Spotlight Social Media Feeds - Version 0.1

Version Description

Download this release

Release Info

Developer Mekku
Plugin Icon 128x128 Spotlight Social Media Feeds
Version 0.1
Comparing to
See all releases

Version 0.1

Files changed (105) hide show
  1. core/Actions/AuthCallbackListener.php +114 -0
  2. core/Actions/CleanUpMediaAction.php +75 -0
  3. core/Actions/ImportMediaAction.php +57 -0
  4. core/Actions/RefreshAccessTokensAction.php +67 -0
  5. core/Actions/RenderShortcode.php +75 -0
  6. core/Config/ConfigEntry.php +33 -0
  7. core/Config/ConfigSet.php +119 -0
  8. core/Config/WpOption.php +84 -0
  9. core/Di/ConfigService.php +32 -0
  10. core/Di/Container.php +138 -0
  11. core/Di/NotFoundException.php +15 -0
  12. core/Di/OverrideExtension.php +36 -0
  13. core/Feeds/Feed.php +119 -0
  14. core/Feeds/FeedTemplate.php +48 -0
  15. core/Feeds/FeedWidget.php +136 -0
  16. core/IgApi/AccessToken.php +74 -0
  17. core/IgApi/IgAccount.php +63 -0
  18. core/IgApi/IgApiClient.php +81 -0
  19. core/IgApi/IgApiUtils.php +278 -0
  20. core/IgApi/IgBasicApiClient.php +248 -0
  21. core/IgApi/IgComment.php +143 -0
  22. core/IgApi/IgGraphApiClient.php +157 -0
  23. core/IgApi/IgMedia.php +313 -0
  24. core/IgApi/IgUser.php +221 -0
  25. core/MediaStore/Fetchers/AccountMediaFetcher.php +68 -0
  26. core/MediaStore/IgCachedMedia.php +147 -0
  27. core/MediaStore/MediaFetcherInterface.php +27 -0
  28. core/MediaStore/MediaProcessorInterface.php +26 -0
  29. core/MediaStore/MediaSource.php +104 -0
  30. core/MediaStore/MediaStore.php +344 -0
  31. core/MediaStore/Processors/MediaSorterProcessor.php +115 -0
  32. core/Module.php +24 -0
  33. core/Plugin.php +172 -0
  34. core/PostTypes/AccountPostType.php +244 -0
  35. core/PostTypes/FeedPostType.php +143 -0
  36. core/PostTypes/MediaPostType.php +166 -0
  37. core/PrefixingModule.php +177 -0
  38. core/RestApi/Auth/AuthUserCapability.php +53 -0
  39. core/RestApi/Auth/AuthVerifyNonce.php +63 -0
  40. core/RestApi/AuthGuardInterface.php +27 -0
  41. core/RestApi/EndPoint.php +105 -0
  42. core/RestApi/EndPointManager.php +96 -0
  43. core/RestApi/EndPoints/AbstractEndpointHandler.php +137 -0
  44. core/RestApi/EndPoints/Accounts/ConnectAccountEndPoint.php +69 -0
  45. core/RestApi/EndPoints/Accounts/DeleteAccountEndPoint.php +74 -0
  46. core/RestApi/EndPoints/Accounts/DeleteAccountMediaEndpoint.php +95 -0
  47. core/RestApi/EndPoints/Accounts/GetAccessTokenEndPoint.php +61 -0
  48. core/RestApi/EndPoints/Accounts/GetAccountsEndPoint.php +109 -0
  49. core/RestApi/EndPoints/Accounts/UpdateAccountEndPoint.php +73 -0
  50. core/RestApi/EndPoints/Feeds/DeleteFeedsEndpoint.php +63 -0
  51. core/RestApi/EndPoints/Feeds/GetFeedsEndpoint.php +71 -0
  52. core/RestApi/EndPoints/Feeds/SaveFeedsEndpoint.php +80 -0
  53. core/RestApi/EndPoints/Front/FrontEndpoint.php +20 -0
  54. core/RestApi/EndPoints/Media/FetchMediaEndPoint.php +75 -0
  55. core/RestApi/EndPoints/Media/GetMediaEndPoint.php +91 -0
  56. core/RestApi/EndPoints/Settings/GetSettingsEndpoint.php +45 -0
  57. core/RestApi/EndPoints/Settings/PatchSettingsEndpoint.php +59 -0
  58. core/RestApi/Transformers/AccountTransformer.php +82 -0
  59. core/RestApi/Transformers/CamelCaseTransformer.php +74 -0
  60. core/RestApi/Transformers/CompositeTransformer.php +49 -0
  61. core/RestApi/Transformers/FeedsTransformer.php +59 -0
  62. core/RestApi/Transformers/MediaTransformer.php +81 -0
  63. core/RestApi/Transformers/RecursiveToArrayTransformer.php +65 -0
  64. core/Utils/Arrays.php +361 -0
  65. core/Wp/AdminPage.php +68 -0
  66. core/Wp/Asset.php +170 -0
  67. core/Wp/CronJob.php +173 -0
  68. core/Wp/Menu.php +119 -0
  69. core/Wp/MetaField.php +82 -0
  70. core/Wp/PostType.php +248 -0
  71. core/Wp/Shortcode.php +72 -0
  72. core/Wp/SubMenu.php +147 -0
  73. core/Wp/Transient.php +91 -0
  74. modules.php +31 -0
  75. modules/AccountsModule.php +80 -0
  76. modules/CleanUpCronModule.php +110 -0
  77. modules/ConfigModule.php +56 -0
  78. modules/Dev/DevClearLog.php +30 -0
  79. modules/Dev/DevDeleteMedia.php +61 -0
  80. modules/Dev/DevModule.php +123 -0
  81. modules/Dev/DevPage.php +319 -0
  82. modules/Dev/DevResetDb.php +90 -0
  83. modules/Dev/ServiceTree.php +284 -0
  84. modules/FeedsModule.php +75 -0
  85. modules/ImportCronModule.php +106 -0
  86. modules/InstagramModule.php +139 -0
  87. modules/MediaModule.php +124 -0
  88. modules/RestApiModule.php +318 -0
  89. modules/ShortcodeModule.php +54 -0
  90. modules/TokenRefresherModule.php +93 -0
  91. modules/UiModule.php +306 -0
  92. modules/WidgetModule.php +58 -0
  93. modules/WordPressModule.php +77 -0
  94. plugin.php +170 -0
  95. readme.txt +187 -0
  96. ui/.babelrc +14 -0
  97. ui/.browserslistrc +2 -0
  98. ui/dist/admin-app.js +1 -0
  99. ui/dist/admin-common.js +1 -0
  100. ui/dist/assets/grid.png +0 -0
  101. ui/dist/assets/ig-type-sprites.png +0 -0
  102. ui/dist/assets/spotlight-200w.png +0 -0
  103. ui/dist/assets/spotlight-800w.png +0 -0
  104. ui/dist/assets/widget.png +0 -0
  105. ui/dist/common.js +2 -0
core/Actions/AuthCallbackListener.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Actions;
4
+
5
+ use RebelCode\Spotlight\Instagram\IgApi\AccessToken;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgAccount;
7
+ use RebelCode\Spotlight\Instagram\IgApi\IgApiClient;
8
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
9
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
10
+
11
+ /**
12
+ * Listens for requests from the auth server to insert connected accounts into the database.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class AuthCallbackListener
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var IgApiClient
22
+ */
23
+ protected $api;
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var PostType
29
+ */
30
+ protected $cpt;
31
+
32
+ /**
33
+ * @since 0.1
34
+ *
35
+ * @var string
36
+ */
37
+ protected $businessAuthUrl;
38
+
39
+ /**
40
+ * Constructor.
41
+ *
42
+ * @since 0.1
43
+ *
44
+ * @param IgApiClient $api The API client.
45
+ * @param PostType $cpt The accounts post type.
46
+ * @param string $businessAuthUrl The URL for the business auth dialog.
47
+ */
48
+ public function __construct(IgApiClient $api, PostType $cpt, string $businessAuthUrl)
49
+ {
50
+ $this->api = $api;
51
+ $this->cpt = $cpt;
52
+ $this->businessAuthUrl = $businessAuthUrl;
53
+ }
54
+
55
+ /**
56
+ * @since 0.1
57
+ */
58
+ public function __invoke()
59
+ {
60
+ if (!isset($_GET['sli_connect'])) {
61
+ return;
62
+ }
63
+
64
+ // Get access token
65
+ $tokenData = $_GET['access_token'];
66
+ $tokenCode = $tokenData['code'];
67
+ $tokenExpiry = $tokenData['expiry'];
68
+ $token = new AccessToken($tokenCode, $tokenExpiry);
69
+
70
+ // Check if connecting a business account
71
+ $isBusiness = filter_input(INPUT_GET, 'business', FILTER_VALIDATE_BOOLEAN);
72
+
73
+ if ($isBusiness) {
74
+ $pageId = filter_input(INPUT_GET, 'page_id');
75
+ $pageName = filter_input(INPUT_GET, 'page_name');
76
+
77
+ $account = $this->api->getGraphApi()->getAccountForPage($pageId, $token);
78
+
79
+ if ($account === null) {
80
+ $message = sprintf(
81
+ '%s does not have an associated Instagram account',
82
+ "<strong>{$pageName}</strong>"
83
+ );
84
+
85
+ $dieHtml = sprintf('<p>%2$s</p><p><a href="%1$s">%3$s</a></p>',
86
+ $this->businessAuthUrl,
87
+ $message,
88
+ 'Choose another page'
89
+ );
90
+
91
+ wp_die($dieHtml, 'Spotlight Instagram - Connection Failed');
92
+ }
93
+ } else {
94
+ $user = $this->api->getBasicApi()->getTokenUser($token);
95
+ $account = new IgAccount($user, $token);
96
+ }
97
+
98
+ $accountId = AccountPostType::insertOrUpdate($this->cpt, $account);
99
+
100
+ ?>
101
+ <script type="text/javascript">
102
+ setTimeout(function () {
103
+ if (window.opener && window.opener.SliAccountManagerState) {
104
+ window.opener.SliAccountManagerState.connectSuccess = true;
105
+ window.opener.SliAccountManagerState.connectedId = <?= $accountId ?? 'null' ?>;
106
+ }
107
+ window.close();
108
+ }, 500);
109
+ </script>
110
+ <?php
111
+
112
+ die;
113
+ }
114
+ }
core/Actions/CleanUpMediaAction.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Actions;
4
+
5
+ use RebelCode\Spotlight\Instagram\Config\ConfigSet;
6
+ use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
7
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
8
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
9
+ use WP_Post;
10
+
11
+ /**
12
+ * The action that cleans up old media.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class CleanUpMediaAction
17
+ {
18
+ /**
19
+ * Config key for the age limit.
20
+ *
21
+ * @since 0.1
22
+ */
23
+ const CFG_AGE_LIMIT = 'cleanerAgeLimit';
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var PostType
29
+ */
30
+ protected $cpt;
31
+
32
+ /**
33
+ * @since 0.1
34
+ *
35
+ * @var ConfigSet
36
+ */
37
+ protected $config;
38
+
39
+ /**
40
+ * Constructor.
41
+ *
42
+ * @since 0.1
43
+ *
44
+ * @param PostType $cpt The media post type.
45
+ * @param ConfigSet $config The config set.
46
+ */
47
+ public function __construct(PostType $cpt, ConfigSet $config)
48
+ {
49
+ $this->cpt = $cpt;
50
+ $this->config = $config;
51
+ }
52
+
53
+ /**
54
+ * @since 0.1
55
+ */
56
+ public function __invoke()
57
+ {
58
+ $ageLimit = $this->config->get(static::CFG_AGE_LIMIT)->getValue();
59
+ $ageTime = strtotime($ageLimit . ' ago');
60
+
61
+ $oldMedia = $this->cpt->query([
62
+ 'meta_query' => [
63
+ [
64
+ 'key' => MediaPostType::LAST_REQUESTED,
65
+ 'compare' => '<=',
66
+ 'value' => $ageTime,
67
+ ],
68
+ ],
69
+ ]);
70
+
71
+ Arrays::each($oldMedia, function (WP_Post $post) {
72
+ wp_delete_post($post->ID);
73
+ });
74
+ }
75
+ }
core/Actions/ImportMediaAction.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Actions;
4
+
5
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaStore;
6
+ use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
7
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
8
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
9
+ use WP_Post;
10
+
11
+ /**
12
+ * The action that imports media for all saved accounts.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class ImportMediaAction
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var PostType
22
+ */
23
+ protected $cpt;
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var MediaStore
29
+ */
30
+ protected $store;
31
+
32
+ /**
33
+ * Constructor.
34
+ *
35
+ * @since 0.1
36
+ *
37
+ * @param PostType $cpt The feeds post type.
38
+ * @param MediaStore $store The media store.
39
+ */
40
+ public function __construct(PostType $cpt, MediaStore $store)
41
+ {
42
+ $this->cpt = $cpt;
43
+ $this->store = $store;
44
+ }
45
+
46
+ /**
47
+ * @since 0.1
48
+ */
49
+ public function __invoke()
50
+ {
51
+ $feeds = $this->cpt->query();
52
+
53
+ Arrays::each($feeds, function (WP_Post $post) {
54
+ $this->store->getFeedMedia(FeedPostType::fromWpPost($post));
55
+ });
56
+ }
57
+ }
core/Actions/RefreshAccessTokensAction.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Actions;
4
+
5
+ use Exception;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgAccount;
7
+ use RebelCode\Spotlight\Instagram\IgApi\IgApiClient;
8
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
9
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
10
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
11
+ use WP_Post;
12
+
13
+ /**
14
+ * The action that refreshes the access tokens for all saved accounts.
15
+ *
16
+ * @since 0.1
17
+ */
18
+ class RefreshAccessTokensAction
19
+ {
20
+ /**
21
+ * @since 0.1
22
+ *
23
+ * @var IgApiClient
24
+ */
25
+ protected $api;
26
+
27
+ /**
28
+ * @since 0.1
29
+ *
30
+ * @var PostType
31
+ */
32
+ protected $cpt;
33
+
34
+ /**
35
+ * Constructor.
36
+ *
37
+ * @since 0.1
38
+ *
39
+ * @param IgApiClient $api The Instagram API client.
40
+ * @param PostType $cpt The accounts post type.
41
+ */
42
+ public function __construct(IgApiClient $api, PostType $cpt)
43
+ {
44
+ $this->api = $api;
45
+ $this->cpt = $cpt;
46
+ }
47
+
48
+ /**
49
+ * @since 0.1
50
+ */
51
+ public function __invoke()
52
+ {
53
+ Arrays::each($this->cpt->query(), function (WP_Post $post) {
54
+ $account = AccountPostType::fromWpPost($post);
55
+ try {
56
+ $accessToken = $this->api->getBasicApi()->refreshAccessToken($account->getAccessToken());
57
+
58
+ $newAccount = new IgAccount($account->getUser(), $accessToken);
59
+ $newPost = AccountPostType::toWpPost($newAccount);
60
+
61
+ $this->cpt->update($post->ID, $newPost);
62
+ } catch (Exception $exception) {
63
+ return;
64
+ }
65
+ });
66
+ }
67
+ }
core/Actions/RenderShortcode.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Actions;
4
+
5
+ use Dhii\Output\TemplateInterface;
6
+ use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
7
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
8
+ use WP_Post;
9
+
10
+ /**
11
+ * The action that renders the content for the shortcode.
12
+ *
13
+ * @since 0.1
14
+ */
15
+ class RenderShortcode
16
+ {
17
+ /**
18
+ * @since 0.1
19
+ *
20
+ * @var PostType
21
+ */
22
+ protected $cpt;
23
+
24
+ /**
25
+ * @since 0.1
26
+ *
27
+ * @var TemplateInterface
28
+ */
29
+ protected $template;
30
+
31
+ /**
32
+ * Constructor.
33
+ *
34
+ * @since 0.1
35
+ *
36
+ * @param PostType $cpt The feeds post type.
37
+ * @param TemplateInterface $template The template to use for rendering.
38
+ */
39
+ public function __construct(PostType $cpt, TemplateInterface $template)
40
+ {
41
+ $this->cpt = $cpt;
42
+ $this->template = $template;
43
+ }
44
+
45
+ /**
46
+ * Renders the content for the shortcode.
47
+ *
48
+ * @since 0.1
49
+ *
50
+ * @param array $args The render arguments.
51
+ *
52
+ * @return string The rendered content.
53
+ */
54
+ public function __invoke($args)
55
+ {
56
+ $options = $args;
57
+
58
+ // If the "feed" arg is given, get the feed for that ID and merge its options with the other args
59
+ if (array_key_exists('feed', $options)) {
60
+ $feedId = $options['feed'];
61
+ $feedPost = $this->cpt->get($feedId);
62
+
63
+ if ($feedPost instanceof WP_Post) {
64
+ unset($options['feed']);
65
+ $options = array_merge($options, $feedPost->{FeedPostType::OPTIONS});
66
+ } else {
67
+ return is_user_logged_in()
68
+ ? "<p>There is no feed with ID {$feedId} <small>(only admins can see this message)</small></p>"
69
+ : '';
70
+ }
71
+ }
72
+
73
+ return $this->template->render($options);
74
+ }
75
+ }
core/Config/ConfigEntry.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Config;
4
+
5
+ /**
6
+ * Represents a single config entry.
7
+ *
8
+ * A config entry is an entity that controls where and how a certain config value is stored or read from. This is
9
+ * used in conjunction with {@link ConfigSet} to provide configuration that is customizable at a per-entry level.
10
+ *
11
+ * @since 0.1
12
+ * @see ConfigSet
13
+ */
14
+ interface ConfigEntry
15
+ {
16
+ /**
17
+ * Retrieves the value for this config entry.
18
+ *
19
+ * @since 0.1
20
+ *
21
+ * @return mixed
22
+ */
23
+ public function getValue();
24
+
25
+ /**
26
+ * Sets the value for this config entry.
27
+ *
28
+ * @since 0.1
29
+ *
30
+ * @param mixed $value The value to set.
31
+ */
32
+ public function setValue($value);
33
+ }
core/Config/ConfigSet.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Config;
4
+
5
+ use OutOfBoundsException;
6
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
7
+
8
+ /**
9
+ * A set of configuration entries.
10
+ *
11
+ * This container-like implementation allows consumers to retrieve {@link ConfigService} instances, which in turn allow
12
+ * for the reading and writing of config entries. The config set does not dictate where and how each config entry
13
+ * stores or reads its values to/from; that is left up to each entry in order to allow the config to be customizable on
14
+ * a per-entry level.
15
+ *
16
+ * The set may optionally be configured with a "default" callback. This callback will be invoked with a requested entry
17
+ * key in the event that the set does not contain an entry for that key. The callback, if given, can create a new
18
+ * {@link ConfigService} instance. This can be useful for non-strict storage systems that allow for entries to be
19
+ * dynamically declared (such as WP Options).
20
+ *
21
+ * @since 0.1
22
+ * @see ConfigService
23
+ */
24
+ class ConfigSet
25
+ {
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var ConfigEntry[]
30
+ */
31
+ protected $entries;
32
+
33
+ /**
34
+ * @since 0.1
35
+ *
36
+ * @var callable|null
37
+ */
38
+ protected $default;
39
+
40
+ /**
41
+ * Constructor.
42
+ *
43
+ * @since 0.1
44
+ *
45
+ * @param ConfigEntry[] $entries The config entries.
46
+ * @param callable|null $default Optional callback to invoke when the config set does not have an entry for a
47
+ * given key. The key will be passed as argument, and the callback is expected to
48
+ * return a {@link ConfigService} instance, or throw a {@link OutOfBoundsException}.
49
+ */
50
+ public function __construct(array $entries, ?callable $default = null)
51
+ {
52
+ $this->entries = $entries;
53
+ $this->default = $default;
54
+ }
55
+
56
+ /**
57
+ * Retrieves a config entry by key.
58
+ *
59
+ * @since 0.1
60
+ *
61
+ * @param string $key The key that maps to the config entry to be returned.
62
+ *
63
+ * @return ConfigEntry
64
+ *
65
+ * @throws OutOfBoundsException If the key does not map to a config entry.
66
+ */
67
+ public function get(string $key) : ConfigEntry
68
+ {
69
+ if ($this->has($key)) {
70
+ return $this->entries[$key];
71
+ }
72
+
73
+ if ($this->default !== null) {
74
+ return ($this->default)($key);
75
+ }
76
+
77
+ throw new OutOfBoundsException("Undefined config for key \"${key}\"");
78
+ }
79
+
80
+ /**
81
+ * Checks if a the set has a config entry for a given key.
82
+ *
83
+ * @since 0.1
84
+ *
85
+ * @param string $key The key to check for.
86
+ *
87
+ * @return bool True if the set has a config entry for the given key, false if not.
88
+ */
89
+ public function has(string $key) : bool
90
+ {
91
+ return array_key_exists($key, $this->entries);
92
+ }
93
+
94
+ /**
95
+ * Retrieves the entire list of entries.
96
+ *
97
+ * @since 0.1
98
+ *
99
+ * @return ConfigEntry[]
100
+ */
101
+ public function getEntries() : array
102
+ {
103
+ return $this->entries;
104
+ }
105
+
106
+ /**
107
+ * Retrieves the entire set of values for all entries.
108
+ *
109
+ * @since 0.1
110
+ *
111
+ * @return array
112
+ */
113
+ public function getValues()
114
+ {
115
+ return Arrays::map($this->entries, function (ConfigEntry $entry) {
116
+ return $entry->getValue();
117
+ });
118
+ }
119
+ }
core/Config/WpOption.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Config;
4
+
5
+ /**
6
+ * A config entry implementation that uses WordPress Options for storage.
7
+ *
8
+ * @since 0.1
9
+ * @see ConfigService
10
+ */
11
+ class WpOption implements ConfigEntry
12
+ {
13
+ /**
14
+ * @since 0.1
15
+ *
16
+ * @var string
17
+ */
18
+ protected $key;
19
+
20
+ /**
21
+ * @since 0.1
22
+ *
23
+ * @var mixed
24
+ */
25
+ protected $default;
26
+
27
+ /**
28
+ * Constructor.
29
+ *
30
+ * @since 0.1
31
+ *
32
+ * @param string $key The option key.
33
+ * @param mixed $default The default value for this option.
34
+ */
35
+ public function __construct(string $key, $default = null)
36
+ {
37
+ $this->key = $key;
38
+ $this->default = $default;
39
+ }
40
+
41
+ /**
42
+ * Retrieves the key of the option.
43
+ *
44
+ * @since 0.1
45
+ *
46
+ * @return string
47
+ */
48
+ public function getKey() : string
49
+ {
50
+ return $this->key;
51
+ }
52
+
53
+ /**
54
+ * Retrieves the default value of the option.
55
+ *
56
+ * @since 0.1
57
+ *
58
+ * @return mixed
59
+ */
60
+ public function getDefault()
61
+ {
62
+ return $this->default;
63
+ }
64
+
65
+ /**
66
+ * @inheritDoc
67
+ *
68
+ * @since 0.1
69
+ */
70
+ public function getValue()
71
+ {
72
+ return get_option($this->key, $this->default);
73
+ }
74
+
75
+ /**
76
+ * @inheritDoc
77
+ *
78
+ * @since 0.1
79
+ */
80
+ public function setValue($value)
81
+ {
82
+ return update_option($this->key, $value, false);
83
+ }
84
+ }
core/Di/ConfigService.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Di;
4
+
5
+ use Dhii\Services\Factory;
6
+ use RebelCode\Spotlight\Instagram\Config\ConfigEntry;
7
+ use RebelCode\Spotlight\Instagram\Config\ConfigSet;
8
+
9
+ /**
10
+ * A service factory helper that automatically resolves to the value of a config entry.
11
+ *
12
+ * @since 0.1
13
+ * @see ConfigSet
14
+ * @see ConfigEntry
15
+ */
16
+ class ConfigService extends Factory
17
+ {
18
+ /**
19
+ * Constructor.
20
+ *
21
+ * @since 0.1
22
+ *
23
+ * @param string $configSet The config set from which to read the entry.
24
+ * @param string $key The key of the entry whose value to resolve to.
25
+ */
26
+ public function __construct(string $configSet, string $key)
27
+ {
28
+ parent::__construct([$configSet], function (ConfigSet $configSet) use ($key) {
29
+ return $configSet->get($key)->getValue();
30
+ });
31
+ }
32
+ }
core/Di/Container.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Di;
4
+
5
+ use Dhii\Modular\Module\ExtensionInterface;
6
+ use Dhii\Modular\Module\FactoryInterface;
7
+ use LogicException;
8
+ use Psr\Container\ContainerInterface;
9
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
10
+
11
+ /**
12
+ * The container implementation for the services provided by the plugin's modules.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class Container implements ContainerInterface
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var FactoryInterface[]
22
+ */
23
+ protected $factories;
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var ExtensionInterface[]
29
+ */
30
+ protected $extensions;
31
+
32
+ /**
33
+ * @since 0.1
34
+ *
35
+ * @var array
36
+ */
37
+ protected $cache;
38
+
39
+ /**
40
+ * @since 0.1
41
+ *
42
+ * @var string
43
+ */
44
+ protected $filterPrefix;
45
+
46
+ /**
47
+ * Constructor.
48
+ *
49
+ * @since 0.1
50
+ *
51
+ * @param string $filterPrefix The prefix to use for WordPress filters when services are created.
52
+ * @param FactoryInterface[] $factories The service factories.
53
+ * @param ExtensionInterface[] $extensions The service extensions.
54
+ */
55
+ public function __construct(string $filterPrefix, array $factories, array $extensions)
56
+ {
57
+ $this->factories = $factories;
58
+ $this->extensions = $extensions;
59
+ $this->cache = [];
60
+ $this->filterPrefix = $filterPrefix;
61
+ }
62
+
63
+ /**
64
+ * @inheritDoc
65
+ *
66
+ * @since 0.1
67
+ */
68
+ public function get($id)
69
+ {
70
+ static $fetching = [];
71
+
72
+ // Circular dependency detection
73
+ if (isset($fetching[$id])) {
74
+ $i = 0;
75
+ $trace = array_map(function ($id) use (&$i) {
76
+ return '#' . $i++ . ' ' . $id;
77
+ }, array_reverse(array_keys($fetching)));
78
+
79
+ $trace = implode("\n", $trace);
80
+
81
+ throw new LogicException("Circular dependency detected for \"${id}\", required by:\n${trace}");
82
+ }
83
+
84
+ $fetching[$id] = true;
85
+
86
+ try {
87
+ return $this->actualGet($id);
88
+ } finally {
89
+ unset($fetching[$id]);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Internal method that performs the actual service resolution.
95
+ *
96
+ * @since 0.1
97
+ *
98
+ * @param string $key The service key.
99
+ *
100
+ * @return mixed The created service value.
101
+ * @throws NotFoundException If no service with the given key was found.
102
+ */
103
+ protected function actualGet($key)
104
+ {
105
+ if (!$this->has($key)) {
106
+ throw new NotFoundException("Service \"$key\" does not exist");
107
+ }
108
+
109
+ if (!array_key_exists($key, $this->cache)) {
110
+ $service = ($this->factories[$key])($this);
111
+
112
+ if (array_key_exists($key, $this->extensions)) {
113
+ $service = ($this->extensions[$key])($this, $service);
114
+ }
115
+
116
+ $this->cache[$key] = apply_filters($this->filterPrefix . '/' . $key, $service);
117
+ }
118
+
119
+ return $this->cache[$key];
120
+ }
121
+
122
+ /**
123
+ * @inheritDoc
124
+ *
125
+ * @since 0.1
126
+ */
127
+ public function has($id)
128
+ {
129
+ return array_key_exists($id, $this->factories);
130
+ }
131
+
132
+ public static function fetchTraceAsString(array $trace)
133
+ {
134
+ return Arrays::join($trace, " -> ", function ($val, $key) {
135
+ return $key;
136
+ });
137
+ }
138
+ }
core/Di/NotFoundException.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Di;
4
+
5
+ use Exception;
6
+ use Psr\Container\NotFoundExceptionInterface;
7
+
8
+ /**
9
+ * Implementation of an exception when a service is not found in a DI container.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ class NotFoundException extends Exception implements NotFoundExceptionInterface
14
+ {
15
+ }
core/Di/OverrideExtension.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Di;
4
+
5
+ use Dhii\Services\Service;
6
+ use Psr\Container\ContainerInterface;
7
+
8
+ /**
9
+ * A service helper for extensions that completely override an existing service.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ class OverrideExtension extends Service
14
+ {
15
+ /**
16
+ * Constructor.
17
+ *
18
+ * @since 0.1
19
+ *
20
+ * @param string $replacement The key of the service that will be used to replace the original when extended.
21
+ */
22
+ public function __construct(string $replacement)
23
+ {
24
+ parent::__construct([$replacement]);
25
+ }
26
+
27
+ /**
28
+ * @inheritDoc
29
+ *
30
+ * @since 0.1
31
+ */
32
+ public function __invoke(ContainerInterface $c)
33
+ {
34
+ return $this->resolveKeys($c, $this->dependencies)[0];
35
+ }
36
+ }
core/Feeds/Feed.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Feeds;
4
+
5
+ /**
6
+ * Represents a feed saved in the database.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class Feed
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var int|null
16
+ */
17
+ protected $id;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var string
23
+ */
24
+ protected $name;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var array
30
+ */
31
+ protected $options;
32
+
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @since 0.1
37
+ *
38
+ * @param int|null $id The ID of the feed in the database.
39
+ * @param string $name The user-given name for the feed.
40
+ * @param array $options The options for the feed, which control rendering.
41
+ */
42
+ public function __construct(?int $id, string $name = '', array $options = [])
43
+ {
44
+ $this->id = $id;
45
+ $this->name = $name;
46
+ $this->options = $options;
47
+ }
48
+
49
+ /**
50
+ * Retrieves the ID of the feed.
51
+ *
52
+ * @since 0.1
53
+ *
54
+ * @return int|null
55
+ */
56
+ public function getId() : ?int
57
+ {
58
+ return $this->id;
59
+ }
60
+
61
+ /**
62
+ * Retrieves the name of the feed.
63
+ *
64
+ * @since 0.1
65
+ *
66
+ * @return string
67
+ */
68
+ public function getName() : string
69
+ {
70
+ return $this->name;
71
+ }
72
+
73
+ /**
74
+ * Retrieves the options for this feed.
75
+ *
76
+ * @since 0.1
77
+ *
78
+ * @return array
79
+ */
80
+ public function getOptions() : array
81
+ {
82
+ return $this->options;
83
+ }
84
+
85
+ /**
86
+ * Retrieves a single option, optionally defaulting to a specific value.
87
+ *
88
+ * @since 0.1
89
+ *
90
+ * @param string $key The key of the option to retrieve.
91
+ * @param mixed $default Optional value to return if no option is found for the given $key.
92
+ *
93
+ * @return mixed|null The value for the option that corresponds to the given $key, or $default if not found.
94
+ */
95
+ public function getOption(string $key, $default = null)
96
+ {
97
+ return array_key_exists($key, $this->options)
98
+ ? $this->options[$key]
99
+ : $default;
100
+ }
101
+
102
+ /**
103
+ * Creates a feed instance from an array.
104
+ *
105
+ * @since 0.1
106
+ *
107
+ * @param array $data The array from which to create the feed.
108
+ *
109
+ * @return Feed The created feed instance.
110
+ */
111
+ public static function fromArray(array $data)
112
+ {
113
+ $id = $data['id'] ?? null;
114
+ $name = $data['name'] ?? '';
115
+ $options = $data['options'] ?? [];
116
+
117
+ return new Feed($id, $name, $options);
118
+ }
119
+ }
core/Feeds/FeedTemplate.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Feeds;
4
+
5
+ use Dhii\Output\TemplateInterface;
6
+
7
+ /**
8
+ * The template that renders a feed.
9
+ *
10
+ * @since 0.1
11
+ */
12
+ class FeedTemplate implements TemplateInterface
13
+ {
14
+ /**
15
+ * @inheritDoc
16
+ *
17
+ * @since 0.1
18
+ */
19
+ public function render($ctx = null)
20
+ {
21
+ if (!is_array($ctx)) {
22
+ return '';
23
+ }
24
+
25
+ // Convert the options into JSON
26
+ $feedJson = json_encode($ctx);
27
+ // The name of the JS variable to use
28
+ $varName = uniqid('feed');
29
+
30
+ // Output the required HTML and JS
31
+ ob_start();
32
+ ?>
33
+ <div class="spotlight-instagram-feed" data-feed-var="<?= $varName ?>"></div>
34
+ <script type="text/javascript">
35
+ if (!window.SliFrontCtx) {
36
+ window.SliFrontCtx = {};
37
+ }
38
+
39
+ window.SliFrontCtx["<?= $varName ?>"] = <?= $feedJson ?>;
40
+ </script>
41
+ <?php
42
+
43
+ // Trigger the action that will enqueue the required JS bundles
44
+ do_action('spotlight/instagram/enqueue_front_app');
45
+
46
+ return ob_get_clean();
47
+ }
48
+ }
core/Feeds/FeedWidget.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Feeds;
4
+
5
+ use RebelCode\Spotlight\Instagram\Actions\RenderShortcode;
6
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
7
+ use WP_Widget;
8
+
9
+ /**
10
+ * A widget that renders a feed in the same way as the shortcode.
11
+ *
12
+ * @since 0.1
13
+ */
14
+ class FeedWidget extends WP_Widget
15
+ {
16
+ /**
17
+ * @since 0.1
18
+ *
19
+ * @var PostType
20
+ */
21
+ public static $cpt;
22
+
23
+ /**
24
+ * @since 0.1
25
+ *
26
+ * @var RenderShortcode
27
+ */
28
+ public static $shortcode;
29
+
30
+ /**
31
+ * Constructor.
32
+ *
33
+ * @since 0.1
34
+ */
35
+ public function __construct()
36
+ {
37
+ parent::__construct('sli-feed', 'Spotlight Instagram Feed', [
38
+ 'description' => 'Show an Instagram feed in a widget',
39
+ ]);
40
+ }
41
+
42
+ /**
43
+ * @inheritDoc
44
+ *
45
+ * @since 0.1
46
+ */
47
+ public function widget($args, $instance)
48
+ {
49
+ $instance = wp_parse_args($instance, $this->getDefaults(static::$cpt->query()));
50
+
51
+ if (empty($instance['feed'])) {
52
+ return;
53
+ }
54
+
55
+ $feedId = $instance['feed'];
56
+ $render = static::$shortcode;
57
+
58
+ echo $args['before_widget'];
59
+ echo $args['before_title'] . ($instance['title'] ?? '') . $args['after_title'];
60
+
61
+ echo $render(['feed' => $feedId]);
62
+
63
+ echo $args['after_widget'];
64
+ }
65
+
66
+ /**
67
+ * @inheritDoc
68
+ *
69
+ * @since 0.1
70
+ */
71
+ public function form($instance)
72
+ {
73
+ $feeds = static::$cpt->query();
74
+ $instance = wp_parse_args($instance, $this->getDefaults($feeds));
75
+
76
+ $title = $instance['title'] ?? '';
77
+ $titleHtmlId = $this->get_field_id('title');
78
+ $titleHtmlName = $this->get_field_name('title');
79
+
80
+ $feed = $instance['feed'] ?? '';
81
+ $feedHtmlId = $this->get_field_id('feed');
82
+ $feedHtmlName = $this->get_field_name('feed');
83
+
84
+ ?>
85
+ <p>
86
+ <label for="<?= $titleHtmlId ?>" style="margin-right: 5px;">Title:</label>
87
+ <input type="text"
88
+ id="<?= $titleHtmlId ?>"
89
+ name="<?= $titleHtmlName ?>"
90
+ value="<?= esc_attr($title) ?>"
91
+ class="widefat" />
92
+ </p>
93
+
94
+ <p>
95
+ <label for="<?= $feedHtmlId ?>" style="margin-right: 5px;">
96
+ Choose the feed to show:
97
+ </label>
98
+ <select id="<?= $feedHtmlId ?>" name="<?= $feedHtmlName ?>" class="widefat">
99
+ <?php foreach ($feeds as $post): ?>
100
+ <option value="<?= $post->ID ?>" <?= selected($feed, $post->ID, false) ?>>
101
+ <?= $post->post_title ?>
102
+ </option>
103
+ <?php endforeach ?>
104
+ </select>
105
+ </p>
106
+ <?php
107
+
108
+ }
109
+
110
+ /**
111
+ * @inheritDoc
112
+ *
113
+ * @since 0.1
114
+ */
115
+ public function update($instance, $prev)
116
+ {
117
+ return $instance;
118
+ }
119
+
120
+ /**
121
+ * Retrieves the default values for the widget.
122
+ *
123
+ * @since 0.1
124
+ *
125
+ * @param array $feeds The list of feeds in the database.
126
+ *
127
+ * @return array An associative array of default values.
128
+ */
129
+ public function getDefaults(array $feeds = [])
130
+ {
131
+ return [
132
+ 'title' => 'Instagram',
133
+ 'feed' => count($feeds) > 0 ? $feeds[0]->ID : '',
134
+ ];
135
+ }
136
+ }
core/IgApi/AccessToken.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ /**
6
+ * Represents an API access token for an Instagram account.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class AccessToken
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var string
16
+ */
17
+ protected $code;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var int
23
+ */
24
+ protected $expires;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param string $code The access token code.
32
+ * @param int $expires The timestamp for when the access code expires.
33
+ */
34
+ public function __construct(string $code, int $expires)
35
+ {
36
+ $this->code = $code;
37
+ $this->expires = $expires;
38
+ }
39
+
40
+ /**
41
+ * Retrieves the access token code.
42
+ *
43
+ * @since 0.1
44
+ *
45
+ * @return string
46
+ */
47
+ public function getCode() : string
48
+ {
49
+ return $this->code;
50
+ }
51
+
52
+ /**
53
+ * Retrieves the timestamp for when the access token expires.
54
+ * @since 0.1
55
+ *
56
+ * @return int
57
+ */
58
+ public function getExpires() : int
59
+ {
60
+ return $this->expires;
61
+ }
62
+
63
+ /**
64
+ * Converts the access token instance into a string equivalent to its code.
65
+ *
66
+ * @since 0.1
67
+ *
68
+ * @return string
69
+ */
70
+ public function __toString()
71
+ {
72
+ return $this->code;
73
+ }
74
+ }
core/IgApi/IgAccount.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ /**
6
+ * Represents an Instagram account; a tuple of an {@link IgUser} and an {@link AccessToken}.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class IgAccount
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var IgUser
16
+ */
17
+ protected $user;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var AccessToken
23
+ */
24
+ protected $accessToken;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param IgUser $user The user instance.
32
+ * @param AccessToken $accessToken The access token.
33
+ */
34
+ public function __construct(IgUser $user, AccessToken $accessToken)
35
+ {
36
+ $this->user = $user;
37
+ $this->accessToken = $accessToken;
38
+ }
39
+
40
+ /**
41
+ * Retrieves the user for this account.
42
+ *
43
+ * @since 0.1
44
+ *
45
+ * @return IgUser
46
+ */
47
+ public function getUser() : IgUser
48
+ {
49
+ return $this->user;
50
+ }
51
+
52
+ /**
53
+ * Retrieves the access token for this account.
54
+ *
55
+ * @since 0.1
56
+ *
57
+ * @return AccessToken
58
+ */
59
+ public function getAccessToken() : AccessToken
60
+ {
61
+ return $this->accessToken;
62
+ }
63
+ }
core/IgApi/IgApiClient.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ /**
6
+ * The main API client, for both the Basic Display API and the Graph API.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class IgApiClient
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var IgBasicApiClient
16
+ */
17
+ protected $basicApi;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var IgGraphApiClient
23
+ */
24
+ protected $graphApi;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param IgBasicApiClient $basicApi The client for the Basic Display API.
32
+ * @param IgGraphApiClient $graphApi The client for the Graph API.
33
+ */
34
+ public function __construct(IgBasicApiClient $basicApi, IgGraphApiClient $graphApi)
35
+ {
36
+ $this->basicApi = $basicApi;
37
+ $this->graphApi = $graphApi;
38
+ }
39
+
40
+ /**
41
+ * Retrieves the client for the Basic Display API.
42
+ *
43
+ * @since 0.1
44
+ *
45
+ * @return IgBasicApiClient
46
+ */
47
+ public function getBasicApi() : IgBasicApiClient
48
+ {
49
+ return $this->basicApi;
50
+ }
51
+
52
+ /**
53
+ * Retrieves the client for the Graph API.
54
+ *
55
+ * @since 0.1
56
+ *
57
+ * @return IgGraphApiClient
58
+ */
59
+ public function getGraphApi() : IgGraphApiClient
60
+ {
61
+ return $this->graphApi;
62
+ }
63
+
64
+ /**
65
+ * Retrieves media for a given account, using either the Basic Display or the Graph API depending on user type.
66
+ *
67
+ * @since 0.1
68
+ *
69
+ * @param IgAccount $account The account for which to retrieve media.
70
+ *
71
+ * @return IgMedia[] A list of media objects.
72
+ */
73
+ public function getAccountMedia(IgAccount $account)
74
+ {
75
+ if ($account->getUser()->getType() === IgUser::TYPE_PERSONAL) {
76
+ return $this->basicApi->getMedia($account->getUser()->getId(), $account->getAccessToken());
77
+ }
78
+
79
+ return $this->graphApi->getMedia($account->getUser()->getId(), $account->getAccessToken());
80
+ }
81
+ }
core/IgApi/IgApiUtils.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ use GuzzleHttp\ClientInterface;
6
+ use GuzzleHttp\Exception\GuzzleException;
7
+ use GuzzleHttp\Exception\RequestException;
8
+ use Psr\Http\Message\ResponseInterface;
9
+ use Psr\SimpleCache\CacheInterface;
10
+ use Psr\SimpleCache\InvalidArgumentException as InvalidCacheKeyException;
11
+ use RuntimeException;
12
+
13
+ /**
14
+ * Utilities for the API client.
15
+ *
16
+ * @since 0.1
17
+ */
18
+ class IgApiUtils
19
+ {
20
+ /**
21
+ * Sends a request and detects erroneous IG responses.
22
+ *
23
+ * @since 0.1
24
+ *
25
+ * @param ClientInterface $client The client driver.
26
+ * @param string $method The HTTP method.
27
+ * @param string $uri The URI to send the request to.
28
+ * @param array $options Request options. See Guzzle's docs for available options.
29
+ *
30
+ * @return ResponseInterface The response.
31
+ */
32
+ public static function request(ClientInterface $client, string $method, string $uri, array $options = [])
33
+ {
34
+ try {
35
+ return $client->request($method, $uri, $options);
36
+ } catch (RequestException $e) {
37
+ $body = $e->getResponse()->getBody()->getContents();
38
+ $decoded = json_decode($body, true) ?? [];
39
+ $error = $decoded['error'] ?? $decoded;
40
+ $message = $error['error_description'] ??
41
+ $error['error_message'] ??
42
+ $error['message'] ??
43
+ 'An unknown error occurred';
44
+
45
+ throw new RuntimeException($message);
46
+ } catch (GuzzleException $ge) {
47
+ // Should never be thrown. Catching RequestInterface should cover everything
48
+ throw new RuntimeException('GuzzleException was thrown: ' . $ge->getMessage(), $ge->getCode(), $ge);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Sends a request, or uses a cache.
54
+ *
55
+ * @since 0.1
56
+ *
57
+ * @param CacheInterface $cache The cache instance.
58
+ * @param string $key The key to read responses from or write new responses to.
59
+ * @param callable $getRemote The actual request dispatching function to invoke when the key is not in cache.
60
+ *
61
+ * @return array The parsed response.
62
+ *
63
+ * @throws CacheExceptionInterface
64
+ */
65
+ public static function getCachedResponse(CacheInterface $cache, string $key, callable $getRemote)
66
+ {
67
+ try {
68
+ if ($cache->has($key)) {
69
+ return json_decode($cache->get($key), true);
70
+ }
71
+ } catch (InvalidCacheKeyException $e) {
72
+ // Carry on with normal request
73
+ }
74
+
75
+ $response = ($getRemote)();
76
+
77
+ $result = ($response instanceof ResponseInterface)
78
+ ? static::parseResponse($response)
79
+ : $response;
80
+
81
+ $attempt = 1;
82
+
83
+ do {
84
+ try {
85
+ $cache->set($key, json_encode($result), 1800);
86
+ break;
87
+ } catch (InvalidCacheKeyException $e) {
88
+ // Do nothing
89
+ } catch (CacheExceptionInterface $e) {
90
+ // Do nothing
91
+ }
92
+
93
+ error_log($e->getMessage() . " (attempt $attempt of 3)");
94
+
95
+ $attempt++;
96
+ if ($attempt > 3) {
97
+ break;
98
+ }
99
+ } while (true);
100
+
101
+ return $result;
102
+ }
103
+
104
+ /**
105
+ * Parses an IG response, decoding JSON bodies or detecting errors, if any.
106
+ *
107
+ * @since 0.1
108
+ *
109
+ * @param ResponseInterface $response The response.
110
+ *
111
+ * @return array The decoded JSON response body.
112
+ */
113
+ public static function parseResponse(ResponseInterface $response)
114
+ {
115
+ static::checkResponseStatus($response);
116
+
117
+ $body = $response->getBody()->getContents();
118
+ $decoded = json_decode($body, true);
119
+
120
+ if ($decoded === false) {
121
+ throw new RuntimeException("Received malformed response: {$body}");
122
+ }
123
+
124
+ if (isset($decoded['error']) || isset($decoded['error_message'])) {
125
+ $message = isset($decoded['error'])
126
+ ? $decoded['error_description']
127
+ : $decoded['error_message'];
128
+
129
+ throw new RuntimeException("API error: {$message}");
130
+ }
131
+
132
+ return $decoded;
133
+ }
134
+
135
+ /**
136
+ * Checks a response's status to determine if its an erroneous response.
137
+ *
138
+ * @since 0.1
139
+ *
140
+ * @param ResponseInterface $response
141
+ */
142
+ public static function checkResponseStatus(ResponseInterface $response)
143
+ {
144
+ $statusCode = $response->getStatusCode();
145
+
146
+ if ($statusCode !== 200) {
147
+ $statusPhrase = $response->getReasonPhrase();
148
+ throw new RuntimeException("API responded with {$statusCode} {$statusPhrase}");
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Retrieves the fields available for users from the basic display API.
154
+ *
155
+ * @since 0.1
156
+ *
157
+ * @return string[]
158
+ */
159
+ public static function getBasicUserFields() : array
160
+ {
161
+ return [
162
+ 'id',
163
+ 'username',
164
+ 'media_count',
165
+ 'account_type',
166
+ ];
167
+ }
168
+
169
+ /**
170
+ * Retrieves all the fields available for users from the Graph API.
171
+ *
172
+ * @since 0.1
173
+ *
174
+ * @return string[]
175
+ */
176
+ public static function getGraphUserFields() : array
177
+ {
178
+ return [
179
+ 'id',
180
+ 'username',
181
+ 'name',
182
+ 'biography',
183
+ 'media_count',
184
+ 'followers_count',
185
+ 'follows_count',
186
+ 'profile_picture_url',
187
+ 'website',
188
+ ];
189
+ }
190
+
191
+ /**
192
+ * Retrieves the fields for media objects.
193
+ *
194
+ * @since 0.1
195
+ *
196
+ * @return string[]
197
+ */
198
+ public static function getMediaFields() : array
199
+ {
200
+ $fields = [
201
+ 'id',
202
+ 'username',
203
+ 'timestamp',
204
+ 'caption',
205
+ 'like_count',
206
+ 'comments_count',
207
+ 'media_type',
208
+ 'media_url',
209
+ 'permalink',
210
+ ];
211
+
212
+ $list = implode(',', static::getChildrenMediaFields());
213
+ $fields[] = "children{{$list}}";
214
+
215
+ return $fields;
216
+ }
217
+
218
+ /**
219
+ * Retrieves the fields for media objects from hashtags.
220
+ *
221
+ * @since 0.1
222
+ *
223
+ * @return string[]
224
+ */
225
+ public static function getHashtagMediaFields() : array
226
+ {
227
+ $fields = [
228
+ 'id',
229
+ 'caption',
230
+ 'like_count',
231
+ 'comments_count',
232
+ 'media_type',
233
+ 'media_url',
234
+ 'permalink',
235
+ 'timestamp',
236
+ ];
237
+
238
+ $list = implode(',', static::getChildrenMediaFields());
239
+ $fields[] = "children{{$list}}";
240
+
241
+ return $fields;
242
+ }
243
+
244
+ /**
245
+ * Retrieves the fields for children media objects.
246
+ *
247
+ * @since 0.1
248
+ *
249
+ * @return string[]
250
+ */
251
+ public static function getChildrenMediaFields() : array
252
+ {
253
+ return [
254
+ 'id',
255
+ 'media_url',
256
+ 'media_type',
257
+ 'permalink',
258
+ ];
259
+ }
260
+
261
+ /**
262
+ * Retrieves the field for comment objects.
263
+ *
264
+ * @since 0.1
265
+ *
266
+ * @return string[]
267
+ */
268
+ public static function getCommentFields() : array
269
+ {
270
+ return [
271
+ 'id',
272
+ 'username',
273
+ 'text',
274
+ 'timestamp',
275
+ 'like_count',
276
+ ];
277
+ }
278
+ }
core/IgApi/IgBasicApiClient.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ use Exception;
6
+ use GuzzleHttp\ClientInterface;
7
+ use Psr\SimpleCache\CacheInterface;
8
+
9
+ /**
10
+ * API client for the Instagram Basic Display API.
11
+ *
12
+ * @since 0.1
13
+ */
14
+ class IgBasicApiClient
15
+ {
16
+ /**
17
+ * The base URI to the Instagram Basic Display API.
18
+ *
19
+ * @since 0.1
20
+ */
21
+ const BASE_URL = 'https://graph.instagram.com';
22
+
23
+ /**
24
+ * The API client driver.
25
+ *
26
+ * @since 0.1
27
+ *
28
+ * @var ClientInterface
29
+ */
30
+ protected $client;
31
+
32
+ /**
33
+ * The cache to use for caching responses.
34
+ *
35
+ * @since 0.1
36
+ *
37
+ * @var CacheInterface
38
+ */
39
+ protected $cache;
40
+
41
+ /**
42
+ * Whether or not to use the legacy Instagram API to compensate for data that is omitted by the Basic Display API.
43
+ *
44
+ * @since 0.1
45
+ *
46
+ * @var bool
47
+ */
48
+ protected $legacyComp;
49
+
50
+ /**
51
+ * Constructor.
52
+ *
53
+ * @since 0.1
54
+ *
55
+ * @param ClientInterface $client The client driver to use for sending requests.
56
+ * @param CacheInterface $cache The cache to use for caching responses.
57
+ * @param bool $legacyComp If true, the legacy Instagram API will be used to compensate for data that is
58
+ * omitted by the Basic Display API.
59
+ */
60
+ public function __construct(
61
+ ClientInterface $client,
62
+ CacheInterface $cache,
63
+ bool $legacyComp = false
64
+ ) {
65
+ $this->client = $client;
66
+ $this->cache = $cache;
67
+ $this->legacyComp = $legacyComp;
68
+ }
69
+
70
+ /**
71
+ * Retrieves information about the user with whom the access token is associated with.
72
+ *
73
+ * @since 0.1
74
+ *
75
+ * @param AccessToken $accessToken The access token.
76
+ *
77
+ * @return IgUser The user associated with the given access token.
78
+ */
79
+ public function getTokenUser(AccessToken $accessToken) : IgUser
80
+ {
81
+ $response = IgApiUtils::request($this->client, 'GET', static::BASE_URL . '/me', [
82
+ 'query' => [
83
+ 'fields' => implode(',', IgApiUtils::getBasicUserFields()),
84
+ 'access_token' => $accessToken->getCode(),
85
+ ],
86
+ ]);
87
+
88
+ $body = IgApiUtils::parseResponse($response);
89
+
90
+ // Make sure the account is marked as PERSONAL, even if Instagram treats it as a BUSINESS account.
91
+ // Otherwise, media fetching in IgApiClient will use the Graph API instead of the BasicDisplay API, which will
92
+ // fail (access tokens cannot be used across the two APIs).
93
+ $body['account_type'] = 'PERSONAL';
94
+
95
+ return $this->createUserFromResponse($body);
96
+ }
97
+
98
+ /**
99
+ * Refreshes a long-lived access token.
100
+ *
101
+ * @since 0.1
102
+ *
103
+ * @param AccessToken $accessToken The access token to refresh.
104
+ *
105
+ * @return AccessToken The new access token.
106
+ */
107
+ public function refreshAccessToken(AccessToken $accessToken) : AccessToken
108
+ {
109
+ $response = IgApiUtils::request($this->client, 'GET', static::BASE_URL . '/refresh_access_token', [
110
+ 'query' => [
111
+ 'grant_type' => 'ig_refresh_token',
112
+ 'access_token' => $accessToken->getCode(),
113
+ ],
114
+ ]);
115
+
116
+ $body = IgApiUtils::parseResponse($response);
117
+ $code = $body['access_token'];
118
+ $expiry = time() + intval($body['expires_in']);
119
+
120
+ return new AccessToken($code, $expiry);
121
+ }
122
+
123
+ /**
124
+ * Retrieves media for a specific user.
125
+ *
126
+ * @since 0.1
127
+ *
128
+ * @param string $userId The ID of the user whose media to fetch.
129
+ * @param AccessToken $accessToken The access token.
130
+ *
131
+ * @return IgMedia[] A list of media objects.
132
+ */
133
+ public function getMedia($userId, AccessToken $accessToken) : array
134
+ {
135
+ $getRemote = function () use ($userId, $accessToken) {
136
+ return IgApiUtils::request($this->client, 'GET', static::BASE_URL . "/{$userId}/media", [
137
+ 'query' => [
138
+ 'fields' => implode(',', IgApiUtils::getMediaFields()),
139
+ 'access_token' => $accessToken->getCode(),
140
+ 'limit' => 200,
141
+ ],
142
+ ]);
143
+ };
144
+
145
+ $body = IgApiUtils::getCachedResponse($this->cache, "basic_media.{$userId}", $getRemote);
146
+ $media = $body['data'];
147
+
148
+ return array_map(function ($data) {
149
+ return IgMedia::create($this->populateMissingMediaInfo($data));
150
+ }, $media);
151
+ }
152
+
153
+ /**
154
+ * Creates an IgUser instance from a response.
155
+ *
156
+ * @since 0.1
157
+ *
158
+ * @param array $data The user response data.
159
+ *
160
+ * @return IgUser The created user instance.
161
+ */
162
+ protected function createUserFromResponse(array $data)
163
+ {
164
+ $data = $this->populateMissingUserInfo($data);
165
+
166
+ return IgUser::create($data);
167
+ }
168
+
169
+ /**
170
+ * Attempts to populate missing user info from the legacy API.
171
+ *
172
+ * @since 0.1
173
+ *
174
+ * @param array $data The user data.
175
+ *
176
+ * @return array The user data, populated with additional info from the legacy API if successful.
177
+ */
178
+ protected function populateMissingUserInfo(array $data)
179
+ {
180
+ if (!$this->legacyComp || !isset($data['username'])) {
181
+ return $data;
182
+ }
183
+
184
+ $username = $data['username'];
185
+
186
+ try {
187
+ $getRemote = function () use ($username) {
188
+ return IgApiUtils::request($this->client, 'GET', "https://instagram.com/{$username}?__a=1");
189
+ };
190
+
191
+ $info = IgApiUtils::getCachedResponse($this->cache, "legacy_api.user.{$username}", $getRemote);
192
+ } catch (Exception $exception) {
193
+ return $data;
194
+ }
195
+
196
+ if (!isset($info['graphql']['user'])) {
197
+ return $data;
198
+ }
199
+
200
+ $legacy = $info['graphql']['user'];
201
+
202
+ $data['profile_picture_url'] = $legacy['profile_pic_url'] ?? "";
203
+ $data['biography'] = $legacy['biography'] ?? "";
204
+ $data['followers_count'] = $legacy['edge_followed_by']['count'] ?? 0;
205
+
206
+ return $data;
207
+ }
208
+
209
+ /**
210
+ * Attempts to populate missing media info from the legacy API.
211
+ *
212
+ * @since 0.1
213
+ *
214
+ * @param array $data The media data.
215
+ *
216
+ * @return array The media data, populated with additional info from the legacy API if successful.
217
+ */
218
+ protected function populateMissingMediaInfo(array $data)
219
+ {
220
+ if (!$this->legacyComp || !isset($data['permalink'])) {
221
+ return $data;
222
+ }
223
+
224
+ $mediaId = $data['id'];
225
+ $permalink = $data['permalink'];
226
+
227
+ try {
228
+ $getRemote = function () use ($mediaId, $permalink) {
229
+ return IgApiUtils::request($this->client, 'GET', $permalink . "?__a=1");
230
+ };
231
+
232
+ $info = IgApiUtils::getCachedResponse($this->cache, "legacy_api.media.{$mediaId}", $getRemote);
233
+ } catch (Exception $exception) {
234
+ return $data;
235
+ }
236
+
237
+ if (!isset($info['graphql']['shortcode_media'])) {
238
+ return $data;
239
+ }
240
+
241
+ $legacy = $info['graphql']['shortcode_media'];
242
+
243
+ $data['comments_count'] = $legacy['edge_media_preview_comment']['count'] ?? 0;
244
+ $data['like_count'] = $legacy['edge_media_preview_comment']['count'] ?? 0;
245
+
246
+ return $data;
247
+ }
248
+ }
core/IgApi/IgComment.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ use DateTime;
6
+
7
+ /**
8
+ * Represents an Instagram media comment as retrieved from the Graph API.
9
+ *
10
+ * @since 0.1
11
+ */
12
+ class IgComment
13
+ {
14
+ /**
15
+ * @since 0.1
16
+ *
17
+ * @var string
18
+ */
19
+ protected $id;
20
+
21
+ /**
22
+ * @since 0.1
23
+ *
24
+ * @var string
25
+ */
26
+ protected $username;
27
+
28
+ /**
29
+ * @since 0.1
30
+ *
31
+ * @var string
32
+ */
33
+ protected $text;
34
+
35
+ /**
36
+ * @since 0.1
37
+ *
38
+ * @var DateTime|null
39
+ */
40
+ protected $timestamp;
41
+
42
+ /**
43
+ * @since 0.1
44
+ *
45
+ * @var int
46
+ */
47
+ protected $likeCount;
48
+
49
+ /**
50
+ * Creates an instance using data from the Graph API.
51
+ *
52
+ * @since 0.1
53
+ *
54
+ * @param array $data An associative array containing the comment data from the API.
55
+ *
56
+ * @return static The created instance.
57
+ */
58
+ public static function create(array $data)
59
+ {
60
+ $data = array_merge(static::getDefaults(), $data);
61
+
62
+ $timestamp = empty($data['timestamp'])
63
+ ? null
64
+ : DateTime::createFromFormat(DATE_ISO8601, $data['timestamp']);
65
+
66
+ $comment = new static();
67
+ $comment->id = $data['id'];
68
+ $comment->username = $data['username'];
69
+ $comment->text = $data['text'];
70
+ $comment->timestamp = $timestamp;
71
+ $comment->likeCount = $data['like_count'];
72
+
73
+ return $comment;
74
+ }
75
+
76
+ /**
77
+ * Retrieves the default values for a comment's data.
78
+ *
79
+ * @since 0.1
80
+ *
81
+ * @return array An associative array containing the default values for each comment property.
82
+ */
83
+ public static function getDefaults() : array
84
+ {
85
+ return [
86
+ 'id' => '',
87
+ 'username' => '',
88
+ 'text' => '',
89
+ 'timestamp' => '',
90
+ 'like_count' => 0,
91
+ ];
92
+ }
93
+
94
+ /**
95
+ * @since 0.1
96
+ *
97
+ * @return string
98
+ */
99
+ public function getId() : string
100
+ {
101
+ return $this->id;
102
+ }
103
+
104
+ /**
105
+ * @since 0.1
106
+ *
107
+ * @return string
108
+ */
109
+ public function getUsername() : string
110
+ {
111
+ return $this->username;
112
+ }
113
+
114
+ /**
115
+ * @since 0.1
116
+ *
117
+ * @return string
118
+ */
119
+ public function getText() : string
120
+ {
121
+ return $this->text;
122
+ }
123
+
124
+ /**
125
+ * @since 0.1
126
+ *
127
+ * @return DateTime|null
128
+ */
129
+ public function getTimestamp() : ?DateTime
130
+ {
131
+ return $this->timestamp;
132
+ }
133
+
134
+ /**
135
+ * @since 0.1
136
+ *
137
+ * @return int
138
+ */
139
+ public function getLikeCount() : int
140
+ {
141
+ return $this->likeCount;
142
+ }
143
+ }
core/IgApi/IgGraphApiClient.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ use GuzzleHttp\ClientInterface;
6
+ use Psr\Http\Message\ResponseInterface;
7
+ use Psr\SimpleCache\CacheInterface;
8
+
9
+ class IgGraphApiClient
10
+ {
11
+ const API_URI = 'https://graph.facebook.com';
12
+ const TOKEN_EXPIRY = 60 * 24 * 3600;
13
+ const TOP_MEDIA = 'top_media';
14
+ const RECENT_MEDIA = 'recent_media';
15
+
16
+ /**
17
+ * @since 0.1
18
+ *
19
+ * @var ClientInterface
20
+ */
21
+ protected $client;
22
+
23
+ /**
24
+ * @since 0.1
25
+ *
26
+ * @var CacheInterface
27
+ */
28
+ protected $cache;
29
+
30
+ /**
31
+ * Constructor.
32
+ *
33
+ * @since 0.1
34
+ *
35
+ * @param ClientInterface $client
36
+ * @param CacheInterface $cache
37
+ */
38
+ public function __construct(
39
+ ClientInterface $client,
40
+ CacheInterface $cache
41
+ ) {
42
+ $this->client = $client;
43
+ $this->cache = $cache;
44
+ }
45
+
46
+ /**
47
+ * Retrieves the Instagram Business account associated with a given Facebook page.
48
+ *
49
+ * @since 0.1
50
+ *
51
+ * @param string $pageId The ID of the Facebook page.
52
+ * @param AccessToken $accessToken The access token for the Facebook page.
53
+ *
54
+ * @return IgAccount|null The associated Instagram Business account, or null if the page has no associated account.
55
+ */
56
+ public function getAccountForPage(string $pageId, AccessToken $accessToken) : ?IgAccount
57
+ {
58
+ // Get the info for the Facebook page
59
+ $response = IgApiUtils::request($this->client, 'GET', static::API_URI . "/${pageId}", [
60
+ 'query' => [
61
+ 'fields' => 'instagram_business_account,access_token',
62
+ 'access_token' => $accessToken->getCode(),
63
+ ],
64
+ ]);
65
+
66
+ $body = IgApiUtils::parseResponse($response);
67
+
68
+ if (!isset($body['instagram_business_account'])) {
69
+ return null;
70
+ }
71
+
72
+ $userId = $body['instagram_business_account']['id'];
73
+ $userToken = $body['access_token'];
74
+
75
+ // Get the user info
76
+ $response = IgApiUtils::request($this->client, 'GET', static::API_URI . "/${userId}", [
77
+ 'query' => [
78
+ 'fields' => implode(',', IgApiUtils::getGraphUserFields()),
79
+ 'access_token' => $userToken,
80
+ ],
81
+ ]);
82
+
83
+ $userData = IgApiUtils::parseResponse($response);
84
+ $userData['account_type'] = IgUser::TYPE_BUSINESS;
85
+
86
+ $user = IgUser::create($userData);
87
+ $token = new AccessToken($userToken, time() + static::TOKEN_EXPIRY);
88
+
89
+ return new IgAccount($user, $token);
90
+ }
91
+
92
+ /**
93
+ * @since 0.1
94
+ *
95
+ * @param string $userId
96
+ * @param AccessToken $accessToken
97
+ *
98
+ * @return IgMedia[]
99
+ */
100
+ public function getMedia($userId, AccessToken $accessToken) : array
101
+ {
102
+ $getRemote = function () use ($userId, $accessToken) {
103
+ $response = IgApiUtils::request($this->client, 'GET', static::API_URI . "/{$userId}/media", [
104
+ 'query' => [
105
+ 'fields' => implode(',', IgApiUtils::getMediaFields()),
106
+ 'access_token' => $accessToken->getCode(),
107
+ 'limit' => 200,
108
+ ],
109
+ ]);
110
+
111
+ return $this->expandWithComments($response, $accessToken);
112
+ };
113
+
114
+ $body = IgApiUtils::getCachedResponse($this->cache, "graph_media.{$userId}", $getRemote);
115
+ $media = $body['data'];
116
+
117
+ return array_map([IgMedia::class, 'create'], $media);
118
+ }
119
+
120
+ /**
121
+ * @since 0.1
122
+ *
123
+ * @param ResponseInterface $response
124
+ * @param AccessToken $accessToken
125
+ *
126
+ * @return IgMedia[]
127
+ */
128
+ protected function expandWithComments(ResponseInterface $response, AccessToken $accessToken) : array
129
+ {
130
+ $mediaList = IgApiUtils::parseResponse($response)['data'];
131
+ $mediaIds = array_column($mediaList, 'id');
132
+
133
+ $response = IgApiUtils::request($this->client, 'GET', static::API_URI . "/comments", [
134
+ 'query' => [
135
+ 'ids' => implode(',', $mediaIds),
136
+ 'fields' => implode(',', IgApiUtils::getCommentFields()),
137
+ 'access_token' => $accessToken->getCode(),
138
+ ],
139
+ ]);
140
+
141
+ $comments = IgApiUtils::parseResponse($response);
142
+
143
+ foreach ($mediaList as $idx => $media) {
144
+ $mediaId = $media['id'];
145
+
146
+ if (!isset($comments[$mediaId])) {
147
+ continue;
148
+ }
149
+
150
+ $mediaList[$idx]['comments'] = $comments[$mediaId]['data'];
151
+ }
152
+
153
+ return [
154
+ 'data' => $mediaList,
155
+ ];
156
+ }
157
+ }
core/IgApi/IgMedia.php ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ use DateTime;
6
+
7
+ /**
8
+ * Represents an Instagram media object as retrieved from the Graph API.
9
+ *
10
+ * @since 0.1
11
+ */
12
+ class IgMedia
13
+ {
14
+ /**
15
+ * @since 0.1
16
+ *
17
+ * @var string
18
+ */
19
+ protected $id;
20
+
21
+ /**
22
+ * @since 0.1
23
+ *
24
+ * @var string
25
+ */
26
+ protected $username;
27
+
28
+ /**
29
+ * @since 0.1
30
+ *
31
+ * @var DateTime|null
32
+ */
33
+ protected $timestamp;
34
+
35
+ /**
36
+ * @since 0.1
37
+ *
38
+ * @var string
39
+ */
40
+ protected $caption;
41
+
42
+ /**
43
+ * @since 0.1
44
+ *
45
+ * @var string
46
+ */
47
+ protected $type;
48
+
49
+ /**
50
+ * @since 0.1
51
+ *
52
+ * @var string
53
+ */
54
+ protected $url;
55
+
56
+ /**
57
+ * @since 0.1
58
+ *
59
+ * @var string
60
+ */
61
+ protected $permalink;
62
+
63
+ /**
64
+ * @since 0.1
65
+ *
66
+ * @var string
67
+ */
68
+ protected $thumbnail;
69
+
70
+ /**
71
+ * @since 0.1
72
+ *
73
+ * @var int
74
+ */
75
+ protected $likesCount;
76
+
77
+ /**
78
+ * @since 0.1
79
+ *
80
+ * @var int
81
+ */
82
+ protected $commentsCount;
83
+
84
+ /**
85
+ * @since 0.1
86
+ *
87
+ * @var IgComment[]
88
+ */
89
+ protected $comments;
90
+
91
+ /**
92
+ * @since 0.1
93
+ *
94
+ * @var array
95
+ */
96
+ protected $children;
97
+
98
+ /**
99
+ * Creates a media object from the given Instagram API data.
100
+ *
101
+ * @since 0.1
102
+ *
103
+ * @param array $data The media data.
104
+ *
105
+ * @return static The created media object.
106
+ */
107
+ public static function create(array $data)
108
+ {
109
+ $data = array_merge(static::getDefaults(), $data);
110
+
111
+ $timestamp = empty($data['timestamp'])
112
+ ? null
113
+ : DateTime::createFromFormat(DATE_ISO8601, $data['timestamp']);
114
+
115
+ $children = isset($data['children']['data'])
116
+ ? $data['children']['data']
117
+ : $data['children'];
118
+
119
+ foreach ($children as $idx => $child) {
120
+ if (is_array($child)) {
121
+ $children[$idx] = static::create($child);
122
+ }
123
+ }
124
+
125
+ $comments = isset($data['comments']['data'])
126
+ ? $data['comments']['data']
127
+ : $data['comments'];
128
+
129
+ foreach ($comments as $idx => $comment) {
130
+ if (is_array($comment)) {
131
+ $comments[$idx] = IgComment::create($comment);
132
+ }
133
+ }
134
+
135
+ $media = new static();
136
+ $media->id = $data['id'];
137
+ $media->username = $data['username'];
138
+ $media->timestamp = $timestamp;
139
+ $media->caption = $data['caption'];
140
+ $media->type = $data['media_type'];
141
+ $media->url = $data['media_url'];
142
+ $media->permalink = $data['permalink'];
143
+ $media->thumbnail = $data['thumbnail_url'];
144
+ $media->likesCount = $data['like_count'];
145
+ $media->commentsCount = $data['comments_count'];
146
+ $media->comments = $comments;
147
+ $media->children = $children;
148
+
149
+ return $media;
150
+ }
151
+
152
+ /**
153
+ * Retrieves the default creation data.
154
+ *
155
+ * @since 0.1
156
+ *
157
+ * @return array
158
+ */
159
+ public static function getDefaults()
160
+ {
161
+ return [
162
+ 'id' => '',
163
+ 'username' => '',
164
+ 'timestamp' => '',
165
+ 'caption' => '',
166
+ 'media_type' => '',
167
+ 'media_url' => '',
168
+ 'permalink' => '',
169
+ 'thumbnail_url' => '',
170
+ 'like_count' => 0,
171
+ 'comments_count' => 0,
172
+ 'comments' => [],
173
+ 'children' => [],
174
+ ];
175
+ }
176
+
177
+ /**
178
+ * @since 0.1
179
+ *
180
+ * @return string
181
+ */
182
+ public function getId() : string
183
+ {
184
+ return $this->id;
185
+ }
186
+
187
+ /**
188
+ * @since 0.1
189
+ *
190
+ * @return string
191
+ */
192
+ public function getUsername() : string
193
+ {
194
+ return $this->username;
195
+ }
196
+
197
+ /**
198
+ * @since 0.1
199
+ *
200
+ * @return DateTime|null
201
+ */
202
+ public function getTimestamp() : ?DateTime
203
+ {
204
+ return $this->timestamp;
205
+ }
206
+
207
+ /**
208
+ * @since 0.1
209
+ *
210
+ * @return string
211
+ */
212
+ public function getCaption() : string
213
+ {
214
+ return $this->caption;
215
+ }
216
+
217
+ /**
218
+ * @since 0.1
219
+ *
220
+ * @return string
221
+ */
222
+ public function getType() : string
223
+ {
224
+ return $this->type;
225
+ }
226
+
227
+ /**
228
+ * @since 0.1
229
+ *
230
+ * @return string
231
+ */
232
+ public function getUrl() : string
233
+ {
234
+ return $this->url;
235
+ }
236
+
237
+ /**
238
+ * @since 0.1
239
+ *
240
+ * @return string
241
+ */
242
+ public function getPermalink() : string
243
+ {
244
+ return $this->permalink;
245
+ }
246
+
247
+ /**
248
+ * @since 0.1
249
+ *
250
+ * @return string
251
+ */
252
+ public function getThumbnailUrl() : string
253
+ {
254
+ return $this->thumbnail;
255
+ }
256
+
257
+ /**
258
+ * @since 0.1
259
+ *
260
+ * @return int
261
+ */
262
+ public function getLikesCount() : int
263
+ {
264
+ return $this->likesCount;
265
+ }
266
+
267
+ /**
268
+ * @since 0.1
269
+ *
270
+ * @return int
271
+ */
272
+ public function getCommentsCount() : int
273
+ {
274
+ return $this->commentsCount;
275
+ }
276
+
277
+ /**
278
+ * @since 0.1
279
+ *
280
+ * @return array
281
+ */
282
+ public function getComments() : array
283
+ {
284
+ return $this->comments;
285
+ }
286
+
287
+ /**
288
+ * @since 0.1
289
+ *
290
+ * @return IgMedia[]
291
+ */
292
+ public function getChildren() : array
293
+ {
294
+ return $this->children;
295
+ }
296
+
297
+ /**
298
+ * Creates a copy with the given list of comments.
299
+ *
300
+ * @since 0.1
301
+ *
302
+ * @param IgComment[] $comments The comments.
303
+ *
304
+ * @return IgMedia The copied instance with the comments.
305
+ */
306
+ public function withComments(array $comments)
307
+ {
308
+ $instance = clone $this;
309
+ $instance->comments = $comments;
310
+
311
+ return $instance;
312
+ }
313
+ }
core/IgApi/IgUser.php ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\IgApi;
4
+
5
+ /**
6
+ * Represents an Instagram user as retrieved from the Graph API.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class IgUser
11
+ {
12
+ const TYPE_PERSONAL = 'PERSONAL';
13
+ const TYPE_BUSINESS = 'BUSINESS';
14
+
15
+ /**
16
+ * @since 0.1
17
+ *
18
+ * @var string
19
+ */
20
+ protected $id;
21
+
22
+ /**
23
+ * @since 0.1
24
+ *
25
+ * @var string
26
+ */
27
+ protected $username;
28
+
29
+ /**
30
+ * @since 0.1
31
+ *
32
+ * @var string
33
+ */
34
+ protected $type;
35
+
36
+ /**
37
+ * @since 0.1
38
+ *
39
+ * @var string
40
+ */
41
+ protected $name;
42
+
43
+ /**
44
+ * @since 0.1
45
+ *
46
+ * @var string
47
+ */
48
+ protected $bio;
49
+
50
+ /**
51
+ * @since 0.1
52
+ *
53
+ * @var int
54
+ */
55
+ protected $mediaCount;
56
+
57
+ /**
58
+ * @since 0.1
59
+ *
60
+ * @var string
61
+ */
62
+ protected $profilePicUrl;
63
+
64
+ /**
65
+ * @since 0.1
66
+ *
67
+ * @var int
68
+ */
69
+ protected $followersCount;
70
+
71
+ /**
72
+ * @since 0.1
73
+ *
74
+ * @var int
75
+ */
76
+ protected $followsCount;
77
+
78
+ /**
79
+ * @since 0.1
80
+ *
81
+ * @var string
82
+ */
83
+ protected $website;
84
+
85
+ /**
86
+ * @since 0.1
87
+ *
88
+ * @param array $data
89
+ *
90
+ * @return IgUser
91
+ */
92
+ public static function create(array $data)
93
+ {
94
+ $data = array_merge([
95
+ 'id' => '',
96
+ 'username' => '',
97
+ 'name' => '',
98
+ 'biography' => '',
99
+ 'account_type' => '',
100
+ 'media_count' => 0,
101
+ 'profile_picture_url' => '',
102
+ 'followers_count' => 0,
103
+ 'follows_count' => 0,
104
+ 'website' => '',
105
+ ], $data);
106
+
107
+ $user = new static();
108
+ $user->id = $data['id'];
109
+ $user->username = $data['username'];
110
+ $user->name = $data['name'];
111
+ $user->bio = $data['biography'];
112
+ $user->type = $data['account_type'];
113
+ $user->mediaCount = $data['media_count'];
114
+ $user->profilePicUrl = $data['profile_picture_url'];
115
+ $user->followersCount = $data['followers_count'];
116
+ $user->followsCount = $data['follows_count'];
117
+ $user->website = $data['website'];
118
+
119
+ return $user;
120
+ }
121
+
122
+ /**
123
+ * @since 0.1
124
+ *
125
+ * @return string
126
+ */
127
+ public function getId() : string
128
+ {
129
+ return $this->id;
130
+ }
131
+
132
+ /**
133
+ * @since 0.1
134
+ *
135
+ * @return string
136
+ */
137
+ public function getUsername() : string
138
+ {
139
+ return $this->username;
140
+ }
141
+
142
+ /**
143
+ * @since 0.1
144
+ *
145
+ * @return string
146
+ */
147
+ public function getType() : string
148
+ {
149
+ return $this->type;
150
+ }
151
+
152
+ /**
153
+ * @since 0.1
154
+ *
155
+ * @return string
156
+ */
157
+ public function getName() : string
158
+ {
159
+ return $this->name;
160
+ }
161
+
162
+ /**
163
+ * @since 0.1
164
+ *
165
+ * @return string
166
+ */
167
+ public function getBio() : string
168
+ {
169
+ return $this->bio;
170
+ }
171
+
172
+ /**
173
+ * @since 0.1
174
+ *
175
+ * @return int
176
+ */
177
+ public function getMediaCount() : int
178
+ {
179
+ return $this->mediaCount;
180
+ }
181
+
182
+ /**
183
+ * @since 0.1
184
+ *
185
+ * @return string
186
+ */
187
+ public function getProfilePicUrl() : string
188
+ {
189
+ return $this->profilePicUrl;
190
+ }
191
+
192
+ /**
193
+ * @since 0.1
194
+ *
195
+ * @return int
196
+ */
197
+ public function getFollowersCount() : int
198
+ {
199
+ return $this->followersCount;
200
+ }
201
+
202
+ /**
203
+ * @since 0.1
204
+ *
205
+ * @return int
206
+ */
207
+ public function getFollowsCount() : int
208
+ {
209
+ return $this->followsCount;
210
+ }
211
+
212
+ /**
213
+ * @since 0.1
214
+ *
215
+ * @return string
216
+ */
217
+ public function getWebsite() : string
218
+ {
219
+ return $this->website;
220
+ }
221
+ }
core/MediaStore/Fetchers/AccountMediaFetcher.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\MediaStore\Fetchers;
4
+
5
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgApiClient;
7
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaFetcherInterface;
8
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaSource;
9
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaStore;
10
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
11
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
12
+
13
+ /**
14
+ * Fetches media posted by the accounts that are selected for a feed.
15
+ *
16
+ * @since 0.1
17
+ */
18
+ class AccountMediaFetcher implements MediaFetcherInterface
19
+ {
20
+ /**
21
+ * @since 0.1
22
+ *
23
+ * @var IgApiClient
24
+ */
25
+ protected $api;
26
+
27
+ /**
28
+ * @since 0.1
29
+ *
30
+ * @var PostType
31
+ */
32
+ protected $cpt;
33
+
34
+ /**
35
+ * Constructor.
36
+ *
37
+ * @since 0.1
38
+ *
39
+ * @param IgApiClient $api The Instagram API client.
40
+ * @param PostType $cpt The accounts CPT.
41
+ */
42
+ public function __construct(IgApiClient $api, PostType $cpt)
43
+ {
44
+ $this->api = $api;
45
+ $this->cpt = $cpt;
46
+ }
47
+
48
+ /**
49
+ * @inheritDoc
50
+ *
51
+ * @since 0.1
52
+ */
53
+ public function fetch(Feed $feed, MediaStore $store)
54
+ {
55
+ $accountIds = $feed->getOption('accounts', []);
56
+ if (empty($accountIds)) {
57
+ return;
58
+ }
59
+
60
+ $accountPosts = $this->cpt->query(['post__in' => $accountIds]);
61
+ foreach ($accountPosts as $accountPost) {
62
+ $account = AccountPostType::fromWpPost($accountPost);
63
+ $source = MediaSource::forUser($account->getUser());
64
+
65
+ $store->addMedia($this->api->getAccountMedia($account), $source);
66
+ }
67
+ }
68
+ }
core/MediaStore/IgCachedMedia.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\MediaStore;
4
+
5
+ use DateTime;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
7
+ use WP_Post;
8
+
9
+ class IgCachedMedia extends IgMedia
10
+ {
11
+ /**
12
+ * @since 0.1
13
+ *
14
+ * @var WP_Post|null
15
+ */
16
+ protected $post;
17
+
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var int
22
+ */
23
+ protected $lastRequested;
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var MediaSource
29
+ */
30
+ protected $source;
31
+
32
+ /**
33
+ * @inheritDoc
34
+ *
35
+ * @since 0.1
36
+ *
37
+ * @return IgCachedMedia
38
+ */
39
+ public static function create(array $data)
40
+ {
41
+ /* @var $instance IgCachedMedia */
42
+ $instance = parent::create($data);
43
+
44
+ $instance->post = $data['post'] ?? null;
45
+ $instance->lastRequested = empty($data['last_requested']) ? time() : $data['last_requested'];
46
+ $instance->source = MediaSource::create($data['source'] ?? []);
47
+
48
+ return $instance;
49
+ }
50
+
51
+ /**
52
+ * Creates an instance from a non-cached instance.
53
+ *
54
+ * @since 0.1
55
+ *
56
+ * @param IgMedia $media
57
+ * @param array $extra
58
+ *
59
+ * @return IgCachedMedia
60
+ */
61
+ public static function from(IgMedia $media, array $extra = []) : IgCachedMedia
62
+ {
63
+ if ($media instanceof static) {
64
+ return $media;
65
+ }
66
+
67
+ $post = $extra['post'] ?? null;
68
+ $lastRequested = empty($extra['last_requested']) ? time() : $extra['last_requested'];
69
+ $source = MediaSource::create($extra['source'] ?? []);
70
+
71
+ $timestamp = $media->getTimestamp();
72
+
73
+ return static::create([
74
+ 'post' => $post,
75
+ 'id' => $media->getId(),
76
+ 'username' => $media->getUsername(),
77
+ 'timestamp' => $timestamp ? $timestamp->format(DateTime::ISO8601) : null,
78
+ 'caption' => $media->getCaption(),
79
+ 'media_type' => $media->getType(),
80
+ 'media_url' => $media->getUrl(),
81
+ 'permalink' => $media->getPermalink(),
82
+ 'thumbnail_url' => $media->getThumbnailUrl(),
83
+ 'like_count' => $media->getLikesCount(),
84
+ 'comments_count' => $media->getCommentsCount(),
85
+ 'comments' => $media->getComments(),
86
+ 'children' => $media->getChildren(),
87
+ 'last_requested' => $lastRequested,
88
+ 'source' => $source,
89
+ ]);
90
+ }
91
+
92
+ /**
93
+ * @inheritDoc
94
+ *
95
+ * @since 0.1
96
+ */
97
+ public static function getDefaults()
98
+ {
99
+ $defaults = parent::getDefaults();
100
+ $defaults['last_requested'] = '';
101
+ $defaults['source'] = MediaSource::create([]);
102
+
103
+ return $defaults;
104
+ }
105
+
106
+ /**
107
+ * @since 0.1
108
+ *
109
+ * @return WP_Post|null
110
+ */
111
+ public function getPost() : ?WP_Post
112
+ {
113
+ return $this->post;
114
+ }
115
+
116
+ /**
117
+ * @since 0.1
118
+ *
119
+ * @return int
120
+ */
121
+ public function getLastRequested() : int
122
+ {
123
+ return $this->lastRequested;
124
+ }
125
+
126
+ /**
127
+ * @since 0.1
128
+ *
129
+ * @return MediaSource
130
+ */
131
+ public function getSource() : MediaSource
132
+ {
133
+ return $this->source;
134
+ }
135
+
136
+ /**
137
+ * Gets a {@link DateTime} instance that represents the current date and time.
138
+ *
139
+ * @since 0.1
140
+ *
141
+ * @return DateTime
142
+ */
143
+ public static function now()
144
+ {
145
+ return DateTime::createFromFormat(DateTime::ISO8601, date(DateTime::ISO8601));
146
+ }
147
+ }
core/MediaStore/MediaFetcherInterface.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\MediaStore;
4
+
5
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
6
+
7
+ /**
8
+ * A media fetcher is an object that can retrieve Instagram media objects from some source and add them to a store.
9
+ *
10
+ * Given a feed, a fetcher should be responsible of fetching media objects that are appropriate for **one** of that
11
+ * feed's sources. When a fetcher has acquired a list of media objects, it can then add them to the store via the
12
+ * store's {@link MediaStore::addMedia()} method.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ interface MediaFetcherInterface
17
+ {
18
+ /**
19
+ * Fetches media for a given feed.
20
+ *
21
+ * @since 0.1
22
+ *
23
+ * @param Feed $feed The feed instance for which to retrieve media.
24
+ * @param MediaStore $store The media store instance in which to store the fetched media.
25
+ */
26
+ public function fetch(Feed $feed, MediaStore $store);
27
+ }
core/MediaStore/MediaProcessorInterface.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\MediaStore;
4
+
5
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
6
+
7
+ /**
8
+ * A media processor is an object that performs some transformation on a list of media, as per a feed's options.
9
+ *
10
+ * Processors are intended to used in a set. Therefore, the scope of a single processor should ideally be restricted
11
+ * to a single feed option or feature.
12
+ *
13
+ * @since 0.1
14
+ */
15
+ interface MediaProcessorInterface
16
+ {
17
+ /**
18
+ * Processes the given media list to satisfy a feed's options.
19
+ *
20
+ * @since 0.1
21
+ *
22
+ * @param IgCachedMedia[] $mediaList A list of media objects, passed by reference for performance.
23
+ * @param Feed $feed The feed.
24
+ */
25
+ public function process(array &$mediaList, Feed $feed);
26
+ }
core/MediaStore/MediaSource.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\MediaStore;
4
+
5
+ use RebelCode\Spotlight\Instagram\IgApi\IgGraphApiClient;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgUser;
7
+
8
+ /**
9
+ * A media source is a simple struct-like object that records information about from where, or why, a specific media
10
+ * object was fetched.
11
+ *
12
+ * @since 0.1
13
+ */
14
+ class MediaSource
15
+ {
16
+ const PERSONAL_ACCOUNT = 'PERSONAL_ACCOUNT';
17
+ const BUSINESS_ACCOUNT = 'BUSINESS_ACCOUNT';
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var string
23
+ */
24
+ protected $name;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var string
30
+ */
31
+ protected $type;
32
+
33
+ /**
34
+ * @since 0.1
35
+ *
36
+ * @param array|MediaSource $data
37
+ *
38
+ * @return static
39
+ */
40
+ public static function create($data)
41
+ {
42
+ if ($data instanceof static) {
43
+ return $data;
44
+ }
45
+
46
+ $instance = new static();
47
+ $instance->name = $data['name'] ?? '';
48
+ $instance->type = $data['type'] ?? '';
49
+
50
+ return $instance;
51
+ }
52
+
53
+ /**
54
+ * Creates a media source for a user.
55
+ *
56
+ * @since 0.1
57
+ *
58
+ * @param IgUser $user The user instance.
59
+ *
60
+ * @return static The created media source instance.
61
+ */
62
+ public static function forUser(IgUser $user)
63
+ {
64
+ return static::create([
65
+ 'name' => $user->getUsername(),
66
+ 'type' => ($user->getType() === IgUser::TYPE_PERSONAL)
67
+ ? static::PERSONAL_ACCOUNT
68
+ : static::BUSINESS_ACCOUNT,
69
+ ]);
70
+ }
71
+
72
+ /**
73
+ * @since 0.1
74
+ *
75
+ * @return array
76
+ */
77
+ public function toArray()
78
+ {
79
+ return [
80
+ 'name' => $this->name,
81
+ 'type' => $this->type,
82
+ ];
83
+ }
84
+
85
+ /**
86
+ * @since 0.1
87
+ *
88
+ * @return string
89
+ */
90
+ public function getName() : string
91
+ {
92
+ return $this->name;
93
+ }
94
+
95
+ /**
96
+ * @since 0.1
97
+ *
98
+ * @return string
99
+ */
100
+ public function getType() : string
101
+ {
102
+ return $this->type;
103
+ }
104
+ }
core/MediaStore/MediaStore.php ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\MediaStore;
4
+
5
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
7
+ use RebelCode\Spotlight\Instagram\IgApi\IgUser;
8
+ use RebelCode\Spotlight\Instagram\Modules\Pro\MediaStore\ProMediaSource;
9
+ use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
10
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
11
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
12
+ use wpdb;
13
+
14
+ /**
15
+ * The store for IG media.
16
+ *
17
+ * This class is responsible for providing Instagram media to other objects, such as feeds.
18
+ *
19
+ * All media fetching functionality is delegated to media fetchers, which are objects that implement
20
+ * {@link MediaFetcherInterface}. The store will call each fetcher's {@link MediaFetcherInterface::fetch()} method,
21
+ * passing the feed as well as itself as arguments. Fetchers are responsible for actually retrieving the media from
22
+ * external sources, such as from the IG API. When a fetcher wishes to commit a list of media objects, they should
23
+ * call {@link MediaStore::addMedia()} on the media store argument that they are given. This will tell the media
24
+ * store to insert those media objects into the database (unless they already exist) and also add the media objects
25
+ * into a **queue**. For stories, fetchers should call {@link MediaStore::addStories()} to ensure that story media do
26
+ * not interfere with the count and offset slicing.
27
+ *
28
+ * Once all fetchers have been called, the media store will invoke the media processors.
29
+ *
30
+ * Media processors are objects that implement {@link MediaProcessorInterface}. The store will pass the fetched queue
31
+ * to each processor, by reference (for performance reasons). Each processor may perform manipulations of the queue
32
+ * directly. Since processors are called in sequence, each processor will be operating on the result of the previous
33
+ * processor, making the order of processors potentially an important factor.
34
+ *
35
+ * The queue of media objects will persist until the {@link MediaStore::getFeedMedia()} method is called again.
36
+ * Manipulations done by the store itself, such as offset and count slicing, will not affect the queue. These parameters
37
+ * only used to control the size of the return value and the scope of any database updates (such as for "last requested
38
+ * time" information). This ensures that the result of {@link MediaStore::getNumMedia()} is not affected by these
39
+ * operations and accurately returns the size of the results generated by the fetchers and processors, the results of
40
+ * which should always be the same when given the same feed (unlike offset and count slicing which are not dependant on
41
+ * the feed).
42
+ *
43
+ * @since 0.1
44
+ */
45
+ class MediaStore
46
+ {
47
+ /**
48
+ * @since 0.1
49
+ *
50
+ * @var wpdb
51
+ */
52
+ protected $wpdb;
53
+
54
+ /**
55
+ * @since 0.1
56
+ *
57
+ * @var MediaFetcherInterface[]
58
+ */
59
+ protected $fetchers;
60
+
61
+ /**
62
+ * @since 0.1
63
+ *
64
+ * @var MediaProcessorInterface[]
65
+ */
66
+ protected $processors;
67
+
68
+ /**
69
+ * @since 0.1
70
+ *
71
+ * @var PostType
72
+ */
73
+ protected $mediaCpt;
74
+
75
+ /**
76
+ * @since 0.1
77
+ *
78
+ * @var array
79
+ */
80
+ protected $queue;
81
+
82
+ /**
83
+ * @since 0.1
84
+ *
85
+ * @var array
86
+ */
87
+ protected $mediaQueue;
88
+
89
+ /**
90
+ * @since 0.1
91
+ *
92
+ * @var array
93
+ */
94
+ protected $storyQueue;
95
+
96
+ /**
97
+ * Constructor.
98
+ *
99
+ * @since 0.1
100
+ *
101
+ * @param wpdb $wpdb The WordPress database driver.
102
+ * @param MediaFetcherInterface[] $fetchers The fetchers to use to fetch media.
103
+ * @param MediaProcessorInterface[] $processors The processors to use to process media.
104
+ * @param PostType $mediaCpt The media CPT.
105
+ */
106
+ public function __construct(
107
+ wpdb $wpdb,
108
+ array $fetchers,
109
+ array $processors,
110
+ PostType $mediaCpt
111
+ ) {
112
+ $this->wpdb = $wpdb;
113
+ $this->fetchers = $fetchers;
114
+ $this->processors = $processors;
115
+ $this->mediaCpt = $mediaCpt;
116
+ $this->mediaQueue = [];
117
+ $this->storyQueue = [];
118
+ }
119
+
120
+ /**
121
+ * Retrieves the media used by a given feed.
122
+ *
123
+ * @since 0.1
124
+ *
125
+ * @param Feed $feed The feed instance for which to retrieve media.
126
+ * @param int $num The number of media objects to return. Will return all media objects if less than or equal
127
+ * to zero.
128
+ * @param int $offset The offset from which to begin returning media. Negative values will be treated as zero.
129
+ *
130
+ * @return IgCachedMedia[][] A tuple containing two lists of media objects. The first list will contain non-story
131
+ * media while the second will only contain story media.
132
+ */
133
+ public function getFeedMedia(Feed $feed, int $num = -1, int $offset = 0)
134
+ {
135
+ $this->mediaQueue = [];
136
+ $this->storyQueue = [];
137
+
138
+ foreach ($this->fetchers as $fetcher) {
139
+ $fetcher->fetch($feed, $this);
140
+ }
141
+
142
+ foreach ($this->processors as $processor) {
143
+ $processor->process($this->mediaQueue, $feed);
144
+ }
145
+
146
+ $total = count($this->mediaQueue);
147
+ $offset = max(0, min($total, $offset));
148
+
149
+ $toUpdate = $this->mediaQueue;
150
+ $toReturn = $this->mediaQueue;
151
+
152
+ if ($num > 0) {
153
+ // We need to update the media that was requested between offset and num, as well as any preceding media.
154
+ // This is because when feeds "Load more", the keep previous media on the screen. So we treat these media
155
+ // as being requested again.
156
+ // However, the returned list must respect the offset. So we need to slice again here with that offset
157
+ // Example: [offset = 5, num = 3]
158
+ // * Will return media from indices 5 to 8
159
+ // * Will update media from indices 0 to 8
160
+ $toUpdate = array_slice($this->mediaQueue, 0, $offset + $num);
161
+ $toReturn = array_slice($toUpdate, $offset);
162
+ }
163
+
164
+ $this->updateLastRequestedTime($toUpdate);
165
+
166
+ return [$toReturn, $this->storyQueue];
167
+ }
168
+
169
+ /**
170
+ * Retrieves the total number of media objects in the queue, prior to any offset and count slicing.
171
+ *
172
+ * @since 0.1
173
+ *
174
+ * @return int
175
+ */
176
+ public function getNumMedia()
177
+ {
178
+ return count($this->mediaQueue);
179
+ }
180
+
181
+ /**
182
+ * Retrieves the total number of story media objects in the queue.
183
+ *
184
+ * @since 0.1
185
+ *
186
+ * @return int
187
+ */
188
+ public function getNumStories()
189
+ {
190
+ return count($this->storyQueue);
191
+ }
192
+
193
+ /**
194
+ * Updates the store with a given list of media posts.
195
+ *
196
+ * @since 0.1
197
+ *
198
+ * @param IgMedia[] $mediaList The list of media to update the store with.
199
+ * @param MediaSource $source The source from where the media is being imported.
200
+ */
201
+ public function addMedia(array $mediaList, MediaSource $source)
202
+ {
203
+ $this->updateWith($mediaList, $source, $this->mediaQueue);
204
+ }
205
+
206
+ /**
207
+ * Updates the store with a given list of story media.
208
+ *
209
+ * Media that already exists in the store will be ignored. Comparison is done against the IG media ID.
210
+ *
211
+ * @since 0.1
212
+ *
213
+ * @param IgMedia[] $storyList The list of story media to update the store with.
214
+ * @param igUser $user The user that the story belongs to.
215
+ */
216
+ public function addStories(array $storyList, IgUser $user)
217
+ {
218
+ if (class_exists(ProMediaSource::class)) {
219
+ $this->updateWith($storyList, ProMediaSource::forStory($user), $this->storyQueue);
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Updates the store with a given media list.
225
+ *
226
+ * Media that already exists in the store will be ignored. Comparison is done against the IG media ID.
227
+ *
228
+ * @since 0.1
229
+ *
230
+ * @param IgMedia[] $mediaList The list of media to update the store with.
231
+ * @param MediaSource $source The source from where the media is being imported.
232
+ * @param array $queue A reference to the queue to which to add the media.
233
+ */
234
+ protected function updateWith(array $mediaList, MediaSource $source, array &$queue)
235
+ {
236
+ if (empty($mediaList)) {
237
+ return;
238
+ }
239
+
240
+ // Get the media from the DB whose media IDs are in the $mediaList.
241
+ // This array is a mapping of media ID -> wp post ID
242
+ $existing = $this->getExistingMedia($mediaList);
243
+
244
+ foreach ($mediaList as $media) {
245
+ $mediaId = $media->getId();
246
+
247
+ // Create a cached media instance from this media
248
+ $cachedMedia = IgCachedMedia::from($media, [
249
+ 'source' => $source,
250
+ ]);
251
+
252
+ // Only insert into the database if the media does not already exists
253
+ if (!array_key_exists($mediaId, $existing)) {
254
+ $post = MediaPostType::toWpPost($cachedMedia);
255
+ $postId = $this->mediaCpt->insert($post);
256
+
257
+ if (is_wp_error($postId)) {
258
+ continue;
259
+ }
260
+ } else {
261
+ // If the media exists, get the post ID from the map
262
+ $postId = $existing[$mediaId];
263
+ }
264
+
265
+ // Create a cached media instance from this media
266
+ $cachedMedia = IgCachedMedia::from($media, [
267
+ 'source' => $source,
268
+ 'post' => get_post($postId),
269
+ ]);
270
+
271
+ // Add to the queue
272
+ $queue[] = $cachedMedia;
273
+
274
+ // Save the media's ID for future existence checks
275
+ // Don't map it to a post ID to prevent future iterations from re-saving the last requested date
276
+ $existing[$mediaId] = false;
277
+ }
278
+ }
279
+
280
+ /**
281
+ * Checks which media in a given list already exist in the database and returns them.
282
+ *
283
+ * @since 0.1
284
+ *
285
+ * @param array $mediaList The media list to check.
286
+ *
287
+ * @return array A mapping of media IDs to post IDs
288
+ */
289
+ protected function getExistingMedia(array $mediaList) : array
290
+ {
291
+ if (empty($mediaList)) {
292
+ return [];
293
+ }
294
+
295
+ $mediaIds = Arrays::join($mediaList, ',', function (IgMedia $media) {
296
+ return $media->getId();
297
+ });
298
+
299
+ $table = $this->wpdb->prefix . 'postmeta';
300
+ $query = sprintf(
301
+ "SELECT meta_value, post_id FROM %s WHERE meta_key = '%s' AND meta_value IN (%s)",
302
+ $table,
303
+ MediaPostType::MEDIA_ID,
304
+ $mediaIds
305
+ );
306
+
307
+ $results = $this->wpdb->get_results($query, 'ARRAY_N');
308
+
309
+ // Transform the list, where each value is a tuple array of the media ID and post ID, into a mapping of media
310
+ // IDs to post IDs
311
+ return Arrays::mapPairs($results, function ($idx, $pair) {
312
+ return $pair;
313
+ });
314
+ }
315
+
316
+ /**
317
+ * Updates the last requested time for a list of media objects.
318
+ *
319
+ * @since 0.1
320
+ *
321
+ * @param IgCachedMedia[] $mediaList The list of media objects to update.
322
+ */
323
+ protected function updateLastRequestedTime(array $mediaList)
324
+ {
325
+ if (count($mediaList) === 0) {
326
+ return;
327
+ }
328
+
329
+ $ids = Arrays::join($mediaList, ',', function (IgCachedMedia $media) {
330
+ return '\'' . $media->getPost()->ID . '\'';
331
+ });
332
+
333
+ $table = $this->wpdb->prefix . 'postmeta';
334
+ $query = sprintf(
335
+ "UPDATE %s SET meta_value = '%s' WHERE meta_key = '%s' AND post_id IN (%s)",
336
+ $table,
337
+ time(),
338
+ MediaPostType::LAST_REQUESTED,
339
+ $ids
340
+ );
341
+
342
+ $this->wpdb->query($query);
343
+ }
344
+ }
core/MediaStore/Processors/MediaSorterProcessor.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\MediaStore\Processors;
4
+
5
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
6
+ use RebelCode\Spotlight\Instagram\MediaStore\IgCachedMedia;
7
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaProcessorInterface;
8
+
9
+ /**
10
+ * Sorts media according to a feed's options.
11
+ *
12
+ * @since 0.1
13
+ */
14
+ class MediaSorterProcessor implements MediaProcessorInterface
15
+ {
16
+ /**
17
+ * @inheritDoc
18
+ *
19
+ * @since 0.1
20
+ */
21
+ public function process(array &$mediaList, Feed $feed)
22
+ {
23
+ $fOrder = $feed->getOption('postOrder');
24
+
25
+ switch ($fOrder) {
26
+ case 'date_asc':
27
+ case 'date_desc':
28
+ {
29
+ $mult = ($fOrder === 'date_asc') ? 1 : -1;
30
+
31
+ usort($mediaList, function (IgCachedMedia $m1, IgCachedMedia $m2) use ($mult) {
32
+ $t1 = $m1->getTimestamp();
33
+ $t2 = $m2->getTimestamp();
34
+
35
+ // If both have dates
36
+ if ($t1 !== null && $t2 !== null) {
37
+ return ($t1 <=> $t2) * $mult;
38
+ }
39
+
40
+ // If m2 has no date, consider it as more recent
41
+ if ($t1 !== null) {
42
+ return $mult;
43
+ }
44
+
45
+ // If m1 has no date, consider it as more recent
46
+ if ($t2 !== null) {
47
+ return -$mult;
48
+ }
49
+
50
+ // Neither have dates
51
+ return 0;
52
+ });
53
+
54
+ break;
55
+ }
56
+
57
+ case 'popularity_asc':
58
+ case 'popularity_desc':
59
+ {
60
+ $mult = ($fOrder === 'popularity_asc') ? 1 : -1;
61
+
62
+ usort($mediaList, function (IgCachedMedia $m1, IgCachedMedia $m2) use ($mult) {
63
+ $s1 = $m1->getLikesCount() + $m1->getCommentsCount();
64
+ $s2 = $m2->getLikesCount() + $m2->getCommentsCount();
65
+
66
+ return ($s1 <=> $s2) * $mult;
67
+ });
68
+
69
+ break;
70
+ }
71
+
72
+ case 'random':
73
+ {
74
+ $mediaList = $this->shuffleMedia($mediaList);
75
+
76
+ break;
77
+ }
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Shuffles the order of media in a given list.
83
+ *
84
+ * @since 0.1
85
+ *
86
+ * @param IgCachedMedia[] $media A list of media objects.
87
+ *
88
+ * @return IgCachedMedia[] The shuffled list of media.
89
+ */
90
+ protected function shuffleMedia(array $media)
91
+ {
92
+ $count = count($media);
93
+ // If empty or only 1 element, do nothing
94
+ if ($count < 2) {
95
+ return $media;
96
+ }
97
+
98
+ // Iterate backwards
99
+ $currIdx = $count - 1;
100
+ while ($currIdx !== 0) {
101
+ // Pick a random element
102
+ $randIdx = rand(0, $currIdx - 1);
103
+
104
+ // Swap with current
105
+ $temp = $media[$currIdx];
106
+ $media[$currIdx] = $media[$randIdx];
107
+ $media[$randIdx] = $temp;
108
+
109
+ // Move to previous media in the list
110
+ $currIdx--;
111
+ }
112
+
113
+ return $media;
114
+ }
115
+ }
core/Module.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram;
4
+
5
+ use Dhii\Modular\Module\ModuleInterface;
6
+ use Interop\Container\ServiceProviderInterface;
7
+
8
+ /**
9
+ * Padding layer for modules, implementing the service provider interface to avoid implementing the setup method.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ abstract class Module implements ModuleInterface, ServiceProviderInterface
14
+ {
15
+ /**
16
+ * @inheritDoc
17
+ *
18
+ * @since 0.1
19
+ */
20
+ public function setup() : ServiceProviderInterface
21
+ {
22
+ return $this;
23
+ }
24
+ }
core/Plugin.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram;
4
+
5
+ use Dhii\Modular\Module\ModuleInterface;
6
+ use Dhii\Services\Extension;
7
+ use Dhii\Services\Factories\Value;
8
+ use Dhii\Services\Factory;
9
+ use Psr\Container\ContainerInterface;
10
+
11
+ /**
12
+ * The plugin's core newModule.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class Plugin extends Module
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var string
22
+ */
23
+ protected $pluginFile;
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var ModuleInterface[]
29
+ */
30
+ protected $modules;
31
+
32
+ /**
33
+ * @since 0.1
34
+ *
35
+ * @var Factory[]
36
+ */
37
+ protected $factories;
38
+
39
+ /**
40
+ * @since 0.1
41
+ *
42
+ * @var Extension[]
43
+ */
44
+ protected $extensions;
45
+
46
+ /**
47
+ * Constructor.
48
+ *
49
+ * @since 0.1
50
+ *
51
+ * @param string $pluginFile The path to the plugin file.
52
+ * @param ModuleInterface[] $modules The plugin's modules.
53
+ */
54
+ public function __construct(string $pluginFile, array $modules)
55
+ {
56
+ $this->pluginFile = $pluginFile;
57
+ $this->modules = $modules;
58
+
59
+ $this->compileServices();
60
+ }
61
+
62
+ /**
63
+ * Retrieves the modules.
64
+ *
65
+ * @since 0.1
66
+ *
67
+ * @return ModuleInterface[] A list of module instances.
68
+ */
69
+ public function getModules() : array
70
+ {
71
+ return $this->modules;
72
+ }
73
+
74
+ /**
75
+ * Retrieves the compiled services.
76
+ *
77
+ * @since 0.1
78
+ *
79
+ * @return array A tuple array with two entries: the factory and the extension maps.
80
+ */
81
+ public function getCompiledServices() : array
82
+ {
83
+ return [$this->factories, $this->extensions];
84
+ }
85
+
86
+ /**
87
+ * @since 0.1
88
+ *
89
+ * @return Factory[]
90
+ */
91
+ public function getCoreFactories() : array
92
+ {
93
+ return [
94
+ 'plugin' => new Value($this),
95
+ 'plugin/modules' => new Value($this->modules),
96
+ 'plugin/file' => new Value($this->pluginFile),
97
+ 'plugin/dir' => new Value(dirname($this->pluginFile)),
98
+ 'plugin/url' => new Factory(['plugin/file'], function ($file) {
99
+ return rtrim(plugin_dir_url($file), '\\/');
100
+ }),
101
+ ];
102
+ }
103
+
104
+ /**
105
+ * @since 0.1
106
+ *
107
+ * @return Extension[]
108
+ */
109
+ public function getCoreExtensions() : array
110
+ {
111
+ return [];
112
+ }
113
+
114
+ /**
115
+ * @inheritDoc
116
+ */
117
+ public function getFactories() : array
118
+ {
119
+ return $this->factories;
120
+ }
121
+
122
+ /**
123
+ * @inheritDoc
124
+ */
125
+ public function getExtensions() : array
126
+ {
127
+ return $this->extensions;
128
+ }
129
+
130
+ /**
131
+ * @inheritDoc
132
+ */
133
+ public function run(ContainerInterface $c)
134
+ {
135
+ foreach ($this->modules as $module) {
136
+ $module->run($c);
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Compiles all of the newModule services.
142
+ *
143
+ * @since 0.1
144
+ */
145
+ protected function compileServices()
146
+ {
147
+ $this->factories = $this->getCoreFactories();
148
+ $this->extensions = $this->getCoreExtensions();
149
+
150
+ foreach ($this->modules as $module) {
151
+ $this->factories = array_merge($this->factories, $module->getFactories());
152
+ $moduleExtensions = $module->getExtensions();
153
+
154
+ if (empty($this->extensions)) {
155
+ $this->extensions = $moduleExtensions;
156
+ continue;
157
+ }
158
+
159
+ foreach ($moduleExtensions as $key => $extension) {
160
+ if (!array_key_exists($key, $this->extensions)) {
161
+ $this->extensions[$key] = $extension;
162
+ continue;
163
+ }
164
+
165
+ $prevExtension = $this->extensions[$key];
166
+ $this->extensions[$key] = function (ContainerInterface $c, $prev) use ($prevExtension, $extension) {
167
+ return $extension($c, $prevExtension($c, $prev));
168
+ };
169
+ }
170
+ }
171
+ }
172
+ }
core/PostTypes/AccountPostType.php ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\PostTypes;
4
+
5
+ use RebelCode\Spotlight\Instagram\IgApi\AccessToken;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgAccount;
7
+ use RebelCode\Spotlight\Instagram\IgApi\IgUser;
8
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaSource;
9
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
10
+ use RuntimeException;
11
+ use WP_Error;
12
+ use WP_Post;
13
+
14
+ /**
15
+ * The post type for accounts.
16
+ *
17
+ * This class extends the {@link PostType} class only as a formality. The primary purpose of this class is to house
18
+ * the meta key constants and functionality for dealing with posts of the account custom post type.
19
+ *
20
+ * @since 0.1
21
+ */
22
+ class AccountPostType extends PostType
23
+ {
24
+ const USER_ID = '_sli_user_id';
25
+ const USERNAME = '_sli_username';
26
+ const NAME = '_sli_name';
27
+ const BIO = '_sli_bio';
28
+ const TYPE = '_sli_account_type';
29
+ const MEDIA_COUNT = '_sli_media_count';
30
+ const PROFILE_PIC_URL = '_sli_profile_pic_url';
31
+ const FOLLOWERS_COUNT = '_sli_followers_count';
32
+ const FOLLOWS_COUNT = '_sli_follows_count';
33
+ const WEBSITE = '_sli_website';
34
+ const CUSTOM_PROFILE_PIC = '_sli_custom_profile_pic';
35
+ const CUSTOM_BIO = '_sli_custom_bio';
36
+ const ACCESS_TOKEN = '_sli_access_token';
37
+ const ACCESS_EXPIRY = '_sli_access_expires';
38
+
39
+ /**
40
+ * Converts a WordPress post into an IG account instance.
41
+ *
42
+ * @since 0.1
43
+ *
44
+ * @param WP_Post $post
45
+ *
46
+ * @return IgAccount
47
+ */
48
+ public static function fromWpPost(WP_Post $post) : IgAccount
49
+ {
50
+ $accessToken = new AccessToken(
51
+ $post->{static::ACCESS_TOKEN},
52
+ $post->{static::ACCESS_EXPIRY}
53
+ );
54
+
55
+ $user = IgUser::create([
56
+ 'id' => $post->{static::USER_ID},
57
+ 'username' => $post->{static::USERNAME},
58
+ 'name' => $post->{static::NAME},
59
+ 'biography' => $post->{static::BIO},
60
+ 'account_type' => $post->{static::TYPE},
61
+ 'media_count' => $post->{static::MEDIA_COUNT},
62
+ 'profile_picture_url' => $post->{static::PROFILE_PIC_URL},
63
+ 'followers_count' => $post->{static::FOLLOWERS_COUNT},
64
+ 'follows_count' => $post->{static::FOLLOWS_COUNT},
65
+ 'website' => $post->{static::WEBSITE},
66
+ ]);
67
+
68
+ return new IgAccount($user, $accessToken);
69
+ }
70
+
71
+ /**
72
+ * Converts an IG account instance into a WordPress post.
73
+ *
74
+ * @since 0.1
75
+ *
76
+ * @param IgAccount $account
77
+ *
78
+ * @return array
79
+ */
80
+ public static function toWpPost(IgAccount $account) : array
81
+ {
82
+ $user = $account->getUser();
83
+ $accessToken = $account->getAccessToken();
84
+
85
+ return [
86
+ 'post_title' => $user->getUsername(),
87
+ 'post_status' => 'publish',
88
+ 'meta_input' => [
89
+ static::USER_ID => $user->getId(),
90
+ static::USERNAME => $user->getUsername(),
91
+ static::NAME => $user->getName(),
92
+ static::BIO => $user->getBio(),
93
+ static::TYPE => $user->getType(),
94
+ static::MEDIA_COUNT => $user->getMediaCount(),
95
+ static::PROFILE_PIC_URL => $user->getProfilePicUrl(),
96
+ static::FOLLOWERS_COUNT => $user->getFollowersCount(),
97
+ static::FOLLOWS_COUNT => $user->getFollowsCount(),
98
+ static::WEBSITE => $user->getWebsite(),
99
+ static::ACCESS_TOKEN => $accessToken->getCode(),
100
+ static::ACCESS_EXPIRY => $accessToken->getExpires(),
101
+ ],
102
+ ];
103
+ }
104
+
105
+ /**
106
+ * Converts a WordPress post into a post array for an account.
107
+ *
108
+ * @since 0.1
109
+ *
110
+ * @param WP_Post $post The post.
111
+ *
112
+ * @return array The post array.
113
+ */
114
+ public static function fromWpPostToArray(WP_Post $post) : array
115
+ {
116
+ $array = static::toWpPost(static::fromWpPost($post));
117
+
118
+ $array['meta_input'][static::CUSTOM_PROFILE_PIC] = $post->{static::CUSTOM_PROFILE_PIC};
119
+ $array['meta_input'][static::CUSTOM_BIO] = $post->{static::CUSTOM_BIO};
120
+
121
+ return $array;
122
+ }
123
+
124
+ /**
125
+ * Finds and retrieves a business account.
126
+ *
127
+ * @since 0.1
128
+ *
129
+ * @param PostType $cpt The post type instance.
130
+ *
131
+ * @return IgAccount|null The found business account, or null if none could be found.
132
+ */
133
+ public static function findBusinessAccount(PostType $cpt)
134
+ {
135
+ $accounts = $cpt->query([
136
+ 'meta_query' => [
137
+ [
138
+ 'key' => AccountPostType::TYPE,
139
+ 'value' => IgUser::TYPE_BUSINESS,
140
+ ],
141
+ ],
142
+ ]);
143
+
144
+ return count($accounts) > 0
145
+ ? AccountPostType::fromWpPost($accounts[0])
146
+ : null;
147
+ }
148
+
149
+ /**
150
+ * Inserts an account into the database, or updates an existing account if it already exists in the database.
151
+ *
152
+ * @since 0.1
153
+ *
154
+ * @param PostType $cpt The post type.
155
+ * @param IgAccount $account The account instance.
156
+ *
157
+ * @return int The inserted ID.
158
+ *
159
+ * @throws RuntimeException If the insertion or update failed.
160
+ */
161
+ public static function insertOrUpdate(PostType $cpt, IgAccount $account)
162
+ {
163
+ $existing = $cpt->query([
164
+ 'meta_query' => [
165
+ [
166
+ 'key' => static::USER_ID,
167
+ 'value' => $account->getUser()->getId(),
168
+ ],
169
+ ],
170
+ ]);
171
+
172
+ $data = static::toWpPost($account);
173
+
174
+ $result = (count($existing) > 0)
175
+ ? $cpt->update($existing[0]->ID, $data)
176
+ : $cpt->insert($data);
177
+
178
+ if ($result instanceof WP_Error) {
179
+ throw new RuntimeException($result->get_error_message());
180
+ }
181
+
182
+ return $result;
183
+ }
184
+
185
+ /**
186
+ * Deletes an account and its associated media from the DB.
187
+ *
188
+ * @since 0.1
189
+ *
190
+ * @param string $id The ID of the account to delete.
191
+ * @param PostType $accountsCpt The accounts post type.
192
+ * @param PostType $mediaCpt The media post type.
193
+ *
194
+ * @return bool True on success, false on failure.
195
+ */
196
+ public static function deleteWithMedia($id, PostType $accountsCpt, PostType $mediaCpt)
197
+ {
198
+ // Make sure the account exists
199
+ $post = $accountsCpt->get($id);
200
+ if ($post === null) {
201
+ return false;
202
+ }
203
+
204
+ // Delete associated media
205
+ static::deleteAccountMedia($id, $accountsCpt, $mediaCpt);
206
+
207
+ // Delete the account
208
+ $result = $accountsCpt->delete($id);
209
+ if ($result === false) {
210
+ return false;
211
+ }
212
+
213
+ return true;
214
+ }
215
+
216
+ /**
217
+ * Deletes all media associated with an account, by ID.
218
+ *
219
+ * @since 0.1
220
+ *
221
+ * @param string $id The ID of the account to delete.
222
+ * @param PostType $accountsCpt The accounts post type.
223
+ * @param PostType $mediaCpt The media post type.
224
+ *
225
+ * @return bool True on success, false on failure.
226
+ */
227
+ public static function deleteAccountMedia($id, PostType $accountsCpt, PostType $mediaCpt)
228
+ {
229
+ // Make sure the account exists
230
+ $post = $accountsCpt->get($id);
231
+ if ($post === null) {
232
+ return false;
233
+ }
234
+
235
+ // Get the source for the account's user
236
+ $account = static::fromWpPost($post);
237
+ $user = $account->getUser();
238
+ $source = MediaSource::forUser($user);
239
+
240
+ MediaPostType::deleteForSource($source, $mediaCpt);
241
+
242
+ return true;
243
+ }
244
+ }
core/PostTypes/FeedPostType.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\PostTypes;
4
+
5
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
6
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
7
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
8
+ use WP_Post;
9
+ use wpdb;
10
+
11
+ /**
12
+ * The post type for feeds.
13
+ *
14
+ * This class extends the {@link PostType} class only as a formality. The primary purpose of this class is to house
15
+ * the meta key constants and functionality for dealing with posts of the feed custom post type.
16
+ *
17
+ * @since 0.1
18
+ */
19
+ class FeedPostType extends PostType
20
+ {
21
+ /**
22
+ * The meta key for a feed's options.
23
+ *
24
+ * @since 0.1
25
+ */
26
+ const OPTIONS = '_sli_options';
27
+
28
+ /**
29
+ * Converts a WordPress post into a feed instance.
30
+ *
31
+ * @since 0.1
32
+ *
33
+ * @param WP_Post $post
34
+ *
35
+ * @return Feed
36
+ */
37
+ public static function fromWpPost(WP_Post $post)
38
+ {
39
+ return new Feed($post->ID, $post->post_title, $post->{static::OPTIONS});
40
+ }
41
+
42
+ /**
43
+ * Converts a feed instance into a WordPress post array.
44
+ *
45
+ * @since 0.1
46
+ *
47
+ * @param Feed $feed
48
+ *
49
+ * @return array
50
+ */
51
+ public static function toWpPost(Feed $feed)
52
+ {
53
+ return [
54
+ 'ID' => $feed->getId(),
55
+ 'post_title' => $feed->getName(),
56
+ 'post_status' => 'publish',
57
+ 'meta_input' => [
58
+ static::OPTIONS => $feed->getOptions(),
59
+ ],
60
+ ];
61
+ }
62
+
63
+ /**
64
+ * Finds usages of the shortcode for a specific feed.
65
+ *
66
+ * @since 0.1
67
+ *
68
+ * @param Feed $feed The feed instance.
69
+ * @param wpdb $wpdb The WordPress database driver.
70
+ *
71
+ * @return array A list of associative sub-arrays, each containing information about posts whose contents include
72
+ * an occurrence of the shortcode with the given feed's ID. Each sub-array will have the below keys:
73
+ * 'id' => The ID of the post
74
+ * 'name' => The title of the post
75
+ * 'type' => The post type
76
+ * 'link' => The URL to the post's edit page
77
+ */
78
+ public static function getShortcodeUsages(Feed $feed, wpdb $wpdb)
79
+ {
80
+ $query = sprintf(
81
+ "SELECT ID, post_title, post_type
82
+ FROM %s
83
+ WHERE post_type != 'revision' AND
84
+ post_status != 'trash' AND
85
+ post_content REGEXP '\\[instagram[[:blank:]]+feed=[\\'\"]%s[\\'\"]'",
86
+ $wpdb->prefix . 'posts',
87
+ $feed->getId()
88
+ );
89
+
90
+ $results = $wpdb->get_results($query);
91
+
92
+ return Arrays::map($results, function ($row) {
93
+ return [
94
+ 'id' => $row->ID,
95
+ 'name' => $row->post_title,
96
+ 'type' => get_post_type_object($row->post_type)->labels->singular_name,
97
+ 'link' => get_edit_post_link($row->ID, ''),
98
+ ];
99
+ });
100
+ }
101
+
102
+ /**
103
+ * Work in progress.
104
+ *
105
+ * @since 0.1
106
+ *
107
+ * @param Feed $feed
108
+ */
109
+ public static function getWidgetUsages(Feed $feed)
110
+ {
111
+ $id = $feed->getId();
112
+
113
+ $sidebars = get_option('sidebars_widgets', []);
114
+ $sliWidgets = get_option('widget_sli-feed', []);
115
+ $widgetEditLink = admin_url('customize.php?autofocus[panel]=widgets');
116
+
117
+ unset($sidebars['wp_inactive_widgets']);
118
+ unset($sidebars['array_version']);
119
+
120
+ foreach ($sidebars as $sidebar => $widgetList) {
121
+ foreach ($widgetList as $widgetId) {
122
+ if (strpos($widgetId, 'sli-feed-') !== 0) {
123
+ continue;
124
+ }
125
+
126
+ $actualId = substr($widgetId, 9);
127
+
128
+ if (!array_key_exists($actualId, $sliWidgets)) {
129
+ continue;
130
+ }
131
+
132
+ if ($sliWidgets[$actualId]['feed'] == $id) {
133
+ $usages[] = [
134
+ 'id' => $actualId,
135
+ 'name' => $sliWidgets[$actualId]['title'],
136
+ 'type' => 'Widget',
137
+ 'link' => $widgetEditLink,
138
+ ];
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
core/PostTypes/MediaPostType.php ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\PostTypes;
4
+
5
+ use DateTime;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgComment;
7
+ use RebelCode\Spotlight\Instagram\MediaStore\IgCachedMedia;
8
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaSource;
9
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
10
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
11
+ use WP_Post;
12
+
13
+ /**
14
+ * The post type for media.
15
+ *
16
+ * This class extends the {@link PostType} class only as a formality. The primary purpose of this class is to house
17
+ * the meta key constants and functionality for dealing with posts of the media custom post type.
18
+ *
19
+ * @since 0.1
20
+ */
21
+ class MediaPostType extends PostType
22
+ {
23
+ const MEDIA_ID = '_sli_media_id';
24
+ const USERNAME = '_sli_media_username';
25
+ const TIMESTAMP = '_sli_timestamp';
26
+ const CAPTION = '_sli_caption';
27
+ const TYPE = '_sli_media_type';
28
+ const URL = '_sli_media_url';
29
+ const PERMALINK = '_sli_permalink';
30
+ const THUMBNAIL_URL = '_sli_thumbnail_url';
31
+ const LIKES_COUNT = '_sli_likes_count';
32
+ const COMMENTS_COUNT = '_sli_comments_count';
33
+ const COMMENTS = '_sli_comments';
34
+ const CHILDREN = '_sli_children';
35
+ const LAST_REQUESTED = '_sli_last_requested';
36
+ const SOURCE_NAME = '_sli_source_name';
37
+ const SOURCE_TYPE = '_sli_source_type';
38
+
39
+ /**
40
+ * Converts a WordPress post into an IG media instance.
41
+ *
42
+ * @since 0.1
43
+ *
44
+ * @param WP_Post $post
45
+ *
46
+ * @return IgCachedMedia
47
+ */
48
+ public static function fromWpPost(WP_Post $post) : IgCachedMedia
49
+ {
50
+ return IgCachedMedia::create([
51
+ 'post' => $post,
52
+ 'id' => $post->{static::MEDIA_ID},
53
+ 'username' => $post->{static::USERNAME},
54
+ 'timestamp' => $post->{static::TIMESTAMP},
55
+ 'caption' => $post->{static::CAPTION},
56
+ 'media_type' => $post->{static::TYPE},
57
+ 'media_url' => $post->{static::URL},
58
+ 'permalink' => $post->{static::PERMALINK},
59
+ 'thumbnail_url' => $post->{static::THUMBNAIL_URL},
60
+ 'likes_count' => $post->{static::LIKES_COUNT},
61
+ 'comments_count' => $post->{static::COMMENTS_COUNT},
62
+ 'comments' => array_map([IgComment::class, 'create'], $post->{static::COMMENTS}),
63
+ 'children' => $post->{static::CHILDREN},
64
+ 'last_requested' => $post->{static::LAST_REQUESTED},
65
+ 'source' => MediaSource::create([
66
+ 'name' => $post->{static::SOURCE_NAME},
67
+ 'type' => $post->{static::SOURCE_TYPE},
68
+ ]),
69
+ ]);
70
+ }
71
+
72
+ /**
73
+ * Converts an IG media instance into a WordPress post.
74
+ *
75
+ * @since 0.1
76
+ *
77
+ * @param IgCachedMedia $media
78
+ *
79
+ * @return array
80
+ */
81
+ public static function toWpPost(IgCachedMedia $media) : array
82
+ {
83
+ $timestamp = $media->getTimestamp();
84
+ $source = $media->getSource();
85
+
86
+ return [
87
+ 'post_title' => $media->getCaption(),
88
+ 'post_status' => 'publish',
89
+ 'meta_input' => [
90
+ static::MEDIA_ID => $media->getId(),
91
+ static::USERNAME => $media->getUsername(),
92
+ static::TIMESTAMP => $timestamp ? $timestamp->format(DateTime::ISO8601) : null,
93
+ static::CAPTION => $media->getCaption(),
94
+ static::TYPE => $media->getType(),
95
+ static::URL => $media->getUrl(),
96
+ static::PERMALINK => $media->getPermalink(),
97
+ static::THUMBNAIL_URL => $media->getThumbnailUrl(),
98
+ static::LIKES_COUNT => $media->getLikesCount(),
99
+ static::COMMENTS_COUNT => $media->getCommentsCount(),
100
+ static::COMMENTS => array_map([static::class, 'commentToArray'], $media->getComments()),
101
+ static::CHILDREN => $media->getChildren(),
102
+ static::LAST_REQUESTED => $media->getLastRequested(),
103
+ static::SOURCE_NAME => $source->getName(),
104
+ static::SOURCE_TYPE => $source->getType(),
105
+ ],
106
+ ];
107
+ }
108
+
109
+ /**
110
+ * Converts a comment into an array for storing in post meta.
111
+ *
112
+ * @since 0.1
113
+ *
114
+ * @param IgComment $comment The comment instance.
115
+ *
116
+ * @return array
117
+ */
118
+ public static function commentToArray(IgComment $comment)
119
+ {
120
+ return [
121
+ 'id' => $comment->getId(),
122
+ 'username' => $comment->getUsername(),
123
+ 'text' => $comment->getText(),
124
+ 'timestamp' => $comment->getTimestamp()->format(DateTime::ISO8601),
125
+ 'like_count' => $comment->getLikeCount(),
126
+ ];
127
+ }
128
+
129
+ /**
130
+ * Deletes all media associated with a particular source.
131
+ *
132
+ * @since 0.1
133
+ *
134
+ * @param MediaSource $source The source for which to delete media.
135
+ * @param PostType $cpt The media post type.
136
+ *
137
+ * @return int The number of deleted media.
138
+ */
139
+ public static function deleteForSource(MediaSource $source, PostType $cpt)
140
+ {
141
+ $media = $cpt->query([
142
+ 'meta_query' => [
143
+ 'relation' => 'AND',
144
+ [
145
+ 'key' => MediaPostType::SOURCE_NAME,
146
+ 'value' => $source->getName(),
147
+ ],
148
+ [
149
+ 'key' => MediaPostType::SOURCE_TYPE,
150
+ 'value' => $source->getType(),
151
+ ],
152
+ ],
153
+ ]);
154
+
155
+ $count = 0;
156
+ Arrays::each($media, function (WP_Post $post) use (&$count) {
157
+ $result = wp_delete_post($post->ID, true);
158
+
159
+ if (!empty($result)) {
160
+ $count++;
161
+ }
162
+ });
163
+
164
+ return $count;
165
+ }
166
+ }
core/PrefixingModule.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram;
4
+
5
+ use Dhii\Container\DeprefixingContainer;
6
+ use Dhii\Modular\Module\ModuleInterface;
7
+ use Dhii\Services\Service;
8
+ use Psr\Container\ContainerInterface;
9
+
10
+ /**
11
+ * A module decorator that prefixes all of a module's services.
12
+ *
13
+ * This instance ensures that all service factories given by the inner module are prefixed. In addition, the decorator
14
+ * will also prefix all service dependencies for both factories and extensions.
15
+ *
16
+ * Naturally, prefixing can break references to services outside of the module. For this reason, extension keys will NOT
17
+ * be prefixed and dependencies that start with an '@' character will also NOT be prefixed. This gives modules the
18
+ * ability to extend or depend on external services.
19
+ *
20
+ * Example:
21
+ * ```
22
+ * [
23
+ * "foo" => new Constructor(Foo::class, ['bar']),
24
+ * "bar" => new Value("hello"),
25
+ * ]
26
+ * // If prefix is set to "pre/", the above will be transformed into:
27
+ * [
28
+ * "pre/foo" => new Constructor(Foo::class, ['pre/bar']),
29
+ * "pre/bar" => new Value("hello"),
30
+ * ]
31
+ * ```
32
+ *
33
+ * @since 0.1
34
+ */
35
+ class PrefixingModule extends Module
36
+ {
37
+ /**
38
+ * @since 0.1
39
+ *
40
+ * @var string
41
+ */
42
+ protected $prefix;
43
+
44
+ /**
45
+ * @since 0.1
46
+ *
47
+ * @var ModuleInterface
48
+ */
49
+ protected $inner;
50
+
51
+ /**
52
+ * Constructor.
53
+ *
54
+ * @since 0.1
55
+ *
56
+ * @param string $prefix The prefix to apply to service keys.
57
+ * @param ModuleInterface $inner The module instance to which to apply the prefixing.
58
+ */
59
+ public function __construct(string $prefix, ModuleInterface $inner)
60
+ {
61
+ $this->prefix = $prefix;
62
+ $this->inner = $inner;
63
+ }
64
+
65
+ /**
66
+ * @inheritDoc
67
+ *
68
+ * @since 0.1
69
+ */
70
+ public function getFactories() : array
71
+ {
72
+ return $this->prefixFactories($this->inner->getFactories());
73
+ }
74
+
75
+ /**
76
+ * @inheritDoc
77
+ *
78
+ * @since 0.1
79
+ */
80
+ public function getExtensions() : array
81
+ {
82
+ return $this->prefixExtensions($this->inner->getExtensions());
83
+ }
84
+
85
+ /**
86
+ * @inheritDoc
87
+ *
88
+ * @since 0.1
89
+ */
90
+ public function run(ContainerInterface $c)
91
+ {
92
+ $container = new DeprefixingContainer($c, $this->prefix, false);
93
+
94
+ $this->inner->run($container);
95
+ }
96
+
97
+ /**
98
+ * Applies the prefix to a service key.
99
+ *
100
+ * Service keys that start with '@' are not prefixed, but the '@' is omitted.
101
+ *
102
+ * @since 0.1
103
+ *
104
+ * @param string $key The service key.
105
+ *
106
+ * @return string The prefixed service key.
107
+ */
108
+ protected function applyPrefix(string $key)
109
+ {
110
+ return ($key[0] === '@')
111
+ ? substr($key, 1)
112
+ : $this->prefix . $key;
113
+ }
114
+
115
+ /**
116
+ * Prefixes a list of factories.
117
+ *
118
+ * @since 0.1
119
+ *
120
+ * @param Service[] $factories The factories to prefix.
121
+ *
122
+ * @return Service[] The list of prefixed factories.
123
+ */
124
+ protected function prefixFactories(array $factories)
125
+ {
126
+ $results = [];
127
+
128
+ foreach ($factories as $key => $factory) {
129
+ $newKey = $this->applyPrefix($key);
130
+
131
+ $results[$newKey] = $this->prefixDependencies($factory);
132
+ }
133
+
134
+ return $results;
135
+ }
136
+
137
+ /**
138
+ * Prefixes a list of extensions.
139
+ *
140
+ * @since 0.1
141
+ *
142
+ * @param Service[] $extensions The extensions to prefix.
143
+ *
144
+ * @return Service[] The list of prefixed extensions.
145
+ */
146
+ protected function prefixExtensions(array $extensions)
147
+ {
148
+ $results = [];
149
+
150
+ foreach ($extensions as $key => $extension) {
151
+ $results[$key] = $this->prefixDependencies($extension);
152
+ }
153
+
154
+ return $results;
155
+ }
156
+
157
+ /**
158
+ * Creates a copy of the service with its dependencies prefixed.
159
+ *
160
+ * @since 0.1
161
+ *
162
+ * @param callable|Service $service The service whose dependencies to prefix.
163
+ *
164
+ * @return Service The new service.
165
+ */
166
+ protected function prefixDependencies($service)
167
+ {
168
+ if (!($service instanceof Service)) {
169
+ return $service;
170
+ }
171
+
172
+ $dependencies = $service->getDependencies();
173
+ $dependencies = array_map([$this, 'applyPrefix'], $dependencies);
174
+
175
+ return $service->withDependencies($dependencies);
176
+ }
177
+ }
core/RestApi/Auth/AuthUserCapability.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Auth;
4
+
5
+ use RebelCode\Spotlight\Instagram\RestApi\AuthGuardInterface;
6
+ use WP_REST_Request;
7
+
8
+ /**
9
+ * A REST API auth handler that checks if the request is sent by a logged in user that has a specific capability.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ class AuthUserCapability implements AuthGuardInterface
14
+ {
15
+ /**
16
+ * @since 0.1
17
+ *
18
+ * @var string
19
+ */
20
+ protected $capability;
21
+
22
+ /**
23
+ * Constructor.
24
+ *
25
+ * @since 0.1
26
+ *
27
+ * @param string $capability The required user capability.
28
+ */
29
+ public function __construct(string $capability)
30
+ {
31
+ $this->capability = $capability;
32
+ }
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ *
37
+ * @since 0.1
38
+ */
39
+ public function getAuthErrors(WP_REST_Request $request) : array
40
+ {
41
+ $userId = get_current_user_id();
42
+
43
+ if ($userId === 0) {
44
+ return ['You must be logged in'];
45
+ }
46
+
47
+ if (!user_can($userId, $this->capability)) {
48
+ return ['You do not have permission to complete this action'];
49
+ }
50
+
51
+ return [];
52
+ }
53
+ }
core/RestApi/Auth/AuthVerifyNonce.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Auth;
4
+
5
+ use RebelCode\Spotlight\Instagram\RestApi\AuthGuardInterface;
6
+ use WP_REST_Request;
7
+
8
+ /**
9
+ * A REST API auth handler implementation that verifies the validity of a WordPress nonce in the request.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ class AuthVerifyNonce implements AuthGuardInterface
14
+ {
15
+ /**
16
+ * The name of the nonce to validate.
17
+ *
18
+ * @since 0.1
19
+ *
20
+ * @var string
21
+ */
22
+ protected $nonce;
23
+
24
+ /**
25
+ * The name of the header from where the nonce value is read.
26
+ *
27
+ * @since 0.1
28
+ *
29
+ * @var string
30
+ */
31
+ protected $header;
32
+
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @since 0.1
37
+ *
38
+ * @param string $header The name of the header from where the nonce value is read.
39
+ * @param string $nonce The name of the nonce to validate.
40
+ */
41
+ public function __construct($header, $nonce)
42
+ {
43
+ $this->header = $header;
44
+ $this->nonce = $nonce;
45
+ }
46
+
47
+ /**
48
+ * {@inheritdoc}
49
+ *
50
+ * @since 0.1
51
+ */
52
+ public function getAuthErrors(WP_REST_Request $request) : array
53
+ {
54
+ $value = $request->get_header($this->header);
55
+ $valid = wp_verify_nonce($value, $this->nonce);
56
+
57
+ if (!$valid) {
58
+ return ['Request nonce is invalid or has expired',];
59
+ }
60
+
61
+ return [];
62
+ }
63
+ }
core/RestApi/AuthGuardInterface.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi;
4
+
5
+ use WP_REST_Request;
6
+
7
+ /**
8
+ * Represents an authorization guard for the REST API.
9
+ *
10
+ * Objects that implement this interface are used to determine if a client is authorized to carry out a specific
11
+ * request.
12
+ *
13
+ * @since 0.1
14
+ */
15
+ interface AuthGuardInterface
16
+ {
17
+ /**
18
+ * Retrieves any
19
+ *
20
+ * @since 0.1
21
+ *
22
+ * @param WP_REST_Request $request The request.
23
+ *
24
+ * @return array|null Any authorization error messages. An empty array signifies that the request is authorized.
25
+ */
26
+ public function getAuthErrors(WP_REST_Request $request) : array;
27
+ }
core/RestApi/EndPoint.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi;
4
+
5
+ /**
6
+ * A simple implementation of a REST API endpoint.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class EndPoint
11
+ {
12
+ /**
13
+ * The endpoint's route.
14
+ *
15
+ * @since 0.1
16
+ *
17
+ * @var string
18
+ */
19
+ protected $route;
20
+
21
+ /**
22
+ * The endpoint's accepted HTTP methods.
23
+ *
24
+ * @since 0.1
25
+ *
26
+ * @var string[]
27
+ */
28
+ protected $methods;
29
+
30
+ /**
31
+ * The endpoint's handler.
32
+ *
33
+ * @since 0.1
34
+ *
35
+ * @var callable
36
+ */
37
+ protected $handler;
38
+
39
+ /**
40
+ * The endpoint's authorization handler, if any.
41
+ *
42
+ * @since 0.1
43
+ *
44
+ * @var AuthGuardInterface|null
45
+ */
46
+ protected $authHandler;
47
+
48
+ /**
49
+ * Constructor.
50
+ *
51
+ * @since 0.1
52
+ *
53
+ * @param string $route The route.
54
+ * @param string[] $methods The accepted HTTP methods.
55
+ * @param callable $handler The handler.
56
+ * @param AuthGuardInterface|null $authHandler Optional authorization handler.
57
+ */
58
+ public function __construct($route, array $methods, callable $handler, AuthGuardInterface $authHandler = null)
59
+ {
60
+ $this->route = $route;
61
+ $this->methods = $methods;
62
+ $this->handler = $handler;
63
+ $this->authHandler = $authHandler;
64
+ }
65
+
66
+ /**
67
+ * {@inheritdoc}
68
+ *
69
+ * @since 0.1
70
+ */
71
+ public function getRoute()
72
+ {
73
+ return $this->route;
74
+ }
75
+
76
+ /**
77
+ * {@inheritdoc}
78
+ *
79
+ * @since 0.1
80
+ */
81
+ public function getMethods()
82
+ {
83
+ return $this->methods;
84
+ }
85
+
86
+ /**
87
+ * {@inheritdoc}
88
+ *
89
+ * @since 0.1
90
+ */
91
+ public function getHandler()
92
+ {
93
+ return $this->handler;
94
+ }
95
+
96
+ /**
97
+ * {@inheritdoc}
98
+ *
99
+ * @since 0.1
100
+ */
101
+ public function getAuthHandler()
102
+ {
103
+ return $this->authHandler;
104
+ }
105
+ }
core/RestApi/EndPointManager.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi;
4
+
5
+ use WP_Error;
6
+ use WP_REST_Request;
7
+
8
+ /**
9
+ * A REST API endpoint manager.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ class EndPointManager
14
+ {
15
+ /**
16
+ * The namespace.
17
+ *
18
+ * @since 0.1
19
+ *
20
+ * @var string
21
+ */
22
+ protected $namespace;
23
+
24
+ /**
25
+ * The REST API endpoints.
26
+ *
27
+ * @since 0.1
28
+ *
29
+ * @var EndPoint[]
30
+ */
31
+ protected $endPoints;
32
+
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @since 0.1
37
+ *
38
+ * @param string $namespace The namespace.
39
+ * @param EndPoint[] $endPoints The REST API endpoints.
40
+ */
41
+ public function __construct($namespace, $endPoints)
42
+ {
43
+ $this->namespace = $namespace;
44
+ $this->endPoints = $endPoints;
45
+ }
46
+
47
+ /**
48
+ * Registers the routes and endpoints with WordPress.
49
+ *
50
+ * @since 0.1
51
+ */
52
+ public function register()
53
+ {
54
+ foreach ($this->endPoints as $endPoint) {
55
+ $route = $endPoint->getRoute();
56
+ $methods = $endPoint->getMethods();
57
+ $handler = $endPoint->getHandler();
58
+ $authFn = $endPoint->getAuthHandler();
59
+
60
+ register_rest_route($this->namespace, $route, [
61
+ 'methods' => $methods,
62
+ 'callback' => $handler,
63
+ 'permission_callback' => $this->getPermissionCallback($authFn),
64
+ ]);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Retrieves the permissions callback for an auth guard.
70
+ *
71
+ * @since 0.1
72
+ *
73
+ * @param AuthGuardInterface|null $auth The auth guard instance, if any.
74
+ *
75
+ * @return callable The callback.
76
+ */
77
+ protected function getPermissionCallback(AuthGuardInterface $auth = null)
78
+ {
79
+ if ($auth === null) {
80
+ return null;
81
+ }
82
+
83
+ return function (WP_REST_Request $request) use ($auth) {
84
+ $errors = $auth->getAuthErrors($request);
85
+
86
+ if (count($errors) === 0) {
87
+ return true;
88
+ }
89
+
90
+ return new WP_Error('unauthorized', 'Unauthorized', [
91
+ 'status' => 401,
92
+ 'reasons' => $errors,
93
+ ]);
94
+ };
95
+ }
96
+ }
core/RestApi/EndPoints/AbstractEndpointHandler.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use Exception;
7
+ use InvalidArgumentException;
8
+ use RebelCode\Spotlight\Instagram\RestApi\Transformers\CamelCaseTransformer;
9
+ use RebelCode\Spotlight\Instagram\RestApi\Transformers\CompositeTransformer;
10
+ use RebelCode\Spotlight\Instagram\RestApi\Transformers\RecursiveToArrayTransformer;
11
+ use Traversable;
12
+ use WP_Error;
13
+ use WP_REST_Request;
14
+ use WP_REST_Response;
15
+
16
+ /**
17
+ * Abstract functionality for REST API endpoint handlers.
18
+ *
19
+ * @since 0.1
20
+ */
21
+ abstract class AbstractEndpointHandler
22
+ {
23
+ /**
24
+ * @since 0.1
25
+ */
26
+ public function __invoke()
27
+ {
28
+ $request = func_get_arg(0);
29
+
30
+ if (!($request instanceof WP_REST_Request)) {
31
+ throw new InvalidArgumentException('Argument is not a WP_REST_Request instance');
32
+ }
33
+
34
+ try {
35
+ // Handle the request and get the response
36
+ $response = $this->handle($request);
37
+
38
+ if ($response instanceof WP_Error) {
39
+ return $response;
40
+ }
41
+
42
+ // Retrieve the data
43
+ $data = $response->get_data();
44
+ // Turn the data into an array if it's a traversable
45
+ $aData = ($data instanceof Traversable)
46
+ ? iterator_to_array($data)
47
+ : $data;
48
+
49
+ // Transform the data if a transformer is given
50
+ $transformer = $this->getTransformer();
51
+ $tData = ($transformer instanceof TransformerInterface)
52
+ ? $transformer->transform($aData)
53
+ : $aData;
54
+
55
+ // Only include fields that were requested
56
+ $fData = $request->has_param('fields')
57
+ ? array_intersect_key($tData, array_flip($request->get_param('fields')))
58
+ : $tData;
59
+
60
+ // Update the response with the final data
61
+ $response->set_data($fData);
62
+ } catch (Exception $exception) {
63
+ return $this->exceptionResponse($exception);
64
+ }
65
+
66
+ return $response;
67
+ }
68
+
69
+ /**
70
+ * Retrieves the response transformer to use, if any.
71
+ *
72
+ * @since 0.1
73
+ *
74
+ * @return TransformerInterface|null The transformer instance or null if no transformer is required.
75
+ */
76
+ protected function getTransformer()
77
+ {
78
+ return new CompositeTransformer([
79
+ new RecursiveToArrayTransformer(),
80
+ new CamelCaseTransformer(),
81
+ ]);
82
+ }
83
+
84
+ /**
85
+ * Creates an erroneous response from an exception.
86
+ *
87
+ * @since 0.1
88
+ *
89
+ * @param Exception $exception The exception from which to create the response.
90
+ *
91
+ * @return WP_Error The erroneous response.
92
+ */
93
+ protected function exceptionResponse(Exception $exception)
94
+ {
95
+ $message = $exception->getMessage();
96
+ $data = [
97
+ 'status' => 500,
98
+ 'trace' => [],
99
+ ];
100
+
101
+ foreach ($exception->getTrace() as $trace) {
102
+ $file = array_key_exists('file', $trace) ? basename($trace['file']) : '<unknown>';
103
+ $line = array_key_exists('line', $trace) ? $trace['line'] : '<unknown>';
104
+ $fn = array_key_exists('function', $trace) ? $trace['function'] : '<unknown>';
105
+
106
+ if (array_key_exists('args', $trace)) {
107
+ $args = array_map(function ($arg) {
108
+ if (is_scalar($arg)) {
109
+ return $arg;
110
+ }
111
+
112
+ return is_object($arg)
113
+ ? get_class($arg)
114
+ : gettype($arg);
115
+ }, $trace['args']);
116
+ $argsStr = implode(', ', $args);
117
+ } else {
118
+ $argsStr = '<unknown>';
119
+ }
120
+
121
+ $data['trace'][] = sprintf('%s(%s) @ %s:%s', $fn, $argsStr, $file, $line);
122
+ }
123
+
124
+ return new WP_Error('rest_api_error', $message, $data);
125
+ }
126
+
127
+ /**
128
+ * Handles the request and provides a response.
129
+ *
130
+ * @since 0.1
131
+ *
132
+ * @param WP_REST_Request $request The request.
133
+ *
134
+ * @return WP_REST_Response|WP_Error The response or error.
135
+ */
136
+ abstract protected function handle(WP_REST_Request $request);
137
+ }
core/RestApi/EndPoints/Accounts/ConnectAccountEndPoint.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
+
5
+ use RebelCode\Spotlight\Instagram\IgApi\AccessToken;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgAccount;
7
+ use RebelCode\Spotlight\Instagram\IgApi\IgApiClient;
8
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
9
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
10
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
11
+ use WP_Error;
12
+ use WP_REST_Request;
13
+ use WP_REST_Response;
14
+
15
+ class ConnectAccountEndPoint extends AbstractEndpointHandler
16
+ {
17
+ /**
18
+ * @since 0.1
19
+ *
20
+ * @var IgApiClient
21
+ */
22
+ protected $client;
23
+
24
+ /**
25
+ * @since 0.1
26
+ *
27
+ * @var callable
28
+ */
29
+ protected $cpt;
30
+
31
+ /**
32
+ * Constructor.
33
+ *
34
+ * @since 0.1
35
+ *
36
+ * @param IgApiClient $client The API client.
37
+ * @param PostType $cpt The accounts post type.
38
+ */
39
+ public function __construct(IgApiClient $client, PostType $cpt)
40
+ {
41
+ $this->client = $client;
42
+ $this->cpt = $cpt;
43
+ }
44
+
45
+ /**
46
+ * @inheritDoc
47
+ *
48
+ * @since 0.1
49
+ */
50
+ protected function handle(WP_REST_Request $request)
51
+ {
52
+ $tokenData = filter_var($request['accessToken'], FILTER_SANITIZE_STRING);
53
+
54
+ if (empty($tokenData)) {
55
+ return new WP_Error('missing_access_token', "Missing access token in request", ['status' => 401]);
56
+ }
57
+
58
+ $accessToken = new AccessToken($tokenData, 0);
59
+ $user = $this->client->getBasicApi()->getTokenUser($accessToken);
60
+ $account = new IgAccount($user, $accessToken);
61
+
62
+ $accountId = AccountPostType::insertOrUpdate($this->cpt, $account);
63
+
64
+ return new WP_REST_Response([
65
+ 'success' => true,
66
+ 'accountId' => $accountId,
67
+ ]);
68
+ }
69
+ }
core/RestApi/EndPoints/Accounts/DeleteAccountEndPoint.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
7
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
8
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
9
+ use WP_Error;
10
+ use WP_REST_Request;
11
+ use WP_REST_Response;
12
+
13
+ /**
14
+ * Endpoint handler for deleting accounts.
15
+ *
16
+ * @since 0.1
17
+ */
18
+ class DeleteAccountEndPoint extends AbstractEndpointHandler
19
+ {
20
+ /**
21
+ * @since 0.1
22
+ *
23
+ * @var PostType
24
+ */
25
+ protected $accountsCpt;
26
+
27
+ /**
28
+ * @since 0.1
29
+ *
30
+ * @var PostType
31
+ */
32
+ protected $mediaCpt;
33
+
34
+ /**
35
+ * @since 0.1
36
+ *
37
+ * @var TransformerInterface
38
+ */
39
+ protected $transformer;
40
+
41
+ /**
42
+ * Constructor.
43
+ *
44
+ * @since 0.1
45
+ *
46
+ * @param PostType $accountsCpt The accounts post type.
47
+ * @param PostType $mediaCpt The media post type.
48
+ * @param TransformerInterface $transformer
49
+ */
50
+ public function __construct(PostType $accountsCpt, PostType $mediaCpt, TransformerInterface $transformer)
51
+ {
52
+ $this->accountsCpt = $accountsCpt;
53
+ $this->mediaCpt = $mediaCpt;
54
+ $this->transformer = $transformer;
55
+ }
56
+
57
+ /**
58
+ * @inheritDoc
59
+ *
60
+ * @since 0.1
61
+ */
62
+ protected function handle(WP_REST_Request $request)
63
+ {
64
+ if (!$request->has_param('id')) {
65
+ return new WP_Error('sli_missing_id', 'Missing account ID in request');
66
+ }
67
+
68
+ $id = $request->get_param('id');
69
+
70
+ AccountPostType::deleteWithMedia($id, $this->accountsCpt, $this->mediaCpt);
71
+
72
+ return new WP_REST_Response(array_map([$this->transformer, 'transform'], $this->accountsCpt->query()));
73
+ }
74
+ }
core/RestApi/EndPoints/Accounts/DeleteAccountMediaEndpoint.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
+
5
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaSource;
6
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
7
+ use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
8
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
9
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
10
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
11
+ use WP_Error;
12
+ use WP_Post;
13
+ use WP_REST_Request;
14
+ use WP_REST_Response;
15
+
16
+ /**
17
+ * Endpoint handler for deleting accounts.
18
+ *
19
+ * @since 0.1
20
+ */
21
+ class DeleteAccountMediaEndpoint extends AbstractEndpointHandler
22
+ {
23
+ /**
24
+ * @since 0.1
25
+ *
26
+ * @var PostType
27
+ */
28
+ protected $accountsCpt;
29
+
30
+ /**
31
+ * @since 0.1
32
+ *
33
+ * @var PostType
34
+ */
35
+ protected $mediaCpt;
36
+
37
+ /**
38
+ * Constructor.
39
+ *
40
+ * @since 0.1
41
+ *
42
+ * @param PostType $accountsCpt The accounts post type.
43
+ * @param PostType $mediaCpt The media post type.
44
+ */
45
+ public function __construct(PostType $accountsCpt, PostType $mediaCpt)
46
+ {
47
+ $this->accountsCpt = $accountsCpt;
48
+ $this->mediaCpt = $mediaCpt;
49
+ }
50
+
51
+ /**
52
+ * @inheritDoc
53
+ *
54
+ * @since 0.1
55
+ */
56
+ protected function handle(WP_REST_Request $request)
57
+ {
58
+ if (!$request->has_param('id')) {
59
+ return new WP_Error('sli_missing_id', 'Missing account ID in request', ['status' => 400]);
60
+ }
61
+
62
+ $id = $request->get_param('id');
63
+ $accountPost = $this->accountsCpt->get($id);
64
+
65
+ if ($accountPost === null) {
66
+ return new WP_Error('sli_account_not_found', "Account with ID {$id} not found", ['status' => 404]);
67
+ }
68
+
69
+ $account = AccountPostType::fromWpPost($accountPost);
70
+ $source = MediaSource::forUser($account->getUser());
71
+
72
+ MediaPostType::deleteForSource($source, $this->mediaCpt);
73
+
74
+
75
+ $media = $this->mediaCpt->query([
76
+ 'meta_query' => [
77
+ 'relation' => 'AND',
78
+ [
79
+ 'key' => MediaPostType::SOURCE_NAME,
80
+ 'value' => $source->getName(),
81
+ ],
82
+ [
83
+ 'key' => MediaPostType::SOURCE_TYPE,
84
+ 'value' => $source->getType(),
85
+ ],
86
+ ],
87
+ ]);
88
+
89
+ Arrays::each($media, function (WP_Post $post) {
90
+ wp_delete_post($post->ID, true);
91
+ });
92
+
93
+ return new WP_REST_Response(['ok' => 1]);
94
+ }
95
+ }
core/RestApi/EndPoints/Accounts/GetAccessTokenEndPoint.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
+
5
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
6
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
8
+ use WP_REST_Request;
9
+ use WP_REST_Response;
10
+
11
+ /**
12
+ * The handler for the endpoint that provides account access tokens.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class GetAccessTokenEndPoint extends AbstractEndpointHandler
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var PostType
22
+ */
23
+ protected $cpt;
24
+
25
+ /**
26
+ * Constructor.
27
+ *
28
+ * @since 0.1
29
+ *
30
+ * @param PostType $cpt The accounts post type.
31
+ */
32
+ public function __construct(PostType $cpt)
33
+ {
34
+ $this->cpt = $cpt;
35
+ }
36
+
37
+ /**
38
+ * @inheritDoc
39
+ *
40
+ * @since 0.1
41
+ */
42
+ protected function handle(WP_REST_Request $request)
43
+ {
44
+ $id = filter_var($request['id'], FILTER_SANITIZE_STRING);
45
+
46
+ if (empty($id)) {
47
+ return new WP_Error('no_id', "Must specify an account \"${id}\"", ['status' => 400]);
48
+ }
49
+
50
+ $account = $this->cpt->get($id);
51
+
52
+ if ($account === null) {
53
+ return new WP_Error('not_found', "Account \"${id}\" was not found", ['status' => 404]);
54
+ }
55
+
56
+ return new WP_REST_Response([
57
+ 'code' => $account->{AccountPostType::ACCESS_TOKEN},
58
+ 'expiry' => $account->{AccountPostType::ACCESS_EXPIRY},
59
+ ]);
60
+ }
61
+ }
core/RestApi/EndPoints/Accounts/GetAccountsEndPoint.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
7
+ use RebelCode\Spotlight\Instagram\RestApi\AuthGuardInterface;
8
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
9
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
10
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
11
+ use WP_Error;
12
+ use WP_Post;
13
+ use WP_REST_Request;
14
+ use WP_REST_Response;
15
+
16
+ /**
17
+ * The handler for the endpoint that provides account information.
18
+ *
19
+ * @since 0.1
20
+ */
21
+ class GetAccountsEndPoint extends AbstractEndpointHandler
22
+ {
23
+ /**
24
+ * @since 0.1
25
+ *
26
+ * @var PostType
27
+ */
28
+ protected $cpt;
29
+
30
+ /**
31
+ * @since 0.1
32
+ *
33
+ * @var TransformerInterface
34
+ */
35
+ protected $transformer;
36
+
37
+ /**
38
+ * @var AuthGuardInterface
39
+ */
40
+ protected $tokenGuard;
41
+
42
+ /**
43
+ * Constructor.
44
+ *
45
+ * @since 0.1
46
+ *
47
+ * @param PostType $cpt The account post type.
48
+ * @param TransformerInterface $transformer The transformer to use for formatting accounts into responses.
49
+ * @param AuthGuardInterface $tokenGuard The auth guard that determines whether a request is authorized to have
50
+ * account access tokens in the response.
51
+ */
52
+ public function __construct(PostType $cpt, TransformerInterface $transformer, AuthGuardInterface $tokenGuard)
53
+ {
54
+ $this->cpt = $cpt;
55
+ $this->transformer = $transformer;
56
+ $this->tokenGuard = $tokenGuard;
57
+ }
58
+
59
+ /**
60
+ * @inheritDoc
61
+ *
62
+ * @since 0.1
63
+ */
64
+ protected function handle(WP_REST_Request $request)
65
+ {
66
+ $id = filter_var($request['id'], FILTER_SANITIZE_STRING);
67
+
68
+ if (empty($id)) {
69
+ $data = Arrays::map($this->cpt->query(), function ($account) use ($request) {
70
+ return $this->transformAccount($account, $request);
71
+ });
72
+
73
+ return new WP_REST_Response($data);
74
+ }
75
+
76
+ $account = $this->cpt->get($id);
77
+
78
+ if ($account === null) {
79
+ return new WP_Error('not_found', "Account \"${id}\" was not found", ['status' => 404]);
80
+ }
81
+
82
+ return new WP_REST_Response($this->transformAccount($account, $request));
83
+ }
84
+
85
+ /**
86
+ * Transforms an account into response format, including the access token if the request is authorized accordingly.
87
+ *
88
+ * @since 0.1
89
+ *
90
+ * @param WP_Post $account The account to transform.
91
+ * @param WP_REST_Request $request The request, used to determine if the access token is to be included or not.
92
+ *
93
+ * @return array The account data for the response.
94
+ */
95
+ protected function transformAccount(WP_Post $account, WP_REST_Request $request)
96
+ {
97
+ $data = $this->transformer->transform($account);
98
+
99
+ // If the request is authorized for access tokens, include the access token in the response
100
+ if (count($this->tokenGuard->getAuthErrors($request)) === 0) {
101
+ $data['accessToken'] = [
102
+ 'code' => $account->{AccountPostType::ACCESS_TOKEN},
103
+ 'expiry' => (int) $account->{AccountPostType::ACCESS_EXPIRY},
104
+ ];
105
+ }
106
+
107
+ return $data;
108
+ }
109
+ }
core/RestApi/EndPoints/Accounts/UpdateAccountEndPoint.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
+
5
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
6
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
8
+ use WP_REST_Request;
9
+ use WP_REST_Response;
10
+
11
+ /**
12
+ * The handler for the REST API endpoint that updates account information.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class UpdateAccountEndPoint extends AbstractEndpointHandler
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var PostType
22
+ */
23
+ protected $cpt;
24
+
25
+ /**
26
+ * Constructor.
27
+ *
28
+ * @since 0.1
29
+ *
30
+ * @param PostType $cpt The accounts post type.
31
+ */
32
+ public function __construct(PostType $cpt)
33
+ {
34
+ $this->cpt = $cpt;
35
+ }
36
+
37
+ /**
38
+ * @inheritDoc
39
+ *
40
+ * @since 0.1
41
+ */
42
+ protected function handle(WP_REST_Request $request)
43
+ {
44
+ if (!$request->has_param('id')) {
45
+ return new WP_Error('sli_missing_id', 'Missing account ID in request', [
46
+ 'status' => 400,
47
+ ]);
48
+ }
49
+
50
+ $id = $request->get_param('id');
51
+ $post = $this->cpt->get($id);
52
+
53
+ if ($post === null) {
54
+ return new WP_Error('sli_missing_id', 'Missing account ID in request', [
55
+ 'status' => 404,
56
+ ]);
57
+ }
58
+
59
+ $array = AccountPostType::fromWpPostToArray($post);
60
+
61
+ if ($request->has_param('customProfilePicUrl')) {
62
+ $array['meta_input'][AccountPostType::CUSTOM_PROFILE_PIC] = $request->get_param('customProfilePicUrl');
63
+ }
64
+
65
+ if ($request->has_param('customBio')) {
66
+ $array['meta_input'][AccountPostType::CUSTOM_BIO] = $request->get_param('customBio');
67
+ }
68
+
69
+ $this->cpt->update($id, $array);
70
+
71
+ return new WP_REST_Response([], 200);
72
+ }
73
+ }
core/RestApi/EndPoints/Feeds/DeleteFeedsEndpoint.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
8
+ use WP_Error;
9
+ use WP_REST_Request;
10
+ use WP_REST_Response;
11
+
12
+ /**
13
+ * The handler for the REST API endpoint that deletes feeds.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ class DeleteFeedsEndpoint extends AbstractEndpointHandler
18
+ {
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var PostType
23
+ */
24
+ protected $cpt;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var TransformerInterface
30
+ */
31
+ protected $transformer;
32
+
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @since 0.1
37
+ *
38
+ * @param PostType $cpt
39
+ * @param TransformerInterface $transformer
40
+ */
41
+ public function __construct(PostType $cpt, TransformerInterface $transformer)
42
+ {
43
+ $this->cpt = $cpt;
44
+ $this->transformer = $transformer;
45
+ }
46
+
47
+ /**
48
+ * @inheritDoc
49
+ *
50
+ * @since 0.1
51
+ */
52
+ protected function handle(WP_REST_Request $request)
53
+ {
54
+ if (!$request->has_param('id')) {
55
+ return new WP_Error('sli_missing_id', 'Missing feed ID in request');
56
+ }
57
+
58
+ $id = $request->get_param('id');
59
+ $this->cpt->delete($id);
60
+
61
+ return new WP_REST_Response(array_map([$this->transformer, 'transform'], $this->cpt->query()));
62
+ }
63
+ }
core/RestApi/EndPoints/Feeds/GetFeedsEndpoint.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
8
+ use WP_Error;
9
+ use WP_REST_Request;
10
+ use WP_REST_Response;
11
+
12
+ /**
13
+ * The handler for the REST API endpoint that exposes feeds.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ class GetFeedsEndpoint extends AbstractEndpointHandler
18
+ {
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var PostType
23
+ */
24
+ protected $cpt;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var TransformerInterface
30
+ */
31
+ protected $transformer;
32
+
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @since 0.1
37
+ *
38
+ * @param PostType $cpt
39
+ * @param TransformerInterface $transformer
40
+ */
41
+ public function __construct(PostType $cpt, TransformerInterface $transformer)
42
+ {
43
+ $this->cpt = $cpt;
44
+ $this->transformer = $transformer;
45
+ }
46
+
47
+ /**
48
+ * @inheritDoc
49
+ *
50
+ * @since 0.1
51
+ */
52
+ protected function handle(WP_REST_Request $request)
53
+ {
54
+ $id = filter_var($request['id'], FILTER_SANITIZE_STRING);
55
+
56
+ if (empty($id)) {
57
+ return new WP_REST_Response(array_map([$this->transformer, 'transform'], $this->cpt->query([
58
+ 'order' => 'ASC',
59
+ 'order_by' => 'ID'
60
+ ])));
61
+ }
62
+
63
+ $feed = $this->cpt->get($id);
64
+
65
+ if ($feed === null) {
66
+ return new WP_Error('not_found', "FeedCard \"${id}\" was not found", ['status' => 404]);
67
+ }
68
+
69
+ return new WP_REST_Response($this->transformer->transform($feed));
70
+ }
71
+ }
core/RestApi/EndPoints/Feeds/SaveFeedsEndpoint.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
7
+ use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
8
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
9
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
10
+ use WP_Error;
11
+ use WP_REST_Request;
12
+ use WP_REST_Response;
13
+
14
+ /**
15
+ * The handler for the REST API endpoint that saves feeds.
16
+ *
17
+ * @since 0.1
18
+ */
19
+ class SaveFeedsEndpoint extends AbstractEndpointHandler
20
+ {
21
+ /**
22
+ * @since 0.1
23
+ *
24
+ * @var PostType
25
+ */
26
+ protected $cpt;
27
+
28
+ /**
29
+ * @since 0.1
30
+ *
31
+ * @var TransformerInterface
32
+ */
33
+ protected $transformer;
34
+
35
+ /**
36
+ * Constructor.
37
+ *
38
+ * @since 0.1
39
+ *
40
+ * @param PostType $cpt
41
+ * @param TransformerInterface $transformer
42
+ */
43
+ public function __construct(PostType $cpt, TransformerInterface $transformer)
44
+ {
45
+ $this->cpt = $cpt;
46
+ $this->transformer = $transformer;
47
+ }
48
+
49
+ /**
50
+ * @inheritDoc
51
+ *
52
+ * @since 0.1
53
+ */
54
+ protected function handle(WP_REST_Request $request)
55
+ {
56
+ if (!$request->has_param('feed')) {
57
+ return new WP_Error('sli_missing_feed', 'Missing feed data in request');
58
+ }
59
+
60
+ $id = $request->has_param('id')
61
+ ? $request->get_param('id')
62
+ : null;
63
+ $feedData = $request->get_param('feed');
64
+
65
+ unset($feedData['usages']);
66
+
67
+ $feed = Feed::fromArray($feedData);
68
+ $post = FeedPostType::toWpPost($feed);
69
+
70
+ $result = $this->cpt->update($id, $post);
71
+
72
+ if ($result instanceof WP_Error) {
73
+ return new WP_Error('sli_feed_save_error', $result->get_error_message(), ['status' => 500]);
74
+ } else {
75
+ $feed = new Feed($result, $feed->getName(), $feed->getOptions());
76
+ }
77
+
78
+ return new WP_REST_Response(['feed' => $this->transformer->transform($feed)]);
79
+ }
80
+ }
core/RestApi/EndPoints/Front/FrontEndpoint.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Front;
4
+
5
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
6
+ use WP_REST_Request;
7
+
8
+ class FrontEndpoint extends AbstractEndpointHandler
9
+ {
10
+ /**
11
+ * @inheritDoc
12
+ *
13
+ * @since 0.1
14
+ *
15
+ */
16
+ protected function handle(WP_REST_Request $request)
17
+ {
18
+ // TODO
19
+ }
20
+ }
core/RestApi/EndPoints/Media/FetchMediaEndPoint.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
7
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaStore;
8
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
9
+ use WP_REST_Request;
10
+ use WP_REST_Response;
11
+
12
+ /**
13
+ * The handler for the endpoint that fetches media from Instagram.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ class FetchMediaEndPoint extends AbstractEndpointHandler
18
+ {
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var MediaStore
23
+ */
24
+ protected $store;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var TransformerInterface
30
+ */
31
+ protected $transformer;
32
+
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @since 0.1
37
+ *
38
+ * @param MediaStore $store
39
+ * @param TransformerInterface $transformer
40
+ */
41
+ public function __construct(MediaStore $store, TransformerInterface $transformer)
42
+ {
43
+ $this->store = $store;
44
+ $this->transformer = $transformer;
45
+ }
46
+
47
+ /**
48
+ * @inheritDoc
49
+ *
50
+ * @since 0.1
51
+ */
52
+ protected function handle(WP_REST_Request $request)
53
+ {
54
+ $options = $request->get_param('options');
55
+ $feed = Feed::fromArray(['options' => $options]);
56
+
57
+ $from = $request->get_param('from');
58
+ $num = $request->get_param('num');
59
+ $num = ($num === null) ? $feed->getOption('numPosts')['desktop'] : $num;
60
+
61
+ [$media, $stories] = $this->store->getFeedMedia($feed, $num, $from);
62
+ $total = $this->store->getNumMedia();
63
+
64
+ $media = array_map([$this->transformer, 'transform'], $media);
65
+ $stories = array_map([$this->transformer, 'transform'], $stories);
66
+
67
+ $response = [
68
+ 'media' => $media,
69
+ 'stories' => $stories,
70
+ 'total' => $total,
71
+ ];
72
+
73
+ return new WP_REST_Response($response);
74
+ }
75
+ }
core/RestApi/EndPoints/Media/GetMediaEndPoint.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media;
4
+
5
+ use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
6
+ use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
7
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
8
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
9
+ use WP_REST_Request;
10
+ use WP_REST_Response;
11
+
12
+ /**
13
+ * The handler for the endpoint that provides media objects.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ class GetMediaEndPoint extends AbstractEndpointHandler
18
+ {
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var PostType
23
+ */
24
+ protected $mediaCpt;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param PostType $mediaCpt
32
+ */
33
+ public function __construct(PostType $mediaCpt)
34
+ {
35
+ $this->mediaCpt = $mediaCpt;
36
+ }
37
+
38
+ /**
39
+ * @inheritDoc
40
+ *
41
+ * @since 0.1
42
+ */
43
+ protected function handle(WP_REST_Request $request)
44
+ {
45
+ $media = array_map([MediaPostType::class, 'fromWpPost'], $this->mediaCpt->query());
46
+
47
+ usort($media, function (IgMedia $a, IgMedia $b) {
48
+ $aTs = $a->getTimestamp();
49
+ $bTs = $b->getTimestamp();
50
+
51
+ if ($aTs == $bTs) {
52
+ return 0;
53
+ }
54
+
55
+ if ($aTs === null) {
56
+ return 1;
57
+ }
58
+
59
+ if ($bTs === null) {
60
+ return -1;
61
+ }
62
+
63
+ return $aTs < $bTs ? 1 : -1;
64
+ });
65
+
66
+ return new WP_REST_Response(array_map([$this, 'postToResponse'], $media));
67
+ }
68
+
69
+ /**
70
+ * Transforms an Ig Media instance into a response array
71
+ *
72
+ * @since 0.1
73
+ *
74
+ * @param IgMedia $media
75
+ *
76
+ * @return array
77
+ */
78
+ protected function postToResponse(IgMedia $media)
79
+ {
80
+ return [
81
+ 'id' => $media->getId(),
82
+ 'username' => $media->getUsername(),
83
+ 'caption' => $media->getCaption(),
84
+ 'timestamp' => $media->getTimestamp(),
85
+ 'type' => $media->getType(),
86
+ 'url' => $media->getUrl(),
87
+ 'permalink' => $media->getPermalink(),
88
+ 'thumbnailUrl' => $media->getThumbnailUrl(),
89
+ ];
90
+ }
91
+ }
core/RestApi/EndPoints/Settings/GetSettingsEndpoint.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Settings;
4
+
5
+ use RebelCode\Spotlight\Instagram\Config\ConfigSet;
6
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
+ use WP_REST_Request;
8
+ use WP_REST_Response;
9
+
10
+ /**
11
+ * The handler for the endpoint that provides settings values.
12
+ *
13
+ * @since 0.1
14
+ */
15
+ class GetSettingsEndpoint extends AbstractEndpointHandler
16
+ {
17
+ /**
18
+ * @since 0.1
19
+ *
20
+ * @var ConfigSet
21
+ */
22
+ protected $config;
23
+
24
+ /**
25
+ * Constructor.
26
+ *
27
+ * @since 0.1
28
+ *
29
+ * @param ConfigSet $config The config set.
30
+ */
31
+ public function __construct(ConfigSet $config)
32
+ {
33
+ $this->config = $config;
34
+ }
35
+
36
+ /**
37
+ * @inheritDoc
38
+ *
39
+ * @since 0.1
40
+ */
41
+ protected function handle(WP_REST_Request $request)
42
+ {
43
+ return new WP_REST_Response($this->config->getValues());
44
+ }
45
+ }
core/RestApi/EndPoints/Settings/PatchSettingsEndpoint.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Settings;
4
+
5
+ use RebelCode\Spotlight\Instagram\Config\ConfigSet;
6
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
+ use RebelCode\Spotlight\Instagram\Utils\Strings;
8
+ use WP_Error;
9
+ use WP_REST_Request;
10
+ use WP_REST_Response;
11
+
12
+ /**
13
+ * The handler for the endpoint that patches settings values.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ class PatchSettingsEndpoint extends AbstractEndpointHandler
18
+ {
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var ConfigSet
23
+ */
24
+ protected $config;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param ConfigSet $config The config set.
32
+ */
33
+ public function __construct(ConfigSet $config)
34
+ {
35
+ $this->config = $config;
36
+ }
37
+
38
+ /**
39
+ * @inheritDoc
40
+ *
41
+ * @since 0.1
42
+ */
43
+ protected function handle(WP_REST_Request $request)
44
+ {
45
+ $patch = $request->get_param('settings');
46
+
47
+ if (!is_array($patch)) {
48
+ return new WP_Error('sli_no_settings', 'Must provide an object of settings to patch', [
49
+ 'status' => 400,
50
+ ]);
51
+ }
52
+
53
+ foreach ($patch as $key => $value) {
54
+ $this->config->get($key)->setValue($value);
55
+ }
56
+
57
+ return new WP_REST_Response($this->config->getValues());
58
+ }
59
+ }
core/RestApi/Transformers/AccountTransformer.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Transformers;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\IgApi\IgAccount;
7
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
8
+ use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
9
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
10
+ use WP_Post;
11
+
12
+ /**
13
+ * Transforms {@link IgAccount} instances into REST API response format.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ class AccountTransformer implements TransformerInterface
18
+ {
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var PostType
23
+ */
24
+ protected $feedsCpt;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param PostType $feedsCpt The feeds post type.
32
+ */
33
+ public function __construct(PostType $feedsCpt)
34
+ {
35
+ $this->feedsCpt = $feedsCpt;
36
+ }
37
+
38
+ /**
39
+ * @inheritDoc
40
+ *
41
+ * @since 0.1
42
+ */
43
+ public function transform($source)
44
+ {
45
+ if (!($source instanceof WP_Post)) {
46
+ return $source;
47
+ }
48
+
49
+ $account = AccountPostType::fromWpPost($source);
50
+ $user = $account->getUser();
51
+
52
+ $usages = [];
53
+ $feeds = $this->feedsCpt->query();
54
+ foreach ($feeds as $feedPost) {
55
+ $options = $feedPost->{FeedPostType::OPTIONS};
56
+
57
+ $usedAccounts = $options['accounts'] ?? [];
58
+ $usedTagged = $options['tagged'] ?? [];
59
+
60
+ $used = array_search($source->ID, $usedAccounts) !== false ||
61
+ array_search($source->ID, $usedTagged) !== false;
62
+
63
+ if ($used) {
64
+ $usages[] = $feedPost->ID;
65
+ }
66
+ }
67
+
68
+ return [
69
+ 'id' => $source->ID,
70
+ 'type' => $user->getType(),
71
+ 'userId' => $user->getId(),
72
+ 'username' => $user->getUsername(),
73
+ 'bio' => $user->getBio(),
74
+ 'customBio' => $source->{AccountPostType::CUSTOM_BIO},
75
+ 'profilePicUrl' => $user->getProfilePicUrl(),
76
+ 'customProfilePicUrl' => $source->{AccountPostType::CUSTOM_PROFILE_PIC},
77
+ 'mediaCount' => $user->getMediaCount(),
78
+ 'followersCount' => $user->getFollowersCount(),
79
+ 'usages' => $usages,
80
+ ];
81
+ }
82
+ }
core/RestApi/Transformers/CamelCaseTransformer.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Transformers;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+
7
+ /**
8
+ * A REST API transformer that ensures that all keys use camelCase.
9
+ *
10
+ * @since 0.1
11
+ */
12
+ class CamelCaseTransformer implements TransformerInterface
13
+ {
14
+ /**
15
+ * @inheritDoc
16
+ *
17
+ * @since 0.1
18
+ */
19
+ public function transform($source)
20
+ {
21
+ if (!is_iterable($source)) {
22
+ return $source;
23
+ }
24
+
25
+ return $this->camelCaseIterable($source);
26
+ }
27
+
28
+ /**
29
+ * Applies {@link CamelCaseTransformer::camelCase()} to a all elements in an iterable value.
30
+ *
31
+ * @since 0.1
32
+ *
33
+ * @param iterable $iterable The iterable value.
34
+ *
35
+ * @return array An array with the same values, but potentially camelCase-d keys.
36
+ */
37
+ protected function camelCaseIterable(iterable $iterable)
38
+ {
39
+ $result = [];
40
+
41
+ foreach ($iterable as $key => $value) {
42
+ $result[$this->camelCase($key)] = is_iterable($value)
43
+ ? $this->camelCaseIterable($value)
44
+ : $value;
45
+ }
46
+
47
+ return $result;
48
+ }
49
+
50
+ /**
51
+ * Transforms a snake_case string into a camelCase string.
52
+ *
53
+ * @since 0.1
54
+ *
55
+ * @param string $snakeCase The snake case string.
56
+ *
57
+ * @return string The resulting camelCase string.
58
+ */
59
+ protected function camelCase(string $snakeCase)
60
+ {
61
+ $parts = explode('_', $snakeCase);
62
+
63
+ if (count($parts) < 2) {
64
+ return implode('', $parts);
65
+ }
66
+
67
+ $head = array_shift($parts);
68
+ $tail = array_map(function ($part) {
69
+ return ucfirst(strtolower($part));
70
+ }, $parts);
71
+
72
+ return $head . implode('', $tail);
73
+ }
74
+ }
core/RestApi/Transformers/CompositeTransformer.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Transformers;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+
7
+ /**
8
+ * A REST API transformer that is composed of other transformers.
9
+ *
10
+ * The children transformers are called in sequence; each transformer will be given the previous transformer's result
11
+ * as input, making the order of transformers potentially an important factor.
12
+ *
13
+ * @since 0.1
14
+ */
15
+ class CompositeTransformer implements TransformerInterface
16
+ {
17
+ /**
18
+ * @since 0.1
19
+ *
20
+ * @var TransformerInterface[]
21
+ */
22
+ protected $transformers;
23
+
24
+ /**
25
+ * Constructor.
26
+ *
27
+ * @since 0.1
28
+ *
29
+ * @param TransformerInterface[] $transformers
30
+ */
31
+ public function __construct(iterable $transformers)
32
+ {
33
+ $this->transformers = $transformers;
34
+ }
35
+
36
+ /**
37
+ * @inheritDoc
38
+ *
39
+ * @since 0.1
40
+ */
41
+ public function transform($source)
42
+ {
43
+ foreach ($this->transformers as $transformer) {
44
+ $source = $transformer->transform($source);
45
+ }
46
+
47
+ return $source;
48
+ }
49
+ }
core/RestApi/Transformers/FeedsTransformer.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Transformers;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use RebelCode\Spotlight\Instagram\Feeds\Feed;
7
+ use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
8
+ use WP_Post;
9
+ use wpdb;
10
+
11
+ /**
12
+ * Transforms {@link Feed} instances, or {@link WP_Post} instances that represents feeds, into REST API response format.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class FeedsTransformer implements TransformerInterface
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var wpdb
22
+ */
23
+ protected $wpdb;
24
+
25
+ /**
26
+ * Constructor.
27
+ *
28
+ * @since 0.1
29
+ *
30
+ * @param wpdb $wpdb The WordPress database driver.
31
+ */
32
+ public function __construct(wpdb $wpdb)
33
+ {
34
+ $this->wpdb = $wpdb;
35
+ }
36
+
37
+ /**
38
+ * @inheritDoc
39
+ *
40
+ * @since 0.1
41
+ */
42
+ public function transform($source)
43
+ {
44
+ if ($source instanceof Feed) {
45
+ $feed = $source;
46
+ } elseif ($source instanceof WP_Post) {
47
+ $feed = FeedPostType::fromWpPost($source);
48
+ } else {
49
+ return $source;
50
+ }
51
+
52
+ return array_merge([
53
+ 'id' => $feed->getId(),
54
+ 'name' => $feed->getName(),
55
+ 'usages' => FeedPostType::getShortcodeUsages($feed, $this->wpdb),
56
+ 'options' => $feed->getOptions(),
57
+ ]);
58
+ }
59
+ }
core/RestApi/Transformers/MediaTransformer.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Transformers;
4
+
5
+ use DateTime;
6
+ use Dhii\Transformer\TransformerInterface;
7
+ use RebelCode\Spotlight\Instagram\IgApi\IgComment;
8
+ use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
9
+ use RebelCode\Spotlight\Instagram\MediaStore\IgCachedMedia;
10
+
11
+ /**
12
+ * Transforms {@link IgMedia} instances into REST API response format.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class MediaTransformer implements TransformerInterface
17
+ {
18
+ /**
19
+ * @inheritDoc
20
+ *
21
+ * @since 0.1
22
+ */
23
+ public function transform($source)
24
+ {
25
+ if (!($source instanceof IgMedia)) {
26
+ return $source;
27
+ }
28
+
29
+ $media = IgCachedMedia::from($source);
30
+
31
+ $children = $media->getChildren();
32
+ foreach ($children as $idx => $child) {
33
+ $children[$idx] = [
34
+ 'id' => $child->getId(),
35
+ 'type' => $child->getType(),
36
+ 'url' => $child->getUrl(),
37
+ 'permalink' => $child->getPermalink(),
38
+ ];
39
+ }
40
+
41
+ $timestamp = $media->getTimestamp();
42
+
43
+ return [
44
+ 'id' => $media->getId(),
45
+ 'username' => $media->getUsername(),
46
+ 'caption' => $media->getCaption(),
47
+ 'timestamp' => $timestamp ? $timestamp->format(DateTime::ISO8601) : null,
48
+ 'type' => $media->getType(),
49
+ 'url' => $media->getUrl(),
50
+ 'permalink' => $media->getPermalink(),
51
+ 'thumbnail' => $media->getThumbnailUrl(),
52
+ 'likesCount' => $media->getLikesCount(),
53
+ 'commentsCount' => $media->getCommentsCount(),
54
+ 'comments' => array_map([$this, 'transformComment'], $media->getComments()),
55
+ 'children' => $children,
56
+ 'source' => $media->getSource()->toArray(),
57
+ ];
58
+ }
59
+
60
+ /**
61
+ * Transforms a single media comment.
62
+ *
63
+ * @since 0.1
64
+ *
65
+ * @param IgComment $comment The comment instance.
66
+ *
67
+ * @return array The transformation result.
68
+ */
69
+ public function transformComment(IgComment $comment)
70
+ {
71
+ $timestamp = $comment->getTimestamp();
72
+
73
+ return [
74
+ 'id' => $comment->getId(),
75
+ 'username' => $comment->getUsername(),
76
+ 'text' => $comment->getText(),
77
+ 'timestamp' => $timestamp ? $timestamp->format(DateTime::ISO8601) : null,
78
+ 'likeCount' => $comment->getLikeCount(),
79
+ ];
80
+ }
81
+ }
core/RestApi/Transformers/RecursiveToArrayTransformer.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\RestApi\Transformers;
4
+
5
+ use Dhii\Transformer\TransformerInterface;
6
+ use stdClass;
7
+ use Traversable;
8
+
9
+ /**
10
+ * A transformer that recursively unpacks iterable values into arrays.
11
+ *
12
+ * @since 0.1
13
+ */
14
+ class RecursiveToArrayTransformer implements TransformerInterface
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ *
19
+ * @since 0.1
20
+ */
21
+ public function transform($source)
22
+ {
23
+ if (!$this->isIterable($source)) {
24
+ return $source;
25
+ }
26
+
27
+ return $this->iterableToArray($source);
28
+ }
29
+
30
+ /**
31
+ * Recursively unpacks an iterable value and all of its iterable children into arrays.
32
+ *
33
+ * @since 0.1
34
+ *
35
+ * @param array|stdClass|Traversable $input The iterable value to unpack.
36
+ *
37
+ * @return array The unpacked array.
38
+ */
39
+ protected function iterableToArray($input)
40
+ {
41
+ $output = [];
42
+
43
+ foreach ($input as $key => $value) {
44
+ $output[$key] = $this->isIterable($value)
45
+ ? $this->iterableToArray($value)
46
+ : $value;
47
+ }
48
+
49
+ return $output;
50
+ }
51
+
52
+ /**
53
+ * Checks if a value is iterable.
54
+ *
55
+ * @since 0.1
56
+ *
57
+ * @param mixed $value The value to check.
58
+ *
59
+ * @return bool True if the value is iterable, false if not.
60
+ */
61
+ protected function isIterable($value)
62
+ {
63
+ return is_array($value) || $value instanceof stdClass || $value instanceof Traversable;
64
+ }
65
+ }
core/Utils/Arrays.php ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Utils;
4
+
5
+ /**
6
+ * Utility functions for working with arrays,
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class Arrays
11
+ {
12
+ /**
13
+ * Functionally equivalent to {@link array_map}, but passes the index or key as a second argument to the callback.
14
+ * For code legibility purposes, this function takes the array as the first argument whereas {@link array_map} takes
15
+ * the array as a second argument. By accepting the function as a second argument, the syntax becomes much cleaner
16
+ * when using anonymous functions.
17
+ *
18
+ * @since 0.1
19
+ *
20
+ * @param array $array The array to map.
21
+ * @param callable $fn The function to call for each entry in the array. It will receive the value and the index
22
+ * as arguments in that order, and must return the new value.
23
+ *
24
+ * @return array The mapped array.
25
+ */
26
+ public static function map(array $array, callable $fn)
27
+ {
28
+ $newArray = [];
29
+
30
+ array_walk($array, function ($val, $key) use ($fn, &$newArray) {
31
+ $newArray[$key] = $fn($val, $key);
32
+ });
33
+
34
+ return $newArray;
35
+ }
36
+
37
+ /**
38
+ * Similar to {@link Arrays::map()}, but reverses the order of the index and key arguments given to the function.
39
+ *
40
+ * @since 0.1
41
+ *
42
+ * @param array $array The array to map.
43
+ * @param callable $fn The function to call for each entry in the array. It will receive the index and the value
44
+ * as arguments in that order, and must return the new value.
45
+ *
46
+ * @return array The mapped array.
47
+ */
48
+ public static function mapAssoc(array $array, callable $fn)
49
+ {
50
+ $newArray = [];
51
+
52
+ array_walk($array, function ($val, $key) use ($fn, &$newArray) {
53
+ $newArray[$key] = $fn($key, $val);
54
+ });
55
+
56
+ return $newArray;
57
+ }
58
+
59
+ /**
60
+ * Maps each key->value pair in an array, creating a new array.
61
+ *
62
+ * The given function is used to construct a new key->value pair. This distinguishes this function from
63
+ * {@link Arrays::map()} by allowing the caller to create a mapped array with different keys.
64
+ *
65
+ * @since 0.1
66
+ *
67
+ * @param array $array The array to map.
68
+ * @param callable $fn The function to call for each pair in the array. It will receive the key, the value and
69
+ * the index as arguments in that order, and must return an array containing two values: the
70
+ * new key and the new value.
71
+ *
72
+ * @return array The mapped array.
73
+ */
74
+ public static function mapPairs(array $array, callable $fn)
75
+ {
76
+ $newArray = [];
77
+ $idx = 0;
78
+
79
+ array_walk($array, function ($val, $key) use ($fn, &$newArray, &$idx) {
80
+ list($newKey, $newVal) = $fn($key, $val, $idx);
81
+ $newArray[$newKey] = $newVal;
82
+ $idx++;
83
+ });
84
+
85
+ return $newArray;
86
+ }
87
+
88
+ /**
89
+ * Runs a function on each element of the array.
90
+ *
91
+ * @since 0.1
92
+ *
93
+ * @param array $array The array.
94
+ * @param callable $fn The function to call for each value. It will receive the value and the key as arguments
95
+ * in that order. The return value is ignored.
96
+ */
97
+ public static function each(array $array, callable $fn)
98
+ {
99
+ array_walk($array, function ($val, $key) use ($fn) {
100
+ $fn($val, $key);
101
+ });
102
+ }
103
+
104
+ /**
105
+ * Similar to {@link Arrays::map()}, but reverses the order of the arguments given to the function.
106
+ *
107
+ * @since 0.1
108
+ *
109
+ * @param array $array The array.
110
+ * @param callable $fn The function to call for each value. It will receive the key and the value as arguments
111
+ * in that order. The return value is ignored.
112
+ */
113
+ public static function eachAssoc(array $array, callable $fn)
114
+ {
115
+ array_walk($array, function ($val, $key) use ($fn) {
116
+ $fn($key, $val);
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Concatenates the elements of an array using a glue string, optionally mapping each value before concatenation.
122
+ *
123
+ * @since 0.1
124
+ *
125
+ * @param array $array The array.
126
+ * @param string $glue The string to use to concatenate values.
127
+ * @param callable|null $fn Optional function for mapping values before concatenation. The {@link Arrays::map()}
128
+ * function will be used for this purpose. If null, no mapping is performed.
129
+ *
130
+ * @return string A string containing the concatenated values, each separated by the $glue string.
131
+ */
132
+ public static function join(array $array, string $glue, callable $fn = null) : string
133
+ {
134
+ if ($fn === null) {
135
+ return implode($glue, $array);
136
+ }
137
+
138
+ return implode($glue, static::map($array, $fn));
139
+ }
140
+
141
+ /**
142
+ * Assigns a deep key in an array to a specific value.
143
+ *
144
+ * A path array is used to find the deep key. Each element in the path is checked for in the array. If it does not
145
+ * exist, an empty array will be created at that key and the algorithm will repeat the process for that new array.
146
+ *
147
+ * @since 0.1
148
+ *
149
+ * @param array $array The array to change.
150
+ * @param array $path A list of strings, representing the path to the deep key.
151
+ * @param mixed $value The value to set.
152
+ */
153
+ public static function setPath(array &$array, array $path, $value)
154
+ {
155
+ if (empty($path)) {
156
+ return;
157
+ }
158
+
159
+ $cursor = &$array;
160
+ while (count($path) > 1) {
161
+ $head = array_shift($path);
162
+
163
+ if (!array_key_exists($head, $cursor)) {
164
+ $cursor[$head] = [];
165
+ }
166
+
167
+ $cursor = &$cursor[$head];
168
+ }
169
+
170
+ $last = reset($path);
171
+ $cursor[$last] = $value;
172
+ }
173
+
174
+ /**
175
+ * Retrieves the last element of an array.
176
+ *
177
+ * Internally, this uses {@link end()}. However, this function does not take the argument by reference, allowing
178
+ * it to be used with intermediate values.
179
+ *
180
+ * @since 0.1
181
+ *
182
+ * @param array $array The array.
183
+ *
184
+ * @return mixed The value of the last element of the array, of false if the array is empty.
185
+ */
186
+ public static function last(array $array)
187
+ {
188
+ return end($array);
189
+ }
190
+
191
+ /**
192
+ * Performs a deep array merge.
193
+ *
194
+ * This function behaves similarly to {@link array_merge()}, making values in the second argument override those
195
+ * in the first. If a value is an array in both arguments, the function will recurse. This is unlike the
196
+ * {@link array_merge_recursive()} function, which combines values into new arrays.
197
+ *
198
+ * @since 0.1
199
+ *
200
+ * @param array $array1 The array to merge into.
201
+ * @param array $array2 The array whose values to merge into $array1.
202
+ *
203
+ * @return array The merged array.
204
+ */
205
+ static function deepMerge(array $array1, array $array2)
206
+ {
207
+ $result = $array1;
208
+
209
+ foreach ($array2 as $key => $value) {
210
+ // Both arrays have sub-arrays for this key. Recurse
211
+ if (isset($array1[$key]) && is_array($value) && is_array($array1[$key])) {
212
+ $result[$key] = static::deepMerge($array1[$key], $value);
213
+ continue;
214
+ }
215
+
216
+ // No conflict. Append if numeric key, override if string key
217
+ if (is_numeric($key)) {
218
+ $result[] = $value;
219
+ } else {
220
+ $result[$key] = $value;
221
+ }
222
+ }
223
+
224
+ return $result;
225
+ }
226
+
227
+ /**
228
+ * Breaks path keys into sub-arrays, creating a tree from a flat list.
229
+ *
230
+ * Example:
231
+ * ```
232
+ * Arrays::breakPaths([
233
+ * 'test/one' => 1,
234
+ * 'test/two' => 2,
235
+ * 'very/deep/key' => 'hello',
236
+ * 'foo' => 'bar'
237
+ * ])
238
+ *
239
+ * // Gives:
240
+ *
241
+ * [
242
+ * 'test' => [
243
+ * 'one' => 1,
244
+ * 'two' => 2,
245
+ * ],
246
+ * 'very' => [
247
+ * 'deep' => [
248
+ * 'key' => 'hello'
249
+ * ]
250
+ * ],
251
+ * 'foo' => 'bar'
252
+ * ]
253
+ * ```
254
+ *
255
+ * @since 0.1
256
+ *
257
+ * @param array $array The array to break
258
+ * @param string $delimiter The path delimiter.
259
+ *
260
+ * @return array
261
+ */
262
+ static function breakPaths(array $array, string $delimiter)
263
+ {
264
+ $result = [];
265
+
266
+ static::each($array, function ($value, $key) use (&$result, $delimiter) {
267
+ static::setPath($result, explode($delimiter, $key), $value);
268
+ });
269
+
270
+ return $result;
271
+ }
272
+
273
+ /**
274
+ * Flattens an array tree into a flat list with path keys.
275
+ *
276
+ * Example:
277
+ * ```
278
+ * Arrays::flattenPaths([
279
+ * 'test' => [
280
+ * 'one' => 1,
281
+ * 'two' => 2,
282
+ * ],
283
+ * 'very' => [
284
+ * 'deep' => [
285
+ * 'key' => 'hello'
286
+ * ]
287
+ * ],
288
+ * 'foo' => 'bar'
289
+ * ])
290
+ *
291
+ * // Gives:
292
+ *
293
+ * [
294
+ * 'test/one' => 1,
295
+ * 'test/two' => 2,
296
+ * 'very/deep/key' => 'hello',
297
+ * 'foo' => 'bar'
298
+ * ]
299
+ * ```
300
+ *
301
+ * @since 0.1
302
+ *
303
+ * @param array $array The array to flatten
304
+ * @param string $delimiter The path delimiter.
305
+ *
306
+ * @return array
307
+ */
308
+ static function flattenPaths(array $array, string $delimiter, array $path = [])
309
+ {
310
+ $result = [];
311
+
312
+ static::each($array, function ($value, $key) use (&$result, $delimiter, &$path) {
313
+ array_push($path, $key);
314
+ $pathStr = implode('/', $path);
315
+
316
+ $newValues = is_array($value)
317
+ ? static::flattenPaths($value, $delimiter, $path)
318
+ : [$pathStr => $value];
319
+
320
+ $result = array_merge($result, $newValues);
321
+
322
+ array_pop($path);
323
+ });
324
+
325
+ return $result;
326
+ }
327
+
328
+ /**
329
+ * Paginates an array.
330
+ *
331
+ * @since 0.1
332
+ *
333
+ * @param array $array The array to paginate.
334
+ * @param int $page The page to return.
335
+ * @param int $perPage The number of items per page.
336
+ *
337
+ * @return array An array containing the following:
338
+ * 1. The resulting paginated array
339
+ * 2. The total number of items in the array prior to paginating
340
+ * 3. The total number of available pages
341
+ */
342
+ static function paginate(array $array, int $page, int $perPage)
343
+ {
344
+ $total = count($array);
345
+
346
+ if ($total === 0) {
347
+ return [[], 0, 0];
348
+ }
349
+
350
+ $perPage = max(0, min($total, $perPage));
351
+
352
+ $numPages = ceil($total / $perPage);
353
+ $page = max(1, min($page, $numPages));
354
+
355
+ return [
356
+ array_slice($array, ($page - 1) * $perPage, $perPage),
357
+ $total,
358
+ $numPages,
359
+ ];
360
+ }
361
+ }
core/Wp/AdminPage.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents a page that is shown in the WordPress Admin.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class AdminPage
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var string
16
+ */
17
+ protected $title;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var callable
23
+ */
24
+ protected $renderFn;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param string $title The title of the page, shown in the browser's tab.
32
+ * @param callable $renderFn The function that returns the rendered contents of the page
33
+ */
34
+ public function __construct(string $title, callable $renderFn)
35
+ {
36
+ $this->title = $title;
37
+ $this->renderFn = $renderFn;
38
+ }
39
+
40
+ /**
41
+ * Retrieves the title for the page.
42
+ *
43
+ * @since 0.1
44
+ *
45
+ * @return string
46
+ */
47
+ public function getTitle() : string
48
+ {
49
+ return $this->title;
50
+ }
51
+
52
+ /**
53
+ * Retrieves the render function for the page.
54
+ *
55
+ * @since 0.1
56
+ *
57
+ * @return callable
58
+ */
59
+ public function getRenderFn() : callable
60
+ {
61
+ $returnFn = $this->renderFn;
62
+
63
+ // The first argument is passed by WordPress and is unused
64
+ return function ($unused, ...$args) use ($returnFn) {
65
+ echo $returnFn(...$args);
66
+ };
67
+ }
68
+ }
core/Wp/Asset.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents an asset, a WordPress mechanism used for enqueueing scripts and stylesheets,
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class Asset
11
+ {
12
+ /**
13
+ * The type for script assets.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ const SCRIPT = 0;
18
+ /**
19
+ * The type for style assets.
20
+ *
21
+ * @since 0.1
22
+ */
23
+ const STYLE = 1;
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var int
29
+ */
30
+ protected $type;
31
+
32
+ /**
33
+ * @since 0.1
34
+ *
35
+ * @var string
36
+ */
37
+ protected $url;
38
+
39
+ /**
40
+ * @since 0.1
41
+ *
42
+ * @var string[]
43
+ */
44
+ protected $deps;
45
+
46
+ /**
47
+ * @since 0.1
48
+ *
49
+ * @var string|null
50
+ */
51
+ protected $ver;
52
+
53
+ /**
54
+ * Constructor.
55
+ *
56
+ * @since 0.1
57
+ *
58
+ * @param int $type Either {@link Asset::SCRIPT} or {@link Asset::style}.
59
+ * @param string $url The URL of the asset.
60
+ * @param string|null $ver The version of the asset, used for caching.
61
+ * @param string[] $deps Keys of dependency assets of the same type.
62
+ */
63
+ public function __construct(int $type, string $url, string $ver = null, array $deps = [])
64
+ {
65
+ $this->type = $type;
66
+ $this->url = $url;
67
+ $this->ver = $ver;
68
+ $this->deps = $deps;
69
+ }
70
+
71
+ /**
72
+ * Retrieves the asset type.
73
+ *
74
+ * @since 0.1
75
+ *
76
+ * @see Asset::SCRIPT
77
+ * @see Asset::style
78
+ *
79
+ * @return int
80
+ */
81
+ public function getType() : int
82
+ {
83
+ return $this->type;
84
+ }
85
+
86
+ /**
87
+ * Retrieves the asset URL.
88
+ *
89
+ * @since 0.1
90
+ *
91
+ * @return string
92
+ */
93
+ public function getUrl() : string
94
+ {
95
+ return $this->url;
96
+ }
97
+
98
+ /**
99
+ * Retrieves the asset's dependencies.
100
+ *
101
+ * @since 0.1
102
+ *
103
+ * @return string[]
104
+ */
105
+ public function getDeps() : array
106
+ {
107
+ return $this->deps;
108
+ }
109
+
110
+ /**
111
+ * Retrieves the version of the asset.
112
+ *
113
+ * @since 0.1
114
+ *
115
+ * @return string
116
+ */
117
+ public function getVer() : ?string
118
+ {
119
+ return $this->ver;
120
+ }
121
+
122
+ /**
123
+ * Creates a script asset.
124
+ *
125
+ * @since 0.1
126
+ *
127
+ * @param string $url The URL of the asset.
128
+ * @param string|null $ver The version of the asset, used for caching.
129
+ * @param string[] $deps Keys of dependency script assets.
130
+ *
131
+ * @return static
132
+ */
133
+ public static function script(string $url, string $ver = null, array $deps = [])
134
+ {
135
+ return new static(static::SCRIPT, $url, $ver, $deps);
136
+ }
137
+
138
+ /**
139
+ * Creates a style asset.
140
+ *
141
+ * @since 0.1
142
+ *
143
+ * @param string $url The URL of the asset.
144
+ * @param string|null $ver The version of the asset, used for caching.
145
+ * @param string[] $deps Keys of dependency style assets.
146
+ *
147
+ * @return static
148
+ */
149
+ public static function style(string $url, string $ver = null, array $deps = [])
150
+ {
151
+ return new static(static::STYLE, $url, $ver, $deps);
152
+ }
153
+
154
+ /**
155
+ * Registers an asset.
156
+ *
157
+ * @since 0.1
158
+ *
159
+ * @param string $key The handle with which to register the asset.
160
+ * @param Asset $asset The asset instance.
161
+ *
162
+ * @return bool True on success, false on failure.
163
+ */
164
+ public static function register(string $key, Asset $asset)
165
+ {
166
+ return ($asset->type === static::SCRIPT)
167
+ ? wp_register_script($key, $asset->url, $asset->deps, $asset->ver, true)
168
+ : wp_register_style($key, $asset->url, $asset->deps, $asset->ver);
169
+ }
170
+ }
core/Wp/CronJob.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents a WordPress cron job.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class CronJob
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var string
16
+ */
17
+ protected $hook;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var array
23
+ */
24
+ protected $args;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var string|null
30
+ */
31
+ protected $repeat;
32
+
33
+ /**
34
+ * @since 0.1
35
+ *
36
+ * @var callable[]
37
+ */
38
+ protected $handlers;
39
+
40
+ /**
41
+ * Constructor.
42
+ *
43
+ * @since 0.1
44
+ *
45
+ * @param string $hook The hook to trigger when the cron job is invoked.
46
+ * @param array $args Optional arguments to pass to cron job handlers.
47
+ * @param string|null $repeat Optional repetition schedule. See {@link wp_get_schedules()}. If null, the cron job
48
+ * will be scheduled for a one-time invocation only.
49
+ * @param callable[] $handlers Optional handlers to register with the cron job. See {@link CronJob::register()}.
50
+ */
51
+ public function __construct(string $hook, array $args = [], string $repeat = null, array $handlers = [])
52
+ {
53
+ $this->hook = $hook;
54
+ $this->args = $args;
55
+ $this->repeat = $repeat;
56
+ $this->handlers = $handlers;
57
+ }
58
+
59
+ /**
60
+ * Schedules a cron job.
61
+ *
62
+ * @since 0.1
63
+ *
64
+ * @param CronJob $job The job.
65
+ * @param int $time The time at which to schedule the job.
66
+ */
67
+ public static function schedule(CronJob $job, int $time)
68
+ {
69
+ if ($job->repeat === null) {
70
+ wp_schedule_single_event($time, $job->hook, $job->args);
71
+ } else {
72
+ wp_schedule_event($time, $job->repeat, $job->hook, $job->args);
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Deschedules a job.
78
+ *
79
+ * Yes, "deschedule" is the correct term, not "unschedule". "De" prefixes mean to undo, while "Un" prefixes mean
80
+ * "is not". In other words, "unscheduled" means it is not, or has not, been scheduled. And "unschedule" would mean
81
+ * to make something that is scheduled never have been scheduled in the first place, which would require time
82
+ * travel. :D
83
+ *
84
+ * @since 0.1
85
+ *
86
+ * @param CronJob $job The job to deschedule.
87
+ */
88
+ public static function deschedule(CronJob $job)
89
+ {
90
+ $scheduled = static::getScheduledEvent($job);
91
+
92
+ if ($scheduled === false) {
93
+ return;
94
+ }
95
+
96
+ wp_unschedule_event($scheduled->timestamp, $job->hook, $job->args);
97
+ }
98
+
99
+ /**
100
+ * Checks if a cron job is scheduled.
101
+ *
102
+ * @since 0.1
103
+ *
104
+ * @param CronJob $job The job to check.
105
+ *
106
+ * @return bool True if the job is scheduled, false if not.
107
+ */
108
+ public static function isScheduled(CronJob $job) : bool
109
+ {
110
+ $next = wp_next_scheduled($job->hook, $job->args);
111
+
112
+ return $next !== false;
113
+ }
114
+
115
+ /**
116
+ * Retrieves the scheduled event for a cron job, if any.
117
+ *
118
+ * @since 0.1
119
+ *
120
+ * @param CronJob $job The cron job whose scheduled event to retrieve.
121
+ *
122
+ * @return object|false The event object. False if the event does not exist.
123
+ */
124
+ public static function getScheduledEvent(CronJob $job)
125
+ {
126
+ return wp_get_scheduled_event($job->hook, $job->args);
127
+ }
128
+
129
+ /**
130
+ * Ensures that a cron job and its handlers are scheduled.
131
+ *
132
+ * Cron events will be rescheduled if the existing event's repetition schedule does not match the schedule of the
133
+ * cron job given as argument.
134
+ *
135
+ * @since 0.1
136
+ *
137
+ * @param CronJob $job The cron job to register.
138
+ */
139
+ public static function register(CronJob $job)
140
+ {
141
+ // Cache for the WordPress schedules
142
+ static $schedules = null;
143
+
144
+ // Attach the handlers for the job
145
+ foreach ($job->handlers as $handler) {
146
+ add_action($job->hook, $handler);
147
+ }
148
+
149
+ // Get the existing event, if it exists
150
+ $event = static::getScheduledEvent($job);
151
+ $isScheduled = is_object($event);
152
+
153
+ // If an event is already scheduled and the intervals are the same, stop here.
154
+ if ($isScheduled && $event->schedule === $job->repeat) {
155
+ return;
156
+ }
157
+
158
+ // Deschedule any existing event.
159
+ // This should only happen when the job is being registered for the first time, or when the existing event
160
+ // has a different interval
161
+ static::deschedule($job);
162
+
163
+ // Get the WordPress schedules if not already cached
164
+ if ($schedules === null) {
165
+ $schedules = wp_get_schedules();
166
+ }
167
+
168
+ $time = time();
169
+ $time += ($schedules[$job->repeat]['interval'] ?? 0);
170
+
171
+ static::schedule($job, $time);
172
+ }
173
+ }
core/Wp/Menu.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents a top-level WordPress admin menu.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class Menu
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var string
16
+ */
17
+ protected $slug;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var string
23
+ */
24
+ protected $label;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var string
30
+ */
31
+ protected $capability;
32
+
33
+ /**
34
+ * @since 0.1
35
+ *
36
+ * @var string
37
+ */
38
+ protected $icon;
39
+
40
+ /**
41
+ * @since 0.1
42
+ *
43
+ * @var int|null
44
+ */
45
+ protected $position;
46
+
47
+ /**
48
+ * @since 0.1
49
+ *
50
+ * @var AdminPage
51
+ */
52
+ protected $page;
53
+
54
+ /**
55
+ * @since 0.1
56
+ *
57
+ * @var SubMenu[]
58
+ */
59
+ protected $items;
60
+
61
+ /**
62
+ * Constructor.
63
+ *
64
+ * @since 0.1
65
+ *
66
+ * @param AdminPage $page The page that the menu refers to.
67
+ * @param string $slug The slug name for the menu.
68
+ * @param string $label The label to show in the WP admin menu bar.
69
+ * @param string $capability The user capability required to show the menu and access the page.
70
+ * @param string $icon The icon to show near the menu's label in the WP admin menu bar.
71
+ * @param int|null $position The position of the menu in the WP admin menu bar.
72
+ * @param SubMenu[] $items The submenu items for this menu.
73
+ */
74
+ public function __construct(
75
+ AdminPage $page,
76
+ string $slug,
77
+ string $label,
78
+ string $capability,
79
+ string $icon = '',
80
+ int $position = null,
81
+ array $items = []
82
+ ) {
83
+ $this->page = $page;
84
+ $this->slug = $slug;
85
+ $this->label = $label;
86
+ $this->capability = $capability;
87
+ $this->icon = $icon;
88
+ $this->position = $position;
89
+ $this->items = $items;
90
+ }
91
+
92
+ /**
93
+ * Registers a menu with WordPress.
94
+ *
95
+ * @since 0.1
96
+ *
97
+ * @param Menu $menu The menu instance to register.
98
+ */
99
+ public static function register(Menu $menu)
100
+ {
101
+ if (!current_user_can($menu->capability)) {
102
+ return;
103
+ }
104
+
105
+ add_menu_page(
106
+ $menu->page->getTitle(),
107
+ $menu->label,
108
+ $menu->capability,
109
+ $menu->slug,
110
+ $menu->page->getRenderFn(),
111
+ $menu->icon,
112
+ $menu->position
113
+ );
114
+
115
+ foreach ($menu->items as $item) {
116
+ SubMenu::registerFor($menu->slug, $item);
117
+ }
118
+ }
119
+ }
core/Wp/MetaField.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents configuration for a WordPress post meta field in an immutable struct-like form.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class MetaField
11
+ {
12
+ /**
13
+ * The default meta field registration arguments.
14
+ *
15
+ * @since 0.1
16
+ */
17
+ const DEFAULT_ARGS = [
18
+ 'single' => true,
19
+ 'show_in_rest' => true,
20
+ ];
21
+
22
+ /**
23
+ * @since 0.1
24
+ *
25
+ * @var string
26
+ */
27
+ protected $key;
28
+
29
+ /**
30
+ * @since 0.1
31
+ *
32
+ * @var array
33
+ */
34
+ protected $args;
35
+
36
+ /**
37
+ * Constructor.
38
+ *
39
+ * @since 0.1
40
+ *
41
+ * @param string $key The key of the meta field.
42
+ * @param array $args Optional addition arguments. See {@link register_meta()}.
43
+ */
44
+ public function __construct(string $key, array $args = self::DEFAULT_ARGS)
45
+ {
46
+ $this->key = $key;
47
+ $this->args = $args;
48
+ }
49
+
50
+ /**
51
+ * @since 0.1
52
+ *
53
+ * @return string
54
+ */
55
+ public function getKey() : string
56
+ {
57
+ return $this->key;
58
+ }
59
+
60
+ /**
61
+ * @since 0.1
62
+ *
63
+ * @return array
64
+ */
65
+ public function getArgs() : array
66
+ {
67
+ return $this->args;
68
+ }
69
+
70
+ /**
71
+ * Registers a meta field for a specific WordPress post type.
72
+ *
73
+ * @since 0.1
74
+ *
75
+ * @param MetaField $field The meta field to register.
76
+ * @param string $postType The slug of the post type to register for.
77
+ */
78
+ public static function registerFor(MetaField $field, string $postType)
79
+ {
80
+ register_post_meta($postType, $field->key, $field->args);
81
+ }
82
+ }
core/Wp/PostType.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ use WP_Error;
6
+ use WP_Post;
7
+
8
+ /**
9
+ * Represents WordPress post type configuration in an immutable struct-like form.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ class PostType
14
+ {
15
+ /**
16
+ * @since 0.1
17
+ *
18
+ * @var string
19
+ */
20
+ protected $slug;
21
+
22
+ /**
23
+ * @since 0.1
24
+ *
25
+ * @var array
26
+ */
27
+ protected $args;
28
+
29
+ /**
30
+ * @since 0.1
31
+ *
32
+ * @var MetaField[]
33
+ */
34
+ protected $fields;
35
+
36
+ /**
37
+ * Constructor.
38
+ *
39
+ * @since 0.1
40
+ *
41
+ * @param string $slug The slug of the post type.
42
+ * @param array $args Registration arguments for the post type. See {@link register_post_type()}.
43
+ * @param MetaField[] $fields Optional meta fields to register with this post type.
44
+ */
45
+ public function __construct(string $slug, array $args, array $fields = [])
46
+ {
47
+ $this->slug = $slug;
48
+ $this->args = $args;
49
+ $this->fields = $fields;
50
+ }
51
+
52
+ /**
53
+ * @since 0.1
54
+ *
55
+ * @return string
56
+ */
57
+ public function getSlug() : string
58
+ {
59
+ return $this->slug;
60
+ }
61
+
62
+ /**
63
+ * @since 0.1
64
+ *
65
+ * @return array
66
+ */
67
+ public function getArgs() : array
68
+ {
69
+ return $this->args;
70
+ }
71
+
72
+ /**
73
+ * @since 0.1
74
+ *
75
+ * @return MetaField[]
76
+ */
77
+ public function getMetaFields() : array
78
+ {
79
+ return $this->fields;
80
+ }
81
+
82
+ /**
83
+ * Queries the post type for posts.
84
+ *
85
+ * If the $query contains a `fields` entry, the return type may change.
86
+ *
87
+ * @since 0.1
88
+ *
89
+ * @see https://developer.wordpress.org/reference/functions/get_posts/#comment-3553 Return type information.
90
+ *
91
+ * @param array $query The query. See {@link get_posts()}.
92
+ * @param null $num The number of posts to return. Overrides `posts_per_page` in $query.
93
+ * @param int $page The page to return. Overrides `page` in $query.
94
+ *
95
+ * @return WP_Post[] An array of {@link WP_Post} instances.
96
+ */
97
+ public function query($query = [], $num = null, $page = 1)
98
+ {
99
+ return get_posts(static::queryArgs($this->slug, $num, $page, $query));
100
+ }
101
+
102
+ /**
103
+ * Retrieves a specific post by ID.
104
+ *
105
+ * This method will **not** return posts whose post type does not match the instance's slug. A post MAY exist for
106
+ * the given ID but may belong to a different post type. In such an event, this method will return null.
107
+ *
108
+ * @since 0.1
109
+ *
110
+ * @param string|int $id The ID of the post to retrieve.
111
+ *
112
+ * @return WP_Post|null The post instance, or null if no post for the given ID was found or the found post belongs
113
+ * to a different post type.
114
+ */
115
+ public function get($id)
116
+ {
117
+ $posts = $this->query(['p' => $id], 1, 1);
118
+
119
+ return count($posts) === 0 ? null : $posts[0];
120
+ }
121
+
122
+ /**
123
+ * Inserts a new post into the database using the given data.
124
+ *
125
+ * @since 0.1
126
+ *
127
+ * @see wp_insert_post() For accepted values in the $data paramater.
128
+ *
129
+ * @param array $data The post data. See {@link wp_insert_post()}. If the array contains an `ID` entry, the
130
+ * {@link PostType::update()} method will be used instead.
131
+ *
132
+ * @return int|WP_Error The ID of the inserted post, or a {@link WP_Error} instance on failure.
133
+ */
134
+ public function insert(array $data)
135
+ {
136
+ $data['post_type'] = $this->slug;
137
+
138
+ if (isset($data['ID'])) {
139
+ return $this->update($data['ID'], $data);
140
+ }
141
+
142
+ return wp_insert_post($data, true);
143
+ }
144
+
145
+ /**
146
+ * Updates a post with a specific ID using the given data.
147
+ *
148
+ * @since 0.1
149
+ *
150
+ * @see wp_update_post() For accepted values in the $data paramater.
151
+ *
152
+ * @param int|string $id The ID of the post to update.
153
+ * @param array $data The data to update the post with. See {@link wp_update_post()}.
154
+ *
155
+ * @return int|WP_Error The updated post's ID, or a {@link WP_Error} instance on failure.
156
+ */
157
+ public function update($id, array $data)
158
+ {
159
+ if ($id === null) {
160
+ unset($data['ID']);
161
+
162
+ return $this->insert($data);
163
+ }
164
+
165
+ $data['ID'] = $id;
166
+ $data['post_type'] = $this->slug;
167
+
168
+ return wp_update_post($data, true);
169
+ }
170
+
171
+ /**
172
+ * Sends a post to the trash.
173
+ *
174
+ * This does not remove the post from the database, but instead changes its status.
175
+ *
176
+ * @since 0.1
177
+ *
178
+ * @param int|string $id The ID of the post to send to the trash.
179
+ *
180
+ * @return WP_Post|false The post instance on success, false on failure.
181
+ */
182
+ public function trash($id)
183
+ {
184
+ $ret = wp_trash_post($id);
185
+
186
+ return ($ret instanceof WP_Post) ? $ret : false;
187
+ }
188
+
189
+ /**
190
+ * Deletes a post.
191
+ *
192
+ * This does not move the post to the trash, but removes it completely from the database along with any associated
193
+ * meta data.
194
+ *
195
+ * @since 0.1
196
+ *
197
+ * @param int|string $id The ID of the post to delete.
198
+ *
199
+ * @return WP_Post|false The post instance on success, false on failure.
200
+ */
201
+ public function delete($id)
202
+ {
203
+ $ret = wp_delete_post($id, true);
204
+
205
+ return ($ret instanceof WP_Post) ? $ret : false;
206
+ }
207
+
208
+ /**
209
+ * Prepares query arguments.
210
+ *
211
+ * @since 0.1
212
+ *
213
+ * @param string $slug The post type slug.
214
+ * @param int|null $num Optional number of posts.
215
+ * @param int $page Optional page number. Integers less than 1 will be treated as 1.
216
+ * @param array $extra Optional extra arguments to add to the query.
217
+ *
218
+ * @return array The prepared query arguments.
219
+ */
220
+ public static function queryArgs(string $slug, int $num = null, int $page = 1, array $extra = [])
221
+ {
222
+ $base = [
223
+ 'post_type' => $slug,
224
+ 'posts_per_page' => $num ?? -1,
225
+ 'page' => max(1, $page),
226
+ 'orderby' => 'ID',
227
+ 'order' => 'ASC',
228
+ ];
229
+
230
+ return array_merge($base, $extra);
231
+ }
232
+
233
+ /**
234
+ * Registers a post type with WordPress.
235
+ *
236
+ * @since 0.1
237
+ *
238
+ * @param PostType $postType The post type to register.
239
+ */
240
+ public static function register(PostType $postType)
241
+ {
242
+ register_post_type($postType->slug, $postType->args);
243
+
244
+ foreach ($postType->fields as $field) {
245
+ MetaField::registerFor($field, $postType->slug);
246
+ }
247
+ }
248
+ }
core/Wp/Shortcode.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents configuration for a WordPress shortcode in an immutable struct-like form.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class Shortcode
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var string
16
+ */
17
+ protected $tag;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var callable
23
+ */
24
+ protected $callback;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param string $tag The shortcode tag.
32
+ * @param callable $callback The function that renders the shortcode. Should return a string containing the
33
+ * rendered result.
34
+ */
35
+ public function __construct(string $tag, callable $callback)
36
+ {
37
+ $this->tag = $tag;
38
+ $this->callback = $callback;
39
+ }
40
+
41
+ /**
42
+ * @since 0.1
43
+ *
44
+ * @return string
45
+ */
46
+ public function getTag() : string
47
+ {
48
+ return $this->tag;
49
+ }
50
+
51
+ /**
52
+ * @since 0.1
53
+ *
54
+ * @return callable
55
+ */
56
+ public function getCallback() : callable
57
+ {
58
+ return $this->callback;
59
+ }
60
+
61
+ /**
62
+ * Registers a shortcode to WordPress.
63
+ *
64
+ * @since 0.1
65
+ *
66
+ * @param Shortcode $shortcode The shortcode instance to register.
67
+ */
68
+ public static function register(Shortcode $shortcode)
69
+ {
70
+ add_shortcode($shortcode->tag, $shortcode->callback);
71
+ }
72
+ }
core/Wp/SubMenu.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents a WordPress admin submenu that appears under a top-level menu.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class SubMenu
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var string
16
+ */
17
+ protected $slug;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var string
23
+ */
24
+ protected $label;
25
+
26
+ /**
27
+ * @since 0.1
28
+ *
29
+ * @var string
30
+ */
31
+ protected $capability;
32
+
33
+ /**
34
+ * @since 0.1
35
+ *
36
+ * @var int|null
37
+ */
38
+ protected $position;
39
+
40
+ /**
41
+ * @since 0.1
42
+ *
43
+ * @var AdminPage|null
44
+ */
45
+ protected $page;
46
+
47
+ /**
48
+ * @since 0.1
49
+ *
50
+ * @var string|null
51
+ */
52
+ protected $url;
53
+
54
+ /**
55
+ * Creates a sub-menu instance that refers to a page.
56
+ *
57
+ * @since 0.1
58
+ *
59
+ * @param AdminPage $page The page that the submenu refers to.
60
+ * @param string $slug The slug name for the submenu.
61
+ * @param string $label The label to show for this submenu in the WP admin menu bar.
62
+ * @param string $capability The user capability required to show the menu and access the page.
63
+ * @param int|null $position The position of the submenu in its parent menu's container.
64
+ *
65
+ * @return static The created submenu instance.
66
+ */
67
+ public static function page(AdminPage $page, string $slug, string $label, string $capability, int $position = null)
68
+ {
69
+ $submenu = new static();
70
+ $submenu->slug = $slug;
71
+ $submenu->label = $label;
72
+ $submenu->capability = $capability;
73
+ $submenu->position = $position;
74
+ $submenu->page = $page;
75
+ $submenu->url = null;
76
+
77
+ return $submenu;
78
+ }
79
+
80
+ /**
81
+ * Creates a sub-menu instance that points to a URL.
82
+ *
83
+ * @since 0.1
84
+ *
85
+ * @param string $url The absolute URL that the submenu points to.
86
+ * @param string $label The label to show for this submenu in the WP admin menu bar.
87
+ * @param string $capability The user capability required to show the menu and access the page.
88
+ * @param int|null $position The position of the submenu in its parent menu's container.
89
+ *
90
+ * @return static The created submenu instance.
91
+ */
92
+ public static function url(string $url, string $label, string $capability, int $position = null)
93
+ {
94
+ $submenu = new static();
95
+ $submenu->slug = '';
96
+ $submenu->label = $label;
97
+ $submenu->capability = $capability;
98
+ $submenu->position = $position;
99
+ $submenu->url = $url;
100
+ $submenu->page = null;
101
+
102
+ return $submenu;
103
+ }
104
+
105
+ /**
106
+ * Registers the submenu to a parent menu.
107
+ *
108
+ * @since 0.1
109
+ *
110
+ * @param string $parentSlug The slug name of the parent menu.
111
+ * @param SubMenu $instance The submenu instance.
112
+ */
113
+ public static function registerFor(string $parentSlug, SubMenu $instance)
114
+ {
115
+ if (!current_user_can($instance->capability)) {
116
+ return;
117
+ }
118
+
119
+ if ($instance->page instanceof AdminPage && $instance->url === null) {
120
+ add_submenu_page(
121
+ $parentSlug,
122
+ $instance->page->getTitle(),
123
+ $instance->label,
124
+ $instance->capability,
125
+ $instance->slug,
126
+ $instance->page->getRenderFn(),
127
+ $instance->position
128
+ );
129
+
130
+ return;
131
+ }
132
+
133
+ if (is_string($instance->url) && strlen($instance->url) > 0 && $instance->page === null) {
134
+ global $submenu;
135
+
136
+ // Add to the menu
137
+ $submenu[$parentSlug][] = [
138
+ $instance->label,
139
+ $instance->capability,
140
+ $instance->url,
141
+ $instance->label,
142
+ ];
143
+
144
+ return;
145
+ }
146
+ }
147
+ }
core/Wp/Transient.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Wp;
4
+
5
+ /**
6
+ * Represents a WordPress transient in an immutable struct-like form.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class Transient
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ *
15
+ * @var string
16
+ */
17
+ protected $key;
18
+
19
+ /**
20
+ * @since 0.1
21
+ *
22
+ * @var int
23
+ */
24
+ protected $expiry;
25
+
26
+ /**
27
+ * Constructor.
28
+ *
29
+ * @since 0.1
30
+ *
31
+ * @param string $key The transient's key.
32
+ * @param int $expiry The timestamp for when the transient expires.
33
+ */
34
+ public function __construct(string $key, int $expiry)
35
+ {
36
+ $this->key = $key;
37
+ $this->expiry = $expiry;
38
+ }
39
+
40
+ /**
41
+ * @since 0.1
42
+ *
43
+ * @return string
44
+ */
45
+ public function getKey() : string
46
+ {
47
+ return $this->key;
48
+ }
49
+
50
+ /**
51
+ * @since 0.1
52
+ *
53
+ * @return int
54
+ */
55
+ public function getExpiry() : int
56
+ {
57
+ return $this->expiry;
58
+ }
59
+
60
+ /**
61
+ * Retrieves the value of a transient.
62
+ *
63
+ * @since 0.1
64
+ *
65
+ * @param Transient $transient The transient instance.
66
+ * @param mixed $default The value to return if the transient is not set.
67
+ *
68
+ * @return mixed
69
+ */
70
+ public static function getValue(Transient $transient, $default = null)
71
+ {
72
+ $value = get_transient($transient->key);
73
+
74
+ return ($value === false) ? $default : $value;
75
+ }
76
+
77
+ /**
78
+ * Sets a value to a transient.
79
+ *
80
+ * @since 0.1
81
+ *
82
+ * @param Transient $transient The transient instance.
83
+ * @param mixed $value The value to set to the transient.
84
+ *
85
+ * @return bool True on success, false on failure.
86
+ */
87
+ public static function setValue(Transient $transient, $value)
88
+ {
89
+ return set_transient($transient->key, $value, $transient->expiry);
90
+ }
91
+ }
modules.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use RebelCode\Spotlight\Instagram\Modules\AccountsModule;
4
+ use RebelCode\Spotlight\Instagram\Modules\CleanUpCronModule;
5
+ use RebelCode\Spotlight\Instagram\Modules\ConfigModule;
6
+ use RebelCode\Spotlight\Instagram\Modules\FeedsModule;
7
+ use RebelCode\Spotlight\Instagram\Modules\ImportCronModule;
8
+ use RebelCode\Spotlight\Instagram\Modules\InstagramModule;
9
+ use RebelCode\Spotlight\Instagram\Modules\MediaModule;
10
+ use RebelCode\Spotlight\Instagram\Modules\RestApiModule;
11
+ use RebelCode\Spotlight\Instagram\Modules\ShortcodeModule;
12
+ use RebelCode\Spotlight\Instagram\Modules\TokenRefresherModule;
13
+ use RebelCode\Spotlight\Instagram\Modules\UiModule;
14
+ use RebelCode\Spotlight\Instagram\Modules\WidgetModule;
15
+ use RebelCode\Spotlight\Instagram\Modules\WordPressModule;
16
+
17
+ return [
18
+ 'wp' => new WordPressModule(),
19
+ 'config' => new ConfigModule(),
20
+ 'ig' => new InstagramModule(),
21
+ 'feeds' => new FeedsModule(),
22
+ 'accounts' => new AccountsModule(),
23
+ 'media' => new MediaModule(),
24
+ 'importer' => new ImportCronModule(),
25
+ 'cleaner' => new CleanUpCronModule(),
26
+ 'token_refresher' => new TokenRefresherModule(),
27
+ 'rest_api' => new RestApiModule(),
28
+ 'ui' => new UiModule(),
29
+ 'shortcode' => new ShortcodeModule(),
30
+ 'widget' => new WidgetModule(),
31
+ ];
modules/AccountsModule.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\Value;
8
+ use Psr\Container\ContainerInterface;
9
+ use RebelCode\Spotlight\Instagram\Module;
10
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
11
+ use RebelCode\Spotlight\Instagram\Wp\MetaField;
12
+
13
+ /**
14
+ * The module that adds the accounts post type to the plugin.
15
+ *
16
+ * @since 0.1
17
+ */
18
+ class AccountsModule extends Module
19
+ {
20
+ /**
21
+ * @inheritDoc
22
+ *
23
+ * @since 0.1
24
+ */
25
+ public function getFactories() : array
26
+ {
27
+ return [
28
+ // The accounts CPT
29
+ 'cpt' => new Constructor(AccountPostType::class, [
30
+ 'cpt/slug',
31
+ 'cpt/args',
32
+ 'cpt/fields',
33
+ ]),
34
+
35
+ // The accounts CPT slug name
36
+ 'cpt/slug' => new Value('sl-insta-account'),
37
+ // The accounts CPT registration args
38
+ 'cpt/args' => new Value([
39
+ 'public' => false,
40
+ 'supports' => ['title', 'custom-fields'],
41
+ 'show_in_rest' => false,
42
+ ]),
43
+ // The meta fields for the accounts CPT
44
+ 'cpt/fields' => new Value([
45
+ new MetaField(AccountPostType::USER_ID),
46
+ new MetaField(AccountPostType::USERNAME),
47
+ new MetaField(AccountPostType::TYPE),
48
+ new MetaField(AccountPostType::MEDIA_COUNT),
49
+ new MetaField(AccountPostType::BIO),
50
+ new MetaField(AccountPostType::CUSTOM_BIO),
51
+ new MetaField(AccountPostType::PROFILE_PIC_URL),
52
+ new MetaField(AccountPostType::CUSTOM_PROFILE_PIC),
53
+ new MetaField(AccountPostType::ACCESS_TOKEN),
54
+ new MetaField(AccountPostType::ACCESS_EXPIRY),
55
+ ]),
56
+ ];
57
+ }
58
+
59
+ /**
60
+ * @inheritDoc
61
+ *
62
+ * @since 0.1
63
+ */
64
+ public function getExtensions() : array
65
+ {
66
+ return [
67
+ // Add the post type to WordPress
68
+ 'wp/post_types' => new ArrayExtension(['cpt']),
69
+ ];
70
+ }
71
+
72
+ /**
73
+ * @inheritDoc
74
+ *
75
+ * @since 0.1
76
+ */
77
+ public function run(ContainerInterface $c)
78
+ {
79
+ }
80
+ }
modules/CleanUpCronModule.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\ServiceList;
8
+ use Dhii\Services\Factories\Value;
9
+ use Psr\Container\ContainerInterface;
10
+ use RebelCode\Spotlight\Instagram\Actions\CleanUpMediaAction;
11
+ use RebelCode\Spotlight\Instagram\Config\WpOption;
12
+ use RebelCode\Spotlight\Instagram\Di\ConfigService;
13
+ use RebelCode\Spotlight\Instagram\Module;
14
+ use RebelCode\Spotlight\Instagram\Wp\CronJob;
15
+
16
+ /**
17
+ * Provides a corn job for cleaning up old media.
18
+ *
19
+ * @since 0.1
20
+ */
21
+ class CleanUpCronModule extends Module
22
+ {
23
+ /**
24
+ * Config key for the cleaner cron interval.
25
+ *
26
+ * @since 0.1
27
+ */
28
+ const CFG_CRON_INTERVAL = 'cleanerInterval';
29
+
30
+ /**
31
+ * @inheritDoc
32
+ *
33
+ * @since 0.1
34
+ */
35
+ public function getFactories() : array
36
+ {
37
+ return [
38
+ //==========================================================================
39
+ // CRON JOB
40
+ //==========================================================================
41
+
42
+ // The hook for the cron
43
+ 'hook' => new Value('spotlight/instagram/clean_up_media'),
44
+
45
+ // The args to pass to the cron's handlers
46
+ 'args' => new Value([]),
47
+
48
+ // The repetition for the cron, retrieved from config
49
+ 'repeat' => new ConfigService('@config/set', static::CFG_CRON_INTERVAL),
50
+
51
+ // The main handler for the cron
52
+ 'main_handler' => new Constructor(CleanUpMediaAction::class, [
53
+ '@media/cpt',
54
+ '@config/set',
55
+ ]),
56
+
57
+ // The list of handlers for the cron
58
+ 'handlers' => new ServiceList([
59
+ 'main_handler',
60
+ ]),
61
+
62
+ // The cron job instance.
63
+ 'job' => new Constructor(CronJob::class, [
64
+ 'hook',
65
+ 'args',
66
+ 'repeat',
67
+ 'handlers',
68
+ ]),
69
+
70
+ //==========================================================================
71
+ // CONFIG ENTRIES
72
+ //==========================================================================
73
+
74
+ // The config entry that stores the truncation age limit
75
+ 'config/age_limit' => new Value(new WpOption('sli_media_age_limit', '30 days')),
76
+
77
+ // The config entry that stores the repetition interval for the cron
78
+ 'config/interval' => new Value(new WpOption('sli_clean_up_interval', 'daily')),
79
+ ];
80
+ }
81
+
82
+ /**
83
+ * @inheritDoc
84
+ *
85
+ * @since 0.1
86
+ */
87
+ public function getExtensions() : array
88
+ {
89
+ return [
90
+ // Register the cron job
91
+ 'wp/cron_jobs' => new ArrayExtension([
92
+ 'job',
93
+ ]),
94
+ // Register the config entries
95
+ 'config/entries' => new ArrayExtension([
96
+ static::CFG_CRON_INTERVAL => 'config/interval',
97
+ CleanUpMediaAction::CFG_AGE_LIMIT => 'config/age_limit',
98
+ ]),
99
+ ];
100
+ }
101
+
102
+ /**
103
+ * @inheritDoc
104
+ *
105
+ * @since 0.1
106
+ */
107
+ public function run(ContainerInterface $c)
108
+ {
109
+ }
110
+ }
modules/ConfigModule.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Factories\FuncService;
6
+ use Dhii\Services\Factories\Value;
7
+ use Dhii\Services\Factory;
8
+ use Psr\Container\ContainerInterface;
9
+ use RebelCode\Spotlight\Instagram\Config\ConfigSet;
10
+ use RebelCode\Spotlight\Instagram\Config\WpOption;
11
+ use RebelCode\Spotlight\Instagram\Module;
12
+
13
+ class ConfigModule extends Module
14
+ {
15
+ /**
16
+ * @inheritDoc
17
+ *
18
+ * @since 0.1
19
+ */
20
+ public function run(ContainerInterface $c)
21
+ {
22
+ }
23
+
24
+ /**
25
+ * @inheritDoc
26
+ *
27
+ * @since 0.1
28
+ */
29
+ public function getFactories()
30
+ {
31
+ return [
32
+ // The config set
33
+ 'set' => new Factory(['entries', 'default'], function ($entries, $default) {
34
+ return new ConfigSet($entries, $default);
35
+ }),
36
+
37
+ // Entries for the config
38
+ 'entries' => new Value([]),
39
+
40
+ // The callback used by the config set to create options that do not exist
41
+ 'default' => new FuncService([], function ($key) {
42
+ return new WpOption($key);
43
+ }),
44
+ ];
45
+ }
46
+
47
+ /**
48
+ * @inheritDoc
49
+ *
50
+ * @since 0.1
51
+ */
52
+ public function getExtensions()
53
+ {
54
+ return [];
55
+ }
56
+ }
modules/Dev/DevClearLog.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
+
5
+ /**
6
+ * Dev tool that clears the WordPress debug.log file.
7
+ *
8
+ * @since 0.1
9
+ */
10
+ class DevClearLog
11
+ {
12
+ /**
13
+ * @since 0.1
14
+ */
15
+ public function __invoke()
16
+ {
17
+ $resetDb = filter_input(INPUT_POST, 'sli_clear_log');
18
+ if (!$resetDb) {
19
+ return;
20
+ }
21
+
22
+ if (!wp_verify_nonce($resetDb, 'sli_clear_log')) {
23
+ wp_die('You cannot do that!', 'Unauthorized', [
24
+ 'back_link' => true,
25
+ ]);
26
+ }
27
+
28
+ @unlink(WP_CONTENT_DIR . '/debug.log');
29
+ }
30
+ }
modules/Dev/DevDeleteMedia.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
+
5
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
6
+
7
+ /**
8
+ * Dev tool that deletes all media from the DB.
9
+ *
10
+ * @since 0.1
11
+ */
12
+ class DevDeleteMedia
13
+ {
14
+ /**
15
+ * @since 0.1
16
+ *
17
+ * @var PostType
18
+ */
19
+ protected $cpt;
20
+
21
+ /**
22
+ * Constructor.
23
+ *
24
+ * @since 0.1
25
+ *
26
+ * @param PostType $cpt The media post type.
27
+ */
28
+ public function __construct(PostType $cpt)
29
+ {
30
+ $this->cpt = $cpt;
31
+ }
32
+
33
+ /**
34
+ * @since 0.1
35
+ */
36
+ public function __invoke()
37
+ {
38
+ $deleteNonce = filter_input(INPUT_POST, 'sli_delete_meta');
39
+ if (!$deleteNonce) {
40
+ return;
41
+ }
42
+
43
+ if (!wp_verify_nonce($deleteNonce, 'sli_delete_media')) {
44
+ wp_die('You cannot do that!', 'Unauthorized', [
45
+ 'back_link' => true,
46
+ ]);
47
+ }
48
+
49
+ $list = $this->cpt->query();
50
+
51
+ foreach ($list as $media) {
52
+ $this->cpt->delete($media->ID);
53
+ }
54
+
55
+ $count = count($list);
56
+
57
+ add_action('admin_notices', function () use ($count) {
58
+ printf('<div class="notice notice-success"><p>Deleted %d media from the database</p></div>', $count);
59
+ });
60
+ }
61
+ }
modules/Dev/DevModule.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
+
5
+ use Dhii\Services\Extension;
6
+ use Dhii\Services\Extensions\ArrayExtension;
7
+ use Dhii\Services\Factories\Constructor;
8
+ use Dhii\Services\Factories\Value;
9
+ use Dhii\Services\Factory;
10
+ use Psr\Container\ContainerInterface;
11
+ use RebelCode\Spotlight\Instagram\Module;
12
+ use RebelCode\Spotlight\Instagram\Wp\AdminPage;
13
+ use RebelCode\Spotlight\Instagram\Wp\Menu;
14
+
15
+ /**
16
+ * This module is only used for development purposes.
17
+ *
18
+ * @since 0.1
19
+ *
20
+ * @package dev
21
+ */
22
+ class DevModule extends Module
23
+ {
24
+ /**
25
+ * @inheritDoc
26
+ *
27
+ * @since 0.1
28
+ */
29
+ public function getFactories() : array
30
+ {
31
+ return [
32
+ //==========================================================================
33
+ // DEV MENU and PAGE
34
+ //==========================================================================
35
+
36
+ // The dev menu
37
+ 'menu' => new Factory(['page'], function ($page) {
38
+ return new Menu(
39
+ $page,
40
+ 'sli-dev',
41
+ 'Spotlight Dev',
42
+ 'manage_options'
43
+ );
44
+ }),
45
+
46
+ // The dev page
47
+ 'page' => new Factory(['page/render'], function ($renderFn) {
48
+ return new AdminPage('Spotlight Dev Tools', $renderFn);
49
+ }),
50
+
51
+ // The render function for the page
52
+ 'page/render' => function (ContainerInterface $c) {
53
+ return new DevPage($c->get('plugin'), $c);
54
+ },
55
+
56
+ //==========================================================================
57
+ // DEV SERVER (Webpack)
58
+ //==========================================================================
59
+
60
+ // Whether or not to use the dev server for the front-end
61
+ 'dev_server/enabled' => new Factory(['@plugin/dir'], function ($dir) {
62
+ // If constant defined, use its value
63
+ if (defined('SL_INSTA_UI_DEV_SERVER')) {
64
+ return SL_INSTA_UI_DEV_SERVER;
65
+ }
66
+
67
+ // Otherwise, autodetect built files
68
+ return !file_exists($dir . '/ui/dist/runtime.js');
69
+ }),
70
+ // The URL to the front-end dev server
71
+ 'dev_server/url' => new Value('https://localhost:8000'),
72
+
73
+ //==========================================================================
74
+ // DEV TOOLS
75
+ //==========================================================================
76
+
77
+ // The DB reset tool
78
+ 'reset_db' => new Constructor(DevResetDb::class, ['@wp/db']),
79
+
80
+ // The DB media delete tool
81
+ 'delete_media' => new Constructor(DevDeleteMedia::class, ['@media/cpt']),
82
+
83
+ // The clear log tool
84
+ 'clear_log' => new Constructor(DevClearLog::class),
85
+ ];
86
+ }
87
+
88
+ /**
89
+ * @inheritDoc
90
+ *
91
+ * @since 0.1
92
+ */
93
+ public function getExtensions() : array
94
+ {
95
+ return [
96
+ // Add the dev menu to WordPress
97
+ 'wp/menus' => new ArrayExtension(['menu']),
98
+
99
+ // Use the dev server
100
+ 'ui/root_url' => new Extension(
101
+ ['dev_server/enabled', 'dev_server/url'],
102
+ function ($url, $enabled, $devServer) {
103
+ return $enabled ? $devServer : $url;
104
+ }
105
+ ),
106
+ ];
107
+ }
108
+
109
+ /**
110
+ * @inheritDoc
111
+ *
112
+ * @since 0.1
113
+ */
114
+ public function run(ContainerInterface $c)
115
+ {
116
+ // Listen for DB reset requests
117
+ add_action('init', $c->get('reset_db'));
118
+ // Listen for DB media delete requests
119
+ add_action('init', $c->get('delete_media'));
120
+ // Listen for log clear requests
121
+ add_action('init', $c->get('clear_log'));
122
+ }
123
+ }
modules/Dev/DevPage.php ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
+
5
+ use Psr\Container\ContainerInterface;
6
+ use RebelCode\Spotlight\Instagram\Plugin;
7
+ use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
8
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
9
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
10
+
11
+ /**
12
+ * The developers page.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class DevPage
17
+ {
18
+ /**
19
+ * @since 0.1
20
+ *
21
+ * @var Plugin
22
+ */
23
+ protected $plugin;
24
+
25
+ /**
26
+ * @since 0.1
27
+ *
28
+ * @var ContainerInterface
29
+ */
30
+ protected $container;
31
+
32
+ /**
33
+ * Constructor.
34
+ *
35
+ * @since 0.1
36
+ *
37
+ * @param Plugin $plugin
38
+ * @param ContainerInterface $container
39
+ */
40
+ public function __construct(Plugin $plugin, ContainerInterface $container)
41
+ {
42
+ $this->plugin = $plugin;
43
+ $this->container = $container;
44
+ }
45
+
46
+ /**
47
+ * @since 0.1
48
+ */
49
+ public function __invoke()
50
+ {
51
+ $currTab = filter_input(INPUT_GET, 'tab');
52
+ $currTab = empty($currTab) ? 'main' : $currTab;
53
+
54
+ $tabUrl = function ($tab) {
55
+ return admin_url('admin.php?page=sli-dev&tab=' . $tab);
56
+ };
57
+
58
+ $tabClass = function ($tab) use ($currTab) {
59
+ return 'nav-tab' . ($tab === $currTab ? ' nav-tab-active' : '');
60
+ };
61
+
62
+ $tabContent = function () use ($currTab) {
63
+ switch ($currTab) {
64
+ default:
65
+ $this->mainTab();
66
+ break;
67
+ case 'db':
68
+ $this->dbTab();
69
+ break;
70
+ case 'services':
71
+ $this->servicesTab();
72
+ break;
73
+ }
74
+ }
75
+
76
+ ?>
77
+ <div class="wrap">
78
+ <h1>Spotlight Dev</h1>
79
+
80
+ <nav class="nav-tab-wrapper">
81
+ <a class="<?= $tabClass('main') ?>" href="<?= $tabUrl('main') ?>">
82
+ Main
83
+ </a>
84
+ <a class="<?= $tabClass('db') ?>" href="<?= $tabUrl('db') ?>">
85
+ Database
86
+ </a>
87
+ <a class="<?= $tabClass('services') ?>" href="<?= $tabUrl('services') ?>">
88
+ Services
89
+ </a>
90
+ </nav>
91
+
92
+ <?php $tabContent() ?>
93
+ </div>
94
+ <?php
95
+
96
+ return;
97
+ }
98
+
99
+ /**
100
+ * Renders the main debug tab.
101
+ *
102
+ * @since 0.1
103
+ */
104
+ protected function mainTab()
105
+ {
106
+ ?>
107
+
108
+ <h2>Operations</h2>
109
+
110
+ <form method="POST">
111
+ <input type="hidden" name="sli_reset_db" value="<?= wp_create_nonce('sli_reset_db') ?>" />
112
+ <p>Remove all plugin data from the database</p>
113
+ <p>
114
+ <label>
115
+ <input type="checkbox" name="sli_reset_keep_accounts" value="1" />
116
+ Keep accounts
117
+ </label>
118
+ </p>
119
+ <p>
120
+ <label>
121
+ <input type="checkbox" name="sli_reset_keep_feeds" value="1" />
122
+ Keep feeds
123
+ </label>
124
+ </p>
125
+ <button type="submit" class="button">
126
+ Reset database
127
+ </button>
128
+ </form>
129
+
130
+ <h2>Debug Log</h2>
131
+
132
+ <?php
133
+
134
+ $debugLog = file_exists(WP_CONTENT_DIR . '/debug.log')
135
+ ? file_get_contents(WP_CONTENT_DIR . '/debug.log')
136
+ : '';
137
+
138
+ if (empty($debugLog)) : ?>
139
+ <p>The log is empty</p>
140
+ <?php else : ?>
141
+ <form method="POST">
142
+ <input type="hidden" name="sli_clear_log" value="<?= wp_create_nonce('sli_clear_log') ?>" />
143
+ <button type="submit" class="button">Clear log</button>
144
+ </form>
145
+
146
+ <br />
147
+
148
+ <details>
149
+ <summary>Show/Hide</summary>
150
+ <pre class="sli-debug-log"><?= $debugLog ?></pre>
151
+ </details>
152
+
153
+ <style type="text/css">
154
+ .sli-debug-log {
155
+ padding: 5px;
156
+ background: rgba(0, 0, 0, 0.1);
157
+ overflow-x: auto;
158
+ }
159
+
160
+ summary {
161
+ cursor: pointer;
162
+ user-select: none;
163
+ }
164
+ </style>
165
+ <?php
166
+ endif;
167
+ }
168
+
169
+ /**
170
+ * Renders the DB tab.
171
+ *
172
+ * @since 0.1
173
+ */
174
+ protected function dbTab()
175
+ {
176
+ /* @var $cpt PostType */
177
+ $cpt = $this->container->get('media/cpt');
178
+
179
+ $mediaList = $cpt->query();
180
+
181
+ $page = filter_input(INPUT_GET, 'db_page', FILTER_SANITIZE_NUMBER_INT);
182
+ $page = empty($page) ? 1 : max(1, intval($page));
183
+
184
+ [$mediaList, $totalNum, $numPages] = Arrays::paginate($mediaList, $page, 50);
185
+
186
+ $prevPageUrl = $page > 1 ? admin_url('admin.php?page=sli-dev&tab=db&db_page=' . ($page - 1)) : '';
187
+ $nextPageUrl = $page < $numPages ? admin_url('admin.php?page=sli-dev&tab=db&db_page=' . ($page + 1)) : '';
188
+
189
+ $headings = function () {
190
+ ?>
191
+ <tr>
192
+ <th class="sli-db-col-id">ID</th>
193
+ <th class="sli-db-col-link">Link</th>
194
+ <th class="sli-db-col-caption">Caption</th>
195
+ <th class="sli-db-col-type">Type</th>
196
+ <th class="sli-db-col-source">Source</th>
197
+ <th class="sli-db-col-date">Date &amp; Time</th>
198
+ </tr>
199
+ <?php
200
+ };
201
+
202
+ ?>
203
+ <style>
204
+ .sli-db-col-caption {
205
+ word-break: break-word;
206
+ }
207
+ </style>
208
+
209
+ <h2>Media</h2>
210
+
211
+ <div class="tablenav top">
212
+ <div class="alignleft actions">
213
+ <form method="POST">
214
+ <input type="hidden" name="sli_delete_meta" value="<?= wp_create_nonce('sli_delete_media') ?>" />
215
+ <button type="submit" class="button">Delete all</button>
216
+ </form>
217
+ </div>
218
+ <div class="tablenav-pages <?= ($numPages <= 1 ? 'one-page' : '') ?>">
219
+ <span class="displaying-num"><?= $totalNum ?> items</span>
220
+ <?php if ($numPages > 1): ?>
221
+ <span class="pagination-links">
222
+ <?php if ($page > 1) : ?>
223
+ <a class="tablenav-pages-navspan button" href="<?= $prevPageUrl ?>">&lsaquo;</a>
224
+ <?php else: ?>
225
+ <span class="tablenav-pages-navspan button disabled" aria-hidden="true">&lsaquo;</span>
226
+ <?php endif; ?>
227
+
228
+ <span class="paging-input">
229
+ <span class="tablenav-paging-text">
230
+ &nbsp;
231
+ <span><?= $page ?></span>
232
+ of
233
+ <span><?= $numPages ?></span>
234
+ &nbsp;
235
+ </span>
236
+ </span>
237
+
238
+ <?php if ($page < $numPages) : ?>
239
+ <a class="tablenav-pages-navspan button" href="<?= $nextPageUrl ?>">&rsaquo;</a>
240
+ <?php else: ?>
241
+ <span class="tablenav-pages-navspan button disabled" aria-hidden="true">&rsaquo;</span>
242
+ <?php endif; ?>
243
+ </span>
244
+ <?php endif; ?>
245
+ </div>
246
+ <br class="break" />
247
+ </div>
248
+
249
+ <table class="widefat striped sli-db-table">
250
+ <thead>
251
+ <?php $headings() ?>
252
+ </thead>
253
+ <tbody>
254
+ <?php if (empty($mediaList)) : ?>
255
+ <tr>
256
+ <td colspan="6">There are no media posts in the database.</td>
257
+ </tr>
258
+ <?php endif; ?>
259
+ <?php foreach ($mediaList as $media): ?>
260
+ <tr>
261
+ <td class="sli-db-col-id"><?= $media->ID ?></td>
262
+ <td class="sli-db-col-link">
263
+ <?php if (empty($media->{MediaPostType::URL})): ?>
264
+ <?= $media->{MediaPostType::MEDIA_ID} ?> <i>(Missing media URL)</i>
265
+ <?php else: ?>
266
+ <a href="<?= $media->{MediaPostType::URL} ?>" target="_blank">
267
+ <?= $media->{MediaPostType::MEDIA_ID} ?>
268
+ </a>
269
+ <?php endif; ?>
270
+ </td>
271
+ <td class="sli-db-col-caption">
272
+ <?= $media->{MediaPostType::CAPTION} ?>
273
+ </td>
274
+ <td class="sli-db-col-type">
275
+ <?= $media->{MediaPostType::TYPE} ?>
276
+ </td>
277
+ <td class="sli-db-col-source">
278
+ <?php
279
+
280
+ $username = $media->{MediaPostType::USERNAME};
281
+
282
+ if (!empty($username)) {
283
+ echo $username;
284
+ } else {
285
+ $isHashtag = stripos($media->{MediaPostType::SOURCE_TYPE}, 'hashtag');
286
+ $prefix = $isHashtag ? '#' : '';
287
+
288
+ echo $prefix . $media->{MediaPostType::SOURCE_NAME};
289
+ }
290
+ ?>
291
+ </td>
292
+ <td class="sli-db-col-date"><?= $media->{MediaPostType::TIMESTAMP} ?></td>
293
+ </tr>
294
+ <?php endforeach; ?>
295
+ </tbody>
296
+ <tfoot>
297
+ <?php $headings() ?>
298
+ </tfoot>
299
+ </table>
300
+ <?php
301
+
302
+ }
303
+
304
+ /**
305
+ * Renders the services tab.
306
+ *
307
+ * @since 0.1
308
+ */
309
+ protected function servicesTab()
310
+ {
311
+ [$factories] = $this->plugin->getCompiledServices();
312
+
313
+ $keys = array_keys($factories);
314
+ $tree = ServiceTree::buildTree('/', $keys, $this->container);
315
+
316
+ echo '<h2>Services</h2>';
317
+ echo ServiceTree::renderTree($tree);
318
+ }
319
+ }
modules/Dev/DevResetDb.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
+
5
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
6
+ use wpdb;
7
+
8
+ /**
9
+ * Dev tool that resets the DB.
10
+ *
11
+ * @since 0.1
12
+ */
13
+ class DevResetDb
14
+ {
15
+ /**
16
+ * @since 0.1
17
+ *
18
+ * @var wpdb
19
+ */
20
+ protected $db;
21
+
22
+ /**
23
+ * Constructor.
24
+ *
25
+ * @since 0.1
26
+ *
27
+ * @param wpdb $db
28
+ */
29
+ public function __construct(wpdb $db)
30
+ {
31
+ $this->db = $db;
32
+ }
33
+
34
+ /**
35
+ * @since 0.1
36
+ */
37
+ public function __invoke()
38
+ {
39
+ $resetDb = filter_input(INPUT_POST, 'sli_reset_db');
40
+ if (!$resetDb) {
41
+ return;
42
+ }
43
+
44
+ if (!wp_verify_nonce($resetDb, 'sli_reset_db')) {
45
+ wp_die('You cannot do that!', 'Unauthorized', [
46
+ 'back_link' => true,
47
+ ]);
48
+ }
49
+
50
+ $db = $this->db;
51
+
52
+ // The post types to delete
53
+ $postTypes = [
54
+ 'sl-insta-media',
55
+ ];
56
+ // Check for "keep accounts"
57
+ if (!filter_input(INPUT_POST, 'sli_reset_keep_accounts', FILTER_VALIDATE_BOOLEAN)) {
58
+ $postTypes[] = 'sl-insta-account';
59
+ }
60
+ // Check for "keep feeds"
61
+ if (!filter_input(INPUT_POST, 'sli_reset_keep_feeds', FILTER_VALIDATE_BOOLEAN)) {
62
+ $postTypes[] = 'sl-insta-feed';
63
+ }
64
+ // Generate SQL IN set for post types
65
+ $postTypesStr = implode(',', Arrays::map($postTypes, function ($postType) {
66
+ return "'$postType'";
67
+ }));
68
+
69
+ $count = $db->query("DELETE post, meta
70
+ FROM {$db->posts} as post
71
+ LEFT JOIN {$db->postmeta} as meta ON post.ID = meta.post_id
72
+ WHERE post.post_type IN ($postTypesStr)");
73
+
74
+ if ($db->last_error) {
75
+ wp_die($db->last_error, 'Spotlight DB Reset - Error', ['back_link' => true]);
76
+ }
77
+
78
+ $count += $db->query("DELETE FROM {$db->options}
79
+ WHERE (option_name LIKE 'sli_%' OR option_name LIKE '%_sli_%') AND
80
+ option_name != 'sli_user_did_onboarding'");
81
+
82
+ if ($db->last_error) {
83
+ wp_die($db->last_error, 'Spotlight DB Reset - Error', ['back_link' => true]);
84
+ }
85
+
86
+ add_action('admin_notices', function () use ($count) {
87
+ printf('<div class="notice notice-success"><p>Deleted %d items from the database</p></div>', $count);
88
+ });
89
+ }
90
+ }
modules/Dev/ServiceTree.php ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
+
5
+ use Psr\Container\ContainerExceptionInterface;
6
+ use Psr\Container\ContainerInterface;
7
+ use RebelCode\Spotlight\Instagram\Plugin;
8
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
9
+ use ReflectionClass;
10
+ use ReflectionException;
11
+ use wpdb;
12
+
13
+ /**
14
+ * Renders a hierarchical graph of services from a container, showing their resolved values.
15
+ *
16
+ * @since 0.1
17
+ */
18
+ class ServiceTree
19
+ {
20
+ /**
21
+ * Maximum depth by which to expand objects and arrays.
22
+ *
23
+ * @since 0.1
24
+ */
25
+ const DEPTH = 3;
26
+ /**
27
+ * Depth overrides for specific classes.
28
+ */
29
+ const DEPTH_OVERRIDES = [
30
+ wpdb::class => 0,
31
+ Plugin::class => 0,
32
+ ];
33
+
34
+ /**
35
+ * Builds a service tree.
36
+ *
37
+ * This algorithm builds the tree by interpreting service keys as paths.
38
+ *
39
+ * @since 0.1
40
+ *
41
+ * @param string $delimiter The delimiter used to separate path segments.
42
+ * @param array $services The service keys.
43
+ * @param ContainerInterface $container The container to use to resolve services.
44
+ *
45
+ * @return array An associative array that maps service key to a sub-array. Each sub-array will have a "__value"
46
+ * index that maps to the service's value, unless the service key is only a path node in which case
47
+ * the "__value" index will be omitted. In addition to the value, each sub-array will contain
48
+ * additional mappings for any child services, each of which map to a similar sub-array.
49
+ */
50
+ public static function buildTree(string $delimiter, array $services, ContainerInterface $container)
51
+ {
52
+ $tree = [];
53
+
54
+ foreach ($services as $service) {
55
+ try {
56
+ $value = $container->get($service);
57
+ } catch (ContainerExceptionInterface $exception) {
58
+ throw $exception;
59
+ }
60
+
61
+ $path = explode($delimiter, $service);
62
+ Arrays::setPath($tree, $path, ['__value' => $value]);
63
+ }
64
+
65
+ return $tree;
66
+ }
67
+
68
+ /**
69
+ * Renders a built tree into HTML.
70
+ *
71
+ * @since 0.1
72
+ *
73
+ * @see ServiceTree::buildTree()
74
+ *
75
+ * @param array $tree A built tree. See {@link ServiceTree::buildTree()}.
76
+ *
77
+ * @return string The rendered HTML.
78
+ */
79
+ public static function renderTree(array $tree)
80
+ {
81
+ ob_start();
82
+
83
+ ?>
84
+ <style type="text/css">
85
+ div.sli-service-graph {
86
+ font-family: monospace;
87
+ }
88
+
89
+ .service {
90
+ margin: 1px 0;
91
+ }
92
+
93
+ .service-list > .service-children > .service-list > .service::before {
94
+ position: absolute;
95
+ content: '─';
96
+ left: 0;
97
+ }
98
+
99
+ .service-children {
100
+ position: relative;
101
+ margin: 0 0 0 0.5em;
102
+ padding-left: 1.5em;
103
+ border-left: 1px solid #444;
104
+ }
105
+
106
+ code {
107
+ display: inline;
108
+ font-size: 11px;
109
+ color: #555;
110
+ background: transparent;
111
+ white-space: pre-wrap;
112
+ padding: 2px 0;
113
+ }
114
+ </style>
115
+ <div class="sli-service-graph"><?php static::printTree($tree) ?></div>
116
+ <?php
117
+
118
+ return ob_get_clean();
119
+ }
120
+
121
+ /**
122
+ * Outputs a service tree.
123
+ *
124
+ * @since 0.1
125
+ *
126
+ * @param array $tree The tree to output.
127
+ */
128
+ public static function printTree(array $tree)
129
+ {
130
+ echo '<div class="service-list">';
131
+
132
+ foreach ($tree as $key => $node) {
133
+ printf('<div class="service"><strong>%s</strong>', $key);
134
+
135
+ if (isset($node['__value'])) {
136
+ $value = $node['__value'];
137
+
138
+ echo ' = <code>';
139
+ static::printValue(static::buildValue($value));
140
+ echo '</code>';
141
+ }
142
+
143
+ echo '</div>';
144
+ unset($node['__value']);
145
+
146
+ if (count($tree) > 0) {
147
+ echo '<div class="service-children">';
148
+ static::printTree($node);
149
+ echo '</div>';
150
+ }
151
+ }
152
+
153
+ echo '</div>';
154
+ }
155
+
156
+ /**
157
+ * Builds a value, which can be outputted later.
158
+ *
159
+ * This formats values (such as null and booleans) or processes them into an intermediate format (such as for
160
+ * arrays and objects).
161
+ *
162
+ * @since 0.1
163
+ *
164
+ * @param mixed $val The value.
165
+ * @param int $depth The depth up to which to expand objects and arrays.
166
+ *
167
+ * @return array|string The printable value, array or object in array form with meta data (__CLASS AND __PROPS).
168
+ */
169
+ public static function buildValue($val, int $depth = self::DEPTH)
170
+ {
171
+ if ($val === null) {
172
+ return 'null';
173
+ }
174
+
175
+ if (is_bool($val)) {
176
+ return $val ? 'true' : 'false';
177
+ }
178
+
179
+ if (is_object($val)) {
180
+ $class = get_class($val);
181
+
182
+ foreach (static::DEPTH_OVERRIDES as $key => $override) {
183
+ if ($class === $key) {
184
+ $depth = $override;
185
+ break;
186
+ }
187
+ }
188
+
189
+ $props = static::getObjectProps($val, $depth);
190
+
191
+ return [
192
+ '__CLASS' => $class,
193
+ '__PROPS' => $props,
194
+ ];
195
+ }
196
+
197
+ if (is_array($val)) {
198
+ return Arrays::map($val, function ($elem) use ($depth) {
199
+ return static::buildValue($elem, $depth - 1);
200
+ });
201
+ }
202
+
203
+ return $val;
204
+ }
205
+
206
+ /**
207
+ * Outputs a built value.
208
+ *
209
+ * @since 0.1
210
+ *
211
+ * @param mixed $value The value to output.
212
+ * @param int $indent The current indent level. Used by recursive calls. Should be set to 0 for normal calls.
213
+ */
214
+ public static function printValue($value, int $indent = 0)
215
+ {
216
+ if (is_array($value)) {
217
+ $isObject = isset($value['__CLASS']);
218
+ $props = $isObject ? $value['__PROPS'] : $value;
219
+ $isEmpty = empty($props);
220
+
221
+ echo $isObject ? '&lt;' . $value['__CLASS'] . '&gt; {' : '[';
222
+
223
+ if (is_array($props)) {
224
+ echo $isEmpty ? '' : "\n";
225
+ ++$indent;
226
+
227
+ foreach ($props as $key => $propVal) {
228
+ echo str_repeat(' ', 4 * $indent) . $key . ': ';
229
+ echo static::printValue($propVal, $indent) . ",\n";
230
+ }
231
+
232
+ --$indent;
233
+ echo $isEmpty ? '' : str_repeat(' ', 4 * $indent);
234
+ } else {
235
+ echo ' ' . $props . ' ';
236
+ }
237
+
238
+ echo $isObject ? '}' : ']';
239
+ } else {
240
+ echo strval($value);
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Uses reflection to retrieve and object's properties.
246
+ *
247
+ * @since 0.1
248
+ *
249
+ * @param object $object The object.
250
+ * @param int $depth The depth up to which to recurse for object properties.
251
+ *
252
+ * @return array|string An associative array of prop names to corresponding values, or a string if the max depth
253
+ * is reached or failed to get reflection information.
254
+ */
255
+ public static function getObjectProps($object, int $depth = self::DEPTH)
256
+ {
257
+ if ($depth <= 0) {
258
+ return "...";
259
+ }
260
+
261
+ try {
262
+ $ref = new ReflectionClass($object);
263
+ } catch (ReflectionException $exception) {
264
+ return "...";
265
+ }
266
+
267
+ $results = [];
268
+
269
+ $props = $ref->getProperties();
270
+ foreach ($props as $prop) {
271
+ $prop->setAccessible(true);
272
+
273
+ $results[$prop->getName()] = self::buildValue($prop->getValue($object), $depth - 1);
274
+ }
275
+
276
+ $sProps = $ref->getStaticProperties();
277
+ foreach ($sProps as $prop) {
278
+ $prop->setAccessible(true);
279
+ $results['static ' . $prop->getName()] = self::buildValue($prop->getValue(), $depth - 1);
280
+ }
281
+
282
+ return $results;
283
+ }
284
+ }
modules/FeedsModule.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\Value;
8
+ use Psr\Container\ContainerInterface;
9
+ use RebelCode\Spotlight\Instagram\Feeds\FeedTemplate;
10
+ use RebelCode\Spotlight\Instagram\Module;
11
+ use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
12
+ use RebelCode\Spotlight\Instagram\Wp\MetaField;
13
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
14
+
15
+ /**
16
+ * The module that adds the feeds post type and related functionality to the plugin.
17
+ *
18
+ * @since 0.1
19
+ */
20
+ class FeedsModule extends Module
21
+ {
22
+ /**
23
+ * @inheritDoc
24
+ *
25
+ * @since 0.1
26
+ */
27
+ public function getFactories() : array
28
+ {
29
+ return [
30
+ // The feeds CPT
31
+ 'cpt' => new Constructor(PostType::class, [
32
+ 'cpt/slug',
33
+ 'cpt/args',
34
+ 'cpt/fields',
35
+ ]),
36
+ // The slug name for the feeds CPT
37
+ 'cpt/slug' => new Value('sl-insta-feed'),
38
+ // The args for the feeds CPT
39
+ 'cpt/args' => new Value([
40
+ 'public' => false,
41
+ 'supports' => ['title', 'custom-fields'],
42
+ 'show_in_rest' => false,
43
+ ]),
44
+ // The meta fields for the feeds CPT
45
+ 'cpt/fields' => new Value([
46
+ new MetaField(FeedPostType::OPTIONS),
47
+ ]),
48
+
49
+ // The template that renders feeds
50
+ 'template' => new Constructor(FeedTemplate::class, []),
51
+ ];
52
+ }
53
+
54
+ /**
55
+ * @inheritDoc
56
+ *
57
+ * @since 0.1
58
+ */
59
+ public function getExtensions() : array
60
+ {
61
+ return [
62
+ // Add the post type to WordPress
63
+ 'wp/post_types' => new ArrayExtension(['cpt']),
64
+ ];
65
+ }
66
+
67
+ /**
68
+ * @inheritDoc
69
+ *
70
+ * @since 0.1
71
+ */
72
+ public function run(ContainerInterface $c)
73
+ {
74
+ }
75
+ }
modules/ImportCronModule.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\ServiceList;
8
+ use Dhii\Services\Factories\Value;
9
+ use Psr\Container\ContainerInterface;
10
+ use RebelCode\Spotlight\Instagram\Actions\ImportMediaAction;
11
+ use RebelCode\Spotlight\Instagram\Config\WpOption;
12
+ use RebelCode\Spotlight\Instagram\Di\ConfigService;
13
+ use RebelCode\Spotlight\Instagram\Module;
14
+ use RebelCode\Spotlight\Instagram\Wp\CronJob;
15
+
16
+ /**
17
+ * Provides a cron job for importing media.
18
+ *
19
+ * @since 0.1
20
+ */
21
+ class ImportCronModule extends Module
22
+ {
23
+ /**
24
+ * The config key for the importer cron job interval.
25
+ *
26
+ * @since 0.1
27
+ */
28
+ const CFG_CRON_INTERVAL = 'importerInterval';
29
+
30
+ /**
31
+ * @inheritDoc
32
+ *
33
+ * @since 0.1
34
+ */
35
+ public function getFactories() : array
36
+ {
37
+ return [
38
+ //==========================================================================
39
+ // CRON JOB
40
+ //==========================================================================
41
+
42
+ // The hook for the cron
43
+ 'hook' => new Value('spotlight/instagram/import_media'),
44
+
45
+ // The args to pass to the cron's handlers
46
+ 'args' => new Value([]),
47
+
48
+ // The repetition for the cron
49
+ 'repeat' => new ConfigService('@config/set', static::CFG_CRON_INTERVAL),
50
+
51
+ // The main handler for the cron
52
+ 'main_handler' => new Constructor(ImportMediaAction::class, [
53
+ '@feeds/cpt',
54
+ '@media/store',
55
+ ]),
56
+
57
+ // The list of handlers for the cron
58
+ 'handlers' => new ServiceList([
59
+ 'main_handler',
60
+ ]),
61
+
62
+ // The cron job instance
63
+ 'job' => new Constructor(CronJob::class, [
64
+ 'hook',
65
+ 'args',
66
+ 'repeat',
67
+ 'handlers',
68
+ ]),
69
+
70
+ //==========================================================================
71
+ // CONFIG ENTRIES
72
+ //==========================================================================
73
+
74
+ // The config entry that stores the cron's repetition interval
75
+ 'config/interval' => new Value(new WpOption('sli_importer_interval', 'hourly')),
76
+ ];
77
+ }
78
+
79
+ /**
80
+ * @inheritDoc
81
+ *
82
+ * @since 0.1
83
+ */
84
+ public function getExtensions() : array
85
+ {
86
+ return [
87
+ // Register the cron job
88
+ 'wp/cron_jobs' => new ArrayExtension([
89
+ 'job',
90
+ ]),
91
+ // Register the config entries
92
+ 'config/entries' => new ArrayExtension([
93
+ static::CFG_CRON_INTERVAL => 'config/interval',
94
+ ]),
95
+ ];
96
+ }
97
+
98
+ /**
99
+ * @inheritDoc
100
+ *
101
+ * @since 0.1
102
+ */
103
+ public function run(ContainerInterface $c)
104
+ {
105
+ }
106
+ }
modules/InstagramModule.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Factories\Constructor;
6
+ use Dhii\Services\Factories\StringService;
7
+ use Dhii\Services\Factories\Value;
8
+ use Dhii\Services\Factory;
9
+ use GuzzleHttp\Client;
10
+ use Psr\Container\ContainerInterface;
11
+ use RebelCode\Spotlight\Instagram\Actions\AuthCallbackListener;
12
+ use RebelCode\Spotlight\Instagram\IgApi\IgApiClient;
13
+ use RebelCode\Spotlight\Instagram\IgApi\IgBasicApiClient;
14
+ use RebelCode\Spotlight\Instagram\IgApi\IgGraphApiClient;
15
+ use RebelCode\Spotlight\Instagram\Module;
16
+ use WpOop\TransientCache\CachePool;
17
+
18
+ /**
19
+ * The module that contains all functionality related to Instagram's APIs.
20
+ *
21
+ * @since 0.1
22
+ */
23
+ class InstagramModule extends Module
24
+ {
25
+ /**
26
+ * @inheritDoc
27
+ *
28
+ * @since 0.1
29
+ */
30
+ public function getFactories() : array
31
+ {
32
+ return [
33
+ //==========================================================================
34
+ // API CLIENT
35
+ //==========================================================================
36
+
37
+ // The auth state, which is passed back by IG/FB APIs
38
+ // We use the site URL so our auth server can redirect back to the user's site
39
+ 'api/state' => new Value(urlencode(admin_url())),
40
+
41
+ // The driver for clients, responsible for dispatching requests and receiving responses
42
+ 'api/driver' => function () {
43
+ return new Client([
44
+ 'timeout' => 20.0,
45
+ ]);
46
+ },
47
+
48
+ // The API client that combines the Basic Display API and Graph API clients
49
+ 'api/client' => new Constructor(IgApiClient::class, [
50
+ 'api/basic/client',
51
+ 'api/graph/client',
52
+ ]),
53
+
54
+ // Listens to requests from the auth server to save accounts into the DB
55
+ 'api/auth/listener' => new Constructor(AuthCallbackListener::class, [
56
+ 'api/client',
57
+ '@accounts/cpt',
58
+ 'api/graph/auth_url'
59
+ ]),
60
+
61
+ //==========================================================================
62
+ // BASIC DISPLAY API
63
+ //==========================================================================
64
+
65
+ // The URL to the auth dialog for the Basic Display API
66
+ 'api/basic/auth_url' => new Factory(['api/state'], function ($state) {
67
+ return "https://auth.spotlightwp.com/dialog/personal?state={$state}";
68
+ }),
69
+
70
+ // The basic display API client
71
+ 'api/basic/client' => new Constructor(IgBasicApiClient::class, [
72
+ 'api/driver',
73
+ 'api/cache',
74
+ 'api/basic/legacy_compensation',
75
+ ]),
76
+
77
+ // Whether or not to use the legacy API to compensate for data that is missing from the Basic Display API
78
+ 'api/basic/legacy_compensation' => new Value(false),
79
+
80
+ //==========================================================================
81
+ // GRAPH API
82
+ //==========================================================================
83
+
84
+ // The URL to auth dialog for the Graph API
85
+ 'api/graph/auth_url' => new Factory(['api/state'], function ($state) {
86
+ return "https://auth.spotlightwp.com/dialog/business?state={$state}";
87
+ }),
88
+
89
+ // The Graph API client
90
+ 'api/graph/client' => new Constructor(IgGraphApiClient::class, [
91
+ 'api/driver',
92
+ 'api/cache',
93
+ ]),
94
+
95
+ //==========================================================================
96
+ // API CACHE
97
+ //==========================================================================
98
+
99
+ // The cache pool instance
100
+ 'api/cache' => new Constructor(CachePool::class, [
101
+ '@wp/db',
102
+ 'api/cache/key',
103
+ 'api/cache/default',
104
+ ]),
105
+
106
+ // The time-to-live for the cache (30 minutes)
107
+ 'api/cache/ttl' => new Value(1800),
108
+
109
+ // The key for the cache pool
110
+ 'api/cache/key' => new Value('sli_api'),
111
+
112
+ // The default value for the cache pool - allows false-negative detection
113
+ 'api/cache/default' => new StringService(uniqid('{key}'), [
114
+ 'key' => 'api/cache/key',
115
+ ]),
116
+ ];
117
+ }
118
+
119
+ /**
120
+ * @inheritDoc
121
+ *
122
+ * @since 0.1
123
+ */
124
+ public function getExtensions() : array
125
+ {
126
+ return [];
127
+ }
128
+
129
+ /**
130
+ * @inheritDoc
131
+ *
132
+ * @since 0.1
133
+ */
134
+ public function run(ContainerInterface $c)
135
+ {
136
+ // Listen for requests from the auth server to insert connected accounts into the DB
137
+ add_action('admin_init', $c->get('api/auth/listener'));
138
+ }
139
+ }
modules/MediaModule.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\ServiceList;
8
+ use Dhii\Services\Factories\Value;
9
+ use Psr\Container\ContainerInterface;
10
+ use RebelCode\Spotlight\Instagram\MediaStore\Fetchers\AccountMediaFetcher;
11
+ use RebelCode\Spotlight\Instagram\MediaStore\MediaStore;
12
+ use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaSorterProcessor;
13
+ use RebelCode\Spotlight\Instagram\Module;
14
+ use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
15
+ use RebelCode\Spotlight\Instagram\Wp\MetaField;
16
+
17
+ /**
18
+ * The module that adds the media post type and all related functionality to the plugin.
19
+ *
20
+ * @since 0.1
21
+ */
22
+ class MediaModule extends Module
23
+ {
24
+ /**
25
+ * @inheritDoc
26
+ *
27
+ * @since 0.1
28
+ */
29
+ public function getFactories() : array
30
+ {
31
+ return [
32
+ //==========================================================================
33
+ // POST TYPE
34
+ //==========================================================================
35
+
36
+ // The media CPT
37
+ 'cpt' => new Constructor(MediaPostType::class, [
38
+ 'cpt/slug',
39
+ 'cpt/args',
40
+ 'cpt/fields',
41
+ ]),
42
+
43
+ // The media CPT slug name
44
+ 'cpt/slug' => new Value('sl-insta-media'),
45
+ // The media CPT registration args
46
+ 'cpt/args' => new Value([
47
+ 'public' => false,
48
+ 'supports' => ['title', 'custom-fields'],
49
+ 'show_in_rest' => false,
50
+ ]),
51
+ // The meta fields for the media CPT
52
+ 'cpt/fields' => new Value([
53
+ new MetaField(MediaPostType::MEDIA_ID),
54
+ new MetaField(MediaPostType::USERNAME),
55
+ new MetaField(MediaPostType::TIMESTAMP),
56
+ new MetaField(MediaPostType::CAPTION),
57
+ new MetaField(MediaPostType::TYPE),
58
+ new MetaField(MediaPostType::URL),
59
+ new MetaField(MediaPostType::PERMALINK),
60
+ new MetaField(MediaPostType::THUMBNAIL_URL),
61
+ new MetaField(MediaPostType::LIKES_COUNT),
62
+ new MetaField(MediaPostType::COMMENTS_COUNT),
63
+ new MetaField(MediaPostType::CHILDREN),
64
+ new MetaField(MediaPostType::LAST_REQUESTED),
65
+ ]),
66
+
67
+ //==========================================================================
68
+ // MEDIA STORE
69
+ //==========================================================================
70
+
71
+ // The media store
72
+ 'store' => new Constructor(MediaStore::class, ['@wp/db', 'fetchers', 'processors', 'cpt']),
73
+
74
+ // The media fetchers to use in the store
75
+ 'fetchers' => new ServiceList([
76
+ 'fetchers/accounts',
77
+ ]),
78
+
79
+ // The media processors to use in the store
80
+ 'processors' => new ServiceList([
81
+ 'processors/sorter',
82
+ ]),
83
+
84
+ //==========================================================================
85
+ // FETCHERS
86
+ //==========================================================================
87
+
88
+ // The fetcher that gets media from accounts
89
+ 'fetchers/accounts' => new Constructor(AccountMediaFetcher::class, [
90
+ '@ig/api/client',
91
+ '@accounts/cpt',
92
+ ]),
93
+
94
+ //==========================================================================
95
+ // PROCESSORS
96
+ //==========================================================================
97
+
98
+ // The processor that sorts the media
99
+ 'processors/sorter' => new Constructor(MediaSorterProcessor::class, []),
100
+ ];
101
+ }
102
+
103
+ /**
104
+ * @inheritDoc
105
+ *
106
+ * @since 0.1
107
+ */
108
+ public function getExtensions() : array
109
+ {
110
+ return [
111
+ // Add the post type to WordPress
112
+ 'wp/post_types' => new ArrayExtension(['cpt']),
113
+ ];
114
+ }
115
+
116
+ /**
117
+ * @inheritDoc
118
+ *
119
+ * @since 0.1
120
+ */
121
+ public function run(ContainerInterface $c)
122
+ {
123
+ }
124
+ }
modules/RestApiModule.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\ServiceList;
8
+ use Dhii\Services\Factories\Value;
9
+ use Dhii\Services\Factory;
10
+ use Psr\Container\ContainerInterface;
11
+ use RebelCode\Spotlight\Instagram\Module;
12
+ use RebelCode\Spotlight\Instagram\RestApi\Auth\AuthUserCapability;
13
+ use RebelCode\Spotlight\Instagram\RestApi\Auth\AuthVerifyNonce;
14
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoint;
15
+ use RebelCode\Spotlight\Instagram\RestApi\EndPointManager;
16
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\ConnectAccountEndPoint;
17
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\DeleteAccountEndPoint;
18
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\DeleteAccountMediaEndpoint;
19
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\GetAccessTokenEndPoint;
20
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\GetAccountsEndPoint;
21
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\UpdateAccountEndPoint;
22
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\DeleteFeedsEndpoint;
23
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\GetFeedsEndpoint;
24
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\SaveFeedsEndpoint;
25
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media\FetchMediaEndPoint;
26
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media\GetMediaEndPoint;
27
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Settings\GetSettingsEndpoint;
28
+ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Settings\PatchSettingsEndpoint;
29
+ use RebelCode\Spotlight\Instagram\RestApi\Transformers\AccountTransformer;
30
+ use RebelCode\Spotlight\Instagram\RestApi\Transformers\FeedsTransformer;
31
+ use RebelCode\Spotlight\Instagram\RestApi\Transformers\MediaTransformer;
32
+
33
+ /**
34
+ * The module that adds the REST API to the plugin.
35
+ *
36
+ * @since 0.1
37
+ */
38
+ class RestApiModule extends Module
39
+ {
40
+ /**
41
+ * @inheritDoc
42
+ *
43
+ * @since 0.1
44
+ */
45
+ public function getFactories() : array
46
+ {
47
+ return [
48
+ // The namespace for the REST API
49
+ 'namespace' => new Value('sl-insta'),
50
+
51
+ // The REST API endpoint manager
52
+ 'manager' => new Factory(['namespace', 'endpoints'], function ($ns, $endpoints) {
53
+ return new EndPointManager($ns, $endpoints);
54
+ }),
55
+
56
+ // The REST API endpoints under the `namespace`
57
+ 'endpoints' => new ServiceList([
58
+ 'endpoints/feeds/get',
59
+ 'endpoints/feeds/save',
60
+ 'endpoints/feeds/delete',
61
+ 'endpoints/accounts/get',
62
+ 'endpoints/accounts/delete',
63
+ 'endpoints/accounts/connect',
64
+ 'endpoints/accounts/update',
65
+ 'endpoints/accounts/delete_media',
66
+ 'endpoints/accounts/get_access_token',
67
+ 'endpoints/media/get',
68
+ 'endpoints/media/fetch',
69
+ 'endpoints/settings/get',
70
+ 'endpoints/settings/patch',
71
+ ]),
72
+
73
+ //==========================================================================
74
+ // USER AUTH
75
+ //==========================================================================
76
+
77
+ // The user capability required to access the REST API endpoints that manage entities
78
+ 'auth/user/capability' => new Value('edit_pages'),
79
+
80
+ // The auth guard to use to authorize logged in users
81
+ 'auth/user' => new Constructor(AuthUserCapability::class, ['auth/user/capability']),
82
+
83
+ //==========================================================================
84
+ // PUBLIC AUTH
85
+ //==========================================================================
86
+
87
+ // The authorization nonce for the JS apps to access the REST API
88
+ 'auth/public/nonce_header' => new Value('X-Sli-Nonce'),
89
+ 'auth/public/nonce_name' => new Value('sli-rest-api'),
90
+ 'auth/public/nonce_value' => new Factory(['auth/public/nonce_name'], function ($name) {
91
+ return wp_create_nonce($name);
92
+ }),
93
+
94
+ // The auth guard to use for REST API endpoints to authorize requests against the nonce
95
+ 'auth/public' => new Constructor(AuthVerifyNonce::class, [
96
+ 'auth/public/nonce_header',
97
+ 'auth/public/nonce_name',
98
+ ]),
99
+
100
+ //==========================================================================
101
+ // FEEDS
102
+ //==========================================================================
103
+
104
+ // The transformer for formatting feeds into REST API responses
105
+ 'feeds/transformer' => new Constructor(FeedsTransformer::class, [
106
+ '@wp/db',
107
+ ]),
108
+
109
+ // The REST API endpoint for retrieving feeds
110
+ 'endpoints/feeds/get' => new Factory(
111
+ ['@feeds/cpt', 'feeds/transformer', 'auth/user'],
112
+ function ($cpt, $t9r, $auth) {
113
+ return new EndPoint(
114
+ '/feeds(?:/(?P<id>\d+))?',
115
+ ['GET'],
116
+ new GetFeedsEndpoint($cpt, $t9r),
117
+ $auth
118
+ );
119
+ }
120
+ ),
121
+
122
+ // The REST API endpoint for saving feeds
123
+ 'endpoints/feeds/save' => new Factory(
124
+ ['@feeds/cpt', 'feeds/transformer', 'auth/user'],
125
+ function ($cpt, $t9r, $auth) {
126
+ return new EndPoint(
127
+ '/feeds(?:/(?P<id>\d+))?',
128
+ ['POST'],
129
+ new SaveFeedsEndpoint($cpt, $t9r),
130
+ $auth
131
+ );
132
+ }
133
+ ),
134
+
135
+ // The REST API endpoint for deleting feeds
136
+ 'endpoints/feeds/delete' => new Factory(
137
+ ['@feeds/cpt', 'feeds/transformer', 'auth/user'],
138
+ function ($cpt, $t9r, $auth) {
139
+ return new EndPoint(
140
+ '/feeds/(?P<id>\d+)',
141
+ ['DELETE'],
142
+ new DeleteFeedsEndpoint($cpt, $t9r),
143
+ $auth
144
+ );
145
+ }
146
+ ),
147
+
148
+ //==========================================================================
149
+ // ACCOUNTS
150
+ //==========================================================================
151
+
152
+ // The transformer for formatting accounts into REST API responses
153
+ 'accounts/transformer' => new Constructor(AccountTransformer::class, [
154
+ '@feeds/cpt',
155
+ ]),
156
+
157
+ // The GET endpoint for accounts
158
+ 'endpoints/accounts/get' => new Factory(
159
+ ['@accounts/cpt', 'accounts/transformer', 'auth/public', 'auth/user'],
160
+ function ($cpt, $t9r, $auth, $tokenGuard) {
161
+ return new EndPoint(
162
+ '/accounts(?:/(?P<id>\d+))?',
163
+ ['GET'],
164
+ new GetAccountsEndPoint($cpt, $t9r, $tokenGuard),
165
+ $auth
166
+ );
167
+ }
168
+ ),
169
+ // The DELETE endpoint for accounts
170
+ 'endpoints/accounts/delete' => new Factory(
171
+ ['@accounts/cpt', '@media/cpt', 'accounts/transformer', 'auth/user'],
172
+ function ($accountsCpt, $mediaCpt, $t9r, $auth) {
173
+ return new EndPoint(
174
+ '/accounts/(?P<id>\d+)',
175
+ ['DELETE'],
176
+ new DeleteAccountEndPoint($accountsCpt, $mediaCpt, $t9r),
177
+ $auth
178
+ );
179
+ }
180
+ ),
181
+ // The endpoint to manually connect an account by access token
182
+ 'endpoints/accounts/connect' => new Factory(
183
+ ['@ig/api/client', '@accounts/cpt', 'auth/user'],
184
+ function ($client, $cpt, $auth) {
185
+ return new EndPoint(
186
+ '/connect',
187
+ ['POST'],
188
+ new ConnectAccountEndPoint($client, $cpt),
189
+ $auth
190
+ );
191
+ }
192
+ ),
193
+ // The endpoint for updating account information
194
+ 'endpoints/accounts/update' => new Factory(
195
+ ['@accounts/cpt', 'auth/user'],
196
+ function ($cpt, $auth) {
197
+ return new EndPoint(
198
+ '/accounts',
199
+ ['POST'],
200
+ new UpdateAccountEndPoint($cpt),
201
+ $auth
202
+ );
203
+ }
204
+ ),
205
+ // The endpoint that deletes media for an account
206
+ 'endpoints/accounts/delete_media' => new Factory(
207
+ ['@accounts/cpt', '@media/cpt', 'auth/user'],
208
+ function ($accountsCpt, $mediaCpt, $auth) {
209
+ return new EndPoint(
210
+ '/account_media/(?P<id>\d+)',
211
+ ['DELETE'],
212
+ new DeleteAccountMediaEndpoint($accountsCpt, $mediaCpt),
213
+ $auth
214
+ );
215
+ }
216
+ ),
217
+ // The endpoint to provides access tokens
218
+ 'endpoints/accounts/get_access_token' => new Factory(
219
+ ['@accounts/cpt', 'auth/user'],
220
+ function ($cpt, $auth) {
221
+ return new EndPoint(
222
+ '/access_token/(?P<id>\d+)',
223
+ ['GET'],
224
+ new GetAccessTokenEndPoint($cpt),
225
+ $auth
226
+ );
227
+ }
228
+ ),
229
+
230
+ //==========================================================================
231
+ // MEDIA
232
+ //==========================================================================
233
+
234
+ // The transformer that transforms IG media instances into REST API response format
235
+ 'media/transformer' => new Constructor(MediaTransformer::class, []),
236
+
237
+ // The GET endpoint for posts
238
+ 'endpoints/media/get' => new Factory(
239
+ ['@media/cpt', 'auth/public'],
240
+ function ($cpt, $auth) {
241
+ return new EndPoint(
242
+ '/media',
243
+ ['GET'],
244
+ new GetMediaEndPoint($cpt),
245
+ $auth
246
+ );
247
+ }
248
+ ),
249
+ // The endpoint for fetching media posts from IG
250
+ 'endpoints/media/fetch' => new Factory(
251
+ ['@media/store', 'media/transformer', 'auth/public'],
252
+ function ($store, $t9r, $auth) {
253
+ return new EndPoint(
254
+ '/media/fetch',
255
+ ['POST'],
256
+ new FetchMediaEndPoint($store, $t9r),
257
+ $auth
258
+ );
259
+ }
260
+ ),
261
+
262
+ //==========================================================================
263
+ // SETTINGS
264
+ //==========================================================================
265
+
266
+ // The endpoint for retrieving settings
267
+ 'endpoints/settings/get' => new Factory(['@config/set', 'auth/user'], function ($config, $auth) {
268
+ return new EndPoint(
269
+ '/settings',
270
+ ['GET'],
271
+ new GetSettingsEndpoint($config),
272
+ $auth
273
+ );
274
+ }),
275
+
276
+ // The endpoint for changing settings
277
+ 'endpoints/settings/patch' => new Factory(['@config/set', 'auth/user'], function ($config, $auth) {
278
+ return new EndPoint(
279
+ '/settings',
280
+ ['POST', 'PUT', 'PATCH'],
281
+ new PatchSettingsEndpoint($config),
282
+ $auth
283
+ );
284
+ }),
285
+ ];
286
+ }
287
+
288
+ /**
289
+ * @inheritDoc
290
+ *
291
+ * @since 0.1
292
+ */
293
+ public function getExtensions() : array
294
+ {
295
+ return [
296
+ // Add the REST API's URL to the localization data for the common bundle
297
+ 'ui/l10n/common' => new Extension(['namespace'], function ($config, $ns) {
298
+ $config['restApi']['baseUrl'] = rest_url() . $ns;
299
+
300
+ return $config;
301
+ }),
302
+ ];
303
+ }
304
+
305
+ /**
306
+ * @inheritDoc
307
+ *
308
+ * @since 0.1
309
+ */
310
+ public function run(ContainerInterface $c)
311
+ {
312
+ add_action('rest_api_init', function () use ($c) {
313
+ /* @var $manager EndPointManager */
314
+ $manager = $c->get('manager');
315
+ $manager->register();
316
+ });
317
+ }
318
+ }
modules/ShortcodeModule.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\Value;
8
+ use Psr\Container\ContainerInterface;
9
+ use RebelCode\Spotlight\Instagram\Actions\RenderShortcode;
10
+ use RebelCode\Spotlight\Instagram\Module;
11
+ use RebelCode\Spotlight\Instagram\Wp\Shortcode;
12
+
13
+ /**
14
+ * The module that adds the shortcode (to display feeds) to the plugin.
15
+ *
16
+ * @since 0.1
17
+ */
18
+ class ShortcodeModule extends Module
19
+ {
20
+ /**
21
+ * @inheritDoc
22
+ *
23
+ * @since 0.1
24
+ */
25
+ public function getFactories() : array
26
+ {
27
+ return [
28
+ 'tag' => new Value('instagram'),
29
+ 'callback' => new Constructor(RenderShortcode::class, ['@feeds/cpt', '@feeds/template',]),
30
+ 'instance' => new Constructor(Shortcode::class, ['tag', 'callback']),
31
+ ];
32
+ }
33
+
34
+ /**
35
+ * @inheritDoc
36
+ *
37
+ * @since 0.1
38
+ */
39
+ public function getExtensions() : array
40
+ {
41
+ return [
42
+ 'wp/shortcodes' => new ArrayExtension(['instance']),
43
+ ];
44
+ }
45
+
46
+ /**
47
+ * @inheritDoc
48
+ *
49
+ * @since 0.1
50
+ */
51
+ public function run(ContainerInterface $c)
52
+ {
53
+ }
54
+ }
modules/TokenRefresherModule.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\ServiceList;
8
+ use Dhii\Services\Factories\Value;
9
+ use Psr\Container\ContainerInterface;
10
+ use RebelCode\Spotlight\Instagram\Actions\RefreshAccessTokensAction;
11
+ use RebelCode\Spotlight\Instagram\Module;
12
+ use RebelCode\Spotlight\Instagram\Wp\CronJob;
13
+
14
+ /**
15
+ * The module that provides access token refreshing functionality.
16
+ *
17
+ * @since 0.1
18
+ */
19
+ class TokenRefresherModule extends Module
20
+ {
21
+ /**
22
+ * The repetition interval for the cron job.
23
+ *
24
+ * @since 0.1
25
+ */
26
+ const CFG_CRON_INTERVAL = 'weekly';
27
+
28
+ /**
29
+ * @inheritDoc
30
+ *
31
+ * @since 0.1
32
+ */
33
+ public function run(ContainerInterface $c)
34
+ {
35
+ }
36
+
37
+ /**
38
+ * @inheritDoc
39
+ *
40
+ * @since 0.1
41
+ */
42
+ public function getFactories()
43
+ {
44
+ return [
45
+ //==========================================================================
46
+ // CRON JOB
47
+ //==========================================================================
48
+
49
+ // The hook for the cron
50
+ 'hook' => new Value('spotlight/instagram/refresh_access_tokens'),
51
+
52
+ // The args to pass to the cron's handlers
53
+ 'args' => new Value([]),
54
+
55
+ // The repetition for the cron
56
+ 'repeat' => new Value(static::CFG_CRON_INTERVAL),
57
+
58
+ // The main handler for the cron
59
+ 'main_handler' => new Constructor(RefreshAccessTokensAction::class, [
60
+ '@ig/api/client',
61
+ '@accounts/cpt',
62
+ ]),
63
+
64
+ // The list of handlers for the cron
65
+ 'handlers' => new ServiceList([
66
+ 'main_handler',
67
+ ]),
68
+
69
+ // The cron job instance
70
+ 'job' => new Constructor(CronJob::class, [
71
+ 'hook',
72
+ 'args',
73
+ 'repeat',
74
+ 'handlers',
75
+ ]),
76
+ ];
77
+ }
78
+
79
+ /**
80
+ * @inheritDoc
81
+ *
82
+ * @since 0.1
83
+ */
84
+ public function getExtensions()
85
+ {
86
+ return [
87
+ // Register the cron job
88
+ 'wp/cron_jobs' => new ArrayExtension([
89
+ 'job',
90
+ ]),
91
+ ];
92
+ }
93
+ }
modules/UiModule.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factories\Alias;
7
+ use Dhii\Services\Factories\Constructor;
8
+ use Dhii\Services\Factories\FuncService;
9
+ use Dhii\Services\Factories\StringService;
10
+ use Dhii\Services\Factories\Value;
11
+ use Dhii\Services\Factory;
12
+ use Psr\Container\ContainerInterface;
13
+ use RebelCode\Spotlight\Instagram\Module;
14
+ use RebelCode\Spotlight\Instagram\RestApi\Auth\AuthVerifyNonce;
15
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
16
+ use RebelCode\Spotlight\Instagram\Wp\AdminPage;
17
+ use RebelCode\Spotlight\Instagram\Wp\Asset;
18
+ use RebelCode\Spotlight\Instagram\Wp\Menu;
19
+ use RebelCode\Spotlight\Instagram\Wp\SubMenu;
20
+
21
+ /**
22
+ * The module for the UI front-end of the plugin.
23
+ *
24
+ * @since 0.1
25
+ */
26
+ class UiModule extends Module
27
+ {
28
+ /**
29
+ * @inheritDoc
30
+ *
31
+ * @since 0.1
32
+ */
33
+ public function getFactories() : array
34
+ {
35
+ return [
36
+ //==========================================================================
37
+ // MENU PAGE
38
+ //==========================================================================
39
+
40
+ // The menu
41
+ 'menu' => new Constructor(Menu::class, [
42
+ 'page',
43
+ 'menu/slug',
44
+ 'menu/label',
45
+ 'menu/capability',
46
+ 'menu/icon',
47
+ 'menu/position',
48
+ 'menu/items',
49
+ ]),
50
+
51
+ // Configuration for the menu
52
+ 'menu/slug' => new Value('spotlight-instagram'),
53
+ 'menu/capability' => new Value('edit_pages'),
54
+ 'menu/label' => new Value('Instagram Feeds'),
55
+ 'menu/icon' => new Value('dashicons-instagram'),
56
+ 'menu/position' => new Value(30),
57
+
58
+ // The items that appear under the WP Admin menu entry
59
+ // The UI react app will mount over the menu with identical-looking components. But we still need to
60
+ // register them in order for the menu to appear while the user is on pages where the app is not loaded.
61
+ 'menu/items' => new Factory(['menu/slug', 'menu/capability'], function ($parentSlug, $cap) {
62
+ $parentUrl = admin_url("admin.php?page={$parentSlug}");
63
+
64
+ return [
65
+ SubMenu::url("{$parentUrl}&screen=feeds", 'Feeds', $cap),
66
+ SubMenu::url("{$parentUrl}&screen=new", 'Add New', $cap),
67
+ SubMenu::url("{$parentUrl}&screen=settings", 'Settings', $cap),
68
+ ];
69
+ }),
70
+
71
+ // The page to show for the menu
72
+ 'page' => new Constructor(AdminPage::class, ['page/title', 'page/render_fn']),
73
+
74
+ // The title of the page, shown in the browser's tab
75
+ 'page/title' => new Value('Spotlight'),
76
+
77
+ // The render function for the page
78
+ 'page/render_fn' => new FuncService(['root_element_id'], function ($id) {
79
+ do_action('spotlight/instagram/enqueue_admin_app');
80
+
81
+ return sprintf('<div class="wrap"><div id="%s"></div></div>', $id);
82
+ }),
83
+
84
+ // The ID of the root element, onto which React will mount
85
+ 'root_element_id' => new Value('spotlight-instagram-admin'),
86
+
87
+ //==========================================================================
88
+ // PATHS
89
+ //==========================================================================
90
+
91
+ // The path, relative to the plugin directory, where the UI code is located
92
+ 'root_path' => new Value('/ui'),
93
+ // The path, relative to the root URL, from where assets are served
94
+ 'assets_path' => new Value('/dist'),
95
+ // The path, relative to assets_path, from where scripts are served
96
+ 'scripts_path' => new Value(''),
97
+ // The path, relative to assets_path, from where styles are served
98
+ 'styles_path' => new Value('/styles'),
99
+
100
+ //==========================================================================
101
+ // URLS
102
+ //==========================================================================
103
+
104
+ // The URL to where the UI code is located
105
+ 'root_url' => new StringService('{0}{1}', ['@plugin/url', 'root_path']),
106
+ // The URL from where assets will be served
107
+ 'assets_url' => new StringService('{0}{1}', ['root_url', 'assets_path']),
108
+ // The URL from where scripts and styles are served
109
+ 'scripts_url' => new StringService('{0}{1}', ['assets_url', 'scripts_path']),
110
+ 'styles_url' => new StringService('{0}{1}', ['assets_url', 'styles_path']),
111
+
112
+ //==========================================================================
113
+ // ASSETS
114
+ //==========================================================================
115
+
116
+ // The version to use for assets (the plugin's current version)
117
+ 'assets_ver' => new Alias('plugin/version', new Value('')),
118
+
119
+ // The scripts
120
+ 'scripts' => new Factory(['scripts_url', 'assets_ver'], function ($url, $ver) {
121
+ return [
122
+ // Runtime chunk
123
+ 'sli-runtime' => Asset::script("{$url}/runtime.js", $ver),
124
+ // Contains all common code
125
+ 'sli-common' => Asset::script("{$url}/common.js", $ver, [
126
+ 'sli-runtime',
127
+ ]),
128
+ // Contains all code shared between all the admin bundles
129
+ 'sli-admin-common' => Asset::script("{$url}/admin-common.js", $ver, [
130
+ 'sli-common',
131
+ ]),
132
+ // Contains the code for the editor
133
+ 'sli-editor' => Asset::script("{$url}/editor.js", $ver, [
134
+ 'sli-admin-common',
135
+ ]),
136
+ // The main admin app
137
+ 'sli-admin' => Asset::script("{$url}/admin-app.js", $ver, [
138
+ 'sli-admin-common',
139
+ 'sli-editor',
140
+ ]),
141
+ // The frontend app (for the shortcode, widget, block, etc.)
142
+ 'sli-front' => Asset::script("{$url}/front-app.js", $ver, [
143
+ 'sli-common',
144
+ ]),
145
+ ];
146
+ }),
147
+
148
+ // The styles
149
+ 'styles' => new Factory(['styles_url', 'assets_ver'], function ($url, $ver) {
150
+ return [
151
+ // Styles for the common bundle
152
+ 'sli-common' => Asset::style("{$url}/common.css", $ver),
153
+ // Styles shared by all admin bundles
154
+ 'sli-admin-common' => Asset::style("{$url}/admin-common.css", $ver),
155
+ // Styles for the editor
156
+ 'sli-editor' => Asset::style("{$url}/editor.css", $ver, [
157
+ 'sli-admin-common',
158
+ 'sli-common',
159
+ ]),
160
+ // Styles for the main admin app
161
+ 'sli-admin' => Asset::style("{$url}/admin-app.css", $ver, [
162
+ 'sli-admin-common',
163
+ 'sli-editor',
164
+ ]),
165
+ // Styles for the frontend app
166
+ 'sli-front' => Asset::style("{$url}/front-app.css", $ver, [
167
+ 'sli-common',
168
+ 'dashicons',
169
+ ]),
170
+ ];
171
+ }),
172
+
173
+ //==========================================================================
174
+ // LOCALIZATION
175
+ //==========================================================================
176
+
177
+ // Localization data for the common bundle
178
+ 'l10n/common' => new Factory(['@rest_api/auth/public/nonce_value'], function ($sliNonce) {
179
+ return [
180
+ 'restApi' => [
181
+ 'baseUrl' => '',
182
+ 'wpNonce' => wp_create_nonce('wp_rest'),
183
+ 'sliNonce' => $sliNonce,
184
+ ],
185
+ ];
186
+ }),
187
+
188
+ // Localization data for the admin-common bundle
189
+ 'l10n/admin-common' => new Factory(
190
+ ['@ig/api/basic/auth_url', '@ig/api/graph/auth_url', 'onboarding/is_done'],
191
+ function ($basicAuthUrl, $graphAuthUrl, $onboardingDone) {
192
+ return [
193
+ 'adminUrl' => admin_url(),
194
+ 'restApi' => [
195
+ 'personalAuthUrl' => $basicAuthUrl,
196
+ 'businessAuthUrl' => $graphAuthUrl,
197
+ ],
198
+ 'doOnboarding' => !$onboardingDone,
199
+ 'cronSchedules' => Arrays::mapPairs(wp_get_schedules(), function ($key, $val, $idx) {
200
+ return [$idx, array_merge($val, ['key' => $key])];
201
+ }),
202
+ ];
203
+ }
204
+ ),
205
+
206
+ //==========================================================================
207
+ // ADMIN ONBOARDING
208
+ //==========================================================================
209
+
210
+ // The name of option that indicates whether the user went through the onboarding process
211
+ 'onboarding/option' => new Value('sli_user_did_onboarding'),
212
+ // Whether or not the user has completed the onboarding process
213
+ 'onboarding/is_done' => new Factory(['onboarding/option'], function ($option) {
214
+ return filter_var(get_option($option, false), FILTER_VALIDATE_BOOLEAN);
215
+ }),
216
+ ];
217
+ }
218
+
219
+ /**
220
+ * @inheritDoc
221
+ *
222
+ * @since 0.1
223
+ */
224
+ public function getExtensions() : array
225
+ {
226
+ return [
227
+ 'wp/menus' => new ArrayExtension(['menu']),
228
+ ];
229
+ }
230
+
231
+ /**
232
+ * @inheritDoc
233
+ *
234
+ * @since 0.1
235
+ */
236
+ public function run(ContainerInterface $c)
237
+ {
238
+ // Register the assets
239
+ {
240
+ $scripts = $c->get('scripts');
241
+ $styles = $c->get('styles');
242
+
243
+ $registerAssetsFn = function () use ($scripts, $styles) {
244
+ Arrays::eachAssoc($scripts, [Asset::class, 'register']);
245
+ Arrays::eachAssoc($styles, [Asset::class, 'register']);
246
+ };
247
+
248
+ add_action('wp_enqueue_scripts', $registerAssetsFn);
249
+ add_action('admin_enqueue_scripts', $registerAssetsFn);
250
+ }
251
+
252
+ // Actions for enqueueing assets
253
+ {
254
+ // Action that localizes config for the apps.
255
+ add_action('spotlight/instagram/localize_config', function () use ($c) {
256
+ $common = $c->get('l10n/common');
257
+ wp_localize_script('sli-common', 'SliCommonL10n', $common);
258
+
259
+ $adminCommon = $c->get('l10n/admin-common');
260
+ wp_localize_script('sli-admin-common', 'SliAdminCommonL10n', $adminCommon);
261
+ });
262
+
263
+ // Action that enqueues the admin app.
264
+ add_action('spotlight/instagram/enqueue_admin_app', function () use ($c) {
265
+ // Enqueue assets
266
+ wp_enqueue_media();
267
+ wp_enqueue_script('sli-admin');
268
+ wp_enqueue_style('sli-admin');
269
+
270
+ // Localize
271
+ do_action('spotlight/instagram/localize_config');
272
+ });
273
+
274
+ // Action that enqueues the front app.
275
+ add_action('spotlight/instagram/enqueue_front_app', function () use ($c) {
276
+ // Enqueue assets
277
+ wp_enqueue_script('sli-front');
278
+ wp_enqueue_style('sli-front');
279
+
280
+ // Localize
281
+ do_action('spotlight/instagram/localize_config');
282
+ });
283
+ }
284
+
285
+ {
286
+ add_action('admin_menu', function () use ($c) {
287
+ // If the user has not completed the onboarding yet, hide the submenu items for the admin menu
288
+ if (!$c->get('onboarding/is_done')) {
289
+ global $submenu;
290
+ $menuSlug = $c->get('menu/slug');
291
+ unset($submenu[$menuSlug]);
292
+ }
293
+ }, 100);
294
+ }
295
+
296
+ // Handlers for onboarding
297
+ {
298
+ // When a feed is saved, update the onboarding option
299
+ add_action('save_post', function ($postId, $post) use ($c) {
300
+ if ($post->post_type === $c->get('feeds/cpt/slug')) {
301
+ update_option($c->get('onboarding/option'), true);
302
+ }
303
+ }, 10, 2);
304
+ }
305
+ }
306
+ }
modules/WidgetModule.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Extensions\ArrayExtension;
6
+ use Dhii\Services\Factory;
7
+ use Psr\Container\ContainerInterface;
8
+ use RebelCode\Spotlight\Instagram\Feeds\FeedWidget;
9
+ use RebelCode\Spotlight\Instagram\Module;
10
+
11
+ /**
12
+ * The module that adds the widget (to display feeds) to the plugin.
13
+ *
14
+ * @since 0.1
15
+ */
16
+ class WidgetModule extends Module
17
+ {
18
+ /**
19
+ * @inheritDoc
20
+ *
21
+ * @since 0.1
22
+ */
23
+ public function getFactories() : array
24
+ {
25
+ return [
26
+ // The WP widget class - renders using the shortcode
27
+ 'class' => new Factory(['@feeds/cpt', '@shortcode/callback'], function ($cpt, $shortcode) {
28
+ FeedWidget::$cpt = $cpt;
29
+ FeedWidget::$shortcode = $shortcode;
30
+
31
+ return FeedWidget::class;
32
+ }),
33
+ ];
34
+ }
35
+
36
+ /**
37
+ * @inheritDoc
38
+ *
39
+ * @since 0.1
40
+ */
41
+ public function getExtensions() : array
42
+ {
43
+ return [
44
+ 'wp/widgets' => new ArrayExtension([
45
+ 'class',
46
+ ]),
47
+ ];
48
+ }
49
+
50
+ /**
51
+ * @inheritDoc
52
+ *
53
+ * @since 0.1
54
+ */
55
+ public function run(ContainerInterface $c)
56
+ {
57
+ }
58
+ }
modules/WordPressModule.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Modules;
4
+
5
+ use Dhii\Services\Factories\GlobalVar;
6
+ use Dhii\Services\Factories\Value;
7
+ use Psr\Container\ContainerInterface;
8
+ use RebelCode\Spotlight\Instagram\Module;
9
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
10
+ use RebelCode\Spotlight\Instagram\Wp\CronJob;
11
+ use RebelCode\Spotlight\Instagram\Wp\Menu;
12
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
13
+ use RebelCode\Spotlight\Instagram\Wp\Shortcode;
14
+
15
+ /**
16
+ * A module that contains services for various WordPress objects.
17
+ *
18
+ * @since 0.1
19
+ */
20
+ class WordPressModule extends Module
21
+ {
22
+ /**
23
+ * @inheritDoc
24
+ *
25
+ * @since 0.1
26
+ */
27
+ public function getFactories() : array
28
+ {
29
+ return [
30
+ 'db' => new GlobalVar('wpdb'),
31
+ 'post_types' => new Value([]),
32
+ 'cron_jobs' => new Value([]),
33
+ 'shortcodes' => new Value([]),
34
+ 'widgets' => new Value([]),
35
+ 'menus' => new Value([]),
36
+ ];
37
+ }
38
+
39
+ /**
40
+ * @inheritDoc
41
+ *
42
+ * @since 0.1
43
+ */
44
+ public function getExtensions() : array
45
+ {
46
+ return [];
47
+ }
48
+
49
+ /**
50
+ * @inheritDoc
51
+ *
52
+ * @since 0.1
53
+ */
54
+ public function run(ContainerInterface $c)
55
+ {
56
+ add_action('init', function () use ($c) {
57
+ // Register the CPTs
58
+ Arrays::each($c->get('post_types'), [PostType::class, 'register']);
59
+
60
+ // Register the cron jobs
61
+ Arrays::each($c->get('cron_jobs'), [CronJob::class, 'register']);
62
+
63
+ // Register the shortcodes
64
+ Arrays::each($c->get('shortcodes'), [Shortcode::class, 'register']);
65
+ });
66
+
67
+ // Registers the menus for the WP Admin sidebar
68
+ add_action('admin_menu', function () use ($c) {
69
+ Arrays::each($c->get('menus'), [Menu::class, 'register']);
70
+ });
71
+
72
+ // Registers the widget
73
+ add_action('widgets_init', function () use ($c) {
74
+ Arrays::each($c->get('widgets'), 'register_widget');
75
+ });
76
+ }
77
+ }
plugin.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * @wordpress-plugin
5
+ * Plugin Name: Spotlight - Social Photo Feeds
6
+ * Description: Easily embed beautiful Instagram feeds on your WordPress site.
7
+ * Version: 0.1
8
+ * Author: RebelCode
9
+ * Plugin URI: https://spotlightwp.com
10
+ * Author URI: https://rebelcode.com
11
+ * Requires at least: 5.0
12
+ * Requires PHP: 7.1
13
+ */
14
+
15
+ use Dhii\Modular\Module\ModuleInterface;
16
+ use RebelCode\Spotlight\Instagram\Di\Container;
17
+ use RebelCode\Spotlight\Instagram\Modules\Dev\DevModule;
18
+ use RebelCode\Spotlight\Instagram\Plugin;
19
+ use RebelCode\Spotlight\Instagram\PrefixingModule;
20
+
21
+ // If not running within a WordPress context, or the plugin is already running, stop
22
+ if (defined(ABSPATH) || defined('SL_INSTA')) {
23
+ exit;
24
+ }
25
+
26
+ // Used for detecting that hte plugin is running
27
+ define('SL_INSTA', true);
28
+ // Path constants
29
+ define('SL_INSTA_FILE', __FILE__);
30
+ define('SL_INSTA_DIR', __DIR__);
31
+ // Minimum required versions
32
+ define('SL_INSTA_MIN_PHP_VER', '7.1');
33
+ define('SL_INSTA_MIN_WP_VER', '4.9');
34
+
35
+ if (!defined('SL_INSTA_DEV')) {
36
+ define('SL_INSTA_DEV', false);
37
+ }
38
+
39
+ // Load the modules file, if not already loaded
40
+ if (!defined('SL_INSTA_MODULES')) {
41
+ define('SL_INSTA_MODULES', __DIR__ . '/modules.php');
42
+ }
43
+
44
+ // Autoloader
45
+ if (file_exists(__DIR__ . '/vendor/autoload.php')) {
46
+ require __DIR__ . '/vendor/autoload.php';
47
+ }
48
+
49
+ if (version_compare(PHP_VERSION, SL_INSTA_MIN_PHP_VER, '<')) {
50
+ add_action('admin_notices', function () {
51
+ printf(
52
+ '<div class="notice notice-error"><p>%s</p></div>',
53
+ sprintf(
54
+ _x(
55
+ '%1$s requires PHP version %2$s or later',
56
+ '%1$s is the name of the plugin, %2$s is the required PHP version',
57
+ 'sli'
58
+ ),
59
+ '<strong>Spotlight - Social Photo Feeds</strong>',
60
+ SL_INSTA_MIN_PHP_VER
61
+ )
62
+ );
63
+ });
64
+
65
+ return;
66
+ }
67
+
68
+ global $wp_version;
69
+ if (version_compare($wp_version, SL_INSTA_MIN_WP_VER, '<')) {
70
+ add_action('admin_notices', function () {
71
+ printf(
72
+ '<div class="notice notice-error"><p>%s</p></div>',
73
+ sprintf(
74
+ _x(
75
+ '%1$s requires WordPress version %2$s or later',
76
+ '%1$s is the name of the plugin, %2$s is the required WP version',
77
+ 'sli'
78
+ ),
79
+ '<strong>Spotlight - Social Photo Feeds</strong>',
80
+ SL_INSTA_MIN_WP_VER
81
+ )
82
+ );
83
+ });
84
+
85
+ return;
86
+ }
87
+
88
+ /**
89
+ * Retrieves the plugin instance.
90
+ *
91
+ * @since 0.1
92
+ *
93
+ * @return Plugin
94
+ */
95
+ function slInstaPlugin()
96
+ {
97
+ static $instance = null;
98
+
99
+ if ($instance === null) {
100
+ $modules = slInstaModules();
101
+
102
+ if (slInstaDevMode()) {
103
+ $modules['dev'] = new PrefixingModule('dev/', new DevModule());
104
+ }
105
+
106
+ $instance = new Plugin(__FILE__, $modules);
107
+ }
108
+
109
+ return $instance;
110
+ }
111
+
112
+ /**
113
+ * Retrieves the plugin modules.
114
+ *
115
+ * @since 0.1
116
+ *
117
+ * @return ModuleInterface[]
118
+ */
119
+ function slInstaModules()
120
+ {
121
+ static $modules = null;
122
+
123
+ if ($modules === null) {
124
+ $map = require SL_INSTA_MODULES;
125
+
126
+ $modules = [];
127
+ foreach ($map as $key => $module) {
128
+ $modules[$key] = new PrefixingModule("$key/", $module);
129
+ }
130
+ }
131
+
132
+ return $modules;
133
+ }
134
+
135
+ /**
136
+ * Runs the plugin.
137
+ *
138
+ * @since 0.1
139
+ */
140
+ function slInstaRun()
141
+ {
142
+ try {
143
+ $plugin = slInstaPlugin();
144
+ $container = new Container('sl-insta', $plugin->getFactories(), $plugin->getExtensions());
145
+ $plugin->run($container);
146
+ } catch (Exception $exception) {
147
+ wp_die(
148
+ $exception->getMessage() . "\n<pre>" . $exception->getTraceAsString() . '</pre>',
149
+ 'Spotlight - Social Photo Feeds | Error',
150
+ [
151
+ 'back_link' => true,
152
+ ]
153
+ );
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Checks whether the plugin is in development mode.
159
+ *
160
+ * @since 0.1
161
+ *
162
+ * @return bool True if in development mode, false if not.
163
+ */
164
+ function slInstaDevMode()
165
+ {
166
+ return defined('SL_INSTA_DEV') && SL_INSTA_DEV;
167
+ }
168
+
169
+ // Run the plugin
170
+ slInstaRun();
readme.txt ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Spotlight - Social Photo Feeds ===
2
+
3
+ Contributors: RebelCode, markzahra, Mekku, jeangalea
4
+ Plugin URI: https://spotlightwp.com
5
+ Tags: Instagram, Instagram feed, Instagram gallery, embed Instagram, Instagram widget, Instagram photos, Instagram hashtags, Instagram posts, Instagram carousel, Instagram grid, Instagram videos, Instagram images
6
+ Requires at least: 5.0 or higher
7
+ Tested up to: 5.4.2
8
+ Stable tag: 0.1
9
+ Requires PHP: 7.1
10
+ License: GPLv3
11
+
12
+ Add responsive Instagram feeds from multiple accounts to your site. Connect and customize with our interactive live preview editor.
13
+
14
+ == Description ==
15
+
16
+ Boost your brand, drive more conversions, and grow your following with a simple, intuitive, and powerful solution.
17
+
18
+ It’s simple enough for new WordPress users to get up and running in seconds, yet powerful enough for social media marketers to use on a daily basis.
19
+
20
+ == Gain Instagram followers & add social proof ==
21
+
22
+ From baby boomers to millennials and Gen Z, Instagram gets people from all walks of life to engage with each other. It's also where you can build a strong reputation and develop social proof.
23
+
24
+ Spotlight is here to help you make the most of all this by sharing the photos and videos from your Instagram account on your website. Something as simple as adding a “**Follow button**” to an Instagram feed in your sidebar or footer can instantly improve engagement and grow your following.
25
+
26
+ == Keep your site looking fresh and vibrant ==
27
+
28
+ Keep website visitors engaged with vibrant imagery and a constant flow of fresh content. Not everyone has time for a blog or content marketing, but Instagram feeds can do the job fantastically well.
29
+
30
+ They keep your website looking lively and vibrant without having to do any extra work. Post on Instagram and it's automatically refreshing your website content.
31
+
32
+ == Quick to connect, fun to design, simple to embed ==
33
+
34
+ Set up your Instagram feed in 3 simple steps:
35
+
36
+ 1. Connect your Instagram accounts
37
+
38
+ 2. Design your feed
39
+
40
+ 3. Add it anywhere on your site
41
+
42
+ Connecting your Instagram account to your website takes a couple of clicks. It's really that simple thanks to Instagram's latest secure and powerful API and authentication.
43
+
44
+ No HTML, CSS, or complex shortcodes to set up your feeds. Spotlight has a robust and interactive **live preview customiser** to get an immediate look at what you're creating. Play around with the design options and test it out without ever leaving the page.
45
+
46
+ Your feeds are **completely responsive - switch between desktop, tablet, and phone views** with one click. You can even customise a number of design options for individual devices to ensure the feed looks exactly the way you want it to on each screen.
47
+
48
+ Save the feed and use the [shortcode](https://docs.spotlightwp.com/article/579-shortcode) or [widget](https://docs.spotlightwp.com/article/580-widget) provided by Spotlight to add your Instagram feed to any page, post, block, widget area, or otherwise.
49
+
50
+ == Full list of free features ==
51
+
52
+ - Connect multiple Instagram accounts
53
+ - Set up unlimited feeds
54
+ - Interactive live preview customiser
55
+ - Point and click design editor
56
+ - Responsiveness options
57
+ - Beautiful grid layout
58
+ - Set the number of posts and columns per feed
59
+ - Order by date, popularity, or at random
60
+ - Popup (lightbox) display
61
+ - Like and comment counts on hover
62
+ - Feed header with profile details
63
+ - Custom bio text per feed*
64
+ - Custom profile photo per feed*
65
+ - “Follow” button
66
+ - “Load More” button
67
+ - Simple shortcode
68
+
69
+ *Instagram's API does not allow you to use the profile photo or bio from your Personal Instagram account. That feature is only available for Business accounts (which are free to upgrade to). The custom bio text and custom profile photo features have been added to ensure you can still add a header to your Instagram feed and use the same (or different) details you have on Instagram.
70
+
71
+ == Open up to new opportunities with Spotlight PRO [COMING SOON] ==
72
+
73
+ Spotlight's premium versions add incredible value for those looking to make the most of their Instagram feeds. Apart from more layouts and styles, you can set up feeds for hashtag campaigns, share posts where you're tagged, embed stories, and even take full control over what posts are being displayed in each feed.
74
+
75
+ Here’s a quick look at the full feature list:
76
+
77
+ - Instagram stories
78
+ - Hashtag feeds (from all of Instagram)
79
+ - Tagged post feeds
80
+ - Masonry layout
81
+ - Carousel layout
82
+ - Highlight layout
83
+ - Hover options
84
+ - Header styles
85
+ - Autoloading
86
+ - Captions, likes and comments
87
+ - Caption filtering
88
+ - Hashtag filtering
89
+ - Visual moderation mode (show/hide posts)
90
+
91
+ **[Visit our website to learn more.](https://spotlightwp.com/pro-coming-soon/?utm_source=dotorg&utm_medium=dotorg_readme&utm_campaign=dotorg_readme_procta)**
92
+
93
+ == Developed and supported by WordPress experts ==
94
+
95
+ Support for Spotlight’s free version is available in the plugin repository forums.
96
+
97
+ Premium customers and those with other questions may contact us using the [support contact form](https://spotlightwp.com/support/?utm_source=dotorg&utm_medium=dotorg_readme&utm_campaign=dotorg_readme_support).
98
+
99
+ Our team has decades of experience in the WordPress community and we have helped millions of people with their WordPress sites through WP Mayor, a trusted and long-standing WordPress resource site; and WP RSS Aggregator, the original and most popular RSS feed importer for WordPress.
100
+
101
+ == Get Started ==
102
+
103
+ = Installing the Plugin =
104
+
105
+ Method 1:
106
+
107
+ 1. Go to the Plugins page in your WordPress site's dashboard.
108
+ 2. Click on the "Add New" button.
109
+ 3. Search for “Spotlight Social Photo Feeds”.
110
+ 4. Click on the "Install" button once you find it, then hit the "Activate" button when it has installed.
111
+ 5. Go to the “Instagram Feeds” menu item to get started.
112
+
113
+ Method 2:
114
+
115
+ 1. Click on the "Download" button above.
116
+ 2. Upload the zip file to your site's `/wp-content/plugins/` directory via SFTP.
117
+ 3. Activate the “Spotlight Social Photo Feeds” plugin from the Plugins page of your WordPress dashboard.
118
+ 4. Go to the “Instagram Feeds” menu item to get started.
119
+
120
+ = Adding a feed to your website =
121
+
122
+ Use the [Spotlight shortcode](https://docs.spotlightwp.com/article/579-shortcode), [instagram feed="xyz"], or the ["Spotlight Instagram Feed"](https://docs.spotlightwp.com/article/580-widget) widget to embed your feed anywhere on your WordPress site.
123
+
124
+ == Frequently Asked Questions ==
125
+
126
+ = What do I need to connect my Instagram account? =
127
+
128
+ Not much. Once you hit the connect button in Spotlight it will show you two options where Instagram (for Personal accounts) or Facebook (for Business accounts) will ask you to grant access to Spotlight for your Instagram posts. Authorize Spotlight and you’re all done.
129
+
130
+ You can remove Spotlight’s access to your account at any time.
131
+
132
+ - - -
133
+
134
+ = How many Instagram accounts can I connect? =
135
+
136
+ Spotlight sets no limits on the number of Instagram accounts you may connect. So long as you have legitimate access to those accounts, you can connect them directly or by using an access token from Instagram or Facebook.
137
+
138
+ - - -
139
+
140
+ = What is an Instagram Business account? =
141
+
142
+ Business accounts get additional API features that give you more control over your feeds in Spotlight, especially with the premium versions.
143
+
144
+ Plus, they get access to more cool stuff within Instagram itself, such as insights and analytics.
145
+
146
+ [Learn more here](https://docs.spotlightwp.com/article/553-what-is-the-difference-between-instagram-personal-and-business-accounts).
147
+
148
+ - - -
149
+
150
+ = How many different feeds can I set up? =
151
+
152
+ Spotlight sets no limits on the number of feeds you can set up. Design one for your footer, another for the sidebar, and one to fill an entire page - let your imagination run free.
153
+
154
+ - - -
155
+
156
+ = Can I show more than one feed on a single page? =
157
+
158
+ Yes, you can embed as many Instagram feeds as you want on any page or post.
159
+
160
+ - - -
161
+
162
+ = What’s the live preview customiser? =
163
+
164
+ It’s a super convenient live interactive preview of exactly what your feed will look like on your website once you embed it. The colours, the buttons, the padding - what you see is what you get!
165
+
166
+ No need to save your changes and keep going back and forth between pages to see what it looks like. It’s just quicker this way. [Get to know Spotlight live preview](https://docs.spotlightwp.com/article/557-get-to-know-spotlights-live-preview).
167
+
168
+ - - -
169
+
170
+ = When will Spotlight’s premium version be available? =
171
+
172
+ Very soon - we’re just working on the final touches! We’re super excited to share all the amazing features and layouts with you, and we even have a few surprises up our sleeves in the coming months.
173
+
174
+ == Screenshots ==
175
+
176
+ 1. Display your Instagram feeds anywhere on your site.
177
+ 2. Set posts to open in a popup/lightbox.
178
+ 3. Connect your Instagram account in seconds.
179
+ 4. Design your feed in our live preview customiser.
180
+ 5. Customise your feed for any device, it's fully responsive.
181
+ 6. Embed your feed with a shortcode or widget.
182
+ 7. Manage multiple feeds in a simple list.
183
+
184
+ == Changelog ==
185
+
186
+ **0.1 (2020-06-23)**
187
+ - Initial version.
ui/.babelrc ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "plugins": [
3
+ [
4
+ "react-css-modules",
5
+ {
6
+ "generateScopedName": "[name]__[local]___[hash:base64:5]",
7
+ "webpackHotModuleReloading": true
8
+ }
9
+ ]
10
+ ],
11
+ "presets": [
12
+ "@babel/preset-env"
13
+ ]
14
+ }
ui/.browserslistrc ADDED
@@ -0,0 +1,2 @@
 
 
1
+ defaults
2
+ > 1%
ui/dist/admin-app.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.spotlight=t():e.spotlight=t()}(window,(function(){return(window.webpackJsonpspotlight=window.webpackJsonpspotlight||[]).push([[2],{116:function(e,t,n){e.exports={root:"SettingsGroup__root layout__flex-column",title:"SettingsGroup__title",content:"SettingsGroup__content","field-list":"SettingsGroup__field-list layout__flex-column",fieldList:"SettingsGroup__field-list layout__flex-column"}},117:function(e,t,n){e.exports={root:"SpotlightGame__root layout__flex-column","game-text":"SpotlightGame__game-text",gameText:"SpotlightGame__game-text",score:"SpotlightGame__score SpotlightGame__game-text",message:"SpotlightGame__message SpotlightGame__game-text","message-bubble":"SpotlightGame__message-bubble",messageBubble:"SpotlightGame__message-bubble"}},120:function(e,t,n){e.exports={root:"AdvancedSettings__root","field-container":"AdvancedSettings__field-container layout__flex-row",fieldContainer:"AdvancedSettings__field-container layout__flex-row","field-element":"AdvancedSettings__field-element",fieldElement:"AdvancedSettings__field-element","field-label":"AdvancedSettings__field-label AdvancedSettings__field-element",fieldLabel:"AdvancedSettings__field-label AdvancedSettings__field-element","field-control":"AdvancedSettings__field-control AdvancedSettings__field-element layout__flex-column",fieldControl:"AdvancedSettings__field-control AdvancedSettings__field-element layout__flex-column","field-centered":"AdvancedSettings__field-centered",fieldCentered:"AdvancedSettings__field-centered"}},147:function(e,t,n){"use strict";var a=n(0),o=n.n(a),r=n(148),i=n(39),c=n.n(i),s=n(2),l=n(40),u=n(9),d=n(3),m=n(8),f=n(142),p=n(34),g=n(15),b=n(35),_=n(151),h=n(143),y=n(7),v=n(95);function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,o=!1,r=void 0;try{for(var i,c=e[Symbol.iterator]();!(a=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw r}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var S=Object(s.b)((function(e){var t=e.accounts,n=e.showDelete,a=e.onDelete;t=null!=t?t:[];var r=E(o.a.useState(!1),2),i=r[0],s=r[1],w=E(o.a.useState(null),2),S=w[0],A=w[1],N=E(o.a.useState(!1),2),C=N[0],F=N[1],O=E(o.a.useState(),2),I=O[0],k=O[1],L=function(e){return function(){A(e),s(!0)}},j=function(e){return function(){b.a.openAuthWindow(e.type,0,(function(){y.a.restApi.deleteAccountMedia(e.id)}))}},x=function(e){return function(){k(e),F(!0)}},T={cols:{username:c.a.usernameCol,type:c.a.typeCol,usages:c.a.usagesCol,actions:c.a.actionsCol},cells:{username:c.a.usernameCell,type:c.a.typeCell,usages:c.a.usagesCell,actions:c.a.actionsCell}};return o.a.createElement("div",{className:"accounts-list"},o.a.createElement(f.a,{styleMap:T,rows:t,cols:[{id:"username",label:"Username",render:function(e){return o.a.createElement("div",null,o.a.createElement(h.a,{account:e,className:c.a.profilePic}),o.a.createElement("a",{className:c.a.username,onClick:L(e)},e.username))}},{id:"type",label:"Type",render:function(e){return o.a.createElement("span",{className:c.a.accountType},e.type)}},{id:"usages",label:"Feeds",render:function(e){return o.a.createElement("span",{className:c.a.usages},e.usages.map((function(e,t){return!!p.a.getById(e)&&o.a.createElement(l.a,{key:t,to:g.a.at({screen:"edit",id:e.toString()})},p.a.getById(e).name)})))}},{id:"actions",label:"Actions",render:function(e){return n&&o.a.createElement("div",{className:c.a.actionsList},o.a.createElement(d.a,{className:c.a.action,type:d.c.SECONDARY,tooltip:"Account info",onClick:L(e)},o.a.createElement(m.a,{icon:"info"})),o.a.createElement(d.a,{className:c.a.action,type:d.c.SECONDARY,tooltip:"Reconnect account",onClick:j(e)},o.a.createElement(m.a,{icon:"image-rotate"})),o.a.createElement(d.a,{className:c.a.actions,type:d.c.DANGER,tooltip:"Remove account",onClick:x(e)},o.a.createElement(m.a,{icon:"trash"})))}}]}),o.a.createElement(_.a,{isOpen:i,onClose:function(){return s(!1)},account:S}),I&&o.a.createElement(v.a,{isOpen:C,title:"Are you sure?",buttons:["Yes I'm sure","Cancel"],onAccept:function(){a&&a(I)},onCancel:function(){k(null),F(!1)}},o.a.createElement("p",null,"Are you sure you want to delete"," ",o.a.createElement("span",{style:{fontWeight:"bold"}},I.username),"?"," ","This will also delete all saved media associated with this account."),I.type===u.a.Type.BUSINESS&&1===u.b.getBusinessAccounts().length&&o.a.createElement("p",null,o.a.createElement("b",null,"Note:")," Because this is your only connected Business account, deleting it will"," ","also cause any feeds that show public hashtag posts to no longer work.")))})),A=n(19),N=n(135),C=n(190),F=n.n(C);function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}t.a=Object(s.b)((function(){Object(a.useEffect)((function(){u.b.loadAccounts()}),[]);var e,t,n=(e=o.a.useState(""),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,o=!1,r=void 0;try{for(var i,c=e[Symbol.iterator]();!(a=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw r}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],c=n[1];return u.b.hasAccounts()?o.a.createElement("div",{className:F.a.root},i.length>0&&o.a.createElement(A.a,{type:A.b.ERROR,showIcon:!0,isDismissible:!0,onDismiss:function(){return c("")}},i),o.a.createElement("div",{className:F.a.connectBtn},o.a.createElement(r.a,null)),o.a.createElement(S,{accounts:u.b.list,showDelete:!0,onDelete:function(e){b.a.deleteAccount(e.id).catch((function(){return c("An error occurred while trying to remove the account.")}))}})):o.a.createElement(N.a,null)}))},15:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var a=n(1),o=n(100);function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var c,s=function(e,t,n,a){var o,r=arguments.length,c=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(c=(r<3?o(c):r>3?o(t,n,c):o(t,n))||c);return r>3&&c&&Object.defineProperty(t,n,c),c},l=new(c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._path=window.location.pathname,this.parsed=Object(o.parse)(window.location.search),this.unListen=null,this.listeners=[]}var t,n;return t=e,(n=[{key:"createPath",value:function(e){return this._path+"?"+Object(o.stringify)(e)}},{key:"get",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==(t=this.parsed[e])&&void 0!==t?t:n}},{key:"at",value:function(e){return this.createPath(Object.assign({page:this.parsed.page},this.processQuery(e)))}},{key:"with",value:function(e){return this.createPath(Object.assign(Object.assign({},this.parsed),this.processQuery(e)))}},{key:"without",value:function(e){var t=Object.assign({},this.parsed);return delete t[e],this.createPath(t)}},{key:"useHistory",value:function(e){var t=this;return this.unListen&&this.unListen(),this.history=e,this.unListen=this.history.listen((function(e){t.parsed=Object(o.parse)(e.search),t.listeners.forEach((function(e){return e()}))})),this}},{key:"listen",value:function(e){this.listeners.push(e)}},{key:"unlisten",value:function(e){this.listeners=this.listeners.filter((function(t){return t===e}))}},{key:"processQuery",value:function(e){var t=Object.assign({},e);return Object.getOwnPropertyNames(e).forEach((function(n){e[n]&&0===e[n].length?delete t[n]:t[n]=e[n]})),t}},{key:"path",get:function(){return this.createPath(this.parsed)}}])&&r(t.prototype,n),e}(),s([a.o],c.prototype,"parsed",void 0),s([a.h],c.prototype,"path",null),c)},151:function(e,t,n){"use strict";n.d(t,"a",(function(){return S}));var a=n(0),o=n.n(a),r=n(29),i=n(17),c=n.n(i),s=n(2),l=n(9),u=n(519),d=n(518),m=n(48),f=n(141),p=n(111),g=n(35),b=n(3),_=n(19),h=n(7),y=n(143);function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,o=!1,r=void 0;try{for(var i,c=e[Symbol.iterator]();!(a=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw r}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var w=Object(s.b)((function(e){var t=e.account,n=e.onUpdate,a=v(o.a.useState(!1),2),r=a[0],i=a[1],s=v(o.a.useState(""),2),E=s[0],w=s[1],S=v(o.a.useState(!1),2),A=S[0],N=S[1],C=t.type===l.a.Type.PERSONAL,F=l.b.getBioText(t),O=function(){t.customBio=E,N(!0),g.a.updateAccount(t).then((function(){i(!1),N(!1),n&&n()}))},I=function(e){t.customProfilePicUrl=e,N(!0),g.a.updateAccount(t).then((function(){N(!1),n&&n()}))};return o.a.createElement("div",{className:c.a.root},o.a.createElement("div",{className:c.a.container},o.a.createElement("div",{className:c.a.infoColumn},o.a.createElement("a",{href:l.b.getProfileUrl(t),target:"_blank",className:c.a.username},"@",t.username),o.a.createElement("div",{className:c.a.row},o.a.createElement("span",{className:c.a.label},"Spotlight ID:"),t.id),o.a.createElement("div",{className:c.a.row},o.a.createElement("span",{className:c.a.label},"Instagram ID:"),t.userId),o.a.createElement("div",{className:c.a.row},o.a.createElement("span",{className:c.a.label},"Type:"),t.type),!r&&o.a.createElement("div",{className:c.a.row},o.a.createElement("div",null,o.a.createElement("span",{className:c.a.label},"Bio:"),o.a.createElement("a",{className:c.a.editBioLink,onClick:function(){w(l.b.getBioText(t)),i(!0)}},"Edit bio"),o.a.createElement("pre",{className:c.a.bio},F.length>0?F:"(No bio)"))),r&&o.a.createElement("div",{className:c.a.row},o.a.createElement("textarea",{className:c.a.bioEditor,value:E,onChange:function(e){w(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&e.ctrlKey&&(O(),e.preventDefault(),e.stopPropagation())},rows:4}),o.a.createElement("div",{className:c.a.bioFooter},o.a.createElement("div",{className:c.a.bioEditingControls},A&&o.a.createElement("span",null,"Please wait ...")),o.a.createElement("div",{className:c.a.bioEditingControls},o.a.createElement(b.a,{className:c.a.bioEditingButton,type:b.c.DANGER,disabled:A,onClick:function(){t.customBio="",N(!0),g.a.updateAccount(t).then((function(){i(!1),N(!1),n&&n()}))}},"Reset"),o.a.createElement(b.a,{className:c.a.bioEditingButton,type:b.c.SECONDARY,disabled:A,onClick:function(){i(!1)}},"Cancel"),o.a.createElement(b.a,{className:c.a.bioEditingButton,type:b.c.PRIMARY,disabled:A,onClick:O},"Save"))))),o.a.createElement("div",{className:c.a.picColumn},o.a.createElement("div",null,o.a.createElement(y.a,{account:t,className:c.a.profilePic})),o.a.createElement(f.a,{id:"account-custom-profile-pic",title:"Select profile picture",mediaType:"image",onSelect:function(e){var t=parseInt(e.attributes.id),n=p.a.media.attachment(t).attributes.url;I(n)}},(function(e){var t=e.open;return o.a.createElement(b.a,{type:b.c.SECONDARY,className:c.a.setCustomPic,onClick:t},"Change profile picture")})),t.customProfilePicUrl.length>0&&o.a.createElement("a",{className:c.a.resetCustomPic,onClick:function(){I("")}},"Reset profile picture"))),C&&o.a.createElement("div",{className:c.a.personalInfoMessage},o.a.createElement(_.a,{type:_.b.INFO,showIcon:!0},"Due to restrictions set by Instagram, Spotlight cannot import the profile photo and bio"," ","text for Personal accounts."," ",o.a.createElement("a",{href:h.a.resources.customPersonalInfoUrl,target:"_blank"},"Click here to learn more"),".")),o.a.createElement(m.a,{label:"View access token",stealth:!0},o.a.createElement("div",{className:c.a.row},t.accessToken&&o.a.createElement("div",null,o.a.createElement("p",null,o.a.createElement("span",{className:c.a.label},"Expires on:"),o.a.createElement("span",null,Object(u.a)(Object(d.a)(t.accessToken.expiry),"PPPP"))),o.a.createElement("pre",{className:c.a.accessToken},t.accessToken.code)))))}));function S(e){var t=e.isOpen,n=e.onClose,a=e.onUpdate,i=e.account;return o.a.createElement(r.a,{isOpen:t,title:"Account details",icon:"admin-users",onClose:n},o.a.createElement(r.a.Content,null,o.a.createElement(w,{account:i,onUpdate:a})))}},154:function(e,t,n){e.exports={root:"FeedsOnboarding__root","contact-us":"FeedsOnboarding__contact-us",contactUs:"FeedsOnboarding__contact-us","call-to-action":"FeedsOnboarding__call-to-action",callToAction:"FeedsOnboarding__call-to-action"}},155:function(e,t,n){e.exports={root:"SettingsPage__root layout__flex-column",content:"SettingsPage__content","group-list":"SettingsPage__group-list layout__flex-column",groupList:"SettingsPage__group-list layout__flex-column"}},156:function(e,t,n){e.exports={buttons:"SettingsNavbar__buttons layout__flex-row","cancel-btn":"SettingsNavbar__cancel-btn",cancelBtn:"SettingsNavbar__cancel-btn","save-btn":"SettingsNavbar__save-btn",saveBtn:"SettingsNavbar__save-btn"}},17:function(e,t,n){e.exports={root:"AccountInfo__root",container:"AccountInfo__container",column:"AccountInfo__column","info-column":"AccountInfo__info-column AccountInfo__column",infoColumn:"AccountInfo__info-column AccountInfo__column","pic-column":"AccountInfo__pic-column AccountInfo__column",picColumn:"AccountInfo__pic-column AccountInfo__column",id:"AccountInfo__id",username:"AccountInfo__username","profile-pic":"AccountInfo__profile-pic",profilePic:"AccountInfo__profile-pic",label:"AccountInfo__label",row:"AccountInfo__row",pre:"AccountInfo__pre",bio:"AccountInfo__bio AccountInfo__pre","link-button":"AccountInfo__link-button",linkButton:"AccountInfo__link-button","edit-bio-link":"AccountInfo__edit-bio-link AccountInfo__link-button",editBioLink:"AccountInfo__edit-bio-link AccountInfo__link-button","bio-editor":"AccountInfo__bio-editor",bioEditor:"AccountInfo__bio-editor","bio-footer":"AccountInfo__bio-footer",bioFooter:"AccountInfo__bio-footer","bio-editing-controls":"AccountInfo__bio-editing-controls",bioEditingControls:"AccountInfo__bio-editing-controls","access-token":"AccountInfo__access-token AccountInfo__pre",accessToken:"AccountInfo__access-token AccountInfo__pre","set-custom-pic":"AccountInfo__set-custom-pic",setCustomPic:"AccountInfo__set-custom-pic","reset-custom-pic":"AccountInfo__reset-custom-pic AccountInfo__link-button",resetCustomPic:"AccountInfo__reset-custom-pic AccountInfo__link-button",subtext:"AccountInfo__subtext","personal-info-message":"AccountInfo__personal-info-message",personalInfoMessage:"AccountInfo__personal-info-message"}},178:function(e,t,n){"use strict";t.a="/wp-content/plugins/spotlight-social-photo-feeds/ui/dist/assets/grid.png"},190:function(e,t,n){e.exports={root:"AccountsPage__root","connect-btn":"AccountsPage__connect-btn",connectBtn:"AccountsPage__connect-btn"}},191:function(e,t,n){e.exports={root:"FeedsScreen__root","create-new-btn":"FeedsScreen__create-new-btn",createNewBtn:"FeedsScreen__create-new-btn"}},194:function(e,t,n){e.exports={"buttons-container":"AdminEditorNavbar__buttons-container Navbar__button-container layout__flex-row",buttonsContainer:"AdminEditorNavbar__buttons-container Navbar__button-container layout__flex-row","cancel-button":"AdminEditorNavbar__cancel-button",cancelButton:"AdminEditorNavbar__cancel-button"}},195:function(e,t,n){e.exports={message:"FeedNamePrompt__message",input:"FeedNamePrompt__input"}},264:function(e,t,n){e.exports={pill:"ProPill__pill"}},272:function(e,t,n){e.exports={root:"SettingsScreen__root"}},273:function(e,t,n){e.exports={root:"ProUpgradeBtn__root"}},293:function(e,t,n){},31:function(e,t,n){e.exports={root:"FeedsList__root","name-col":"FeedsList__name-col",nameCol:"FeedsList__name-col","sources-col":"FeedsList__sources-col",sourcesCol:"FeedsList__sources-col","usages-col":"FeedsList__usages-col",usagesCol:"FeedsList__usages-col","actions-col":"FeedsList__actions-col",actionsCol:"FeedsList__actions-col","name-cell":"FeedsList__name-cell",nameCell:"FeedsList__name-cell","sources-cell":"FeedsList__sources-cell",sourcesCell:"FeedsList__sources-cell","usages-cell":"FeedsList__usages-cell",usagesCell:"FeedsList__usages-cell","actions-cell":"FeedsList__actions-cell",actionsCell:"FeedsList__actions-cell",name:"FeedsList__name layout__text-overflow-ellipsis","meta-list":"FeedsList__meta-list",metaList:"FeedsList__meta-list","meta-info":"FeedsList__meta-info",metaInfo:"FeedsList__meta-info",id:"FeedsList__id FeedsList__meta-info",layout:"FeedsList__layout FeedsList__meta-info","sources-list":"FeedsList__sources-list layout__flex-row",sourcesList:"FeedsList__sources-list layout__flex-row",source:"FeedsList__source layout__text-overflow-ellipsis","no-sources-msg":"FeedsList__no-sources-msg",noSourcesMsg:"FeedsList__no-sources-msg","usages-list":"FeedsList__usages-list layout__flex-column",usagesList:"FeedsList__usages-list layout__flex-column",usage:"FeedsList__usage layout__flex-row layout__text-overflow-ellipsis","usage-link":"FeedsList__usage-link layout__text-overflow-ellipsis",usageLink:"FeedsList__usage-link layout__text-overflow-ellipsis","usage-type":"FeedsList__usage-type",usageType:"FeedsList__usage-type","actions-list":"FeedsList__actions-list",actionsList:"FeedsList__actions-list"}},39:function(e,t,n){e.exports={root:"AccountsList__root","username-col":"AccountsList__username-col",usernameCol:"AccountsList__username-col","type-col":"AccountsList__type-col",typeCol:"AccountsList__type-col","usages-col":"AccountsList__usages-col",usagesCol:"AccountsList__usages-col","actions-col":"AccountsList__actions-col",actionsCol:"AccountsList__actions-col","username-cell":"AccountsList__username-cell",usernameCell:"AccountsList__username-cell","type-cell":"AccountsList__type-cell",typeCell:"AccountsList__type-cell","usages-cell":"AccountsList__usages-cell",usagesCell:"AccountsList__usages-cell","actions-cell":"AccountsList__actions-cell",actionsCell:"AccountsList__actions-cell",username:"AccountsList__username","profile-pic":"AccountsList__profile-pic",profilePic:"AccountsList__profile-pic","account-type":"AccountsList__account-type",accountType:"AccountsList__account-type",usages:"AccountsList__usages","actions-list":"AccountsList__actions-list layout__flex-row",actionsList:"AccountsList__actions-list layout__flex-row",action:"AccountsList__action"}},42:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return i}));var a,o=n(15);function r(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}!function(e){e.NEW_FEED="new",e.EDIT_FEED="edit",e.FEED_LIST="feeds",e.SETTINGS="settings"}(a||(a={}));var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.screens=t,this.screens.sort((function(e,t){var n,a,o=null!==(n=e.position)&&void 0!==n?n:0,r=null!==(a=t.position)&&void 0!==a?a:0;return Math.sign(o-r)}))}var t,n;return t=e,(n=[{key:"current",get:function(){var e,t=null!==(e=o.a.get("screen"))&&void 0!==e?e:"";return this.screens.find((function(e,n){return t===e.id||!t&&0===n}))}}])&&r(t.prototype,n),e}()},514:function(e,t,n){"use strict";n.r(t);var a=n(47),o=(n(293),n(255)),r=n(30),i=n(0),c=n.n(i),s=n(23),l=n(15),u=n(2),d=n(41),m=n.n(d),f=n(4),p=Object(u.b)((function(e){var t=e.store,n=e.screensStore,a=c.a.createElement(c.a.Fragment,null,c.a.createElement("li",{className:"wp-submenu-head","aria-hidden":"true"},"Instagram"),c.a.createElement(s.b,{render:function(){return n.screens.map((function(e,t){return(!e.isHidden||!e.isHidden())&&c.a.createElement(g,{key:t,screen:e,isRoot:0===t})}))}})),o=document.getElementById("toplevel_page_spotlight-instagram");if(o){var r=o.querySelector("ul.wp-submenu");return r?r.innerHTML="":((r=document.createElement("ul")).className="wp-submenu wp-submenu-wrap sli-onboarding",o.appendChild(r)),o.classList.toggle("wp-has-submenu",!t.isDoingOnboarding),o.classList.toggle("wp-has-current-submenu",!t.isDoingOnboarding),o.classList.toggle("wp-menu-open",!t.isDoingOnboarding),r.classList.toggle("sli-onboarding",t.isDoingOnboarding),t.isDoingOnboarding?null:m.a.createPortal(a,r)}})),g=Object(u.b)((function(e){var t,n=e.screen,a=e.isRoot,o=null!==(t=l.a.get("screen"))&&void 0!==t?t:"",r=o===n.id||!o&&a,i=n.state||{},s=l.a.at(Object.assign({screen:n.id},i)),u=Object(f.c)({"wp-first-item current":r,disabled:n.isDisabled&&n.isDisabled()});return c.a.createElement("li",{className:u,"aria-current":!!r&&"page"},c.a.createElement("a",{onClick:function(){return l.a.history.push(s,{})}},n.title))})),b=n(257),_="/wp-content/plugins/spotlight-social-photo-feeds/ui/dist/assets/spotlight-800w.png",h=function(){return c.a.createElement("div",{className:"admin-loading"},c.a.createElement("div",{className:"admin-loading__perspective"},c.a.createElement("div",{className:"admin-loading__container"},c.a.createElement("img",{src:_,className:"admin-loading__logo",alt:"Spotlight"}))))},y=n(5),v=n(7),E=n(269),w=Object(u.b)((function(e){var t=e.store,n=e.screensStore,a=e.toaster,o=e.titleTemplate;t.load();var r=function(e){var n,a=null!==(n=e.detail.response.data.message)&&void 0!==n?n:null;t.toaster.addToast("feed/fetch_fail",(function(){return c.a.createElement("div",null,c.a.createElement("p",null,"An error occurred while retrieving the media for this feed. Instagram's API responded with:"),a&&c.a.createElement("code",null,a),c.a.createElement("p",null,"If this error persists, kindly"," ",c.a.createElement("a",{href:v.a.resources.supportUrl,target:"_blank"},"contact customer support"),"."))}),0)};return Object(i.useEffect)((function(){return document.addEventListener(y.a.Events.FETCH_FAIL,r),function(){return document.removeEventListener(y.a.Events.FETCH_FAIL,r)}}),[]),t.isLoaded?c.a.createElement(s.c,{history:l.a.history},n.screens.map((function(e,t){return c.a.createElement(b.a,{key:e.id,when:"screen",is:e.id,isRoot:0===t,render:function(){var t=function(){return c.a.createElement(e.component)};return t.displayName=e.title,document.title=o.replace("%s",e.title),c.a.createElement(t)}})})),c.a.createElement(a),c.a.createElement(E.a,null),c.a.createElement(p,{store:t,screensStore:n})):c.a.createElement(h,null)})),S=n(42),A=n(191),N=n.n(A),C=n(40),F=function(e){var t=e.navbar,n=e.className,a=e.fillPage,o=e.children,r=Object(f.a)("admin-screen",{"--fillPage":a})+(n?" "+n:"");return c.a.createElement("div",{className:r},t&&c.a.createElement("div",{className:"admin-screen__navbar"},c.a.createElement(t)),c.a.createElement("div",{className:"admin-screen__content"},o))},O=n(37),I=n(9),k=n(154),L=n.n(k);function j(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var x=l.a.at({screen:S.a.NEW_FEED}),T=function(){var e,t,n=(e=c.a.useState(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,o=!1,r=void 0;try{for(var i,c=e[Symbol.iterator]();!(a=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw r}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=n[0],o=n[1];return c.a.createElement(O.a,{className:L.a.root,isTransitioning:a},c.a.createElement("div",null,c.a.createElement("h1",null,"Start engaging with your audience"),c.a.createElement(O.a.Thin,null,c.a.createElement("p",null,"Connect with more people by embedding one or more Instagram feeds on this website."),c.a.createElement("p",null,"It only takes 3 steps! Let’s get going!"),c.a.createElement(O.a.StepList,null,c.a.createElement(O.a.Step,{num:1,isDone:I.b.list.length>0},c.a.createElement("span",null,"Connect your Instagram Account")),c.a.createElement(O.a.Step,{num:2},c.a.createElement("span",null,"Design your feed")),c.a.createElement(O.a.Step,{num:3},c.a.createElement("span",null,"Embed it on your site")))),c.a.createElement(O.a.ProTip,null,c.a.createElement("span",null,"Come back to this page later to create more feeds.",c.a.createElement("br",null),"You can create as many feeds as you want and use them anywhere on your site."))),c.a.createElement("div",{className:L.a.callToAction},c.a.createElement(O.a.HeroButton,{onClick:function(){o(!0),setTimeout((function(){return l.a.history.push(x,{})}),O.a.TRANSITION_DURATION)}},I.b.list.length>0?"Design your feed":"Connect your Instagram Account"),c.a.createElement(O.a.HelpMsg,{className:L.a.contactUs},"If you need help at any time,"," ",c.a.createElement("a",{href:v.a.resources.supportUrl,target:"_blank",style:{whiteSpace:"nowrap"}},"contact me here"),".",c.a.createElement("br",null),"- Mark Zahra, Spotlight")))},P=n(31),D=n.n(P),R=n(8),B=n(3),M=n(144),U=n(142),G=n(71),Y=n(34),W=function(e){var t=e.toaster,n={cols:{name:D.a.nameCol,sources:D.a.sourcesCol,usages:D.a.usagesCol,actions:D.a.actionsCol},cells:{name:D.a.nameCell,sources:D.a.sourcesCell,usages:D.a.usagesCell,actions:D.a.actionsCell}};return c.a.createElement("div",{className:"feeds-list"},c.a.createElement(U.a,{styleMap:n,cols:[{id:"name",label:"Name",render:function(e){var t=Y.a.getEditUrl(e);return c.a.createElement("div",null,c.a.createElement(C.a,{to:t,className:D.a.name},e.name?e.name:"(no name)"),c.a.createElement("div",{className:D.a.metaList},c.a.createElement("span",{className:D.a.id},"ID: ",e.id),c.a.createElement("span",{className:D.a.layout},G.a.getName(e.options.layout))))}},{id:"sources",label:"Shows posts from",render:function(e){return c.a.createElement(z,{feed:e})}},{id:"usages",label:"Instances",render:function(e){return c.a.createElement(H,{feed:e})}},{id:"actions",label:"Actions",render:function(e){return c.a.createElement("div",{className:D.a.actionsList},c.a.createElement(M.a,{feed:e,toaster:t},c.a.createElement(B.a,{type:B.c.SECONDARY,tooltip:"Copy shortcode"},c.a.createElement(R.a,{icon:"editor-code"}))),c.a.createElement(B.a,{type:B.c.DANGER,tooltip:"Delete feed",onClick:function(){return function(e){confirm("Are you sure you want to delete this feed? This cannot be undone.")&&Y.a.deleteFeed(e)}(e)}},c.a.createElement(R.a,{icon:"trash"})))}}],rows:Y.a.list}))},z=function(e){var t=e.feed,n=[],a=y.a.Options.getSources(t.options);return a.accounts.forEach((function(e){var t=K(e);t&&n.push(t)})),a.tagged.forEach((function(e){var t=K(e,!0);t&&n.push(t)})),a.hashtags.forEach((function(e){return n.push(c.a.createElement("div",null,"#",e.tag))})),0===n.length&&n.push(c.a.createElement("div",{className:D.a.noSourcesMsg},c.a.createElement(R.a,{icon:"warning"}),c.a.createElement("span",null,"Feed has no sources"))),c.a.createElement("div",{className:D.a.sourcesList},n.map((function(e,t){return e&&c.a.createElement(J,{key:t},e)})))},H=function(e){var t=e.feed;return c.a.createElement("div",{className:D.a.usagesList},t.usages.map((function(e,t){return c.a.createElement("div",{key:t,className:D.a.usage},c.a.createElement("a",{className:D.a.usageLink,href:e.link,target:"_blank"},e.name),c.a.createElement("span",{className:D.a.usageType},"(",e.type,")"))})))};function K(e,t){return e?c.a.createElement($,{account:e,isTagged:t}):null}var $=function(e){var t=e.account,n=e.isTagged?"tag":t.type===I.a.Type.BUSINESS?"businessman":"admin-users";return c.a.createElement("div",null,c.a.createElement(R.a,{icon:n}),t.username)},J=function(e){var t=e.children;return c.a.createElement("div",{className:D.a.source},t)},Q=Object(u.b)((function(e){var t=e.navbar,n=e.toaster;return c.a.createElement(F,{navbar:t},c.a.createElement("div",{className:N.a.root},Y.a.hasFeeds()?c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{className:N.a.createNewBtn},c.a.createElement(C.a,{to:l.a.at({screen:S.a.NEW_FEED}),className:"button button-primary button-large"},"Create a new feed")),c.a.createElement(W,{toaster:n})):c.a.createElement(T,null)))})),q=n(271),V=n(287),Z=n(272),X=n.n(Z),ee=n(98),te=n(20),ne=n(18),ae=n(100),oe="You have unsaved changes. If you leave now, your changes will be lost.",re=Object(u.b)((function(e){var t=e.navbar,n=l.a.get("tab"),a=n?v.a.settings.pages.find((function(e){return n===e.id})):v.a.settings.pages[0];return Object(ne.g)(oe,(function(){return te.b.isDirty})),Object(i.useEffect)((function(){return function(){te.b.isDirty&&l.a.get("screen")!==S.a.SETTINGS&&te.b.restore()}}),[]),c.a.createElement(c.a.Fragment,null,c.a.createElement(F,{navbar:t,className:X.a.root},a&&c.a.createElement(ee.a,{page:a})),c.a.createElement(s.a,{when:te.b.isDirty,message:ie}))}));function ie(e){return Object(ae.parse)(e.search).screen===S.a.SETTINGS||oe}var ce=n(49),se=n(273),le=n.n(se),ue=function(e){var t=e.children;return c.a.createElement("a",{className:le.a.root,href:v.a.resources.upgradeUrl,target:"_blank"},null!=t?t:"Upgrade to PRO")},de=Object(u.b)((function(e){var t=e.store,n=e.right,a=e.showUpgrade,o=e.chevron,r=e.children;a=null!=a?a:null==n;var i=c.a.createElement(ce.a.Item,null,t.current.title);return c.a.createElement(ce.a,null,c.a.createElement(c.a.Fragment,null,i,o&&c.a.createElement(ce.a.Chevron,null),r),n?c.a.createElement(n):a&&c.a.createElement(ue,null,"Spotlight PRO coming soon"))})),me=n(274),fe=n(1),pe=n(96);function ge(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var _e,he=function(e,t,n,a){var o,r=arguments.length,i=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"===("undefined"==typeof Reflect?"undefined":be(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,a);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(r<3?o(i):r>3?o(t,n,i):o(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i},ye=Y.a.SavedFeed,ve=(_e=function(){function e(t,n,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isLoaded=!1,this.isGoingFromNewToEdit=!1,this.isPromptingFeedName=!1,this.feed=new ye,this.loader=t,this.toaster=n,this.editorConfig=a,this.isDoingOnboarding=v.a.config.doOnboarding}var t,n;return t=e,(n=[{key:"edit",value:function(e){this.isGoingFromNewToEdit||(this.editorConfig.currTab=0),this.isGoingFromNewToEdit=!1,this.feed=null,this.feed=new ye(e),this.isEditorDirty=!1}},{key:"saveEditor",value:function(e){var t=this;if(this.isEditorDirty){var n=null===this.feed.id;if(0!==this.feed.name.length||e)return this.isSavingFeed=!0,this.isDoingOnboarding=!1,Y.a.saveFeed(this.feed).then((function(e){t.feed=new ye(e),t.isSavingFeed=!1,t.isEditorDirty=!1,t.toaster.addToast("feed/saved",Object(r.a)(pe.a,{message:"Feed saved."})),n&&(t.isGoingFromNewToEdit=!0,l.a.history.push(l.a.at({screen:S.a.EDIT_FEED,id:t.feed.id.toString()}),{}))}));this.isPromptingFeedName=!0}}},{key:"cancelEditor",value:function(){this.isGoingFromNewToEdit||(this.feed=new ye,this.isEditorDirty=!1,this.isGoingFromNewToEdit=!1)}},{key:"closeEditor",value:function(){this.cancelEditor(),l.a.history.push(l.a.at({screen:S.a.FEED_LIST}),{})}},{key:"onEditorChange",value:function(e){e&&(this.feed.options=e),this.isEditorDirty=!0}},{key:"load",value:function(){var e=this;this.isLoaded||this.loader.load(null,(function(){e.isLoaded=!0}))}}])&&ge(t.prototype,n),e}(),he([fe.o],_e.prototype,"isLoaded",void 0),he([fe.o],_e.prototype,"feed",void 0),he([fe.o],_e.prototype,"isSavingFeed",void 0),he([fe.o],_e.prototype,"isEditorDirty",void 0),he([fe.o],_e.prototype,"editorConfig",void 0),he([fe.o],_e.prototype,"isDoingOnboarding",void 0),he([fe.o],_e.prototype,"isPromptingFeedName",void 0),he([fe.f],_e.prototype,"edit",null),he([fe.f],_e.prototype,"saveEditor",null),he([fe.f],_e.prototype,"cancelEditor",null),he([fe.f],_e.prototype,"closeEditor",null),he([fe.f],_e.prototype,"onEditorChange",null),he([fe.f],_e.prototype,"load",null),_e),Ee=n(156),we=n.n(Ee),Se=n(97),Ae=Object(u.b)((function(e){var t=e.store,n=l.a.get("tab");return c.a.createElement(de,{store:t,chevron:!0,showUpgrade:!1,right:Ne},v.a.settings.pages.map((function(e,t){return c.a.createElement(ce.a.Link,{key:e.id,linkTo:l.a.with({tab:e.id}),isCurrent:n===e.id||!n&&0===t},e.title)})))})),Ne=Object(u.b)((function(e){!function(e){if(null==e)throw new TypeError("Cannot destructure undefined")}(e);var t=!te.b.isDirty;return c.a.createElement("div",{className:we.a.buttons},c.a.createElement(B.a,{className:we.a.cancelBtn,type:B.c.DANGER_PILL,size:B.b.LARGE,onClick:function(){return te.b.restore()},disabled:t},"Cancel"),c.a.createElement(Se.a,{className:we.a.saveBtn,onClick:function(){return te.b.save()},isSaving:te.b.isSaving,tooltip:"Save the settings (Ctrl+S)",disabled:t}))})),Ce=n(117),Fe=n.n(Ce),Oe=n(14),Ie=n(29);function ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,o=!1,r=void 0;try{for(var i,c=e[Symbol.iterator]();!(a=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw r}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Le(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function je(e){!function(e){if(null==e)throw new TypeError("Cannot destructure undefined")}(e);var t=c.a.useRef(),n=c.a.useRef([]),a=ke(c.a.useState(0),2),o=a[0],r=a[1],s=ke(c.a.useState(!1),2),l=s[0],u=s[1],d=ke(c.a.useState(),2)[1],m=function(){var e,a,o,r,i,c,s=(r=707*(o=(a=.4*(e=t.current.getBoundingClientRect()).width)/724),i=22*o,c=35*o,{bounds:e,origin:{x:(e.width-a)/2+r-c/2,y:.5*e.height+i-c/2},scale:o,particleSize:c});n.current=n.current.map((function(e){var t=e.didSike?1:Math.max(1,1.3-1.3*Math.min(1,e.life/100));return Object.assign(Object.assign({},e),{pos:{x:e.pos.x+e.vel.x*t,y:e.pos.y+e.vel.y*t},life:e.life+1})})).filter((function(e){return e.life<500&&e.pos.x>=0&&e.pos.y>=0&&e.pos.x+e.size<=s.bounds.width&&e.pos.y+e.size<=s.bounds.height})),n.current.length<30&&10*Math.random()>7&&n.current.push(function(e){var t=Math.max(1,4*Math.random()),n=2*Math.random()*Math.PI,a={x:Math.sin(n)*t,y:Math.cos(n)*t};return{pos:Object.assign({},e.origin),vel:a,size:e.particleSize,life:1}}(s)),d(Oe.f)};Object(i.useEffect)((function(){var e=setInterval(m,25);return function(){return clearInterval(e)}}),[]);var f=function(e){var t=null;return xe.forEach((function(n){var a=ke(n,2),o=a[0],r=a[1];e>=o&&(t=r)})),t}(o);return c.a.createElement("div",{className:Fe.a.root},c.a.createElement("h1",{style:{textAlign:"center"}},"Coming soon!"),c.a.createElement("p",null,"We're working on giving you more control over your feeds. Stay tuned!"),c.a.createElement("p",null,"Until then, here's a quick game ..."," ","Click on as many Spotlight dots as you can. We challenge you to ",c.a.createElement("strong",null,"hit ",100),"!"),c.a.createElement("br",null),c.a.createElement("div",{ref:t,style:Te.container},o>0&&c.a.createElement("div",{className:Fe.a.score},c.a.createElement("strong",null,"Score"),": ",c.a.createElement("span",null,o)),f&&c.a.createElement("div",{className:Fe.a.message},c.a.createElement("span",{className:Fe.a.messageBubble},f)),n.current.map((function(e,t){return c.a.createElement("div",{key:t,onMouseDown:function(){return function(e){var t=n.current[e].didSike?3:1;n.current.splice(e,1),r(o+t)}(t)},onMouseEnter:function(){return function(e){var t=n.current[e];if(!t.didSike){var a=1e3*Math.random();a>100&&a<150&&(t.vel={x:5*Math.sign(-t.vel.x),y:5*Math.sign(-t.vel.y)},t.life=100,t.didSike=!0)}}(t)},style:Object.assign(Object.assign({},Te.particle),{top:e.pos.y,left:e.pos.x,width:e.size,height:e.size,backgroundColor:e.didSike?"#ff0000":"#"+(16758843+e.life/3).toString(16)})},e.didSike&&c.a.createElement("span",{style:Te.sike},"x3"))}))),c.a.createElement(Ie.a,{title:"Get 20% off Spotlight PRO at launch",isOpen:o>=100&&!l,onClose:function(){return u(!0)},allowShadeClose:!1},c.a.createElement(Ie.a.Content,null,c.a.createElement("div",{style:{textAlign:"center"}},c.a.createElement("p",{style:{display:"inline-block",width:"70%",marginTop:10}},c.a.createElement("strong",{style:{opacity:.7}},"You were just clicking the dot in the logo, weren't you?",c.a.createElement("br",null),"It doesn't matter. You made it a 100!")),c.a.createElement("h1",null,"Get 20% off Spotlight PRO at launch"),c.a.createElement("p",{style:{display:"inline-block",width:"60%"}},"Open up to new opportunities with hashtag feeds, filtering options, visual moderation,"," ","tagged feeds, new layouts and much more."),c.a.createElement("div",{style:{margin:"10px 0"}},c.a.createElement("a",{href:v.a.resources.proComingSoonUrl,target:"_blank",style:{width:"100%"}},c.a.createElement(B.a,{type:B.c.PRIMARY,size:B.b.HERO,style:{width:"80%"}},"Sign up to get 20% off")))))))}var xe=[[10,c.a.createElement("span",null,"You're getting the hang of this!")],[50,c.a.createElement("span",null,"Not bad. You're half way to a 100!")],[120,c.a.createElement("span",null,"Just post a 5-star review already. You're clearly in love with us!")],[150,c.a.createElement("span",null,"Hey, we'd be curious if there were more messages too. But sadly, this is the last one. Good-bye!")],[500,c.a.createElement("span",null,"Error: User has become obsessed with clicking games.")],[1e3,c.a.createElement("span",null,"While the term Easter egg has been used to mean a hidden object for some time, in reference to an Easter egg hunt, it has come to be more commonly used to mean a message, image, or feature hidden in a video game, film, or other, usually electronic, medium. The term used in this manner was coined around 1979 by Steve Wright, the then Director of Software Development in the Atari Consumer Division, to describe a hidden message in the Atari video game Adventure. [Wikipedia]")]],Te={container:{flex:1,position:"relative",backgroundColor:"#fff",backgroundImage:"url('".concat(_,"')"),backgroundPosition:"center 50%",backgroundSize:"40%",backgroundRepeat:"no-repeat",borderRadius:8,marginTop:15,userSelect:"none"},particle:{position:"absolute",backgroundColor:"#ffb83b",borderRadius:999,cursor:"pointer",color:"#000",userSelect:"none"},sike:{position:"relative",left:"calc(100% + 5px)",fontSize:"16px",userSelect:"none"}},Pe=n(147),De=n(285),Re=n(120),Be=n.n(Re),Me=Object(u.b)((function(e){return function(e){if(null==e)throw new TypeError("Cannot destructure undefined")}(e),c.a.createElement("div",{className:Be.a.root})})),Ue=(Object(u.b)((function(e){var t=e.className,n=e.label,a=e.children,o="settings-field-"+Object(Oe.f)();return c.a.createElement("div",{className:Object(f.b)(Be.a.fieldContainer,t)},c.a.createElement("div",{className:Be.a.fieldLabel},c.a.createElement("label",{htmlFor:o},n)),c.a.createElement("div",{className:Be.a.fieldControl},a(o)))})),n(93)),Ge=n(91),Ye=n.n(Ge),We=n(87);function ze(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,o=!1,r=void 0;try{for(var i,c=e[Symbol.iterator]();!(a=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw r}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return He(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?He(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function He(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function Ke(e){var t=e.store,n=ze(c.a.useState(""),2),a=n[0],o=n[1],r=ze(c.a.useState(!1),2),i=r[0],s=r[1],l=t.feed.name.length?t.feed.name:t.feed.id?"(no name)":"New Feed",u=function(){o(t.feed.name),s(!0)},d=function(){t.feed.name=a,s(!1),t.onEditorChange()},m=function(e){switch(e.key){case"Enter":case" ":u()}};return c.a.createElement("div",{className:Ye.a.root},c.a.createElement(We.a,{isOpen:i,onBlur:function(){return s(!1)},placement:"bottom"},(function(e){var t=e.ref;return c.a.createElement("div",{ref:t,className:Ye.a.staticContainer,onClick:u,onKeyPress:m,tabIndex:0,role:"button"},c.a.createElement("span",{className:Ye.a.label},l),c.a.createElement(R.a,{icon:"edit",className:Ye.a.editIcon}))}),c.a.createElement(We.b,null,c.a.createElement(We.d,null,c.a.createElement("div",{className:Ye.a.editContainer},c.a.createElement("input",{type:"text",value:a,onChange:function(e){o(e.target.value)},onKeyDown:function(e){switch(e.key){case"Enter":d();break;case"Escape":s(!1);break;default:return}e.preventDefault(),e.stopPropagation()},autoFocus:!0,placeholder:"Feed name"}),c.a.createElement(B.a,{className:Ye.a.doneBtn,type:B.c.PRIMARY,size:B.b.NORMAL,onClick:d},c.a.createElement(R.a,{icon:"yes"})))))))}function $e(e){var t=e.store;return c.a.createElement(c.a.Fragment,null,c.a.createElement(ce.a.Item,null,c.a.createElement(Ke,{store:t})),c.a.createElement(ce.a.Chevron,null))}var Je=n(194),Qe=n.n(Je),qe=Object(u.b)((function(e){var t=e.store,n=!t.isEditorDirty,a=t.isSavingFeed;return c.a.createElement("div",{className:Qe.a.buttonsContainer},c.a.createElement(B.a,{className:Qe.a.cancelButton,type:B.c.DANGER_LINK,onClick:function(){return t.closeEditor()},disabled:n},"Cancel"),c.a.createElement(Se.a,{disabled:n,onClick:function(){return t.saveEditor()},isSaving:a,tooltip:"Save the feed (Ctrl+S)"}))})),Ve=n(48),Ze=n(19),Xe=Object(u.b)((function(e){var t=e.store,n='[instagram feed="'.concat(t.feed.id,'"]'),a="".concat(v.a.config.adminUrl,"/widgets.php"),o="".concat(v.a.config.adminUrl,"/customize.php?autofocus%5Bpanel%5D=widgets");return t.feed.id?c.a.createElement("div",{className:"editor-embed"},t.feed.usages.length>0&&c.a.createElement(Ve.a,{label:"Instances",isOpen:!0,showIcon:!1},c.a.createElement("div",{className:"editor-embed__instances"},c.a.createElement("p",null,"This feed is currently being shown in these pages:"),c.a.createElement("ul",{className:"editor-embed__instance-list"},t.feed.usages.map((function(e,t){return c.a.createElement("li",{key:t,className:"editor-embed_instance"},c.a.createElement("a",{href:"".concat(v.a.config.adminUrl,"/post.php?action=edit&post=").concat(e.id),target:"_blank"},e.name),c.a.createElement("span",null,"(",e.type,")"))}))))),c.a.createElement(Ve.a,{label:"Shortcode",isOpen:!0,showIcon:!1},c.a.createElement("div",null,c.a.createElement("p",null,"Copy the shortcode below and paste it in any page or post to embed this feed:"),c.a.createElement("div",{className:"editor-embed__shortcode"},c.a.createElement("code",null,n),c.a.createElement(M.a,{feed:t.feed,toaster:t.toaster},c.a.createElement(B.a,{type:B.c.SECONDARY},"Copy"))))),c.a.createElement(Ve.a,{label:"Widget",isOpen:!0,showIcon:!1},c.a.createElement("div",null,c.a.createElement("p",null,"To embed this feed in a widget, go to the"," ",c.a.createElement("a",{href:a,target:"_blank"},"Appearance » Widgets")," page or the"," ",c.a.createElement("a",{href:o,target:"_blank"},"Widgets section of the Customizer"),", add"," ","a ",c.a.createElement("strong",null,"Spotlight Instagram Feed")," widget and choose"," ",c.a.createElement("strong",null,t.feed.name)," as the feed to be shown."),c.a.createElement("div",{className:"editor-embed__widget"},c.a.createElement("p",null,"Example:"),c.a.createElement("img",{src:"/wp-content/plugins/spotlight-social-photo-feeds/ui/dist/assets/widget.png",alt:"Example screenshot of a widget"}))))):c.a.createElement("div",{className:"editor-embed"},c.a.createElement(Ze.a,{type:Ze.b.INFO,showIcon:!0},"You're almost there... Click the ",c.a.createElement("strong",null,"Save")," button at the top-right to be able to"," ","embed this feed on your site!"))})),et=n(286),tt=n(284),nt=n(195),at=n.n(nt),ot=n(95);function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var it=Object(u.b)((function(e){var t,n,a=e.store,o=(t=c.a.useState(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],a=!0,o=!1,r=void 0;try{for(var i,c=e[Symbol.iterator]();!(a=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==c.return||c.return()}finally{if(o)throw r}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return rt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=o[0],i=o[1],s=function(){a.isPromptingFeedName=!1,i("")},l=function(){a.feed.name=r,s(),a.saveEditor(!0)};return c.a.createElement(ot.a,{title:"Feed name",isOpen:a.isPromptingFeedName,onCancel:s,onAccept:l,buttons:["Save","Cancel"]},c.a.createElement("p",{className:at.a.message},"Give this feed a memorable name:"),c.a.createElement("input",{type:"text",className:at.a.input,value:r,onChange:function(e){i(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(l(),e.preventDefault(),e.stopPropagation())},autoFocus:!0}))}));function ct(e){var t=e.store,n=e.children,a=new y.a(t.feed.options);return Object(ne.c)("keydown",(function(e){"s"===e.key.toLowerCase()&&e.ctrlKey&&(t.saveEditor(),e.preventDefault())})),Object(i.useEffect)((function(){return function(){return t.cancelEditor()}}),[]),c.a.createElement(c.a.Fragment,null,c.a.createElement(et.a,{feed:a,config:t.editorConfig,onChange:function(e){return t.onEditorChange(e)}}),n,c.a.createElement(it,{store:t}),c.a.createElement(tt.a,{when:function(){return t.isEditorDirty},message:"You have unsaved changes. If you leave now, your changes will be lost."}))}var st=Y.a.SavedFeed;function lt(e){var t=e.store;return t.edit(new st),t.editorConfig.currTab=0,c.a.createElement(ct,{store:t})}function ut(e){var t=e.store,n=mt(),a=Y.a.getById(n);return n&&a?(t.feed.id!==n&&t.edit(a),c.a.createElement(ct,{store:t})):c.a.createElement(dt,null)}var dt=function(){return c.a.createElement("div",null,c.a.createElement(Ze.a,{type:Ze.b.ERROR,showIcon:!0},"Feed does not exist.",c.a.createElement(C.a,{to:l.a.with({screen:"feeds"})},"Go back")))},mt=function(){var e=l.a.get("id");return e?(e=Array.isArray(e)?e[0]:e,parseInt(e)):null};function ft(e){return function(e){if(Array.isArray(e))return pt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return pt(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pt(e,void 0):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var gt={factories:Object(a.b)({"admin/submenu/component":function(e){return Object(r.a)(p,{screensStore:e.get("admin/screens/store")})},"admin/root/component":function(e){return Object(r.a)(w,{store:e.get("admin/store"),screensStore:e.get("admin/screens/store"),toaster:e.get("admin/toaster/component"),titleTemplate:e.get("admin/title_template")})},"admin/title_template":function(){return document.title.replace("Spotlight","%s ‹ Spotlight")},"admin/store":function(e){return new ve(e.get("admin/loading/loader"),e.get("admin/toaster/store"),e.get("admin/editor/config"))},"admin/loading/loader":function(e){return new me.a(e.get("admin/loading/functions"),750)},"admin/loading/functions":function(){return[function(e,t){return Y.a.loadFeeds().then(t)},function(e,t){return I.b.loadAccounts().then(t)},function(e,t){return te.b.load().then(t)}]},"admin/navbar/component":function(e){return Object(r.b)(de,{store:function(){return e.get("admin/screens/store")},showUpgrade:function(){return!v.a.config.isPro}})},"admin/settings/navbar/component":function(e){return Object(r.b)(Ae,{store:function(){return e.get("admin/screens/store")}})},"admin/screens/store":function(e){return new S.b(e.get("admin/screens"))},"admin/screens":function(e){return[e.get("admin/feeds/screen"),e.get("admin/editor/add_new/screen"),e.get("admin/editor/edit/screen"),e.get("admin/settings/screen")]},"admin/feeds/screen":function(e){return{id:"feeds",title:"Feeds",position:0,component:Object(r.a)(Q,{navbar:e.get("admin/navbar/component"),toaster:e.get("admin/toaster/store")})}},"admin/editor/add_new/screen":function(e){return{id:"new",title:"Add New",position:10,component:Object(r.a)(lt,{store:e.get("admin/store")})}},"admin/editor/edit/screen":function(e){return{id:"edit",title:"Edit",isHidden:function(){return!0},component:Object(r.a)(ut,{store:e.get("admin/store")})}},"admin/editor/config":function(e){var t=Object.assign({},v.a.editor.config);return t.tabs=e.get("admin/editor/tabs"),t.navbarLeft=e.get("admin/editor/navbar/left"),t.navbarRight=e.get("admin/editor/navbar/right"),t},"admin/editor/tabs":function(e){var t=e.get("admin/editor/tabs/extender")(Ue.a.defaultConfig.tabs);return t.push(e.get("admin/editor/tabs/embed")),t},"admin/editor/tabs/extender":function(){return De.a},"admin/editor/navbar/left":function(e){return Object(r.b)($e,{store:function(){return e.get("admin/store")}})},"admin/editor/navbar/right":function(e){return Object(r.b)(qe,{store:function(){return e.get("admin/store")}})},"admin/editor/tabs/embed":function(e){return{id:"embed",label:"Embed",showPreview:function(){return!0},component:Object(r.b)(Xe,{store:function(){return e.get("admin/store")}})}},"admin/settings/screen":function(e){return{id:"settings",title:"Settings",position:50,component:e.get("admin/settings/component")}},"admin/settings/component":function(e){return Object(r.a)(re,{navbar:e.get("admin/settings/navbar/component")})},"admin/settings/tabs/accounts":function(){return{id:"accounts",label:"Manage Accounts",component:Pe.a}},"admin/settings/tabs/crons":function(){return{id:"crons",label:"Crons",component:Object(r.b)(ee.a,{page:function(){return v.a.settings.pages.find((function(e){return"crons"===e.id}))}})}},"admin/settings/tabs/advanced":function(e){return{id:"advanced",label:"Advanced",component:e.get("admin/settings/show_game")?e.get("admin/settings/game/component"):e.get("admin/settings/advanced/component")}},"admin/settings/show_game":function(){return!0},"admin/settings/advanced/component":function(e){return Me},"admin/settings/game/component":function(){return je},"admin/toaster/store":function(e){return new q.a(e.get("admin/toaster/ttl"))},"admin/toaster/ttl":function(){return 5e3},"admin/toaster/component":function(e){return Object(r.a)(V.a,{store:e.get("admin/toaster/store")})}}),extensions:Object(a.b)({"root/children":function(e,t){return[].concat(ft(t),[e.get("admin/root/component")])},"settings/tabs":function(e,t){return[e.get("admin/settings/tabs/accounts"),e.get("admin/settings/tabs/advanced")].concat(ft(t))}}),run:function(e){var t=e.get("admin/toaster/store");document.addEventListener(te.a,(function(){t.addToast("sli/settings/saved",Object(r.a)(pe.a,{message:"Settings saved."}))}))}},bt=n(32);Object(bt.d)();var _t=document.getElementById(v.a.config.rootId);if(_t){var ht=[o.a,gt].filter((function(e){return null!==e}));_t.classList.add("wp-core-ui-override"),new a.a("admin",_t,ht).run()}},67:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var a=n(0),o=n.n(a),r=n(264),i=n.n(r),c=n(7),s=function(e){var t=e.children;return o.a.createElement("a",{className:i.a.pill,href:c.a.resources.upgradeUrl,target:"_blank",tabIndex:-1},"PRO",t)}},90:function(e,t,n){e.exports={root:"SettingsField__root layout__flex-column",label:"SettingsField__label layout__flex-column",container:"SettingsField__container layout__flex-row",control:"SettingsField__control layout__flex-row","control-partial-width":"SettingsField__control-partial-width SettingsField__control layout__flex-row",controlPartialWidth:"SettingsField__control-partial-width SettingsField__control layout__flex-row","control-full-width":"SettingsField__control-full-width SettingsField__control layout__flex-row",controlFullWidth:"SettingsField__control-full-width SettingsField__control layout__flex-row",tooltip:"SettingsField__tooltip layout__flex-column"}},91:function(e,t,n){e.exports={root:"FeedNameField__root layout__flex-row",container:"FeedNameField__container layout__flex-row","edit-container":"FeedNameField__edit-container FeedNameField__container layout__flex-row",editContainer:"FeedNameField__edit-container FeedNameField__container layout__flex-row","static-container":"FeedNameField__static-container FeedNameField__container layout__flex-row",staticContainer:"FeedNameField__static-container FeedNameField__container layout__flex-row","edit-icon":"FeedNameField__edit-icon dashicons__dashicon-normal",editIcon:"FeedNameField__edit-icon dashicons__dashicon-normal",label:"FeedNameField__label","done-btn":"FeedNameField__done-btn",doneBtn:"FeedNameField__done-btn"}},98:function(e,t,n){"use strict";n.d(t,"a",(function(){return h}));var a=n(0),o=n.n(a),r=n(155),i=n.n(r),c=n(20),s=n(116),l=n.n(s),u=n(90),d=n.n(u),m=n(2),f=n(14),p=n(134),g=Object(m.b)((function(e){var t=e.field,n="settings-field-"+Object(f.f)(),a=!t.label||t.fullWidth;return o.a.createElement("div",{className:d.a.root},t.label&&o.a.createElement("div",{className:d.a.label},o.a.createElement("label",{htmlFor:n},t.label)),o.a.createElement("div",{className:d.a.container},o.a.createElement("div",{className:a?d.a.controlFullWidth:d.a.controlPartialWidth},o.a.createElement(t.component,{id:n})),t.tooltip&&o.a.createElement("div",{className:d.a.tooltip},o.a.createElement(p.a,null,t.tooltip))))}));function b(e){var t=e.group;return o.a.createElement("div",{className:l.a.root},t.title.length>0&&o.a.createElement("h1",{className:l.a.title},t.title),t.component&&o.a.createElement("div",{className:l.a.content},o.a.createElement(t.component)),o.a.createElement("div",{className:l.a.fieldList},t.fields.map((function(e){return o.a.createElement(g,{field:e,key:e.id})}))))}var _=n(18);function h(e){var t=e.page;return Object(_.c)("keydown",(function(e){e.ctrlKey&&"s"===e.key.toLowerCase()&&(c.b.save(),e.preventDefault(),e.stopPropagation())})),o.a.createElement("article",{className:i.a.root},t.component&&o.a.createElement("div",{className:i.a.content},o.a.createElement(t.component)),t.groups&&o.a.createElement("div",{className:i.a.groupList},t.groups.map((function(e){return o.a.createElement(b,{key:e.id,group:e})}))))}}},[[514,1,0,3,4]]])}));
ui/dist/admin-common.js ADDED
@@ -0,0 +1 @@
 
1
+ (window.webpackJsonpspotlight=window.webpackJsonpspotlight||[]).push([[3],{103:function(e,t,n){e.exports={primaryColor:"#007cba",secondaryColor:"#d04186",tertiaryColor:"#d82442",lightColor:"#f5f5f5",lightColor2:"#e6e7e8",lightColor3:"#e1e2e3",shadowColor:"rgba(20,25,60,.32)",washedColor:"#eaf0f4"}},104:function(e,t,n){e.exports={root:"Toast__root","fade-in-animation":"Toast__fade-in-animation",fadeInAnimation:"Toast__fade-in-animation","root-fading-out":"Toast__root-fading-out Toast__root",rootFadingOut:"Toast__root-fading-out Toast__root","fade-out-animation":"Toast__fade-out-animation",fadeOutAnimation:"Toast__fade-out-animation",content:"Toast__content","dismiss-icon":"Toast__dismiss-icon",dismissIcon:"Toast__dismiss-icon","dismiss-btn":"Toast__dismiss-btn Toast__dismiss-icon",dismissBtn:"Toast__dismiss-btn Toast__dismiss-icon"}},111:function(e,t,n){"use strict";t.a=wp},114:function(e,t,n){e.exports={root:"Tooltip__root layout__z-highest",container:"Tooltip__container","container-top":"Tooltip__container-top Tooltip__container",containerTop:"Tooltip__container-top Tooltip__container","container-bottom":"Tooltip__container-bottom Tooltip__container",containerBottom:"Tooltip__container-bottom Tooltip__container","container-left":"Tooltip__container-left Tooltip__container",containerLeft:"Tooltip__container-left Tooltip__container","container-right":"Tooltip__container-right Tooltip__container",containerRight:"Tooltip__container-right Tooltip__container",arrow:"Tooltip__arrow","arrow-top":"Tooltip__arrow-top Tooltip__arrow",arrowTop:"Tooltip__arrow-top Tooltip__arrow","arrow-bottom":"Tooltip__arrow-bottom Tooltip__arrow",arrowBottom:"Tooltip__arrow-bottom Tooltip__arrow","arrow-left":"Tooltip__arrow-left Tooltip__arrow",arrowLeft:"Tooltip__arrow-left Tooltip__arrow","arrow-right":"Tooltip__arrow-right Tooltip__arrow",arrowRight:"Tooltip__arrow-right Tooltip__arrow"}},115:function(e,t,n){e.exports={root:"HelpTooltip__root layout__flex-column",tooltip:"HelpTooltip__tooltip layout__z-high","tooltip-container":"HelpTooltip__tooltip-container",tooltipContainer:"HelpTooltip__tooltip-container","tooltip-content":"HelpTooltip__tooltip-content",tooltipContent:"HelpTooltip__tooltip-content",icon:"HelpTooltip__icon"}},133:function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n(0),o=n.n(r),a=n(114),i=n.n(a),c=n(85),l=n(196),u=n(197),s=n(7),f=n(4);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t=e.visible,n=e.delay,a=e.placement,m=e.theme,b=e.children;m=null!=m?m:{},a=a||"bottom";var y,v,h=(y=o.a.useState(!1),v=2,function(e){if(Array.isArray(e))return e}(y)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(y,v)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(y,v)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=h[0],_=h[1],E={preventOverflow:{boundariesElement:document.getElementById(s.a.config.rootId),padding:5}};Object(r.useEffect)((function(){var e=setTimeout((function(){return _(t)}),t?n:1);return function(){return clearTimeout(e)}}),[t]);var O=d("container",a),w=d("arrow",a),S=Object(f.b)(i.a[O],m.container,m[O]),A=Object(f.b)(i.a[w],m.arrow,m[w]);return o.a.createElement(c.c,null,o.a.createElement(l.a,null,(function(e){return b[0](e)})),o.a.createElement(u.a,{placement:a,modifiers:E,positionFixed:!0},(function(e){var t=e.ref,n=e.style,r=e.placement,a=e.arrowProps;return g?o.a.createElement("div",{ref:t,className:Object(f.b)(i.a.root,m.root),style:n,tabIndex:-1},o.a.createElement("div",{className:S,"data-placement":r},o.a.createElement("div",{className:Object(f.b)(i.a.content,m.content)},b[1]),o.a.createElement("div",{className:A,ref:a.ref,style:a.style,"data-placement":r}))):null})))}function d(e,t){switch(t){case"top":case"top-start":case"top-end":return e+"Top";case"bottom":case"bottom-start":case"bottom-end":return e+"Bottom";case"left":case"left-start":case"left-end":return e+"Left";case"right":case"right-start":case"right-end":return e+"Right";default:return e}}},134:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0),o=n.n(r),a=n(115),i=n.n(a),c=n(8),l=n(133);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e){var t,n,r=e.children,a=(t=o.a.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=a[0],f=a[1],p=function(){return f(!0)},m=function(){return f(!1)},d={content:i.a.tooltipContent,container:i.a.tooltipContainer};return o.a.createElement("div",{className:i.a.root},o.a.createElement(l.a,{visible:s,theme:d},(function(e){var t=e.ref;return o.a.createElement("span",{ref:t,className:i.a.icon,onMouseEnter:p,onMouseLeave:m},o.a.createElement(c.a,{icon:"info"}))}),o.a.createElement("div",null,r)))}},141:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n.n(r),a=n(111),i=n(14);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l=function(e){var t=e.id,n=e.value,r=e.title,l=e.button,u=e.mediaType,s=e.multiple,f=e.children,p=e.onOpen,m=e.onClose,d=e.onSelect;t=null!=t?t:"wp-media-"+Object(i.f)(),u=null!=u?u:"image",l=null!=l?l:"Select";var b=o.a.useRef();b.current||(b.current=a.a.media({id:t,title:r,library:{type:u},button:{text:l},multiple:s}));var y=function(){var e=b.current.state().get("selection").first();d&&d(e)};return m&&b.current.on("close",m),b.current.on("open",(function(){if(n){var e="object"===c(n)?n:a.a.media.attachment(n);e.fetch(),b.current.state().get("selection").add(e?[e]:[])}p&&p()})),b.current.on("insert",y),b.current.on("select",y),f({open:function(){return b.current.open()}})}},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n.n(r),a=n(4),i=n(69),c=n.n(i);function l(e){var t=e.cols,n=e.rows,r=e.footerCols,a=e.styleMap;return a=null!=a?a:{cols:{},cells:{}},o.a.createElement("table",{className:c.a.table},o.a.createElement("thead",{className:c.a.header},o.a.createElement(s,{cols:t,styleMap:a})),o.a.createElement("tbody",null,n.map((function(e,n){return o.a.createElement(u,{key:n,row:e,cols:t,styleMap:a})}))),r&&o.a.createElement("tfoot",{className:c.a.footer},o.a.createElement(s,{cols:t,styleMap:a})))}function u(e){var t=e.row,n=e.cols,r=e.styleMap;return o.a.createElement("tr",{className:c.a.row},n.map((function(e){return o.a.createElement("td",{key:e.id,className:Object(a.b)(c.a.cell,f(e),r.cells[e.id])},e.render(t))})))}function s(e){var t=e.cols,n=e.styleMap;return o.a.createElement("tr",null,t.map((function(e){var t=Object(a.b)(c.a.colHeading,f(e),n.cols[e.id]);return o.a.createElement("th",{key:e.id,className:t},e.label)})))}function f(e){return"center"===e.align?c.a.alignCenter:"right"===e.align?c.a.alignRight:c.a.alignLeft}},144:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n.n(r),a=n(270),i=n.n(a),c=n(96),l=function(e){var t=e.feed,n=e.onCopy,r=e.toaster,a=e.children;return o.a.createElement(i.a,{text:'[instagram feed="'.concat(t.id,'"]'),onCopy:function(){r&&r.addToast("feeds/shortcode/copied",(function(){return o.a.createElement(c.a,{message:"Copied shortcode to clipboard."})})),n&&n()}},a)}},148:function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n(0),o=n.n(r),a=n(261),i=n.n(a),c=n(3),l=n(8),u=n(150),s=n(29);function f(e){var t=e.isOpen,n=e.onClose,r=e.onConnect,a=e.beforeConnect;return o.a.createElement(s.a,{title:"Connect an Instagram account",isOpen:t,width:650,onClose:n},o.a.createElement(s.a.Content,null,o.a.createElement(u.a,{onConnect:r,beforeConnect:function(e){a&&a(e),n()}})))}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t,n,r=e.children,a=e.onConnect,u=e.beforeConnect,s=(t=o.a.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=s[0],d=s[1];return o.a.createElement(o.a.Fragment,null,o.a.createElement(c.a,{className:i.a.root,size:c.b.HERO,type:c.c.SECONDARY,onClick:function(){return d(!0)}},o.a.createElement(l.a,{icon:"instagram"}),null!=r?r:o.a.createElement("span",null,"Connect more Instagram accounts")),o.a.createElement(f,{isOpen:m,onClose:function(){d(!1)},onConnect:a,beforeConnect:u}))}},150:function(e,t,n){"use strict";n.d(t,"a",(function(){return g}));var r=n(0),o=n.n(r),a=n(59),i=n.n(a),c=n(35),l=n(9),u=n(29),s=n(3),f=n(8),p=n(73),m=n.n(p),d=n(48),b=n(7);function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t=e.isColumn,n=e.onConnect,r=y(o.a.useState(!1),2),a=r[0],i=r[1],c=y(o.a.useState(""),2),l=c[0],u=c[1],f=o.a.createElement("div",{className:m.a.helpMessage},!1);return o.a.createElement("div",{className:t?m.a.column:m.a.row},o.a.createElement(d.a,{label:"Connect using an access token (for developers)",stealth:!0,isOpen:a,onClick:function(){return i(!a)}},o.a.createElement("div",{className:m.a.content},o.a.createElement("label",{className:m.a.label,htmlFor:"manual-connect-field"},o.a.createElement("div",null,"Enter your Instagram or Facebook access token")),o.a.createElement("div",{className:m.a.bottom},o.a.createElement("input",{id:"manual-connect-field",type:"text",value:l,onChange:function(e){return u(e.target.value)},placeholder:"Your access token"}),o.a.createElement("div",{className:m.a.buttonContainer},t&&f,o.a.createElement(s.a,{className:m.a.button,onClick:function(){return n(l)},type:s.c.PRIMARY,disabled:0===l.length},"Connect"))),!t&&f)))}function g(e){var t=e.onConnect,n=e.beforeConnect,r=e.useColumns,a=e.showPrompt;a=null==a||a,t||(t=function(){});var p=function(e){c.a.State.connectSuccess&&n&&n(e)};return o.a.createElement("div",{className:i.a.root},a&&o.a.createElement("p",{className:i.a.promptMsg},"Choose the type of account to connect:"),o.a.createElement("div",{className:r?i.a.typesColumns:i.a.typesRows},o.a.createElement("div",{className:i.a.type},o.a.createElement(s.a,{type:s.c.PRIMARY,size:s.b.HERO,onClick:function(){return c.a.openAuthWindow(l.a.Type.PERSONAL,u.a.ANIMATION_DELAY,p).then(t).catch((function(){}))}},"Connect your Personal account"),o.a.createElement("div",{className:i.a.capabilities},o.a.createElement(_,null,"Connects directly through Instagram"),o.a.createElement(_,null,"Show posts from your account"))),o.a.createElement("div",{className:i.a.type},o.a.createElement(s.a,{type:s.c.SECONDARY,size:s.b.HERO,onClick:function(){return c.a.openAuthWindow(l.a.Type.BUSINESS,u.a.ANIMATION_DELAY,p).then(t).catch((function(){}))}},"Connect your Business account"),o.a.createElement("div",{className:i.a.capabilities},o.a.createElement(_,null,"Connects through your Facebook page"),o.a.createElement(_,null,"Show posts from your account"),o.a.createElement(_,null,"Show posts where you are tagged"),o.a.createElement(_,null,"Show posts with a specific hashtag from all across Instagram"),o.a.createElement("div",{className:i.a.businessLearnMore},o.a.createElement(f.a,{icon:"editor-help"}),o.a.createElement("a",{href:b.a.resources.businessAccounts,target:"_blank"},"Learn more about Business accounts"))))),o.a.createElement("div",{className:i.a.connectAccessToken},o.a.createElement(h,{isColumn:r,onConnect:function(e){return c.a.addWithAccessToken(e,u.a.ANIMATION_DELAY,p).then(t)}})))}var _=function(e){var t=e.children,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children"]);return o.a.createElement("div",Object.assign({className:i.a.capability},n),o.a.createElement(f.a,{icon:"yes"}),o.a.createElement("div",null,t))}},153:function(e,t,n){e.exports={root:"ModalPrompt__root",button:"ModalPrompt__button"}},188:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0),o=n.n(r),a=(n(218),function(e){var t=e.children;return o.a.createElement("div",{className:"button-group"},t)})},19:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return u}));var r,o=n(0),a=n.n(o),i=(n(503),n(4)),c=n(8);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(e){e.SUCCESS="success",e.INFO="info",e.PRO_TIP="pro-tip",e.WARNING="warning",e.ERROR="error"}(r||(r={}));var u=function(e){var t,n,r=e.children,o=e.type,u=e.showIcon,f=e.shake,p=e.isDismissible,m=e.onDismiss,d=(t=a.a.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),b=d[0],y=d[1],v=Object(i.b)("message","message--"+o,f?"message--shake":null);return b?null:a.a.createElement("div",{className:v},u?a.a.createElement("div",null,a.a.createElement(c.a,{className:"message__icon",icon:s(o)})):null,a.a.createElement("div",{className:"message__content"},r),p?a.a.createElement("button",{className:"message__dismiss-btn",onClick:function(){p&&(y(!0),m&&m())}},a.a.createElement(c.a,{icon:"no"})):null)};function s(e){switch(e){case r.SUCCESS:return"yes-alt";case r.PRO_TIP:return"lightbulb";case r.ERROR:case r.WARNING:return"warning";case r.INFO:default:return"info"}}},192:function(e,t,n){e.exports={root:"Toaster__root layout__z-highest",container:"Toaster__container"}},193:function(e,t,n){e.exports={root:"SaveButton__root","saving-overlay":"SaveButton__saving-overlay layout__fill-parent",savingOverlay:"SaveButton__saving-overlay layout__fill-parent","saving-animation":"SaveButton__saving-animation",savingAnimation:"SaveButton__saving-animation"}},20:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r,o=n(1),a=n(7),i=n(14);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)})(e)}function f(e,t,n){return(f=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&m(o,n.prototype),o}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}t.b=r=o.o.object({values:Object(o.o)({}),original:{},isDirty:!1,isSaving:!1,save:Object(o.f)((function(){if(r.isDirty)return r.isSaving=!0,a.a.restApi.saveSettings(r.values).then((function(e){r.fromResponse(e),document.dispatchEvent(new y(b))})).finally((function(){return r.isSaving=!1}))})),load:Object(o.f)((function(){return a.a.restApi.getSettings().then((function(e){return r.fromResponse(e)}))})),restore:Object(o.f)((function(){Object.assign(r.values,r.original),r.isDirty=!1})),fromResponse:function(e){r.original=e.data,r.restore()}}),Object(o.g)((function(){r.isDirty=!Object(i.b)(r.original,r.values)}));var b="sli/settings/saved",y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(o,e);var t,n,r=(t=o,n=p(),function(){var e,r=d(t);if(n){var o=d(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return u(this,e)});function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(this,o),r.call(this,e,t)}return o}(s(CustomEvent))},218:function(e,t,n){},219:function(e,t,n){},254:function(e,t,n){},255:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(47),o=n(50),a=n(15),i={factories:Object(r.b)({"router/history":function(){return Object(o.a)()},"router/store":function(e){return a.a.useHistory(e.get("router/history"))}}),run:function(e){e.get("router/store")}}},257:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(18);function o(e){var t=e.when,n=e.is,o=e.isRoot,a=e.render,i=Object(r.d)().get(t);return i===n||!n&&!i||o&&!i?a():null}},261:function(e,t,n){e.exports={root:"ConnectAccountButton__root"}},265:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=n.n(r),a=n(4),i=(n(337),function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}),c=function(e){var t=e.className,n=e.unit,r=i(e,["className","unit"]),c=Object(a.b)("unit-input__field",t);return o.a.createElement("div",{className:"unit-input"},o.a.createElement("input",Object.assign({},r,{className:c})),o.a.createElement("div",{className:"unit-input__unit"},o.a.createElement("span",null,n)))}},267:function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n(0),o=n.n(r),a=n(268),i=(n(219),n(18)),c=n(45),l=n(85),u=n(196),s=n(197),f=n(4),p=n(7);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var d=function(e){var t=e.id,n=e.value,r=e.disableAlpha,d=e.onChange;n=null!=n?n:"#fff";var b,y,v=(b=o.a.useState(!1),y=2,function(e){if(Array.isArray(e))return e}(b)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(b,y)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(b,y)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),h=v[0],g=v[1],_=o.a.useRef(),E=o.a.useRef(),O=function(){return g(!0)},w=function(){return g(!1)};Object(i.b)(_,w,[E]),Object(i.c)("keydown",(function(e){"Escape"===e.key&&h&&(w(),e.preventDefault(),e.stopPropagation())}),h);var S=function(e){return d&&d(e)},A={preventOverflow:{boundariesElement:document.getElementById(p.a.config.rootId),padding:5}};return o.a.createElement(l.c,null,o.a.createElement(u.a,null,(function(e){var r=e.ref;return o.a.createElement("button",{ref:Object(f.d)(_,r),id:t,className:"color-picker",onClick:O},o.a.createElement("span",{className:"color-picker__preview",style:{backgroundColor:Object(c.a)(n)}}))})),o.a.createElement(s.a,{placement:"bottom-end",positionFixed:!0,modifiers:A},(function(e){var t=e.ref,i=e.style;return h&&o.a.createElement("div",{className:"color-picker__popper",ref:Object(f.d)(E,t),style:i},o.a.createElement(a.ChromePicker,{color:n,onChange:S,disableAlpha:r}))})))}},269:function(e,t,n){"use strict";var r=n(0),o=n.n(r),a=n(9),i=n(95),c=n(151),l=n(35),u=n(2),s=n(19),f=n(7);function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=Object(u.b)((function(e){!function(e){if(null==e)throw new TypeError("Cannot destructure undefined")}(e),Object(r.useEffect)((function(){var e=function(e){var t=e.detail.account;d||v||t.type!==a.a.Type.PERSONAL||t.customBio.length||t.customProfilePicUrl.length||(u(t),b(!0))};return document.addEventListener(l.a.ACCOUNT_CONNECTED_EVENT,e),function(){return document.removeEventListener(l.a.ACCOUNT_CONNECTED_EVENT,e)}}),[]);var t=p(o.a.useState(null),2),n=t[0],u=t[1],m=p(o.a.useState(!1),2),d=m[0],b=m[1],y=p(o.a.useState(!1),2),v=y[0],h=y[1],g=function(){l.a.State.connectedId=null};return o.a.createElement(o.a.Fragment,null,o.a.createElement(i.a,{title:"Do you want to show your profile details in the feed?",buttons:["Yes","No"],isOpen:d,onAccept:function(){b(!1),h(!0)},onCancel:function(){b(!1),g()}},o.a.createElement("p",null,"Instagram does not provide the profile photo and bio text for Personal accounts."," ","You can upload your own photo and add a custom bio in Spotlight to match your Instagram profile."),o.a.createElement("p",null,o.a.createElement("a",{href:f.a.resources.customPersonalInfoUrl,target:"_blank"},"Learn more")),o.a.createElement("p",null,"Would you like to do that now?"),o.a.createElement(s.a,{type:s.b.PRO_TIP,showIcon:!0},"You can change these later from the ",o.a.createElement("b",null,"Settings » Accounts")," page.")),o.a.createElement(c.a,{isOpen:v,onClose:function(){h(!1),g()},account:n}))}))},271:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(1),o=n(14);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var c=function(e,t,n,r){var o,a=arguments.length,c=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(c=(a<3?o(c):a>3?o(t,n,c):o(t,n))||c);return a>3&&c&&Object.defineProperty(t,n,c),c},l=function(){var e=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.ttl=t,this.toasts=new Array}var t,n;return t=e,(n=[{key:"addToast",value:function(e,t,n){this.toasts.push({key:e+Object(o.f)(),component:t,ttl:n})}},{key:"removeToast",value:function(e){var t=this.toasts.findIndex((function(t){return t.key===e}));t>-1&&this.toasts.splice(t,1)}}])&&a(t.prototype,n),e}();return c([r.o],e.prototype,"toasts",void 0),c([r.f],e.prototype,"addToast",null),c([r.f],e.prototype,"removeToast",null),e}()},279:function(e,t,n){"use strict";var r=n(0),o=n.n(r),a=n(29),i=n(97),c=n(20),l=n(98),u=n(7),s=n(2);t.a=Object(s.b)((function(e){var t=e.isOpen,n=e.onClose,r=e.onSave;return o.a.createElement(a.a,{title:"Global filters",isOpen:t,onClose:function(){c.b.isDirty&&!confirm("You have unsaved changes. If you close the window now, your settings will not be saved. Click OK to close anyway.")||n()}},o.a.createElement(a.a.Content,null,o.a.createElement(l.a,{page:u.a.settings.pages.find((function(e){return"filters"===e.id}))})),o.a.createElement(a.a.Footer,null,o.a.createElement(i.a,{disabled:!c.b.isDirty,isSaving:c.b.isSaving,onClick:function(){c.b.save().then((function(){r&&r()}))}})))}))},281:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n.n(r),a=n(4),i=(n(510),function(e){var t=e.name,n=e.className,r=e.disabled,i=e.value,c=e.onChange,l=e.options,u=function(e){!r&&e.target.checked&&c&&c(e.target.value)},s=Object(a.b)(Object(a.a)("radio-group",{"--disabled":r}),n);return o.a.createElement("div",{className:s},l.map((function(e,n){return o.a.createElement("label",{className:"radio-group__option",key:n},o.a.createElement("input",{type:"radio",name:t,value:e.value,checked:i===e.value,onChange:u}),o.a.createElement("span",null,e.label))})))})},283:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0),o=n.n(r),a=(n(511),function(e){var t=e.size,n=(t=null!=t?t:24)+"px",r=.375*t+"px",a={width:n,height:n,boxShadow:"".concat(.25*t+"px"," 0 0 ").concat(r," #999 inset")};return o.a.createElement("span",{className:"loading-spinner",style:a})})},285:function(e,t,n){"use strict";var r=n(275),o=n(9),a=n(276),i=n(80),c=n(5),l=n(51),u=n(61),s=n(44),f=n(278),p=n(118),m=n(0),d=n.n(m),b=n(138),y=n(19),v=n(70);function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(e,t)||g(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){if(e){if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_(e,t):void 0}}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var E={DropdownIndicator:null},O=function(e){return{label:e,value:e}},w=function(e){var t=e.id,n=e.value,r=e.onChange,o=e.sanitize,a=e.autoFocus,i=e.message,c=h(d.a.useState(""),2),l=c[0],u=c[1],s=h(d.a.useState(-1),2),f=s[0],p=s[1],w=h(d.a.useState(),2),S=w[0],A=w[1];Object(m.useEffect)((function(){A(i)}),[i]);var C=(n=Array.isArray(n)?n:[]).map((function(e){return O(e)})),N=function(e){if(r){var t=-1;e=e?e.map((function(e){return e&&o?o(e.value):e.value})).filter((function(e,n,r){var o=r.indexOf(e);return o!==n?(t=o,!1):!!e})):[],p(t),-1===t&&r(e)}},j=Object(v.b)();return d.a.createElement(d.a.Fragment,null,d.a.createElement(b.a,{inputId:t,className:"react-select",classNamePrefix:"react-select",components:E,inputValue:l,isClearable:!0,isMulti:!0,menuIsOpen:!1,onChange:N,onInputChange:function(e){u(e)},onKeyDown:function(e){if(l)switch(e.key){case",":case"Enter":case"Tab":u(""),N([].concat(function(e){if(Array.isArray(e))return _(e)}(t=C)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(t)||g(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[O(l)])),e.preventDefault()}var t},placeholder:"Type something and press enter...",value:C,autoFocus:a,styles:j}),f<0||0===C.length?null:d.a.createElement(y.a,{type:y.b.WARNING,shake:!0,showIcon:!0,isDismissible:!0},d.a.createElement("code",null,C[f].label)," is already in the list"),S?d.a.createElement(y.a,{type:y.b.WARNING,shake:!0,showIcon:!0,isDismissible:!0},S):null)},S=n(2);function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var C,N=Object(S.b)((function(e){var t,n,r=(t=d.a.useState(""),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],a=r[1];e.exclude&&0===e.exclude.length&&o.length>0&&a("");var i=void 0;if(o.length>0){var c=e.excludeMsg.indexOf("%s"),l=e.excludeMsg.substring(0,c),u=e.excludeMsg.substring(c+"%s".length);i=d.a.createElement(d.a.Fragment,null,l,d.a.createElement("code",null,o),u)}var s=Object.assign(Object.assign({},e),{message:i,onChange:function(t){var n=t.findIndex((function(t){return e.exclude.includes(t)}));n>-1?a(t[n]):e.onChange(t)}});return d.a.createElement(w,Object.assign({},s))})),j=n(119),T=n(112),I=function(e){var t=Object.assign(Object.assign({},e),{value:e.value?e.value.map((function(e){return Object(T.a)(e,"#")})):[],sanitize:T.b});return d.a.createElement(N,Object.assign({},t))},k=n(280),R=n(282),x=n(113),P=c.a.HoverInfo,F=c.a.HeaderInfo;!function(e){e.FILTER="filter",e.MODERATE="moderate"}(C||(C={})),t.a=function(e){var t=e.slice();t.find((function(e){return e.id===x.a.CONNECT})).groups.push({id:"tagged",label:"Show posts where these accounts are tagged",isOpen:!0,isFakePro:!0,fields:[{component:r.a,isFakePro:!0,props:function(){return{value:[],accounts:o.b.getBusinessAccounts()}}}]},{id:"hashtags",label:"Show posts with these hashtags",isOpen:!0,isFakePro:!0,fields:[{component:a.a,isFakePro:!0,props:function(){return{value:[]}}}]});var n=t.find((function(e){return e.id===x.a.DESIGN}));n.groups.find((function(e){return"feed"===e.id})).fields.splice(3,0,{label:"Types of posts",component:i.a,isFakePro:!0,props:function(){return{options:[{value:c.a.MediaType.ALL,label:"All posts"},{value:c.a.MediaType.PHOTOS,label:"Photos Only"},{value:c.a.MediaType.VIDEOS,label:"Videos Only"}]}}});var m=n.groups.find((function(e){return"appearance"===e.id}));m.fields.push({label:"Hover text color",component:l.a,isFakePro:!0},{label:"Hover background color",component:l.a,isFakePro:!0});var d=m.fields.find((function(e){return"hoverInfo"===e.option})),b=d.props;d.props=function(e,t){var n=b(e,t);return n.options.push({value:P.CAPTION,label:"Caption",isFakePro:!0},{value:P.USERNAME,label:"Username",isFakePro:!0},{value:P.DATE,label:"Date",isFakePro:!0}),n};var y=n.groups.find((function(e){return"header"===e.id}));y.fields.splice(2,0,{label:"Header style",component:i.a,isResponsive:!0,isFakePro:!0,props:function(){return{options:[{value:c.a.HeaderStyle.NORMAL,label:"Normal"},{value:c.a.HeaderStyle.CENTERED,label:"Centered"},{value:c.a.HeaderStyle.BOXED,label:"Boxed"}]}}}),y.fields.push({label:"Include stories",component:u.a,isFakePro:!0},{label:"Stories interval time",component:s.a,isFakePro:!0,props:function(){return{value:5,unit:"sec"}}});var v=y.fields.find((function(e){return"headerInfo"===e.option})),h=v.props;return v.props=function(e,t){var n=h(e,t);return n.options.push({value:F.MEDIA_COUNT,label:"Media count",isFakePro:!0},{value:F.FOLLOWERS,label:"Follower count",isFakePro:!0}),n},n.groups.find((function(e){return"loadMoreBtn"===e.id})).fields.push({label:"Autoload",component:u.a,isFakePro:!0}),n.groups.splice(4,0,{id:"lightbox",label:"Popup box",isFakePro:!0,isOpen:!1,fields:[{label:"Show sidebar",component:u.a},{label:"Number of comments",component:s.a,props:function(){return{value:5,placeholder:"No comments"}}}]},{id:"captions",label:"Captions",isFakePro:!0,isOpen:!1,fields:[{label:"Show captions",isResponsive:!0,component:u.a},{label:"Caption max length",isResponsive:!0,isFakePro:!0,component:s.a,props:function(){return{unit:"words",placeholder:"No limit"}}},{label:"Caption text size",isResponsive:!0,component:s.a,props:function(){return{unit:"px",placeholder:"Theme default"}}},{label:"Caption text color",component:l.a}]},{id:"likesComments",label:"Likes & comments",isFakePro:!0,isOpen:!1,fields:[{label:"Show likes icon",isResponsive:!0,component:u.a},{label:"Likes icon color",component:l.a},{label:"Show comments icon",isResponsive:!0,component:u.a},{label:"Comments icon color",component:l.a},{label:"Icon size",isResponsive:!0,component:s.a,props:function(){return{value:20,unit:"px"}}}]}),t.push({id:C.FILTER,label:"Filter",isFakePro:!0,showPreview:function(){return!0},component:f.a,groups:[{id:"captionFilters",label:"Caption filtering",isOpen:!0,isFakePro:!0,fields:[{component:p.a,props:function(){return{component:N,label:"Only show posts with these words or phrases"}}},{component:j.a},{component:p.a,props:function(){return{bordered:!0,component:N,label:"Hide posts with these words or phrases"}}},{component:j.a}]},{id:"hashtagFilters",label:"Hashtag filtering",isOpen:!0,isFakePro:!0,fields:[{component:p.a,props:function(){return{component:I,label:"Only show posts with these hashtags"}}},{component:j.a},{component:p.a,props:function(){return{bordered:!0,component:I,label:"Hide posts with these hashtags"}}},{component:j.a}]}]},{id:C.MODERATE,label:"Moderate",isFakePro:!0,showPreview:function(){return!0},component:k.a,preview:R.a}),t}},287:function(e,t,n){"use strict";var r=n(0),o=n.n(r),a=n(8),i=n(104),c=n.n(i);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e){var t=e.children,n=e.ttl,i=e.onExpired;n=null!=n?n:0;var u,s,f=(u=o.a.useState(!1),s=2,function(e){if(Array.isArray(e))return e}(u)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(u,s)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(u,s)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=f[0],m=f[1],d=o.a.useRef(),b=o.a.useRef(),y=function(){n>0&&(d.current=setTimeout(h,n))},v=function(){clearTimeout(d.current)},h=function(){m(!0),b.current=setTimeout(g,200)},g=function(){i&&i()};Object(r.useEffect)((function(){return y(),function(){v(),clearTimeout(b.current)}}),[]);var _=p?c.a.rootFadingOut:c.a.root;return o.a.createElement("div",{className:_,onMouseOver:v,onMouseOut:y},o.a.createElement("div",{className:c.a.content},t),o.a.createElement("button",{className:c.a.dismissBtn,onClick:function(){v(),h()}},o.a.createElement(a.a,{icon:"no-alt",className:c.a.dismissIcon})))}var s=n(192),f=n.n(s),p=n(2);t.a=Object(p.b)((function(e){var t=e.store;return o.a.createElement("div",{className:f.a.root},o.a.createElement("div",{className:f.a.container},t.toasts.map((function(e){var n;return o.a.createElement(u,{key:e.key,ttl:null!==(n=e.ttl)&&void 0!==n?n:t.ttl,onExpired:function(){return n=e.key,void t.removeToast(n);var n}},o.a.createElement(e.component))}))))}))},29:function(e,t,n){"use strict";n.d(t,"a",(function(){return p}));var r=n(0),o=n.n(r),a=n(41),i=n.n(a),c=n(4),l=(n(333),n(18)),u=n(3),s=n(8);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e){var t,n,a=e.children,u=e.className,s=e.isOpen,m=e.icon,d=e.title,b=e.width,y=e.height,v=e.onClose,h=e.allowShadeClose,g=e.focusChild,_=e.portalTo,E=o.a.useRef(),O=(t=Object(l.a)(s,!1,p.ANIMATION_DELAY),n=1,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];if(Object(l.c)("keydown",(function(e){"Escape"===e.key&&(v&&v(),e.preventDefault(),e.stopPropagation())})),Object(r.useEffect)((function(){E&&E.current&&s&&(null!=g?g:E).current.focus()}),[]),!O)return null;var w={width:b=null!=b?b:600,height:y},S=Object(c.b)("modal",s?"modal--open":null,s?null:"modal--close",u,"wp-core-ui-override");h=null==h||h;var A=o.a.createElement("div",{className:S},o.a.createElement("div",{className:"modal__shade",tabIndex:-1,onClick:function(){h&&v&&v()}}),o.a.createElement("div",{ref:E,className:"modal__container",style:w,tabIndex:-1},d?o.a.createElement(p.Header,null,o.a.createElement("h1",null,o.a.createElement(p.Icon,{icon:m}),d),o.a.createElement(p.CloseBtn,{onClick:v})):null,a));return i.a.createPortal(A,null!=_?_:document.body)}!function(e){e.ANIMATION_DELAY=120,e.CloseBtn=function(e){var t=e.onClick;return o.a.createElement(u.a,{className:"modal__close-btn",type:u.c.NONE,onClick:t,tooltip:"Close"},o.a.createElement("span",{className:"dashicons dashicons-no-alt"}))},e.Icon=function(e){var t=e.icon;return t?o.a.createElement(s.a,{icon:t,className:"modal__icon"}):null},e.Header=function(e){var t=e.children;return o.a.createElement("div",{className:"modal__header"},t)},e.Content=function(e){var t=e.children;return o.a.createElement("div",{className:"modal__scroller"},o.a.createElement("div",{className:"modal__content"},t))},e.Footer=function(e){var t=e.children;return o.a.createElement("div",{className:"modal__footer"},t)}}(p||(p={}))},3:function(e,t,n){"use strict";n.d(t,"c",(function(){return u})),n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return f}));var r=n(0),o=n.n(r),a=n(4),i=n(133),c=(n(218),n(14));function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u,s;!function(e){e[e.PRIMARY=0]="PRIMARY",e[e.SECONDARY=1]="SECONDARY",e[e.TOGGLE=2]="TOGGLE",e[e.LINK=3]="LINK",e[e.PILL=4]="PILL",e[e.DANGER=5]="DANGER",e[e.DANGER_LINK=6]="DANGER_LINK",e[e.DANGER_PILL=7]="DANGER_PILL",e[e.NONE=8]="NONE"}(u||(u={})),function(e){e[e.SMALL=0]="SMALL",e[e.NORMAL=1]="NORMAL",e[e.LARGE=2]="LARGE",e[e.HERO=3]="HERO"}(s||(s={}));var f=o.a.forwardRef((function(e,t){var n=e.children,r=e.className,f=e.type,p=e.size,m=e.active,d=e.tooltip,b=e.tooltipPlacement,y=e.onClick,v=e.linkTo,h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","className","type","size","active","tooltip","tooltipPlacement","onClick","linkTo"]);f=null!=f?f:u.SECONDARY,p=null!=p?p:s.NORMAL,b=null!=b?b:"bottom";var g,_,E=(g=o.a.useState(!1),_=2,function(e){if(Array.isArray(e))return e}(g)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(g,_)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(g,_)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),O=E[0],w=E[1],S=function(){return w(!0)},A=function(){return w(!1)},C=Object(a.b)(r,f!==u.NONE?"button":null,f===u.PRIMARY?"button-primary":null,f===u.SECONDARY?"button-secondary":null,f===u.LINK?"button-secondary button-tertiary":null,f===u.PILL?"button-secondary button-tertiary button-pill":null,f===u.TOGGLE?"button-toggle":null,f===u.TOGGLE&&m?"button-primary button-active":null,f!==u.TOGGLE||m?null:"button-secondary",f===u.DANGER?"button-secondary button-danger":null,f===u.DANGER_LINK?"button-tertiary button-danger":null,f===u.DANGER_PILL?"button-tertiary button-danger button-danger-pill":null,p===s.SMALL?"button-small":null,p===s.LARGE?"button-large":null,p===s.HERO?"button-hero":null),N=function(e){y&&y(e)},j="button";if("string"==typeof v?(j="a",h.href=v):h.type="button",h.tabIndex=0,!d)return o.a.createElement(j,Object.assign({ref:t,className:C,onClick:N},h),n);var T="string"==typeof d,I="btn-tooltip-"+Object(c.f)(),k=T?d:o.a.createElement(d,{id:I});return o.a.createElement(i.a,{visible:O&&!e.disabled,placement:b,delay:300},(function(e){var r=e.ref;return o.a.createElement(j,Object.assign({ref:t?Object(a.d)(r,t):r,className:C,onClick:N,onMouseEnter:S,onMouseLeave:A},h),n)}),k)}))},333:function(e,t,n){},334:function(e,t,n){},335:function(e,t,n){},337:function(e,t,n){},34:function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n(5),o=n(15),a=n(42),i=n(1),c=n(36),l=n(7);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var m,d=function(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":p(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i};!function(e){var t=function(){var e=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,e),e.setFromObject(this,t)}var t,n;return t=e,n=[{key:"setFromObject",value:function(e){var t,n,o,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.id=null!==(t=i.id)&&void 0!==t?t:null,e.name=null!==(n=i.name)&&void 0!==n?n:"",e.usages=null!==(o=i.usages)&&void 0!==o?o:[],e.options=r.a.Options.setFromObject(null!==(a=e.options)&&void 0!==a?a:new r.a.Options,i.options)}}],null&&f(t.prototype,null),n&&f(t,n),e}();return d([i.o],e.prototype,"id",void 0),d([i.o],e.prototype,"name",void 0),d([i.o],e.prototype,"usages",void 0),d([i.o],e.prototype,"options",void 0),e}();function n(n){var r,o;e.list.splice(0,e.list.length),(r=e.list).push.apply(r,function(e){if(Array.isArray(e))return u(e)}(o=n.data.map((function(e){return new t(e)})))||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}e.SavedFeed=t,e.list=Object(i.o)([]),e.loadFeeds=function(){return c.a.getFeeds().then(n).catch((function(e){}))},e.getById=function(t){return e.list.find((function(e){return e.id===t}))},e.hasFeeds=function(){return e.list.length>0},e.create=function(n,r){var o=new t({id:null,name:m(n),options:r});return e.list.push(o),o},e.saveFeed=function(n){return l.a.restApi.saveFeed(n).then((function(r){var o=new t(r.data.feed);if(null===n.id)e.list.push(o);else{var a=e.list.findIndex((function(e){return e.id===n.id}));e.list[a]=o}return o}))},e.deleteFeed=function(t){var n=null!==t.id?e.list.findIndex((function(e){return e.id===t.id})):e.list.findIndex((function(e){return e===t}));return n>=0&&e.list.splice(n,1),null!==t.id?l.a.restApi.deleteFeed(t.id).catch((function(e){})):new Promise((function(e){return e()}))},e.getEditUrl=function(e){return o.a.at({screen:a.a.EDIT_FEED,id:e.id.toString()})};var p=new RegExp("([\\w\\s]+)\\s?\\((\\d+)\\)?");function m(t){var n=b(t)[0],r=e.list.map((function(e){return b(e.name)})).filter((function(e){return e[0]===n})),o=r.reduce((function(e,t){return Math.max(e,t[1])}),1);return r.length>0?"".concat(n," (").concat(o+1,")"):t.trim()}function b(e){e=e.trim();var t=p.exec(e);return t?[t[1].trim(),parseInt(t[2])]:[e,0]}}(m||(m={}))},35:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r,o=n(9),a=n(79),i=n(7),c=n(1);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)})(e)}function f(e,t,n){return(f=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&m(o,n.prototype),o}).apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e){var t=null,n=null;function r(t,n,r){r&&r(e.State.connectedId),setTimeout((function(){return o.b.loadAccounts().then((function(){var t=o.b.getById(e.State.connectedId),r=new l(e.ACCOUNT_CONNECTED_EVENT,t);document.dispatchEvent(r),n(e.State.connectedId)}))}),t)}e.State=window.SliAccountManagerState=Object(c.o)({accessToken:null,connectSuccess:!1,connectedId:null}),e.addWithAccessToken=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;return new Promise((function(a,c){e.State.connectSuccess=!1,i.a.restApi.connectAccount(t).then((function(t){e.State.connectSuccess=!0,e.State.connectedId=t.data.accountId,r(n,a,o)})).catch(c)}))},e.openAuthWindow=function(c){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2?arguments[2]:void 0;return new Promise((function(s,f){if(e.State.connectedId=null,null==t||t.closed){var p=Object(a.a)(700,800),m=c===o.a.Type.PERSONAL?i.a.restApi.config.personalAuthUrl:i.a.restApi.config.businessAuthUrl;t=Object(a.c)(m,"_blank",Object.assign({dependent:"yes",resizable:"yes",toolbar:"no",location:"no",scrollbars:"no"},p))}else t.focus();null==t||t.closed||(n=setInterval((function(){t&&!t.closed||(clearInterval(n),null===e.State.connectedId?f&&f():r(l,s,u))}),500))}))},e.updateAccount=function(e){return i.a.restApi.updateAccount(e)},e.deleteAccount=function(e){return i.a.restApi.deleteAccount(e).then(o.b.loadFromResponse)},e.ACCOUNT_CONNECTED_EVENT="sli/account/connected";var l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(o,e);var t,n,r=(t=o,n=p(),function(){var e,r=d(t);if(n){var o=d(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return u(this,e)});function o(e,t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),r.call(this,e,{detail:{account:t}})}return o}(s(CustomEvent));e.AccountConnectedEvent=l}(r||(r={}))},37:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(0),o=n.n(r),a=n(4),i=n(3),c=(n(335),n(8)),l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function u(e){var t=e.className,n=e.children,r=e.isTransitioning,i=l(e,["className","children","isTransitioning"]),c=Object(a.a)("onboarding",{"--transitioning":r});return o.a.createElement("div",Object.assign({className:Object(a.b)(c,t)},i),Array.isArray(n)?n.map((function(e,t){return o.a.createElement("div",{key:t},e)})):n)}!function(e){e.TRANSITION_DURATION=200,e.Thin=function(e){var t=e.className,n=e.children,r=l(e,["className","children"]);return o.a.createElement("div",Object.assign({className:Object(a.b)("onboarding__thin",t)},r),n)},e.HelpMsg=function(e){var t=e.className,n=e.children,r=l(e,["className","children"]);return o.a.createElement("div",Object.assign({className:Object(a.b)("onboarding__help-msg",t)},r),n)},e.ProTip=function(t){var n=t.children;return o.a.createElement(e.HelpMsg,null,o.a.createElement("div",{className:"onboarding__pro-tip"},o.a.createElement("span",null,o.a.createElement(c.a,{icon:"lightbulb"}),o.a.createElement("strong",null,"Pro tip!")),n))},e.StepList=function(e){var t=e.className,n=e.children,r=l(e,["className","children"]);return o.a.createElement("ul",Object.assign({className:Object(a.b)("onboarding__steps",t)},r),n)},e.Step=function(e){var t=e.isDone,n=e.num,r=e.className,i=e.children,c=l(e,["isDone","num","className","children"]);return o.a.createElement("li",Object.assign({className:Object(a.b)(t?"onboarding__done":null,r)},c),o.a.createElement("strong",null,"Step ",n,":")," ",i)},e.HeroButton=function(e){var t,n=e.className,r=e.children,c=l(e,["className","children"]);return o.a.createElement(i.a,Object.assign({type:null!==(t=c.type)&&void 0!==t?t:i.c.PRIMARY,size:i.b.HERO,className:Object(a.b)("onboarding__hero-button",n)},c),r)}}(u||(u={}))},48:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n.n(r),a=n(4),i=(n(334),n(8));function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var l=o.a.forwardRef((function(e,t){var n=e.label,r=e.className,l=e.isOpen,u=e.showIcon,s=e.disabled,f=e.stealth,p=e.onClick,m=e.children;u=null==u||u,s=null!=s&&s;var d,b,y=(d=o.a.useState(!1),b=2,function(e){if(Array.isArray(e))return e}(d)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(d,b)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(d,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v=y[0],h=y[1],g=void 0!==l;g||(l=v);var _=function(){s||(g||h(!l),p&&p())},E=Object(a.a)("spoiler",{"--open":l,"--disabled":s,"--stealth":f}),O=Object(a.b)(E,r),w=l?"arrow-up-alt2":"arrow-down-alt2",S=Array.isArray(n)?n.map((function(e,t){return o.a.createElement(o.a.Fragment,{key:t},e)})):"string"==typeof n?o.a.createElement("span",null,n):n;return o.a.createElement("div",{ref:t,className:O},o.a.createElement("div",{className:"spoiler__header",onClick:_,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||_()},role:"button",tabIndex:0},o.a.createElement("div",{className:"spoiler__label"},S),u&&o.a.createElement(i.a,{icon:w,className:"spoiler__icon"})),o.a.createElement("div",{className:"spoiler__content"},m))}))},49:function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n(63),o=n.n(r),a=n(0),i=n.n(a),c=n(40),l=n(4),u=n(15),s=n(42),f=n(67);function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=e.children;return i.a.createElement("div",{className:o.a.root},i.a.createElement(m.Item,null,i.a.createElement(c.a,{to:u.a.at({screen:s.a.FEED_LIST}),className:o.a.logo})),i.a.createElement(m.Chevron,null),i.a.createElement("div",{className:o.a.leftContainer},t[0]),t[1]&&i.a.createElement("div",{className:o.a.rightContainer},t[1]))}n(508),function(e){e.Item=function(e){var t=e.children;return i.a.createElement("div",{className:o.a.item},t)},e.Link=function(t){var n,r=t.linkTo,a=t.onClick,u=t.isCurrent,s=t.isDisabled,f=t.children,m=Object(l.c)((p(n={},o.a.link,!0),p(n,o.a.current,u),p(n,o.a.disabled,s),n)),d=function(e){"Enter"!==e.key&&" "!==e.key||e.currentTarget.click()},b=s?-1:0;return i.a.createElement(e.Item,null,r?i.a.createElement(c.a,{to:r,className:m,role:"button",onKeyPress:d,tabIndex:b},f):i.a.createElement("div",{className:m,role:"button",onClick:function(){return!s&&a&&a()},onKeyPress:d,tabIndex:b},f))},e.ProPill=function(){return i.a.createElement("div",{className:o.a.proPill},i.a.createElement(f.a,null))},e.Chevron=function(){return i.a.createElement("div",{className:o.a.chevron},i.a.createElement("svg",{viewBox:"0 0 100 100",width:"100%",height:"100%",preserveAspectRatio:"none"},i.a.createElement("path",{d:"M0 0 L100 50 L0 100",fill:"none",stroke:"currentcolor",strokeLinejoin:"bevel"})))}}(m||(m={}))},501:function(e,t,n){},503:function(e,t,n){},504:function(e,t,n){},508:function(e,t,n){},510:function(e,t,n){},511:function(e,t,n){},59:function(e,t,n){e.exports={root:"ConnectAccount__root","prompt-msg":"ConnectAccount__prompt-msg",promptMsg:"ConnectAccount__prompt-msg",types:"ConnectAccount__types",type:"ConnectAccount__type","types-rows":"ConnectAccount__types-rows ConnectAccount__types",typesRows:"ConnectAccount__types-rows ConnectAccount__types","types-columns":"ConnectAccount__types-columns ConnectAccount__types",typesColumns:"ConnectAccount__types-columns ConnectAccount__types",capabilities:"ConnectAccount__capabilities",capability:"ConnectAccount__capability","business-learn-more":"ConnectAccount__business-learn-more",businessLearnMore:"ConnectAccount__business-learn-more","connect-access-token":"ConnectAccount__connect-access-token",connectAccessToken:"ConnectAccount__connect-access-token"}},63:function(e,t,n){e.exports={root:"Navbar__root layout__flex-row",container:"Navbar__container layout__flex-row","left-container":"Navbar__left-container Navbar__container layout__flex-row",leftContainer:"Navbar__left-container Navbar__container layout__flex-row","right-container":"Navbar__right-container Navbar__container layout__flex-row",rightContainer:"Navbar__right-container Navbar__container layout__flex-row",child:"Navbar__child",item:"Navbar__item Navbar__child",disabled:"Navbar__disabled",chevron:"Navbar__chevron Navbar__child",logo:"Navbar__logo",link:"Navbar__link","pro-pill":"Navbar__pro-pill",proPill:"Navbar__pro-pill",current:"Navbar__current","button-container":"Navbar__button-container layout__flex-row",buttonContainer:"Navbar__button-container layout__flex-row"}},69:function(e,t,n){e.exports={table:"Table__table theme__subtle-drop-shadow theme__slightly-rounded",header:"Table__header",footer:"Table__footer",cell:"Table__cell","col-heading":"Table__col-heading Table__cell",colHeading:"Table__col-heading Table__cell",row:"Table__row","align-left":"Table__align-left",alignLeft:"Table__align-left","align-right":"Table__align-right",alignRight:"Table__align-right","align-center":"Table__align-center",alignCenter:"Table__align-center"}},7:function(e,t,n){"use strict";var r=n(93),o=n(36),a=n(0),i=n.n(a),c=n(20),l=n(147),u=n(2),s=n(70),f=n(74),p=n.n(f),m=n(87),d=n(8);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e){var t,n,r=e.type,o=e.unit,a=e.units,c=e.value,l=e.onChange,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["type","unit","units","value","onChange"]),s=(t=i.a.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=s[0],y=s[1],v=Array.isArray(a)&&a.length,h=function(){return y((function(e){return!e}))},g=function(e){switch(e.key){case" ":case"Enter":h();break;default:return}e.preventDefault(),e.stopPropagation()};return(null==c||isNaN(c))&&(c=""),i.a.createElement("div",{className:p.a.root},i.a.createElement("input",Object.assign({},u,{className:p.a.input,type:null!=r?r:"text",value:c,onChange:function(e){return l&&l(e.currentTarget.value,o)}})),i.a.createElement("div",{className:p.a.unitContainer},v&&i.a.createElement(m.a,{isOpen:f,onBlur:function(){return y(!1)}},(function(e){var t=e.ref;return i.a.createElement("div",{ref:t,className:p.a.unitSelector,role:"button",onClick:h,onKeyDown:g,tabIndex:0},i.a.createElement("span",{className:p.a.currentUnit},o),i.a.createElement(d.a,{icon:"arrow-down-alt2",className:f?p.a.menuChevronOpen:p.a.menuChevron}))}),a.map((function(e){return i.a.createElement(m.c,{key:e,onClick:function(){return l&&l(c,e),void y(!1)}},e)}))),!v&&i.a.createElement("div",{className:p.a.unitStatic},i.a.createElement("span",null,o))))}var v=n(48),h=[{id:"accounts",title:"Accounts",component:l.a},{id:"general",title:"Configuration",groups:[{id:"importing",title:"Import options",fields:[{id:"importerInterval",label:"Check for new posts",component:Object(u.b)((function(e){var t=e.id;return i.a.createElement(s.a,{id:t,width:250,value:c.b.values.importerInterval,options:g.config.cronScheduleOptions,onChange:function(e){return c.b.values.importerInterval=e.value}})}))}]},{id:"cleaner",title:"Optimization",component:function(){return i.a.createElement("div",null,i.a.createElement(v.a,{label:"What is this?",stealth:!0},i.a.createElement("div",null,i.a.createElement("p",null,"Spotlight imports all Instagram posts that can be displayed in your feed, even "," ",'those hidden behind a "Load more" button. The posts furthest down the list may'," ","therefore rarely be seen."),i.a.createElement("p",null,"To improve your site’s performance, you can choose to delete these unseen posts"," ","after a set period of time. Once a site visitor requests those posts, they will"," ","be re-imported."))))},fields:[{id:"cleanerAgeLimit",label:"Delete unseen posts after",component:Object(u.b)((function(e){var t=e.id,n=c.b.values.cleanerAgeLimit.split(" "),r=parseInt(n[0]),o=n[1];return i.a.createElement(y,{id:t,units:["days","hours","minutes"],value:r,unit:o,type:"number",onChange:function(e,t){return c.b.values.cleanerAgeLimit=e+" "+t}})}))},{id:"cleanerInterval",label:"Run optimization",component:Object(u.b)((function(e){var t=e.id;return i.a.createElement(s.a,{id:t,width:250,value:c.b.values.cleanerInterval,options:g.config.cronScheduleOptions,onChange:function(e){return c.b.values.cleanerInterval=e.value}})}))}]}]}],g=t.a={config:{rootId:"spotlight-instagram-admin",adminUrl:SliAdminCommonL10n.adminUrl,restApi:SliAdminCommonL10n.restApi,doOnboarding:"1"==SliAdminCommonL10n.doOnboarding,cronSchedules:SliAdminCommonL10n.cronSchedules,cronScheduleOptions:SliAdminCommonL10n.cronSchedules.map((function(e){return{value:e.key,label:e.display}})),isPro:!1},resources:{upgradeUrl:"https://spotlightwp.com/pro-coming-soon/",proComingSoonUrl:"https://spotlightwp.com/pro-coming-soon/",supportUrl:"https://spotlightwp.com/support/",customPersonalInfoUrl:"https://docs.spotlightwp.com/article/624-custom-profile-photo-and-bio-text",businessAccounts:"https://docs.spotlightwp.com/article/555-how-to-switch-to-a-business-account",accessTokenDocUrl:""},editor:{config:r.a.defaultConfig},restApi:{config:SliAdminCommonL10n.restApi,saveFeed:function(e){return o.a.driver.post("/feeds"+(e.id?"/".concat(e.id):""),{feed:e})},deleteFeed:function(e){return o.a.driver.delete("/feeds/".concat(e))},connectAccount:function(e){return o.a.driver.post("/connect",{accessToken:e})},updateAccount:function(e){return o.a.driver.post("/accounts",e)},deleteAccount:function(e){return o.a.driver.delete("/accounts/".concat(e))},deleteAccountMedia:function(e){return o.a.driver.delete("/account_media/".concat(e))},getSettings:function(){return o.a.driver.get("/settings")},saveSettings:function(e){return o.a.driver.patch("/settings",{settings:e})}},settings:{pages:h}}},70:function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return f}));var r=n(0),o=n.n(r),a=n(266),i=n(138),c=n(103),l=n.n(c),u=n(4),s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{option:function(e,t){return Object.assign(Object.assign({},e),{cursor:"pointer",lineHeight:"24px"})},menu:function(e,t){return Object.assign(Object.assign({},e),{margin:"6px 0",boxShadow:"0 2px 8px "+l.a.shadowColor,overflow:"hidden"})},menuList:function(e,t){return{padding:"0px"}},control:function(e,t){var n=Object.assign(Object.assign({},e),{cursor:"pointer",lineHeight:"2",minHeight:"40px"});return t.isFocused&&(n.borderColor=l.a.primaryColor,n.boxShadow="0 0 0 1px ".concat(l.a.primaryColor)),n},valueContainer:function(e,t){return Object.assign(Object.assign({},e),{paddingTop:0,paddingBottom:0,paddingRight:0})},container:function(t,n){return Object.assign(Object.assign({},t),{width:e.width||"100%"})},multiValue:function(e,t){return Object.assign(Object.assign({},e),{padding:"0 6px"})},input:function(e,t){return Object.assign(Object.assign({},e),{outline:"0 transparent !important",border:"0 transparent !important",boxShadow:"0 0 0 transparent !important"})},indicatorSeparator:function(e,t){return Object.assign(Object.assign({},e),{margin:"0",backgroundColor:"transparent"})}}},f=function(e){var t=e.options.find((function(t){return t.value===e.value}));e=Object.assign(Object.assign({},e),{id:void 0,className:Object(u.b)("react-select",e.className),classNamePrefix:"react-select",inputId:e.id,menuPosition:"fixed"});var n=s(e),r=e.isCreatable?i.a:a.a;return o.a.createElement(r,Object.assign({isSearchable:e.isCreatable},e,{value:t,styles:n,theme:function(e){return Object.assign(Object.assign({},e),{borderRadius:3,colors:Object.assign(Object.assign({},e.colors),{primary:l.a.primaryColor,primary25:l.a.washedColor})})},menuPlacement:"auto",menuShouldScrollIntoView:!0}))}},73:function(e,t,n){e.exports={root:"ConnectAccessToken__root",row:"ConnectAccessToken__row ConnectAccessToken__root",content:"ConnectAccessToken__content",label:"ConnectAccessToken__label",bottom:"ConnectAccessToken__bottom","button-container":"ConnectAccessToken__button-container",buttonContainer:"ConnectAccessToken__button-container",button:"ConnectAccessToken__button","help-message":"ConnectAccessToken__help-message",helpMessage:"ConnectAccessToken__help-message",column:"ConnectAccessToken__column ConnectAccessToken__root"}},74:function(e,t,n){e.exports={root:"UnitField__root layout__flex-row",input:"UnitField__input","unit-container":"UnitField__unit-container layout__flex-column",unitContainer:"UnitField__unit-container layout__flex-column","unit-bubble":"UnitField__unit-bubble",unitBubble:"UnitField__unit-bubble","unit-static":"UnitField__unit-static UnitField__unit-bubble layout__flex-column",unitStatic:"UnitField__unit-static UnitField__unit-bubble layout__flex-column","unit-selector":"UnitField__unit-selector UnitField__unit-bubble layout__flex-row",unitSelector:"UnitField__unit-selector UnitField__unit-bubble layout__flex-row","current-unit":"UnitField__current-unit",currentUnit:"UnitField__current-unit","menu-chevron":"UnitField__menu-chevron",menuChevron:"UnitField__menu-chevron","menu-chevron-open":"UnitField__menu-chevron-open UnitField__menu-chevron",menuChevronOpen:"UnitField__menu-chevron-open UnitField__menu-chevron","unit-list":"UnitField__unit-list layout__flex-column layout__z-highest",unitList:"UnitField__unit-list layout__flex-column layout__z-highest","unit-option":"UnitField__unit-option",unitOption:"UnitField__unit-option","unit-selected":"UnitField__unit-selected UnitField__unit-option",unitSelected:"UnitField__unit-selected UnitField__unit-option"}},87:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"c",(function(){return p})),n.d(t,"b",(function(){return m})),n.d(t,"d",(function(){return d}));var r=n(0),o=n.n(r),a=n(85),i=n(196),c=n(197),l=n(18),u=n(7),s=(n(504),function(e){var t=e.children,n=e.className,s=e.isOpen,p=e.onBlur,m=e.placement,d=e.modifiers,b=e.useVisibility;m=null!=m?m:"bottom-end",b=null!=b&&b;var y=o.a.useRef(),v=s||b,h=!s&&b,g=Object.assign({preventOverflow:{boundariesElement:document.getElementById(u.a.config.rootId),padding:5}},d),_=function(){p()},E=function(e){switch(e.key){case"ArrowDown":break;case"Escape":_();break;default:return}e.preventDefault(),e.stopPropagation()};return Object(l.b)(y,_,[y]),Object(r.useEffect)((function(){if(y.current&&s){var e=function(){document.activeElement===y.current||y.current.contains(document.activeElement)||_()};return document.addEventListener("keyup",e),function(){return document.removeEventListener("keyup",e)}}}),[y,s]),o.a.createElement("div",{ref:y,className:"menu__ref"},o.a.createElement(a.c,null,o.a.createElement(i.a,null,(function(e){return t[0](e)})),o.a.createElement(c.a,{placement:m,positionFixed:!0,modifiers:g},(function(e){var r=e.ref,a=e.style,i=e.placement;return v?o.a.createElement("div",{ref:r,className:"menu",style:f(a,h),"data-placement":i,onKeyDown:E},o.a.createElement("div",{className:"menu__container"+(n?" "+n:"")},t[1])):null}))))});function f(e,t){return Object.assign(Object.assign({},e),{opacity:1,pointerEvents:"all",visibility:t?"hidden":"visible"})}var p=function(e){var t=e.children,n=e.onClick;return o.a.createElement("div",{className:"menu__item"},o.a.createElement("button",{onClick:n},t))},m=function(e){return e.children},d=function(e){var t=e.children;return o.a.createElement("div",{className:"menu__static"},t)}},95:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(0),o=n.n(r),a=n(153),i=n.n(a),c=n(29),l=n(3);function u(e){var t=e.children,n=e.title,r=e.buttons,a=e.onAccept,u=e.onCancel,s=e.isOpen;r=null!=r?r:["OK","Cancel"];var f=function(){return u&&u()};return o.a.createElement(c.a,{isOpen:s,title:n,onClose:f,className:i.a.root},o.a.createElement(c.a.Content,null,"string"==typeof t?o.a.createElement("p",null,t):t),o.a.createElement(c.a.Footer,null,o.a.createElement(l.a,{className:i.a.button,type:l.c.SECONDARY,onClick:f},r[1]),o.a.createElement(l.a,{className:i.a.button,type:l.c.PRIMARY,onClick:function(){return a&&a()}},r[0])))}},96:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0),o=n.n(r);function a(e){return o.a.createElement("p",null,e.message)}},97:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(193),o=n.n(r),a=n(0),i=n.n(a),c=n(2),l=n(3),u=n(4),s=Object(c.b)((function(e){var t=e.className,n=e.content,r=e.tooltip,a=e.onClick,c=e.disabled,s=e.isSaving;return n=null!=n?n:function(e){return e?"Saving ...":"Save"},r=null!=r?r:"Save",i.a.createElement(l.a,{className:Object(u.b)(o.a.root,t),type:l.c.PRIMARY,size:l.b.LARGE,tooltip:r,onClick:function(){return a&&a()},disabled:c},s&&i.a.createElement("div",{className:o.a.savingOverlay}),n(s))}))}}]);
ui/dist/assets/grid.png ADDED
Binary file
ui/dist/assets/ig-type-sprites.png ADDED
Binary file
ui/dist/assets/spotlight-200w.png ADDED
Binary file
ui/dist/assets/spotlight-800w.png ADDED
Binary file
ui/dist/assets/widget.png ADDED
Binary file
ui/dist/common.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! For license information please see common.js.LICENSE.txt */
2
+ (window.webpackJsonpspotlight=window.webpackJsonpspotlight||[]).push([[0],[function(e,t,n){"use strict";e.exports=n(289)},function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return S})),n.d(t,"b",(function(){return Re})),n.d(t,"c",(function(){return ye})),n.d(t,"d",(function(){return de})),n.d(t,"e",(function(){return fe})),n.d(t,"f",(function(){return qe})),n.d(t,"g",(function(){return Qe})),n.d(t,"h",(function(){return te})),n.d(t,"i",(function(){return rt})),n.d(t,"j",(function(){return P})),n.d(t,"k",(function(){return ut})),n.d(t,"l",(function(){return Tt})),n.d(t,"m",(function(){return Dt})),n.d(t,"n",(function(){return Vt})),n.d(t,"o",(function(){return X})),n.d(t,"p",(function(){return et})),n.d(t,"q",(function(){return Xe})),n.d(t,"r",(function(){return We})),n.d(t,"s",(function(){return dt})),n.d(t,"t",(function(){return le}));var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function l(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e}var s=[];Object.freeze(s);var c={};function f(){return++je.mobxGuid}function d(e){throw p(!1,e),"X"}function p(e,t){if(!e)throw new Error("[mobx] "+(t||"An invariant failed, however the error is obfuscated because this is a production build."))}function h(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}Object.freeze(c);var v=function(){};function m(e){return null!==e&&"object"==typeof e}function b(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function g(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function y(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return m(e)&&!0===e[n]}}function w(e){return e instanceof Map}function x(e){return e instanceof Set}function E(e){var t=new Set;for(var n in e)t.add(n);return Object.getOwnPropertySymbols(e).forEach((function(n){Object.getOwnPropertyDescriptor(e,n).enumerable&&t.add(n)})),Array.from(t)}function _(e){return e&&e.toString?e.toString():new String(e).toString()}function O(e){return null===e?null:"object"==typeof e?""+e:e}var S=Symbol("mobx administration"),C=function(){function e(e){void 0===e&&(e="Atom@"+f()),this.name=e,this.isPendingUnobservation=!1,this.isBeingObserved=!1,this.observers=new Set,this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=Q.NOT_TRACKING}return e.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(e){return e()}))},e.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(e){return e()}))},e.prototype.reportObserved=function(){return Ne(this)},e.prototype.reportChanged=function(){Le(),function(e){e.lowestObserverState!==Q.STALE&&(e.lowestObserverState=Q.STALE,e.observers.forEach((function(t){t.dependenciesState===Q.UP_TO_DATE&&(t.isTracing!==J.NONE&&Ie(t,e),t.onBecomeStale()),t.dependenciesState=Q.STALE})))}(this),Fe()},e.prototype.toString=function(){return this.name},e}(),k=y("Atom",C);function P(e,t,n){void 0===t&&(t=v),void 0===n&&(n=v);var r=new C(e);return t!==v&&nt("onBecomeObserved",r,t,void 0),n!==v&&tt(r,n),r}var T={identity:function(e,t){return e===t},structural:function(e,t){return Gt(e,t)},default:function(e,t){return Object.is(e,t)},shallow:function(e,t){return Gt(e,t,1)}},j=Symbol("mobx did run lazy initializers"),A=Symbol("mobx pending decorators"),M={},D={};function L(e,t){var n=t?M:D;return n[e]||(n[e]={configurable:!0,enumerable:t,get:function(){return F(this),this[e]},set:function(t){F(this),this[e]=t}})}function F(e){var t,n;if(!0!==e[j]){var r=e[A];if(r){g(e,j,!0);var o=l(Object.getOwnPropertySymbols(r),Object.keys(r));try{for(var i=a(o),u=i.next();!u.done;u=i.next()){var s=r[u.value];s.propertyCreator(e,s.prop,s.descriptor,s.decoratorTarget,s.decoratorArguments)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}}}function N(e,t){return function(){var n,r=function(r,o,a,u){if(!0===u)return t(r,o,a,r,n),null;if(!Object.prototype.hasOwnProperty.call(r,A)){var l=r[A];g(r,A,i({},l))}return r[A][o]={prop:o,propertyCreator:t,descriptor:a,decoratorTarget:r,decoratorArguments:n},L(o,e)};return I(arguments)?(n=s,r.apply(null,arguments)):(n=Array.prototype.slice.call(arguments),r)}}function I(e){return(2===e.length||3===e.length)&&("string"==typeof e[1]||"symbol"==typeof e[1])||4===e.length&&!0===e[3]}function R(e,t,n){return ct(e)?e:Array.isArray(e)?X.array(e,{name:n}):b(e)?X.object(e,void 0,{name:n}):w(e)?X.map(e,{name:n}):x(e)?X.set(e,{name:n}):e}function B(e){return e}function U(t){p(t);var n=N(!0,(function(e,n,r,o,i){var a=r?r.initializer?r.initializer.call(e):r.value:void 0;Rt(e).addObservableProp(n,a,t)})),r=(void 0!==e&&e.env,n);return r.enhancer=t,r}var H={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};function z(e){return null==e?H:"string"==typeof e?{name:e,deep:!0,proxy:!0}:e}Object.freeze(H);var V=U(R),W=U((function(e,t,n){return null==e||Vt(e)||Tt(e)||Dt(e)||Nt(e)?e:Array.isArray(e)?X.array(e,{name:n,deep:!1}):b(e)?X.object(e,void 0,{name:n,deep:!1}):w(e)?X.map(e,{name:n,deep:!1}):x(e)?X.set(e,{name:n,deep:!1}):d(!1)})),$=U(B),G=U((function(e,t,n){return Gt(e,t)?t:e}));function Y(e){return e.defaultDecorator?e.defaultDecorator.enhancer:!1===e.deep?B:R}var q={box:function(e,t){arguments.length>2&&K("box");var n=z(t);return new Ee(e,Y(n),n.name,!0,n.equals)},array:function(e,t){arguments.length>2&&K("array");var n=z(t);return Ot(e,Y(n),n.name)},map:function(e,t){arguments.length>2&&K("map");var n=z(t);return new Mt(e,Y(n),n.name)},set:function(e,t){arguments.length>2&&K("set");var n=z(t);return new Ft(e,Y(n),n.name)},object:function(e,t,n){"string"==typeof arguments[1]&&K("object");var r=z(n);if(!1===r.proxy)return ot({},e,t,r);var o=it(r),i=ot({},void 0,void 0,r),a=mt(i);return at(a,e,t,o),a},ref:$,shallow:W,deep:V,struct:G},X=function(e,t,n){if("string"==typeof arguments[1]||"symbol"==typeof arguments[1])return V.apply(null,arguments);if(ct(e))return e;var r=b(e)?X.object(e,t,n):Array.isArray(e)?X.array(e,t):w(e)?X.map(e,t):x(e)?X.set(e,t):e;if(r!==e)return r;d(!1)};function K(e){d("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}Object.keys(q).forEach((function(e){return X[e]=q[e]}));var Q,J,Z=N(!1,(function(e,t,n,r,o){var a=n.get,u=n.set,l=o[0]||{};Rt(e).addComputedProp(e,t,i({get:a,set:u,context:e},l))})),ee=Z({equals:T.structural}),te=function(e,t,n){if("string"==typeof t)return Z.apply(null,arguments);if(null!==e&&"object"==typeof e&&1===arguments.length)return Z.apply(null,arguments);var r="object"==typeof t?t:{};return r.get=e,r.set="function"==typeof t?t:r.set,r.name=r.name||e.name||"",new _e(r)};te.struct=ee,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(Q||(Q={})),function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(J||(J={}));var ne=function(e){this.cause=e};function re(e){return e instanceof ne}function oe(e){switch(e.dependenciesState){case Q.UP_TO_DATE:return!1;case Q.NOT_TRACKING:case Q.STALE:return!0;case Q.POSSIBLY_STALE:for(var t=fe(!0),n=se(),r=e.observing,o=r.length,i=0;i<o;i++){var a=r[i];if(Oe(a)){if(je.disableErrorBoundaries)a.get();else try{a.get()}catch(e){return ce(n),de(t),!0}if(e.dependenciesState===Q.STALE)return ce(n),de(t),!0}}return pe(e),ce(n),de(t),!1}}function ie(e){var t=e.observers.size>0;je.computationDepth>0&&t&&d(!1),je.allowStateChanges||!t&&"strict"!==je.enforceActions||d(!1)}function ae(e,t,n){var r=fe(!0);pe(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++je.runId;var o,i=je.trackingDerivation;if(je.trackingDerivation=e,!0===je.disableErrorBoundaries)o=t.call(n);else try{o=t.call(n)}catch(e){o=new ne(e)}return je.trackingDerivation=i,function(e){for(var t=e.observing,n=e.observing=e.newObserving,r=Q.UP_TO_DATE,o=0,i=e.unboundDepsCount,a=0;a<i;a++)0===(u=n[a]).diffValue&&(u.diffValue=1,o!==a&&(n[o]=u),o++),u.dependenciesState>r&&(r=u.dependenciesState);for(n.length=o,e.newObserving=null,i=t.length;i--;)0===(u=t[i]).diffValue&&Me(u,e),u.diffValue=0;for(;o--;){var u;1===(u=n[o]).diffValue&&(u.diffValue=0,Ae(u,e))}r!==Q.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}(e),de(r),o}function ue(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Me(t[n],e);e.dependenciesState=Q.NOT_TRACKING}function le(e){var t=se();try{return e()}finally{ce(t)}}function se(){var e=je.trackingDerivation;return je.trackingDerivation=null,e}function ce(e){je.trackingDerivation=e}function fe(e){var t=je.allowStateReads;return je.allowStateReads=e,t}function de(e){je.allowStateReads=e}function pe(e){if(e.dependenciesState!==Q.UP_TO_DATE){e.dependenciesState=Q.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=Q.UP_TO_DATE}}var he=0,ve=1,me=Object.getOwnPropertyDescriptor((function(){}),"name");function be(e,t,n){var r=function(){return ge(0,t,n||this,arguments)};return r.isMobxAction=!0,r}function ge(e,t,n,r){var o=function(e,t,n){var r=se();Le();var o={prevDerivation:r,prevAllowStateChanges:we(!0),prevAllowStateReads:fe(!0),notifySpy:!1,startTime:0,actionId:ve++,parentActionId:he};return he=o.actionId,o}();try{return t.apply(n,r)}catch(e){throw o.error=e,e}finally{!function(e){he!==e.actionId&&d("invalid action stack. did you forget to finish an action?"),he=e.parentActionId,void 0!==e.error&&(je.suppressReactionErrors=!0),xe(e.prevAllowStateChanges),de(e.prevAllowStateReads),Fe(),ce(e.prevDerivation),e.notifySpy,je.suppressReactionErrors=!1}(o)}}function ye(e,t){var n,r=we(e);try{n=t()}finally{xe(r)}return n}function we(e){var t=je.allowStateChanges;return je.allowStateChanges=e,t}function xe(e){je.allowStateChanges=e}me&&me.configurable;var Ee=function(e){function t(t,n,r,o,i){void 0===r&&(r="ObservableValue@"+f()),void 0===o&&(o=!0),void 0===i&&(i=T.default);var a=e.call(this,r)||this;return a.enhancer=n,a.name=r,a.equals=i,a.hasUnreportedChange=!1,a.value=n(t,void 0,r),a}return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.prototype.set=function(e){this.value,(e=this.prepareNewValue(e))!==je.UNCHANGED&&this.setNewValue(e)},t.prototype.prepareNewValue=function(e){if(ie(this),bt(this)){var t=yt(this,{object:this,type:"update",newValue:e});if(!t)return je.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value,this.name),this.equals(this.value,e)?je.UNCHANGED:e},t.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),wt(this)&&Et(this,{type:"update",object:this,newValue:e,oldValue:t})},t.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},t.prototype.intercept=function(e){return gt(this,e)},t.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),xt(this,e)},t.prototype.toJSON=function(){return this.get()},t.prototype.toString=function(){return this.name+"["+this.value+"]"},t.prototype.valueOf=function(){return O(this.get())},t.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},t}(C),_e=(y("ObservableValue",Ee),function(){function e(e){this.dependenciesState=Q.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isBeingObserved=!1,this.isPendingUnobservation=!1,this.observers=new Set,this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=Q.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+f(),this.value=new ne(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=J.NONE,p(e.get,"missing option for computed: get"),this.derivation=e.get,this.name=e.name||"ComputedValue@"+f(),e.set&&(this.setter=be(this.name,e.set)),this.equals=e.equals||(e.compareStructural||e.struct?T.structural:T.default),this.scope=e.context,this.requiresReaction=!!e.requiresReaction,this.keepAlive=!!e.keepAlive}return e.prototype.onBecomeStale=function(){!function(e){e.lowestObserverState===Q.UP_TO_DATE&&(e.lowestObserverState=Q.POSSIBLY_STALE,e.observers.forEach((function(t){t.dependenciesState===Q.UP_TO_DATE&&(t.dependenciesState=Q.POSSIBLY_STALE,t.isTracing!==J.NONE&&Ie(t,e),t.onBecomeStale())})))}(this)},e.prototype.onBecomeObserved=function(){this.onBecomeObservedListeners&&this.onBecomeObservedListeners.forEach((function(e){return e()}))},e.prototype.onBecomeUnobserved=function(){this.onBecomeUnobservedListeners&&this.onBecomeUnobservedListeners.forEach((function(e){return e()}))},e.prototype.get=function(){this.isComputing&&d("Cycle detected in computation "+this.name+": "+this.derivation),0!==je.inBatch||0!==this.observers.size||this.keepAlive?(Ne(this),oe(this)&&this.trackAndCompute()&&function(e){e.lowestObserverState!==Q.STALE&&(e.lowestObserverState=Q.STALE,e.observers.forEach((function(t){t.dependenciesState===Q.POSSIBLY_STALE?t.dependenciesState=Q.STALE:t.dependenciesState===Q.UP_TO_DATE&&(e.lowestObserverState=Q.UP_TO_DATE)})))}(this)):oe(this)&&(this.warnAboutUntrackedRead(),Le(),this.value=this.computeValue(!1),Fe());var e=this.value;if(re(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(re(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){p(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else p(!1,!1)},e.prototype.trackAndCompute=function(){var e=this.value,t=this.dependenciesState===Q.NOT_TRACKING,n=this.computeValue(!0),r=t||re(e)||re(n)||!this.equals(e,n);return r&&(this.value=n),r},e.prototype.computeValue=function(e){var t;if(this.isComputing=!0,je.computationDepth++,e)t=ae(this,this.derivation,this.scope);else if(!0===je.disableErrorBoundaries)t=this.derivation.call(this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new ne(e)}return je.computationDepth--,this.isComputing=!1,t},e.prototype.suspend=function(){this.keepAlive||(ue(this),this.value=void 0)},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return Qe((function(){var i=n.get();if(!r||t){var a=se();e({type:"update",object:n,newValue:i,oldValue:o}),ce(a)}r=!1,o=i}))},e.prototype.warnAboutUntrackedRead=function(){},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return O(this.get())},e.prototype[Symbol.toPrimitive]=function(){return this.valueOf()},e}()),Oe=y("ComputedValue",_e),Se=function(){this.version=5,this.UNCHANGED={},this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.allowStateReads=!0,this.enforceActions=!1,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.computedConfigurable=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1},Ce={};function ke(){return"undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:Ce}var Pe=!0,Te=!1,je=function(){var e=ke();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Pe=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new Se).version&&(Pe=!1),Pe?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Se):(setTimeout((function(){Te||d("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`")}),1),new Se)}();function Ae(e,t){e.observers.add(t),e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Me(e,t){e.observers.delete(t),0===e.observers.size&&De(e)}function De(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,je.pendingUnobservations.push(e))}function Le(){je.inBatch++}function Fe(){if(0==--je.inBatch){Ue();for(var e=je.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.size&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBecomeUnobserved()),n instanceof _e&&n.suspend())}je.pendingUnobservations=[]}}function Ne(e){var t=je.trackingDerivation;return null!==t?(t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e,e.isBeingObserved||(e.isBeingObserved=!0,e.onBecomeObserved())),!0):(0===e.observers.size&&je.inBatch>0&&De(e),!1)}function Ie(e,t){if(e.isTracing===J.BREAK){var n=[];!function e(t,n,r){n.length>=1e3?n.push("(and many more)"):(n.push(""+new Array(r).join("\t")+t.name),t.dependencies&&t.dependencies.forEach((function(t){return e(t,n,r+1)})))}(ut(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof _e?e.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}var Re=function(){function e(e,t,n,r){void 0===e&&(e="Reaction@"+f()),void 0===r&&(r=!1),this.name=e,this.onInvalidate=t,this.errorHandler=n,this.requiresObservable=r,this.observing=[],this.newObserving=[],this.dependenciesState=Q.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+f(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=J.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,je.pendingReactions.push(this),Ue())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){if(!this.isDisposed){if(Le(),this._isScheduled=!1,oe(this)){this._isTrackPending=!0;try{this.onInvalidate(),this._isTrackPending}catch(e){this.reportExceptionInDerivation(e)}}Fe()}},e.prototype.track=function(e){if(!this.isDisposed){Le(),this._isRunning=!0;var t=ae(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&ue(this),re(t)&&this.reportExceptionInDerivation(t.cause),Fe()}},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)this.errorHandler(e,this);else{if(je.disableErrorBoundaries)throw e;je.suppressReactionErrors,je.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Le(),ue(this),Fe()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e[S]=this,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.trace=function(e){void 0===e&&(e=!1),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=!1;"boolean"==typeof e[e.length-1]&&(n=e.pop());var r=ft(e);if(!r)return d(!1);r.isTracing,J.NONE,r.isTracing=n?J.BREAK:J.LOG}(this,e)},e}(),Be=function(e){return e()};function Ue(){je.inBatch>0||je.isRunningReactions||Be(He)}function He(){je.isRunningReactions=!0;for(var e=je.pendingReactions,t=0;e.length>0;){100==++t&&e.splice(0);for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction()}je.isRunningReactions=!1}var ze=y("Reaction",Re);function Ve(e){var t=Be;Be=function(n){return e((function(){return t(n)}))}}function We(e){return function(){}}function $e(){d(!1)}function Ge(e){return function(t,n,r){if(r){if(r.value)return{value:be(0,r.value),enumerable:!1,configurable:!0,writable:!0};var o=r.initializer;return{enumerable:!1,configurable:!0,writable:!0,initializer:function(){return be(0,o.call(this))}}}return Ye(e).apply(this,arguments)}}function Ye(e){return function(t,n,r){Object.defineProperty(t,n,{configurable:!0,enumerable:!1,get:function(){},set:function(t){g(this,n,qe(e,t))}})}}var qe=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?be(e.name,e):2===arguments.length&&"function"==typeof t?be(0,t):1===arguments.length&&"string"==typeof e?Ge(e):!0!==r?Ge(t).apply(null,arguments):void g(e,t,be(e.name,n.value,this))};function Xe(e,t){return"string"==typeof e||e.name,ge(0,"function"==typeof e?e:t,this,void 0)}function Ke(e,t,n){g(e,t,be(0,n.bind(e)))}function Qe(e,t){void 0===t&&(t=c);var n,r=t&&t.name||e.name||"Autorun@"+f();if(t.scheduler||t.delay){var o=Ze(t),i=!1;n=new Re(r,(function(){i||(i=!0,o((function(){i=!1,n.isDisposed||n.track(a)})))}),t.onError,t.requiresObservable)}else n=new Re(r,(function(){this.track(a)}),t.onError,t.requiresObservable);function a(){e(n)}return n.schedule(),n.getDisposer()}qe.bound=function(e,t,n,r){return!0===r?(Ke(e,t,n.value),null):n?{configurable:!0,enumerable:!1,get:function(){return Ke(this,t,n.value||n.initializer.call(this)),this[t]},set:$e}:{enumerable:!1,configurable:!0,set:function(e){Ke(this,t,e)},get:function(){}}};var Je=function(e){return e()};function Ze(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Je}function et(e,t,n){void 0===n&&(n=c);var r,o,i,a=n.name||"Reaction@"+f(),u=qe(a,n.onError?(r=n.onError,o=t,function(){try{return o.apply(this,arguments)}catch(e){r.call(this,e)}}):t),l=!n.scheduler&&!n.delay,s=Ze(n),d=!0,p=!1,h=n.compareStructural?T.structural:n.equals||T.default,v=new Re(a,(function(){d||l?m():p||(p=!0,s(m))}),n.onError,n.requiresObservable);function m(){if(p=!1,!v.isDisposed){var t=!1;v.track((function(){var n=e(v);t=d||!h(i,n),i=n})),d&&n.fireImmediately&&u(i,v),d||!0!==t||u(i,v),d&&(d=!1)}}return v.schedule(),v.getDisposer()}function tt(e,t,n){return nt("onBecomeUnobserved",e,t,n)}function nt(e,t,n,r){var o="function"==typeof r?Wt(t,n):Wt(t),i="function"==typeof r?r:n,a=e+"Listeners";return o[a]?o[a].add(i):o[a]=new Set([i]),"function"!=typeof o[e]?d(!1):function(){var e=o[a];e&&(e.delete(i),0===e.size&&delete o[a])}}function rt(e){var t=e.enforceActions,n=e.computedRequiresReaction,r=e.computedConfigurable,o=e.disableErrorBoundaries,i=e.reactionScheduler,a=e.reactionRequiresObservable,u=e.observableRequiresReaction;if(!0===e.isolateGlobalState&&((je.pendingReactions.length||je.inBatch||je.isRunningReactions)&&d("isolateGlobalState should be called before MobX is running any reactions"),Te=!0,Pe&&(0==--ke().__mobxInstanceCount&&(ke().__mobxGlobals=void 0),je=new Se)),void 0!==t){var l=void 0;switch(t){case!0:case"observed":l=!0;break;case!1:case"never":l=!1;break;case"strict":case"always":l="strict";break;default:d("Invalid value for 'enforceActions': '"+t+"', expected 'never', 'always' or 'observed'")}je.enforceActions=l,je.allowStateChanges=!0!==l&&"strict"!==l}void 0!==n&&(je.computedRequiresReaction=!!n),void 0!==a&&(je.reactionRequiresObservable=!!a),void 0!==u&&(je.observableRequiresReaction=!!u,je.allowStateReads=!je.observableRequiresReaction),void 0!==r&&(je.computedConfigurable=!!r),void 0!==o&&(je.disableErrorBoundaries=!!o),i&&Ve(i)}function ot(e,t,n,r){var o=it(r=z(r));return F(e),Rt(e,r.name,o.enhancer),t&&at(e,t,n,o),e}function it(e){return e.defaultDecorator||(!1===e.deep?$:V)}function at(e,t,n,r){var o,i;Le();try{var u=E(t);try{for(var l=a(u),s=l.next();!s.done;s=l.next()){var c=s.value,f=Object.getOwnPropertyDescriptor(t,c),d=(n&&c in n?n[c]:f.get?Z:r)(e,c,f,!0);d&&Object.defineProperty(e,c,d)}}catch(e){o={error:e}}finally{try{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}}finally{Fe()}}function ut(e,t){return lt(Wt(e,t))}function lt(e){var t,n,r={name:e.name};return e.observing&&e.observing.length>0&&(r.dependencies=(t=e.observing,n=[],t.forEach((function(e){-1===n.indexOf(e)&&n.push(e)})),n).map(lt)),r}function st(e,t){return null!=e&&(void 0!==t?!!Vt(e)&&e[S].values.has(t):Vt(e)||!!e[S]||k(e)||ze(e)||Oe(e))}function ct(e){return 1!==arguments.length&&d(!1),st(e)}function ft(e){switch(e.length){case 0:return je.trackingDerivation;case 1:return Wt(e[0]);case 2:return Wt(e[0],e[1])}}function dt(e,t){void 0===t&&(t=void 0),Le();try{return e.apply(t)}finally{Fe()}}function pt(e){return e[S]}function ht(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e}Object.create(Error.prototype);var vt={has:function(e,t){if(t===S||"constructor"===t||t===j)return!0;var n=pt(e);return ht(t)?n.has(t):t in e},get:function(e,t){if(t===S||"constructor"===t||t===j)return e[t];var n=pt(e),r=n.values.get(t);if(r instanceof C){var o=r.get();return void 0===o&&n.has(t),o}return ht(t)&&n.has(t),e[t]},set:function(e,t,n){return!!ht(t)&&(function e(t,n,r){if(2!==arguments.length||Nt(t))if(Vt(t)){var o=t[S],i=o.values.get(n);i?o.write(n,r):o.addObservableProp(n,r,o.defaultEnhancer)}else if(Dt(t))t.set(n,r);else if(Nt(t))t.add(n);else{if(!Tt(t))return d(!1);"number"!=typeof n&&(n=parseInt(n,10)),p(n>=0,"Not a valid index: '"+n+"'"),Le(),n>=t.length&&(t.length=n+1),t[n]=r,Fe()}else{Le();var a=n;try{for(var u in a)e(t,u,a[u])}finally{Fe()}}}(e,t,n),!0)},deleteProperty:function(e,t){return!!ht(t)&&(pt(e).remove(t),!0)},ownKeys:function(e){return pt(e).keysAtom.reportObserved(),Reflect.ownKeys(e)},preventExtensions:function(e){return d("Dynamic observable objects cannot be frozen"),!1}};function mt(e){var t=new Proxy(e,vt);return e[S].proxy=t,t}function bt(e){return void 0!==e.interceptors&&e.interceptors.length>0}function gt(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),h((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function yt(e,t){var n=se();try{for(var r=l(e.interceptors||[]),o=0,i=r.length;o<i&&(p(!(t=r[o](t))||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{ce(n)}}function wt(e){return void 0!==e.changeListeners&&e.changeListeners.length>0}function xt(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),h((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function Et(e,t){var n=se(),r=e.changeListeners;if(r){for(var o=0,i=(r=r.slice()).length;o<i;o++)r[o](t);ce(n)}}var _t={get:function(e,t){return t===S?e[S]:"length"===t?e[S].getArrayLength():"number"==typeof t?Ct.get.call(e,t):"string"!=typeof t||isNaN(t)?Ct.hasOwnProperty(t)?Ct[t]:e[t]:Ct.get.call(e,parseInt(t))},set:function(e,t,n){return"length"===t&&e[S].setArrayLength(n),"number"==typeof t&&Ct.set.call(e,t,n),"symbol"==typeof t||isNaN(t)?e[t]=n:Ct.set.call(e,parseInt(t),n),!0},preventExtensions:function(e){return d("Observable arrays cannot be frozen"),!1}};function Ot(e,t,n,r){void 0===n&&(n="ObservableArray@"+f()),void 0===r&&(r=!1);var o,i,a,u=new St(n,t,r);o=u.values,i=S,a=u,Object.defineProperty(o,i,{enumerable:!1,writable:!1,configurable:!0,value:a});var l=new Proxy(u.values,_t);if(u.proxy=l,e&&e.length){var s=we(!0);u.spliceWithArray(0,0,e),xe(s)}return l}var St=function(){function e(e,t,n){this.owned=n,this.values=[],this.proxy=void 0,this.lastKnownLength=0,this.atom=new C(e||"ObservableArray@"+f()),this.enhancer=function(n,r){return t(n,r,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer&&e.length>0?e.map(this.dehancer):e},e.prototype.intercept=function(e){return gt(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.proxy,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),xt(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray(t,0,n)}else this.spliceWithArray(e,t-e)},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed.");this.lastKnownLength+=t},e.prototype.spliceWithArray=function(e,t,n){var r=this;ie(this.atom);var o=this.values.length;if(void 0===e?e=0:e>o?e=o:e<0&&(e=Math.max(0,o+e)),t=1===arguments.length?o-e:null==t?0:Math.max(0,Math.min(t,o-e)),void 0===n&&(n=s),bt(this)){var i=yt(this,{object:this.proxy,type:"splice",index:e,removedCount:t,added:n});if(!i)return s;t=i.removedCount,n=i.added}n=0===n.length?n:n.map((function(e){return r.enhancer(e,void 0)}));var a=this.spliceItemsIntoValues(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice(e,n,a),this.dehanceValues(a)},e.prototype.spliceItemsIntoValues=function(e,t,n){var r;if(n.length<1e4)return(r=this.values).splice.apply(r,l([e,t],n));var o=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),o},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&!1,o=wt(this),i=o||r?{object:this.proxy,type:"update",index:e,newValue:t,oldValue:n}:null;this.atom.reportChanged(),o&&Et(this,i)},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&!1,o=wt(this),i=o||r?{object:this.proxy,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.atom.reportChanged(),o&&Et(this,i)},e}(),Ct={intercept:function(e){return this[S].intercept(e)},observe:function(e,t){return void 0===t&&(t=!1),this[S].observe(e,t)},clear:function(){return this.splice(0)},replace:function(e){var t=this[S];return t.spliceWithArray(0,t.values.length,e)},toJS:function(){return this.slice()},toJSON:function(){return this.toJS()},splice:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this[S];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray(e);case 2:return o.spliceWithArray(e,t)}return o.spliceWithArray(e,t,n)},spliceWithArray:function(e,t,n){return this[S].spliceWithArray(e,t,n)},push:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this[S];return n.spliceWithArray(n.values.length,0,e),n.values.length},pop:function(){return this.splice(Math.max(this[S].values.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this[S];return n.spliceWithArray(0,0,e),n.values.length},reverse:function(){var e=this.slice();return e.reverse.apply(e,arguments)},sort:function(e){var t=this.slice();return t.sort.apply(t,arguments)},remove:function(e){var t=this[S],n=t.dehanceValues(t.values).indexOf(e);return n>-1&&(this.splice(n,1),!0)},get:function(e){var t=this[S];if(t&&e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e])},set:function(e,t){var n=this[S],r=n.values;if(e<r.length){ie(n.atom);var o=r[e];if(bt(n)){var i=yt(n,{type:"update",object:n.proxy,index:e,newValue:t});if(!i)return;t=i.newValue}(t=n.enhancer(t,o))!==o&&(r[e]=t,n.notifyArrayChildUpdate(e,t,o))}else{if(e!==r.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+r.length);n.spliceWithArray(e,0,[t])}}};["concat","every","filter","forEach","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toString","toLocaleString"].forEach((function(e){Ct[e]=function(){var t=this[S];t.atom.reportObserved();var n=t.dehanceValues(t.values);return n[e].apply(n,arguments)}}));var kt,Pt=y("ObservableArrayAdministration",St);function Tt(e){return m(e)&&Pt(e[S])}var jt,At={},Mt=function(){function e(e,t,n){if(void 0===t&&(t=R),void 0===n&&(n="ObservableMap@"+f()),this.enhancer=t,this.name=n,this[kt]=At,this._keysAtom=P(this.name+".keys()"),this[Symbol.toStringTag]="Map","function"!=typeof Map)throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js");this._data=new Map,this._hasMap=new Map,this.merge(e)}return e.prototype._has=function(e){return this._data.has(e)},e.prototype.has=function(e){var t=this;if(!je.trackingDerivation)return this._has(e);var n=this._hasMap.get(e);if(!n){var r=n=new Ee(this._has(e),B,this.name+"."+_(e)+"?",!1);this._hasMap.set(e,r),tt(r,(function(){return t._hasMap.delete(e)}))}return n.get()},e.prototype.set=function(e,t){var n=this._has(e);if(bt(this)){var r=yt(this,{type:n?"update":"add",object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this._updateValue(e,t):this._addValue(e,t),this},e.prototype.delete=function(e){var t=this;if(bt(this)&&!(r=yt(this,{type:"delete",object:this,name:e})))return!1;if(this._has(e)){var n=wt(this),r=n?{type:"delete",object:this,oldValue:this._data.get(e).value,name:e}:null;return dt((function(){t._keysAtom.reportChanged(),t._updateHasMapEntry(e,!1),t._data.get(e).setNewValue(void 0),t._data.delete(e)})),n&&Et(this,r),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap.get(e);n&&n.setNewValue(t)},e.prototype._updateValue=function(e,t){var n=this._data.get(e);if((t=n.prepareNewValue(t))!==je.UNCHANGED){var r=wt(this),o=r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;n.setNewValue(t),r&&Et(this,o)}},e.prototype._addValue=function(e,t){var n=this;ie(this._keysAtom),dt((function(){var r=new Ee(t,n.enhancer,n.name+"."+_(e),!1);n._data.set(e,r),t=r.value,n._updateHasMapEntry(e,!0),n._keysAtom.reportChanged()}));var r=wt(this);r&&Et(this,r?{type:"add",object:this,name:e,newValue:t}:null)},e.prototype.get=function(e){return this.has(e)?this.dehanceValue(this._data.get(e).get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return this._keysAtom.reportObserved(),this._data.keys()},e.prototype.values=function(){var e=this,t=0,n=Array.from(this.keys());return Xt({next:function(){return t<n.length?{value:e.get(n[t++]),done:!1}:{done:!0}}})},e.prototype.entries=function(){var e=this,t=0,n=Array.from(this.keys());return Xt({next:function(){if(t<n.length){var r=n[t++];return{value:[r,e.get(r)],done:!1}}return{done:!0}}})},e.prototype[(kt=S,Symbol.iterator)]=function(){return this.entries()},e.prototype.forEach=function(e,t){var n,r;try{for(var o=a(this),i=o.next();!i.done;i=o.next()){var l=u(i.value,2),s=l[0],c=l[1];e.call(t,c,s,this)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e.prototype.merge=function(e){var t=this;return Dt(e)&&(e=e.toJS()),dt((function(){b(e)?E(e).forEach((function(n){return t.set(n,e[n])})):Array.isArray(e)?e.forEach((function(e){var n=u(e,2),r=n[0],o=n[1];return t.set(r,o)})):w(e)?(e.constructor!==Map&&d("Cannot initialize from classes that inherit from Map: "+e.constructor.name),e.forEach((function(e,n){return t.set(n,e)}))):null!=e&&d("Cannot initialize map from "+e)})),this},e.prototype.clear=function(){var e=this;dt((function(){le((function(){var t,n;try{for(var r=a(e.keys()),o=r.next();!o.done;o=r.next()){var i=o.value;e.delete(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}))}))},e.prototype.replace=function(e){var t=this;return dt((function(){var n,r=b(n=e)?Object.keys(n):Array.isArray(n)?n.map((function(e){return u(e,1)[0]})):w(n)||Dt(n)?Array.from(n.keys()):d("Cannot get keys from '"+n+"'");Array.from(t.keys()).filter((function(e){return-1===r.indexOf(e)})).forEach((function(e){return t.delete(e)})),t.merge(e)})),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keysAtom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),e.prototype.toPOJO=function(){var e,t,n={};try{for(var r=a(this),o=r.next();!o.done;o=r.next()){var i=u(o.value,2),l=i[0],s=i[1];n["symbol"==typeof l?l:_(l)]=s}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},e.prototype.toJS=function(){return new Map(this)},e.prototype.toJSON=function(){return this.toPOJO()},e.prototype.toString=function(){var e=this;return this.name+"[{ "+Array.from(this.keys()).map((function(t){return _(t)+": "+e.get(t)})).join(", ")+" }]"},e.prototype.observe=function(e,t){return xt(this,e)},e.prototype.intercept=function(e){return gt(this,e)},e}(),Dt=y("ObservableMap",Mt),Lt={},Ft=function(){function e(e,t,n){if(void 0===t&&(t=R),void 0===n&&(n="ObservableSet@"+f()),this.name=n,this[jt]=Lt,this._data=new Set,this._atom=P(this.name),this[Symbol.toStringTag]="Set","function"!=typeof Set)throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js");this.enhancer=function(e,r){return t(e,r,n)},e&&this.replace(e)}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.clear=function(){var e=this;dt((function(){le((function(){var t,n;try{for(var r=a(e._data.values()),o=r.next();!o.done;o=r.next()){var i=o.value;e.delete(i)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}))}))},e.prototype.forEach=function(e,t){var n,r;try{for(var o=a(this),i=o.next();!i.done;i=o.next()){var u=i.value;e.call(t,u,u,this)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._atom.reportObserved(),this._data.size},enumerable:!0,configurable:!0}),e.prototype.add=function(e){var t=this;if(ie(this._atom),bt(this)&&!(r=yt(this,{type:"add",object:this,newValue:e})))return this;if(!this.has(e)){dt((function(){t._data.add(t.enhancer(e,void 0)),t._atom.reportChanged()}));var n=wt(this),r=n?{type:"add",object:this,newValue:e}:null;n&&Et(this,r)}return this},e.prototype.delete=function(e){var t=this;if(bt(this)&&!(r=yt(this,{type:"delete",object:this,oldValue:e})))return!1;if(this.has(e)){var n=wt(this),r=n?{type:"delete",object:this,oldValue:e}:null;return dt((function(){t._atom.reportChanged(),t._data.delete(e)})),n&&Et(this,r),!0}return!1},e.prototype.has=function(e){return this._atom.reportObserved(),this._data.has(this.dehanceValue(e))},e.prototype.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return Xt({next:function(){var r=e;return e+=1,r<n.length?{value:[t[r],n[r]],done:!1}:{done:!0}}})},e.prototype.keys=function(){return this.values()},e.prototype.values=function(){this._atom.reportObserved();var e=this,t=0,n=Array.from(this._data.values());return Xt({next:function(){return t<n.length?{value:e.dehanceValue(n[t++]),done:!1}:{done:!0}}})},e.prototype.replace=function(e){var t=this;return Nt(e)&&(e=e.toJS()),dt((function(){Array.isArray(e)||x(e)?(t.clear(),e.forEach((function(e){return t.add(e)}))):null!=e&&d("Cannot initialize set from "+e)})),this},e.prototype.observe=function(e,t){return xt(this,e)},e.prototype.intercept=function(e){return gt(this,e)},e.prototype.toJS=function(){return new Set(this)},e.prototype.toString=function(){return this.name+"[ "+Array.from(this).join(", ")+" ]"},e.prototype[(jt=S,Symbol.iterator)]=function(){return this.values()},e}(),Nt=y("ObservableSet",Ft),It=function(){function e(e,t,n,r){void 0===t&&(t=new Map),this.target=e,this.values=t,this.name=n,this.defaultEnhancer=r,this.keysAtom=new C(n+".keys")}return e.prototype.read=function(e){return this.values.get(e).get()},e.prototype.write=function(e,t){var n=this.target,r=this.values.get(e);if(r instanceof _e)r.set(t);else{if(bt(this)){if(!(i=yt(this,{type:"update",object:this.proxy||n,name:e,newValue:t})))return;t=i.newValue}if((t=r.prepareNewValue(t))!==je.UNCHANGED){var o=wt(this),i=o?{type:"update",object:this.proxy||n,oldValue:r.value,name:e,newValue:t}:null;r.setNewValue(t),o&&Et(this,i)}}},e.prototype.has=function(e){var t=this.pendingKeys||(this.pendingKeys=new Map),n=t.get(e);if(n)return n.get();var r=!!this.values.get(e);return n=new Ee(r,B,this.name+"."+_(e)+"?",!1),t.set(e,n),n.get()},e.prototype.addObservableProp=function(e,t,n){void 0===n&&(n=this.defaultEnhancer);var r=this.target;if(bt(this)){var o=yt(this,{object:this.proxy||r,name:e,type:"add",newValue:t});if(!o)return;t=o.newValue}var i=new Ee(t,n,this.name+"."+_(e),!1);this.values.set(e,i),t=i.value,Object.defineProperty(r,e,function(e){return Bt[e]||(Bt[e]={configurable:!0,enumerable:!0,get:function(){return this[S].read(e)},set:function(t){this[S].write(e,t)}})}(e)),this.notifyPropertyAddition(e,t)},e.prototype.addComputedProp=function(e,t,n){var r,o,i,a=this.target;n.name=n.name||this.name+"."+_(t),this.values.set(t,new _e(n)),(e===a||(r=e,o=t,!(i=Object.getOwnPropertyDescriptor(r,o))||!1!==i.configurable&&!1!==i.writable))&&Object.defineProperty(e,t,function(e){return Ut[e]||(Ut[e]={configurable:je.computedConfigurable,enumerable:!1,get:function(){return Ht(this).read(e)},set:function(t){Ht(this).write(e,t)}})}(t))},e.prototype.remove=function(e){if(this.values.has(e)){var t=this.target;if(bt(this)&&!(a=yt(this,{object:this.proxy||t,name:e,type:"remove"})))return;try{Le();var n=wt(this),r=this.values.get(e),o=r&&r.get();if(r&&r.set(void 0),this.keysAtom.reportChanged(),this.values.delete(e),this.pendingKeys){var i=this.pendingKeys.get(e);i&&i.set(!1)}delete this.target[e];var a=n?{type:"remove",object:this.proxy||t,oldValue:o,name:e}:null;n&&Et(this,a)}finally{Fe()}}},e.prototype.illegalAccess=function(e,t){},e.prototype.observe=function(e,t){return xt(this,e)},e.prototype.intercept=function(e){return gt(this,e)},e.prototype.notifyPropertyAddition=function(e,t){var n=wt(this),r=n?{type:"add",object:this.proxy||this.target,name:e,newValue:t}:null;if(n&&Et(this,r),this.pendingKeys){var o=this.pendingKeys.get(e);o&&o.set(!0)}this.keysAtom.reportChanged()},e.prototype.getKeys=function(){var e,t;this.keysAtom.reportObserved();var n=[];try{for(var r=a(this.values),o=r.next();!o.done;o=r.next()){var i=u(o.value,2),l=i[0];i[1]instanceof Ee&&n.push(l)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},e}();function Rt(e,t,n){if(void 0===t&&(t=""),void 0===n&&(n=R),Object.prototype.hasOwnProperty.call(e,S))return e[S];b(e)||(t=(e.constructor.name||"ObservableObject")+"@"+f()),t||(t="ObservableObject@"+f());var r=new It(e,new Map,_(t),n);return g(e,S,r),r}var Bt=Object.create(null),Ut=Object.create(null);function Ht(e){return e[S]||(F(e),e[S])}var zt=y("ObservableObjectAdministration",It);function Vt(e){return!!m(e)&&(F(e),zt(e[S]))}function Wt(e,t){if("object"==typeof e&&null!==e){if(Tt(e))return void 0!==t&&d(!1),e[S].atom;if(Nt(e))return e[S];if(Dt(e)){var n=e;return void 0===t?n._keysAtom:((r=n._data.get(t)||n._hasMap.get(t))||d(!1),r)}var r;if(F(e),t&&!e[S]&&e[t],Vt(e))return t?((r=e[S].values.get(t))||d(!1),r):d(!1);if(k(e)||Oe(e)||ze(e))return e}else if("function"==typeof e&&ze(e[S]))return e[S];return d(!1)}var $t=Object.prototype.toString;function Gt(e,t,n){return void 0===n&&(n=-1),function e(t,n,r,o,i){if(t===n)return 0!==t||1/t==1/n;if(null==t||null==n)return!1;if(t!=t)return n!=n;var a=typeof t;if("function"!==a&&"object"!==a&&"object"!=typeof n)return!1;var u=$t.call(t);if(u!==$t.call(n))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+t==""+n;case"[object Number]":return+t!=+t?+n!=+n:0==+t?1/+t==1/n:+t==+n;case"[object Date]":case"[object Boolean]":return+t==+n;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(t)===Symbol.valueOf.call(n);case"[object Map]":case"[object Set]":r>=0&&r++}t=Yt(t),n=Yt(n);var l="[object Array]"===u;if(!l){if("object"!=typeof t||"object"!=typeof n)return!1;var s=t.constructor,c=n.constructor;if(s!==c&&!("function"==typeof s&&s instanceof s&&"function"==typeof c&&c instanceof c)&&"constructor"in t&&"constructor"in n)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var f=(o=o||[]).length;f--;)if(o[f]===t)return i[f]===n;if(o.push(t),i.push(n),l){if((f=t.length)!==n.length)return!1;for(;f--;)if(!e(t[f],n[f],r-1,o,i))return!1}else{var d=Object.keys(t),p=void 0;if(f=d.length,Object.keys(n).length!==f)return!1;for(;f--;)if(!qt(n,p=d[f])||!e(t[p],n[p],r-1,o,i))return!1}return o.pop(),i.pop(),!0}(e,t,n)}function Yt(e){return Tt(e)?e.slice():w(e)||Dt(e)||x(e)||Nt(e)?Array.from(e.entries()):e}function qt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Xt(e){return e[Symbol.iterator]=Kt,e}function Kt(){return this}if("undefined"==typeof Proxy||"undefined"==typeof Symbol)throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.");"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:We,extras:{getDebugName:function(e,t){return(void 0!==t?Wt(e,t):Vt(e)||Dt(e)||Nt(e)?function e(t,n){return t||d("Expecting some object"),void 0!==n?e(Wt(t,n)):k(t)||Oe(t)||ze(t)||Dt(t)||Nt(t)?t:(F(t),t[S]?t[S]:void d(!1))}(e):Wt(e)).name}},$mobx:S})}).call(this,n(200),n(81))},function(e,t,n){"use strict";n.d(t,"a",(function(){return A})),n.d(t,"b",(function(){return P}));var r=n(1),o=n(0),i=n.n(o),a=n(32),u=0,l={};function s(e){return l[e]||(l[e]=function(e){if("function"==typeof Symbol)return Symbol(e);var t="__$mobx-react "+e+" ("+u+")";return u++,t}(e)),l[e]}function c(e,t){if(f(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=0;o<n.length;o++)if(!Object.hasOwnProperty.call(t,n[o])||!f(e[n[o]],t[n[o]]))return!1;return!0}function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e,t,n){Object.hasOwnProperty.call(e,t)?e[t]=n:Object.defineProperty(e,t,{enumerable:!1,configurable:!0,writable:!0,value:n})}var p=s("patchMixins"),h=s("patchedDefinition");function v(e,t){for(var n=this,r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];t.locks++;try{var a;return null!=e&&(a=e.apply(this,o)),a}finally{t.locks--,0===t.locks&&t.methods.forEach((function(e){e.apply(n,o)}))}}function m(e,t){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];v.call.apply(v,[this,e,t].concat(r))}}var b=r.a||"$mobx",g=s("isUnmounted"),y=s("skipRender"),w=s("isForcingUpdate");function x(e){var t=e.prototype;if(t.componentWillReact)throw new Error("The componentWillReact life-cycle event is no longer supported");if(e.__proto__!==o.PureComponent)if(t.shouldComponentUpdate){if(t.shouldComponentUpdate!==_)throw new Error("It is not allowed to use shouldComponentUpdate in observer based components.")}else t.shouldComponentUpdate=_;O(t,"props"),O(t,"state");var n=t.render;return t.render=function(){return E.call(this,n)},function(e,t,n){var r=function(e,t){var n=e[p]=e[p]||{},r=n[t]=n[t]||{};return r.locks=r.locks||0,r.methods=r.methods||[],r}(e,t);r.methods.indexOf(n)<0&&r.methods.push(n);var o=Object.getOwnPropertyDescriptor(e,t);if(!o||!o[h]){var i=e[t],a=function e(t,n,r,o,i){var a,u=m(i,o);return(a={})[h]=!0,a.get=function(){return u},a.set=function(i){if(this===t)u=m(i,o);else{var a=e(this,n,r,o,i);Object.defineProperty(this,n,a)}},a.configurable=!0,a.enumerable=r,a}(e,t,o?o.enumerable:void 0,r,i);Object.defineProperty(e,t,a)}}(t,"componentWillUnmount",(function(){!0!==Object(a.b)()&&(this.render[b]&&this.render[b].dispose(),this[g]=!0)})),e}function E(e){var t=this;if(!0===Object(a.b)())return e.call(this);d(this,y,!1),d(this,w,!1);var n=this.displayName||this.name||this.constructor&&(this.constructor.displayName||this.constructor.name)||"<component>",i=e.bind(this),u=!1,l=new r.b(n+".render()",(function(){if(!u&&(u=!0,!0!==t[g])){var e=!0;try{d(t,w,!0),t[y]||o.Component.prototype.forceUpdate.call(t),e=!1}finally{d(t,w,!1),e&&l.dispose()}}}));function s(){u=!1;var e=void 0,t=void 0;if(l.track((function(){try{t=Object(r.c)(!1,i)}catch(t){e=t}})),e)throw e;return t}return l.reactComponent=this,s[b]=l,this.render=s,s.call(this)}function _(e,t){return Object(a.b)(),this.state!==t||!c(this.props,e)}function O(e,t){var n=s("reactProp_"+t+"_valueHolder"),o=s("reactProp_"+t+"_atomHolder");function i(){return this[o]||d(this,o,Object(r.j)("reactive "+t)),this[o]}Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){var e=!1;return r.e&&r.d&&(e=Object(r.e)(!0)),i.call(this).reportObserved(),r.e&&r.d&&Object(r.d)(e),this[n]},set:function(e){this[w]||c(this[n],e)?d(this,n,e):(d(this,n,e),d(this,y,!0),i.call(this).reportChanged(),d(this,y,!1))}})}var S="function"==typeof Symbol&&Symbol.for,C=S?Symbol.for("react.forward_ref"):"function"==typeof o.forwardRef&&Object(o.forwardRef)((function(e){return null})).$$typeof,k=S?Symbol.for("react.memo"):"function"==typeof o.memo&&Object(o.memo)((function(e){return null})).$$typeof;function P(e){if(e.isMobxInjector,k&&e.$$typeof===k)throw new Error("Mobx observer: You are trying to use 'observer' on a function component wrapped in either another observer or 'React.memo'. The observer already applies 'React.memo' for you.");if(C&&e.$$typeof===C){var t=e.render;if("function"!=typeof t)throw new Error("render property of ForwardRef was not a function");return Object(o.forwardRef)((function(){var e=arguments;return Object(o.createElement)(a.a,null,(function(){return t.apply(void 0,e)}))}))}return"function"!=typeof e||e.prototype&&e.prototype.render||e.isReactClass||Object.prototype.isPrototypeOf.call(o.Component,e)?x(e):Object(a.c)(e)}function T(){return(T=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var j=i.a.createContext({});function A(e){var t=e.children,n=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,["children"]),r=i.a.useContext(j),o=i.a.useRef(T({},r,{},n)).current;return i.a.createElement(j.Provider,{value:o},t)}if(A.displayName="MobXProvider",!o.Component)throw new Error("mobx-react requires React to be available");if(!r.o)throw new Error("mobx-react requires mobx to be available")},,function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((function(e){return!!e})).join(" ")}function i(e){var t,n=Object.getOwnPropertyNames(e).map((function(t){return e[t]?t:null}));return o.apply(void 0,function(e){if(Array.isArray(e))return r(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,void 0):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.getOwnPropertyNames(t).map((function(n){return t[n]?e+n:null}));return e+" "+n.filter((function(e){return!!e})).join(" ")}function u(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){return t&&l(t,e)}))}}function l(e,t){"function"==typeof e?e(t):e.current=t}n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return u}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return S}));var r=n(1),o=n(6),i=n(71),a=n(47),u=n(9),l=n(14),s=n(45),c=n(36);function f(e,t){var n;return function(){clearTimeout(n),n=setTimeout((function(){n=null,e()}),t)}}function d(e,t){return!t||"object"!==E(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){var t="function"==typeof Map?new Map:void 0;return(p=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return h(e,arguments,b(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)})(e)}function h(e,t,n){return(h=v()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&m(o,n.prototype),o}).apply(null,arguments)}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var _,O=function(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":E(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},S=(_=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new e.Options,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.a.Mode.DESKTOP;y(this,e),this.media=[],this.canLoadMore=!1,this.stories=[],this.numLoadedMore=0,this.totalMedia=0,this.mode=o.a.Mode.DESKTOP,this.isLoading=!1,this.isLoadingMore=!1,this.numMediaToShow=0,this.numMediaPerPage=0,this.options=n,this.localMedia=[],this.mode=i,this.mediaCounter=this._numMediaPerPage,this.reload=f((function(){return t.load()}),300),Object(r.p)((function(){return t.mode}),(function(){0===t.numLoadedMore&&(t.mediaCounter=t._numMediaPerPage,t.localMedia.length<t.numMediaToShow&&t.loadMedia(t.localMedia.length,t.numMediaToShow-t.localMedia.length))})),Object(r.p)((function(){return t.getReloadOptions()}),(function(){return t.reload()})),Object(r.p)((function(){return t.options.numPosts}),(function(e){var n=o.a.get(e,t.mode);t.localMedia.length<n&&n<=t.totalMedia?t.reload():t.mediaCounter=Math.max(1,n)})),Object(r.p)((function(){return t._media}),(function(e){return t.media=e})),Object(r.p)((function(){return t._numMediaToShow}),(function(e){return t.numMediaToShow=e})),Object(r.p)((function(){return t._numMediaPerPage}),(function(e){return t.numMediaPerPage=e})),Object(r.p)((function(){return t._canLoadMore}),(function(e){return t.canLoadMore=e}))}return x(e,[{key:"loadMore",value:function(){var e=this,t=this.numMediaToShow+this._numMediaPerPage-this.localMedia.length;return this.isLoadingMore=!0,t>0?this.loadMedia(this.localMedia.length,this._numMediaPerPage).then((function(){e.mediaCounter+=e._numMediaPerPage,e.numLoadedMore++,e.isLoadingMore=!1})):new Promise((function(t){e.numLoadedMore++,e.mediaCounter+=e._numMediaPerPage,e.isLoadingMore=!1,t()}))}},{key:"load",value:function(){var e=this;return this.numLoadedMore=0,this.loadMedia(0,this._numMediaPerPage,!0).then((function(){return e.mediaCounter=e._numMediaPerPage}))}},{key:"loadMedia",value:function(t,n,r){var o=this;return this.isLoading?Promise.resolve():e.Options.hasSources(this.options)?(this.isLoading=!0,new Promise((function(i,a){c.a.getFeedMedia(o.options,t,n).then((function(e){var t,n,a;r&&(o.localMedia=[]),(t=o.localMedia).push.apply(t,function(e){if(Array.isArray(e))return g(e)}(a=e.data.media)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(a)||function(e,t){if(e){if("string"==typeof e)return g(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,void 0):void 0}}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o.stories=null!==(n=e.data.stories)&&void 0!==n?n:[],o.totalMedia=e.data.total,i&&i()})).catch((function(t){var n=new e.Events.FetchFailEvent(e.Events.FETCH_FAIL,{detail:{feed:o,response:t.response}});return document.dispatchEvent(n),a&&a(),t})).finally((function(){return o.isLoading=!1}))}))):new Promise((function(e){o.localMedia=[],o.totalMedia=0,e&&e()}))}},{key:"getReloadOptions",value:function(){return JSON.stringify({accounts:this.options.accounts,hashtags:this.options.hashtags,tagged:this.options.tagged,postOrder:this.options.postOrder,mediaType:this.options.mediaType,moderation:this.options.moderation,moderationMode:this.options.moderationMode,hashtagBlacklist:this.options.hashtagBlacklist,hashtagWhitelist:this.options.hashtagWhitelist,captionBlacklist:this.options.captionBlacklist,captionWhitelist:this.options.captionWhitelist,hashtagBlacklistSettings:this.options.hashtagBlacklistSettings,hashtagWhitelistSettings:this.options.hashtagWhitelistSettings,captionBlacklistSettings:this.options.captionBlacklistSettings,captionWhitelistSettings:this.options.captionWhitelistSettings})}},{key:"_media",get:function(){return this.localMedia.slice(0,this.numMediaToShow)}},{key:"_numMediaToShow",get:function(){return Math.min(this.mediaCounter,this.totalMedia)}},{key:"_numMediaPerPage",get:function(){var e=o.a.get(this.options.numPosts,this.mode,!0),t=parseInt(e.toString());return t<1||isNaN(t)?1:e}},{key:"_canLoadMore",get:function(){return this.localMedia.length>this.mediaCounter||this.localMedia.length<this.totalMedia}}]),e}(),O([r.o],_.prototype,"media",void 0),O([r.o],_.prototype,"canLoadMore",void 0),O([r.o],_.prototype,"stories",void 0),O([r.o],_.prototype,"numLoadedMore",void 0),O([r.o],_.prototype,"options",void 0),O([r.o],_.prototype,"totalMedia",void 0),O([r.o],_.prototype,"mode",void 0),O([r.o],_.prototype,"isLoading",void 0),O([r.o],_.prototype,"isLoadingMore",void 0),O([r.f],_.prototype,"reload",void 0),O([r.o],_.prototype,"localMedia",void 0),O([r.o],_.prototype,"numMediaToShow",void 0),O([r.o],_.prototype,"numMediaPerPage",void 0),O([r.o],_.prototype,"mediaCounter",void 0),O([r.h],_.prototype,"_media",null),O([r.h],_.prototype,"_numMediaToShow",null),O([r.h],_.prototype,"_numMediaPerPage",null),O([r.h],_.prototype,"_canLoadMore",null),O([r.f],_.prototype,"loadMore",null),O([r.f],_.prototype,"load",null),O([r.f],_.prototype,"loadMedia",null),_);!function(e){!function(e){e.FETCH_FAIL="sli/feed/fetch_fail";var t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(o,e);var t,n,r=(t=o,n=v(),function(){var e,r=b(t);if(n){var o=b(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return d(this,e)});function o(e,t){return y(this,o),r.call(this,e,t)}return o}(p(CustomEvent));e.FetchFailEvent=t}(e.Events||(e.Events={}));var t=function(){var t=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};y(this,t),t.setFromObject(this,e)}return x(t,null,[{key:"setFromObject",value:function(e){var t,r,a,l,s,d,p,v,m,b,y,x=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.accounts=x.accounts?x.accounts.slice():[],e.hashtags=x.hashtags?x.hashtags.slice():[],e.tagged=x.tagged?x.tagged.slice():[],e.layout=i.a.getById(x.layout).id,e.numColumns=o.a.normalize(x.numColumns,{desktop:3}),e.highlightFreq=o.a.normalize(x.highlightFreq,{desktop:4}),e.mediaType=x.mediaType||n.ALL,e.postOrder=x.postOrder||f.DATE_DESC,e.numPosts=o.a.normalize(x.numPosts,{desktop:9}),e.linkBehavior=o.a.normalize(x.linkBehavior,{desktop:c.LIGHTBOX,phone:c.NEW_TAB}),e.feedWidth=o.a.normalize(x.feedWidth,{desktop:""}),e.feedHeight=o.a.normalize(x.feedHeight,{desktop:""}),e.feedPadding=o.a.normalize(x.feedPadding,{desktop:20,tablet:14,phone:10}),e.imgPadding=o.a.normalize(x.imgPadding,{desktop:14,tablet:10,phone:6}),e.textSize=o.a.normalize(x.textSize,{desktop:""}),e.bgColor=x.bgColor||{r:255,g:255,b:255,a:1},e.hoverInfo=x.hoverInfo?x.hoverInfo.slice():[h.LIKES_COMMENTS,h.INSTA_LINK],e.textColorHover=x.textColorHover||{r:255,g:255,b:255,a:1},e.bgColorHover=x.bgColorHover||{r:0,g:0,b:0,a:.5},e.showHeader=o.a.normalize(x.showHeader,{all:!0}),e.headerInfo=o.a.normalize(x.headerInfo,{all:[w.PROFILE_PIC,w.BIO]}),e.headerAccount=null!==(t=x.headerAccount)&&void 0!==t?t:null,e.headerAccount=null===e.headerAccount||void 0===u.b.getById(e.headerAccount)?u.b.list.length>0?u.b.list[0].id:null:e.headerAccount,e.headerStyle=o.a.normalize(x.headerStyle,{all:g.NORMAL}),e.headerTextSize=o.a.normalize(x.headerTextSize,{all:""}),e.headerPhotoSize=o.a.normalize(x.headerPhotoSize,{desktop:50}),e.headerTextColor=x.headerTextColor||{r:0,g:0,b:0,a:1},e.headerBgColor=x.headerBgColor||{r:255,g:255,b:255,a:1},e.headerPadding=o.a.normalize(x.headerPadding,{desktop:0}),e.customProfilePic=null!==(r=x.customProfilePic)&&void 0!==r?r:0,e.customBioText=x.customBioText||"",e.includeStories=null!==(a=x.includeStories)&&void 0!==a&&a,e.storiesInterval=x.storiesInterval||5,e.showCaptions=o.a.normalize(x.showCaptions,{all:!1}),e.captionMaxLength=o.a.normalize(x.captionMaxLength,{all:0}),e.captionSize=o.a.normalize(x.captionSize,{all:0}),e.captionColor=x.captionColor||{r:0,g:0,b:0,a:1},e.showLikes=o.a.normalize(x.showLikes,{all:!1}),e.showComments=o.a.normalize(x.showComments,{all:!1}),e.lcIconSize=o.a.normalize(x.lcIconSize,{all:14}),e.likesIconColor=null!==(l=x.likesIconColor)&&void 0!==l?l:{r:0,g:0,b:0,a:1},e.commentsIconColor=x.commentsIconColor||{r:0,g:0,b:0,a:1},e.lightboxShowSidebar=null!==(s=x.lightboxShowSidebar)&&void 0!==s&&s,e.numLightboxComments=x.numLightboxComments||50,e.showLoadMoreBtn=o.a.normalize(x.showLoadMoreBtn,{all:!0}),e.loadMoreBtnTextColor=x.loadMoreBtnTextColor||{r:255,g:255,b:255,a:1},e.loadMoreBtnBgColor=x.loadMoreBtnBgColor||{r:0,g:149,b:246,a:1},e.loadMoreBtnText=x.loadMoreBtnText||"Load more",e.autoload=null!==(d=x.autoload)&&void 0!==d&&d,e.showFollowBtn=o.a.normalize(x.showFollowBtn,{all:!0}),e.followBtnText=null!==(p=x.followBtnText)&&void 0!==p?p:"Follow on Instagram",e.followBtnTextColor=x.followBtnTextColor||{r:255,g:255,b:255,a:1},e.followBtnBgColor=x.followBtnBgColor||{r:0,g:149,b:246,a:1},e.followBtnLocation=o.a.normalize(x.followBtnLocation,{desktop:E.HEADER,tablet:E.HEADER,phone:E.BOTTOM}),e.hashtagWhitelist=x.hashtagWhitelist||[],e.hashtagBlacklist=x.hashtagBlacklist||[],e.captionWhitelist=x.captionWhitelist||[],e.captionBlacklist=x.captionBlacklist||[],e.hashtagWhitelistSettings=null===(v=x.hashtagWhitelistSettings)||void 0===v||v,e.hashtagBlacklistSettings=null===(m=x.hashtagBlacklistSettings)||void 0===m||m,e.captionWhitelistSettings=null===(b=x.captionWhitelistSettings)||void 0===b||b,e.captionBlacklistSettings=null===(y=x.captionBlacklistSettings)||void 0===y||y,e.moderation=x.moderation||[],e.moderationMode=x.moderationMode||_.BLACKLIST,e}},{key:"getAllAccounts",value:function(e){var t=u.b.idsToAccounts(e.accounts),n=u.b.idsToAccounts(e.tagged);return{all:t.concat(n),accounts:t,tagged:n}}},{key:"getSources",value:function(e){return{accounts:u.b.idsToAccounts(e.accounts),tagged:u.b.idsToAccounts(e.tagged),hashtags:u.b.getBusinessAccounts().length>0?e.hashtags.filter((function(e){return e.tag.length>0})):[]}}},{key:"hasSources",value:function(t,n){var r=e.Options.getSources(t),o=r.accounts.length>0||r.tagged.length>0,i=!n&&r.hashtags.length>0;return o||i}}]),t}();return O([r.o],t.prototype,"accounts",void 0),O([r.o],t.prototype,"hashtags",void 0),O([r.o],t.prototype,"tagged",void 0),O([r.o],t.prototype,"layout",void 0),O([r.o],t.prototype,"numColumns",void 0),O([r.o],t.prototype,"highlightFreq",void 0),O([r.o],t.prototype,"mediaType",void 0),O([r.o],t.prototype,"postOrder",void 0),O([r.o],t.prototype,"numPosts",void 0),O([r.o],t.prototype,"linkBehavior",void 0),O([r.o],t.prototype,"feedWidth",void 0),O([r.o],t.prototype,"feedHeight",void 0),O([r.o],t.prototype,"feedPadding",void 0),O([r.o],t.prototype,"imgPadding",void 0),O([r.o],t.prototype,"textSize",void 0),O([r.o],t.prototype,"bgColor",void 0),O([r.o],t.prototype,"textColorHover",void 0),O([r.o],t.prototype,"bgColorHover",void 0),O([r.o],t.prototype,"hoverInfo",void 0),O([r.o],t.prototype,"showHeader",void 0),O([r.o],t.prototype,"headerInfo",void 0),O([r.o],t.prototype,"headerAccount",void 0),O([r.o],t.prototype,"headerStyle",void 0),O([r.o],t.prototype,"headerTextSize",void 0),O([r.o],t.prototype,"headerPhotoSize",void 0),O([r.o],t.prototype,"headerTextColor",void 0),O([r.o],t.prototype,"headerBgColor",void 0),O([r.o],t.prototype,"headerPadding",void 0),O([r.o],t.prototype,"customBioText",void 0),O([r.o],t.prototype,"customProfilePic",void 0),O([r.o],t.prototype,"includeStories",void 0),O([r.o],t.prototype,"storiesInterval",void 0),O([r.o],t.prototype,"showCaptions",void 0),O([r.o],t.prototype,"captionMaxLength",void 0),O([r.o],t.prototype,"captionSize",void 0),O([r.o],t.prototype,"captionColor",void 0),O([r.o],t.prototype,"showLikes",void 0),O([r.o],t.prototype,"showComments",void 0),O([r.o],t.prototype,"lcIconSize",void 0),O([r.o],t.prototype,"likesIconColor",void 0),O([r.o],t.prototype,"commentsIconColor",void 0),O([r.o],t.prototype,"lightboxShowSidebar",void 0),O([r.o],t.prototype,"numLightboxComments",void 0),O([r.o],t.prototype,"showLoadMoreBtn",void 0),O([r.o],t.prototype,"loadMoreBtnText",void 0),O([r.o],t.prototype,"loadMoreBtnTextColor",void 0),O([r.o],t.prototype,"loadMoreBtnBgColor",void 0),O([r.o],t.prototype,"autoload",void 0),O([r.o],t.prototype,"showFollowBtn",void 0),O([r.o],t.prototype,"followBtnText",void 0),O([r.o],t.prototype,"followBtnTextColor",void 0),O([r.o],t.prototype,"followBtnBgColor",void 0),O([r.o],t.prototype,"followBtnLocation",void 0),O([r.o],t.prototype,"hashtagWhitelist",void 0),O([r.o],t.prototype,"hashtagBlacklist",void 0),O([r.o],t.prototype,"captionWhitelist",void 0),O([r.o],t.prototype,"captionBlacklist",void 0),O([r.o],t.prototype,"hashtagWhitelistSettings",void 0),O([r.o],t.prototype,"hashtagBlacklistSettings",void 0),O([r.o],t.prototype,"captionWhitelistSettings",void 0),O([r.o],t.prototype,"captionBlacklistSettings",void 0),O([r.o],t.prototype,"moderation",void 0),O([r.o],t.prototype,"moderationMode",void 0),t}();e.Options=t;var n,c,f,h,g,w,E,_,S=function(){function t(e){var n=this;y(this,t),Object.getOwnPropertyNames(e).map((function(t){n[t]=e[t]}))}return x(t,[{key:"getCaption",value:function(e){var t=e.caption?e.caption:"";return this.captionMaxLength&&t.length?Object(l.c)(Object(l.e)(t,this.captionMaxLength)):t}}],[{key:"compute",value:function(n){var r=n.options,a=n.mode,c=new t({accounts:u.b.filterExisting(r.accounts),tagged:u.b.filterExisting(r.tagged),hashtags:r.hashtags.filter((function(e){return e.tag.length>0})),layout:i.a.getById(r.layout),numColumns:o.a.get(r.numColumns,a,!0),highlightFreq:o.a.get(r.highlightFreq,a,!0),numPosts:o.a.get(r.numPosts,a,!0),linkBehavior:o.a.get(r.linkBehavior,a),bgColor:Object(s.a)(r.bgColor),textColorHover:Object(s.a)(r.textColorHover),bgColorHover:Object(s.a)(r.bgColorHover),hoverInfo:r.hoverInfo,showHeader:o.a.get(r.showHeader,a),headerInfo:o.a.get(r.headerInfo,a),headerStyle:o.a.get(r.headerStyle,a),headerTextColor:Object(s.a)(r.headerTextColor),headerBgColor:Object(s.a)(r.headerBgColor),headerPadding:o.a.get(r.headerPadding,a),includeStories:r.includeStories,storiesInterval:r.storiesInterval,showCaptions:o.a.get(r.showCaptions,a),captionMaxLength:o.a.get(r.captionMaxLength,a),captionColor:Object(s.a)(r.captionColor),showLikes:o.a.get(r.showLikes,a),showComments:o.a.get(r.showComments,a),likesIconColor:Object(s.a)(r.likesIconColor),commentsIconColor:Object(s.a)(r.commentsIconColor),lightboxShowSidebar:r.lightboxShowSidebar,numLightboxComments:r.numLightboxComments,showLoadMoreBtn:o.a.get(r.showLoadMoreBtn,a),loadMoreBtnTextColor:Object(s.a)(r.loadMoreBtnTextColor),loadMoreBtnBgColor:Object(s.a)(r.loadMoreBtnBgColor),loadMoreBtnText:r.loadMoreBtnText,showFollowBtn:o.a.get(r.showFollowBtn,a),autoload:r.autoload,followBtnLocation:o.a.get(r.followBtnLocation,a),followBtnTextColor:Object(s.a)(r.followBtnTextColor),followBtnBgColor:Object(s.a)(r.followBtnBgColor),followBtnText:r.followBtnText,account:null,showBio:!1,bioText:null,profilePhotoUrl:u.b.DEFAULT_PROFILE_PIC,feedWidth:"",feedHeight:"",feedPadding:"",imgPadding:"",textSize:"",headerTextSize:"",headerPhotoSize:"",captionSize:"",lcIconSize:"",showLcIcons:!1});if(n.mode!==o.a.Mode.DESKTOP&&(c.numColumns=c.numColumns<1?o.a.get(r.numColumns,o.a.Mode.DESKTOP):c.numColumns),c.numPosts=parseInt(c.numPosts+""),(c.numPosts<1||isNaN(c.numPosts))&&(c.numPosts=1),c.allAccounts=c.accounts.concat(c.tagged.filter((function(e){return!c.accounts.includes(e)}))),c.allAccounts.length>0&&(c.account=r.headerAccount&&c.allAccounts.includes(r.headerAccount)?u.b.getById(r.headerAccount):u.b.getById(c.allAccounts[0])),c.showHeader=c.showHeader&&null!==c.account,c.showHeader&&(c.profilePhotoUrl=r.customProfilePic.length?r.customProfilePic:u.b.getProfilePicUrl(c.account)),c.showFollowBtn=c.showFollowBtn&&null!==c.account,c.showLoadMoreBtn=c.showLoadMoreBtn&&n.canLoadMore,c.showBio=c.headerInfo.some((function(t){return t===e.HeaderInfo.BIO})),c.showBio){var f=r.customBioText.trim().length>0?r.customBioText:null!==c.account?u.b.getBioText(c.account):"";c.bioText=Object(l.c)(f),c.showBio=c.bioText.length>0}return c.feedWidth=this.normalizeCssSize(r.feedWidth,a,"auto"),c.feedHeight=this.normalizeCssSize(r.feedHeight,a,"auto"),c.feedPadding=this.normalizeCssSize(r.feedPadding,a,"0"),c.imgPadding=this.normalizeCssSize(r.imgPadding,a,"0"),c.textSize=this.normalizeCssSize(r.textSize,a,"inherit"),c.headerTextSize=this.normalizeCssSize(r.headerTextSize,a,"inherit"),c.headerPhotoSize=this.normalizeCssSize(r.headerPhotoSize,a,"50px"),c.captionSize=this.normalizeCssSize(r.captionSize,a,"inherit"),c.lcIconSize=this.normalizeCssSize(r.lcIconSize,a,"inherit"),c.buttonPadding=Math.max(10,o.a.get(r.imgPadding,a))+"px",c.showLcIcons=c.showLikes||c.showComments,c}},{key:"normalizeCssSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=o.a.get(e,t);return r?r+"px":n}}]),t}();e.ComputedOptions=S,e.HashtagSorting=Object(a.b)({recent:"Most recent",popular:"Most popular"}),function(e){e.ALL="all",e.PHOTOS="photos",e.VIDEOS="videos"}(n=e.MediaType||(e.MediaType={})),function(e){e.NOTHING="nothing",e.SELF="self",e.NEW_TAB="new_tab",e.LIGHTBOX="lightbox"}(c=e.LinkBehavior||(e.LinkBehavior={})),function(e){e.DATE_ASC="date_asc",e.DATE_DESC="date_desc",e.POPULARITY_ASC="popularity_asc",e.POPULARITY_DESC="popularity_desc",e.RANDOM="random"}(f=e.PostOrder||(e.PostOrder={})),function(e){e.USERNAME="username",e.DATE="date",e.CAPTION="caption",e.LIKES_COMMENTS="likes_comments",e.INSTA_LINK="insta_link"}(h=e.HoverInfo||(e.HoverInfo={})),function(e){e.NORMAL="normal",e.BOXED="boxed",e.CENTERED="centered"}(g=e.HeaderStyle||(e.HeaderStyle={})),function(e){e.BIO="bio",e.PROFILE_PIC="profile_pic",e.FOLLOWERS="followers",e.MEDIA_COUNT="media_count"}(w=e.HeaderInfo||(e.HeaderInfo={})),function(e){e.HEADER="header",e.BOTTOM="bottom",e.BOTH="both"}(E=e.FollowBtnLocation||(e.FollowBtnLocation={})),function(e){e.WHITELIST="whitelist",e.BLACKLIST="blacklist"}(_=e.ModerationMode||(e.ModerationMode={}))}(S||(S={}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(1);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var u,l=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":a(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u};!function(e){var t=function(){var e=function e(t,n,r){i(this,e),this.prop=t,this.name=n,this.icon=r};return e.DESKTOP=new e("desktop","Desktop","desktop"),e.TABLET=new e("tablet","Tablet","tablet"),e.PHONE=new e("phone","Phone","smartphone"),e}();e.Mode=t,e.MODES=[t.DESKTOP,t.TABLET,t.PHONE];var n=function(){var e=function(){function e(t,n,r){i(this,e),this.desktop=t,this.tablet=n,this.phone=r}var t,n;return t=e,(n=[{key:"get",value:function(e,t){return u(this,e,t)}},{key:"set",value:function(e,t){s(this,t,e)}},{key:"with",value:function(t,n){var r=c(this,n,t);return new e(r.desktop,r.tablet,r.phone)}}])&&o(t.prototype,n),e}();return l([r.o],e.prototype,"desktop",void 0),l([r.o],e.prototype,"tablet",void 0),l([r.o],e.prototype,"phone",void 0),e}();function u(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){var r=e[t.prop];return n?null!=r?r:e.desktop:r}}function s(e,t,n){return e[n.prop]=t,e}function c(e,t,n){return s({desktop:e.desktop,tablet:e.tablet,phone:e.phone},t,n)}e.Value=n,e.getName=function(e){return e.name},e.getIcon=function(e){return e.icon},e.cycle=function(n){var r=e.MODES.findIndex((function(e){return e===n}));return void 0===r?t.DESKTOP:e.MODES[(r+1)%e.MODES.length]},e.get=u,e.set=s,e.withValue=c,e.normalize=function(e,t){return null==e?t.hasOwnProperty("all")?new n(t.all,t.all,t.all):new n(t.desktop,t.tablet,t.phone):"object"===a(e)&&e.hasOwnProperty("desktop")?new n(e.desktop,e.tablet,e.phone):new n(e,e,e)},e.getModeForWindowSize=function(e){return e.width<=768?t.PHONE:e.width<=935?t.TABLET:t.DESKTOP}}(u||(u={}))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n.n(r),i=function(e){var t=e.icon,n=e.className,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["icon","className"]);return o.a.createElement("span",Object.assign({className:"dashicons dashicons-"+t+(n?" "+n:"")},r))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r,o=n(36),i=n(1);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}!function(e){var t;(t=e.Type||(e.Type={})).PERSONAL="PERSONAL",t.BUSINESS="BUSINESS"}(r||(r={}));var u=Object(i.o)([]),l="https://secure.gravatar.com/avatar/4a94d759753ade2961582f7345c1d7b2?s=64&d=mm&r=g",s=function(e){return u.find((function(t){return t.id===e}))};function c(e){e.data.sort((function(e,t){return e.type===t.type?0:e.type===r.Type.PERSONAL?-1:1}));var t,n=e.data.map((function(e){return Object(i.o)(e)}));return u.splice(0,u.length),u.push.apply(u,function(e){if(Array.isArray(e))return a(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return a(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,void 0):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u}t.b={list:u,DEFAULT_PROFILE_PIC:l,getById:s,hasAccounts:function(){return u.length>0},filterExisting:function(e){return e.filter((function(e){return void 0!==s(e)}))},idsToAccounts:function(e){return e.map((function(e){return s(e)})).filter((function(e){return void 0!==e}))},getBusinessAccounts:function(){return u.filter((function(e){return e.type===r.Type.BUSINESS}))},getProfilePicUrl:function(e){return e.customProfilePicUrl?e.customProfilePicUrl:e.profilePicUrl?e.profilePicUrl:l},getBioText:function(e){return e.customBio.length?e.customBio:e.bio},getProfileUrl:function(e){return"https://instagram.com/".concat(e.username)},loadAccounts:function(){return o.a.getAccounts().catch((function(e){})).then(c)},loadFromResponse:c}},function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return x})),n.d(t,"c",(function(){return b})),n.d(t,"d",(function(){return g}));n(77);var r=n(0),o=n(146);function i(e,t,n){var r="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]):r+=n+" "})),r}var a=function(e,t,n){var r=e.key+"-"+t.name;if(!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles),void 0===e.inserted[t.name]){var o=t;do{e.insert("."+r,o,e.sheet,!0),o=o.next}while(void 0!==o)}},u=n(88),l=(n(139),n(66)),s=Object(r.createContext)("undefined"!=typeof HTMLElement?Object(o.a)():null),c=Object(r.createContext)({}),f=s.Provider,d=function(e){return Object(r.forwardRef)((function(t,n){return Object(r.createElement)(s.Consumer,null,(function(r){return e(t,r,n)}))}))},p="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",h=Object.prototype.hasOwnProperty,v=function(e,t,n,o){var l=null===n?t.css:t.css(n);"string"==typeof l&&void 0!==e.registered[l]&&(l=e.registered[l]);var s=t[p],c=[l],f="";"string"==typeof t.className?f=i(e.registered,c,t.className):null!=t.className&&(f=t.className+" ");var d=Object(u.a)(c);a(e,d,"string"==typeof s),f+=e.key+"-"+d.name;var v={};for(var m in t)h.call(t,m)&&"css"!==m&&m!==p&&(v[m]=t[m]);return v.ref=o,v.className=f,Object(r.createElement)(s,v)},m=d((function(e,t,n){return"function"==typeof e.css?Object(r.createElement)(c.Consumer,null,(function(r){return v(t,e,r,n)})):v(t,e,null,n)})),b=function(e,t){var n=arguments;if(null==t||!h.call(t,"css"))return r.createElement.apply(void 0,n);var o=n.length,i=new Array(o);i[0]=m;var a={};for(var u in t)h.call(t,u)&&(a[u]=t[u]);a[p]=e,i[1]=a;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)},g=(r.Component,function(){var e=l.a.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}),y=function e(t){for(var n=t.length,r=0,o="";r<n;r++){var i=t[r];if(null!=i){var a=void 0;switch(typeof i){case"boolean":break;case"object":if(Array.isArray(i))a=e(i);else for(var u in a="",i)i[u]&&u&&(a&&(a+=" "),a+=u);break;default:a=i}a&&(o&&(o+=" "),o+=a)}}return o};function w(e,t,n){var r=[],o=i(e,r,n);return r.length<2?n:o+t(r)}var x=d((function(e,t){return Object(r.createElement)(c.Consumer,null,(function(n){var r=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=Object(u.a)(n,t.registered);return a(t,o,!1),t.key+"-"+o.name},o={css:r,cx:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return w(t.registered,r,y(n))},theme:n};return e.children(o)}))}))},function(e,t,n){"use strict";function r(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReactCSS=t.loop=t.handleActive=t.handleHover=t.hover=void 0;var r=s(n(339)),o=s(n(410)),i=s(n(430)),a=s(n(431)),u=s(n(432)),l=s(n(433));function s(e){return e&&e.__esModule?e:{default:e}}t.hover=a.default,t.handleHover=a.default,t.handleActive=u.default,t.loop=l.default;var c=t.ReactCSS=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];var u=(0,r.default)(n),l=(0,o.default)(e,u);return(0,i.default)(l)};t.default=c},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(11);function o(e){Object(r.a)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):new Date(NaN)}},function(e,t,n){"use strict";n.d(t,"f",(function(){return s})),n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return d})),n.d(t,"e",(function(){return p})),n.d(t,"d",(function(){return h}));var r=n(0),o=n.n(r),i=n(517),a=n(516);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l=0;function s(){return l++}function c(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(n){if(!n(e[r],t[r]))return!1}else if(e[r]!==t[r])return!1;return!0}function f(e,t){return e&&t&&"object"===u(e)&&"object"===u(t)?!Object.getOwnPropertyNames(e).some((function(n){return"object"===u(e[n])?"object"!==u(t[n])||!f(e[n],t[n]):Array.isArray(e[n])?!Array.isArray(t[n])||!c(e[n],t[n]):e[n]!==t[n]})):e===t}function d(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=e.trim().split("\n"),a=i.map((function(e,n){for(var a,u=[];null!==(a=/#([^\s]+)/g.exec(e));){var l="https://instagram.com/explore/tags/"+a[1],s=o.a.createElement("a",{href:l,target:"_blank",key:u.length},a[0]),c=e.substr(0,a.index),f=e.substr(a.index+a[0].length);u.push(c),u.push(s),e=f}return e.length&&u.push(e),t&&(u=t(u,n)),i.length>1&&u.push(o.a.createElement("br",{key:u.length})),o.a.createElement(r.Fragment,{key:n},u)}));return n>0?a.slice(0,n):a}function p(e,t){for(var n,r=/(\s+)/g,o=0,i=0,a="";null!==(n=r.exec(e))&&o<t;){var u=n.index+n[1].length;a+=e.substr(i,u-i),i=u,o++}return i<e.length&&(a+=" ..."),a}function h(e){return Object(i.a)(Object(a.a)(e),{addSuffix:!0})}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return A})),n.d(t,"c",(function(){return X})),n.d(t,"d",(function(){return z})),n.d(t,"e",(function(){return H})),n.d(t,"f",(function(){return J})),n.d(t,"g",(function(){return V})),n.d(t,"h",(function(){return Q})),n.d(t,"i",(function(){return ee})),n.d(t,"j",(function(){return D})),n.d(t,"k",(function(){return x})),n.d(t,"l",(function(){return g})),n.d(t,"m",(function(){return $})),n.d(t,"n",(function(){return m})),n.d(t,"o",(function(){return O})),n.d(t,"p",(function(){return re})),n.d(t,"q",(function(){return oe})),n.d(t,"r",(function(){return ie})),n.d(t,"s",(function(){return w})),n.d(t,"t",(function(){return fe})),n.d(t,"u",(function(){return pe})),n.d(t,"v",(function(){return ve})),n.d(t,"w",(function(){return M})),n.d(t,"x",(function(){return ge})),n.d(t,"y",(function(){return T}));var r=n(0),o=n(10),i=n(41),a=n(21),u=n.n(a),l=n(24),s=n(66),c=n(132),f=n.n(c);function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function h(e){var t=e.maxHeight,n=e.menuEl,r=e.minHeight,o=e.placement,i=e.shouldScroll,a=e.isFixedPosition,u=e.theme.spacing,s=Object(l.a)(n),c={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return c;var f=s.getBoundingClientRect().height,d=n.getBoundingClientRect(),p=d.bottom,h=d.height,v=d.top,m=n.offsetParent.getBoundingClientRect().top,b=window.innerHeight,g=Object(l.b)(s),y=parseInt(getComputedStyle(n).marginBottom,10),w=parseInt(getComputedStyle(n).marginTop,10),x=m-w,E=b-v,_=x+g,O=f-g-v,S=p-b+g+y,C=g+v-w;switch(o){case"auto":case"bottom":if(E>=h)return{placement:"bottom",maxHeight:t};if(O>=h&&!a)return i&&Object(l.c)(s,S,160),{placement:"bottom",maxHeight:t};if(!a&&O>=r||a&&E>=r)return i&&Object(l.c)(s,S,160),{placement:"bottom",maxHeight:a?E-y:O-y};if("auto"===o||a){var k=t,P=a?x:_;return P>=r&&(k=Math.min(P-y-u.controlHeight,t)),{placement:"top",maxHeight:k}}if("bottom"===o)return Object(l.l)(s,S),{placement:"bottom",maxHeight:t};break;case"top":if(x>=h)return{placement:"top",maxHeight:t};if(_>=h&&!a)return i&&Object(l.c)(s,C,160),{placement:"top",maxHeight:t};if(!a&&_>=r||a&&x>=r){var T=t;return(!a&&_>=r||a&&x>=r)&&(T=a?x-w:_-w),i&&Object(l.c)(s,C,160),{placement:"top",maxHeight:T}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'+o+'".')}return c}var v=function(e){return"auto"===e?"bottom":e},m=function(e){var t,n=e.placement,r=e.theme,o=r.borderRadius,i=r.spacing,a=r.colors;return(t={label:"menu"})[function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(n)]="100%",t.backgroundColor=a.neutral0,t.borderRadius=o,t.boxShadow="0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",t.marginBottom=i.menuGutter,t.marginTop=i.menuGutter,t.position="absolute",t.width="100%",t.zIndex=1,t},b=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={maxHeight:t.props.maxMenuHeight,placement:null},t.getPlacement=function(e){var n=t.props,r=n.minMenuHeight,o=n.maxMenuHeight,i=n.menuPlacement,a=n.menuPosition,u=n.menuShouldScrollIntoView,l=n.theme,s=t.context.getPortalPlacement;if(e){var c="fixed"===a,f=h({maxHeight:o,menuEl:e,minHeight:r,placement:i,shouldScroll:u&&!c,isFixedPosition:c,theme:l});s&&s(f),t.setState(f)}},t.getUpdatedProps=function(){var e=t.props.menuPlacement,n=t.state.placement||v(e);return d({},t.props,{placement:n,maxHeight:t.state.maxHeight})},t}return p(t,e),t.prototype.render=function(){return(0,this.props.children)({ref:this.getPlacement,placerProps:this.getUpdatedProps()})},t}(r.Component);b.contextTypes={getPortalPlacement:u.a.func};var g=function(e){var t=e.maxHeight,n=e.theme.spacing.baseUnit;return{maxHeight:t,overflowY:"auto",paddingBottom:n,paddingTop:n,position:"relative",WebkitOverflowScrolling:"touch"}},y=function(e){var t=e.theme,n=t.spacing.baseUnit;return{color:t.colors.neutral40,padding:2*n+"px "+3*n+"px",textAlign:"center"}},w=y,x=y,E=function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.innerProps;return Object(o.c)("div",d({css:i("noOptionsMessage",e),className:r({"menu-notice":!0,"menu-notice--no-options":!0},n)},a),t)};E.defaultProps={children:"No options"};var _=function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.innerProps;return Object(o.c)("div",d({css:i("loadingMessage",e),className:r({"menu-notice":!0,"menu-notice--loading":!0},n)},a),t)};_.defaultProps={children:"Loading..."};var O=function(e){var t=e.rect,n=e.offset,r=e.position;return{left:t.left,position:r,top:n,width:t.width,zIndex:1}},S=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={placement:null},t.getPortalPlacement=function(e){var n=e.placement;n!==v(t.props.menuPlacement)&&t.setState({placement:n})},t}p(t,e);var n=t.prototype;return n.getChildContext=function(){return{getPortalPlacement:this.getPortalPlacement}},n.render=function(){var e=this.props,t=e.appendTo,n=e.children,r=e.controlElement,a=e.menuPlacement,u=e.menuPosition,s=e.getStyles,c="fixed"===u;if(!t&&!c||!r)return null;var f=this.state.placement||v(a),d=Object(l.g)(r),p=c?0:window.pageYOffset,h={offset:d[f]+p,position:u,rect:d},m=Object(o.c)("div",{css:s("menuPortal",h)},n);return t?Object(i.createPortal)(m,t):m},t}(r.Component);S.childContextTypes={getPortalPlacement:u.a.func};var C=Array.isArray,k=Object.keys,P=Object.prototype.hasOwnProperty;function T(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,o,i,a=C(t),u=C(n);if(a&&u){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(a!=u)return!1;var l=t instanceof Date,s=n instanceof Date;if(l!=s)return!1;if(l&&s)return t.getTime()==n.getTime();var c=t instanceof RegExp,f=n instanceof RegExp;if(c!=f)return!1;if(c&&f)return t.toString()==n.toString();var d=k(t);if((o=d.length)!==k(n).length)return!1;for(r=o;0!=r--;)if(!P.call(n,d[r]))return!1;for(r=o;0!=r--;)if(!("_owner"===(i=d[r])&&t.$$typeof||e(t[i],n[i])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if(e.message&&e.message.match(/stack|recursion/i))return!1;throw e}}function j(){return(j=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var A=function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":null,pointerEvents:t?"none":null,position:"relative"}},M=function(e){var t=e.theme.spacing;return{alignItems:"center",display:"flex",flex:1,flexWrap:"wrap",padding:t.baseUnit/2+"px "+2*t.baseUnit+"px",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"}},D=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}};function L(){var e,t,n=(e=["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"],t||(t=e.slice(0)),e.raw=t,e);return L=function(){return n},n}function F(){return(F=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var N={name:"19bqh2r",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;"},I=function(e){var t=e.size,n=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,["size"]);return Object(o.c)("svg",F({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:N},n))},R=function(e){return Object(o.c)(I,F({size:20},e),Object(o.c)("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},B=function(e){return Object(o.c)(I,F({size:20},e),Object(o.c)("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},U=function(e){var t=e.isFocused,n=e.theme,r=n.spacing.baseUnit,o=n.colors;return{label:"indicatorContainer",color:t?o.neutral60:o.neutral20,display:"flex",padding:2*r,transition:"color 150ms",":hover":{color:t?o.neutral80:o.neutral40}}},H=U,z=U,V=function(e){var t=e.isDisabled,n=e.theme,r=n.spacing.baseUnit,o=n.colors;return{label:"indicatorSeparator",alignSelf:"stretch",backgroundColor:t?o.neutral10:o.neutral20,marginBottom:2*r,marginTop:2*r,width:1}},W=Object(o.d)(L()),$=function(e){var t=e.isFocused,n=e.size,r=e.theme,o=r.colors,i=r.spacing.baseUnit;return{label:"loadingIndicator",color:t?o.neutral60:o.neutral20,display:"flex",padding:2*i,transition:"color 150ms",alignSelf:"center",fontSize:n,lineHeight:1,marginRight:n,textAlign:"center",verticalAlign:"middle"}},G=function(e){var t=e.delay,n=e.offset;return Object(o.c)("span",{css:Object(s.a)({animation:W+" 1s ease-in-out "+t+"ms infinite;",backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":null,height:"1em",verticalAlign:"top",width:"1em"},"")})},Y=function(e){var t=e.className,n=e.cx,r=e.getStyles,i=e.innerProps,a=e.isRtl;return Object(o.c)("div",F({},i,{css:r("loadingIndicator",e),className:n({indicator:!0,"loading-indicator":!0},t)}),Object(o.c)(G,{delay:0,offset:a}),Object(o.c)(G,{delay:160,offset:!0}),Object(o.c)(G,{delay:320,offset:!a}))};function q(){return(q=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}Y.defaultProps={size:4};var X=function(e){var t=e.isDisabled,n=e.isFocused,r=e.theme,o=r.colors,i=r.borderRadius,a=r.spacing;return{label:"control",alignItems:"center",backgroundColor:t?o.neutral5:o.neutral0,borderColor:t?o.neutral10:n?o.primary:o.neutral20,borderRadius:i,borderStyle:"solid",borderWidth:1,boxShadow:n?"0 0 0 1px "+o.primary:null,cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:a.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms","&:hover":{borderColor:n?o.primary:o.neutral30}}};function K(){return(K=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var Q=function(e){var t=e.theme.spacing;return{paddingBottom:2*t.baseUnit,paddingTop:2*t.baseUnit}},J=function(e){var t=e.theme.spacing;return{label:"group",color:"#999",cursor:"default",display:"block",fontSize:"75%",fontWeight:"500",marginBottom:"0.25em",paddingLeft:3*t.baseUnit,paddingRight:3*t.baseUnit,textTransform:"uppercase"}};function Z(){return(Z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var ee=function(e){var t=e.isDisabled,n=e.theme,r=n.spacing,o=n.colors;return{margin:r.baseUnit/2,paddingBottom:r.baseUnit/2,paddingTop:r.baseUnit/2,visibility:t?"hidden":"visible",color:o.neutral80}},te=function(e){return{label:"input",background:0,border:0,fontSize:"inherit",opacity:e?0:1,outline:0,padding:0,color:"inherit"}};function ne(){return(ne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var re=function(e){var t=e.theme,n=t.spacing,r=t.borderRadius;return{label:"multiValue",backgroundColor:t.colors.neutral10,borderRadius:r/2,display:"flex",margin:n.baseUnit/2,minWidth:0}},oe=function(e){var t=e.theme,n=t.borderRadius,r=t.colors,o=e.cropWithEllipsis;return{borderRadius:n/2,color:r.neutral80,fontSize:"85%",overflow:"hidden",padding:3,paddingLeft:6,textOverflow:o?"ellipsis":null,whiteSpace:"nowrap"}},ie=function(e){var t=e.theme,n=t.spacing,r=t.borderRadius,o=t.colors;return{alignItems:"center",borderRadius:r/2,backgroundColor:e.isFocused&&o.dangerLight,display:"flex",paddingLeft:n.baseUnit,paddingRight:n.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}}},ae=function(e){var t=e.children,n=e.innerProps;return Object(o.c)("div",n,t)},ue=ae,le=ae,se=function(e){var t=e.children,n=e.className,r=e.components,i=e.cx,a=e.data,u=e.getStyles,l=e.innerProps,s=e.isDisabled,c=e.removeProps,f=e.selectProps,d=r.Container,p=r.Label,h=r.Remove;return Object(o.c)(o.b,null,(function(r){var v=r.css,m=r.cx;return Object(o.c)(d,{data:a,innerProps:ne({},l,{className:m(v(u("multiValue",e)),i({"multi-value":!0,"multi-value--is-disabled":s},n))}),selectProps:f},Object(o.c)(p,{data:a,innerProps:{className:m(v(u("multiValueLabel",e)),i({"multi-value__label":!0},n))},selectProps:f},t),Object(o.c)(h,{data:a,innerProps:ne({className:m(v(u("multiValueRemove",e)),i({"multi-value__remove":!0},n))},c),selectProps:f}))}))};function ce(){return(ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}se.defaultProps={cropWithEllipsis:!0};var fe=function(e){var t=e.isDisabled,n=e.isFocused,r=e.isSelected,o=e.theme,i=o.spacing,a=o.colors;return{label:"option",backgroundColor:r?a.primary:n?a.primary25:"transparent",color:t?a.neutral20:r?a.neutral0:"inherit",cursor:"default",display:"block",fontSize:"inherit",padding:2*i.baseUnit+"px "+3*i.baseUnit+"px",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",":active":{backgroundColor:!t&&(r?a.primary:a.primary50)}}};function de(){return(de=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var pe=function(e){var t=e.theme,n=t.spacing;return{label:"placeholder",color:t.colors.neutral50,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2,position:"absolute",top:"50%",transform:"translateY(-50%)"}};function he(){return(he=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var ve=function(e){var t=e.isDisabled,n=e.theme,r=n.spacing,o=n.colors;return{label:"singleValue",color:t?o.neutral40:o.neutral80,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2,maxWidth:"calc(100% - "+2*r.baseUnit+"px)",overflow:"hidden",position:"absolute",textOverflow:"ellipsis",whiteSpace:"nowrap",top:"50%",transform:"translateY(-50%)"}};function me(){return(me=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var be={ClearIndicator:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.innerProps;return Object(o.c)("div",F({},a,{css:i("clearIndicator",e),className:r({indicator:!0,"clear-indicator":!0},n)}),t||Object(o.c)(R,null))},Control:function(e){var t=e.children,n=e.cx,r=e.getStyles,i=e.className,a=e.isDisabled,u=e.isFocused,l=e.innerRef,s=e.innerProps,c=e.menuIsOpen;return Object(o.c)("div",q({ref:l,css:r("control",e),className:n({control:!0,"control--is-disabled":a,"control--is-focused":u,"control--menu-is-open":c},i)},s),t)},DropdownIndicator:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.innerProps;return Object(o.c)("div",F({},a,{css:i("dropdownIndicator",e),className:r({indicator:!0,"dropdown-indicator":!0},n)}),t||Object(o.c)(B,null))},DownChevron:B,CrossIcon:R,Group:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.Heading,u=e.headingProps,l=e.label,s=e.theme,c=e.selectProps;return Object(o.c)("div",{css:i("group",e),className:r({group:!0},n)},Object(o.c)(a,K({},u,{selectProps:c,theme:s,getStyles:i,cx:r}),l),Object(o.c)("div",null,t))},GroupHeading:function(e){var t=e.className,n=e.cx,r=e.getStyles,i=e.theme,a=(e.selectProps,function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,["className","cx","getStyles","theme","selectProps"]));return Object(o.c)("div",K({css:r("groupHeading",K({theme:i},a)),className:n({"group-heading":!0},t)},a))},IndicatorsContainer:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles;return Object(o.c)("div",{css:i("indicatorsContainer",e),className:r({indicators:!0},n)},t)},IndicatorSeparator:function(e){var t=e.className,n=e.cx,r=e.getStyles,i=e.innerProps;return Object(o.c)("span",F({},i,{css:r("indicatorSeparator",e),className:n({"indicator-separator":!0},t)}))},Input:function(e){var t=e.className,n=e.cx,r=e.getStyles,i=e.innerRef,a=e.isHidden,u=e.isDisabled,l=e.theme,s=(e.selectProps,function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,["className","cx","getStyles","innerRef","isHidden","isDisabled","theme","selectProps"]));return Object(o.c)("div",{css:r("input",Z({theme:l},s))},Object(o.c)(f.a,Z({className:n({input:!0},t),inputRef:i,inputStyle:te(a),disabled:u},s)))},LoadingIndicator:Y,Menu:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.innerRef,u=e.innerProps;return Object(o.c)("div",d({css:i("menu",e),className:r({menu:!0},n)},u,{ref:a}),t)},MenuList:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.isMulti,u=e.innerRef;return Object(o.c)("div",{css:i("menuList",e),className:r({"menu-list":!0,"menu-list--is-multi":a},n),ref:u},t)},MenuPortal:S,LoadingMessage:_,NoOptionsMessage:E,MultiValue:se,MultiValueContainer:ue,MultiValueLabel:le,MultiValueRemove:function(e){var t=e.children,n=e.innerProps;return Object(o.c)("div",n,t||Object(o.c)(R,{size:14}))},Option:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.isDisabled,u=e.isFocused,l=e.isSelected,s=e.innerRef,c=e.innerProps;return Object(o.c)("div",ce({css:i("option",e),className:r({option:!0,"option--is-disabled":a,"option--is-focused":u,"option--is-selected":l},n),ref:s},c),t)},Placeholder:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.innerProps;return Object(o.c)("div",de({css:i("placeholder",e),className:r({placeholder:!0},n)},a),t)},SelectContainer:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.innerProps,u=e.isDisabled,l=e.isRtl;return Object(o.c)("div",j({css:i("container",e),className:r({"--is-disabled":u,"--is-rtl":l},n)},a),t)},SingleValue:function(e){var t=e.children,n=e.className,r=e.cx,i=e.getStyles,a=e.isDisabled,u=e.innerProps;return Object(o.c)("div",he({css:i("singleValue",e),className:r({"single-value":!0,"single-value--is-disabled":a},n)},u),t)},ValueContainer:function(e){var t=e.children,n=e.className,r=e.cx,i=e.isMulti,a=e.getStyles,u=e.hasValue;return Object(o.c)("div",{css:a("valueContainer",e),className:r({"value-container":!0,"value-container--is-multi":i,"value-container--has-value":u},n)},t)}},ge=function(e){return me({},be,e.components)}},,function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c})),n.d(t,"h",(function(){return f})),n.d(t,"d",(function(){return d})),n.d(t,"g",(function(){return p})),n.d(t,"e",(function(){return h})),n.d(t,"c",(function(){return v})),n.d(t,"f",(function(){return m}));var r=n(0),o=n.n(r),i=n(23),a=n(79);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];function o(r){!e.current||e.current.contains(r.target)||n.some((function(e){return e&&e.current&&e.current.contains(r.target)}))||t(r)}Object(r.useEffect)((function(){return document.addEventListener("mousedown",o),document.addEventListener("touchend",o),function(){document.removeEventListener("mousedown",o),document.removeEventListener("touchend",o)}}))}function c(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,i=o.a.useState(e),a=u(i,2),l=a[0],s=a[1];return Object(r.useEffect)((function(){var r=null;return e===t?r=setTimeout((function(){return s(t)}),n):s(!t),function(){null!==r&&clearTimeout(r)}}),[e]),[l,s]}function f(e){var t=u(o.a.useState(Object(a.b)()),2),n=t[0],i=t[1],l=function(){var t=Object(a.b)();i(t),e&&e(t)};return Object(r.useEffect)((function(){return window.addEventListener("resize",l),function(){return window.removeEventListener("resize",l)}}),[]),n}function d(){return new URLSearchParams(Object(i.f)().search)}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=function(n){if(t())return(n||window.event).returnValue=e,e};Object(r.useEffect)((function(){return window.addEventListener("beforeunload",n),function(){return window.removeEventListener("beforeunload",n)}}),[])}function h(e,t){var n=o.a.useRef(!1);return Object(r.useEffect)((function(){n.current&&void 0!==e.current&&(e.current.scrollIntoView(Object.assign({behavior:"smooth",block:"start"},null!=t?t:{})),n.current=!1)}),[n.current]),function(){return n.current=!0}}function v(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];Object(r.useEffect)((function(){return o.reduce((function(e,t){return e&&t}),!0)&&document.addEventListener(e,t),function(){return document.removeEventListener(e,t)}}),o)}function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];Object(r.useEffect)((function(){var n=setTimeout(t,e);return function(){return clearTimeout(n)}}),n)}},,,function(e,t,n){e.exports=n(297)()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(434);Object.defineProperty(t,"Alpha",{enumerable:!0,get:function(){return f(r).default}});var o=n(177);Object.defineProperty(t,"Checkboard",{enumerable:!0,get:function(){return f(o).default}});var i=n(437);Object.defineProperty(t,"EditableInput",{enumerable:!0,get:function(){return f(i).default}});var a=n(438);Object.defineProperty(t,"Hue",{enumerable:!0,get:function(){return f(a).default}});var u=n(440);Object.defineProperty(t,"Raised",{enumerable:!0,get:function(){return f(u).default}});var l=n(454);Object.defineProperty(t,"Saturation",{enumerable:!0,get:function(){return f(l).default}});var s=n(252);Object.defineProperty(t,"ColorWrap",{enumerable:!0,get:function(){return f(s).default}});var c=n(462);function f(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"Swatch",{enumerable:!0,get:function(){return f(c).default}})},function(e,t,n){"use strict";n.d(t,"a",(function(){return v})),n.d(t,"b",(function(){return y})),n.d(t,"c",(function(){return p})),n.d(t,"d",(function(){return d})),n.d(t,"e",(function(){return g})),n.d(t,"f",(function(){return x}));var r=n(56),o=n(0),i=n.n(o),a=(n(21),n(50),n(180)),u=n(43),l=n(33),s=n(181),c=n.n(s),f=(n(201),n(84),n(256),function(e){var t=Object(a.a)();return t.displayName="Router-History",t}()),d=function(e){var t=Object(a.a)();return t.displayName="Router",t}(),p=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._isMounted?n.setState({location:e}):n._pendingLocation=e}))),n}Object(r.a)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&this.unlisten()},n.render=function(){return i.a.createElement(d.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},i.a.createElement(f.Provider,{children:this.props.children||null,value:this.props.history}))},t}(i.a.Component);i.a.Component;var h=function(e){function t(){return e.apply(this,arguments)||this}Object(r.a)(t,e);var n=t.prototype;return n.componentDidMount=function(){this.props.onMount&&this.props.onMount.call(this,this)},n.componentDidUpdate=function(e){this.props.onUpdate&&this.props.onUpdate.call(this,this,e)},n.componentWillUnmount=function(){this.props.onUnmount&&this.props.onUnmount.call(this,this)},n.render=function(){return null},t}(i.a.Component);function v(e){var t=e.message,n=e.when,r=void 0===n||n;return i.a.createElement(d.Consumer,null,(function(e){if(e||Object(u.a)(!1),!r||e.staticContext)return null;var n=e.history.block;return i.a.createElement(h,{onMount:function(e){e.release=n(t)},onUpdate:function(e,r){r.message!==t&&(e.release(),e.release=n(t))},onUnmount:function(e){e.release()},message:t})}))}var m={},b=0;function g(e,t){void 0===t&&(t={}),("string"==typeof t||Array.isArray(t))&&(t={path:t});var n=t,r=n.path,o=n.exact,i=void 0!==o&&o,a=n.strict,u=void 0!==a&&a,l=n.sensitive,s=void 0!==l&&l;return[].concat(r).reduce((function(t,n){if(!n&&""!==n)return null;if(t)return t;var r=function(e,t){var n=""+t.end+t.strict+t.sensitive,r=m[n]||(m[n]={});if(r[e])return r[e];var o=[],i={regexp:c()(e,o,t),keys:o};return b<1e4&&(r[e]=i,b++),i}(n,{end:i,strict:u,sensitive:s}),o=r.regexp,a=r.keys,l=o.exec(e);if(!l)return null;var f=l[0],d=l.slice(1),p=e===f;return i&&!p?null:{path:n,url:"/"===n&&""===f?"/":f,isExact:p,params:a.reduce((function(e,t,n){return e[t.name]=d[n],e}),{})}}),null)}var y=function(e){function t(){return e.apply(this,arguments)||this}return Object(r.a)(t,e),t.prototype.render=function(){var e=this;return i.a.createElement(d.Consumer,null,(function(t){t||Object(u.a)(!1);var n=e.props.location||t.location,r=e.props.computedMatch?e.props.computedMatch:e.props.path?g(n.pathname,e.props):t.match,o=Object(l.a)({},t,{location:n,match:r}),a=e.props,s=a.children,c=a.component,f=a.render;return Array.isArray(s)&&0===s.length&&(s=null),i.a.createElement(d.Provider,{value:o},o.match?s?"function"==typeof s?s(o):s:c?i.a.createElement(c,o):f?f(o):null:"function"==typeof s?s(o):null)}))},t}(i.a.Component);i.a.Component,i.a.Component;var w=i.a.useContext;function x(){return w(d).location}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return l})),n.d(t,"c",(function(){return f})),n.d(t,"d",(function(){return v})),n.d(t,"e",(function(){return a})),n.d(t,"f",(function(){return d})),n.d(t,"g",(function(){return p})),n.d(t,"h",(function(){return i})),n.d(t,"i",(function(){return h})),n.d(t,"j",(function(){return u})),n.d(t,"k",(function(){return r})),n.d(t,"l",(function(){return s}));var r=function(){};function o(e,t){return t?"-"===t[0]?e+t:e+"__"+t:e}function i(e,t,n){var r=[n];if(t&&e)for(var i in t)t.hasOwnProperty(i)&&t[i]&&r.push(""+o(e,i));return r.filter((function(e){return e})).map((function(e){return String(e).trim()})).join(" ")}var a=function(e){return Array.isArray(e)?e.filter(Boolean):"object"==typeof e&&null!==e?[e]:[]};function u(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function l(e){return u(e)?window.pageYOffset:e.scrollTop}function s(e,t){u(e)?window.scrollTo(0,t):e.scrollTop=t}function c(e){var t=getComputedStyle(e),n="absolute"===t.position,r=/(auto|scroll)/,o=document.documentElement;if("fixed"===t.position)return o;for(var i=e;i=i.parentElement;)if(t=getComputedStyle(i),(!n||"static"!==t.position)&&r.test(t.overflow+t.overflowY+t.overflowX))return i;return o}function f(e,t,n,o){void 0===n&&(n=200),void 0===o&&(o=r);var i=l(e),a=t-i,u=0;!function t(){var r,l=a*((r=(r=u+=10)/n-1)*r*r+1)+i;s(e,l),u<n?window.requestAnimationFrame(t):o(e)}()}function d(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=t.offsetHeight/3;r.bottom+o>n.bottom?s(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+o,e.scrollHeight)):r.top-o<n.top&&s(e,Math.max(t.offsetTop-o,0))}function p(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}function h(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}}function v(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(e){return!1}}},function(e,t,n){e.exports={root:"MediaLightbox__root layout__fill-parent layout__z-higher layout__flex-row layout__flex-center layout__no-overflow",shade:"MediaLightbox__shade layout__fill-parent layout__z-low","shade-fullscreen":"MediaLightbox__shade-fullscreen MediaLightbox__shade layout__fill-parent layout__z-low",shadeFullscreen:"MediaLightbox__shade-fullscreen MediaLightbox__shade layout__fill-parent layout__z-low",container:"MediaLightbox__container layout__flex-row layout__z-high",frame:"MediaLightbox__frame layout__flex-column layout__flex-center",sidebar:"MediaLightbox__sidebar layout__flex-column layout__scroll-y","nav-button-container":"MediaLightbox__nav-button-container layout__flex-column layout__flex-center",navButtonContainer:"MediaLightbox__nav-button-container layout__flex-column layout__flex-center","next-button-container":"MediaLightbox__next-button-container MediaLightbox__nav-button-container layout__flex-column layout__flex-center",nextButtonContainer:"MediaLightbox__next-button-container MediaLightbox__nav-button-container layout__flex-column layout__flex-center","prev-button-container":"MediaLightbox__prev-button-container MediaLightbox__nav-button-container layout__flex-column layout__flex-center",prevButtonContainer:"MediaLightbox__prev-button-container MediaLightbox__nav-button-container layout__flex-column layout__flex-center",button:"MediaLightbox__button layout__z-low","button-icon":"MediaLightbox__button-icon dashicons__dashicon-large",buttonIcon:"MediaLightbox__button-icon dashicons__dashicon-large","next-button":"MediaLightbox__next-button MediaLightbox__button layout__z-low",nextButton:"MediaLightbox__next-button MediaLightbox__button layout__z-low","prev-button":"MediaLightbox__prev-button MediaLightbox__button layout__z-low",prevButton:"MediaLightbox__prev-button MediaLightbox__button layout__z-low","close-button":"MediaLightbox__close-button MediaLightbox__button layout__z-low",closeButton:"MediaLightbox__close-button MediaLightbox__button layout__z-low","sidebar-component":"MediaLightbox__sidebar-component",sidebarComponent:"MediaLightbox__sidebar-component","sidebar-component-bordered":"MediaLightbox__sidebar-component-bordered MediaLightbox__sidebar-component",sidebarComponentBordered:"MediaLightbox__sidebar-component-bordered MediaLightbox__sidebar-component","sidebar-info":"MediaLightbox__sidebar-info MediaLightbox__sidebar-component-bordered MediaLightbox__sidebar-component layout__flex-column",sidebarInfo:"MediaLightbox__sidebar-info MediaLightbox__sidebar-component-bordered MediaLightbox__sidebar-component layout__flex-column","sidebar-caption":"MediaLightbox__sidebar-caption MediaLightbox__sidebar-component",sidebarCaption:"MediaLightbox__sidebar-caption MediaLightbox__sidebar-component","sidebar-link":"MediaLightbox__sidebar-link MediaLightbox__sidebar-component-bordered MediaLightbox__sidebar-component",sidebarLink:"MediaLightbox__sidebar-link MediaLightbox__sidebar-component-bordered MediaLightbox__sidebar-component","sidebar-comment-list":"MediaLightbox__sidebar-comment-list MediaLightbox__sidebar-component layout__flex-column",sidebarCommentList:"MediaLightbox__sidebar-comment-list MediaLightbox__sidebar-component layout__flex-column","sidebar-comment":"MediaLightbox__sidebar-comment",sidebarComment:"MediaLightbox__sidebar-comment","sidebar-user":"MediaLightbox__sidebar-user",sidebarUser:"MediaLightbox__sidebar-user","sidebar-date":"MediaLightbox__sidebar-date",sidebarDate:"MediaLightbox__sidebar-date","sidebar-scroller":"MediaLightbox__sidebar-scroller layout__scroll-y",sidebarScroller:"MediaLightbox__sidebar-scroller layout__scroll-y"}},function(e,t,n){"use strict";function r(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,"a",(function(){return r}))},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return u}));var r=n(0),o=n.n(r),i=n(2),a=function(e,t){return Object(i.b)((function(n){return o.a.createElement(e,Object.assign(Object.assign({},t),n))}))},u=function(e,t){return Object(i.b)((function(n){var r={};return Object.keys(t).forEach((function(e){return r[e]=t[e](n)})),o.a.createElement(e,Object.assign({},r,n))}))}},,function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return _})),n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return x})),n.d(t,"d",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);if(!o.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!r.r)throw new Error("mobx-react-lite requires mobx at least version 4 to be available");function a(){return!1}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(){var e=Object(o.useState)(0)[1];return Object(o.useCallback)((function(){e((function(e){return e+1}))}),[])}function s(e){return"function"==typeof Symbol?Symbol.for(e):"__$mobx-react "+e+"__"}var c={};var f=s("observerBatching"),d=function(t){"function"==typeof t&&Object(r.i)({reactionScheduler:t}),("undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:c)[f]=!0};function p(e){return Object(r.k)(e)}var h,v=new Set;function m(){void 0===h&&(h=setTimeout(b,1e4))}function b(){h=void 0;var e=Date.now();v.forEach((function(t){var n=t.current;n&&e>=n.cleanAt&&(n.reaction.dispose(),t.current=null,v.delete(t))})),v.size>0&&m()}var g={};function y(e){return"observer"+e}function w(e,t,n){void 0===t&&(t="observed"),void 0===n&&(n=g);var o,a=(n.useForceUpdate||l)(),u=i.a.useRef(null);if(!u.current){var s=new r.b(y(t),(function(){c.mounted?a():(s.dispose(),u.current=null)})),c=function(e){return{cleanAt:Date.now()+1e4,reaction:e}}(s);u.current=c,o=u,v.add(o),m()}var f,d,h=u.current.reaction;if(i.a.useDebugValue(h,p),i.a.useEffect((function(){var e;return e=u,v.delete(e),u.current?u.current.mounted=!0:(u.current={reaction:new r.b(y(t),(function(){a()})),cleanAt:1/0},a()),function(){u.current.reaction.dispose(),u.current=null}}),[]),h.track((function(){try{f=e()}catch(e){d=e}})),d)throw d;return f}function x(e,t){var n,r,i,a=u({forwardRef:!1},t),l=e.displayName||e.name,s=function(t,n){return w((function(){return e(t,n)}),l)};return s.displayName=l,n=a.forwardRef?Object(o.memo)(Object(o.forwardRef)(s)):Object(o.memo)(s),r=e,i=n,Object.keys(r).forEach((function(e){E[e]||Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(r,e))})),n.displayName=l,n}var E={$$typeof:!0,render:!0,compare:!0,type:!0};function _(e){var t=e.children,n=e.render,r=t||n;return"function"!=typeof r?null:w(r)}function O(e,t,n,r,o){var i="children"===t?"render":"children",a="function"==typeof e[t],u="function"==typeof e[i];return a&&u?new Error("MobX Observer: Do not use children and render in the same time in`"+n):a||u?null:new Error("Invalid prop `"+o+"` of type `"+typeof e[t]+"` supplied to `"+n+"`, expected `function`.")}_.propTypes={children:O,render:O},_.displayName="Observer"}).call(this,n(81))},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},,,function(e,t,n){"use strict";var r=n(260),o=n.n(r),i={config:{restApi:SliCommonL10n.restApi}},a=i.config.restApi.baseUrl,u={};i.config.restApi.wpNonce&&(u["X-WP-Nonce"]=i.config.restApi.wpNonce),i.config.restApi.sliNonce&&(u["X-Sli-Nonce"]=i.config.restApi.sliNonce);var l=o.a.create({baseURL:a,headers:u});t.a={config:i.config.restApi,driver:l,getFeeds:function(){return l.get("/feeds")},getFeedMedia:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return l.post("/media/fetch",{options:e,num:n,from:t})},getAccounts:function(){return l.get("/accounts")}}},,function(e,t,n){e.exports={root:"StoryLightbox__root layout__fill-parent layout__z-highest layout__flex-column",container:"StoryLightbox__container layout__flex-column",header:"StoryLightbox__header layout__flex-row","profile-picture":"StoryLightbox__profile-picture",profilePicture:"StoryLightbox__profile-picture",username:"StoryLightbox__username",date:"StoryLightbox__date",progress:"StoryLightbox__progress layout__flex-row","progress-segment":"StoryLightbox__progress-segment",progressSegment:"StoryLightbox__progress-segment","progress-overlay":"StoryLightbox__progress-overlay StoryLightbox__progress-segment",progressOverlay:"StoryLightbox__progress-overlay StoryLightbox__progress-segment","progress-overlay-animating":"StoryLightbox__progress-overlay-animating StoryLightbox__progress-overlay StoryLightbox__progress-segment",progressOverlayAnimating:"StoryLightbox__progress-overlay-animating StoryLightbox__progress-overlay StoryLightbox__progress-segment","progress-segment-animation":"StoryLightbox__progress-segment-animation",progressSegmentAnimation:"StoryLightbox__progress-segment-animation","progress-overlay-done":"StoryLightbox__progress-overlay-done StoryLightbox__progress-overlay StoryLightbox__progress-segment",progressOverlayDone:"StoryLightbox__progress-overlay-done StoryLightbox__progress-overlay StoryLightbox__progress-segment",content:"StoryLightbox__content layout__flex-row layout__flex-center",media:"StoryLightbox__media",button:"StoryLightbox__button","close-button":"StoryLightbox__close-button StoryLightbox__button",closeButton:"StoryLightbox__close-button StoryLightbox__button","nav-button":"StoryLightbox__nav-button StoryLightbox__button",navButton:"StoryLightbox__nav-button StoryLightbox__button","prev-button":"StoryLightbox__prev-button StoryLightbox__nav-button StoryLightbox__button",prevButton:"StoryLightbox__prev-button StoryLightbox__nav-button StoryLightbox__button","next-button":"StoryLightbox__next-button StoryLightbox__nav-button StoryLightbox__button",nextButton:"StoryLightbox__next-button StoryLightbox__nav-button StoryLightbox__button"}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var r=n(23),o=(n(56),n(0)),i=n.n(o),a=n(50),u=(n(21),n(33)),l=n(84),s=n(43);i.a.Component,i.a.Component;var c=function(e,t){return"function"==typeof e?e(t):e},f=function(e,t){return"string"==typeof e?Object(a.c)(e,null,null,t):e},d=function(e){return e},p=i.a.forwardRef;void 0===p&&(p=d);var h=p((function(e,t){var n=e.innerRef,r=e.navigate,o=e.onClick,a=Object(l.a)(e,["innerRef","navigate","onClick"]),s=a.target,c=Object(u.a)({},a,{onClick:function(e){try{o&&o(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||s&&"_self"!==s||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),r())}});return c.ref=d!==p&&t||n,i.a.createElement("a",c)})),v=p((function(e,t){var n=e.component,o=void 0===n?h:n,a=e.replace,v=e.to,m=e.innerRef,b=Object(l.a)(e,["component","replace","to","innerRef"]);return i.a.createElement(r.d.Consumer,null,(function(e){e||Object(s.a)(!1);var n=e.history,r=f(c(v,e.location),e.location),l=r?n.createHref(r):"",h=Object(u.a)({},b,{href:l,navigate:function(){var t=c(v,e.location);(a?n.replace:n.push)(t)}});return d!==p?h.ref=t||m:h.innerRef=m,i.a.createElement(o,h)}))})),m=function(e){return e},b=i.a.forwardRef;void 0===b&&(b=m),b((function(e,t){var n=e["aria-current"],o=void 0===n?"page":n,a=e.activeClassName,d=void 0===a?"active":a,p=e.activeStyle,h=e.className,g=e.exact,y=e.isActive,w=e.location,x=e.sensitive,E=e.strict,_=e.style,O=e.to,S=e.innerRef,C=Object(l.a)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return i.a.createElement(r.d.Consumer,null,(function(e){e||Object(s.a)(!1);var n=w||e.location,a=f(c(O,n),n),l=a.pathname,k=l&&l.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),P=k?Object(r.e)(n.pathname,{path:k,exact:g,sensitive:x,strict:E}):null,T=!!(y?y(P,n):P),j=T?function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((function(e){return e})).join(" ")}(h,d):h,A=T?Object(u.a)({},_,{},p):_,M=Object(u.a)({"aria-current":T&&o||null,className:j,style:A,to:a},C);return m!==b?M.ref=t||S:M.innerRef=S,i.a.createElement(v,M)}))}))},function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){}}(),e.exports=n(290)},,function(e,t,n){"use strict";t.a=function(e,t){if(!e)throw new Error("Invariant failed")}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(e){return"string"==typeof e?e:"r"in e?"rgba("+e.r+","+e.g+","+e.b+","+e.a+")":"h"in e?"hsla("+e.h+","+e.s+","+e.l+","+e.a+")":"#fff"}},function(e,t,n){e.exports={root:"FeedHeader__root",container:"FeedHeader__container","left-container":"FeedHeader__left-container FeedHeader__container",leftContainer:"FeedHeader__left-container FeedHeader__container","right-container":"FeedHeader__right-container FeedHeader__container",rightContainer:"FeedHeader__right-container FeedHeader__container","profile-pic":"FeedHeader__profile-pic",profilePic:"FeedHeader__profile-pic","profile-pic-with-stories":"FeedHeader__profile-pic-with-stories FeedHeader__profile-pic",profilePicWithStories:"FeedHeader__profile-pic-with-stories FeedHeader__profile-pic",info:"FeedHeader__info","info-row":"FeedHeader__info-row",infoRow:"FeedHeader__info-row",username:"FeedHeader__username FeedHeader__info-row",subtext:"FeedHeader__subtext FeedHeader__info-row",bio:"FeedHeader__bio FeedHeader__subtext FeedHeader__info-row","counter-list":"FeedHeader__counter-list FeedHeader__subtext FeedHeader__info-row",counterList:"FeedHeader__counter-list FeedHeader__subtext FeedHeader__info-row",counter:"FeedHeader__counter","follow-button":"FeedHeader__follow-button",followButton:"FeedHeader__follow-button","normal-style":"FeedHeader__normal-style FeedHeader__root",normalStyle:"FeedHeader__normal-style FeedHeader__root","centered-style":"FeedHeader__centered-style FeedHeader__root",centeredStyle:"FeedHeader__centered-style FeedHeader__root","boxed-style":"FeedHeader__boxed-style FeedHeader__root",boxedStyle:"FeedHeader__boxed-style FeedHeader__root"}},function(e,t,n){"use strict";n.d(t,"a",(function(){return x})),n.d(t,"b",(function(){return _}));var r=n(0),o=n.n(r),i=n(41),a=n.n(i),u=n(2);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return f(e,arguments,h(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)})(e)}function f(e,t,n){return(f=d()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&p(o,n.prototype),o}).apply(null,arguments)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return m(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,void 0):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t&&g(e.prototype,t),n&&g(e,n),e}var w=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];b(this,e),this.factories=n,this.extensions=new Map,this.cache=new Map,r.forEach((function(e){return t.addModule(e)}))}return y(e,[{key:"addModule",value:function(e){var t=this;e.factories&&(this.factories=new Map([].concat(v(this.factories),v(e.factories)))),e.extensions&&e.extensions.forEach((function(e,n){t.extensions.has(n)?t.extensions.get(n).push(e):t.extensions.set(n,[e])}))}},{key:"get",value:function(e){var t=this,n=this.factories.get(e);if(void 0===n)throw new Error('Service "'+e+'" does not exist');var r=this.cache.get(e);if(void 0===r){r=n(this);var o=this.extensions.get(e);o&&o.forEach((function(e){return r=e(t,r)})),this.cache.set(e,r)}return r}},{key:"has",value:function(e){return this.factories.has(e)}}]),e}(),x=function(){function e(t,n,r){b(this,e),this.key=t,this.mount=n,this.modules=r,this.container=null}return y(e,[{key:"addModules",value:function(e){this.modules=this.modules.concat(e)}},{key:"run",value:function(){var e=this;null===this.container&&window.addEventListener("load",(function(){var t,n;n="app/".concat((t=e).key,"/run"),document.dispatchEvent(new E(n,t));var r=_({root:function(){return null},"root/children":function(){return[]}});e.container=new w(r,e.modules);var i=e.container.get("root/children").map((function(e,t){return o.a.createElement(e,{key:t})})),l=o.a.createElement(u.a,{c:e.container},i);e.modules.forEach((function(t){return t.run&&t.run(e.container)})),a.a.render(l,e.mount)}))}}]),e}(),E=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(o,e);var t,n,r=(t=o,n=d(),function(){var e,r=h(t);if(n){var o=h(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return s(this,e)});function o(e,t){return b(this,o),r.call(this,e,{detail:{app:t}})}return y(o,[{key:"app",get:function(){return this.detail.app}}]),o}(c(CustomEvent));function _(e){return new Map(Object.entries(e))}},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return y})),n.d(t,"b",(function(){return O})),n.d(t,"d",(function(){return C})),n.d(t,"c",(function(){return p})),n.d(t,"f",(function(){return h})),n.d(t,"e",(function(){return d}));var r=n(33);function o(e){return"/"===e.charAt(0)}function i(e,t){for(var n=t,r=n+1,o=e.length;r<o;n+=1,r+=1)e[n]=e[r];e.pop()}function a(e){return e.valueOf?e.valueOf():Object.prototype.valueOf.call(e)}var u=n(43);function l(e){return"/"===e.charAt(0)?e:"/"+e}function s(e){return"/"===e.charAt(0)?e.substr(1):e}function c(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function f(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function d(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function p(e,t,n,a){var u;"string"==typeof e?(u=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var i=t.indexOf("?");return-1!==i&&(n=t.substr(i),t=t.substr(0,i)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e)).state=t:(void 0===(u=Object(r.a)({},e)).pathname&&(u.pathname=""),u.search?"?"!==u.search.charAt(0)&&(u.search="?"+u.search):u.search="",u.hash?"#"!==u.hash.charAt(0)&&(u.hash="#"+u.hash):u.hash="",void 0!==t&&void 0===u.state&&(u.state=t));try{u.pathname=decodeURI(u.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+u.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(u.key=n),a?u.pathname?"/"!==u.pathname.charAt(0)&&(u.pathname=function(e,t){void 0===t&&(t="");var n,r=e&&e.split("/")||[],a=t&&t.split("/")||[],u=e&&o(e),l=t&&o(t),s=u||l;if(e&&o(e)?a=r:r.length&&(a.pop(),a=a.concat(r)),!a.length)return"/";if(a.length){var c=a[a.length-1];n="."===c||".."===c||""===c}else n=!1;for(var f=0,d=a.length;d>=0;d--){var p=a[d];"."===p?i(a,d):".."===p?(i(a,d),f++):f&&(i(a,d),f--)}if(!s)for(;f--;f)a.unshift("..");!s||""===a[0]||a[0]&&o(a[0])||a.unshift("");var h=a.join("/");return n&&"/"!==h.substr(-1)&&(h+="/"),h}(u.pathname,a.pathname)):u.pathname=a.pathname:u.pathname||(u.pathname="/"),u}function h(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&function e(t,n){if(t===n)return!0;if(null==t||null==n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every((function(t,r){return e(t,n[r])}));if("object"==typeof t||"object"==typeof n){var r=a(t),o=a(n);return r!==t||o!==n?e(r,o):Object.keys(Object.assign({},t,n)).every((function(r){return e(t[r],n[r])}))}return!1}(e.state,t.state)}function v(){var e=null,t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var i="function"==typeof e?e(t,n):e;"string"==typeof i?"function"==typeof r?r(i,o):o(!0):o(!1!==i)}else o(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.forEach((function(e){return e.apply(void 0,n)}))}}}var m=!("undefined"==typeof window||!window.document||!window.document.createElement);function b(e,t){t(window.confirm(e))}function g(){try{return window.history.state||{}}catch(e){return{}}}function y(e){void 0===e&&(e={}),m||Object(u.a)(!1);var t,n=window.history,o=(-1===(t=window.navigator.userAgent).indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history,i=!(-1===window.navigator.userAgent.indexOf("Trident")),a=e,s=a.forceRefresh,h=void 0!==s&&s,y=a.getUserConfirmation,w=void 0===y?b:y,x=a.keyLength,E=void 0===x?6:x,_=e.basename?f(l(e.basename)):"";function O(e){var t=e||{},n=t.key,r=t.state,o=window.location,i=o.pathname+o.search+o.hash;return _&&(i=c(i,_)),p(i,r,n)}function S(){return Math.random().toString(36).substr(2,E)}var C=v();function k(e){Object(r.a)(B,e),B.length=n.length,C.notifyListeners(B.location,B.action)}function P(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||A(O(e.state))}function T(){A(O(g()))}var j=!1;function A(e){j?(j=!1,k()):C.confirmTransitionTo(e,"POP",w,(function(t){t?k({action:"POP",location:e}):function(e){var t=B.location,n=D.indexOf(t.key);-1===n&&(n=0);var r=D.indexOf(e.key);-1===r&&(r=0);var o=n-r;o&&(j=!0,F(o))}(e)}))}var M=O(g()),D=[M.key];function L(e){return _+d(e)}function F(e){n.go(e)}var N=0;function I(e){1===(N+=e)&&1===e?(window.addEventListener("popstate",P),i&&window.addEventListener("hashchange",T)):0===N&&(window.removeEventListener("popstate",P),i&&window.removeEventListener("hashchange",T))}var R=!1,B={length:n.length,action:"POP",location:M,createHref:L,push:function(e,t){var r=p(e,t,S(),B.location);C.confirmTransitionTo(r,"PUSH",w,(function(e){if(e){var t=L(r),i=r.key,a=r.state;if(o)if(n.pushState({key:i,state:a},null,t),h)window.location.href=t;else{var u=D.indexOf(B.location.key),l=D.slice(0,u+1);l.push(r.key),D=l,k({action:"PUSH",location:r})}else window.location.href=t}}))},replace:function(e,t){var r=p(e,t,S(),B.location);C.confirmTransitionTo(r,"REPLACE",w,(function(e){if(e){var t=L(r),i=r.key,a=r.state;if(o)if(n.replaceState({key:i,state:a},null,t),h)window.location.replace(t);else{var u=D.indexOf(B.location.key);-1!==u&&(D[u]=r.key),k({action:"REPLACE",location:r})}else window.location.replace(t)}}))},go:F,goBack:function(){F(-1)},goForward:function(){F(1)},block:function(e){void 0===e&&(e=!1);var t=C.setPrompt(e);return R||(I(1),R=!0),function(){return R&&(R=!1,I(-1)),t()}},listen:function(e){var t=C.appendListener(e);return I(1),function(){I(-1),t()}}};return B}var w={hashbang:{encodePath:function(e){return"!"===e.charAt(0)?e:"!/"+s(e)},decodePath:function(e){return"!"===e.charAt(0)?e.substr(1):e}},noslash:{encodePath:s,decodePath:l},slash:{encodePath:l,decodePath:l}};function x(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function E(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function _(e){window.location.replace(x(window.location.href)+"#"+e)}function O(e){void 0===e&&(e={}),m||Object(u.a)(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),o=n.getUserConfirmation,i=void 0===o?b:o,a=n.hashType,s=void 0===a?"slash":a,h=e.basename?f(l(e.basename)):"",g=w[s],y=g.encodePath,O=g.decodePath;function S(){var e=O(E());return h&&(e=c(e,h)),p(e)}var C=v();function k(e){Object(r.a)(B,e),B.length=t.length,C.notifyListeners(B.location,B.action)}var P=!1,T=null;function j(){var e,t,n=E(),r=y(n);if(n!==r)_(r);else{var o=S(),a=B.location;if(!P&&(t=o,(e=a).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(T===d(o))return;T=null,function(e){P?(P=!1,k()):C.confirmTransitionTo(e,"POP",i,(function(t){t?k({action:"POP",location:e}):function(e){var t=B.location,n=L.lastIndexOf(d(t));-1===n&&(n=0);var r=L.lastIndexOf(d(e));-1===r&&(r=0);var o=n-r;o&&(P=!0,F(o))}(e)}))}(o)}}var A=E(),M=y(A);A!==M&&_(M);var D=S(),L=[d(D)];function F(e){t.go(e)}var N=0;function I(e){1===(N+=e)&&1===e?window.addEventListener("hashchange",j):0===N&&window.removeEventListener("hashchange",j)}var R=!1,B={length:t.length,action:"POP",location:D,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=x(window.location.href)),n+"#"+y(h+d(e))},push:function(e,t){var n=p(e,void 0,void 0,B.location);C.confirmTransitionTo(n,"PUSH",i,(function(e){if(e){var t=d(n),r=y(h+t);if(E()!==r){T=t,function(e){window.location.hash=e}(r);var o=L.lastIndexOf(d(B.location)),i=L.slice(0,o+1);i.push(t),L=i,k({action:"PUSH",location:n})}else k()}}))},replace:function(e,t){var n=p(e,void 0,void 0,B.location);C.confirmTransitionTo(n,"REPLACE",i,(function(e){if(e){var t=d(n),r=y(h+t);E()!==r&&(T=t,_(r));var o=L.indexOf(d(B.location));-1!==o&&(L[o]=t),k({action:"REPLACE",location:n})}}))},go:F,goBack:function(){F(-1)},goForward:function(){F(1)},block:function(e){void 0===e&&(e=!1);var t=C.setPrompt(e);return R||(I(1),R=!0),function(){return R&&(R=!1,I(-1)),t()}},listen:function(e){var t=C.appendListener(e);return I(1),function(){I(-1),t()}}};return B}function S(e,t,n){return Math.min(Math.max(e,t),n)}function C(e){void 0===e&&(e={});var t=e,n=t.getUserConfirmation,o=t.initialEntries,i=void 0===o?["/"]:o,a=t.initialIndex,u=void 0===a?0:a,l=t.keyLength,s=void 0===l?6:l,c=v();function f(e){Object(r.a)(w,e),w.length=w.entries.length,c.notifyListeners(w.location,w.action)}function h(){return Math.random().toString(36).substr(2,s)}var m=S(u,0,i.length-1),b=i.map((function(e){return p(e,void 0,"string"==typeof e?h():e.key||h())})),g=d;function y(e){var t=S(w.index+e,0,w.entries.length-1),r=w.entries[t];c.confirmTransitionTo(r,"POP",n,(function(e){e?f({action:"POP",location:r,index:t}):f()}))}var w={length:b.length,action:"POP",location:b[m],index:m,entries:b,createHref:g,push:function(e,t){var r=p(e,t,h(),w.location);c.confirmTransitionTo(r,"PUSH",n,(function(e){if(e){var t=w.index+1,n=w.entries.slice(0);n.length>t?n.splice(t,n.length-t,r):n.push(r),f({action:"PUSH",location:r,index:t,entries:n})}}))},replace:function(e,t){var r=p(e,t,h(),w.location);c.confirmTransitionTo(r,"REPLACE",n,(function(e){e&&(w.entries[w.index]=r,f({action:"REPLACE",location:r}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t<w.entries.length},block:function(e){return void 0===e&&(e=!1),c.setPrompt(e)},listen:function(e){return c.appendListener(e)}};return w}},,function(e,t,n){"use strict";var r=n(202),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function a(e){return void 0===e}function u(e){return null!==e&&"object"==typeof e}function l(e){return"[object Function]"===o.call(e)}function s(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!a(e)&&null!==e.constructor&&!a(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isUndefined:a,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:l,isStream:function(e){return u(e)&&l(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:s,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,o=arguments.length;r<o;r++)s(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,o=arguments.length;r<o;r++)s(arguments[r],n);return t},extend:function(e,t,n){return s(t,(function(t,o){e[o]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){var r=n(441),o=n(445)((function(e,t,n){r(e,t,n)}));e.exports=o},function(e,t,n){"use strict";var r;n.d(t,"a",(function(){return r})),function(e){var t,n;(n=e.Type||(e.Type={})).IMAGE="IMAGE",n.VIDEO="VIDEO",n.ALBUM="CAROUSEL_ALBUM",function(e){!function(e){e.PERSONAL_ACCOUNT="PERSONAL_ACCOUNT",e.BUSINESS_ACCOUNT="BUSINESS_ACCOUNT",e.TAGGED_ACCOUNT="TAGGED_ACCOUNT",e.RECENT_HASHTAG="RECENT_HASHTAG",e.POPULAR_HASHTAG="POPULAR_HASHTAG",e.USER_STORY="USER_STORY"}(e.Type||(e.Type={}))}(t=e.Source||(e.Source={})),e.getAsRows=function(e,t){e=e.slice(),t=t>0?t:1;for(var n=[];e.length;)n.push(e.splice(0,t));if(n.length>0)for(var r=n.length-1;n[r].length<t;)n[r].push({});return n},e.isFromHashtag=function(e){return e.source.type===t.Type.POPULAR_HASHTAG||e.source.type===t.Type.RECENT_HASHTAG}}(r||(r={}))},function(e,t,n){"use strict";function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports={root:"MediaOverlay__root layout__fill-parent",rows:"MediaOverlay__rows",row:"MediaOverlay__row","top-row":"MediaOverlay__top-row MediaOverlay__row",topRow:"MediaOverlay__top-row MediaOverlay__row","middle-row":"MediaOverlay__middle-row MediaOverlay__row",middleRow:"MediaOverlay__middle-row MediaOverlay__row","bottom-row":"MediaOverlay__bottom-row MediaOverlay__row",bottomRow:"MediaOverlay__bottom-row MediaOverlay__row","counter-list":"MediaOverlay__counter-list",counterList:"MediaOverlay__counter-list",username:"MediaOverlay__username",date:"MediaOverlay__date",caption:"MediaOverlay__caption",counter:"MediaOverlay__counter","likes-count":"MediaOverlay__likes-count MediaOverlay__counter",likesCount:"MediaOverlay__likes-count MediaOverlay__counter","comments-count":"MediaOverlay__comments-count MediaOverlay__counter",commentsCount:"MediaOverlay__comments-count MediaOverlay__counter","ig-link-icon":"MediaOverlay__ig-link-icon",igLinkIcon:"MediaOverlay__ig-link-icon"}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},,function(e,t,n){var r=n(220),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},,function(e,t,n){e.exports={root:"GridLayout__root layout__flex-column",grid:"GridLayout__grid",cell:"GridLayout__cell","cell-content":"GridLayout__cell-content layout__fill-parent layout__flex-column",cellContent:"GridLayout__cell-content layout__fill-parent layout__flex-column","media-container":"GridLayout__media-container",mediaContainer:"GridLayout__media-container","media-meta":"GridLayout__media-meta layout__flex-column",mediaMeta:"GridLayout__media-meta layout__flex-column","button-list":"GridLayout__button-list layout__flex-column",buttonList:"GridLayout__button-list layout__flex-column"}},,function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.red=t.getContrastingColor=t.isValidHex=t.toState=t.simpleCheckForValidColor=void 0;var r=i(n(459)),o=i(n(461));function i(e){return e&&e.__esModule?e:{default:e}}t.simpleCheckForValidColor=function(e){var t=0,n=0;return(0,r.default)(["r","g","b","a","h","s","l","v"],(function(r){e[r]&&(t+=1,isNaN(e[r])||(n+=1),"s"===r||"l"===r)&&/^\d+%$/.test(e[r])&&(n+=1)})),t===n&&e};var a=t.toState=function(e,t){var n=e.hex?(0,o.default)(e.hex):(0,o.default)(e),r=n.toHsl(),i=n.toHsv(),a=n.toRgb(),u=n.toHex();return 0===r.s&&(r.h=t||0,i.h=t||0),{hsl:r,hex:"000000"===u&&0===a.a?"transparent":"#"+u,rgb:a,hsv:i,oldHue:e.h||t||r.h,source:e.source}};t.isValidHex=function(e){var t="#"===String(e).charAt(0)?1:0;return e.length!==4+t&&e.length<7+t&&(0,o.default)(e).isValid()},t.getContrastingColor=function(e){if(!e)return"#fff";var t=a(e);return"transparent"===t.hex?"rgba(0,0,0,0.4)":(299*t.rgb.r+587*t.rgb.g+114*t.rgb.b)/1e3>=128?"#000":"#fff"},t.red={hsl:{a:1,h:0,l:.5,s:1},hex:"#ff0000",rgb:{r:255,g:0,b:0,a:1},hsv:{h:0,s:1,v:1,a:1}},t.default=t},function(e,t,n){"use strict";var r=n(88);t.a=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Object(r.a)(t)}},,function(e,t,n){e.exports={root:"MediaAlbum__root",strip:"MediaAlbum__strip",frame:"MediaAlbum__frame",controls:"MediaAlbum__controls layout__fill-parent layout__flex-row","nav-button":"MediaAlbum__nav-button",navButton:"MediaAlbum__nav-button","prev-button":"MediaAlbum__prev-button MediaAlbum__nav-button",prevButton:"MediaAlbum__prev-button MediaAlbum__nav-button","next-button":"MediaAlbum__next-button MediaAlbum__nav-button",nextButton:"MediaAlbum__next-button MediaAlbum__nav-button","indicator-list":"MediaAlbum__indicator-list layout__flex-row",indicatorList:"MediaAlbum__indicator-list layout__flex-row",indicator:"MediaAlbum__indicator","indicator-current":"MediaAlbum__indicator-current MediaAlbum__indicator",indicatorCurrent:"MediaAlbum__indicator-current MediaAlbum__indicator"}},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return ve}));var r=n(178),o=n(0),i=n.n(o),a=n(62),u=n.n(a),l=n(2),s=n(101),c=n.n(s),f=n(55),d=n(57),p=n.n(d),h=n(516),v=n(13),m=n(11);function b(e){Object(m.a)(1,arguments);var t=Object(v.a)(e),n=t.getTime();return n}var g=n(519),y=n(5),w=n(8),x=n(14),E=Object(l.b)((function(e){var t,n=e.options,r=e.media,o=n.hoverInfo.some((function(e){return e===y.a.HoverInfo.LIKES_COMMENTS}));o=o&&(r.source.type!==f.a.Source.Type.PERSONAL_ACCOUNT||r.source.type===f.a.Source.Type.PERSONAL_ACCOUNT&&r.likesCount+r.commentsCount>0);var a=n.hoverInfo.some((function(e){return e===y.a.HoverInfo.CAPTION})),u=n.hoverInfo.some((function(e){return e===y.a.HoverInfo.USERNAME})),l=n.hoverInfo.some((function(e){return e===y.a.HoverInfo.DATE})),s=n.hoverInfo.some((function(e){return e===y.a.HoverInfo.INSTA_LINK})),c=null!==(t=r.caption)&&void 0!==t?t:"",d=r.timestamp?Object(h.a)(r.timestamp):null,v=r.timestamp?function(e){return Object(m.a)(1,arguments),Math.floor(b(e)/1e3)}(d).toString():null,E=r.timestamp?Object(g.a)(d,"HH:mm - do MMM yyyy"):null,_=r.timestamp?Object(x.d)(r.timestamp):null,O={color:n.textColorHover,backgroundColor:n.bgColorHover};return i.a.createElement("div",{className:p.a.root,style:O},i.a.createElement("div",{className:p.a.rows},i.a.createElement("div",{className:p.a.topRow},u&&r.username&&i.a.createElement("div",{className:p.a.username},i.a.createElement("a",{href:"https://instagram.com/"+r.username,target:"_blank"},"@",r.username)),a&&r.caption&&i.a.createElement("div",{className:p.a.caption},c)),i.a.createElement("div",{className:p.a.middleRow},o&&i.a.createElement("div",{className:p.a.counterList},i.a.createElement("span",{className:p.a.likesCount},i.a.createElement(w.a,{icon:"heart"})," ",r.likesCount),i.a.createElement("span",{className:p.a.commentsCount},i.a.createElement(w.a,{icon:"admin-comments"})," ",r.commentsCount))),i.a.createElement("div",{className:p.a.bottomRow},l&&r.timestamp&&i.a.createElement("div",{className:p.a.date},i.a.createElement("time",{dateTime:v,title:E},_)),s&&i.a.createElement("a",{className:p.a.igLinkIcon,href:r.permalink,title:c,target:"_blank",onClick:function(e){return e.stopPropagation()}},i.a.createElement(w.a,{icon:"instagram"})))))})),_=n(78);function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var S=Object(l.b)((function(e){var t,n,r=e.media,o=e.options,a=e.forceOverlay,u=e.onClick,l=(t=i.a.useState(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],f=l[1];return i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:c.a.root,onClick:function(e){u&&u(e)},onMouseEnter:function(){return f(!0)},onMouseLeave:function(){return f(!1)}},i.a.createElement(_.a,{media:r,isPreview:!0}),i.a.createElement("div",{className:C(r)}),(s||a)&&i.a.createElement("div",{className:c.a.overlay},i.a.createElement(E,{media:r,options:o}))))}));function C(e){switch(e.type){case f.a.Type.IMAGE:return c.a.imageTypeIcon;case f.a.Type.VIDEO:return c.a.videoTypeIcon;case f.a.Type.ALBUM:return c.a.albumTypeIcon;default:return}}var k=n(184),P=n.n(k),T=Object(l.b)((function(e){var t=e.media,n=e.options,r=e.full;if(!n.showCaptions||!t.type)return null;var o={color:n.captionColor,fontSize:n.captionSize},a=r?0:1,u=t.caption?t.caption:"",l=n.captionMaxLength?Object(x.e)(u,n.captionMaxLength):u,s=Object(x.c)(l,void 0,a),c=r?P.a.full:P.a.preview;return i.a.createElement("div",{className:c,style:o},s)})),j=n(152),A=n.n(j),M=Object(l.b)((function(e){var t=e.media,n=e.options;if(!t.type||t.source.type===f.a.Source.Type.PERSONAL_ACCOUNT)return null;var r={fontSize:n.lcIconSize,lineHeight:n.lcIconSize},o=Object.assign(Object.assign({},r),{color:n.likesIconColor}),a=Object.assign(Object.assign({},r),{color:n.commentsIconColor}),u={fontSize:n.lcIconSize,width:n.lcIconSize,height:n.lcIconSize};return n.showLcIcons&&i.a.createElement("div",{className:A.a.root},n.showLikes&&i.a.createElement("div",{className:A.a.icon,style:o},i.a.createElement(w.a,{icon:"heart",style:u}),i.a.createElement("span",null,t.likesCount)),n.showComments&&i.a.createElement("div",{className:A.a.icon,style:a},i.a.createElement(w.a,{icon:"admin-comments",style:u}),i.a.createElement("span",null,t.commentsCount)))})),D=n(102),L=n.n(D),F=n(41),N=n.n(F),I=n(89),R=n.n(I),B=n(4);function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H=function(e){var t=e.comment,n=e.className,r="https://instagram.com/".concat(t.username),o=i.a.createElement("a",{key:-1,href:r,target:"_blank",className:R.a.username},t.username),a=Object(x.c)(t.text,(function(e,t){return t>0?e:[o].concat(function(e){if(Array.isArray(e))return U(e)}(n=e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return U(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,void 0):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var n})),u=1===t.likeCount?"like":"likes";return i.a.createElement("div",{className:Object(B.b)(R.a.root,n)},i.a.createElement("div",{className:R.a.content},i.a.createElement("div",null,a)),i.a.createElement("div",{className:R.a.metaList},i.a.createElement("div",{className:R.a.date},Object(x.d)(t.timestamp)),i.a.createElement("div",{className:R.a.likeCount},"".concat(t.likeCount," ").concat(u))))},z=n(25),V=n.n(z);function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $(e){var t=e.mediaList,n=e.current,r=e.options,a=e.showSidebar,u=e.fullScreen,l=e.autoplay,s=e.interval,c=e.onClose;l=null!=l&&l,s=null!=s?s:5,u=null!=u&&u;var f,d,p=t.length-1,h=(f=i.a.useState(n),d=2,function(e){if(Array.isArray(e))return e}(f)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(f,d)||function(e,t){if(e){if("string"==typeof e)return W(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?W(e,t):void 0}}(f,d)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v=h[0],m=h[1],b=function(){return c&&c()},g=function(){return y((function(e){return e+1}))},y=function(e){m((function(t){return Math.min(Math.max(e(t),0),p)}))};Object(o.useEffect)((function(){y((function(){return n}))}),[n]);var E=t[v],O=E.comments?E.comments.slice(0,r.numLightboxComments):[],S={fontSize:r.textSize},C=function(e){y((function(e){return e-1})),e.stopPropagation(),e.preventDefault()},k=function(e){g(),e.stopPropagation(),e.preventDefault()},P=function(e){b(),e.stopPropagation(),e.preventDefault()};Object(o.useEffect)((function(){return document.body.addEventListener("keydown",T),function(){return document.body.removeEventListener("keydown",T)}}),[]);var T=function(e){switch(e.key){case"ArrowRight":k(e);break;case"ArrowLeft":C(e);break;case"Escape":P(e)}};Object(o.useEffect)((function(){var e;return l&&(e=setTimeout((function(){v>=p?b():g()}),1e3*s)),function(){return clearTimeout(e)}}),[]);var j=i.a.createElement("div",{style:S,className:V.a.root,tabIndex:-1},i.a.createElement("div",{className:u?V.a.shadeFullscreen:V.a.shade,onClick:P}),i.a.createElement("div",{className:V.a.closeButton,onClick:P,role:"button",tabIndex:0},i.a.createElement(w.a,{icon:"no-alt",className:V.a.buttonIcon})),v>0&&i.a.createElement("div",{className:V.a.prevButtonContainer},i.a.createElement("div",{className:V.a.prevButton,onClick:C,role:"button",tabIndex:0},i.a.createElement(w.a,{icon:"arrow-left-alt",className:V.a.buttonIcon}))),i.a.createElement("div",{className:V.a.container,role:"dialog"},i.a.createElement("div",{className:V.a.frame},i.a.createElement(_.a,{media:E,playableVideos:!0})),a&&i.a.createElement("div",{className:V.a.sidebar},i.a.createElement("div",{className:V.a.sidebarInfo},E.username&&E.username.length&&i.a.createElement("div",{className:V.a.sidebarUser},i.a.createElement("a",{href:"https://instagram.com/".concat(E.username),target:"_blank"},"@",E.username)),E.timestamp&&i.a.createElement("div",{className:V.a.sidebarDate},Object(x.d)(E.timestamp))),i.a.createElement("div",{className:V.a.sidebarScroller},E.caption&&E.caption.trim().length>0&&i.a.createElement("div",{className:V.a.sidebarCaption,key:E.id},Object(x.c)(E.caption)),O.length>0&&i.a.createElement("div",{className:V.a.sidebarCommentList},O.map((function(e,t){return i.a.createElement(H,{key:t,comment:e,className:V.a.sidebarComment})})))),i.a.createElement("div",{className:V.a.sidebarLink},i.a.createElement("a",{href:E.permalink,target:"_blank"},i.a.createElement(w.a,{icon:"instagram"}),i.a.createElement("span",null,"View on Instagram"))))),v<t.length-1&&i.a.createElement("div",{className:V.a.nextButtonContainer},i.a.createElement("div",{className:V.a.nextButton,onClick:k,role:"button",tabIndex:0},i.a.createElement(w.a,{icon:"arrow-right-alt",className:V.a.buttonIcon}))));return N.a.createPortal(j,document.body)}var G=n(46),Y=n.n(G),q=n(185),X=n.n(q),K=Object(l.b)((function(e){var t=e.options,n="https://instagram.com/"+t.account.username,r={color:t.followBtnTextColor,backgroundColor:t.followBtnBgColor};return i.a.createElement("a",{href:n,target:"__blank",className:X.a.link},i.a.createElement("button",{className:X.a.button,style:r},t.followBtnText))})),Q=n(38),J=n.n(Q),Z=n(517),ee=n(18);function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ne=Object(l.b)((function(e){var t,n,r=e.stories,o=e.options,a=e.onClose,u=(t=i.a.useState(0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?te(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=u[0],s=u[1],c=r.length-1,f=function(){return a&&a()},d=function(){return l<c?s(l+1):f()},p=function(){return s((function(e){return Math.max(e-1,0)}))},v=l<c,m=l>0,b=r[l],g="https://instagram.com/".concat(o.account.username);Object(ee.f)(1e3*o.storiesInterval,(function(){v?d():f()}),[l]),Object(ee.c)("keydown",(function(e){switch(e.key){case"Escape":f();break;case"ArrowLeft":p();break;case"ArrowRight":d();break;default:return}e.preventDefault(),e.stopPropagation()}));var y=i.a.createElement("div",{className:J.a.root},i.a.createElement("div",{className:J.a.container},i.a.createElement("div",{className:J.a.header},i.a.createElement("a",{href:g,target:"_blank"},i.a.createElement("img",{className:J.a.profilePicture,src:o.profilePhotoUrl,alt:o.account.username})),i.a.createElement("a",{href:g,className:J.a.username,target:"_blank"},o.account.username),i.a.createElement("div",{className:J.a.date},Object(Z.a)(Object(h.a)(b.timestamp),{addSuffix:!0}))),i.a.createElement("div",{className:J.a.progress},r.map((function(e,t){return i.a.createElement(re,{key:e.id,duration:o.storiesInterval,animate:t===l,isDone:t<l})}))),i.a.createElement("div",{className:J.a.content},m&&i.a.createElement("div",{className:J.a.prevButton,onClick:p,role:"button"},i.a.createElement(w.a,{icon:"arrow-left-alt2"})),i.a.createElement("div",{className:J.a.frame},i.a.createElement(_.a,{media:b,playableVideos:!0,autoplayVideos:!0})),v&&i.a.createElement("div",{className:J.a.nextButton,onClick:d,role:"button"},i.a.createElement(w.a,{icon:"arrow-right-alt2"})),i.a.createElement("div",{className:J.a.closeButton,onClick:f,role:"button"},i.a.createElement(w.a,{icon:"no-alt"})))));return N.a.createPortal(y,document.body)}));function re(e){var t=e.animate,n=e.isDone,r=e.duration,o=t?J.a.progressOverlayAnimating:n?J.a.progressOverlayDone:J.a.progressOverlay,a={animationDuration:r+"s"};return i.a.createElement("div",{className:J.a.progressSegment},i.a.createElement("div",{className:o,style:a}))}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ie=Object(l.b)((function(e){var t,n,r=e.feed,o=e.options,a=(t=i.a.useState(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return oe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oe(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=a[0],l=a[1],s=o.account,c="https://instagram.com/"+s.username,f=r.stories.filter((function(e){return e.username===s.username})),d=f.length>0,p=o.headerInfo.includes(y.a.HeaderInfo.MEDIA_COUNT),h=o.headerInfo.includes(y.a.HeaderInfo.FOLLOWERS),v=o.headerInfo.includes(y.a.HeaderInfo.PROFILE_PIC),m=o.includeStories&&d,b=o.headerStyle===y.a.HeaderStyle.BOXED,g={fontSize:o.headerTextSize,color:o.headerTextColor,backgroundColor:o.headerBgColor,padding:o.headerPadding},w=m?"button":void 0,x={width:o.headerPhotoSize,height:o.headerPhotoSize,cursor:m?"pointer":"normal"},E=o.showFollowBtn&&(o.followBtnLocation===y.a.FollowBtnLocation.HEADER||o.followBtnLocation===y.a.FollowBtnLocation.BOTH),_={justifyContent:o.showBio&&b?"flex-start":"center"},O=i.a.createElement("img",{src:o.profilePhotoUrl,alt:s.username}),S=m&&d?Y.a.profilePicWithStories:Y.a.profilePic;return i.a.createElement("div",{className:ae(o.headerStyle),style:g},i.a.createElement("div",{className:Y.a.leftContainer},v&&i.a.createElement("div",{className:S,style:x,role:w,onClick:function(){m&&l(0)}},m?O:i.a.createElement("a",{href:c,target:"_blank"},O)),i.a.createElement("div",{className:Y.a.info},i.a.createElement("div",{className:Y.a.username},i.a.createElement("a",{href:c,target:"_blank"},"@",s.username)),o.showBio&&i.a.createElement("div",{className:Y.a.bio},o.bioText),(p||h)&&i.a.createElement("div",{className:Y.a.counterList},p&&i.a.createElement("div",{className:Y.a.counter},i.a.createElement("span",null,s.mediaCount)," posts"),h&&i.a.createElement("div",{className:Y.a.counter},i.a.createElement("span",null,s.followersCount)," followers")))),i.a.createElement("div",{className:Y.a.rightContainer},E&&i.a.createElement("div",{className:Y.a.followButton,style:_},i.a.createElement(K,{options:o}))),m&&null!==u&&i.a.createElement(ne,{stories:f,options:o,onClose:function(){l(null)}}))}));function ae(e){switch(e){case y.a.HeaderStyle.NORMAL:return Y.a.normalStyle;case y.a.HeaderStyle.CENTERED:return Y.a.centeredStyle;case y.a.HeaderStyle.BOXED:return Y.a.boxedStyle;default:return}}var ue=n(259),le=n.n(ue),se=Object(l.b)((function(e){var t=e.feed,n=e.options,r=i.a.useRef(),o=Object(ee.e)(r),a={color:n.loadMoreBtnTextColor,backgroundColor:n.loadMoreBtnBgColor};return i.a.createElement("button",{ref:r,className:le.a.root,style:a,onClick:function(){o(),t.loadMore()}},t.isLoading?i.a.createElement("span",null,"Loading ..."):i.a.createElement("span",null,t.options.loadMoreBtnText))}));function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var fe=Object(l.b)((function(e){var t,n,r=e.children,o=e.feed,a=e.options,u=(t=i.a.useState(null),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ce(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=u[0],s=u[1],c={width:a.feedWidth,height:a.feedHeight,fontSize:a.textSize,paddingBottom:a.feedPadding},f={backgroundColor:a.bgColor,padding:a.feedPadding},d={marginBottom:a.imgPadding},p={marginTop:a.buttonPadding},h=a.showHeader&&i.a.createElement("div",{style:d},i.a.createElement(ie,{feed:o,options:a})),v=a.showLoadMoreBtn&&i.a.createElement("div",{className:L.a.loadMoreBtn,style:p},i.a.createElement(se,{feed:o,options:a})),m=a.showFollowBtn&&(a.followBtnLocation===y.a.FollowBtnLocation.BOTTOM||a.followBtnLocation===y.a.FollowBtnLocation.BOTH)&&i.a.createElement("div",{className:L.a.followBtn,style:p},i.a.createElement(K,{options:a})),b=new Array(a.numPosts).fill(L.a.fakeMedia);return i.a.createElement("div",{className:L.a.root,style:c},i.a.createElement("div",{className:L.a.wrapper,style:f},r({mediaList:o.media,openMedia:function(e){switch(a.linkBehavior){case y.a.LinkBehavior.LIGHTBOX:return void s(e);case y.a.LinkBehavior.NEW_TAB:return void window.open(o.media[e].permalink,"_blank");case y.a.LinkBehavior.SELF:return void window.open(o.media[e].permalink,"_self")}},header:h,loadMoreBtn:v,followBtn:m,loadingMedia:b})),null!==l&&i.a.createElement($,{mediaList:o.media,current:l,options:a,showSidebar:a.lightboxShowSidebar,onClose:function(){return s(null)}}))})),de=Object(l.b)((function(e){var t=e.feed,n=e.options,r=e.cellClassName;r=null!=r?r:function(){};var o={gridGap:n.imgPadding,gridTemplateColumns:"repeat(".concat(n.numColumns,", auto)")};return i.a.createElement(fe,{feed:t,options:n},(function(e){var a=e.mediaList,l=e.openMedia,s=e.header,c=e.loadMoreBtn,f=e.followBtn,d=e.loadingMedia;return i.a.createElement("div",{className:u.a.root},s,(!t.isLoading||t.isLoadingMore)&&i.a.createElement("div",{className:u.a.grid,style:o},t.media.length?a.map((function(e,t){return i.a.createElement("div",{key:"".concat(t,"-").concat(e.id),className:Object(B.b)(u.a.cell,r(e,t))},i.a.createElement("div",{className:u.a.cellContent},i.a.createElement("div",{className:u.a.mediaContainer},i.a.createElement(S,{media:e,onClick:function(){return l(t)},options:n})),i.a.createElement("div",{className:u.a.mediaMeta},i.a.createElement(T,{options:n,media:e}),i.a.createElement(M,{options:n,media:e}))))})):null,t.isLoadingMore&&d.map((function(e,t){return i.a.createElement("div",{key:"fake-media-".concat(Object(x.f)()),className:Object(B.b)(u.a.loadingCell,e,r(null,t))})}))),t.isLoading&&!t.isLoadingMore&&i.a.createElement("div",{className:u.a.grid,style:o},d.map((function(e,t){return i.a.createElement("div",{key:"fake-media-".concat(Object(x.f)()),className:Object(B.b)(u.a.loadingCell,e,r(null,t))})}))),i.a.createElement("div",{className:u.a.buttonList},c,f))}))}));function pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var he,ve=((he=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"getById",value:function(t){var n=e.list.find((function(e){return e.id===t}));return!n&&e.list.length>0?e.list[0]:n}},{key:"getName",value:function(t){var n=e.getById(t);return n?n.name:"(Missing layout)"}},{key:"addLayout",value:function(t){e.list.push(t)}}],null&&pe(t.prototype,null),n&&pe(t,n),e}()).list=[{id:"grid",name:"Grid",img:r.a,component:de}],he)},function(e,t,n){"use strict";n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return i}));var r=function(e){return Array.isArray(e)?e[0]:e},o=function(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}},i=function(e,t){if("function"==typeof e)return o(e,t);null!=e&&(e.current=t)}},,,function(e,t,n){var r=n(227),o=n(350),i=n(408),a=n(53);e.exports=function(e,t){return(a(e)?r:i)(e,o(t,3))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return W}));var r=n(0),o=n.n(r),i=n(94),a=n(10),u=n(41),l=n(24),s=n(16),c=n(66),f=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}],d=function(e){for(var t=0;t<f.length;t++)e=e.replace(f[t].letters,f[t].base);return e};function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var h=function(e){return e.replace(/^\s+|\s+$/g,"")},v=function(e){return e.label+" "+e.value};function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var b={name:"1laao21-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap;"},g=function(e){return Object(a.c)("span",m({css:b},e))};function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function w(e){e.in,e.out,e.onExited,e.appear,e.enter,e.exit;var t=e.innerRef,n=(e.emotion,function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,["in","out","onExited","appear","enter","exit","innerRef","emotion"]));return Object(a.c)("input",y({ref:t},n,{css:Object(c.a)({label:"dummyInput",background:0,border:0,fontSize:"inherit",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(0)"},"")}))}var x=function(e){var t,n;function r(){return e.apply(this,arguments)||this}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=r.prototype;return o.componentDidMount=function(){this.props.innerRef(Object(u.findDOMNode)(this))},o.componentWillUnmount=function(){this.props.innerRef(null)},o.render=function(){return this.props.children},r}(r.Component),E=["boxSizing","height","overflow","paddingRight","position"],_={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function O(e){e.preventDefault()}function S(e){e.stopPropagation()}function C(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;0===e?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function k(){return"ontouchstart"in window||navigator.maxTouchPoints}var P=!(!window.document||!window.document.createElement),T=0,j=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).originalStyles={},t.listenerOptions={capture:!1,passive:!1},t}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var o=r.prototype;return o.componentDidMount=function(){var e=this;if(P){var t=this.props,n=t.accountForScrollbars,r=t.touchScrollTarget,o=document.body,i=o&&o.style;if(n&&E.forEach((function(t){var n=i&&i[t];e.originalStyles[t]=n})),n&&T<1){var a=parseInt(this.originalStyles.paddingRight,10)||0,u=document.body?document.body.clientWidth:0,l=window.innerWidth-u+a||0;Object.keys(_).forEach((function(e){var t=_[e];i&&(i[e]=t)})),i&&(i.paddingRight=l+"px")}o&&k()&&(o.addEventListener("touchmove",O,this.listenerOptions),r&&(r.addEventListener("touchstart",C,this.listenerOptions),r.addEventListener("touchmove",S,this.listenerOptions))),T+=1}},o.componentWillUnmount=function(){var e=this;if(P){var t=this.props,n=t.accountForScrollbars,r=t.touchScrollTarget,o=document.body,i=o&&o.style;T=Math.max(T-1,0),n&&T<1&&E.forEach((function(t){var n=e.originalStyles[t];i&&(i[t]=n)})),o&&k()&&(o.removeEventListener("touchmove",O,this.listenerOptions),r&&(r.removeEventListener("touchstart",C,this.listenerOptions),r.removeEventListener("touchmove",S,this.listenerOptions)))}},o.render=function(){return null},r}(r.Component);j.defaultProps={accountForScrollbars:!0};var A={name:"1dsbpcp",styles:"position:fixed;left:0;bottom:0;right:0;top:0;"},M=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={touchScrollTarget:null},t.getScrollTarget=function(e){e!==t.state.touchScrollTarget&&t.setState({touchScrollTarget:e})},t.blurSelectInput=function(){document.activeElement&&document.activeElement.blur()},t}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,r.prototype.render=function(){var e=this.props,t=e.children,n=e.isEnabled,r=this.state.touchScrollTarget;return n?Object(a.c)("div",null,Object(a.c)("div",{onClick:this.blurSelectInput,css:A}),Object(a.c)(x,{innerRef:this.getScrollTarget},t),r?Object(a.c)(j,{touchScrollTarget:r}):null):t},r}(r.PureComponent),D=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).isBottom=!1,t.isTop=!1,t.scrollTarget=void 0,t.touchStart=void 0,t.cancelScroll=function(e){e.preventDefault(),e.stopPropagation()},t.handleEventDelta=function(e,n){var r=t.props,o=r.onBottomArrive,i=r.onBottomLeave,a=r.onTopArrive,u=r.onTopLeave,l=t.scrollTarget,s=l.scrollTop,c=l.scrollHeight,f=l.clientHeight,d=t.scrollTarget,p=n>0,h=c-f-s,v=!1;h>n&&t.isBottom&&(i&&i(e),t.isBottom=!1),p&&t.isTop&&(u&&u(e),t.isTop=!1),p&&n>h?(o&&!t.isBottom&&o(e),d.scrollTop=c,v=!0,t.isBottom=!0):!p&&-n>s&&(a&&!t.isTop&&a(e),d.scrollTop=0,v=!0,t.isTop=!0),v&&t.cancelScroll(e)},t.onWheel=function(e){t.handleEventDelta(e,e.deltaY)},t.onTouchStart=function(e){t.touchStart=e.changedTouches[0].clientY},t.onTouchMove=function(e){var n=t.touchStart-e.changedTouches[0].clientY;t.handleEventDelta(e,n)},t.getScrollTarget=function(e){t.scrollTarget=e},t}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var i=r.prototype;return i.componentDidMount=function(){this.startListening(this.scrollTarget)},i.componentWillUnmount=function(){this.stopListening(this.scrollTarget)},i.startListening=function(e){e&&("function"==typeof e.addEventListener&&e.addEventListener("wheel",this.onWheel,!1),"function"==typeof e.addEventListener&&e.addEventListener("touchstart",this.onTouchStart,!1),"function"==typeof e.addEventListener&&e.addEventListener("touchmove",this.onTouchMove,!1))},i.stopListening=function(e){"function"==typeof e.removeEventListener&&e.removeEventListener("wheel",this.onWheel,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchstart",this.onTouchStart,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchmove",this.onTouchMove,!1)},i.render=function(){return o.a.createElement(x,{innerRef:this.getScrollTarget},this.props.children)},r}(r.Component);function L(e){var t=e.isEnabled,n=void 0===t||t,r=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,["isEnabled"]);return n?o.a.createElement(D,r):r.children}var F=function(e,t){void 0===t&&(t={});var n=t,r=n.isSearchable,o=n.isMulti,i=n.label,a=n.isDisabled;switch(e){case"menu":return"Use Up and Down to choose options"+(a?"":", press Enter to select the currently focused option")+", press Escape to exit the menu, press Tab to select the option and exit the menu.";case"input":return(i||"Select")+" is focused "+(r?",type to refine list":"")+", press Down to open the menu, "+(o?" press left to focus selected values":"");case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value"}},N=function(e,t){var n=t.value,r=t.isDisabled;if(n)switch(e){case"deselect-option":case"pop-value":case"remove-value":return"option "+n+", deselected.";case"select-option":return r?"option "+n+" is disabled. Select another option.":"option "+n+", selected."}},I=function(e){return!!e.isDisabled},R={clearIndicator:s.d,container:s.b,control:s.c,dropdownIndicator:s.e,group:s.h,groupHeading:s.f,indicatorsContainer:s.j,indicatorSeparator:s.g,input:s.i,loadingIndicator:s.m,loadingMessage:s.k,menu:s.n,menuList:s.l,menuPortal:s.o,multiValue:s.p,multiValueLabel:s.q,multiValueRemove:s.r,noOptionsMessage:s.s,option:s.t,placeholder:s.u,singleValue:s.v,valueContainer:s.w},B={borderRadius:4,colors:{primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},spacing:{baseUnit:4,controlHeight:38,menuGutter:8}};function U(){return(U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function H(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var z={backspaceRemovesValue:!0,blurInputOnSelect:Object(l.i)(),captureMenuScroll:!Object(l.i)(),closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:function(e,t){var n=p({ignoreCase:!0,ignoreAccents:!0,stringify:v,trim:!0,matchFrom:"any"},void 0),r=n.ignoreCase,o=n.ignoreAccents,i=n.stringify,a=n.trim,u=n.matchFrom,l=a?h(t):t,s=a?h(i(e)):i(e);return r&&(l=l.toLowerCase(),s=s.toLowerCase()),o&&(l=d(l),s=d(s)),"start"===u?s.substr(0,l.length)===l:s.indexOf(l)>-1},formatGroupLabel:function(e){return e.label},getOptionLabel:function(e){return e.label},getOptionValue:function(e){return e.value},isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:I,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Object(l.d)(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return t+" result"+(1!==t?"s":"")+" available"},styles:{},tabIndex:"0",tabSelectsValue:!0},V=1,W=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).state={ariaLiveSelection:"",ariaLiveContext:"",focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,menuOptions:{render:[],focusable:[]},selectValue:[]},n.blockOptionHover=!1,n.isComposing=!1,n.clearFocusValueOnUpdate=!1,n.commonProps=void 0,n.components=void 0,n.hasGroups=!1,n.initialTouchX=0,n.initialTouchY=0,n.inputIsHiddenAfterUpdate=void 0,n.instancePrefix="",n.openAfterFocus=!1,n.scrollToFocusedOptionOnUpdate=!1,n.userIsDragging=void 0,n.controlRef=null,n.getControlRef=function(e){n.controlRef=e},n.focusedOptionRef=null,n.getFocusedOptionRef=function(e){n.focusedOptionRef=e},n.menuListRef=null,n.getMenuListRef=function(e){n.menuListRef=e},n.inputRef=null,n.getInputRef=function(e){n.inputRef=e},n.cacheComponents=function(e){n.components=Object(s.x)({components:e})},n.focus=n.focusInput,n.blur=n.blurInput,n.onChange=function(e,t){var r=n.props;(0,r.onChange)(e,U({},t,{name:r.name}))},n.setValue=function(e,t,r){void 0===t&&(t="set-value");var o=n.props,i=o.closeMenuOnSelect,a=o.isMulti;n.onInputChange("",{action:"set-value"}),i&&(n.inputIsHiddenAfterUpdate=!a,n.onMenuClose()),n.clearFocusValueOnUpdate=!0,n.onChange(e,{action:t,option:r})},n.selectOption=function(e){var t=n.props,r=t.blurInputOnSelect,o=t.isMulti,i=n.state.selectValue;if(o)if(n.isOptionSelected(e,i)){var a=n.getOptionValue(e);n.setValue(i.filter((function(e){return n.getOptionValue(e)!==a})),"deselect-option",e),n.announceAriaLiveSelection({event:"deselect-option",context:{value:n.getOptionLabel(e)}})}else n.isOptionDisabled(e,i)?n.announceAriaLiveSelection({event:"select-option",context:{value:n.getOptionLabel(e),isDisabled:!0}}):(n.setValue([].concat(i,[e]),"select-option",e),n.announceAriaLiveSelection({event:"select-option",context:{value:n.getOptionLabel(e)}}));else n.isOptionDisabled(e,i)?n.announceAriaLiveSelection({event:"select-option",context:{value:n.getOptionLabel(e),isDisabled:!0}}):(n.setValue(e,"select-option"),n.announceAriaLiveSelection({event:"select-option",context:{value:n.getOptionLabel(e)}}));r&&n.blurInput()},n.removeValue=function(e){var t=n.state.selectValue,r=n.getOptionValue(e),o=t.filter((function(e){return n.getOptionValue(e)!==r}));n.onChange(o.length?o:null,{action:"remove-value",removedValue:e}),n.announceAriaLiveSelection({event:"remove-value",context:{value:e?n.getOptionLabel(e):""}}),n.focusInput()},n.clearValue=function(){var e=n.props.isMulti;n.onChange(e?[]:null,{action:"clear"})},n.popValue=function(){var e=n.state.selectValue,t=e[e.length-1],r=e.slice(0,e.length-1);n.announceAriaLiveSelection({event:"pop-value",context:{value:t?n.getOptionLabel(t):""}}),n.onChange(r.length?r:null,{action:"pop-value",removedValue:t})},n.getOptionLabel=function(e){return n.props.getOptionLabel(e)},n.getOptionValue=function(e){return n.props.getOptionValue(e)},n.getStyles=function(e,t){var r=R[e](t);r.boxSizing="border-box";var o=n.props.styles[e];return o?o(r,t):r},n.getElementId=function(e){return n.instancePrefix+"-"+e},n.getActiveDescendentId=function(){var e=n.props.menuIsOpen,t=n.state,r=t.menuOptions,o=t.focusedOption;if(o&&e){var i=r.focusable.indexOf(o),a=r.render[i];return a&&a.key}},n.announceAriaLiveSelection=function(e){var t=e.event,r=e.context;n.setState({ariaLiveSelection:N(t,r)})},n.announceAriaLiveContext=function(e){var t=e.event,r=e.context;n.setState({ariaLiveContext:F(t,U({},r,{label:n.props["aria-label"]}))})},n.onMenuMouseDown=function(e){0===e.button&&(e.stopPropagation(),e.preventDefault(),n.focusInput())},n.onMenuMouseMove=function(e){n.blockOptionHover=!1},n.onControlMouseDown=function(e){var t=n.props.openMenuOnClick;n.state.isFocused?n.props.menuIsOpen?"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&n.onMenuClose():t&&n.openMenu("first"):(t&&(n.openAfterFocus=!0),n.focusInput()),"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&e.preventDefault()},n.onDropdownIndicatorMouseDown=function(e){if(!(e&&"mousedown"===e.type&&0!==e.button||n.props.isDisabled)){var t=n.props,r=t.isMulti,o=t.menuIsOpen;n.focusInput(),o?(n.inputIsHiddenAfterUpdate=!r,n.onMenuClose()):n.openMenu("first"),e.preventDefault(),e.stopPropagation()}},n.onClearIndicatorMouseDown=function(e){e&&"mousedown"===e.type&&0!==e.button||(n.clearValue(),e.stopPropagation(),n.openAfterFocus=!1,"touchend"===e.type?n.focusInput():setTimeout((function(){return n.focusInput()})))},n.onScroll=function(e){"boolean"==typeof n.props.closeMenuOnScroll?e.target instanceof HTMLElement&&Object(l.j)(e.target)&&n.props.onMenuClose():"function"==typeof n.props.closeMenuOnScroll&&n.props.closeMenuOnScroll(e)&&n.props.onMenuClose()},n.onCompositionStart=function(){n.isComposing=!0},n.onCompositionEnd=function(){n.isComposing=!1},n.onTouchStart=function(e){var t=e.touches.item(0);t&&(n.initialTouchX=t.clientX,n.initialTouchY=t.clientY,n.userIsDragging=!1)},n.onTouchMove=function(e){var t=e.touches.item(0);if(t){var r=Math.abs(t.clientX-n.initialTouchX),o=Math.abs(t.clientY-n.initialTouchY);n.userIsDragging=r>5||o>5}},n.onTouchEnd=function(e){n.userIsDragging||(n.controlRef&&!n.controlRef.contains(e.target)&&n.menuListRef&&!n.menuListRef.contains(e.target)&&n.blurInput(),n.initialTouchX=0,n.initialTouchY=0)},n.onControlTouchEnd=function(e){n.userIsDragging||n.onControlMouseDown(e)},n.onClearIndicatorTouchEnd=function(e){n.userIsDragging||n.onClearIndicatorMouseDown(e)},n.onDropdownIndicatorTouchEnd=function(e){n.userIsDragging||n.onDropdownIndicatorMouseDown(e)},n.handleInputChange=function(e){var t=e.currentTarget.value;n.inputIsHiddenAfterUpdate=!1,n.onInputChange(t,{action:"input-change"}),n.onMenuOpen()},n.onInputFocus=function(e){var t=n.props,r=t.isSearchable,o=t.isMulti;n.props.onFocus&&n.props.onFocus(e),n.inputIsHiddenAfterUpdate=!1,n.announceAriaLiveContext({event:"input",context:{isSearchable:r,isMulti:o}}),n.setState({isFocused:!0}),(n.openAfterFocus||n.props.openMenuOnFocus)&&n.openMenu("first"),n.openAfterFocus=!1},n.onInputBlur=function(e){n.menuListRef&&n.menuListRef.contains(document.activeElement)?n.inputRef.focus():(n.props.onBlur&&n.props.onBlur(e),n.onInputChange("",{action:"input-blur"}),n.onMenuClose(),n.setState({focusedValue:null,isFocused:!1}))},n.onOptionHover=function(e){n.blockOptionHover||n.state.focusedOption===e||n.setState({focusedOption:e})},n.shouldHideSelectedOptions=function(){var e=n.props,t=e.hideSelectedOptions,r=e.isMulti;return void 0===t?r:t},n.onKeyDown=function(e){var t=n.props,r=t.isMulti,o=t.backspaceRemovesValue,i=t.escapeClearsValue,a=t.inputValue,u=t.isClearable,l=t.isDisabled,s=t.menuIsOpen,c=t.onKeyDown,f=t.tabSelectsValue,d=t.openMenuOnFocus,p=n.state,h=p.focusedOption,v=p.focusedValue,m=p.selectValue;if(!(l||"function"==typeof c&&(c(e),e.defaultPrevented))){switch(n.blockOptionHover=!0,e.key){case"ArrowLeft":if(!r||a)return;n.focusValue("previous");break;case"ArrowRight":if(!r||a)return;n.focusValue("next");break;case"Delete":case"Backspace":if(a)return;if(v)n.removeValue(v);else{if(!o)return;r?n.popValue():u&&n.clearValue()}break;case"Tab":if(n.isComposing)return;if(e.shiftKey||!s||!f||!h||d&&n.isOptionSelected(h,m))return;n.selectOption(h);break;case"Enter":if(229===e.keyCode)break;if(s){if(!h)return;if(n.isComposing)return;n.selectOption(h);break}return;case"Escape":s?(n.inputIsHiddenAfterUpdate=!1,n.onInputChange("",{action:"menu-close"}),n.onMenuClose()):u&&i&&n.clearValue();break;case" ":if(a)return;if(!s){n.openMenu("first");break}if(!h)return;n.selectOption(h);break;case"ArrowUp":s?n.focusOption("up"):n.openMenu("last");break;case"ArrowDown":s?n.focusOption("down"):n.openMenu("first");break;case"PageUp":if(!s)return;n.focusOption("pageup");break;case"PageDown":if(!s)return;n.focusOption("pagedown");break;case"Home":if(!s)return;n.focusOption("first");break;case"End":if(!s)return;n.focusOption("last");break;default:return}e.preventDefault()}},n.buildMenuOptions=function(e,t){var r=e.inputValue,o=void 0===r?"":r,i=e.options,a=function(e,r){var i=n.isOptionDisabled(e,t),a=n.isOptionSelected(e,t),u=n.getOptionLabel(e),l=n.getOptionValue(e);if(!(n.shouldHideSelectedOptions()&&a||!n.filterOption({label:u,value:l,data:e},o))){var s=i?void 0:function(){return n.onOptionHover(e)},c=i?void 0:function(){return n.selectOption(e)},f=n.getElementId("option")+"-"+r;return{innerProps:{id:f,onClick:c,onMouseMove:s,onMouseOver:s,tabIndex:-1},data:e,isDisabled:i,isSelected:a,key:f,label:u,type:"option",value:l}}};return i.reduce((function(e,t,r){if(t.options){n.hasGroups||(n.hasGroups=!0);var o=t.options.map((function(t,n){var o=a(t,r+"-"+n);return o&&e.focusable.push(t),o})).filter(Boolean);if(o.length){var i=n.getElementId("group")+"-"+r;e.render.push({type:"group",key:i,data:t,options:o})}}else{var u=a(t,""+r);u&&(e.render.push(u),e.focusable.push(t))}return e}),{render:[],focusable:[]})};var r=t.value;n.cacheComponents=Object(i.a)(n.cacheComponents,s.y).bind(H(H(n))),n.cacheComponents(t.components),n.instancePrefix="react-select-"+(n.props.instanceId||++V);var o=Object(l.e)(r);n.buildMenuOptions=Object(i.a)(n.buildMenuOptions,(function(e,t){var n=e,r=n[0],o=n[1],i=t,a=i[0],u=i[1];return Object(s.y)(o,u)&&Object(s.y)(r.inputValue,a.inputValue)&&Object(s.y)(r.options,a.options)})).bind(H(H(n)));var a=t.menuIsOpen?n.buildMenuOptions(t,o):{render:[],focusable:[]};return n.state.menuOptions=a,n.state.selectValue=o,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var a=r.prototype;return a.componentDidMount=function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()},a.UNSAFE_componentWillReceiveProps=function(e){var t=this.props,n=t.options,r=t.value,o=t.menuIsOpen,i=t.inputValue;if(this.cacheComponents(e.components),e.value!==r||e.options!==n||e.menuIsOpen!==o||e.inputValue!==i){var a=Object(l.e)(e.value),u=e.menuIsOpen?this.buildMenuOptions(e,a):{render:[],focusable:[]},s=this.getNextFocusedValue(a),c=this.getNextFocusedOption(u.focusable);this.setState({menuOptions:u,selectValue:a,focusedOption:c,focusedValue:s})}null!=this.inputIsHiddenAfterUpdate&&(this.setState({inputIsHidden:this.inputIsHiddenAfterUpdate}),delete this.inputIsHiddenAfterUpdate)},a.componentDidUpdate=function(e){var t=this.props,n=t.isDisabled,r=t.menuIsOpen,o=this.state.isFocused;(o&&!n&&e.isDisabled||o&&r&&!e.menuIsOpen)&&this.focusInput(),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Object(l.f)(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)},a.componentWillUnmount=function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)},a.onMenuOpen=function(){this.props.onMenuOpen()},a.onMenuClose=function(){var e=this.props,t=e.isSearchable,n=e.isMulti;this.announceAriaLiveContext({event:"input",context:{isSearchable:t,isMulti:n}}),this.onInputChange("",{action:"menu-close"}),this.props.onMenuClose()},a.onInputChange=function(e,t){this.props.onInputChange(e,t)},a.focusInput=function(){this.inputRef&&this.inputRef.focus()},a.blurInput=function(){this.inputRef&&this.inputRef.blur()},a.openMenu=function(e){var t=this,n=this.state,r=n.selectValue,o=n.isFocused,i=this.buildMenuOptions(this.props,r),a=this.props.isMulti,u="first"===e?0:i.focusable.length-1;if(!a){var l=i.focusable.indexOf(r[0]);l>-1&&(u=l)}this.scrollToFocusedOptionOnUpdate=!(o&&this.menuListRef),this.inputIsHiddenAfterUpdate=!1,this.setState({menuOptions:i,focusedValue:null,focusedOption:i.focusable[u]},(function(){t.onMenuOpen(),t.announceAriaLiveContext({event:"menu"})}))},a.focusValue=function(e){var t=this.props,n=t.isMulti,r=t.isSearchable,o=this.state,i=o.selectValue,a=o.focusedValue;if(n){this.setState({focusedOption:null});var u=i.indexOf(a);a||(u=-1,this.announceAriaLiveContext({event:"value"}));var l=i.length-1,s=-1;if(i.length){switch(e){case"previous":s=0===u?0:-1===u?l:u-1;break;case"next":u>-1&&u<l&&(s=u+1)}-1===s&&this.announceAriaLiveContext({event:"input",context:{isSearchable:r,isMulti:n}}),this.setState({inputIsHidden:-1!==s,focusedValue:i[s]})}}},a.focusOption=function(e){void 0===e&&(e="first");var t=this.props.pageSize,n=this.state,r=n.focusedOption,o=n.menuOptions.focusable;if(o.length){var i=0,a=o.indexOf(r);r||(a=-1,this.announceAriaLiveContext({event:"menu"})),"up"===e?i=a>0?a-1:o.length-1:"down"===e?i=(a+1)%o.length:"pageup"===e?(i=a-t)<0&&(i=0):"pagedown"===e?(i=a+t)>o.length-1&&(i=o.length-1):"last"===e&&(i=o.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:o[i],focusedValue:null}),this.announceAriaLiveContext({event:"menu",context:{isDisabled:I(o[i])}})}},a.getTheme=function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(B):U({},B,this.props.theme):B},a.getCommonProps=function(){var e=this.clearValue,t=this.getStyles,n=this.setValue,r=this.selectOption,o=this.props,i=o.classNamePrefix,a=o.isMulti,u=o.isRtl,s=o.options,c=this.state.selectValue,f=this.hasValue();return{cx:l.h.bind(null,i),clearValue:e,getStyles:t,getValue:function(){return c},hasValue:f,isMulti:a,isRtl:u,options:s,selectOption:r,setValue:n,selectProps:o,theme:this.getTheme()}},a.getNextFocusedValue=function(e){if(this.clearFocusValueOnUpdate)return this.clearFocusValueOnUpdate=!1,null;var t=this.state,n=t.focusedValue,r=t.selectValue.indexOf(n);if(r>-1){if(e.indexOf(n)>-1)return n;if(r<e.length)return e[r]}return null},a.getNextFocusedOption=function(e){var t=this.state.focusedOption;return t&&e.indexOf(t)>-1?t:e[0]},a.hasValue=function(){return this.state.selectValue.length>0},a.hasOptions=function(){return!!this.state.menuOptions.render.length},a.countOptions=function(){return this.state.menuOptions.focusable.length},a.isClearable=function(){var e=this.props,t=e.isClearable,n=e.isMulti;return void 0===t?n:t},a.isOptionDisabled=function(e,t){return"function"==typeof this.props.isOptionDisabled&&this.props.isOptionDisabled(e,t)},a.isOptionSelected=function(e,t){var n=this;if(t.indexOf(e)>-1)return!0;if("function"==typeof this.props.isOptionSelected)return this.props.isOptionSelected(e,t);var r=this.getOptionValue(e);return t.some((function(e){return n.getOptionValue(e)===r}))},a.filterOption=function(e,t){return!this.props.filterOption||this.props.filterOption(e,t)},a.formatOptionLabel=function(e,t){if("function"==typeof this.props.formatOptionLabel){var n=this.props.inputValue,r=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:n,selectValue:r})}return this.getOptionLabel(e)},a.formatGroupLabel=function(e){return this.props.formatGroupLabel(e)},a.startListeningComposition=function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))},a.stopListeningComposition=function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))},a.startListeningToTouch=function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))},a.stopListeningToTouch=function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))},a.constructAriaLiveMessage=function(){var e=this.state,t=e.ariaLiveContext,n=e.selectValue,r=e.focusedValue,o=e.focusedOption,i=this.props,a=i.options,u=i.menuIsOpen,l=i.inputValue,s=i.screenReaderStatus;return(r?function(e){var t=e.focusedValue,n=e.selectValue;return"value "+(0,e.getOptionLabel)(t)+" focused, "+(n.indexOf(t)+1)+" of "+n.length+"."}({focusedValue:r,getOptionLabel:this.getOptionLabel,selectValue:n}):"")+" "+(o&&u?function(e){var t=e.focusedOption,n=e.options;return"option "+(0,e.getOptionLabel)(t)+" focused"+(t.isDisabled?" disabled":"")+", "+(n.indexOf(t)+1)+" of "+n.length+"."}({focusedOption:o,getOptionLabel:this.getOptionLabel,options:a}):"")+" "+function(e){var t=e.inputValue;return e.screenReaderMessage+(t?" for search term "+t:"")+"."}({inputValue:l,screenReaderMessage:s({count:this.countOptions()})})+" "+t},a.renderInput=function(){var e=this.props,t=e.isDisabled,n=e.isSearchable,r=e.inputId,i=e.inputValue,a=e.tabIndex,u=this.components.Input,s=this.state.inputIsHidden,c=r||this.getElementId("input"),f={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};if(!n)return o.a.createElement(w,U({id:c,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:l.k,onFocus:this.onInputFocus,readOnly:!0,disabled:t,tabIndex:a,value:""},f));var d=this.commonProps,p=d.cx,h=d.theme,v=d.selectProps;return o.a.createElement(u,U({autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",cx:p,getStyles:this.getStyles,id:c,innerRef:this.getInputRef,isDisabled:t,isHidden:s,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,selectProps:v,spellCheck:"false",tabIndex:a,theme:h,type:"text",value:i},f))},a.renderPlaceholderOrValue=function(){var e=this,t=this.components,n=t.MultiValue,r=t.MultiValueContainer,i=t.MultiValueLabel,a=t.MultiValueRemove,u=t.SingleValue,l=t.Placeholder,s=this.commonProps,c=this.props,f=c.controlShouldRenderValue,d=c.isDisabled,p=c.isMulti,h=c.inputValue,v=c.placeholder,m=this.state,b=m.selectValue,g=m.focusedValue,y=m.isFocused;if(!this.hasValue()||!f)return h?null:o.a.createElement(l,U({},s,{key:"placeholder",isDisabled:d,isFocused:y}),v);if(p)return b.map((function(t,u){var l=t===g;return o.a.createElement(n,U({},s,{components:{Container:r,Label:i,Remove:a},isFocused:l,isDisabled:d,key:e.getOptionValue(t),index:u,removeProps:{onClick:function(){return e.removeValue(t)},onTouchEnd:function(){return e.removeValue(t)},onMouseDown:function(e){e.preventDefault(),e.stopPropagation()}},data:t}),e.formatOptionLabel(t,"value"))}));if(h)return null;var w=b[0];return o.a.createElement(u,U({},s,{data:w,isDisabled:d}),this.formatOptionLabel(w,"value"))},a.renderClearIndicator=function(){var e=this.components.ClearIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,i=n.isLoading,a=this.state.isFocused;if(!this.isClearable()||!e||r||!this.hasValue()||i)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return o.a.createElement(e,U({},t,{innerProps:u,isFocused:a}))},a.renderLoadingIndicator=function(){var e=this.components.LoadingIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,i=n.isLoading,a=this.state.isFocused;return e&&i?o.a.createElement(e,U({},t,{innerProps:{"aria-hidden":"true"},isDisabled:r,isFocused:a})):null},a.renderIndicatorSeparator=function(){var e=this.components,t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var r=this.commonProps,i=this.props.isDisabled,a=this.state.isFocused;return o.a.createElement(n,U({},r,{isDisabled:i,isFocused:a}))},a.renderDropdownIndicator=function(){var e=this.components.DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,r=this.state.isFocused,i={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return o.a.createElement(e,U({},t,{innerProps:i,isDisabled:n,isFocused:r}))},a.renderMenu=function(){var e=this,t=this.components,n=t.Group,r=t.GroupHeading,i=t.Menu,a=t.MenuList,u=t.MenuPortal,l=t.LoadingMessage,c=t.NoOptionsMessage,f=t.Option,d=this.commonProps,p=this.state,h=p.focusedOption,v=p.menuOptions,m=this.props,b=m.captureMenuScroll,g=m.inputValue,y=m.isLoading,w=m.loadingMessage,x=m.minMenuHeight,E=m.maxMenuHeight,_=m.menuIsOpen,O=m.menuPlacement,S=m.menuPosition,C=m.menuPortalTarget,k=m.menuShouldBlockScroll,P=m.menuShouldScrollIntoView,T=m.noOptionsMessage,j=m.onMenuScrollToTop,A=m.onMenuScrollToBottom;if(!_)return null;var D,F=function(t){var n=h===t.data;return t.innerRef=n?e.getFocusedOptionRef:void 0,o.a.createElement(f,U({},d,t,{isFocused:n}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())D=v.render.map((function(t){if("group"===t.type){t.type;var i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,["type"]),a=t.key+"-heading";return o.a.createElement(n,U({},d,i,{Heading:r,headingProps:{id:a},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return F(e)})))}if("option"===t.type)return F(t)}));else if(y){var N=w({inputValue:g});if(null===N)return null;D=o.a.createElement(l,d,N)}else{var I=T({inputValue:g});if(null===I)return null;D=o.a.createElement(c,d,I)}var R={minMenuHeight:x,maxMenuHeight:E,menuPlacement:O,menuPosition:S,menuShouldScrollIntoView:P},B=o.a.createElement(s.a,U({},d,R),(function(t){var n=t.ref,r=t.placerProps,u=r.placement,l=r.maxHeight;return o.a.createElement(i,U({},d,R,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:y,placement:u}),o.a.createElement(L,{isEnabled:b,onTopArrive:j,onBottomArrive:A},o.a.createElement(M,{isEnabled:k},o.a.createElement(a,U({},d,{innerRef:e.getMenuListRef,isLoading:y,maxHeight:l}),D))))}));return C||"fixed"===S?o.a.createElement(u,U({},d,{appendTo:C,controlElement:this.controlRef,menuPlacement:O,menuPosition:S}),B):B},a.renderFormField=function(){var e=this,t=this.props,n=t.delimiter,r=t.isDisabled,i=t.isMulti,a=t.name,u=this.state.selectValue;if(a&&!r){if(i){if(n){var l=u.map((function(t){return e.getOptionValue(t)})).join(n);return o.a.createElement("input",{name:a,type:"hidden",value:l})}var s=u.length>0?u.map((function(t,n){return o.a.createElement("input",{key:"i-"+n,name:a,type:"hidden",value:e.getOptionValue(t)})})):o.a.createElement("input",{name:a,type:"hidden"});return o.a.createElement("div",null,s)}var c=u[0]?this.getOptionValue(u[0]):"";return o.a.createElement("input",{name:a,type:"hidden",value:c})}},a.renderLiveRegion=function(){return this.state.isFocused?o.a.createElement(g,{"aria-live":"polite"},o.a.createElement("p",{id:"aria-selection-event"}," ",this.state.ariaLiveSelection),o.a.createElement("p",{id:"aria-context"}," ",this.constructAriaLiveMessage())):null},a.render=function(){var e=this.components,t=e.Control,n=e.IndicatorsContainer,r=e.SelectContainer,i=e.ValueContainer,a=this.props,u=a.className,l=a.id,s=a.isDisabled,c=a.menuIsOpen,f=this.state.isFocused,d=this.commonProps=this.getCommonProps();return o.a.createElement(r,U({},d,{className:u,innerProps:{id:l,onKeyDown:this.onKeyDown},isDisabled:s,isFocused:f}),this.renderLiveRegion(),o.a.createElement(t,U({},d,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:s,isFocused:f,menuIsOpen:c}),o.a.createElement(i,U({},d,{isDisabled:s}),this.renderPlaceholderOrValue(),this.renderInput()),o.a.createElement(n,U({},d,{isDisabled:s}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())},r}(r.Component);W.defaultProps=z},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},function(e,t,n){"use strict";n.d(t,"a",(function(){return w}));var r=n(258),o=n.n(r),i=n(0),a=n.n(i),u=n(55),l=n(182),s=n.n(l),c=n(4);function f(e){var t=e.url,n=e.isPlayable,r=e.isPreview,o=e.autoplay,i=e.className,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["url","isPlayable","isPreview","autoplay","className"]);r=null!=r&&r,n=(null==n||n)&&!r,o=null!=o&&o&&n;var l=Object(c.b)(r?s.a.preview:s.a.root,i);return a.a.createElement("div",Object.assign({},u,{className:l}),a.a.createElement("video",{src:t,autoPlay:o,controls:!!n,tabIndex:n?0:-1},a.a.createElement("source",{src:t}),"Your browser does not support videos"))}var d=n(68),p=n.n(d),h=n(8);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e){var t,n,r=e.album,o=e.isPreview,i=e.playableVideos,u=e.autoplayVideos,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["album","isPreview","playableVideos","autoplayVideos"]),s=(t=a.a.useState(0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}(t,n)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=s[0],f=s[1];if(o&&r.length>0)return a.a.createElement(w,Object.assign({media:r[0],isPreview:o,playableVideos:i,autoplayVideos:u},l));var d={transform:"translateX(".concat(100*-c,"%)")},m=r.length-1;return a.a.createElement("div",{className:p.a.root},a.a.createElement("div",{className:p.a.strip,style:d},r.map((function(e){return a.a.createElement("div",{key:e.id,className:p.a.frame},a.a.createElement(w,Object.assign({media:e,isPreview:o,playableVideos:i,autoplayVideos:u},l)))}))),!o&&a.a.createElement("div",{className:p.a.controls},a.a.createElement("div",null,c>0&&a.a.createElement("div",{className:p.a.prevButton,onClick:function(){return f(Math.max(c-1,0))},role:"button"},a.a.createElement(h.a,{icon:"arrow-left-alt2"}))),a.a.createElement("div",null,c<m&&a.a.createElement("div",{className:p.a.nextButton,onClick:function(){return f(Math.min(c+1,m))},role:"button"},a.a.createElement(h.a,{icon:"arrow-right-alt2"})))),!o&&a.a.createElement("div",{className:p.a.indicatorList},r.map((function(e,t){return a.a.createElement("div",{key:t,className:t===c?p.a.indicatorCurrent:p.a.indicator})}))))}var b=n(183),g=n.n(b);function y(e){var t=e.url,n=e.caption,r=e.isPreview,o=e.className,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["url","caption","isPreview","className"]);r=null!=r&&r;var u=Object(c.b)(r?g.a.preview:g.a.root,o);return a.a.createElement("div",Object.assign({},i,{className:u}),a.a.createElement("img",{src:t,alt:n,loading:"lazy"}))}function w(e){var t=e.media,n=e.playableVideos,r=e.autoplayVideos,i=e.isPreview,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["media","playableVideos","autoplayVideos","isPreview"]);switch(t.type){case u.a.Type.IMAGE:return a.a.createElement(y,Object.assign({url:t.url,caption:t.caption,isPreview:i},l));case u.a.Type.VIDEO:return a.a.createElement(f,Object.assign({url:t.url,isPlayable:n,isPreview:i,autoplay:r},l));case u.a.Type.ALBUM:if(t.children&&t.children.length>0)return a.a.createElement(m,Object.assign({album:t.children,isPreview:i,playableVideos:n,autoplayVideos:r},l))}return a.a.createElement("div",{className:o.a.notAvailable},a.a.createElement("span",null,"Thumbnail not available"))}},function(e,t,n){"use strict";function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return window.open(e,t,o(n))}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.getOwnPropertyNames(e).map((function(t){return"".concat(t,"=").concat(e[t])})).join(",")}function i(e,t){return{top:window.top.outerHeight/2+window.top.screenY-t/2,left:window.top.outerWidth/2+window.top.screenX-e/2,width:e,height:t}}function a(){var e=window;return{width:e.innerWidth,height:e.innerHeight}}n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return a}))},,function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(106),o=n(341),i=n(342),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},function(e,t,n){var r=n(363),o=n(366);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return h}));var r=n(27),o=n.n(r),i=n(77),a=n.n(i),u=n(28),l=n.n(u),s=n(0),c=n(186),f=n.n(c),d=f()(),p=f()(),h=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t=e.call.apply(e,[this].concat(r))||this,l()(o()(t),"referenceNode",void 0),l()(o()(t),"setReferenceNode",(function(e){e&&t.referenceNode!==e&&(t.referenceNode=e,t.forceUpdate())})),t}a()(t,e);var n=t.prototype;return n.componentWillUnmount=function(){this.referenceNode=null},n.render=function(){return s.createElement(d.Provider,{value:this.referenceNode},s.createElement(p.Provider,{value:this.setReferenceNode},this.props.children))},t}(s.Component)},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},,function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var r,o=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)},i={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},a=/[A-Z]|^ms/g,u=/_EMO_([^_]+?)_([^]*?)_EMO_/g,l=function(e){return 45===e.charCodeAt(1)},s=function(e){return null!=e&&"boolean"!=typeof e},c=(r={},function(e){return void 0===r[e]&&(r[e]=l(t=e)?t:t.replace(a,"-$&").toLowerCase()),r[e];var t}),f=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(u,(function(e,t,n){return p={name:t,styles:n,next:p},t}))}return 1===i[e]||l(e)||"number"!=typeof t||0===t?t:t+"px"};function d(e,t,n,r){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return p={name:n.name,styles:n.styles,next:p},n.name;if(void 0!==n.styles){var o=n.next;if(void 0!==o)for(;void 0!==o;)p={name:o.name,styles:o.styles,next:p},o=o.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=d(e,t,n[o],!1);else for(var i in n){var a=n[i];if("object"!=typeof a)null!=t&&void 0!==t[a]?r+=i+"{"+t[a]+"}":s(a)&&(r+=c(i)+":"+f(i,a)+";");else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var u=d(e,t,a,!1);switch(i){case"animation":case"animationName":r+=c(i)+":"+u+";";break;default:r+=i+"{"+u+"}"}}else for(var l=0;l<a.length;l++)s(a[l])&&(r+=c(i)+":"+f(i,a[l])+";")}return r}(e,t,n);case"function":if(void 0!==e){var i=p,a=n(e);return p=i,d(e,t,a,r)}}if(null==t)return n;var u=t[n];return void 0===u||r?n:u}var p,h=/label:\s*([^\s;\n{]+)\s*;/g,v=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,i="";p=void 0;var a=e[0];null==a||void 0===a.raw?(r=!1,i+=d(n,t,a,!1)):i+=a[0];for(var u=1;u<e.length;u++)i+=d(n,t,e[u],46===i.charCodeAt(i.length-1)),r&&(i+=a[u]);h.lastIndex=0;for(var l,s="";null!==(l=h.exec(i));)s+="-"+l[1];return{name:o(i)+s,styles:i,next:p}}},function(e,t,n){e.exports={root:"MediaComment__root",row:"MediaComment__row",username:"MediaComment__username",content:"MediaComment__content MediaComment__row","meta-list":"MediaComment__meta-list MediaComment__row",metaList:"MediaComment__meta-list MediaComment__row",meta:"MediaComment__meta",date:"MediaComment__date MediaComment__meta","like-count":"MediaComment__like-count MediaComment__meta",likeCount:"MediaComment__like-count MediaComment__meta"}},,,function(e,t,n){var r=n(169),o=n(165);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},,function(e,t,n){"use strict";function r(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}t.a=function(e,t){var n;void 0===t&&(t=r);var o,i=[],a=!1;return function(){for(var r=[],u=0;u<arguments.length;u++)r[u]=arguments[u];return a&&n===this&&t(r,i)||(o=e.apply(this,r),a=!0,n=this,i=r),o}}},,,,,,function(e,t,n){"use strict";const r=n(294),o=n(295),i=n(296);function a(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function l(e,t){return t.decode?o(e):e}function s(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function c(e){const t=(e=s(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function d(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const o="string"==typeof n&&n.split("").indexOf(e.arrayFormatSeparator)>-1?n.split(e.arrayFormatSeparator).map(t=>l(t,e)):null===n?n:l(n,e);r[t]=o};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,a]=i(t.decode?o.replace(/\+/g," "):o,"=");a=void 0===a?null:["comma","separator"].includes(t.arrayFormat)?a:l(a,t),n(l(e,t),a,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=f(n[e],t);else r[e]=f(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=c,t.parse=d,t.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const o=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[",o,"]"].join("")]:[...n,[u(t,e),"[",u(o,e),"]=",u(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[]"].join("")]:[...n,[u(t,e),"[]=",u(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[u(t,e),"=",u(r,e)].join("")]:[[n,u(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,u(t,e)]:[...n,[u(t,e),"=",u(r,e)].join("")]}}(t),o={};for(const t of Object.keys(e))n(t)||(o[t]=e[t]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map(n=>{const o=e[n];return void 0===o?"":null===o?u(n,t):Array.isArray(o)?o.reduce(r(n),[]).join("&"):u(n,t)+"="+u(o,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>({url:s(e).split("?")[0]||"",query:d(c(e),t)}),t.stringifyUrl=(e,n)=>{const r=s(e.url).split("?")[0]||"",o=t.extract(e.url),i=t.parse(o),a=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url),u=Object.assign(i,e.query);let l=t.stringify(u,n);return l&&(l="?"+l),`${r}${l}${a}`}},function(e,t,n){e.exports={root:"MediaTile__root","type-icon":"MediaTile__type-icon",typeIcon:"MediaTile__type-icon","image-type-icon":"MediaTile__image-type-icon MediaTile__type-icon",imageTypeIcon:"MediaTile__image-type-icon MediaTile__type-icon","video-type-icon":"MediaTile__video-type-icon MediaTile__type-icon",videoTypeIcon:"MediaTile__video-type-icon MediaTile__type-icon","album-type-icon":"MediaTile__album-type-icon MediaTile__type-icon",albumTypeIcon:"MediaTile__album-type-icon MediaTile__type-icon",overlay:"MediaTile__overlay layout__fill-parent"}},function(e,t,n){e.exports={root:"FeedLayout__root",wrapper:"FeedLayout__wrapper",button:"FeedLayout__button","load-more-btn":"FeedLayout__load-more-btn FeedLayout__button",loadMoreBtn:"FeedLayout__load-more-btn FeedLayout__button","follow-btn":"FeedLayout__follow-btn FeedLayout__button",followBtn:"FeedLayout__follow-btn FeedLayout__button","fake-media":"FeedLayout__fake-media",fakeMedia:"FeedLayout__fake-media","fake-media-flash-animation":"FeedLayout__fake-media-flash-animation",fakeMediaFlashAnimation:"FeedLayout__fake-media-flash-animation"}},,,function(e,t,n){"use strict";var r=n(211),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,a=Array.prototype.concat,u=Object.defineProperty,l=u&&function(){var e={};try{for(var t in u(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),s=function(e,t,n,r){var o;(!(t in e)||"function"==typeof(o=r)&&"[object Function]"===i.call(o)&&r())&&(l?u(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n)},c=function(e,t){var n=arguments.length>2?arguments[2]:{},i=r(t);o&&(i=a.call(i,Object.getOwnPropertySymbols(t)));for(var u=0;u<i.length;u+=1)s(e,i[u],t[i[u]],n[i[u]])};c.supportsDescriptors=!!l,e.exports=c},function(e,t,n){var r=n(60).Symbol;e.exports=r},function(e,t,n){var r=n(223),o=n(348),i=n(92);e.exports=function(e){return i(e)?r(e):o(e)}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(242),o=n(175);e.exports=function(e,t,n,i){var a=!n;n||(n={});for(var u=-1,l=t.length;++u<l;){var s=t[u],c=i?i(n[s],e[s],s,n,e):void 0;void 0===c&&(c=e[s]),a?o(n,s,c):r(n,s,c)}return n}},function(e,t,n){"use strict";function r(e){return e.getTime()%6e4}function o(e){var t=new Date(e.getTime()),n=Math.ceil(t.getTimezoneOffset());return t.setSeconds(0,0),6e4*n+(n>0?(6e4+r(t))%6e4:r(t))}n.d(t,"a",(function(){return o}))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));var r=function(e,t){return e.startsWith(t)?e:t+e},o=function(e){return(t=e,"#",t.startsWith("#")?t.substr("#".length):t).split(/\s/).map((function(e,t){return t>0?e[0].toUpperCase()+e.substr(1):e})).join("").replace(/\W/gi,"");var t}},,,,,,,,,function(e,t,n){(function(e){var r=n(60),o=n(346),i=t&&!t.nodeType&&t,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,u=a&&a.exports===i?r.Buffer:void 0,l=(u?u.isBuffer:void 0)||o;e.exports=l}).call(this,n(162)(e))},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(124),o=n(358),i=n(359),a=n(360),u=n(361),l=n(362);function s(e){var t=this.__data__=new r(e);this.size=t.size}s.prototype.clear=o,s.prototype.delete=i,s.prototype.get=a,s.prototype.has=u,s.prototype.set=l,e.exports=s},function(e,t,n){var r=n(353),o=n(354),i=n(355),a=n(356),u=n(357);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}l.prototype.clear=r,l.prototype.delete=o,l.prototype.get=i,l.prototype.has=a,l.prototype.set=u,e.exports=l},function(e,t,n){var r=n(108);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t,n){var r=n(83)(Object,"create");e.exports=r},function(e,t,n){var r=n(375);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t,n){var r=n(390),o=n(171),i=n(391),a=n(392),u=n(393),l=n(82),s=n(228),c=s(r),f=s(o),d=s(i),p=s(a),h=s(u),v=l;(r&&"[object DataView]"!=v(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=v(new o)||i&&"[object Promise]"!=v(i.resolve())||a&&"[object Set]"!=v(new a)||u&&"[object WeakMap]"!=v(new u))&&(v=function(e){var t=l(e),n="[object Object]"==t?e.constructor:void 0,r=n?s(n):"";if(r)switch(r){case c:return"[object DataView]";case f:return"[object Map]";case d:return"[object Promise]";case p:return"[object Set]";case h:return"[object WeakMap]"}return t}),e.exports=v},function(e,t,n){var r=n(82),o=n(64);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(129);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,n){var r=n(223),o=n(415),i=n(92);e.exports=function(e){return i(e)?r(e,!0):o(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=l(i),u=l(n(21));function l(e){return e&&e.__esModule?e:{default:e}}var s={position:"absolute",top:0,left:0,visibility:"hidden",height:0,overflow:"scroll",whiteSpace:"pre"},c=["extraWidth","injectStyles","inputClassName","inputRef","inputStyle","minWidth","onAutosize","placeholderIsMinWidth"],f=function(e,t){t.style.fontSize=e.fontSize,t.style.fontFamily=e.fontFamily,t.style.fontWeight=e.fontWeight,t.style.fontStyle=e.fontStyle,t.style.letterSpacing=e.letterSpacing,t.style.textTransform=e.textTransform},d=!("undefined"==typeof window||!window.navigator)&&/MSIE |Trident\/|Edge\//.test(window.navigator.userAgent),p=function(){return d?"_"+Math.random().toString(36).substr(2,12):void 0},h=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.inputRef=function(e){n.input=e,"function"==typeof n.props.inputRef&&n.props.inputRef(e)},n.placeHolderSizerRef=function(e){n.placeHolderSizer=e},n.sizerRef=function(e){n.sizer=e},n.state={inputWidth:e.minWidth,inputId:e.id||p()},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"componentDidMount",value:function(){this.mounted=!0,this.copyInputStyles(),this.updateInputWidth()}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){var t=e.id;t!==this.props.id&&this.setState({inputId:t||p()})}},{key:"componentDidUpdate",value:function(e,t){t.inputWidth!==this.state.inputWidth&&"function"==typeof this.props.onAutosize&&this.props.onAutosize(this.state.inputWidth),this.updateInputWidth()}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"copyInputStyles",value:function(){if(this.mounted&&window.getComputedStyle){var e=this.input&&window.getComputedStyle(this.input);e&&(f(e,this.sizer),this.placeHolderSizer&&f(e,this.placeHolderSizer))}}},{key:"updateInputWidth",value:function(){if(this.mounted&&this.sizer&&void 0!==this.sizer.scrollWidth){var e=void 0;e=this.props.placeholder&&(!this.props.value||this.props.value&&this.props.placeholderIsMinWidth)?Math.max(this.sizer.scrollWidth,this.placeHolderSizer.scrollWidth)+2:this.sizer.scrollWidth+2,(e+="number"===this.props.type&&void 0===this.props.extraWidth?16:parseInt(this.props.extraWidth)||0)<this.props.minWidth&&(e=this.props.minWidth),e!==this.state.inputWidth&&this.setState({inputWidth:e})}}},{key:"getInput",value:function(){return this.input}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"renderStyles",value:function(){var e=this.props.injectStyles;return d&&e?a.default.createElement("style",{dangerouslySetInnerHTML:{__html:"input#"+this.state.inputId+"::-ms-clear {display: none;}"}}):null}},{key:"render",value:function(){var e=[this.props.defaultValue,this.props.value,""].reduce((function(e,t){return null!=e?e:t})),t=r({},this.props.style);t.display||(t.display="inline-block");var n=r({boxSizing:"content-box",width:this.state.inputWidth+"px"},this.props.inputStyle),o=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(this.props,[]);return function(e){c.forEach((function(t){return delete e[t]}))}(o),o.className=this.props.inputClassName,o.id=this.state.inputId,o.style=n,a.default.createElement("div",{className:this.props.className,style:t},this.renderStyles(),a.default.createElement("input",r({},o,{ref:this.inputRef})),a.default.createElement("div",{ref:this.sizerRef,style:s},e),this.props.placeholder?a.default.createElement("div",{ref:this.placeHolderSizerRef,style:s},this.props.placeholder):null)}}]),t}(i.Component);h.propTypes={className:u.default.string,defaultValue:u.default.any,extraWidth:u.default.oneOfType([u.default.number,u.default.string]),id:u.default.string,injectStyles:u.default.bool,inputClassName:u.default.string,inputRef:u.default.func,inputStyle:u.default.object,minWidth:u.default.oneOfType([u.default.number,u.default.string]),onAutosize:u.default.func,onChange:u.default.func,placeholder:u.default.string,placeholderIsMinWidth:u.default.bool,style:u.default.object,value:u.default.any},h.defaultProps={minWidth:1,injectStyles:!0},t.default=h},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n.n(r),i=n(2),a=n(71),u=n(5),l=Object(i.b)((function(e){var t=e.feed,n=a.a.getById(t.options.layout),r=u.a.ComputedOptions.compute(t);return o.a.createElement("div",{className:"feed"},o.a.createElement(n.component,{feed:t,options:r}))}))},function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=(n(10),n(41),n(21),n(24)),a=n(76),u=(n(66),n(132),n(140));function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var s,c,f,d=function(e,t){void 0===e&&(e="");var n=String(e).toLowerCase(),r=String(t.value).toLowerCase(),o=String(t.label).toLowerCase();return r===n||o===n},p=l({allowCreateWhileLoading:!1,createOptionPosition:"last"},{formatCreateLabel:function(e){return'Create "'+e+'"'},isValidNewOption:function(e,t,n){return!(!e||t.some((function(t){return d(e,t)}))||n.some((function(t){return d(e,t)})))},getNewOptionData:function(e,t){return{label:t,value:e,__isNew__:!0}}}),h=(s=a.a,f=c=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).select=void 0,n.onChange=function(e,t){var r=n.props,o=r.getNewOptionData,a=r.inputValue,u=r.isMulti,l=r.onChange,s=r.onCreateOption,c=r.value,f=r.name;if("select-option"!==t.action)return l(e,t);var d=n.state.newOption,p=Array.isArray(e)?e:[e];if(p[p.length-1]!==d)l(e,t);else if(s)s(a);else{var h=o(a,a),v={action:"create-option",name:f};l(u?[].concat(Object(i.e)(c),[h]):h,v)}};var r=t.options||[];return n.state={newOption:void 0,options:r},n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var a=r.prototype;return a.UNSAFE_componentWillReceiveProps=function(e){var t=e.allowCreateWhileLoading,n=e.createOptionPosition,r=e.formatCreateLabel,o=e.getNewOptionData,a=e.inputValue,u=e.isLoading,l=e.isValidNewOption,s=e.value,c=e.options||[],f=this.state.newOption;f=l(a,Object(i.e)(s),c)?o(a,r(a)):void 0,this.setState({newOption:f,options:!t&&u||!f?c:"first"===n?[f].concat(c):[].concat(c,[f])})},a.focus=function(){this.select.focus()},a.blur=function(){this.select.blur()},a.render=function(){var e=this,t=this.state.options;return o.a.createElement(s,l({},this.props,{ref:function(t){e.select=t},options:t,onChange:this.onChange}))},r}(r.Component),c.defaultProps=p,f),v=Object(u.a)(h);t.a=v},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(e){this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.before=null}var t=e.prototype;return t.insert=function(e){if(this.ctr%(this.isSpeedy?65e3:1)==0){var t,n=function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t}(this);t=0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling,this.container.insertBefore(n,t),this.tags.push(n)}var r=this.tags[this.tags.length-1];if(this.isSpeedy){var o=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(r);try{var i=105===e.charCodeAt(1)&&64===e.charCodeAt(0);o.insertRule(e,i?0:o.cssRules.length)}catch(e){}}else r.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){return e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0},e}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(0),o=n.n(r);function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a={defaultInputValue:"",defaultMenuIsOpen:!1,defaultValue:null},u=function(e){var t,n;return n=t=function(t){var n,r;function a(){for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=t.call.apply(t,[this].concat(r))||this).select=void 0,e.state={inputValue:void 0!==e.props.inputValue?e.props.inputValue:e.props.defaultInputValue,menuIsOpen:void 0!==e.props.menuIsOpen?e.props.menuIsOpen:e.props.defaultMenuIsOpen,value:void 0!==e.props.value?e.props.value:e.props.defaultValue},e.onChange=function(t,n){e.callProp("onChange",t,n),e.setState({value:t})},e.onInputChange=function(t,n){var r=e.callProp("onInputChange",t,n);e.setState({inputValue:void 0!==r?r:t})},e.onMenuOpen=function(){e.callProp("onMenuOpen"),e.setState({menuIsOpen:!0})},e.onMenuClose=function(){e.callProp("onMenuClose"),e.setState({menuIsOpen:!1})},e}r=t,(n=a).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r;var u=a.prototype;return u.focus=function(){this.select.focus()},u.blur=function(){this.select.blur()},u.getProp=function(e){return void 0!==this.props[e]?this.props[e]:this.state[e]},u.callProp=function(e){if("function"==typeof this.props[e]){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return(t=this.props)[e].apply(t,r)}},u.render=function(){var t=this,n=this.props,r=(n.defaultInputValue,n.defaultMenuIsOpen,n.defaultValue,function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(n,["defaultInputValue","defaultMenuIsOpen","defaultValue"]));return o.a.createElement(e,i({},r,{ref:function(e){t.select=e},inputValue:this.getProp("inputValue"),menuIsOpen:this.getProp("menuIsOpen"),onChange:this.onChange,onInputChange:this.onInputChange,onMenuClose:this.onMenuClose,onMenuOpen:this.onMenuOpen,value:this.getProp("value")}))},a}(r.Component),t.defaultProps=a,n}},,,function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=n(189),a=n.n(i),u=n(9),l=n(4),s=n(2);t.a=Object(s.b)((function(e){var t=e.account,n=e.square,r=e.className,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["account","square","className"]),s=u.b.getProfilePicUrl(t),c=Object(l.b)(n?a.a.square:a.a.round,r);return o.a.createElement("img",Object.assign({},i,{className:c,src:u.b.DEFAULT_PROFILE_PIC,srcSet:"".concat(s," 1x"),alt:"".concat(t.username," profile picture")}))}))},,function(e,t,n){"use strict";var r={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function o(e){return function(t){var n=t||{},r=n.width?String(n.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}var i={date:o({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:o({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:o({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},a={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function u(e){return function(t,n){var r,o=n||{};if("formatting"===(o.context?String(o.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,a=o.width?String(o.width):i;r=e.formattingValues[a]||e.formattingValues[i]}else{var u=e.defaultWidth,l=o.width?String(o.width):e.defaultWidth;r=e.values[l]||e.values[u]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function l(e){return function(t,n){var r=String(t),o=n||{},i=o.width,a=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],u=r.match(a);if(!u)return null;var l,s=u[0],c=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth];return l="[object Array]"===Object.prototype.toString.call(c)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].test(s))return n}(c):function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].test(s))return n}(c),l=e.valueCallback?e.valueCallback(l):l,{value:l=o.valueCallback?o.valueCallback(l):l,rest:r.slice(s.length)}}}var s,c={code:"en-US",formatDistance:function(e,t,n){var o;return n=n||{},o="string"==typeof r[e]?r[e]:1===t?r[e].one:r[e].other.replace("{{count}}",t),n.addSuffix?n.comparison>0?"in "+o:o+" ago":o},formatLong:i,formatRelative:function(e,t,n,r){return a[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:u({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:u({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return Number(e)-1}}),month:u({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:u({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:u({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(s={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e,t){var n=String(e),r=t||{},o=n.match(s.matchPattern);if(!o)return null;var i=o[0],a=n.match(s.parsePattern);if(!a)return null;var u=s.valueCallback?s.valueCallback(a[0]):a[0];return{value:u=r.valueCallback?r.valueCallback(u):u,rest:n.slice(i.length)}}),era:l({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:l({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:l({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:l({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:l({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};t.a=c},function(e,t,n){"use strict";var r=n(139),o=function(e){function t(e,t,r){var o=t.trim().split(h);t=o;var i=o.length,a=e.length;switch(a){case 0:case 1:var u=0;for(e=0===a?"":e[0]+" ";u<i;++u)t[u]=n(e,t[u],r).trim();break;default:var l=u=0;for(t=[];u<i;++u)for(var s=0;s<a;++s)t[l++]=n(e[s]+" ",o[u],r).trim()}return t}function n(e,t,n){var r=t.charCodeAt(0);switch(33>r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(v,"$1"+e.trim());case 58:return e.trim()+t.replace(v,"$1"+e.trim());default:if(0<1*n&&0<t.indexOf("\f"))return t.replace(v,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function r(e,t,n,i){var a=e+";",u=2*t+3*n+4*i;if(944===u){e=a.indexOf(":",9)+1;var l=a.substring(e,a.length-1).trim();return l=a.substring(0,e).trim()+l+";",1===T||2===T&&o(l,1)?"-webkit-"+l+l:l}if(0===T||2===T&&!o(a,1))return a;switch(u){case 1015:return 97===a.charCodeAt(10)?"-webkit-"+a+a:a;case 951:return 116===a.charCodeAt(3)?"-webkit-"+a+a:a;case 963:return 110===a.charCodeAt(5)?"-webkit-"+a+a:a;case 1009:if(100!==a.charCodeAt(4))break;case 969:case 942:return"-webkit-"+a+a;case 978:return"-webkit-"+a+"-moz-"+a+a;case 1019:case 983:return"-webkit-"+a+"-moz-"+a+"-ms-"+a+a;case 883:if(45===a.charCodeAt(8))return"-webkit-"+a+a;if(0<a.indexOf("image-set(",11))return a.replace(S,"$1-webkit-$2")+a;break;case 932:if(45===a.charCodeAt(4))switch(a.charCodeAt(5)){case 103:return"-webkit-box-"+a.replace("-grow","")+"-webkit-"+a+"-ms-"+a.replace("grow","positive")+a;case 115:return"-webkit-"+a+"-ms-"+a.replace("shrink","negative")+a;case 98:return"-webkit-"+a+"-ms-"+a.replace("basis","preferred-size")+a}return"-webkit-"+a+"-ms-"+a+a;case 964:return"-webkit-"+a+"-ms-flex-"+a+a;case 1023:if(99!==a.charCodeAt(8))break;return"-webkit-box-pack"+(l=a.substring(a.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+a+"-ms-flex-pack"+l+a;case 1005:return d.test(a)?a.replace(f,":-webkit-")+a.replace(f,":-moz-")+a:a;case 1e3:switch(t=(l=a.substring(13).trim()).indexOf("-")+1,l.charCodeAt(0)+l.charCodeAt(t)){case 226:l=a.replace(y,"tb");break;case 232:l=a.replace(y,"tb-rl");break;case 220:l=a.replace(y,"lr");break;default:return a}return"-webkit-"+a+"-ms-"+l+a;case 1017:if(-1===a.indexOf("sticky",9))break;case 975:switch(t=(a=e).length-10,u=(l=(33===a.charCodeAt(t)?a.substring(0,t):a).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|l.charCodeAt(7))){case 203:if(111>l.charCodeAt(8))break;case 115:a=a.replace(l,"-webkit-"+l)+";"+a;break;case 207:case 102:a=a.replace(l,"-webkit-"+(102<u?"inline-":"")+"box")+";"+a.replace(l,"-webkit-"+l)+";"+a.replace(l,"-ms-"+l+"box")+";"+a}return a+";";case 938:if(45===a.charCodeAt(5))switch(a.charCodeAt(6)){case 105:return l=a.replace("-items",""),"-webkit-"+a+"-webkit-box-"+l+"-ms-flex-"+l+a;case 115:return"-webkit-"+a+"-ms-flex-item-"+a.replace(E,"")+a;default:return"-webkit-"+a+"-ms-flex-line-pack"+a.replace("align-content","").replace(E,"")+a}break;case 973:case 989:if(45!==a.charCodeAt(3)||122===a.charCodeAt(4))break;case 931:case 953:if(!0===O.test(e))return 115===(l=e.substring(e.indexOf(":")+1)).charCodeAt(0)?r(e.replace("stretch","fill-available"),t,n,i).replace(":fill-available",":stretch"):a.replace(l,"-webkit-"+l)+a.replace(l,"-moz-"+l.replace("fill-",""))+a;break;case 962:if(a="-webkit-"+a+(102===a.charCodeAt(5)?"-ms-"+a:"")+a,211===n+i&&105===a.charCodeAt(13)&&0<a.indexOf("transform",10))return a.substring(0,a.indexOf(";",27)+1).replace(p,"$1-webkit-$2")+a}return a}function o(e,t){var n=e.indexOf(1===t?":":"{"),r=e.substring(0,3!==t?n:10);return n=e.substring(n+1,e.length-1),D(2!==t?r:r.replace(_,"$1"),n,t)}function i(e,t){var n=r(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return n!==t+";"?n.replace(x," or ($1)").substring(4):"("+t+")"}function a(e,t,n,r,o,i,a,u,s,c){for(var f,d=0,p=t;d<M;++d)switch(f=A[d].call(l,e,p,n,r,o,i,a,u,s,c)){case void 0:case!1:case!0:case null:break;default:p=f}if(p!==t)return p}function u(e){return void 0!==(e=e.prefix)&&(D=null,e?"function"!=typeof e?T=1:(T=2,D=e):T=0),u}function l(e,n){var u=e;if(33>u.charCodeAt(0)&&(u=u.trim()),u=[u],0<M){var l=a(-1,n,u,u,k,C,0,0,0,0);void 0!==l&&"string"==typeof l&&(n=l)}var f=function e(n,u,l,f,d){for(var p,h,v,y,x,E=0,_=0,O=0,S=0,A=0,D=0,F=v=p=0,N=0,I=0,R=0,B=0,U=l.length,H=U-1,z="",V="",W="",$="";N<U;){if(h=l.charCodeAt(N),N===H&&0!==_+S+O+E&&(0!==_&&(h=47===_?10:47),S=O=E=0,U++,H++),0===_+S+O+E){if(N===H&&(0<I&&(z=z.replace(c,"")),0<z.trim().length)){switch(h){case 32:case 9:case 59:case 13:case 10:break;default:z+=l.charAt(N)}h=59}switch(h){case 123:for(p=(z=z.trim()).charCodeAt(0),v=1,B=++N;N<U;){switch(h=l.charCodeAt(N)){case 123:v++;break;case 125:v--;break;case 47:switch(h=l.charCodeAt(N+1)){case 42:case 47:e:{for(F=N+1;F<H;++F)switch(l.charCodeAt(F)){case 47:if(42===h&&42===l.charCodeAt(F-1)&&N+2!==F){N=F+1;break e}break;case 10:if(47===h){N=F+1;break e}}N=F}}break;case 91:h++;case 40:h++;case 34:case 39:for(;N++<H&&l.charCodeAt(N)!==h;);}if(0===v)break;N++}switch(v=l.substring(B,N),0===p&&(p=(z=z.replace(s,"").trim()).charCodeAt(0)),p){case 64:switch(0<I&&(z=z.replace(c,"")),h=z.charCodeAt(1)){case 100:case 109:case 115:case 45:I=u;break;default:I=j}if(B=(v=e(u,I,v,h,d+1)).length,0<M&&(x=a(3,v,I=t(j,z,R),u,k,C,B,h,d,f),z=I.join(""),void 0!==x&&0===(B=(v=x.trim()).length)&&(h=0,v="")),0<B)switch(h){case 115:z=z.replace(w,i);case 100:case 109:case 45:v=z+"{"+v+"}";break;case 107:v=(z=z.replace(m,"$1 $2"))+"{"+v+"}",v=1===T||2===T&&o("@"+v,3)?"@-webkit-"+v+"@"+v:"@"+v;break;default:v=z+v,112===f&&(V+=v,v="")}else v="";break;default:v=e(u,t(u,z,R),v,f,d+1)}W+=v,v=R=I=F=p=0,z="",h=l.charCodeAt(++N);break;case 125:case 59:if(1<(B=(z=(0<I?z.replace(c,""):z).trim()).length))switch(0===F&&(p=z.charCodeAt(0),45===p||96<p&&123>p)&&(B=(z=z.replace(" ",":")).length),0<M&&void 0!==(x=a(1,z,u,n,k,C,V.length,f,d,f))&&0===(B=(z=x.trim()).length)&&(z="\0\0"),p=z.charCodeAt(0),h=z.charCodeAt(1),p){case 0:break;case 64:if(105===h||99===h){$+=z+l.charAt(N);break}default:58!==z.charCodeAt(B-1)&&(V+=r(z,p,h,z.charCodeAt(2)))}R=I=F=p=0,z="",h=l.charCodeAt(++N)}}switch(h){case 13:case 10:47===_?_=0:0===1+p&&107!==f&&0<z.length&&(I=1,z+="\0"),0<M*L&&a(0,z,u,n,k,C,V.length,f,d,f),C=1,k++;break;case 59:case 125:if(0===_+S+O+E){C++;break}default:switch(C++,y=l.charAt(N),h){case 9:case 32:if(0===S+E+_)switch(A){case 44:case 58:case 9:case 32:y="";break;default:32!==h&&(y=" ")}break;case 0:y="\\0";break;case 12:y="\\f";break;case 11:y="\\v";break;case 38:0===S+_+E&&(I=R=1,y="\f"+y);break;case 108:if(0===S+_+E+P&&0<F)switch(N-F){case 2:112===A&&58===l.charCodeAt(N-3)&&(P=A);case 8:111===D&&(P=D)}break;case 58:0===S+_+E&&(F=N);break;case 44:0===_+O+S+E&&(I=1,y+="\r");break;case 34:case 39:0===_&&(S=S===h?0:0===S?h:S);break;case 91:0===S+_+O&&E++;break;case 93:0===S+_+O&&E--;break;case 41:0===S+_+E&&O--;break;case 40:if(0===S+_+E){if(0===p)switch(2*A+3*D){case 533:break;default:p=1}O++}break;case 64:0===_+O+S+E+F+v&&(v=1);break;case 42:case 47:if(!(0<S+E+O))switch(_){case 0:switch(2*h+3*l.charCodeAt(N+1)){case 235:_=47;break;case 220:B=N,_=42}break;case 42:47===h&&42===A&&B+2!==N&&(33===l.charCodeAt(B+2)&&(V+=l.substring(B,N+1)),y="",_=0)}}0===_&&(z+=y)}D=A,A=h,N++}if(0<(B=V.length)){if(I=u,0<M&&void 0!==(x=a(2,V,I,n,k,C,B,f,d,f))&&0===(V=x).length)return $+V+W;if(V=I.join(",")+"{"+V+"}",0!=T*P){switch(2!==T||o(V,2)||(P=0),P){case 111:V=V.replace(g,":-moz-$1")+V;break;case 112:V=V.replace(b,"::-webkit-input-$1")+V.replace(b,"::-moz-$1")+V.replace(b,":-ms-input-$1")+V}P=0}}return $+V+W}(j,u,n,0,0);return 0<M&&void 0!==(l=a(-2,f,u,u,k,C,f.length,0,0,0))&&(f=l),P=0,C=k=1,f}var s=/^\0+/g,c=/[\0\r\f]/g,f=/: */g,d=/zoo|gra/,p=/([,: ])(transform)/g,h=/,\r+?/g,v=/([\t\r\n ])*\f?&/g,m=/@(k\w+)\s*(\S*)\s*/,b=/::(place)/g,g=/:(read-only)/g,y=/[svh]\w+-[tblr]{2}/,w=/\(\s*(.*)\s*\)/g,x=/([\s\S]*?);/g,E=/-self|flex-/g,_=/[^]*?(:[rp][el]a[\w-]+)[^]*/,O=/stretch|:\s*\w+\-(?:conte|avail)/,S=/([^-])(image-set\()/,C=1,k=1,P=0,T=1,j=[],A=[],M=0,D=null,L=0;return l.use=function e(t){switch(t){case void 0:case null:M=A.length=0;break;default:if("function"==typeof t)A[M++]=t;else if("object"==typeof t)for(var n=0,r=t.length;n<r;++n)e(t[n]);else L=0|!!t}return e},l.set=u,void 0!==e&&u(e),l};function i(e){e&&a.current.insert(e+"}")}var a={current:null},u=function(e,t,n,r,o,u,l,s,c,f){switch(e){case 1:switch(t.charCodeAt(0)){case 64:return a.current.insert(t+";"),"";case 108:if(98===t.charCodeAt(2))return""}break;case 2:if(0===s)return t+"/*|*/";break;case 3:switch(s){case 102:case 112:return a.current.insert(n[0]+t),"";default:return t+(0===f?"/*|*/":"")}case-2:t.split("/*|*/}").forEach(i)}};t.a=function(e){void 0===e&&(e={});var t,n=e.key||"css";void 0!==e.prefix&&(t={prefix:e.prefix});var i,l=new o(t),s={};i=e.container||document.head;var c,f=document.querySelectorAll("style[data-emotion-"+n+"]");Array.prototype.forEach.call(f,(function(e){e.getAttribute("data-emotion-"+n).split(" ").forEach((function(e){s[e]=!0})),e.parentNode!==i&&i.appendChild(e)})),l.use(e.stylisPlugins)(u),c=function(e,t,n,r){var o=t.name;a.current=n,l(e,t.styles),r&&(d.inserted[o]=!0)};var d={key:n,sheet:new r.a({key:n,container:i,nonce:e.nonce,speedy:e.speedy}),nonce:e.nonce,inserted:s,registered:{},insert:c};return d}},,,,,,function(e,t,n){e.exports={root:"MediaTileIcons__root layout__flex-row",icon:"MediaTileIcons__icon"}},,,,,,,function(e,t,n){"use strict";var r=n(323);e.exports=Function.prototype.bind||r},function(e,t,n){var r=n(221),o=n(225);e.exports=function(e,t){return e&&r(e,o(t))}},function(e,t,n){var r=n(345),o=n(64),i=Object.prototype,a=i.hasOwnProperty,u=i.propertyIsEnumerable,l=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!u.call(e,"callee")};e.exports=l},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,n){var r=n(347),o=n(166),i=n(167),a=i&&i.isTypedArray,u=a?o(a):r;e.exports=u},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){(function(e){var r=n(220),o=t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=i&&i.exports===o&&r.process,u=function(){try{return i&&i.require&&i.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=u}).call(this,n(162)(e))},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t,n){var r=n(82),o=n(58);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){var r=n(224)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(83)(n(60),"Map");e.exports=r},function(e,t,n){var r=n(367),o=n(374),i=n(376),a=n(377),u=n(378);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}l.prototype.clear=r,l.prototype.delete=o,l.prototype.get=i,l.prototype.has=a,l.prototype.set=u,e.exports=l},function(e,t,n){var r=n(389),o=n(235),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,u=a?function(e){return null==e?[]:(e=Object(e),r(a(e),(function(t){return i.call(e,t)})))}:o;e.exports=u},function(e,t,n){var r=n(53),o=n(129),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||a.test(e)||!i.test(e)||null!=t&&e in Object(t)}},function(e,t,n){var r=n(243);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(231);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Checkboard=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=n(0),i=l(o),a=l(n(12)),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(436));function l(e){return e&&e.__esModule?e:{default:e}}var s=t.Checkboard=function(e){var t=e.white,n=e.grey,l=e.size,s=e.renderers,c=e.borderRadius,f=e.boxShadow,d=e.children,p=(0,a.default)({default:{grid:{borderRadius:c,boxShadow:f,absolute:"0px 0px 0px 0px",background:"url("+u.get(t,n,l,s.canvas)+") center left"}}});return(0,o.isValidElement)(d)?i.default.cloneElement(d,r({},d.props,{style:r({},d.props.style,p.grid)})):i.default.createElement("div",{style:p.grid})};s.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}},t.default=s},,function(e,t,n){"use strict";e.exports=function(){}},function(e,t,n){"use strict";(function(e){var r=n(0),o=n.n(r),i=n(56),a=n(21),u=n.n(a),l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:{};function s(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(n,r){e=n,t.forEach((function(t){return t(e,r)}))}}}var c=o.a.createContext||function(e,t){var n,o,a="__create-react-context-"+(l["__global_unique_id__"]=(l.__global_unique_id__||0)+1)+"__",c=function(e){function n(){var t;return(t=e.apply(this,arguments)||this).emitter=s(t.props.value),t}Object(i.a)(n,e);var r=n.prototype;return r.getChildContext=function(){var e;return(e={})[a]=this.emitter,e},r.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n,r=this.props.value,o=e.value;((i=r)===(a=o)?0!==i||1/i==1/a:i!=i&&a!=a)?n=0:(n="function"==typeof t?t(r,o):1073741823,0!=(n|=0)&&this.emitter.set(e.value,n))}var i,a},r.render=function(){return this.props.children},n}(r.Component);c.childContextTypes=((n={})[a]=u.a.object.isRequired,n);var f=function(t){function n(){var e;return(e=t.apply(this,arguments)||this).state={value:e.getValue()},e.onUpdate=function(t,n){0!=((0|e.observedBits)&n)&&e.setState({value:e.getValue()})},e}Object(i.a)(n,t);var r=n.prototype;return r.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?1073741823:t},r.componentDidMount=function(){this.context[a]&&this.context[a].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?1073741823:e},r.componentWillUnmount=function(){this.context[a]&&this.context[a].off(this.onUpdate)},r.getValue=function(){return this.context[a]?this.context[a].get():e},r.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(r.Component);return f.contextTypes=((o={})[a]=u.a.object,o),{Provider:c,Consumer:f}};t.a=c}).call(this,n(81))},function(e,t,n){var r=n(299);e.exports=function e(t,n,o){return r(n)||(o=n||o,n=[]),o=o||{},t instanceof RegExp?function(e,t){var n=e.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)t.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return c(e,t)}(t,n):r(t)?function(t,n,r){for(var o=[],i=0;i<t.length;i++)o.push(e(t[i],n,r).source);return c(new RegExp("(?:"+o.join("|")+")",f(r)),n)}(t,n,o):function(e,t,n){return d(i(e,n),t,n)}(t,n,o)},e.exports.parse=i,e.exports.compile=function(e,t){return u(i(e,t),t)},e.exports.tokensToFunction=u,e.exports.tokensToRegExp=d;var o=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function i(e,t){for(var n,r=[],i=0,a=0,u="",c=t&&t.delimiter||"/";null!=(n=o.exec(e));){var f=n[0],d=n[1],p=n.index;if(u+=e.slice(a,p),a=p+f.length,d)u+=d[1];else{var h=e[a],v=n[2],m=n[3],b=n[4],g=n[5],y=n[6],w=n[7];u&&(r.push(u),u="");var x=null!=v&&null!=h&&h!==v,E="+"===y||"*"===y,_="?"===y||"*"===y,O=n[2]||c,S=b||g;r.push({name:m||i++,prefix:v||"",delimiter:O,optional:_,repeat:E,partial:x,asterisk:!!w,pattern:S?s(S):w?".*":"[^"+l(O)+"]+?"})}}return a<e.length&&(u+=e.substr(a)),u&&r.push(u),r}function a(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function u(e,t){for(var n=new Array(e.length),o=0;o<e.length;o++)"object"==typeof e[o]&&(n[o]=new RegExp("^(?:"+e[o].pattern+")$",f(t)));return function(t,o){for(var i="",u=t||{},l=(o||{}).pretty?a:encodeURIComponent,s=0;s<e.length;s++){var c=e[s];if("string"!=typeof c){var f,d=u[c.name];if(null==d){if(c.optional){c.partial&&(i+=c.prefix);continue}throw new TypeError('Expected "'+c.name+'" to be defined')}if(r(d)){if(!c.repeat)throw new TypeError('Expected "'+c.name+'" to not repeat, but received `'+JSON.stringify(d)+"`");if(0===d.length){if(c.optional)continue;throw new TypeError('Expected "'+c.name+'" to not be empty')}for(var p=0;p<d.length;p++){if(f=l(d[p]),!n[s].test(f))throw new TypeError('Expected all "'+c.name+'" to match "'+c.pattern+'", but received `'+JSON.stringify(f)+"`");i+=(0===p?c.prefix:c.delimiter)+f}}else{if(f=c.asterisk?encodeURI(d).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):l(d),!n[s].test(f))throw new TypeError('Expected "'+c.name+'" to match "'+c.pattern+'", but received "'+f+'"');i+=c.prefix+f}}else i+=c}return i}}function l(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function s(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function c(e,t){return e.keys=t,e}function f(e){return e&&e.sensitive?"":"i"}function d(e,t,n){r(t)||(n=t||n,t=[]);for(var o=(n=n||{}).strict,i=!1!==n.end,a="",u=0;u<e.length;u++){var s=e[u];if("string"==typeof s)a+=l(s);else{var d=l(s.prefix),p="(?:"+s.pattern+")";t.push(s),s.repeat&&(p+="(?:"+d+p+")*"),a+=p=s.optional?s.partial?d+"("+p+")?":"(?:"+d+"("+p+"))?":d+"("+p+")"}}var h=l(n.delimiter||"/"),v=a.slice(-h.length)===h;return o||(a=(v?a.slice(0,-h.length):a)+"(?:"+h+"(?=$))?"),a+=i?"$":o&&v?"":"(?="+h+"|$)",c(new RegExp("^"+a,f(n)),t)}},function(e,t,n){e.exports={root:"MediaVideo__root MediaObject__media",preview:"MediaVideo__preview MediaObject__preview MediaObject__media"}},function(e,t,n){e.exports={root:"MediaImage__root MediaObject__media",preview:"MediaImage__preview MediaObject__preview MediaObject__media"}},function(e,t,n){e.exports={root:"MediaTileCaption__root",preview:"MediaTileCaption__preview MediaTileCaption__root",full:"MediaTileCaption__full MediaTileCaption__root"}},function(e,t,n){e.exports={link:"FollowButton__link",button:"FollowButton__button feed__feed-button"}},function(e,t,n){"use strict";t.__esModule=!0;var r=i(n(0)),o=i(n(318));function i(e){return e&&e.__esModule?e:{default:e}}t.default=r.default.createContext||o.default,e.exports=t.default},function(e,t,n){"use strict";(function(e){var n="undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof navigator,r=function(){for(var e=["Edge","Trident","Firefox"],t=0;t<e.length;t+=1)if(n&&navigator.userAgent.indexOf(e[t])>=0)return 1;return 0}(),o=n&&window.Promise?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then((function(){t=!1,e()})))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout((function(){t=!1,e()}),r))}};function i(e){return e&&"[object Function]"==={}.toString.call(e)}function a(e,t){if(1!==e.nodeType)return[];var n=e.ownerDocument.defaultView.getComputedStyle(e,null);return t?n[t]:n}function u(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function l(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=a(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:l(u(e))}function s(e){return e&&e.referenceNode?e.referenceNode:e}var c=n&&!(!window.MSInputMethodContext||!document.documentMode),f=n&&/MSIE 10/.test(navigator.userAgent);function d(e){return 11===e?c:10===e?f:c||f}function p(e){if(!e)return document.documentElement;for(var t=d(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return r&&"BODY"!==r&&"HTML"!==r?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===a(n,"position")?p(n):n:e?e.ownerDocument.documentElement:document.documentElement}function h(e){return null!==e.parentNode?h(e.parentNode):e}function v(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var a,u,l=i.commonAncestorContainer;if(e!==l&&t!==l||r.contains(o))return"BODY"===(u=(a=l).nodeName)||"HTML"!==u&&p(a.firstElementChild)!==a?p(l):l;var s=h(e);return s.host?v(s.host,t):v(e,h(t).host)}function m(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",n="top"===t?"scrollTop":"scrollLeft",r=e.nodeName;if("BODY"===r||"HTML"===r){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function b(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=m(t,"top"),o=m(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function g(e,t){var n="x"===t?"Left":"Top",r="Left"===n?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function y(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],d(10)?parseInt(n["offset"+e])+parseInt(r["margin"+("Height"===e?"Top":"Left")])+parseInt(r["margin"+("Height"===e?"Bottom":"Right")]):0)}function w(e){var t=e.body,n=e.documentElement,r=d(10)&&getComputedStyle(n);return{height:y("Height",t,n,r),width:y("Width",t,n,r)}}var x=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},E=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},O=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function S(e){return O({},e,{right:e.left+e.width,bottom:e.top+e.height})}function C(e){var t={};try{if(d(10)){t=e.getBoundingClientRect();var n=m(e,"top"),r=m(e,"left");t.top+=n,t.left+=r,t.bottom+=n,t.right+=r}else t=e.getBoundingClientRect()}catch(e){}var o={left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top},i="HTML"===e.nodeName?w(e.ownerDocument):{},u=i.width||e.clientWidth||o.width,l=i.height||e.clientHeight||o.height,s=e.offsetWidth-u,c=e.offsetHeight-l;if(s||c){var f=a(e);s-=g(f,"x"),c-=g(f,"y"),o.width-=s,o.height-=c}return S(o)}function k(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=d(10),o="HTML"===t.nodeName,i=C(e),u=C(t),s=l(e),c=a(t),f=parseFloat(c.borderTopWidth),p=parseFloat(c.borderLeftWidth);n&&o&&(u.top=Math.max(u.top,0),u.left=Math.max(u.left,0));var h=S({top:i.top-u.top-f,left:i.left-u.left-p,width:i.width,height:i.height});if(h.marginTop=0,h.marginLeft=0,!r&&o){var v=parseFloat(c.marginTop),m=parseFloat(c.marginLeft);h.top-=f-v,h.bottom-=f-v,h.left-=p-m,h.right-=p-m,h.marginTop=v,h.marginLeft=m}return(r&&!n?t.contains(s):t===s&&"BODY"!==s.nodeName)&&(h=b(h,t)),h}function P(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.ownerDocument.documentElement,r=k(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=t?0:m(n),u=t?0:m(n,"left"),l={top:a-r.top+r.marginTop,left:u-r.left+r.marginLeft,width:o,height:i};return S(l)}function T(e){var t=e.nodeName;if("BODY"===t||"HTML"===t)return!1;if("fixed"===a(e,"position"))return!0;var n=u(e);return!!n&&T(n)}function j(e){if(!e||!e.parentElement||d())return document.documentElement;for(var t=e.parentElement;t&&"none"===a(t,"transform");)t=t.parentElement;return t||document.documentElement}function A(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i={top:0,left:0},a=o?j(e):v(e,s(t));if("viewport"===r)i=P(a,o);else{var c=void 0;"scrollParent"===r?"BODY"===(c=l(u(t))).nodeName&&(c=e.ownerDocument.documentElement):c="window"===r?e.ownerDocument.documentElement:r;var f=k(c,a,o);if("HTML"!==c.nodeName||T(a))i=f;else{var d=w(e.ownerDocument),p=d.height,h=d.width;i.top+=f.top-f.marginTop,i.bottom=p+f.top,i.left+=f.left-f.marginLeft,i.right=h+f.left}}var m="number"==typeof(n=n||0);return i.left+=m?n:n.left||0,i.top+=m?n:n.top||0,i.right-=m?n:n.right||0,i.bottom-=m?n:n.bottom||0,i}function M(e){return e.width*e.height}function D(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf("auto"))return e;var a=A(n,r,i,o),u={top:{width:a.width,height:t.top-a.top},right:{width:a.right-t.right,height:a.height},bottom:{width:a.width,height:a.bottom-t.bottom},left:{width:t.left-a.left,height:a.height}},l=Object.keys(u).map((function(e){return O({key:e},u[e],{area:M(u[e])})})).sort((function(e,t){return t.area-e.area})),s=l.filter((function(e){var t=e.width,r=e.height;return t>=n.clientWidth&&r>=n.clientHeight})),c=s.length>0?s[0].key:l[0].key,f=e.split("-")[1];return c+(f?"-"+f:"")}function L(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=r?j(t):v(t,s(n));return k(n,o,r)}function F(e){var t=e.ownerDocument.defaultView.getComputedStyle(e),n=parseFloat(t.marginTop||0)+parseFloat(t.marginBottom||0),r=parseFloat(t.marginLeft||0)+parseFloat(t.marginRight||0);return{width:e.offsetWidth+r,height:e.offsetHeight+n}}function N(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,(function(e){return t[e]}))}function I(e,t,n){n=n.split("-")[0];var r=F(e),o={width:r.width,height:r.height},i=-1!==["right","left"].indexOf(n),a=i?"top":"left",u=i?"left":"top",l=i?"height":"width",s=i?"width":"height";return o[a]=t[a]+t[l]/2-r[l]/2,o[u]=n===u?t[u]-r[s]:t[N(u)],o}function R(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function B(e,t,n){return(void 0===n?e:e.slice(0,function(e,t,n){if(Array.prototype.findIndex)return e.findIndex((function(e){return e.name===n}));var r=R(e,(function(e){return e.name===n}));return e.indexOf(r)}(e,0,n))).forEach((function(e){e.function;var n=e.function||e.fn;e.enabled&&i(n)&&(t.offsets.popper=S(t.offsets.popper),t.offsets.reference=S(t.offsets.reference),t=n(t,e))})),t}function U(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=L(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=D(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=I(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=B(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function H(e,t){return e.some((function(e){var n=e.name;return e.enabled&&n===t}))}function z(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;r<t.length;r++){var o=t[r],i=o?""+o+n:e;if(void 0!==document.body.style[i])return i}return null}function V(){return this.state.isDestroyed=!0,H(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[z("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function W(e){var t=e.ownerDocument;return t?t.defaultView:window}function $(){this.state.eventsEnabled||(this.state=function(e,t,n,r){n.updateBound=r,W(e).addEventListener("resize",n.updateBound,{passive:!0});var o=l(e);return function e(t,n,r,o){var i="BODY"===t.nodeName,a=i?t.ownerDocument.defaultView:t;a.addEventListener(n,r,{passive:!0}),i||e(l(a.parentNode),n,r,o),o.push(a)}(o,"scroll",n.updateBound,n.scrollParents),n.scrollElement=o,n.eventsEnabled=!0,n}(this.reference,this.options,this.state,this.scheduleUpdate))}function G(){var e,t;this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=(e=this.reference,t=this.state,W(e).removeEventListener("resize",t.updateBound),t.scrollParents.forEach((function(e){e.removeEventListener("scroll",t.updateBound)})),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t))}function Y(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function q(e,t){Object.keys(t).forEach((function(n){var r="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&Y(t[n])&&(r="px"),e.style[n]=t[n]+r}))}var X=n&&/Firefox/i.test(navigator.userAgent);function K(e,t,n){var r=R(e,(function(e){return e.name===t})),o=!!r&&e.some((function(e){return e.name===n&&e.enabled&&e.order<r.order}));return o}var Q=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],J=Q.slice(3);function Z(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=J.indexOf(e),r=J.slice(n+1).concat(J.slice(0,n));return t?r.reverse():r}var ee={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,a=o.popper,u=-1!==["bottom","top"].indexOf(n),l=u?"left":"top",s=u?"width":"height",c={start:_({},l,i[l]),end:_({},l,i[l]+i[s]-a[s])};e.offsets.popper=O({},a,c[r])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var n,r=t.offset,o=e.placement,i=e.offsets,a=i.popper,u=i.reference,l=o.split("-")[0];return n=Y(+r)?[+r,0]:function(e,t,n,r){var o=[0,0],i=-1!==["right","left"].indexOf(r),a=e.split(/(\+|\-)/).map((function(e){return e.trim()})),u=a.indexOf(R(a,(function(e){return-1!==e.search(/,|\s/)})));a[u]&&a[u].indexOf(",");var l=/\s*,\s*|\s+/,s=-1!==u?[a.slice(0,u).concat([a[u].split(l)[0]]),[a[u].split(l)[1]].concat(a.slice(u+1))]:[a];return(s=s.map((function(e,r){var o=(1===r?!i:i)?"height":"width",a=!1;return e.reduce((function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,a=!0,e):a?(e[e.length-1]+=t,a=!1,e):e.concat(t)}),[]).map((function(e){return function(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],a=o[2];if(!i)return e;if(0===a.indexOf("%")){var u=void 0;switch(a){case"%p":u=n;break;case"%":case"%r":default:u=r}return S(u)[t]/100*i}return"vh"===a||"vw"===a?("vh"===a?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*i:i}(e,o,t,n)}))}))).forEach((function(e,t){e.forEach((function(n,r){Y(n)&&(o[t]+=n*("-"===e[r-1]?-1:1))}))})),o}(r,a,u,l),"left"===l?(a.top+=n[0],a.left-=n[1]):"right"===l?(a.top+=n[0],a.left+=n[1]):"top"===l?(a.left+=n[0],a.top-=n[1]):"bottom"===l&&(a.left+=n[0],a.top+=n[1]),e.popper=a,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var n=t.boundariesElement||p(e.instance.popper);e.instance.reference===n&&(n=p(n));var r=z("transform"),o=e.instance.popper.style,i=o.top,a=o.left,u=o[r];o.top="",o.left="",o[r]="";var l=A(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=a,o[r]=u,t.boundaries=l;var s=t.priority,c=e.offsets.popper,f={primary:function(e){var n=c[e];return c[e]<l[e]&&!t.escapeWithReference&&(n=Math.max(c[e],l[e])),_({},e,n)},secondary:function(e){var n="right"===e?"left":"top",r=c[n];return c[e]>l[e]&&!t.escapeWithReference&&(r=Math.min(c[n],l[e]-("right"===e?c.width:c.height))),_({},n,r)}};return s.forEach((function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";c=O({},c,f[t](e))})),e.offsets.popper=c,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,a=-1!==["top","bottom"].indexOf(o),u=a?"right":"bottom",l=a?"left":"top",s=a?"width":"height";return n[u]<i(r[l])&&(e.offsets.popper[l]=i(r[l])-n[s]),n[l]>i(r[u])&&(e.offsets.popper[l]=i(r[u])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){var n;if(!K(e.instance.modifiers,"arrow","keepTogether"))return e;var r=t.element;if("string"==typeof r){if(!(r=e.instance.popper.querySelector(r)))return e}else if(!e.instance.popper.contains(r))return e;var o=e.placement.split("-")[0],i=e.offsets,u=i.popper,l=i.reference,s=-1!==["left","right"].indexOf(o),c=s?"height":"width",f=s?"Top":"Left",d=f.toLowerCase(),p=s?"left":"top",h=s?"bottom":"right",v=F(r)[c];l[h]-v<u[d]&&(e.offsets.popper[d]-=u[d]-(l[h]-v)),l[d]+v>u[h]&&(e.offsets.popper[d]+=l[d]+v-u[h]),e.offsets.popper=S(e.offsets.popper);var m=l[d]+l[c]/2-v/2,b=a(e.instance.popper),g=parseFloat(b["margin"+f]),y=parseFloat(b["border"+f+"Width"]),w=m-e.offsets.popper[d]-g-y;return w=Math.max(Math.min(u[c]-v,w),0),e.arrowElement=r,e.offsets.arrow=(_(n={},d,Math.round(w)),_(n,p,""),n),e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(e,t){if(H(e.instance.modifiers,"inner"))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var n=A(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=N(r),i=e.placement.split("-")[1]||"",a=[];switch(t.behavior){case"flip":a=[r,o];break;case"clockwise":a=Z(r);break;case"counterclockwise":a=Z(r,!0);break;default:a=t.behavior}return a.forEach((function(u,l){if(r!==u||a.length===l+1)return e;r=e.placement.split("-")[0],o=N(r);var s=e.offsets.popper,c=e.offsets.reference,f=Math.floor,d="left"===r&&f(s.right)>f(c.left)||"right"===r&&f(s.left)<f(c.right)||"top"===r&&f(s.bottom)>f(c.top)||"bottom"===r&&f(s.top)<f(c.bottom),p=f(s.left)<f(n.left),h=f(s.right)>f(n.right),v=f(s.top)<f(n.top),m=f(s.bottom)>f(n.bottom),b="left"===r&&p||"right"===r&&h||"top"===r&&v||"bottom"===r&&m,g=-1!==["top","bottom"].indexOf(r),y=!!t.flipVariations&&(g&&"start"===i&&p||g&&"end"===i&&h||!g&&"start"===i&&v||!g&&"end"===i&&m),w=!!t.flipVariationsByContent&&(g&&"start"===i&&h||g&&"end"===i&&p||!g&&"start"===i&&m||!g&&"end"===i&&v),x=y||w;(d||b||x)&&(e.flipped=!0,(d||b)&&(r=a[l+1]),x&&(i=function(e){return"end"===e?"start":"start"===e?"end":e}(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=O({},e.offsets.popper,I(e.instance.popper,e.offsets.reference,e.placement)),e=B(e.instance.modifiers,e,"flip"))})),e},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],r=e.offsets,o=r.popper,i=r.reference,a=-1!==["left","right"].indexOf(n),u=-1===["top","left"].indexOf(n);return o[a?"left":"top"]=i[n]-(u?o[a?"width":"height"]:0),e.placement=N(t),e.offsets.popper=S(o),e}},hide:{order:800,enabled:!0,fn:function(e){if(!K(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=R(e.instance.modifiers,(function(e){return"preventOverflow"===e.name})).boundaries;if(t.bottom<n.top||t.left>n.right||t.top>n.bottom||t.right<n.left){if(!0===e.hide)return e;e.hide=!0,e.attributes["x-out-of-boundaries"]=""}else{if(!1===e.hide)return e;e.hide=!1,e.attributes["x-out-of-boundaries"]=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var n,r,o=t.x,i=t.y,a=e.offsets.popper,u=R(e.instance.modifiers,(function(e){return"applyStyle"===e.name})).gpuAcceleration,l=void 0!==u?u:t.gpuAcceleration,s=p(e.instance.popper),c=C(s),f={position:a.position},d=function(e,t){var n=e.offsets,r=n.popper,o=n.reference,i=Math.round,a=Math.floor,u=function(e){return e},l=i(o.width),s=i(r.width),c=-1!==["left","right"].indexOf(e.placement),f=-1!==e.placement.indexOf("-"),d=t?c||f||l%2==s%2?i:a:u,p=t?i:u;return{left:d(l%2==1&&s%2==1&&!f&&t?r.left-1:r.left),top:p(r.top),bottom:p(r.bottom),right:d(r.right)}}(e,window.devicePixelRatio<2||!X),h="bottom"===o?"top":"bottom",v="right"===i?"left":"right",m=z("transform");if(r="bottom"===h?"HTML"===s.nodeName?-s.clientHeight+d.bottom:-c.height+d.bottom:d.top,n="right"===v?"HTML"===s.nodeName?-s.clientWidth+d.right:-c.width+d.right:d.left,l&&m)f[m]="translate3d("+n+"px, "+r+"px, 0)",f[h]=0,f[v]=0,f.willChange="transform";else{var b="bottom"===h?-1:1,g="right"===v?-1:1;f[h]=r*b,f[v]=n*g,f.willChange=h+", "+v}var y={"x-placement":e.placement};return e.attributes=O({},y,e.attributes),e.styles=O({},f,e.styles),e.arrowStyles=O({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(e){var t,n;return q(e.instance.popper,e.styles),t=e.instance.popper,n=e.attributes,Object.keys(n).forEach((function(e){!1!==n[e]?t.setAttribute(e,n[e]):t.removeAttribute(e)})),e.arrowElement&&Object.keys(e.arrowStyles).length&&q(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,n,r,o){var i=L(o,t,e,n.positionFixed),a=D(n.placement,i,t,e,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return t.setAttribute("x-placement",a),q(t,{position:n.positionFixed?"fixed":"absolute"}),n},gpuAcceleration:void 0}}},te=function(){function e(t,n){var r=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};x(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=o(this.update.bind(this)),this.options=O({},e.Defaults,a),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(O({},e.Defaults.modifiers,a.modifiers)).forEach((function(t){r.options.modifiers[t]=O({},e.Defaults.modifiers[t]||{},a.modifiers?a.modifiers[t]:{})})),this.modifiers=Object.keys(this.options.modifiers).map((function(e){return O({name:e},r.options.modifiers[e])})).sort((function(e,t){return e.order-t.order})),this.modifiers.forEach((function(e){e.enabled&&i(e.onLoad)&&e.onLoad(r.reference,r.popper,r.options,e,r.state)})),this.update();var u=this.options.eventsEnabled;u&&this.enableEventListeners(),this.state.eventsEnabled=u}return E(e,[{key:"update",value:function(){return U.call(this)}},{key:"destroy",value:function(){return V.call(this)}},{key:"enableEventListeners",value:function(){return $.call(this)}},{key:"disableEventListeners",value:function(){return G.call(this)}}]),e}();te.Utils=("undefined"!=typeof window?window:e).PopperUtils,te.placements=Q,te.Defaults=ee,t.a=te}).call(this,n(81))},,function(e,t,n){e.exports={root:"ProfilePic__root",round:"ProfilePic__round ProfilePic__root",square:"ProfilePic__square ProfilePic__root"}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(86),o=n.n(r),i=n(27),a=n.n(i),u=n(77),l=n.n(u),s=n(28),c=n.n(s),f=n(0),d=n(179),p=n.n(d),h=n(85),v=n(72),m=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t=e.call.apply(e,[this].concat(r))||this,c()(a()(t),"refHandler",(function(e){Object(v.b)(t.props.innerRef,e),Object(v.a)(t.props.setReferenceNode,e)})),t}l()(t,e);var n=t.prototype;return n.componentWillUnmount=function(){Object(v.b)(this.props.innerRef,null)},n.render=function(){return p()(Boolean(this.props.setReferenceNode),"`Reference` should not be used outside of a `Manager` component."),Object(v.c)(this.props.children)({ref:this.refHandler})},t}(f.Component);function b(e){return f.createElement(h.b.Consumer,null,(function(t){return f.createElement(m,o()({setReferenceNode:t},e))}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return E}));var r=n(262),o=n.n(r),i=n(86),a=n.n(i),u=n(27),l=n.n(u),s=n(77),c=n.n(s),f=n(28),d=n.n(f),p=n(263),h=n.n(p),v=n(0),m=n(187),b=n(85),g=n(72),y={position:"absolute",top:0,left:0,opacity:0,pointerEvents:"none"},w={},x=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t=e.call.apply(e,[this].concat(r))||this,d()(l()(t),"state",{data:void 0,placement:void 0}),d()(l()(t),"popperInstance",void 0),d()(l()(t),"popperNode",null),d()(l()(t),"arrowNode",null),d()(l()(t),"setPopperNode",(function(e){e&&t.popperNode!==e&&(Object(g.b)(t.props.innerRef,e),t.popperNode=e,t.updatePopperInstance())})),d()(l()(t),"setArrowNode",(function(e){t.arrowNode=e})),d()(l()(t),"updateStateModifier",{enabled:!0,order:900,fn:function(e){var n=e.placement;return t.setState({data:e,placement:n}),e}}),d()(l()(t),"getOptions",(function(){return{placement:t.props.placement,eventsEnabled:t.props.eventsEnabled,positionFixed:t.props.positionFixed,modifiers:a()({},t.props.modifiers,{arrow:a()({},t.props.modifiers&&t.props.modifiers.arrow,{enabled:!!t.arrowNode,element:t.arrowNode}),applyStyle:{enabled:!1},updateStateModifier:t.updateStateModifier})}})),d()(l()(t),"getPopperStyle",(function(){return t.popperNode&&t.state.data?a()({position:t.state.data.offsets.popper.position},t.state.data.styles):y})),d()(l()(t),"getPopperPlacement",(function(){return t.state.data?t.state.placement:void 0})),d()(l()(t),"getArrowStyle",(function(){return t.arrowNode&&t.state.data?t.state.data.arrowStyles:w})),d()(l()(t),"getOutOfBoundariesState",(function(){return t.state.data?t.state.data.hide:void 0})),d()(l()(t),"destroyPopperInstance",(function(){t.popperInstance&&(t.popperInstance.destroy(),t.popperInstance=null)})),d()(l()(t),"updatePopperInstance",(function(){t.destroyPopperInstance();var e=l()(t).popperNode,n=t.props.referenceElement;n&&e&&(t.popperInstance=new m.a(n,e,t.getOptions()))})),d()(l()(t),"scheduleUpdate",(function(){t.popperInstance&&t.popperInstance.scheduleUpdate()})),t}c()(t,e);var n=t.prototype;return n.componentDidUpdate=function(e,t){this.props.placement===e.placement&&this.props.referenceElement===e.referenceElement&&this.props.positionFixed===e.positionFixed&&h()(this.props.modifiers,e.modifiers,{strict:!0})?this.props.eventsEnabled!==e.eventsEnabled&&this.popperInstance&&(this.props.eventsEnabled?this.popperInstance.enableEventListeners():this.popperInstance.disableEventListeners()):this.updatePopperInstance(),t.placement!==this.state.placement&&this.scheduleUpdate()},n.componentWillUnmount=function(){Object(g.b)(this.props.innerRef,null),this.destroyPopperInstance()},n.render=function(){return Object(g.c)(this.props.children)({ref:this.setPopperNode,style:this.getPopperStyle(),placement:this.getPopperPlacement(),outOfBoundaries:this.getOutOfBoundariesState(),scheduleUpdate:this.scheduleUpdate,arrowProps:{ref:this.setArrowNode,style:this.getArrowStyle()}})},t}(v.Component);function E(e){var t=e.referenceElement,n=o()(e,["referenceElement"]);return v.createElement(b.a.Consumer,null,(function(e){return v.createElement(x,a()({referenceElement:void 0!==t?t:e},n))}))}d()(x,"defaultProps",{placement:"bottom",eventsEnabled:!0,referenceElement:void 0,positionFixed:!1}),m.a.placements},,function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,l=a(e),s=1;s<arguments.length;s++){for(var c in n=Object(arguments[s]))o.call(n,c)&&(l[c]=n[c]);if(r){u=r(n);for(var f=0;f<u.length;f++)i.call(n,u[f])&&(l[u[f]]=n[u[f]])}}return l}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l,s=[],c=!1,f=-1;function d(){c&&l&&(c=!1,l.length?s=l.concat(s):f=-1,s.length&&p())}function p(){if(!c){var e=u(d);c=!0;for(var t=s.length;t;){for(l=s,s=[];++f<t;)l&&l[f].run();f=-1,t=s.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new h(e,t)),1!==s.length||c||u(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";e.exports=n(300)},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";var r=n(52);function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var a=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),a.push(o(t)+"="+o(e))})))})),i=a.join("&")}if(i){var u=e.indexOf("#");-1!==u&&(e=e.slice(0,u)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";(function(t){var r=n(52),o=n(306),i={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,l={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t))&&(u=n(206)),u),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){l.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){l.headers[e]=r.merge(i)})),e.exports=l}).call(this,n(200))},function(e,t,n){"use strict";var r=n(52),o=n(307),i=n(203),a=n(309),u=n(312),l=n(313),s=n(207);e.exports=function(e){return new Promise((function(t,c){var f=e.data,d=e.headers;r.isFormData(f)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",v=e.auth.password||"";d.Authorization="Basic "+btoa(h+":"+v)}var m=a(e.baseURL,e.url);if(p.open(e.method.toUpperCase(),i(m,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in p?u(p.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:n,config:e,request:p};o(t,c,r),p=null}},p.onabort=function(){p&&(c(s("Request aborted",e,"ECONNABORTED",p)),p=null)},p.onerror=function(){c(s("Network Error",e,null,p)),p=null},p.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),c(s(t,e,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var b=n(314),g=(e.withCredentials||l(m))&&e.xsrfCookieName?b.read(e.xsrfCookieName):void 0;g&&(d[e.xsrfHeaderName]=g)}if("setRequestHeader"in p&&r.forEach(d,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete d[t]:p.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){p&&(p.abort(),c(e),p=null)})),void 0===f&&(f=null),p.send(f)}))}},function(e,t,n){"use strict";var r=n(308);e.exports=function(e,t,n,o,i){var a=new Error(e);return r(a,t,n,o,i)}},function(e,t,n){"use strict";var r=n(52);e.exports=function(e,t){t=t||{};var n={},o=["url","method","params","data"],i=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];r.forEach(o,(function(e){void 0!==t[e]&&(n[e]=t[e])})),r.forEach(i,(function(o){r.isObject(t[o])?n[o]=r.deepMerge(e[o],t[o]):void 0!==t[o]?n[o]=t[o]:r.isObject(e[o])?n[o]=r.deepMerge(e[o]):void 0!==e[o]&&(n[o]=e[o])})),r.forEach(a,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var u=o.concat(i).concat(a),l=Object.keys(t).filter((function(e){return-1===u.indexOf(e)}));return r.forEach(l,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},,function(e,t,n){"use strict";var r=Array.prototype.slice,o=n(212),i=Object.keys,a=i?function(e){return i(e)}:n(320),u=Object.keys;a.shim=function(){return Object.keys?function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2)||(Object.keys=function(e){return o(e)?u(r.call(e)):u(e)}):Object.keys=a,Object.keys||a},e.exports=a},function(e,t,n){"use strict";var r=Object.prototype.toString;e.exports=function(e){var t=r.call(e),n="[object Arguments]"===t;return n||(n="[object Array]"!==t&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===r.call(e.callee)),n}},function(e,t,n){"use strict";var r=n(159),o=n(324)("%Function%"),i=o.apply,a=o.call;e.exports=function(){return r.apply(a,arguments)},e.exports.apply=function(){return r.apply(i,arguments)}},function(e,t,n){"use strict";var r=function(e){return e!=e};e.exports=function(e,t){return 0===e&&0===t?1/e==1/t:e===t||!(!r(e)||!r(t))}},function(e,t,n){"use strict";var r=n(214);e.exports=function(){return"function"==typeof Object.is?Object.is:r}},function(e,t,n){"use strict";var r=Object,o=TypeError;e.exports=function(){if(null!=this&&this!==r(this))throw new o("RegExp.prototype.flags getter called on non-object");var e="";return this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.sticky&&(e+="y"),e}},function(e,t,n){"use strict";var r=n(216),o=n(105).supportsDescriptors,i=Object.getOwnPropertyDescriptor,a=TypeError;e.exports=function(){if(!o)throw new a("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");if("gim"===/a/gim.flags){var e=i(RegExp.prototype,"flags");if(e&&"function"==typeof e.get&&"boolean"==typeof/a/.dotAll)return e.get}return r}},,,function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(81))},function(e,t,n){var r=n(222),o=n(107);e.exports=function(e,t){return e&&r(e,t,o)}},function(e,t,n){var r=n(343)();e.exports=r},function(e,t,n){var r=n(344),o=n(161),i=n(53),a=n(121),u=n(163),l=n(164),s=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),c=!n&&o(e),f=!n&&!c&&a(e),d=!n&&!c&&!f&&l(e),p=n||c||f||d,h=p?r(e.length,String):[],v=h.length;for(var m in e)!t&&!s.call(e,m)||p&&("length"==m||f&&("offset"==m||"parent"==m)||d&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||u(m,v))||h.push(m);return h}},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(122);e.exports=function(e){return"function"==typeof e?e:r}},function(e,t,n){var r=n(82),o=n(170),i=n(64),a=Function.prototype,u=Object.prototype,l=a.toString,s=u.hasOwnProperty,c=l.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=s.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==c}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(379),o=n(64);e.exports=function e(t,n,i,a,u){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,a,e,u))}},function(e,t,n){var r=n(380),o=n(383),i=n(384);e.exports=function(e,t,n,a,u,l){var s=1&n,c=e.length,f=t.length;if(c!=f&&!(s&&f>c))return!1;var d=l.get(e);if(d&&l.get(t))return d==t;var p=-1,h=!0,v=2&n?new r:void 0;for(l.set(e,t),l.set(t,e);++p<c;){var m=e[p],b=t[p];if(a)var g=s?a(b,m,p,t,e,l):a(m,b,p,e,t,l);if(void 0!==g){if(g)continue;h=!1;break}if(v){if(!o(t,(function(e,t){if(!i(v,t)&&(m===e||u(m,e,n,a,l)))return v.push(t)}))){h=!1;break}}else if(m!==b&&!u(m,b,n,a,l)){h=!1;break}}return l.delete(e),l.delete(t),h}},function(e,t,n){var r=n(60).Uint8Array;e.exports=r},function(e,t,n){var r=n(233),o=n(173),i=n(107);e.exports=function(e){return r(e,i,o)}},function(e,t,n){var r=n(234),o=n(53);e.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}},function(e,t){e.exports=function(){return[]}},function(e,t,n){var r=n(58);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&n[e]===t&&(void 0!==t||e in Object(n))}}},function(e,t,n){var r=n(239),o=n(130);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n<i;)e=e[o(t[n++])];return n&&n==i?e:void 0}},function(e,t,n){var r=n(53),o=n(174),i=n(397),a=n(400);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(a(e))}},function(e,t,n){var r=n(221),o=n(409)(r);e.exports=o},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}},function(e,t,n){var r=n(175),o=n(108),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];i.call(e,t)&&o(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(83),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){(function(e){var r=n(60),o=t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=i&&i.exports===o?r.Buffer:void 0,u=a?a.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=u?u(n):new e.constructor(n);return e.copy(r),r}}).call(this,n(162)(e))},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},function(e,t,n){var r=n(234),o=n(170),i=n(173),a=n(235),u=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=o(e);return t}:a;e.exports=u},function(e,t,n){var r=n(176);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},function(e,t,n){var r=n(425),o=n(170),i=n(168);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(o(e))}},function(e,t,n){var r=n(175),o=n(108);e.exports=function(e,t,n){(void 0!==n&&!o(e[t],n)||void 0===n&&!(t in e))&&r(e,t,n)}},function(e,t){e.exports=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}},function(e,t,n){var r=n(58),o=n(456),i=n(457),a=Math.max,u=Math.min;e.exports=function(e,t,n){var l,s,c,f,d,p,h=0,v=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var n=l,r=s;return l=s=void 0,h=t,f=e.apply(r,n)}function y(e){return h=e,d=setTimeout(x,t),v?g(e):f}function w(e){var n=e-p;return void 0===p||n>=t||n<0||m&&e-h>=c}function x(){var e=o();if(w(e))return E(e);d=setTimeout(x,function(e){var n=t-(e-p);return m?u(n,c-(e-h)):n}(e))}function E(e){return d=void 0,b&&l?g(e):(l=s=void 0,f)}function _(){var e=o(),n=w(e);if(l=arguments,s=this,p=e,n){if(void 0===d)return y(p);if(m)return clearTimeout(d),d=setTimeout(x,t),g(p)}return void 0===d&&(d=setTimeout(x,t)),f}return t=i(t)||0,r(n)&&(v=!!n.leading,c=(m="maxWait"in n)?a(i(n.maxWait)||0,t):c,b="trailing"in n?!!n.trailing:b),_.cancel=function(){void 0!==d&&clearTimeout(d),h=0,l=p=s=d=void 0},_.flush=function(){return void 0===d?f:E(o())},_}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorWrap=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=s(i),u=s(n(251)),l=s(n(65));function s(e){return e&&e.__esModule?e:{default:e}}var c=t.ColorWrap=function(e){var t=function(t){function n(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var t=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return t.handleChange=function(e,n){if(l.default.simpleCheckForValidColor(e)){var r=l.default.toState(e,e.h||t.state.oldHue);t.setState(r),t.props.onChangeComplete&&t.debounce(t.props.onChangeComplete,r,n),t.props.onChange&&t.props.onChange(r,n)}},t.handleSwatchHover=function(e,n){if(l.default.simpleCheckForValidColor(e)){var r=l.default.toState(e,e.h||t.state.oldHue);t.props.onSwatchHover&&t.props.onSwatchHover(r,n)}},t.state=r({},l.default.toState(e.color,0)),t.debounce=(0,u.default)((function(e,t,n){e(t,n)}),100),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,t),o(n,[{key:"render",value:function(){var t={};return this.props.onSwatchHover&&(t.onSwatchHover=this.handleSwatchHover),a.default.createElement(e,r({},this.props,this.state,{onChange:this.handleChange},t))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return r({},l.default.toState(e.color,t.oldHue))}}]),n}(i.PureComponent||i.Component);return t.propTypes=r({},e.propTypes),t.defaultProps=r({},e.defaultProps,{color:{h:250,s:.5,l:.2,a:1}}),t};t.default=c},function(e,t,n){"use strict";n.r(t),n.d(t,"red",(function(){return r})),n.d(t,"pink",(function(){return o})),n.d(t,"purple",(function(){return i})),n.d(t,"deepPurple",(function(){return a})),n.d(t,"indigo",(function(){return u})),n.d(t,"blue",(function(){return l})),n.d(t,"lightBlue",(function(){return s})),n.d(t,"cyan",(function(){return c})),n.d(t,"teal",(function(){return f})),n.d(t,"green",(function(){return d})),n.d(t,"lightGreen",(function(){return p})),n.d(t,"lime",(function(){return h})),n.d(t,"yellow",(function(){return v})),n.d(t,"amber",(function(){return m})),n.d(t,"orange",(function(){return b})),n.d(t,"deepOrange",(function(){return g})),n.d(t,"brown",(function(){return y})),n.d(t,"grey",(function(){return w})),n.d(t,"blueGrey",(function(){return x})),n.d(t,"darkText",(function(){return E})),n.d(t,"lightText",(function(){return _})),n.d(t,"darkIcons",(function(){return O})),n.d(t,"lightIcons",(function(){return S})),n.d(t,"white",(function(){return C})),n.d(t,"black",(function(){return k}));var r={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",a100:"#ff8a80",a200:"#ff5252",a400:"#ff1744",a700:"#d50000"},o={50:"#fce4ec",100:"#f8bbd0",200:"#f48fb1",300:"#f06292",400:"#ec407a",500:"#e91e63",600:"#d81b60",700:"#c2185b",800:"#ad1457",900:"#880e4f",a100:"#ff80ab",a200:"#ff4081",a400:"#f50057",a700:"#c51162"},i={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",a100:"#ea80fc",a200:"#e040fb",a400:"#d500f9",a700:"#aa00ff"},a={50:"#ede7f6",100:"#d1c4e9",200:"#b39ddb",300:"#9575cd",400:"#7e57c2",500:"#673ab7",600:"#5e35b1",700:"#512da8",800:"#4527a0",900:"#311b92",a100:"#b388ff",a200:"#7c4dff",a400:"#651fff",a700:"#6200ea"},u={50:"#e8eaf6",100:"#c5cae9",200:"#9fa8da",300:"#7986cb",400:"#5c6bc0",500:"#3f51b5",600:"#3949ab",700:"#303f9f",800:"#283593",900:"#1a237e",a100:"#8c9eff",a200:"#536dfe",a400:"#3d5afe",a700:"#304ffe"},l={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",a100:"#82b1ff",a200:"#448aff",a400:"#2979ff",a700:"#2962ff"},s={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",a100:"#80d8ff",a200:"#40c4ff",a400:"#00b0ff",a700:"#0091ea"},c={50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",a100:"#84ffff",a200:"#18ffff",a400:"#00e5ff",a700:"#00b8d4"},f={50:"#e0f2f1",100:"#b2dfdb",200:"#80cbc4",300:"#4db6ac",400:"#26a69a",500:"#009688",600:"#00897b",700:"#00796b",800:"#00695c",900:"#004d40",a100:"#a7ffeb",a200:"#64ffda",a400:"#1de9b6",a700:"#00bfa5"},d={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",a100:"#b9f6ca",a200:"#69f0ae",a400:"#00e676",a700:"#00c853"},p={50:"#f1f8e9",100:"#dcedc8",200:"#c5e1a5",300:"#aed581",400:"#9ccc65",500:"#8bc34a",600:"#7cb342",700:"#689f38",800:"#558b2f",900:"#33691e",a100:"#ccff90",a200:"#b2ff59",a400:"#76ff03",a700:"#64dd17"},h={50:"#f9fbe7",100:"#f0f4c3",200:"#e6ee9c",300:"#dce775",400:"#d4e157",500:"#cddc39",600:"#c0ca33",700:"#afb42b",800:"#9e9d24",900:"#827717",a100:"#f4ff81",a200:"#eeff41",a400:"#c6ff00",a700:"#aeea00"},v={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",a100:"#ffff8d",a200:"#ffff00",a400:"#ffea00",a700:"#ffd600"},m={50:"#fff8e1",100:"#ffecb3",200:"#ffe082",300:"#ffd54f",400:"#ffca28",500:"#ffc107",600:"#ffb300",700:"#ffa000",800:"#ff8f00",900:"#ff6f00",a100:"#ffe57f",a200:"#ffd740",a400:"#ffc400",a700:"#ffab00"},b={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",a100:"#ffd180",a200:"#ffab40",a400:"#ff9100",a700:"#ff6d00"},g={50:"#fbe9e7",100:"#ffccbc",200:"#ffab91",300:"#ff8a65",400:"#ff7043",500:"#ff5722",600:"#f4511e",700:"#e64a19",800:"#d84315",900:"#bf360c",a100:"#ff9e80",a200:"#ff6e40",a400:"#ff3d00",a700:"#dd2c00"},y={50:"#efebe9",100:"#d7ccc8",200:"#bcaaa4",300:"#a1887f",400:"#8d6e63",500:"#795548",600:"#6d4c41",700:"#5d4037",800:"#4e342e",900:"#3e2723"},w={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121"},x={50:"#eceff1",100:"#cfd8dc",200:"#b0bec5",300:"#90a4ae",400:"#78909c",500:"#607d8b",600:"#546e7a",700:"#455a64",800:"#37474f",900:"#263238"},E={primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.38)",dividers:"rgba(0, 0, 0, 0.12)"},_={primary:"rgba(255, 255, 255, 1)",secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",dividers:"rgba(255, 255, 255, 0.12)"},O={active:"rgba(0, 0, 0, 0.54)",inactive:"rgba(0, 0, 0, 0.38)"},S={active:"rgba(255, 255, 255, 1)",inactive:"rgba(255, 255, 255, 0.5)"},C="#ffffff",k="#000000";t.default={red:r,pink:o,purple:i,deepPurple:a,indigo:u,blue:l,lightBlue:s,cyan:c,teal:f,green:d,lightGreen:p,lime:h,yellow:v,amber:m,orange:b,deepOrange:g,brown:y,grey:w,blueGrey:x,darkText:E,lightText:_,darkIcons:O,lightIcons:S,white:C,black:k}},,,function(e,t,n){"use strict";var r=n(201),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},u={};function l(e){return r.isMemo(e)?a:u[e.$$typeof]||o}u[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},u[r.Memo]=a;var s=Object.defineProperty,c=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(h){var o=p(n);o&&o!==h&&e(t,o,r)}var a=c(n);f&&(a=a.concat(f(n)));for(var u=l(t),v=l(n),m=0;m<a.length;++m){var b=a[m];if(!(i[b]||r&&r[b]||v&&v[b]||u&&u[b])){var g=d(n,b);try{s(t,b,g)}catch(e){}}}}return t}},,function(e,t,n){e.exports={media:"MediaObject__media","media-background-fade-in-animation":"MediaObject__media-background-fade-in-animation",mediaBackgroundFadeInAnimation:"MediaObject__media-background-fade-in-animation","media-object-fade-in-animation":"MediaObject__media-object-fade-in-animation",mediaObjectFadeInAnimation:"MediaObject__media-object-fade-in-animation",preview:"MediaObject__preview MediaObject__media","not-available":"MediaObject__not-available MediaObject__media",notAvailable:"MediaObject__not-available MediaObject__media"}},function(e,t,n){e.exports={root:"LoadMoreButton__root feed__feed-button"}},function(e,t,n){e.exports=n(301)},,function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t,n){var r=n(211),o=n(321),i=n(322),a=n(328),u=n(330),l=n(332),s=Date.prototype.getTime;function c(e){return null==e}function f(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length||"function"!=typeof e.copy||"function"!=typeof e.slice||e.length>0&&"number"!=typeof e[0])}e.exports=function e(t,n,d){var p=d||{};return!!(p.strict?i(t,n):t===n)||(!t||!n||"object"!=typeof t&&"object"!=typeof n?p.strict?i(t,n):t==n:function(t,n,i){var d,p;if(typeof t!=typeof n)return!1;if(c(t)||c(n))return!1;if(t.prototype!==n.prototype)return!1;if(o(t)!==o(n))return!1;var h=a(t),v=a(n);if(h!==v)return!1;if(h||v)return t.source===n.source&&u(t)===u(n);if(l(t)&&l(n))return s.call(t)===s.call(n);var m=f(t),b=f(n);if(m!==b)return!1;if(m||b){if(t.length!==n.length)return!1;for(d=0;d<t.length;d++)if(t[d]!==n[d])return!1;return!0}if(typeof t!=typeof n)return!1;try{var g=r(t),y=r(n)}catch(e){return!1}if(g.length!==y.length)return!1;for(g.sort(),y.sort(),d=g.length-1;d>=0;d--)if(g[d]!=y[d])return!1;for(d=g.length-1;d>=0;d--)if(!e(t[p=g[d]],n[p],i))return!1;return!0}(t,n,p))}},,,function(e,t,n){"use strict";var r=n(0),o=(n(94),n(10),n(41),n(21),n(76)),i=(n(66),n(132),n(140));n(146);r.Component;var a=Object(i.a)(o.a);t.a=a},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CustomPicker=t.TwitterPicker=t.SwatchesPicker=t.SliderPicker=t.SketchPicker=t.PhotoshopPicker=t.MaterialPicker=t.HuePicker=t.GithubPicker=t.CompactPicker=t.ChromePicker=t.default=t.CirclePicker=t.BlockPicker=t.AlphaPicker=void 0;var r=n(338);Object.defineProperty(t,"AlphaPicker",{enumerable:!0,get:function(){return g(r).default}});var o=n(465);Object.defineProperty(t,"BlockPicker",{enumerable:!0,get:function(){return g(o).default}});var i=n(467);Object.defineProperty(t,"CirclePicker",{enumerable:!0,get:function(){return g(i).default}});var a=n(469);Object.defineProperty(t,"ChromePicker",{enumerable:!0,get:function(){return g(a).default}});var u=n(475);Object.defineProperty(t,"CompactPicker",{enumerable:!0,get:function(){return g(u).default}});var l=n(478);Object.defineProperty(t,"GithubPicker",{enumerable:!0,get:function(){return g(l).default}});var s=n(480);Object.defineProperty(t,"HuePicker",{enumerable:!0,get:function(){return g(s).default}});var c=n(482);Object.defineProperty(t,"MaterialPicker",{enumerable:!0,get:function(){return g(c).default}});var f=n(483);Object.defineProperty(t,"PhotoshopPicker",{enumerable:!0,get:function(){return g(f).default}});var d=n(489);Object.defineProperty(t,"SketchPicker",{enumerable:!0,get:function(){return g(d).default}});var p=n(492);Object.defineProperty(t,"SliderPicker",{enumerable:!0,get:function(){return g(p).default}});var h=n(496);Object.defineProperty(t,"SwatchesPicker",{enumerable:!0,get:function(){return g(h).default}});var v=n(500);Object.defineProperty(t,"TwitterPicker",{enumerable:!0,get:function(){return g(v).default}});var m=n(252);Object.defineProperty(t,"CustomPicker",{enumerable:!0,get:function(){return g(m).default}});var b=g(a);function g(e){return e&&e.__esModule?e:{default:e}}t.default=b.default},,function(e,t,n){"use strict";var r=n(505).CopyToClipboard;r.CopyToClipboard=r,e.exports=r},,,,function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.d(t,"a",(function(){return o}));var o=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fns=t,this.delay=null!=n?n:1}var t,n;return t=e,(n=[{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1?arguments[1]:void 0;this.numLoaded=0,this.isLoading=!0;var r=function(){e.numLoaded++,e.numLoaded>=e.fns.length&&setTimeout((function(){e.isLoading=!1,n&&n()}),e.delay)};this.fns.forEach((function(e){return e(t,r)}))}}])&&r(t.prototype,n),e}()},,,function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=o.apply(null,r);a&&e.push(a)}else if("object"===i)for(var u in r)n.call(r,u)&&r[u]&&e.push(u)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,function(e,t,n){"use strict";var r=n(0),o=n.n(r),i=n(2),a=n(23),u=n(18);t.a=Object(i.b)((function(e){var t=e.when,n=e.message;return Object(u.g)(n,t),o.a.createElement(a.a,{when:t(),message:n})}))},,,,function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){o(e,t,n[t])}))}return e}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function l(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}n.d(t,"a",(function(){return yt}));var s=l(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),c=l(/Edge/i),f=l(/firefox/i),d=l(/safari/i)&&!l(/chrome/i)&&!l(/android/i),p=l(/iP(ad|od|hone)/i),h=l(/chrome/i)&&l(/android/i),v={capture:!1,passive:!1};function m(e,t,n){e.addEventListener(t,n,!s&&v)}function b(e,t,n){e.removeEventListener(t,n,!s&&v)}function g(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function y(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function w(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&g(e,t):g(e,t))||r&&e===n)return e;if(e===n)break}while(e=y(e))}return null}var x,E=/\s+/g;function _(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(E," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(E," ")}}function O(e,t,n){var r=e&&e.style;if(r){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in r||-1!==t.indexOf("webkit")||(t="-webkit-"+t),r[t]=n+("string"==typeof n?"":"px")}}function S(e,t){var n="";if("string"==typeof e)n=e;else do{var r=O(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix;return o&&new o(n)}function C(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o<i;o++)n(r[o],o);return r}return[]}function k(){return s?document.documentElement:document.scrollingElement}function P(e,t,n,r,o){if(e.getBoundingClientRect||e===window){var i,a,u,l,c,f,d;if(e!==window&&e!==k()?(a=(i=e.getBoundingClientRect()).top,u=i.left,l=i.bottom,c=i.right,f=i.height,d=i.width):(a=0,u=0,l=window.innerHeight,c=window.innerWidth,f=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!s))do{if(o&&o.getBoundingClientRect&&("none"!==O(o,"transform")||n&&"static"!==O(o,"position"))){var p=o.getBoundingClientRect();a-=p.top+parseInt(O(o,"border-top-width")),u-=p.left+parseInt(O(o,"border-left-width")),l=a+i.height,c=u+i.width;break}}while(o=o.parentNode);if(r&&e!==window){var h=S(o||e),v=h&&h.a,m=h&&h.d;h&&(l=(a/=m)+(f/=m),c=(u/=v)+(d/=v))}return{top:a,left:u,bottom:l,right:c,width:d,height:f}}}function T(e,t,n){for(var r=L(e,!0),o=P(e)[t];r;){var i=P(r)[n];if(!("top"===n||"left"===n?o>=i:o<=i))return r;if(r===k())break;r=L(r,!1)}return!1}function j(e,t,n){for(var r=0,o=0,i=e.children;o<i.length;){if("none"!==i[o].style.display&&i[o]!==Fe.ghost&&i[o]!==Fe.dragged&&w(i[o],n.draggable,e,!1)){if(r===t)return i[o];r++}o++}return null}function A(e,t){for(var n=e.lastElementChild;n&&(n===Fe.ghost||"none"===O(n,"display")||t&&!g(n,t));)n=n.previousElementSibling;return n||null}function M(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Fe.clone||t&&!g(e,t)||n++;return n}function D(e){var t=0,n=0,r=k();if(e)do{var o=S(e),i=o.a,a=o.d;t+=e.scrollLeft*i,n+=e.scrollTop*a}while(e!==r&&(e=e.parentNode));return[t,n]}function L(e,t){if(!e||!e.getBoundingClientRect)return k();var n=e,r=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=O(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n.getBoundingClientRect||n===document.body)return k();if(r||t)return n;r=!0}}}while(n=n.parentNode);return k()}function F(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function N(e,t){return function(){if(!x){var n=arguments,r=this;1===n.length?e.call(r,n[0]):e.apply(r,n),x=setTimeout((function(){x=void 0}),t)}}}function I(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function R(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}var B="Sortable"+(new Date).getTime();var U=[],H={initializeByDefault:!0},z={mount:function(e){for(var t in H)H.hasOwnProperty(t)&&!(t in e)&&(e[t]=H[t]);U.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var o=e+"Global";U.forEach((function(r){t[r.pluginName]&&(t[r.pluginName][o]&&t[r.pluginName][o](a({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](a({sortable:t},n)))}))},initializePlugins:function(e,t,n,r){for(var o in U.forEach((function(r){var o=r.pluginName;if(e.options[o]||r.initializeByDefault){var a=new r(e,t,e.options);a.sortable=e,a.options=e.options,e[o]=a,i(n,a.defaults)}})),e.options)if(e.options.hasOwnProperty(o)){var a=this.modifyOption(e,o,e.options[o]);void 0!==a&&(e.options[o]=a)}},getEventProperties:function(e,t){var n={};return U.forEach((function(r){"function"==typeof r.eventProperties&&i(n,r.eventProperties.call(t[r.pluginName],e))})),n},modifyOption:function(e,t,n){var r;return U.forEach((function(o){e[o.pluginName]&&o.optionListeners&&"function"==typeof o.optionListeners[t]&&(r=o.optionListeners[t].call(e[o.pluginName],n))})),r}};var V=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=u(n,["evt"]);z.pluginEvent.bind(Fe)(e,t,a({dragEl:$,parentEl:G,ghostEl:Y,rootEl:q,nextEl:X,lastDownEl:K,cloneEl:Q,cloneHidden:J,dragStarted:fe,putSortable:oe,activeSortable:Fe.active,originalEvent:r,oldIndex:Z,oldDraggableIndex:te,newIndex:ee,newDraggableIndex:ne,hideGhostForTarget:Ae,unhideGhostForTarget:Me,cloneNowHidden:function(){J=!0},cloneNowShown:function(){J=!1},dispatchSortableEvent:function(e){W({sortable:t,name:e,originalEvent:r})}},o))};function W(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,u=e.toEl,l=e.fromEl,f=e.oldIndex,d=e.newIndex,p=e.oldDraggableIndex,h=e.newDraggableIndex,v=e.originalEvent,m=e.putSortable,b=e.extraEventProperties;if(t=t||n&&n[B]){var g,y=t.options,w="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||s||c?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=u||n,g.from=l||n,g.item=o||n,g.clone=i,g.oldIndex=f,g.newIndex=d,g.oldDraggableIndex=p,g.newDraggableIndex=h,g.originalEvent=v,g.pullMode=m?m.lastPutMode:void 0;var x=a({},b,z.getEventProperties(r,t));for(var E in x)g[E]=x[E];n&&n.dispatchEvent(g),y[w]&&y[w].call(t,g)}}(a({putSortable:oe,cloneEl:Q,targetEl:$,rootEl:q,oldIndex:Z,oldDraggableIndex:te,newIndex:ee,newDraggableIndex:ne},e))}var $,G,Y,q,X,K,Q,J,Z,ee,te,ne,re,oe,ie,ae,ue,le,se,ce,fe,de,pe,he,ve,me=!1,be=!1,ge=[],ye=!1,we=!1,xe=[],Ee=!1,_e=[],Oe="undefined"!=typeof document,Se=p,Ce=c||s?"cssFloat":"float",ke=Oe&&!h&&!p&&"draggable"in document.createElement("div"),Pe=function(){if(Oe){if(s)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Te=function(e,t){var n=O(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=j(e,0,t),i=j(e,1,t),a=o&&O(o),u=i&&O(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+P(o).width,s=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+P(i).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&"none"!==a.float){var c="left"===a.float?"left":"right";return!i||"both"!==u.clear&&u.clear!==c?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=r&&"none"===n[Ce]||i&&"none"===n[Ce]&&l+s>r)?"vertical":"horizontal"},je=function(e){function t(e,n){return function(r,o,i,a){var u=r.options.group.name&&o.options.group.name&&r.options.group.name===o.options.group.name;if(null==e&&(n||u))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(r,o,i,a),n)(r,o,i,a);var l=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},o=e.group;o&&"object"==r(o)||(o={name:o}),n.name=o.name,n.checkPull=t(o.pull,!0),n.checkPut=t(o.put),n.revertClone=o.revertClone,e.group=n},Ae=function(){!Pe&&Y&&O(Y,"display","none")},Me=function(){!Pe&&Y&&O(Y,"display","")};Oe&&document.addEventListener("click",(function(e){if(be)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),be=!1,!1}),!0);var De=function(e){if($){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,ge.some((function(e){if(!A(e)){var t=P(e),n=e[B].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,u=i>=t.top-n&&i<=t.bottom+n;return n&&r&&u?a=e:void 0}})),a);if(t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[B]._onDragOver(n)}}var o,i,a},Le=function(e){$&&$.parentNode[B]._isOutsideThisEl(e.target)};function Fe(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=i({},t),e[B]=this;var n,r,o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Te(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Fe.supportPointer&&"PointerEvent"in window,emptyInsertThreshold:5};for(var u in z.initializePlugins(this,e,o),o)!(u in t)&&(t[u]=o[u]);for(var l in je(t),this)"_"===l.charAt(0)&&"function"==typeof this[l]&&(this[l]=this[l].bind(this));this.nativeDraggable=!t.forceFallback&&ke,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?m(e,"pointerdown",this._onTapStart):(m(e,"mousedown",this._onTapStart),m(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(m(e,"dragover",this),m(e,"dragenter",this)),ge.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),i(this,(r=[],{captureAnimationState:function(){r=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==O(e,"display")&&e!==Fe.ghost){r.push({target:e,rect:P(e)});var t=a({},r[r.length-1].rect);if(e.thisAnimationDuration){var n=S(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){r.push(e)},removeAnimationState:function(e){r.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var r in t)if(t.hasOwnProperty(r)&&t[r]===e[n][r])return Number(n);return-1}(r,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var o=!1,i=0;r.forEach((function(e){var n=0,r=e.target,a=r.fromRect,u=P(r),l=r.prevFromRect,s=r.prevToRect,c=e.rect,f=S(r,!0);f&&(u.top-=f.f,u.left-=f.e),r.toRect=u,r.thisAnimationDuration&&F(l,u)&&!F(a,u)&&(c.top-u.top)/(c.left-u.left)==(a.top-u.top)/(a.left-u.left)&&(n=function(e,t,n,r){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*r.animation}(c,l,s,t.options)),F(u,a)||(r.prevFromRect=a,r.prevToRect=u,n||(n=t.options.animation),t.animate(r,c,u,n)),n&&(o=!0,i=Math.max(i,n),clearTimeout(r.animationResetTimer),r.animationResetTimer=setTimeout((function(){r.animationTime=0,r.prevFromRect=null,r.fromRect=null,r.prevToRect=null,r.thisAnimationDuration=null}),n),r.thisAnimationDuration=n)})),clearTimeout(n),o?n=setTimeout((function(){"function"==typeof e&&e()}),i):"function"==typeof e&&e(),r=[]},animate:function(e,t,n,r){if(r){O(e,"transition",""),O(e,"transform","");var o=S(this.el),i=o&&o.a,a=o&&o.d,u=(t.left-n.left)/(i||1),l=(t.top-n.top)/(a||1);e.animatingX=!!u,e.animatingY=!!l,O(e,"transform","translate3d("+u+"px,"+l+"px,0)"),function(e){e.offsetWidth}(e),O(e,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:"")),O(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){O(e,"transition",""),O(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),r)}}}))}function Ne(e,t,n,r,o,i,a,u){var l,f,d=e[B],p=d.options.onMove;return!window.CustomEvent||s||c?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=r,l.related=o||t,l.relatedRect=i||P(t),l.willInsertAfter=u,l.originalEvent=a,e.dispatchEvent(l),p&&(f=p.call(d,l,a)),f}function Ie(e){e.draggable=!1}function Re(){Ee=!1}function Be(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function Ue(e){return setTimeout(e,0)}function He(e){return clearTimeout(e)}Fe.prototype={constructor:Fe,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(de=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,$):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,u=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,s=r.filter;if(function(e){_e.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var r=t[n];r.checked&&_e.push(r)}}(n),!$&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled||l.isContentEditable||(u=w(u,r.draggable,n,!1))&&u.animated||K===u)){if(Z=M(u),te=M(u,r.draggable),"function"==typeof s){if(s.call(this,e,u,this))return W({sortable:t,rootEl:l,name:"filter",targetEl:u,toEl:n,fromEl:n}),V("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(s&&(s=s.split(",").some((function(r){if(r=w(l,r.trim(),n,!1))return W({sortable:t,rootEl:r,name:"filter",targetEl:u,fromEl:n,toEl:n}),V("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!w(l,r.handle,n,!1)||this._prepareDragStart(e,a,u)}}},_prepareDragStart:function(e,t,n){var r,o=this,i=o.el,a=o.options,u=i.ownerDocument;if(n&&!$&&n.parentNode===i){var l=P(n);if(q=i,G=($=n).parentNode,X=$.nextSibling,K=n,re=a.group,Fe.dragged=$,ie={target:$,clientX:(t||e).clientX,clientY:(t||e).clientY},se=ie.clientX-l.left,ce=ie.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,$.style["will-change"]="all",r=function(){V("delayEnded",o,{evt:e}),Fe.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!f&&o.nativeDraggable&&($.draggable=!0),o._triggerDragStart(e,t),W({sortable:o,name:"choose",originalEvent:e}),_($,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){C($,e.trim(),Ie)})),m(u,"dragover",De),m(u,"mousemove",De),m(u,"touchmove",De),m(u,"mouseup",o._onDrop),m(u,"touchend",o._onDrop),m(u,"touchcancel",o._onDrop),f&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),V("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(c||s))r();else{if(Fe.eventCanceled)return void this._onDrop();m(u,"mouseup",o._disableDelayedDrag),m(u,"touchend",o._disableDelayedDrag),m(u,"touchcancel",o._disableDelayedDrag),m(u,"mousemove",o._delayedDragTouchMoveHandler),m(u,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&m(u,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&Ie($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;b(e,"mouseup",this._disableDelayedDrag),b(e,"touchend",this._disableDelayedDrag),b(e,"touchcancel",this._disableDelayedDrag),b(e,"mousemove",this._delayedDragTouchMoveHandler),b(e,"touchmove",this._delayedDragTouchMoveHandler),b(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?m(document,"pointermove",this._onTouchMove):m(document,t?"touchmove":"mousemove",this._onTouchMove):(m($,"dragend",this),m(q,"dragstart",this._onDragStart));try{document.selection?Ue((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(me=!1,q&&$){V("dragStarted",this,{evt:t}),this.nativeDraggable&&m(document,"dragover",Le);var n=this.options;!e&&_($,n.dragClass,!1),_($,n.ghostClass,!0),Fe.active=this,e&&this._appendGhost(),W({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(ae){this._lastX=ae.clientX,this._lastY=ae.clientY,Ae();for(var e=document.elementFromPoint(ae.clientX,ae.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ae.clientX,ae.clientY))!==t;)t=e;if($.parentNode[B]._isOutsideThisEl(e),t)do{if(t[B]&&t[B]._onDragOver({clientX:ae.clientX,clientY:ae.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);Me()}},_onTouchMove:function(e){if(ie){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=Y&&S(Y),a=Y&&i&&i.a,u=Y&&i&&i.d,l=Se&&ve&&D(ve),s=(o.clientX-ie.clientX+r.x)/(a||1)+(l?l[0]-xe[0]:0)/(a||1),c=(o.clientY-ie.clientY+r.y)/(u||1)+(l?l[1]-xe[1]:0)/(u||1);if(!Fe.active&&!me){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(Y){i?(i.e+=s-(ue||0),i.f+=c-(le||0)):i={a:1,b:0,c:0,d:1,e:s,f:c};var f="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");O(Y,"webkitTransform",f),O(Y,"mozTransform",f),O(Y,"msTransform",f),O(Y,"transform",f),ue=s,le=c,ae=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Y){var e=this.options.fallbackOnBody?document.body:q,t=P($,!0,Se,!0,e),n=this.options;if(Se){for(ve=e;"static"===O(ve,"position")&&"none"===O(ve,"transform")&&ve!==document;)ve=ve.parentNode;ve!==document.body&&ve!==document.documentElement?(ve===document&&(ve=k()),t.top+=ve.scrollTop,t.left+=ve.scrollLeft):ve=k(),xe=D(ve)}_(Y=$.cloneNode(!0),n.ghostClass,!1),_(Y,n.fallbackClass,!0),_(Y,n.dragClass,!0),O(Y,"transition",""),O(Y,"transform",""),O(Y,"box-sizing","border-box"),O(Y,"margin",0),O(Y,"top",t.top),O(Y,"left",t.left),O(Y,"width",t.width),O(Y,"height",t.height),O(Y,"opacity","0.8"),O(Y,"position",Se?"absolute":"fixed"),O(Y,"zIndex","100000"),O(Y,"pointerEvents","none"),Fe.ghost=Y,e.appendChild(Y),O(Y,"transform-origin",se/parseInt(Y.style.width)*100+"% "+ce/parseInt(Y.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,o=n.options;V("dragStart",this,{evt:e}),Fe.eventCanceled?this._onDrop():(V("setupClone",this),Fe.eventCanceled||((Q=R($)).draggable=!1,Q.style["will-change"]="",this._hideClone(),_(Q,this.options.chosenClass,!1),Fe.clone=Q),n.cloneId=Ue((function(){V("clone",n),Fe.eventCanceled||(n.options.removeCloneOnHide||q.insertBefore(Q,$),n._hideClone(),W({sortable:n,name:"clone"}))})),!t&&_($,o.dragClass,!0),t?(be=!0,n._loopId=setInterval(n._emulateDragOver,50)):(b(document,"mouseup",n._onDrop),b(document,"touchend",n._onDrop),b(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",o.setData&&o.setData.call(n,r,$)),m(document,"drop",n),O($,"transform","translateZ(0)")),me=!0,n._dragStartId=Ue(n._dragStarted.bind(n,t,e)),m(document,"selectstart",n),fe=!0,d&&O(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,r,o,i=this.el,u=e.target,l=this.options,s=l.group,c=Fe.active,f=re===s,d=l.sort,p=oe||c,h=this,v=!1;if(!Ee){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),u=w(u,l.draggable,i,!0),N("dragOver"),Fe.eventCanceled)return v;if($.contains(e.target)||u.animated&&u.animatingX&&u.animatingY||h._ignoreWhileAnimating===u)return U(!1);if(be=!1,c&&!l.disabled&&(f?d||(r=!q.contains($)):oe===this||(this.lastPutMode=re.checkPull(this,c,$,e))&&s.checkPut(this,c,$,e))){if(o="vertical"===this._getDirection(e,u),t=P($),N("dragOverValid"),Fe.eventCanceled)return v;if(r)return G=q,R(),this._hideClone(),N("revert"),Fe.eventCanceled||(X?q.insertBefore($,X):q.appendChild($)),U(!0);var m=A(i,l.draggable);if(!m||function(e,t,n){var r=P(A(n.el,n.options.draggable));return t?e.clientX>r.right+10||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+10}(e,o,this)&&!m.animated){if(m===$)return U(!1);if(m&&i===e.target&&(u=m),u&&(n=P(u)),!1!==Ne(q,i,$,t,u,n,e,!!u))return R(),i.appendChild($),G=i,H(),U(!0)}else if(u.parentNode===i){n=P(u);var b,g,y,x=$.parentNode!==i,E=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,i=n?e.width:e.height,a=n?t.left:t.top,u=n?t.right:t.bottom,l=n?t.width:t.height;return r===a||o===u||r+i/2===a+l/2}($.animated&&$.toRect||t,u.animated&&u.toRect||n,o),S=o?"top":"left",C=T(u,"top","top")||T($,"top","top"),k=C?C.scrollTop:void 0;if(de!==u&&(g=n[S],ye=!1,we=!E&&l.invertSwap||x),0!==(b=function(e,t,n,r,o,i,a,u){var l=r?e.clientY:e.clientX,s=r?n.height:n.width,c=r?n.top:n.left,f=r?n.bottom:n.right,d=!1;if(!a)if(u&&he<s*o){if(!ye&&(1===pe?l>c+s*i/2:l<f-s*i/2)&&(ye=!0),ye)d=!0;else if(1===pe?l<c+he:l>f-he)return-pe}else if(l>c+s*(1-o)/2&&l<f-s*(1-o)/2)return function(e){return M($)<M(e)?1:-1}(t);return(d=d||a)&&(l<c+s*i/2||l>f-s*i/2)?l>c+s/2?1:-1:0}(e,u,n,o,E?1:l.swapThreshold,null==l.invertedSwapThreshold?l.swapThreshold:l.invertedSwapThreshold,we,de===u))){var j=M($);do{j-=b,y=G.children[j]}while(y&&("none"===O(y,"display")||y===Y))}if(0===b||y===u)return U(!1);de=u,pe=b;var D=u.nextElementSibling,L=!1,F=Ne(q,i,$,t,u,n,e,L=1===b);if(!1!==F)return 1!==F&&-1!==F||(L=1===F),Ee=!0,setTimeout(Re,30),R(),L&&!D?i.appendChild($):u.parentNode.insertBefore($,L?D:u),C&&I(C,0,k-C.scrollTop),G=$.parentNode,void 0===g||we||(he=Math.abs(g-P(u)[S])),H(),U(!0)}if(i.contains($))return U(!1)}return!1}function N(l,s){V(l,h,a({evt:e,isOwner:f,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:p,target:u,completed:U,onMove:function(n,r){return Ne(q,i,$,t,n,P(n),e,r)},changed:H},s))}function R(){N("dragOverAnimationCapture"),h.captureAnimationState(),h!==p&&p.captureAnimationState()}function U(t){return N("dragOverCompleted",{insertion:t}),t&&(f?c._hideClone():c._showClone(h),h!==p&&(_($,oe?oe.options.ghostClass:c.options.ghostClass,!1),_($,l.ghostClass,!0)),oe!==h&&h!==Fe.active?oe=h:h===Fe.active&&oe&&(oe=null),p===h&&(h._ignoreWhileAnimating=u),h.animateAll((function(){N("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==p&&(p.animateAll(),p._ignoreWhileAnimating=null)),(u===$&&!$.animated||u===i&&!u.animated)&&(de=null),l.dragoverBubble||e.rootEl||u===document||($.parentNode[B]._isOutsideThisEl(e.target),!t&&De(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),v=!0}function H(){ee=M($),ne=M($,l.draggable),W({sortable:h,name:"change",toEl:i,newIndex:ee,newDraggableIndex:ne,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){b(document,"mousemove",this._onTouchMove),b(document,"touchmove",this._onTouchMove),b(document,"pointermove",this._onTouchMove),b(document,"dragover",De),b(document,"mousemove",De),b(document,"touchmove",De)},_offUpEvents:function(){var e=this.el.ownerDocument;b(e,"mouseup",this._onDrop),b(e,"touchend",this._onDrop),b(e,"pointerup",this._onDrop),b(e,"touchcancel",this._onDrop),b(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;ee=M($),ne=M($,n.draggable),V("drop",this,{evt:e}),G=$&&$.parentNode,ee=M($),ne=M($,n.draggable),Fe.eventCanceled||(me=!1,we=!1,ye=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),He(this.cloneId),He(this._dragStartId),this.nativeDraggable&&(b(document,"drop",this),b(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),d&&O(document.body,"user-select",""),e&&(fe&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),Y&&Y.parentNode&&Y.parentNode.removeChild(Y),(q===G||oe&&"clone"!==oe.lastPutMode)&&Q&&Q.parentNode&&Q.parentNode.removeChild(Q),$&&(this.nativeDraggable&&b($,"dragend",this),Ie($),$.style["will-change"]="",fe&&!me&&_($,oe?oe.options.ghostClass:this.options.ghostClass,!1),_($,this.options.chosenClass,!1),W({sortable:this,name:"unchoose",toEl:G,newIndex:null,newDraggableIndex:null,originalEvent:e}),q!==G?(ee>=0&&(W({rootEl:G,name:"add",toEl:G,fromEl:q,originalEvent:e}),W({sortable:this,name:"remove",toEl:G,originalEvent:e}),W({rootEl:G,name:"sort",toEl:G,fromEl:q,originalEvent:e}),W({sortable:this,name:"sort",toEl:G,originalEvent:e})),oe&&oe.save()):ee!==Z&&ee>=0&&(W({sortable:this,name:"update",toEl:G,originalEvent:e}),W({sortable:this,name:"sort",toEl:G,originalEvent:e})),Fe.active&&(null!=ee&&-1!==ee||(ee=Z,ne=te),W({sortable:this,name:"end",toEl:G,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){V("nulling",this),q=$=G=Y=X=Q=K=J=ie=ae=fe=ee=ne=Z=te=de=pe=oe=re=Fe.dragged=Fe.ghost=Fe.clone=Fe.active=null,_e.forEach((function(e){e.checked=!0})),_e.length=ue=le=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":$&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,r=0,o=n.length,i=this.options;r<o;r++)w(e=n[r],i.draggable,this.el,!1)&&t.push(e.getAttribute(i.dataIdAttr)||Be(e));return t},sort:function(e){var t={},n=this.el;this.toArray().forEach((function(e,r){var o=n.children[r];w(o,this.options.draggable,n,!1)&&(t[e]=o)}),this),e.forEach((function(e){t[e]&&(n.removeChild(t[e]),n.appendChild(t[e]))}))},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return w(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var r=z.modifyOption(this,e,t);n[e]=void 0!==r?r:t,"group"===e&&je(n)},destroy:function(){V("destroy",this);var e=this.el;e[B]=null,b(e,"mousedown",this._onTapStart),b(e,"touchstart",this._onTapStart),b(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(b(e,"dragover",this),b(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),ge.splice(ge.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!J){if(V("hideClone",this),Fe.eventCanceled)return;O(Q,"display","none"),this.options.removeCloneOnHide&&Q.parentNode&&Q.parentNode.removeChild(Q),J=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(J){if(V("showClone",this),Fe.eventCanceled)return;q.contains($)&&!this.options.group.revertClone?q.insertBefore(Q,$):X?q.insertBefore(Q,X):q.appendChild(Q),this.options.group.revertClone&&this.animate($,Q),O(Q,"display",""),J=!1}}else this._hideClone()}},Oe&&m(document,"touchmove",(function(e){(Fe.active||me)&&e.cancelable&&e.preventDefault()})),Fe.utils={on:m,off:b,css:O,find:C,is:function(e,t){return!!w(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:N,closest:w,toggleClass:_,clone:R,index:M,nextTick:Ue,cancelNextTick:He,detectDirection:Te,getChild:j},Fe.get=function(e){return e[B]},Fe.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(Fe.utils=a({},Fe.utils,e.utils)),z.mount(e)}))},Fe.create=function(e,t){return new Fe(e,t)},Fe.version="1.10.1";var ze,Ve,We,$e,Ge,Ye,qe=[],Xe=!1;function Ke(){qe.forEach((function(e){clearInterval(e.pid)})),qe=[]}function Qe(){clearInterval(Ye)}var Je=N((function(e,t,n,r){if(t.scroll){var o,i=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,u=t.scrollSensitivity,l=t.scrollSpeed,s=k(),c=!1;Ve!==n&&(Ve=n,Ke(),ze=t.scroll,o=t.scrollFn,!0===ze&&(ze=L(n,!0)));var f=0,d=ze;do{var p=d,h=P(p),v=h.top,m=h.bottom,b=h.left,g=h.right,y=h.width,w=h.height,x=void 0,E=void 0,_=p.scrollWidth,S=p.scrollHeight,C=O(p),T=p.scrollLeft,j=p.scrollTop;p===s?(x=y<_&&("auto"===C.overflowX||"scroll"===C.overflowX||"visible"===C.overflowX),E=w<S&&("auto"===C.overflowY||"scroll"===C.overflowY||"visible"===C.overflowY)):(x=y<_&&("auto"===C.overflowX||"scroll"===C.overflowX),E=w<S&&("auto"===C.overflowY||"scroll"===C.overflowY));var A=x&&(Math.abs(g-i)<=u&&T+y<_)-(Math.abs(b-i)<=u&&!!T),M=E&&(Math.abs(m-a)<=u&&j+w<S)-(Math.abs(v-a)<=u&&!!j);if(!qe[f])for(var D=0;D<=f;D++)qe[D]||(qe[D]={});qe[f].vx==A&&qe[f].vy==M&&qe[f].el===p||(qe[f].el=p,qe[f].vx=A,qe[f].vy=M,clearInterval(qe[f].pid),0==A&&0==M||(c=!0,qe[f].pid=setInterval(function(){r&&0===this.layer&&Fe.active._onTouchMove(Ge);var t=qe[this.layer].vy?qe[this.layer].vy*l:0,n=qe[this.layer].vx?qe[this.layer].vx*l:0;"function"==typeof o&&"continue"!==o.call(Fe.dragged.parentNode[B],n,t,e,Ge,qe[this.layer].el)||I(qe[this.layer].el,n,t)}.bind({layer:f}),24))),f++}while(t.bubbleScroll&&d!==s&&(d=L(d,!1)));Xe=c}}),30),Ze=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,o=e.activeSortable,i=e.dispatchSortableEvent,a=e.hideGhostForTarget,u=e.unhideGhostForTarget;if(t){var l=n||o;a();var s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,c=document.elementFromPoint(s.clientX,s.clientY);u(),l&&!l.el.contains(c)&&(i("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function et(){}function tt(){}et.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=j(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:Ze},i(et,{pluginName:"revertOnSpill"}),tt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:Ze},i(tt,{pluginName:"removeOnSpill"}),Fe.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?m(document,"dragover",this._handleAutoScroll):this.options.supportPointer?m(document,"pointermove",this._handleFallbackAutoScroll):t.touches?m(document,"touchmove",this._handleFallbackAutoScroll):m(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?b(document,"dragover",this._handleAutoScroll):(b(document,"pointermove",this._handleFallbackAutoScroll),b(document,"touchmove",this._handleFallbackAutoScroll),b(document,"mousemove",this._handleFallbackAutoScroll)),Qe(),Ke(),clearTimeout(x),x=void 0},nulling:function(){Ge=Ve=ze=Xe=Ye=We=$e=null,qe.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,r=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,i=document.elementFromPoint(r,o);if(Ge=e,t||c||s||d){Je(e,this.options,i,t);var a=L(i,!0);!Xe||Ye&&r===We&&o===$e||(Ye&&Qe(),Ye=setInterval((function(){var i=L(document.elementFromPoint(r,o),!0);i!==a&&(a=i,Ke()),Je(e,n.options,i,t)}),10),We=r,$e=o)}else{if(!this.options.bubbleScroll||L(i,!0)===k())return void Ke();Je(e,this.options,L(i,!1),!1)}}},i(e,{pluginName:"scroll",initializeByDefault:!0})}),Fe.mount(tt,et);var nt=Fe,rt=n(277),ot=n.n(rt),it=n(0),at=n(43),ut=function(e,t){return(ut=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},lt=function(){return(lt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function st(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function ct(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(st(arguments[t]));return e}function ft(e){null!==e.parentElement&&e.parentElement.removeChild(e)}function dt(e){e.forEach((function(e){return ft(e.element)}))}function pt(e){e.forEach((function(e){var t,n,r,o;t=e.parentElement,n=e.element,r=e.oldIndex,o=t.children[r]||null,t.insertBefore(n,o)}))}function ht(e,t){var n=bt(e),r={parentElement:e.from},o=[];switch(n){case"normal":o=[{element:e.item,newIndex:e.newIndex,oldIndex:e.oldIndex,parentElement:e.from}];break;case"swap":o=[lt({element:e.item,oldIndex:e.oldIndex,newIndex:e.newIndex},r),lt({element:e.swapItem,oldIndex:e.newIndex,newIndex:e.oldIndex},r)];break;case"multidrag":o=e.oldIndicies.map((function(t,n){return lt({element:t.multiDragElement,oldIndex:t.index,newIndex:e.newIndicies[n].index},r)}))}return function(e,t){return e.map((function(e){return lt(lt({},e),{item:t[e.oldIndex]})})).sort((function(e,t){return e.oldIndex-t.oldIndex}))}(o,t)}function vt(e,t){var n=ct(t);return e.concat().reverse().forEach((function(e){return n.splice(e.oldIndex,1)})),n}function mt(e,t){var n=ct(t);return e.forEach((function(e){return n.splice(e.newIndex,0,e.item)})),n}function bt(e){return e.oldIndicies&&e.oldIndicies.length>0?"multidrag":e.swapItem?"swap":"normal"}var gt={dragging:null},yt=function(e){function t(t){var n=e.call(this,t)||this;n.ref=Object(it.createRef)();var r=ct(t.list).map((function(e){return lt(lt({},e),{chosen:!1,selected:!1})}));return t.setList(r,n.sortable,gt),Object(at.a)(!t.plugins,'\nPlugins prop is no longer supported.\nInstead, mount it with "Sortable.mount(new MultiDrag())"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n '),n}return function(e,t){function n(){this.constructor=e}ut(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){if(null!==this.ref.current){var e=this.makeOptions();nt.create(this.ref.current,e)}},t.prototype.render=function(){var e=this.props,t=e.tag,n={style:e.style,className:e.className,id:e.id},r=t&&null!==t?t:"div";return Object(it.createElement)(r,lt({ref:this.ref},n),this.getChildren())},t.prototype.getChildren=function(){var e=this.props,t=e.children,n=e.dataIdAttr,r=e.selectedClass,o=void 0===r?"sortable-selected":r,i=e.chosenClass,a=void 0===i?"sortable-chosen":i,u=(e.dragClass,e.fallbackClass,e.ghostClass,e.swapClass,e.filter),l=void 0===u?"sortable-filter":u,s=e.list;if(!t||null==t)return null;var c=n||"data-id";return it.Children.map(t,(function(e,t){var n,r,i,u=s[t],f=e.props.className,d="string"==typeof l&&((n={})[l.replace(".","")]=!!u.filtered,n),p=ot()(f,lt(((r={})[o]=u.selected,r[a]=u.chosen,r),d));return Object(it.cloneElement)(e,((i={})[c]=e.key,i.className=p,i))}))},Object.defineProperty(t.prototype,"sortable",{get:function(){var e=this.ref.current;if(null===e)return null;var t=Object.keys(e).find((function(e){return e.includes("Sortable")}));return t?e[t]:null},enumerable:!0,configurable:!0}),t.prototype.makeOptions=function(){var e,t=this,n=((e=this.props).list,e.setList,e.children,e.tag,e.style,e.className,e.clone,e.onAdd,e.onChange,e.onChoose,e.onClone,e.onEnd,e.onFilter,e.onRemove,e.onSort,e.onStart,e.onUnchoose,e.onUpdate,e.onMove,e.onSpill,e.onSelect,e.onDeselect,function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["list","setList","children","tag","style","className","clone","onAdd","onChange","onChoose","onClone","onEnd","onFilter","onRemove","onSort","onStart","onUnchoose","onUpdate","onMove","onSpill","onSelect","onDeselect"]));return["onAdd","onChoose","onDeselect","onEnd","onRemove","onSelect","onSpill","onStart","onUnchoose","onUpdate"].forEach((function(e){return n[e]=t.prepareOnHandlerPropAndDOM(e)})),["onChange","onClone","onFilter","onSort"].forEach((function(e){return n[e]=t.prepareOnHandlerProp(e)})),lt(lt({},n),{onMove:function(e,n){var r=t.props.onMove,o=e.willInsertAfter||-1;if(!r)return o;var i=r(e,n,t.sortable,gt);return void 0!==i&&i}})},t.prototype.prepareOnHandlerPropAndDOM=function(e){var t=this;return function(n){t.callOnHandlerProp(n,e),t[e](n)}},t.prototype.prepareOnHandlerProp=function(e){var t=this;return function(n){t.callOnHandlerProp(n,e)}},t.prototype.callOnHandlerProp=function(e,t){var n=this.props[t];n&&n(e,this.sortable,gt)},t.prototype.onAdd=function(e){var t=this.props,n=t.list,r=t.setList,o=ht(e,ct(gt.dragging.props.list));dt(o),r(mt(o,n),this.sortable,gt)},t.prototype.onRemove=function(e){var t=this,n=this.props,r=n.list,o=n.setList,i=bt(e),a=ht(e,r);pt(a);var u=ct(r);if("clone"!==e.pullMode)u=vt(a,u);else{var l=a;switch(i){case"multidrag":l=a.map((function(t,n){return lt(lt({},t),{element:e.clones[n]})}));break;case"normal":l=a.map((function(t,n){return lt(lt({},t),{element:e.clone})}));break;case"swap":default:Object(at.a)(!0,'mode "'+i+'" cannot clone. Please remove "props.clone" from <ReactSortable/> when using the "'+i+'" plugin')}dt(l),a.forEach((function(n){var r=n.oldIndex,o=t.props.clone(n.item,e);u.splice(r,1,o)}))}o(u=u.map((function(e){return lt(lt({},e),{selected:!1})})),this.sortable,gt)},t.prototype.onUpdate=function(e){var t=this.props,n=t.list,r=t.setList,o=ht(e,n);return dt(o),pt(o),r(function(e,t){return mt(e,vt(e,t))}(o,n),this.sortable,gt)},t.prototype.onStart=function(e){gt.dragging=this},t.prototype.onEnd=function(e){gt.dragging=null},t.prototype.onChoose=function(e){var t=this.props,n=t.list,r=t.setList,o=ct(n);o[e.oldIndex].chosen=!0,r(o,this.sortable,gt)},t.prototype.onUnchoose=function(e){var t=this.props,n=t.list,r=t.setList,o=ct(n);o[e.oldIndex].chosen=!1,r(o,this.sortable,gt)},t.prototype.onSpill=function(e){var t=this.props,n=t.removeOnSpill,r=t.revertOnSpill;n&&!r&&ft(e.item)},t.prototype.onSelect=function(e){var t=this.props,n=t.list,r=t.setList,o=ct(n).map((function(e){return lt(lt({},e),{selected:!1})}));e.newIndicies.forEach((function(e){var t=e.index;-1!==t&&(o[t].selected=!0)})),r(o,this.sortable,gt)},t.prototype.onDeselect=function(e){var t=this.props,n=t.list,r=t.setList,o=ct(n).map((function(e){return lt(lt({},e),{selected:!1})}));e.newIndicies.forEach((function(e){var t=e.index;-1!==t&&(o[t].selected=!0)})),r(o,this.sortable,gt)},t.defaultProps={clone:function(e){return e}},t}(it.Component)},function(e,t,n){"use strict";var r=n(199),o="function"==typeof Symbol&&Symbol.for,i=o?Symbol.for("react.element"):60103,a=o?Symbol.for("react.portal"):60106,u=o?Symbol.for("react.fragment"):60107,l=o?Symbol.for("react.strict_mode"):60108,s=o?Symbol.for("react.profiler"):60114,c=o?Symbol.for("react.provider"):60109,f=o?Symbol.for("react.context"):60110,d=o?Symbol.for("react.forward_ref"):60112,p=o?Symbol.for("react.suspense"):60113,h=o?Symbol.for("react.memo"):60115,v=o?Symbol.for("react.lazy"):60116,m="function"==typeof Symbol&&Symbol.iterator;function b(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y={};function w(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||g}function x(){}function E(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||g}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(b(85));this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},x.prototype=w.prototype;var _=E.prototype=new x;_.constructor=E,r(_,w.prototype),_.isPureReactComponent=!0;var O={current:null},S=Object.prototype.hasOwnProperty,C={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,n){var r,o={},a=null,u=null;if(null!=t)for(r in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(a=""+t.key),t)S.call(t,r)&&!C.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(1===l)o.children=n;else if(1<l){for(var s=Array(l),c=0;c<l;c++)s[c]=arguments[c+2];o.children=s}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===o[r]&&(o[r]=l[r]);return{$$typeof:i,type:e,key:a,ref:u,props:o,_owner:O.current}}function P(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var T=/\/+/g,j=[];function A(e,t,n,r){if(j.length){var o=j.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function M(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>j.length&&j.push(e)}function D(e,t,n){return null==e?0:function e(t,n,r,o){var u=typeof t;"undefined"!==u&&"boolean"!==u||(t=null);var l=!1;if(null===t)l=!0;else switch(u){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case i:case a:l=!0}}if(l)return r(o,t,""===n?"."+L(t,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(t))for(var s=0;s<t.length;s++){var c=n+L(u=t[s],s);l+=e(u,c,r,o)}else if("function"==typeof(c=null===t||"object"!=typeof t?null:"function"==typeof(c=m&&t[m]||t["@@iterator"])?c:null))for(t=c.call(t),s=0;!(u=t.next()).done;)l+=e(u=u.value,c=n+L(u,s++),r,o);else if("object"===u)throw r=""+t,Error(b(31,"[object Object]"===r?"object with keys {"+Object.keys(t).join(", ")+"}":r,""));return l}(e,"",t,n)}function L(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function F(e,t){e.func.call(e.context,t,e.count++)}function N(e,t,n){var r=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?I(e,r,n,(function(e){return e})):null!=e&&(P(e)&&(e=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(T,"$&/")+"/")+n)),r.push(e))}function I(e,t,n,r,o){var i="";null!=n&&(i=(""+n).replace(T,"$&/")+"/"),D(e,N,t=A(t,i,r,o)),M(t)}var R={current:null};function B(){var e=R.current;if(null===e)throw Error(b(321));return e}var U={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:O,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:function(e,t,n){if(null==e)return e;var r=[];return I(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;D(e,F,t=A(null,null,t,n)),M(t)},count:function(e){return D(e,(function(){return null}),null)},toArray:function(e){var t=[];return I(e,t,null,(function(e){return e})),t},only:function(e){if(!P(e))throw Error(b(143));return e}},t.Component=w,t.Fragment=u,t.Profiler=s,t.PureComponent=E,t.StrictMode=l,t.Suspense=p,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,t.cloneElement=function(e,t,n){if(null==e)throw Error(b(267,e));var o=r({},e.props),a=e.key,u=e.ref,l=e._owner;if(null!=t){if(void 0!==t.ref&&(u=t.ref,l=O.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(c in t)S.call(t,c)&&!C.hasOwnProperty(c)&&(o[c]=void 0===t[c]&&void 0!==s?s[c]:t[c])}var c=arguments.length-2;if(1===c)o.children=n;else if(1<c){s=Array(c);for(var f=0;f<c;f++)s[f]=arguments[f+2];o.children=s}return{$$typeof:i,type:e.type,key:a,ref:u,props:o,_owner:l}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:f,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:c,_context:e},e.Consumer=e},t.createElement=k,t.createFactory=function(e){var t=k.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:d,render:e}},t.isValidElement=P,t.lazy=function(e){return{$$typeof:v,_ctor:e,_status:-1,_result:null}},t.memo=function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return B().useCallback(e,t)},t.useContext=function(e,t){return B().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return B().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return B().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return B().useLayoutEffect(e,t)},t.useMemo=function(e,t){return B().useMemo(e,t)},t.useReducer=function(e,t,n){return B().useReducer(e,t,n)},t.useRef=function(e){return B().useRef(e)},t.useState=function(e){return B().useState(e)},t.version="16.13.1"},function(e,t,n){"use strict";var r=n(0),o=n(199),i=n(291);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!r)throw Error(a(227));function u(e,t,n,r,o,i,a,u,l){var s=Array.prototype.slice.call(arguments,3);try{t.apply(n,s)}catch(e){this.onError(e)}}var l=!1,s=null,c=!1,f=null,d={onError:function(e){l=!0,s=e}};function p(e,t,n,r,o,i,a,c,f){l=!1,s=null,u.apply(d,arguments)}var h=null,v=null,m=null;function b(e,t,n){var r=e.type||"unknown-event";e.currentTarget=m(n),function(e,t,n,r,o,i,u,d,h){if(p.apply(this,arguments),l){if(!l)throw Error(a(198));var v=s;l=!1,s=null,c||(c=!0,f=v)}}(r,t,void 0,e),e.currentTarget=null}var g=null,y={};function w(){if(g)for(var e in y){var t=y[e],n=g.indexOf(e);if(!(-1<n))throw Error(a(96,e));if(!E[n]){if(!t.extractEvents)throw Error(a(97,e));for(var r in E[n]=t,n=t.eventTypes){var o=void 0,i=n[r],u=t,l=r;if(_.hasOwnProperty(l))throw Error(a(99,l));_[l]=i;var s=i.phasedRegistrationNames;if(s){for(o in s)s.hasOwnProperty(o)&&x(s[o],u,l);o=!0}else i.registrationName?(x(i.registrationName,u,l),o=!0):o=!1;if(!o)throw Error(a(98,r,e))}}}}function x(e,t,n){if(O[e])throw Error(a(100,e));O[e]=t,S[e]=t.eventTypes[n].dependencies}var E=[],_={},O={},S={};function C(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(!y.hasOwnProperty(t)||y[t]!==r){if(y[t])throw Error(a(102,t));y[t]=r,n=!0}}n&&w()}var k=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),P=null,T=null,j=null;function A(e){if(e=v(e)){if("function"!=typeof P)throw Error(a(280));var t=e.stateNode;t&&(t=h(t),P(e.stateNode,e.type,t))}}function M(e){T?j?j.push(e):j=[e]:T=e}function D(){if(T){var e=T,t=j;if(j=T=null,A(e),t)for(e=0;e<t.length;e++)A(t[e])}}function L(e,t){return e(t)}function F(e,t,n,r,o){return e(t,n,r,o)}function N(){}var I=L,R=!1,B=!1;function U(){null===T&&null===j||(N(),D())}function H(e,t,n){if(B)return e(t,n);B=!0;try{return I(e,t,n)}finally{B=!1,U()}}var z=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,V=Object.prototype.hasOwnProperty,W={},$={};function G(e,t,n,r,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i}var Y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){Y[e]=new G(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];Y[t]=new G(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){Y[e]=new G(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){Y[e]=new G(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){Y[e]=new G(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){Y[e]=new G(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){Y[e]=new G(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){Y[e]=new G(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){Y[e]=new G(e,5,!1,e.toLowerCase(),null,!1)}));var q=/[\-:]([a-z])/g;function X(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(q,X);Y[t]=new G(t,1,!1,e,null,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(q,X);Y[t]=new G(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(q,X);Y[t]=new G(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)})),["tabIndex","crossOrigin"].forEach((function(e){Y[e]=new G(e,1,!1,e.toLowerCase(),null,!1)})),Y.xlinkHref=new G("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach((function(e){Y[e]=new G(e,1,!1,e.toLowerCase(),null,!0)}));var K=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Q(e,t,n,r){var o=Y.hasOwnProperty(t)?Y[t]:null;(null!==o?0===o.type:!r&&2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1]))||(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!V.call($,e)||!V.call(W,e)&&(z.test(e)?$[e]=!0:(W[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}K.hasOwnProperty("ReactCurrentDispatcher")||(K.ReactCurrentDispatcher={current:null}),K.hasOwnProperty("ReactCurrentBatchConfig")||(K.ReactCurrentBatchConfig={suspense:null});var J=/^(.*)[\\\/]/,Z="function"==typeof Symbol&&Symbol.for,ee=Z?Symbol.for("react.element"):60103,te=Z?Symbol.for("react.portal"):60106,ne=Z?Symbol.for("react.fragment"):60107,re=Z?Symbol.for("react.strict_mode"):60108,oe=Z?Symbol.for("react.profiler"):60114,ie=Z?Symbol.for("react.provider"):60109,ae=Z?Symbol.for("react.context"):60110,ue=Z?Symbol.for("react.concurrent_mode"):60111,le=Z?Symbol.for("react.forward_ref"):60112,se=Z?Symbol.for("react.suspense"):60113,ce=Z?Symbol.for("react.suspense_list"):60120,fe=Z?Symbol.for("react.memo"):60115,de=Z?Symbol.for("react.lazy"):60116,pe=Z?Symbol.for("react.block"):60121,he="function"==typeof Symbol&&Symbol.iterator;function ve(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=he&&e[he]||e["@@iterator"])?e:null}function me(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case ne:return"Fragment";case te:return"Portal";case oe:return"Profiler";case re:return"StrictMode";case se:return"Suspense";case ce:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ae:return"Context.Consumer";case ie:return"Context.Provider";case le:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case fe:return me(e.type);case pe:return me(e.render);case de:if(e=1===e._status?e._result:null)return me(e)}return null}function be(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break e;default:var r=e._debugOwner,o=e._debugSource,i=me(e.type);n=null,r&&(n=me(r.type)),r=i,i="",o?i=" (at "+o.fileName.replace(J,"")+":"+o.lineNumber+")":n&&(i=" (created by "+n+")"),n="\n in "+(r||"Unknown")+i}t+=n,e=e.return}while(e);return t}function ge(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function ye(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function we(e){e._valueTracker||(e._valueTracker=function(e){var t=ye(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ye(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Ee(e,t){var n=t.checked;return o({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function _e(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=ge(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Oe(e,t){null!=(t=t.checked)&&Q(e,"checked",t,!1)}function Se(e,t){Oe(e,t);var n=ge(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ke(e,t.type,n):t.hasOwnProperty("defaultValue")&&ke(e,t.type,ge(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Ce(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ke(e,t,n){"number"===t&&e.ownerDocument.activeElement===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function Pe(e,t){return e=o({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function Te(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ge(n),t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function je(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(a(91));return o({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ae(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(a(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(a(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:ge(n)}}function Me(e,t){var n=ge(t.value),r=ge(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function De(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Le(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Fe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Le(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Ne,Ie=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction((function(){return e(t,n)}))}:e}((function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Ne=Ne||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ne.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}));function Re(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function Be(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ue={animationend:Be("Animation","AnimationEnd"),animationiteration:Be("Animation","AnimationIteration"),animationstart:Be("Animation","AnimationStart"),transitionend:Be("Transition","TransitionEnd")},He={},ze={};function Ve(e){if(He[e])return He[e];if(!Ue[e])return e;var t,n=Ue[e];for(t in n)if(n.hasOwnProperty(t)&&t in ze)return He[e]=n[t];return e}k&&(ze=document.createElement("div").style,"AnimationEvent"in window||(delete Ue.animationend.animation,delete Ue.animationiteration.animation,delete Ue.animationstart.animation),"TransitionEvent"in window||delete Ue.transitionend.transition);var We=Ve("animationend"),$e=Ve("animationiteration"),Ge=Ve("animationstart"),Ye=Ve("transitionend"),qe="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Xe=new("function"==typeof WeakMap?WeakMap:Map);function Ke(e){var t=Xe.get(e);return void 0===t&&(t=new Map,Xe.set(e,t)),t}function Qe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Je(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function Ze(e){if(Qe(e)!==e)throw Error(a(188))}function et(e){if(!(e=function(e){var t=e.alternate;if(!t){if(null===(t=Qe(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var i=o.alternate;if(null===i){if(null!==(r=o.return)){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Ze(o),e;if(i===r)return Ze(o),t;i=i.sibling}throw Error(a(188))}if(n.return!==r.return)n=o,r=i;else{for(var u=!1,l=o.child;l;){if(l===n){u=!0,n=o,r=i;break}if(l===r){u=!0,r=o,n=i;break}l=l.sibling}if(!u){for(l=i.child;l;){if(l===n){u=!0,n=i,r=o;break}if(l===r){u=!0,r=i,n=o;break}l=l.sibling}if(!u)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function tt(e,t){if(null==t)throw Error(a(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function nt(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var rt=null;function ot(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;r<t.length&&!e.isPropagationStopped();r++)b(e,t[r],n[r]);else t&&b(e,t,n);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function it(e){if(null!==e&&(rt=tt(rt,e)),e=rt,rt=null,e){if(nt(e,ot),rt)throw Error(a(95));if(c)throw e=f,c=!1,f=null,e}}function at(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function ut(e){if(!k)return!1;var t=(e="on"+e)in document;return t||((t=document.createElement("div")).setAttribute(e,"return;"),t="function"==typeof t[e]),t}var lt=[];function st(e){e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>lt.length&&lt.push(e)}function ct(e,t,n,r){if(lt.length){var o=lt.pop();return o.topLevelType=e,o.eventSystemFlags=r,o.nativeEvent=t,o.targetInst=n,o}return{topLevelType:e,eventSystemFlags:r,nativeEvent:t,targetInst:n,ancestors:[]}}function ft(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r=n;if(3===r.tag)r=r.stateNode.containerInfo;else{for(;r.return;)r=r.return;r=3!==r.tag?null:r.stateNode.containerInfo}if(!r)break;5!==(t=n.tag)&&6!==t||e.ancestors.push(n),n=Sn(r)}while(n);for(n=0;n<e.ancestors.length;n++){t=e.ancestors[n];var o=at(e.nativeEvent);r=e.topLevelType;var i=e.nativeEvent,a=e.eventSystemFlags;0===n&&(a|=64);for(var u=null,l=0;l<E.length;l++){var s=E[l];s&&(s=s.extractEvents(r,t,i,o,a))&&(u=tt(u,s))}it(u)}}function dt(e,t,n){if(!n.has(e)){switch(e){case"scroll":Gt(t,"scroll",!0);break;case"focus":case"blur":Gt(t,"focus",!0),Gt(t,"blur",!0),n.set("blur",null),n.set("focus",null);break;case"cancel":case"close":ut(e)&&Gt(t,e,!0);break;case"invalid":case"submit":case"reset":break;default:-1===qe.indexOf(e)&&$t(e,t)}n.set(e,null)}}var pt,ht,vt,mt=!1,bt=[],gt=null,yt=null,wt=null,xt=new Map,Et=new Map,_t=[],Ot="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput close cancel copy cut paste click change contextmenu reset submit".split(" "),St="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function Ct(e,t,n,r,o){return{blockedOn:e,topLevelType:t,eventSystemFlags:32|n,nativeEvent:o,container:r}}function kt(e,t){switch(e){case"focus":case"blur":gt=null;break;case"dragenter":case"dragleave":yt=null;break;case"mouseover":case"mouseout":wt=null;break;case"pointerover":case"pointerout":xt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Et.delete(t.pointerId)}}function Pt(e,t,n,r,o,i){return null===e||e.nativeEvent!==i?(e=Ct(t,n,r,o,i),null!==t&&null!==(t=Cn(t))&&ht(t),e):(e.eventSystemFlags|=r,e)}function Tt(e){var t=Sn(e.target);if(null!==t){var n=Qe(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Je(n)))return e.blockedOn=t,void i.unstable_runWithPriority(e.priority,(function(){vt(n)}))}else if(3===t&&n.stateNode.hydrate)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function jt(e){if(null!==e.blockedOn)return!1;var t=Kt(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);if(null!==t){var n=Cn(t);return null!==n&&ht(n),e.blockedOn=t,!1}return!0}function At(e,t,n){jt(e)&&n.delete(t)}function Mt(){for(mt=!1;0<bt.length;){var e=bt[0];if(null!==e.blockedOn){null!==(e=Cn(e.blockedOn))&&pt(e);break}var t=Kt(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);null!==t?e.blockedOn=t:bt.shift()}null!==gt&&jt(gt)&&(gt=null),null!==yt&&jt(yt)&&(yt=null),null!==wt&&jt(wt)&&(wt=null),xt.forEach(At),Et.forEach(At)}function Dt(e,t){e.blockedOn===t&&(e.blockedOn=null,mt||(mt=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Mt)))}function Lt(e){function t(t){return Dt(t,e)}if(0<bt.length){Dt(bt[0],e);for(var n=1;n<bt.length;n++){var r=bt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==gt&&Dt(gt,e),null!==yt&&Dt(yt,e),null!==wt&&Dt(wt,e),xt.forEach(t),Et.forEach(t),n=0;n<_t.length;n++)(r=_t[n]).blockedOn===e&&(r.blockedOn=null);for(;0<_t.length&&null===(n=_t[0]).blockedOn;)Tt(n),null===n.blockedOn&&_t.shift()}var Ft={},Nt=new Map,It=new Map,Rt=["abort","abort",We,"animationEnd",$e,"animationIteration",Ge,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Ye,"transitionEnd","waiting","waiting"];function Bt(e,t){for(var n=0;n<e.length;n+=2){var r=e[n],o=e[n+1],i="on"+(o[0].toUpperCase()+o.slice(1));i={phasedRegistrationNames:{bubbled:i,captured:i+"Capture"},dependencies:[r],eventPriority:t},It.set(r,t),Nt.set(r,i),Ft[o]=i}}Bt("blur blur cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focus focus input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Bt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Bt(Rt,2);for(var Ut="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Ht=0;Ht<Ut.length;Ht++)It.set(Ut[Ht],0);var zt=i.unstable_UserBlockingPriority,Vt=i.unstable_runWithPriority,Wt=!0;function $t(e,t){Gt(t,e,!1)}function Gt(e,t,n){var r=It.get(t);switch(void 0===r?2:r){case 0:r=Yt.bind(null,t,1,e);break;case 1:r=qt.bind(null,t,1,e);break;default:r=Xt.bind(null,t,1,e)}n?e.addEventListener(t,r,!0):e.addEventListener(t,r,!1)}function Yt(e,t,n,r){R||N();var o=Xt,i=R;R=!0;try{F(o,e,t,n,r)}finally{(R=i)||U()}}function qt(e,t,n,r){Vt(zt,Xt.bind(null,e,t,n,r))}function Xt(e,t,n,r){if(Wt)if(0<bt.length&&-1<Ot.indexOf(e))e=Ct(null,e,t,n,r),bt.push(e);else{var o=Kt(e,t,n,r);if(null===o)kt(e,r);else if(-1<Ot.indexOf(e))e=Ct(o,e,t,n,r),bt.push(e);else if(!function(e,t,n,r,o){switch(t){case"focus":return gt=Pt(gt,e,t,n,r,o),!0;case"dragenter":return yt=Pt(yt,e,t,n,r,o),!0;case"mouseover":return wt=Pt(wt,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return xt.set(i,Pt(xt.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Et.set(i,Pt(Et.get(i)||null,e,t,n,r,o)),!0}return!1}(o,e,t,n,r)){kt(e,r),e=ct(e,r,null,t);try{H(ft,e)}finally{st(e)}}}}function Kt(e,t,n,r){if(null!==(n=Sn(n=at(r)))){var o=Qe(n);if(null===o)n=null;else{var i=o.tag;if(13===i){if(null!==(n=Je(o)))return n;n=null}else if(3===i){if(o.stateNode.hydrate)return 3===o.tag?o.stateNode.containerInfo:null;n=null}else o!==n&&(n=null)}}e=ct(e,r,n,t);try{H(ft,e)}finally{st(e)}return null}var Qt={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Jt=["Webkit","ms","Moz","O"];function Zt(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||Qt.hasOwnProperty(e)&&Qt[e]?(""+t).trim():t+"px"}function en(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=Zt(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}Object.keys(Qt).forEach((function(e){Jt.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Qt[t]=Qt[e]}))}));var tn=o({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nn(e,t){if(t){if(tn[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(a(137,e,""));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(a(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(a(62,""))}}function rn(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var on="http://www.w3.org/1999/xhtml";function an(e,t){var n=Ke(e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument);t=S[t];for(var r=0;r<t.length;r++)dt(t[r],e,n)}function un(){}function ln(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function sn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function cn(e,t){var n,r=sn(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=sn(r)}}function fn(){for(var e=window,t=ln();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=ln((e=t.contentWindow).document)}return t}function dn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var pn=null,hn=null;function vn(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function mn(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var bn="function"==typeof setTimeout?setTimeout:void 0,gn="function"==typeof clearTimeout?clearTimeout:void 0;function yn(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function wn(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var xn=Math.random().toString(36).slice(2),En="__reactInternalInstance$"+xn,_n="__reactEventHandlers$"+xn,On="__reactContainere$"+xn;function Sn(e){var t=e[En];if(t)return t;for(var n=e.parentNode;n;){if(t=n[On]||n[En]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=wn(e);null!==e;){if(n=e[En])return n;e=wn(e)}return t}n=(e=n).parentNode}return null}function Cn(e){return!(e=e[En]||e[On])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function kn(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(a(33))}function Pn(e){return e[_n]||null}function Tn(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function jn(e,t){var n=e.stateNode;if(!n)return null;var r=h(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(a(231,t,typeof n));return n}function An(e,t,n){(t=jn(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=tt(n._dispatchListeners,t),n._dispatchInstances=tt(n._dispatchInstances,e))}function Mn(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=Tn(t);for(t=n.length;0<t--;)An(n[t],"captured",e);for(t=0;t<n.length;t++)An(n[t],"bubbled",e)}}function Dn(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=jn(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=tt(n._dispatchListeners,t),n._dispatchInstances=tt(n._dispatchInstances,e))}function Ln(e){e&&e.dispatchConfig.registrationName&&Dn(e._targetInst,null,e)}function Fn(e){nt(e,Mn)}var Nn=null,In=null,Rn=null;function Bn(){if(Rn)return Rn;var e,t,n=In,r=n.length,o="value"in Nn?Nn.value:Nn.textContent,i=o.length;for(e=0;e<r&&n[e]===o[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===o[i-t];t++);return Rn=o.slice(e,1<t?1-t:void 0)}function Un(){return!0}function Hn(){return!1}function zn(e,t,n,r){for(var o in this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface)e.hasOwnProperty(o)&&((t=e[o])?this[o]=t(n):"target"===o?this.target=r:this[o]=n[o]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?Un:Hn,this.isPropagationStopped=Hn,this}function Vn(e,t,n,r){if(this.eventPool.length){var o=this.eventPool.pop();return this.call(o,e,t,n,r),o}return new this(e,t,n,r)}function Wn(e){if(!(e instanceof this))throw Error(a(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function $n(e){e.eventPool=[],e.getPooled=Vn,e.release=Wn}o(zn.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Un)},persist:function(){this.isPersistent=Un},isPersistent:Hn,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=Hn,this._dispatchInstances=this._dispatchListeners=null}}),zn.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},zn.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return o(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=o({},r.Interface,e),n.extend=r.extend,$n(n),n},$n(zn);var Gn=zn.extend({data:null}),Yn=zn.extend({data:null}),qn=[9,13,27,32],Xn=k&&"CompositionEvent"in window,Kn=null;k&&"documentMode"in document&&(Kn=document.documentMode);var Qn=k&&"TextEvent"in window&&!Kn,Jn=k&&(!Xn||Kn&&8<Kn&&11>=Kn),Zn=String.fromCharCode(32),er={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},tr=!1;function nr(e,t){switch(e){case"keyup":return-1!==qn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function rr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var or=!1,ir={eventTypes:er,extractEvents:function(e,t,n,r){var o;if(Xn)e:{switch(e){case"compositionstart":var i=er.compositionStart;break e;case"compositionend":i=er.compositionEnd;break e;case"compositionupdate":i=er.compositionUpdate;break e}i=void 0}else or?nr(e,n)&&(i=er.compositionEnd):"keydown"===e&&229===n.keyCode&&(i=er.compositionStart);return i?(Jn&&"ko"!==n.locale&&(or||i!==er.compositionStart?i===er.compositionEnd&&or&&(o=Bn()):(In="value"in(Nn=r)?Nn.value:Nn.textContent,or=!0)),i=Gn.getPooled(i,t,n,r),(o||null!==(o=rr(n)))&&(i.data=o),Fn(i),o=i):o=null,(e=Qn?function(e,t){switch(e){case"compositionend":return rr(t);case"keypress":return 32!==t.which?null:(tr=!0,Zn);case"textInput":return(e=t.data)===Zn&&tr?null:e;default:return null}}(e,n):function(e,t){if(or)return"compositionend"===e||!Xn&&nr(e,t)?(e=Bn(),Rn=In=Nn=null,or=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Jn&&"ko"!==t.locale?null:t.data;default:return null}}(e,n))?((t=Yn.getPooled(er.beforeInput,t,n,r)).data=e,Fn(t)):t=null,null===o?t:null===t?o:[o,t]}},ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ur(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!ar[e.type]:"textarea"===t}var lr={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function sr(e,t,n){return(e=zn.getPooled(lr.change,e,t,n)).type="change",M(n),Fn(e),e}var cr=null,fr=null;function dr(e){it(e)}function pr(e){if(xe(kn(e)))return e}function hr(e,t){if("change"===e)return t}var vr=!1;function mr(){cr&&(cr.detachEvent("onpropertychange",br),fr=cr=null)}function br(e){if("value"===e.propertyName&&pr(fr))if(e=sr(fr,e,at(e)),R)it(e);else{R=!0;try{L(dr,e)}finally{R=!1,U()}}}function gr(e,t,n){"focus"===e?(mr(),fr=n,(cr=t).attachEvent("onpropertychange",br)):"blur"===e&&mr()}function yr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return pr(fr)}function wr(e,t){if("click"===e)return pr(t)}function xr(e,t){if("input"===e||"change"===e)return pr(t)}k&&(vr=ut("input")&&(!document.documentMode||9<document.documentMode));var Er={eventTypes:lr,_isInputEventSupported:vr,extractEvents:function(e,t,n,r){var o=t?kn(t):window,i=o.nodeName&&o.nodeName.toLowerCase();if("select"===i||"input"===i&&"file"===o.type)var a=hr;else if(ur(o))if(vr)a=xr;else{a=yr;var u=gr}else(i=o.nodeName)&&"input"===i.toLowerCase()&&("checkbox"===o.type||"radio"===o.type)&&(a=wr);if(a&&(a=a(e,t)))return sr(a,n,r);u&&u(e,o,t),"blur"===e&&(e=o._wrapperState)&&e.controlled&&"number"===o.type&&ke(o,"number",o.value)}},_r=zn.extend({view:null,detail:null}),Or={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Or[e])&&!!t[e]}function Cr(){return Sr}var kr=0,Pr=0,Tr=!1,jr=!1,Ar=_r.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Cr,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=kr;return kr=e.screenX,Tr?"mousemove"===e.type?e.screenX-t:0:(Tr=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=Pr;return Pr=e.screenY,jr?"mousemove"===e.type?e.screenY-t:0:(jr=!0,0)}}),Mr=Ar.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Dr={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Lr={eventTypes:Dr,extractEvents:function(e,t,n,r,o){var i="mouseover"===e||"pointerover"===e,a="mouseout"===e||"pointerout"===e;if(i&&0==(32&o)&&(n.relatedTarget||n.fromElement)||!a&&!i)return null;if(i=r.window===r?r:(i=r.ownerDocument)?i.defaultView||i.parentWindow:window,a?(a=t,null!==(t=(t=n.relatedTarget||n.toElement)?Sn(t):null)&&(t!==Qe(t)||5!==t.tag&&6!==t.tag)&&(t=null)):a=null,a===t)return null;if("mouseout"===e||"mouseover"===e)var u=Ar,l=Dr.mouseLeave,s=Dr.mouseEnter,c="mouse";else"pointerout"!==e&&"pointerover"!==e||(u=Mr,l=Dr.pointerLeave,s=Dr.pointerEnter,c="pointer");if(e=null==a?i:kn(a),i=null==t?i:kn(t),(l=u.getPooled(l,a,n,r)).type=c+"leave",l.target=e,l.relatedTarget=i,(n=u.getPooled(s,t,n,r)).type=c+"enter",n.target=i,n.relatedTarget=e,c=t,(r=a)&&c)e:{for(s=c,a=0,e=u=r;e;e=Tn(e))a++;for(e=0,t=s;t;t=Tn(t))e++;for(;0<a-e;)u=Tn(u),a--;for(;0<e-a;)s=Tn(s),e--;for(;a--;){if(u===s||u===s.alternate)break e;u=Tn(u),s=Tn(s)}u=null}else u=null;for(s=u,u=[];r&&r!==s&&(null===(a=r.alternate)||a!==s);)u.push(r),r=Tn(r);for(r=[];c&&c!==s&&(null===(a=c.alternate)||a!==s);)r.push(c),c=Tn(c);for(c=0;c<u.length;c++)Dn(u[c],"bubbled",l);for(c=r.length;0<c--;)Dn(r[c],"captured",n);return 0==(64&o)?[l]:[l,n]}},Fr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Nr=Object.prototype.hasOwnProperty;function Ir(e,t){if(Fr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!Nr.call(t,n[r])||!Fr(e[n[r]],t[n[r]]))return!1;return!0}var Rr=k&&"documentMode"in document&&11>=document.documentMode,Br={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Ur=null,Hr=null,zr=null,Vr=!1;function Wr(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return Vr||null==Ur||Ur!==ln(n)?null:(n="selectionStart"in(n=Ur)&&dn(n)?{start:n.selectionStart,end:n.selectionEnd}:{anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},zr&&Ir(zr,n)?null:(zr=n,(e=zn.getPooled(Br.select,Hr,e,t)).type="select",e.target=Ur,Fn(e),e))}var $r={eventTypes:Br,extractEvents:function(e,t,n,r,o,i){if(!(i=!(o=i||(r.window===r?r.document:9===r.nodeType?r:r.ownerDocument)))){e:{o=Ke(o),i=S.onSelect;for(var a=0;a<i.length;a++)if(!o.has(i[a])){o=!1;break e}o=!0}i=!o}if(i)return null;switch(o=t?kn(t):window,e){case"focus":(ur(o)||"true"===o.contentEditable)&&(Ur=o,Hr=t,zr=null);break;case"blur":zr=Hr=Ur=null;break;case"mousedown":Vr=!0;break;case"contextmenu":case"mouseup":case"dragend":return Vr=!1,Wr(n,r);case"selectionchange":if(Rr)break;case"keydown":case"keyup":return Wr(n,r)}return null}},Gr=zn.extend({animationName:null,elapsedTime:null,pseudoElement:null}),Yr=zn.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qr=_r.extend({relatedTarget:null});function Xr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}var Kr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Qr={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Jr=_r.extend({key:function(e){if(e.key){var t=Kr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Xr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Qr[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Cr,charCode:function(e){return"keypress"===e.type?Xr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Xr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Zr=Ar.extend({dataTransfer:null}),eo=_r.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Cr}),to=zn.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),no=Ar.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),ro={eventTypes:Ft,extractEvents:function(e,t,n,r){var o=Nt.get(e);if(!o)return null;switch(e){case"keypress":if(0===Xr(n))return null;case"keydown":case"keyup":e=Jr;break;case"blur":case"focus":e=qr;break;case"click":if(2===n.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=Ar;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=Zr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=eo;break;case We:case $e:case Ge:e=Gr;break;case Ye:e=to;break;case"scroll":e=_r;break;case"wheel":e=no;break;case"copy":case"cut":case"paste":e=Yr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=Mr;break;default:e=zn}return Fn(t=e.getPooled(o,t,n,r)),t}};if(g)throw Error(a(101));g=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),w(),h=Pn,v=Cn,m=kn,C({SimpleEventPlugin:ro,EnterLeaveEventPlugin:Lr,ChangeEventPlugin:Er,SelectEventPlugin:$r,BeforeInputEventPlugin:ir});var oo=[],io=-1;function ao(e){0>io||(e.current=oo[io],oo[io]=null,io--)}function uo(e,t){io++,oo[io]=e.current,e.current=t}var lo={},so={current:lo},co={current:!1},fo=lo;function po(e,t){var n=e.type.contextTypes;if(!n)return lo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,i={};for(o in n)i[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ho(e){return null!=e.childContextTypes}function vo(){ao(co),ao(so)}function mo(e,t,n){if(so.current!==lo)throw Error(a(168));uo(so,t),uo(co,n)}function bo(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in e))throw Error(a(108,me(t)||"Unknown",i));return o({},n,{},r)}function go(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||lo,fo=so.current,uo(so,e),uo(co,co.current),!0}function yo(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=bo(e,t,fo),r.__reactInternalMemoizedMergedChildContext=e,ao(co),ao(so),uo(so,e)):ao(co),uo(co,n)}var wo=i.unstable_runWithPriority,xo=i.unstable_scheduleCallback,Eo=i.unstable_cancelCallback,_o=i.unstable_requestPaint,Oo=i.unstable_now,So=i.unstable_getCurrentPriorityLevel,Co=i.unstable_ImmediatePriority,ko=i.unstable_UserBlockingPriority,Po=i.unstable_NormalPriority,To=i.unstable_LowPriority,jo=i.unstable_IdlePriority,Ao={},Mo=i.unstable_shouldYield,Do=void 0!==_o?_o:function(){},Lo=null,Fo=null,No=!1,Io=Oo(),Ro=1e4>Io?Oo:function(){return Oo()-Io};function Bo(){switch(So()){case Co:return 99;case ko:return 98;case Po:return 97;case To:return 96;case jo:return 95;default:throw Error(a(332))}}function Uo(e){switch(e){case 99:return Co;case 98:return ko;case 97:return Po;case 96:return To;case 95:return jo;default:throw Error(a(332))}}function Ho(e,t){return e=Uo(e),wo(e,t)}function zo(e,t,n){return e=Uo(e),xo(e,t,n)}function Vo(e){return null===Lo?(Lo=[e],Fo=xo(Co,$o)):Lo.push(e),Ao}function Wo(){if(null!==Fo){var e=Fo;Fo=null,Eo(e)}$o()}function $o(){if(!No&&null!==Lo){No=!0;var e=0;try{var t=Lo;Ho(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),Lo=null}catch(t){throw null!==Lo&&(Lo=Lo.slice(e+1)),xo(Co,Wo),t}finally{No=!1}}}function Go(e,t,n){return 1073741821-(1+((1073741821-e+t/10)/(n/=10)|0))*n}function Yo(e,t){if(e&&e.defaultProps)for(var n in t=o({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}var qo={current:null},Xo=null,Ko=null,Qo=null;function Jo(){Qo=Ko=Xo=null}function Zo(e){var t=qo.current;ao(qo),e.type._context._currentValue=t}function ei(e,t){for(;null!==e;){var n=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t);else{if(!(null!==n&&n.childExpirationTime<t))break;n.childExpirationTime=t}e=e.return}}function ti(e,t){Xo=e,Qo=Ko=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(e.expirationTime>=t&&(Pa=!0),e.firstContext=null)}function ni(e,t){if(Qo!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(Qo=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Ko){if(null===Xo)throw Error(a(308));Ko=t,Xo.dependencies={expirationTime:0,firstContext:t,responders:null}}else Ko=Ko.next=t;return e._currentValue}var ri=!1;function oi(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function ii(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function ai(e,t){return(e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null}).next=e}function ui(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function li(e,t){var n=e.alternate;null!==n&&ii(n,e),null===(n=(e=e.updateQueue).baseQueue)?(e.baseQueue=t.next=t,t.next=t):(t.next=n.next,n.next=t)}function si(e,t,n,r){var i=e.updateQueue;ri=!1;var a=i.baseQueue,u=i.shared.pending;if(null!==u){if(null!==a){var l=a.next;a.next=u.next,u.next=l}a=u,i.shared.pending=null,null!==(l=e.alternate)&&null!==(l=l.updateQueue)&&(l.baseQueue=u)}if(null!==a){l=a.next;var s=i.baseState,c=0,f=null,d=null,p=null;if(null!==l)for(var h=l;;){if((u=h.expirationTime)<r){var v={expirationTime:h.expirationTime,suspenseConfig:h.suspenseConfig,tag:h.tag,payload:h.payload,callback:h.callback,next:null};null===p?(d=p=v,f=s):p=p.next=v,u>c&&(c=u)}else{null!==p&&(p=p.next={expirationTime:1073741823,suspenseConfig:h.suspenseConfig,tag:h.tag,payload:h.payload,callback:h.callback,next:null}),rl(u,h.suspenseConfig);e:{var m=e,b=h;switch(u=t,v=n,b.tag){case 1:if("function"==typeof(m=b.payload)){s=m.call(v,s,u);break e}s=m;break e;case 3:m.effectTag=-4097&m.effectTag|64;case 0:if(null==(u="function"==typeof(m=b.payload)?m.call(v,s,u):m))break e;s=o({},s,u);break e;case 2:ri=!0}}null!==h.callback&&(e.effectTag|=32,null===(u=i.effects)?i.effects=[h]:u.push(h))}if(null===(h=h.next)||h===l){if(null===(u=i.shared.pending))break;h=a.next=u.next,u.next=l,i.baseQueue=a=u,i.shared.pending=null}}null===p?f=s:p.next=d,i.baseState=f,i.baseQueue=p,ol(c),e.expirationTime=c,e.memoizedState=s}}function ci(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(null!==o){if(r.callback=null,r=o,o=n,"function"!=typeof r)throw Error(a(191,r));r.call(o)}}}var fi=K.ReactCurrentBatchConfig,di=(new r.Component).refs;function pi(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:o({},t,n),e.memoizedState=n,0===e.expirationTime&&(e.updateQueue.baseState=n)}var hi={isMounted:function(e){return!!(e=e._reactInternalFiber)&&Qe(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternalFiber;var r=Wu(),o=fi.suspense;(o=ai(r=$u(r,e,o),o)).payload=t,null!=n&&(o.callback=n),ui(e,o),Gu(e,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternalFiber;var r=Wu(),o=fi.suspense;(o=ai(r=$u(r,e,o),o)).tag=1,o.payload=t,null!=n&&(o.callback=n),ui(e,o),Gu(e,r)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var n=Wu(),r=fi.suspense;(r=ai(n=$u(n,e,r),r)).tag=2,null!=t&&(r.callback=t),ui(e,r),Gu(e,n)}};function vi(e,t,n,r,o,i,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,a):!(t.prototype&&t.prototype.isPureReactComponent&&Ir(n,r)&&Ir(o,i))}function mi(e,t,n){var r=!1,o=lo,i=t.contextType;return"object"==typeof i&&null!==i?i=ni(i):(o=ho(t)?fo:so.current,i=(r=null!=(r=t.contextTypes))?po(e,o):lo),t=new t(n,i),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=hi,e.stateNode=t,t._reactInternalFiber=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function bi(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&hi.enqueueReplaceState(t,t.state,null)}function gi(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=di,oi(e);var i=t.contextType;"object"==typeof i&&null!==i?o.context=ni(i):(i=ho(t)?fo:so.current,o.context=po(e,i)),si(e,n,o,r),o.state=e.memoizedState,"function"==typeof(i=t.getDerivedStateFromProps)&&(pi(e,t,i,n),o.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(t=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),t!==o.state&&hi.enqueueReplaceState(o,o.state,null),si(e,n,o,r),o.state=e.memoizedState),"function"==typeof o.componentDidMount&&(e.effectTag|=4)}var yi=Array.isArray;function wi(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(a(309));var r=n.stateNode}if(!r)throw Error(a(147,e));var o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:((t=function(e){var t=r.refs;t===di&&(t=r.refs={}),null===e?delete t[o]:t[o]=e})._stringRef=o,t)}if("string"!=typeof e)throw Error(a(284));if(!n._owner)throw Error(a(290,e))}return e}function xi(e,t){if("textarea"!==e.type)throw Error(a(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,""))}function Ei(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t){return(e=Ol(e,t)).index=0,e.sibling=null,e}function i(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.effectTag=2,n):r:(t.effectTag=2,n):n}function u(t){return e&&null===t.alternate&&(t.effectTag=2),t}function l(e,t,n,r){return null===t||6!==t.tag?((t=kl(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function s(e,t,n,r){return null!==t&&t.elementType===n.type?((r=o(t,n.props)).ref=wi(e,t,n),r.return=e,r):((r=Sl(n.type,n.key,n.props,null,e.mode,r)).ref=wi(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Pl(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function f(e,t,n,r,i){return null===t||7!==t.tag?((t=Cl(n,e.mode,r,i)).return=e,t):((t=o(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=kl(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ee:return(n=Sl(t.type,t.key,t.props,null,e.mode,n)).ref=wi(e,null,t),n.return=e,n;case te:return(t=Pl(t,e.mode,n)).return=e,t}if(yi(t)||ve(t))return(t=Cl(t,e.mode,n,null)).return=e,t;xi(e,t)}return null}function p(e,t,n,r){var o=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==o?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case ee:return n.key===o?n.type===ne?f(e,t,n.props.children,r,o):s(e,t,n,r):null;case te:return n.key===o?c(e,t,n,r):null}if(yi(n)||ve(n))return null!==o?null:f(e,t,n,r,null);xi(e,n)}return null}function h(e,t,n,r,o){if("string"==typeof r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,o);if("object"==typeof r&&null!==r){switch(r.$$typeof){case ee:return e=e.get(null===r.key?n:r.key)||null,r.type===ne?f(t,e,r.props.children,o,r.key):s(t,e,r,o);case te:return c(t,e=e.get(null===r.key?n:r.key)||null,r,o)}if(yi(r)||ve(r))return f(t,e=e.get(n)||null,r,o,null);xi(t,r)}return null}function v(o,a,u,l){for(var s=null,c=null,f=a,v=a=0,m=null;null!==f&&v<u.length;v++){f.index>v?(m=f,f=null):m=f.sibling;var b=p(o,f,u[v],l);if(null===b){null===f&&(f=m);break}e&&f&&null===b.alternate&&t(o,f),a=i(b,a,v),null===c?s=b:c.sibling=b,c=b,f=m}if(v===u.length)return n(o,f),s;if(null===f){for(;v<u.length;v++)null!==(f=d(o,u[v],l))&&(a=i(f,a,v),null===c?s=f:c.sibling=f,c=f);return s}for(f=r(o,f);v<u.length;v++)null!==(m=h(f,o,v,u[v],l))&&(e&&null!==m.alternate&&f.delete(null===m.key?v:m.key),a=i(m,a,v),null===c?s=m:c.sibling=m,c=m);return e&&f.forEach((function(e){return t(o,e)})),s}function m(o,u,l,s){var c=ve(l);if("function"!=typeof c)throw Error(a(150));if(null==(l=c.call(l)))throw Error(a(151));for(var f=c=null,v=u,m=u=0,b=null,g=l.next();null!==v&&!g.done;m++,g=l.next()){v.index>m?(b=v,v=null):b=v.sibling;var y=p(o,v,g.value,s);if(null===y){null===v&&(v=b);break}e&&v&&null===y.alternate&&t(o,v),u=i(y,u,m),null===f?c=y:f.sibling=y,f=y,v=b}if(g.done)return n(o,v),c;if(null===v){for(;!g.done;m++,g=l.next())null!==(g=d(o,g.value,s))&&(u=i(g,u,m),null===f?c=g:f.sibling=g,f=g);return c}for(v=r(o,v);!g.done;m++,g=l.next())null!==(g=h(v,o,m,g.value,s))&&(e&&null!==g.alternate&&v.delete(null===g.key?m:g.key),u=i(g,u,m),null===f?c=g:f.sibling=g,f=g);return e&&v.forEach((function(e){return t(o,e)})),c}return function(e,r,i,l){var s="object"==typeof i&&null!==i&&i.type===ne&&null===i.key;s&&(i=i.props.children);var c="object"==typeof i&&null!==i;if(c)switch(i.$$typeof){case ee:e:{for(c=i.key,s=r;null!==s;){if(s.key===c){switch(s.tag){case 7:if(i.type===ne){n(e,s.sibling),(r=o(s,i.props.children)).return=e,e=r;break e}break;default:if(s.elementType===i.type){n(e,s.sibling),(r=o(s,i.props)).ref=wi(e,s,i),r.return=e,e=r;break e}}n(e,s);break}t(e,s),s=s.sibling}i.type===ne?((r=Cl(i.props.children,e.mode,l,i.key)).return=e,e=r):((l=Sl(i.type,i.key,i.props,null,e.mode,l)).ref=wi(e,r,i),l.return=e,e=l)}return u(e);case te:e:{for(s=i.key;null!==r;){if(r.key===s){if(4===r.tag&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),(r=o(r,i.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Pl(i,e.mode,l)).return=e,e=r}return u(e)}if("string"==typeof i||"number"==typeof i)return i=""+i,null!==r&&6===r.tag?(n(e,r.sibling),(r=o(r,i)).return=e,e=r):(n(e,r),(r=kl(i,e.mode,l)).return=e,e=r),u(e);if(yi(i))return v(e,r,i,l);if(ve(i))return m(e,r,i,l);if(c&&xi(e,i),void 0===i&&!s)switch(e.tag){case 1:case 0:throw e=e.type,Error(a(152,e.displayName||e.name||"Component"))}return n(e,r)}}var _i=Ei(!0),Oi=Ei(!1),Si={},Ci={current:Si},ki={current:Si},Pi={current:Si};function Ti(e){if(e===Si)throw Error(a(174));return e}function ji(e,t){switch(uo(Pi,t),uo(ki,e),uo(Ci,Si),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Fe(null,"");break;default:t=Fe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ao(Ci),uo(Ci,t)}function Ai(){ao(Ci),ao(ki),ao(Pi)}function Mi(e){Ti(Pi.current);var t=Ti(Ci.current),n=Fe(t,e.type);t!==n&&(uo(ki,e),uo(Ci,n))}function Di(e){ki.current===e&&(ao(Ci),ao(ki))}var Li={current:0};function Fi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function Ni(e,t){return{responder:e,props:t}}var Ii=K.ReactCurrentDispatcher,Ri=K.ReactCurrentBatchConfig,Bi=0,Ui=null,Hi=null,zi=null,Vi=!1;function Wi(){throw Error(a(321))}function $i(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Fr(e[n],t[n]))return!1;return!0}function Gi(e,t,n,r,o,i){if(Bi=i,Ui=t,t.memoizedState=null,t.updateQueue=null,t.expirationTime=0,Ii.current=null===e||null===e.memoizedState?va:ma,e=n(r,o),t.expirationTime===Bi){i=0;do{if(t.expirationTime=0,!(25>i))throw Error(a(301));i+=1,zi=Hi=null,t.updateQueue=null,Ii.current=ba,e=n(r,o)}while(t.expirationTime===Bi)}if(Ii.current=ha,t=null!==Hi&&null!==Hi.next,Bi=0,zi=Hi=Ui=null,Vi=!1,t)throw Error(a(300));return e}function Yi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===zi?Ui.memoizedState=zi=e:zi=zi.next=e,zi}function qi(){if(null===Hi){var e=Ui.alternate;e=null!==e?e.memoizedState:null}else e=Hi.next;var t=null===zi?Ui.memoizedState:zi.next;if(null!==t)zi=t,Hi=e;else{if(null===e)throw Error(a(310));e={memoizedState:(Hi=e).memoizedState,baseState:Hi.baseState,baseQueue:Hi.baseQueue,queue:Hi.queue,next:null},null===zi?Ui.memoizedState=zi=e:zi=zi.next=e}return zi}function Xi(e,t){return"function"==typeof t?t(e):t}function Ki(e){var t=qi(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=Hi,o=r.baseQueue,i=n.pending;if(null!==i){if(null!==o){var u=o.next;o.next=i.next,i.next=u}r.baseQueue=o=i,n.pending=null}if(null!==o){o=o.next,r=r.baseState;var l=u=i=null,s=o;do{var c=s.expirationTime;if(c<Bi){var f={expirationTime:s.expirationTime,suspenseConfig:s.suspenseConfig,action:s.action,eagerReducer:s.eagerReducer,eagerState:s.eagerState,next:null};null===l?(u=l=f,i=r):l=l.next=f,c>Ui.expirationTime&&(Ui.expirationTime=c,ol(c))}else null!==l&&(l=l.next={expirationTime:1073741823,suspenseConfig:s.suspenseConfig,action:s.action,eagerReducer:s.eagerReducer,eagerState:s.eagerState,next:null}),rl(c,s.suspenseConfig),r=s.eagerReducer===e?s.eagerState:e(r,s.action);s=s.next}while(null!==s&&s!==o);null===l?i=r:l.next=u,Fr(r,t.memoizedState)||(Pa=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function Qi(e){var t=qi(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(null!==o){n.pending=null;var u=o=o.next;do{i=e(i,u.action),u=u.next}while(u!==o);Fr(i,t.memoizedState)||(Pa=!0),t.memoizedState=i,null===t.baseQueue&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Ji(e){var t=Yi();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:Xi,lastRenderedState:e}).dispatch=pa.bind(null,Ui,e),[t.memoizedState,e]}function Zi(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Ui.updateQueue)?(t={lastEffect:null},Ui.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ea(){return qi().memoizedState}function ta(e,t,n,r){var o=Yi();Ui.effectTag|=e,o.memoizedState=Zi(1|t,n,void 0,void 0===r?null:r)}function na(e,t,n,r){var o=qi();r=void 0===r?null:r;var i=void 0;if(null!==Hi){var a=Hi.memoizedState;if(i=a.destroy,null!==r&&$i(r,a.deps))return void Zi(t,n,i,r)}Ui.effectTag|=e,o.memoizedState=Zi(1|t,n,i,r)}function ra(e,t){return ta(516,4,e,t)}function oa(e,t){return na(516,4,e,t)}function ia(e,t){return na(4,2,e,t)}function aa(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function ua(e,t,n){return n=null!=n?n.concat([e]):null,na(4,2,aa.bind(null,t,e),n)}function la(){}function sa(e,t){return Yi().memoizedState=[e,void 0===t?null:t],e}function ca(e,t){var n=qi();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&$i(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fa(e,t){var n=qi();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&$i(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function da(e,t,n){var r=Bo();Ho(98>r?98:r,(function(){e(!0)})),Ho(97<r?97:r,(function(){var r=Ri.suspense;Ri.suspense=void 0===t?null:t;try{e(!1),n()}finally{Ri.suspense=r}}))}function pa(e,t,n){var r=Wu(),o=fi.suspense;o={expirationTime:r=$u(r,e,o),suspenseConfig:o,action:n,eagerReducer:null,eagerState:null,next:null};var i=t.pending;if(null===i?o.next=o:(o.next=i.next,i.next=o),t.pending=o,i=e.alternate,e===Ui||null!==i&&i===Ui)Vi=!0,o.expirationTime=Bi,Ui.expirationTime=Bi;else{if(0===e.expirationTime&&(null===i||0===i.expirationTime)&&null!==(i=t.lastRenderedReducer))try{var a=t.lastRenderedState,u=i(a,n);if(o.eagerReducer=i,o.eagerState=u,Fr(u,a))return}catch(e){}Gu(e,r)}}var ha={readContext:ni,useCallback:Wi,useContext:Wi,useEffect:Wi,useImperativeHandle:Wi,useLayoutEffect:Wi,useMemo:Wi,useReducer:Wi,useRef:Wi,useState:Wi,useDebugValue:Wi,useResponder:Wi,useDeferredValue:Wi,useTransition:Wi},va={readContext:ni,useCallback:sa,useContext:ni,useEffect:ra,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,ta(4,2,aa.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ta(4,2,e,t)},useMemo:function(e,t){var n=Yi();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Yi();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=pa.bind(null,Ui,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Yi().memoizedState=e},useState:Ji,useDebugValue:la,useResponder:Ni,useDeferredValue:function(e,t){var n=Ji(e),r=n[0],o=n[1];return ra((function(){var n=Ri.suspense;Ri.suspense=void 0===t?null:t;try{o(e)}finally{Ri.suspense=n}}),[e,t]),r},useTransition:function(e){var t=Ji(!1),n=t[0];return t=t[1],[sa(da.bind(null,t,e),[t,e]),n]}},ma={readContext:ni,useCallback:ca,useContext:ni,useEffect:oa,useImperativeHandle:ua,useLayoutEffect:ia,useMemo:fa,useReducer:Ki,useRef:ea,useState:function(){return Ki(Xi)},useDebugValue:la,useResponder:Ni,useDeferredValue:function(e,t){var n=Ki(Xi),r=n[0],o=n[1];return oa((function(){var n=Ri.suspense;Ri.suspense=void 0===t?null:t;try{o(e)}finally{Ri.suspense=n}}),[e,t]),r},useTransition:function(e){var t=Ki(Xi),n=t[0];return t=t[1],[ca(da.bind(null,t,e),[t,e]),n]}},ba={readContext:ni,useCallback:ca,useContext:ni,useEffect:oa,useImperativeHandle:ua,useLayoutEffect:ia,useMemo:fa,useReducer:Qi,useRef:ea,useState:function(){return Qi(Xi)},useDebugValue:la,useResponder:Ni,useDeferredValue:function(e,t){var n=Qi(Xi),r=n[0],o=n[1];return oa((function(){var n=Ri.suspense;Ri.suspense=void 0===t?null:t;try{o(e)}finally{Ri.suspense=n}}),[e,t]),r},useTransition:function(e){var t=Qi(Xi),n=t[0];return t=t[1],[ca(da.bind(null,t,e),[t,e]),n]}},ga=null,ya=null,wa=!1;function xa(e,t){var n=El(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Ea(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);case 13:default:return!1}}function _a(e){if(wa){var t=ya;if(t){var n=t;if(!Ea(e,t)){if(!(t=yn(n.nextSibling))||!Ea(e,t))return e.effectTag=-1025&e.effectTag|2,wa=!1,void(ga=e);xa(ga,n)}ga=e,ya=yn(t.firstChild)}else e.effectTag=-1025&e.effectTag|2,wa=!1,ga=e}}function Oa(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ga=e}function Sa(e){if(e!==ga)return!1;if(!wa)return Oa(e),wa=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!mn(t,e.memoizedProps))for(t=ya;t;)xa(e,t),t=yn(t.nextSibling);if(Oa(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){ya=yn(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}ya=null}}else ya=ga?yn(e.stateNode.nextSibling):null;return!0}function Ca(){ya=ga=null,wa=!1}var ka=K.ReactCurrentOwner,Pa=!1;function Ta(e,t,n,r){t.child=null===e?Oi(t,null,n,r):_i(t,e.child,n,r)}function ja(e,t,n,r,o){n=n.render;var i=t.ref;return ti(t,o),r=Gi(e,t,n,r,i,o),null===e||Pa?(t.effectTag|=1,Ta(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=o&&(e.expirationTime=0),Ga(e,t,o))}function Aa(e,t,n,r,o,i){if(null===e){var a=n.type;return"function"!=typeof a||_l(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Sl(n.type,null,r,null,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Ma(e,t,a,r,o,i))}return a=e.child,o<i&&(o=a.memoizedProps,(n=null!==(n=n.compare)?n:Ir)(o,r)&&e.ref===t.ref)?Ga(e,t,i):(t.effectTag|=1,(e=Ol(a,r)).ref=t.ref,e.return=t,t.child=e)}function Ma(e,t,n,r,o,i){return null!==e&&Ir(e.memoizedProps,r)&&e.ref===t.ref&&(Pa=!1,o<i)?(t.expirationTime=e.expirationTime,Ga(e,t,i)):La(e,t,n,r,i)}function Da(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.effectTag|=128)}function La(e,t,n,r,o){var i=ho(n)?fo:so.current;return i=po(t,i),ti(t,o),n=Gi(e,t,n,r,i,o),null===e||Pa?(t.effectTag|=1,Ta(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=o&&(e.expirationTime=0),Ga(e,t,o))}function Fa(e,t,n,r,o){if(ho(n)){var i=!0;go(t)}else i=!1;if(ti(t,o),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),mi(t,n,r),gi(t,n,r,o),r=!0;else if(null===e){var a=t.stateNode,u=t.memoizedProps;a.props=u;var l=a.context,s=n.contextType;s="object"==typeof s&&null!==s?ni(s):po(t,s=ho(n)?fo:so.current);var c=n.getDerivedStateFromProps,f="function"==typeof c||"function"==typeof a.getSnapshotBeforeUpdate;f||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(u!==r||l!==s)&&bi(t,a,r,s),ri=!1;var d=t.memoizedState;a.state=d,si(t,r,a,o),l=t.memoizedState,u!==r||d!==l||co.current||ri?("function"==typeof c&&(pi(t,n,c,r),l=t.memoizedState),(u=ri||vi(t,n,u,r,d,l,s))?(f||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.effectTag|=4)):("function"==typeof a.componentDidMount&&(t.effectTag|=4),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=s,r=u):("function"==typeof a.componentDidMount&&(t.effectTag|=4),r=!1)}else a=t.stateNode,ii(e,t),u=t.memoizedProps,a.props=t.type===t.elementType?u:Yo(t.type,u),l=a.context,s="object"==typeof(s=n.contextType)&&null!==s?ni(s):po(t,s=ho(n)?fo:so.current),(f="function"==typeof(c=n.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(u!==r||l!==s)&&bi(t,a,r,s),ri=!1,l=t.memoizedState,a.state=l,si(t,r,a,o),d=t.memoizedState,u!==r||l!==d||co.current||ri?("function"==typeof c&&(pi(t,n,c,r),d=t.memoizedState),(c=ri||vi(t,n,u,r,l,d,s))?(f||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,d,s),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,d,s)),"function"==typeof a.componentDidUpdate&&(t.effectTag|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.effectTag|=256)):("function"!=typeof a.componentDidUpdate||u===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),"function"!=typeof a.getSnapshotBeforeUpdate||u===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),t.memoizedProps=r,t.memoizedState=d),a.props=r,a.state=d,a.context=s,r=c):("function"!=typeof a.componentDidUpdate||u===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=4),"function"!=typeof a.getSnapshotBeforeUpdate||u===e.memoizedProps&&l===e.memoizedState||(t.effectTag|=256),r=!1);return Na(e,t,n,r,i,o)}function Na(e,t,n,r,o,i){Da(e,t);var a=0!=(64&t.effectTag);if(!r&&!a)return o&&yo(t,n,!1),Ga(e,t,i);r=t.stateNode,ka.current=t;var u=a&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.effectTag|=1,null!==e&&a?(t.child=_i(t,e.child,null,i),t.child=_i(t,null,u,i)):Ta(e,t,u,i),t.memoizedState=r.state,o&&yo(t,n,!0),t.child}function Ia(e){var t=e.stateNode;t.pendingContext?mo(0,t.pendingContext,t.pendingContext!==t.context):t.context&&mo(0,t.context,!1),ji(e,t.containerInfo)}var Ra,Ba,Ua,Ha={dehydrated:null,retryTime:0};function za(e,t,n){var r,o=t.mode,i=t.pendingProps,a=Li.current,u=!1;if((r=0!=(64&t.effectTag))||(r=0!=(2&a)&&(null===e||null!==e.memoizedState)),r?(u=!0,t.effectTag&=-65):null!==e&&null===e.memoizedState||void 0===i.fallback||!0===i.unstable_avoidThisFallback||(a|=1),uo(Li,1&a),null===e){if(void 0!==i.fallback&&_a(t),u){if(u=i.fallback,(i=Cl(null,o,0,null)).return=t,0==(2&t.mode))for(e=null!==t.memoizedState?t.child.child:t.child,i.child=e;null!==e;)e.return=i,e=e.sibling;return(n=Cl(u,o,n,null)).return=t,i.sibling=n,t.memoizedState=Ha,t.child=i,n}return o=i.children,t.memoizedState=null,t.child=Oi(t,null,o,n)}if(null!==e.memoizedState){if(o=(e=e.child).sibling,u){if(i=i.fallback,(n=Ol(e,e.pendingProps)).return=t,0==(2&t.mode)&&(u=null!==t.memoizedState?t.child.child:t.child)!==e.child)for(n.child=u;null!==u;)u.return=n,u=u.sibling;return(o=Ol(o,i)).return=t,n.sibling=o,n.childExpirationTime=0,t.memoizedState=Ha,t.child=n,o}return n=_i(t,e.child,i.children,n),t.memoizedState=null,t.child=n}if(e=e.child,u){if(u=i.fallback,(i=Cl(null,o,0,null)).return=t,i.child=e,null!==e&&(e.return=i),0==(2&t.mode))for(e=null!==t.memoizedState?t.child.child:t.child,i.child=e;null!==e;)e.return=i,e=e.sibling;return(n=Cl(u,o,n,null)).return=t,i.sibling=n,n.effectTag|=2,i.childExpirationTime=0,t.memoizedState=Ha,t.child=i,n}return t.memoizedState=null,t.child=_i(t,e,i.children,n)}function Va(e,t){e.expirationTime<t&&(e.expirationTime=t);var n=e.alternate;null!==n&&n.expirationTime<t&&(n.expirationTime=t),ei(e.return,t)}function Wa(e,t,n,r,o,i){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailExpiration:0,tailMode:o,lastEffect:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailExpiration=0,a.tailMode=o,a.lastEffect=i)}function $a(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Ta(e,t,r.children,n),0!=(2&(r=Li.current)))r=1&r|2,t.effectTag|=64;else{if(null!==e&&0!=(64&e.effectTag))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Va(e,n);else if(19===e.tag)Va(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(uo(Li,r),0==(2&t.mode))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===Fi(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Wa(t,!1,o,n,i,t.lastEffect);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===Fi(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Wa(t,!0,n,null,i,t.lastEffect);break;case"together":Wa(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function Ga(e,t,n){null!==e&&(t.dependencies=e.dependencies);var r=t.expirationTime;if(0!==r&&ol(r),t.childExpirationTime<n)return null;if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=Ol(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Ol(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Ya(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function qa(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return ho(t.type)&&vo(),null;case 3:return Ai(),ao(co),ao(so),(n=t.stateNode).pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||!Sa(t)||(t.effectTag|=4),null;case 5:Di(t),n=Ti(Pi.current);var i=t.type;if(null!==e&&null!=t.stateNode)Ba(e,t,i,r,n),e.ref!==t.ref&&(t.effectTag|=128);else{if(!r){if(null===t.stateNode)throw Error(a(166));return null}if(e=Ti(Ci.current),Sa(t)){r=t.stateNode,i=t.type;var u=t.memoizedProps;switch(r[En]=t,r[_n]=u,i){case"iframe":case"object":case"embed":$t("load",r);break;case"video":case"audio":for(e=0;e<qe.length;e++)$t(qe[e],r);break;case"source":$t("error",r);break;case"img":case"image":case"link":$t("error",r),$t("load",r);break;case"form":$t("reset",r),$t("submit",r);break;case"details":$t("toggle",r);break;case"input":_e(r,u),$t("invalid",r),an(n,"onChange");break;case"select":r._wrapperState={wasMultiple:!!u.multiple},$t("invalid",r),an(n,"onChange");break;case"textarea":Ae(r,u),$t("invalid",r),an(n,"onChange")}for(var l in nn(i,u),e=null,u)if(u.hasOwnProperty(l)){var s=u[l];"children"===l?"string"==typeof s?r.textContent!==s&&(e=["children",s]):"number"==typeof s&&r.textContent!==""+s&&(e=["children",""+s]):O.hasOwnProperty(l)&&null!=s&&an(n,l)}switch(i){case"input":we(r),Ce(r,u,!0);break;case"textarea":we(r),De(r);break;case"select":case"option":break;default:"function"==typeof u.onClick&&(r.onclick=un)}n=e,t.updateQueue=n,null!==n&&(t.effectTag|=4)}else{switch(l=9===n.nodeType?n:n.ownerDocument,e===on&&(e=Le(i)),e===on?"script"===i?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=l.createElement(i,{is:r.is}):(e=l.createElement(i),"select"===i&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,i),e[En]=t,e[_n]=r,Ra(e,t),t.stateNode=e,l=rn(i,r),i){case"iframe":case"object":case"embed":$t("load",e),s=r;break;case"video":case"audio":for(s=0;s<qe.length;s++)$t(qe[s],e);s=r;break;case"source":$t("error",e),s=r;break;case"img":case"image":case"link":$t("error",e),$t("load",e),s=r;break;case"form":$t("reset",e),$t("submit",e),s=r;break;case"details":$t("toggle",e),s=r;break;case"input":_e(e,r),s=Ee(e,r),$t("invalid",e),an(n,"onChange");break;case"option":s=Pe(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=o({},r,{value:void 0}),$t("invalid",e),an(n,"onChange");break;case"textarea":Ae(e,r),s=je(e,r),$t("invalid",e),an(n,"onChange");break;default:s=r}nn(i,s);var c=s;for(u in c)if(c.hasOwnProperty(u)){var f=c[u];"style"===u?en(e,f):"dangerouslySetInnerHTML"===u?null!=(f=f?f.__html:void 0)&&Ie(e,f):"children"===u?"string"==typeof f?("textarea"!==i||""!==f)&&Re(e,f):"number"==typeof f&&Re(e,""+f):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(O.hasOwnProperty(u)?null!=f&&an(n,u):null!=f&&Q(e,u,f,l))}switch(i){case"input":we(e),Ce(e,r,!1);break;case"textarea":we(e),De(e);break;case"option":null!=r.value&&e.setAttribute("value",""+ge(r.value));break;case"select":e.multiple=!!r.multiple,null!=(n=r.value)?Te(e,!!r.multiple,n,!1):null!=r.defaultValue&&Te(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof s.onClick&&(e.onclick=un)}vn(i,r)&&(t.effectTag|=4)}null!==t.ref&&(t.effectTag|=128)}return null;case 6:if(e&&null!=t.stateNode)Ua(0,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(a(166));n=Ti(Pi.current),Ti(Ci.current),Sa(t)?(n=t.stateNode,r=t.memoizedProps,n[En]=t,n.nodeValue!==r&&(t.effectTag|=4)):((n=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[En]=t,t.stateNode=n)}return null;case 13:return ao(Li),r=t.memoizedState,0!=(64&t.effectTag)?(t.expirationTime=n,t):(n=null!==r,r=!1,null===e?void 0!==t.memoizedProps.fallback&&Sa(t):(r=null!==(i=e.memoizedState),n||null===i||null!==(i=e.child.sibling)&&(null!==(u=t.firstEffect)?(t.firstEffect=i,i.nextEffect=u):(t.firstEffect=t.lastEffect=i,i.nextEffect=null),i.effectTag=8)),n&&!r&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&Li.current)?Su===gu&&(Su=yu):(Su!==gu&&Su!==yu||(Su=wu),0!==ju&&null!==Eu&&(Al(Eu,Ou),Ml(Eu,ju)))),(n||r)&&(t.effectTag|=4),null);case 4:return Ai(),null;case 10:return Zo(t),null;case 17:return ho(t.type)&&vo(),null;case 19:if(ao(Li),null===(r=t.memoizedState))return null;if(i=0!=(64&t.effectTag),null===(u=r.rendering)){if(i)Ya(r,!1);else if(Su!==gu||null!==e&&0!=(64&e.effectTag))for(u=t.child;null!==u;){if(null!==(e=Fi(u))){for(t.effectTag|=64,Ya(r,!1),null!==(i=e.updateQueue)&&(t.updateQueue=i,t.effectTag|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=t.child;null!==r;)u=n,(i=r).effectTag&=2,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null,null===(e=i.alternate)?(i.childExpirationTime=0,i.expirationTime=u,i.child=null,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null):(i.childExpirationTime=e.childExpirationTime,i.expirationTime=e.expirationTime,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,u=e.dependencies,i.dependencies=null===u?null:{expirationTime:u.expirationTime,firstContext:u.firstContext,responders:u.responders}),r=r.sibling;return uo(Li,1&Li.current|2),t.child}u=u.sibling}}else{if(!i)if(null!==(e=Fi(u))){if(t.effectTag|=64,i=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.effectTag|=4),Ya(r,!0),null===r.tail&&"hidden"===r.tailMode&&!u.alternate)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Ro()-r.renderingStartTime>r.tailExpiration&&1<n&&(t.effectTag|=64,i=!0,Ya(r,!1),t.expirationTime=t.childExpirationTime=n-1);r.isBackwards?(u.sibling=t.child,t.child=u):(null!==(n=r.last)?n.sibling=u:t.child=u,r.last=u)}return null!==r.tail?(0===r.tailExpiration&&(r.tailExpiration=Ro()+500),n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Ro(),n.sibling=null,t=Li.current,uo(Li,i?1&t|2:1&t),n):null}throw Error(a(156,t.tag))}function Xa(e){switch(e.tag){case 1:ho(e.type)&&vo();var t=e.effectTag;return 4096&t?(e.effectTag=-4097&t|64,e):null;case 3:if(Ai(),ao(co),ao(so),0!=(64&(t=e.effectTag)))throw Error(a(285));return e.effectTag=-4097&t|64,e;case 5:return Di(e),null;case 13:return ao(Li),4096&(t=e.effectTag)?(e.effectTag=-4097&t|64,e):null;case 19:return ao(Li),null;case 4:return Ai(),null;case 10:return Zo(e),null;default:return null}}function Ka(e,t){return{value:e,source:t,stack:be(t)}}Ra=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ba=function(e,t,n,r,i){var a=e.memoizedProps;if(a!==r){var u,l,s=t.stateNode;switch(Ti(Ci.current),e=null,n){case"input":a=Ee(s,a),r=Ee(s,r),e=[];break;case"option":a=Pe(s,a),r=Pe(s,r),e=[];break;case"select":a=o({},a,{value:void 0}),r=o({},r,{value:void 0}),e=[];break;case"textarea":a=je(s,a),r=je(s,r),e=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(s.onclick=un)}for(u in nn(n,r),n=null,a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&null!=a[u])if("style"===u)for(l in s=a[u])s.hasOwnProperty(l)&&(n||(n={}),n[l]="");else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(O.hasOwnProperty(u)?e||(e=[]):(e=e||[]).push(u,null));for(u in r){var c=r[u];if(s=null!=a?a[u]:void 0,r.hasOwnProperty(u)&&c!==s&&(null!=c||null!=s))if("style"===u)if(s){for(l in s)!s.hasOwnProperty(l)||c&&c.hasOwnProperty(l)||(n||(n={}),n[l]="");for(l in c)c.hasOwnProperty(l)&&s[l]!==c[l]&&(n||(n={}),n[l]=c[l])}else n||(e||(e=[]),e.push(u,n)),n=c;else"dangerouslySetInnerHTML"===u?(c=c?c.__html:void 0,s=s?s.__html:void 0,null!=c&&s!==c&&(e=e||[]).push(u,c)):"children"===u?s===c||"string"!=typeof c&&"number"!=typeof c||(e=e||[]).push(u,""+c):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(O.hasOwnProperty(u)?(null!=c&&an(i,u),e||s===c||(e=[])):(e=e||[]).push(u,c))}n&&(e=e||[]).push("style",n),i=e,(t.updateQueue=i)&&(t.effectTag|=4)}},Ua=function(e,t,n,r){n!==r&&(t.effectTag|=4)};var Qa="function"==typeof WeakSet?WeakSet:Set;function Ja(e,t){var n=t.source,r=t.stack;null===r&&null!==n&&(r=be(n)),null!==n&&me(n.type),t=t.value,null!==e&&1===e.tag&&me(e.type)}function Za(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(t){ml(e,t)}else t.current=null}function eu(e,t){switch(t.tag){case 0:case 11:case 15:case 22:return;case 1:if(256&t.effectTag&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Yo(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:case 5:case 6:case 4:case 17:return}throw Error(a(163))}function tu(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.destroy;n.destroy=void 0,void 0!==r&&r()}n=n.next}while(n!==t)}}function nu(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ru(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:return void nu(3,n);case 1:if(e=n.stateNode,4&n.effectTag)if(null===t)e.componentDidMount();else{var r=n.elementType===n.type?t.memoizedProps:Yo(n.type,t.memoizedProps);e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate)}return void(null!==(t=n.updateQueue)&&ci(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}ci(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.effectTag&&vn(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&Lt(n)))));case 19:case 17:case 20:case 21:return}throw Error(a(163))}function ou(e,t,n){switch("function"==typeof wl&&wl(t),t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var r=e.next;Ho(97<n?97:n,(function(){var e=r;do{var n=e.destroy;if(void 0!==n){var o=t;try{n()}catch(e){ml(o,e)}}e=e.next}while(e!==r)}))}break;case 1:Za(t),"function"==typeof(n=t.stateNode).componentWillUnmount&&function(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(t){ml(e,t)}}(t,n);break;case 5:Za(t);break;case 4:lu(e,t,n)}}function iu(e){var t=e.alternate;e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.alternate=null,e.firstEffect=null,e.lastEffect=null,e.pendingProps=null,e.memoizedProps=null,e.stateNode=null,null!==t&&iu(t)}function au(e){return 5===e.tag||3===e.tag||4===e.tag}function uu(e){e:{for(var t=e.return;null!==t;){if(au(t)){var n=t;break e}t=t.return}throw Error(a(160))}switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(a(161))}16&n.effectTag&&(Re(t,""),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||au(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}r?function e(t,n,r){var o=t.tag,i=5===o||6===o;if(i)t=i?t.stateNode:t.stateNode.instance,n?8===r.nodeType?r.parentNode.insertBefore(t,n):r.insertBefore(t,n):(8===r.nodeType?(n=r.parentNode).insertBefore(t,r):(n=r).appendChild(t),null!==(r=r._reactRootContainer)&&void 0!==r||null!==n.onclick||(n.onclick=un));else if(4!==o&&null!==(t=t.child))for(e(t,n,r),t=t.sibling;null!==t;)e(t,n,r),t=t.sibling}(e,n,t):function e(t,n,r){var o=t.tag,i=5===o||6===o;if(i)t=i?t.stateNode:t.stateNode.instance,n?r.insertBefore(t,n):r.appendChild(t);else if(4!==o&&null!==(t=t.child))for(e(t,n,r),t=t.sibling;null!==t;)e(t,n,r),t=t.sibling}(e,n,t)}function lu(e,t,n){for(var r,o,i=t,u=!1;;){if(!u){u=i.return;e:for(;;){if(null===u)throw Error(a(160));switch(r=u.stateNode,u.tag){case 5:o=!1;break e;case 3:case 4:r=r.containerInfo,o=!0;break e}u=u.return}u=!0}if(5===i.tag||6===i.tag){e:for(var l=e,s=i,c=n,f=s;;)if(ou(l,f,c),null!==f.child&&4!==f.tag)f.child.return=f,f=f.child;else{if(f===s)break e;for(;null===f.sibling;){if(null===f.return||f.return===s)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}o?(l=r,s=i.stateNode,8===l.nodeType?l.parentNode.removeChild(s):l.removeChild(s)):r.removeChild(i.stateNode)}else if(4===i.tag){if(null!==i.child){r=i.stateNode.containerInfo,o=!0,i.child.return=i,i=i.child;continue}}else if(ou(e,i,n),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(u=!1)}i.sibling.return=i.return,i=i.sibling}}function su(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:return void tu(3,t);case 1:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps,o=null!==e?e.memoizedProps:r;e=t.type;var i=t.updateQueue;if(t.updateQueue=null,null!==i){for(n[_n]=r,"input"===e&&"radio"===r.type&&null!=r.name&&Oe(n,r),rn(e,o),t=rn(e,r),o=0;o<i.length;o+=2){var u=i[o],l=i[o+1];"style"===u?en(n,l):"dangerouslySetInnerHTML"===u?Ie(n,l):"children"===u?Re(n,l):Q(n,u,l,t)}switch(e){case"input":Se(n,r);break;case"textarea":Me(n,r);break;case"select":t=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(e=r.value)?Te(n,!!r.multiple,e,!1):t!==!!r.multiple&&(null!=r.defaultValue?Te(n,!!r.multiple,r.defaultValue,!0):Te(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(a(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((t=t.stateNode).hydrate&&(t.hydrate=!1,Lt(t.containerInfo)));case 12:return;case 13:if(n=t,null===t.memoizedState?r=!1:(r=!0,n=t.child,Mu=Ro()),null!==n)e:for(e=n;;){if(5===e.tag)i=e.stateNode,r?"function"==typeof(i=i.style).setProperty?i.setProperty("display","none","important"):i.display="none":(i=e.stateNode,o=null!=(o=e.memoizedProps.style)&&o.hasOwnProperty("display")?o.display:null,i.style.display=Zt("display",o));else if(6===e.tag)e.stateNode.nodeValue=r?"":e.memoizedProps;else{if(13===e.tag&&null!==e.memoizedState&&null===e.memoizedState.dehydrated){(i=e.child.sibling).return=e,e=i;continue}if(null!==e.child){e.child.return=e,e=e.child;continue}}if(e===n)break;for(;null===e.sibling;){if(null===e.return||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}return void cu(t);case 19:return void cu(t);case 17:return}throw Error(a(163))}function cu(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Qa),t.forEach((function(t){var r=gl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}var fu="function"==typeof WeakMap?WeakMap:Map;function du(e,t,n){(n=ai(n,null)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Lu||(Lu=!0,Fu=r),Ja(e,t)},n}function pu(e,t,n){(n=ai(n,null)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var o=t.value;n.payload=function(){return Ja(e,t),r(o)}}var i=e.stateNode;return null!==i&&"function"==typeof i.componentDidCatch&&(n.callback=function(){"function"!=typeof r&&(null===Nu?Nu=new Set([this]):Nu.add(this),Ja(e,t));var n=t.stack;this.componentDidCatch(t.value,{componentStack:null!==n?n:""})}),n}var hu,vu=Math.ceil,mu=K.ReactCurrentDispatcher,bu=K.ReactCurrentOwner,gu=0,yu=3,wu=4,xu=0,Eu=null,_u=null,Ou=0,Su=gu,Cu=null,ku=1073741823,Pu=1073741823,Tu=null,ju=0,Au=!1,Mu=0,Du=null,Lu=!1,Fu=null,Nu=null,Iu=!1,Ru=null,Bu=90,Uu=null,Hu=0,zu=null,Vu=0;function Wu(){return 0!=(48&xu)?1073741821-(Ro()/10|0):0!==Vu?Vu:Vu=1073741821-(Ro()/10|0)}function $u(e,t,n){if(0==(2&(t=t.mode)))return 1073741823;var r=Bo();if(0==(4&t))return 99===r?1073741823:1073741822;if(0!=(16&xu))return Ou;if(null!==n)e=Go(e,0|n.timeoutMs||5e3,250);else switch(r){case 99:e=1073741823;break;case 98:e=Go(e,150,100);break;case 97:case 96:e=Go(e,5e3,250);break;case 95:e=2;break;default:throw Error(a(326))}return null!==Eu&&e===Ou&&--e,e}function Gu(e,t){if(50<Hu)throw Hu=0,zu=null,Error(a(185));if(null!==(e=Yu(e,t))){var n=Bo();1073741823===t?0!=(8&xu)&&0==(48&xu)?Qu(e):(Xu(e),0===xu&&Wo()):Xu(e),0==(4&xu)||98!==n&&99!==n||(null===Uu?Uu=new Map([[e,t]]):(void 0===(n=Uu.get(e))||n>t)&&Uu.set(e,t))}}function Yu(e,t){e.expirationTime<t&&(e.expirationTime=t);var n=e.alternate;null!==n&&n.expirationTime<t&&(n.expirationTime=t);var r=e.return,o=null;if(null===r&&3===e.tag)o=e.stateNode;else for(;null!==r;){if(n=r.alternate,r.childExpirationTime<t&&(r.childExpirationTime=t),null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t),null===r.return&&3===r.tag){o=r.stateNode;break}r=r.return}return null!==o&&(Eu===o&&(ol(t),Su===wu&&Al(o,Ou)),Ml(o,t)),o}function qu(e){var t=e.lastExpiredTime;if(0!==t)return t;if(!jl(e,t=e.firstPendingTime))return t;var n=e.lastPingedTime;return 2>=(e=n>(e=e.nextKnownPendingLevel)?n:e)&&t!==e?0:e}function Xu(e){if(0!==e.lastExpiredTime)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=Vo(Qu.bind(null,e));else{var t=qu(e),n=e.callbackNode;if(0===t)null!==n&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var r=Wu();if(r=1073741823===t?99:1===t||2===t?95:0>=(r=10*(1073741821-t)-10*(1073741821-r))?99:250>=r?98:5250>=r?97:95,null!==n){var o=e.callbackPriority;if(e.callbackExpirationTime===t&&o>=r)return;n!==Ao&&Eo(n)}e.callbackExpirationTime=t,e.callbackPriority=r,t=1073741823===t?Vo(Qu.bind(null,e)):zo(r,Ku.bind(null,e),{timeout:10*(1073741821-t)-Ro()}),e.callbackNode=t}}}function Ku(e,t){if(Vu=0,t)return Dl(e,t=Wu()),Xu(e),null;var n=qu(e);if(0!==n){if(t=e.callbackNode,0!=(48&xu))throw Error(a(327));if(pl(),e===Eu&&n===Ou||el(e,n),null!==_u){var r=xu;xu|=16;for(var o=nl();;)try{al();break}catch(t){tl(e,t)}if(Jo(),xu=r,mu.current=o,1===Su)throw t=Cu,el(e,n),Al(e,n),Xu(e),t;if(null===_u)switch(o=e.finishedWork=e.current.alternate,e.finishedExpirationTime=n,r=Su,Eu=null,r){case gu:case 1:throw Error(a(345));case 2:Dl(e,2<n?2:n);break;case yu:if(Al(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=sl(o)),1073741823===ku&&10<(o=Mu+500-Ro())){if(Au){var i=e.lastPingedTime;if(0===i||i>=n){e.lastPingedTime=n,el(e,n);break}}if(0!==(i=qu(e))&&i!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}e.timeoutHandle=bn(cl.bind(null,e),o);break}cl(e);break;case wu:if(Al(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=sl(o)),Au&&(0===(o=e.lastPingedTime)||o>=n)){e.lastPingedTime=n,el(e,n);break}if(0!==(o=qu(e))&&o!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}if(1073741823!==Pu?r=10*(1073741821-Pu)-Ro():1073741823===ku?r=0:(r=10*(1073741821-ku)-5e3,0>(r=(o=Ro())-r)&&(r=0),(n=10*(1073741821-n)-o)<(r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*vu(r/1960))-r)&&(r=n)),10<r){e.timeoutHandle=bn(cl.bind(null,e),r);break}cl(e);break;case 5:if(1073741823!==ku&&null!==Tu){i=ku;var u=Tu;if(0>=(r=0|u.busyMinDurationMs)?r=0:(o=0|u.busyDelayMs,r=(i=Ro()-(10*(1073741821-i)-(0|u.timeoutMs||5e3)))<=o?0:o+r-i),10<r){Al(e,n),e.timeoutHandle=bn(cl.bind(null,e),r);break}}cl(e);break;default:throw Error(a(329))}if(Xu(e),e.callbackNode===t)return Ku.bind(null,e)}}return null}function Qu(e){var t=e.lastExpiredTime;if(t=0!==t?t:1073741823,0!=(48&xu))throw Error(a(327));if(pl(),e===Eu&&t===Ou||el(e,t),null!==_u){var n=xu;xu|=16;for(var r=nl();;)try{il();break}catch(t){tl(e,t)}if(Jo(),xu=n,mu.current=r,1===Su)throw n=Cu,el(e,t),Al(e,t),Xu(e),n;if(null!==_u)throw Error(a(261));e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,Eu=null,cl(e),Xu(e)}return null}function Ju(e,t){var n=xu;xu|=1;try{return e(t)}finally{0===(xu=n)&&Wo()}}function Zu(e,t){var n=xu;xu&=-2,xu|=8;try{return e(t)}finally{0===(xu=n)&&Wo()}}function el(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,gn(n)),null!==_u)for(n=_u.return;null!==n;){var r=n;switch(r.tag){case 1:null!=(r=r.type.childContextTypes)&&vo();break;case 3:Ai(),ao(co),ao(so);break;case 5:Di(r);break;case 4:Ai();break;case 13:case 19:ao(Li);break;case 10:Zo(r)}n=n.return}Eu=e,_u=Ol(e.current,null),Ou=t,Su=gu,Cu=null,Pu=ku=1073741823,Tu=null,ju=0,Au=!1}function tl(e,t){for(;;){try{if(Jo(),Ii.current=ha,Vi)for(var n=Ui.memoizedState;null!==n;){var r=n.queue;null!==r&&(r.pending=null),n=n.next}if(Bi=0,zi=Hi=Ui=null,Vi=!1,null===_u||null===_u.return)return Su=1,Cu=t,_u=null;e:{var o=e,i=_u.return,a=_u,u=t;if(t=Ou,a.effectTag|=2048,a.firstEffect=a.lastEffect=null,null!==u&&"object"==typeof u&&"function"==typeof u.then){var l=u;if(0==(2&a.mode)){var s=a.alternate;s?(a.updateQueue=s.updateQueue,a.memoizedState=s.memoizedState,a.expirationTime=s.expirationTime):(a.updateQueue=null,a.memoizedState=null)}var c=0!=(1&Li.current),f=i;do{var d;if(d=13===f.tag){var p=f.memoizedState;if(null!==p)d=null!==p.dehydrated;else{var h=f.memoizedProps;d=void 0!==h.fallback&&(!0!==h.unstable_avoidThisFallback||!c)}}if(d){var v=f.updateQueue;if(null===v){var m=new Set;m.add(l),f.updateQueue=m}else v.add(l);if(0==(2&f.mode)){if(f.effectTag|=64,a.effectTag&=-2981,1===a.tag)if(null===a.alternate)a.tag=17;else{var b=ai(1073741823,null);b.tag=2,ui(a,b)}a.expirationTime=1073741823;break e}u=void 0,a=t;var g=o.pingCache;if(null===g?(g=o.pingCache=new fu,u=new Set,g.set(l,u)):void 0===(u=g.get(l))&&(u=new Set,g.set(l,u)),!u.has(a)){u.add(a);var y=bl.bind(null,o,l,a);l.then(y,y)}f.effectTag|=4096,f.expirationTime=t;break e}f=f.return}while(null!==f);u=Error((me(a.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."+be(a))}5!==Su&&(Su=2),u=Ka(u,a),f=i;do{switch(f.tag){case 3:l=u,f.effectTag|=4096,f.expirationTime=t,li(f,du(f,l,t));break e;case 1:l=u;var w=f.type,x=f.stateNode;if(0==(64&f.effectTag)&&("function"==typeof w.getDerivedStateFromError||null!==x&&"function"==typeof x.componentDidCatch&&(null===Nu||!Nu.has(x)))){f.effectTag|=4096,f.expirationTime=t,li(f,pu(f,l,t));break e}}f=f.return}while(null!==f)}_u=ll(_u)}catch(e){t=e;continue}break}}function nl(){var e=mu.current;return mu.current=ha,null===e?ha:e}function rl(e,t){e<ku&&2<e&&(ku=e),null!==t&&e<Pu&&2<e&&(Pu=e,Tu=t)}function ol(e){e>ju&&(ju=e)}function il(){for(;null!==_u;)_u=ul(_u)}function al(){for(;null!==_u&&!Mo();)_u=ul(_u)}function ul(e){var t=hu(e.alternate,e,Ou);return e.memoizedProps=e.pendingProps,null===t&&(t=ll(e)),bu.current=null,t}function ll(e){_u=e;do{var t=_u.alternate;if(e=_u.return,0==(2048&_u.effectTag)){if(t=qa(t,_u,Ou),1===Ou||1!==_u.childExpirationTime){for(var n=0,r=_u.child;null!==r;){var o=r.expirationTime,i=r.childExpirationTime;o>n&&(n=o),i>n&&(n=i),r=r.sibling}_u.childExpirationTime=n}if(null!==t)return t;null!==e&&0==(2048&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=_u.firstEffect),null!==_u.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=_u.firstEffect),e.lastEffect=_u.lastEffect),1<_u.effectTag&&(null!==e.lastEffect?e.lastEffect.nextEffect=_u:e.firstEffect=_u,e.lastEffect=_u))}else{if(null!==(t=Xa(_u)))return t.effectTag&=2047,t;null!==e&&(e.firstEffect=e.lastEffect=null,e.effectTag|=2048)}if(null!==(t=_u.sibling))return t;_u=e}while(null!==_u);return Su===gu&&(Su=5),null}function sl(e){var t=e.expirationTime;return t>(e=e.childExpirationTime)?t:e}function cl(e){var t=Bo();return Ho(99,fl.bind(null,e,t)),null}function fl(e,t){do{pl()}while(null!==Ru);if(0!=(48&xu))throw Error(a(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw Error(a(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var o=sl(n);if(e.firstPendingTime=o,r<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:r<=e.firstSuspendedTime&&(e.firstSuspendedTime=r-1),r<=e.lastPingedTime&&(e.lastPingedTime=0),r<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===Eu&&(_u=Eu=null,Ou=0),1<n.effectTag?null!==n.lastEffect?(n.lastEffect.nextEffect=n,o=n.firstEffect):o=n:o=n.firstEffect,null!==o){var i=xu;xu|=32,bu.current=null,pn=Wt;var u=fn();if(dn(u)){if("selectionStart"in u)var l={start:u.selectionStart,end:u.selectionEnd};else e:{var s=(l=(l=u.ownerDocument)&&l.defaultView||window).getSelection&&l.getSelection();if(s&&0!==s.rangeCount){l=s.anchorNode;var c=s.anchorOffset,f=s.focusNode;s=s.focusOffset;try{l.nodeType,f.nodeType}catch(e){l=null;break e}var d=0,p=-1,h=-1,v=0,m=0,b=u,g=null;t:for(;;){for(var y;b!==l||0!==c&&3!==b.nodeType||(p=d+c),b!==f||0!==s&&3!==b.nodeType||(h=d+s),3===b.nodeType&&(d+=b.nodeValue.length),null!==(y=b.firstChild);)g=b,b=y;for(;;){if(b===u)break t;if(g===l&&++v===c&&(p=d),g===f&&++m===s&&(h=d),null!==(y=b.nextSibling))break;g=(b=g).parentNode}b=y}l=-1===p||-1===h?null:{start:p,end:h}}else l=null}l=l||{start:0,end:0}}else l=null;hn={activeElementDetached:null,focusedElem:u,selectionRange:l},Wt=!1,Du=o;do{try{dl()}catch(e){if(null===Du)throw Error(a(330));ml(Du,e),Du=Du.nextEffect}}while(null!==Du);Du=o;do{try{for(u=e,l=t;null!==Du;){var w=Du.effectTag;if(16&w&&Re(Du.stateNode,""),128&w){var x=Du.alternate;if(null!==x){var E=x.ref;null!==E&&("function"==typeof E?E(null):E.current=null)}}switch(1038&w){case 2:uu(Du),Du.effectTag&=-3;break;case 6:uu(Du),Du.effectTag&=-3,su(Du.alternate,Du);break;case 1024:Du.effectTag&=-1025;break;case 1028:Du.effectTag&=-1025,su(Du.alternate,Du);break;case 4:su(Du.alternate,Du);break;case 8:lu(u,c=Du,l),iu(c)}Du=Du.nextEffect}}catch(e){if(null===Du)throw Error(a(330));ml(Du,e),Du=Du.nextEffect}}while(null!==Du);if(E=hn,x=fn(),w=E.focusedElem,l=E.selectionRange,x!==w&&w&&w.ownerDocument&&function e(t,n){return!(!t||!n)&&(t===n||(!t||3!==t.nodeType)&&(n&&3===n.nodeType?e(t,n.parentNode):"contains"in t?t.contains(n):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(n))))}(w.ownerDocument.documentElement,w)){null!==l&&dn(w)&&(x=l.start,void 0===(E=l.end)&&(E=x),"selectionStart"in w?(w.selectionStart=x,w.selectionEnd=Math.min(E,w.value.length)):(E=(x=w.ownerDocument||document)&&x.defaultView||window).getSelection&&(E=E.getSelection(),c=w.textContent.length,u=Math.min(l.start,c),l=void 0===l.end?u:Math.min(l.end,c),!E.extend&&u>l&&(c=l,l=u,u=c),c=cn(w,u),f=cn(w,l),c&&f&&(1!==E.rangeCount||E.anchorNode!==c.node||E.anchorOffset!==c.offset||E.focusNode!==f.node||E.focusOffset!==f.offset)&&((x=x.createRange()).setStart(c.node,c.offset),E.removeAllRanges(),u>l?(E.addRange(x),E.extend(f.node,f.offset)):(x.setEnd(f.node,f.offset),E.addRange(x))))),x=[];for(E=w;E=E.parentNode;)1===E.nodeType&&x.push({element:E,left:E.scrollLeft,top:E.scrollTop});for("function"==typeof w.focus&&w.focus(),w=0;w<x.length;w++)(E=x[w]).element.scrollLeft=E.left,E.element.scrollTop=E.top}Wt=!!pn,hn=pn=null,e.current=n,Du=o;do{try{for(w=e;null!==Du;){var _=Du.effectTag;if(36&_&&ru(w,Du.alternate,Du),128&_){x=void 0;var O=Du.ref;if(null!==O){var S=Du.stateNode;switch(Du.tag){case 5:x=S;break;default:x=S}"function"==typeof O?O(x):O.current=x}}Du=Du.nextEffect}}catch(e){if(null===Du)throw Error(a(330));ml(Du,e),Du=Du.nextEffect}}while(null!==Du);Du=null,Do(),xu=i}else e.current=n;if(Iu)Iu=!1,Ru=e,Bu=t;else for(Du=o;null!==Du;)t=Du.nextEffect,Du.nextEffect=null,Du=t;if(0===(t=e.firstPendingTime)&&(Nu=null),1073741823===t?e===zu?Hu++:(Hu=0,zu=e):Hu=0,"function"==typeof yl&&yl(n.stateNode,r),Xu(e),Lu)throw Lu=!1,e=Fu,Fu=null,e;return 0!=(8&xu)||Wo(),null}function dl(){for(;null!==Du;){var e=Du.effectTag;0!=(256&e)&&eu(Du.alternate,Du),0==(512&e)||Iu||(Iu=!0,zo(97,(function(){return pl(),null}))),Du=Du.nextEffect}}function pl(){if(90!==Bu){var e=97<Bu?97:Bu;return Bu=90,Ho(e,hl)}}function hl(){if(null===Ru)return!1;var e=Ru;if(Ru=null,0!=(48&xu))throw Error(a(331));var t=xu;for(xu|=32,e=e.current.firstEffect;null!==e;){try{var n=e;if(0!=(512&n.effectTag))switch(n.tag){case 0:case 11:case 15:case 22:tu(5,n),nu(5,n)}}catch(t){if(null===e)throw Error(a(330));ml(e,t)}n=e.nextEffect,e.nextEffect=null,e=n}return xu=t,Wo(),!0}function vl(e,t,n){ui(e,t=du(e,t=Ka(n,t),1073741823)),null!==(e=Yu(e,1073741823))&&Xu(e)}function ml(e,t){if(3===e.tag)vl(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){vl(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Nu||!Nu.has(r))){ui(n,e=pu(n,e=Ka(t,e),1073741823)),null!==(n=Yu(n,1073741823))&&Xu(n);break}}n=n.return}}function bl(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),Eu===e&&Ou===n?Su===wu||Su===yu&&1073741823===ku&&Ro()-Mu<500?el(e,Ou):Au=!0:jl(e,n)&&(0!==(t=e.lastPingedTime)&&t<n||(e.lastPingedTime=n,Xu(e)))}function gl(e,t){var n=e.stateNode;null!==n&&n.delete(t),0==(t=0)&&(t=$u(t=Wu(),e,null)),null!==(e=Yu(e,t))&&Xu(e)}hu=function(e,t,n){var r=t.expirationTime;if(null!==e){var o=t.pendingProps;if(e.memoizedProps!==o||co.current)Pa=!0;else{if(r<n){switch(Pa=!1,t.tag){case 3:Ia(t),Ca();break;case 5:if(Mi(t),4&t.mode&&1!==n&&o.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:ho(t.type)&&go(t);break;case 4:ji(t,t.stateNode.containerInfo);break;case 10:r=t.memoizedProps.value,o=t.type._context,uo(qo,o._currentValue),o._currentValue=r;break;case 13:if(null!==t.memoizedState)return 0!==(r=t.child.childExpirationTime)&&r>=n?za(e,t,n):(uo(Li,1&Li.current),null!==(t=Ga(e,t,n))?t.sibling:null);uo(Li,1&Li.current);break;case 19:if(r=t.childExpirationTime>=n,0!=(64&e.effectTag)){if(r)return $a(e,t,n);t.effectTag|=64}if(null!==(o=t.memoizedState)&&(o.rendering=null,o.tail=null),uo(Li,Li.current),!r)return null}return Ga(e,t,n)}Pa=!1}}else Pa=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,o=po(t,so.current),ti(t,n),o=Gi(null,t,r,e,o,n),t.effectTag|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,ho(r)){var i=!0;go(t)}else i=!1;t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,oi(t);var u=r.getDerivedStateFromProps;"function"==typeof u&&pi(t,r,u,e),o.updater=hi,t.stateNode=o,o._reactInternalFiber=t,gi(t,r,e,n),t=Na(null,t,r,!0,i,n)}else t.tag=0,Ta(null,t,o,n),t=t.child;return t;case 16:e:{if(o=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,function(e){if(-1===e._status){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}}(o),1!==o._status)throw o._result;switch(o=o._result,t.type=o,i=t.tag=function(e){if("function"==typeof e)return _l(e)?1:0;if(null!=e){if((e=e.$$typeof)===le)return 11;if(e===fe)return 14}return 2}(o),e=Yo(o,e),i){case 0:t=La(null,t,o,e,n);break e;case 1:t=Fa(null,t,o,e,n);break e;case 11:t=ja(null,t,o,e,n);break e;case 14:t=Aa(null,t,o,Yo(o.type,e),r,n);break e}throw Error(a(306,o,""))}return t;case 0:return r=t.type,o=t.pendingProps,La(e,t,r,o=t.elementType===r?o:Yo(r,o),n);case 1:return r=t.type,o=t.pendingProps,Fa(e,t,r,o=t.elementType===r?o:Yo(r,o),n);case 3:if(Ia(t),r=t.updateQueue,null===e||null===r)throw Error(a(282));if(r=t.pendingProps,o=null!==(o=t.memoizedState)?o.element:null,ii(e,t),si(t,r,null,n),(r=t.memoizedState.element)===o)Ca(),t=Ga(e,t,n);else{if((o=t.stateNode.hydrate)&&(ya=yn(t.stateNode.containerInfo.firstChild),ga=t,o=wa=!0),o)for(n=Oi(t,null,r,n),t.child=n;n;)n.effectTag=-3&n.effectTag|1024,n=n.sibling;else Ta(e,t,r,n),Ca();t=t.child}return t;case 5:return Mi(t),null===e&&_a(t),r=t.type,o=t.pendingProps,i=null!==e?e.memoizedProps:null,u=o.children,mn(r,o)?u=null:null!==i&&mn(r,i)&&(t.effectTag|=16),Da(e,t),4&t.mode&&1!==n&&o.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(Ta(e,t,u,n),t=t.child),t;case 6:return null===e&&_a(t),null;case 13:return za(e,t,n);case 4:return ji(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=_i(t,null,r,n):Ta(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,ja(e,t,r,o=t.elementType===r?o:Yo(r,o),n);case 7:return Ta(e,t,t.pendingProps,n),t.child;case 8:case 12:return Ta(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,o=t.pendingProps,u=t.memoizedProps,i=o.value;var l=t.type._context;if(uo(qo,l._currentValue),l._currentValue=i,null!==u)if(l=u.value,0==(i=Fr(l,i)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(l,i):1073741823))){if(u.children===o.children&&!co.current){t=Ga(e,t,n);break e}}else for(null!==(l=t.child)&&(l.return=t);null!==l;){var s=l.dependencies;if(null!==s){u=l.child;for(var c=s.firstContext;null!==c;){if(c.context===r&&0!=(c.observedBits&i)){1===l.tag&&((c=ai(n,null)).tag=2,ui(l,c)),l.expirationTime<n&&(l.expirationTime=n),null!==(c=l.alternate)&&c.expirationTime<n&&(c.expirationTime=n),ei(l.return,n),s.expirationTime<n&&(s.expirationTime=n);break}c=c.next}}else u=10===l.tag&&l.type===t.type?null:l.child;if(null!==u)u.return=l;else for(u=l;null!==u;){if(u===t){u=null;break}if(null!==(l=u.sibling)){l.return=u.return,u=l;break}u=u.return}l=u}Ta(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=(i=t.pendingProps).children,ti(t,n),r=r(o=ni(o,i.unstable_observedBits)),t.effectTag|=1,Ta(e,t,r,n),t.child;case 14:return i=Yo(o=t.type,t.pendingProps),Aa(e,t,o,i=Yo(o.type,i),r,n);case 15:return Ma(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Yo(r,o),null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,ho(r)?(e=!0,go(t)):e=!1,ti(t,n),mi(t,r,o),gi(t,r,o,n),Na(null,t,r,!0,e,n);case 19:return $a(e,t,n)}throw Error(a(156,t.tag))};var yl=null,wl=null;function xl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function El(e,t,n,r){return new xl(e,t,n,r)}function _l(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Ol(e,t){var n=e.alternate;return null===n?((n=El(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=e.childExpirationTime,n.expirationTime=e.expirationTime,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Sl(e,t,n,r,o,i){var u=2;if(r=e,"function"==typeof e)_l(e)&&(u=1);else if("string"==typeof e)u=5;else e:switch(e){case ne:return Cl(n.children,o,i,t);case ue:u=8,o|=7;break;case re:u=8,o|=1;break;case oe:return(e=El(12,n,t,8|o)).elementType=oe,e.type=oe,e.expirationTime=i,e;case se:return(e=El(13,n,t,o)).type=se,e.elementType=se,e.expirationTime=i,e;case ce:return(e=El(19,n,t,o)).elementType=ce,e.expirationTime=i,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ie:u=10;break e;case ae:u=9;break e;case le:u=11;break e;case fe:u=14;break e;case de:u=16,r=null;break e;case pe:u=22;break e}throw Error(a(130,null==e?e:typeof e,""))}return(t=El(u,n,t,o)).elementType=e,t.type=r,t.expirationTime=i,t}function Cl(e,t,n,r){return(e=El(7,e,r,t)).expirationTime=n,e}function kl(e,t,n){return(e=El(6,e,null,t)).expirationTime=n,e}function Pl(e,t,n){return(t=El(4,null!==e.children?e.children:[],e.key,t)).expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Tl(e,t,n){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=90,this.lastExpiredTime=this.lastPingedTime=this.nextKnownPendingLevel=this.lastSuspendedTime=this.firstSuspendedTime=this.firstPendingTime=0}function jl(e,t){var n=e.firstSuspendedTime;return e=e.lastSuspendedTime,0!==n&&n>=t&&e<=t}function Al(e,t){var n=e.firstSuspendedTime,r=e.lastSuspendedTime;n<t&&(e.firstSuspendedTime=t),(r>t||0===n)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function Ml(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var n=e.firstSuspendedTime;0!==n&&(t>=n?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function Dl(e,t){var n=e.lastExpiredTime;(0===n||n>t)&&(e.lastExpiredTime=t)}function Ll(e,t,n,r){var o=t.current,i=Wu(),u=fi.suspense;i=$u(i,o,u);e:if(n){t:{if(Qe(n=n._reactInternalFiber)!==n||1!==n.tag)throw Error(a(170));var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break t;case 1:if(ho(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break t}}l=l.return}while(null!==l);throw Error(a(171))}if(1===n.tag){var s=n.type;if(ho(s)){n=bo(n,s,l);break e}}n=l}else n=lo;return null===t.context?t.context=n:t.pendingContext=n,(t=ai(i,u)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),ui(o,t),Gu(o,i),i}function Fl(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function Nl(e,t){null!==(e=e.memoizedState)&&null!==e.dehydrated&&e.retryTime<t&&(e.retryTime=t)}function Il(e,t){Nl(e,t),(e=e.alternate)&&Nl(e,t)}function Rl(e,t,n){var r=new Tl(e,t,n=null!=n&&!0===n.hydrate),o=El(3,null,null,2===t?7:1===t?3:0);r.current=o,o.stateNode=r,oi(o),e[On]=r.current,n&&0!==t&&function(e,t){var n=Ke(t);Ot.forEach((function(e){dt(e,t,n)})),St.forEach((function(e){dt(e,t,n)}))}(0,9===e.nodeType?e:e.ownerDocument),this._internalRoot=r}function Bl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Ul(e,t,n,r,o){var i=n._reactRootContainer;if(i){var a=i._internalRoot;if("function"==typeof o){var u=o;o=function(){var e=Fl(a);u.call(e)}}Ll(t,a,e,o)}else{if(i=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new Rl(e,0,t?{hydrate:!0}:void 0)}(n,r),a=i._internalRoot,"function"==typeof o){var l=o;o=function(){var e=Fl(a);l.call(e)}}Zu((function(){Ll(t,a,e,o)}))}return Fl(a)}function Hl(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:te,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}function zl(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Bl(t))throw Error(a(200));return Hl(e,t,null,n)}Rl.prototype.render=function(e){Ll(e,this._internalRoot,null,null)},Rl.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Ll(null,e,null,(function(){t[On]=null}))},pt=function(e){if(13===e.tag){var t=Go(Wu(),150,100);Gu(e,t),Il(e,t)}},ht=function(e){13===e.tag&&(Gu(e,3),Il(e,3))},vt=function(e){if(13===e.tag){var t=Wu();Gu(e,t=$u(t,e,null)),Il(e,t)}},P=function(e,t,n){switch(t){case"input":if(Se(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Pn(r);if(!o)throw Error(a(90));xe(r),Se(r,o)}}}break;case"textarea":Me(e,n);break;case"select":null!=(t=n.value)&&Te(e,!!n.multiple,t,!1)}},L=Ju,F=function(e,t,n,r,o){var i=xu;xu|=4;try{return Ho(98,e.bind(null,t,n,r,o))}finally{0===(xu=i)&&Wo()}},N=function(){0==(49&xu)&&(function(){if(null!==Uu){var e=Uu;Uu=null,e.forEach((function(e,t){Dl(t,e),Xu(t)})),Wo()}}(),pl())},I=function(e,t){var n=xu;xu|=2;try{return e(t)}finally{0===(xu=n)&&Wo()}};var Vl,Wl,$l={Events:[Cn,kn,Pn,C,_,Fn,function(e){nt(e,Ln)},M,D,Xt,it,pl,{current:!1}]};Wl=(Vl={findFiberByHostInstance:Sn,bundleType:0,version:"16.13.1",rendererPackageName:"react-dom"}).findFiberByHostInstance,function(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);yl=function(e){try{t.onCommitFiberRoot(n,e,void 0,64==(64&e.current.effectTag))}catch(e){}},wl=function(e){try{t.onCommitFiberUnmount(n,e)}catch(e){}}}catch(e){}}(o({},Vl,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:K.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=et(e))?null:e.stateNode},findFiberByHostInstance:function(e){return Wl?Wl(e):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null})),t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$l,t.createPortal=zl,t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternalFiber;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw Error(a(268,Object.keys(e)))}return null===(e=et(t))?null:e.stateNode},t.flushSync=function(e,t){if(0!=(48&xu))throw Error(a(187));var n=xu;xu|=1;try{return Ho(99,e.bind(null,t))}finally{xu=n,Wo()}},t.hydrate=function(e,t,n){if(!Bl(t))throw Error(a(200));return Ul(null,e,t,!0,n)},t.render=function(e,t,n){if(!Bl(t))throw Error(a(200));return Ul(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Bl(e))throw Error(a(40));return!!e._reactRootContainer&&(Zu((function(){Ul(null,null,e,!1,(function(){e._reactRootContainer=null,e[On]=null}))})),!0)},t.unstable_batchedUpdates=Ju,t.unstable_createPortal=function(e,t){return zl(e,t,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)},t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Bl(n))throw Error(a(200));if(null==e||void 0===e._reactInternalFiber)throw Error(a(38));return Ul(e,t,n,!1,r)},t.version="16.13.1"},function(e,t,n){"use strict";e.exports=n(292)},function(e,t,n){"use strict";var r,o,i,a,u;if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,s=null,c=function(){if(null!==l)try{var e=t.unstable_now();l(!0,e),l=null}catch(e){throw setTimeout(c,0),e}},f=Date.now();t.unstable_now=function(){return Date.now()-f},r=function(e){null!==l?setTimeout(r,0,e):(l=e,setTimeout(c,0))},o=function(e,t){s=setTimeout(e,t)},i=function(){clearTimeout(s)},a=function(){return!1},u=t.unstable_forceFrameRate=function(){}}else{var d=window.performance,p=window.Date,h=window.setTimeout,v=window.clearTimeout;if("undefined"!=typeof console&&(window.cancelAnimationFrame,window.requestAnimationFrame),"object"==typeof d&&"function"==typeof d.now)t.unstable_now=function(){return d.now()};else{var m=p.now();t.unstable_now=function(){return p.now()-m}}var b=!1,g=null,y=-1,w=5,x=0;a=function(){return t.unstable_now()>=x},u=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e||(w=0<e?Math.floor(1e3/e):5)};var E=new MessageChannel,_=E.port2;E.port1.onmessage=function(){if(null!==g){var e=t.unstable_now();x=e+w;try{g(!0,e)?_.postMessage(null):(b=!1,g=null)}catch(e){throw _.postMessage(null),e}}else b=!1},r=function(e){g=e,b||(b=!0,_.postMessage(null))},o=function(e,n){y=h((function(){e(t.unstable_now())}),n)},i=function(){v(y),y=-1}}function O(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,o=e[r];if(!(void 0!==o&&0<k(o,t)))break e;e[r]=t,e[n]=o,n=r}}function S(e){return void 0===(e=e[0])?null:e}function C(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length;r<o;){var i=2*(r+1)-1,a=e[i],u=i+1,l=e[u];if(void 0!==a&&0>k(a,n))void 0!==l&&0>k(l,a)?(e[r]=l,e[u]=n,r=u):(e[r]=a,e[i]=n,r=i);else{if(!(void 0!==l&&0>k(l,n)))break e;e[r]=l,e[u]=n,r=u}}}return t}return null}function k(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var P=[],T=[],j=1,A=null,M=3,D=!1,L=!1,F=!1;function N(e){for(var t=S(T);null!==t;){if(null===t.callback)C(T);else{if(!(t.startTime<=e))break;C(T),t.sortIndex=t.expirationTime,O(P,t)}t=S(T)}}function I(e){if(F=!1,N(e),!L)if(null!==S(P))L=!0,r(R);else{var t=S(T);null!==t&&o(I,t.startTime-e)}}function R(e,n){L=!1,F&&(F=!1,i()),D=!0;var r=M;try{for(N(n),A=S(P);null!==A&&(!(A.expirationTime>n)||e&&!a());){var u=A.callback;if(null!==u){A.callback=null,M=A.priorityLevel;var l=u(A.expirationTime<=n);n=t.unstable_now(),"function"==typeof l?A.callback=l:A===S(P)&&C(P),N(n)}else C(P);A=S(P)}if(null!==A)var s=!0;else{var c=S(T);null!==c&&o(I,c.startTime-n),s=!1}return s}finally{A=null,M=r,D=!1}}function B(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var U=u;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){L||D||(L=!0,r(R))},t.unstable_getCurrentPriorityLevel=function(){return M},t.unstable_getFirstCallbackNode=function(){return S(P)},t.unstable_next=function(e){switch(M){case 1:case 2:case 3:var t=3;break;default:t=M}var n=M;M=t;try{return e()}finally{M=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=U,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=M;M=e;try{return t()}finally{M=n}},t.unstable_scheduleCallback=function(e,n,a){var u=t.unstable_now();if("object"==typeof a&&null!==a){var l=a.delay;l="number"==typeof l&&0<l?u+l:u,a="number"==typeof a.timeout?a.timeout:B(e)}else a=B(e),l=u;return e={id:j++,callback:n,priorityLevel:e,startTime:l,expirationTime:a=l+a,sortIndex:-1},l>u?(e.sortIndex=l,O(T,e),null===S(P)&&e===S(T)&&(F?i():F=!0,o(I,l-u))):(e.sortIndex=a,O(P,e),L||D||(L=!0,r(R))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();N(e);var n=S(P);return n!==A&&null!==A&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime<A.expirationTime||a()},t.unstable_wrapCallback=function(e){var t=M;return function(){var n=M;M=t;try{return e.apply(this,arguments)}finally{M=n}}}},,function(e,t,n){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function a(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=i(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=a(n[0]);r!==n[0]&&(t[n[0]]=r)}n=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),u=0;u<i.length;u++){var l=i[u];e=e.replace(new RegExp(l,"g"),t[l])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},function(e,t,n){"use strict";var r=n(298);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,l=r?Symbol.for("react.profiler"):60114,s=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,f=r?Symbol.for("react.async_mode"):60111,d=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,v=r?Symbol.for("react.suspense_list"):60120,m=r?Symbol.for("react.memo"):60115,b=r?Symbol.for("react.lazy"):60116,g=r?Symbol.for("react.block"):60121,y=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,x=r?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case f:case d:case a:case l:case u:case h:return e;default:switch(e=e&&e.$$typeof){case c:case p:case b:case m:case s:return e;default:return t}}case i:return t}}}function _(e){return E(e)===d}t.AsyncMode=f,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=s,t.Element=o,t.ForwardRef=p,t.Fragment=a,t.Lazy=b,t.Memo=m,t.Portal=i,t.Profiler=l,t.StrictMode=u,t.Suspense=h,t.isAsyncMode=function(e){return _(e)||E(e)===f},t.isConcurrentMode=_,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return E(e)===p},t.isFragment=function(e){return E(e)===a},t.isLazy=function(e){return E(e)===b},t.isMemo=function(e){return E(e)===m},t.isPortal=function(e){return E(e)===i},t.isProfiler=function(e){return E(e)===l},t.isStrictMode=function(e){return E(e)===u},t.isSuspense=function(e){return E(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===l||e===u||e===h||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===p||e.$$typeof===y||e.$$typeof===w||e.$$typeof===x||e.$$typeof===g)},t.typeOf=E},function(e,t,n){"use strict";var r=n(52),o=n(202),i=n(302),a=n(208);function u(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var l=u(n(205));l.Axios=i,l.create=function(e){return u(a(l.defaults,e))},l.Cancel=n(209),l.CancelToken=n(315),l.isCancel=n(204),l.all=function(e){return Promise.all(e)},l.spread=n(316),e.exports=l,e.exports.default=l},function(e,t,n){"use strict";var r=n(52),o=n(203),i=n(303),a=n(304),u=n(208);function l(e){this.defaults=e,this.interceptors={request:new i,response:new i}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=u(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},l.prototype.getUri=function(e){return e=u(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){l.prototype[e]=function(t,n){return this.request(r.merge(n||{},{method:e,url:t}))}})),r.forEach(["post","put","patch"],(function(e){l.prototype[e]=function(t,n,o){return this.request(r.merge(o||{},{method:e,url:t,data:n}))}})),e.exports=l},function(e,t,n){"use strict";var r=n(52);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},function(e,t,n){"use strict";var r=n(52),o=n(305),i=n(204),a=n(205);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return u(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return u(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(u(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},function(e,t,n){"use strict";var r=n(52);e.exports=function(e,t,n){return r.forEach(n,(function(n){e=n(e,t)})),e}},function(e,t,n){"use strict";var r=n(52);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},function(e,t,n){"use strict";var r=n(207);e.exports=function(e,t,n){var o=n.config.validateStatus;!o||o(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(310),o=n(311);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(52),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,a={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(a[t]&&o.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},function(e,t,n){"use strict";var r=n(52);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=r.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},function(e,t,n){"use strict";var r=n(52);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,o,i,a){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),!0===a&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";var r=n(209);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},,function(e,t,n){"use strict";t.__esModule=!0;var r=n(0),o=(a(r),a(n(21))),i=a(n(319));function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(n,r){e=n,t.forEach((function(t){return t(e,r)}))}}}a(n(179)),t.default=function(e,t){var n,a,f="__create-react-context-"+(0,i.default)()+"__",d=function(e){function n(){var t,r;u(this,n);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return t=r=l(this,e.call.apply(e,[this].concat(i))),r.emitter=c(r.props.value),l(r,t)}return s(n,e),n.prototype.getChildContext=function(){var e;return(e={})[f]=this.emitter,e},n.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n=this.props.value,r=e.value,o=void 0;((i=n)===(a=r)?0!==i||1/i==1/a:i!=i&&a!=a)?o=0:(o="function"==typeof t?t(n,r):1073741823,0!=(o|=0)&&this.emitter.set(e.value,o))}var i,a},n.prototype.render=function(){return this.props.children},n}(r.Component);d.childContextTypes=((n={})[f]=o.default.object.isRequired,n);var p=function(t){function n(){var e,r;u(this,n);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return e=r=l(this,t.call.apply(t,[this].concat(i))),r.state={value:r.getValue()},r.onUpdate=function(e,t){0!=((0|r.observedBits)&t)&&r.setState({value:r.getValue()})},l(r,e)}return s(n,t),n.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?1073741823:t},n.prototype.componentDidMount=function(){this.context[f]&&this.context[f].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?1073741823:e},n.prototype.componentWillUnmount=function(){this.context[f]&&this.context[f].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[f]?this.context[f].get():e},n.prototype.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(r.Component);return p.contextTypes=((a={})[f]=o.default.object,a),{Provider:d,Consumer:p}},e.exports=t.default},function(e,t,n){"use strict";(function(t){var n="__global_unique_id__";e.exports=function(){return t[n]=(t[n]||0)+1}}).call(this,n(81))},function(e,t,n){"use strict";var r;if(!Object.keys){var o=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=n(212),u=Object.prototype.propertyIsEnumerable,l=!u.call({toString:null},"toString"),s=u.call((function(){}),"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!d["$"+e]&&o.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{f(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();r=function(e){var t=null!==e&&"object"==typeof e,n="[object Function]"===i.call(e),r=a(e),u=t&&"[object String]"===i.call(e),d=[];if(!t&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var h=s&&n;if(u&&e.length>0&&!o.call(e,0))for(var v=0;v<e.length;++v)d.push(String(v));if(r&&e.length>0)for(var m=0;m<e.length;++m)d.push(String(m));else for(var b in e)h&&"prototype"===b||!o.call(e,b)||d.push(String(b));if(l)for(var g=function(e){if("undefined"==typeof window||!p)return f(e);try{return f(e)}catch(e){return!1}}(e),y=0;y<c.length;++y)g&&"constructor"===c[y]||!o.call(e,c[y])||d.push(c[y]);return d}}e.exports=r},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,o=Object.prototype.toString,i=function(e){return!(r&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===o.call(e)},a=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==o.call(e)&&"[object Function]"===o.call(e.callee)},u=function(){return i(arguments)}();i.isLegacyArguments=a,e.exports=u?i:a},function(e,t,n){"use strict";var r=n(105),o=n(213),i=n(214),a=n(215),u=n(327),l=o(a(),Object);r(l,{getPolyfill:a,implementation:i,shim:u}),e.exports=l},function(e,t,n){"use strict";var r="Function.prototype.bind called on incompatible ",o=Array.prototype.slice,i=Object.prototype.toString;e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==i.call(t))throw new TypeError(r+t);for(var n,a=o.call(arguments,1),u=function(){if(this instanceof n){var r=t.apply(this,a.concat(o.call(arguments)));return Object(r)===r?r:this}return t.apply(e,a.concat(o.call(arguments)))},l=Math.max(0,t.length-a.length),s=[],c=0;c<l;c++)s.push("$"+c);if(n=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(u),t.prototype){var f=function(){};f.prototype=t.prototype,n.prototype=new f,f.prototype=null}return n}},function(e,t,n){"use strict";var r=TypeError,o=Object.getOwnPropertyDescriptor;if(o)try{o({},"")}catch(e){o=null}var i=function(){throw new r},a=o?function(){try{return i}catch(e){try{return o(arguments,"callee").get}catch(e){return i}}}():i,u=n(325)(),l=Object.getPrototypeOf||function(e){return e.__proto__},s="undefined"==typeof Uint8Array?void 0:l(Uint8Array),c={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":u?l([][Symbol.iterator]()):void 0,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":void 0,"%AsyncFunctionPrototype%":void 0,"%AsyncGenerator%":void 0,"%AsyncGeneratorFunction%":void 0,"%AsyncGeneratorPrototype%":void 0,"%AsyncIteratorPrototype%":void 0,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?void 0:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?void 0:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?void 0:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":void 0,"%GeneratorFunction%":void 0,"%GeneratorPrototype%":void 0,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?void 0:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?void 0:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?void 0:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":u?l(l([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%JSONParse%":"object"==typeof JSON?JSON.parse:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&u?l((new Map)[Symbol.iterator]()):void 0,"%MapPrototype%":"undefined"==typeof Map?void 0:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%PromisePrototype%":"undefined"==typeof Promise?void 0:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?void 0:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?void 0:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?void 0:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?void 0:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&u?l((new Set)[Symbol.iterator]()):void 0,"%SetPrototype%":"undefined"==typeof Set?void 0:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":u?l(""[Symbol.iterator]()):void 0,"%StringPrototype%":String.prototype,"%Symbol%":u?Symbol:void 0,"%SymbolPrototype%":u?Symbol.prototype:void 0,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":a,"%TypedArray%":s,"%TypedArrayPrototype%":s?s.prototype:void 0,"%TypeError%":r,"%TypeErrorPrototype%":r.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?void 0:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?void 0:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?void 0:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?void 0:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?void 0:WeakSet.prototype},f=n(159).call(Function.call,String.prototype.replace),d=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,p=/\\(\\)?/g,h=function(e){var t=[];return f(e,d,(function(e,n,r,o){t[t.length]=r?f(o,p,"$1"):n||e})),t},v=function(e,t){if(!(e in c))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===c[e]&&!t)throw new r("intrinsic "+e+" exists, but is not available. Please file an issue!");return c[e]};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new TypeError('"allowMissing" argument must be a boolean');for(var n=h(e),i=v("%"+(n.length>0?n[0]:"")+"%",t),a=1;a<n.length;a+=1)if(null!=i)if(o&&a+1>=n.length){var u=o(i,n[a]);if(!t&&!(n[a]in i))throw new r("base intrinsic for "+e+" exists, but the property is not available.");i=u?u.get||u.value:i[n[a]]}else i=i[n[a]];return i}},function(e,t,n){"use strict";(function(t){var r=t.Symbol,o=n(326);e.exports=function(){return"function"==typeof r&&"function"==typeof Symbol&&"symbol"==typeof r("foo")&&"symbol"==typeof Symbol("bar")&&o()}}).call(this,n(81))},function(e,t,n){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},function(e,t,n){"use strict";var r=n(215),o=n(105);e.exports=function(){var e=r();return o(Object,{is:e},{is:function(){return Object.is!==e}}),e}},function(e,t,n){"use strict";var r=n(329),o=RegExp.prototype.exec,i=Object.getOwnPropertyDescriptor,a=Object.prototype.toString,u="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!u)return"[object RegExp]"===a.call(e);var t=i(e,"lastIndex");return!(!t||!r(t,"value"))&&function(e){try{var t=e.lastIndex;return e.lastIndex=0,o.call(e),!0}catch(e){return!1}finally{e.lastIndex=t}}(e)}},function(e,t,n){"use strict";var r=n(159);e.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},function(e,t,n){"use strict";var r=n(105),o=n(213),i=n(216),a=n(217),u=n(331),l=o(i);r(l,{getPolyfill:a,implementation:i,shim:u}),e.exports=l},function(e,t,n){"use strict";var r=n(105).supportsDescriptors,o=n(217),i=Object.getOwnPropertyDescriptor,a=Object.defineProperty,u=TypeError,l=Object.getPrototypeOf,s=/a/;e.exports=function(){if(!r||!l)throw new u("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=o(),t=l(s),n=i(t,"flags");return n&&n.get===e||a(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}},function(e,t,n){"use strict";var r=Date.prototype.getDay,o=Object.prototype.toString,i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){return"object"==typeof e&&null!==e&&(i?function(e){try{return r.call(e),!0}catch(e){return!1}}(e):"[object Date]"===o.call(e))}},,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AlphaPicker=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=l(n(0)),i=l(n(12)),a=n(22),u=l(n(464));function l(e){return e&&e.__esModule?e:{default:e}}var s=t.AlphaPicker=function(e){var t=e.rgb,n=e.hsl,u=e.width,l=e.height,s=e.onChange,c=e.direction,f=e.style,d=e.renderers,p=e.pointer,h=e.className,v=void 0===h?"":h,m=(0,i.default)({default:{picker:{position:"relative",width:u,height:l},alpha:{radius:"2px",style:f}}});return o.default.createElement("div",{style:m.picker,className:"alpha-picker "+v},o.default.createElement(a.Alpha,r({},m.alpha,{rgb:t,hsl:n,pointer:p,renderers:d,onChange:s,direction:c})))};s.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:u.default},t.default=(0,a.ColorWrap)(s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.flattenNames=void 0;var r=u(n(340)),o=u(n(160)),i=u(n(226)),a=u(n(75));function u(e){return e&&e.__esModule?e:{default:e}}var l=t.flattenNames=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=[];return(0,a.default)(t,(function(t){Array.isArray(t)?e(t).map((function(e){return n.push(e)})):(0,i.default)(t)?(0,o.default)(t,(function(e,t){!0===e&&n.push(t),n.push(t+"-"+e)})):(0,r.default)(t)&&n.push(t)})),n};t.default=l},function(e,t,n){var r=n(82),o=n(53),i=n(64);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},function(e,t,n){var r=n(106),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[u]=n:delete e[u]),o}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t){e.exports=function(e){return function(t,n,r){for(var o=-1,i=Object(t),a=r(t),u=a.length;u--;){var l=a[e?u:++o];if(!1===n(i[l],l,i))break}return t}}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(82),o=n(64);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(82),o=n(165),i=n(64),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!a[r(e)]}},function(e,t,n){var r=n(168),o=n(349),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t,n){var r=n(224)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(351),o=n(395),i=n(122),a=n(53),u=n(405);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?a(e)?o(e[0],e[1]):r(e):u(e)}},function(e,t,n){var r=n(352),o=n(394),i=n(237);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(123),o=n(229);e.exports=function(e,t,n,i){var a=n.length,u=a,l=!i;if(null==e)return!u;for(e=Object(e);a--;){var s=n[a];if(l&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++a<u;){var c=(s=n[a])[0],f=e[c],d=s[1];if(l&&s[2]){if(void 0===f&&!(c in e))return!1}else{var p=new r;if(i)var h=i(f,d,c,e,t,p);if(!(void 0===h?o(d,f,3,i,p):h))return!1}}return!0}},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(125),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0||(n==t.length-1?t.pop():o.call(t,n,1),--this.size,0))}},function(e,t,n){var r=n(125);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(125);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(125);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},function(e,t,n){var r=n(124);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(124),o=n(171),i=n(172);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(169),o=n(364),i=n(58),a=n(228),u=/^\[object .+?Constructor\]$/,l=Function.prototype,s=Object.prototype,c=l.toString,f=s.hasOwnProperty,d=RegExp("^"+c.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?d:u).test(a(e))}},function(e,t,n){var r,o=n(365),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},function(e,t,n){var r=n(60)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(368),o=n(124),i=n(171);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},function(e,t,n){var r=n(369),o=n(370),i=n(371),a=n(372),u=n(373);function l(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}l.prototype.clear=r,l.prototype.delete=o,l.prototype.get=i,l.prototype.has=a,l.prototype.set=u,e.exports=l},function(e,t,n){var r=n(126);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(126),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(126),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},function(e,t,n){var r=n(126);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,n){var r=n(127);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(127);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(127);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(127);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},function(e,t,n){var r=n(123),o=n(230),i=n(385),a=n(388),u=n(128),l=n(53),s=n(121),c=n(164),f="[object Object]",d=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,p,h,v){var m=l(e),b=l(t),g=m?"[object Array]":u(e),y=b?"[object Array]":u(t),w=(g="[object Arguments]"==g?f:g)==f,x=(y="[object Arguments]"==y?f:y)==f,E=g==y;if(E&&s(e)){if(!s(t))return!1;m=!0,w=!1}if(E&&!w)return v||(v=new r),m||c(e)?o(e,t,n,p,h,v):i(e,t,g,n,p,h,v);if(!(1&n)){var _=w&&d.call(e,"__wrapped__"),O=x&&d.call(t,"__wrapped__");if(_||O){var S=_?e.value():e,C=O?t.value():t;return v||(v=new r),h(S,C,n,p,v)}}return!!E&&(v||(v=new r),a(e,t,n,p,h,v))}},function(e,t,n){var r=n(172),o=n(381),i=n(382);function a(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}a.prototype.add=a.prototype.push=o,a.prototype.has=i,e.exports=a},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t){e.exports=function(e,t){return e.has(t)}},function(e,t,n){var r=n(106),o=n(231),i=n(108),a=n(230),u=n(386),l=n(387),s=r?r.prototype:void 0,c=s?s.valueOf:void 0;e.exports=function(e,t,n,r,s,f,d){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!f(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var p=u;case"[object Set]":var h=1&r;if(p||(p=l),e.size!=t.size&&!h)return!1;var v=d.get(e);if(v)return v==t;r|=2,d.set(e,t);var m=a(p(e),p(t),r,s,f,d);return d.delete(e),m;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t,n){var r=n(232),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,a,u){var l=1&n,s=r(e),c=s.length;if(c!=r(t).length&&!l)return!1;for(var f=c;f--;){var d=s[f];if(!(l?d in t:o.call(t,d)))return!1}var p=u.get(e);if(p&&u.get(t))return p==t;var h=!0;u.set(e,t),u.set(t,e);for(var v=l;++f<c;){var m=e[d=s[f]],b=t[d];if(i)var g=l?i(b,m,d,t,e,u):i(m,b,d,e,t,u);if(!(void 0===g?m===b||a(m,b,n,i,u):g)){h=!1;break}v||(v="constructor"==d)}if(h&&!v){var y=e.constructor,w=t.constructor;y==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof w&&w instanceof w||(h=!1)}return u.delete(e),u.delete(t),h}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var a=e[n];t(a,n,e)&&(i[o++]=a)}return i}},function(e,t,n){var r=n(83)(n(60),"DataView");e.exports=r},function(e,t,n){var r=n(83)(n(60),"Promise");e.exports=r},function(e,t,n){var r=n(83)(n(60),"Set");e.exports=r},function(e,t,n){var r=n(83)(n(60),"WeakMap");e.exports=r},function(e,t,n){var r=n(236),o=n(107);e.exports=function(e){for(var t=o(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,r(a)]}return t}},function(e,t,n){var r=n(229),o=n(396),i=n(402),a=n(174),u=n(236),l=n(237),s=n(130);e.exports=function(e,t){return a(e)&&u(t)?l(s(e),t):function(n){var a=o(n,e);return void 0===a&&a===t?i(n,e):r(t,a,3)}}},function(e,t,n){var r=n(238);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},function(e,t,n){var r=n(398),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=a},function(e,t,n){var r=n(399);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t,n){var r=n(172);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},function(e,t,n){var r=n(401);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){var r=n(106),o=n(227),i=n(53),a=n(129),u=r?r.prototype:void 0,l=u?u.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(a(t))return l?l.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},function(e,t,n){var r=n(403),o=n(404);e.exports=function(e,t){return null!=e&&o(e,t,r)}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(239),o=n(161),i=n(53),a=n(163),u=n(165),l=n(130);e.exports=function(e,t,n){for(var s=-1,c=(t=r(t,e)).length,f=!1;++s<c;){var d=l(t[s]);if(!(f=null!=e&&n(e,d)))break;e=e[d]}return f||++s!=c?f:!!(c=null==e?0:e.length)&&u(c)&&a(d,c)&&(i(e)||o(e))}},function(e,t,n){var r=n(406),o=n(407),i=n(174),a=n(130);e.exports=function(e){return i(e)?r(a(e)):o(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){var r=n(238);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(240),o=n(92);e.exports=function(e,t){var n=-1,i=o(e)?Array(e.length):[];return r(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}},function(e,t,n){var r=n(92);e.exports=function(e,t){return function(n,o){if(null==n)return n;if(!r(n))return e(n,o);for(var i=n.length,a=t?i:-1,u=Object(n);(t?a--:++a<i)&&!1!==o(u[a],a,u););return n}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeClasses=void 0;var r=a(n(160)),o=a(n(411)),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function a(e){return e&&e.__esModule?e:{default:e}}var u=t.mergeClasses=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.default&&(0,o.default)(e.default)||{};return t.map((function(t){var o=e[t];return o&&(0,r.default)(o,(function(e,t){n[t]||(n[t]={}),n[t]=i({},n[t],o[t])})),t})),n};t.default=u},function(e,t,n){var r=n(412);e.exports=function(e){return r(e,5)}},function(e,t,n){var r=n(123),o=n(241),i=n(242),a=n(413),u=n(414),l=n(244),s=n(245),c=n(417),f=n(418),d=n(232),p=n(419),h=n(128),v=n(420),m=n(421),b=n(248),g=n(53),y=n(121),w=n(426),x=n(58),E=n(428),_=n(107),O={};O["[object Arguments]"]=O["[object Array]"]=O["[object ArrayBuffer]"]=O["[object DataView]"]=O["[object Boolean]"]=O["[object Date]"]=O["[object Float32Array]"]=O["[object Float64Array]"]=O["[object Int8Array]"]=O["[object Int16Array]"]=O["[object Int32Array]"]=O["[object Map]"]=O["[object Number]"]=O["[object Object]"]=O["[object RegExp]"]=O["[object Set]"]=O["[object String]"]=O["[object Symbol]"]=O["[object Uint8Array]"]=O["[object Uint8ClampedArray]"]=O["[object Uint16Array]"]=O["[object Uint32Array]"]=!0,O["[object Error]"]=O["[object Function]"]=O["[object WeakMap]"]=!1,e.exports=function e(t,n,S,C,k,P){var T,j=1&n,A=2&n,M=4&n;if(S&&(T=k?S(t,C,k,P):S(t)),void 0!==T)return T;if(!x(t))return t;var D=g(t);if(D){if(T=v(t),!j)return s(t,T)}else{var L=h(t),F="[object Function]"==L||"[object GeneratorFunction]"==L;if(y(t))return l(t,j);if("[object Object]"==L||"[object Arguments]"==L||F&&!k){if(T=A||F?{}:b(t),!j)return A?f(t,u(T,t)):c(t,a(T,t))}else{if(!O[L])return k?t:{};T=m(t,L,j)}}P||(P=new r);var N=P.get(t);if(N)return N;P.set(t,T),E(t)?t.forEach((function(r){T.add(e(r,n,S,r,t,P))})):w(t)&&t.forEach((function(r,o){T.set(o,e(r,n,S,o,t,P))}));var I=M?A?p:d:A?keysIn:_,R=D?void 0:I(t);return o(R||t,(function(r,o){R&&(r=t[o=r]),i(T,o,e(r,n,S,o,t,P))})),T}},function(e,t,n){var r=n(109),o=n(107);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t,n){var r=n(109),o=n(131);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t,n){var r=n(58),o=n(168),i=n(416),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var u in e)("constructor"!=u||!t&&a.call(e,u))&&n.push(u);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t,n){var r=n(109),o=n(173);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t,n){var r=n(109),o=n(246);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t,n){var r=n(233),o=n(246),i=n(131);e.exports=function(e){return r(e,i,o)}},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},function(e,t,n){var r=n(176),o=n(422),i=n(423),a=n(424),u=n(247);e.exports=function(e,t,n){var l=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new l(+e);case"[object DataView]":return o(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return u(e,n);case"[object Map]":return new l;case"[object Number]":case"[object String]":return new l(e);case"[object RegExp]":return i(e);case"[object Set]":return new l;case"[object Symbol]":return a(e)}}},function(e,t,n){var r=n(176);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},function(e,t){var n=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},function(e,t,n){var r=n(106),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},function(e,t,n){var r=n(58),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},function(e,t,n){var r=n(427),o=n(166),i=n(167),a=i&&i.isMap,u=a?o(a):r;e.exports=u},function(e,t,n){var r=n(128),o=n(64);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},function(e,t,n){var r=n(429),o=n(166),i=n(167),a=i&&i.isSet,u=a?o(a):r;e.exports=u},function(e,t,n){var r=n(128),o=n(64);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.autoprefix=void 0;var r,o=(r=n(160))&&r.__esModule?r:{default:r},i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a={borderRadius:function(e){return{msBorderRadius:e,MozBorderRadius:e,OBorderRadius:e,WebkitBorderRadius:e,borderRadius:e}},boxShadow:function(e){return{msBoxShadow:e,MozBoxShadow:e,OBoxShadow:e,WebkitBoxShadow:e,boxShadow:e}},userSelect:function(e){return{WebkitTouchCallout:e,KhtmlUserSelect:e,MozUserSelect:e,msUserSelect:e,WebkitUserSelect:e,userSelect:e}},flex:function(e){return{WebkitBoxFlex:e,MozBoxFlex:e,WebkitFlex:e,msFlex:e,flex:e}},flexBasis:function(e){return{WebkitFlexBasis:e,flexBasis:e}},justifyContent:function(e){return{WebkitJustifyContent:e,justifyContent:e}},transition:function(e){return{msTransition:e,MozTransition:e,OTransition:e,WebkitTransition:e,transition:e}},transform:function(e){return{msTransform:e,MozTransform:e,OTransform:e,WebkitTransform:e,transform:e}},absolute:function(e){var t=e&&e.split(" ");return{position:"absolute",top:t&&t[0],right:t&&t[1],bottom:t&&t[2],left:t&&t[3]}},extend:function(e,t){return t[e]||{extend:e}}},u=t.autoprefix=function(e){var t={};return(0,o.default)(e,(function(e,n){var r={};(0,o.default)(e,(function(e,t){var n=a[t];n?r=i({},r,n(e)):r[t]=e})),t[n]=r})),t};t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hover=void 0;var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=(r=n(0))&&r.__esModule?r:{default:r};function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=t.hover=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"span";return function(n){function r(){var n,l,s;a(this,r);for(var c=arguments.length,f=Array(c),d=0;d<c;d++)f[d]=arguments[d];return l=s=u(this,(n=r.__proto__||Object.getPrototypeOf(r)).call.apply(n,[this].concat(f))),s.state={hover:!1},s.handleMouseOver=function(){return s.setState({hover:!0})},s.handleMouseOut=function(){return s.setState({hover:!1})},s.render=function(){return i.default.createElement(t,{onMouseOver:s.handleMouseOver,onMouseOut:s.handleMouseOut},i.default.createElement(e,o({},s.props,s.state)))},u(s,l)}return l(r,n),r}(i.default.Component)};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.active=void 0;var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=(r=n(0))&&r.__esModule?r:{default:r};function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=t.active=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"span";return function(n){function r(){var n,l,s;a(this,r);for(var c=arguments.length,f=Array(c),d=0;d<c;d++)f[d]=arguments[d];return l=s=u(this,(n=r.__proto__||Object.getPrototypeOf(r)).call.apply(n,[this].concat(f))),s.state={active:!1},s.handleMouseDown=function(){return s.setState({active:!0})},s.handleMouseUp=function(){return s.setState({active:!1})},s.render=function(){return i.default.createElement(t,{onMouseDown:s.handleMouseDown,onMouseUp:s.handleMouseUp},i.default.createElement(e,o({},s.props,s.state)))},u(s,l)}return l(r,n),r}(i.default.Component)};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n={},r=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];n[e]=t};return 0===e&&r("first-child"),e===t-1&&r("last-child"),(0===e||e%2==0)&&r("even"),1===Math.abs(e%2)&&r("odd"),r("nth-child",e),n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Alpha=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=c(i),u=c(n(12)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(435)),s=c(n(177));function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var p=t.Alpha=function(e){function t(){var e,n,r;f(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=d(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r.handleChange=function(e){var t=l.calculateChange(e,r.props.hsl,r.props.direction,r.props.a,r.container);t&&"function"==typeof r.props.onChange&&r.props.onChange(t,e)},r.handleMouseDown=function(e){r.handleChange(e),window.addEventListener("mousemove",r.handleChange),window.addEventListener("mouseup",r.handleMouseUp)},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleChange),window.removeEventListener("mouseup",r.handleMouseUp)},d(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var e=this,t=this.props.rgb,n=(0,u.default)({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+t.r+","+t.g+","+t.b+", 0) 0%,\n rgba("+t.r+","+t.g+","+t.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:100*t.a+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+t.r+","+t.g+","+t.b+", 0) 0%,\n rgba("+t.r+","+t.g+","+t.b+", 1) 100%)"},pointer:{left:0,top:100*t.a+"%"}},overwrite:r({},this.props.style)},{vertical:"vertical"===this.props.direction,overwrite:!0});return a.default.createElement("div",{style:n.alpha},a.default.createElement("div",{style:n.checkboard},a.default.createElement(s.default,{renderers:this.props.renderers})),a.default.createElement("div",{style:n.gradient}),a.default.createElement("div",{style:n.container,ref:function(t){return e.container=t},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},a.default.createElement("div",{style:n.pointer},this.props.pointer?a.default.createElement(this.props.pointer,this.props):a.default.createElement("div",{style:n.slider}))))}}]),t}(i.PureComponent||i.Component);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateChange=function(e,t,n,r,o){var i=o.clientWidth,a=o.clientHeight,u="number"==typeof e.pageX?e.pageX:e.touches[0].pageX,l="number"==typeof e.pageY?e.pageY:e.touches[0].pageY,s=u-(o.getBoundingClientRect().left+window.pageXOffset),c=l-(o.getBoundingClientRect().top+window.pageYOffset);if("vertical"===n){var f;if(f=c<0?0:c>a?1:Math.round(100*c/a)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var d;if(r!==(d=s<0?0:s>i?1:Math.round(100*s/i)/100))return{h:t.h,s:t.s,l:t.l,a:d,source:"rgb"}}return null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={},o=t.render=function(e,t,n,r){if("undefined"==typeof document&&!r)return null;var o=r?new r:document.createElement("canvas");o.width=2*n,o.height=2*n;var i=o.getContext("2d");return i?(i.fillStyle=e,i.fillRect(0,0,o.width,o.height),i.fillStyle=t,i.fillRect(0,0,n,n),i.translate(n,n),i.fillRect(0,0,n,n),o.toDataURL()):null};t.get=function(e,t,n,i){var a=e+"-"+t+"-"+n+(i?"-server":"");if(r[a])return r[a];var u=o(e,t,n,i);return r[a]=u,u}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditableInput=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),i=u(o),a=u(n(12));function u(e){return e&&e.__esModule?e:{default:e}}var l=[38,40],s=t.EditableInput=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.handleBlur=function(){n.state.blurValue&&n.setState({value:n.state.blurValue,blurValue:null})},n.handleChange=function(e){n.setUpdatedValue(e.target.value,e)},n.handleKeyDown=function(e){var t,r=function(e){return Number(String(e).replace(/%/g,""))}(e.target.value);if(!isNaN(r)&&(t=e.keyCode,l.indexOf(t)>-1)){var o=n.getArrowOffset(),i=38===e.keyCode?r+o:r-o;n.setUpdatedValue(i,e)}},n.handleDrag=function(e){if(n.props.dragLabel){var t=Math.round(n.props.value+e.movementX);t>=0&&t<=n.props.dragMax&&n.props.onChange&&n.props.onChange(n.getValueObjectWithLabel(t),e)}},n.handleMouseDown=function(e){n.props.dragLabel&&(e.preventDefault(),n.handleDrag(e),window.addEventListener("mousemove",n.handleDrag),window.addEventListener("mouseup",n.handleMouseUp))},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleDrag),window.removeEventListener("mouseup",n.handleMouseUp)},n.state={value:String(e.value).toUpperCase(),blurValue:String(e.value).toUpperCase()},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"componentDidUpdate",value:function(e,t){this.props.value===this.state.value||e.value===this.props.value&&t.value===this.state.value||(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(e){return function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},this.props.label,e)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||1}},{key:"setUpdatedValue",value:function(e,t){var n=this.props.label?this.getValueObjectWithLabel(e):e;this.props.onChange&&this.props.onChange(n,t),this.setState({value:e})}},{key:"render",value:function(){var e=this,t=(0,a.default)({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return i.default.createElement("div",{style:t.wrap},i.default.createElement("input",{style:t.input,ref:function(t){return e.input=t},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?i.default.createElement("span",{style:t.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),t}(o.PureComponent||o.Component);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hue=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),i=l(o),a=l(n(12)),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(439));function l(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var f=t.Hue=function(e){function t(){var e,n,r;s(this,t);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=c(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r.handleChange=function(e){var t=u.calculateChange(e,r.props.direction,r.props.hsl,r.container);t&&"function"==typeof r.props.onChange&&r.props.onChange(t,e)},r.handleMouseDown=function(e){r.handleChange(e),window.addEventListener("mousemove",r.handleChange),window.addEventListener("mouseup",r.handleMouseUp)},r.handleMouseUp=function(){r.unbindEventListeners()},c(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var e=this,t=this.props.direction,n=void 0===t?"horizontal":t,r=(0,a.default)({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:100*this.props.hsl.h/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-100*this.props.hsl.h/360+100+"%"}}},{vertical:"vertical"===n});return i.default.createElement("div",{style:r.hue},i.default.createElement("div",{className:"hue-"+n,style:r.container,ref:function(t){return e.container=t},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},i.default.createElement("style",null,"\n .hue-horizontal {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0\n 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to right, #f00 0%, #ff0\n 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n\n .hue-vertical {\n background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,\n #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,\n #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n "),i.default.createElement("div",{style:r.pointer},this.props.pointer?i.default.createElement(this.props.pointer,this.props):i.default.createElement("div",{style:r.slider}))))}}]),t}(o.PureComponent||o.Component);t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateChange=function(e,t,n,r){var o=r.clientWidth,i=r.clientHeight,a="number"==typeof e.pageX?e.pageX:e.touches[0].pageX,u="number"==typeof e.pageY?e.pageY:e.touches[0].pageY,l=a-(r.getBoundingClientRect().left+window.pageXOffset),s=u-(r.getBoundingClientRect().top+window.pageYOffset);if("vertical"===t){var c=void 0;if(c=s<0?359:s>i?0:360*(-100*s/i+100)/100,n.h!==c)return{h:c,s:n.s,l:n.l,a:n.a,source:"hsl"}}else{var f=void 0;if(f=l<0?0:l>o?359:100*l/o*360/100,n.h!==f)return{h:f,s:n.s,l:n.l,a:n.a,source:"hsl"}}return null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Raised=void 0;var r=u(n(0)),o=u(n(21)),i=u(n(12)),a=u(n(54));function u(e){return e&&e.__esModule?e:{default:e}}var l=t.Raised=function(e){var t=e.zDepth,n=e.radius,o=e.background,u=e.children,l=e.styles,s=void 0===l?{}:l,c=(0,i.default)((0,a.default)({default:{wrap:{position:"relative",display:"inline-block"},content:{position:"relative"},bg:{absolute:"0px 0px 0px 0px",boxShadow:"0 "+t+"px "+4*t+"px rgba(0,0,0,.24)",borderRadius:n,background:o}},"zDepth-0":{bg:{boxShadow:"none"}},"zDepth-1":{bg:{boxShadow:"0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)"}},"zDepth-2":{bg:{boxShadow:"0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)"}},"zDepth-3":{bg:{boxShadow:"0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)"}},"zDepth-4":{bg:{boxShadow:"0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)"}},"zDepth-5":{bg:{boxShadow:"0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)"}},square:{bg:{borderRadius:"0"}},circle:{bg:{borderRadius:"50%"}}},s),{"zDepth-1":1===t});return r.default.createElement("div",{style:c.wrap},r.default.createElement("div",{style:c.bg}),r.default.createElement("div",{style:c.content},u))};l.propTypes={background:o.default.string,zDepth:o.default.oneOf([0,1,2,3,4,5]),radius:o.default.number,styles:o.default.object},l.defaultProps={background:"#fff",zDepth:1,radius:2,styles:{}},t.default=l},function(e,t,n){var r=n(123),o=n(249),i=n(222),a=n(442),u=n(58),l=n(131),s=n(250);e.exports=function e(t,n,c,f,d){t!==n&&i(n,(function(i,l){if(d||(d=new r),u(i))a(t,n,l,c,e,f,d);else{var p=f?f(s(t,l),i,l+"",t,n,d):void 0;void 0===p&&(p=i),o(t,l,p)}}),l)}},function(e,t,n){var r=n(249),o=n(244),i=n(247),a=n(245),u=n(248),l=n(161),s=n(53),c=n(443),f=n(121),d=n(169),p=n(58),h=n(226),v=n(164),m=n(250),b=n(444);e.exports=function(e,t,n,g,y,w,x){var E=m(e,n),_=m(t,n),O=x.get(_);if(O)r(e,n,O);else{var S=w?w(E,_,n+"",e,t,x):void 0,C=void 0===S;if(C){var k=s(_),P=!k&&f(_),T=!k&&!P&&v(_);S=_,k||P||T?s(E)?S=E:c(E)?S=a(E):P?(C=!1,S=o(_,!0)):T?(C=!1,S=i(_,!0)):S=[]:h(_)||l(_)?(S=E,l(E)?S=b(E):p(E)&&!d(E)||(S=u(_))):C=!1}C&&(x.set(_,S),y(S,_,g,w,x),x.delete(_)),r(e,n,S)}}},function(e,t,n){var r=n(92),o=n(64);e.exports=function(e){return o(e)&&r(e)}},function(e,t,n){var r=n(109),o=n(131);e.exports=function(e){return r(e,o(e))}},function(e,t,n){var r=n(446),o=n(453);e.exports=function(e){return r((function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,u=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,u&&o(n[0],n[1],u)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var l=n[r];l&&e(t,l,r,a)}return t}))}},function(e,t,n){var r=n(122),o=n(447),i=n(449);e.exports=function(e,t){return i(o(e,t,r),e+"")}},function(e,t,n){var r=n(448),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,a=-1,u=o(i.length-t,0),l=Array(u);++a<u;)l[a]=i[t+a];a=-1;for(var s=Array(t+1);++a<t;)s[a]=i[a];return s[t]=n(l),r(e,this,s)}}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(450),o=n(452)(r);e.exports=o},function(e,t,n){var r=n(451),o=n(243),i=n(122),a=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=a},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t){var n=Date.now;e.exports=function(e){var t=0,r=0;return function(){var o=n(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(108),o=n(92),i=n(163),a=n(58);e.exports=function(e,t,n){if(!a(n))return!1;var u=typeof t;return!!("number"==u?o(n)&&i(t,n.length):"string"==u&&t in n)&&r(n[t],e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Saturation=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(0),i=s(o),a=s(n(12)),u=s(n(455)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(458));function s(e){return e&&e.__esModule?e:{default:e}}var c=t.Saturation=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleChange=function(e){"function"==typeof n.props.onChange&&n.throttle(n.props.onChange,l.calculateChange(e,n.props.hsl,n.container),e)},n.handleMouseDown=function(e){n.handleChange(e),window.addEventListener("mousemove",n.handleChange),window.addEventListener("mouseup",n.handleMouseUp)},n.handleMouseUp=function(){n.unbindEventListeners()},n.throttle=(0,u.default)((function(e,t,n){e(t,n)}),50),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"componentWillUnmount",value:function(){this.throttle.cancel(),this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var e=this,t=this.props.style||{},n=t.color,r=t.white,o=t.black,u=t.pointer,l=t.circle,s=(0,a.default)({default:{color:{absolute:"0px 0px 0px 0px",background:"hsl("+this.props.hsl.h+",100%, 50%)",borderRadius:this.props.radius},white:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},black:{absolute:"0px 0px 0px 0px",boxShadow:this.props.shadow,borderRadius:this.props.radius},pointer:{position:"absolute",top:-100*this.props.hsv.v+100+"%",left:100*this.props.hsv.s+"%",cursor:"default"},circle:{width:"4px",height:"4px",boxShadow:"0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),\n 0 0 1px 2px rgba(0,0,0,.4)",borderRadius:"50%",cursor:"hand",transform:"translate(-2px, -2px)"}},custom:{color:n,white:r,black:o,pointer:u,circle:l}},{custom:!!this.props.style});return i.default.createElement("div",{style:s.color,ref:function(t){return e.container=t},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},i.default.createElement("style",null,"\n .saturation-white {\n background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));\n background: linear-gradient(to right, #fff, rgba(255,255,255,0));\n }\n .saturation-black {\n background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));\n background: linear-gradient(to top, #000, rgba(0,0,0,0));\n }\n "),i.default.createElement("div",{style:s.white,className:"saturation-white"},i.default.createElement("div",{style:s.black,className:"saturation-black"}),i.default.createElement("div",{style:s.pointer},this.props.pointer?i.default.createElement(this.props.pointer,this.props):i.default.createElement("div",{style:s.circle}))))}}]),t}(o.PureComponent||o.Component);t.default=c},function(e,t,n){var r=n(251),o=n(58);e.exports=function(e,t,n){var i=!0,a=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return o(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),r(e,t,{leading:i,maxWait:t,trailing:a})}},function(e,t,n){var r=n(60);e.exports=function(){return r.Date.now()}},function(e,t,n){var r=n(58),o=n(129),i=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=u.test(e);return n||l.test(e)?s(e.slice(2),n?2:8):a.test(e)?NaN:+e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.calculateChange=function(e,t,n){var r=n.getBoundingClientRect(),o=r.width,i=r.height,a="number"==typeof e.pageX?e.pageX:e.touches[0].pageX,u="number"==typeof e.pageY?e.pageY:e.touches[0].pageY,l=a-(n.getBoundingClientRect().left+window.pageXOffset),s=u-(n.getBoundingClientRect().top+window.pageYOffset);l<0?l=0:l>o&&(l=o),s<0?s=0:s>i&&(s=i);var c=l/o,f=1-s/i;return{h:t.h,s:c,v:f,a:t.a,source:"hsv"}}},function(e,t,n){e.exports=n(460)},function(e,t,n){var r=n(241),o=n(240),i=n(225),a=n(53);e.exports=function(e,t){return(a(e)?r:o)(e,i(t))}},function(e,t,n){var r;!function(o){var i=/^\s+/,a=/\s+$/,u=0,l=o.round,s=o.min,c=o.max,f=o.random;function d(e,t){if(t=t||{},(e=e||"")instanceof d)return e;if(!(this instanceof d))return new d(e,t);var n=function(e){var t,n,r,u={r:0,g:0,b:0},l=1,f=null,d=null,p=null,h=!1,v=!1;return"string"==typeof e&&(e=function(e){e=e.replace(i,"").replace(a,"").toLowerCase();var t,n=!1;if(j[e])e=j[e],n=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=V.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=V.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=V.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=V.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=V.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=V.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=V.hex8.exec(e))?{r:F(t[1]),g:F(t[2]),b:F(t[3]),a:B(t[4]),format:n?"name":"hex8"}:(t=V.hex6.exec(e))?{r:F(t[1]),g:F(t[2]),b:F(t[3]),format:n?"name":"hex"}:(t=V.hex4.exec(e))?{r:F(t[1]+""+t[1]),g:F(t[2]+""+t[2]),b:F(t[3]+""+t[3]),a:B(t[4]+""+t[4]),format:n?"name":"hex8"}:!!(t=V.hex3.exec(e))&&{r:F(t[1]+""+t[1]),g:F(t[2]+""+t[2]),b:F(t[3]+""+t[3]),format:n?"name":"hex"}}(e)),"object"==typeof e&&(W(e.r)&&W(e.g)&&W(e.b)?(t=e.r,n=e.g,r=e.b,u={r:255*D(t,255),g:255*D(n,255),b:255*D(r,255)},h=!0,v="%"===String(e.r).substr(-1)?"prgb":"rgb"):W(e.h)&&W(e.s)&&W(e.v)?(f=I(e.s),d=I(e.v),u=function(e,t,n){e=6*D(e,360),t=D(t,100),n=D(n,100);var r=o.floor(e),i=e-r,a=n*(1-t),u=n*(1-i*t),l=n*(1-(1-i)*t),s=r%6;return{r:255*[n,u,a,a,l,n][s],g:255*[l,n,n,u,a,a][s],b:255*[a,a,l,n,n,u][s]}}(e.h,f,d),h=!0,v="hsv"):W(e.h)&&W(e.s)&&W(e.l)&&(f=I(e.s),p=I(e.l),u=function(e,t,n){var r,o,i;function a(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(e=D(e,360),t=D(t,100),n=D(n,100),0===t)r=o=i=n;else{var u=n<.5?n*(1+t):n+t-n*t,l=2*n-u;r=a(l,u,e+1/3),o=a(l,u,e),i=a(l,u,e-1/3)}return{r:255*r,g:255*o,b:255*i}}(e.h,f,p),h=!0,v="hsl"),e.hasOwnProperty("a")&&(l=e.a)),l=M(l),{ok:h,format:e.format||v,r:s(255,c(u.r,0)),g:s(255,c(u.g,0)),b:s(255,c(u.b,0)),a:l}}(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=l(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=l(this._r)),this._g<1&&(this._g=l(this._g)),this._b<1&&(this._b=l(this._b)),this._ok=n.ok,this._tc_id=u++}function p(e,t,n){e=D(e,255),t=D(t,255),n=D(n,255);var r,o,i=c(e,t,n),a=s(e,t,n),u=(i+a)/2;if(i==a)r=o=0;else{var l=i-a;switch(o=u>.5?l/(2-i-a):l/(i+a),i){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return{h:r,s:o,l:u}}function h(e,t,n){e=D(e,255),t=D(t,255),n=D(n,255);var r,o,i=c(e,t,n),a=s(e,t,n),u=i,l=i-a;if(o=0===i?0:l/i,i==a)r=0;else{switch(i){case e:r=(t-n)/l+(t<n?6:0);break;case t:r=(n-e)/l+2;break;case n:r=(e-t)/l+4}r/=6}return{h:r,s:o,v:u}}function v(e,t,n,r){var o=[N(l(e).toString(16)),N(l(t).toString(16)),N(l(n).toString(16))];return r&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function m(e,t,n,r){return[N(R(r)),N(l(e).toString(16)),N(l(t).toString(16)),N(l(n).toString(16))].join("")}function b(e,t){t=0===t?0:t||10;var n=d(e).toHsl();return n.s-=t/100,n.s=L(n.s),d(n)}function g(e,t){t=0===t?0:t||10;var n=d(e).toHsl();return n.s+=t/100,n.s=L(n.s),d(n)}function y(e){return d(e).desaturate(100)}function w(e,t){t=0===t?0:t||10;var n=d(e).toHsl();return n.l+=t/100,n.l=L(n.l),d(n)}function x(e,t){t=0===t?0:t||10;var n=d(e).toRgb();return n.r=c(0,s(255,n.r-l(-t/100*255))),n.g=c(0,s(255,n.g-l(-t/100*255))),n.b=c(0,s(255,n.b-l(-t/100*255))),d(n)}function E(e,t){t=0===t?0:t||10;var n=d(e).toHsl();return n.l-=t/100,n.l=L(n.l),d(n)}function _(e,t){var n=d(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,d(n)}function O(e){var t=d(e).toHsl();return t.h=(t.h+180)%360,d(t)}function S(e){var t=d(e).toHsl(),n=t.h;return[d(e),d({h:(n+120)%360,s:t.s,l:t.l}),d({h:(n+240)%360,s:t.s,l:t.l})]}function C(e){var t=d(e).toHsl(),n=t.h;return[d(e),d({h:(n+90)%360,s:t.s,l:t.l}),d({h:(n+180)%360,s:t.s,l:t.l}),d({h:(n+270)%360,s:t.s,l:t.l})]}function k(e){var t=d(e).toHsl(),n=t.h;return[d(e),d({h:(n+72)%360,s:t.s,l:t.l}),d({h:(n+216)%360,s:t.s,l:t.l})]}function P(e,t,n){t=t||6,n=n||30;var r=d(e).toHsl(),o=360/n,i=[d(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,i.push(d(r));return i}function T(e,t){t=t||6;for(var n=d(e).toHsv(),r=n.h,o=n.s,i=n.v,a=[],u=1/t;t--;)a.push(d({h:r,s:o,v:i})),i=(i+u)%1;return a}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,n,r=this.toRgb();return e=r.r/255,t=r.g/255,n=r.b/255,.2126*(e<=.03928?e/12.92:o.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:o.pow((t+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:o.pow((n+.055)/1.055,2.4))},setAlpha:function(e){return this._a=M(e),this._roundA=l(100*this._a)/100,this},toHsv:function(){var e=h(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=h(this._r,this._g,this._b),t=l(360*e.h),n=l(100*e.s),r=l(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=p(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=p(this._r,this._g,this._b),t=l(360*e.h),n=l(100*e.s),r=l(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return v(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,n,r,o){var i=[N(l(e).toString(16)),N(l(t).toString(16)),N(l(n).toString(16)),N(R(r))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*D(this._r,255))+"%",g:l(100*D(this._g,255))+"%",b:l(100*D(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*D(this._r,255))+"%, "+l(100*D(this._g,255))+"%, "+l(100*D(this._b,255))+"%)":"rgba("+l(100*D(this._r,255))+"%, "+l(100*D(this._g,255))+"%, "+l(100*D(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(A[v(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+m(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var o=d(e);n="#"+m(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0;return t||!r||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(w,arguments)},brighten:function(){return this._applyModification(x,arguments)},darken:function(){return this._applyModification(E,arguments)},desaturate:function(){return this._applyModification(b,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(_,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(P,arguments)},complement:function(){return this._applyCombination(O,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(S,arguments)},tetrad:function(){return this._applyCombination(C,arguments)}},d.fromRatio=function(e,t){if("object"==typeof e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]="a"===r?e[r]:I(e[r]));e=n}return d(e,t)},d.equals=function(e,t){return!(!e||!t)&&d(e).toRgbString()==d(t).toRgbString()},d.random=function(){return d.fromRatio({r:f(),g:f(),b:f()})},d.mix=function(e,t,n){n=0===n?0:n||50;var r=d(e).toRgb(),o=d(t).toRgb(),i=n/100;return d({r:(o.r-r.r)*i+r.r,g:(o.g-r.g)*i+r.g,b:(o.b-r.b)*i+r.b,a:(o.a-r.a)*i+r.a})},d.readability=function(e,t){var n=d(e),r=d(t);return(o.max(n.getLuminance(),r.getLuminance())+.05)/(o.min(n.getLuminance(),r.getLuminance())+.05)},d.isReadable=function(e,t,n){var r,o,i,a,u,l=d.readability(e,t);switch(o=!1,(i=n,"AA"!==(a=((i=i||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==a&&(a="AA"),"small"!==(u=(i.size||"small").toLowerCase())&&"large"!==u&&(u="small"),r={level:a,size:u}).level+r.size){case"AAsmall":case"AAAlarge":o=l>=4.5;break;case"AAlarge":o=l>=3;break;case"AAAsmall":o=l>=7}return o},d.mostReadable=function(e,t,n){var r,o,i,a,u=null,l=0;o=(n=n||{}).includeFallbackColors,i=n.level,a=n.size;for(var s=0;s<t.length;s++)(r=d.readability(e,t[s]))>l&&(l=r,u=d(t[s]));return d.isReadable(e,u,{level:i,size:a})||!o?u:(n.includeFallbackColors=!1,d.mostReadable(e,["#fff","#000"],n))};var j=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},A=d.hexNames=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}(j);function M(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function D(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var n=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=s(t,c(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),o.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function L(e){return s(1,c(0,e))}function F(e){return parseInt(e,16)}function N(e){return 1==e.length?"0"+e:""+e}function I(e){return e<=1&&(e=100*e+"%"),e}function R(e){return o.round(255*parseFloat(e)).toString(16)}function B(e){return F(e)/255}var U,H,z,V=(H="[\\s|\\(]+("+(U="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?",z="[\\s|\\(]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?",{CSS_UNIT:new RegExp(U),rgb:new RegExp("rgb"+H),rgba:new RegExp("rgba"+z),hsl:new RegExp("hsl"+H),hsla:new RegExp("hsla"+z),hsv:new RegExp("hsv"+H),hsva:new RegExp("hsva"+z),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function W(e){return!!V.CSS_UNIT.exec(e)}e.exports?e.exports=d:void 0===(r=function(){return d}.call(t,n,t,e))||(e.exports=r)}(Math)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Swatch=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=l(n(0)),i=l(n(12)),a=n(463),u=l(n(177));function l(e){return e&&e.__esModule?e:{default:e}}var s=t.Swatch=function(e){var t=e.color,n=e.style,a=e.onClick,l=void 0===a?function(){}:a,s=e.onHover,c=e.title,f=void 0===c?t:c,d=e.children,p=e.focus,h=e.focusStyle,v=void 0===h?{}:h,m="transparent"===t,b=(0,i.default)({default:{swatch:r({background:t,height:"100%",width:"100%",cursor:"pointer",position:"relative",outline:"none"},n,p?v:{})}}),g={};return s&&(g.onMouseOver=function(e){return s(t,e)}),o.default.createElement("div",r({style:b.swatch,onClick:function(e){return l(t,e)},title:f,tabIndex:0,onKeyDown:function(e){return 13===e.keyCode&&l(t,e)}},g),d,m&&o.default.createElement(u.default,{borderRadius:b.swatch.borderRadius,boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.1)"}))};t.default=(0,a.handleFocus)(s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleFocus=void 0;var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=(r=n(0))&&r.__esModule?r:{default:r};function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.handleFocus=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"span";return function(n){function r(){var e,t,n;u(this,r);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return t=n=l(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(i))),n.state={focus:!1},n.handleFocus=function(){return n.setState({focus:!0})},n.handleBlur=function(){return n.setState({focus:!1})},l(n,t)}return s(r,n),i(r,[{key:"render",value:function(){return a.default.createElement(t,{onFocus:this.handleFocus,onBlur:this.handleBlur},a.default.createElement(e,o({},this.props,this.state)))}}]),r}(a.default.Component)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AlphaPointer=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.AlphaPointer=function(e){var t=e.direction,n=(0,o.default)({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:"vertical"===t});return r.default.createElement("div",{style:n.picker})};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Block=void 0;var r=c(n(0)),o=c(n(21)),i=c(n(12)),a=c(n(54)),u=c(n(65)),l=n(22),s=c(n(466));function c(e){return e&&e.__esModule?e:{default:e}}var f=t.Block=function(e){var t=e.onChange,n=e.onSwatchHover,o=e.hex,c=e.colors,f=e.width,d=e.triangle,p=e.styles,h=void 0===p?{}:p,v=e.className,m=void 0===v?"":v,b="transparent"===o,g=function(e,n){u.default.isValidHex(e)&&t({hex:e,source:"hex"},n)},y=(0,i.default)((0,a.default)({default:{card:{width:f,background:"#fff",boxShadow:"0 1px rgba(0,0,0,.1)",borderRadius:"6px",position:"relative"},head:{height:"110px",background:o,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},body:{padding:"10px"},label:{fontSize:"18px",color:u.default.getContrastingColor(o),position:"relative"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 10px 10px 10px",borderColor:"transparent transparent "+o+" transparent",position:"absolute",top:"-10px",left:"50%",marginLeft:"-10px"},input:{width:"100%",fontSize:"12px",color:"#666",border:"0px",outline:"none",height:"22px",boxShadow:"inset 0 0 0 1px #ddd",borderRadius:"4px",padding:"0 7px",boxSizing:"border-box"}},"hide-triangle":{triangle:{display:"none"}}},h),{"hide-triangle":"hide"===d});return r.default.createElement("div",{style:y.card,className:"block-picker "+m},r.default.createElement("div",{style:y.triangle}),r.default.createElement("div",{style:y.head},b&&r.default.createElement(l.Checkboard,{borderRadius:"6px 6px 0 0"}),r.default.createElement("div",{style:y.label},o)),r.default.createElement("div",{style:y.body},r.default.createElement(s.default,{colors:c,onClick:g,onSwatchHover:n}),r.default.createElement(l.EditableInput,{style:{input:y.input},value:o,onChange:g})))};f.propTypes={width:o.default.oneOfType([o.default.string,o.default.number]),colors:o.default.arrayOf(o.default.string),triangle:o.default.oneOf(["top","hide"]),styles:o.default.object},f.defaultProps={width:170,colors:["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],triangle:"top",styles:{}},t.default=(0,l.ColorWrap)(f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockSwatches=void 0;var r=u(n(0)),o=u(n(12)),i=u(n(75)),a=n(22);function u(e){return e&&e.__esModule?e:{default:e}}var l=t.BlockSwatches=function(e){var t=e.colors,n=e.onClick,u=e.onSwatchHover,l=(0,o.default)({default:{swatches:{marginRight:"-10px"},swatch:{width:"22px",height:"22px",float:"left",marginRight:"10px",marginBottom:"10px",borderRadius:"4px"},clear:{clear:"both"}}});return r.default.createElement("div",{style:l.swatches},(0,i.default)(t,(function(e){return r.default.createElement(a.Swatch,{key:e,color:e,style:l.swatch,onClick:n,onHover:u,focusStyle:{boxShadow:"0 0 4px "+e}})})),r.default.createElement("div",{style:l.clear}))};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Circle=void 0;var r=f(n(0)),o=f(n(21)),i=f(n(12)),a=f(n(75)),u=f(n(54)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(253)),s=n(22),c=f(n(468));function f(e){return e&&e.__esModule?e:{default:e}}var d=t.Circle=function(e){var t=e.width,n=e.onChange,o=e.onSwatchHover,l=e.colors,s=e.hex,f=e.circleSize,d=e.styles,p=void 0===d?{}:d,h=e.circleSpacing,v=e.className,m=void 0===v?"":v,b=(0,i.default)((0,u.default)({default:{card:{width:t,display:"flex",flexWrap:"wrap",marginRight:-h,marginBottom:-h}}},p)),g=function(e,t){return n({hex:e,source:"hex"},t)};return r.default.createElement("div",{style:b.card,className:"circle-picker "+m},(0,a.default)(l,(function(e){return r.default.createElement(c.default,{key:e,color:e,onClick:g,onSwatchHover:o,active:s===e.toLowerCase(),circleSize:f,circleSpacing:h})})))};d.propTypes={width:o.default.oneOfType([o.default.string,o.default.number]),circleSize:o.default.number,circleSpacing:o.default.number,styles:o.default.object},d.defaultProps={width:252,circleSize:28,circleSpacing:14,colors:[l.red[500],l.pink[500],l.purple[500],l.deepPurple[500],l.indigo[500],l.blue[500],l.lightBlue[500],l.cyan[500],l.teal[500],l.green[500],l.lightGreen[500],l.lime[500],l.yellow[500],l.amber[500],l.orange[500],l.deepOrange[500],l.brown[500],l.blueGrey[500]],styles:{}},t.default=(0,s.ColorWrap)(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CircleSwatch=void 0;var r=u(n(0)),o=n(12),i=u(o),a=n(22);function u(e){return e&&e.__esModule?e:{default:e}}var l=t.CircleSwatch=function(e){var t=e.color,n=e.onClick,o=e.onSwatchHover,u=e.hover,l=e.active,s=e.circleSize,c=e.circleSpacing,f=(0,i.default)({default:{swatch:{width:s,height:s,marginRight:c,marginBottom:c,transform:"scale(1)",transition:"100ms transform ease"},Swatch:{borderRadius:"50%",background:"transparent",boxShadow:"inset 0 0 0 "+(s/2+1)+"px "+t,transition:"100ms box-shadow ease"}},hover:{swatch:{transform:"scale(1.2)"}},active:{Swatch:{boxShadow:"inset 0 0 0 3px "+t}}},{hover:u,active:l});return r.default.createElement("div",{style:f.swatch},r.default.createElement(a.Swatch,{style:f.Swatch,color:t,onClick:n,onHover:o,focusStyle:{boxShadow:f.Swatch.boxShadow+", 0 0 5px "+t}}))};l.defaultProps={circleSize:28,circleSpacing:14},t.default=(0,o.handleHover)(l)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Chrome=void 0;var r=f(n(0)),o=f(n(21)),i=f(n(12)),a=f(n(54)),u=n(22),l=f(n(470)),s=f(n(473)),c=f(n(474));function f(e){return e&&e.__esModule?e:{default:e}}var d=t.Chrome=function(e){var t=e.width,n=e.onChange,o=e.disableAlpha,f=e.rgb,d=e.hsl,p=e.hsv,h=e.hex,v=e.renderers,m=e.styles,b=void 0===m?{}:m,g=e.className,y=void 0===g?"":g,w=e.defaultView,x=(0,i.default)((0,a.default)({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+f.r+", "+f.g+", "+f.b+", "+f.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},b),{disableAlpha:o});return r.default.createElement("div",{style:x.picker,className:"chrome-picker "+y},r.default.createElement("div",{style:x.saturation},r.default.createElement(u.Saturation,{style:x.Saturation,hsl:d,hsv:p,pointer:c.default,onChange:n})),r.default.createElement("div",{style:x.body},r.default.createElement("div",{style:x.controls,className:"flexbox-fix"},r.default.createElement("div",{style:x.color},r.default.createElement("div",{style:x.swatch},r.default.createElement("div",{style:x.active}),r.default.createElement(u.Checkboard,{renderers:v}))),r.default.createElement("div",{style:x.toggles},r.default.createElement("div",{style:x.hue},r.default.createElement(u.Hue,{style:x.Hue,hsl:d,pointer:s.default,onChange:n})),r.default.createElement("div",{style:x.alpha},r.default.createElement(u.Alpha,{style:x.Alpha,rgb:f,hsl:d,pointer:s.default,renderers:v,onChange:n})))),r.default.createElement(l.default,{rgb:f,hsl:d,hex:h,view:w,onChange:n,disableAlpha:o})))};d.propTypes={width:o.default.oneOfType([o.default.string,o.default.number]),disableAlpha:o.default.bool,styles:o.default.object,defaultView:o.default.oneOf(["hex","rgb","hsl"])},d.defaultProps={width:225,disableAlpha:!1,styles:{}},t.default=(0,u.ColorWrap)(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChromeFields=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(0)),i=c(n(12)),a=c(n(65)),u=c(n(471)),l=n(22),s=c(n(472));function c(e){return e&&e.__esModule?e:{default:e}}var f=t.ChromeFields=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.toggleViews=function(){"hex"===n.state.view?n.setState({view:"rgb"}):"rgb"===n.state.view?n.setState({view:"hsl"}):"hsl"===n.state.view&&(1===n.props.hsl.a?n.setState({view:"hex"}):n.setState({view:"rgb"}))},n.handleChange=function(e,t){e.hex?a.default.isValidHex(e.hex)&&n.props.onChange({hex:e.hex,source:"hex"},t):e.r||e.g||e.b?n.props.onChange({r:e.r||n.props.rgb.r,g:e.g||n.props.rgb.g,b:e.b||n.props.rgb.b,source:"rgb"},t):e.a?(e.a<0?e.a=0:e.a>1&&(e.a=1),n.props.onChange({h:n.props.hsl.h,s:n.props.hsl.s,l:n.props.hsl.l,a:Math.round(100*e.a)/100,source:"rgb"},t)):(e.h||e.s||e.l)&&("string"==typeof e.s&&e.s.includes("%")&&(e.s=e.s.replace("%","")),"string"==typeof e.l&&e.l.includes("%")&&(e.l=e.l.replace("%","")),1==e.s?e.s=.01:1==e.l&&(e.l=.01),n.props.onChange({h:e.h||n.props.hsl.h,s:Number((0,u.default)(e.s)?n.props.hsl.s:e.s),l:Number((0,u.default)(e.l)?n.props.hsl.l:e.l),source:"hsl"},t))},n.showHighlight=function(e){e.currentTarget.style.background="#eee"},n.hideHighlight=function(e){e.currentTarget.style.background="transparent"},1!==e.hsl.a&&"hex"===e.view?n.state={view:"rgb"}:n.state={view:e.view},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"render",value:function(){var e=this,t=(0,i.default)({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),n=void 0;return"hex"===this.state.view?n=o.default.createElement("div",{style:t.fields,className:"flexbox-fix"},o.default.createElement("div",{style:t.field},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):"rgb"===this.state.view?n=o.default.createElement("div",{style:t.fields,className:"flexbox-fix"},o.default.createElement("div",{style:t.field},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),o.default.createElement("div",{style:t.field},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),o.default.createElement("div",{style:t.field},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),o.default.createElement("div",{style:t.alpha},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):"hsl"===this.state.view&&(n=o.default.createElement("div",{style:t.fields,className:"flexbox-fix"},o.default.createElement("div",{style:t.field},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),o.default.createElement("div",{style:t.field},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"s",value:Math.round(100*this.props.hsl.s)+"%",onChange:this.handleChange})),o.default.createElement("div",{style:t.field},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"l",value:Math.round(100*this.props.hsl.l)+"%",onChange:this.handleChange})),o.default.createElement("div",{style:t.alpha},o.default.createElement(l.EditableInput,{style:{input:t.input,label:t.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),o.default.createElement("div",{style:t.wrap,className:"flexbox-fix"},n,o.default.createElement("div",{style:t.toggle},o.default.createElement("div",{style:t.icon,onClick:this.toggleViews,ref:function(t){return e.icon=t}},o.default.createElement(s.default,{style:t.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return 1!==e.hsl.a&&"hex"===t.view?{view:"rgb"}:null}}]),t}(o.default.Component);f.defaultProps={view:"hex"},t.default=f},function(e,t){e.exports=function(e){return void 0===e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=(r=n(0))&&r.__esModule?r:{default:r};t.default=function(e){var t=e.fill,n=void 0===t?"currentColor":t,r=e.width,a=void 0===r?24:r,u=e.height,l=void 0===u?24:u,s=e.style,c=void 0===s?{}:s,f=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["fill","width","height","style"]);return i.default.createElement("svg",o({viewBox:"0 0 24 24",style:o({fill:n,width:a,height:l},c)},f),i.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChromePointer=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.ChromePointer=function(){var e=(0,o.default)({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return r.default.createElement("div",{style:e.picker})};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChromePointerCircle=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.ChromePointerCircle=function(){var e=(0,o.default)({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return r.default.createElement("div",{style:e.picker})};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Compact=void 0;var r=d(n(0)),o=d(n(21)),i=d(n(12)),a=d(n(75)),u=d(n(54)),l=d(n(65)),s=n(22),c=d(n(476)),f=d(n(477));function d(e){return e&&e.__esModule?e:{default:e}}var p=t.Compact=function(e){var t=e.onChange,n=e.onSwatchHover,o=e.colors,d=e.hex,p=e.rgb,h=e.styles,v=void 0===h?{}:h,m=e.className,b=void 0===m?"":m,g=(0,i.default)((0,u.default)({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},v)),y=function(e,n){e.hex?l.default.isValidHex(e.hex)&&t({hex:e.hex,source:"hex"},n):t(e,n)};return r.default.createElement(s.Raised,{style:g.Compact,styles:v},r.default.createElement("div",{style:g.compact,className:"compact-picker "+b},r.default.createElement("div",null,(0,a.default)(o,(function(e){return r.default.createElement(c.default,{key:e,color:e,active:e.toLowerCase()===d,onClick:y,onSwatchHover:n})})),r.default.createElement("div",{style:g.clear})),r.default.createElement(f.default,{hex:d,rgb:p,onChange:y})))};p.propTypes={colors:o.default.arrayOf(o.default.string),styles:o.default.object},p.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}},t.default=(0,s.ColorWrap)(p)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompactColor=void 0;var r=u(n(0)),o=u(n(12)),i=u(n(65)),a=n(22);function u(e){return e&&e.__esModule?e:{default:e}}var l=t.CompactColor=function(e){var t=e.color,n=e.onClick,u=void 0===n?function(){}:n,l=e.onSwatchHover,s=e.active,c=(0,o.default)({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:i.default.getContrastingColor(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:s,"color-#FFFFFF":"#FFFFFF"===t,transparent:"transparent"===t});return r.default.createElement(a.Swatch,{style:c.color,color:t,onClick:u,onHover:l,focusStyle:{boxShadow:"0 0 4px "+t}},r.default.createElement("div",{style:c.dot}))};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CompactFields=void 0;var r=a(n(0)),o=a(n(12)),i=n(22);function a(e){return e&&e.__esModule?e:{default:e}}var u=t.CompactFields=function(e){var t=e.hex,n=e.rgb,a=e.onChange,u=(0,o.default)({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),l=function(e,t){e.r||e.g||e.b?a({r:e.r||n.r,g:e.g||n.g,b:e.b||n.b,source:"rgb"},t):a({hex:e.hex,source:"hex"},t)};return r.default.createElement("div",{style:u.fields,className:"flexbox-fix"},r.default.createElement("div",{style:u.active}),r.default.createElement(i.EditableInput,{style:{wrap:u.HEXwrap,input:u.HEXinput,label:u.HEXlabel},label:"hex",value:t,onChange:l}),r.default.createElement(i.EditableInput,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"r",value:n.r,onChange:l}),r.default.createElement(i.EditableInput,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"g",value:n.g,onChange:l}),r.default.createElement(i.EditableInput,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"b",value:n.b,onChange:l}))};t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Github=void 0;var r=c(n(0)),o=c(n(21)),i=c(n(12)),a=c(n(75)),u=c(n(54)),l=n(22),s=c(n(479));function c(e){return e&&e.__esModule?e:{default:e}}var f=t.Github=function(e){var t=e.width,n=e.colors,o=e.onChange,l=e.onSwatchHover,c=e.triangle,f=e.styles,d=void 0===f?{}:f,p=e.className,h=void 0===p?"":p,v=(0,i.default)((0,u.default)({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},d),{"hide-triangle":"hide"===c,"top-left-triangle":"top-left"===c,"top-right-triangle":"top-right"===c,"bottom-left-triangle":"bottom-left"===c,"bottom-right-triangle":"bottom-right"===c}),m=function(e,t){return o({hex:e,source:"hex"},t)};return r.default.createElement("div",{style:v.card,className:"github-picker "+h},r.default.createElement("div",{style:v.triangleShadow}),r.default.createElement("div",{style:v.triangle}),(0,a.default)(n,(function(e){return r.default.createElement(s.default,{color:e,key:e,onClick:m,onSwatchHover:l})})))};f.propTypes={width:o.default.oneOfType([o.default.string,o.default.number]),colors:o.default.arrayOf(o.default.string),triangle:o.default.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:o.default.object},f.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}},t.default=(0,l.ColorWrap)(f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GithubSwatch=void 0;var r=u(n(0)),o=n(12),i=u(o),a=n(22);function u(e){return e&&e.__esModule?e:{default:e}}var l=t.GithubSwatch=function(e){var t=e.hover,n=e.color,o=e.onClick,u=e.onSwatchHover,l={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},s=(0,i.default)({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:l}},{hover:t});return r.default.createElement("div",{style:s.swatch},r.default.createElement(a.Swatch,{color:n,onClick:o,onHover:u,focusStyle:l}))};t.default=(0,o.handleHover)(l)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HuePicker=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=c(n(0)),i=c(n(21)),a=c(n(12)),u=c(n(54)),l=n(22),s=c(n(481));function c(e){return e&&e.__esModule?e:{default:e}}var f=t.HuePicker=function(e){var t=e.width,n=e.height,i=e.onChange,s=e.hsl,c=e.direction,f=e.pointer,d=e.styles,p=void 0===d?{}:d,h=e.className,v=void 0===h?"":h,m=(0,a.default)((0,u.default)({default:{picker:{position:"relative",width:t,height:n},hue:{radius:"2px"}}},p));return o.default.createElement("div",{style:m.picker,className:"hue-picker "+v},o.default.createElement(l.Hue,r({},m.hue,{hsl:s,pointer:f,onChange:function(e){return i({a:1,h:e.h,l:.5,s:1})},direction:c})))};f.propTypes={styles:i.default.object},f.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:s.default,styles:{}},t.default=(0,l.ColorWrap)(f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SliderPointer=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.SliderPointer=function(e){var t=e.direction,n=(0,o.default)({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:"vertical"===t});return r.default.createElement("div",{style:n.picker})};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Material=void 0;var r=l(n(0)),o=l(n(12)),i=l(n(54)),a=l(n(65)),u=n(22);function l(e){return e&&e.__esModule?e:{default:e}}var s=t.Material=function(e){var t=e.onChange,n=e.hex,l=e.rgb,s=e.styles,c=void 0===s?{}:s,f=e.className,d=void 0===f?"":f,p=(0,o.default)((0,i.default)({default:{material:{width:"98px",height:"98px",padding:"16px",fontFamily:"Roboto"},HEXwrap:{position:"relative"},HEXinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"2px solid "+n,outline:"none",height:"30px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},Hex:{style:{}},RGBwrap:{position:"relative"},RGBinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"1px solid #eee",outline:"none",height:"30px"},RGBlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},split:{display:"flex",marginRight:"-10px",paddingTop:"11px"},third:{flex:"1",paddingRight:"10px"}}},c)),h=function(e,n){e.hex?a.default.isValidHex(e.hex)&&t({hex:e.hex,source:"hex"},n):(e.r||e.g||e.b)&&t({r:e.r||l.r,g:e.g||l.g,b:e.b||l.b,source:"rgb"},n)};return r.default.createElement(u.Raised,{styles:c},r.default.createElement("div",{style:p.material,className:"material-picker "+d},r.default.createElement(u.EditableInput,{style:{wrap:p.HEXwrap,input:p.HEXinput,label:p.HEXlabel},label:"hex",value:n,onChange:h}),r.default.createElement("div",{style:p.split,className:"flexbox-fix"},r.default.createElement("div",{style:p.third},r.default.createElement(u.EditableInput,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"r",value:l.r,onChange:h})),r.default.createElement("div",{style:p.third},r.default.createElement(u.EditableInput,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"g",value:l.g,onChange:h})),r.default.createElement("div",{style:p.third},r.default.createElement(u.EditableInput,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"b",value:l.b,onChange:h})))))};t.default=(0,u.ColorWrap)(s)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Photoshop=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=h(n(0)),i=h(n(21)),a=h(n(12)),u=h(n(54)),l=n(22),s=h(n(484)),c=h(n(485)),f=h(n(486)),d=h(n(487)),p=h(n(488));function h(e){return e&&e.__esModule?e:{default:e}}var v=t.Photoshop=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.state={currentColor:e.hex},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"render",value:function(){var e=this.props,t=e.styles,n=void 0===t?{}:t,r=e.className,i=void 0===r?"":r,h=(0,a.default)((0,u.default)({default:{picker:{background:"#DCDCDC",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15)",boxSizing:"initial",width:"513px"},head:{backgroundImage:"linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%)",borderBottom:"1px solid #B1B1B1",boxShadow:"inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02)",height:"23px",lineHeight:"24px",borderRadius:"4px 4px 0 0",fontSize:"13px",color:"#4D4D4D",textAlign:"center"},body:{padding:"15px 15px 0",display:"flex"},saturation:{width:"256px",height:"256px",position:"relative",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0",overflow:"hidden"},hue:{position:"relative",height:"256px",width:"19px",marginLeft:"10px",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0"},controls:{width:"180px",marginLeft:"10px"},top:{display:"flex"},previews:{width:"60px"},actions:{flex:"1",marginLeft:"20px"}}},n));return o.default.createElement("div",{style:h.picker,className:"photoshop-picker "+i},o.default.createElement("div",{style:h.head},this.props.header),o.default.createElement("div",{style:h.body,className:"flexbox-fix"},o.default.createElement("div",{style:h.saturation},o.default.createElement(l.Saturation,{hsl:this.props.hsl,hsv:this.props.hsv,pointer:c.default,onChange:this.props.onChange})),o.default.createElement("div",{style:h.hue},o.default.createElement(l.Hue,{direction:"vertical",hsl:this.props.hsl,pointer:f.default,onChange:this.props.onChange})),o.default.createElement("div",{style:h.controls},o.default.createElement("div",{style:h.top,className:"flexbox-fix"},o.default.createElement("div",{style:h.previews},o.default.createElement(p.default,{rgb:this.props.rgb,currentColor:this.state.currentColor})),o.default.createElement("div",{style:h.actions},o.default.createElement(d.default,{label:"OK",onClick:this.props.onAccept,active:!0}),o.default.createElement(d.default,{label:"Cancel",onClick:this.props.onCancel}),o.default.createElement(s.default,{onChange:this.props.onChange,rgb:this.props.rgb,hsv:this.props.hsv,hex:this.props.hex}))))))}}]),t}(o.default.Component);v.propTypes={header:i.default.string,styles:i.default.object},v.defaultProps={header:"Color Picker",styles:{}},t.default=(0,l.ColorWrap)(v)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PhotoshopPicker=void 0;var r=u(n(0)),o=u(n(12)),i=u(n(65)),a=n(22);function u(e){return e&&e.__esModule?e:{default:e}}var l=t.PhotoshopPicker=function(e){var t=e.onChange,n=e.rgb,u=e.hsv,l=e.hex,s=(0,o.default)({default:{fields:{paddingTop:"5px",paddingBottom:"9px",width:"80px",position:"relative"},divider:{height:"5px"},RGBwrap:{position:"relative"},RGBinput:{marginLeft:"40%",width:"40%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"5px",fontSize:"13px",paddingLeft:"3px",marginRight:"10px"},RGBlabel:{left:"0px",width:"34px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px",position:"absolute"},HEXwrap:{position:"relative"},HEXinput:{marginLeft:"20%",width:"80%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"6px",fontSize:"13px",paddingLeft:"3px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",width:"14px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px"},fieldSymbols:{position:"absolute",top:"5px",right:"-7px",fontSize:"13px"},symbol:{height:"20px",lineHeight:"22px",paddingBottom:"7px"}}}),c=function(e,r){e["#"]?i.default.isValidHex(e["#"])&&t({hex:e["#"],source:"hex"},r):e.r||e.g||e.b?t({r:e.r||n.r,g:e.g||n.g,b:e.b||n.b,source:"rgb"},r):(e.h||e.s||e.v)&&t({h:e.h||u.h,s:e.s||u.s,v:e.v||u.v,source:"hsv"},r)};return r.default.createElement("div",{style:s.fields},r.default.createElement(a.EditableInput,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"h",value:Math.round(u.h),onChange:c}),r.default.createElement(a.EditableInput,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"s",value:Math.round(100*u.s),onChange:c}),r.default.createElement(a.EditableInput,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"v",value:Math.round(100*u.v),onChange:c}),r.default.createElement("div",{style:s.divider}),r.default.createElement(a.EditableInput,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:n.r,onChange:c}),r.default.createElement(a.EditableInput,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:n.g,onChange:c}),r.default.createElement(a.EditableInput,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:n.b,onChange:c}),r.default.createElement("div",{style:s.divider}),r.default.createElement(a.EditableInput,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"#",value:l.replace("#",""),onChange:c}),r.default.createElement("div",{style:s.fieldSymbols},r.default.createElement("div",{style:s.symbol},"°"),r.default.createElement("div",{style:s.symbol},"%"),r.default.createElement("div",{style:s.symbol},"%")))};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PhotoshopPointerCircle=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.PhotoshopPointerCircle=function(e){var t=e.hsl,n=(0,o.default)({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}},"black-outline":{picker:{boxShadow:"inset 0 0 0 1px #000"}}},{"black-outline":t.l>.5});return r.default.createElement("div",{style:n.picker})};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PhotoshopPointerCircle=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.PhotoshopPointerCircle=function(){var e=(0,o.default)({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return r.default.createElement("div",{style:e.pointer},r.default.createElement("div",{style:e.left},r.default.createElement("div",{style:e.leftInside})),r.default.createElement("div",{style:e.right},r.default.createElement("div",{style:e.rightInside})))};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PhotoshopButton=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.PhotoshopButton=function(e){var t=e.onClick,n=e.label,i=e.children,a=e.active,u=(0,o.default)({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:a});return r.default.createElement("div",{style:u.button,onClick:t},n||i)};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PhotoshopPreviews=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.PhotoshopPreviews=function(e){var t=e.rgb,n=e.currentColor,i=(0,o.default)({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:n,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return r.default.createElement("div",null,r.default.createElement("div",{style:i.label},"new"),r.default.createElement("div",{style:i.swatches},r.default.createElement("div",{style:i.new}),r.default.createElement("div",{style:i.current})),r.default.createElement("div",{style:i.label},"current"))};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sketch=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=f(n(0)),i=f(n(21)),a=f(n(12)),u=f(n(54)),l=n(22),s=f(n(490)),c=f(n(491));function f(e){return e&&e.__esModule?e:{default:e}}var d=t.Sketch=function(e){var t=e.width,n=e.rgb,i=e.hex,f=e.hsv,d=e.hsl,p=e.onChange,h=e.onSwatchHover,v=e.disableAlpha,m=e.presetColors,b=e.renderers,g=e.styles,y=void 0===g?{}:g,w=e.className,x=void 0===w?"":w,E=(0,a.default)((0,u.default)({default:r({picker:{width:t,padding:"10px 10px 0",boxSizing:"initial",background:"#fff",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)"},saturation:{width:"100%",paddingBottom:"75%",position:"relative",overflow:"hidden"},Saturation:{radius:"3px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},controls:{display:"flex"},sliders:{padding:"4px 0",flex:"1"},color:{width:"24px",height:"24px",position:"relative",marginTop:"4px",marginLeft:"4px",borderRadius:"3px"},activeColor:{absolute:"0px 0px 0px 0px",borderRadius:"2px",background:"rgba("+n.r+","+n.g+","+n.b+","+n.a+")",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},hue:{position:"relative",height:"10px",overflow:"hidden"},Hue:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},alpha:{position:"relative",height:"10px",marginTop:"4px",overflow:"hidden"},Alpha:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"}},y),disableAlpha:{color:{height:"10px"},hue:{height:"10px"},alpha:{display:"none"}}},y),{disableAlpha:v});return o.default.createElement("div",{style:E.picker,className:"sketch-picker "+x},o.default.createElement("div",{style:E.saturation},o.default.createElement(l.Saturation,{style:E.Saturation,hsl:d,hsv:f,onChange:p})),o.default.createElement("div",{style:E.controls,className:"flexbox-fix"},o.default.createElement("div",{style:E.sliders},o.default.createElement("div",{style:E.hue},o.default.createElement(l.Hue,{style:E.Hue,hsl:d,onChange:p})),o.default.createElement("div",{style:E.alpha},o.default.createElement(l.Alpha,{style:E.Alpha,rgb:n,hsl:d,renderers:b,onChange:p}))),o.default.createElement("div",{style:E.color},o.default.createElement(l.Checkboard,null),o.default.createElement("div",{style:E.activeColor}))),o.default.createElement(s.default,{rgb:n,hsl:d,hex:i,onChange:p,disableAlpha:v}),o.default.createElement(c.default,{colors:m,onClick:p,onSwatchHover:h}))};d.propTypes={disableAlpha:i.default.bool,width:i.default.oneOfType([i.default.string,i.default.number]),styles:i.default.object},d.defaultProps={disableAlpha:!1,width:200,styles:{},presetColors:["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"]},t.default=(0,l.ColorWrap)(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SketchFields=void 0;var r=u(n(0)),o=u(n(12)),i=u(n(65)),a=n(22);function u(e){return e&&e.__esModule?e:{default:e}}var l=t.SketchFields=function(e){var t=e.onChange,n=e.rgb,u=e.hsl,l=e.hex,s=e.disableAlpha,c=(0,o.default)({default:{fields:{display:"flex",paddingTop:"4px"},single:{flex:"1",paddingLeft:"6px"},alpha:{flex:"1",paddingLeft:"6px"},double:{flex:"2"},input:{width:"80%",padding:"4px 10% 3px",border:"none",boxShadow:"inset 0 0 0 1px #ccc",fontSize:"11px"},label:{display:"block",textAlign:"center",fontSize:"11px",color:"#222",paddingTop:"3px",paddingBottom:"4px",textTransform:"capitalize"}},disableAlpha:{alpha:{display:"none"}}},{disableAlpha:s}),f=function(e,r){e.hex?i.default.isValidHex(e.hex)&&t({hex:e.hex,source:"hex"},r):e.r||e.g||e.b?t({r:e.r||n.r,g:e.g||n.g,b:e.b||n.b,a:n.a,source:"rgb"},r):e.a&&(e.a<0?e.a=0:e.a>100&&(e.a=100),e.a/=100,t({h:u.h,s:u.s,l:u.l,a:e.a,source:"rgb"},r))};return r.default.createElement("div",{style:c.fields,className:"flexbox-fix"},r.default.createElement("div",{style:c.double},r.default.createElement(a.EditableInput,{style:{input:c.input,label:c.label},label:"hex",value:l.replace("#",""),onChange:f})),r.default.createElement("div",{style:c.single},r.default.createElement(a.EditableInput,{style:{input:c.input,label:c.label},label:"r",value:n.r,onChange:f,dragLabel:"true",dragMax:"255"})),r.default.createElement("div",{style:c.single},r.default.createElement(a.EditableInput,{style:{input:c.input,label:c.label},label:"g",value:n.g,onChange:f,dragLabel:"true",dragMax:"255"})),r.default.createElement("div",{style:c.single},r.default.createElement(a.EditableInput,{style:{input:c.input,label:c.label},label:"b",value:n.b,onChange:f,dragLabel:"true",dragMax:"255"})),r.default.createElement("div",{style:c.alpha},r.default.createElement(a.EditableInput,{style:{input:c.input,label:c.label},label:"a",value:Math.round(100*n.a),onChange:f,dragLabel:"true",dragMax:"100"})))};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SketchPresetColors=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=l(n(0)),i=l(n(21)),a=l(n(12)),u=n(22);function l(e){return e&&e.__esModule?e:{default:e}}var s=t.SketchPresetColors=function(e){var t=e.colors,n=e.onClick,i=void 0===n?function(){}:n,l=e.onSwatchHover,s=(0,a.default)({default:{colors:{margin:"0 -10px",padding:"10px 0 0 10px",borderTop:"1px solid #eee",display:"flex",flexWrap:"wrap",position:"relative"},swatchWrap:{width:"16px",height:"16px",margin:"0 10px 10px 0"},swatch:{borderRadius:"3px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15)"}},"no-presets":{colors:{display:"none"}}},{"no-presets":!t||!t.length}),c=function(e,t){i({hex:e,source:"hex"},t)};return o.default.createElement("div",{style:s.colors,className:"flexbox-fix"},t.map((function(e){var t="string"==typeof e?{color:e}:e,n=""+t.color+(t.title||"");return o.default.createElement("div",{key:n,style:s.swatchWrap},o.default.createElement(u.Swatch,r({},t,{style:s.swatch,onClick:c,onHover:l,focusStyle:{boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px "+t.color}})))})))};s.propTypes={colors:i.default.arrayOf(i.default.oneOfType([i.default.string,i.default.shape({color:i.default.string,title:i.default.string})])).isRequired},t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Slider=void 0;var r=c(n(0)),o=c(n(21)),i=c(n(12)),a=c(n(54)),u=n(22),l=c(n(493)),s=c(n(495));function c(e){return e&&e.__esModule?e:{default:e}}var f=t.Slider=function(e){var t=e.hsl,n=e.onChange,o=e.pointer,s=e.styles,c=void 0===s?{}:s,f=e.className,d=void 0===f?"":f,p=(0,i.default)((0,a.default)({default:{hue:{height:"12px",position:"relative"},Hue:{radius:"2px"}}},c));return r.default.createElement("div",{style:p.wrap||{},className:"slider-picker "+d},r.default.createElement("div",{style:p.hue},r.default.createElement(u.Hue,{style:p.Hue,hsl:t,pointer:o,onChange:n})),r.default.createElement("div",{style:p.swatches},r.default.createElement(l.default,{hsl:t,onClick:n})))};f.propTypes={styles:o.default.object},f.defaultProps={pointer:s.default,styles:{}},t.default=(0,u.ColorWrap)(f)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SliderSwatches=void 0;var r=a(n(0)),o=a(n(12)),i=a(n(494));function a(e){return e&&e.__esModule?e:{default:e}}var u=t.SliderSwatches=function(e){var t=e.onClick,n=e.hsl,a=(0,o.default)({default:{swatches:{marginTop:"20px"},swatch:{boxSizing:"border-box",width:"20%",paddingRight:"1px",float:"left"},clear:{clear:"both"}}});return r.default.createElement("div",{style:a.swatches},r.default.createElement("div",{style:a.swatch},r.default.createElement(i.default,{hsl:n,offset:".80",active:Math.abs(n.l-.8)<.1&&Math.abs(n.s-.5)<.1,onClick:t,first:!0})),r.default.createElement("div",{style:a.swatch},r.default.createElement(i.default,{hsl:n,offset:".65",active:Math.abs(n.l-.65)<.1&&Math.abs(n.s-.5)<.1,onClick:t})),r.default.createElement("div",{style:a.swatch},r.default.createElement(i.default,{hsl:n,offset:".50",active:Math.abs(n.l-.5)<.1&&Math.abs(n.s-.5)<.1,onClick:t})),r.default.createElement("div",{style:a.swatch},r.default.createElement(i.default,{hsl:n,offset:".35",active:Math.abs(n.l-.35)<.1&&Math.abs(n.s-.5)<.1,onClick:t})),r.default.createElement("div",{style:a.swatch},r.default.createElement(i.default,{hsl:n,offset:".20",active:Math.abs(n.l-.2)<.1&&Math.abs(n.s-.5)<.1,onClick:t,last:!0})),r.default.createElement("div",{style:a.clear}))};t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SliderSwatch=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.SliderSwatch=function(e){var t=e.hsl,n=e.offset,i=e.onClick,a=void 0===i?function(){}:i,u=e.active,l=e.first,s=e.last,c=(0,o.default)({default:{swatch:{height:"12px",background:"hsl("+t.h+", 50%, "+100*n+"%)",cursor:"pointer"}},first:{swatch:{borderRadius:"2px 0 0 2px"}},last:{swatch:{borderRadius:"0 2px 2px 0"}},active:{swatch:{transform:"scaleY(1.8)",borderRadius:"3.6px/2px"}}},{active:u,first:l,last:s});return r.default.createElement("div",{style:c.swatch,onClick:function(e){return a({h:t.h,s:.5,l:n,source:"hsl"},e)}})};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SliderPointer=void 0;var r=i(n(0)),o=i(n(12));function i(e){return e&&e.__esModule?e:{default:e}}var a=t.SliderPointer=function(){var e=(0,o.default)({default:{picker:{width:"14px",height:"14px",borderRadius:"6px",transform:"translate(-7px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return r.default.createElement("div",{style:e.picker})};t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Swatches=void 0;var r=f(n(0)),o=f(n(21)),i=f(n(12)),a=f(n(75)),u=f(n(54)),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(253)),s=n(22),c=f(n(497));function f(e){return e&&e.__esModule?e:{default:e}}var d=t.Swatches=function(e){var t=e.width,n=e.height,o=e.onChange,l=e.onSwatchHover,f=e.colors,d=e.hex,p=e.styles,h=void 0===p?{}:p,v=e.className,m=void 0===v?"":v,b=(0,i.default)((0,u.default)({default:{picker:{width:t,height:n},overflow:{height:n,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},h)),g=function(e,t){return o({hex:e,source:"hex"},t)};return r.default.createElement("div",{style:b.picker,className:"swatches-picker "+m},r.default.createElement(s.Raised,null,r.default.createElement("div",{style:b.overflow},r.default.createElement("div",{style:b.body},(0,a.default)(f,(function(e){return r.default.createElement(c.default,{key:e.toString(),group:e,active:d,onClick:g,onSwatchHover:l})})),r.default.createElement("div",{style:b.clear})))))};d.propTypes={width:o.default.oneOfType([o.default.string,o.default.number]),height:o.default.oneOfType([o.default.string,o.default.number]),colors:o.default.arrayOf(o.default.arrayOf(o.default.string)),styles:o.default.object},d.defaultProps={width:320,height:240,colors:[[l.red[900],l.red[700],l.red[500],l.red[300],l.red[100]],[l.pink[900],l.pink[700],l.pink[500],l.pink[300],l.pink[100]],[l.purple[900],l.purple[700],l.purple[500],l.purple[300],l.purple[100]],[l.deepPurple[900],l.deepPurple[700],l.deepPurple[500],l.deepPurple[300],l.deepPurple[100]],[l.indigo[900],l.indigo[700],l.indigo[500],l.indigo[300],l.indigo[100]],[l.blue[900],l.blue[700],l.blue[500],l.blue[300],l.blue[100]],[l.lightBlue[900],l.lightBlue[700],l.lightBlue[500],l.lightBlue[300],l.lightBlue[100]],[l.cyan[900],l.cyan[700],l.cyan[500],l.cyan[300],l.cyan[100]],[l.teal[900],l.teal[700],l.teal[500],l.teal[300],l.teal[100]],["#194D33",l.green[700],l.green[500],l.green[300],l.green[100]],[l.lightGreen[900],l.lightGreen[700],l.lightGreen[500],l.lightGreen[300],l.lightGreen[100]],[l.lime[900],l.lime[700],l.lime[500],l.lime[300],l.lime[100]],[l.yellow[900],l.yellow[700],l.yellow[500],l.yellow[300],l.yellow[100]],[l.amber[900],l.amber[700],l.amber[500],l.amber[300],l.amber[100]],[l.orange[900],l.orange[700],l.orange[500],l.orange[300],l.orange[100]],[l.deepOrange[900],l.deepOrange[700],l.deepOrange[500],l.deepOrange[300],l.deepOrange[100]],[l.brown[900],l.brown[700],l.brown[500],l.brown[300],l.brown[100]],[l.blueGrey[900],l.blueGrey[700],l.blueGrey[500],l.blueGrey[300],l.blueGrey[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}},t.default=(0,s.ColorWrap)(d)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SwatchesGroup=void 0;var r=u(n(0)),o=u(n(12)),i=u(n(75)),a=u(n(498));function u(e){return e&&e.__esModule?e:{default:e}}var l=t.SwatchesGroup=function(e){var t=e.onClick,n=e.onSwatchHover,u=e.group,l=e.active,s=(0,o.default)({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return r.default.createElement("div",{style:s.group},(0,i.default)(u,(function(e,o){return r.default.createElement(a.default,{key:e,color:e,active:e.toLowerCase()===l,first:0===o,last:o===u.length-1,onClick:t,onSwatchHover:n})})))};t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SwatchesColor=void 0;var r=l(n(0)),o=l(n(12)),i=l(n(65)),a=n(22),u=l(n(499));function l(e){return e&&e.__esModule?e:{default:e}}var s=t.SwatchesColor=function(e){var t=e.color,n=e.onClick,l=void 0===n?function(){}:n,s=e.onSwatchHover,c=e.first,f=e.last,d=e.active,p=(0,o.default)({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:i.default.getContrastingColor(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:c,last:f,active:d,"color-#FFFFFF":"#FFFFFF"===t,transparent:"transparent"===t});return r.default.createElement(a.Swatch,{color:t,style:p.color,onClick:l,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},r.default.createElement("div",{style:p.check},r.default.createElement(u.default,null)))};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=(r=n(0))&&r.__esModule?r:{default:r};t.default=function(e){var t=e.fill,n=void 0===t?"currentColor":t,r=e.width,a=void 0===r?24:r,u=e.height,l=void 0===u?24:u,s=e.style,c=void 0===s?{}:s,f=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["fill","width","height","style"]);return i.default.createElement("svg",o({viewBox:"0 0 24 24",style:o({fill:n,width:a,height:l},c)},f),i.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Twitter=void 0;var r=c(n(0)),o=c(n(21)),i=c(n(12)),a=c(n(75)),u=c(n(54)),l=c(n(65)),s=n(22);function c(e){return e&&e.__esModule?e:{default:e}}var f=t.Twitter=function(e){var t=e.onChange,n=e.onSwatchHover,o=e.hex,c=e.colors,f=e.width,d=e.triangle,p=e.styles,h=void 0===p?{}:p,v=e.className,m=void 0===v?"":v,b=(0,i.default)((0,u.default)({default:{card:{width:f,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},h),{"hide-triangle":"hide"===d,"top-left-triangle":"top-left"===d,"top-right-triangle":"top-right"===d}),g=function(e,n){l.default.isValidHex(e)&&t({hex:e,source:"hex"},n)};return r.default.createElement("div",{style:b.card,className:"twitter-picker "+m},r.default.createElement("div",{style:b.triangleShadow}),r.default.createElement("div",{style:b.triangle}),r.default.createElement("div",{style:b.body},(0,a.default)(c,(function(e,t){return r.default.createElement(s.Swatch,{key:t,color:e,hex:e,style:b.swatch,onClick:g,onHover:n,focusStyle:{boxShadow:"0 0 4px "+e}})})),r.default.createElement("div",{style:b.hash},"#"),r.default.createElement(s.EditableInput,{label:null,style:{input:b.input},value:o.replace("#",""),onChange:g}),r.default.createElement("div",{style:b.clear})))};f.propTypes={width:o.default.oneOfType([o.default.string,o.default.number]),triangle:o.default.oneOf(["hide","top-left","top-right"]),colors:o.default.arrayOf(o.default.string),styles:o.default.object},f.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}},t.default=(0,s.ColorWrap)(f)},,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CopyToClipboard=void 0;var r=i(n(0)),o=i(n(506));function i(e){return e&&e.__esModule?e:{default:e}}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?d(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){function t(){var e,n;l(this,t);for(var i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return h(d(n=c(this,(e=f(t)).call.apply(e,[this].concat(a)))),"onClick",(function(e){var t=n.props,i=t.text,a=t.onCopy,u=t.children,l=t.options,s=r.default.Children.only(u),c=(0,o.default)(i,l);a&&a(i,c),s&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(e)})),n}var n,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(t,e),n=t,(i=[{key:"render",value:function(){var e=this.props,t=(e.text,e.onCopy,e.options,e.children),n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,["text","onCopy","options","children"]),o=r.default.Children.only(t);return r.default.cloneElement(o,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(n,!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n,{onClick:this.onClick}))}}])&&s(n.prototype,i),t}(r.default.PureComponent);t.CopyToClipboard=v,h(v,"defaultProps",{onCopy:void 0,options:void 0})},function(e,t,n){"use strict";var r=n(507),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,i,a,u,l,s=!1;t||(t={}),t.debug;try{if(i=r(),a=document.createRange(),u=document.getSelection(),(l=document.createElement("span")).textContent=e,l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){window.clipboardData.clearData();var r=o[t.format]||o.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(l),a.selectNodeContents(l),u.addRange(a),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(r){try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(r){n=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(n,e)}}finally{u&&("function"==typeof u.removeRange?u.removeRange(a):u.removeAllRanges()),l&&document.body.removeChild(l),i()}return s}},function(e,t){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(26),o=n(11),i={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},a=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,u=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,l=/^([+-])(\d{2})(?::?(\d{2}))?$/;function s(e,t){Object(o.a)(1,arguments);var n=t||{},i=null==n.additionalDigits?2:Object(r.a)(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var a,u=c(e);if(u.date){var l=f(u.date,i);a=d(l.restDateString,l.year)}if(isNaN(a)||!a)return new Date(NaN);var s,p=a.getTime(),v=0;if(u.time&&(v=h(u.time),isNaN(v)||null===v))return new Date(NaN);if(!u.timezone){var b=new Date(p+v),g=new Date(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds(),b.getUTCMilliseconds());return g.setFullYear(b.getUTCFullYear()),g}return s=m(u.timezone),isNaN(s)?new Date(NaN):new Date(p+v+s)}function c(e){var t,n={},r=e.split(i.dateTimeDelimiter);if(/:/.test(r[0])?(n.date=null,t=r[0]):(n.date=r[0],t=r[1],i.timeZoneDelimiter.test(n.date)&&(n.date=e.split(i.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var o=i.timezone.exec(t);o?(n.time=t.replace(o[1],""),n.timezone=o[1]):n.time=t}return n}function f(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:null};var o=r[1]&&parseInt(r[1]),i=r[2]&&parseInt(r[2]);return{year:null==i?o:100*i,restDateString:e.slice((r[1]||r[2]).length)}}function d(e,t){if(null===t)return null;var n=e.match(a);if(!n)return null;var r=!!n[4],o=p(n[1]),i=p(n[2])-1,u=p(n[3]),l=p(n[4]),s=p(n[5])-1;if(r)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,l,s)?function(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var o=7*(t-1)+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+o),r}(t,l,s):new Date(NaN);var c=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(b[t]||(g(e)?29:28))}(t,i,u)&&function(e,t){return t>=1&&t<=(g(e)?366:365)}(t,o)?(c.setUTCFullYear(t,i,Math.max(o,u)),c):new Date(NaN)}function p(e){return e?parseInt(e):1}function h(e){var t=e.match(u);if(!t)return null;var n=v(t[1]),r=v(t[2]),o=v(t[3]);return function(e,t,n){return 24===e?0===t&&0===n:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,r,o)?36e5*n+6e4*r+1e3*o:NaN}function v(e){return e&&parseFloat(e.replace(",","."))||0}function m(e){if("Z"===e)return 0;var t=e.match(l);if(!t)return 0;var n="+"===t[1]?-1:1,r=parseInt(t[2]),o=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,o)?n*(36e5*r+6e4*o):NaN}var b=[31,null,31,30,31,30,31,31,30,31,30,31];function g(e){return e%400==0||e%4==0&&e%100}},function(e,t,n){"use strict";n.d(t,"a",(function(){return h}));var r=n(13),o=n(11);function i(e,t){Object(o.a)(2,arguments);var n=Object(r.a)(e),i=Object(r.a)(t),a=n.getTime()-i.getTime();return a<0?-1:a>0?1:a}function a(e,t){Object(o.a)(2,arguments);var n=Object(r.a)(e),i=Object(r.a)(t),a=n.getFullYear()-i.getFullYear(),u=n.getMonth()-i.getMonth();return 12*a+u}function u(e,t){Object(o.a)(2,arguments);var n=Object(r.a)(e),u=Object(r.a)(t),l=i(n,u),s=Math.abs(a(n,u));n.setMonth(n.getMonth()-l*s);var c=i(n,u)===-l,f=l*(s-c);return 0===f?0:f}function l(e,t){Object(o.a)(2,arguments);var n=Object(r.a)(e),i=Object(r.a)(t);return n.getTime()-i.getTime()}function s(e,t){Object(o.a)(2,arguments);var n=l(e,t)/1e3;return n>0?Math.floor(n):Math.ceil(n)}var c=n(145);function f(e){return function(e,t){if(null==e)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in t=t||{})t.hasOwnProperty(n)&&(e[n]=t[n]);return e}({},e)}var d=n(110);function p(e,t,n){Object(o.a)(2,arguments);var a=n||{},l=a.locale||c.a;if(!l.formatDistance)throw new RangeError("locale must contain formatDistance property");var p=i(e,t);if(isNaN(p))throw new RangeError("Invalid time value");var h,v,m=f(a);m.addSuffix=Boolean(a.addSuffix),m.comparison=p,p>0?(h=Object(r.a)(t),v=Object(r.a)(e)):(h=Object(r.a)(e),v=Object(r.a)(t));var b,g=s(v,h),y=(Object(d.a)(v)-Object(d.a)(h))/1e3,w=Math.round((g-y)/60);if(w<2)return a.includeSeconds?g<5?l.formatDistance("lessThanXSeconds",5,m):g<10?l.formatDistance("lessThanXSeconds",10,m):g<20?l.formatDistance("lessThanXSeconds",20,m):g<40?l.formatDistance("halfAMinute",null,m):g<60?l.formatDistance("lessThanXMinutes",1,m):l.formatDistance("xMinutes",1,m):0===w?l.formatDistance("lessThanXMinutes",1,m):l.formatDistance("xMinutes",w,m);if(w<45)return l.formatDistance("xMinutes",w,m);if(w<90)return l.formatDistance("aboutXHours",1,m);if(w<1440){var x=Math.round(w/60);return l.formatDistance("aboutXHours",x,m)}if(w<2520)return l.formatDistance("xDays",1,m);if(w<43200){var E=Math.round(w/1440);return l.formatDistance("xDays",E,m)}if(w<86400)return b=Math.round(w/43200),l.formatDistance("aboutXMonths",b,m);if((b=u(v,h))<12){var _=Math.round(w/43200);return l.formatDistance("xMonths",_,m)}var O=b%12,S=Math.floor(b/12);return O<3?l.formatDistance("aboutXYears",S,m):O<9?l.formatDistance("overXYears",S,m):l.formatDistance("almostXYears",S+1,m)}function h(e,t){return Object(o.a)(1,arguments),p(e,Date.now(),t)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(13),o=n(26),i=n(11);function a(e){Object(i.a)(1,arguments);var t=Object(o.a)(e);return Object(r.a)(1e3*t)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return V}));var r=n(13),o=n(11);function i(e){Object(o.a)(1,arguments);var t=Object(r.a)(e);return!isNaN(t)}var a=n(145),u=n(26);function l(e,t){Object(o.a)(2,arguments);var n=Object(r.a)(e).getTime(),i=Object(u.a)(t);return new Date(n+i)}function s(e,t){Object(o.a)(2,arguments);var n=Object(u.a)(t);return l(e,-n)}function c(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var f=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return c("yy"===t?r%100:r,t.length)},d=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):c(n+1,2)},p=function(e,t){return c(e.getUTCDate(),t.length)},h=function(e,t){return c(e.getUTCHours()%12||12,t.length)},v=function(e,t){return c(e.getUTCHours(),t.length)},m=function(e,t){return c(e.getUTCMinutes(),t.length)},b=function(e,t){return c(e.getUTCSeconds(),t.length)},g=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return c(Math.floor(r*Math.pow(10,n-3)),t.length)};function y(e){Object(o.a)(1,arguments);var t=1,n=Object(r.a)(e),i=n.getUTCDay(),a=(i<t?7:0)+i-t;return n.setUTCDate(n.getUTCDate()-a),n.setUTCHours(0,0,0,0),n}function w(e){Object(o.a)(1,arguments);var t=Object(r.a)(e),n=t.getUTCFullYear(),i=new Date(0);i.setUTCFullYear(n+1,0,4),i.setUTCHours(0,0,0,0);var a=y(i),u=new Date(0);u.setUTCFullYear(n,0,4),u.setUTCHours(0,0,0,0);var l=y(u);return t.getTime()>=a.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function x(e){Object(o.a)(1,arguments);var t=w(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=y(n);return r}function E(e,t){Object(o.a)(1,arguments);var n=t||{},i=n.locale,a=i&&i.options&&i.options.weekStartsOn,l=null==a?0:Object(u.a)(a),s=null==n.weekStartsOn?l:Object(u.a)(n.weekStartsOn);if(!(s>=0&&s<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var c=Object(r.a)(e),f=c.getUTCDay(),d=(f<s?7:0)+f-s;return c.setUTCDate(c.getUTCDate()-d),c.setUTCHours(0,0,0,0),c}function _(e,t){Object(o.a)(1,arguments);var n=Object(r.a)(e,t),i=n.getUTCFullYear(),a=t||{},l=a.locale,s=l&&l.options&&l.options.firstWeekContainsDate,c=null==s?1:Object(u.a)(s),f=null==a.firstWeekContainsDate?c:Object(u.a)(a.firstWeekContainsDate);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=new Date(0);d.setUTCFullYear(i+1,0,f),d.setUTCHours(0,0,0,0);var p=E(d,t),h=new Date(0);h.setUTCFullYear(i,0,f),h.setUTCHours(0,0,0,0);var v=E(h,t);return n.getTime()>=p.getTime()?i+1:n.getTime()>=v.getTime()?i:i-1}function O(e,t){Object(o.a)(1,arguments);var n=t||{},r=n.locale,i=r&&r.options&&r.options.firstWeekContainsDate,a=null==i?1:Object(u.a)(i),l=null==n.firstWeekContainsDate?a:Object(u.a)(n.firstWeekContainsDate),s=_(e,t),c=new Date(0);c.setUTCFullYear(s,0,l),c.setUTCHours(0,0,0,0);var f=E(c,t);return f}function S(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(0===i)return n+String(o);var a=t||"";return n+String(o)+a+c(i,2)}function C(e,t){return e%60==0?(e>0?"-":"+")+c(Math.abs(e)/60,2):k(e,t)}function k(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e);return r+c(Math.floor(o/60),2)+n+c(o%60,2)}var P={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return f(e,t)},Y:function(e,t,n,r){var o=_(e,r),i=o>0?o:1-o;return"YY"===t?c(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):c(i,t.length)},R:function(e,t){return c(w(e),t.length)},u:function(e,t){return c(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return c(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return c(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return d(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return c(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,i){var a=function(e,t){Object(o.a)(1,arguments);var n=Object(r.a)(e),i=E(n,t).getTime()-O(n,t).getTime();return Math.round(i/6048e5)+1}(e,i);return"wo"===t?n.ordinalNumber(a,{unit:"week"}):c(a,t.length)},I:function(e,t,n){var i=function(e){Object(o.a)(1,arguments);var t=Object(r.a)(e),n=y(t).getTime()-x(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(i,{unit:"week"}):c(i,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):p(e,t)},D:function(e,t,n){var i=function(e){Object(o.a)(1,arguments);var t=Object(r.a)(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var i=t.getTime(),a=n-i;return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(i,{unit:"dayOfYear"}):c(i,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return c(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return c(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return c(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,o=e.getUTCHours();switch(r=12===o?"noon":0===o?"midnight":o/12>=1?"pm":"am",t){case"b":case"bb":case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,o=e.getUTCHours();switch(r=o>=17?"evening":o>=12?"afternoon":o>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):v(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):c(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):c(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):b(e,t)},S:function(e,t){return g(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return C(o);case"XXXX":case"XX":return k(o);case"XXXXX":case"XXX":default:return k(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return C(o);case"xxxx":case"xx":return k(o);case"xxxxx":case"xxx":default:return k(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+S(o,":");case"OOOO":default:return"GMT"+k(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+S(o,":");case"zzzz":default:return"GMT"+k(o,":")}},t:function(e,t,n,r){var o=r._originalDate||e;return c(Math.floor(o.getTime()/1e3),t.length)},T:function(e,t,n,r){return c((r._originalDate||e).getTime(),t.length)}};function T(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}}function j(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}}var A={p:j,P:function(e,t){var n,r=e.match(/(P+)(p+)?/),o=r[1],i=r[2];if(!i)return T(e,t);switch(o){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;case"PPPP":default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",T(o,t)).replace("{{time}}",j(i,t))}},M=n(110),D=["D","DD"],L=["YY","YYYY"];function F(e){return-1!==D.indexOf(e)}function N(e){return-1!==L.indexOf(e)}function I(e){if("YYYY"===e