Spotlight Social Media Feeds - Version 0.9

Version Description

(2021-07-20) =

Added - Accessibility and SEO attributes to buttons and links in the feed

Changed - Replaced the built-in import engine with an upgraded version - Posts that have not changed on Instagram will not be updated unnecessarily - Large numbers of Instagram posts are now imported in batches - Minor database query optimizations

Fixed - Timeout errors when importing large numbers of Instagram posts - Timeout errors when clearing the cache for large numbers of Instagram posts - A PHP notice about an undefined 'shortcode' index - A conflict with pages that have the word "spotlight" in their permalink - Expired images in the popup now fallback to a local image - A styling incompatibility with LearnDash Advanced Quizzes - Vertical center alignment for album images and videos - The feeds shows the wrong number of posts when tablets and phones show more than on desktop

Download this release

Release Info

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

Code changes from version 0.8.2 to 0.9

Files changed (100) hide show
  1. core/Actions/CleanUpMediaAction.php +23 -32
  2. core/Actions/IgImageProxy.php +85 -0
  3. core/Actions/ImportMediaAction.php +0 -61
  4. core/Actions/UpdateFeedsAction.php +28 -0
  5. core/Engine/Aggregation/ExpiredStoriesProcessor.php +0 -26
  6. core/Engine/Aggregation/MediaCollection.php +0 -9
  7. core/Engine/Aggregation/MediaStorySegregator.php +0 -27
  8. core/Engine/Aggregation/MediaTransformer.php +0 -77
  9. core/Engine/Aggregator/FeedPostFilterProcessor.php +22 -0
  10. core/Engine/Aggregator/IgAggregationStrategy.php +59 -0
  11. core/Engine/{Aggregation/MediaSorterProcessor.php → Aggregator/SortProcessor.php} +15 -22
  12. core/Engine/Converter/IgConversionStrategy.php +90 -0
  13. core/Engine/Data/Feed/StoryFeed.php +33 -0
  14. core/Engine/{MediaChild.php → Data/Item/MediaChild.php} +1 -1
  15. core/Engine/{MediaComment.php → Data/Item/MediaComment.php} +1 -1
  16. core/Engine/Data/Item/MediaItem.php +72 -0
  17. core/Engine/{MediaProductType.php → Data/Item/MediaProductType.php} +1 -1
  18. core/Engine/{Sources → Data/Source}/HashtagSource.php +3 -7
  19. core/Engine/{Sources → Data/Source}/StorySource.php +3 -7
  20. core/Engine/{Sources → Data/Source}/TaggedUserSource.php +3 -3
  21. core/Engine/{Sources → Data/Source}/UserSource.php +10 -10
  22. core/Engine/Fetcher/AccountPostsCatalog.php +97 -0
  23. core/Engine/Fetcher/CompositeCatalog.php +48 -0
  24. core/Engine/Fetcher/IgFetchStrategy.php +35 -0
  25. core/Engine/Fetcher/IgPostsCatalog.php +87 -0
  26. core/Engine/Fetcher/NullCatalog.php +17 -0
  27. core/Engine/IgPostStore.php +385 -0
  28. core/Engine/Importer.php +79 -0
  29. core/Engine/MediaItem.php +0 -64
  30. core/Engine/Providers/IgAccountMediaProvider.php +0 -127
  31. core/Engine/Providers/IgProvider.php +0 -64
  32. core/Engine/Store/ThumbnailRecipe.php +26 -0
  33. core/Engine/Store/ThumbnailStore.php +281 -0
  34. core/Engine/Stores/WpPostMediaStore.php +0 -376
  35. core/Engine/StoryFeed.php +0 -23
  36. core/Feeds/FeedManager.php +21 -39
  37. core/MediaStore/Fetchers/AccountMediaFetcher.php +0 -69
  38. core/MediaStore/IgCachedMedia.php +15 -3
  39. core/MediaStore/MediaFetcherInterface.php +0 -27
  40. core/MediaStore/MediaProcessorInterface.php +0 -26
  41. core/MediaStore/MediaSource.php +0 -1
  42. core/MediaStore/MediaStore.php +0 -360
  43. core/MediaStore/Processors/MediaDownloader.php +0 -353
  44. core/MediaStore/Processors/MediaSorterProcessor.php +0 -115
  45. core/Notifications/NewsNotificationProvider.php +3 -1
  46. core/PostTypes/AccountPostType.php +37 -62
  47. core/PostTypes/MediaPostType.php +16 -214
  48. core/RestApi/EndPoints/AbstractEndpointHandler.php +6 -4
  49. core/RestApi/EndPoints/Accounts/ConnectAccountEndPoint.php +20 -13
  50. core/RestApi/EndPoints/Accounts/DeleteAccountEndPoint.php +7 -2
  51. core/RestApi/EndPoints/Accounts/DeleteAccountMediaEndpoint.php +11 -32
  52. core/RestApi/EndPoints/Feeds/GetSourcesEndpoint.php +0 -36
  53. core/RestApi/EndPoints/Front/FrontEndpoint.php +0 -20
  54. core/RestApi/EndPoints/Media/GetMediaEndPoint.php +27 -95
  55. core/RestApi/EndPoints/Media/ImportMediaEndPoint.php +5 -17
  56. core/RestApi/EndPoints/Tools/ClearCacheEndpoint.php +2 -1
  57. core/RestApi/EndPoints/Tools/ClearCacheFeedEndpoint.php +6 -35
  58. core/Server.php +98 -44
  59. core/Utils/Functions.php +28 -0
  60. core/Wp/PostType.php +22 -0
  61. engine/Aggregation/ItemAggregator.php +0 -204
  62. engine/Aggregation/ItemFeed.php +0 -62
  63. engine/Aggregation/ItemProcessor.php +0 -25
  64. engine/Aggregation/ItemSegregator.php +0 -26
  65. engine/Aggregation/ItemTransformer.php +0 -25
  66. engine/Engine.php +0 -113
  67. engine/Error.php +0 -57
  68. engine/Fetching/BatchingItemProvider.php +0 -133
  69. engine/Fetching/CompositeItemProvider.php +0 -44
  70. engine/Fetching/DelegateItemProvider.php +0 -72
  71. engine/Fetching/FallbackItemProvider.php +0 -59
  72. engine/Fetching/ItemProvider.php +0 -38
  73. engine/Importing/ItemImporter.php +0 -81
  74. engine/Importing/ItemStore.php +0 -28
  75. engine/Item.php +0 -60
  76. engine/Result.php +0 -219
  77. engine/Source.php +0 -148
  78. modules.php +4 -3
  79. modules/AccountsModule.php +1 -0
  80. modules/CleanUpCronModule.php +1 -0
  81. modules/Dev/DevAccessTokenHandler.php +40 -0
  82. modules/Dev/DevCatalog.php +61 -0
  83. modules/Dev/DevDeleteMedia.php +1 -1
  84. modules/Dev/DevModule.php +49 -22
  85. modules/Dev/DevPage.php +29 -16
  86. modules/Dev/DevResetDb.php +11 -19
  87. modules/EngineModule.php +89 -96
  88. modules/ImportCronModule.php +16 -6
  89. modules/InstagramModule.php +1 -16
  90. modules/MediaModule.php +48 -47
  91. modules/RestApiModule.php +12 -28
  92. modules/ServerModule.php +2 -2
  93. modules/UiModule.php +14 -1
  94. modules/UpdateCronModule.php +122 -0
  95. plugin.json +1 -1
  96. plugin.php +2 -21
  97. readme.txt +22 -1
  98. ui/dist/admin-app.js +1 -1
  99. ui/dist/admin-common.js +1 -1
  100. ui/dist/admin-vendors.js +0 -1
core/Actions/CleanUpMediaAction.php CHANGED
@@ -2,12 +2,13 @@
2
 
3
  namespace RebelCode\Spotlight\Instagram\Actions;
4
 
 
5
  use RebelCode\Spotlight\Instagram\Config\ConfigSet;
6
- use RebelCode\Spotlight\Instagram\Engine\MediaItem;
7
- use RebelCode\Spotlight\Instagram\Engine\Sources\StorySource;
8
- use RebelCode\Spotlight\Instagram\Engine\Stores\WpPostMediaStore;
9
  use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
10
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
 
11
  use RebelCode\Spotlight\Instagram\Wp\PostType;
12
 
13
  /**
@@ -24,30 +25,19 @@ class CleanUpMediaAction
24
  */
25
  const CFG_AGE_LIMIT = 'cleanerAgeLimit';
26
 
27
- /**
28
- * @since 0.1
29
- *
30
- * @var PostType
31
- */
32
  protected $cpt;
33
 
34
- /**
35
- * @since 0.1
36
- *
37
- * @var ConfigSet
38
- */
39
  protected $config;
40
 
41
- /**
42
- * Constructor.
43
- *
44
- * @since 0.1
45
- *
46
- * @param PostType $cpt The media post type.
47
- * @param ConfigSet $config The config set.
48
- */
49
- public function __construct(PostType $cpt, ConfigSet $config)
50
  {
 
51
  $this->cpt = $cpt;
52
  $this->config = $config;
53
  }
@@ -70,7 +60,7 @@ class CleanUpMediaAction
70
  $ageLimit = $ageLimit ?? $this->config->get(static::CFG_AGE_LIMIT)->getValue();
71
  $ageTime = strtotime($ageLimit . ' ago');
72
 
73
- $oldMedia = $this->cpt->query([
74
  'meta_query' => [
75
  [
76
  'key' => MediaPostType::LAST_REQUESTED,
@@ -80,28 +70,29 @@ class CleanUpMediaAction
80
  ],
81
  ]);
82
 
83
- $count += count($oldMedia);
84
- Arrays::each($oldMedia, [MediaPostType::class, 'deleteMedia']);
85
  }
86
 
87
  // Delete expired stories
88
  {
89
- $stories = $this->cpt->query([
90
  'meta_query' => [
91
  [
92
- 'key' => MediaPostType::IS_STORY,
93
- 'compare' => '!=',
94
- 'value' => '',
95
  ],
96
  ],
97
  ]);
98
 
99
- foreach ($stories as $story) {
100
- $item = WpPostMediaStore::wpPostToItem($story, StorySource::create(''));
101
 
 
102
  if (MediaItem::isExpiredStory($item)) {
 
103
  $count++;
104
- MediaPostType::deleteMedia($story);
105
  }
106
  }
107
  }
2
 
3
  namespace RebelCode\Spotlight\Instagram\Actions;
4
 
5
+ use RebelCode\Iris\Engine;
6
  use RebelCode\Spotlight\Instagram\Config\ConfigSet;
7
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
8
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaProductType;
 
9
  use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
10
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
11
+ use RebelCode\Spotlight\Instagram\Utils\Functions;
12
  use RebelCode\Spotlight\Instagram\Wp\PostType;
13
 
14
  /**
25
  */
26
  const CFG_AGE_LIMIT = 'cleanerAgeLimit';
27
 
28
+ /** @var Engine */
29
+ protected $engine;
30
+
31
+ /** @var PostType */
 
32
  protected $cpt;
33
 
34
+ /** @var ConfigSet */
 
 
 
 
35
  protected $config;
36
 
37
+ /** Constructor */
38
+ public function __construct(Engine $engine, PostType $cpt, ConfigSet $config)
 
 
 
 
 
 
 
39
  {
40
+ $this->engine = $engine;
41
  $this->cpt = $cpt;
42
  $this->config = $config;
43
  }
60
  $ageLimit = $ageLimit ?? $this->config->get(static::CFG_AGE_LIMIT)->getValue();
61
  $ageTime = strtotime($ageLimit . ' ago');
62
 
63
+ $oldPosts = $this->cpt->query([
64
  'meta_query' => [
65
  [
66
  'key' => MediaPostType::LAST_REQUESTED,
70
  ],
71
  ]);
72
 
73
+ $ids = Arrays::map($oldPosts, Functions::property('ID'));
74
+ $count += $this->engine->getStore()->deleteMultiple($ids);
75
  }
76
 
77
  // Delete expired stories
78
  {
79
+ $storyPosts = $this->cpt->query([
80
  'meta_query' => [
81
  [
82
+ 'key' => MediaPostType::PRODUCT_TYPE,
83
+ 'compare' => '==',
84
+ 'value' => MediaProductType::STORY,
85
  ],
86
  ],
87
  ]);
88
 
89
+ $ids = Arrays::map($storyPosts, Functions::property('ID'));
90
+ $storyItems = $this->engine->getStore()->getMultiple($ids);
91
 
92
+ foreach ($storyItems as $item) {
93
  if (MediaItem::isExpiredStory($item)) {
94
+ $this->engine->getStore()->delete($item->id);
95
  $count++;
 
96
  }
97
  }
98
  }
core/Actions/IgImageProxy.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Actions;
6
+
7
+ use RebelCode\Iris\Data\Item;
8
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
9
+
10
+ /**
11
+ * Listens for Instagram image requests from the UI client, fetches the corresponding image and outputs it to the
12
+ * browser.
13
+ */
14
+ class IgImageProxy
15
+ {
16
+ public const IMG_PARAM = 'sli-img';
17
+ public const SIZE_PARAM = 'size';
18
+ public const USERAGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36';
19
+ public const TIMEOUT = 10;
20
+ public const CONTENT_TYPE = 'image/jpeg';
21
+
22
+ public function __invoke()
23
+ {
24
+ $shortcode = filter_input(INPUT_GET, static::IMG_PARAM);
25
+ $size = filter_input(INPUT_GET, static::SIZE_PARAM);
26
+ if (empty($shortcode) || empty($size)) {
27
+ return;
28
+ }
29
+
30
+ $size = strtolower($size);
31
+ $size = $size === 's' ? 't' : $size;
32
+
33
+ $url = "https://instagram.com/p/$shortcode/media?size=$size";
34
+
35
+ $ch = curl_init($url);
36
+ curl_setopt($ch, CURLOPT_HEADER, false);
37
+ curl_setopt($ch, CURLOPT_USERAGENT, static::USERAGENT);
38
+ curl_setopt($ch, CURLOPT_FAILONERROR, true);
39
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
40
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
41
+ curl_setopt($ch, CURLOPT_ENCODING, '');
42
+ curl_setopt($ch, CURLOPT_TIMEOUT, static::TIMEOUT);
43
+ $response = curl_exec($ch);
44
+ curl_close($ch);
45
+
46
+ header('Content-type: ' . static::CONTENT_TYPE);
47
+ echo $response;
48
+ exit;
49
+ }
50
+
51
+ public static function getUrl(string $shortcode, string $size): string
52
+ {
53
+ return site_url() . '?' . static::IMG_PARAM . '=' . $shortcode . '&' . static::SIZE_PARAM . '=' . $size;
54
+ }
55
+
56
+ public static function itemWithProxyImages(Item $item): Item
57
+ {
58
+ $type = $item->get(MediaItem::MEDIA_TYPE);
59
+
60
+ switch ($type) {
61
+ case 'IMAGE':
62
+ $shortcode = $item->get(MediaItem::SHORTCODE);
63
+ if ($shortcode) {
64
+ $item = $item->with(MediaItem::MEDIA_URL, static::getUrl($shortcode, 'l'));
65
+ }
66
+ break;
67
+
68
+ case 'CAROUSEL_ALBUM':
69
+ $children = $item->get(MediaItem::CHILDREN, []);
70
+
71
+ foreach ($children as $idx => $child) {
72
+ $shortcode = $child[MediaItem::SHORTCODE] ?? null;
73
+
74
+ if (!empty($shortcode)) {
75
+ $children[$idx][MediaItem::MEDIA_URL] = IgImageProxy::getUrl($shortcode, 'l');
76
+ }
77
+ }
78
+
79
+ $item = $item->with(MediaItem::CHILDREN, $children);
80
+ break;
81
+ }
82
+
83
+ return $item;
84
+ }
85
+ }
core/Actions/ImportMediaAction.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Actions;
4
-
5
- use RebelCode\Iris\Aggregation\ItemFeed;
6
- use RebelCode\Iris\Importing\ItemImporter;
7
- use RebelCode\Spotlight\Instagram\Engine\FeedMediaImporter;
8
- use RebelCode\Spotlight\Instagram\Feeds\FeedManager;
9
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
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.5
20
- *
21
- * @var FeedManager
22
- */
23
- protected $feedManager;
24
-
25
- /**
26
- * @since 0.5
27
- *
28
- * @var ItemImporter
29
- */
30
- protected $importer;
31
-
32
- /**
33
- * Constructor.
34
- *
35
- * @since 0.1
36
- *
37
- * @param FeedManager $feedManager The feeds manager.
38
- * @param ItemImporter $importer The item import.
39
- */
40
- public function __construct(FeedManager $feedManager, ItemImporter $importer)
41
- {
42
- $this->feedManager = $feedManager;
43
- $this->importer = $importer;
44
- }
45
-
46
- /**
47
- * @since 0.1
48
- */
49
- public function __invoke()
50
- {
51
- $feeds = $this->feedManager->query();
52
-
53
- Arrays::each($feeds, function (ItemFeed $feed) {
54
- // Allocate up to 5 minutes for each feed's import
55
- set_time_limit(300);
56
-
57
- // Import all media for each of the feed's sources
58
- Arrays::each($feed->sources, [$this->importer, 'import']);
59
- });
60
- }
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Actions/UpdateFeedsAction.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Actions;
6
+
7
+ use RebelCode\Spotlight\Instagram\Engine\Importer;
8
+
9
+ class UpdateFeedsAction
10
+ {
11
+ /** @var Importer */
12
+ protected $importer;
13
+
14
+ /**
15
+ * Constructor.
16
+ *
17
+ * @param Importer $importer
18
+ */
19
+ public function __construct(Importer $importer)
20
+ {
21
+ $this->importer = $importer;
22
+ }
23
+
24
+ public function __invoke()
25
+ {
26
+ $this->importer->updateFeeds();
27
+ }
28
+ }
core/Engine/Aggregation/ExpiredStoriesProcessor.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine\Aggregation;
4
-
5
- use RebelCode\Iris\Aggregation\ItemFeed;
6
- use RebelCode\Iris\Aggregation\ItemProcessor;
7
- use RebelCode\Spotlight\Instagram\Engine\MediaItem;
8
- use RebelCode\Spotlight\Instagram\Utils\Functions;
9
-
10
- /**
11
- * Filters media to remove expired stories.
12
- *
13
- * @since 0.6
14
- */
15
- class ExpiredStoriesProcessor implements ItemProcessor
16
- {
17
- /**
18
- * @inheritDoc
19
- *
20
- * @since 0.6
21
- */
22
- public function process(array &$items, ItemFeed $feed)
23
- {
24
- $items = array_filter($items, Functions::not([MediaItem::class, 'isExpiredStory']));
25
- }
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Engine/Aggregation/MediaCollection.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine\Aggregation;
4
-
5
- class MediaCollection
6
- {
7
- const MEDIA = 'media';
8
- const STORY = 'story';
9
- }
 
 
 
 
 
 
 
 
 
core/Engine/Aggregation/MediaStorySegregator.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine\Aggregation;
4
-
5
- use RebelCode\Iris\Aggregation\ItemFeed;
6
- use RebelCode\Iris\Aggregation\ItemSegregator;
7
- use RebelCode\Iris\Item;
8
-
9
- /**
10
- * Segregates Instagram media and stories into separate collections.
11
- *
12
- * @since 0.5
13
- */
14
- class MediaStorySegregator implements ItemSegregator
15
- {
16
- /**
17
- * @inheritDoc
18
- *
19
- * @since 0.5
20
- */
21
- public function segregate(Item $item, ItemFeed $feed) : ?string
22
- {
23
- return ($item->data['is_story'] ?? false)
24
- ? MediaCollection::STORY
25
- : MediaCollection::MEDIA;
26
- }
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Engine/Aggregation/MediaTransformer.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine\Aggregation;
4
-
5
- use RebelCode\Iris\Aggregation\ItemAggregator;
6
- use RebelCode\Iris\Aggregation\ItemFeed;
7
- use RebelCode\Iris\Aggregation\ItemTransformer;
8
- use RebelCode\Iris\Item;
9
- use RebelCode\Spotlight\Instagram\Engine\MediaChild;
10
- use RebelCode\Spotlight\Instagram\Engine\MediaComment;
11
- use RebelCode\Spotlight\Instagram\Engine\MediaItem;
12
- use RebelCode\Spotlight\Instagram\Engine\MediaProductType;
13
-
14
- /**
15
- * Transforms items into media data arrays.
16
- *
17
- * This is used to transform the results from an {@link ItemAggregator} and prepares the items to be in the correct
18
- * format for REST API responses.
19
- *
20
- * @since 0.5
21
- */
22
- class MediaTransformer implements ItemTransformer
23
- {
24
- /**
25
- * @inheritDoc
26
- *
27
- * @since 0.5
28
- */
29
- public function transform(Item $item, ItemFeed $feed)
30
- {
31
- $children = $item->data['children'] ?? [];
32
- foreach ($children as $idx => $child) {
33
- $children[$idx] = [
34
- 'id' => $child[MediaChild::MEDIA_ID],
35
- 'type' => $child[MediaChild::MEDIA_TYPE],
36
- 'url' => $child[MediaChild::MEDIA_URL],
37
- 'permalink' => $child[MediaChild::PERMALINK],
38
- 'shortcode' => $child[MediaChild::SHORTCODE],
39
- ];
40
- }
41
-
42
- $comments = $item->data['comments'] ?? [];
43
- foreach ($comments as $idx => $comment) {
44
- $comments[$idx] = [
45
- 'id' => $comment[MediaComment::ID],
46
- 'username' => $comment[MediaComment::USERNAME],
47
- 'text' => $comment[MediaComment::TEXT],
48
- 'timestamp' => $comment[MediaComment::TIMESTAMP],
49
- 'likeCount' => $comment[MediaComment::LIKES_COUNT],
50
- ];
51
- }
52
-
53
- return [
54
- 'id' => $item->data[MediaItem::MEDIA_ID],
55
- 'username' => $item->data[MediaItem::USERNAME],
56
- 'caption' => $item->data[MediaItem::CAPTION],
57
- 'timestamp' => $item->data[MediaItem::TIMESTAMP],
58
- 'type' => $item->data[MediaItem::MEDIA_TYPE],
59
- 'url' => $item->data[MediaItem::MEDIA_URL],
60
- 'size' => $item->data[MediaItem::MEDIA_SIZE],
61
- 'permalink' => $item->data[MediaItem::PERMALINK],
62
- 'shortcode' => $item->data[MediaItem::SHORTCODE] ?? '',
63
- 'videoTitle' => $item->data[MediaItem::VIDEO_TITLE] ?? '',
64
- 'productType' => $item->data[MediaItem::MEDIA_PRODUCT_TYPE] ?? MediaProductType::FEED,
65
- 'thumbnail' => $item->data[MediaItem::THUMBNAIL_URL],
66
- 'thumbnails' => $item->data[MediaItem::THUMBNAILS],
67
- 'likesCount' => $item->data[MediaItem::LIKES_COUNT],
68
- 'commentsCount' => $item->data[MediaItem::COMMENTS_COUNT],
69
- 'comments' => $comments,
70
- 'children' => $children,
71
- 'source' => [
72
- 'type' => $item->source->type,
73
- 'name' => $item->source->data['name'],
74
- ],
75
- ];
76
- }
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Engine/Aggregator/FeedPostFilterProcessor.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Aggregator;
6
+
7
+ use RebelCode\Iris\Aggregator\ItemProcessor;
8
+ use RebelCode\Iris\Data\Feed;
9
+ use RebelCode\Iris\Store\Query;
10
+ use RebelCode\Spotlight\Instagram\Engine\Data\Feed\StoryFeed;
11
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
12
+ use RebelCode\Spotlight\Instagram\Utils\Functions;
13
+
14
+ class FeedPostFilterProcessor implements ItemProcessor
15
+ {
16
+ public function process(array &$items, Feed $feed, Query $query): void
17
+ {
18
+ if ($feed->get('mediaType') !== StoryFeed::MEDIA_TYPE) {
19
+ $items = array_filter($items, Functions::not([MediaItem::class, 'isStory']));
20
+ }
21
+ }
22
+ }
core/Engine/Aggregator/IgAggregationStrategy.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Aggregator;
6
+
7
+ use RebelCode\Iris\Aggregator\AggregationStrategy;
8
+ use RebelCode\Iris\Aggregator\ItemProcessor;
9
+ use RebelCode\Iris\Data\Feed;
10
+ use RebelCode\Iris\Store\Query;
11
+
12
+ class IgAggregationStrategy implements AggregationStrategy
13
+ {
14
+ /** @var ItemProcessor[] */
15
+ protected $preProcessors;
16
+
17
+ /** @var ItemProcessor[] */
18
+ protected $postProcessors;
19
+
20
+ /**
21
+ * Constructor.
22
+ *
23
+ * @param ItemProcessor[] $preProcessors
24
+ * @param ItemProcessor[] $postProcessors
25
+ */
26
+ public function __construct(array $preProcessors = [], array $postProcessors = [])
27
+ {
28
+ $this->preProcessors = $preProcessors;
29
+ $this->postProcessors = $postProcessors;
30
+ }
31
+
32
+ public function doManualPagination(Feed $feed, Query $query): bool
33
+ {
34
+ return true;
35
+ }
36
+
37
+ public function getFeedQuery(Feed $feed, ?int $count = null, int $offset = 0): ?Query
38
+ {
39
+ if ($count === null) {
40
+ $numPosts = $feed->get('numPosts');
41
+
42
+ $count = is_array($numPosts)
43
+ ? max($numPosts['desktop'] ?? 9, $numPosts['tablet'] ?? 0, $numPosts['phone'] ?? 0)
44
+ : (int) $numPosts;
45
+ }
46
+
47
+ return new Query($feed->sources, null, null, $count, $offset);
48
+ }
49
+
50
+ public function getPreProcessors(Feed $feed, Query $query): array
51
+ {
52
+ return $this->preProcessors;
53
+ }
54
+
55
+ public function getPostProcessors(Feed $feed, Query $query): array
56
+ {
57
+ return $this->postProcessors;
58
+ }
59
+ }
core/Engine/{Aggregation/MediaSorterProcessor.php → Aggregator/SortProcessor.php} RENAMED
@@ -1,28 +1,21 @@
1
  <?php
2
 
3
- namespace RebelCode\Spotlight\Instagram\Engine\Aggregation;
4
 
5
- use RebelCode\Iris\Aggregation\ItemFeed;
6
- use RebelCode\Iris\Aggregation\ItemProcessor;
7
- use RebelCode\Iris\Item;
8
- use RebelCode\Spotlight\Instagram\Engine\MediaItem;
 
 
 
9
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
10
 
11
- /**
12
- * Sorts media according to a feed's "Post order" option.
13
- *
14
- * @since 0.5
15
- */
16
- class MediaSorterProcessor implements ItemProcessor
17
  {
18
- /**
19
- * @inheritDoc
20
- *
21
- * @since 0.5
22
- */
23
- public function process(array &$items, ItemFeed $feed)
24
  {
25
- $fOrder = $feed->getOption('postOrder');
26
 
27
  switch ($fOrder) {
28
  // Date sorting
@@ -32,8 +25,8 @@ class MediaSorterProcessor implements ItemProcessor
32
  $mult = ($fOrder === 'date_asc') ? 1 : -1;
33
 
34
  usort($items, function (Item $a, Item $b) use ($mult) {
35
- $t1 = $a->data[MediaItem::TIMESTAMP];
36
- $t2 = $b->data[MediaItem::TIMESTAMP];
37
 
38
  // If both have dates
39
  if ($t1 !== null && $t2 !== null) {
@@ -64,8 +57,8 @@ class MediaSorterProcessor implements ItemProcessor
64
  $mult = ($fOrder === 'popularity_asc') ? 1 : -1;
65
 
66
  usort($items, function (Item $a, Item $b) use ($mult) {
67
- $s1 = ($a->data[MediaItem::LIKES_COUNT] ?? 0) + ($a->data[MediaItem::COMMENTS_COUNT] ?? 0);
68
- $s2 = ($b->data[MediaItem::LIKES_COUNT] ?? 0) + ($b->data[MediaItem::COMMENTS_COUNT] ?? 0);
69
 
70
  return ($s1 <=> $s2) * $mult;
71
  });
1
  <?php
2
 
3
+ declare(strict_types=1);
4
 
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Aggregator;
6
+
7
+ use RebelCode\Iris\Aggregator\ItemProcessor;
8
+ use RebelCode\Iris\Data\Feed;
9
+ use RebelCode\Iris\Data\Item;
10
+ use RebelCode\Iris\Store\Query;
11
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
12
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
13
 
14
+ class SortProcessor implements ItemProcessor
 
 
 
 
 
15
  {
16
+ public function process(array &$items, Feed $feed, Query $query): void
 
 
 
 
 
17
  {
18
+ $fOrder = $feed->get('postOrder');
19
 
20
  switch ($fOrder) {
21
  // Date sorting
25
  $mult = ($fOrder === 'date_asc') ? 1 : -1;
26
 
27
  usort($items, function (Item $a, Item $b) use ($mult) {
28
+ $t1 = $a->get(MediaItem::TIMESTAMP);
29
+ $t2 = $b->get(MediaItem::TIMESTAMP);
30
 
31
  // If both have dates
32
  if ($t1 !== null && $t2 !== null) {
57
  $mult = ($fOrder === 'popularity_asc') ? 1 : -1;
58
 
59
  usort($items, function (Item $a, Item $b) use ($mult) {
60
+ $s1 = $a->get(MediaItem::LIKES_COUNT, 0) + $a->get(MediaItem::COMMENTS_COUNT, 0);
61
+ $s2 = $b->get(MediaItem::LIKES_COUNT, 0) + $b->get(MediaItem::COMMENTS_COUNT, 0);
62
 
63
  return ($s1 <=> $s2) * $mult;
64
  });
core/Engine/Converter/IgConversionStrategy.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Converter;
6
+
7
+ use RebelCode\Iris\Converter\ConversionStrategy;
8
+ use RebelCode\Iris\Data\Item;
9
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
10
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
11
+ use RebelCode\Spotlight\Instagram\Utils\Functions;
12
+
13
+ class IgConversionStrategy implements ConversionStrategy
14
+ {
15
+ public function convert(Item $item): ?Item
16
+ {
17
+ $comments = $item->data[MediaItem::COMMENTS]['data'] ?? [];
18
+ $children = $item->data[MediaItem::CHILDREN]['data'] ?? [];
19
+ $shortcode = $item->data[MediaItem::SHORTCODE] ?? '';
20
+ $permalink = $item->data[MediaItem::PERMALINK] ?? '';
21
+
22
+ if (empty($shortcode) || empty($permalink)) {
23
+ if (preg_match('/instagram\.com\/p\/([^\/]+)/i', $permalink, $matches)) {
24
+ if (isset($matches[1])) {
25
+ $shortcode = $matches[1];
26
+ }
27
+ }
28
+ }
29
+
30
+ return $item->withChanges([
31
+ MediaItem::SHORTCODE => $shortcode,
32
+ MediaItem::COMMENTS => $comments,
33
+ MediaItem::CHILDREN => $children,
34
+ ]);
35
+ }
36
+
37
+ public function reconcile(Item $incoming, Item $existing): ?Item
38
+ {
39
+ $newItem = $existing
40
+ ->withAddedSources($incoming->sources)
41
+ ->withChanges([
42
+ MediaItem::LIKES_COUNT => $incoming->get(MediaItem::LIKES_COUNT),
43
+ MediaItem::COMMENTS_COUNT => $incoming->get(MediaItem::COMMENTS_COUNT),
44
+ MediaItem::COMMENTS => $incoming->get(MediaItem::COMMENTS_COUNT),
45
+ ]);
46
+
47
+ // Update the URL for video posts
48
+ $type = $newItem->get(MediaItem::MEDIA_TYPE);
49
+ if ($type === 'VIDEO') {
50
+ $newItem = $newItem->with(MediaItem::MEDIA_URL, $incoming->get(MediaItem::MEDIA_URL));
51
+ }
52
+
53
+ // Update the URL for video posts in albums
54
+ $children = $existing->get(MediaItem::CHILDREN, []);
55
+ $newChildren = $incoming->get(MediaItem::CHILDREN, []);
56
+ foreach ($children as $idx => $child) {
57
+ if ($child[MediaItem::MEDIA_TYPE] === 'VIDEO' && !empty($newChildren[$idx][MediaItem::MEDIA_URL])) {
58
+ $child[MediaItem::MEDIA_URL] = $newChildren[$idx][MediaItem::MEDIA_URL];
59
+ }
60
+ $children[$idx] = $child;
61
+ }
62
+ $newItem->with(MediaItem::CHILDREN, $children);
63
+
64
+ // If the reconciled item is the same as the existing one, disregard it
65
+ if ($this->itemsEqual($newItem, $existing)) {
66
+ return null;
67
+ }
68
+
69
+ return $newItem;
70
+ }
71
+
72
+ public function finalize(Item $item): ?Item
73
+ {
74
+ return $item;
75
+ }
76
+
77
+ protected function itemsEqual(Item $a, Item $b): bool
78
+ {
79
+ $sources1 = Arrays::map($a->sources, Functions::method('__toString'));
80
+ $sources2 = Arrays::map($b->sources, Functions::method('__toString'));
81
+ sort($sources1);
82
+ sort($sources2);
83
+ $sources1 = Arrays::join($sources1, ',');
84
+ $sources2 = Arrays::join($sources2, ',');
85
+
86
+ return $a->id === $b->id &&
87
+ $a->data == $b->data &&
88
+ $sources1 === $sources2;
89
+ }
90
+ }
core/Engine/Data/Feed/StoryFeed.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Feed;
4
+
5
+ use RebelCode\Iris\Data\Feed;
6
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\UserSource;
7
+
8
+ class StoryFeed
9
+ {
10
+ const MEDIA_TYPE = 'stories';
11
+
12
+ /**
13
+ * Creates a story-only variant of a given feed.
14
+ *
15
+ * @param Feed $feed The feed.
16
+ *
17
+ * @return Feed|null The story feed, or null if the given feed does not have a business account source.
18
+ */
19
+ public static function createFromFeed(Feed $feed): ?Feed
20
+ {
21
+ if (empty($feed->sources)) {
22
+ return null;
23
+ }
24
+
25
+ foreach ($feed->sources as $source) {
26
+ if ($source->type === UserSource::TYPE_BUSINESS) {
27
+ return $feed->with('mediaType', static::MEDIA_TYPE);
28
+ }
29
+ }
30
+
31
+ return null;
32
+ }
33
+ }
core/Engine/{MediaChild.php → Data/Item/MediaChild.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- namespace RebelCode\Spotlight\Instagram\Engine;
4
 
5
  class MediaChild
6
  {
1
  <?php
2
 
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Item;
4
 
5
  class MediaChild
6
  {
core/Engine/{MediaComment.php → Data/Item/MediaComment.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- namespace RebelCode\Spotlight\Instagram\Engine;
4
 
5
  class MediaComment
6
  {
1
  <?php
2
 
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Item;
4
 
5
  class MediaComment
6
  {
core/Engine/Data/Item/MediaItem.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Item;
4
+
5
+ use DateTime;
6
+ use Exception;
7
+ use RebelCode\Iris\Data\Item;
8
+ use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
9
+
10
+ class MediaItem
11
+ {
12
+ // -----------------------
13
+ // INSTAGRAM API FIELDS
14
+ // -----------------------
15
+ const MEDIA_ID = 'media_id';
16
+ const CAPTION = 'caption';
17
+ const USERNAME = 'username';
18
+ const TIMESTAMP = 'timestamp';
19
+ const MEDIA_TYPE = 'media_type';
20
+ const MEDIA_URL = 'media_url';
21
+ const MEDIA_PRODUCT_TYPE = 'media_product_type';
22
+ const PERMALINK = 'permalink';
23
+ const SHORTCODE = 'shortcode';
24
+ const VIDEO_TITLE = 'video_title';
25
+ const THUMBNAIL_URL = 'thumbnail_url';
26
+ const LIKES_COUNT = 'like_count';
27
+ const COMMENTS_COUNT = 'comments_count';
28
+ const COMMENTS = 'comments';
29
+ const CHILDREN = 'children';
30
+ // -----------------------
31
+ // CUSTOM FIELDS
32
+ // -----------------------
33
+ const POST = 'post';
34
+ const IS_STORY = 'is_story';
35
+ const LAST_REQUESTED = 'last_requested';
36
+ const THUMBNAILS = 'thumbnails';
37
+ const MEDIA_SIZE = 'media_size';
38
+ const SOURCE_TYPE = 'source_type';
39
+ const SOURCE_NAME = 'source_name';
40
+
41
+ /** Checks if an item is a story post, regardless of whether or not it's expired. */
42
+ public static function isStory(Item $item): bool
43
+ {
44
+ return $item->get(static::IS_STORY, false) ||
45
+ $item->get(static::MEDIA_PRODUCT_TYPE) === MediaProductType::STORY;
46
+ }
47
+
48
+ /** Checks if an item is a valid (non-expired) story. */
49
+ public static function isValidStory(Item $item): bool
50
+ {
51
+ return static::isStory($item) && static::isTimestampValidForStory($item);
52
+ }
53
+
54
+ /** Checks if an item is an expired story. */
55
+ public static function isExpiredStory(Item $item): bool
56
+ {
57
+ return static::isStory($item) && !static::isTimestampValidForStory($item);
58
+ }
59
+
60
+ /** Checks if an item's timestamp is valid for a story. Does not check if the item actually IS a story. */
61
+ protected static function isTimestampValidForStory(Item $item): bool
62
+ {
63
+ try {
64
+ $datetime = new DateTime($item->get(static::TIMESTAMP));
65
+ $diff = time() - $datetime->getTimestamp();
66
+
67
+ return $diff < IgMedia::STORY_MAX_LIFE;
68
+ } catch (Exception $exception) {
69
+ return false;
70
+ }
71
+ }
72
+ }
core/Engine/{MediaProductType.php → Data/Item/MediaProductType.php} RENAMED
@@ -2,7 +2,7 @@
2
 
3
  declare(strict_types=1);
4
 
5
- namespace RebelCode\Spotlight\Instagram\Engine;
6
 
7
  class MediaProductType
8
  {
2
 
3
  declare(strict_types=1);
4
 
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Item;
6
 
7
  class MediaProductType
8
  {
core/Engine/{Sources → Data/Source}/HashtagSource.php RENAMED
@@ -1,13 +1,11 @@
1
  <?php
2
 
3
- namespace RebelCode\Spotlight\Instagram\Engine\Sources;
4
 
5
- use RebelCode\Iris\Source;
6
 
7
  /**
8
  * Source for posts from a hashtag.
9
- *
10
- * @since 0.5
11
  */
12
  class HashtagSource
13
  {
@@ -17,8 +15,6 @@ class HashtagSource
17
  /**
18
  * Creates a source for a hashtag.
19
  *
20
- * @since 0.5
21
- *
22
  * @param string $tag The hashtag.
23
  * @param string $type The hashtag media type.
24
  *
@@ -30,6 +26,6 @@ class HashtagSource
30
  ? static::TYPE_POPULAR
31
  : static::TYPE_RECENT;
32
 
33
- return Source::auto($srcType, ['name' => $tag]);
34
  }
35
  }
1
  <?php
2
 
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Source;
4
 
5
+ use RebelCode\Iris\Data\Source;
6
 
7
  /**
8
  * Source for posts from a hashtag.
 
 
9
  */
10
  class HashtagSource
11
  {
15
  /**
16
  * Creates a source for a hashtag.
17
  *
 
 
18
  * @param string $tag The hashtag.
19
  * @param string $type The hashtag media type.
20
  *
26
  ? static::TYPE_POPULAR
27
  : static::TYPE_RECENT;
28
 
29
+ return new Source($tag, $srcType);
30
  }
31
  }
core/Engine/{Sources → Data/Source}/StorySource.php RENAMED
@@ -1,13 +1,11 @@
1
  <?php
2
 
3
- namespace RebelCode\Spotlight\Instagram\Engine\Sources;
4
 
5
- use RebelCode\Iris\Source;
6
 
7
  /**
8
  * Source for story posts from a user.
9
- *
10
- * @since 0.5
11
  */
12
  class StorySource
13
  {
@@ -16,14 +14,12 @@ class StorySource
16
  /**
17
  * Creates a source for a user's story.
18
  *
19
- * @since 0.5
20
- *
21
  * @param string $username The user name.
22
  *
23
  * @return Source The created source instance.
24
  */
25
  public static function create(string $username): Source
26
  {
27
- return Source::auto(static::TYPE, ['name' => $username]);
28
  }
29
  }
1
  <?php
2
 
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Source;
4
 
5
+ use RebelCode\Iris\Data\Source;
6
 
7
  /**
8
  * Source for story posts from a user.
 
 
9
  */
10
  class StorySource
11
  {
14
  /**
15
  * Creates a source for a user's story.
16
  *
 
 
17
  * @param string $username The user name.
18
  *
19
  * @return Source The created source instance.
20
  */
21
  public static function create(string $username): Source
22
  {
23
+ return new Source($username, static::TYPE);
24
  }
25
  }
core/Engine/{Sources → Data/Source}/TaggedUserSource.php RENAMED
@@ -1,8 +1,8 @@
1
  <?php
2
 
3
- namespace RebelCode\Spotlight\Instagram\Engine\Sources;
4
 
5
- use RebelCode\Iris\Source;
6
 
7
  /**
8
  * Source for posts where a user is tagged.
@@ -24,6 +24,6 @@ class TaggedUserSource
24
  */
25
  public static function create(string $username) : Source
26
  {
27
- return Source::auto(static::TYPE, ['name' => $username]);
28
  }
29
  }
1
  <?php
2
 
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Source;
4
 
5
+ use RebelCode\Iris\Data\Source;
6
 
7
  /**
8
  * Source for posts where a user is tagged.
24
  */
25
  public static function create(string $username) : Source
26
  {
27
+ return new Source($username, static::TYPE);
28
  }
29
  }
core/Engine/{Sources → Data/Source}/UserSource.php RENAMED
@@ -1,14 +1,12 @@
1
  <?php
2
 
3
- namespace RebelCode\Spotlight\Instagram\Engine\Sources;
4
 
5
- use RebelCode\Iris\Source;
6
  use RebelCode\Spotlight\Instagram\IgApi\IgUser;
7
 
8
  /**
9
  * Source for posts posted by a user.
10
- *
11
- * @since 0.5
12
  */
13
  class UserSource
14
  {
@@ -18,8 +16,6 @@ class UserSource
18
  /**
19
  * Creates a media source for a user.
20
  *
21
- * @since 0.5
22
- *
23
  * @param string $username The username.
24
  * @param string $userType The user type.
25
  *
@@ -27,10 +23,14 @@ class UserSource
27
  */
28
  public static function create(string $username, string $userType) : Source
29
  {
30
- $type = ($userType === IgUser::TYPE_PERSONAL)
31
- ? static::TYPE_PERSONAL
32
- : static::TYPE_BUSINESS;
 
 
 
 
33
 
34
- return Source::auto($type, ['name' => $username]);
35
  }
36
  }
1
  <?php
2
 
3
+ namespace RebelCode\Spotlight\Instagram\Engine\Data\Source;
4
 
5
+ use RebelCode\Iris\Data\Source;
6
  use RebelCode\Spotlight\Instagram\IgApi\IgUser;
7
 
8
  /**
9
  * Source for posts posted by a user.
 
 
10
  */
11
  class UserSource
12
  {
16
  /**
17
  * Creates a media source for a user.
18
  *
 
 
19
  * @param string $username The username.
20
  * @param string $userType The user type.
21
  *
23
  */
24
  public static function create(string $username, string $userType) : Source
25
  {
26
+ if ($userType === IgUser::TYPE_PERSONAL) {
27
+ $type = static::TYPE_PERSONAL;
28
+ } elseif ($userType === IgUser::TYPE_BUSINESS) {
29
+ $type = static::TYPE_BUSINESS;
30
+ } else {
31
+ $type = $userType;
32
+ }
33
 
34
+ return new Source($username, $type);
35
  }
36
  }
core/Engine/Fetcher/AccountPostsCatalog.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Fetcher;
6
+
7
+ use Psr\Http\Client\ClientInterface;
8
+ use RebelCode\Iris\Data\Source;
9
+ use RebelCode\Iris\Exception\FetchException;
10
+ use RebelCode\Iris\Fetcher\Catalog;
11
+ use RebelCode\Iris\Fetcher\FetchResult;
12
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\UserSource;
13
+ use RebelCode\Spotlight\Instagram\IgApi\IgApiUtils;
14
+ use RebelCode\Spotlight\Instagram\IgApi\IgUser;
15
+ use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
16
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
17
+
18
+ class AccountPostsCatalog implements Catalog
19
+ {
20
+ const DEFAULT_LIMIT = 50;
21
+
22
+ /** @var ClientInterface */
23
+ protected $client;
24
+
25
+ /** @var PostType */
26
+ protected $accounts;
27
+
28
+ /** @var Catalog|null */
29
+ protected $storyCatalog;
30
+
31
+ /** Constructor */
32
+ public function __construct(ClientInterface $client, PostType $accounts, ?Catalog $storyCatalog = null)
33
+ {
34
+ $this->client = $client;
35
+ $this->accounts = $accounts;
36
+ $this->storyCatalog = $storyCatalog;
37
+ }
38
+
39
+ public function query(Source $source, ?string $cursor = null, ?int $count = null): FetchResult
40
+ {
41
+ if ($source->type !== UserSource::TYPE_PERSONAL && $source->type !== UserSource::TYPE_BUSINESS) {
42
+ return new FetchResult([], $source, null, null, null, [
43
+ 'Invalid source type',
44
+ ]);
45
+ }
46
+
47
+ $username = $source->id;
48
+ $account = AccountPostType::getByUsername($this->accounts, $username);
49
+
50
+ if ($account === null) {
51
+ throw new FetchException("Account \"@{$username}\" does not exist", null, $source, $cursor);
52
+ }
53
+
54
+ $userId = $account->user->id;
55
+ $accessToken = $account->accessToken;
56
+ $isBusiness = $account->getUser()->getType() === IgUser::TYPE_BUSINESS;
57
+
58
+ $baseUrl = $isBusiness ? IgPostsCatalog::GRAPH_API_URL : IgPostsCatalog::BASIC_API_URL;
59
+ $url = "{$baseUrl}/{$userId}/media";
60
+ $limit = $count ?? static::DEFAULT_LIMIT;
61
+
62
+ $fields = $isBusiness
63
+ ? IgApiUtils::getBusinessMediaFields(true)
64
+ : IgApiUtils::getPersonalMediaFields(true);
65
+
66
+ $args = [
67
+ 'access_token' => $accessToken->code,
68
+ 'fields' => implode(',', $fields),
69
+ ];
70
+
71
+ $result = IgPostsCatalog::requestItems($this->client, $source, $cursor, $limit, $url, $args);
72
+ $result = new FetchResult(
73
+ $result->items,
74
+ $source,
75
+ $account->getUser()->getMediaCount(),
76
+ $result->nextCursor,
77
+ $result->prevCursor,
78
+ $result->errors
79
+ );
80
+
81
+ // Add stories if it's a business account and we have a story catalog
82
+ if ($isBusiness && $this->storyCatalog) {
83
+ $storiesResult = $this->storyCatalog->query($source);
84
+
85
+ $result = new FetchResult(
86
+ array_merge($storiesResult->items, $result->items),
87
+ $result->source,
88
+ $result->catalogSize,
89
+ $result->nextCursor,
90
+ $result->prevCursor,
91
+ $result->errors
92
+ );
93
+ }
94
+
95
+ return $result;
96
+ }
97
+ }
core/Engine/Fetcher/CompositeCatalog.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Fetcher;
6
+
7
+ use RebelCode\Iris\Data\Source;
8
+ use RebelCode\Iris\Fetcher\Catalog;
9
+ use RebelCode\Iris\Fetcher\FetchResult;
10
+
11
+ /**
12
+ * A catalog implementation that provides items from multiple other catalogs.
13
+ */
14
+ class CompositeCatalog implements Catalog
15
+ {
16
+ /** @var Catalog[] */
17
+ protected $catalogs;
18
+
19
+ /**
20
+ * Constructor.
21
+ *
22
+ * @param Catalog[] $catalogs
23
+ */
24
+ public function __construct(array $catalogs)
25
+ {
26
+ $this->catalogs = $catalogs;
27
+ }
28
+
29
+ /** @inheritDoc */
30
+ public function query(Source $source, ?string $cursor = null, ?int $count = null): FetchResult
31
+ {
32
+ $result = new FetchResult([], $source, 0);
33
+
34
+ foreach ($this->catalogs as $catalog) {
35
+ $subResult = $catalog->query($source, $cursor, $count);
36
+ $result = new FetchResult(
37
+ array_merge($result->items, $subResult->items),
38
+ $source,
39
+ $result->catalogSize + ($subResult->catalogSize ?? 0),
40
+ $result->nextCursor ?? $subResult->nextCursor,
41
+ $result->prevCursor ?? $subResult->prevCursor,
42
+ array_merge($result->errors, $subResult->errors)
43
+ );
44
+ }
45
+
46
+ return $result;
47
+ }
48
+ }
core/Engine/Fetcher/IgFetchStrategy.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Fetcher;
6
+
7
+ use RebelCode\Iris\Data\Source;
8
+ use RebelCode\Iris\Fetcher\Catalog;
9
+ use RebelCode\Iris\Fetcher\FetchStrategy;
10
+
11
+ class IgFetchStrategy implements FetchStrategy
12
+ {
13
+ /** @var array<string, Catalog> */
14
+ protected $catalogMap;
15
+
16
+ /** @var Catalog|null */
17
+ protected $fallback;
18
+
19
+ /**
20
+ * Constructor.
21
+ *
22
+ * @param array<string, Catalog> $sourceCatalogMap
23
+ * @param Catalog|null $fallback
24
+ */
25
+ public function __construct(array $sourceCatalogMap, ?Catalog $fallback = null)
26
+ {
27
+ $this->catalogMap = $sourceCatalogMap;
28
+ $this->fallback = $fallback;
29
+ }
30
+
31
+ public function getCatalog(Source $source): ?Catalog
32
+ {
33
+ return $this->catalogMap[$source->type] ?? $this->fallback;
34
+ }
35
+ }
core/Engine/Fetcher/IgPostsCatalog.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Fetcher;
6
+
7
+ use Exception;
8
+ use Psr\Http\Client\ClientInterface;
9
+ use RebelCode\Iris\Data\Item;
10
+ use RebelCode\Iris\Data\Source;
11
+ use RebelCode\Iris\Fetcher\FetchResult;
12
+ use RebelCode\Psr7\Request;
13
+ use RebelCode\Psr7\Uri;
14
+ use RebelCode\Spotlight\Instagram\IgApi\IgApiUtils;
15
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
16
+
17
+ abstract class IgPostsCatalog
18
+ {
19
+ const BASIC_API_URL = 'https://graph.instagram.com';
20
+ const GRAPH_API_URL = 'https://graph.facebook.com';
21
+
22
+ public static function requestItems(
23
+ ClientInterface $client,
24
+ Source $source,
25
+ ?string $cursor,
26
+ ?int $count,
27
+ string $url,
28
+ array $args
29
+ ): FetchResult {
30
+ if ($cursor) {
31
+ $args['after'] = $cursor;
32
+ }
33
+
34
+ if ($count) {
35
+ $args['limit'] = $count;
36
+ }
37
+
38
+ $items = [];
39
+ $errors = [];
40
+ $nextCursor = null;
41
+ $prevCursor = null;
42
+
43
+ try {
44
+ $response = static::requestRaw($client, $url, $args);
45
+
46
+ $items = $response['data'] ?? [];
47
+ $items = Arrays::map($items, function (array $data) use ($source) {
48
+ return new Item($data['id'], null, [$source], $data);
49
+ });
50
+
51
+ if (!empty($response['paging']['next'] ?? null)) {
52
+ $nextCursor = $response['paging']['cursors']['after'] ?? null;
53
+ }
54
+
55
+ if (!empty($response['paging']['previous'] ?? null)) {
56
+ $prevCursor = $response['paging']['cursors']['before'] ?? null;
57
+ }
58
+ } catch (Exception $ex) {
59
+ $errors[] = $ex->getMessage();
60
+ }
61
+
62
+ return new FetchResult(
63
+ $items,
64
+ $source,
65
+ count($items),
66
+ $nextCursor,
67
+ $prevCursor,
68
+ $errors
69
+ );
70
+ }
71
+
72
+ public static function requestRaw(
73
+ ClientInterface $client,
74
+ string $url,
75
+ array $query = []
76
+ ): array {
77
+ // Merge the query into the URL
78
+ $uri = Uri::withQueryValues(new Uri($url), $query);
79
+
80
+ // Create and send the request
81
+ $request = new Request('GET', $uri);
82
+ $response = IgApiUtils::sendRequest($client, $request);
83
+
84
+ // Parse the body of the response
85
+ return IgApiUtils::parseResponse($response);
86
+ }
87
+ }
core/Engine/Fetcher/NullCatalog.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Fetcher;
6
+
7
+ use RebelCode\Iris\Data\Source;
8
+ use RebelCode\Iris\Fetcher\Catalog;
9
+ use RebelCode\Iris\Fetcher\FetchResult;
10
+
11
+ class NullCatalog implements Catalog
12
+ {
13
+ public function query(Source $source, ?string $cursor = null, ?int $count = null): FetchResult
14
+ {
15
+ return new FetchResult([], $source);
16
+ }
17
+ }
core/Engine/IgPostStore.php ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine;
6
+
7
+ use RebelCode\Iris\Data\Item;
8
+ use RebelCode\Iris\Data\Source;
9
+ use RebelCode\Iris\Exception\StoreException;
10
+ use RebelCode\Iris\Store;
11
+ use RebelCode\Iris\Store\Query\Condition;
12
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaChild;
13
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
14
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaProductType;
15
+ use RebelCode\Spotlight\Instagram\Engine\Store\ThumbnailStore;
16
+ use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
17
+ use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
18
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
19
+ use WP_Post;
20
+
21
+ class IgPostStore implements Store
22
+ {
23
+ /** @var string */
24
+ protected $postType;
25
+
26
+ /** @var ThumbnailStore */
27
+ protected $thumbnails;
28
+
29
+ /**
30
+ * Constructor.
31
+ *
32
+ * @param string $postType
33
+ * @param ThumbnailStore $thumbnailStore
34
+ */
35
+ public function __construct(string $postType, ThumbnailStore $thumbnailStore)
36
+ {
37
+ $this->postType = $postType;
38
+ $this->thumbnails = $thumbnailStore;
39
+ }
40
+
41
+ public function getPostType(): string
42
+ {
43
+ return $this->postType;
44
+ }
45
+
46
+ public function getThumbnailStore(): ThumbnailStore
47
+ {
48
+ return $this->thumbnails;
49
+ }
50
+
51
+ public function insert(Item $item): Item
52
+ {
53
+ $item = $this->thumbnails->downloadAndGenerate($item);
54
+
55
+ $postData = $this->itemToPostData($item);
56
+
57
+ $result = ($item->localId === null)
58
+ ? wp_insert_post($postData, true)
59
+ : wp_update_post(array_merge(['ID' => $item->localId], $postData), true);
60
+
61
+ if (is_wp_error($result)) {
62
+ throw new StoreException($result->get_error_message(), $this);
63
+ }
64
+
65
+ $insertedId = (int) $result;
66
+
67
+ delete_post_meta($insertedId, MediaPostType::SOURCE);
68
+ foreach ($item->sources as $source) {
69
+ add_post_meta($insertedId, MediaPostType::SOURCE, (string) $source);
70
+ }
71
+
72
+ return $item->withLocalId($insertedId);
73
+ }
74
+
75
+ public function insertMultiple(array $items, int $mode = self::THROW_ON_FAIL): array
76
+ {
77
+ $result = [];
78
+ foreach ($items as $item) {
79
+ set_time_limit(30);
80
+ try {
81
+ $result[] = $this->insert($item);
82
+ } catch (StoreException $ex) {
83
+ if ($mode === Store::THROW_ON_FAIL) {
84
+ throw $ex;
85
+ }
86
+ }
87
+ }
88
+
89
+ return $result;
90
+ }
91
+
92
+ public function get(string $id): ?Item
93
+ {
94
+ $post = get_post($id);
95
+
96
+ return ($post instanceof WP_Post && $post->post_type === $this->postType)
97
+ ? $this->postToItem($post)
98
+ : null;
99
+ }
100
+
101
+ public function getMultiple(array $ids): array
102
+ {
103
+ if (empty($ids)) {
104
+ return [];
105
+ }
106
+
107
+ $posts = get_posts([
108
+ 'post_type' => $this->postType,
109
+ 'post_status' => 'any',
110
+ 'meta_query' => [
111
+ 'relation' => 'AND',
112
+ [
113
+ 'key' => MediaPostType::MEDIA_ID,
114
+ 'value' => $ids,
115
+ 'compare' => 'IN',
116
+ ],
117
+ ],
118
+ ]);
119
+
120
+ return Arrays::createMap($posts, function (WP_Post $post) {
121
+ $item = $this->postToItem($post);
122
+
123
+ return [$item->id, $item];
124
+ });
125
+ }
126
+
127
+ public function getForSources(array $sources, ?int $count = null, int $offset = 0): array
128
+ {
129
+ return $this->query(
130
+ new Store\Query($sources, null, null, $count, $offset)
131
+ );
132
+ }
133
+
134
+ public function query(Store\Query $query): array
135
+ {
136
+ $args = $this->queryToWpQueryArgs($query);
137
+ $posts = get_posts($args);
138
+
139
+ return Arrays::map($posts, function (WP_Post $post) {
140
+ return $this->postToItem($post);
141
+ });
142
+ }
143
+
144
+ public function delete(string $id): bool
145
+ {
146
+ return $this->deleteItem($this->get($id));
147
+ }
148
+
149
+ public function deleteMultiple(array $ids): int
150
+ {
151
+ $count = 0;
152
+ foreach ($ids as $id) {
153
+ if ($this->delete($id)) {
154
+ $count++;
155
+ }
156
+ }
157
+
158
+ return $count;
159
+ }
160
+
161
+ public function deleteForSources(array $sources): int
162
+ {
163
+ $items = $this->getForSources($sources);
164
+
165
+ $count = 0;
166
+ foreach ($items as $item) {
167
+ if ($this->deleteItem($item)) {
168
+ $count++;
169
+ }
170
+ }
171
+
172
+ return $count;
173
+ }
174
+
175
+ protected function deleteItem(Item $item): bool
176
+ {
177
+ if ($item !== null && $item->localId !== null) {
178
+ $result = wp_delete_post($item->localId);
179
+
180
+ if (!empty($result)) {
181
+ $this->thumbnails->delete($item->id);
182
+
183
+ return true;
184
+ }
185
+ }
186
+
187
+ return false;
188
+ }
189
+
190
+ protected function itemToPostData(Item $item): array
191
+ {
192
+ $meta = [
193
+ MediaPostType::MEDIA_ID => $item->id,
194
+ MediaPostType::USERNAME => $item->data[MediaItem::USERNAME] ?? '',
195
+ MediaPostType::TIMESTAMP => $item->data[MediaItem::TIMESTAMP] ?? null,
196
+ MediaPostType::CAPTION => $item->data[MediaItem::CAPTION] ?? '',
197
+ MediaPostType::TYPE => $item->data[MediaItem::MEDIA_TYPE] ?? '',
198
+ MediaPostType::URL => $item->data[MediaItem::MEDIA_URL] ?? '',
199
+ MediaPostType::SIZE => $item->data[MediaItem::MEDIA_SIZE] ?? '',
200
+ MediaPostType::PERMALINK => $item->data[MediaItem::PERMALINK] ?? '',
201
+ MediaPostType::SHORTCODE => $item->data[MediaItem::SHORTCODE] ?? '',
202
+ MediaPostType::VIDEO_TITLE => $item->data[MediaItem::VIDEO_TITLE] ?? '',
203
+ MediaPostType::PRODUCT_TYPE => $item->data[MediaItem::MEDIA_PRODUCT_TYPE] ?? '',
204
+ MediaPostType::THUMBNAIL_URL => $item->data[MediaItem::THUMBNAIL_URL] ?? '',
205
+ MediaPostType::THUMBNAILS => $item->data[MediaItem::THUMBNAILS] ?? [],
206
+ MediaPostType::LIKES_COUNT => $item->data[MediaItem::LIKES_COUNT] ?? 0,
207
+ MediaPostType::COMMENTS_COUNT => $item->data[MediaItem::COMMENTS_COUNT] ?? 0,
208
+ MediaPostType::COMMENTS => $item->data[MediaItem::COMMENTS] ?? [],
209
+ MediaPostType::CHILDREN => $item->data[MediaItem::CHILDREN] ?? [],
210
+ MediaPostType::IS_STORY => $item->data[MediaItem::IS_STORY] ?? false,
211
+ MediaPostType::LAST_REQUESTED => time(),
212
+ ];
213
+
214
+ return [
215
+ 'post_type' => $this->postType,
216
+ 'post_status' => 'publish',
217
+ 'post_title' => wp_trim_words($item->data[MediaItem::CAPTION] ?? '', 20),
218
+ 'meta_input' => $meta,
219
+ ];
220
+ }
221
+
222
+ public function postToItem(WP_Post $post): Item
223
+ {
224
+ $id = $post->{MediaPostType::MEDIA_ID};
225
+
226
+ $sources = get_post_meta($post->ID, MediaPostType::SOURCE, false);
227
+ // If the item has no sources
228
+ if (empty($sources)) {
229
+ // Check the deprecated meta keys
230
+ $sources = [
231
+ new Source(
232
+ $post->{MediaPostType::SOURCE_NAME},
233
+ $post->{MediaPostType::SOURCE_TYPE}
234
+ ),
235
+ ];
236
+ } else {
237
+ $sources = Arrays::map($sources, [Source::class, 'fromString']);
238
+ }
239
+
240
+ $children = $post->{MediaPostType::CHILDREN};
241
+ $children = is_array($children) ? $children : [];
242
+ $children = Arrays::map($children, function ($child) {
243
+ return ($child instanceof IgMedia)
244
+ ? [
245
+ MediaChild::MEDIA_ID => $child->id,
246
+ MediaChild::MEDIA_TYPE => $child->type,
247
+ MediaChild::PERMALINK => $child->permalink,
248
+ MediaChild::SHORTCODE => $child->shortcode,
249
+ MediaChild::MEDIA_URL => $child->url,
250
+ ]
251
+ : (array) $child;
252
+ });
253
+
254
+ $thumbnails = $post->{MediaPostType::THUMBNAILS};
255
+ $thumbnails = is_array($thumbnails) ? $thumbnails : [];
256
+ $thumbnails = Arrays::map($thumbnails, function ($url) {
257
+ return is_ssl()
258
+ ? preg_replace('#^http://#', 'https://', $url, 1)
259
+ : $url;
260
+ });
261
+
262
+ $comments = $post->{MediaPostType::COMMENTS};
263
+ $comments = is_array($comments) ? $comments : [];
264
+
265
+ $likesCount = intval($post->{MediaPostType::LIKES_COUNT});
266
+ $commentsCount = intval($post->{MediaPostType::COMMENTS_COUNT});
267
+ $size = is_array($post->{MediaPostType::SIZE})
268
+ ? $post->{MediaPostType::SIZE}
269
+ : null;
270
+
271
+ $data = [
272
+ MediaItem::MEDIA_ID => $id,
273
+ MediaItem::CAPTION => $post->{MediaPostType::CAPTION},
274
+ MediaItem::USERNAME => $post->{MediaPostType::USERNAME},
275
+ MediaItem::TIMESTAMP => $post->{MediaPostType::TIMESTAMP},
276
+ MediaItem::MEDIA_TYPE => $post->{MediaPostType::TYPE},
277
+ MediaItem::MEDIA_URL => $post->{MediaPostType::URL},
278
+ MediaItem::MEDIA_PRODUCT_TYPE => $post->{MediaPostType::PRODUCT_TYPE} ?? MediaProductType::FEED,
279
+ MediaItem::MEDIA_SIZE => $size,
280
+ MediaItem::PERMALINK => $post->{MediaPostType::PERMALINK},
281
+ MediaItem::SHORTCODE => $post->{MediaPostType::SHORTCODE} ?? '',
282
+ MediaItem::VIDEO_TITLE => $post->{MediaPostType::VIDEO_TITLE} ?? '',
283
+ MediaItem::THUMBNAIL_URL => $post->{MediaPostType::THUMBNAIL_URL},
284
+ MediaItem::THUMBNAILS => $thumbnails,
285
+ MediaItem::LIKES_COUNT => $likesCount,
286
+ MediaItem::COMMENTS_COUNT => $commentsCount,
287
+ MediaItem::COMMENTS => $comments,
288
+ MediaItem::CHILDREN => $children,
289
+ MediaItem::IS_STORY => boolval($post->{MediaPostType::IS_STORY}),
290
+ MediaItem::LAST_REQUESTED => $post->{MediaPostType::LAST_REQUESTED},
291
+ MediaItem::POST => $post->ID,
292
+ ];
293
+
294
+ return new Item($id, $post->ID, $sources, $data);
295
+ }
296
+
297
+ protected function queryToWpQueryArgs(Store\Query $query): array
298
+ {
299
+ $queryArgs = [
300
+ 'post_type' => $this->postType,
301
+ 'posts_per_page' => $query->count ?? -1,
302
+ 'offset' => $query->offset,
303
+ ];
304
+
305
+ if ($query->order) {
306
+ $queryArgs['order'] = $query->order->type;
307
+ $queryArgs['order_by'] = $query->order->field;
308
+ } else {
309
+ $queryArgs['order'] = 'DESC';
310
+ $queryArgs['order_by'] = 'meta_val';
311
+ $queryArgs['meta_key'] = MediaPostType::TIMESTAMP;
312
+ $queryArgs['meta_type'] = 'DATETIME';
313
+ }
314
+
315
+ $sourceQuery = ['relation' => 'OR'];
316
+ foreach ($query->sources as $source) {
317
+ $sourceQuery[] = [
318
+ 'key' => MediaPostType::SOURCE,
319
+ 'value' => (string) $source,
320
+ 'compare' => '=',
321
+ ];
322
+ }
323
+
324
+ $metaQuery = [
325
+ 'relation' => 'AND',
326
+ $sourceQuery,
327
+ ];
328
+
329
+ if ($query->condition) {
330
+ $metaQuery[] = $this->conditionToMetaQuery($query->condition);
331
+ }
332
+
333
+ $queryArgs['meta_query'] = $metaQuery;
334
+
335
+ return $queryArgs;
336
+ }
337
+
338
+ protected function conditionToMetaQuery(Condition $condition): array
339
+ {
340
+ $result = ['relation' => $condition->relation];
341
+
342
+ foreach ($condition->criteria as $criterion) {
343
+ if ($criterion instanceof Store\Query\Expression) {
344
+ $result[] = [
345
+ 'key' => $criterion->field,
346
+ 'compare' => $criterion->operator,
347
+ 'value' => $criterion->value,
348
+ ];
349
+ } elseif ($criterion instanceof Condition) {
350
+ $result[] = $this->conditionToMetaQuery($criterion);
351
+ }
352
+ }
353
+
354
+ return $result;
355
+ }
356
+
357
+ /**
358
+ * Updates the last requested time for a list of items.
359
+ *
360
+ * @param Item[] $items The list of items.
361
+ */
362
+ public static function updateLastRequestedTime(array $items)
363
+ {
364
+ if (count($items) === 0) {
365
+ return;
366
+ }
367
+
368
+ global $wpdb;
369
+
370
+ $postIds = Arrays::join($items, ',', function (Item $item) {
371
+ return '\'' . $item->localId . '\'';
372
+ });
373
+
374
+ $table = $wpdb->prefix . 'postmeta';
375
+ $query = sprintf(
376
+ "UPDATE %s SET meta_value = '%s' WHERE meta_key = '%s' AND post_id IN (%s)",
377
+ $table,
378
+ time(),
379
+ MediaPostType::LAST_REQUESTED,
380
+ $postIds
381
+ );
382
+
383
+ $wpdb->query($query);
384
+ }
385
+ }
core/Engine/Importer.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine;
6
+
7
+ use RebelCode\Iris\Data\Feed;
8
+ use RebelCode\Iris\Engine;
9
+ use RebelCode\Iris\Fetcher\FetchQuery;
10
+ use RebelCode\Iris\Fetcher\FetchResult;
11
+ use RebelCode\Spotlight\Instagram\Feeds\FeedManager;
12
+ use RebelCode\Spotlight\Instagram\Wp\CronJob;
13
+
14
+ class Importer
15
+ {
16
+ /** @var Engine */
17
+ protected $engine;
18
+
19
+ /** @var FeedManager */
20
+ protected $feedManager;
21
+
22
+ /** @var int */
23
+ protected $batchSize;
24
+
25
+ /** @var string */
26
+ protected $batchCronHook;
27
+
28
+ public function __construct(Engine $engine, FeedManager $feedManager, int $batchSize, string $batchCronHook)
29
+ {
30
+ $this->engine = $engine;
31
+ $this->feedManager = $feedManager;
32
+ $this->batchSize = $batchSize;
33
+ $this->batchCronHook = $batchCronHook;
34
+ }
35
+
36
+ public function updateFeeds(): void
37
+ {
38
+ $feeds = $this->feedManager->query();
39
+
40
+ foreach ($feeds as $feed) {
41
+ $this->updateFeed($feed);
42
+ }
43
+ }
44
+
45
+ public function updateFeed(Feed $feed): array
46
+ {
47
+ $items = [];
48
+ $scheduledBatch = false;
49
+
50
+ foreach ($feed->sources as $source) {
51
+ /** @var $subResult FetchResult */
52
+ /** @var $subScheduledBatch bool */
53
+ [$subResult, $subScheduledBatch] = $this->importBatch(new FetchQuery($source, null, $this->batchSize));
54
+
55
+ $items = array_merge($items, $subResult->items);
56
+ $scheduledBatch = $scheduledBatch || $subScheduledBatch;
57
+ }
58
+
59
+ return [$items, $scheduledBatch];
60
+ }
61
+
62
+ public function importBatch(FetchQuery $query): array
63
+ {
64
+ // Allocate up to 30 minutes for each batch
65
+ set_time_limit(30 * 60);
66
+
67
+ $result = $this->engine->import($query);
68
+
69
+ $nextQuery = $query->forNextBatch($result);
70
+ $scheduledBatch = false;
71
+ if ($nextQuery !== null) {
72
+ $job = new CronJob($this->batchCronHook, [$nextQuery]);
73
+ CronJob::schedule($job, time() + 5);
74
+ $scheduledBatch = true;
75
+ }
76
+
77
+ return [$result, $scheduledBatch];
78
+ }
79
+ }
core/Engine/MediaItem.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine;
4
-
5
- use DateTime;
6
- use Exception;
7
- use RebelCode\Iris\Item;
8
- use RebelCode\Spotlight\Instagram\Engine\Sources\StorySource;
9
- use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
10
-
11
- class MediaItem
12
- {
13
- // FROM INSTAGRAM API
14
- // -----------------------
15
- const MEDIA_ID = 'media_id';
16
- const CAPTION = 'caption';
17
- const USERNAME = 'username';
18
- const TIMESTAMP = 'timestamp';
19
- const MEDIA_TYPE = 'media_type';
20
- const MEDIA_URL = 'media_url';
21
- const MEDIA_PRODUCT_TYPE = 'media_product_type';
22
- const PERMALINK = 'permalink';
23
- const SHORTCODE = 'shortcode';
24
- const VIDEO_TITLE = 'video_title';
25
- const THUMBNAIL_URL = 'thumbnail_url';
26
- const LIKES_COUNT = 'like_count';
27
- const COMMENTS_COUNT = 'comments_count';
28
- const COMMENTS = 'comments';
29
- const CHILDREN = 'children';
30
- // CUSTOM FIELDS
31
- // -----------------------
32
- const POST = 'post';
33
- const IS_STORY = 'is_story';
34
- const LAST_REQUESTED = 'last_requested';
35
- const THUMBNAILS = 'thumbnails';
36
- const MEDIA_SIZE = 'media_size';
37
- const SOURCE_TYPE = 'source_type';
38
- const SOURCE_NAME = 'source_name';
39
-
40
- /**
41
- * Checks if a media instance is an expired story.
42
- *
43
- * @since 0.6
44
- *
45
- * @param Item $media The media to check.
46
- *
47
- * @return bool True if the story is expired, false if not. True is also returned in the post has an invalid date.
48
- */
49
- public static function isExpiredStory(Item $media): bool
50
- {
51
- if ($media->data[static::SOURCE_TYPE] !== StorySource::TYPE) {
52
- return false;
53
- }
54
-
55
- try {
56
- $datetime = new DateTime($media->data[static::TIMESTAMP]);
57
- $diff = time() - $datetime->getTimestamp();
58
-
59
- return $diff > IgMedia::STORY_MAX_LIFE;
60
- } catch (Exception $exception) {
61
- return true;
62
- }
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Engine/Providers/IgAccountMediaProvider.php DELETED
@@ -1,127 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine\Providers;
4
-
5
- use Psr\Http\Client\ClientInterface;
6
- use RebelCode\Iris\Fetching\ItemProvider;
7
- use RebelCode\Iris\Result;
8
- use RebelCode\Iris\Source;
9
- use RebelCode\Spotlight\Instagram\Engine\Sources\UserSource;
10
- use RebelCode\Spotlight\Instagram\IgApi\IgApiUtils;
11
- use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
12
- use RebelCode\Spotlight\Instagram\Wp\PostType;
13
-
14
- /**
15
- * Provides Instagram media that belongs to an Instagram account.
16
- *
17
- * @since 0.5
18
- */
19
- class IgAccountMediaProvider implements ItemProvider
20
- {
21
- const DEFAULT_LIMIT = 50;
22
-
23
- /**
24
- * The API client.
25
- *
26
- * @since 0.5
27
- *
28
- * @var ClientInterface
29
- */
30
- protected $client;
31
-
32
- /**
33
- * @since 0.5
34
- *
35
- * @var PostType
36
- */
37
- protected $accounts;
38
-
39
- /**
40
- * @since 0.5
41
- *
42
- * @var bool
43
- */
44
- protected $isBusiness;
45
-
46
- /**
47
- * Constructor.
48
- *
49
- * @since 0.5
50
- *
51
- * @param ClientInterface $client The HTTP client.
52
- * @param PostType $accounts The accounts post type.
53
- * @param bool $isBusiness Whether or not to provide posts for business accounts using the Graph API.
54
- */
55
- public function __construct(ClientInterface $client, PostType $accounts, bool $isBusiness)
56
- {
57
- $this->client = $client;
58
- $this->accounts = $accounts;
59
- $this->isBusiness = $isBusiness;
60
- }
61
-
62
- /**
63
- * Static constructor for personal accounts.
64
- *
65
- * @since 0.5
66
- *
67
- * @param ClientInterface $client The HTTP client.
68
- * @param PostType $accounts The accounts post type.
69
- *
70
- * @return self
71
- */
72
- public static function forPersonalAccount(ClientInterface $client, PostType $accounts)
73
- {
74
- return new self($client, $accounts, false);
75
- }
76
-
77
- /**
78
- * Static constructor for business accounts.
79
- *
80
- * @since 0.5
81
- *
82
- * @param ClientInterface $client The HTTP client.
83
- * @param PostType $accounts The accounts post type.
84
- *
85
- * @return self
86
- */
87
- public static function forBusinessAccount(ClientInterface $client, PostType $accounts)
88
- {
89
- return new self($client, $accounts, true);
90
- }
91
-
92
- /**
93
- * @inheritDoc
94
- *
95
- * @since 0.5
96
- */
97
- public function getItems(Source $source, ?int $limit = null, int $offset = 0) : Result
98
- {
99
- $username = $source->data['name'] ?? null;
100
- $expectedType = $this->isBusiness ? UserSource::TYPE_BUSINESS : UserSource::TYPE_PERSONAL;
101
-
102
- if ($source->type !== $expectedType || empty($username)) {
103
- return Result::empty();
104
- }
105
-
106
- $account = AccountPostType::getByUsername($this->accounts, $username);
107
- if ($account === null) {
108
- return Result::error("Account \"{$username}\" does not exist on this site");
109
- }
110
-
111
- $userId = $account->user->id;
112
- $accessToken = $account->accessToken;
113
-
114
- $limit = $limit ?? static::DEFAULT_LIMIT;
115
- $baseUrl = $this->isBusiness ? IgProvider::GRAPH_API_URL : IgProvider::BASIC_API_URL;
116
- $fields = $this->isBusiness
117
- ? IgApiUtils::getBusinessMediaFields(true)
118
- : IgApiUtils::getPersonalMediaFields(true);
119
-
120
- return IgProvider::request($this->client, $source, "{$baseUrl}/{$userId}/media", [
121
- 'limit' => $limit,
122
- 'offset' => $offset,
123
- 'access_token' => $accessToken->code,
124
- 'fields' => implode(',', $fields),
125
- ]);
126
- }
127
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Engine/Providers/IgProvider.php DELETED
@@ -1,64 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine\Providers;
4
-
5
- use Exception;
6
- use Psr\Http\Client\ClientInterface;
7
- use RebelCode\Iris\Item;
8
- use RebelCode\Iris\Result;
9
- use RebelCode\Iris\Source;
10
- use RebelCode\Psr7\Request;
11
- use RebelCode\Psr7\Uri;
12
- use RebelCode\Spotlight\Instagram\IgApi\IgApiUtils;
13
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
14
-
15
- class IgProvider
16
- {
17
- const BASIC_API_URL = 'https://graph.instagram.com';
18
- const GRAPH_API_URL = 'https://graph.facebook.com';
19
-
20
- public static function request(
21
- ClientInterface $client,
22
- Source $source,
23
- string $url,
24
- array $query = [],
25
- bool $setNext = true
26
- ): Result {
27
- try {
28
- // Merge the query into the URL
29
- $uri = Uri::withQueryValues(new Uri($url), $query);
30
-
31
- // Create and send the request
32
- $request = new Request('GET', $uri);
33
- $response = IgApiUtils::sendRequest($client, $request);
34
-
35
- // Parse the body of the response to create the result
36
- $body = IgApiUtils::parseResponse($response);
37
-
38
- return static::createResult($client, $source, $body, $setNext);
39
- } catch (Exception $exception) {
40
- return Result::error($exception->getCode(), $exception->getCode());
41
- }
42
- }
43
-
44
- public static function createResult(ClientInterface $client, Source $source, array $body, bool $setNext = true)
45
- {
46
- $data = $body['data'] ?? [];
47
- $items = Arrays::map($data, function (array $data) use ($source) {
48
- return Item::create($data['id'], $source, $data);
49
- });
50
-
51
- $result = Result::success($items);
52
- $result->data['paging'] = $body['paging'] ?? [];
53
-
54
- $next = $body['paging']['next'] ?? null;
55
-
56
- if (!empty($next) && $setNext) {
57
- $result->next = function () use ($client, $source, $next) {
58
- return static::request($client, $source, $next);
59
- };
60
- }
61
-
62
- return $result;
63
- }
64
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Engine/Store/ThumbnailRecipe.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Store;
6
+
7
+ class ThumbnailRecipe
8
+ {
9
+ /** @var int */
10
+ public $width;
11
+
12
+ /** @var int */
13
+ public $jpegQuality;
14
+
15
+ /**
16
+ * Constructor.
17
+ *
18
+ * @param int $width
19
+ * @param int $jpegQuality
20
+ */
21
+ public function __construct(int $width, int $jpegQuality)
22
+ {
23
+ $this->width = $width;
24
+ $this->jpegQuality = $jpegQuality;
25
+ }
26
+ }
core/Engine/Store/ThumbnailStore.php ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Engine\Store;
6
+
7
+ use Exception;
8
+ use RebelCode\Iris\Data\Item;
9
+ use RebelCode\Spotlight\Instagram\Actions\IgImageProxy;
10
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
11
+ use RebelCode\Spotlight\Instagram\Utils\Files;
12
+ use RuntimeException;
13
+
14
+ /**
15
+ * @psalm-type ThumbnailSize = ThumbnailGenerator::SIZE_*
16
+ */
17
+ class ThumbnailStore
18
+ {
19
+ const SIZE_SMALL = 's';
20
+ const SIZE_MEDIUM = 'm';
21
+ const SIZE_LARGE = 'l';
22
+ const IMAGE_MIME_TYPE = 'image/jpeg';
23
+
24
+ /** @var string */
25
+ protected $dirName;
26
+
27
+ /** @var ThumbnailRecipe[] */
28
+ protected $recipes;
29
+
30
+ /** @var array|null */
31
+ protected $dirInfo = null;
32
+
33
+ /**
34
+ * Constructor.
35
+ *
36
+ * @param string $dirName
37
+ * @param ThumbnailRecipe[] $recipes
38
+ */
39
+ public function __construct(string $dirName, array $recipes)
40
+ {
41
+ $this->dirName = $dirName;
42
+ $this->recipes = $recipes;
43
+ }
44
+
45
+ public function downloadAndGenerate(Item $item): Item
46
+ {
47
+ $id = $item->id;
48
+ $url = $item->get(MediaItem::MEDIA_URL, '');
49
+ $type = $item->get(MediaItem::MEDIA_TYPE, '');
50
+ $thumbnail = $item->get(MediaItem::THUMBNAIL_URL, '');
51
+ $thumbnail = empty($thumbnail) ? null : $thumbnail;
52
+ $shortcode = $item->get(MediaItem::SHORTCODE);
53
+
54
+ $isVideo = $type === 'VIDEO';
55
+ $remoteImg = $isVideo ? $thumbnail : $url;
56
+
57
+ if (empty($remoteImg)) {
58
+ return $item;
59
+ }
60
+
61
+ $localImg = $this->getFileInfo($id)['path'];
62
+
63
+ try {
64
+ // Download the image if it doesn't exist
65
+ if (!file_exists($localImg)) {
66
+ static::downloadFile($remoteImg, $localImg);
67
+ }
68
+
69
+ // Get and save its dimensions
70
+ $imgSize = @getimagesize($localImg);
71
+
72
+ if (is_array($imgSize) && $imgSize[0] > 0 && $imgSize[1] > 0) {
73
+ $item = $item->with(MediaItem::MEDIA_SIZE, [
74
+ 'width' => $imgSize[0],
75
+ 'height' => $imgSize[1],
76
+ ]);
77
+ }
78
+
79
+ // If the item has no thumbnail, set it to the original image URL
80
+ if (empty($thumbnail)) {
81
+ $item = $item->with(MediaItem::THUMBNAIL_URL, $remoteImg);
82
+ }
83
+
84
+ // Generate smaller sizes of the original image
85
+ $newThumbnails = $this->generateThumbnails($id, $localImg);
86
+
87
+ // Use the proxy image URL for the large thumbnail
88
+ if (!empty($shortcode)) {
89
+ $newThumbnails[static::SIZE_LARGE] = IgImageProxy::getUrl($item->get(MediaItem::SHORTCODE), 'l');
90
+ }
91
+
92
+ // Then remove the original file
93
+ if (file_exists($localImg)) {
94
+ @unlink($localImg);
95
+ }
96
+
97
+ // Update the item's thumbnail map
98
+ $item = $item->with(MediaItem::THUMBNAILS, $newThumbnails);
99
+ } catch (Exception $exception) {
100
+ // do nothing
101
+ }
102
+
103
+ // Use proxy image URLs for the original media URLs
104
+ return IgImageProxy::itemWithProxyImages($item);
105
+ }
106
+
107
+ public function generateThumbnails(string $mediaId, string $imagePath, bool $overwrite = false): array
108
+ {
109
+ if (!file_exists($imagePath)) {
110
+ return [];
111
+ }
112
+
113
+ $result = [];
114
+
115
+ foreach ($this->recipes as $size => $recipe) {
116
+ $result[$size] = false;
117
+ $thumbnail = $this->getFileInfo($mediaId, $size);
118
+
119
+ // If the image does not already exist or we can overwrite it, pass image through the WordPress Image Editor
120
+ if (!file_exists($thumbnail['path']) || $overwrite) {
121
+ $editor = wp_get_image_editor($imagePath);
122
+
123
+ if (is_wp_error($editor)) {
124
+ continue;
125
+ }
126
+
127
+ @$editor->resize($recipe->width, null);
128
+ @$editor->set_quality($recipe->jpegQuality);
129
+ $editorResult = @$editor->save($thumbnail['path'], static::IMAGE_MIME_TYPE);
130
+
131
+ if (is_wp_error($editorResult)) {
132
+ continue;
133
+ }
134
+ }
135
+
136
+ $result[$size] = $thumbnail['url'];
137
+ }
138
+
139
+ return $result;
140
+ }
141
+
142
+ public function getThumbnails(string $mediaId): array
143
+ {
144
+ $result = [];
145
+
146
+ foreach ($this->recipes as $size => $recipe) {
147
+ $result[$size] = false;
148
+ $file = $this->getFileInfo($mediaId, $size);
149
+
150
+ if (file_exists($file['path'])) {
151
+ $result[$size] = $file;
152
+ }
153
+ }
154
+
155
+ return $result;
156
+ }
157
+
158
+ public function getFileInfo(string $mediaId, ?string $size = null): array
159
+ {
160
+ $dirInfo = $this->getDirInfo();
161
+ $suffix = $size ? "-{$size}" : '';
162
+ $fileName = "{$mediaId}{$suffix}.jpg";
163
+
164
+ return [
165
+ 'path' => $dirInfo['path'] . '/' . $fileName,
166
+ 'url' => $dirInfo['url'] . '/' . $fileName,
167
+ ];
168
+ }
169
+
170
+ public function getDirInfo(): array
171
+ {
172
+ if ($this->dirInfo !== null) {
173
+ return $this->dirInfo;
174
+ }
175
+
176
+ $uploadDir = wp_upload_dir();
177
+
178
+ if (isset($uploadDir['error']) && $uploadDir['error'] !== false) {
179
+ throw new RuntimeException(
180
+ 'Spotlight failed to access your uploads directory: ' . $uploadDir['error']
181
+ );
182
+ }
183
+
184
+ if (!is_dir($uploadDir['basedir'])) {
185
+ if (!mkdir($uploadDir['basedir'], 0775)) {
186
+ throw new RuntimeException(
187
+ 'Spotlight failed to create the uploads directory: ' . $uploadDir['basedir']
188
+ );
189
+ }
190
+ }
191
+
192
+ $subDir = $uploadDir['basedir'] . '/' . $this->dirName;
193
+ if (!is_dir($subDir)) {
194
+ if (!mkdir($subDir, 0775)) {
195
+ throw new RuntimeException(
196
+ 'Spotlight failed to create its photo uploads directory: ' . $subDir
197
+ );
198
+ }
199
+ }
200
+
201
+ // Fix the URL protocol to be HTTPS when the site is using SSL
202
+ $baseUrl = is_ssl()
203
+ ? str_replace('http://', 'https://', $uploadDir['baseurl'])
204
+ : $uploadDir['baseurl'];
205
+
206
+ return $this->dirInfo = [
207
+ 'path' => $subDir,
208
+ 'url' => $baseUrl . '/' . $this->dirName,
209
+ ];
210
+ }
211
+
212
+ /**
213
+ * Downloads a remote file.
214
+ *
215
+ * @param string $url The URL that points to the resource to be downloaded.
216
+ * @param string $filepath The path to the file to which the resource will downloaded to.
217
+ */
218
+ public static function downloadFile(string $url, string $filepath)
219
+ {
220
+ $curl = curl_init($url);
221
+
222
+ if (!$curl) {
223
+ throw new RuntimeException(
224
+ 'Spotlight was unable to initialize curl. Please check if the curl extension is enabled.'
225
+ );
226
+ }
227
+
228
+ $file = @fopen($filepath, 'wb');
229
+
230
+ if (!$file) {
231
+ throw new RuntimeException(
232
+ 'Spotlight was unable to create the file: ' . $filepath
233
+ );
234
+ }
235
+
236
+ try {
237
+ // SET UP CURL
238
+ {
239
+ curl_setopt($curl, CURLOPT_FILE, $file);
240
+ curl_setopt($curl, CURLOPT_FAILONERROR, true);
241
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
242
+ curl_setopt($curl, CURLOPT_ENCODING, '');
243
+ curl_setopt($curl, CURLOPT_TIMEOUT, 10);
244
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
245
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
246
+
247
+ if (!empty($_SERVER['HTTP_USER_AGENT'])) {
248
+ curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
249
+ }
250
+ }
251
+
252
+ $success = curl_exec($curl);
253
+
254
+ if (!$success) {
255
+ throw new RuntimeException(
256
+ 'Spotlight failed to get the media data from Instagram: ' . curl_error($curl)
257
+ );
258
+ }
259
+ } finally {
260
+ curl_close($curl);
261
+ fclose($file);
262
+ }
263
+ }
264
+
265
+ public function delete(string $mediaId)
266
+ {
267
+ foreach ($this->recipes as $size => $recipe) {
268
+ $thumbnail = $this->getFileInfo($mediaId, $size);
269
+
270
+ if (file_exists($thumbnail['path'])) {
271
+ @unlink($thumbnail['path']);
272
+ }
273
+ }
274
+ }
275
+
276
+ public function deleteAll()
277
+ {
278
+ $dirInfo = $this->getDirInfo();
279
+ Files::rmDirRecursive($dirInfo['path']);
280
+ }
281
+ }
core/Engine/Stores/WpPostMediaStore.php DELETED
@@ -1,376 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine\Stores;
4
-
5
- use RebelCode\Iris\Error;
6
- use RebelCode\Iris\Importing\ItemStore;
7
- use RebelCode\Iris\Item;
8
- use RebelCode\Iris\Result;
9
- use RebelCode\Iris\Source;
10
- use RebelCode\Spotlight\Instagram\Engine\MediaChild;
11
- use RebelCode\Spotlight\Instagram\Engine\MediaItem;
12
- use RebelCode\Spotlight\Instagram\Engine\MediaProductType;
13
- use RebelCode\Spotlight\Instagram\Engine\Sources\UserSource;
14
- use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
15
- use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaDownloader;
16
- use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
17
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
18
- use RebelCode\Spotlight\Instagram\Wp\PostType;
19
- use WP_Post;
20
-
21
- /**
22
- * The item store for storing Instagram media as WordPress posts.
23
- *
24
- * @since 0.5
25
- */
26
- class WpPostMediaStore implements ItemStore
27
- {
28
- /**
29
- * The media post type.
30
- *
31
- * @since 0.5
32
- *
33
- * @var PostType
34
- */
35
- protected $postType;
36
-
37
- /**
38
- * Constructor.
39
- *
40
- * @since 0.5
41
- *
42
- * @param PostType $postType The media post type.
43
- */
44
- public function __construct(PostType $postType)
45
- {
46
- $this->postType = $postType;
47
- }
48
-
49
- /**
50
- * @inheritDoc
51
- *
52
- * @since 0.5
53
- */
54
- public function store(array $items) : Result
55
- {
56
- $result = Result::empty();
57
-
58
- $numItems = count($items);
59
- if ($numItems === 0) {
60
- return $result;
61
- }
62
-
63
- set_time_limit(30);
64
-
65
- $existing = $this->getExistingItems($items);
66
-
67
- foreach ($items as $item) {
68
- // If the item does not exist, import it
69
- if (!array_key_exists($item->id, $existing)) {
70
- // Store the item
71
- $item = $this->add($item);
72
-
73
- if ($item instanceof Error) {
74
- $result->errors[] = $item;
75
- } else {
76
- $result->items[] = $item;
77
- $existing[$item->id] = true;
78
- }
79
- } else {
80
- $post = $this->postType->get($existing[$item->id]);
81
-
82
- if ($post !== null) {
83
- $postData = [
84
- 'meta_input' => [
85
- // This MUST be updated
86
- MediaPostType::URL => $item->data[MediaItem::MEDIA_URL] ?? '',
87
- // These don't usually need updating, but this helps auto-resolve previous import errors
88
- MediaPostType::CAPTION => $item->data[MediaItem::CAPTION] ?? '',
89
- MediaPostType::SHORTCODE => $item->data[MediaItem::SHORTCODE] ?? '',
90
- MediaPostType::VIDEO_TITLE => $item->data[MediaItem::VIDEO_TITLE] ?? '',
91
- MediaPostType::PRODUCT_TYPE => $item->data[MediaItem::MEDIA_PRODUCT_TYPE] ?? '',
92
- // Update the like and comment counts
93
- MediaPostType::LIKES_COUNT => $item->data[MediaItem::LIKES_COUNT] ?? 0,
94
- MediaPostType::COMMENTS_COUNT => $item->data[MediaItem::COMMENTS_COUNT] ?? 0,
95
- // Update the comments
96
- MediaPostType::COMMENTS => $item->data[MediaItem::COMMENTS]['data'] ?? [],
97
- ],
98
- ];
99
-
100
- // If the item is a video and has no thumbnail, re-download and regenerate the thumbnails
101
- if ($item->data[MediaItem::MEDIA_TYPE] === "VIDEO" &&
102
- $post->{MediaPostType::TYPE} === "VIDEO" &&
103
- empty($post->{MediaPostType::THUMBNAIL_URL})
104
- ) {
105
- $item = MediaDownloader::downloadItemFiles($item);
106
- $postData = static::itemToPostData($item);
107
- }
108
-
109
- // If the existing item and the current item are the same account, but one is from a personal
110
- // account and one is from a business account, update the existing post with the new item's source
111
- $currSrcType = $post->{MediaPostType::SOURCE_TYPE};
112
- $currSrcName = $post->{MediaPostType::SOURCE_NAME};
113
- $newSrcType = $item->source->type;
114
- $newSrcName = $item->source->data['name'] ?? '';
115
-
116
- if (($currSrcType === UserSource::TYPE_PERSONAL || $currSrcType === UserSource::TYPE_BUSINESS) &&
117
- ($newSrcType === UserSource::TYPE_PERSONAL || $newSrcType === UserSource::TYPE_BUSINESS) &&
118
- $currSrcType !== $newSrcType && $currSrcName === $newSrcName
119
- ) {
120
- $postData['meta_input'][MediaPostType::SOURCE_TYPE] = $item->source->type;
121
- $postData['meta_input'][MediaPostType::SOURCE_NAME] = $item->source->data['name'] ?? '';
122
- }
123
-
124
- $this->postType->update($post->ID, $postData);
125
- }
126
- }
127
- }
128
-
129
- // Report success if the number of errors is less than the number of items
130
- $result->success = count($result->errors) < $numItems;
131
-
132
- return $result;
133
- }
134
-
135
- /**
136
- * @inheritDoc
137
- *
138
- * @since 0.5
139
- */
140
- public function getItems(Source $source, ?int $limit = null, int $offset = 0) : Result
141
- {
142
- $posts = $this->postType->query([
143
- 'posts_per_page' => empty($limit) ? -1 : $limit,
144
- 'offset' => $offset,
145
- 'meta_query' => [
146
- 'relation' => 'AND',
147
- [
148
- 'key' => MediaPostType::SOURCE_TYPE,
149
- 'value' => $source->type,
150
- ],
151
- [
152
- 'key' => MediaPostType::SOURCE_NAME,
153
- 'value' => $source->data['name'] ?? '',
154
- ],
155
- ],
156
- ]);
157
-
158
- $items = Arrays::map($posts, function (WP_Post $post) use ($source) {
159
- return static::wpPostToItem($post, $source);
160
- });
161
-
162
- return Result::success($items);
163
- }
164
-
165
- /**
166
- * Adds a single item to the store.
167
- *
168
- * @since 0.5
169
- *
170
- * @param Item $item The item to add to the store.
171
- *
172
- * @return Item|Error The stored item on success, or an error on failure.
173
- */
174
- public function add(Item $item)
175
- {
176
- set_time_limit(30);
177
-
178
- // Download the files and get the updated item
179
- $item = MediaDownloader::downloadItemFiles($item);
180
-
181
- $postData = static::itemToPostData($item);
182
- $postId = $this->postType->insert($postData);
183
-
184
- // If failed to insert the post into the DB
185
- if (is_wp_error($postId)) {
186
- // Delete all created thumbnail files
187
- foreach (MediaDownloader::getAllThumbnails($item->id) as $file) {
188
- if (file_exists($file)) {
189
- @unlink($file);
190
- }
191
- }
192
-
193
- return new Error('Failed to insert post for item #' . $item->id);
194
- } else {
195
- return static::wpPostToItem(get_post($postId), $item->source);
196
- }
197
- }
198
-
199
- /**
200
- * Checks which items in a given list already exist in the database and returns them.
201
- *
202
- * @since 0.5
203
- *
204
- * @param Item[] $items The media list to check.
205
- *
206
- * @return array A mapping of media IDs to post IDs
207
- */
208
- public function getExistingItems(array $items) : array
209
- {
210
- global $wpdb;
211
-
212
- if (empty($items)) {
213
- return [];
214
- }
215
-
216
- $mediaIds = Arrays::join($items, ',', function (Item $item) {
217
- return $item->id;
218
- });
219
-
220
- $table = $wpdb->prefix . 'postmeta';
221
- $query = sprintf(
222
- "SELECT meta_value, post_id FROM %s WHERE meta_key = '%s' AND meta_value IN (%s)",
223
- $table,
224
- MediaPostType::MEDIA_ID,
225
- $mediaIds
226
- );
227
-
228
- $results = $wpdb->get_results($query, 'ARRAY_N');
229
-
230
- // Each value in $results is a tuple of the media ID and post ID
231
- // The below creates an associative array using each tuple as the key->value pair
232
- return Arrays::createMap($results, function ($pair) {
233
- return $pair;
234
- });
235
- }
236
-
237
- /**
238
- * Transforms an item into WordPress post data.
239
- *
240
- * @since 0.5
241
- *
242
- * @param Item $item The item instance.
243
- *
244
- * @return array The WordPress post data for the given item.
245
- */
246
- public static function itemToPostData(Item $item)
247
- {
248
- return [
249
- 'post_title' => $item->data[MediaItem::CAPTION] ?? '',
250
- 'post_status' => 'publish',
251
- 'meta_input' => [
252
- MediaPostType::MEDIA_ID => $item->id,
253
- MediaPostType::USERNAME => $item->data[MediaItem::USERNAME] ?? '',
254
- MediaPostType::TIMESTAMP => $item->data[MediaItem::TIMESTAMP] ?? null,
255
- MediaPostType::CAPTION => $item->data[MediaItem::CAPTION] ?? '',
256
- MediaPostType::TYPE => $item->data[MediaItem::MEDIA_TYPE] ?? '',
257
- MediaPostType::URL => $item->data[MediaItem::MEDIA_URL] ?? '',
258
- MediaPostType::SIZE => $item->data[MediaItem::MEDIA_SIZE] ?? '',
259
- MediaPostType::PERMALINK => $item->data[MediaItem::PERMALINK] ?? '',
260
- MediaPostType::SHORTCODE => $item->data[MediaItem::SHORTCODE] ?? '',
261
- MediaPostType::VIDEO_TITLE => $item->data[MediaItem::VIDEO_TITLE] ?? '',
262
- MediaPostType::PRODUCT_TYPE => $item->data[MediaItem::MEDIA_PRODUCT_TYPE] ?? '',
263
- MediaPostType::THUMBNAIL_URL => $item->data[MediaItem::THUMBNAIL_URL] ?? '',
264
- MediaPostType::THUMBNAILS => $item->data[MediaItem::THUMBNAILS] ?? [],
265
- MediaPostType::LIKES_COUNT => $item->data[MediaItem::LIKES_COUNT] ?? 0,
266
- MediaPostType::COMMENTS_COUNT => $item->data[MediaItem::COMMENTS_COUNT] ?? 0,
267
- MediaPostType::COMMENTS => $item->data[MediaItem::COMMENTS]['data'] ?? [],
268
- MediaPostType::CHILDREN => $item->data[MediaItem::CHILDREN]['data'] ?? [],
269
- MediaPostType::IS_STORY => $item->data[MediaItem::IS_STORY] ?? false,
270
- MediaPostType::LAST_REQUESTED => time(),
271
- MediaPostType::SOURCE_TYPE => $item->source->type,
272
- MediaPostType::SOURCE_NAME => $item->source->data['name'] ?? '',
273
- ],
274
- ];
275
- }
276
-
277
- /**
278
- * Transforms a WordPress post into an item.
279
- *
280
- * @since 0.5
281
- *
282
- * @param WP_Post $post The post.
283
- * @param Source $source
284
- *
285
- * @return Item The WordPress post data for the given item.
286
- */
287
- public static function wpPostToItem(WP_Post $post, Source $source) : Item
288
- {
289
- $children = $post->{MediaPostType::CHILDREN};
290
- $children = is_array($children) ? $children : [];
291
- $children = Arrays::map($children, function ($child) {
292
- return ($child instanceof IgMedia)
293
- ? [
294
- MediaChild::MEDIA_ID => $child->id,
295
- MediaChild::MEDIA_TYPE => $child->type,
296
- MediaChild::PERMALINK => $child->permalink,
297
- MediaChild::SHORTCODE => $child->shortcode,
298
- MediaChild::MEDIA_URL => $child->url,
299
- ]
300
- : (array) $child;
301
- });
302
-
303
- $thumbnails = $post->{MediaPostType::THUMBNAILS};
304
- $thumbnails = is_array($thumbnails) ? $thumbnails : [];
305
- $thumbnails = Arrays::map($thumbnails, function ($url) {
306
- return is_ssl()
307
- ? preg_replace('#^http://#', 'https://', $url, 1)
308
- : $url;
309
- });
310
-
311
- $comments = $post->{MediaPostType::COMMENTS};
312
- $comments = is_array($comments) ? $comments : [];
313
-
314
- $likesCount = intval($post->{MediaPostType::LIKES_COUNT});
315
- $commentsCount = intval($post->{MediaPostType::COMMENTS_COUNT});
316
- $size = is_array($post->{MediaPostType::SIZE})
317
- ? $post->{MediaPostType::SIZE}
318
- : null;
319
-
320
- return Item::create($post->ID, $source, [
321
- MediaItem::MEDIA_ID => $post->{MediaPostType::MEDIA_ID},
322
- MediaItem::CAPTION => $post->{MediaPostType::CAPTION},
323
- MediaItem::USERNAME => $post->{MediaPostType::USERNAME},
324
- MediaItem::TIMESTAMP => $post->{MediaPostType::TIMESTAMP},
325
- MediaItem::MEDIA_TYPE => $post->{MediaPostType::TYPE},
326
- MediaItem::MEDIA_URL => $post->{MediaPostType::URL},
327
- MediaItem::MEDIA_PRODUCT_TYPE => $post->{MediaPostType::PRODUCT_TYPE} ?? MediaProductType::FEED,
328
- MediaItem::MEDIA_SIZE => $size,
329
- MediaItem::PERMALINK => $post->{MediaPostType::PERMALINK},
330
- MediaItem::SHORTCODE => $post->{MediaPostType::SHORTCODE} ?? '',
331
- MediaItem::VIDEO_TITLE => $post->{MediaPostType::VIDEO_TITLE} ?? '',
332
- MediaItem::THUMBNAIL_URL => $post->{MediaPostType::THUMBNAIL_URL},
333
- MediaItem::THUMBNAILS => $thumbnails,
334
- MediaItem::LIKES_COUNT => $likesCount,
335
- MediaItem::COMMENTS_COUNT => $commentsCount,
336
- MediaItem::COMMENTS => $comments,
337
- MediaItem::CHILDREN => $children,
338
- MediaItem::IS_STORY => boolval($post->{MediaPostType::IS_STORY}),
339
- MediaItem::LAST_REQUESTED => $post->{MediaPostType::LAST_REQUESTED},
340
- MediaItem::SOURCE_NAME => $post->{MediaPostType::SOURCE_NAME},
341
- MediaItem::SOURCE_TYPE => $post->{MediaPostType::SOURCE_TYPE},
342
- MediaItem::POST => $post->ID,
343
- ]);
344
- }
345
-
346
- /**
347
- * Updates the last requested time for a list of media objects.
348
- *
349
- * @since 0.5
350
- *
351
- * @param Item[] $items The list of items.
352
- */
353
- public static function updateLastRequestedTime(array $items)
354
- {
355
- if (count($items) === 0) {
356
- return;
357
- }
358
-
359
- global $wpdb;
360
-
361
- $postIds = Arrays::join($items, ',', function (Item $item) {
362
- return '\'' . $item->data[MediaItem::POST] . '\'';
363
- });
364
-
365
- $table = $wpdb->prefix . 'postmeta';
366
- $query = sprintf(
367
- "UPDATE %s SET meta_value = '%s' WHERE meta_key = '%s' AND post_id IN (%s)",
368
- $table,
369
- time(),
370
- MediaPostType::LAST_REQUESTED,
371
- $postIds
372
- );
373
-
374
- $wpdb->query($query);
375
- }
376
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Engine/StoryFeed.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\Engine;
4
-
5
- use RebelCode\Iris\Aggregation\ItemFeed;
6
- use RebelCode\Spotlight\Instagram\Engine\Sources\StorySource;
7
- use RebelCode\Spotlight\Instagram\Engine\Sources\UserSource;
8
-
9
- class StoryFeed extends ItemFeed
10
- {
11
- public static function createFromFeed(ItemFeed $feed)
12
- {
13
- // Copy the feed's business account sources as story sources
14
- $sources = [];
15
- foreach ($feed->sources as $source) {
16
- if ($source->type === UserSource::TYPE_BUSINESS) {
17
- $sources[] = StorySource::create($source->data['name']);
18
- }
19
- }
20
-
21
- return new static($sources, $feed->options);
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/Feeds/FeedManager.php CHANGED
@@ -2,11 +2,11 @@
2
 
3
  namespace RebelCode\Spotlight\Instagram\Feeds;
4
 
5
- use RebelCode\Iris\Aggregation\ItemFeed;
6
- use RebelCode\Iris\Source;
7
- use RebelCode\Spotlight\Instagram\Engine\Sources\HashtagSource;
8
- use RebelCode\Spotlight\Instagram\Engine\Sources\TaggedUserSource;
9
- use RebelCode\Spotlight\Instagram\Engine\Sources\UserSource;
10
  use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
11
  use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
12
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
@@ -14,22 +14,16 @@ use RebelCode\Spotlight\Instagram\Wp\PostType;
14
  use WP_Post;
15
 
16
  /**
17
- * A manager for feeds (not WordPress Posts, but {@link ItemFeed} instances).
18
- *
19
- * @since 0.5
20
  */
21
  class FeedManager
22
  {
23
  /**
24
- * @since 0.5
25
- *
26
  * @var PostType
27
  */
28
  public $feeds;
29
 
30
  /**
31
- * @since 0.5
32
- *
33
  * @var PostType
34
  */
35
  public $accounts;
@@ -37,8 +31,6 @@ class FeedManager
37
  /**
38
  * Constructor.
39
  *
40
- * @since 0.5
41
- *
42
  * @param PostType $feeds
43
  * @param PostType $accounts
44
  */
@@ -51,13 +43,11 @@ class FeedManager
51
  /**
52
  * Gets the item feed for a post by ID.
53
  *
54
- * @since 0.5
55
- *
56
  * @param string|int $id The ID.
57
  *
58
- * @return ItemFeed|null The item feed, or null if the ID does not correspond to a post.
59
  */
60
- public function get($id)
61
  {
62
  return $this->wpPostToFeed($this->feeds->get($id));
63
  }
@@ -65,15 +55,13 @@ class FeedManager
65
  /**
66
  * Queries the feeds.
67
  *
68
- * @since 0.5
 
 
69
  *
70
- * @param array $query The WP_Query args.
71
- * @param int|null $num The number of feeds to retrieve.
72
- * @param int $page The result page number.
73
- *
74
- * @return ItemFeed[] A list of feeds.
75
  */
76
- public function query($query = [], $num = null, $page = 1)
77
  {
78
  return Arrays::map($this->feeds->query($query, $num, $page), [$this, 'wpPostToFeed']);
79
  }
@@ -81,13 +69,11 @@ class FeedManager
81
  /**
82
  * Retrieves the sources to use for a given set of feed options.
83
  *
84
- * @since 0.5
85
- *
86
  * @param array $options The feed options.
87
  *
88
  * @return Source[] A list of item sources.
89
  */
90
- public function getSources(array $options)
91
  {
92
  $sources = [];
93
 
@@ -119,29 +105,25 @@ class FeedManager
119
  }
120
 
121
  /**
122
- * Creates an {@link ItemFeed} from a set of feed options.
123
- *
124
- * @since 0.5
125
  *
126
  * @param array $options The feed options.
127
  *
128
- * @return ItemFeed The created feed.
129
  */
130
- public function createFeed(array $options)
131
  {
132
- return new ItemFeed($this->getSources($options), $options);
133
  }
134
 
135
  /**
136
- * Converts a WordPress post into an {@link ItemFeed}.
137
- *
138
- * @since 0.5
139
  *
140
  * @param WP_Post|null $post The WordPress post.
141
  *
142
- * @return ItemFeed|null The created feed or null if the post is null.
143
  */
144
- public function wpPostToFeed(?WP_Post $post)
145
  {
146
  if ($post === null) {
147
  return null;
2
 
3
  namespace RebelCode\Spotlight\Instagram\Feeds;
4
 
5
+ use RebelCode\Iris\Data\Feed;
6
+ use RebelCode\Iris\Data\Source;
7
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\HashtagSource;
8
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\TaggedUserSource;
9
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\UserSource;
10
  use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
11
  use RebelCode\Spotlight\Instagram\PostTypes\FeedPostType;
12
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
14
  use WP_Post;
15
 
16
  /**
17
+ * A manager for feeds (not WordPress Posts, but {@link Feed} instances).
 
 
18
  */
19
  class FeedManager
20
  {
21
  /**
 
 
22
  * @var PostType
23
  */
24
  public $feeds;
25
 
26
  /**
 
 
27
  * @var PostType
28
  */
29
  public $accounts;
31
  /**
32
  * Constructor.
33
  *
 
 
34
  * @param PostType $feeds
35
  * @param PostType $accounts
36
  */
43
  /**
44
  * Gets the item feed for a post by ID.
45
  *
 
 
46
  * @param string|int $id The ID.
47
  *
48
+ * @return Feed|null The item feed, or null if the ID does not correspond to a post.
49
  */
50
+ public function get($id): ?Feed
51
  {
52
  return $this->wpPostToFeed($this->feeds->get($id));
53
  }
55
  /**
56
  * Queries the feeds.
57
  *
58
+ * @param array $query The WP_Query args.
59
+ * @param int|null $num The number of feeds to retrieve.
60
+ * @param int $page The result page number.
61
  *
62
+ * @return Feed[] A list of feeds.
 
 
 
 
63
  */
64
+ public function query($query = [], $num = null, $page = 1): array
65
  {
66
  return Arrays::map($this->feeds->query($query, $num, $page), [$this, 'wpPostToFeed']);
67
  }
69
  /**
70
  * Retrieves the sources to use for a given set of feed options.
71
  *
 
 
72
  * @param array $options The feed options.
73
  *
74
  * @return Source[] A list of item sources.
75
  */
76
+ public function getSources(array $options): array
77
  {
78
  $sources = [];
79
 
105
  }
106
 
107
  /**
108
+ * Creates an {@link Feed} from a set of feed options.
 
 
109
  *
110
  * @param array $options The feed options.
111
  *
112
+ * @return Feed The created feed.
113
  */
114
+ public function createFeed(array $options): Feed
115
  {
116
+ return new Feed(null, $this->getSources($options), $options);
117
  }
118
 
119
  /**
120
+ * Converts a WordPress post into an {@link Feed}.
 
 
121
  *
122
  * @param WP_Post|null $post The WordPress post.
123
  *
124
+ * @return Feed|null The created feed or null if the post is null.
125
  */
126
+ public function wpPostToFeed(?WP_Post $post): ?Feed
127
  {
128
  if ($post === null) {
129
  return null;
core/MediaStore/Fetchers/AccountMediaFetcher.php DELETED
@@ -1,69 +0,0 @@
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->user);
64
- $result = $this->api->getAccountMedia($account);
65
-
66
- $store->addMedia($result['media'], $source);
67
- }
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/MediaStore/IgCachedMedia.php CHANGED
@@ -3,10 +3,13 @@
3
  namespace RebelCode\Spotlight\Instagram\MediaStore;
4
 
5
  use DateTime;
 
6
  use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
7
- use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaDownloader;
 
8
  use WP_Post;
9
 
 
10
  class IgCachedMedia extends IgMedia
11
  {
12
  /**
@@ -33,10 +36,15 @@ class IgCachedMedia extends IgMedia
33
  /**
34
  * @since 0.1
35
  *
 
 
36
  * @var MediaSource
37
  */
38
  public $source;
39
 
 
 
 
40
  /**
41
  * @inheritDoc
42
  *
@@ -75,7 +83,11 @@ class IgCachedMedia extends IgMedia
75
  $post = $extra['post'] ?? null;
76
  $lastRequested = empty($extra['last_requested']) ? time() : $extra['last_requested'];
77
  $source = MediaSource::create($extra['source'] ?? []);
78
- $thumbnails = MediaDownloader::getAllThumbnails($media->id, true);
 
 
 
 
79
 
80
  return static::create([
81
  'post' => $post,
@@ -87,7 +99,7 @@ class IgCachedMedia extends IgMedia
87
  'media_url' => $media->url,
88
  'permalink' => $media->permalink,
89
  'thumbnail_url' => $media->thumbnail,
90
- 'thumbnails' => $thumbnails,
91
  'like_count' => $media->likesCount,
92
  'comments_count' => $media->commentsCount,
93
  'comments' => $media->comments,
3
  namespace RebelCode\Spotlight\Instagram\MediaStore;
4
 
5
  use DateTime;
6
+ use RebelCode\Spotlight\Instagram\Engine\Store\ThumbnailStore;
7
  use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
8
+ use RebelCode\Spotlight\Instagram\Utils\Arrays;
9
+ use RebelCode\Spotlight\Instagram\Utils\Functions;
10
  use WP_Post;
11
 
12
+ /** @deprecated */
13
  class IgCachedMedia extends IgMedia
14
  {
15
  /**
36
  /**
37
  * @since 0.1
38
  *
39
+ * @deprecated Use {@link sources} instead.
40
+ *
41
  * @var MediaSource
42
  */
43
  public $source;
44
 
45
+ /** @var MediaSource[] */
46
+ public $sources;
47
+
48
  /**
49
  * @inheritDoc
50
  *
83
  $post = $extra['post'] ?? null;
84
  $lastRequested = empty($extra['last_requested']) ? time() : $extra['last_requested'];
85
  $source = MediaSource::create($extra['source'] ?? []);
86
+
87
+ /** @var ThumbnailStore $thumbStore */
88
+ $thumbStore = spotlightInsta()->get('engine/store/thumbnails');
89
+ $thumbnailFiles = $thumbStore->getThumbnails($media->id);
90
+ $thumbnailUrls = Arrays::map($thumbnailFiles, Functions::index('url'));
91
 
92
  return static::create([
93
  'post' => $post,
99
  'media_url' => $media->url,
100
  'permalink' => $media->permalink,
101
  'thumbnail_url' => $media->thumbnail,
102
+ 'thumbnails' => $thumbnailUrls,
103
  'like_count' => $media->likesCount,
104
  'comments_count' => $media->commentsCount,
105
  'comments' => $media->comments,
core/MediaStore/MediaFetcherInterface.php DELETED
@@ -1,27 +0,0 @@
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 DELETED
@@ -1,26 +0,0 @@
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 CHANGED
@@ -2,7 +2,6 @@
2
 
3
  namespace RebelCode\Spotlight\Instagram\MediaStore;
4
 
5
- use RebelCode\Spotlight\Instagram\IgApi\IgGraphApiClient;
6
  use RebelCode\Spotlight\Instagram\IgApi\IgUser;
7
 
8
  /**
2
 
3
  namespace RebelCode\Spotlight\Instagram\MediaStore;
4
 
 
5
  use RebelCode\Spotlight\Instagram\IgApi\IgUser;
6
 
7
  /**
core/MediaStore/MediaStore.php DELETED
@@ -1,360 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\MediaStore;
4
-
5
- use Exception;
6
- use RebelCode\Spotlight\Instagram\Feeds\Feed;
7
- use RebelCode\Spotlight\Instagram\IgApi\IgMedia;
8
- use RebelCode\Spotlight\Instagram\IgApi\IgUser;
9
- use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaDownloader;
10
- use RebelCode\Spotlight\Instagram\Modules\Pro\MediaStore\ProMediaSource;
11
- use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
12
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
13
- use RebelCode\Spotlight\Instagram\Wp\PostType;
14
- use RuntimeException;
15
- use wpdb;
16
-
17
- /**
18
- * The store for IG media.
19
- *
20
- * This class is responsible for providing Instagram media to other objects, such as feeds.
21
- *
22
- * All media fetching functionality is delegated to media fetchers, which are objects that implement
23
- * {@link MediaFetcherInterface}. The store will call each fetcher's {@link MediaFetcherInterface::fetch()} method,
24
- * passing the feed as well as itself as arguments. Fetchers are responsible for actually retrieving the media from
25
- * external sources, such as from the IG API. When a fetcher wishes to commit a list of media objects, they should
26
- * call {@link MediaStore::addMedia()} on the media store argument that they are given. This will tell the media
27
- * store to insert those media objects into the database (unless they already exist) and also add the media objects
28
- * into a **queue**. For stories, fetchers should call {@link MediaStore::addStories()} to ensure that story media do
29
- * not interfere with the count and offset slicing.
30
- *
31
- * Once all fetchers have been called, the media store will invoke the media processors.
32
- *
33
- * Media processors are objects that implement {@link MediaProcessorInterface}. The store will pass the fetched queue
34
- * to each processor, by reference (for performance reasons). Each processor may perform manipulations of the queue
35
- * directly. Since processors are called in sequence, each processor will be operating on the result of the previous
36
- * processor, making the order of processors potentially an important factor.
37
- *
38
- * The queue of media objects will persist until the {@link MediaStore::getFeedMedia()} method is called again.
39
- * Manipulations done by the store itself, such as offset and count slicing, will not affect the queue. These parameters
40
- * only used to control the size of the return value and the scope of any database updates (such as for "last requested
41
- * time" information). This ensures that the result of {@link MediaStore::getNumMedia()} is not affected by these
42
- * operations and accurately returns the size of the results generated by the fetchers and processors, the results of
43
- * which should always be the same when given the same feed (unlike offset and count slicing which are not dependant on
44
- * the feed).
45
- *
46
- * @since 0.1
47
- */
48
- class MediaStore
49
- {
50
- /**
51
- * @since 0.1
52
- *
53
- * @var wpdb
54
- */
55
- protected $wpdb;
56
-
57
- /**
58
- * @since 0.1
59
- *
60
- * @var MediaFetcherInterface[]
61
- */
62
- protected $fetchers;
63
-
64
- /**
65
- * @since 0.1
66
- *
67
- * @var MediaProcessorInterface[]
68
- */
69
- protected $processors;
70
-
71
- /**
72
- * @since 0.1
73
- *
74
- * @var PostType
75
- */
76
- protected $mediaCpt;
77
-
78
- /**
79
- * @since 0.1
80
- *
81
- * @var array
82
- */
83
- protected $queue;
84
-
85
- /**
86
- * @since 0.1
87
- *
88
- * @var array
89
- */
90
- protected $mediaQueue;
91
-
92
- /**
93
- * @since 0.1
94
- *
95
- * @var array
96
- */
97
- protected $storyQueue;
98
-
99
- /**
100
- * Constructor.
101
- *
102
- * @since 0.1
103
- *
104
- * @param wpdb $wpdb The WordPress database driver.
105
- * @param MediaFetcherInterface[] $fetchers The fetchers to use to fetch media.
106
- * @param MediaProcessorInterface[] $processors The processors to use to process media.
107
- * @param PostType $mediaCpt The media CPT.
108
- */
109
- public function __construct(
110
- wpdb $wpdb,
111
- array $fetchers,
112
- array $processors,
113
- PostType $mediaCpt
114
- ) {
115
- $this->wpdb = $wpdb;
116
- $this->fetchers = $fetchers;
117
- $this->processors = $processors;
118
- $this->mediaCpt = $mediaCpt;
119
- $this->mediaQueue = [];
120
- $this->storyQueue = [];
121
- }
122
-
123
- /**
124
- * Retrieves the media used by a given feed.
125
- *
126
- * @since 0.1
127
- *
128
- * @param Feed $feed The feed instance for which to retrieve media.
129
- * @param int $num The number of media objects to return. Will return all media objects if less than or equal
130
- * to zero.
131
- * @param int $offset The offset from which to begin returning media. Negative values will be treated as zero.
132
- *
133
- * @return IgCachedMedia[][] A tuple containing two lists of media objects. The first list will contain non-story
134
- * media while the second will only contain story media.
135
- */
136
- public function getFeedMedia(Feed $feed, int $num = -1, int $offset = 0)
137
- {
138
- $this->mediaQueue = [];
139
- $this->storyQueue = [];
140
-
141
- try {
142
- foreach ($this->fetchers as $fetcher) {
143
- $fetcher->fetch($feed, $this);
144
- }
145
- } catch (Exception $exception) {
146
- throw new RuntimeException(
147
- sprintf(
148
- __('Failed to fetch media due to an error from Instagram\'s API: %s', 'sli-insta'),
149
- $exception->getMessage()
150
- ),
151
- $exception->getCode(),
152
- $exception->getPrevious()
153
- );
154
- }
155
-
156
- foreach ($this->processors as $processor) {
157
- $processor->process($this->mediaQueue, $feed);
158
- }
159
-
160
- $total = count($this->mediaQueue);
161
- $offset = max(0, min($total, $offset));
162
-
163
- $toUpdate = $this->mediaQueue;
164
- $toReturn = $this->mediaQueue;
165
-
166
- if ($num > 0) {
167
- // We need to update the media that was requested between offset and num, as well as any preceding media.
168
- // This is because when feeds "Load more", the keep previous media on the screen. So we treat these media
169
- // as being requested again.
170
- // However, the returned list must respect the offset. So we need to slice again here with that offset
171
- // Example: [offset = 5, num = 3]
172
- // * Will return media from indices 5 to 8
173
- // * Will update media from indices 0 to 8
174
- $toUpdate = array_slice($this->mediaQueue, 0, $offset + $num);
175
- $toReturn = array_slice($toUpdate, $offset);
176
- }
177
-
178
- $this->updateLastRequestedTime($toUpdate);
179
-
180
- return [array_values($toReturn), array_values($this->storyQueue)];
181
- }
182
-
183
- /**
184
- * Retrieves the total number of media objects in the queue, prior to any offset and count slicing.
185
- *
186
- * @since 0.1
187
- *
188
- * @return int
189
- */
190
- public function getNumMedia()
191
- {
192
- return count($this->mediaQueue);
193
- }
194
-
195
- /**
196
- * Retrieves the total number of story media objects in the queue.
197
- *
198
- * @since 0.1
199
- *
200
- * @return int
201
- */
202
- public function getNumStories()
203
- {
204
- return count($this->storyQueue);
205
- }
206
-
207
- /**
208
- * Updates the store with a given list of media posts.
209
- *
210
- * @since 0.1
211
- *
212
- * @param IgMedia[] $mediaList The list of media to update the store with.
213
- * @param MediaSource $source The source from where the media is being imported.
214
- */
215
- public function addMedia(array $mediaList, MediaSource $source)
216
- {
217
- $this->updateWith($mediaList, $source, $this->mediaQueue);
218
- }
219
-
220
- /**
221
- * Updates the store with a given list of story media.
222
- *
223
- * Media that already exists in the store will be ignored. Comparison is done against the IG media ID.
224
- *
225
- * @since 0.1
226
- *
227
- * @param IgMedia[] $storyList The list of story media to update the store with.
228
- * @param igUser $user The user that the story belongs to.
229
- */
230
- public function addStories(array $storyList, IgUser $user)
231
- {
232
- if (class_exists(ProMediaSource::class)) {
233
- $this->updateWith($storyList, ProMediaSource::forStory($user), $this->storyQueue);
234
- }
235
- }
236
-
237
- /**
238
- * Updates the store with a given media list.
239
- *
240
- * Media that already exists in the store will be ignored. Comparison is done against the IG media ID.
241
- *
242
- * @since 0.1
243
- *
244
- * @param IgMedia[] $mediaList The list of media to update the store with.
245
- * @param MediaSource $source The source from where the media is being imported.
246
- * @param array $queue A reference to the queue to which to add the media.
247
- */
248
- protected function updateWith(array $mediaList, MediaSource $source, array &$queue)
249
- {
250
- if (empty($mediaList)) {
251
- return;
252
- }
253
-
254
- // Get the media from the DB whose media IDs are in the $mediaList.
255
- // This array is a mapping of media ID -> wp post ID
256
- $existing = $this->getExistingMedia($mediaList);
257
-
258
- foreach ($mediaList as $media) {
259
- $mediaId = $media->id;
260
-
261
- // Create a cached media instance from this media
262
- $cachedMedia = IgCachedMedia::from($media, [
263
- 'source' => $source,
264
- ]);
265
-
266
- // Only insert into the database if the media does not already exists
267
- if (!array_key_exists($mediaId, $existing)) {
268
- MediaDownloader::downloadMediaFiles($cachedMedia);
269
-
270
- $post = MediaPostType::toWpPost($cachedMedia);
271
- $postId = $this->mediaCpt->insert($post);
272
-
273
- if (is_wp_error($postId)) {
274
- continue;
275
- }
276
- } else {
277
- // If the media exists, get the post ID from the map
278
- $postId = $existing[$mediaId];
279
- }
280
-
281
- // Create a cached media instance from this media
282
- $cachedMedia = IgCachedMedia::from($media, [
283
- 'source' => $source,
284
- 'post' => get_post($postId),
285
- ]);
286
-
287
- // Add to the queue
288
- $queue[] = $cachedMedia;
289
-
290
- // Save the media's ID for future existence checks
291
- // Don't map it to a post ID to prevent future iterations from re-saving the last requested date
292
- $existing[$mediaId] = false;
293
- }
294
- }
295
-
296
- /**
297
- * Checks which media in a given list already exist in the database and returns them.
298
- *
299
- * @since 0.1
300
- *
301
- * @param array $mediaList The media list to check.
302
- *
303
- * @return array A mapping of media IDs to post IDs
304
- */
305
- protected function getExistingMedia(array $mediaList) : array
306
- {
307
- if (empty($mediaList)) {
308
- return [];
309
- }
310
-
311
- $mediaIds = Arrays::join($mediaList, ',', function (IgMedia $media) {
312
- return $media->id;
313
- });
314
-
315
- $table = $this->wpdb->prefix . 'postmeta';
316
- $query = sprintf(
317
- "SELECT meta_value, post_id FROM %s WHERE meta_key = '%s' AND meta_value IN (%s)",
318
- $table,
319
- MediaPostType::MEDIA_ID,
320
- $mediaIds
321
- );
322
-
323
- $results = $this->wpdb->get_results($query, 'ARRAY_N');
324
-
325
- // Transform the list, where each value is a tuple array of the media ID and post ID, into a mapping of media
326
- // IDs to post IDs
327
- return Arrays::mapPairs($results, function ($idx, $pair) {
328
- return $pair;
329
- });
330
- }
331
-
332
- /**
333
- * Updates the last requested time for a list of media objects.
334
- *
335
- * @since 0.1
336
- *
337
- * @param IgCachedMedia[] $mediaList The list of media objects to update.
338
- */
339
- protected function updateLastRequestedTime(array $mediaList)
340
- {
341
- if (count($mediaList) === 0) {
342
- return;
343
- }
344
-
345
- $ids = Arrays::join($mediaList, ',', function (IgCachedMedia $media) {
346
- return '\'' . $media->post->ID . '\'';
347
- });
348
-
349
- $table = $this->wpdb->prefix . 'postmeta';
350
- $query = sprintf(
351
- "UPDATE %s SET meta_value = '%s' WHERE meta_key = '%s' AND post_id IN (%s)",
352
- $table,
353
- time(),
354
- MediaPostType::LAST_REQUESTED,
355
- $ids
356
- );
357
-
358
- $this->wpdb->query($query);
359
- }
360
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/MediaStore/Processors/MediaDownloader.php DELETED
@@ -1,353 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\MediaStore\Processors;
4
-
5
- use Exception;
6
- use RebelCode\Iris\Item;
7
- use RebelCode\Iris\Source;
8
- use RebelCode\Spotlight\Instagram\Engine\MediaItem;
9
- use RebelCode\Spotlight\Instagram\MediaStore\IgCachedMedia;
10
- use RebelCode\Spotlight\Instagram\Utils\Files;
11
- use RuntimeException;
12
- use stdClass;
13
-
14
- /**
15
- * The media processor that downloads images files to create thumbnails.
16
- *
17
- * @since 0.4.1
18
- */
19
- class MediaDownloader
20
- {
21
- // The name of the thumbnails directory within the WordPress uploads directory.
22
- const DIR_NAME = "spotlight-insta";
23
- // The string identifiers for the image sizes
24
- const SIZE_SMALL = 's';
25
- const SIZE_MEDIUM = 'm';
26
- // The image sizes
27
- const SIZES = [
28
- self::SIZE_SMALL,
29
- self::SIZE_MEDIUM,
30
- ];
31
- // The image sizes to be generated
32
- const TO_GENERATE = [
33
- self::SIZE_SMALL => 480,
34
- self::SIZE_MEDIUM => 600,
35
- ];
36
- // The image quality to be generated
37
- const JPEG_QUALITY = [
38
- self::SIZE_SMALL => 80,
39
- self::SIZE_MEDIUM => 90,
40
- ];
41
-
42
- /**
43
- * Downloads all files for a given media.
44
- *
45
- * @since 0.4.1
46
- *
47
- * @param IgCachedMedia $media The media.
48
- */
49
- public static function downloadMediaFiles(IgCachedMedia $media)
50
- {
51
- $item = static::downloadItemFiles(Item::create($media->id, Source::auto($media->source->type), [
52
- 'media_type' => $media->type,
53
- 'media_url' => $media->url,
54
- 'thumbnail_url' => $media->thumbnail,
55
- ]));
56
-
57
- $media->thumbnail = $item->data['thumbnail'];
58
- $media->thumbnails = $item->data['thumbnails'];
59
- }
60
-
61
- /**
62
- * Downloads all files for a given media.
63
- *
64
- * @since 0.5
65
- *
66
- * @param Item $item
67
- *
68
- * @return Item
69
- */
70
- public static function downloadItemFiles(Item $item) : Item
71
- {
72
- $newItem = clone $item;
73
-
74
- $id = $item->id;
75
- $type = $item->data['media_type'] ?? '';
76
- $url = $item->data['media_url'] ?? '';
77
- $thumbnail = $item->data['thumbnail_url'] ?? '';
78
-
79
- if ($type === 'VIDEO') {
80
- $ogImageUrl = !empty($thumbnail)
81
- ? $thumbnail
82
- : null;
83
- } else {
84
- $ogImageUrl = $url;
85
- }
86
-
87
- if (!empty($ogImageUrl)) {
88
- $ogImgPath = static::getThumbnailFile($id, null)['path'];
89
-
90
- try {
91
- // Download the image if it doesn't exist
92
- if (!file_exists($ogImgPath)) {
93
- static::downloadFile($ogImageUrl, $ogImgPath);
94
- }
95
-
96
- // Get and save its dimensions
97
- $imgSize = @getimagesize($ogImgPath);
98
- if (is_array($imgSize) && $imgSize[0] > 0 && $imgSize[1] > 0) {
99
- $newItem->data[MediaItem::MEDIA_SIZE] = [
100
- 'width' => $imgSize[0],
101
- 'height' => $imgSize[1],
102
- ];
103
- }
104
-
105
- // Set the item's main thumbnail to point to the original image
106
- $newItem->data['thumbnail_url'] = $ogImageUrl;
107
-
108
- // Generate smaller sizes of the original image
109
- static::generateSizes($id, $ogImgPath);
110
-
111
- // Then remove the original file (unless its for a video post)
112
- if (file_exists($ogImgPath)) {
113
- @unlink($ogImgPath);
114
- }
115
-
116
- // Update the item's thumbnail list
117
- $newItem->data['thumbnails'] = static::getAllThumbnails($id, true);
118
- } catch (Exception $exception) {
119
- // do nothing
120
- }
121
- }
122
-
123
- return $newItem;
124
- }
125
-
126
- /**
127
- * Generates the different sized thumbnails for a given media.
128
- *
129
- * @since 0.4.1
130
- *
131
- * @param string $mediaId The ID of the media.
132
- * @param string $filepath The path to the file that contains the full image.
133
- */
134
- public static function generateSizes(string $mediaId, string $filepath)
135
- {
136
- foreach (static::TO_GENERATE as $size => $width) {
137
- $filePath = static::getThumbnailFile($mediaId, $size)['path'];
138
-
139
- if (!file_exists($filePath)) {
140
- $editor = wp_get_image_editor($filepath);
141
-
142
- if (!is_wp_error($editor)) {
143
- @$editor->resize($width, null);
144
- @$editor->set_quality(static::JPEG_QUALITY[$size]);
145
- @$editor->save(static::getThumbnailFile($mediaId, $size)['path'], 'image/jpeg');
146
- }
147
- }
148
- }
149
- }
150
-
151
- /**
152
- * Retrieves the path and URL to a thumbnail file for a specific media and a given size.
153
- *
154
- * @since 0.4.1
155
- *
156
- * @param string $mediaId The ID of the media.
157
- * @param string|null $size The size of the thumbnail to retrieve.
158
- *
159
- * @return string[] An array containing 2 keys: "path" and "url"
160
- */
161
- public static function getThumbnailFile(string $mediaId, $size = null) : array
162
- {
163
- $dir = static::getThumbnailsDir();
164
- $filename = $mediaId . (empty($size) ? '' : '-' . $size) . '.jpg';
165
-
166
- return [
167
- 'path' => $dir['path'] . '/' . $filename,
168
- 'url' => $dir['url'] . '/' . $filename,
169
- ];
170
- }
171
-
172
- /**
173
- * Retrieves the paths or URLs for all the generated thumbnails for a given media.
174
- *
175
- * @since 0.4.1
176
- *
177
- * @param string $mediaId The ID of the media.
178
- * @param bool $urls If true, URLs will be returned. If false, paths will be returned. Both URLs and paths
179
- * are absolute.
180
- *
181
- * @return string[] An array containing all the generated thumbnails.
182
- */
183
- public static function getAllThumbnails(string $mediaId, bool $urls = false) : array
184
- {
185
- $thumbnails = [];
186
-
187
- $largeFile = static::getThumbnailFile($mediaId, null);
188
- if (file_exists($largeFile['path'])) {
189
- $thumbnails['l'] = $largeFile[$urls ? 'url' : 'path'];
190
- }
191
-
192
- foreach (static::SIZES as $size) {
193
- $file = static::getThumbnailFile($mediaId, $size);
194
-
195
- if (file_exists($file['path'])) {
196
- $thumbnails[$size] = $file[$urls ? 'url' : 'path'];
197
- }
198
- }
199
-
200
- return $thumbnails;
201
- }
202
-
203
- /**
204
- * Retrieves the path and URL to the thumbnails directory.
205
- *
206
- * @since 0.4.1
207
- *
208
- * @return string[] An array containing 2 keys: 'path' and 'url'.
209
- */
210
- public static function getThumbnailsDir() : array
211
- {
212
- $uploadDir = wp_upload_dir();
213
-
214
- if (isset($uploadDir['error']) && $uploadDir['error'] !== false) {
215
- throw new RuntimeException(
216
- 'Spotlight failed to access your uploads directory: ' . $uploadDir['error']
217
- );
218
- }
219
-
220
- if (!is_dir($uploadDir['basedir'])) {
221
- if (!mkdir($uploadDir['basedir'], 0775)) {
222
- throw new RuntimeException(
223
- 'Spotlight failed to create the uploads directory: ' . $uploadDir['basedir']
224
- );
225
- }
226
- }
227
-
228
- $subDir = $uploadDir['basedir'] . '/' . static::DIR_NAME;
229
- if (!is_dir($subDir)) {
230
- if (!mkdir($subDir, 0775)) {
231
- throw new RuntimeException(
232
- 'Spotlight failed to create its photo uploads directory: ' . $subDir
233
- );
234
- }
235
- }
236
-
237
- // Fix the URL protocol to be HTTPS when the site is using SSL
238
- $baseUrl = is_ssl()
239
- ? str_replace('http://', 'https://', $uploadDir['baseurl'])
240
- : $uploadDir['baseurl'];
241
-
242
- return [
243
- 'path' => $subDir,
244
- 'url' => $baseUrl . '/' . static::DIR_NAME,
245
- ];
246
- }
247
-
248
- /**
249
- * Deletes the thumbnails directory and all files within.
250
- *
251
- * @since 0.4.1
252
- */
253
- public static function clearThumbnailsDir()
254
- {
255
- $dir = MediaDownloader::getThumbnailsDir();
256
- Files::rmDirRecursive($dir['path']);
257
- }
258
-
259
- /**
260
- * Downloads a remote file.
261
- *
262
- * @since 0.4.1
263
- *
264
- * @param string $url The URL that points to the resource to be downloaded.
265
- * @param string $filepath The path to the file to which the resource will downloaded to.
266
- */
267
- public static function downloadFile(string $url, string $filepath)
268
- {
269
- $curl = curl_init($url);
270
-
271
- if (!$curl) {
272
- throw new RuntimeException(
273
- 'Spotlight was unable to initialize curl. Please check if the curl extension is enabled.'
274
- );
275
- }
276
-
277
- $file = @fopen($filepath, 'wb');
278
-
279
- if (!$file) {
280
- throw new RuntimeException(
281
- 'Spotlight was unable to create the file: ' . $filepath
282
- );
283
- }
284
-
285
- try {
286
- // SET UP CURL
287
- {
288
- curl_setopt($curl, CURLOPT_FILE, $file);
289
- curl_setopt($curl, CURLOPT_FAILONERROR, true);
290
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
291
- curl_setopt($curl, CURLOPT_ENCODING, '');
292
- curl_setopt($curl, CURLOPT_TIMEOUT, 3);
293
-
294
- if (!empty($_SERVER['HTTP_USER_AGENT'])) {
295
- curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
296
- }
297
- }
298
-
299
- $success = curl_exec($curl);
300
-
301
- if (!$success) {
302
- throw new RuntimeException(
303
- 'Spotlight failed to get the media data from Instagram: ' . curl_error($curl)
304
- );
305
- }
306
- } finally {
307
- curl_close($curl);
308
- fclose($file);
309
- }
310
- }
311
-
312
- /**
313
- * Attempts to retrieve the thumbnail URL for a video post.
314
- *
315
- * @since 0.4.1
316
- *
317
- * @param IgCachedMedia $media The media.
318
- *
319
- * @return string|null The URL to the thumbnail or null if could not determine the thumbnail URL.
320
- */
321
- public static function getVideoThumbnail(IgCachedMedia $media)
322
- {
323
- $permalink = trailingslashit($media->permalink);
324
- $response = wp_remote_get($permalink . '?__a=1');
325
-
326
- if (!is_wp_error($response)) {
327
- $data = @json_decode($response['body']);
328
-
329
- if ($data instanceof stdClass && isset($data->graphql->shortcode_media->display_resources)) {
330
- $last = end($data->graphql->shortcode_media->display_resources) ?? null;
331
- if ($last) {
332
- return $last->src;
333
- }
334
- }
335
- }
336
-
337
- // Get the thumbnail URL from the IG page's "og:image" meta tag
338
- $response = wp_remote_get($permalink);
339
- if (!is_wp_error($response)) {
340
- preg_match(
341
- '/property="og:image"\s+content="([^"]+)"/mui',
342
- $response['body'],
343
- $matches
344
- );
345
-
346
- if (count($matches) > 1) {
347
- return $matches[1];
348
- }
349
- }
350
-
351
- return null;
352
- }
353
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/MediaStore/Processors/MediaSorterProcessor.php DELETED
@@ -1,115 +0,0 @@
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/Notifications/NewsNotificationProvider.php CHANGED
@@ -4,6 +4,7 @@ namespace RebelCode\Spotlight\Instagram\Notifications;
4
 
5
  use Psr\Http\Client\ClientInterface;
6
  use Psr\SimpleCache\CacheInterface;
 
7
  use Throwable;
8
 
9
  /**
@@ -61,7 +62,8 @@ class NewsNotificationProvider implements NotificationProvider
61
  if ($this->cache->has(static::CACHE_KEY)) {
62
  $raw = $this->cache->get(static::CACHE_KEY);
63
  } else {
64
- $response = $this->client->request('GET', '');
 
65
  $body = $response ? $response->getBody() : null;
66
  $raw = $body ? $body->getContents() : null;
67
  $fetched = true;
4
 
5
  use Psr\Http\Client\ClientInterface;
6
  use Psr\SimpleCache\CacheInterface;
7
+ use RebelCode\Psr7\Request;
8
  use Throwable;
9
 
10
  /**
62
  if ($this->cache->has(static::CACHE_KEY)) {
63
  $raw = $this->cache->get(static::CACHE_KEY);
64
  } else {
65
+ $request = new Request('GET', '');
66
+ $response = $this->client->sendRequest($request);
67
  $body = $response ? $response->getBody() : null;
68
  $raw = $body ? $body->getContents() : null;
69
  $fetched = true;
core/PostTypes/AccountPostType.php CHANGED
@@ -2,10 +2,11 @@
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;
@@ -13,7 +14,7 @@ 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
  *
@@ -36,6 +37,40 @@ class AccountPostType extends PostType
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
  *
@@ -207,64 +242,4 @@ class AccountPostType extends PostType
207
 
208
  return $result;
209
  }
210
-
211
- /**
212
- * Deletes an account and its associated media from the DB.
213
- *
214
- * @since 0.1
215
- *
216
- * @param string $id The ID of the account to delete.
217
- * @param PostType $accountsCpt The accounts post type.
218
- * @param PostType $mediaCpt The media post type.
219
- *
220
- * @return bool True on success, false on failure.
221
- */
222
- public static function deleteWithMedia(string $id, PostType $accountsCpt, PostType $mediaCpt)
223
- {
224
- // Make sure the account exists
225
- $post = $accountsCpt->get($id);
226
- if ($post === null) {
227
- return false;
228
- }
229
-
230
- // Delete associated media
231
- static::deleteAccountMedia($id, $accountsCpt, $mediaCpt);
232
-
233
- // Delete the account
234
- $result = $accountsCpt->delete($id);
235
- if ($result === false) {
236
- return false;
237
- }
238
-
239
- return true;
240
- }
241
-
242
- /**
243
- * Deletes all media associated with an account, by ID.
244
- *
245
- * @since 0.1
246
- *
247
- * @param string $id The ID of the account to delete.
248
- * @param PostType $accountsCpt The accounts post type.
249
- * @param PostType $mediaCpt The media post type.
250
- *
251
- * @return bool True on success, false on failure.
252
- */
253
- public static function deleteAccountMedia(string $id, PostType $accountsCpt, PostType $mediaCpt)
254
- {
255
- // Make sure the account exists
256
- $post = $accountsCpt->get($id);
257
- if ($post === null) {
258
- return false;
259
- }
260
-
261
- // Get the source for the account's user
262
- $account = static::fromWpPost($post);
263
- $user = $account->user;
264
- $source = MediaSource::forUser($user);
265
-
266
- MediaPostType::deleteForSource($source, $mediaCpt);
267
-
268
- return true;
269
- }
270
  }
2
 
3
  namespace RebelCode\Spotlight\Instagram\PostTypes;
4
 
5
+ use RebelCode\Iris\Store;
6
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\UserSource;
7
  use RebelCode\Spotlight\Instagram\IgApi\AccessToken;
8
  use RebelCode\Spotlight\Instagram\IgApi\IgAccount;
9
  use RebelCode\Spotlight\Instagram\IgApi\IgUser;
 
10
  use RebelCode\Spotlight\Instagram\Wp\PostType;
11
  use RuntimeException;
12
  use WP_Error;
14
 
15
  /**
16
  * The post type for accounts.
17
+ *
18
  * This class extends the {@link PostType} class only as a formality. The primary purpose of this class is to house
19
  * the meta key constants and functionality for dealing with posts of the account custom post type.
20
  *
37
  const ACCESS_TOKEN = '_sli_access_token';
38
  const ACCESS_EXPIRY = '_sli_access_expires';
39
 
40
+ /** @var Store */
41
+ protected $store;
42
+
43
+ /** Constructor */
44
+ public function __construct(string $slug, array $args, array $fields, Store $store)
45
+ {
46
+ parent::__construct($slug, $args, $fields);
47
+ $this->store = $store;
48
+ }
49
+
50
+ /** @inheritDoc */
51
+ public function delete($id)
52
+ {
53
+ // Make sure the account exists
54
+ $post = $this->get($id);
55
+ if ($post === null) {
56
+ return false;
57
+ }
58
+
59
+ // Get the source for the account's user
60
+ $account = static::fromWpPost($post);
61
+ $source = UserSource::create($account->user->username, $account->user->type);
62
+
63
+ // Delete the account
64
+ $result = parent::delete($id);
65
+
66
+ // If successful, delete the associated media
67
+ if ($result) {
68
+ $this->store->deleteForSources([$source]);
69
+ }
70
+
71
+ return $result;
72
+ }
73
+
74
  /**
75
  * Converts a WordPress post into an IG account instance.
76
  *
242
 
243
  return $result;
244
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  }
core/PostTypes/MediaPostType.php CHANGED
@@ -2,15 +2,8 @@
2
 
3
  namespace RebelCode\Spotlight\Instagram\PostTypes;
4
 
5
- use DateTime;
6
- use RebelCode\Iris\Source;
7
- use RebelCode\Spotlight\Instagram\IgApi\IgComment;
8
- use RebelCode\Spotlight\Instagram\MediaStore\IgCachedMedia;
9
- use RebelCode\Spotlight\Instagram\MediaStore\MediaSource;
10
- use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaDownloader;
11
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
12
  use RebelCode\Spotlight\Instagram\Wp\PostType;
13
- use WP_Post;
14
 
15
  /**
16
  * The post type for media.
@@ -41,222 +34,31 @@ class MediaPostType extends PostType
41
  const CHILDREN = '_sli_children';
42
  const LAST_REQUESTED = '_sli_last_requested';
43
  const IS_STORY = '_sli_is_story';
 
 
44
  const SOURCE_NAME = '_sli_source_name';
 
45
  const SOURCE_TYPE = '_sli_source_type';
46
 
47
- /**
48
- * Converts a WordPress post into an IG media instance.
49
- *
50
- * @since 0.1
51
- *
52
- * @param WP_Post $post
53
- *
54
- * @return IgCachedMedia
55
- */
56
- public static function fromWpPost(WP_Post $post) : IgCachedMedia
57
- {
58
- return IgCachedMedia::create([
59
- 'post' => $post,
60
- 'id' => $post->{static::MEDIA_ID},
61
- 'username' => $post->{static::USERNAME},
62
- 'timestamp' => $post->{static::TIMESTAMP},
63
- 'caption' => $post->{static::CAPTION},
64
- 'media_type' => $post->{static::TYPE},
65
- 'media_url' => $post->{static::URL},
66
- 'media_size' => $post->{static::SIZE},
67
- 'permalink' => $post->{static::PERMALINK},
68
- 'thumbnail_url' => $post->{static::THUMBNAIL_URL},
69
- 'thumbnails' => $post->{static::THUMBNAILS},
70
- 'likes_count' => $post->{static::LIKES_COUNT},
71
- 'comments_count' => $post->{static::COMMENTS_COUNT},
72
- 'comments' => array_map([IgComment::class, 'create'], $post->{static::COMMENTS}),
73
- 'children' => $post->{static::CHILDREN},
74
- 'last_requested' => $post->{static::LAST_REQUESTED},
75
- 'source' => MediaSource::create([
76
- 'name' => $post->{static::SOURCE_NAME},
77
- 'type' => $post->{static::SOURCE_TYPE},
78
- ]),
79
- ]);
80
- }
81
 
82
- /**
83
- * Converts an IG media instance into a WordPress post.
84
- *
85
- * @since 0.1
86
- *
87
- * @param IgCachedMedia $media
88
- *
89
- * @return array
90
- */
91
- public static function toWpPost(IgCachedMedia $media) : array
92
  {
93
- return [
94
- 'post_title' => $media->getCaption(),
95
- 'post_status' => 'publish',
96
- 'meta_input' => [
97
- static::MEDIA_ID => $media->id,
98
- static::USERNAME => $media->username,
99
- static::TIMESTAMP => $media->timestamp ? $media->timestamp->format(DateTime::ISO8601) : null,
100
- static::CAPTION => $media->caption,
101
- static::TYPE => $media->type,
102
- static::URL => $media->url,
103
- static::PERMALINK => $media->permalink,
104
- static::THUMBNAIL_URL => $media->thumbnail,
105
- static::THUMBNAILS => $media->thumbnails,
106
- static::LIKES_COUNT => $media->likesCount,
107
- static::COMMENTS_COUNT => $media->commentsCount,
108
- static::COMMENTS => array_map([static::class, 'commentToArray'], $media->comments),
109
- static::CHILDREN => $media->children,
110
- static::LAST_REQUESTED => $media->lastRequested,
111
- static::SOURCE_NAME => $media->source->name,
112
- static::SOURCE_TYPE => $media->source->type,
113
- ],
114
- ];
115
  }
116
 
117
- /**
118
- * Converts a comment into an array for storing in post meta.
119
- *
120
- * @since 0.1
121
- *
122
- * @param IgComment $comment The comment instance.
123
- *
124
- * @return array
125
- */
126
- public static function commentToArray(IgComment $comment)
127
  {
128
- return [
129
- 'id' => $comment->id,
130
- 'username' => $comment->username,
131
- 'text' => $comment->text,
132
- 'timestamp' => $comment->timestamp->format(DateTime::ISO8601),
133
- 'like_count' => $comment->likeCount,
134
- ];
135
- }
136
-
137
- /**
138
- * Deletes all media associated with a particular source.
139
- *
140
- * @since 0.1
141
- *
142
- * @param MediaSource $source The source for which to delete media.
143
- * @param PostType $cpt The media post type.
144
- *
145
- * @return int The number of deleted media.
146
- */
147
- public static function deleteForSource(MediaSource $source, PostType $cpt)
148
- {
149
- $media = $cpt->query([
150
- 'meta_query' => [
151
- 'relation' => 'AND',
152
- [
153
- 'key' => MediaPostType::SOURCE_NAME,
154
- 'value' => $source->name,
155
- ],
156
- [
157
- 'key' => MediaPostType::SOURCE_TYPE,
158
- 'value' => $source->type,
159
- ],
160
- ],
161
- ]);
162
-
163
- $count = 0;
164
- Arrays::each($media, function (WP_Post $post) use (&$count) {
165
- $result = static::deleteMedia($post);
166
-
167
- if (!empty($result)) {
168
- $count++;
169
- }
170
- });
171
 
172
- return $count;
173
- }
174
-
175
- /**
176
- * Deletes a media post and all associated data.
177
- *
178
- * @since 0.4.1
179
- *
180
- * @param WP_Post $post The post for the media to delete.
181
- *
182
- * @return bool True on success, false on failure.
183
- */
184
- public static function deleteMedia(WP_Post $post) : bool
185
- {
186
- $success = wp_delete_post($post->ID, true);
187
-
188
- $thumbnails = MediaDownloader::getAllThumbnails($post->{static::MEDIA_ID});
189
-
190
- foreach ($thumbnails as $thumbnail) {
191
- if (file_exists($thumbnail)) {
192
- @unlink($thumbnail);
193
- }
194
  }
195
 
196
- return $success !== false;
197
- }
198
-
199
- /**
200
- * Deletes all media posts and their associated meta data from the database.
201
- *
202
- * @since 0.2
203
- *
204
- * @return bool|int False on failure, the number of deleted media posts and meta entries on success.
205
- */
206
- public static function deleteAll()
207
- {
208
- global $wpdb;
209
-
210
- $query = sprintf(
211
- 'DELETE post, meta
212
- FROM %s as post
213
- LEFT JOIN %s as meta on post.ID = meta.post_id
214
- WHERE post.post_type = \'sl-insta-media\'',
215
- $wpdb->posts,
216
- $wpdb->postmeta
217
- );
218
-
219
- MediaDownloader::clearThumbnailsDir();
220
-
221
- return $wpdb->query($query);
222
- }
223
-
224
- /**
225
- * Retrieves all used the sources from across all the media in the database.
226
- *
227
- * @since 0.5.3
228
- *
229
- * @return Source[] An array of sources.
230
- */
231
- public static function getUsedSources()
232
- {
233
- global $wpdb;
234
-
235
- $namesSubQuery = sprintf(
236
- /** @lang text */
237
- 'SELECT post_id, meta_value as name
238
- FROM %s WHERE meta_key = "_sli_source_name"',
239
- $wpdb->postmeta
240
- );
241
-
242
- $typesSubQuery = sprintf(
243
- /** @lang text */
244
- 'SELECT post_id, meta_value as type
245
- FROM %s WHERE meta_key = "_sli_source_type"',
246
- $wpdb->postmeta
247
- );
248
-
249
- $query = sprintf(
250
- /** @lang text */
251
- 'SELECT DISTINCT name, type
252
- FROM (%s) as sources
253
- INNER JOIN (%s) as types ON sources.post_id = types.post_id',
254
- $namesSubQuery,
255
- $typesSubQuery
256
- );
257
-
258
- return Arrays::map($wpdb->get_results($query), function ($data) {
259
- return Source::auto($data->type, ['name' => $data->name]);
260
- });
261
  }
262
  }
2
 
3
  namespace RebelCode\Spotlight\Instagram\PostTypes;
4
 
5
+ use RebelCode\Spotlight\Instagram\Engine\Store\ThumbnailStore;
 
 
 
 
 
 
6
  use RebelCode\Spotlight\Instagram\Wp\PostType;
 
7
 
8
  /**
9
  * The post type for media.
34
  const CHILDREN = '_sli_children';
35
  const LAST_REQUESTED = '_sli_last_requested';
36
  const IS_STORY = '_sli_is_story';
37
+ const SOURCE = '_sli_source';
38
+ /** @deprecated Use {@link SOURCE} instead. */
39
  const SOURCE_NAME = '_sli_source_name';
40
+ /** @deprecated Use {@link SOURCE} instead. */
41
  const SOURCE_TYPE = '_sli_source_type';
42
 
43
+ /** @var ThumbnailStore */
44
+ protected $thumbnails;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
+ /** Constructor */
47
+ public function __construct(string $slug, array $args, array $fields, ThumbnailStore $thumbnailStore)
 
 
 
 
 
 
 
 
48
  {
49
+ parent::__construct($slug, $args, $fields);
50
+ $this->thumbnails = $thumbnailStore;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
53
+ /** @inheritDoc */
54
+ public function deleteAll()
 
 
 
 
 
 
 
 
55
  {
56
+ $result = parent::deleteAll();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ if ($result !== false) {
59
+ $this->thumbnails->deleteAll();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
+ return $result;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
  }
core/RestApi/EndPoints/AbstractEndpointHandler.php CHANGED
@@ -211,10 +211,12 @@ abstract class AbstractEndpointHandler
211
  *
212
  * @since 0.2.3
213
  *
214
- * @param int|string $code The error code.
215
- * @param string $message The error message.
216
- * @param string $file
217
- * @param int $line
 
 
218
  */
219
  protected function sendError($code, $message = '', $file = '', $line = 0)
220
  {
211
  *
212
  * @since 0.2.3
213
  *
214
+ * @param int|string $code The error code.
215
+ * @param string $message The error message.
216
+ * @param string $file
217
+ * @param int $line
218
+ *
219
+ * @return never-returns
220
  */
221
  protected function sendError($code, $message = '', $file = '', $line = 0)
222
  {
core/RestApi/EndPoints/Accounts/ConnectAccountEndPoint.php CHANGED
@@ -57,24 +57,31 @@ class ConnectAccountEndPoint extends AbstractEndpointHandler
57
  return new WP_REST_Response(['error' => "Access token is required"], 400);
58
  }
59
 
60
- // Construct the access token object
61
- $accessToken = new AccessToken($tokenCode, 0);
62
 
63
  try {
64
- // FOR BUSINESS ACCOUNT ACCESS TOKENS
65
- if (stripos($tokenCode, 'EA') === 0 && strlen($tokenCode) > 145) {
66
- $userId = filter_var($request['userId'], FILTER_SANITIZE_STRING);
67
 
68
- if (empty($userId)) {
69
- return new WP_REST_Response(['error' => 'The user ID is required for business accounts'], 400);
70
- }
71
 
72
- $account = $this->client->getGraphApi()->getAccountForUser($userId, $accessToken);
73
- } else {
74
- // FOR PERSONAL ACCOUNT ACCESS TOKENS
75
- $user = $this->client->getBasicApi()->getTokenUser($accessToken);
76
- $account = new IgAccount($user, $accessToken);
 
 
 
 
 
 
 
 
 
77
  }
 
78
  // Insert the account into the database (or update existing account)
79
  $accountId = AccountPostType::insertOrUpdate($this->cpt, $account);
80
 
57
  return new WP_REST_Response(['error' => "Access token is required"], 400);
58
  }
59
 
60
+ $userId = filter_var($request['userId'], FILTER_SANITIZE_STRING);
 
61
 
62
  try {
63
+ // Construct the access token object
64
+ $accessToken = new AccessToken($tokenCode, 0);
 
65
 
66
+ // Attempt to connect via a filter first
67
+ $account = apply_filters('spotlight/instagram/api/connect_access_token', null, $accessToken, $userId);
 
68
 
69
+ // Connect via Instagram
70
+ if ($account === null) {
71
+ // FOR BUSINESS ACCOUNT ACCESS TOKENS
72
+ if (stripos($tokenCode, 'EA') === 0 && strlen($tokenCode) > 145) {
73
+ if (empty($userId)) {
74
+ return new WP_REST_Response(['error' => 'The user ID is required for business accounts'], 400);
75
+ }
76
+
77
+ $account = $this->client->getGraphApi()->getAccountForUser($userId, $accessToken);
78
+ } else {
79
+ // FOR PERSONAL ACCOUNT ACCESS TOKENS
80
+ $user = $this->client->getBasicApi()->getTokenUser($accessToken);
81
+ $account = new IgAccount($user, $accessToken);
82
+ }
83
  }
84
+
85
  // Insert the account into the database (or update existing account)
86
  $accountId = AccountPostType::insertOrUpdate($this->cpt, $account);
87
 
core/RestApi/EndPoints/Accounts/DeleteAccountEndPoint.php CHANGED
@@ -3,7 +3,6 @@
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 RebelCode\Spotlight\Instagram\Wp\RestRequest;
@@ -68,7 +67,13 @@ class DeleteAccountEndPoint extends AbstractEndpointHandler
68
 
69
  $id = $request->get_param('id');
70
 
71
- AccountPostType::deleteWithMedia($id, $this->accountsCpt, $this->mediaCpt);
 
 
 
 
 
 
72
 
73
  return new WP_REST_Response(array_map([$this->transformer, 'transform'], $this->accountsCpt->query()));
74
  }
3
  namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
 
5
  use Dhii\Transformer\TransformerInterface;
 
6
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
  use RebelCode\Spotlight\Instagram\Wp\PostType;
8
  use RebelCode\Spotlight\Instagram\Wp\RestRequest;
67
 
68
  $id = $request->get_param('id');
69
 
70
+ $result = $this->accountsCpt->delete($id);
71
+
72
+ if (!$result) {
73
+ return new WP_Error('sli_account_delete_failed', 'Failed to delete the account', [
74
+ 'status' => 500,
75
+ ]);
76
+ }
77
 
78
  return new WP_REST_Response(array_map([$this->transformer, 'transform'], $this->accountsCpt->query()));
79
  }
core/RestApi/EndPoints/Accounts/DeleteAccountMediaEndpoint.php CHANGED
@@ -2,9 +2,9 @@
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\Wp\PostType;
10
  use RebelCode\Spotlight\Instagram\Wp\RestRequest;
@@ -14,44 +14,23 @@ use WP_REST_Response;
14
 
15
  /**
16
  * Endpoint handler for deleting accounts.
17
- *
18
- * @since 0.1
19
  */
20
  class DeleteAccountMediaEndpoint extends AbstractEndpointHandler
21
  {
22
- /**
23
- * @since 0.1
24
- *
25
- * @var PostType
26
- */
27
  protected $accountsCpt;
28
 
29
- /**
30
- * @since 0.1
31
- *
32
- * @var PostType
33
- */
34
- protected $mediaCpt;
35
 
36
- /**
37
- * Constructor.
38
- *
39
- * @since 0.1
40
- *
41
- * @param PostType $accountsCpt The accounts post type.
42
- * @param PostType $mediaCpt The media post type.
43
- */
44
- public function __construct(PostType $accountsCpt, PostType $mediaCpt)
45
  {
46
  $this->accountsCpt = $accountsCpt;
47
- $this->mediaCpt = $mediaCpt;
48
  }
49
 
50
- /**
51
- * @inheritDoc
52
- *
53
- * @since 0.1
54
- */
55
  protected function handle(WP_REST_Request $request)
56
  {
57
  if (!RestRequest::has_param($request, 'id')) {
@@ -66,9 +45,9 @@ class DeleteAccountMediaEndpoint extends AbstractEndpointHandler
66
  }
67
 
68
  $account = AccountPostType::fromWpPost($accountPost);
69
- $source = MediaSource::forUser($account->user);
70
 
71
- MediaPostType::deleteForSource($source, $this->mediaCpt);
72
 
73
  return new WP_REST_Response(['ok' => 1]);
74
  }
2
 
3
  namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts;
4
 
5
+ use RebelCode\Iris\Store;
6
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\UserSource;
7
  use RebelCode\Spotlight\Instagram\PostTypes\AccountPostType;
 
8
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
9
  use RebelCode\Spotlight\Instagram\Wp\PostType;
10
  use RebelCode\Spotlight\Instagram\Wp\RestRequest;
14
 
15
  /**
16
  * Endpoint handler for deleting accounts.
 
 
17
  */
18
  class DeleteAccountMediaEndpoint extends AbstractEndpointHandler
19
  {
20
+ /** @var PostType */
 
 
 
 
21
  protected $accountsCpt;
22
 
23
+ /** @var Store */
24
+ protected $store;
 
 
 
 
25
 
26
+ /** Constructor */
27
+ public function __construct(PostType $accountsCpt, Store $store)
 
 
 
 
 
 
 
28
  {
29
  $this->accountsCpt = $accountsCpt;
30
+ $this->store = $store;
31
  }
32
 
33
+ /** @inheritDoc */
 
 
 
 
34
  protected function handle(WP_REST_Request $request)
35
  {
36
  if (!RestRequest::has_param($request, 'id')) {
45
  }
46
 
47
  $account = AccountPostType::fromWpPost($accountPost);
48
+ $source = UserSource::create($account->user->username, $account->user->type);
49
 
50
+ $this->store->deleteForSources([$source]);
51
 
52
  return new WP_REST_Response(['ok' => 1]);
53
  }
core/RestApi/EndPoints/Feeds/GetSourcesEndpoint.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds;
4
-
5
- use RebelCode\Iris\Source;
6
- use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
7
- use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
8
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
9
- use WP_REST_Request;
10
- use WP_REST_Response;
11
-
12
- /**
13
- * Handler for the endpoint that provides the sources used across all feeds.
14
- *
15
- * @since 0.5.3
16
- */
17
- class GetSourcesEndpoint extends AbstractEndpointHandler
18
- {
19
- /**
20
- * @inheritDoc
21
- *
22
- * @since 0.5.3
23
- */
24
- protected function handle(WP_REST_Request $request)
25
- {
26
- $sources = MediaPostType::getUsedSources();
27
- $response = Arrays::map($sources, function (Source $source) {
28
- return [
29
- 'type' => $source->type,
30
- 'name' => $source->data['name'] ?? '',
31
- ];
32
- });
33
-
34
- return new WP_REST_Response($response);
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/RestApi/EndPoints/Front/FrontEndpoint.php DELETED
@@ -1,20 +0,0 @@
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/GetMediaEndPoint.php CHANGED
@@ -2,120 +2,52 @@
2
 
3
  namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media;
4
 
5
- use RebelCode\Iris\Aggregation\ItemAggregator;
6
- use RebelCode\Iris\Aggregation\ItemFeed;
7
- use RebelCode\Iris\Engine;
8
- use RebelCode\Iris\Error;
9
- use RebelCode\Iris\Source;
10
- use RebelCode\Spotlight\Instagram\Engine\Stores\WpPostMediaStore;
11
- use RebelCode\Spotlight\Instagram\Engine\StoryFeed;
12
- use RebelCode\Spotlight\Instagram\Feeds\FeedManager;
13
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
14
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
15
  use WP_REST_Request;
16
  use WP_REST_Response;
17
 
18
  /**
19
  * The handler for the endpoint that provides media objects.
20
- *
21
- * @since 0.1
22
  */
23
  class GetMediaEndPoint extends AbstractEndpointHandler
24
  {
25
- /**
26
- * @since 0.5
27
- *
28
- * @var Engine
29
- */
30
- protected $engine;
31
 
32
- /**
33
- * @since 0.5
34
- *
35
- * @var FeedManager
36
- */
37
- protected $feedManager;
38
 
39
- /**
40
- * Constructor.
41
- *
42
- * @since 0.1
43
- *
44
- * @param Engine $engine
45
- * @param FeedManager $feedManager
46
- */
47
- public function __construct(Engine $engine, FeedManager $feedManager)
48
  {
49
- $this->engine = $engine;
50
- $this->feedManager = $feedManager;
51
  }
52
 
53
- /**
54
- * @inheritDoc
55
- *
56
- * @since 0.1
57
- */
58
  protected function handle(WP_REST_Request $request)
59
  {
60
- if ($request->has_param('source')) {
61
- return $this->handleBySource($request);
62
- }
63
-
64
- $options = $request->get_param('options') ?? [];
65
  $from = $request->get_param('from') ?? 0;
66
- $num = $request->get_param('num') ?? $options['numPosts']['desktop'] ?? 9;
67
-
68
- // Get media and total
69
- $feed = $this->feedManager->createFeed($options);
70
- $result = $this->engine->aggregate($feed, $num, $from);
71
- $media = ItemAggregator::getCollection($result, ItemAggregator::DEF_COLLECTION);
72
- $total = $result->data[ItemAggregator::DATA_TOTAL];
73
-
74
- // Get stories
75
- $storyFeed = StoryFeed::createFromFeed($feed);
76
- $storiesResult = $this->engine->aggregate($storyFeed);
77
- $stories = ItemAggregator::getCollection($storiesResult, ItemAggregator::DEF_COLLECTION);
78
-
79
- WpPostMediaStore::updateLastRequestedTime($result->items);
80
-
81
- $response = [
82
- 'media' => $media,
83
- 'stories' => $stories,
84
- 'total' => $total,
85
- 'errors' => Arrays::map($result->errors, function (Error $error) {
86
- return (array) $error;
87
- }),
88
- ];
89
-
90
- return new WP_REST_Response($response);
91
- }
92
 
93
- public function handleBySource(WP_REST_Request $request)
94
- {
95
- $srcName = $request->get_param('source');
96
- $srcType = $request->get_param('type');
97
-
98
- $from = $request->get_param('from') ?? 0;
99
- $num = $request->get_param('num') ?? 30;
100
-
101
- $source = Source::auto($srcType, ['name' => $srcName]);
102
- $feed = new ItemFeed([$source], [
103
- 'postOrder' => 'date_desc',
104
- 'mediaType' => 'all',
105
- ]);
106
-
107
- $result = $this->engine->aggregate($feed, $num, $from);
108
- $media = ItemAggregator::getCollection($result, ItemAggregator::DEF_COLLECTION);
109
- $total = $result->data[ItemAggregator::DATA_TOTAL];
110
 
111
- $response = [
112
- 'media' => $media,
113
- 'total' => $total,
114
- 'errors' => Arrays::map($result->errors, function (Error $error) {
115
- return (array) $error;
116
- }),
117
- ];
118
 
119
- return new WP_REST_Response($response);
120
  }
121
  }
2
 
3
  namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media;
4
 
5
+ use RebelCode\Iris\Data\Source;
 
 
 
 
 
 
 
6
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
7
+ use RebelCode\Spotlight\Instagram\Server;
8
  use WP_REST_Request;
9
  use WP_REST_Response;
10
 
11
  /**
12
  * The handler for the endpoint that provides media objects.
 
 
13
  */
14
  class GetMediaEndPoint extends AbstractEndpointHandler
15
  {
16
+ /** @var Server */
17
+ protected $server;
 
 
 
 
18
 
19
+ /** @var int */
20
+ protected $expiry;
 
 
 
 
21
 
22
+ /** Constructor */
23
+ public function __construct(Server $server, int $expiry = 0)
 
 
 
 
 
 
 
24
  {
25
+ $this->server = $server;
26
+ $this->expiry = $expiry;
27
  }
28
 
29
+ /** @inheritDoc */
 
 
 
 
30
  protected function handle(WP_REST_Request $request)
31
  {
 
 
 
 
 
32
  $from = $request->get_param('from') ?? 0;
33
+ $num = $request->get_param('num') ?? null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ if ($request->has_param('source')) {
36
+ $srcName = $request->get_param('source');
37
+ $srcType = $request->get_param('type');
38
+
39
+ $source = new Source($srcName, $srcType);
40
+ $result = $this->server->getSourceMedia($source, $from, $num);
41
+ } else {
42
+ $options = $request->get_param('options') ?? [];
43
+ $result = $this->server->getFeedMedia($options, $from, $num);
44
+ }
 
 
 
 
 
 
 
45
 
46
+ $headers = [];
47
+ if ($this->expiry > 0) {
48
+ $headers['Expires'] = gmdate('D, d M Y H:i:s T', $this->expiry);
49
+ }
 
 
 
50
 
51
+ return new WP_REST_Response($result, 200, $headers);
52
  }
53
  }
core/RestApi/EndPoints/Media/ImportMediaEndPoint.php CHANGED
@@ -9,36 +9,24 @@ use WP_REST_Response;
9
 
10
  /**
11
  * The endpoint for importing media.
12
- *
13
- * @since 0.5
14
  */
15
  class ImportMediaEndPoint extends AbstractEndpointHandler
16
  {
17
- /**
18
- * @var Server
19
- */
20
  protected $server;
21
 
22
- /**
23
- * Constructor.
24
- *
25
- * @param Server $server
26
- */
27
  public function __construct(Server $server)
28
  {
29
  $this->server = $server;
30
  }
31
 
32
- /**
33
- * @inheritDoc
34
- *
35
- * @since 0.5
36
- */
37
  protected function handle(WP_REST_Request $request)
38
  {
39
  $options = $request->get_param('options') ?? [];
40
- $response = $this->server->import($options);
41
 
42
- return new WP_REST_Response($response);
43
  }
44
  }
9
 
10
  /**
11
  * The endpoint for importing media.
 
 
12
  */
13
  class ImportMediaEndPoint extends AbstractEndpointHandler
14
  {
15
+ /** @var Server */
 
 
16
  protected $server;
17
 
18
+ /** Constructor */
 
 
 
 
19
  public function __construct(Server $server)
20
  {
21
  $this->server = $server;
22
  }
23
 
24
+ /** @inheritDoc */
 
 
 
 
25
  protected function handle(WP_REST_Request $request)
26
  {
27
  $options = $request->get_param('options') ?? [];
28
+ $result = $this->server->import($options);
29
 
30
+ return new WP_REST_Response($result);
31
  }
32
  }
core/RestApi/EndPoints/Tools/ClearCacheEndpoint.php CHANGED
@@ -58,7 +58,8 @@ class ClearCacheEndpoint extends AbstractEndpointHandler
58
  throw new Exception('Failed to clear the API cache. Please try again later.');
59
  }
60
 
61
- $count = $this->cpt::deleteAll();
 
62
 
63
  if ($count === false) {
64
  throw new Exception('Failed to clear the media cache. Please try again later.');
58
  throw new Exception('Failed to clear the API cache. Please try again later.');
59
  }
60
 
61
+ set_time_limit(60 * 10);
62
+ $count = $this->cpt->deleteAll();
63
 
64
  if ($count === false) {
65
  throw new Exception('Failed to clear the media cache. Please try again later.');
core/RestApi/EndPoints/Tools/ClearCacheFeedEndpoint.php CHANGED
@@ -3,7 +3,6 @@
3
  namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Tools;
4
 
5
  use RebelCode\Iris\Engine;
6
- use RebelCode\Spotlight\Instagram\Engine\MediaItem;
7
  use RebelCode\Spotlight\Instagram\Feeds\FeedManager;
8
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
9
  use WP_REST_Request;
@@ -11,58 +10,30 @@ use WP_REST_Response;
11
 
12
  /**
13
  * Handler for the REST API endpoint that clears the cache for a specific feed.
14
- *
15
- * 0.5.3
16
  */
17
  class ClearCacheFeedEndpoint extends AbstractEndpointHandler
18
  {
19
- /**
20
- * 0.5.3
21
- *
22
- * @var Engine
23
- */
24
  protected $engine;
25
 
26
- /**
27
- * 0.5.3
28
- *
29
- * @var FeedManager
30
- */
31
  protected $feedManager;
32
 
33
- /**
34
- * Constructor.
35
- *
36
- * 0.5.3
37
- *
38
- * @param Engine $engine
39
- * @param FeedManager $feedManager
40
- */
41
  public function __construct(Engine $engine, FeedManager $feedManager)
42
  {
43
  $this->engine = $engine;
44
  $this->feedManager = $feedManager;
45
  }
46
 
47
- /**
48
- * @inheritDoc
49
- *
50
- * 0.5.3
51
- */
52
  protected function handle(WP_REST_Request $request)
53
  {
54
  $options = $request->get_param('options');
55
  $feed = $this->feedManager->createFeed($options);
56
 
57
- foreach ($feed->sources as $source) {
58
- set_time_limit(300);
59
-
60
- $result = $this->engine->store->getItems($source);
61
-
62
- foreach ($result->items as $item) {
63
- wp_delete_post($item->data[MediaItem::POST], true);
64
- }
65
- }
66
 
67
  return new WP_REST_Response(['success' => true]);
68
  }
3
  namespace RebelCode\Spotlight\Instagram\RestApi\EndPoints\Tools;
4
 
5
  use RebelCode\Iris\Engine;
 
6
  use RebelCode\Spotlight\Instagram\Feeds\FeedManager;
7
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\AbstractEndpointHandler;
8
  use WP_REST_Request;
10
 
11
  /**
12
  * Handler for the REST API endpoint that clears the cache for a specific feed.
 
 
13
  */
14
  class ClearCacheFeedEndpoint extends AbstractEndpointHandler
15
  {
16
+ /** @var Engine */
 
 
 
 
17
  protected $engine;
18
 
19
+ /** @var FeedManager */
 
 
 
 
20
  protected $feedManager;
21
 
22
+ /** Constructor */
 
 
 
 
 
 
 
23
  public function __construct(Engine $engine, FeedManager $feedManager)
24
  {
25
  $this->engine = $engine;
26
  $this->feedManager = $feedManager;
27
  }
28
 
29
+ /** @inheritDoc */
 
 
 
 
30
  protected function handle(WP_REST_Request $request)
31
  {
32
  $options = $request->get_param('options');
33
  $feed = $this->feedManager->createFeed($options);
34
 
35
+ set_time_limit(60 * 5);
36
+ $this->engine->getStore()->deleteForSources($feed->sources);
 
 
 
 
 
 
 
37
 
38
  return new WP_REST_Response(['success' => true]);
39
  }
core/Server.php CHANGED
@@ -4,12 +4,18 @@ declare(strict_types=1);
4
 
5
  namespace RebelCode\Spotlight\Instagram;
6
 
7
- use RebelCode\Iris\Aggregation\ItemAggregator;
 
 
 
8
  use RebelCode\Iris\Engine;
9
- use RebelCode\Iris\Error;
10
- use RebelCode\Iris\Result;
11
- use RebelCode\Spotlight\Instagram\Engine\Stores\WpPostMediaStore;
12
- use RebelCode\Spotlight\Instagram\Engine\StoryFeed;
 
 
 
13
  use RebelCode\Spotlight\Instagram\Feeds\FeedManager;
14
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
15
 
@@ -18,57 +24,66 @@ class Server
18
  /** @var Engine */
19
  protected $engine;
20
 
 
 
 
21
  /** @var FeedManager */
22
  protected $feedManager;
23
 
24
- /**
25
- * Constructor.
26
- *
27
- * @param Engine $engine
28
- * @param FeedManager $feedManager
29
- */
30
- public function __construct(Engine $engine, FeedManager $feedManager)
31
  {
32
  $this->engine = $engine;
 
33
  $this->feedManager = $feedManager;
34
  }
35
 
36
  public function getFeedMedia(array $options = [], ?int $from = 0, int $num = null): array
37
  {
38
  // Check if numPosts is not a responsive value first
39
- $num = !is_array($options['numPosts'] ?? null) ? $options['numPosts'] : null;
40
  // Otherwise get the desktop value, defaulting to 9
41
  $num = $num ?? ($options['numPosts']['desktop'] ?? 9);
42
 
43
  // Get media and total
44
  $feed = $this->feedManager->createFeed($options);
45
- $result = $this->engine->aggregate($feed, $num, $from);
46
- $media = ItemAggregator::getCollection($result, ItemAggregator::DEF_COLLECTION);
47
- $total = $result->data[ItemAggregator::DATA_TOTAL];
48
-
49
- WpPostMediaStore::updateLastRequestedTime($result->items);
50
-
51
- $needImport = false;
52
- foreach ($result->data[ItemAggregator::DATA_CHILDREN] as $child) {
53
- if (count($child['result']->items) === 0) {
54
- $needImport = true;
55
- break;
56
- }
57
- }
58
 
59
  // Get stories
60
  $storyFeed = StoryFeed::createFromFeed($feed);
61
- $storiesResult = $this->engine->aggregate($storyFeed);
62
- $stories = ItemAggregator::getCollection($storiesResult, ItemAggregator::DEF_COLLECTION);
 
 
 
 
63
 
64
  return [
65
- 'media' => $media,
66
  'stories' => $stories,
67
- 'total' => $total,
68
  'needImport' => $needImport,
69
- 'errors' => Arrays::map($result->errors, function (Error $error) {
70
- return (array) $error;
71
- }),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  ];
73
  }
74
 
@@ -76,20 +91,59 @@ class Server
76
  {
77
  $feed = $this->feedManager->createFeed($options);
78
 
79
- $result = new Result();
80
- foreach ($feed->sources as $id => $source) {
81
- $subResult = $this->engine->import($source);
82
- $result->items = array_merge($result->items, $subResult->items);
83
- $result->errors = array_merge($result->errors, $subResult->errors);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
  return [
87
- 'success' => $result->success,
88
- 'items' => $result->items,
89
- 'data' => $result->data,
90
- 'errors' => Arrays::map($result->errors, function (Error $error) {
91
- return (array) $error;
92
- }),
 
 
 
 
 
 
 
 
 
 
 
 
93
  ];
94
  }
95
  }
4
 
5
  namespace RebelCode\Spotlight\Instagram;
6
 
7
+ use RebelCode\Iris\Aggregator\AggregateResult;
8
+ use RebelCode\Iris\Data\Feed;
9
+ use RebelCode\Iris\Data\Item;
10
+ use RebelCode\Iris\Data\Source;
11
  use RebelCode\Iris\Engine;
12
+ use RebelCode\Spotlight\Instagram\Engine\Data\Feed\StoryFeed;
13
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaChild;
14
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaComment;
15
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
16
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaProductType;
17
+ use RebelCode\Spotlight\Instagram\Engine\IgPostStore;
18
+ use RebelCode\Spotlight\Instagram\Engine\Importer;
19
  use RebelCode\Spotlight\Instagram\Feeds\FeedManager;
20
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
21
 
24
  /** @var Engine */
25
  protected $engine;
26
 
27
+ /** @var Importer */
28
+ protected $importer;
29
+
30
  /** @var FeedManager */
31
  protected $feedManager;
32
 
33
+ /** Constructor. */
34
+ public function __construct(Engine $engine, Importer $importer, FeedManager $feedManager)
 
 
 
 
 
35
  {
36
  $this->engine = $engine;
37
+ $this->importer = $importer;
38
  $this->feedManager = $feedManager;
39
  }
40
 
41
  public function getFeedMedia(array $options = [], ?int $from = 0, int $num = null): array
42
  {
43
  // Check if numPosts is not a responsive value first
44
+ $num = !is_array($options['numPosts'] ?? null) ? $options['numPosts'] : $num;
45
  // Otherwise get the desktop value, defaulting to 9
46
  $num = $num ?? ($options['numPosts']['desktop'] ?? 9);
47
 
48
  // Get media and total
49
  $feed = $this->feedManager->createFeed($options);
50
+ $mainResult = $this->engine->getAggregator()->aggregate($feed, $num, $from);
51
+ $needImport = (count($mainResult->items) === 0);
52
+
53
+ IgPostStore::updateLastRequestedTime($mainResult->items);
 
 
 
 
 
 
 
 
 
54
 
55
  // Get stories
56
  $storyFeed = StoryFeed::createFromFeed($feed);
57
+ $storiesResult = ($storyFeed !== null)
58
+ ? $this->engine->getAggregator()->aggregate($storyFeed)
59
+ : new AggregateResult([], 0);
60
+
61
+ $items = Arrays::map($mainResult->items, [$this, 'transform']);
62
+ $stories = Arrays::map($storiesResult->items, [$this, 'transform']);
63
 
64
  return [
65
+ 'media' => $items,
66
  'stories' => $stories,
67
+ 'total' => $mainResult->total,
68
  'needImport' => $needImport,
69
+ 'errors' => [],
70
+ ];
71
+ }
72
+
73
+ public function getSourceMedia(Source $source, ?int $from, int $num = null): array
74
+ {
75
+ $feed = new Feed(null, [$source], [
76
+ 'postOrder' => 'date_desc',
77
+ 'mediaType' => 'all',
78
+ ]);
79
+
80
+ $result = $this->engine->getAggregator()->aggregate($feed, $num, $from);
81
+ $items = Arrays::map($result->items, [$this, 'transform']);
82
+
83
+ return [
84
+ 'media' => $items,
85
+ 'total' => $result->total,
86
+ 'errors' => [],
87
  ];
88
  }
89
 
91
  {
92
  $feed = $this->feedManager->createFeed($options);
93
 
94
+ [$items, $hasMoreBatches] = $this->importer->updateFeed($feed);
95
+
96
+ return [
97
+ 'success' => true,
98
+ 'items' => $items,
99
+ 'batching' => $hasMoreBatches,
100
+ 'errors' => [],
101
+ ];
102
+ }
103
+
104
+ public function transform(Item $item): array
105
+ {
106
+ $children = $item->data['children'] ?? [];
107
+ foreach ($children as $idx => $child) {
108
+ $children[$idx] = [
109
+ 'id' => $child[MediaChild::MEDIA_ID],
110
+ 'type' => $child[MediaChild::MEDIA_TYPE],
111
+ 'url' => $child[MediaChild::MEDIA_URL],
112
+ 'permalink' => $child[MediaChild::PERMALINK],
113
+ 'shortcode' => $child[MediaChild::SHORTCODE] ?? '',
114
+ ];
115
+ }
116
+
117
+ $comments = $item->data['comments'] ?? [];
118
+ foreach ($comments as $idx => $comment) {
119
+ $comments[$idx] = [
120
+ 'id' => $comment[MediaComment::ID],
121
+ 'username' => $comment[MediaComment::USERNAME],
122
+ 'text' => $comment[MediaComment::TEXT],
123
+ 'timestamp' => $comment[MediaComment::TIMESTAMP],
124
+ 'likeCount' => $comment[MediaComment::LIKES_COUNT],
125
+ ];
126
  }
127
 
128
  return [
129
+ 'id' => $item->data[MediaItem::MEDIA_ID],
130
+ 'username' => $item->data[MediaItem::USERNAME],
131
+ 'caption' => $item->data[MediaItem::CAPTION],
132
+ 'timestamp' => $item->data[MediaItem::TIMESTAMP],
133
+ 'type' => $item->data[MediaItem::MEDIA_TYPE],
134
+ 'url' => $item->data[MediaItem::MEDIA_URL],
135
+ 'size' => $item->data[MediaItem::MEDIA_SIZE],
136
+ 'permalink' => $item->data[MediaItem::PERMALINK],
137
+ 'shortcode' => $item->data[MediaItem::SHORTCODE] ?? '',
138
+ 'videoTitle' => $item->data[MediaItem::VIDEO_TITLE] ?? '',
139
+ 'productType' => $item->data[MediaItem::MEDIA_PRODUCT_TYPE] ?? MediaProductType::FEED,
140
+ 'thumbnail' => $item->data[MediaItem::THUMBNAIL_URL],
141
+ 'thumbnails' => $item->data[MediaItem::THUMBNAILS],
142
+ 'likesCount' => $item->data[MediaItem::LIKES_COUNT],
143
+ 'commentsCount' => $item->data[MediaItem::COMMENTS_COUNT],
144
+ 'comments' => $comments,
145
+ 'children' => $children,
146
+ 'sources' => $item->sources,
147
  ];
148
  }
149
  }
core/Utils/Functions.php CHANGED
@@ -364,6 +364,34 @@ class Functions
364
  };
365
  }
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  /**
368
  * Merges two lists of arguments.
369
  *
364
  };
365
  }
366
 
367
+ /**
368
+ * Creates a function that returns the value of a specific property from the its object argument.
369
+ *
370
+ * @param string $property The name of the property whose value to return.
371
+ *
372
+ * @return callable The created function.
373
+ */
374
+ public static function property(string $property): callable
375
+ {
376
+ return function ($arg) use ($property) {
377
+ return $arg->{$property};
378
+ };
379
+ }
380
+
381
+ /**
382
+ * Creates a function that returns the value of a specific index from the its array argument.
383
+ *
384
+ * @param string $idx The index whose value to return.
385
+ *
386
+ * @return callable The created function.
387
+ */
388
+ public static function index(string $idx): callable
389
+ {
390
+ return function ($arg) use ($idx) {
391
+ return $arg[$idx];
392
+ };
393
+ }
394
+
395
  /**
396
  * Merges two lists of arguments.
397
  *
core/Wp/PostType.php CHANGED
@@ -206,6 +206,28 @@ class PostType
206
  return ($ret instanceof WP_Post) ? $ret : false;
207
  }
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  /**
210
  * Retrieves the total number of posts for this post type, disregarding of filters.
211
  *
206
  return ($ret instanceof WP_Post) ? $ret : false;
207
  }
208
 
209
+ /**
210
+ * Deletes all posts for this post type.
211
+ *
212
+ * @return bool|int The number of deleted posts, or false on error.
213
+ */
214
+ public function deleteAll()
215
+ {
216
+ global $wpdb;
217
+
218
+ $query = sprintf(
219
+ 'DELETE post, meta
220
+ FROM %s as post
221
+ LEFT JOIN %s as meta on post.ID = meta.post_id
222
+ WHERE post.post_type = \'%s\'',
223
+ $wpdb->posts,
224
+ $wpdb->postmeta,
225
+ $this->slug
226
+ );
227
+
228
+ return $wpdb->query($query);
229
+ }
230
+
231
  /**
232
  * Retrieves the total number of posts for this post type, disregarding of filters.
233
  *
engine/Aggregation/ItemAggregator.php DELETED
@@ -1,204 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Aggregation;
4
-
5
- use RebelCode\Iris\Fetching\ItemProvider;
6
- use RebelCode\Iris\Item;
7
- use RebelCode\Iris\Result;
8
- use RebelCode\Spotlight\Instagram\Utils\Arrays;
9
-
10
- /**
11
- * Aggregates items for an {@link ItemFeed}.
12
- *
13
- * An aggregator's job is to collect items for each source in an {@link ItemFeed} and process those items into a
14
- * desirable format.
15
- *
16
- * The aggregator makes use of {@link ItemProcessor} instances to determine which of the acquired items will be
17
- * returned and how. Processors are allowed to remove items, add new items, sort the items, alter item data or perform
18
- * any other mutation so long as the list still consists of {@link Item} instances.
19
- *
20
- * An {@link ItemTransformer} is then used to transform the items into a different format, such as arrays, plain
21
- * objects or instances of some class.
22
- *
23
- * Finally, an {@link ItemSegregator} is used to separate the items into separate collections. This can be useful if
24
- * the consumer needs to handle different types of items differently. These collections
25
- *
26
- * Aggregator results will contain various information in {@link Result::$data}. This includes the result from each
27
- * {@link ItemProvider} in the {@link ItemAggregator::DATA_CHILDREN} key, the total number of items prior to applying
28
- * limits and offsets in the {@link ItemAggregator::DATA_TOTAL} key and the item collections from the segregator in the
29
- * {@link ItemAggregator::DATA_COLLECTIONS} key.
30
- *
31
- * @since [*next-version*]
32
- */
33
- class ItemAggregator
34
- {
35
- const DATA_COLLECTIONS = 'collections';
36
- const DATA_TOTAL = 'total';
37
- const DATA_CHILDREN = 'children';
38
- const DEF_COLLECTION = 'items';
39
-
40
- /**
41
- * The provider to use to retrieve items.
42
- *
43
- * @since [*next-version*]
44
- *
45
- * @var ItemProvider
46
- */
47
- protected $provider;
48
-
49
- /**
50
- * The processors to use to prepare the resulting items.
51
- *
52
- * @since [*next-version*]
53
- *
54
- * @var ItemProcessor[]
55
- */
56
- protected $processors;
57
-
58
- /**
59
- * Optional item segregator to separate items into collections.
60
- *
61
- * @since [*next-version*]
62
- *
63
- * @var ItemSegregator|null
64
- */
65
- protected $segregator;
66
-
67
- /**
68
- * Optional item transformer to transform collection items.
69
- *
70
- * @since [*next-version*]
71
- *
72
- * @var ItemTransformer|null
73
- */
74
- protected $transformer;
75
-
76
- /**
77
- * Constructor.
78
- *
79
- * @since [*next-version*]
80
- *
81
- * @param ItemProvider $provider The provider to use to retrieve items.
82
- * @param ItemProcessor[] $processors The processors to use to prepare the resulting items.
83
- * @param ItemSegregator|null $segregator Optional item segregator to separate items into collections.
84
- * @param ItemTransformer|null $transformer Optional item transformer to transform collection items.
85
- */
86
- public function __construct(
87
- ItemProvider $provider,
88
- array $processors = [],
89
- ?ItemSegregator $segregator = null,
90
- ?ItemTransformer $transformer = null
91
- ) {
92
- $this->provider = $provider;
93
- $this->processors = $processors;
94
- $this->segregator = $segregator;
95
- $this->transformer = $transformer;
96
- }
97
-
98
- /**
99
- * Aggregates items for a feed.
100
- *
101
- * @since [*next-version*]
102
- *
103
- * @param ItemFeed $feed The feed to aggregate items for.
104
- * @param int|null $limit The maximum number of items to aggregate.
105
- * @param int $offset The number of items to skip over.
106
- *
107
- * @return Result The aggregation result.
108
- */
109
- public function aggregate(ItemFeed $feed, ?int $limit = null, int $offset = 0) : Result
110
- {
111
- $result = new Result();
112
- $result->data = [
113
- 'children' => [],
114
- ];
115
-
116
- // Fetch items from provider
117
- // ---------------------------
118
-
119
- foreach ($feed->sources as $source) {
120
- $srcResult = $this->provider->getItems($source);
121
-
122
- $result->data['children'][] = [
123
- 'source' => $source,
124
- 'result' => $srcResult,
125
- ];
126
-
127
- $result->errors = array_merge($result->errors, $srcResult->errors);
128
- $result->items = array_merge($result->items, $srcResult->items);
129
- }
130
-
131
- $result->success = $result->hasErrors() && count($result->items) === 0;
132
-
133
- // Remove duplicates
134
- // -------------------------------
135
-
136
- $result->items = Arrays::unique($result->items, function ($item) {
137
- return $item->id;
138
- });
139
-
140
- // Pass items through processors
141
- // -------------------------------
142
-
143
- foreach ($this->processors as $processor) {
144
- $processor->process($result->items, $feed);
145
- }
146
-
147
- // Apply limit and offset
148
- // ---------------------------
149
-
150
- $result->data[static::DATA_TOTAL] = count($result->items);
151
-
152
- $limit = max(0, $limit ?? 0);
153
- $offset = max(0, $offset);
154
-
155
- if ($limit > 0 || $offset > 0) {
156
- $result->items = array_slice($result->items, $offset, $limit);
157
- }
158
-
159
- // Segregate and transform the items
160
- // -----------------------------------
161
-
162
- if ($this->segregator === null && $this->transformer === null) {
163
- $result->data[static::DATA_COLLECTIONS] = [
164
- static::DEF_COLLECTION => $result->items,
165
- ];
166
- } else {
167
- $result->data[static::DATA_COLLECTIONS] = [];
168
-
169
- foreach ($result->items as $item) {
170
- $key = ($this->segregator !== null)
171
- ? $this->segregator->segregate($item, $feed) ?? static::DEF_COLLECTION
172
- : static::DEF_COLLECTION;
173
-
174
- if (!array_key_exists($key, $result->data[static::DATA_COLLECTIONS])) {
175
- $result->data[static::DATA_COLLECTIONS][$key] = [];
176
- }
177
-
178
- $result->data[static::DATA_COLLECTIONS][$key][] = ($this->transformer !== null)
179
- ? $this->transformer->transform($item, $feed)
180
- : $item;
181
- }
182
- }
183
-
184
- return $result;
185
- }
186
-
187
- /**
188
- * Retrieves a collection from a result.
189
- *
190
- * @since [*next-version*]
191
- *
192
- * @param Result $result The result.
193
- * @param string $key The key of the collection to retrieve.
194
- *
195
- * @return Item[] The items in the collection. An empty list will be returned if the collection does not exist in
196
- * the given result.
197
- */
198
- public static function getCollection(Result $result, string $key = self::DEF_COLLECTION)
199
- {
200
- $default = ($key === static::DEF_COLLECTION ? $result->items : []);
201
-
202
- return $result->data[static::DATA_COLLECTIONS][$key] ?? $default;
203
- }
204
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Aggregation/ItemFeed.php DELETED
@@ -1,62 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Aggregation;
4
-
5
- use RebelCode\Iris\Source;
6
-
7
- /**
8
- * Represents a feed of items, which is configuration for an {@link ItemAggregator}.
9
- *
10
- * @since [*next-version*]
11
- */
12
- class ItemFeed
13
- {
14
- /**
15
- * The sources that are being aggregated.
16
- *
17
- * @since [*next-version*]
18
- *
19
- * @var Source[]
20
- */
21
- public $sources;
22
-
23
- /**
24
- * Any config options for this aggregation.
25
- *
26
- * @since [*next-version*]
27
- *
28
- * @var array
29
- */
30
- public $options;
31
-
32
- /**
33
- * Constructor.
34
- *
35
- * @since [*next-version*]
36
- *
37
- * @param Source[] $sources The sources that are being aggregated.
38
- * @param array $options Any config options for this aggregation.
39
- */
40
- public function __construct(array $sources, array $options = [])
41
- {
42
- $this->sources = $sources;
43
- $this->options = $options;
44
- }
45
-
46
- /**
47
- * Retrieves a single option, optionally defaulting to a specific value.
48
- *
49
- * @since [*next-version*]
50
- *
51
- * @param string $key The key of the option to retrieve.
52
- * @param mixed $default Optional value to return if no option is found for the given $key.
53
- *
54
- * @return mixed|null The value for the option that corresponds to the given $key, or $default if not found.
55
- */
56
- public function getOption(string $key, $default = null)
57
- {
58
- return array_key_exists($key, $this->options)
59
- ? $this->options[$key]
60
- : $default;
61
- }
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Aggregation/ItemProcessor.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Aggregation;
4
-
5
- /**
6
- * An item processor is used during item aggregation to manipulate a list of items prior to serving the result.
7
- *
8
- * Item processors receive the list of items **by reference**. This is done for performance reasons to avoid creating
9
- * a new list of items in memory, reducing overall memory usage as well as resulting in less instructions required to
10
- * generate results.
11
- *
12
- * @since [*next-version*]
13
- */
14
- interface ItemProcessor
15
- {
16
- /**
17
- * Processes a list of items.
18
- *
19
- * @since [*next-version*]
20
- *
21
- * @param Item[] $items The list of items to process, passed by reference.
22
- * @param ItemFeed $feed The item feed instance for which to process the items.
23
- */
24
- public function process(array &$items, ItemFeed $feed);
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Aggregation/ItemSegregator.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Aggregation;
4
-
5
- use RebelCode\Iris\Item;
6
-
7
- /**
8
- * An item segregator is an item processor that determines what collection an item belongs to.
9
- *
10
- * @since [*next-version*]
11
- */
12
- interface ItemSegregator
13
- {
14
- /**
15
- * Segregates an item for a given feed.
16
- *
17
- * @since [*next-version*]
18
- *
19
- * @param Item $item The item to maybe segregate.
20
- * @param ItemFeed $feed The feed to segregate for.
21
- *
22
- * @return string|null The name of the collection in which the item belongs, or null if the item belongs in the
23
- * default collection.
24
- */
25
- public function segregate(Item $item, ItemFeed $feed) : ?string;
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Aggregation/ItemTransformer.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Aggregation;
4
-
5
- use RebelCode\Iris\Item;
6
-
7
- /**
8
- * A transformer is an item processor that transforms an {@link Item} instance into a different value.
9
- *
10
- * @since [*next-version*]
11
- */
12
- interface ItemTransformer
13
- {
14
- /**
15
- * Transforms an item.
16
- *
17
- * @since [*next-version*]
18
- *
19
- * @param Item $item The item to transform.
20
- * @param ItemFeed $feed The item feed to transform for.
21
- *
22
- * @return mixed The transformed result.
23
- */
24
- public function transform(Item $item, ItemFeed $feed);
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Engine.php DELETED
@@ -1,113 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris;
4
-
5
- use RebelCode\Iris\Aggregation\ItemAggregator;
6
- use RebelCode\Iris\Aggregation\ItemFeed;
7
- use RebelCode\Iris\Fetching\ItemProvider;
8
- use RebelCode\Iris\Importing\ItemImporter;
9
- use RebelCode\Iris\Importing\ItemStore;
10
-
11
- /**
12
- * Acts as the single point of entry for the provider, store, importer and aggregator.
13
- *
14
- * @since [*next-version*]
15
- */
16
- class Engine
17
- {
18
- /**
19
- * @since [*next-version*]
20
- *
21
- * @var ItemProvider
22
- */
23
- public $provider;
24
-
25
- /**
26
- * @since [*next-version*]
27
- *
28
- * @var ItemStore
29
- */
30
- public $store;
31
-
32
- /**
33
- * @since [*next-version*]
34
- *
35
- * @var ItemImporter
36
- */
37
- public $importer;
38
-
39
- /**
40
- * @since [*next-version*]
41
- *
42
- * @var ItemAggregator
43
- */
44
- public $aggregator;
45
-
46
- /**
47
- * Constructor.
48
- *
49
- * @since [*next-version*]
50
- *
51
- * @param ItemProvider $provider The provider.
52
- * @param ItemImporter $importer The importer.
53
- * @param ItemStore $store The store.
54
- * @param ItemAggregator $aggregator The aggregator.
55
- */
56
- public function __construct(
57
- ItemProvider $provider,
58
- ItemImporter $importer,
59
- ItemStore $store,
60
- ItemAggregator $aggregator
61
- ) {
62
- $this->provider = $provider;
63
- $this->importer = $importer;
64
- $this->store = $store;
65
- $this->aggregator = $aggregator;
66
- }
67
-
68
- /**
69
- * Retrieves items.
70
- *
71
- * @since [*next-version*]
72
- *
73
- * @param Source $source The source to retrieve items for.
74
- * @param int|null $limit The maximum number of items to retrieve.
75
- * @param int $offset The number of items to skip.
76
- *
77
- * @return Result The result.
78
- */
79
- public function getItems(Source $source, ?int $limit = null, int $offset = 0) : Result
80
- {
81
- return $this->provider->getItems($source, $limit, $offset);
82
- }
83
-
84
- /**
85
- * Imports items.
86
- *
87
- * @since [*next-version*]
88
- *
89
- * @param Source $source The source to import items from.
90
- *
91
- * @return Result The result.
92
- */
93
- public function import(Source $source)
94
- {
95
- return $this->importer->import($source);
96
- }
97
-
98
- /**
99
- * Aggregates items for a feed.
100
- *
101
- * @since [*next-version*]
102
- *
103
- * @param ItemFeed $feed The feed for which to aggregate items.
104
- * @param int|null $limit The maximum number of items to aggregate.
105
- * @param int $offset The number of items to skip.
106
- *
107
- * @return Result The result.
108
- */
109
- public function aggregate(ItemFeed $feed, ?int $limit = null, int $offset = 0) : Result
110
- {
111
- return $this->aggregator->aggregate($feed, $limit, $offset);
112
- }
113
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Error.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris;
4
-
5
- /**
6
- * Represents a failed retrieval of items.
7
- *
8
- * @since [*next-version*]
9
- */
10
- class Error
11
- {
12
- /**
13
- * The error message.
14
- *
15
- * @var string
16
- */
17
- public $message;
18
-
19
- /**
20
- * A code that identifies the error type.
21
- * This is typically provided by the source in its erroneous result.
22
- *
23
- * @since [*next-version*]
24
- *
25
- * @var string|null
26
- */
27
- public $code;
28
-
29
- /**
30
- * Constructor.
31
- *
32
- * @since [*next-version*]
33
- *
34
- * @param string $message The error message.
35
- * @param string $code The error code.
36
- */
37
- public function __construct(string $message, string $code = '')
38
- {
39
- $this->message = $message;
40
- $this->code = $code;
41
- }
42
-
43
- /**
44
- * Static constructor.
45
- *
46
- * @since [*next-version*]
47
- *
48
- * @param string $message The error message.
49
- * @param string $code The error code.
50
- *
51
- * @return self The created error.
52
- */
53
- public static function create(string $message, string $code = '') : self
54
- {
55
- return new static($message, $code);
56
- }
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Fetching/BatchingItemProvider.php DELETED
@@ -1,133 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Fetching;
4
-
5
- use RebelCode\Iris\Result;
6
- use RebelCode\Iris\Source;
7
-
8
- /**
9
- * An item provider decorate that will retrieve as many items from another provider as it can, in batches.
10
- *
11
- * This provider will not yield results with a {@link Result::$next} callback. Rather, it will use the results from
12
- * another provider to repetitively call {@link Result::$next} to get more items, until it receives a result without
13
- * a {@link Result::$next} callback. Every time it does this, a batch of items is created. The size of the batch can
14
- * be configured during construction.
15
- *
16
- * For convenience, the provider may also be configured with a callback which will be invoked with each obtained
17
- * batch of items as argument. This can be used to perform a variety of tasks that would benefit from operating on
18
- * batches rather than full lists, such as storing the items in an item store. The callback is expected to return a
19
- * {@link Result} of its own. The items in the result will "replace" the items originally from the batch, allowing the
20
- * provider to modify the provider's final result. Additionally, any errors in the callback's result will also be
21
- * recorded in the provider's final result.
22
- *
23
- * @since [*next-version*]
24
- */
25
- class BatchingItemProvider implements ItemProvider
26
- {
27
- /**
28
- * @since [*next-version*]
29
- *
30
- * @var ItemProvider
31
- */
32
- protected $provider;
33
-
34
- /**
35
- * @since [*next-version*]
36
- *
37
- * @var int
38
- */
39
- protected $batchSize;
40
-
41
- /**
42
- * @since [*next-version*]
43
- *
44
- * @var callable
45
- */
46
- protected $callback;
47
-
48
- /**
49
- * Constructor.
50
- *
51
- * @since [*next-version*]
52
- *
53
- * @param ItemProvider $provider
54
- * @param int $batchSize
55
- * @param callable $callback
56
- */
57
- public function __construct(ItemProvider $provider, int $batchSize, callable $callback)
58
- {
59
- $this->provider = $provider;
60
- $this->batchSize = max($batchSize, 1);
61
- $this->callback = $callback;
62
- }
63
-
64
- /**
65
- * @inheritDoc
66
- *
67
- * @since [*next-version*]
68
- */
69
- public function getItems(Source $source, ?int $limit = null, int $offset = 0) : Result
70
- {
71
- // The final result
72
- $result = Result::empty();
73
- $result->data['errors'] = [];
74
-
75
- // Normalize the limit and offset
76
- $limit = max($limit ?? 0, 0);
77
- $offset = max($offset, 0);
78
- $hasLimit = $limit > 0;
79
-
80
- // Create the first batch
81
- $batch = Result::success([], [], function () use ($source, $offset) {
82
- return $this->provider->getItems($source, $this->batchSize, $offset);
83
- });
84
-
85
- // Counter for number of items that were imported
86
- $count = 0;
87
-
88
- // Iterate for as long as we have available batches
89
- while ($batch->next && (!$hasLimit || $count < $limit)) {
90
- set_time_limit(30);
91
-
92
- // Fetch the batch
93
- $batch = $batch->getNextResult();
94
-
95
- // Record any errors generated from fetching the batch
96
- $result->errors = array_merge($result->errors, $batch->errors);
97
-
98
- // If successful, import the items. Otherwise create an error to stop iterating
99
- if ($batch->success) {
100
- $count += count($batch->items);
101
- $numExcess = max($count - $limit, 0);
102
-
103
- // If importing these items will go over the limit, slice the items to get a subset
104
- if ($hasLimit && $numExcess > 0) {
105
- $batchSize = count($batch->items) - $numExcess;
106
- $batch->items = array_slice($batch->items, 0, $batchSize);
107
- }
108
-
109
- if ($hasLimit) {
110
- $count = min($count, $limit);
111
- }
112
-
113
- if (count($batch->items) > 0) {
114
- // If a callback is set, invoke it to get a sub-result
115
- if (is_callable($this->callback)) {
116
- /* @var $cbResult Result */
117
- $cbResult = ($this->callback)($batch->items);
118
-
119
- $result->items = array_merge($result->items, $cbResult->items);
120
- $result->errors = array_merge($result->errors, $cbResult->errors);
121
- } else {
122
- $result->items = array_merge($result->items, $batch->items);
123
- }
124
- } else {
125
- // If we got an empty batch, either we reached the limit or the provider has no more items to give
126
- break;
127
- }
128
- }
129
- }
130
-
131
- return $result;
132
- }
133
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Fetching/CompositeItemProvider.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Fetching;
4
-
5
- use RebelCode\Iris\Result;
6
- use RebelCode\Iris\Source;
7
-
8
- /**
9
- * An {@link ItemProvider} implementation that provides items from multiple other providers.
10
- *
11
- * @since [*next-version*]
12
- */
13
- class CompositeItemProvider implements ItemProvider
14
- {
15
- /**
16
- * @since [*next-version*]
17
- *
18
- * @var ItemProvider[]
19
- */
20
- protected $providers;
21
-
22
- /**
23
- * Constructor.
24
- *
25
- * @since [*next-version*]
26
- *
27
- * @param ItemProvider[] $providers
28
- */
29
- public function __construct(array $providers)
30
- {
31
- $this->providers = $providers;
32
- }
33
-
34
- public function getItems(Source $source, ?int $limit = null, int $offset = 0) : Result
35
- {
36
- $result = new Result();
37
-
38
- foreach ($this->providers as $provider) {
39
- $result = $result->merge($provider->getItems($source, $limit, $offset));
40
- }
41
-
42
- return $result;
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Fetching/DelegateItemProvider.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Fetching;
4
-
5
- use RebelCode\Iris\Result;
6
- use RebelCode\Iris\Source;
7
-
8
- /**
9
- * A provider implementation that delegates to a child provider based on the type of the given source.
10
- *
11
- * Example usage:
12
- * ```
13
- * $provider = new DelegateItemProvider([
14
- * 'foo' => $fooProvider,
15
- * 'bar' => $barProvider,
16
- * ]);
17
- *
18
- * $provider->getItems(Source::create('test', 'foo')); // uses $fooProvider
19
- * $provider->getItems(Source::create('test', 'bar')); // uses $barProvider
20
- * ```
21
- *
22
- * @since [*next-version*]
23
- */
24
- class DelegateItemProvider implements ItemProvider
25
- {
26
- /**
27
- * A map of source types as keys to providers.
28
- *
29
- * @since [*next-version*]
30
- *
31
- * @var ItemProvider[]
32
- */
33
- protected $providers;
34
-
35
- /**
36
- * Constructor.
37
- *
38
- * @since [*next-version*]
39
- *
40
- * @param ItemProvider[] $providers A map of source types as keys to provider instances.
41
- */
42
- public function __construct(array $providers)
43
- {
44
- $this->providers = $providers;
45
- }
46
-
47
- /**
48
- * Creates a new instance.
49
- *
50
- * @since [*next-version*]
51
- *
52
- * @param array $providers A map of source types as keys to provider instances.
53
- *
54
- * @return self The created instance.
55
- */
56
- public static function create(array $providers) : self
57
- {
58
- return new self($providers);
59
- }
60
-
61
- /**
62
- * @inheritDoc
63
- *
64
- * @since [*next-version*]
65
- */
66
- public function getItems(Source $source, ?int $number = null, int $offset = 0) : Result
67
- {
68
- return array_key_exists($source->type, $this->providers)
69
- ? $this->providers[$source->type]->getItems($source, $number, $offset)
70
- : Result::empty();
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Fetching/FallbackItemProvider.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Fetching;
4
-
5
- use RebelCode\Iris\Result;
6
- use RebelCode\Iris\Source;
7
-
8
- /**
9
- * A provider implementation that attempts to get items from multiple providers.
10
- *
11
- * This implementation will return items from the first provider that does so. Whenever a child provider returns an
12
- * erroneous result or a result without any items, the next provider is used. This process repeats until the criteria
13
- * are met. If none of the children providers' results meet the criteria, an erroneous result is returned.
14
- *
15
- * A very useful case for this implementation is caching, using two children providers. The first provider would attempt
16
- * to get items from a cache. If that fails, the second provider is used which would retrieve the items from the desired
17
- * resource such as a remote server.
18
- *
19
- * @since [*next-version*]
20
- */
21
- class FallbackItemProvider implements ItemProvider
22
- {
23
- /**
24
- * @since [*next-version*]
25
- *
26
- * @var ItemProvider[]
27
- */
28
- protected $providers;
29
-
30
- /**
31
- * Constructor.
32
- *
33
- * @since [*next-version*]
34
- *
35
- * @param ItemProvider[] $providers
36
- */
37
- public function __construct(array $providers)
38
- {
39
- $this->providers = $providers;
40
- }
41
-
42
- /**
43
- * @inheritDoc
44
- *
45
- * @since [*next-version*]
46
- */
47
- public function getItems(Source $source, ?int $number = null, int $offset = 0) : Result
48
- {
49
- foreach ($this->providers as $provider) {
50
- $result = $provider->getItems($source, $number, $offset);
51
-
52
- if ($result->success && !empty($result->items)) {
53
- return $result;
54
- }
55
- }
56
-
57
- return Result::error('No item providers are available', __CLASS__ . '_1');
58
- }
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Fetching/ItemProvider.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Fetching;
4
-
5
- use RebelCode\Iris\Result;
6
- use RebelCode\Iris\Source;
7
-
8
- /**
9
- * A provider is any resource that can provide items given a source.
10
- *
11
- * A provider does not need to necessarily represent a discrete location or endpoint. It may represent an entire set,
12
- * from which a discrete provider can be selected using a {@link Source}. For instance, it's possible to have a single
13
- * provider represent the entire internet that selects servers using data within the given {@link Source}. For this
14
- * reason, a provider is comparable to a map; given a source, the list of items that corresponds to that source will be
15
- * retrieved.
16
- *
17
- * The size and region of the list to be returned can be controlled using limit and offset pagination controls. Further
18
- * regions of the list may be retrieved using the return result's {@link Result::next} callback, if it's available. It
19
- * is recommended to use the {@link Result::getNextResult()} method to safely fetch any additional results or the
20
- * {@link Result::withNextResult()} method to obtain a combined version of the current result and the next.
21
- *
22
- * @since [*next-version*]
23
- */
24
- interface ItemProvider
25
- {
26
- /**
27
- * Retrieves items from the provider.
28
- *
29
- * @since [*next-version*]
30
- *
31
- * @param Source $source The source for which to retrieve items.
32
- * @param int|null $limit Optional limit for the number of items to fetch.
33
- * @param int $offset Optional number of items to skip when fetching.
34
- *
35
- * @return Result The result.
36
- */
37
- public function getItems(Source $source, ?int $limit = null, int $offset = 0) : Result;
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Importing/ItemImporter.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Importing;
4
-
5
- use RebelCode\Iris\Fetching\BatchingItemProvider;
6
- use RebelCode\Iris\Fetching\ItemProvider;
7
- use RebelCode\Iris\Result;
8
- use RebelCode\Iris\Source;
9
-
10
- /**
11
- * Imports items from an {@link ItemProvider} into an {@link ItemStore}.
12
- *
13
- * This implementation uses the {@link BatchingItemProvider} to import items into batches. Do **not** instantiate the
14
- * importer with a {@link BatchingItemProvider}, otherwise double-batching will be in-effect. The batching performed
15
- * by the implementation is able to leverage the store's {@link ItemStore::store()} method as the batching callback,
16
- * allowing each batch to be stored once it is fetched, as opposed to waiting for all the batches to be fetched first
17
- * and then all stored later.
18
- *
19
- * @since [*next-version*]
20
- */
21
- class ItemImporter
22
- {
23
- /**
24
- * The store in which to import items.
25
- *
26
- * @since [*next-version*]
27
- *
28
- * @var ItemStore
29
- */
30
- protected $store;
31
-
32
- /**
33
- * The provider to use to obtain items to import.
34
- *
35
- * @since [*next-version*]
36
- *
37
- * @var ItemProvider
38
- */
39
- protected $provider;
40
-
41
- /**
42
- * The size of each import batch.
43
- *
44
- * @since [*next-version*]
45
- *
46
- * @var int
47
- */
48
- protected $batchSize;
49
-
50
- /**
51
- * Constructor.
52
- *
53
- * @since [*next-version*]
54
- *
55
- * @param ItemStore $store The store in which to import items.
56
- * @param ItemProvider $provider The provider to use to obtain items to import.
57
- * @param int $batchSize The size of each import batch.
58
- */
59
- public function __construct(ItemStore $store, ItemProvider $provider, int $batchSize)
60
- {
61
- $this->store = $store;
62
- $this->provider = $provider;
63
- $this->batchSize = $batchSize;
64
- }
65
-
66
- /**
67
- * Imports all items for a given source.
68
- *
69
- * @since [*next-version*]
70
- *
71
- * @param Source $source The source to import items for.
72
- *
73
- * @return Result The result.
74
- */
75
- public function import(Source $source) : Result
76
- {
77
- $provider = new BatchingItemProvider($this->provider, $this->batchSize, [$this->store, 'store']);
78
-
79
- return $provider->getItems($source);
80
- }
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Importing/ItemStore.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris\Importing;
4
-
5
- use RebelCode\Iris\Fetching\ItemProvider;
6
- use RebelCode\Iris\Item;
7
- use RebelCode\Iris\Result;
8
-
9
- /**
10
- * Storage of items retrieved from an {@link ItemProvider}.
11
- *
12
- * @since [*next-version*]
13
- */
14
- interface ItemStore extends ItemProvider
15
- {
16
- /**
17
- * Stores a given list of items.
18
- *
19
- * @since [*next-version*]
20
- *
21
- * @param Item[] $items The items to store.
22
- *
23
- * @return Result The result from storing the items. This result should **not** set a {@link Result::$next}
24
- * callback. The {@link Result::$items} list should only contain items that were successfully added
25
- * to the store, with any changes may have been made prior to storing them.
26
- */
27
- public function store(array $items) : Result;
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Item.php DELETED
@@ -1,60 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris;
4
-
5
- /**
6
- * Represents an item fetched from a source.
7
- *
8
- * @since [*next-version*]
9
- */
10
- class Item
11
- {
12
- /**
13
- * A numeric ID that uniquely identifies this item.
14
- *
15
- * @since [*next-version*]
16
- *
17
- * @var string
18
- */
19
- public $id;
20
-
21
- /**
22
- * The source that fetched this item.
23
- *
24
- * @since [*next-version*]
25
- *
26
- * @var Source
27
- */
28
- public $source;
29
-
30
- /**
31
- * Any additional data for this item.
32
- *
33
- * @since [*next-version*]
34
- *
35
- * @var array
36
- */
37
- public $data;
38
-
39
- /**
40
- * Constructor.
41
- *
42
- * @since [*next-version*]
43
- *
44
- * @param int|string $id The ID of the item.
45
- * @param Source $source The source that fetched this item.
46
- * @param array $data Any additional data attached to the item.
47
- *
48
- * @return self The created item.
49
- */
50
- public static function create($id, Source $source, array $data = []) : self
51
- {
52
- $item = new static();
53
-
54
- $item->id = strval($id);
55
- $item->source = $source;
56
- $item->data = $data;
57
-
58
- return $item;
59
- }
60
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Result.php DELETED
@@ -1,219 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris;
4
-
5
- use RebelCode\Iris\Fetching\ItemProvider;
6
-
7
- /**
8
- * Contain results generated by an operator that works with lists of {@link Item} instances.
9
- *
10
- * Results can be either successful, erroneous or a mix of both. When the {@link Result::$success} flag is set to true,
11
- * consumers can assume that the operator was successful in retrieving items, either entirely or in part. To assert
12
- * to what extent the retrieval was successful, consumers should check the {@link Result::$errors} list. If the list is
13
- * empty, then retrieval was entirely successful. Otherwise, some problems arose during the retrieval process that did
14
- * not warrant a total failure. Operators are left to their own discretion on how to decide what is considered a total
15
- * failure and what isn't.
16
- *
17
- * On the contrary, when the {@link Result::$success} flag is set to false, consumers can assume that the operation has
18
- * failed entirely and no meaningful result could be obtained. In this scenario, consumers can also assume that there
19
- * will be at least one error in the {@link Result::$errors} list.
20
- *
21
- * Retrieved items can be read from the {@link Result::$items} array. This array should be assumed to be numeric.
22
- *
23
- * It is possible for an operator to indicate success while also not providing any items in the result. Consumers are
24
- * advised to first check whether the {@link Result::$success} flag is false to handle a complete failure. In the
25
- * event of a true value, consumers may proceed assuming success. However, the {@link Result::$errors} should be
26
- * handled
27
- * in some way, whether by the direct or a delegated consumer.
28
- *
29
- * Additional data can be attached to the result using the {@link Result::$data} associative array. Any data stored in
30
- * this property is non-standard and should only be depended on when explicitly dealing with specific operator
31
- * implementations. For instance, HTTP headers may be stored when working with an HTTP {@link ItemProvider}.
32
- *
33
- * Finally, results may optionally provide a means by which more results can be obtained. This is done through the
34
- * {@link Result::$next} callback. If not null, this property should be a callback which, when called returns a new
35
- * {@link Result} instance. This callback should NOT depend on any arguments. This callback is typically set by a
36
- * {@link ItemProvider} instance to allow consumers to easily retrieve the next batch of items, in cases where the
37
- * provider was given a limit or the results need to be paginated.
38
- *
39
- * @since [*next-version*]
40
- */
41
- class Result
42
- {
43
- /**
44
- * Whether or not item retrieval was successful.
45
- *
46
- * @since [*next-version*]
47
- *
48
- * @var bool
49
- */
50
- public $success = true;
51
-
52
- /**
53
- * The error if item retrieval failed, or null if successful.
54
- *
55
- * @since [*next-version*]
56
- *
57
- * @var Error[]
58
- */
59
- public $errors = [];
60
-
61
- /**
62
- * The retrieved items.
63
- *
64
- * @since [*next-version*]
65
- *
66
- * @var Item[]
67
- */
68
- public $items = [];
69
-
70
- /**
71
- * Any addition data attached to the result.
72
- *
73
- * @since [*next-version*]
74
- *
75
- * @var array
76
- */
77
- public $data = [];
78
-
79
- /**
80
- * A callback to get the next batch of items, or null if no more items to retrieve.
81
- *
82
- * @since [*next-version*]
83
- *
84
- * @var callable|null
85
- */
86
- public $next = null;
87
-
88
- /**
89
- * Checks whether the result has errors.
90
- *
91
- * @since [*next-version*]
92
- *
93
- * @return bool True if the result has errors, false if not.
94
- */
95
- public function hasErrors()
96
- {
97
- return count($this->errors) > 0;
98
- }
99
-
100
- /**
101
- * Helper method to safely invoke the result's {@link Result::$next} callback, if one is set.
102
- *
103
- * @since [*next-version*]
104
- *
105
- * @return Result The result. An empty result will be returned if the {@link Result::$next} callback is null.
106
- */
107
- public function getNextResult() : ?Result
108
- {
109
- return $this->next !== null ? ($this->next)() : new Result();
110
- }
111
-
112
- /**
113
- * Retrieves the next result, if one is available, and merges this instance with the new result.
114
- *
115
- * @since [*next-version*]
116
- *
117
- * @return static The merged result, or the same instance if no {@link Result::$next} callback is set.
118
- */
119
- public function withNextResult()
120
- {
121
- if ($this->next === null) {
122
- return $this;
123
- } else {
124
- $result = $this->getNextResult();
125
-
126
- if (!$result->hasErrors()) {
127
- $result->items = array_merge($this->items, $result->items);
128
- }
129
-
130
- return $result;
131
- }
132
- }
133
-
134
- /**
135
- * Merges this result with another.
136
- *
137
- * @since [*next-version*]
138
- *
139
- * @param Result $other The result to merge with.
140
- * @param bool $mergeNext Whether to merge the {@link Result::$next} callback or not.
141
- *
142
- * @return Result The merged result.
143
- */
144
- public function merge(Result $other, bool $mergeNext = true)
145
- {
146
- $new = new Result();
147
- $new->success = $this->success || $other->success;
148
- $new->items = array_merge($this->items, $other->items);
149
- $new->data = array_merge($this->data, $other->data);
150
- $new->errors = array_merge($this->errors, $other->errors);
151
-
152
- if ($mergeNext) {
153
- $new->next = function () use ($other) {
154
- $r1 = $this->getNextResult();
155
- $r2 = $other->getNextResult();
156
-
157
- return $r1->merge($r2);
158
- };
159
- }
160
-
161
- return $new;
162
- }
163
-
164
- /**
165
- * Creates a successful result.
166
- *
167
- * @since [*next-version*]
168
- *
169
- * @param array $items The items.
170
- * @param array $data Optional data to store in the result.
171
- * @param callable|null $next Optional callback to get the next batch of items.
172
- *
173
- * @return self The created result.
174
- */
175
- public static function success(array $items, array $data = [], callable $next = null) : self
176
- {
177
- $result = new static();
178
-
179
- $result->success = true;
180
- $result->errors = [];
181
- $result->items = $items;
182
- $result->data = $data;
183
- $result->next = $next;
184
-
185
- return $result;
186
- }
187
-
188
- /**
189
- * Creates an erroneous result.
190
- *
191
- * @since [*next-version*]
192
- *
193
- * @param string $message The error message.
194
- * @param string $code The error code.
195
- *
196
- * @return Result The created result.
197
- */
198
- public static function error(string $message, string $code = '') : self
199
- {
200
- $result = new static();
201
-
202
- $result->success = false;
203
- $result->errors = [new Error($message, $code)];
204
-
205
- return $result;
206
- }
207
-
208
- /**
209
- * Creates an empty result.
210
- *
211
- * @since [*next-version*]
212
- *
213
- * @return static The created result.
214
- */
215
- public static function empty()
216
- {
217
- return new static();
218
- }
219
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
engine/Source.php DELETED
@@ -1,148 +0,0 @@
1
- <?php
2
-
3
- namespace RebelCode\Iris;
4
-
5
- use RebelCode\Iris\Fetching\ItemProvider;
6
-
7
- /**
8
- * A data structure for an item's source.
9
- *
10
- * Sources are primarily used to determine how and/or which items should be fetched from an {@link ItemProvider}.
11
- * Typically, sources will contain information about accounts, categories, collections or other similar item-specific
12
- * parameters. They may also contain remote-specific information such as URLs, host names, IP addresses, file paths
13
- * and so-on. However, it is preferable to defer this resolution to an {@link ItemProvider}.
14
- *
15
- * Sources should be constructable using static consumer data, meaning they should not contain any functional data
16
- * such as class instances or callbacks.
17
- *
18
- * Item sources as primarily used to determine or distinguish the remote source for items. These can be URLs, host
19
- * names, IP addresses, file paths, etc.
20
- *
21
- * Sources must be able to be uniquely identified via their {@link Source::$key}. This key is most notably used in
22
- * equivalence checks to determine if an item was fetched from this source or to query for items that were fetched
23
- * for this source. For reliability, it is advised to generate the key using the uniqueness of a source's data.
24
- *
25
- * In contrast, the {@link Source::$type} is treated as a form of "enum" and is used to allow an {@link ItemProvider}
26
- * to utilize different fetch methods depending on its value.
27
- *
28
- * @since [*next-version*]
29
- */
30
- class Source
31
- {
32
- /**
33
- * A string key, used to uniquely identify the source.
34
- *
35
- * @since [*next-version*]
36
- *
37
- * @var string
38
- */
39
- public $key;
40
-
41
- /**
42
- * The type of the source, typically used to determine what fetching mechanism should be used.
43
- *
44
- * @since [*next-version*]
45
- *
46
- * @var string
47
- */
48
- public $type;
49
-
50
- /**
51
- * Any other data related to the source.
52
- *
53
- * @since [*next-version*]
54
- *
55
- * @var array
56
- */
57
- public $data;
58
-
59
- /**
60
- * Constructor.
61
- *
62
- * @since [*next-version*]
63
- *
64
- * @param string $key The key that identifies the source.
65
- * @param string $type The type for this source.
66
- * @param array $data Any additional data attached to this source.
67
- */
68
- public function __construct(string $key, string $type, array $data = [])
69
- {
70
- $this->key = $key;
71
- $this->type = $type;
72
- $this->data = $data;
73
- }
74
-
75
- /**
76
- * Static constructor.
77
- *
78
- * @since [*next-version*]
79
- *
80
- * @param string $key The key that identifies the source.
81
- * @param string $type The type for this source.
82
- * @param array $data Any additional data attached to this source.
83
- *
84
- * @return self The created source.
85
- */
86
- public static function create(string $key, string $type, array $data = []) : self
87
- {
88
- return new static($key, $type, $data);
89
- }
90
-
91
- /**
92
- * Creates a new source with an automatically generated key.
93
- *
94
- * Do NOT rely on uniqueness if the source has data with nested arrays, unless you are sure that the order of the
95
- * data in sub-arrays is always the same.
96
- *
97
- * @since [*next-version*]
98
- *
99
- * @param string $type The type for this source.
100
- * @param array $data Any additional data attached to this source.
101
- *
102
- * @return self The created source.
103
- */
104
- public static function auto(string $type, array $data = []): self
105
- {
106
- ksort($data);
107
- $hashData = compact('type', 'data');
108
- $hash = sha1(json_encode($hashData));
109
-
110
- return new static($hash, $type, $data);
111
- }
112
-
113
- /**
114
- * Converts a source into an array.
115
- *
116
- * @since [*next-version*]
117
- *
118
- * @param Source $source The source instance.
119
- *
120
- * @return array The array, containing the "type", "key" and "data".
121
- */
122
- public static function toArray(Source $source): array
123
- {
124
- return [
125
- 'type' => $source->type,
126
- 'key' => $source->key,
127
- 'data' => $source->data,
128
- ];
129
- }
130
-
131
- /**
132
- * Creates a source from an array.
133
- *
134
- * @since [*next-version*]
135
- *
136
- * @param array $array The array.
137
- *
138
- * @return Source The created source.
139
- */
140
- public static function fromArray(array $array): Source
141
- {
142
- return new static(
143
- $array['key'] ?? '',
144
- $array['type'] ?? '',
145
- $array['data'] ?? []
146
- );
147
- }
148
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules.php CHANGED
@@ -8,7 +8,6 @@ use RebelCode\Spotlight\Instagram\Modules\ConfigModule ;
8
  use RebelCode\Spotlight\Instagram\Modules\Dev\DevModule ;
9
  use RebelCode\Spotlight\Instagram\Modules\EngineModule ;
10
  use RebelCode\Spotlight\Instagram\Modules\FeedsModule ;
11
- use RebelCode\Spotlight\Instagram\Modules\ImportCronModule ;
12
  use RebelCode\Spotlight\Instagram\Modules\InstagramModule ;
13
  use RebelCode\Spotlight\Instagram\Modules\MediaModule ;
14
  use RebelCode\Spotlight\Instagram\Modules\MigrationModule ;
@@ -18,10 +17,12 @@ use RebelCode\Spotlight\Instagram\Modules\PreviewModule ;
18
  use RebelCode\Spotlight\Instagram\Modules\RestApiModule ;
19
  use RebelCode\Spotlight\Instagram\Modules\SaasModule ;
20
  use RebelCode\Spotlight\Instagram\Modules\ServerModule ;
 
21
  use RebelCode\Spotlight\Instagram\Modules\ShortcodeModule ;
22
  use RebelCode\Spotlight\Instagram\Modules\TemplatesModule ;
23
  use RebelCode\Spotlight\Instagram\Modules\TokenRefresherModule ;
24
  use RebelCode\Spotlight\Instagram\Modules\UiModule ;
 
25
  use RebelCode\Spotlight\Instagram\Modules\WidgetModule ;
26
  use RebelCode\Spotlight\Instagram\Modules\WordPressModule ;
27
  use RebelCode\Spotlight\Instagram\Modules\WpBlockModule ;
@@ -30,13 +31,13 @@ $modules = [
30
  'admin' => new AdminModule(),
31
  'config' => new ConfigModule(),
32
  'ig' => new InstagramModule(),
 
33
  'feeds' => new FeedsModule(),
34
  'templates' => new TemplatesModule(),
35
  'preview' => new PreviewModule(),
36
  'accounts' => new AccountsModule(),
37
  'media' => new MediaModule(),
38
- 'engine' => new EngineModule(),
39
- 'importer' => new ImportCronModule(),
40
  'cleaner' => new CleanUpCronModule(),
41
  'token_refresher' => new TokenRefresherModule(),
42
  'rest_api' => new RestApiModule(),
8
  use RebelCode\Spotlight\Instagram\Modules\Dev\DevModule ;
9
  use RebelCode\Spotlight\Instagram\Modules\EngineModule ;
10
  use RebelCode\Spotlight\Instagram\Modules\FeedsModule ;
 
11
  use RebelCode\Spotlight\Instagram\Modules\InstagramModule ;
12
  use RebelCode\Spotlight\Instagram\Modules\MediaModule ;
13
  use RebelCode\Spotlight\Instagram\Modules\MigrationModule ;
17
  use RebelCode\Spotlight\Instagram\Modules\RestApiModule ;
18
  use RebelCode\Spotlight\Instagram\Modules\SaasModule ;
19
  use RebelCode\Spotlight\Instagram\Modules\ServerModule ;
20
+ use RebelCode\Spotlight\Instagram\Modules\ShitModule ;
21
  use RebelCode\Spotlight\Instagram\Modules\ShortcodeModule ;
22
  use RebelCode\Spotlight\Instagram\Modules\TemplatesModule ;
23
  use RebelCode\Spotlight\Instagram\Modules\TokenRefresherModule ;
24
  use RebelCode\Spotlight\Instagram\Modules\UiModule ;
25
+ use RebelCode\Spotlight\Instagram\Modules\UpdateCronModule ;
26
  use RebelCode\Spotlight\Instagram\Modules\WidgetModule ;
27
  use RebelCode\Spotlight\Instagram\Modules\WordPressModule ;
28
  use RebelCode\Spotlight\Instagram\Modules\WpBlockModule ;
31
  'admin' => new AdminModule(),
32
  'config' => new ConfigModule(),
33
  'ig' => new InstagramModule(),
34
+ 'engine' => new EngineModule(),
35
  'feeds' => new FeedsModule(),
36
  'templates' => new TemplatesModule(),
37
  'preview' => new PreviewModule(),
38
  'accounts' => new AccountsModule(),
39
  'media' => new MediaModule(),
40
+ 'updater' => new UpdateCronModule(),
 
41
  'cleaner' => new CleanUpCronModule(),
42
  'token_refresher' => new TokenRefresherModule(),
43
  'rest_api' => new RestApiModule(),
modules/AccountsModule.php CHANGED
@@ -30,6 +30,7 @@ class AccountsModule extends Module
30
  'cpt/slug',
31
  'cpt/args',
32
  'cpt/fields',
 
33
  ]),
34
 
35
  // The accounts CPT slug name
30
  'cpt/slug',
31
  'cpt/args',
32
  'cpt/fields',
33
+ '@engine/store'
34
  ]),
35
 
36
  // The accounts CPT slug name
modules/CleanUpCronModule.php CHANGED
@@ -50,6 +50,7 @@ class CleanUpCronModule extends Module
50
 
51
  // The cleanup action - also the main handler for the cron
52
  'action' => new Constructor(CleanUpMediaAction::class, [
 
53
  '@media/cpt',
54
  '@config/set',
55
  ]),
50
 
51
  // The cleanup action - also the main handler for the cron
52
  'action' => new Constructor(CleanUpMediaAction::class, [
53
+ '@engine/instance',
54
  '@media/cpt',
55
  '@config/set',
56
  ]),
modules/Dev/DevAccessTokenHandler.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
6
+
7
+ use RebelCode\Spotlight\Instagram\IgApi\AccessToken;
8
+ use RebelCode\Spotlight\Instagram\IgApi\IgAccount;
9
+ use RebelCode\Spotlight\Instagram\IgApi\IgUser;
10
+
11
+ class DevAccessTokenHandler
12
+ {
13
+ public const CODE_PREFIX = 'developer';
14
+
15
+ public static function handle(?IgAccount $account, AccessToken $token): ?IgAccount
16
+ {
17
+ if (!DevModule::isDeveloper() || stripos($token->code, static::CODE_PREFIX) !== 0) {
18
+ return $account;
19
+ }
20
+
21
+ $mediaCount = substr($token->code, strlen(static::CODE_PREFIX));
22
+ $mediaCount = (int) $mediaCount;
23
+ $mediaCount = (!is_int($mediaCount) || $mediaCount <= 0) ? DevCatalog::DEFAULT_SIZE : $mediaCount;
24
+
25
+ update_option(DevCatalog::SIZE_OPTION, $mediaCount, false);
26
+
27
+ $igUser = new IgUser();
28
+ $igUser->name = 'Developer';
29
+ $igUser->type = 'DEVELOPER';
30
+ $igUser->username = "developer_${mediaCount}";
31
+ $igUser->bio = "Spotlight developer account with {$mediaCount} posts";
32
+ $igUser->followersCount = 0;
33
+ $igUser->followsCount = 0;
34
+ $igUser->mediaCount = $mediaCount;
35
+ $igUser->profilePicUrl = '';
36
+ $igUser->website = '';
37
+
38
+ return new IgAccount($igUser, $token);
39
+ }
40
+ }
modules/Dev/DevCatalog.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Modules\Dev;
6
+
7
+ use RebelCode\Iris\Data\Item;
8
+ use RebelCode\Iris\Data\Source;
9
+ use RebelCode\Iris\Fetcher\Catalog;
10
+ use RebelCode\Iris\Fetcher\FetchResult;
11
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
12
+
13
+ class DevCatalog implements Catalog
14
+ {
15
+ public const SIZE_OPTION = 'sli_dev_media_count';
16
+ public const DEFAULT_SIZE = 100;
17
+
18
+ public function query(Source $source, ?string $cursor = null, ?int $count = null): FetchResult
19
+ {
20
+ $catalogSize = (int) get_option(static::SIZE_OPTION, static::DEFAULT_SIZE);
21
+
22
+ $count = $count ?? 10;
23
+ $start = intval($cursor);
24
+ $end = min($catalogSize, $start + $count);
25
+
26
+ if (!is_int($start)) {
27
+ $start = 0;
28
+ }
29
+
30
+ $items = [];
31
+ for ($i = $start; $i < $end; ++$i) {
32
+ $num = $catalogSize - $i;
33
+ $id = sprintf('dev-%d', $num);
34
+
35
+ $items[] = new Item($id, null, [$source], [
36
+ MediaItem::MEDIA_ID => $id,
37
+ MediaItem::CAPTION => sprintf('Dev post #%d', $num),
38
+ MediaItem::USERNAME => 'spotlight_dev',
39
+ MediaItem::TIMESTAMP => date(DATE_ISO8601, time() - ($i * DAY_IN_SECONDS)),
40
+ MediaItem::MEDIA_TYPE => 'IMAGE',
41
+ MediaItem::MEDIA_URL => 'https://www.instagram.com/p/CHsEQO7hX3H/media/?size=m',
42
+ MediaItem::MEDIA_PRODUCT_TYPE => 'media_product_type',
43
+ MediaItem::PERMALINK => 'https://www.instagram.com/p/CHsEQO7hX3H/',
44
+ MediaItem::SHORTCODE => 'CHsEQO7hX3H',
45
+ MediaItem::VIDEO_TITLE => '',
46
+ MediaItem::THUMBNAIL_URL => 'https://www.instagram.com/p/CHsEQO7hX3H/media/?size=t',
47
+ MediaItem::LIKES_COUNT => '0',
48
+ MediaItem::COMMENTS_COUNT => '0',
49
+ MediaItem::COMMENTS => [],
50
+ MediaItem::CHILDREN => [],
51
+ ]);
52
+ }
53
+
54
+ $nextStart = $end;
55
+ $prevStart = $start - 1;
56
+ $nextCursor = ($nextStart < $catalogSize) ? (string) $nextStart : null;
57
+ $prevCursor = ($prevStart > 0) ? (string) $prevStart : null;
58
+
59
+ return new FetchResult($items, $source, $catalogSize, $nextCursor, $prevCursor);
60
+ }
61
+ }
modules/Dev/DevDeleteMedia.php CHANGED
@@ -46,7 +46,7 @@ class DevDeleteMedia
46
  ]);
47
  }
48
 
49
- $result = $this->cpt::deleteAll();
50
 
51
  add_action('admin_notices', function () use ($result) {
52
  if ($result === false) {
46
  ]);
47
  }
48
 
49
+ $result = $this->cpt->deleteAll();
50
 
51
  add_action('admin_notices', function () use ($result) {
52
  if ($result === false) {
modules/Dev/DevModule.php CHANGED
@@ -20,8 +20,8 @@ use RebelCode\Spotlight\Instagram\Wp\SubMenu;
20
  */
21
  class DevModule extends Module
22
  {
23
- const DEV_REQUEST_PARAM = 'sli_developer';
24
- const DEV_CAPABILITY = 'sli_developer';
25
 
26
  /**
27
  * @inheritDoc
@@ -56,23 +56,25 @@ class DevModule extends Module
56
  }
57
  });
58
 
59
- {
60
- add_action('init', function () {
61
- add_rewrite_rule('^spotlight/?\??(.*)', 'index.php?sli-admin=1&$matches[1]', 'top');
62
- });
63
-
64
- add_filter('query_vars', function ($vars) {
65
- $vars[] = 'sli-admin';
66
-
67
- return $vars;
68
- });
69
-
70
- add_filter('template_include', function ($template) use ($c) {
71
- return get_query_var('sli-admin', false)
72
- ? $c->get('plugin/dir') . '/includes/admin.php'
73
- : $template;
74
- });
75
- }
 
 
76
  }
77
 
78
  /**
@@ -88,7 +90,7 @@ class DevModule extends Module
88
  //==========================================================================
89
 
90
  'menu/item' => new Factory(['page'], function ($page) {
91
- return SubMenu::page($page, 'sli-dev', 'Dev tools', static::DEV_REQUEST_PARAM, PHP_INT_MAX);
92
  }),
93
 
94
  // The dev page
@@ -122,8 +124,10 @@ class DevModule extends Module
122
  // DEV TOOLS
123
  //==========================================================================
124
 
 
 
125
  // The DB reset tool
126
- 'reset_db' => new Constructor(DevResetDb::class, ['@wp/db']),
127
 
128
  // The DB media delete tool
129
  'delete_media' => new Constructor(DevDeleteMedia::class, ['@media/cpt']),
@@ -143,7 +147,9 @@ class DevModule extends Module
143
  return [
144
  // Add the menu item to Spotlight menu
145
  'ui/menu/items' => new Extension(['menu/item'], function ($prev, $item) {
146
- $prev[] = $item;
 
 
147
 
148
  return $prev;
149
  }),
@@ -155,6 +161,27 @@ class DevModule extends Module
155
  return $enabled ? $devServer : $url;
156
  }
157
  ),
 
 
 
 
 
 
158
  ];
159
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  }
20
  */
21
  class DevModule extends Module
22
  {
23
+ public const DEV_REQUEST_PARAM = 'sli_developer';
24
+ public const DEV_CAPABILITY = 'sli_developer';
25
 
26
  /**
27
  * @inheritDoc
56
  }
57
  });
58
 
59
+ add_filter('spotlight/instagram/api/connect_access_token', [DevAccessTokenHandler::class, 'handle'], 10, 2);
60
+
61
+ // {
62
+ // add_action('init', function () {
63
+ // add_rewrite_rule('^spotlight/?\??(.*)', 'index.php?sli-admin=1&$matches[1]', 'top');
64
+ // });
65
+ //
66
+ // add_filter('query_vars', function ($vars) {
67
+ // $vars[] = 'sli-admin';
68
+ //
69
+ // return $vars;
70
+ // });
71
+ //
72
+ // add_filter('template_include', function ($template) use ($c) {
73
+ // return get_query_var('sli-admin', false)
74
+ // ? $c->get('plugin/dir') . '/includes/admin.php'
75
+ // : $template;
76
+ // });
77
+ // }
78
  }
79
 
80
  /**
90
  //==========================================================================
91
 
92
  'menu/item' => new Factory(['page'], function ($page) {
93
+ return SubMenu::page($page, 'sli-dev', 'Dev tools', 'manage_options', PHP_INT_MAX);
94
  }),
95
 
96
  // The dev page
124
  // DEV TOOLS
125
  //==========================================================================
126
 
127
+ 'dev_catalog' => new Constructor(DevCatalog::class),
128
+
129
  // The DB reset tool
130
+ 'reset_db' => new Constructor(DevResetDb::class, ['@wp/db', '@engine/store/thumbnails']),
131
 
132
  // The DB media delete tool
133
  'delete_media' => new Constructor(DevDeleteMedia::class, ['@media/cpt']),
147
  return [
148
  // Add the menu item to Spotlight menu
149
  'ui/menu/items' => new Extension(['menu/item'], function ($prev, $item) {
150
+ if (static::isDeveloper()) {
151
+ $prev[] = $item;
152
+ }
153
 
154
  return $prev;
155
  }),
161
  return $enabled ? $devServer : $url;
162
  }
163
  ),
164
+
165
+ 'engine/fetcher/strategy/catalog_map' => new Extension(['dev_catalog'], function ($prev, $catalog) {
166
+ $prev['DEVELOPER'] = $catalog;
167
+
168
+ return $prev;
169
+ }),
170
  ];
171
  }
172
+
173
+ public static function isDeveloper(): bool
174
+ {
175
+ if (defined('SL_INSTA_DEV') && SL_INSTA_DEV) {
176
+ return true;
177
+ }
178
+
179
+ if (!function_exists('wp_get_current_user')) {
180
+ return false;
181
+ }
182
+
183
+ $user = wp_get_current_user();
184
+
185
+ return $user !== null && $user->has_cap(static::DEV_CAPABILITY);
186
+ }
187
  }
modules/Dev/DevPage.php CHANGED
@@ -3,8 +3,10 @@
3
  namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
 
5
  use Psr\Container\ContainerInterface;
 
 
6
  use RebelCode\Spotlight\Instagram\CoreModule;
7
- use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
8
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
9
  use RebelCode\Spotlight\Instagram\Wp\PostType;
10
  use SlInstaRuntime;
@@ -240,8 +242,10 @@ class DevPage
240
  {
241
  /* @var $cpt PostType */
242
  $cpt = $this->container->get('media/cpt');
 
 
243
 
244
- $mediaList = $cpt->query();
245
 
246
  $page = filter_input(INPUT_GET, 'db_page', FILTER_SANITIZE_NUMBER_INT);
247
  $page = empty($page) ? 1 : max(1, intval($page));
@@ -322,42 +326,51 @@ class DevPage
322
  <td colspan="6">There are no media posts in the database.</td>
323
  </tr>
324
  <?php endif; ?>
325
- <?php foreach ($mediaList as $media): ?>
 
 
 
 
 
 
 
 
 
 
326
  <tr>
327
- <td class="sli-db-col-id"><?= $media->ID ?></td>
328
  <td class="sli-db-col-link">
329
- <?php if (empty($media->{MediaPostType::URL})): ?>
330
- <?= $media->{MediaPostType::MEDIA_ID} ?> <i>(Missing media URL)</i>
331
  <?php else: ?>
332
- <a href="<?= $media->{MediaPostType::URL} ?>" target="_blank">
333
- <?= $media->{MediaPostType::MEDIA_ID} ?>
334
  </a>
335
  <?php endif; ?>
336
  </td>
337
  <td class="sli-db-col-caption">
338
- <?= $media->{MediaPostType::CAPTION} ?>
339
  </td>
340
  <td class="sli-db-col-type">
341
- <?= $media->{MediaPostType::TYPE} ?>
342
  </td>
343
  <td class="sli-db-col-source">
344
  <?php
345
 
346
- $username = $media->{MediaPostType::USERNAME};
347
-
348
  if (!empty($username)) {
349
  echo $username;
350
  } else {
351
- $isHashtag = stripos($media->{MediaPostType::SOURCE_TYPE}, 'hashtag');
 
352
  $prefix = $isHashtag ? '#' : '';
353
 
354
- echo $prefix . $media->{MediaPostType::SOURCE_NAME};
355
  }
356
  ?>
357
  </td>
358
- <td class="sli-db-col-date"><?= $media->{MediaPostType::TIMESTAMP} ?></td>
359
  <td class="sli-db-col-last-seen">
360
- <?= date(DATE_ISO8601, $media->{MediaPostType::LAST_REQUESTED}) ?>
361
  </td>
362
  </tr>
363
  <?php endforeach; ?>
3
  namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
 
5
  use Psr\Container\ContainerInterface;
6
+ use RebelCode\Iris\Data\Source;
7
+ use RebelCode\Iris\Store;
8
  use RebelCode\Spotlight\Instagram\CoreModule;
9
+ use RebelCode\Spotlight\Instagram\Engine\Data\Item\MediaItem;
10
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
11
  use RebelCode\Spotlight\Instagram\Wp\PostType;
12
  use SlInstaRuntime;
242
  {
243
  /* @var $cpt PostType */
244
  $cpt = $this->container->get('media/cpt');
245
+ /** @var Store $store */
246
+ $store = $this->container->get('engine/store');
247
 
248
+ $mediaList = $store->query(new Store\Query([]));
249
 
250
  $page = filter_input(INPUT_GET, 'db_page', FILTER_SANITIZE_NUMBER_INT);
251
  $page = empty($page) ? 1 : max(1, intval($page));
326
  <td colspan="6">There are no media posts in the database.</td>
327
  </tr>
328
  <?php endif; ?>
329
+ <?php foreach ($mediaList as $media):
330
+ $id = $media->id;
331
+ $localId = $media->localId;
332
+ $sources = $media->sources;
333
+ $url = $media->get(MediaItem::MEDIA_URL);
334
+ $caption = $media->get(MediaItem::CAPTION);
335
+ $type = $media->get(MediaItem::MEDIA_TYPE);
336
+ $username = $media->get(MediaItem::USERNAME);
337
+ $timestamp = $media->get(MediaItem::TIMESTAMP);
338
+ $lastRequested = $media->get(MediaItem::LAST_REQUESTED);
339
+ ?>
340
  <tr>
341
+ <td class="sli-db-col-id"><?= $localId ?></td>
342
  <td class="sli-db-col-link">
343
+ <?php if (empty($url)): ?>
344
+ <?= $id ?> <i>(Missing media URL)</i>
345
  <?php else: ?>
346
+ <a href="<?= $url ?>" target="_blank">
347
+ <?= $id ?>
348
  </a>
349
  <?php endif; ?>
350
  </td>
351
  <td class="sli-db-col-caption">
352
+ <?= $caption ?>
353
  </td>
354
  <td class="sli-db-col-type">
355
+ <?= $type ?>
356
  </td>
357
  <td class="sli-db-col-source">
358
  <?php
359
 
 
 
360
  if (!empty($username)) {
361
  echo $username;
362
  } else {
363
+ $source = $sources[0] ?? new Source('', '');
364
+ $isHashtag = stripos($source->type, 'hashtag');
365
  $prefix = $isHashtag ? '#' : '';
366
 
367
+ echo $prefix . $source->id;
368
  }
369
  ?>
370
  </td>
371
+ <td class="sli-db-col-date"><?= $timestamp ?></td>
372
  <td class="sli-db-col-last-seen">
373
+ <?= date(DATE_ISO8601, $lastRequested) ?>
374
  </td>
375
  </tr>
376
  <?php endforeach; ?>
modules/Dev/DevResetDb.php CHANGED
@@ -2,39 +2,30 @@
2
 
3
  namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
 
5
- use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaDownloader;
6
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
7
  use wpdb;
8
 
9
  /**
10
  * Dev tool that resets the DB.
11
  *
12
- * @since 0.1
13
  */
14
  class DevResetDb
15
  {
16
- /**
17
- * @since 0.1
18
- *
19
- * @var wpdb
20
- */
21
  protected $db;
22
 
23
- /**
24
- * Constructor.
25
- *
26
- * @since 0.1
27
- *
28
- * @param wpdb $db
29
- */
30
- public function __construct(wpdb $db)
31
  {
32
  $this->db = $db;
 
33
  }
34
 
35
- /**
36
- * @since 0.1
37
- */
38
  public function __invoke()
39
  {
40
  $resetDb = filter_input(INPUT_POST, 'sli_reset_db');
@@ -72,7 +63,8 @@ class DevResetDb
72
  LEFT JOIN {$db->postmeta} as meta ON post.ID = meta.post_id
73
  WHERE post.post_type IN ($postTypesStr)");
74
 
75
- MediaDownloader::clearThumbnailsDir();
 
76
 
77
  if ($db->last_error) {
78
  wp_die($db->last_error, 'Spotlight DB Reset - Error', ['back_link' => true]);
2
 
3
  namespace RebelCode\Spotlight\Instagram\Modules\Dev;
4
 
5
+ use RebelCode\Spotlight\Instagram\Engine\Store\ThumbnailStore;
6
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
7
  use wpdb;
8
 
9
  /**
10
  * Dev tool that resets the DB.
11
  *
12
+ * @todo Use PostType/Store objects instead of hardcoded CPT queries
13
  */
14
  class DevResetDb
15
  {
16
+ /** @var wpdb */
 
 
 
 
17
  protected $db;
18
 
19
+ /** @var ThumbnailStore */
20
+ protected $thumbnailStore;
21
+
22
+ /** Constructor */
23
+ public function __construct(wpdb $db, ThumbnailStore $thumbnailStore)
 
 
 
24
  {
25
  $this->db = $db;
26
+ $this->thumbnailStore = $thumbnailStore;
27
  }
28
 
 
 
 
29
  public function __invoke()
30
  {
31
  $resetDb = filter_input(INPUT_POST, 'sli_reset_db');
63
  LEFT JOIN {$db->postmeta} as meta ON post.ID = meta.post_id
64
  WHERE post.post_type IN ($postTypesStr)");
65
 
66
+ // Delete all thumbnails
67
+ $this->thumbnailStore->deleteAll();
68
 
69
  if ($db->last_error) {
70
  wp_die($db->last_error, 'Spotlight DB Reset - Error', ['back_link' => true]);
modules/EngineModule.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  namespace RebelCode\Spotlight\Instagram\Modules;
4
 
5
  use Dhii\Services\Factories\Constructor;
@@ -7,143 +9,134 @@ use Dhii\Services\Factories\ServiceList;
7
  use Dhii\Services\Factories\Value;
8
  use Dhii\Services\Factory;
9
  use Psr\Container\ContainerInterface;
10
- use RebelCode\Iris\Aggregation\ItemAggregator;
 
 
11
  use RebelCode\Iris\Engine;
12
- use RebelCode\Iris\Fetching\DelegateItemProvider;
13
- use RebelCode\Iris\Importing\ItemImporter;
14
- use RebelCode\Spotlight\Instagram\Engine\Aggregation\ExpiredStoriesProcessor;
15
- use RebelCode\Spotlight\Instagram\Engine\Aggregation\MediaSorterProcessor;
16
- use RebelCode\Spotlight\Instagram\Engine\Aggregation\MediaStorySegregator;
17
- use RebelCode\Spotlight\Instagram\Engine\Aggregation\MediaTransformer;
18
- use RebelCode\Spotlight\Instagram\Engine\Providers\IgAccountMediaProvider;
19
- use RebelCode\Spotlight\Instagram\Engine\Sources\UserSource;
20
- use RebelCode\Spotlight\Instagram\Engine\Stores\WpPostMediaStore;
 
 
 
 
21
  use RebelCode\Spotlight\Instagram\Module;
 
22
 
23
- /**
24
- * The module that configures the Iris engine.
25
- *
26
- * @since 0.5
27
- */
28
  class EngineModule extends Module
29
  {
30
- /**
31
- * @inheritDoc
32
- *
33
- * @since 0.5
34
- */
35
  public function run(ContainerInterface $c)
36
  {
37
  }
38
 
39
- /**
40
- * @inheritDoc
41
- *
42
- * @since 0.5
43
- */
44
  public function getFactories()
45
  {
46
  return [
47
- //==========================================================================================================
48
- // THE ENGINE
49
- //==========================================================================================================
50
 
51
  'instance' => new Constructor(Engine::class, [
52
- 'provider',
53
- 'importer',
54
- 'store',
55
  'aggregator',
 
56
  ]),
57
 
58
- //==========================================================================================================
59
- // PROVIDER
60
- //==========================================================================================================
61
 
62
- // The provider for fetching media from the remote Instagram API for any type of source
63
- 'provider' => new Constructor(DelegateItemProvider::class, ['provider/delegation']),
 
64
 
65
- // The delegation map for the provider
66
- 'provider/delegation' => new Factory(
67
- ['providers/ig/personal', 'providers/ig/business'],
68
- function ($personal, $business) {
 
 
 
69
  return [
70
- UserSource::TYPE_PERSONAL => $personal,
71
- UserSource::TYPE_BUSINESS => $business,
72
  ];
73
  }
74
  ),
75
 
76
- // The provider for fetching media for IG personal accounts
77
- 'providers/ig/personal' => new Factory(
78
- ['@ig/client', '@accounts/cpt'],
79
- [IgAccountMediaProvider::class, 'forPersonalAccount']
 
80
  ),
81
 
82
- // The provider for fetching media and stories for IG business accounts
83
- 'providers/ig/business' => new Factory(
84
- ['@ig/client', '@accounts/cpt'],
85
- [IgAccountMediaProvider::class, 'forBusinessAccount']
86
- ),
87
 
88
- //==========================================================================================================
89
- // IMPORTER
90
- //==========================================================================================================
91
 
92
- // The store for storing media as WordPress posts
93
- 'importer' => new Constructor(ItemImporter::class, [
94
  'store',
95
- 'provider',
96
- 'importer/batch_size',
97
  ]),
98
 
99
- // The size of each import batch
100
- 'importer/batch_size' => new Value(30),
101
-
102
- //==========================================================================================================
103
- // STORE
104
- //==========================================================================================================
105
 
106
- 'store' => new Constructor(WpPostMediaStore::class, ['@media/cpt']),
107
-
108
- //==========================================================================================================
109
  // AGGREGATOR
110
- //==========================================================================================================
111
 
112
- // The item aggregator for collecting items from multiple sources
113
- 'aggregator' => new Factory(
114
- ['store', 'aggregator/processors', 'aggregator/transformer'],
115
- function ($store, $processors, $transformer) {
116
- return new ItemAggregator($store, $processors, null, $transformer);
117
- }
118
- ),
 
 
119
 
120
- // The item processors to use in the aggregator
121
- 'aggregator/processors' => new ServiceList([
122
- 'aggregator/processors/expired_media_filter',
123
  'aggregator/processors/sorter',
 
124
  ]),
125
 
126
- // The aggregator processor that sorts media according to a feed's options
127
- 'aggregator/processors/sorter' => new Constructor(MediaSorterProcessor::class),
128
 
129
- // The aggregator processor that filters out expired media
130
- 'aggregator/processors/expired_media_filter' => new Constructor(ExpiredStoriesProcessor::class),
131
 
132
- // The item transformer to use in the aggregator
133
- 'aggregator/transformer' => new Constructor(MediaTransformer::class),
 
134
 
135
- // The item segregator to use in the aggregator
136
- 'aggregator/segregator' => new Constructor(MediaStorySegregator::class),
137
- ];
138
- }
139
 
140
- /**
141
- * @inheritDoc
142
- *
143
- * @since 0.5
144
- */
145
- public function getExtensions()
146
- {
147
- return [];
 
 
 
 
148
  }
149
  }
1
  <?php
2
 
3
+ declare(strict_types=1);
4
+
5
  namespace RebelCode\Spotlight\Instagram\Modules;
6
 
7
  use Dhii\Services\Factories\Constructor;
9
  use Dhii\Services\Factories\Value;
10
  use Dhii\Services\Factory;
11
  use Psr\Container\ContainerInterface;
12
+ use Psr\Http\Client\ClientInterface;
13
+ use RebelCode\Iris\Aggregator;
14
+ use RebelCode\Iris\Converter;
15
  use RebelCode\Iris\Engine;
16
+ use RebelCode\Iris\Fetcher;
17
+ use RebelCode\Iris\Fetcher\Catalog;
18
+ use RebelCode\Spotlight\Instagram\Engine\Aggregator\FeedPostFilterProcessor;
19
+ use RebelCode\Spotlight\Instagram\Engine\Aggregator\IgAggregationStrategy;
20
+ use RebelCode\Spotlight\Instagram\Engine\Aggregator\SortProcessor;
21
+ use RebelCode\Spotlight\Instagram\Engine\Converter\IgConversionStrategy;
22
+ use RebelCode\Spotlight\Instagram\Engine\Data\Source\UserSource;
23
+ use RebelCode\Spotlight\Instagram\Engine\Fetcher\AccountPostsCatalog;
24
+ use RebelCode\Spotlight\Instagram\Engine\Fetcher\IgFetchStrategy;
25
+ use RebelCode\Spotlight\Instagram\Engine\Fetcher\NullCatalog;
26
+ use RebelCode\Spotlight\Instagram\Engine\IgPostStore;
27
+ use RebelCode\Spotlight\Instagram\Engine\Store\ThumbnailRecipe;
28
+ use RebelCode\Spotlight\Instagram\Engine\Store\ThumbnailStore;
29
  use RebelCode\Spotlight\Instagram\Module;
30
+ use RebelCode\Spotlight\Instagram\Wp\PostType;
31
 
 
 
 
 
 
32
  class EngineModule extends Module
33
  {
 
 
 
 
 
34
  public function run(ContainerInterface $c)
35
  {
36
  }
37
 
 
 
 
 
 
38
  public function getFactories()
39
  {
40
  return [
41
+ //==========================================================================
42
+ // ENGINE
43
+ //==========================================================================
44
 
45
  'instance' => new Constructor(Engine::class, [
46
+ 'fetcher',
47
+ 'converter',
 
48
  'aggregator',
49
+ 'store',
50
  ]),
51
 
52
+ //==========================================================================
53
+ // FETCHER
54
+ //==========================================================================
55
 
56
+ 'fetcher' => new Constructor(Fetcher::class, [
57
+ 'fetcher/strategy',
58
+ ]),
59
 
60
+ 'fetcher/strategy' => new Constructor(IgFetchStrategy::class, [
61
+ 'fetcher/strategy/catalog_map',
62
+ ]),
63
+
64
+ 'fetcher/strategy/catalog_map' => new Factory(
65
+ ['fetcher/catalog/account'],
66
+ function (Catalog $account) {
67
  return [
68
+ UserSource::TYPE_PERSONAL => $account,
69
+ UserSource::TYPE_BUSINESS => $account,
70
  ];
71
  }
72
  ),
73
 
74
+ 'fetcher/catalog/account' => new Factory(
75
+ ['@ig/client', '@accounts/cpt', 'fetcher/catalog/stories'],
76
+ function (ClientInterface $client, PostType $accounts, ?Catalog $storyCatalog) {
77
+ return new AccountPostsCatalog($client, $accounts, $storyCatalog);
78
+ }
79
  ),
80
 
81
+ 'fetcher/catalog/stories' => new Value(null),
82
+
83
+ 'fetcher/catalog/fallback' => new Constructor(NullCatalog::class),
 
 
84
 
85
+ //==========================================================================
86
+ // CONVERTER
87
+ //==========================================================================
88
 
89
+ 'converter' => new Constructor(Converter::class, [
 
90
  'store',
91
+ 'converter/strategy',
 
92
  ]),
93
 
94
+ 'converter/strategy' => new Constructor(IgConversionStrategy::class),
 
 
 
 
 
95
 
96
+ //==========================================================================
 
 
97
  // AGGREGATOR
98
+ //==========================================================================
99
 
100
+ 'aggregator' => new Constructor(Aggregator::class, [
101
+ 'store',
102
+ 'aggregator/strategy',
103
+ ]),
104
+
105
+ 'aggregator/strategy' => new Constructor(IgAggregationStrategy::class, [
106
+ 'aggregator/pre_processors',
107
+ 'aggregator/post_processors',
108
+ ]),
109
 
110
+ 'aggregator/pre_processors' => new ServiceList([
 
 
111
  'aggregator/processors/sorter',
112
+ 'aggregator/processors/feed_post_filter',
113
  ]),
114
 
115
+ 'aggregator/post_processors' => new ServiceList([]),
 
116
 
117
+ 'aggregator/processors/feed_post_filter' => new Constructor(FeedPostFilterProcessor::class),
118
+ 'aggregator/processors/sorter' => new Constructor(SortProcessor::class),
119
 
120
+ //==========================================================================
121
+ // STORE
122
+ //==========================================================================
123
 
124
+ 'store' => new Constructor(IgPostStore::class, [
125
+ '@media/cpt/slug',
126
+ 'store/thumbnails',
127
+ ]),
128
 
129
+ 'store/thumbnails' => new Constructor(ThumbnailStore::class, [
130
+ 'store/thumbnails/directory',
131
+ 'store/thumbnails/recipes',
132
+ ]),
133
+
134
+ 'store/thumbnails/directory' => new Value('spotlight-insta'),
135
+
136
+ 'store/thumbnails/recipes' => new Value([
137
+ ThumbnailStore::SIZE_SMALL => new ThumbnailRecipe(480, 80),
138
+ ThumbnailStore::SIZE_MEDIUM => new ThumbnailRecipe(600, 90),
139
+ ]),
140
+ ];
141
  }
142
  }
modules/ImportCronModule.php CHANGED
@@ -4,15 +4,16 @@ 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 Psr\Container\ContainerInterface;
10
- use RebelCode\Spotlight\Instagram\Actions\ImportMediaAction;
11
  use RebelCode\Spotlight\Instagram\Actions\UpdateAccountsAction;
12
  use RebelCode\Spotlight\Instagram\Config\ConfigEntry;
13
  use RebelCode\Spotlight\Instagram\Config\WpOption;
14
  use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
15
  use RebelCode\Spotlight\Instagram\Di\ConfigService;
 
16
  use RebelCode\Spotlight\Instagram\Module;
17
  use RebelCode\Spotlight\Instagram\Wp\CronJob;
18
 
@@ -55,7 +56,17 @@ class ImportCronModule extends Module
55
  // CRON JOB
56
  //==========================================================================
57
 
58
- // The hook for the cron
 
 
 
 
 
 
 
 
 
 
59
  'hook' => new Value('spotlight/instagram/import'),
60
 
61
  // The args to pass to the cron's handlers
@@ -71,10 +82,9 @@ class ImportCronModule extends Module
71
  ]),
72
 
73
  // The cron handler for fetching media for saved accounts
74
- 'media_handler' => new Constructor(ImportMediaAction::class, [
75
- '@feeds/manager',
76
- '@engine/importer',
77
- ]),
78
 
79
  // The list of handlers for the cron
80
  'handlers' => new ServiceList([
4
 
5
  use Dhii\Services\Extension;
6
  use Dhii\Services\Factories\Constructor;
7
+ use Dhii\Services\Factories\FuncService;
8
  use Dhii\Services\Factories\ServiceList;
9
  use Dhii\Services\Factories\Value;
10
  use Psr\Container\ContainerInterface;
 
11
  use RebelCode\Spotlight\Instagram\Actions\UpdateAccountsAction;
12
  use RebelCode\Spotlight\Instagram\Config\ConfigEntry;
13
  use RebelCode\Spotlight\Instagram\Config\WpOption;
14
  use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
15
  use RebelCode\Spotlight\Instagram\Di\ConfigService;
16
+ use RebelCode\Spotlight\Instagram\Engine\Importer;
17
  use RebelCode\Spotlight\Instagram\Module;
18
  use RebelCode\Spotlight\Instagram\Wp\CronJob;
19
 
56
  // CRON JOB
57
  //==========================================================================
58
 
59
+ 'importer' => new Constructor(Importer::class, [
60
+ '@engine/instance',
61
+ '@feeds/manager',
62
+ 'batch/size',
63
+ 'batch/hook',
64
+ ]),
65
+
66
+ 'batch/size' => new Value(100),
67
+ 'batch/hook' => new Value('spotlight/instagram/import_batch'),
68
+
69
+ // The hook for the main import cron
70
  'hook' => new Value('spotlight/instagram/import'),
71
 
72
  // The args to pass to the cron's handlers
82
  ]),
83
 
84
  // The cron handler for fetching media for saved accounts
85
+ 'media_handler' => new FuncService(['importer'], function (Importer $importer) {
86
+ $importer->updateFeeds();
87
+ }),
 
88
 
89
  // The list of handlers for the cron
90
  'handlers' => new ServiceList([
modules/InstagramModule.php CHANGED
@@ -8,9 +8,6 @@ use Dhii\Services\Factories\ServiceList;
8
  use Dhii\Services\Factories\StringService;
9
  use Dhii\Services\Factories\Value;
10
  use Dhii\Services\Factory;
11
- use Kevinrob\GuzzleCache\CacheMiddleware;
12
- use Kevinrob\GuzzleCache\Storage\Psr16CacheStorage;
13
- use Kevinrob\GuzzleCache\Strategy\GreedyCacheStrategy;
14
  use Psr\Container\ContainerInterface;
15
  use RebelCode\Spotlight\Instagram\Actions\AuthCallbackListener;
16
  use RebelCode\Spotlight\Instagram\IgApi\IgApiClient;
@@ -51,24 +48,12 @@ class InstagramModule extends Module
51
  'client/timeout' => new Value(20),
52
 
53
  // Middleware for the Guzzle client
54
- 'client/middlewares' => new ServiceList([
55
- 'cache/middleware',
56
- ]),
57
 
58
  //==========================================================================
59
  // API CACHE
60
  //==========================================================================
61
 
62
- // The cache middleware
63
- 'cache/middleware' => new Factory(['cache/pool', 'cache/ttl'], function ($cachePool, $ttl) {
64
- return new CacheMiddleware(
65
- new GreedyCacheStrategy(
66
- new Psr16CacheStorage($cachePool),
67
- $ttl
68
- )
69
- );
70
- }),
71
-
72
  // The cache pool instance
73
  'cache/pool' => new Factory(['@wp/db', 'cache/pool/key', 'cache/pool/default', 'cache/pool/silent'],
74
  function ($wpdb, $key, $default, $silent) {
8
  use Dhii\Services\Factories\StringService;
9
  use Dhii\Services\Factories\Value;
10
  use Dhii\Services\Factory;
 
 
 
11
  use Psr\Container\ContainerInterface;
12
  use RebelCode\Spotlight\Instagram\Actions\AuthCallbackListener;
13
  use RebelCode\Spotlight\Instagram\IgApi\IgApiClient;
48
  'client/timeout' => new Value(20),
49
 
50
  // Middleware for the Guzzle client
51
+ 'client/middlewares' => new ServiceList([]),
 
 
52
 
53
  //==========================================================================
54
  // API CACHE
55
  //==========================================================================
56
 
 
 
 
 
 
 
 
 
 
 
57
  // The cache pool instance
58
  'cache/pool' => new Factory(['@wp/db', 'cache/pool/key', 'cache/pool/default', 'cache/pool/silent'],
59
  function ($wpdb, $key, $default, $silent) {
modules/MediaModule.php CHANGED
@@ -4,14 +4,11 @@ namespace RebelCode\Spotlight\Instagram\Modules;
4
 
5
  use Dhii\Services\Factories\Constructor;
6
  use Dhii\Services\Factories\FuncService;
7
- use Dhii\Services\Factories\ServiceList;
8
  use Dhii\Services\Factories\Value;
9
  use Psr\Container\ContainerInterface;
 
10
  use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
11
- use RebelCode\Spotlight\Instagram\MediaStore\Fetchers\AccountMediaFetcher;
12
- use RebelCode\Spotlight\Instagram\MediaStore\MediaStore;
13
- use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaDownloader;
14
- use RebelCode\Spotlight\Instagram\MediaStore\Processors\MediaSorterProcessor;
15
  use RebelCode\Spotlight\Instagram\Module;
16
  use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
17
  use RebelCode\Spotlight\Instagram\Wp\MetaField;
@@ -41,6 +38,7 @@ class MediaModule extends Module
41
  'cpt/slug',
42
  'cpt/args',
43
  'cpt/fields',
 
44
  ]),
45
 
46
  // The media CPT slug name
@@ -67,62 +65,64 @@ class MediaModule extends Module
67
  new MetaField(MediaPostType::LAST_REQUESTED),
68
  ]),
69
 
70
- //==========================================================================
71
- // MEDIA STORE
72
- //==========================================================================
73
-
74
- // The media store
75
- 'store' => new Constructor(MediaStore::class, ['@wp/db', 'fetchers', 'processors', 'cpt']),
76
-
77
- // The media fetchers to use in the store
78
- 'fetchers' => new ServiceList([
79
- 'fetchers/accounts',
80
- ]),
81
-
82
- // The media processors to use in the store
83
- 'processors' => new ServiceList([
84
- 'processors/sorter',
85
- ]),
86
-
87
- //==========================================================================
88
- // FETCHERS
89
- //==========================================================================
90
-
91
- // The fetcher that gets media from accounts
92
- 'fetchers/accounts' => new Constructor(AccountMediaFetcher::class, [
93
- '@ig/api/client',
94
- '@accounts/cpt',
95
- ]),
96
-
97
- //==========================================================================
98
- // PROCESSORS
99
- //==========================================================================
100
-
101
- // The processor that sorts the media
102
- 'processors/sorter' => new Constructor(MediaSorterProcessor::class, []),
103
-
104
  //==========================================================================
105
  // MIGRATIONS
106
  //==========================================================================
107
 
108
  'migrations/0.4.1/generate_thumbnails' => new FuncService(
109
- ['@media/cpt'],
110
- function ($v1, $v2, PostType $mediaCpt) {
111
  if (version_compare($v1, '0.4.1', '<')) {
112
  foreach ($mediaCpt->query() as $post) {
113
  // Extend the time limit by 10 seconds
114
  set_time_limit(10);
115
- // Convert into a cached media object to download the necessary files
116
- $media = MediaPostType::fromWpPost($post);
117
- MediaDownloader::downloadMediaFiles($media);
118
 
119
- // Convert back into a post and update it
120
- $postData = MediaPostType::toWpPost($media);
121
- $mediaCpt->update($post->ID, $postData);
 
 
 
122
  }
123
  }
124
  }
125
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  ];
127
  }
128
 
@@ -140,6 +140,7 @@ class MediaModule extends Module
140
  // Add the migrations
141
  'migrator/migrations' => new ArrayExtension([
142
  'migrations/0.4.1/generate_thumbnails',
 
143
  ]),
144
  ];
145
  }
4
 
5
  use Dhii\Services\Factories\Constructor;
6
  use Dhii\Services\Factories\FuncService;
 
7
  use Dhii\Services\Factories\Value;
8
  use Psr\Container\ContainerInterface;
9
+ use RebelCode\Iris\Data\Source;
10
  use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
11
+ use RebelCode\Spotlight\Instagram\Engine\IgPostStore;
 
 
 
12
  use RebelCode\Spotlight\Instagram\Module;
13
  use RebelCode\Spotlight\Instagram\PostTypes\MediaPostType;
14
  use RebelCode\Spotlight\Instagram\Wp\MetaField;
38
  'cpt/slug',
39
  'cpt/args',
40
  'cpt/fields',
41
+ '@engine/store/thumbnails',
42
  ]),
43
 
44
  // The media CPT slug name
65
  new MetaField(MediaPostType::LAST_REQUESTED),
66
  ]),
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  //==========================================================================
69
  // MIGRATIONS
70
  //==========================================================================
71
 
72
  'migrations/0.4.1/generate_thumbnails' => new FuncService(
73
+ ['@media/cpt', '@engine/store'],
74
+ function ($v1, $v2, PostType $mediaCpt, IgPostStore $store) {
75
  if (version_compare($v1, '0.4.1', '<')) {
76
  foreach ($mediaCpt->query() as $post) {
77
  // Extend the time limit by 10 seconds
78
  set_time_limit(10);
 
 
 
79
 
80
+ // Convert from post to item and generate the thumbnails
81
+ $item = $store->postToItem($post);
82
+ $item = $store->getThumbnailStore()->downloadAndGenerate($item);
83
+
84
+ // Update the item
85
+ $store->insert($item);
86
  }
87
  }
88
  }
89
  ),
90
+
91
+ 'migrations/0.9/update_sources_meta' => new FuncService(['@wp/db'], function ($oldVer, $newVer, $wpdb) {
92
+ if (version_compare($oldVer, '0.9', '<')) {
93
+ $sourceNameQuery = sprintf(
94
+ "SELECT post_id, meta_value FROM %s WHERE meta_key = '%s'",
95
+ $wpdb->postmeta,
96
+ MediaPostType::SOURCE_NAME
97
+ );
98
+
99
+ $sourceTypeQuery = sprintf(
100
+ "SELECT post_id, meta_value FROM %s WHERE meta_key = '%s'",
101
+ $wpdb->postmeta,
102
+ MediaPostType::SOURCE_TYPE
103
+ );
104
+
105
+ $sourceQuery = sprintf(
106
+ 'SELECT st.post_id, sn.meta_value as name, st.meta_value as type
107
+ FROM (%s) as sn
108
+ JOIN (%s) as st
109
+ ON sn.post_id = st.post_id',
110
+ $sourceNameQuery,
111
+ $sourceTypeQuery
112
+ );
113
+
114
+ $rows = $wpdb->get_results($sourceQuery);
115
+
116
+ if (is_array($rows)) {
117
+ foreach ($rows as $row) {
118
+ $source = new Source($row->name, $row->type);
119
+ delete_post_meta($row->post_id, MediaPostType::SOURCE_NAME);
120
+ delete_post_meta($row->post_id, MediaPostType::SOURCE_TYPE);
121
+ add_post_meta($row->post_id, MediaPostType::SOURCE, (string) $source);
122
+ }
123
+ }
124
+ }
125
+ }),
126
  ];
127
  }
128
 
140
  // Add the migrations
141
  'migrator/migrations' => new ArrayExtension([
142
  'migrations/0.4.1/generate_thumbnails',
143
+ 'migrations/0.9/update_sources_meta',
144
  ]),
145
  ];
146
  }
modules/RestApiModule.php CHANGED
@@ -27,9 +27,7 @@ use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\GetAccountsEndPoint
27
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\UpdateAccountEndPoint;
28
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\DeleteFeedsEndpoint;
29
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\GetFeedsEndpoint;
30
- use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\GetSourcesEndpoint;
31
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\SaveFeedsEndpoint;
32
- use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media\GetFeedMediaEndPoint;
33
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media\GetMediaEndPoint;
34
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media\ImportMediaEndPoint;
35
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Notifications\GetNotificationsEndPoint;
@@ -88,7 +86,6 @@ class RestApiModule extends Module
88
  'endpoints/media/get',
89
  'endpoints/media/feed',
90
  'endpoints/media/import',
91
- 'endpoints/media/sources',
92
  'endpoints/promotion/search_posts',
93
  'endpoints/templates/get',
94
  'endpoints/settings/get',
@@ -241,12 +238,12 @@ class RestApiModule extends Module
241
  ),
242
  // The endpoint that deletes media for an account
243
  'endpoints/accounts/delete_media' => new Factory(
244
- ['@accounts/cpt', '@media/cpt', 'auth/user'],
245
- function ($accountsCpt, $mediaCpt, $auth) {
246
  return new EndPoint(
247
  '/account_media/delete/(?P<id>\d+)',
248
  ['POST'],
249
- new DeleteAccountMediaEndpoint($accountsCpt, $mediaCpt),
250
  $auth
251
  );
252
  }
@@ -271,26 +268,26 @@ class RestApiModule extends Module
271
  // The transformer that transforms IG media instances into REST API response format
272
  'media/transformer' => new Constructor(MediaTransformer::class, []),
273
 
274
- // The GET endpoint for retrieving the media posts that have been imported, without fetching new ones
275
  'endpoints/media/get' => new Factory(
276
- ['@engine/instance', '@feeds/manager', 'auth/public'],
277
- function ($engine, $feedManager, $auth) {
278
  return new EndPoint(
279
  '/media',
280
  ['GET'],
281
- new GetMediaEndPoint($engine, $feedManager),
282
  $auth
283
  );
284
  }
285
  ),
286
- // The endpoint for fetching media posts from IG
287
  'endpoints/media/feed' => new Factory(
288
- ['@server/instance', 'auth/public', 'headers/media/expiry'],
289
- function ($server, $auth, $cacheExpiry) {
290
  return new EndPoint(
291
  '/media/feed',
292
  ['POST'],
293
- new GetFeedMediaEndPoint($server, (int) $cacheExpiry),
294
  $auth
295
  );
296
  }
@@ -309,19 +306,6 @@ class RestApiModule extends Module
309
  }
310
  ),
311
 
312
- // The REST API endpoint for getting sources used across all media
313
- 'endpoints/media/sources' => new Factory(
314
- ['auth/user'],
315
- function ($auth) {
316
- return new EndPoint(
317
- '/media/sources',
318
- ['GET'],
319
- new GetSourcesEndpoint(),
320
- $auth
321
- );
322
- }
323
- ),
324
-
325
  //==========================================================================
326
  // PROMOTION
327
  //==========================================================================
@@ -438,7 +422,7 @@ class RestApiModule extends Module
438
  ),
439
 
440
  // The value to use for the "Expires" HTTP header in media endpoints
441
- 'headers/media/expiry' => new Factory(['@importer/job'], function (CronJob $job) {
442
  $event = CronJob::getScheduledEvent($job);
443
 
444
  return is_object($event)
27
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Accounts\UpdateAccountEndPoint;
28
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\DeleteFeedsEndpoint;
29
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\GetFeedsEndpoint;
 
30
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Feeds\SaveFeedsEndpoint;
 
31
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media\GetMediaEndPoint;
32
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Media\ImportMediaEndPoint;
33
  use RebelCode\Spotlight\Instagram\RestApi\EndPoints\Notifications\GetNotificationsEndPoint;
86
  'endpoints/media/get',
87
  'endpoints/media/feed',
88
  'endpoints/media/import',
 
89
  'endpoints/promotion/search_posts',
90
  'endpoints/templates/get',
91
  'endpoints/settings/get',
238
  ),
239
  // The endpoint that deletes media for an account
240
  'endpoints/accounts/delete_media' => new Factory(
241
+ ['@accounts/cpt', '@engine/store', 'auth/user'],
242
+ function ($accountsCpt, $store, $auth) {
243
  return new EndPoint(
244
  '/account_media/delete/(?P<id>\d+)',
245
  ['POST'],
246
+ new DeleteAccountMediaEndpoint($accountsCpt, $store),
247
  $auth
248
  );
249
  }
268
  // The transformer that transforms IG media instances into REST API response format
269
  'media/transformer' => new Constructor(MediaTransformer::class, []),
270
 
271
+ // The GET endpoint for retrieving media
272
  'endpoints/media/get' => new Factory(
273
+ ['@server/instance', 'auth/public'],
274
+ function ($server, $auth) {
275
  return new EndPoint(
276
  '/media',
277
  ['GET'],
278
+ new GetMediaEndPoint($server),
279
  $auth
280
  );
281
  }
282
  ),
283
+ // Equivalent to the above service, but POST
284
  'endpoints/media/feed' => new Factory(
285
+ ['@server/instance', 'auth/public'],
286
+ function ($server, $auth) {
287
  return new EndPoint(
288
  '/media/feed',
289
  ['POST'],
290
+ new GetMediaEndPoint($server),
291
  $auth
292
  );
293
  }
306
  }
307
  ),
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  //==========================================================================
310
  // PROMOTION
311
  //==========================================================================
422
  ),
423
 
424
  // The value to use for the "Expires" HTTP header in media endpoints
425
+ 'headers/media/expiry' => new Factory(['@updater/main/job'], function (CronJob $job) {
426
  $event = CronJob::getScheduledEvent($job);
427
 
428
  return is_object($event)
modules/ServerModule.php CHANGED
@@ -6,8 +6,8 @@ namespace RebelCode\Spotlight\Instagram\Modules;
6
 
7
  use Dhii\Services\Factories\Constructor;
8
  use Psr\Container\ContainerInterface;
9
- use RebelCode\Spotlight\Instagram\Server;
10
  use RebelCode\Spotlight\Instagram\Module;
 
11
 
12
  class ServerModule extends Module
13
  {
@@ -18,7 +18,7 @@ class ServerModule extends Module
18
  public function getFactories()
19
  {
20
  return [
21
- 'instance' => new Constructor(Server::class, ['@engine/instance', '@feeds/manager']),
22
  ];
23
  }
24
 
6
 
7
  use Dhii\Services\Factories\Constructor;
8
  use Psr\Container\ContainerInterface;
 
9
  use RebelCode\Spotlight\Instagram\Module;
10
+ use RebelCode\Spotlight\Instagram\Server;
11
 
12
  class ServerModule extends Module
13
  {
18
  public function getFactories()
19
  {
20
  return [
21
+ 'instance' => new Constructor(Server::class, ['@engine/instance', '@updater/importer', '@feeds/manager']),
22
  ];
23
  }
24
 
modules/UiModule.php CHANGED
@@ -9,6 +9,7 @@ use Dhii\Services\Factories\StringService;
9
  use Dhii\Services\Factories\Value;
10
  use Dhii\Services\Factory;
11
  use Psr\Container\ContainerInterface;
 
12
  use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
13
  use RebelCode\Spotlight\Instagram\Module;
14
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
@@ -209,6 +210,9 @@ class UiModule extends Module
209
  'dashicons',
210
  'wp-edit-post',
211
  ]),
 
 
 
212
  'sli-editor' => Asset::style("{$url}/feed-editor.css", $ver, [
213
  'sli-admin-common',
214
  'sli-feed',
@@ -239,7 +243,7 @@ class UiModule extends Module
239
 
240
  // The styles to load for the admin app
241
  'admin_styles' => new Value([
242
- 'sli-admin-common',
243
  'sli-editor',
244
  ]),
245
 
@@ -314,6 +318,12 @@ class UiModule extends Module
314
  'onboarding/is_done' => new Factory(['onboarding/option'], function ($option) {
315
  return filter_var(get_option($option, false), FILTER_VALIDATE_BOOLEAN);
316
  }),
 
 
 
 
 
 
317
  ];
318
  }
319
 
@@ -336,6 +346,9 @@ class UiModule extends Module
336
  */
337
  public function run(ContainerInterface $c)
338
  {
 
 
 
339
  // Register the assets
340
  {
341
  add_action('spotlight/instagram/init', $c->get('register_assets_fn'), 100);
9
  use Dhii\Services\Factories\Value;
10
  use Dhii\Services\Factory;
11
  use Psr\Container\ContainerInterface;
12
+ use RebelCode\Spotlight\Instagram\Actions\IgImageProxy;
13
  use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
14
  use RebelCode\Spotlight\Instagram\Module;
15
  use RebelCode\Spotlight\Instagram\Utils\Arrays;
210
  'dashicons',
211
  'wp-edit-post',
212
  ]),
213
+ 'sli-admin' => Asset::style("{$url}/admin-app.css", $ver, [
214
+ 'sli-admin-common'
215
+ ]),
216
  'sli-editor' => Asset::style("{$url}/feed-editor.css", $ver, [
217
  'sli-admin-common',
218
  'sli-feed',
243
 
244
  // The styles to load for the admin app
245
  'admin_styles' => new Value([
246
+ 'sli-admin',
247
  'sli-editor',
248
  ]),
249
 
318
  'onboarding/is_done' => new Factory(['onboarding/option'], function ($option) {
319
  return filter_var(get_option($option, false), FILTER_VALIDATE_BOOLEAN);
320
  }),
321
+
322
+ //==========================================================================
323
+ // INSTAGRAM IMAGE PROXY
324
+ //==========================================================================
325
+
326
+ 'image_proxy' => new Constructor(IgImageProxy::class),
327
  ];
328
  }
329
 
346
  */
347
  public function run(ContainerInterface $c)
348
  {
349
+ // Register the image proxy to listen for requests
350
+ add_action('init', $c->get('image_proxy'));
351
+
352
  // Register the assets
353
  {
354
  add_action('spotlight/instagram/init', $c->get('register_assets_fn'), 100);
modules/UpdateCronModule.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace RebelCode\Spotlight\Instagram\Modules;
6
+
7
+ use Dhii\Services\Extension;
8
+ use Dhii\Services\Factories\Constructor;
9
+ use Dhii\Services\Factories\ServiceList;
10
+ use Dhii\Services\Factories\Value;
11
+ use Dhii\Services\Factory;
12
+ use Psr\Container\ContainerInterface;
13
+ use RebelCode\Spotlight\Instagram\Actions\UpdateAccountsAction;
14
+ use RebelCode\Spotlight\Instagram\Actions\UpdateFeedsAction;
15
+ use RebelCode\Spotlight\Instagram\Config\ConfigEntry;
16
+ use RebelCode\Spotlight\Instagram\Config\WpOption;
17
+ use RebelCode\Spotlight\Instagram\Di\ArrayExtension;
18
+ use RebelCode\Spotlight\Instagram\Di\ConfigService;
19
+ use RebelCode\Spotlight\Instagram\Engine\Importer;
20
+ use RebelCode\Spotlight\Instagram\Module;
21
+ use RebelCode\Spotlight\Instagram\Wp\CronJob;
22
+
23
+ class UpdateCronModule extends Module
24
+ {
25
+ /** The config key for the update interval setting. */
26
+ const CONFIG_UPDATE_INTERVAL = 'importerInterval';
27
+
28
+ public function run(ContainerInterface $c)
29
+ {
30
+ add_action('init', function () {
31
+ // Unschedule old crons
32
+ wp_unschedule_hook('spotlight/instagram/import_media');
33
+ wp_unschedule_hook('spotlight/instagram/import');
34
+ });
35
+
36
+ // Register the batch handler
37
+ // We don't use the WpModule's API for this because the cron is not auto-scheduled, but scheduled on-demand
38
+ add_action($c->get('batch/cron/hook'), $c->get('batch/cron/handler'));
39
+ }
40
+
41
+ public function getFactories()
42
+ {
43
+ return [
44
+ //==========================================================================
45
+ // CRON JOB
46
+ //==========================================================================
47
+
48
+ 'importer' => new Constructor(Importer::class, [
49
+ '@engine/instance',
50
+ '@feeds/manager',
51
+ 'batch/size',
52
+ 'batch/cron/hook',
53
+ ]),
54
+
55
+ //==========================================================================
56
+ // BATCH IMPORTING
57
+ //==========================================================================
58
+
59
+ 'batch/size' => new Value(50),
60
+ 'batch/cron/hook' => new Value('spotlight/instagram/import_batch'),
61
+ 'batch/cron/handler' => new Factory(['importer'], function (Importer $importer) {
62
+ return [$importer, 'importBatch'];
63
+ }),
64
+
65
+ //==========================================================================
66
+ // MAIN UPDATE CRON
67
+ //==========================================================================
68
+
69
+ 'main/hook' => new Value('spotlight/instagram/update'),
70
+ 'main/args' => new Value([]),
71
+ 'main/repeat' => new ConfigService('@config/set', static::CONFIG_UPDATE_INTERVAL),
72
+
73
+ // The cron handler for updating account info
74
+ 'main/handlers/accounts' => new Constructor(UpdateAccountsAction::class, [
75
+ '@ig/api/client',
76
+ '@accounts/cpt',
77
+ ]),
78
+
79
+ // The cron handler for fetching media for feeds
80
+ 'main/handlers/feeds' => new Constructor(UpdateFeedsAction::class, ['importer']),
81
+
82
+ // The list of handlers for the cron
83
+ 'main/handlers' => new ServiceList([
84
+ 'main/handlers/accounts',
85
+ 'main/handlers/feeds',
86
+ ]),
87
+
88
+ // The cron job instance
89
+ 'main/job' => new Constructor(CronJob::class, [
90
+ 'main/hook',
91
+ 'main/args',
92
+ 'main/repeat',
93
+ 'main/handlers',
94
+ ]),
95
+
96
+ //==========================================================================
97
+ // CONFIG ENTRIES
98
+ //==========================================================================
99
+
100
+ // The config entry that stores the cron's repetition interval
101
+ 'config/interval' => new Value(new WpOption('sli_importer_interval', 'hourly')),
102
+ ];
103
+ }
104
+
105
+ public function getExtensions(): array
106
+ {
107
+ return [
108
+ // Register the cron job
109
+ 'wp/cron_jobs' => new ArrayExtension([
110
+ 'main/job',
111
+ ]),
112
+ // Register the config entries
113
+ 'config/entries' => new ArrayExtension([
114
+ static::CONFIG_UPDATE_INTERVAL => 'config/interval',
115
+ ]),
116
+ // Override the API cache with the value of the import cron interval option
117
+ 'ig/cache/ttl' => new Extension(['config/interval'], function ($ttl, ConfigEntry $interval) {
118
+ return $interval->getValue();
119
+ }),
120
+ ];
121
+ }
122
+ }
plugin.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "name": "Spotlight - Social Media Feeds",
3
  "description": "Easily embed beautiful Instagram feeds on your WordPress site.",
4
- "version": "0.8.2",
5
  "url": "https://spotlightwp.com",
6
  "author": "RebelCode",
7
  "authorUrl": "https://rebelcode.com",
1
  {
2
  "name": "Spotlight - Social Media Feeds",
3
  "description": "Easily embed beautiful Instagram feeds on your WordPress site.",
4
+ "version": "0.9",
5
  "url": "https://spotlightwp.com",
6
  "author": "RebelCode",
7
  "authorUrl": "https://rebelcode.com",
plugin.php CHANGED
@@ -5,7 +5,7 @@
5
  *
6
  * Plugin Name: Spotlight - Social Media Feeds
7
  * Description: Easily embed beautiful Instagram feeds on your WordPress site.
8
- * Version: 0.8.2
9
  * Author: RebelCode
10
  * Plugin URI: https://spotlightwp.com
11
  * Author URI: https://rebelcode.com
@@ -80,7 +80,7 @@ $bootstrapper = function (SlInstaRuntime $sli) use ($thisIsPro) {
80
  // The plugin name
81
  define('SL_INSTA_NAME', 'Spotlight - Social Media Feeds');
82
  // The plugin version
83
- define('SL_INSTA_VERSION', '0.8.2');
84
  // The path to the plugin's main file
85
  define('SL_INSTA_FILE', __FILE__);
86
  // The dir to the plugin's directory
@@ -130,25 +130,6 @@ $bootstrapper = function (SlInstaRuntime $sli) use ($thisIsPro) {
130
  // Init Freemius
131
  sliFreemius()->set_basename($thisIsPro, __FILE__);
132
 
133
- // If a PRO version is running, block updates for the free version unless they match the running version
134
- add_filter('site_transient_update_plugins', function ($value) use ($sli) {
135
- if ($sli->isProActive && !empty($value) && !empty($value->response)) {
136
- $value->response = array_filter($value->response ?? [], function ($response) use ($sli) {
137
- $newVer = $response->new_version ?? '0.0';
138
-
139
- if ($response->plugin ?? false) {
140
- $info = slInstaPluginInfo($response->plugin);
141
- } else {
142
- $info = null;
143
- }
144
-
145
- return $info === null || $info->isPro || version_compare($newVer, $sli->proVersion, '<=');
146
- });
147
- }
148
-
149
- return $value;
150
- });
151
-
152
  // Load the PRO script, if it exists
153
  if (file_exists(__DIR__ . '/includes/pro.php')) {
154
  require_once __DIR__ . '/includes/pro.php';
5
  *
6
  * Plugin Name: Spotlight - Social Media Feeds
7
  * Description: Easily embed beautiful Instagram feeds on your WordPress site.
8
+ * Version: 0.9
9
  * Author: RebelCode
10
  * Plugin URI: https://spotlightwp.com
11
  * Author URI: https://rebelcode.com
80
  // The plugin name
81
  define('SL_INSTA_NAME', 'Spotlight - Social Media Feeds');
82
  // The plugin version
83
+ define('SL_INSTA_VERSION', '0.9');
84
  // The path to the plugin's main file
85
  define('SL_INSTA_FILE', __FILE__);
86
  // The dir to the plugin's directory
130
  // Init Freemius
131
  sliFreemius()->set_basename($thisIsPro, __FILE__);
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  // Load the PRO script, if it exists
134
  if (file_exists(__DIR__ . '/includes/pro.php')) {
135
  require_once __DIR__ . '/includes/pro.php';
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: Instagram, Instagram feed, Instagram feeds, Instagram widget, Instagram em
6
  Requires at least: 5.0
7
  Requires PHP: 7.1
8
  Tested up to: 5.7
9
- Stable tag: 0.8.2
10
  License: GPLv3
11
 
12
  Instagram feeds for your WordPress site. A simple no-code solution to embed your Instagram account anywhere on your website in seconds.
@@ -270,6 +270,27 @@ There are a few reasons that this may happen. We have documented the reasons and
270
 
271
  == Changelog ==
272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  = 0.8.2 (2021-06-30) =
274
 
275
  **Changed**
6
  Requires at least: 5.0
7
  Requires PHP: 7.1
8
  Tested up to: 5.7
9
+ Stable tag: 0.9
10
  License: GPLv3
11
 
12
  Instagram feeds for your WordPress site. A simple no-code solution to embed your Instagram account anywhere on your website in seconds.
270
 
271
  == Changelog ==
272
 
273
+ = 0.9 (2021-07-20) =
274
+
275
+ **Added**
276
+ - Accessibility and SEO attributes to buttons and links in the feed
277
+
278
+ **Changed**
279
+ - Replaced the built-in import engine with an upgraded version
280
+ - Posts that have not changed on Instagram will not be updated unnecessarily
281
+ - Large numbers of Instagram posts are now imported in batches
282
+ - Minor database query optimizations
283
+
284
+ **Fixed**
285
+ - Timeout errors when importing large numbers of Instagram posts
286
+ - Timeout errors when clearing the cache for large numbers of Instagram posts
287
+ - A PHP notice about an undefined 'shortcode' index
288
+ - A conflict with pages that have the word "spotlight" in their permalink
289
+ - Expired images in the popup now fallback to a local image
290
+ - A styling incompatibility with LearnDash Advanced Quizzes
291
+ - Vertical center alignment for album images and videos
292
+ - The feeds shows the wrong number of posts when tablets and phones show more than on desktop
293
+
294
  = 0.8.2 (2021-06-30) =
295
 
296
  **Changed**
ui/dist/admin-app.js CHANGED
@@ -1,2 +1,2 @@
1
  /*! For license information please see admin-app.js.LICENSE.txt */
2
- var Spotlight=(window.webpackJsonpSpotlight=window.webpackJsonpSpotlight||[]).push([[7],{0:function(e,t){e.exports=React},1019:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectIsAdminEditingNewFeed=t.selectIsAdminAppLoading=t.selectIsAdminAppLoaded=void 0,t.selectIsAdminAppLoaded=e=>e.app.isLoaded,t.selectIsAdminAppLoading=e=>e.app.isLoading,t.selectIsAdminEditingNewFeed=e=>e.app.isEditingNewFeed},104:function(e,t,r){"use strict";const n=r(105),o=r(106),i=r(107);function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function u(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 l(e){const t=(e=s(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(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 f(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const o="string"==typeof r&&r.includes(e.arrayFormatSeparator),i="string"==typeof r&&!o&&u(r,e).includes(e.arrayFormatSeparator);r=i?u(r,e):r;const c=o||i?r.split(e.arrayFormatSeparator).map(t=>u(t,e)):null===r?r:u(r,e);n[t]=c};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const o of e.split("&")){let[e,c]=i(t.decode?o.replace(/\+/g," "):o,"=");c=void 0===c?null:["comma","separator"].includes(t.arrayFormat)?c:u(c,t),r(u(e,t),c,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?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}(r):e[t]=r,e},Object.create(null))}t.extract=l,t.parse=f,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const o=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[a(t,e),"[",o,"]"].join("")]:[...r,[a(t,e),"[",a(o,e),"]=",a(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[a(t,e),"[]"].join("")]:[...r,[a(t,e),"[]=",a(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[a(t,e),"=",a(n,e)].join("")]:[[r,a(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,a(t,e)]:[...r,[a(t,e),"=",a(n,e)].join("")]}}(t),o={};for(const t of Object.keys(e))r(t)||(o[t]=e[t]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map(r=>{const o=e[r];return void 0===o?"":null===o?a(r,t):Array.isArray(o)?o.reduce(n(r),[]).join("&"):a(r,t)+"="+a(o,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=i(e,"#");return Object.assign({url:r.split("?")[0]||"",query:f(l(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:u(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=s(e.url).split("?")[0]||"",o=t.extract(e.url),i=t.parse(o,{sort:!1}),c=Object.assign(i,e.query);let u=t.stringify(c,r);u&&(u="?"+u);let l=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(l="#"+a(e.fragmentIdentifier,r)),`${n}${u}${l}`}},105:function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},106:function(e,t,r){"use strict";var n=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 r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],i(r),i(n))}function c(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=i(t,r).join("")).match(n);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":"��"},r=o.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=c(r[0]);n!==r[0]&&(t[r[0]]=n)}r=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),a=0;a<i.length;a++){var u=i[a];e=e.replace(new RegExp(u,"g"),t[u])}return e}(e)}}},107:function(e,t,r){"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 r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},109:function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,o=r(110)("Object.prototype.toString"),i=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===o(e)},c=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==o(e)&&"[object Function]"===o(e.callee)},a=function(){return i(arguments)}();i.isLegacyArguments=c,e.exports=a?i:c},110:function(e,t,r){"use strict";var n=r(94),o=r(64),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},111:function(e,t,r){"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"),r=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(r))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 n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[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}},112:function(e,t,r){"use strict";var n="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(n+t);for(var r,c=o.call(arguments,1),a=function(){if(this instanceof r){var n=t.apply(this,c.concat(o.call(arguments)));return Object(n)===n?n:this}return t.apply(e,c.concat(o.call(arguments)))},u=Math.max(0,t.length-c.length),s=[],l=0;l<u;l++)s.push("$"+l);if(r=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(a),t.prototype){var p=function(){};p.prototype=t.prototype,r.prototype=new p,p.prototype=null}return r}},113:function(e,t,r){"use strict";var n=r(18),o=r(64),i=r(65),c=r(66),a=r(114),u=o(c(),Object);n(u,{getPolyfill:c,implementation:i,shim:a}),e.exports=u},114:function(e,t,r){"use strict";var n=r(66),o=r(18);e.exports=function(){var e=n();return o(Object,{is:e},{is:function(){return Object.is!==e}}),e}},115:function(e,t,r){"use strict";var n,o,i,c,a=r(85)()&&"symbol"==typeof Symbol.toStringTag;if(a){n=Function.call.bind(Object.prototype.hasOwnProperty),o=Function.call.bind(RegExp.prototype.exec),i={};var u=function(){throw i};c={toString:u,valueOf:u},"symbol"==typeof Symbol.toPrimitive&&(c[Symbol.toPrimitive]=u)}var s=Object.prototype.toString,l=Object.getOwnPropertyDescriptor;e.exports=a?function(e){if(!e||"object"!=typeof e)return!1;var t=l(e,"lastIndex");if(!t||!n(t,"value"))return!1;try{o(e,c)}catch(e){return e===i}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===s.call(e)}},116:function(e,t,r){"use strict";var n=r(18),o=r(177),i=r(67),c=r(68),a=r(117),u=o(i);n(u,{getPolyfill:c,implementation:i,shim:a}),e.exports=u},117:function(e,t,r){"use strict";var n=r(18).supportsDescriptors,o=r(68),i=Object.getOwnPropertyDescriptor,c=Object.defineProperty,a=TypeError,u=Object.getPrototypeOf,s=/a/;e.exports=function(){if(!n||!u)throw new a("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=o(),t=u(s),r=i(t,"flags");return r&&r.get===e||c(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}},118:function(e,t,r){"use strict";var n=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 n.call(e),!0}catch(e){return!1}}(e):"[object Date]"===o.call(e))}},119:function(e,t,r){"use strict";t.__esModule=!0;var n=r(0),o=(c(n),c(r(27))),i=c(r(120));function c(e){return e&&e.__esModule?e:{default:e}}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 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 l(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(r,n){e=r,t.forEach((function(t){return t(e,n)}))}}}c(r(90)),t.default=function(e,t){var r,c,p="__create-react-context-"+(0,i.default)()+"__",f=function(e){function r(){var t,n;a(this,r);for(var o=arguments.length,i=Array(o),c=0;c<o;c++)i[c]=arguments[c];return t=n=u(this,e.call.apply(e,[this].concat(i))),n.emitter=l(n.props.value),u(n,t)}return s(r,e),r.prototype.getChildContext=function(){var e;return(e={})[p]=this.emitter,e},r.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var r=this.props.value,n=e.value,o=void 0;((i=r)===(c=n)?0!==i||1/i==1/c:i!=i&&c!=c)?o=0:(o="function"==typeof t?t(r,n):1073741823,0!=(o|=0)&&this.emitter.set(e.value,o))}var i,c},r.prototype.render=function(){return this.props.children},r}(n.Component);f.childContextTypes=((r={})[p]=o.default.object.isRequired,r);var d=function(t){function r(){var e,n;a(this,r);for(var o=arguments.length,i=Array(o),c=0;c<o;c++)i[c]=arguments[c];return e=n=u(this,t.call.apply(t,[this].concat(i))),n.state={value:n.getValue()},n.onUpdate=function(e,t){0!=((0|n.observedBits)&t)&&n.setState({value:n.getValue()})},u(n,e)}return s(r,t),r.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?1073741823:t},r.prototype.componentDidMount=function(){this.context[p]&&this.context[p].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?1073741823:e},r.prototype.componentWillUnmount=function(){this.context[p]&&this.context[p].off(this.onUpdate)},r.prototype.getValue=function(){return this.context[p]?this.context[p].get():e},r.prototype.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},r}(n.Component);return d.contextTypes=((c={})[p]=o.default.object,c),{Provider:f,Consumer:d}},e.exports=t.default},120:function(e,t,r){"use strict";(function(t){var r="__global_unique_id__";e.exports=function(){return t[r]=(t[r]||0)+1}}).call(this,r(16))},129:function(e,t,r){"use strict";(function(e,n){var o,i=r(48);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var c=Object(i.a)(o);t.a=c}).call(this,r(16),r(83)(e))},130:function(e,t,r){"use strict";function n(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var o=n();o.withExtraArgument=n,t.a=o},150:function(e,t,r){"use strict";t.__esModule=!0;var n=i(r(0)),o=i(r(119));function i(e){return e&&e.__esModule?e:{default:e}}t.default=n.default.createContext||o.default,e.exports=t.default},16:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},164:function(e,t,r){"use strict";function n(e){return"/"===e.charAt(0)}function o(e,t){for(var r=t,n=r+1,o=e.length;n<o;r+=1,n+=1)e[r]=e[n];e.pop()}t.a=function(e,t){void 0===t&&(t="");var r,i=e&&e.split("/")||[],c=t&&t.split("/")||[],a=e&&n(e),u=t&&n(t),s=a||u;if(e&&n(e)?c=i:i.length&&(c.pop(),c=c.concat(i)),!c.length)return"/";if(c.length){var l=c[c.length-1];r="."===l||".."===l||""===l}else r=!1;for(var p=0,f=c.length;f>=0;f--){var d=c[f];"."===d?o(c,f):".."===d?(o(c,f),p++):p&&(o(c,f),p--)}if(!s)for(;p--;p)c.unshift("..");!s||""===c[0]||c[0]&&n(c[0])||c.unshift("");var y=c.join("/");return r&&"/"!==y.substr(-1)&&(y+="/"),y}},165:function(e,t,r){"use strict";function n(e){return e.valueOf?e.valueOf():Object.prototype.valueOf.call(e)}t.a=function e(t,r){if(t===r)return!0;if(null==t||null==r)return!1;if(Array.isArray(t))return Array.isArray(r)&&t.length===r.length&&t.every((function(t,n){return e(t,r[n])}));if("object"==typeof t||"object"==typeof r){var o=n(t),i=n(r);return o!==t||i!==r?e(o,i):Object.keys(Object.assign({},t,r)).every((function(n){return e(t[n],r[n])}))}return!1}},166:function(e,t,r){var n=r(93),o=r(109),i=r(113),c=r(115),a=r(116),u=r(118),s=Date.prototype.getTime;function l(e){return null==e}function p(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,r,f){var d=f||{};return!!(d.strict?i(t,r):t===r)||(!t||!r||"object"!=typeof t&&"object"!=typeof r?d.strict?i(t,r):t==r:function(t,r,i){var f,d;if(typeof t!=typeof r)return!1;if(l(t)||l(r))return!1;if(t.prototype!==r.prototype)return!1;if(o(t)!==o(r))return!1;var y=c(t),g=c(r);if(y!==g)return!1;if(y||g)return t.source===r.source&&a(t)===a(r);if(u(t)&&u(r))return s.call(t)===s.call(r);var h=p(t),m=p(r);if(h!==m)return!1;if(h||m){if(t.length!==r.length)return!1;for(f=0;f<t.length;f++)if(t[f]!==r[f])return!1;return!0}if(typeof t!=typeof r)return!1;try{var v=n(t),b=n(r)}catch(e){return!1}if(v.length!==b.length)return!1;for(v.sort(),b.sort(),f=v.length-1;f>=0;f--)if(v[f]!=b[f])return!1;for(f=v.length-1;f>=0;f--)if(!e(t[d=v[f]],r[d],i))return!1;return!0}(t,r,d))}},167:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var c=o.apply(null,n);c&&e.push(c)}else if("object"===i)for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},176:function(e,t,r){"use strict";var n=r(44);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},18:function(e,t,r){"use strict";var n=r(93),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,c=Array.prototype.concat,a=Object.defineProperty,u=a&&function(){var e={};try{for(var t in a(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),s=function(e,t,r,n){var o;(!(t in e)||"function"==typeof(o=n)&&"[object Function]"===i.call(o)&&n())&&(u?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},l=function(e,t){var r=arguments.length>2?arguments[2]:{},i=n(t);o&&(i=c.call(i,Object.getOwnPropertySymbols(t)));for(var a=0;a<i.length;a+=1)s(e,i[a],t[i[a]],r[i[a]])};l.supportsDescriptors=!!u,e.exports=l},19:function(e,t){e.exports=ReactDOM},210:function(e,t,r){"use strict";(function(e){var n=r(0),o=r.n(n),i=r(38),c=r(27),a=r.n(c),u="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(r,n){e=r,t.forEach((function(t){return t(e,n)}))}}}var l=o.a.createContext||function(e,t){var r,o,c="__create-react-context-"+(u["__global_unique_id__"]=(u.__global_unique_id__||0)+1)+"__",l=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).emitter=s(t.props.value),t}Object(i.a)(r,e);var n=r.prototype;return n.getChildContext=function(){var e;return(e={})[c]=this.emitter,e},n.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var r,n=this.props.value,o=e.value;((i=n)===(c=o)?0!==i||1/i==1/c:i!=i&&c!=c)?r=0:(r="function"==typeof t?t(n,o):1073741823,0!=(r|=0)&&this.emitter.set(e.value,r))}var i,c},n.render=function(){return this.props.children},r}(n.Component);l.childContextTypes=((r={})[c]=a.a.object.isRequired,r);var p=function(t){function r(){var e;return(e=t.apply(this,arguments)||this).state={value:e.getValue()},e.onUpdate=function(t,r){0!=((0|e.observedBits)&r)&&e.setState({value:e.getValue()})},e}Object(i.a)(r,t);var n=r.prototype;return n.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?1073741823:t},n.componentDidMount=function(){this.context[c]&&this.context[c].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?1073741823:e},n.componentWillUnmount=function(){this.context[c]&&this.context[c].off(this.onUpdate)},n.getValue=function(){return this.context[c]?this.context[c].get():e},n.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},r}(n.Component);return p.contextTypes=((o={})[c]=a.a.object,o),{Provider:l,Consumer:p}};t.a=l}).call(this,r(16))},211:function(e,t,r){var n=r(274);e.exports=function e(t,r,o){return n(r)||(o=r||o,r=[]),o=o||{},t instanceof RegExp?function(e,t){var r=e.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return l(e,t)}(t,r):n(t)?function(t,r,n){for(var o=[],i=0;i<t.length;i++)o.push(e(t[i],r,n).source);return l(new RegExp("(?:"+o.join("|")+")",p(n)),r)}(t,r,o):function(e,t,r){return f(i(e,r),t,r)}(t,r,o)},e.exports.parse=i,e.exports.compile=function(e,t){return a(i(e,t),t)},e.exports.tokensToFunction=a,e.exports.tokensToRegExp=f;var o=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function i(e,t){for(var r,n=[],i=0,c=0,a="",l=t&&t.delimiter||"/";null!=(r=o.exec(e));){var p=r[0],f=r[1],d=r.index;if(a+=e.slice(c,d),c=d+p.length,f)a+=f[1];else{var y=e[c],g=r[2],h=r[3],m=r[4],v=r[5],b=r[6],w=r[7];a&&(n.push(a),a="");var x=null!=g&&null!=y&&y!==g,S="+"===b||"*"===b,j="?"===b||"*"===b,O=r[2]||l,A=m||v;n.push({name:h||i++,prefix:g||"",delimiter:O,optional:j,repeat:S,partial:x,asterisk:!!w,pattern:A?s(A):w?".*":"[^"+u(O)+"]+?"})}}return c<e.length&&(a+=e.substr(c)),a&&n.push(a),n}function c(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function a(e,t){for(var r=new Array(e.length),o=0;o<e.length;o++)"object"==typeof e[o]&&(r[o]=new RegExp("^(?:"+e[o].pattern+")$",p(t)));return function(t,o){for(var i="",a=t||{},u=(o||{}).pretty?c:encodeURIComponent,s=0;s<e.length;s++){var l=e[s];if("string"!=typeof l){var p,f=a[l.name];if(null==f){if(l.optional){l.partial&&(i+=l.prefix);continue}throw new TypeError('Expected "'+l.name+'" to be defined')}if(n(f)){if(!l.repeat)throw new TypeError('Expected "'+l.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(l.optional)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var d=0;d<f.length;d++){if(p=u(f[d]),!r[s].test(p))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'", but received `'+JSON.stringify(p)+"`");i+=(0===d?l.prefix:l.delimiter)+p}}else{if(p=l.asterisk?encodeURI(f).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):u(f),!r[s].test(p))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but received "'+p+'"');i+=l.prefix+p}}else i+=l}return i}}function u(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function s(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function l(e,t){return e.keys=t,e}function p(e){return e&&e.sensitive?"":"i"}function f(e,t,r){n(t)||(r=t||r,t=[]);for(var o=(r=r||{}).strict,i=!1!==r.end,c="",a=0;a<e.length;a++){var s=e[a];if("string"==typeof s)c+=u(s);else{var f=u(s.prefix),d="(?:"+s.pattern+")";t.push(s),s.repeat&&(d+="(?:"+f+d+")*"),c+=d=s.optional?s.partial?f+"("+d+")?":"(?:"+f+"("+d+"))?":f+"("+d+")"}}var y=u(r.delimiter||"/"),g=c.slice(-y.length)===y;return o||(c=(g?c.slice(0,-y.length):c)+"(?:"+y+"(?=$))?"),c+=i?"$":o&&g?"":"(?="+y+"|$)",l(new RegExp("^"+c,p(r)),t)}},27:function(e,t,r){e.exports=r(81)()},273:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useFeedTemplate=t.setIsEditingNewFeed=t.AdminAppSlice=void 0;const n=r(15),o=r(403);t.AdminAppSlice=n.createSlice({name:"app",initialState:{isLoaded:!1,isLoading:!1,isEditingNewFeed:!1,isDoingOnboarding:!1,newFeedTemplate:null},reducers:{setIsDoingOnBoarding(e,t){e.isDoingOnboarding=t.payload},setIsEditingNewFeed(e,t){e.isEditingNewFeed=t.payload},useFeedTemplate(e,t){e.newFeedTemplate=t.payload}},extraReducers:e=>e.addCase(o.loadAdminApp.pending,e=>{e.isLoading=!0}).addCase(o.loadAdminApp.fulfilled,e=>{e.isLoading=!1,e.isLoaded=!0})}),t.setIsEditingNewFeed=t.AdminAppSlice.actions.setIsEditingNewFeed,t.useFeedTemplate=t.AdminAppSlice.actions.useFeedTemplate},274:function(e,t){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return R})),r.d(t,"b",(function(){return M})),r.d(t,"c",(function(){return $})),r.d(t,"d",(function(){return D})),r.d(t,"e",(function(){return l})),r.d(t,"f",(function(){return L})),r.d(t,"g",(function(){return z})),r.d(t,"h",(function(){return _})),r.d(t,"i",(function(){return k})),r.d(t,"j",(function(){return S})),r.d(t,"k",(function(){return G})),r.d(t,"l",(function(){return J})),r.d(t,"m",(function(){return V})),r.d(t,"n",(function(){return H})),r.d(t,"o",(function(){return F}));var n="-ms-",o="-moz-",i="-webkit-",c="comm",a="rule",u="decl",s=Math.abs,l=String.fromCharCode;function p(e){return e.trim()}function f(e,t,r){return e.replace(t,r)}function d(e,t){return e.indexOf(t)}function y(e,t){return 0|e.charCodeAt(t)}function g(e,t,r){return e.slice(t,r)}function h(e){return e.length}function m(e){return e.length}function v(e,t){return t.push(e),e}var b=1,w=1,x=0,S=0,j=0,O="";function A(e,t,r,n,o,i,c){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:b,column:w,length:c,return:""}}function E(e,t,r){return A(e,t.root,t.parent,r,t.props,t.children,0)}function P(){return j=S>0?y(O,--S):0,w--,10===j&&(w=1,b--),j}function _(){return j=S<x?y(O,S++):0,w++,10===j&&(w=1,b++),j}function k(){return y(O,S)}function C(){return S}function T(e,t){return g(O,e,t)}function F(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function R(e){return b=w=1,x=h(O=e),S=0,[]}function $(e){return O="",e}function D(e){return p(T(S-1,function e(t){for(;_();)switch(j){case t:return S;case 34:case 39:return e(34===t||39===t?t:j);case 40:41===t&&e(t);break;case 92:_()}return S}(91===e?e+2:40===e?e+1:e)))}function N(e){for(;(j=k())&&j<33;)_();return F(e)>2||F(j)>3?"":" "}function I(e,t){for(;--t&&_()&&!(j<48||j>102||j>57&&j<65||j>70&&j<97););return T(e,C()+(t<6&&32==k()&&32==_()))}function U(e,t){for(;_()&&e+j!==57&&(e+j!==84||47!==k()););return"/*"+T(t,S-1)+"*"+l(47===e?e:_())}function L(e){for(;!F(k());)_();return T(e,S)}function M(e){return $(function e(t,r,n,o,i,c,a,u,s){for(var p=0,d=0,y=a,g=0,m=0,b=0,w=1,x=1,S=1,j=0,O="",A=i,E=c,T=o,F=O;x;)switch(b=j,j=_()){case 34:case 39:case 91:case 40:F+=D(j);break;case 9:case 10:case 13:case 32:F+=N(b);break;case 92:F+=I(C()-1,7);continue;case 47:switch(k()){case 42:case 47:v(q(U(_(),C()),r,n),s);break;default:F+="/"}break;case 123*w:u[p++]=h(F)*S;case 125*w:case 59:case 0:switch(j){case 0:case 125:x=0;case 59+d:m>0&&h(F)-y&&v(m>32?W(F+";",o,n,y-1):W(f(F," ","")+";",o,n,y-2),s);break;case 59:F+=";";default:if(v(T=B(F,r,n,p,d,i,u,O,A=[],E=[],y),c),123===j)if(0===d)e(F,r,T,T,A,c,y,u,E);else switch(g){case 100:case 109:case 115:e(t,T,T,o&&v(B(t,T,T,0,0,i,u,O,i,A=[],y),E),i,E,y,u,o?A:E);break;default:e(F,T,T,T,[""],E,y,u,E)}}p=d=m=0,w=S=1,O=F="",y=a;break;case 58:y=1+h(F),m=b;default:if(w<1)if(123==j)--w;else if(125==j&&0==w++&&125==P())continue;switch(F+=l(j),j*w){case 38:S=d>0?1:(F+="\f",-1);break;case 44:u[p++]=(h(F)-1)*S,S=1;break;case 64:45===k()&&(F+=D(_())),g=k(),d=h(O=F+=L(C())),j++;break;case 45:45===b&&2==h(F)&&(w=0)}}return c}("",null,null,null,[""],e=R(e),0,[0],e))}function B(e,t,r,n,o,i,c,u,l,d,y){for(var h=o-1,v=0===o?i:[""],b=m(v),w=0,x=0,S=0;w<n;++w)for(var j=0,O=g(e,h+1,h=s(x=c[w])),E=e;j<b;++j)(E=p(x>0?v[j]+" "+O:f(O,/&\f/g,v[j])))&&(l[S++]=E);return A(e,t,r,0===o?a:u,l,d,y)}function q(e,t,r){return A(e,t,r,c,l(j),g(e,2,-2),0)}function W(e,t,r,n){return A(e,t,r,u,g(e,0,n),g(e,n+1,-1),n)}function V(e,t){for(var r="",n=m(e),o=0;o<n;o++)r+=t(e[o],o,e,t)||"";return r}function H(e,t,r,n){switch(e.type){case"@import":case u:return e.return=e.return||e.value;case c:return"";case a:e.value=e.props.join(",")}return h(r=V(e.children,n))?e.return=e.value+"{"+r+"}":""}function z(e){var t=m(e);return function(r,n,o,i){for(var c="",a=0;a<t;a++)c+=e[a](r,n,o,i)||"";return c}}function J(e){return function(t){t.root||(t=t.return)&&e(t)}}function G(e,t,r,c){if(!e.return)switch(e.type){case u:e.return=function e(t,r){switch(function(e,t){return(((t<<2^y(e,0))<<2^y(e,1))<<2^y(e,2))<<2^y(e,3)}(t,r)){case 5103:return i+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return i+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return i+t+o+t+n+t+t;case 6828:case 4268:return i+t+n+t+t;case 6165:return i+t+n+"flex-"+t+t;case 5187:return i+t+f(t,/(\w+).+(:[^]+)/,i+"box-$1$2"+n+"flex-$1$2")+t;case 5443:return i+t+n+"flex-item-"+f(t,/flex-|-self/,"")+t;case 4675:return i+t+n+"flex-line-pack"+f(t,/align-content|flex-|-self/,"")+t;case 5548:return i+t+n+f(t,"shrink","negative")+t;case 5292:return i+t+n+f(t,"basis","preferred-size")+t;case 6060:return i+"box-"+f(t,"-grow","")+i+t+n+f(t,"grow","positive")+t;case 4554:return i+f(t,/([^-])(transform)/g,"$1"+i+"$2")+t;case 6187:return f(f(f(t,/(zoom-|grab)/,i+"$1"),/(image-set)/,i+"$1"),t,"")+t;case 5495:case 3959:return f(t,/(image-set\([^]*)/,i+"$1$`$1");case 4968:return f(f(t,/(.+:)(flex-)?(.*)/,i+"box-pack:$3"+n+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+i+t+t;case 4095:case 3583:case 4068:case 2532:return f(t,/(.+)-inline(.+)/,i+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(h(t)-1-r>6)switch(y(t,r+1)){case 109:if(45!==y(t,r+4))break;case 102:return f(t,/(.+:)(.+)-([^]+)/,"$1"+i+"$2-$3$1"+o+(108==y(t,r+3)?"$3":"$2-$3"))+t;case 115:return~d(t,"stretch")?e(f(t,"stretch","fill-available"),r)+t:t}break;case 4949:if(115!==y(t,r+1))break;case 6444:switch(y(t,h(t)-3-(~d(t,"!important")&&10))){case 107:return f(t,":",":"+i)+t;case 101:return f(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+i+(45===y(t,14)?"inline-":"")+"box$3$1"+i+"$2$3$1"+n+"$2box$3")+t}break;case 5936:switch(y(t,r+11)){case 114:return i+t+n+f(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return i+t+n+f(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return i+t+n+f(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return i+t+n+t+t}return t}(e.value,e.length);break;case"@keyframes":return V([E(f(e.value,"@","@"+i),e,"")],c);case a:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return V([E(f(t,/:(read-\w+)/,":-moz-$1"),e,"")],c);case"::placeholder":return V([E(f(t,/:(plac\w+)/,":"+i+"input-$1"),e,""),E(f(t,/:(plac\w+)/,":-moz-$1"),e,""),E(f(t,/:(plac\w+)/,n+"input-$1"),e,"")],c)}return""}))}}},289:function(e,t,r){"use strict";e.exports=r(426)},30:function(e,t,r){"use strict";t.a=function(e,t){if(!e)throw new Error("Invariant failed")}},403:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function c(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.loadAdminApp=void 0;const o=r(15),i=r(136),c=r(404),a=r(126),u=r(92),s=r(139),l=r(204);function p(){return n(this,void 0,void 0,(function*(){return yield new Promise(e=>setTimeout(e,800))}))}t.loadAdminApp=o.createAsyncThunk("admin-app/load",(e,t)=>n(void 0,void 0,void 0,(function*(){try{yield Promise.all([t.dispatch(u.loadAccounts()),t.dispatch(a.loadSettings()),t.dispatch(i.loadFeeds()),t.dispatch(l.loadTemplates()),t.dispatch(c.fetchNews()),p()])}catch(e){s.triggerError({type:"load/error",message:e.toString()})}})))},409:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdminAppStore=void 0;const n=r(15),o=r(26),i=r(273),c=r(140),a=r(75),u=r(410),s=r(47),l=r(52),p=r(205),f=r(276);t.AdminAppStore=n.configureStore({reducer:{[i.AdminAppSlice.name]:i.AdminAppSlice.reducer,[l.RouterSlice.name]:l.RouterSlice.reducer,[p.AccountsSlice.name]:p.AccountsSlice.reducer,[c.FeedsSlice.name]:c.FeedsSlice.reducer,[f.TemplatesSlice.name]:f.TemplatesSlice.reducer,[s.SettingsSlice.name]:s.SettingsSlice.reducer,[o.FeedEditorSlice.name]:o.FeedEditorSlice.reducer,[a.ToastsSlice.name]:a.ToastsSlice.reducer,[u.NewsSlice.name]:u.NewsSlice.reducer}})},425:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),r(289),r(427),r(428),r(429);const o=n(r(0)),i=n(r(19)),c=r(101),a=n(r(42)),u=r(460),s=r(84),l=r(503),p=r(961),f=r(405),d=r(406),y=r(407),g=r(409),h=r(403),m=r(75),v=r(386),b=r(25),w=r(217),x=r(52),S=r(63),j=r(1002),O=r(139);O.addErrorHandler(e=>{var t;const r=null!==(t=e.type)&&void 0!==t?t:"generic";g.AdminAppStore.dispatch(m.showToast({key:"admin/"+r,message:e.message,details:e.details,type:m.ToastType.ERROR}))}),s.Screens.register({id:"feeds",title:"Feeds",position:0,component:u.FeedsScreen}),s.Screens.register({id:"new",title:"Add New",isHidden:!0,component:l.NewFeedScreen}),s.Screens.register({id:"edit",title:"Edit",isHidden:!0,component:p.EditFeedScreen}),s.Screens.register({id:"promotions",title:"Promotions",position:40,component:f.Decorate(d.PromotionsScreen,{isFakePro:!0})}),s.Screens.register({id:"settings",title:"Settings",position:50,component:y.SettingsScreen}),g.AdminAppStore.dispatch(h.loadAdminApp()),document.addEventListener(v.SETTINGS_SAVE_SUCCESS,()=>{g.AdminAppStore.dispatch(m.showToast({key:"admin/settings/saved",message:"Settings saved."}))}),document.addEventListener(v.SETTINGS_SAVE_FAILED,e=>{O.triggerError({type:"settings/save/error",message:e.detail.error})});const A=document.getElementById("toplevel_page_spotlight-instagram");if(A){const e=A.querySelector("ul.wp-submenu").querySelectorAll("li:not(.wp-submenu-head)"),t=Array.from(e),r=g.AdminAppStore.getState();s.Screens.getList().forEach((e,n)=>{const o=e.state||{},i=b.withPartial({screen:e.id},o),c=w.getRouteAbsUrl(r.router,i),a=t.find(e=>e.querySelector("a").href===c);a&&(a.setAttribute("data-screen",e.id),a.querySelector("a").addEventListener("click",t=>{g.AdminAppStore.dispatch(x.gotoScreen(e.id)),t.preventDefault(),t.stopPropagation()}))}),g.AdminAppStore.subscribe(()=>{const e=g.AdminAppStore.getState(),r=S.selectScreen(e);t.forEach(e=>e.classList.remove("current"));const n=t.find(e=>e.getAttribute("data-screen")===r);n&&n.classList.add("current")})}const E=document.getElementById(a.default.config.rootId);E&&(E.classList.add("wp-core-ui-override"),c.runWhenDomReady(()=>{i.default.render(o.default.createElement(j.AdminRoot,{}),E)}))},426:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=(n=r(0))&&"object"==typeof n&&"default"in n?n.default:n;function i(e){return i.warnAboutHMRDisabled&&(i.warnAboutHMRDisabled=!0),o.Children.only(e.children)}i.warnAboutHMRDisabled=!1;var c=function e(){return e.shouldWrapWithAppContainer?function(e){return function(t){return o.createElement(i,null,o.createElement(e,t))}}:function(e){return e}};c.shouldWrapWithAppContainer=!1,t.AppContainer=i,t.hot=c,t.areComponentsEqual=function(e,t){return e===t},t.setConfig=function(){},t.cold=function(e){return e},t.configureComponent=function(){}},44:function(e,t,r){"use strict";var n=r(112);e.exports=Function.prototype.bind||n},476:function(e,t,r){"use strict";var n=r(477),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var r,i,c,a,u,s=!1;t||(t={}),t.debug;try{if(i=n(),c=document.createRange(),a=document.getSelection(),(u=document.createElement("span")).textContent=e,u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){window.clipboardData.clearData();var n=o[t.format]||o.default;window.clipboardData.setData(n,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(u),c.selectNodeContents(u),a.addRange(c),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(n){try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(n){r=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(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(c):a.removeAllRanges()),u&&document.body.removeChild(u),i()}return s}},477:function(e,t){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));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||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},48:function(e,t,r){"use strict";function n(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}r.d(t,"a",(function(){return n}))},59:function(e,t,r){"use strict";var n=r(98),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},c={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function u(e){return n.isMemo(e)?c:a[e.$$typeof]||o}a[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[n.Memo]=c;var s=Object.defineProperty,l=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,y=Object.prototype;e.exports=function e(t,r,n){if("string"!=typeof r){if(y){var o=d(r);o&&o!==y&&e(t,o,n)}var c=l(r);p&&(c=c.concat(p(r)));for(var a=u(t),g=u(r),h=0;h<c.length;++h){var m=c[h];if(!(i[m]||n&&n[m]||g&&g[m]||a&&a[m])){var v=f(r,m);try{s(t,m,v)}catch(e){}}}}return t}},64:function(e,t,r){"use strict";var n=r(44),o=r(94),i=o("%Function.prototype.apply%"),c=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||n.call(c,i),u=o("%Object.getOwnPropertyDescriptor%",!0),s=o("%Object.defineProperty%",!0),l=o("%Math.max%");if(s)try{s({},"a",{value:1})}catch(e){s=null}e.exports=function(e){var t=a(n,c,arguments);if(u&&s){var r=u(t,"length");r.configurable&&s(t,"length",{value:l(0,e.length-(arguments.length-1))})}return t};var p=function(){return a(n,i,arguments)};s?s(e.exports,"apply",{value:p}):e.exports.apply=p},65:function(e,t,r){"use strict";var n=function(e){return e!=e};e.exports=function(e,t){return 0===e&&0===t?1/e==1/t:e===t||!(!n(e)||!n(t))}},66:function(e,t,r){"use strict";var n=r(65);e.exports=function(){return"function"==typeof Object.is?Object.is:n}},67:function(e,t,r){"use strict";var n=Object,o=TypeError;e.exports=function(){if(null!=this&&this!==n(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}},68:function(e,t,r){"use strict";var n=r(67),o=r(18).supportsDescriptors,i=Object.getOwnPropertyDescriptor,c=TypeError;e.exports=function(){if(!o)throw new c("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 n}},78: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}},81:function(e,t,r){"use strict";var n=r(82);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,i,c){if(c!==n){var a=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 a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={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 r.PropTypes=r,r}},82:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},83:function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},85:function(e,t,r){"use strict";(function(t){var n=t.Symbol,o=r(111);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}}).call(this,r(16))},90:function(e,t,r){"use strict";e.exports=function(){}},91:function(e,t,r){"use strict";function n(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}t.a=function(e,t){var r;void 0===t&&(t=n);var o,i=[],c=!1;return function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return c&&r===this&&t(n,i)||(o=e.apply(this,n),c=!0,r=this,i=n),o}}},99:function(e,t,r){"use strict";function n(e,t){return e===t}function o(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;o<n;o++)if(!e(t[o],r[o]))return!1;return!0}function i(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}r.d(t,"a",(function(){return c}));var c=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var c=0,a=n.pop(),u=i(n),s=e.apply(void 0,[function(){return c++,a.apply(null,arguments)}].concat(r)),l=e((function(){for(var e=[],t=u.length,r=0;r<t;r++)e.push(u[r].apply(null,arguments));return s.apply(null,e)}));return l.resultFunc=a,l.dependencies=u,l.recomputations=function(){return c},l.resetRecomputations=function(){return c=0},l}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=null,i=null;return function(){return o(t,r,arguments)||(i=e.apply(null,arguments)),r=arguments,i}}))}},[[425,2,1,0,3,5,4,6]]]);
1
  /*! For license information please see admin-app.js.LICENSE.txt */
2
+ var Spotlight=(window.webpackJsonpSpotlight=window.webpackJsonpSpotlight||[]).push([[7],{0:function(e,t){e.exports=React},1021:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectIsAdminEditingNewFeed=t.selectIsAdminAppLoading=t.selectIsAdminAppLoaded=void 0,t.selectIsAdminAppLoaded=e=>e.app.isLoaded,t.selectIsAdminAppLoading=e=>e.app.isLoading,t.selectIsAdminEditingNewFeed=e=>e.app.isEditingNewFeed},104:function(e,t,r){"use strict";const n=r(105),o=r(106),i=r(107);function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,t){return t.encode?t.strict?n(e):encodeURIComponent(e):e}function u(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 p(e){const t=(e=s(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function l(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 f(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const o="string"==typeof r&&r.includes(e.arrayFormatSeparator),i="string"==typeof r&&!o&&u(r,e).includes(e.arrayFormatSeparator);r=i?u(r,e):r;const c=o||i?r.split(e.arrayFormatSeparator).map(t=>u(t,e)):null===r?r:u(r,e);n[t]=c};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const o of e.split("&")){let[e,c]=i(t.decode?o.replace(/\+/g," "):o,"=");c=void 0===c?null:["comma","separator"].includes(t.arrayFormat)?c:u(c,t),r(u(e,t),c,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=l(r[e],t);else n[e]=l(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((e,t)=>{const r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?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}(r):e[t]=r,e},Object.create(null))}t.extract=p,t.parse=f,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const o=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[a(t,e),"[",o,"]"].join("")]:[...r,[a(t,e),"[",a(o,e),"]=",a(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[a(t,e),"[]"].join("")]:[...r,[a(t,e),"[]=",a(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[a(t,e),"=",a(n,e)].join("")]:[[r,a(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,a(t,e)]:[...r,[a(t,e),"=",a(n,e)].join("")]}}(t),o={};for(const t of Object.keys(e))r(t)||(o[t]=e[t]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map(r=>{const o=e[r];return void 0===o?"":null===o?a(r,t):Array.isArray(o)?o.reduce(n(r),[]).join("&"):a(r,t)+"="+a(o,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=i(e,"#");return Object.assign({url:r.split("?")[0]||"",query:f(p(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:u(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const n=s(e.url).split("?")[0]||"",o=t.extract(e.url),i=t.parse(o,{sort:!1}),c=Object.assign(i,e.query);let u=t.stringify(c,r);u&&(u="?"+u);let p=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(p="#"+a(e.fragmentIdentifier,r)),`${n}${u}${p}`}},105:function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},106:function(e,t,r){"use strict";var n=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 r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],i(r),i(n))}function c(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=i(t,r).join("")).match(n);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":"��"},r=o.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=c(r[0]);n!==r[0]&&(t[r[0]]=n)}r=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),a=0;a<i.length;a++){var u=i[a];e=e.replace(new RegExp(u,"g"),t[u])}return e}(e)}}},107:function(e,t,r){"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 r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},109:function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,o=r(110)("Object.prototype.toString"),i=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===o(e)},c=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==o(e)&&"[object Function]"===o(e.callee)},a=function(){return i(arguments)}();i.isLegacyArguments=c,e.exports=a?i:c},110:function(e,t,r){"use strict";var n=r(94),o=r(64),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},111:function(e,t,r){"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"),r=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(r))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 n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[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}},112:function(e,t,r){"use strict";var n="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(n+t);for(var r,c=o.call(arguments,1),a=function(){if(this instanceof r){var n=t.apply(this,c.concat(o.call(arguments)));return Object(n)===n?n:this}return t.apply(e,c.concat(o.call(arguments)))},u=Math.max(0,t.length-c.length),s=[],p=0;p<u;p++)s.push("$"+p);if(r=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(a),t.prototype){var l=function(){};l.prototype=t.prototype,r.prototype=new l,l.prototype=null}return r}},113:function(e,t,r){"use strict";var n=r(18),o=r(64),i=r(65),c=r(66),a=r(114),u=o(c(),Object);n(u,{getPolyfill:c,implementation:i,shim:a}),e.exports=u},114:function(e,t,r){"use strict";var n=r(66),o=r(18);e.exports=function(){var e=n();return o(Object,{is:e},{is:function(){return Object.is!==e}}),e}},115:function(e,t,r){"use strict";var n,o,i,c,a=r(85)()&&"symbol"==typeof Symbol.toStringTag;if(a){n=Function.call.bind(Object.prototype.hasOwnProperty),o=Function.call.bind(RegExp.prototype.exec),i={};var u=function(){throw i};c={toString:u,valueOf:u},"symbol"==typeof Symbol.toPrimitive&&(c[Symbol.toPrimitive]=u)}var s=Object.prototype.toString,p=Object.getOwnPropertyDescriptor;e.exports=a?function(e){if(!e||"object"!=typeof e)return!1;var t=p(e,"lastIndex");if(!t||!n(t,"value"))return!1;try{o(e,c)}catch(e){return e===i}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===s.call(e)}},116:function(e,t,r){"use strict";var n=r(18),o=r(177),i=r(67),c=r(68),a=r(117),u=o(i);n(u,{getPolyfill:c,implementation:i,shim:a}),e.exports=u},117:function(e,t,r){"use strict";var n=r(18).supportsDescriptors,o=r(68),i=Object.getOwnPropertyDescriptor,c=Object.defineProperty,a=TypeError,u=Object.getPrototypeOf,s=/a/;e.exports=function(){if(!n||!u)throw new a("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=o(),t=u(s),r=i(t,"flags");return r&&r.get===e||c(t,"flags",{configurable:!0,enumerable:!1,get:e}),e}},118:function(e,t,r){"use strict";var n=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 n.call(e),!0}catch(e){return!1}}(e):"[object Date]"===o.call(e))}},119:function(e,t,r){"use strict";t.__esModule=!0;var n=r(0),o=(c(n),c(r(27))),i=c(r(120));function c(e){return e&&e.__esModule?e:{default:e}}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 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 p(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(r,n){e=r,t.forEach((function(t){return t(e,n)}))}}}c(r(90)),t.default=function(e,t){var r,c,l="__create-react-context-"+(0,i.default)()+"__",f=function(e){function r(){var t,n;a(this,r);for(var o=arguments.length,i=Array(o),c=0;c<o;c++)i[c]=arguments[c];return t=n=u(this,e.call.apply(e,[this].concat(i))),n.emitter=p(n.props.value),u(n,t)}return s(r,e),r.prototype.getChildContext=function(){var e;return(e={})[l]=this.emitter,e},r.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var r=this.props.value,n=e.value,o=void 0;((i=r)===(c=n)?0!==i||1/i==1/c:i!=i&&c!=c)?o=0:(o="function"==typeof t?t(r,n):1073741823,0!=(o|=0)&&this.emitter.set(e.value,o))}var i,c},r.prototype.render=function(){return this.props.children},r}(n.Component);f.childContextTypes=((r={})[l]=o.default.object.isRequired,r);var d=function(t){function r(){var e,n;a(this,r);for(var o=arguments.length,i=Array(o),c=0;c<o;c++)i[c]=arguments[c];return e=n=u(this,t.call.apply(t,[this].concat(i))),n.state={value:n.getValue()},n.onUpdate=function(e,t){0!=((0|n.observedBits)&t)&&n.setState({value:n.getValue()})},u(n,e)}return s(r,t),r.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?1073741823:t},r.prototype.componentDidMount=function(){this.context[l]&&this.context[l].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?1073741823:e},r.prototype.componentWillUnmount=function(){this.context[l]&&this.context[l].off(this.onUpdate)},r.prototype.getValue=function(){return this.context[l]?this.context[l].get():e},r.prototype.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},r}(n.Component);return d.contextTypes=((c={})[l]=o.default.object,c),{Provider:f,Consumer:d}},e.exports=t.default},120:function(e,t,r){"use strict";(function(t){var r="__global_unique_id__";e.exports=function(){return t[r]=(t[r]||0)+1}}).call(this,r(16))},129:function(e,t,r){"use strict";(function(e,n){var o,i=r(48);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var c=Object(i.a)(o);t.a=c}).call(this,r(16),r(83)(e))},130:function(e,t,r){"use strict";function n(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(o){return"function"==typeof o?o(r,n,e):t(o)}}}}var o=n();o.withExtraArgument=n,t.a=o},150:function(e,t,r){"use strict";t.__esModule=!0;var n=i(r(0)),o=i(r(119));function i(e){return e&&e.__esModule?e:{default:e}}t.default=n.default.createContext||o.default,e.exports=t.default},16:function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},164:function(e,t,r){"use strict";function n(e){return"/"===e.charAt(0)}function o(e,t){for(var r=t,n=r+1,o=e.length;n<o;r+=1,n+=1)e[r]=e[n];e.pop()}t.a=function(e,t){void 0===t&&(t="");var r,i=e&&e.split("/")||[],c=t&&t.split("/")||[],a=e&&n(e),u=t&&n(t),s=a||u;if(e&&n(e)?c=i:i.length&&(c.pop(),c=c.concat(i)),!c.length)return"/";if(c.length){var p=c[c.length-1];r="."===p||".."===p||""===p}else r=!1;for(var l=0,f=c.length;f>=0;f--){var d=c[f];"."===d?o(c,f):".."===d?(o(c,f),l++):l&&(o(c,f),l--)}if(!s)for(;l--;l)c.unshift("..");!s||""===c[0]||c[0]&&n(c[0])||c.unshift("");var y=c.join("/");return r&&"/"!==y.substr(-1)&&(y+="/"),y}},165:function(e,t,r){"use strict";function n(e){return e.valueOf?e.valueOf():Object.prototype.valueOf.call(e)}t.a=function e(t,r){if(t===r)return!0;if(null==t||null==r)return!1;if(Array.isArray(t))return Array.isArray(r)&&t.length===r.length&&t.every((function(t,n){return e(t,r[n])}));if("object"==typeof t||"object"==typeof r){var o=n(t),i=n(r);return o!==t||i!==r?e(o,i):Object.keys(Object.assign({},t,r)).every((function(n){return e(t[n],r[n])}))}return!1}},166:function(e,t,r){var n=r(93),o=r(109),i=r(113),c=r(115),a=r(116),u=r(118),s=Date.prototype.getTime;function p(e){return null==e}function l(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,r,f){var d=f||{};return!!(d.strict?i(t,r):t===r)||(!t||!r||"object"!=typeof t&&"object"!=typeof r?d.strict?i(t,r):t==r:function(t,r,i){var f,d;if(typeof t!=typeof r)return!1;if(p(t)||p(r))return!1;if(t.prototype!==r.prototype)return!1;if(o(t)!==o(r))return!1;var y=c(t),g=c(r);if(y!==g)return!1;if(y||g)return t.source===r.source&&a(t)===a(r);if(u(t)&&u(r))return s.call(t)===s.call(r);var m=l(t),h=l(r);if(m!==h)return!1;if(m||h){if(t.length!==r.length)return!1;for(f=0;f<t.length;f++)if(t[f]!==r[f])return!1;return!0}if(typeof t!=typeof r)return!1;try{var b=n(t),v=n(r)}catch(e){return!1}if(b.length!==v.length)return!1;for(b.sort(),v.sort(),f=b.length-1;f>=0;f--)if(b[f]!=v[f])return!1;for(f=b.length-1;f>=0;f--)if(!e(t[d=b[f]],r[d],i))return!1;return!0}(t,r,d))}},167:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var c=o.apply(null,n);c&&e.push(c)}else if("object"===i)for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},176:function(e,t,r){"use strict";var n=r(44);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},18:function(e,t,r){"use strict";var n=r(93),o="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,c=Array.prototype.concat,a=Object.defineProperty,u=a&&function(){var e={};try{for(var t in a(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),s=function(e,t,r,n){var o;(!(t in e)||"function"==typeof(o=n)&&"[object Function]"===i.call(o)&&n())&&(u?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},p=function(e,t){var r=arguments.length>2?arguments[2]:{},i=n(t);o&&(i=c.call(i,Object.getOwnPropertySymbols(t)));for(var a=0;a<i.length;a+=1)s(e,i[a],t[i[a]],r[i[a]])};p.supportsDescriptors=!!u,e.exports=p},19:function(e,t){e.exports=ReactDOM},210:function(e,t,r){"use strict";(function(e){var n=r(0),o=r.n(n),i=r(38),c=r(27),a=r.n(c),u="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(r,n){e=r,t.forEach((function(t){return t(e,n)}))}}}var p=o.a.createContext||function(e,t){var r,o,c="__create-react-context-"+(u["__global_unique_id__"]=(u.__global_unique_id__||0)+1)+"__",p=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).emitter=s(t.props.value),t}Object(i.a)(r,e);var n=r.prototype;return n.getChildContext=function(){var e;return(e={})[c]=this.emitter,e},n.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var r,n=this.props.value,o=e.value;((i=n)===(c=o)?0!==i||1/i==1/c:i!=i&&c!=c)?r=0:(r="function"==typeof t?t(n,o):1073741823,0!=(r|=0)&&this.emitter.set(e.value,r))}var i,c},n.render=function(){return this.props.children},r}(n.Component);p.childContextTypes=((r={})[c]=a.a.object.isRequired,r);var l=function(t){function r(){var e;return(e=t.apply(this,arguments)||this).state={value:e.getValue()},e.onUpdate=function(t,r){0!=((0|e.observedBits)&r)&&e.setState({value:e.getValue()})},e}Object(i.a)(r,t);var n=r.prototype;return n.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?1073741823:t},n.componentDidMount=function(){this.context[c]&&this.context[c].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?1073741823:e},n.componentWillUnmount=function(){this.context[c]&&this.context[c].off(this.onUpdate)},n.getValue=function(){return this.context[c]?this.context[c].get():e},n.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},r}(n.Component);return l.contextTypes=((o={})[c]=a.a.object,o),{Provider:p,Consumer:l}};t.a=p}).call(this,r(16))},211:function(e,t,r){var n=r(274);e.exports=function e(t,r,o){return n(r)||(o=r||o,r=[]),o=o||{},t instanceof RegExp?function(e,t){var r=e.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)t.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return p(e,t)}(t,r):n(t)?function(t,r,n){for(var o=[],i=0;i<t.length;i++)o.push(e(t[i],r,n).source);return p(new RegExp("(?:"+o.join("|")+")",l(n)),r)}(t,r,o):function(e,t,r){return f(i(e,r),t,r)}(t,r,o)},e.exports.parse=i,e.exports.compile=function(e,t){return a(i(e,t),t)},e.exports.tokensToFunction=a,e.exports.tokensToRegExp=f;var o=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function i(e,t){for(var r,n=[],i=0,c=0,a="",p=t&&t.delimiter||"/";null!=(r=o.exec(e));){var l=r[0],f=r[1],d=r.index;if(a+=e.slice(c,d),c=d+l.length,f)a+=f[1];else{var y=e[c],g=r[2],m=r[3],h=r[4],b=r[5],v=r[6],w=r[7];a&&(n.push(a),a="");var x=null!=g&&null!=y&&y!==g,S="+"===v||"*"===v,j="?"===v||"*"===v,O=r[2]||p,A=h||b;n.push({name:m||i++,prefix:g||"",delimiter:O,optional:j,repeat:S,partial:x,asterisk:!!w,pattern:A?s(A):w?".*":"[^"+u(O)+"]+?"})}}return c<e.length&&(a+=e.substr(c)),a&&n.push(a),n}function c(e){return encodeURI(e).replace(/[\/?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function a(e,t){for(var r=new Array(e.length),o=0;o<e.length;o++)"object"==typeof e[o]&&(r[o]=new RegExp("^(?:"+e[o].pattern+")$",l(t)));return function(t,o){for(var i="",a=t||{},u=(o||{}).pretty?c:encodeURIComponent,s=0;s<e.length;s++){var p=e[s];if("string"!=typeof p){var l,f=a[p.name];if(null==f){if(p.optional){p.partial&&(i+=p.prefix);continue}throw new TypeError('Expected "'+p.name+'" to be defined')}if(n(f)){if(!p.repeat)throw new TypeError('Expected "'+p.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(p.optional)continue;throw new TypeError('Expected "'+p.name+'" to not be empty')}for(var d=0;d<f.length;d++){if(l=u(f[d]),!r[s].test(l))throw new TypeError('Expected all "'+p.name+'" to match "'+p.pattern+'", but received `'+JSON.stringify(l)+"`");i+=(0===d?p.prefix:p.delimiter)+l}}else{if(l=p.asterisk?encodeURI(f).replace(/[?#]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})):u(f),!r[s].test(l))throw new TypeError('Expected "'+p.name+'" to match "'+p.pattern+'", but received "'+l+'"');i+=p.prefix+l}}else i+=p}return i}}function u(e){return e.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function s(e){return e.replace(/([=!:$\/()])/g,"\\$1")}function p(e,t){return e.keys=t,e}function l(e){return e&&e.sensitive?"":"i"}function f(e,t,r){n(t)||(r=t||r,t=[]);for(var o=(r=r||{}).strict,i=!1!==r.end,c="",a=0;a<e.length;a++){var s=e[a];if("string"==typeof s)c+=u(s);else{var f=u(s.prefix),d="(?:"+s.pattern+")";t.push(s),s.repeat&&(d+="(?:"+f+d+")*"),c+=d=s.optional?s.partial?f+"("+d+")?":"(?:"+f+"("+d+"))?":f+"("+d+")"}}var y=u(r.delimiter||"/"),g=c.slice(-y.length)===y;return o||(c=(g?c.slice(0,-y.length):c)+"(?:"+y+"(?=$))?"),c+=i?"$":o&&g?"":"(?="+y+"|$)",p(new RegExp("^"+c,l(r)),t)}},27:function(e,t,r){e.exports=r(81)()},273:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useFeedTemplate=t.setIsEditingNewFeed=t.AdminAppSlice=void 0;const n=r(15),o=r(402);t.AdminAppSlice=n.createSlice({name:"app",initialState:{isLoaded:!1,isLoading:!1,isEditingNewFeed:!1,isDoingOnboarding:!1,newFeedTemplate:null},reducers:{setIsDoingOnBoarding(e,t){e.isDoingOnboarding=t.payload},setIsEditingNewFeed(e,t){e.isEditingNewFeed=t.payload},useFeedTemplate(e,t){e.newFeedTemplate=t.payload}},extraReducers:e=>e.addCase(o.loadAdminApp.pending,e=>{e.isLoading=!0}).addCase(o.loadAdminApp.fulfilled,e=>{e.isLoading=!1,e.isLoaded=!0})}),t.setIsEditingNewFeed=t.AdminAppSlice.actions.setIsEditingNewFeed,t.useFeedTemplate=t.AdminAppSlice.actions.useFeedTemplate},274:function(e,t){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return R})),r.d(t,"b",(function(){return M})),r.d(t,"c",(function(){return $})),r.d(t,"d",(function(){return D})),r.d(t,"e",(function(){return p})),r.d(t,"f",(function(){return L})),r.d(t,"g",(function(){return z})),r.d(t,"h",(function(){return _})),r.d(t,"i",(function(){return k})),r.d(t,"j",(function(){return S})),r.d(t,"k",(function(){return G})),r.d(t,"l",(function(){return J})),r.d(t,"m",(function(){return V})),r.d(t,"n",(function(){return H})),r.d(t,"o",(function(){return F}));var n="-ms-",o="-moz-",i="-webkit-",c="comm",a="rule",u="decl",s=Math.abs,p=String.fromCharCode;function l(e){return e.trim()}function f(e,t,r){return e.replace(t,r)}function d(e,t){return e.indexOf(t)}function y(e,t){return 0|e.charCodeAt(t)}function g(e,t,r){return e.slice(t,r)}function m(e){return e.length}function h(e){return e.length}function b(e,t){return t.push(e),e}var v=1,w=1,x=0,S=0,j=0,O="";function A(e,t,r,n,o,i,c){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:v,column:w,length:c,return:""}}function E(e,t,r){return A(e,t.root,t.parent,r,t.props,t.children,0)}function P(){return j=S>0?y(O,--S):0,w--,10===j&&(w=1,v--),j}function _(){return j=S<x?y(O,S++):0,w++,10===j&&(w=1,v++),j}function k(){return y(O,S)}function C(){return S}function T(e,t){return g(O,e,t)}function F(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function R(e){return v=w=1,x=m(O=e),S=0,[]}function $(e){return O="",e}function D(e){return l(T(S-1,function e(t){for(;_();)switch(j){case t:return S;case 34:case 39:return e(34===t||39===t?t:j);case 40:41===t&&e(t);break;case 92:_()}return S}(91===e?e+2:40===e?e+1:e)))}function N(e){for(;(j=k())&&j<33;)_();return F(e)>2||F(j)>3?"":" "}function I(e,t){for(;--t&&_()&&!(j<48||j>102||j>57&&j<65||j>70&&j<97););return T(e,C()+(t<6&&32==k()&&32==_()))}function U(e,t){for(;_()&&e+j!==57&&(e+j!==84||47!==k()););return"/*"+T(t,S-1)+"*"+p(47===e?e:_())}function L(e){for(;!F(k());)_();return T(e,S)}function M(e){return $(function e(t,r,n,o,i,c,a,u,s){for(var l=0,d=0,y=a,g=0,h=0,v=0,w=1,x=1,S=1,j=0,O="",A=i,E=c,T=o,F=O;x;)switch(v=j,j=_()){case 34:case 39:case 91:case 40:F+=D(j);break;case 9:case 10:case 13:case 32:F+=N(v);break;case 92:F+=I(C()-1,7);continue;case 47:switch(k()){case 42:case 47:b(q(U(_(),C()),r,n),s);break;default:F+="/"}break;case 123*w:u[l++]=m(F)*S;case 125*w:case 59:case 0:switch(j){case 0:case 125:x=0;case 59+d:h>0&&m(F)-y&&b(h>32?W(F+";",o,n,y-1):W(f(F," ","")+";",o,n,y-2),s);break;case 59:F+=";";default:if(b(T=B(F,r,n,l,d,i,u,O,A=[],E=[],y),c),123===j)if(0===d)e(F,r,T,T,A,c,y,u,E);else switch(g){case 100:case 109:case 115:e(t,T,T,o&&b(B(t,T,T,0,0,i,u,O,i,A=[],y),E),i,E,y,u,o?A:E);break;default:e(F,T,T,T,[""],E,y,u,E)}}l=d=h=0,w=S=1,O=F="",y=a;break;case 58:y=1+m(F),h=v;default:if(w<1)if(123==j)--w;else if(125==j&&0==w++&&125==P())continue;switch(F+=p(j),j*w){case 38:S=d>0?1:(F+="\f",-1);break;case 44:u[l++]=(m(F)-1)*S,S=1;break;case 64:45===k()&&(F+=D(_())),g=k(),d=m(O=F+=L(C())),j++;break;case 45:45===v&&2==m(F)&&(w=0)}}return c}("",null,null,null,[""],e=R(e),0,[0],e))}function B(e,t,r,n,o,i,c,u,p,d,y){for(var m=o-1,b=0===o?i:[""],v=h(b),w=0,x=0,S=0;w<n;++w)for(var j=0,O=g(e,m+1,m=s(x=c[w])),E=e;j<v;++j)(E=l(x>0?b[j]+" "+O:f(O,/&\f/g,b[j])))&&(p[S++]=E);return A(e,t,r,0===o?a:u,p,d,y)}function q(e,t,r){return A(e,t,r,c,p(j),g(e,2,-2),0)}function W(e,t,r,n){return A(e,t,r,u,g(e,0,n),g(e,n+1,-1),n)}function V(e,t){for(var r="",n=h(e),o=0;o<n;o++)r+=t(e[o],o,e,t)||"";return r}function H(e,t,r,n){switch(e.type){case"@import":case u:return e.return=e.return||e.value;case c:return"";case a:e.value=e.props.join(",")}return m(r=V(e.children,n))?e.return=e.value+"{"+r+"}":""}function z(e){var t=h(e);return function(r,n,o,i){for(var c="",a=0;a<t;a++)c+=e[a](r,n,o,i)||"";return c}}function J(e){return function(t){t.root||(t=t.return)&&e(t)}}function G(e,t,r,c){if(!e.return)switch(e.type){case u:e.return=function e(t,r){switch(function(e,t){return(((t<<2^y(e,0))<<2^y(e,1))<<2^y(e,2))<<2^y(e,3)}(t,r)){case 5103:return i+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return i+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return i+t+o+t+n+t+t;case 6828:case 4268:return i+t+n+t+t;case 6165:return i+t+n+"flex-"+t+t;case 5187:return i+t+f(t,/(\w+).+(:[^]+)/,i+"box-$1$2"+n+"flex-$1$2")+t;case 5443:return i+t+n+"flex-item-"+f(t,/flex-|-self/,"")+t;case 4675:return i+t+n+"flex-line-pack"+f(t,/align-content|flex-|-self/,"")+t;case 5548:return i+t+n+f(t,"shrink","negative")+t;case 5292:return i+t+n+f(t,"basis","preferred-size")+t;case 6060:return i+"box-"+f(t,"-grow","")+i+t+n+f(t,"grow","positive")+t;case 4554:return i+f(t,/([^-])(transform)/g,"$1"+i+"$2")+t;case 6187:return f(f(f(t,/(zoom-|grab)/,i+"$1"),/(image-set)/,i+"$1"),t,"")+t;case 5495:case 3959:return f(t,/(image-set\([^]*)/,i+"$1$`$1");case 4968:return f(f(t,/(.+:)(flex-)?(.*)/,i+"box-pack:$3"+n+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+i+t+t;case 4095:case 3583:case 4068:case 2532:return f(t,/(.+)-inline(.+)/,i+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(m(t)-1-r>6)switch(y(t,r+1)){case 109:if(45!==y(t,r+4))break;case 102:return f(t,/(.+:)(.+)-([^]+)/,"$1"+i+"$2-$3$1"+o+(108==y(t,r+3)?"$3":"$2-$3"))+t;case 115:return~d(t,"stretch")?e(f(t,"stretch","fill-available"),r)+t:t}break;case 4949:if(115!==y(t,r+1))break;case 6444:switch(y(t,m(t)-3-(~d(t,"!important")&&10))){case 107:return f(t,":",":"+i)+t;case 101:return f(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+i+(45===y(t,14)?"inline-":"")+"box$3$1"+i+"$2$3$1"+n+"$2box$3")+t}break;case 5936:switch(y(t,r+11)){case 114:return i+t+n+f(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return i+t+n+f(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return i+t+n+f(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return i+t+n+t+t}return t}(e.value,e.length);break;case"@keyframes":return V([E(f(e.value,"@","@"+i),e,"")],c);case a:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return V([E(f(t,/:(read-\w+)/,":-moz-$1"),e,"")],c);case"::placeholder":return V([E(f(t,/:(plac\w+)/,":"+i+"input-$1"),e,""),E(f(t,/:(plac\w+)/,":-moz-$1"),e,""),E(f(t,/:(plac\w+)/,n+"input-$1"),e,"")],c)}return""}))}}},289:function(e,t,r){"use strict";e.exports=r(425)},30:function(e,t,r){"use strict";t.a=function(e,t){if(!e)throw new Error("Invariant failed")}},402:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function c(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(c,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.loadAdminApp=void 0;const o=r(15),i=r(136),c=r(403),a=r(126),u=r(92),s=r(139),p=r(204);function l(){return n(this,void 0,void 0,(function*(){return yield new Promise(e=>setTimeout(e,800))}))}t.loadAdminApp=o.createAsyncThunk("admin-app/load",(e,t)=>n(void 0,void 0,void 0,(function*(){try{yield Promise.all([t.dispatch(u.loadAccounts()),t.dispatch(a.loadSettings()),t.dispatch(i.loadFeeds()),t.dispatch(p.loadTemplates()),t.dispatch(c.fetchNews()),l()])}catch(e){s.triggerError({type:"load/error",message:e.toString()})}})))},408:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdminAppStore=void 0;const n=r(15),o=r(26),i=r(273),c=r(140),a=r(75),u=r(409),s=r(47),p=r(52),l=r(205),f=r(276);t.AdminAppStore=n.configureStore({reducer:{[i.AdminAppSlice.name]:i.AdminAppSlice.reducer,[p.RouterSlice.name]:p.RouterSlice.reducer,[l.AccountsSlice.name]:l.AccountsSlice.reducer,[c.FeedsSlice.name]:c.FeedsSlice.reducer,[f.TemplatesSlice.name]:f.TemplatesSlice.reducer,[s.SettingsSlice.name]:s.SettingsSlice.reducer,[o.FeedEditorSlice.name]:o.FeedEditorSlice.reducer,[a.ToastsSlice.name]:a.ToastsSlice.reducer,[u.NewsSlice.name]:u.NewsSlice.reducer}})},424:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),r(289),r(426),r(427),r(428),r(429);const o=n(r(0)),i=n(r(19)),c=r(101),a=n(r(42)),u=r(460),s=r(84),p=r(503),l=r(963),f=r(404),d=r(405),y=r(406),g=r(408),m=r(402),h=r(75),b=r(386),v=r(25),w=r(217),x=r(52),S=r(63),j=r(1004),O=r(139);O.addErrorHandler(e=>{var t;const r=null!==(t=e.type)&&void 0!==t?t:"generic";g.AdminAppStore.dispatch(h.showToast({key:"admin/"+r,message:e.message,details:e.details,type:h.ToastType.ERROR}))}),s.Screens.register({id:"feeds",title:"Feeds",position:0,component:u.FeedsScreen}),s.Screens.register({id:"new",title:"Add New",isHidden:!0,component:p.NewFeedScreen}),s.Screens.register({id:"edit",title:"Edit",isHidden:!0,component:l.EditFeedScreen}),s.Screens.register({id:"promotions",title:"Promotions",position:40,component:f.Decorate(d.PromotionsScreen,{isFakePro:!0})}),s.Screens.register({id:"settings",title:"Settings",position:50,component:y.SettingsScreen}),g.AdminAppStore.dispatch(m.loadAdminApp()),document.addEventListener(b.SETTINGS_SAVE_SUCCESS,()=>{g.AdminAppStore.dispatch(h.showToast({key:"admin/settings/saved",message:"Settings saved."}))}),document.addEventListener(b.SETTINGS_SAVE_FAILED,e=>{O.triggerError({type:"settings/save/error",message:e.detail.error})});const A=document.getElementById("toplevel_page_spotlight-instagram");if(A){const e=A.querySelector("ul.wp-submenu").querySelectorAll("li:not(.wp-submenu-head)"),t=Array.from(e),r=g.AdminAppStore.getState();s.Screens.getList().forEach(e=>{const n=e.state||{},o=v.withPartial({screen:e.id},n),i=w.getRouteAbsUrl(r.router,o),c=t.find(e=>e.querySelector("a").href===i);c&&(c.setAttribute("data-screen",e.id),c.querySelector("a").addEventListener("click",t=>{g.AdminAppStore.dispatch(x.gotoScreen(e.id)),t.preventDefault(),t.stopPropagation()}))}),g.AdminAppStore.subscribe(()=>{const e=g.AdminAppStore.getState(),r=S.selectScreen(e);t.forEach(e=>e.classList.remove("current"));const n=t.find(e=>e.getAttribute("data-screen")===r);n&&n.classList.add("current")})}const E=document.getElementById(a.default.config.rootId);E&&(E.classList.add("wp-core-ui-override"),c.runWhenDomReady(()=>{i.default.render(o.default.createElement(j.AdminRoot,{}),E)}))},425:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=(n=r(0))&&"object"==typeof n&&"default"in n?n.default:n;function i(e){return i.warnAboutHMRDisabled&&(i.warnAboutHMRDisabled=!0),o.Children.only(e.children)}i.warnAboutHMRDisabled=!1;var c=function e(){return e.shouldWrapWithAppContainer?function(e){return function(t){return o.createElement(i,null,o.createElement(e,t))}}:function(e){return e}};c.shouldWrapWithAppContainer=!1,t.AppContainer=i,t.hot=c,t.areComponentsEqual=function(e,t){return e===t},t.setConfig=function(){},t.cold=function(e){return e},t.configureComponent=function(){}},426:function(e,t,r){e.exports={wpcontent:"wpcontent","wpbody-content":"wpbody-content",wpfooter:"wpfooter",wrap:"wrap",wpbody:"wpbody",adminmenu:"adminmenu","wp-has-current-submenu":"wp-has-current-submenu","wp-submenu":"wp-submenu","sli-onboarding":"sli-onboarding",disabled:"disabled"}},44:function(e,t,r){"use strict";var n=r(112);e.exports=Function.prototype.bind||n},476:function(e,t,r){"use strict";var n=r(477),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var r,i,c,a,u,s=!1;t||(t={}),t.debug;try{if(i=n(),c=document.createRange(),a=document.getSelection(),(u=document.createElement("span")).textContent=e,u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){window.clipboardData.clearData();var n=o[t.format]||o.default;window.clipboardData.setData(n,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(u),c.selectNodeContents(u),a.addRange(c),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(n){try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(n){r=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(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(c):a.removeAllRanges()),u&&document.body.removeChild(u),i()}return s}},477:function(e,t){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));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||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},48:function(e,t,r){"use strict";function n(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}r.d(t,"a",(function(){return n}))},59:function(e,t,r){"use strict";var n=r(98),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},c={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function u(e){return n.isMemo(e)?c:a[e.$$typeof]||o}a[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[n.Memo]=c;var s=Object.defineProperty,p=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,y=Object.prototype;e.exports=function e(t,r,n){if("string"!=typeof r){if(y){var o=d(r);o&&o!==y&&e(t,o,n)}var c=p(r);l&&(c=c.concat(l(r)));for(var a=u(t),g=u(r),m=0;m<c.length;++m){var h=c[m];if(!(i[h]||n&&n[h]||g&&g[h]||a&&a[h])){var b=f(r,h);try{s(t,h,b)}catch(e){}}}}return t}},64:function(e,t,r){"use strict";var n=r(44),o=r(94),i=o("%Function.prototype.apply%"),c=o("%Function.prototype.call%"),a=o("%Reflect.apply%",!0)||n.call(c,i),u=o("%Object.getOwnPropertyDescriptor%",!0),s=o("%Object.defineProperty%",!0),p=o("%Math.max%");if(s)try{s({},"a",{value:1})}catch(e){s=null}e.exports=function(e){var t=a(n,c,arguments);if(u&&s){var r=u(t,"length");r.configurable&&s(t,"length",{value:p(0,e.length-(arguments.length-1))})}return t};var l=function(){return a(n,i,arguments)};s?s(e.exports,"apply",{value:l}):e.exports.apply=l},65:function(e,t,r){"use strict";var n=function(e){return e!=e};e.exports=function(e,t){return 0===e&&0===t?1/e==1/t:e===t||!(!n(e)||!n(t))}},66:function(e,t,r){"use strict";var n=r(65);e.exports=function(){return"function"==typeof Object.is?Object.is:n}},67:function(e,t,r){"use strict";var n=Object,o=TypeError;e.exports=function(){if(null!=this&&this!==n(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}},68:function(e,t,r){"use strict";var n=r(67),o=r(18).supportsDescriptors,i=Object.getOwnPropertyDescriptor,c=TypeError;e.exports=function(){if(!o)throw new c("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 n}},78: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}},81:function(e,t,r){"use strict";var n=r(82);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,i,c){if(c!==n){var a=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 a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={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 r.PropTypes=r,r}},82:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},83:function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},85:function(e,t,r){"use strict";(function(t){var n=t.Symbol,o=r(111);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}}).call(this,r(16))},90:function(e,t,r){"use strict";e.exports=function(){}},91:function(e,t,r){"use strict";function n(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}t.a=function(e,t){var r;void 0===t&&(t=n);var o,i=[],c=!1;return function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return c&&r===this&&t(n,i)||(o=e.apply(this,n),c=!0,r=this,i=n),o}}},99:function(e,t,r){"use strict";function n(e,t){return e===t}function o(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,o=0;o<n;o++)if(!e(t[o],r[o]))return!1;return!0}function i(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}r.d(t,"a",(function(){return c}));var c=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];var c=0,a=n.pop(),u=i(n),s=e.apply(void 0,[function(){return c++,a.apply(null,arguments)}].concat(r)),p=e((function(){for(var e=[],t=u.length,r=0;r<t;r++)e.push(u[r].apply(null,arguments));return s.apply(null,e)}));return p.resultFunc=a,p.dependencies=u,p.recomputations=function(){return c},p.resetRecomputations=function(){return c=0},p}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=null,i=null;return function(){return o(t,r,arguments)||(i=e.apply(null,arguments)),r=arguments,i}}))}},[[424,2,1,0,3,5,4,6]]]);
ui/dist/admin-common.js CHANGED
@@ -1 +1 @@
1
- (window.webpackJsonpSpotlight=window.webpackJsonpSpotlight||[]).push([[4],[,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Button=t.ButtonSize=t.ButtonType=void 0;const l=o(n(0)),i=n(14),r=n(155),s=o(n(218));n(302);const u=n(108);var c,d;!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"}(c=t.ButtonType||(t.ButtonType={})),function(e){e[e.SMALL=0]="SMALL",e[e.NORMAL=1]="NORMAL",e[e.LARGE=2]="LARGE",e[e.HERO=3]="HERO"}(d=t.ButtonSize||(t.ButtonSize={})),t.Button=l.default.forwardRef((e,t)=>{let{children:n,className:o,type:f,size:m,active:p,tooltip:_,tooltipPlacement:h,onClick:g,linkTo:b}=e,v=a(e,["children","className","type","size","active","tooltip","tooltipPlacement","onClick","linkTo"]);f=null!=f?f:c.SECONDARY,m=null!=m?m:d.NORMAL,h=null!=h?h:"bottom";const[y,E]=l.default.useState(!1),S=()=>E(!0),P=()=>E(!1),w=i.classList(o,f!==c.NONE?"button":null,f===c.PRIMARY?"button-primary":null,f===c.SECONDARY?"button-secondary":null,f===c.LINK?"button-secondary button-tertiary":null,f===c.PILL?"button-secondary button-tertiary button-pill":null,f===c.TOGGLE?"button-toggle":null,f===c.TOGGLE&&p?"button-secondary button-active":null,f!==c.TOGGLE||p?null:"button-secondary",f===c.DANGER?"button-secondary button-danger":null,f===c.DANGER_LINK?"button-tertiary button-danger":null,f===c.DANGER_PILL?"button-tertiary button-danger button-danger-pill":null,m===d.SMALL?"button-small":null,m===d.LARGE?"button-large":null,m===d.HERO?"button-hero":null),O=e=>{g&&g(e)};let C="button";if("string"==typeof b?(C="a",v.href=b):v.type="button",v.tabIndex=0,!_)return l.default.createElement(C,Object.assign({ref:t,className:w,onClick:O},v),n);const N="string"==typeof _,M="btn-tooltip-"+u.uniqueNum(),k=N?_:l.default.createElement(_,{id:M});return l.default.createElement(s.default,{visible:y&&!e.disabled,placement:h,delay:300},({ref:e})=>l.default.createElement(C,Object.assign({ref:t?r.mergeRefs(e,t):e,className:w,onClick:O,onMouseEnter:S,onMouseLeave:P},v),n),k)})},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectExpiringAccounts=t.selectBusinessAccounts=t.selectAccountList=t.selectHasBusinessAccounts=t.selectHasAccounts=t.selectAccountById=t.selectAccounts=void 0;const a=n(43),o=n(29),l=n(463);t.selectAccounts=e=>a.Dictionary.values(e.accounts),t.selectAccountById=e=>t=>a.Dictionary.get(t.accounts,e),t.selectHasAccounts=e=>!a.Dictionary.isEmpty(e.accounts),t.selectHasBusinessAccounts=e=>t.selectBusinessAccounts(e).length>0,t.selectAccountList=e=>n=>e.map(e=>t.selectAccountById(e)(n)).filter(e=>!!e),t.selectBusinessAccounts=e=>t.selectAccounts(e).filter(e=>e.type===o.Account.Type.BUSINESS),t.selectExpiringAccounts=e=>t.selectAccounts(e).filter(l.isAccountTokenExpiring)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;const o=a(n(0)),l=n(543),i=n(339);t.NumberField=function({value:e,onChange:t,min:n,max:a,emptyMin:r,placeholder:s,id:u,unit:c}){n=null!=n?n:0,a=null!=a?a:1/0,e=null!=e?e:"",e=isNaN(parseInt(e.toString()))?n:e,s=null!=s?s:"",r=null!=r&&r;const d=o.default.useCallback(e=>{const o=""===e.target.value?n:parseInt(e.target.value);isNaN(o)||t&&t(i.clampNum(o,n,a))},[n,a,t]),f=o.default.useCallback(()=>{r&&e<=n&&e>=a&&t&&t("")},[r,e,n,a,t]),m=o.default.useCallback(a=>{"ArrowUp"===a.key&&""===e&&t&&t(r?n+1:n)},[e,n,r,t]),p=r&&e<=n?"":e,[_,h]=Array.isArray(c)?c:[c,c],g=1===e?_:h;return g?o.default.createElement(l.UnitInput,{id:u,type:"number",unit:g,value:p,min:n,max:a,placeholder:s+"",onChange:d,onBlur:f,onKeyDown:m}):o.default.createElement("input",{id:u,type:"number",value:p,min:n,max:a,placeholder:s+"",onChange:d,onBlur:f,onKeyDown:m})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectSetting=t.selectSettingsValues=t.selectSettingsAreSaving=t.selectSettingsAreDirty=void 0,t.selectSettingsAreDirty=e=>{var t;return null===(t=e.settings)||void 0===t?void 0:t.isDirty},t.selectSettingsAreSaving=e=>{var t;return null===(t=e.settings)||void 0===t?void 0:t.isSaving},t.selectSettingsValues=e=>{var t,n;return null!==(n=null===(t=e.settings)||void 0===t?void 0:t.values)&&void 0!==n?n:{}},t.selectSetting=e=>t=>{var n,a;return null!==(a=null===(n=t.settings)||void 0===n?void 0:n.values[e])&&void 0!==a?a:null}},,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CheckboxField=void 0;const o=a(n(0)),l=a(n(554));t.CheckboxField=function({id:e,value:t,onChange:n,disabled:a}){return o.default.createElement("div",{className:l.default.checkboxField},o.default.createElement("div",{className:l.default.aligner},o.default.createElement("input",{id:e,type:"checkbox",value:"1",checked:!!t,onChange:e=>n(e.target.checked),disabled:a})))}},,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Message=t.MessageType=void 0;const o=a(n(0)),l=a(n(483)),i=n(14),r=n(11);var s;function u(e){switch(e){case s.SUCCESS:return"yes-alt";case s.PRO_TIP:return"lightbulb";case s.ERROR:case s.WARNING:return"warning";case s.INFO:default:return"info"}}!function(e){e.SUCCESS="success",e.INFO="info",e.PRO_TIP="pro-tip",e.WARNING="warning",e.ERROR="error",e.GREY="grey"}(s=t.MessageType||(t.MessageType={})),t.Message=({children:e,type:t,showIcon:n,shake:a,isDismissible:s,onDismiss:c})=>{const[d,f]=o.default.useState(!1),m=i.classList(l.default[t],a?l.default.shaking:null);return d?null:o.default.createElement("div",{className:m},n?o.default.createElement("div",null,o.default.createElement(r.Dashicon,{className:l.default.icon,icon:u(t)})):null,o.default.createElement("div",{className:l.default.content},e),s?o.default.createElement("button",{className:l.default.dismissBtn,onClick:()=>{s&&(f(!0),c&&c())}},o.default.createElement(r.Dashicon,{icon:"no"})):null)}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Select=t.SelectStyles=void 0;const o=a(n(0)),l=a(n(334)),i=a(n(537)),r=a(n(538)),s=a(n(539)),u=n(14);t.SelectStyles=(e={})=>({option:(e,t)=>Object.assign(Object.assign({},e),{cursor:"pointer",lineHeight:"24px"}),menu:(e,t)=>Object.assign(Object.assign({},e),{margin:"6px 0",boxShadow:"0 2px 8px "+s.default.shadowColor,overflow:"hidden"}),menuList:(e,t)=>({padding:"0px"}),control:(e,t)=>{let n=Object.assign(Object.assign({},e),{cursor:"pointer",lineHeight:"2",minHeight:"40px"});return t.isFocused&&(n.borderColor=s.default.primaryColor,n.boxShadow="0 0 0 1px "+s.default.primaryColor),n},valueContainer:(e,t)=>Object.assign(Object.assign({},e),{paddingTop:0,paddingBottom:0,paddingRight:0}),container:(t,n)=>Object.assign(Object.assign({},t),{width:e.width||"100%"}),multiValue:(e,t)=>Object.assign(Object.assign({},e),{padding:"0 6px"}),input:(e,t)=>Object.assign(Object.assign({},e),{outline:"0 transparent !important",border:"0 transparent !important",boxShadow:"0 0 0 transparent !important"}),indicatorSeparator:(e,t)=>Object.assign(Object.assign({},e),{margin:"0",backgroundColor:"transparent"}),menuPortal:e=>Object.assign(Object.assign({},e),{zIndex:9999999})}),t.Select=o.default.forwardRef((e,n)=>{var a;const c=(null!==(a=e.options)&&void 0!==a?a:[]).find(t=>t.value===e.value);e=Object.assign(Object.assign({},e),{id:void 0,className:u.classList("react-select",e.className),classNamePrefix:"react-select",inputId:e.id,menuPosition:"absolute"});const d=t.SelectStyles(e),f=e.isCreatable?i.default:e.async?r.default:l.default;return o.default.createElement(f,Object.assign({},e,{ref:n,isSearchable:e.isCreatable,value:c,styles:d,theme:e=>Object.assign(Object.assign({},e),{borderRadius:3,colors:Object.assign(Object.assign({},e.colors),{primary:s.default.primaryColor,primary25:s.default.washedColor})}),menuPlacement:"auto",menuPortalTarget:document.body,menuShouldScrollIntoView:!0}))})},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarLayout=void 0;const r=l(n(0)),s=i(n(847)),u=n(11),c=n(267);function d(e){return r.default.createElement(c.ResponsiveContainer,{breakpoints:[d.BREAKPOINT]},r.default.createElement(f,Object.assign({},e)))}function f({content:e,sidebar:t,primary:n,current:a,useDefaults:o}){const[l,i]=r.useState(n),u=r.default.useContext(c.ResponsiveContext)<=d.BREAKPOINT,f=()=>i(p?"content":"sidebar"),m=()=>i(p?"sidebar":"content"),p="content"===(n=null!=n?n:"content"),_="sidebar"===n,h="content"===(a=o?l:a),g="sidebar"===a,b=p?s.default.layoutPrimaryContent:s.default.layoutPrimarySidebar;return r.default.createElement("div",{className:b},r.default.createElement(d.Context.Provider,{value:u},e&&(h||!u)&&r.default.createElement("div",{className:s.default.content},o&&r.default.createElement(d.Navigation,{align:p?"right":"left",text:!p&&r.default.createElement("span",null,"Go back"),icon:p?"admin-generic":"arrow-left",onClick:p?m:f}),null!=e?e:null),t&&(g||!u)&&r.default.createElement("div",{className:s.default.sidebar},o&&r.default.createElement(d.Navigation,{align:_?"right":"left",text:!_&&r.default.createElement("span",null,"Go back"),icon:_?"admin-generic":"arrow-left",onClick:_?m:f}),null!=t?t:null)))}t.SidebarLayout=d,function(e){e.BREAKPOINT=968,e.Context=r.default.createContext(!1),e.Navigation=function({icon:e,text:t,align:n,onClick:a}){return t=null!=t?t:"Go back",e=null!=e?e:"arrow-left-alt",n=null!=n?n:"left",r.default.createElement("div",{className:"right"===n?s.default.navigationRight:s.default.navigationLeft},r.default.createElement("a",{className:s.default.navLink,onClick:a},e&&r.default.createElement(u.Dashicon,{icon:e}),r.default.createElement("span",null,null!=t?t:"")))}}(d=t.SidebarLayout||(t.SidebarLayout={}))},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminCommonConfig=void 0,n(430);const o=n(20),l=n(56),i=n(62);t.AdminCommonConfig=SliAdminCommonConfig,o.client.interceptors.request.use(e=>(e.headers["X-WP-Nonce"]=SliAdminCommonConfig.restApi.wpNonce,e),e=>Promise.reject(e));const r={config:{rootId:"spotlight-instagram-admin",adminUrl:SliAdminCommonConfig.adminUrl,doOnboarding:"1"==SliAdminCommonConfig.doOnboarding,cronSchedules:SliAdminCommonConfig.cronSchedules,cronScheduleOptions:SliAdminCommonConfig.cronSchedules.map(e=>({value:e.key,label:e.display})),postTypes:SliAdminCommonConfig.postTypes,hasElementor:SliAdminCommonConfig.hasElementor,searchPosts:(e,t="")=>a(void 0,void 0,void 0,(function*(){return(yield i.AdminRestApi.wp.posts.search(e,t)).data}))},restApi:{config:SliAdminCommonConfig.restApi},editor:{preview:SliAdminCommonConfig.preview}};t.default=r,l.RestApi.config.autoImportMedia=!0},,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdminResources=void 0;const a=n(42);t.AdminResources={upgradeUrl:"https://spotlightwp.com/pricing/",upgradeNavbarUrl:"https://spotlightwp.com/pricing/?utm_source=sl_plugin&utm_medium=sl_plugin_upgrade&utm_campaign=sl_plugin_upgrade_list",pricingUrl:"https://spotlightwp.com/pricing/",proComingSoonUrl:"https://spotlightwp.com/pro-coming-soon/",supportUrl:"https://spotlightwp.com/support/",supportNavbarUrl:"https://spotlightwp.com/support/?utm_source=sl_plugin&utm_medium=sl_plugin_support&utm_campaign=sl_plugin_support_list",customPersonalInfoUrl:"https://docs.spotlightwp.com/article/624-custom-profile-photo-and-bio-text",connectPersonalAccount:"https://docs.spotlightwp.com/article/551-connect-a-personal-account",connectBusinessAccount:"https://docs.spotlightwp.com/article/552-connect-a-business-account",connectAccessToken:"https://docs.spotlightwp.com/article/731-connect-an-access-token",personalVsBusinessAccount:"https://docs.spotlightwp.com/article/553-personal-vs-business-accounts",businessAccounts:"https://docs.spotlightwp.com/article/555-how-to-switch-to-a-business-account",cacheDocsUrl:"https://docs.spotlightwp.com/article/639-cache",promoTypesSurvey:"https://spotlightwp.com/survey-promote/",tokenGenerator:"https://spotlightwp.com/access-token-generator",upgradeLocalUrl:a.AdminCommonConfig.adminUrl+"admin.php?page=spotlight-instagram-pricing",trialLocalUrl:a.AdminCommonConfig.adminUrl+"admin.php?page=spotlight-instagram-pricing&billing_cycle=annual&trial=true"}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.restoreSettings=t.updateSettings=t.SettingsSlice=void 0;const l=n(15),i=n(21),r=n(74),s=n(102),u=n(25),c=n(126);function d(e){i.Common.config.promotions.global=e.values.promotions,i.Common.config.promotions.autos=e.values.autoPromotions}t.SettingsSlice=l.createSlice({name:"settings",initialState:{values:{},original:{},isDirty:!1,isSaving:!1},reducers:{update(e,t){e.values=u.withPartial(e.values,t.payload),e.isDirty=!s.objectsEqual(e.values,e.original),d(e)},restore(e){e.values=r.cloneObj(e.original),e.isDirty=!1,d(e)}},extraReducers:e=>e.addCase(c.saveSettings.pending,e=>{e.isSaving=!0}).addCase(c.saveSettings.rejected,e=>{e.isSaving=!1}).addMatcher(l.isFulfilled(c.saveSettings,c.loadSettings),(e,t)=>{e.original=t.payload,e.values=r.cloneObj(e.original),e.isSaving=!1,e.isDirty=!1,d(e)})}),o(n(836),t),t.updateSettings=t.SettingsSlice.actions.update,t.restoreSettings=t.SettingsSlice.actions.restore},,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.modifyRoute=t.gotoScreen=t.gotoRoute=t.gotoUrl=t.RouterSlice=t.addRouteInterceptor=t.RouterHistory=void 0;const l=n(15),i=n(104),r=n(50),s=n(217),u=n(25),c=n(43),d=n(108);t.RouterHistory=r.createBrowserHistory();const f={};function m(e,n,a){if(!a&&!n)throw"updateRoute() must be given either a query or a path!";a=null!=a?a:s.createPath(e,n),n=null!=n?n:i.parse(a),c.Dictionary.values(f).some(e=>!1===e(n,a))||(e.query=n,function(e){setTimeout(()=>t.RouterHistory.push(e,{}))}(a))}var p;t.addRouteInterceptor=function(e){const t="ri"+d.uniqueNum();return c.Dictionary.set(f,t,e),()=>c.Dictionary.remove(f,t)},t.RouterSlice=l.createSlice({name:"router",initialState:{baseUrl:(p=null!=p?p:window.location).protocol+"//"+p.host,pathName:p.pathname,query:Object.assign({},i.parse(p.search))},reducers:{gotoUrl(e,t){m(e,null,t.payload)},gotoRoute(e,t){m(e,u.withPartial({page:e.query.page},t.payload))},gotoScreen(e,t){m(e,{page:e.query.page,screen:t.payload})},modifyRoute(e,t){const n=e.query.page,a=u.withPartial(e.query,t.payload);a.page=n,m(e,a)}}}),t.gotoUrl=t.RouterSlice.actions.gotoUrl,t.gotoRoute=t.RouterSlice.actions.gotoRoute,t.gotoScreen=t.RouterSlice.actions.gotoScreen,t.modifyRoute=t.RouterSlice.actions.modifyRoute,o(n(468),t)},,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ColorPicker=void 0;const r=l(n(0)),s=i(n(558)),u=i(n(559)),c=n(304),d=n(220),f=n(69),m=n(761),p=n(285),_=n(155),h=i(n(42));t.ColorPicker=function({id:e,value:t,disableAlpha:n,onChange:a}){t=null!=t?t:"#fff";const[o,l]=r.default.useState(t),[i,g]=r.default.useState(!1),b=r.default.useRef(),v=r.default.useRef(),y=r.default.useCallback(()=>g(!1),[]),E=r.default.useCallback(()=>g(e=>!e),[]),S=r.default.useCallback(e=>{l(e.rgb),a&&a(e)},[a]),P=r.default.useCallback(e=>{"Escape"===e.key&&i&&(y(),e.preventDefault(),e.stopPropagation())},[i]);r.useEffect(()=>l(t),[t]),d.useDetectOutsideClick(b,y,[v]),c.useDetectTabOut([b,v],y),f.useDocumentEventListener("keydown",P,[i]);const w={preventOverflow:{boundariesElement:document.getElementById(h.default.config.rootId),padding:5}};return r.default.createElement(p.Manager,null,r.default.createElement(p.Reference,null,({ref:t})=>r.default.createElement("button",{ref:_.mergeRefs(b,t),id:e,className:s.default.button,onClick:E},r.default.createElement("span",{className:s.default.colorPreview,style:{backgroundColor:m.colorToString(o)}}))),r.default.createElement(p.Popper,{placement:"bottom-end",positionFixed:!0,modifiers:w},({ref:e,style:t})=>i&&r.default.createElement("div",{className:s.default.popper,ref:_.mergeRefs(v,e),style:t},r.default.createElement(u.default,{color:o,onChange:S,disableAlpha:n}))))}},,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminRestApi=void 0;const o=a(n(453)),l=a(n(454)),i=a(n(455)),r=a(n(456)),s=a(n(457)),u=a(n(458)),c=a(n(459));t.AdminRestApi={feeds:o.default,accounts:l.default,media:i.default,settings:r.default,notifications:s.default,cache:u.default,wp:c.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectQueryParam=t.selectRoute=t.selectScreen=void 0;const a=n(300),o=n(217);t.selectScreen=e=>{var t;return null!==(t=a.extractFromArray(e.router.query.screen))&&void 0!==t?t:""},t.selectRoute=e=>new l(e.router),t.selectQueryParam=e=>t=>o.getRouteParam(t.router,e);class l{constructor(e){Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state=e}get path(){return o.getRoutePath(this.state)}getParam(e){return o.getRouteParam(this.state,e)}withQuery(e){return o.routeWithQuery(this.state,e)}setQuery(e){return o.routeSetQuery(this.state,e)}withoutParam(e){return o.routeWithoutParam(this.state,e)}getRelUrl(e){return o.getRouteRelUrl(this.state,e)}getAbsUrl(e){return o.getRouteAbsUrl(this.state,e)}}},,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.removeToast=t.showToast=t.ToastsSlice=void 0;const l=n(15),i=n(43);t.ToastsSlice=l.createSlice({name:"toasts",initialState:{},reducers:{showToast(e,t){i.Dictionary.set(e,t.payload.key,t.payload)},removeToast(e,t){i.Dictionary.remove(e,t.payload)}}}),t.showToast=t.ToastsSlice.actions.showToast,t.removeToast=t.ToastsSlice.actions.removeToast,o(n(467),t)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ProPill=void 0;const o=a(n(0)),l=a(n(496)),i=n(14),r=n(45);t.ProPill=({className:e,children:t})=>{const n=o.default.useCallback(()=>{window.open(r.AdminResources.pricingUrl,"_blank")},[]);return o.default.createElement("span",{className:i.classList(l.default.pill,e),onClick:n,tabIndex:-1},"PRO",t)}},,,,,,,,function(e,t,n){"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.Screens=t.SCREENS=void 0,(a=t.SCREENS||(t.SCREENS={})).NEW_FEED="new",a.EDIT_FEED="edit",a.FEED_LIST="feeds",a.SETTINGS="settings",a.PROMOTIONS="promotions",function(e){const t=[];e.getList=function(){return t},e.register=function(n){return t.push(n),t.sort((e,t)=>{var n,a;const o=null!==(n=e.position)&&void 0!==n?n:0,l=null!==(a=t.position)&&void 0!==a?a:0;return Math.sign(o-l)}),e},e.getScreen=function(e){return t.find(t=>t.id===e)}}(t.Screens||(t.Screens={}))},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Modal=void 0;const s=l(n(0)),u=r(n(19)),c=r(n(478)),d=n(14),f=n(479),m=n(69),p=n(11),_=n(222),h=r(n(218));function g({rootRef:e,children:t,className:n,isOpen:a,icon:o,title:l,width:i,height:r,onClose:p,allowShadeClose:_,focusChild:h,portalTo:b}){const v=s.default.useRef(),[y]=f.useDelayedFlag(a,!1,g.ANIMATION_DELAY);if(m.useDocumentEventListener("keydown",e=>{a&&"Escape"===e.key&&(p&&p(),e.preventDefault(),e.stopPropagation())},[],[a,p]),s.useEffect(()=>{v&&v.current&&a&&(null!=h?h:v).current.focus()},[]),!y)return null;const E={width:i=null!=i?i:600,height:r},S=d.classList(c.default.modal,a?c.default.opening:c.default.closing,n,"wp-core-ui-override");_=null==_||_;const P=s.default.createElement("div",{className:S,ref:e},s.default.createElement("div",{className:c.default.shade,tabIndex:-1,onClick:()=>{_&&p&&p()}}),s.default.createElement("div",{ref:v,className:c.default.container,style:E,tabIndex:-1},l?s.default.createElement(g.Header,null,s.default.createElement("h1",null,s.default.createElement(g.Icon,{icon:o}),l),s.default.createElement(g.CloseBtn,{onClick:p})):null,t));let w=b;if(void 0===w){const e=document.getElementsByClassName("spotlight-modal-target");w=0===e.length?document.body:e.item(0)}return u.default.createPortal(P,w)}t.Modal=g,function(e){e.ANIMATION_DELAY=120,e.CloseBtn=({onClick:e})=>{const[t,n]=s.default.useState(!1),a=()=>n(!0),o=()=>n(!1);return s.default.createElement(h.default,{visible:t},({ref:t})=>s.default.createElement(_.DivButton,{ref:t,className:c.default.closeBtn,onClick:e,onMouseEnter:a,onMouseLeave:o,children:s.default.createElement(p.Dashicon,{icon:"no-alt"})}),"Close")},e.Icon=({icon:e})=>e?s.default.createElement(p.Dashicon,{icon:e,className:c.default.icon}):null,e.Header=({children:e})=>s.default.createElement("div",{className:c.default.header},e),e.Content=e=>{var{children:t}=e,n=i(e,["children"]);return s.default.createElement("div",{className:c.default.scroller},s.default.createElement("div",Object.assign({className:c.default.content},n),t))},e.Footer=({children:e})=>s.default.createElement("div",{className:c.default.footer},e)}(g=t.Modal||(t.Modal={}))},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsField=void 0;const o=a(n(0)),l=a(n(835)),i=a(n(238));t.SettingsField=function({id:e,label:t,tooltip:n,fullWidth:a,children:r}){return a=a||!t,o.default.createElement("div",{className:l.default.root},t&&o.default.createElement("div",{className:l.default.label},o.default.createElement("label",{htmlFor:e},t)),o.default.createElement("div",{className:l.default.container},o.default.createElement("div",{className:a?l.default.controlFullWidth:l.default.controlPartialWidth},r),n&&o.default.createElement("div",{className:l.default.tooltip},o.default.createElement(i.default,null,n))))}},,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.updateAccount=t.deleteAccount=t.loadAccounts=void 0;const o=n(15),l=n(56),i=n(62),r=n(20);t.loadAccounts=o.createAsyncThunk("accounts/load",()=>a(void 0,void 0,void 0,(function*(){var e;try{const t=yield l.RestApi.accounts.get();if("object"==typeof t&&Array.isArray(t.data))return null!==(e=null==t?void 0:t.data)&&void 0!==e?e:[]}catch(e){throw r.getErrorResponseMessage(e)}}))),t.deleteAccount=o.createAsyncThunk("accounts/delete",e=>a(void 0,void 0,void 0,(function*(){try{const t=yield i.AdminRestApi.accounts.delete(e);if("object"==typeof t&&Array.isArray(t.data))return t.data}catch(e){throw r.getErrorResponseMessage(e)}throw"Spotlight encountered a problem while trying to delete the account. Kindly contact customer support for assistance."}))),t.updateAccount=o.createAsyncThunk("accounts/update",e=>a(void 0,void 0,void 0,(function*(){return yield i.AdminRestApi.accounts.update(e),e})))},,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectHasFeeds=t.selectFeedById=t.selectFeeds=void 0;const a=n(43);t.selectFeeds=e=>a.Dictionary.values(e.feeds),t.selectFeedById=e=>t=>e?a.Dictionary.get(t.feeds,e):null,t.selectHasFeeds=e=>!a.Dictionary.isEmpty(e.feeds)},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.saveSettings=t.loadSettings=void 0;const o=n(15),l=n(386),i=n(328),r=n(20),s=n(62);function u(e){return a(this,void 0,void 0,(function*(){try{const t=yield e();if("object"==typeof t&&void 0!==t.data)return function(e){var t,n,a,o,l,i,r,s,u,c,d;const f={importerInterval:null!==(t=e.importerInterval)&&void 0!==t?t:"",cleanerAgeLimit:null!==(n=e.cleanerAgeLimit)&&void 0!==n?n:"",cleanerInterval:null!==(a=e.cleanerInterval)&&void 0!==a?a:"",preloadMedia:null!==(o=e.preloadMedia)&&void 0!==o&&o,hashtagWhitelist:null!==(l=e.hashtagWhitelist)&&void 0!==l?l:[],hashtagBlacklist:null!==(i=e.hashtagBlacklist)&&void 0!==i?i:[],captionWhitelist:null!==(r=e.captionWhitelist)&&void 0!==r?r:[],captionBlacklist:null!==(s=e.captionBlacklist)&&void 0!==s?s:[],autoPromotions:null!==(u=e.autoPromotions)&&void 0!==u?u:[],promotions:null!==(c=e.promotions)&&void 0!==c?c:{},thumbnails:null!==(d=e.thumbnails)&&void 0!==d?d:[]};return Array.isArray(f.promotions)&&0===f.promotions.length&&(f.promotions={}),f}(t.data)}catch(e){throw r.getErrorResponseMessage(e)}throw"Spotlight encountered a problem while trying to load your settings. Kindly contact customer support for assistance."}))}t.loadSettings=o.createAsyncThunk("settings/load",()=>a(void 0,void 0,void 0,(function*(){return yield u(()=>s.AdminRestApi.settings.get())}))),t.saveSettings=o.createAsyncThunk("settings/save",(e,t)=>a(void 0,void 0,void 0,(function*(){const e=t.getState().settings;try{const t=yield u(()=>s.AdminRestApi.settings.save(e.values));return document.dispatchEvent(i.createCustomEvent(l.SETTINGS_SAVE_SUCCESS)),t}catch(e){throw document.dispatchEvent(i.createCustomEvent(l.SETTINGS_SAVE_FAILED,{error:e})),e}})))},,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteFeed=t.duplicateFeed=t.saveFeed=t.loadFeeds=void 0;const o=n(15),l=n(56),i=n(62),r=n(75),s=n(74),u=n(20);t.loadFeeds=o.createAsyncThunk("feeds/load",()=>a(void 0,void 0,void 0,(function*(){try{const e=yield l.RestApi.feeds.get();if("object"==typeof e&&Array.isArray(e.data))return e.data}catch(e){throw u.getErrorResponseMessage(e)}throw"Spotlight encountered a problem trying to load your feeds. Kindly contact customer support for assistance."}))),t.saveFeed=o.createAsyncThunk("feeds/save",(e,t)=>a(void 0,void 0,void 0,(function*(){t.dispatch(r.showToast({key:"feeds/saving",message:"Saving feed. Please wait ...",type:r.ToastType.STICKY}));const n=yield i.AdminRestApi.feeds.save(e);return t.dispatch(r.removeToast("feeds/saving")),t.dispatch(r.showToast({key:"feeds/saved",message:"Feed saved!"})),n.data.feed}))),t.duplicateFeed=o.createAsyncThunk("feeds/duplicate",(e,t)=>a(void 0,void 0,void 0,(function*(){t.dispatch(r.showToast({key:"admin/feeds/duplicate/wait",message:"Duplicating feed. Please wait ...",type:r.ToastType.STICKY}));const n={id:null,name:"Copy of "+e.name,usages:[],options:s.cloneObj(e.options)};try{return(yield i.AdminRestApi.feeds.save(n)).data.feed}finally{t.dispatch(r.removeToast("admin/feeds/duplicate/wait"))}}))),t.deleteFeed=o.createAsyncThunk("feeds/delete",(e,t)=>a(void 0,void 0,void 0,(function*(){try{return yield i.AdminRestApi.feeds.delete(e.id),e.id}catch(e){t.dispatch(r.showToast({key:"feeds/delete/error",message:e.toString(),type:r.ToastType.ERROR}))}})))},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MenuHeading=t.MenuStatic=t.MenuSeparator=t.MenuContent=t.MenuItem=t.StatefulMenu=t.Menu=void 0;const s=l(n(0)),u=n(285),c=n(304),d=n(220),f=r(n(42));n(474);const m=n(14);function p(e){var{children:n}=e,a=i(e,["children"]);const[o,l]=s.useState(!1),r=()=>l(!0),u=()=>l(!1),c={openMenu:r,closeMenu:u};return s.default.createElement(p.Context.Provider,{value:c},s.default.createElement(t.Menu,Object.assign({isOpen:o,onBlur:u},a),({ref:e})=>n[0]({ref:e,openMenu:r}),n[1]))}function _(e,t){return Object.assign(Object.assign({},e),{opacity:1,pointerEvents:"all",visibility:t?"hidden":"visible"})}t.Menu=({children:e,className:t,refClassName:n,isOpen:a,onBlur:o,placement:l,modifiers:i,useVisibility:r})=>{l=null!=l?l:"bottom-end",r=null!=r&&r;const p=s.default.useRef(),h=a||r,g=!a&&r,b=Object.assign({preventOverflow:{boundariesElement:document.getElementById(f.default.config.rootId),padding:5}},i),v=()=>{o()},y=e=>{switch(e.key){case"ArrowDown":break;case"Escape":v();break;default:return}e.preventDefault(),e.stopPropagation()};return d.useDetectOutsideClick(p,v,[p]),c.useDetectTabOut([p],v),s.default.createElement("div",{ref:p,className:m.classList("menu__ref",n)},s.default.createElement(u.Manager,null,s.default.createElement(u.Reference,null,t=>e[0](t)),s.default.createElement(u.Popper,{placement:l,positionFixed:!0,modifiers:b},({ref:n,style:a,placement:o})=>h?s.default.createElement("div",{ref:n,className:"menu",style:_(a,g),"data-placement":o,onKeyDown:y},s.default.createElement("div",{className:"menu__container"+(t?" "+t:"")},e[1])):null)))},t.StatefulMenu=p,function(e){e.Context=s.default.createContext({openMenu:null,closeMenu:null})}(p=t.StatefulMenu||(t.StatefulMenu={})),t.MenuItem=({children:e,onClick:t,disabled:n,active:a,danger:o})=>{const l=m.bemClass("menu__item",{"--disabled":n,"--active":a,"--danger":!n&&o});return s.default.createElement(p.Context.Consumer,null,({closeMenu:o})=>s.default.createElement("div",{className:l},s.default.createElement("button",{onClick:()=>{o&&o(),!a&&!n&&t&&t()}},e)))},t.MenuContent=({children:e})=>e,t.MenuSeparator=()=>s.default.createElement("div",{className:"menu__separator"}),t.MenuStatic=({children:e})=>s.default.createElement("div",{className:"menu__static"},e),t.MenuHeading=({children:e})=>s.default.createElement("div",{className:"menu__heading"},e)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Spoiler=void 0;const o=a(n(0)),l=n(14),i=n(155);n(482);const r=n(11),s=n(101);t.Spoiler=o.default.forwardRef((function({label:e,className:t,isOpen:n,defaultOpen:a,showIcon:u,disabled:c,stealth:d,fitted:f,scrollOnOpen:m,hideOnly:p,onClick:_,children:h},g){p=null!=p&&p,u=null==u||u,c=null!=c&&c,m=null!=m&&m;const[b,v]=o.default.useState(!!a),y=void 0!==n;y||(n=b);const E=o.default.useRef(),S=()=>{c||(!n&&m&&s.scrollIntoView(E.current,{behavior:"smooth"}),y||v(!n),_&&_())},P=n&&void 0===_&&!u,w=P?void 0:0,O=P?void 0:"button",C=l.bemClass("spoiler",{"--open":n,"--disabled":c,"--fitted":f,"--stealth":d,"--static":P}),N=l.classList(C,t),M=n?"arrow-up-alt2":"arrow-down-alt2",k=Array.isArray(e)?e.map((e,t)=>o.default.createElement(o.default.Fragment,{key:t},e)):"string"==typeof e?o.default.createElement("span",null,e):e;return o.default.createElement("div",{ref:i.mergeRefs(E,g),className:N},o.default.createElement("div",{className:"spoiler__header",onClick:S,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||S()},role:O,tabIndex:w},o.default.createElement("div",{className:"spoiler__label"},k),u&&o.default.createElement(r.Dashicon,{icon:M,className:"spoiler__icon"})),(n||p)&&o.default.createElement("div",{className:"spoiler__content"},h))}))},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsSlice=t.Feed=void 0;const l=n(15),i=n(43),r=n(136),s=n(230);function u(e,t){t.id&&(t.options=s.createFeedOptions(t.options),i.Dictionary.set(e,t.id,t))}(t.Feed||(t.Feed={})).getLabel=function(e){var t;const n=null===(t=e.name)||void 0===t?void 0:t.trim();return(null==n?void 0:n.length)>0?n:"(no name)"},t.FeedsSlice=l.createSlice({name:"feeds",initialState:{},reducers:{},extraReducers:e=>e.addCase(r.loadFeeds.fulfilled,(e,t)=>{t.payload.forEach(t=>u(e,t))}).addCase(r.deleteFeed.fulfilled,(e,t)=>{i.Dictionary.remove(e,t.payload)}).addMatcher(l.isFulfilled(r.saveFeed,r.duplicateFeed),(e,t)=>{u(e,t.payload)})}),o(n(136),t)},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FieldRow=void 0;const o=a(n(0)),l=a(n(520)),i=a(n(238)),r=n(76),s=n(331),u=n(21);t.FieldRow=function({label:e,labelId:t,wide:n,centered:a,tooltip:c,disabled:d,isResponsive:f,proOnly:m,isPro:p,children:_}){p=null!=p?p:u.Common.isPro;const h=m&&!p,g=(d=d||h)?n?l.default.disabledWide:l.default.disabled:n?l.default.containerWide:l.default.container;return o.default.createElement("div",{className:g},e&&o.default.createElement("div",{className:a?l.default.labelCentered:l.default.labelNormal},o.default.createElement("div",{className:l.default.labelAligner},o.default.createElement("label",{htmlFor:t},e,c&&o.default.createElement(o.default.Fragment,null," ",o.default.createElement(i.default,null,c))))),o.default.createElement("div",{className:l.default.content},f&&o.default.createElement("div",{className:l.default.responsiveContainer},o.default.createElement(s.FeedEditorDeviceCycleButton,null),o.default.createElement("div",{className:l.default.responsiveField},_)),!f&&o.default.createElement("div",{className:a?l.default.fieldCentered:l.default.fieldNormal},_)),h&&o.default.createElement(r.ProPill,{className:l.default.proPill}))}},,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FieldSet=void 0;const l=o(n(0)),i=o(n(763)),r=n(14);t.FieldSet=function(e){var{className:t}=e,n=a(e,["className"]);return l.default.createElement("div",Object.assign({className:r.classList(i.default.root,t)},n))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LimitedMultiTextInput=void 0;const o=a(n(0)),l=n(827);t.LimitedMultiTextInput=function(e){const[t,n]=o.default.useState("");e.exclude&&0===e.exclude.length&&t.length>0&&n("");let a=void 0;if(t.length>0){const n="%s",l=e.excludeMsg.indexOf("%s"),i=e.excludeMsg.substring(0,l),r=e.excludeMsg.substring(l+n.length);a=o.default.createElement(o.default.Fragment,null,i,o.default.createElement("code",null,t),r)}const i=Object.assign(Object.assign({},e),{message:a,onChange:t=>{const a=e.exclude?t.findIndex(t=>e.exclude.includes(t)):-1;a>-1?n(t[a]):e.onChange(t)}});return o.default.createElement(l.MultiTextInput,Object.assign({},i))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsGroup=void 0;const o=a(n(0)),l=a(n(833));t.SettingsGroup=function({title:e,before:t,after:n,children:a}){return o.default.createElement("div",{className:l.default.root},e&&e.length>0&&o.default.createElement("h1",{className:l.default.title},e),t&&o.default.createElement("div",{className:l.default.beforeFields},t),a&&o.default.createElement("div",{className:l.default.fieldList},a),n&&o.default.createElement("div",{className:l.default.afterFields},n))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(323)),i=n(86),r=n(8);t.default=function({children:e,title:t,buttons:n,onAccept:a,onCancel:s,isOpen:u,okDisabled:c,cancelDisabled:d}){n=null!=n?n:["OK","Cancel"];const f=()=>s&&s();return o.default.createElement(i.Modal,{isOpen:u,title:t,onClose:f,className:l.default.root},o.default.createElement(i.Modal.Content,null,"string"==typeof e?o.default.createElement("p",null,e):e),o.default.createElement(i.Modal.Footer,null,o.default.createElement(r.Button,{className:l.default.button,type:r.ButtonType.SECONDARY,onClick:f,disabled:d},n[1]),o.default.createElement(r.Button,{className:l.default.button,type:r.ButtonType.PRIMARY,onClick:()=>a&&a(),disabled:c},n[0])))}},,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Sidebar=void 0;const l=o(n(0)),i=o(n(850));function r(e){var{children:t,padded:n,disabled:o}=e,r=a(e,["children","padded","disabled"]);return l.default.createElement("div",Object.assign({className:o?i.default.disabled:i.default.sidebar},r),l.default.createElement("div",{className:n?i.default.paddedContent:i.default.content},null!=t?t:null))}t.Sidebar=r,function(e){e.padded=i.default.padded}(r=t.Sidebar||(t.Sidebar={}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpotlightNavbarLogo=void 0;const o=a(n(0)),l=a(n(886)),i=n(316);function r({children:e}){const t=Array.isArray(e)?e:[e];return o.default.createElement(o.default.Fragment,null,t.map((e,t)=>o.default.createElement(s,{key:t},e)))}function s({children:e}){return o.default.createElement("div",{className:l.default.item},e)}function u({children:e,style:t}){return o.default.createElement("div",{className:l.default.pathSegment},e,o.default.createElement(c,{style:t}))}function c({style:e}){if("none"===e)return null;const t="chevron"===e?"M0 0 L100 50 L0 100":"M50 0 L50 100";return o.default.createElement("div",{className:l.default.separator},o.default.createElement("svg",{viewBox:"0 0 100 100",width:"100%",height:"100%",preserveAspectRatio:"none"},o.default.createElement("path",{d:t,fill:"none",stroke:"currentcolor",strokeLinejoin:"bevel"})))}t.default=function({children:e,pathStyle:t}){let{path:n,left:a,right:i,center:s}=e;return n=null!=n?n:[],a=null!=a?a:[],i=null!=i?i:[],s=null!=s?s:[],o.default.createElement("div",{className:l.default.root},o.default.createElement("div",{className:l.default.leftList},o.default.createElement("div",{className:l.default.pathList},n.map((e,n)=>o.default.createElement(u,{key:n,style:t},o.default.createElement("div",{className:l.default.item},e)))),o.default.createElement("div",{className:l.default.leftList},o.default.createElement(r,null,a))),o.default.createElement("div",{className:l.default.centerList},o.default.createElement(r,null,s)),o.default.createElement("div",{className:l.default.rightList},o.default.createElement(r,null,i)))},t.SpotlightNavbarLogo=function(){return o.default.createElement(i.SpotlightLogo,null)}},,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AccountManager=void 0;const o=n(29),l=n(173),i=n(42),r=n(92),s=n(31),u=n(62);!function(e){let t=null,n=null;function c(t,n,o){return a(this,void 0,void 0,(function*(){o&&o(e.State.connectedId),yield new Promise(o=>{setTimeout(()=>a(this,void 0,void 0,(function*(){yield t.dispatch(r.loadAccounts());const n=s.selectAccountById(e.State.connectedId)(t.getState()),a=new d(e.ACCOUNT_CONNECTED_EVENT,n);document.dispatchEvent(a),o()})),n)})}))}e.State=window.SliAccountManagerState={accessToken:null,connectSuccess:!1,connectedId:null},e.manualConnectPersonal=function(t,n,o=0,l){return a(this,void 0,void 0,(function*(){e.State.connectSuccess=!1;const a=yield u.AdminRestApi.accounts.connect(n);return e.State.connectSuccess=!0,e.State.connectedId=a.data.accountId,yield c(t,o,l),e.State.connectedId}))},e.manualConnectBusiness=function(t,n,o,l=0,i){return a(this,void 0,void 0,(function*(){e.State.connectSuccess=!1;const a=yield u.AdminRestApi.accounts.connect(n,o);return e.State.connectSuccess=!0,e.State.connectedId=a.data.accountId,yield c(t,l,i),e.State.connectedId}))},e.openAuthWindow=function(r,s,u=0,d){return new Promise((f,m)=>{if(e.State.connectedId=null,null==t||t.closed){const e=l.getWindowCenterBounds(700,800),n=s===o.Account.Type.PERSONAL?i.AdminCommonConfig.restApi.personalAuthUrl:i.AdminCommonConfig.restApi.businessAuthUrl;t=l.openWindow(n,"_blank",Object.assign({dependent:"yes",resizable:"yes",toolbar:"no",location:"no",scrollbars:"no"},e))}else t.focus();null==t||t.closed||(n=setInterval(()=>a(this,void 0,void 0,(function*(){t&&!t.closed||(clearInterval(n),null!==e.State.connectedId?(yield c(r,u,d),f(e.State.connectedId)):m&&m())})),500))})},e.ACCOUNT_CONNECTED_EVENT="sli/account/connected";class d extends CustomEvent{constructor(e,t){super(e,{detail:{account:t}})}}e.AccountConnectedEvent=d}(t.AccountManager||(t.AccountManager={}))},,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Link=void 0;const l=o(n(0)),i=n(1),r=n(63),s=n(52);t.Link=function(e){var{to:t,onClick:n,newTab:o,absolute:u}=e,c=a(e,["to","onClick","newTab","absolute"]);const d=i.useDispatch(),f=i.useSelector(r.selectRoute),m=u?f.setQuery(t):f.withQuery(t);return l.default.createElement("a",Object.assign({href:m,onClick:e=>{if(o||2===e.button)window.open(m,"_blank");else{const e=u?s.gotoRoute(t):s.modifyRoute(t);d(e)}e.preventDefault(),e.stopPropagation()}},c))}},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SaveButton=void 0;const o=a(n(830)),l=a(n(0)),i=n(8),r=n(14);t.SaveButton=function({className:e,content:t,tooltip:n,onClick:a,disabled:s,isSaving:u}){return t=null!=t?t:e=>e?"Saving ...":"Save",n=null!=n?n:"Save",l.default.createElement(i.Button,{className:r.classList(o.default.root,e),type:i.ButtonType.PRIMARY,size:i.ButtonSize.LARGE,tooltip:n,onClick:()=>a&&a(),disabled:s},u&&l.default.createElement("div",{className:o.default.savingOverlay}),t(u))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MultiHashtagInput=void 0;const o=a(n(0)),l=n(146),i=n(840),r=n(224);t.MultiHashtagInput=function(e){var t;const n="string"==typeof e.value?[e.value]:null!==(t=e.value)&&void 0!==t?t:[],a=Object.assign(Object.assign({},e),{value:n.map(e=>i.prefix(e,"#")),sanitize:r.sanitizeHashtag});return o.default.createElement(l.LimitedMultiTextInput,Object.assign({},a))}},,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.loadTemplates=void 0;const o=n(15),l=n(56);t.loadTemplates=o.createAsyncThunk("templates/load",()=>a(void 0,void 0,void 0,(function*(){var e;const t=yield l.RestApi.templates.get();return null!==(e=null==t?void 0:t.data)&&void 0!==e?e:[]})))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccountsSlice=void 0;const a=n(43),o=n(29),l=n(15),i=n(92);t.AccountsSlice=l.createSlice({name:"accounts",initialState:{},reducers:{},extraReducers:e=>e.addCase(i.updateAccount.fulfilled,(e,t)=>{const n=t.payload;a.Dictionary.set(e,n.id,n)}).addMatcher(l.isFulfilled(i.loadAccounts,i.deleteAccount),(e,t)=>{const n=t.payload.slice().sort((e,t)=>e.type===t.type?0:e.type===o.Account.Type.PERSONAL?-1:1);a.Dictionary.clear(e),n.forEach(t=>{a.Dictionary.set(e,t.id,t)})})})},,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPath=t.getRouteAbsUrl=t.getRouteRelUrl=t.routeWithoutParam=t.routeWithQuery=t.routeSetQuery=t.getRouteParam=t.getRoutePath=void 0;const a=n(104),o=n(74),l=n(25),i=n(300);function r(e,t){return s(e,l.withPartial({page:e.query.page},t))}function s(e,t){return e.pathName+"?"+a.stringify(function(e){const t=o.cloneObj(e);return Object.getOwnPropertyNames(e).forEach(n=>{e[n]&&0===e[n].length&&delete t[n]}),t}(t))}t.getRoutePath=function(e){return s(e,e.query)},t.getRouteParam=function(e,t){return i.extractFromArray(e.query[t])},t.routeSetQuery=function(e,t){return s(e,l.withPartial(t,{page:e.query.page}))},t.routeWithQuery=function(e,t){return s(e,l.withPartial(e.query,t))},t.routeWithoutParam=function(e,t){const n=o.cloneObj(e.query);return delete n[t],s(e,n)},t.getRouteRelUrl=r,t.getRouteAbsUrl=function(e,t){return e.baseUrl+r(e,t)},t.createPath=s},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=l(n(0)),s=i(n(469)),u=n(285),c=i(n(42)),d=n(14);function f(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}}t.default=function({visible:e,delay:t,placement:n,theme:a,children:o}){a=null!=a?a:{},n=n||"bottom";const[l,i]=r.default.useState(!1),m={preventOverflow:{boundariesElement:document.getElementById(c.default.config.rootId),padding:5}};r.useEffect(()=>{const n=setTimeout(()=>i(e),e?t:1);return()=>clearTimeout(n)},[e]);const p=f("container",n),_=f("arrow",n),h=d.classList(s.default[p],a.container,a[p]),g=d.classList(s.default[_],a.arrow,a[_]);return r.default.createElement(u.Manager,null,r.default.createElement(u.Reference,null,e=>o[0](e)),r.default.createElement(u.Popper,{placement:n,modifiers:m,positionFixed:!0},({ref:e,style:t,placement:n,arrowProps:i})=>l?r.default.createElement("div",{ref:e,className:d.classList(s.default.root,a.root),style:t,tabIndex:-1},r.default.createElement("div",{className:h,"data-placement":n},r.default.createElement("div",{className:d.classList(s.default.content,a.content)},o[1]),r.default.createElement("div",{className:g,ref:i.ref,style:i.style,"data-placement":n}))):null))}},function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(473)),r=n(29),s=n(14);t.default=function(e){var{account:t,square:n,className:o}=e,u=a(e,["account","square","className"]);const c=r.Account.getProfilePicUrl(t),d=s.classList(n?i.default.square:i.default.round,o);return l.default.createElement("img",Object.assign({},u,{className:d,src:r.Account.DefaultProfilePic,srcSet:c+" 1x",alt:t.username+" profile picture"}))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(86),i=a(n(480));t.default=function({accountId:e,isOpen:t,onClose:n,onUpdate:a}){return o.default.createElement(l.Modal,{isOpen:t&&!!e,title:"Account details",icon:"admin-users",onClose:n},o.default.createElement(l.Modal.Content,null,e&&o.default.createElement(i.default,{accountId:e,onUpdate:a})))}},,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Onboarding=void 0;const l=o(n(0)),i=n(14),r=n(8);n(491);const s=n(11);function u(e){var{className:t,children:n,fullWidth:o,isTransitioning:r}=e,s=a(e,["className","children","fullWidth","isTransitioning"]);const u=i.bemClass("onboarding",{"--full-width":o,"--transitioning":r});return l.default.createElement("div",Object.assign({className:i.classList(u,t)},s),n)}t.Onboarding=u,function(e){e.TRANSITION_DURATION=200,e.Thin=e=>{var{className:t,children:n}=e,o=a(e,["className","children"]);return l.default.createElement("div",Object.assign({className:i.classList("onboarding__thin",t)},o),n)},e.HelpMsg=e=>{var{className:t,children:n}=e,o=a(e,["className","children"]);return l.default.createElement("div",Object.assign({className:i.classList("onboarding__help-msg",t)},o),n)},e.ProTip=({children:t})=>l.default.createElement(e.HelpMsg,null,l.default.createElement("div",{className:"onboarding__pro-tip"},l.default.createElement("span",null,l.default.createElement(s.Dashicon,{icon:"lightbulb"}),l.default.createElement("strong",null,"Pro tip!")),t)),e.StepList=e=>{var{className:t,children:n}=e,o=a(e,["className","children"]);return l.default.createElement("ul",Object.assign({className:i.classList("onboarding__steps",t)},o),n)},e.Step=e=>{var{isDone:t,num:n,className:o,children:r}=e,s=a(e,["isDone","num","className","children"]);return l.default.createElement("li",Object.assign({className:i.classList(t?"onboarding__done":null,o)},s),l.default.createElement("strong",null,"Step ",n,":")," ",r)},e.HeroButton=e=>{var t,{className:n,children:o}=e,s=a(e,["className","children"]);return l.default.createElement(r.Button,Object.assign({type:null!==(t=s.type)&&void 0!==t?t:r.ButtonType.PRIMARY,size:r.ButtonSize.HERO,className:i.classList("onboarding__hero-button",n)},s),o)}}(u=t.Onboarding||(t.Onboarding={}))},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedTemplatePicker=void 0;const r=l(n(0)),s=i(n(492)),u=n(1),c=n(21),d=n(493),f=n(11),m=n(227),p=n(228),_=n(312),h=n(222),g=n(76),b=n(45);function v({template:e,isCurrent:t,onClick:n,onLoadImage:a}){const o=e.isPro&&!c.Common.isPro,l=o?s.default.templatePro:s.default.template;return r.default.createElement("div",{className:s.default.tile},r.default.createElement(h.DivButton,{className:l,onClick:n},r.default.createElement("img",{className:s.default.templateThumbnail,src:e.thumbnail,alt:"",onLoad:a}),r.default.createElement("div",{className:s.default.templateLabel},r.default.createElement("span",{className:s.default.templateName},e.name)),o&&r.default.createElement(r.default.Fragment,null,r.default.createElement("a",{className:s.default.proOverlay,href:b.AdminResources.upgradeUrl,target:"_blank"},r.default.createElement("div",{className:s.default.upgradeButton},"Upgrade to PRO")),r.default.createElement("div",{className:s.default.proPill},r.default.createElement(g.ProPill,null))),t&&r.default.createElement("span",{className:s.default.currentIndicator},"Current")))}function y({onClick:e}){return r.default.createElement(d.Square,{className:s.default.tile},r.default.createElement(h.DivButton,{className:s.default.customTemplate,onClick:e},r.default.createElement("div",{className:s.default.customTemplateIcon},r.default.createElement(f.Dashicon,{icon:"plus-alt"}),r.default.createElement("span",{className:s.default.customTemplateText},"Design your own"))))}t.FeedTemplatePicker=function({showCustomOption:e,value:t,onChange:n}){const a=u.useSelector(p.selectTemplates),o=r.useRef(),[l,i]=r.useState(3),d=r.useCallback(()=>{var e;const t=null===(e=null==o?void 0:o.current)||void 0===e?void 0:e.getBoundingClientRect();t&&i(function(e){const t=(e-40*(e/120-1))/3;return t<120?1:t<150?2:3}(t.width))},[o]);r.useLayoutEffect(()=>d(),[d]),m.useWindowSize(()=>d(),[d],!0);const f=r.useCallback(e=>{(null==e?void 0:e.isPro)&&!c.Common.isPro||n(null===(null==e?void 0:e.id)?null:e)},[n]);let h=a.map(e=>r.default.createElement(v,{key:e.id,template:e,isCurrent:e.id===t,onClick:()=>f(e),onLoadImage:d}));return e&&(h=[r.default.createElement(y,{key:"custom",onClick:()=>f(null)})].concat(h)),r.default.createElement("div",{className:s.default.root,ref:o},r.default.createElement(_.MasonryLayout,{columns:l,gap:40},h))}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectTemplateById=t.selectTemplates=void 0,t.selectTemplates=e=>e.templates.models,t.selectTemplateById=e=>t=>t.templates.models.find(t=>t.id===e)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ProUpgradeBtn=void 0;const o=a(n(0)),l=a(n(499)),i=n(45);t.ProUpgradeBtn=function({url:e,children:t}){return o.default.createElement("a",{className:l.default.root,href:null!=e?e:i.AdminResources.pricingUrl,target:"_blank"},null!=t?t:"Free 14-day PRO trial")}},,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(512)),i=n(8),r=n(11),s=a(n(513));t.default=function({children:e,onConnect:t,beforeConnect:n}){const[a,u]=o.default.useState(!1);return o.default.createElement(o.default.Fragment,null,o.default.createElement(i.Button,{className:l.default.root,size:i.ButtonSize.HERO,type:i.ButtonType.SECONDARY,onClick:()=>u(!0)},o.default.createElement(r.Dashicon,{icon:"instagram"}),null!=e?e:o.default.createElement("span",null,"Connect more Instagram accounts")),o.default.createElement(s.default,{isOpen:a,onClose:()=>{u(!1)},onConnect:t,beforeConnect:n}))}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Capability=void 0;const i=l(n(0)),r=n(1),s=l(n(514)),u=n(172),c=n(29),d=n(86),f=n(8),m=n(11),p=l(n(515)),_=n(95),h=n(20),g=n(45),b=n(139);function v(){return i.default.createElement("div",{className:s.default.orSeparator},i.default.createElement("div",{className:s.default.orLine}),i.default.createElement("span",{className:s.default.orText},"OR"),i.default.createElement("div",{className:s.default.orLine}))}t.default=function({onConnect:e,beforeConnect:n,useColumns:o,showPrompt:l,showCapabilities:y}){const E=r.useStore();l=null==l||l,y=null==y||y,e=null!=e?e:_.fn.noop;const S=e=>{b.triggerError({type:"account/connect/fail",message:h.getErrorResponseMessage(e)})},P=e=>{u.AccountManager.State.connectSuccess&&n&&n(e)};return i.default.createElement("div",{className:o?s.default.vertical:s.default.horizontal},l&&i.default.createElement("p",{className:s.default.promptMsg},"Choose the type of account to connect:"),i.default.createElement("div",{className:s.default.types},i.default.createElement("div",{className:s.default.type},i.default.createElement(f.Button,{type:f.ButtonType.PRIMARY,size:f.ButtonSize.HERO,onClick:()=>a(this,void 0,void 0,(function*(){try{const t=yield u.AccountManager.openAuthWindow(E,c.Account.Type.PERSONAL,d.Modal.ANIMATION_DELAY,P);e(t)}catch(e){}}))},"Personal account"),y&&i.default.createElement("div",{className:s.default.capabilities},i.default.createElement(t.Capability,null,"Connects directly through Instagram"),i.default.createElement(t.Capability,null,"Show posts from your account"))),o&&i.default.createElement(v,null),i.default.createElement("div",{className:s.default.type},i.default.createElement(f.Button,{type:f.ButtonType.SECONDARY,size:f.ButtonSize.HERO,onClick:()=>a(this,void 0,void 0,(function*(){try{const t=yield u.AccountManager.openAuthWindow(E,c.Account.Type.BUSINESS,d.Modal.ANIMATION_DELAY,P);e(t)}catch(e){}}))},"Business account"),y&&i.default.createElement("div",{className:s.default.capabilities},i.default.createElement(t.Capability,null,"Connects through your Facebook page"),i.default.createElement(t.Capability,null,"Show posts from your account"),i.default.createElement(t.Capability,null,"Show posts where you are tagged"),i.default.createElement(t.Capability,null,"Show posts with a specific hashtag from all across Instagram")),i.default.createElement("div",{className:s.default.businessLearnMore},i.default.createElement(m.Dashicon,{icon:"editor-help"}),i.default.createElement("a",{href:g.AdminResources.businessAccounts,target:"_blank"},"Switch to a Business account for free")))),i.default.createElement(v,null),i.default.createElement("div",{className:l?s.default.connectAccessToken:null},(o||l)&&i.default.createElement("p",{className:s.default.promptMsg},"Connect without a login:"),i.default.createElement(p.default,{isColumn:o,onConnectPersonal:t=>a(this,void 0,void 0,(function*(){try{const n=yield u.AccountManager.manualConnectPersonal(E,t,d.Modal.ANIMATION_DELAY,P);e(n)}catch(e){S(e)}})),onConnectBusiness:(t,n)=>a(this,void 0,void 0,(function*(){try{const a=yield u.AccountManager.manualConnectBusiness(E,t,n,d.Modal.ANIMATION_DELAY,P);e(a)}catch(e){S(e)}}))})))},t.Capability=e=>{var{children:t}=e,n=o(e,["children"]);return i.default.createElement("div",Object.assign({className:s.default.capability},n),i.default.createElement(m.Dashicon,{icon:"yes"}),i.default.createElement("div",null,t))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Row=t.AccountSelector=void 0;const o=a(n(0)),l=a(n(519)),i=n(29),r=n(11),s=n(178);function u({account:e,selected:t,singleMode:n,disabled:a,onChange:u}){const c=`url("${i.Account.getProfilePicUrl(e)}")`,d=()=>{!a&&u(!t)},f=s.useKeyboardActivate(d),m=a?t?l.default.accountSelectedDisabled:l.default.accountDisabled:t?l.default.accountSelected:l.default.account;return o.default.createElement("div",{className:l.default.row},o.default.createElement("div",{className:m,onClick:d,onKeyPress:f,role:"button",tabIndex:0},o.default.createElement("div",{className:l.default.profilePic,style:{backgroundImage:c}}),o.default.createElement("div",{className:l.default.infoColumn},o.default.createElement("div",{className:l.default.username},e.username),o.default.createElement("div",{className:l.default.accountType},e.type)),t&&!n&&o.default.createElement(r.Dashicon,{icon:"yes-alt",className:l.default.tickIcon})))}t.AccountSelector=function({accounts:e,value:t,onChange:n,singleMode:a,disabled:i}){const r=(t=null!=t?t:[]).filter(t=>e.some(e=>e.id===t)),s=new Set(r),c=o.default.useCallback((e,t)=>{i||(t?(a&&s.clear(),s.add(e)):a||s.delete(e),n(Array.from(s)))},[i,s,n]);return o.default.createElement("div",{className:l.default.root},e.map((e,t)=>o.default.createElement(u,{key:t,account:e,selected:s.has(e.id),onChange:t=>c(e.id,t),singleMode:a,disabled:i})))},t.Row=u},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(521)),i=n(11),r=a(n(218));t.default=function({maxWidth:e,children:t}){e=null!=e?e:300;const[n,a]=o.default.useState(!1),s=()=>a(!0),u=()=>a(!1),c={content:l.default.tooltipContent,container:l.default.tooltipContainer};return o.default.createElement("div",{className:l.default.root},o.default.createElement(r.default,{visible:n,theme:c},({ref:e})=>o.default.createElement("span",{ref:e,className:l.default.icon,style:{opacity:n?1:.7},onMouseEnter:s,onMouseLeave:u},o.default.createElement(i.Dashicon,{icon:"info"})),o.default.createElement("div",{style:{maxWidth:e+"px"}},t)))}},,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ButtonDesignFields=void 0;const i=l(n(0)),r=n(799),s=n(8),u=n(234),c=n(58),d=n(25),f=n(141),m=n(800),p=n(142);function _({id:e,value:t,onChange:n,disabled:a,show:o}){var l,_,h,g;const[b,v]=i.useState(u.ButtonDesign.DEFAULT);t=null!=t?t:b,n=null!=n?n:v;const[y,E]=i.useState(!1),S=null!==(l=t.border)&&void 0!==l?l:{},P=u.ButtonDesign.getFullState(t,y),w=null!==(_=P.bgColor)&&void 0!==_?_:f.Color.WHITE,O=null!==(g=(null!==(h=P.text)&&void 0!==h?h:{}).color)&&void 0!==g?g:f.Color.BLACK;return i.default.createElement(i.default.Fragment,null,o.states&&i.default.createElement(p.FieldRow,{disabled:a,wide:!0,centered:!0},i.default.createElement(r.ButtonGroup,{wide:!0},i.default.createElement(s.Button,{type:s.ButtonType.TOGGLE,active:!y,onClick:()=>E(!1)},"Normal"),i.default.createElement(s.Button,{type:s.ButtonType.TOGGLE,active:y,onClick:()=>E(!0)},"Hover"))),o.textColor&&i.default.createElement(p.FieldRow,{label:"Text color",labelId:e+"-color",disabled:a},i.default.createElement(c.ColorPicker,{id:e+"-color",value:O,onChange:e=>{const a=u.ButtonDesign.withState(t,y,t=>{var n;return t.text=null!==(n=t.text)&&void 0!==n?n:{},t.text.color=e.rgb,t});n(a)}})),o.bgColor&&i.default.createElement(p.FieldRow,{label:"Background color",labelId:e+"-bg",disabled:a},i.default.createElement(c.ColorPicker,{id:e+"-bg",value:w,onChange:e=>{const a=u.ButtonDesign.withState(t,y,t=>(t.bgColor=e.rgb,t));n(a)}})),i.default.createElement("hr",null),o.border&&i.default.createElement(m.BorderDesignFields,{design:S,onChange:e=>{n(d.withPartial(t,{border:e}))},show:o.border,labels:!0}))}_.defaultProps={id:"",value:null,onChange:null,disabled:!1,show:{}},t.ButtonDesignFields=_},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TextField=void 0;const o=a(n(0));t.TextField=function({id:e,value:t,onChange:n,placeholder:a}){return o.default.createElement("input",{id:e,type:"text",value:t,onChange:e=>n(e.target.value),placeholder:a})}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsPage=void 0;const o=a(n(0)),l=a(n(831)),i=n(1),r=n(69),s=n(126);t.SettingsPage=function({before:e,after:t,children:n}){const a=i.useDispatch();return r.useDocumentEventListener("keydown",e=>{e.key&&"s"===e.key.toLowerCase()&&e.ctrlKey&&(a(s.saveSettings()),e.preventDefault(),e.stopPropagation())},[],[a]),o.default.createElement("article",{className:l.default.root},e&&o.default.createElement("div",{className:l.default.beforeGroups},e),n&&o.default.createElement("div",{className:l.default.groupList},n),t&&o.default.createElement("div",{className:l.default.afterGroups},t))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ResponsiveContainer=t.ResponsiveContext=void 0;const o=a(n(0)),l=n(227);t.ResponsiveContext=o.default.createContext(0),t.ResponsiveContainer=function({breakpoints:e,render:n,children:a}){const[i,r]=o.default.useState(null),s=o.default.useCallback(t=>{r(()=>e.reduce((e,n)=>t.width<=n&&n<e?n:e,1/0))},[e]);l.useWindowSize(s,[r],!0);const u=n?n(i):a;return o.default.createElement(t.ResponsiveContext.Provider,{value:i},null!==i?u:null)}},,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminSettings=void 0;const o=a(n(980)),l=n(986),i=n(997);t.AdminSettings=[{id:"accounts",title:"Accounts",component:o.default},{id:"config",title:"Configuration",component:l.SettingsConfigTab},{id:"tools",title:"Tools",component:i.SettingsToolsTab}]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplatesSlice=t.TemplatesInitialState=void 0;const a=n(15),o=n(204);t.TemplatesInitialState={models:[],isLoaded:!1},t.TemplatesSlice=a.createSlice({name:"templates",initialState:t.TemplatesInitialState,reducers:{},extraReducers:e=>e.addCase(o.loadTemplates.fulfilled,(e,t)=>{e.models=t.payload,e.isLoaded=!0})})},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminScreen=void 0;const i=l(n(0)),r=n(1),s=n(14),u=n(172),c=n(31),d=n(62),f={initialized:!1,list:[]};function m(){const e=Array.from(document.querySelectorAll(".sli-notice")),t=Array.from(document.querySelectorAll(".fs-notice.fs-slug-spotlight-social-photo-feeds"));f.list=e.concat(t),f.initialized=!0}t.AdminScreen=function({navbar:e,className:t,fillPage:n,children:a}){const o=r.useStore(),l=i.default.useRef(null);i.useEffect(()=>{l.current&&(f.initialized||m(),f.list.forEach(e=>{e.remove(),l.current.appendChild(e)}))},[]),i.useLayoutEffect(()=>{const e=new MutationObserver(e=>{for(const t of e)"childList"===t.type&&t.removedNodes.length>0&&m()});return e.observe(l.current,{childList:!0}),()=>e.disconnect()});const p=r.useSelector(c.selectExpiringAccounts),_=s.bemClass("admin-screen",{"--fill-page":n})+(t?" "+t:"");return i.default.createElement("div",{className:_},e&&i.default.createElement("div",{className:"admin-screen__navbar"},i.default.createElement(e)),i.default.createElement("div",{className:"admin-screen__content"},i.default.createElement("div",{className:"admin-screen__notices",ref:l},p.map(e=>i.default.createElement("div",{key:e.id,className:"notice notice-warning"},i.default.createElement("p",null,"The access token for the ",i.default.createElement("b",null,"@",e.username)," account is about to expire."," ",i.default.createElement("a",{className:"admin-screen__reconnect",onClick:t=>function(e,t){u.AccountManager.openAuthWindow(o,t.type,0,()=>{d.AdminRestApi.media.deleteForAccount(t.id)}),e.preventDefault()}(t,e)},"Re-connect the account")," ","to keep using it in Spotlight.")))),a))}},,,,function(e,t,n){},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(14),i=a(n(472));function r({idx:e,row:t,cols:n,styleMap:a}){return o.default.createElement("tr",{className:i.default.row},n.map(n=>o.default.createElement("td",{key:n.id,className:l.classList(i.default.cell,u(n),a.cells[n.id])},n.render(t,e))))}function s({cols:e,styleMap:t}){return o.default.createElement("tr",null,e.map(e=>{const n=l.classList(i.default.colHeading,u(e),t.cols[e.id]);return o.default.createElement("th",{key:e.id,className:n},e.label)}))}function u(e){return"center"===e.align?i.default.alignCenter:"right"===e.align?i.default.alignRight:i.default.alignLeft}t.default=function({className:e,cols:t,rows:n,footerCols:a,styleMap:u}){return u=null!=u?u:{cols:{},cells:{}},o.default.createElement("table",{className:l.classList(i.default.table,e)},o.default.createElement("thead",{className:i.default.header},o.default.createElement(s,{cols:t,styleMap:u})),o.default.createElement("tbody",null,n.map((e,n)=>o.default.createElement(r,{key:n,idx:n,row:e,cols:t,styleMap:u}))),a&&o.default.createElement("tfoot",{className:i.default.footer},o.default.createElement(s,{cols:t,styleMap:u})))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Ellipsis=void 0;const o=a(n(0));t.Ellipsis=()=>o.default.createElement("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-ellipsis",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},o.default.createElement("path",{d:"M5 10c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm12-2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-7 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CopyShortcode=void 0;const o=a(n(0)),l=a(n(307)),i=n(1),r=n(75);t.CopyShortcode=({feed:e,onCopy:t,children:n})=>{const a=i.useDispatch();return o.default.createElement(l.default,{text:`[instagram feed="${e.id}"]`,onCopy:()=>{a(r.showToast({key:"feeds/shortcode/copied",message:"Copied shortcode to clipboard."})),t&&t()}},n)}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WpUploadMedia=void 0;const o=a(n(0)),l=a(n(309)),i=n(108);t.WpUploadMedia=({id:e,value:t,title:n,button:a,mediaType:r,multiple:s,children:u,onOpen:c,onClose:d,onSelect:f})=>{e=null!=e?e:"wp-media-"+i.uniqueNum(),r=null!=r?r:"image",a=null!=a?a:"Select";const m=o.default.useRef();m.current||(m.current=l.default.media({id:e,title:n,library:{type:r},button:{text:a},multiple:s}));const p=()=>{const e=m.current.state().get("selection").first();f&&f(e)};return d&&m.current.on("close",d),m.current.on("open",()=>{if(t){const e="object"==typeof t?t:l.default.media.attachment(t);e.fetch(),m.current.state().get("selection").add(e?[e]:[])}c&&c()}),m.current.on("insert",p),m.current.on("select",p),u({open:()=>m.current.open()})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=wp},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsOnboarding=void 0;const o=a(n(0)),l=a(n(490)),i=n(225),r=n(226);t.FeedsOnboarding=function({showSteps:e,onSelectTemplate:t}){const[n,a]=o.default.useState(!1);return o.default.createElement("div",{className:n?l.default.rootTransitioning:l.default.root},o.default.createElement("div",{className:l.default.left},o.default.createElement("h1",{style:{fontWeight:"normal",lineHeight:"1.2em"}},"Pick a template to ",o.default.createElement("b",null,"get started!")),o.default.createElement(i.Onboarding.Thin,null,o.default.createElement("p",null,"Design your own Instagram feed or choose one of our beautiful pre-made templates."),o.default.createElement("p",null,"The templates are all fully customisable so you can design them to match your style."),e&&o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,"Once you've picked a template:"),o.default.createElement(i.Onboarding.StepList,null,o.default.createElement(i.Onboarding.Step,{num:1},o.default.createElement("span",null,"Connect your Instagram Account")),o.default.createElement(i.Onboarding.Step,{num:2},o.default.createElement("span",null,"Customize your feed")),o.default.createElement(i.Onboarding.Step,{num:3},o.default.createElement("span",null,"Embed it on your site")))),o.default.createElement("p",null,"Choose a template to get started."))),o.default.createElement("div",{className:l.default.right},o.default.createElement("div",{className:l.default.scrollPadding},o.default.createElement(r.FeedTemplatePicker,{onChange:function(e){a(!0),t(e)},showCustomOption:!0}))))}},,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(315),i=n(229),r=n(84),s=n(21),u=n(1),c=n(63),d=n(45),f={display:"flex",flexDirection:"column",justifyContent:"center",marginRight:25},m={textDecoration:"none"};t.default=function({right:e,chevron:t,children:n}){var a,p;const _=u.useSelector(c.selectScreen),h=o.default.createElement(l.Navbar.Item,null,null!==(p=null===(a=r.Screens.getScreen(_))||void 0===a?void 0:a.title)&&void 0!==p?p:"");return o.default.createElement(l.Navbar,null,o.default.createElement(o.default.Fragment,null,h,t&&o.default.createElement(l.Navbar.Chevron,null),n),e?o.default.createElement(e):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{style:f},o.default.createElement("a",{href:d.AdminResources.supportNavbarUrl,target:"_blank",style:m},o.default.createElement("span",null,"Need help?"))),!s.Common.isPro&&o.default.createElement(i.ProUpgradeBtn,{url:d.AdminResources.upgradeNavbarUrl})))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Navbar=void 0;const o=a(n(0)),l=a(n(497)),i=n(175),r=n(14),s=n(76),u=n(316);function c({children:e}){return o.default.createElement("div",{className:l.default.root},o.default.createElement(c.Item,null,o.default.createElement(u.SpotlightLogo,null)),o.default.createElement(c.Chevron,null),o.default.createElement("div",{className:l.default.leftContainer},e[0]),e[1]&&o.default.createElement("div",{className:l.default.rightContainer},e[1]))}t.Navbar=c,function(e){e.Item=({children:e})=>o.default.createElement("div",{className:l.default.item},e),e.Link=({linkTo:t,onClick:n,isCurrent:a,isDisabled:s,children:u})=>{const c=r.classMap({[l.default.link]:!0,[l.default.current]:a,[l.default.disabled]:s}),d=e=>{"Enter"!==e.key&&" "!==e.key||e.currentTarget.click()},f=s?-1:0;return o.default.createElement(e.Item,null,t?o.default.createElement(i.Link,{to:t,className:c,role:"button",onKeyPress:d,tabIndex:f},u):o.default.createElement("div",{className:c,role:"button",onClick:()=>!s&&n&&n(),onKeyPress:d,tabIndex:f},u))},e.ProPill=()=>o.default.createElement("div",{className:l.default.proPill},o.default.createElement(s.ProPill,null)),e.Chevron=()=>o.default.createElement("div",{className:l.default.chevron},o.default.createElement("svg",{viewBox:"0 0 100 100",width:"100%",height:"100%",preserveAspectRatio:"none"},o.default.createElement("path",{d:"M0 0 L100 50 L0 100",fill:"none",stroke:"currentcolor",strokeLinejoin:"bevel"})))}(c=t.Navbar||(t.Navbar={}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpotlightLogo=void 0;const o=a(n(0)),l=a(n(498)),i=n(21),r=n(317);t.SpotlightLogo=function(){return o.default.createElement("div",{className:l.default.logo},o.default.createElement("img",Object.assign({className:l.default.logoImage,src:i.Common.image("spotlight-favicon.png"),alt:"Spotlight"},r.noDrag)))}},,,,,,,function(e,t,n){e.exports={root:"ModalPrompt__root",button:"ModalPrompt__button"}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminEditor=void 0;const l=o(n(0)),i=n(1),r=n(21),s=n(84),u=n(325),c=n(140),d=n(52),f=n(181),m=n(924),p=f.FeedEditorDefaultConfig.tabs.slice();p.push({id:"embed",label:"Embed",requireSources:!0,sidebar:m.EmbedSidebar}),t.AdminEditor=function({feed:e,keepState:t}){const n=i.useDispatch(),o=null===e.id,f=l.default.useCallback(e=>a(this,void 0,void 0,(function*(){const t=yield n(c.saveFeed(e));o&&t.payload.id&&setTimeout(()=>{n(d.gotoRoute({screen:s.SCREENS.EDIT_FEED,id:t.payload.id}))},10)})),[o]),m=l.default.useCallback(()=>{n(d.gotoScreen(s.SCREENS.FEED_LIST))},[]);return l.default.createElement(u.CommonEditor,{feed:e,isPro:r.Common.isPro,onSave:f,onCancel:m,keepState:t,tabs:p,useCtrlS:!0,confirmOnCancel:!0})}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CommonEditor=t.LEAVE_MESSAGE=void 0;const s=l(n(0)),u=n(1),c=n(69),d=n(326),f=n(26),m=n(25),p=n(922),_=n(21),h=n(52),g=r(n(42));function b(e){return s.default.createElement(p.WpMediaField,Object.assign({},e,{title:"Select custom profile photo",buttonSet:"Choose custom photo",buttonChange:"Change custom photo",mediaType:"image"}))}t.LEAVE_MESSAGE="You have unsaved changes. If you leave now, your changes will be lost.",t.CommonEditor=function(e){var{feed:n,confirmOnCancel:a,keepState:o,useCtrlS:l,onSave:r,onCancel:p}=e,v=i(e,["feed","confirmOnCancel","keepState","useCtrlS","onSave","onCancel"]);const y=u.useDispatch(),E=u.useSelector(e=>e.editor.isSaving),S=u.useSelector(e=>e.editor.isDirty),[P,w]=s.default.useState(!1);s.useEffect(()=>{y(f.FeedEditorActions.editFeed({feedName:n.name,feedOptions:n.options,reset:!o}))},[y,n.id,o]),h.useUnload(t.LEAVE_MESSAGE,()=>a&&S&&!E&&!P,[a,S,E,P]),s.useEffect(()=>{P&&p&&p()},[P]),c.useDocumentEventListener("keydown",e=>{l&&e.key&&"s"===e.key.toLowerCase()&&e.ctrlKey&&(y(f.FeedEditorActions.saveFeed(O)),e.preventDefault(),e.stopPropagation())},[],[S]);const O=s.default.useCallback((e,t)=>{const a=m.withPartial(n,{name:e,options:t});return r?r(a):Promise.reject()},[n,r]),C=s.default.useCallback(()=>{(!S||!P&&a&&confirm(t.LEAVE_MESSAGE))&&w(!0)},[p,a]);return s.default.createElement(d.FeedEditor,Object.assign({},v,{isPro:_.Common.isPro,selectMediaField:b,onSave:O,onCancel:C,fakePreview:g.default.editor.preview}))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CheckboxListField=void 0;const o=a(n(0)),l=a(n(776)),i=n(76),r=a(n(238)),s=n(21);t.CheckboxListField=function({id:e,value:t,onChange:n,isPro:a,showProOptions:u,options:c}){a=null!=a?a:s.Common.isPro;const d=new Set(t.map(e=>e.toString())),f=e=>{const t=e.target.value,o=e.target.checked,l=c.find(e=>e.value.toString()===t);l.proOnly&&!a||l.isDisabled||(o?d.add(t):d.delete(t),n&&n(Array.from(d)))};return o.default.createElement("div",{className:l.default.checkboxList},c.filter(e=>!!e).map((t,n)=>{var s;if(!a&&t.proOnly&&!u)return null;const c=t.proOnly&&!a,m=t.isDisabled||c;return o.default.createElement("label",{key:n,className:m?l.default.disabledOption:l.default.option},o.default.createElement("input",{type:"checkbox",id:e,value:null!==(s=t.value.toString())&&void 0!==s?s:"",checked:d.has(t.value.toString()),onChange:f,disabled:m}),o.default.createElement("span",null,t.label,t.tooltip&&!c&&o.default.createElement(o.default.Fragment,null," ",o.default.createElement(r.default,null,t.tooltip))),c&&o.default.createElement("div",{className:l.default.proPill},o.default.createElement(i.ProPill,null)))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SETTINGS_SAVE_FAILED=t.SETTINGS_SAVE_SUCCESS=void 0,t.SETTINGS_SAVE_SUCCESS="sli/settings/save/success",t.SETTINGS_SAVE_FAILED="sli/settings/save/error"},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsFiltersTab=void 0;const o=a(n(0)),l=n(266),i=n(832),r=n(838);t.SettingsFiltersTab=function(){return o.default.createElement(l.SettingsPage,null,o.default.createElement(i.SettingsCaptionFiltersGroup,null),o.default.createElement(r.SettingsHashtagFiltersGroup,null))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},r=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MediaSelectionGrid=void 0;const u=l(n(0)),c=s(n(855)),d=n(856),f=n(389),m=n(9),p=n(74),_=n(149),h=n(56);function g({item:e,isSelected:t,children:n}){return n=null!=n?n:e=>u.default.createElement(_.MediaThumbnail,{media:e.item,className:c.default.thumbnail}),u.default.createElement("div",{className:t?c.default.selectedMedia:c.default.media},n({item:e,isSelected:t}))}t.MediaSelectionGrid=function(e){var{options:t,useFilters:n,useModeration:a,useTypeFilter:o,cache:l,onLoadMedia:s,onClick:_,onSelect:b}=e,v=r(e,["options","useFilters","useModeration","useTypeFilter","cache","onLoadMedia","onClick","onSelect"]);const y=function({options:e,useTypeFilter:t,useFilters:n,useModeration:a}){const o=p.cloneObj(e);return o.numPosts=999999,n||(o.captionWhitelist=[],o.captionBlacklist=[],o.hashtagWhitelist=[],o.hashtagBlacklist=[],o.captionWhitelistSettings=!1,o.captionBlacklistSettings=!1,o.hashtagWhitelistSettings=!1,o.hashtagBlacklistSettings=!1),a||(o.moderation=[],o.moderationMode=m.ModerationMode.BLACKLIST),t||(o.mediaType=m.MediaTypeFilter.ALL),o}({options:t,useTypeFilter:o,useFilters:n,useModeration:a}),[E,S]=u.useState(!0),[P,w]=u.useState([]),O=u.useRef(null);return l||(l={value:O.current,update:e=>O.current=e}),u.useEffect(()=>{!function(){var e;i(this,void 0,void 0,(function*(){if((null===(e=l.value)||void 0===e?void 0:e.key)===m.calculateFeedMediaHash(y))w(l.value.media),S(!1),s&&s(l.value.media);else{S(!0);const e=(yield h.RestApi.media.get(y)).data.media;l.update({key:m.calculateFeedMediaHash(y),media:e}),w(e),S(!1),s&&s(e)}}))}()},[y,n,a,o]),E?u.default.createElement("div",{className:c.default.loading},u.default.createElement(f.LoadingSpinner,{size:60})):u.default.createElement(d.SelectionGrid,Object.assign({},v,{items:P,onClick:function(e,t,n){_&&_(e,t,n)},onSelect:function(e,t,n){b&&b(e,t,n)},keyFn:e=>e.id.toString()}),e=>u.default.createElement(g,Object.assign({},e,{children:v.children})))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LoadingSpinner=void 0;const o=a(n(0));n(858),t.LoadingSpinner=({size:e})=>{const t=(e=null!=e?e:24)+"px",n={width:t,height:t,boxShadow:`${.25*e+"px"} 0 0 ${.375*e+"px"} #999 inset`};return o.default.createElement("span",{className:"loading-spinner",style:n})}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionsGrid=void 0;const r=l(n(0)),s=i(n(870)),u=n(8),c=n(11),d=n(388),f=n(86),m=n(35),p=n(156),_=n(25),h=n(392),g=n(121),b=n(149),v=n(877),y=n(21),E={value:null,update:e=>E.value=e};function S({media:e,isFirst:t,isLast:n,onPrev:a,onNext:o,feedOptions:l,onChange:i}){const d=r.useRef(),f=p.PromotionSystem.getMediaPromoFromFeed(e,l),m=l.globalPromotionsEnabled&&!!p.PromotionSystem.getMediaGlobalPromo(e),g=l.autoPromotionsEnabled&&!!p.PromotionSystem.getMediaAutoPromo(e);return r.useEffect(()=>{var e;null===(e=null==d?void 0:d.current)||void 0===e||e.focus()},[d]),r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:s.default.navigation},r.default.createElement(u.Button,{type:u.ButtonType.PILL,size:u.ButtonSize.LARGE,disabled:t,onClick:a},r.default.createElement(c.Dashicon,{icon:"arrow-left-alt"})),r.default.createElement(v.PromotePreviewTile,{media:e}),r.default.createElement(u.Button,{type:u.ButtonType.PILL,size:u.ButtonSize.LARGE,disabled:n,onClick:o},r.default.createElement(c.Dashicon,{icon:"arrow-right-alt"}))),r.default.createElement(h.MediaPromotionFields,{promo:f,typeSelectorRef:d,hasGlobal:m,hasAuto:g,onChange:function(t){y.Common.isPro&&i(_.withPartial(l.promotions,{[e.id]:t}))}}))}function P({media:e,isSelected:t}){const n=m.useEditorSelector(e=>e.feedOptions),a=p.PromotionSystem.getMediaPromo(e,n),o=g.PromotionTypeStore.getForPromo(a),l=p.PromotionSystem.getPromoConfig(a),i=(null==o?void 0:o.isValid(l))?null==o?void 0:o.getIcon(e,l):void 0;return r.default.createElement("div",{className:t?s.default.tileSelected:s.default.tile},r.default.createElement(b.MediaThumbnail,{className:s.default.tileThumbnail,media:e}),r.default.createElement("div",{className:s.default.tileIcon},r.default.createElement(c.Dashicon,{icon:i})))}t.PromotionsGrid=function({feedOptions:e,onChange:t}){const n=r.useRef(),a=r.useRef(),[o,l]=r.useState(null),[i,c]=r.useState(0),[m,p]=r.useState(!1);function _(){var e;p(!1),null===(e=a.current)||void 0===e||e.focus()}const h=null!==o&&null!==i,g=h&&i<=0,b=h&&i>=o.length-1,v=h?o[i]:null;return r.default.createElement("div",{className:s.default.root},r.default.createElement(d.MediaSelectionGrid,{cache:E,options:e,selected:i,onClick:function(e,t,n){a.current=n,p(!0)},onSelect:function(e,t){c(t)},onLoadMedia:l,canDeselect:!m,useKeyBinds:!m,useFilters:!0,useModeration:!0,useTypeFilter:!0,controlled:!0},e=>r.default.createElement(P,{media:e.item,isSelected:e.isSelected})),r.default.createElement(f.Modal,{title:"Promotion",rootRef:n,isOpen:m&&null!==v,onClose:_},r.default.createElement(f.Modal.Content,null,r.default.createElement(S,{media:v,feedOptions:e,onChange:t,isFirst:g,isLast:b,onNext:()=>c(e=>e+1),onPrev:()=>c(e=>e-1)})),r.default.createElement(f.Modal.Footer,null,r.default.createElement(u.Button,{type:u.ButtonType.PRIMARY,size:u.ButtonSize.LARGE,onClick:_},"Done"))))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MediaPromotionFields=void 0;const s=l(n(0)),u=r(n(871)),c=n(25),d=n(199),f=n(121),m=n(872),p=n(876),_=n(40),h=n(142);t.MediaPromotionFields=function(e){var t,n,{promo:a,typeSelectorRef:o,onChange:l}=e,r=i(e,["promo","typeSelectorRef","onChange"]);a=null!=a?a:{type:"",config:{}};const[g,b]=s.useState(!1),v=s.useCallback(()=>{b(!0),l&&l({type:null,config:{}})},[l]),y=f.PromotionTypeStore.get(a.type),E=null!==(t=a.config)&&void 0!==t?t:{},S=!d.isObjectEmpty(E),P=r.hasGlobal||r.hasAuto,w=P&&(S||g),O=null!==(n=m.PromoTypeComponents.get(y?y.id:""))&&void 0!==n?n:{heading:"",fields:void 0,tutorial:void 0},C=[{value:"",label:"None"}].concat(f.PromotionTypeStore.getAll().map(e=>({value:e.id,label:e.label})));return s.default.createElement("div",null,P&&s.default.createElement(p.PromotionOverrideMessage,{hasAuto:r.hasAuto,hasGlobal:r.hasGlobal,isOverriding:w,onOverride:v}),(!P||w)&&!r.showTutorial&&s.default.createElement(s.default.Fragment,null,s.default.createElement(h.FieldRow,{label:"Promotion type",labelId:"promo-type",proOnly:!0},s.default.createElement(_.Select,{id:"promo-type",ref:o,value:a.type,onChange:e=>{l&&l(c.withPartial(a,{type:e.value}))},isSearchable:!1,isCreatable:!1,isClearable:!1,options:C})),O.fields&&s.default.createElement(s.default.Fragment,null,s.default.createElement("hr",{className:u.default.separator}),s.default.createElement(O.fields,{config:null!=E?E:{},onChange:e=>{l&&l(c.withPartial(a,{config:e}))}}))),r.showTutorial&&O.tutorial&&s.default.createElement(O.tutorial,null))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(889)),i=a(n(163)),r=n(178);function s({tab:e,isCurrent:t,onClick:n}){return o.default.createElement("a",{key:e.key,role:"button",tabIndex:0,className:e.disabled?l.default.disabled:t?l.default.current:l.default.tab,onClick:n,onKeyDown:r.useKeyboardActivate(n)},o.default.createElement("span",{className:l.default.label},e.label))}t.default=function({children:{path:e,tabs:t,right:n},current:a,onClickTab:l}){return o.default.createElement(i.default,{pathStyle:"chevron"},{path:e,right:n,left:t.map(e=>{return o.default.createElement(s,{tab:e,key:e.key,isCurrent:e.key===a,onClick:(t=e.key,()=>l&&l(t))});var t})})}},,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchNews=void 0;const o=n(15),l=(n(20),n(62));t.fetchNews=o.createAsyncThunk("news/fetch",()=>a(void 0,void 0,void 0,(function*(){try{const e=yield l.AdminRestApi.notifications.get();if("object"==typeof e&&Array.isArray(e.data))return e.data}catch(e){}})))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Decorate=void 0;const o=a(n(0));t.Decorate=function(e,t){return n=>o.default.createElement(e,Object.assign(Object.assign({},t),n))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionsScreen=void 0;const r=l(n(0)),s=i(n(962)),u=i(n(394)),c=n(8),d=n(163),f=n(963),m=n(972),p=n(197),_=n(407),h=n(84),g=n(69),b=n(76),v=n(1),y=n(33),E=n(126),S=n(47),P=n(63),w=n(52);function O({currTabId:e,isFakePro:t}){const n=v.useDispatch(),a=v.useSelector(y.selectSettingsAreDirty),o=v.useSelector(y.selectSettingsAreSaving);return r.default.createElement(r.default.Fragment,null,r.default.createElement(u.default,{current:e,onClickTab:e=>n(w.modifyRoute({tab:e}))},{path:[r.default.createElement(d.SpotlightNavbarLogo,{key:"logo"}),r.default.createElement("span",{key:"screen-title"},"Promotions")],tabs:[{key:"automate",label:r.default.createElement("span",{className:t?s.default.navbarFakeProItem:s.default.navbarItem},t&&r.default.createElement(b.ProPill,{className:s.default.navbarProPill}),r.default.createElement("span",null,"Automate"))},{key:"global",label:r.default.createElement("span",{className:t?s.default.navbarFakeProItem:s.default.navbarItem},t&&r.default.createElement(b.ProPill,{className:s.default.navbarProPill}),r.default.createElement("span",null,"Global Promotions"))}],right:[r.default.createElement(c.Button,{key:"cancel",onClick:()=>n(S.restoreSettings()),type:c.ButtonType.SECONDARY,disabled:!a,children:"Cancel"}),r.default.createElement(p.SaveButton,{key:"save",onClick:()=>n(E.saveSettings()),isSaving:o,disabled:!a})]}))}t.PromotionsScreen=function({isFakePro:e}){var t;const n=v.useDispatch(),a=v.useSelector(y.selectSettingsAreDirty),o=v.useSelector(y.selectSettingsAreSaving),l=v.useSelector(y.selectSetting("autoPromotions")),i=e?C:l,u=null!==(t=v.useSelector(P.selectQueryParam("tab")))&&void 0!==t?t:"automate";return w.useUnload(_.LEAVE_MESSAGE,e=>a&&e.screen!==h.SCREENS.PROMOTIONS,[a]),r.useEffect(()=>()=>a&&n(S.restoreSettings()),[a,n]),g.useDocumentEventListener("keydown",e=>{"s"===e.key.toLowerCase()&&e.ctrlKey&&(a&&!o&&n(E.saveSettings()),e.preventDefault(),e.stopPropagation())},[],[a,o]),r.default.createElement("div",{className:s.default.screen},r.default.createElement("div",{className:s.default.navbar},r.default.createElement(O,{currTabId:u,isFakePro:e})),"automate"===u&&r.default.createElement(f.AutomatePromotionsTab,{automations:i,onChange:function(t){e||n(S.updateSettings({autoPromotions:t}))},isFakePro:e}),"global"===u&&r.default.createElement(m.GlobalPromotionsTab,{isFakePro:e}))};const C=[{type:"hashtag",config:{hashtags:["product"]},promotion:{type:"link",config:{linkType:"page",postId:1,postTitle:"Product Page",linkText:"Buy this product"}}},{type:"hashtag",config:{hashtags:["myblog"]},promotion:{type:"link",config:{linkType:"post",postId:1,postTitle:"My Latest Blog Post",linkText:""}}},{type:"hashtag",config:{hashtags:["youtube"]},promotion:{type:"link",config:{linkType:"url",url:"",linkText:""}}}]},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsScreen=t.LEAVE_MESSAGE=void 0;const r=l(n(0)),s=i(n(977)),u=n(1),c=(n(104),n(298)),d=(n(84),n(978)),f=n(275),m=n(33),p=n(47),_=n(21),h=n(63),g=n(52);t.LEAVE_MESSAGE="You have unsaved changes. If you leave now, your changes will be lost.",t.SettingsScreen=function(){const e=u.useDispatch(),n=u.useSelector(m.selectSettingsAreDirty),a=u.useSelector(h.selectQueryParam("tab")),o=a?f.AdminSettings.find(e=>a===e.id):f.AdminSettings[0];return r.useEffect(()=>()=>n&&e(p.restoreSettings()),[n,e]),g.useUnload(t.LEAVE_MESSAGE,()=>n,[n]),r.default.createElement(r.default.Fragment,null,r.default.createElement(c.AdminScreen,{navbar:d.SettingsNavbar,className:s.default.root},o&&(_.Common.isPro||!o.isPro)&&r.default.createElement(o.component,null)))}},,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.hideNews=t.closeNews=t.openNews=t.removeNewsMessage=t.addNewsMessage=t.NewsSlice=void 0;const l=n(15),i=n(404);t.NewsSlice=l.createSlice({name:"news",initialState:{messages:[],isOpen:!1,isHidden:!1},reducers:{addNewsMessage(e,t){e.messages.push(t.payload)},removeNewsMessage(e,t){e.messages=e.messages.filter(e=>e.id!==t.payload)},openNews(e){e.isOpen=!0},closeNews(e){e.isOpen=!1},hideNews(e){e.isHidden=!0}},extraReducers:e=>e.addCase(i.fetchNews.fulfilled,(e,t)=>{e.messages=t.payload})}),o(n(1001),t),t.addNewsMessage=t.NewsSlice.actions.addNewsMessage,t.removeNewsMessage=t.NewsSlice.actions.removeNewsMessage,t.openNews=t.NewsSlice.actions.openNews,t.closeNews=t.NewsSlice.actions.closeNews,t.hideNews=t.NewsSlice.actions.hideNews},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminLoading=void 0;const o=a(n(0)),l=n(21);n(1005),t.AdminLoading=function(){const e=new Date,t=3===e.getMonth()&&1===e.getDate()?"spitloght-800w.png":"spotlight-800w.png";return o.default.createElement("div",{className:"admin-loading"},o.default.createElement("div",{className:"admin-loading__perspective"},o.default.createElement("div",{className:"admin-loading__container"},o.default.createElement("img",{src:l.Common.image(t),className:"admin-loading__logo",alt:"Spotlight"}))))}},,,,,,,,,,,,,,,,function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={save:e=>a.client.post(e.id?"/feeds/"+e.id:"/feeds",{feed:e}),delete:e=>a.client.post("/feeds/delete/"+e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={update:e=>a.client.post("/accounts",e),delete:e=>a.client.post("/accounts/delete/"+e),connect:(e,t)=>{const n=t?{accessToken:e,userId:t}:{accessToken:e};return a.client.post("/connect",n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={deleteForAccount:e=>a.client.post("/account_media/delete/"+e),cleanUp:e=>a.client.post("/clean_up_media",{ageLimit:e})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={get:()=>a.client.get("/settings"),save:e=>a.client.post("/settings",{settings:e})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={get:()=>a.client.get("/notifications")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={clearAll:()=>a.client.post("/clear_cache"),clearForFeed:e=>a.client.post("/clear_cache/feed",{options:e.options})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={posts:{search:(e,t="")=>a.client.get(`/search_posts?search=${t}&type=${e}`)}}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsScreen=void 0;const r=l(n(0)),s=i(n(461)),u=n(298),c=n(84),d=n(465),f=n(311),m=i(n(314)),p=n(1),_=n(103),h=n(8),g=n(86),b=n(226),v=n(52),y=n(140),E=n(501),S=n(11);t.FeedsScreen=function(){const e=p.useDispatch(),t=p.useSelector(_.selectHasFeeds),n=r.useRef(),[a,o]=r.useState(!1);function l(t){const n={screen:c.SCREENS.NEW_FEED};t&&(n.template=t.id),e(v.gotoRoute(n))}return r.default.createElement(u.AdminScreen,{navbar:m.default,fillPage:!t},r.default.createElement("div",{className:s.default.root},t?r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:s.default.toolbar},r.default.createElement(h.Button,{ref:n,type:h.ButtonType.PRIMARY,size:h.ButtonSize.LARGE,onClick:function(){return o(!0)}},r.default.createElement(S.Dashicon,{icon:"plus-alt2"}),r.default.createElement("span",null,"Create a new feed")),"   ",r.default.createElement(E.FeedImportButton,{onImport:function(t){const n={id:null,name:t.name,options:t.options,usages:[]};e(y.saveFeed(n))}})),r.default.createElement(d.FeedsList,null)):r.default.createElement(f.FeedsOnboarding,{onSelectTemplate:l,showSteps:!0})),r.default.createElement(g.Modal,{title:"Select a template or design your own",isOpen:a,onClose:function(){var e;o(!1),null===(e=n.current)||void 0===e||e.focus()},width:1e3,portalTo:document.body},r.default.createElement(g.Modal.Content,null,r.default.createElement(b.FeedTemplatePicker,{onChange:l,showCustomOption:!0}))))}},function(e,t,n){e.exports={toolbar:"FeedsScreen__toolbar"}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccountTokenExpiring=void 0;const o=n(29),l=a(n(464)),i=a(n(216)),r=a(n(1076)),s={days:7};t.isAccountTokenExpiring=function(e){const t=r.default(new Date,s);return e.type===o.Account.Type.BUSINESS&&e.accessToken&&e.accessToken.expiry&&l.default(t,i.default(e.accessToken.expiry))}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsList=void 0;const s=l(n(0)),u=n(1),c=r(n(466)),d=n(103),f=n(136),m=n(11),p=n(175),_=n(8),h=r(n(303)),g=n(84),b=r(n(219)),v=n(137),y=n(305),E=n(306),S=r(n(221)),P=n(223),w=n(22),O=n(75),C=n(52),N=r(n(307)),M=n(31),k=n(20),A=n(56),T=n(62),F=n(139);function j(e){return JSON.stringify({name:e.name,options:e.options})}function L({feed:e,onClickAccount:t}){const n=u.useSelector(M.selectAccountList(e.options.accounts)),a=u.useSelector(M.selectAccountList(e.options.tagged));let o=[];return n.forEach(e=>{e&&o.push(s.default.createElement(D,{account:e,onClick:()=>t(e.id)}))}),a.forEach(e=>{e&&o.push(s.default.createElement(D,{account:e,onClick:()=>t(e.id),isTagged:!0}))}),e.options.hashtags.forEach(e=>o.push(s.default.createElement(I,{hashtag:e}))),0===o.length&&o.push(s.default.createElement("div",{className:c.default.noSourcesMsg},s.default.createElement(m.Dashicon,{icon:"warning"}),s.default.createElement("span",null,"Feed has no sources"))),s.default.createElement("div",{className:c.default.sourcesList},o.map((e,t)=>e&&s.default.createElement(R,{key:t},e)))}t.FeedsList=function(){const e=u.useDispatch(),t=u.useSelector(d.selectFeeds),[n,a]=s.useState(null),o=t=>i(this,void 0,void 0,(function*(){yield A.RestApi.media.import(t.options),e(O.showToast({key:"admin/feeds/import/done",message:`Finished importing posts for "${t.name}"`}))})),l=t=>i(this,void 0,void 0,(function*(){e(O.showToast({key:"admin/feeds/clear_cache/wait",message:`Clearing the cache for "${t.name}". Please wait ...`,type:O.ToastType.STICKY}));try{yield T.AdminRestApi.cache.clearForFeed(t),e(O.showToast({key:"admin/feeds/clear_cache/done",message:`Finished clearing the cache for "${t.name}."`}))}catch(e){F.triggerError({type:"feeds/clear_cache/error",message:k.getErrorResponseMessage(e)})}finally{e(O.removeToast("admin/feeds/clear_cache/wait"))}}));function r(){e(O.showToast({key:"admin/feeds/export",message:"Copied export code to clipboard!"}))}const b={cols:{name:c.default.nameCol,sources:c.default.sourcesCol,usages:c.default.usagesCol,actions:c.default.actionsCol},cells:{name:c.default.nameCell,sources:c.default.sourcesCell,usages:c.default.usagesCell,actions:c.default.actionsCell}};return s.default.createElement("div",{className:"feeds-list"},s.default.createElement(h.default,{styleMap:b,rows:t,cols:[{id:"name",label:"Name",render:e=>{var t,n;const a={screen:g.SCREENS.EDIT_FEED,id:e.id.toString()};return s.default.createElement("div",null,s.default.createElement(p.Link,{to:a,className:c.default.name},e.name?e.name:"(no name)"),s.default.createElement("div",{className:c.default.metaList},s.default.createElement("span",{className:c.default.id},"ID: ",e.id),s.default.createElement("span",{className:c.default.layout},null!==(n=null===(t=w.Responsive.extract(e.options.layout))||void 0===t?void 0:t.toUpperCase())&&void 0!==n?n:"GRID")))}},{id:"sources",label:"Shows posts from",render:e=>s.default.createElement(L,{feed:e,onClickAccount:a})},{id:"usages",label:"Instances",render:e=>s.default.createElement(x,{feed:e})},{id:"actions",label:"Actions",render:t=>s.default.createElement("div",{className:c.default.actionsList},s.default.createElement(v.StatefulMenu,null,({ref:e,openMenu:t})=>s.default.createElement(_.Button,{ref:e,className:c.default.actionsBtn,type:_.ButtonType.PILL,size:_.ButtonSize.NORMAL,onClick:t},s.default.createElement(y.Ellipsis,null)),s.default.createElement(v.MenuContent,null,s.default.createElement(v.MenuItem,{onClick:()=>(t=>{e(C.gotoRoute({screen:g.SCREENS.EDIT_FEED,id:t.id.toString()}))})(t)},s.default.createElement(m.Dashicon,{icon:"edit"}),"Edit feed"),s.default.createElement(v.MenuItem,{onClick:()=>(t=>{e(f.duplicateFeed(t))})(t)},s.default.createElement(m.Dashicon,{icon:"admin-page"}),"Duplicate feed"),s.default.createElement(v.MenuSeparator,null),s.default.createElement(E.CopyShortcode,{feed:t},s.default.createElement(v.MenuItem,null,s.default.createElement(m.Dashicon,{icon:"editor-code"}),"Copy shortcode")),s.default.createElement(N.default,{text:j(t),onCopy:r},s.default.createElement(v.MenuItem,null,s.default.createElement(m.Dashicon,{icon:"download"}),"Export feed")),s.default.createElement(v.MenuSeparator,null),s.default.createElement(v.MenuItem,{onClick:()=>o(t)},s.default.createElement(m.Dashicon,{icon:"image-rotate"}),"Update posts"),s.default.createElement(v.MenuItem,{onClick:()=>l(t)},s.default.createElement(m.Dashicon,{icon:"database-remove"}),"Clear cache"),s.default.createElement(v.MenuSeparator,null),s.default.createElement(v.MenuItem,{onClick:()=>(t=>{confirm("Are you sure you want to delete this feed? This cannot be undone.")&&e(f.deleteFeed(t))})(t),danger:!0},s.default.createElement(m.Dashicon,{icon:"trash"}),"Delete feed"))))}]}),s.default.createElement(S.default,{isOpen:null!==n,accountId:n,onClose:()=>a(null)}))};const x=({feed:e})=>s.default.createElement("div",{className:c.default.usagesList},e.usages.map((e,t)=>s.default.createElement("div",{key:t,className:c.default.usage},s.default.createElement("a",{className:c.default.usageLink,href:e.link,target:"_blank"},e.name),s.default.createElement("span",{className:c.default.usageType},"(",e.type,")"))));function D({account:e,isTagged:t,onClick:n}){return s.default.createElement("div",{className:c.default.accountSource,onClick:n,role:n?"button":void 0,tabIndex:0},t?s.default.createElement(m.Dashicon,{icon:"tag"}):s.default.createElement(b.default,{className:c.default.tinyAccountPic,account:e}),e.username)}function I({hashtag:e}){return s.default.createElement("a",{className:c.default.hashtagSource,href:P.getHashtagPageUrl(e.tag),target:"_blank"},s.default.createElement(m.Dashicon,{icon:"admin-site-alt3"}),s.default.createElement("span",null,"#",e.tag))}const R=({children:e})=>s.default.createElement("div",{className:c.default.source},e)},function(e,t,n){e.exports={"name-col":"FeedsList__name-col",nameCol:"FeedsList__name-col","sources-col":"FeedsList__sources-col",sourcesCol:"FeedsList__sources-col","actions-col":"FeedsList__actions-col",actionsCol:"FeedsList__actions-col","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","account-source":"FeedsList__account-source",accountSource:"FeedsList__account-source","tiny-account-pic":"FeedsList__tiny-account-pic",tinyAccountPic:"FeedsList__tiny-account-pic","hashtag-source":"FeedsList__hashtag-source",hashtagSource:"FeedsList__hashtag-source","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","actions-btn":"FeedsList__actions-btn",actionsBtn:"FeedsList__actions-btn","sources-cell":"FeedsList__sources-cell",sourcesCell:"FeedsList__sources-cell","usages-cell":"FeedsList__usages-cell",usagesCell:"FeedsList__usages-cell","usages-col":"FeedsList__usages-col",usagesCol:"FeedsList__usages-col"}},function(e,t,n){"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.ToastType=void 0,(a=t.ToastType||(t.ToastType={})).NOTIFICATION="notification",a.STICKY="sticky",a.ERROR="error"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useUnload=t.useRouteInterceptor=void 0;const a=n(52),o=n(1),l=n(0),i=n(102);function r(e,t){l.useEffect(()=>a.addRouteInterceptor(e),t)}t.useRouteInterceptor=r,t.useUnload=function(e,t,n=[]){const a=o.useStore(),[s]=l.useState(()=>a.getState().router.query);r(l.useCallback((n,a)=>{if(!i.objectsEqual(n,s)&&t(n,a))return confirm(e)},[t,s,e]),n),l.useEffect(()=>{const n=n=>{if(t({},""))return(n||window.event).returnValue=e,e};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},n)}},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",content:"Tooltip__content",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"}},,,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"}},function(e,t,n){e.exports={root:"ProfilePic__root",round:"ProfilePic__round ProfilePic__root",square:"ProfilePic__square ProfilePic__root"}},function(e,t,n){},,,,function(e,t,n){e.exports={modal:"Modal__modal layout__z-higher",shade:"Modal__shade layout__fill-parent",container:"Modal__container",opening:"Modal__opening","modal-open-animation":"Modal__modal-open-animation",modalOpenAnimation:"Modal__modal-open-animation",closing:"Modal__closing","modal-close-animation":"Modal__modal-close-animation",modalCloseAnimation:"Modal__modal-close-animation",content:"Modal__content",header:"Modal__header",icon:"Modal__icon","close-btn":"Modal__close-btn",closeBtn:"Modal__close-btn",scroller:"Modal__scroller",footer:"Modal__footer"}},,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(481)),r=n(29),s=o(n(421)),u=o(n(216)),c=n(138),d=n(308),f=o(n(309)),m=n(8),p=n(39),_=o(n(219)),h=n(25),g=n(1),b=n(92),v=n(31),y=n(45);t.default=function({accountId:e,onUpdate:t}){const n=g.useDispatch(),o=g.useSelector(v.selectAccountById(e)),[E,S]=l.default.useState(!1),[P,w]=l.default.useState(""),[O,C]=l.default.useState(!1),N=o.type===r.Account.Type.PERSONAL,M=r.Account.getBioText(o),k=()=>a(this,void 0,void 0,(function*(){C(!0);const e=h.withPartial(o,{customBio:P});yield n(b.updateAccount(e)),S(!1),C(!1),t&&t()})),A=e=>a(this,void 0,void 0,(function*(){C(!0);const a=h.withPartial(o,{customProfilePicUrl:e});yield n(b.updateAccount(a)),C(!1),t&&t()}));return l.default.createElement("div",{className:i.default.root},l.default.createElement("div",{className:i.default.container},l.default.createElement("div",{className:i.default.infoColumn},l.default.createElement("a",{href:r.Account.getProfileUrl(o),target:"_blank",className:i.default.username},"@",o.username),l.default.createElement("div",{className:i.default.row},l.default.createElement("span",{className:i.default.label},"Spotlight ID:"),o.id),l.default.createElement("div",{className:i.default.row},l.default.createElement("span",{className:i.default.label},"User ID:"),o.userId),l.default.createElement("div",{className:i.default.row},l.default.createElement("span",{className:i.default.label},"Type:"),o.type),!E&&l.default.createElement("div",{className:i.default.row},l.default.createElement("div",null,l.default.createElement("span",{className:i.default.label},"Bio:"),l.default.createElement("a",{className:i.default.editBioLink,onClick:()=>{w(r.Account.getBioText(o)),S(!0)}},"Edit bio"),l.default.createElement("pre",{className:i.default.bio},M.length>0?M:"(No bio)"))),E&&l.default.createElement("div",{className:i.default.row},l.default.createElement("textarea",{className:i.default.bioEditor,value:P,onChange:e=>{w(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.ctrlKey&&(k(),e.preventDefault(),e.stopPropagation())},rows:4}),l.default.createElement("div",{className:i.default.bioFooter},l.default.createElement("div",{className:i.default.bioEditingControls},O&&l.default.createElement("span",null,"Please wait ...")),l.default.createElement("div",{className:i.default.bioEditingControls},l.default.createElement(m.Button,{className:i.default.bioEditingButton,type:m.ButtonType.DANGER,disabled:O,onClick:()=>a(this,void 0,void 0,(function*(){C(!0);const e=h.withPartial(o,{customBio:""});yield n(b.updateAccount(e)),S(!1),C(!1),t&&t()}))},"Reset"),l.default.createElement(m.Button,{className:i.default.bioEditingButton,type:m.ButtonType.SECONDARY,disabled:O,onClick:()=>{S(!1)}},"Cancel"),l.default.createElement(m.Button,{className:i.default.bioEditingButton,type:m.ButtonType.PRIMARY,disabled:O,onClick:k},"Save"))))),l.default.createElement("div",{className:i.default.picColumn},l.default.createElement("div",null,l.default.createElement(_.default,{account:o,className:i.default.profilePic})),l.default.createElement(d.WpUploadMedia,{id:"account-custom-profile-pic",title:"Select profile picture",mediaType:"image",onSelect:e=>{const t=parseInt(e.attributes.id),n=f.default.media.attachment(t).attributes.url;A(n)}},({open:e})=>l.default.createElement(m.Button,{type:m.ButtonType.SECONDARY,className:i.default.setCustomPic,onClick:e},"Change profile picture")),o.customProfilePicUrl.length>0&&l.default.createElement("a",{className:i.default.resetCustomPic,onClick:()=>{A("")}},"Reset profile picture"))),N&&l.default.createElement("div",{className:i.default.personalInfoMessage},l.default.createElement(p.Message,{type:p.MessageType.INFO,showIcon:!0},"Due to restrictions set by Instagram, Spotlight cannot import the profile photo and bio"," ","text for Personal accounts."," ",l.default.createElement("a",{href:y.AdminResources.customPersonalInfoUrl,target:"_blank"},"Click here to learn more"),".")),l.default.createElement(c.Spoiler,{label:"View access token",stealth:!0},l.default.createElement("div",{className:i.default.row},o.accessToken&&l.default.createElement("div",null,l.default.createElement("p",null,l.default.createElement("span",{className:i.default.label},"Expires on:"),l.default.createElement("span",null,o.accessToken.expiry?s.default(u.default(o.accessToken.expiry),"PPPP"):"Unknown")),l.default.createElement("pre",{className:i.default.accessToken},o.accessToken.code)))))}},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"}},function(e,t,n){},function(e,t,n){e.exports={message:"Message__message",shaking:"Message__shaking","shake-animation":"Message__shake-animation",shakeAnimation:"Message__shake-animation",icon:"Message__icon",content:"Message__content","dismiss-btn":"Message__dismiss-btn",dismissBtn:"Message__dismiss-btn",success:"Message__success Message__message",info:"Message__info Message__message",warning:"Message__warning Message__message","pro-tip":"Message__pro-tip Message__message",proTip:"Message__pro-tip Message__message",error:"Message__error Message__message",grey:"Message__grey Message__message"}},,,,,,,function(e,t,n){e.exports={root:"FeedsOnboarding__root","root-transitioning":"FeedsOnboarding__root-transitioning FeedsOnboarding__root",rootTransitioning:"FeedsOnboarding__root-transitioning FeedsOnboarding__root",transition:"FeedsOnboarding__transition",left:"FeedsOnboarding__left",right:"FeedsOnboarding__right","scroll-padding":"FeedsOnboarding__scroll-padding",scrollPadding:"FeedsOnboarding__scroll-padding"}},function(e,t,n){},function(e,t,n){e.exports={root:"FeedTemplatePicker__root",tile:"FeedTemplatePicker__tile",button:"FeedTemplatePicker__button",template:"FeedTemplatePicker__template FeedTemplatePicker__button","template-pro":"FeedTemplatePicker__template-pro FeedTemplatePicker__template FeedTemplatePicker__button",templatePro:"FeedTemplatePicker__template-pro FeedTemplatePicker__template FeedTemplatePicker__button","template-label":"FeedTemplatePicker__template-label",templateLabel:"FeedTemplatePicker__template-label","template-thumbnail":"FeedTemplatePicker__template-thumbnail",templateThumbnail:"FeedTemplatePicker__template-thumbnail","template-name":"FeedTemplatePicker__template-name",templateName:"FeedTemplatePicker__template-name","current-indicator":"FeedTemplatePicker__current-indicator",currentIndicator:"FeedTemplatePicker__current-indicator","pro-pill":"FeedTemplatePicker__pro-pill",proPill:"FeedTemplatePicker__pro-pill","pro-overlay":"FeedTemplatePicker__pro-overlay",proOverlay:"FeedTemplatePicker__pro-overlay","upgrade-button":"FeedTemplatePicker__upgrade-button",upgradeButton:"FeedTemplatePicker__upgrade-button","custom-template":"FeedTemplatePicker__custom-template FeedTemplatePicker__button",customTemplate:"FeedTemplatePicker__custom-template FeedTemplatePicker__button","custom-template-icon":"FeedTemplatePicker__custom-template-icon",customTemplateIcon:"FeedTemplatePicker__custom-template-icon","custom-template-text":"FeedTemplatePicker__custom-template-text",customTemplateText:"FeedTemplatePicker__custom-template-text"}},,,,function(e,t,n){e.exports={pill:"ProPill__pill"}},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",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"}},function(e,t,n){e.exports={logo:"SpotlightLogo__logo","logo-image":"SpotlightLogo__logo-image",logoImage:"SpotlightLogo__logo-image"}},function(e,t,n){e.exports={root:"ProUpgradeBtn__root"}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedImportButton=void 0;const r=l(n(0)),s=i(n(502)),u=n(8),c=n(11),d=n(86),f=i(n(323)),m=n(135);t.FeedImportButton=function({onImport:e}){const t=r.useRef(),n=r.useRef(),[a,o]=r.useState(!1),[l,i]=r.useState(""),p=r.useCallback(()=>{i(""),o(!0)},[n,o]),_=r.useCallback(()=>{var e;o(!1),null===(e=t.current)||void 0===e||e.focus()},[t,o]),h=r.useCallback(e=>{i(e.target.value)},[i]),g=r.useCallback(()=>{let t;try{t=JSON.parse(l)}catch(e){t=null}m.isPlainObject(t)&&(null==t?void 0:t.hasOwnProperty("name"))&&(null==t?void 0:t.hasOwnProperty("options"))?(e(t),_()):alert("The imported code is not valid")},[l,e,_]);return r.default.createElement(r.default.Fragment,null,r.default.createElement(u.Button,{ref:t,type:u.ButtonType.SECONDARY,size:u.ButtonSize.LARGE,onClick:p},r.default.createElement(c.Dashicon,{icon:"upload"}),r.default.createElement("span",null,"Import a feed")),r.default.createElement(d.Modal,{isOpen:a,onClose:_,title:"Import feed"},r.default.createElement(d.Modal.Content,null,r.default.createElement("p",{className:s.default.message},"Paste your exported feed code:"),r.default.createElement("textarea",{ref:n,className:s.default.field,value:l,onChange:h,autoFocus:!0,rows:4})),r.default.createElement(d.Modal.Footer,null,r.default.createElement(u.Button,{className:f.default.button,type:u.ButtonType.SECONDARY,onClick:_,children:"Cancel"}),r.default.createElement(u.Button,{className:f.default.button,type:u.ButtonType.PRIMARY,onClick:g,children:"Import"}))))}},function(e,t,n){e.exports={message:"FeedImportButton__message",field:"FeedImportButton__field"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.NewFeedScreen=void 0;const i=l(n(0)),r=n(324),s=n(9),u=n(273),c=n(1),d=n(63),f=n(180),m=n(228);t.NewFeedScreen=function(){const e=c.useDispatch(),t=c.useSelector(d.selectQueryParam("template")),n=c.useSelector(m.selectTemplateById(t)),a=n?f.applyFeedTemplateModel(n,s.DefaultFeedOptions):s.DefaultFeedOptions;return i.useEffect(()=>{e(u.setIsEditingNewFeed(!0))},[]),i.default.createElement(r.AdminEditor,{feed:{id:null,name:"",options:a,usages:[]}})}},,,,,,,,,function(e,t,n){e.exports={root:"ConnectAccountButton__root"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(236)),i=n(86);t.default=function({isOpen:e,onClose:t,onConnect:n,beforeConnect:a}){return o.default.createElement(i.Modal,{title:"Connect an Instagram account",isOpen:e,width:650,onClose:t},o.default.createElement(i.Modal.Content,null,o.default.createElement(l.default,{onConnect:n,beforeConnect:e=>{a&&a(e),t()}})))}},function(e,t,n){e.exports={base:"ConnectAccount__base",horizontal:"ConnectAccount__horizontal ConnectAccount__base","prompt-msg":"ConnectAccount__prompt-msg",promptMsg:"ConnectAccount__prompt-msg",types:"ConnectAccount__types",vertical:"ConnectAccount__vertical ConnectAccount__base","or-separator":"ConnectAccount__or-separator",orSeparator:"ConnectAccount__or-separator",type:"ConnectAccount__type",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","or-line":"ConnectAccount__or-line",orLine:"ConnectAccount__or-line","or-text":"ConnectAccount__or-text",orText:"ConnectAccount__or-text","types-rows":"ConnectAccount__types-rows",typesRows:"ConnectAccount__types-rows"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(516)),i=n(8),r=n(39),s=n(45),u=/^(User ID: ([0-9]+)\s*)?Access Token: ([a-zA-Z0-9]+)$/im;t.default=function({isColumn:e,onConnectPersonal:t,onConnectBusiness:n}){const a=o.default.useRef(!1),[c,d]=o.default.useState(""),[f,m]=o.default.useState(""),p=c.length>145&&c.trimLeft().startsWith("EA"),_=o.default.useCallback(()=>{p?n(c,f):t(c)},[c,f,p]),h=o.default.createElement("div",{className:l.default.buttonContainer},o.default.createElement(i.Button,{className:l.default.button,onClick:_,type:i.ButtonType.PRIMARY,disabled:0===c.length&&(0===f.length||!p)},"Connect"));return o.default.createElement("div",{className:e?l.default.column:l.default.row},o.default.createElement("div",{className:l.default.content},o.default.createElement("div",{className:l.default.bottom},o.default.createElement("input",{id:"manual-connect-access-token",type:"text",value:c,onChange:e=>{const t=e.target.value;if(a.current){a.current=!1;const e=u.exec(t);if(e)switch(e.length){case 2:return void d(e[1]);case 4:return m(e[2]),void d(e[3])}}d(t)},onPaste:e=>{a.current=!0,e.persist()},placeholder:"Instagram/Facebook access token"}),!p&&h)),p&&o.default.createElement("div",{className:l.default.content},o.default.createElement("label",{className:l.default.label,htmlFor:"manual-connect-user-id"},o.default.createElement("div",null,"This access token is for a ",o.default.createElement("strong",null,"Business")," account."," ","Please also enter the user ID:")),o.default.createElement("div",{className:l.default.bottom},o.default.createElement("input",{id:"manual-connect-user-id",type:"text",value:f,onChange:e=>{m(e.target.value)},placeholder:"Enter the user ID"}),p&&h)),o.default.createElement(r.Message,{type:r.MessageType.GREY,showIcon:!0},"Connecting a client's account? Avoid sharing passwords and use our"," ",o.default.createElement("a",{href:s.AdminResources.tokenGenerator,target:"_blank"},"access token generator"),"."))}},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"}},,,function(e,t,n){e.exports={root:"AccountSelector__root",row:"AccountSelector__row",account:"AccountSelector__account button__toggle-button button__panel-button theme__panel","account-selected":"AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel",accountSelected:"AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel","account-disabled":"AccountSelector__account-disabled AccountSelector__account button__toggle-button button__panel-button theme__panel theme__disabled",accountDisabled:"AccountSelector__account-disabled AccountSelector__account button__toggle-button button__panel-button theme__panel theme__disabled","account-selected-disabled":"AccountSelector__account-selected-disabled AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel theme__disabled",accountSelectedDisabled:"AccountSelector__account-selected-disabled AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel theme__disabled","profile-pic":"AccountSelector__profile-pic",profilePic:"AccountSelector__profile-pic","info-column":"AccountSelector__info-column",infoColumn:"AccountSelector__info-column","info-text":"AccountSelector__info-text",infoText:"AccountSelector__info-text",username:"AccountSelector__username AccountSelector__info-text","account-type":"AccountSelector__account-type AccountSelector__info-text",accountType:"AccountSelector__account-type AccountSelector__info-text","tick-icon":"AccountSelector__tick-icon",tickIcon:"AccountSelector__tick-icon"}},function(e,t,n){e.exports={container:"FieldRow__container","container-wide":"FieldRow__container-wide FieldRow__container",containerWide:"FieldRow__container-wide FieldRow__container",content:"FieldRow__content",label:"FieldRow__label",disabled:"FieldRow__disabled FieldRow__container","pro-pill":"FieldRow__pro-pill",proPill:"FieldRow__pro-pill","disabled-wide":"FieldRow__disabled-wide FieldRow__container-wide FieldRow__container FieldRow__disabled FieldRow__container",disabledWide:"FieldRow__disabled-wide FieldRow__container-wide FieldRow__container FieldRow__disabled FieldRow__container","label-normal":"FieldRow__label-normal FieldRow__label",labelNormal:"FieldRow__label-normal FieldRow__label","label-centered":"FieldRow__label-centered FieldRow__label",labelCentered:"FieldRow__label-centered FieldRow__label",field:"FieldRow__field","field-normal":"FieldRow__field-normal FieldRow__field",fieldNormal:"FieldRow__field-normal FieldRow__field","field-centered":"FieldRow__field-centered FieldRow__field",fieldCentered:"FieldRow__field-centered FieldRow__field","responsive-container":"FieldRow__responsive-container",responsiveContainer:"FieldRow__responsive-container","responsive-field":"FieldRow__responsive-field FieldRow__field",responsiveField:"FieldRow__responsive-field FieldRow__field","label-aligner":"FieldRow__label-aligner",labelAligner:"FieldRow__label-aligner"}},function(e,t,n){e.exports={root:"HelpTooltip__root",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"}},,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BusinessAccountSelector=void 0;const o=a(n(0)),l=n(1),i=n(237),r=n(39),s=n(31);t.BusinessAccountSelector=function(e){const t=l.useSelector(s.selectBusinessAccounts);return t.length>0?o.default.createElement(i.AccountSelector,Object.assign({accounts:t},e)):o.default.createElement(r.Message,{type:r.MessageType.WARNING},"Connect a business account to use this feature.")}},,,,,,,,,,,,,,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"}},,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.UnitInput=void 0;const l=o(n(0)),i=o(n(544));t.UnitInput=function(e){var{className:t,unit:n}=e,o=a(e,["className","unit"]);return l.default.createElement("div",{className:i.default.root},l.default.createElement("input",Object.assign({},o,{className:`${i.default.field} ${null!=t?t:""}`})),l.default.createElement("div",{className:i.default.unit},l.default.createElement("span",null,n)))}},function(e,t,n){e.exports={root:"UnitInput__root",field:"UnitInput__field",unit:"UnitInput__unit"}},,,,,,,,,,function(e,t,n){e.exports={"checkbox-field":"CheckboxField__checkbox-field",checkboxField:"CheckboxField__checkbox-field",aligner:"CheckboxField__aligner"}},,,,function(e,t,n){e.exports={button:"ColorPicker__button","color-preview":"ColorPicker__color-preview",colorPreview:"ColorPicker__color-preview",popper:"ColorPicker__popper"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports={root:"FieldSet__root"}},,,,,,,,,,,,,function(e,t,n){e.exports={"checkbox-list":"CheckboxListField__checkbox-list",checkboxList:"CheckboxListField__checkbox-list",option:"CheckboxListField__option","disabled-option":"CheckboxListField__disabled-option CheckboxListField__option theme__disabled",disabledOption:"CheckboxListField__disabled-option CheckboxListField__option theme__disabled","pro-pill":"CheckboxListField__pro-pill",proPill:"CheckboxListField__pro-pill"}},,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TextAreaField=void 0;const o=a(n(0));t.TextAreaField=function({id:e,value:t,onChange:n}){return o.default.createElement("textarea",{id:e,value:t,onChange:e=>n(e.target.value)})}},,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ButtonGroup=void 0;const o=a(n(0));n(302);const l=n(14);t.ButtonGroup=({wide:e,children:t})=>o.default.createElement("div",{className:l.classList("button-group",e&&"button-group-wide")},t)},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BorderDesignFields=void 0;const r=l(n(0)),s=i(n(801)),u=n(32),c=n(233),d=n(40),f=n(58),m=n(25),p=n(142);t.BorderDesignFields=function({design:e,onChange:t,labels:n,show:a}){const[o,l]=r.useState(c.BorderDesign.DEFAULT);return e=null!=e?e:o,t=null!=t?t:l,r.default.createElement("div",{className:s.default.root},(a.width||a.style||a.color)&&r.default.createElement(p.FieldRow,{label:n&&"Border"},a.width&&r.default.createElement("div",{className:s.default.width},r.default.createElement(u.NumberField,{value:e.width,onChange:n=>{t(m.withPartial(e,{width:n}))},placeholder:"Thickness",min:0,unit:"px"})),a.style&&r.default.createElement("div",{className:s.default.style},r.default.createElement(d.Select,{value:e.style,onChange:n=>{t(m.withPartial(e,{style:n}))},options:[{value:"solid",label:"Solid line"},{value:"dotted",label:"Dotted line"},{value:"dashed",label:"Dashed line"},{value:"double",label:"Double line"},{value:"groove",label:"Grooved"}]})),a.color&&r.default.createElement("div",{className:s.default.color},r.default.createElement(f.ColorPicker,{value:e.color,onChange:n=>{t(m.withPartial(e,{color:n.rgb}))}}))),a.radius&&r.default.createElement(p.FieldRow,{label:n&&"Border Radius"},r.default.createElement(u.NumberField,{value:e.radius,onChange:n=>{const a=parseInt(n.toString());t(m.withPartial(e,{radius:a||0}))},min:0,unit:"px"})))}},function(e,t,n){e.exports={root:"BorderDesignFields__root",row:"BorderDesignFields__row",label:"BorderDesignFields__label",style:"BorderDesignFields__style",width:"BorderDesignFields__width",color:"BorderDesignFields__color"}},,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MultiTextInput=void 0;const r=l(n(0)),s=i(n(334)),u=n(39),c=n(40),d={DropdownIndicator:null},f=e=>({label:e,value:e});t.MultiTextInput=function({id:e,value:t,onChange:n,sanitize:a,autoFocus:o,message:l}){const[i,m]=r.default.useState(""),[p,_]=r.default.useState(-1),[h,g]=r.default.useState();r.useEffect(()=>{g(l)},[l]);const b=(t=Array.isArray(t)?t:[]).map(e=>f(e)),v=()=>{i.length&&(m(""),y([...b,f(i)]))},y=e=>{if(!n)return;let t=-1;e=e?e.map(e=>e&&a?a(e.value):e.value).filter((e,n,a)=>{const o=a.indexOf(e);return o!==n?(t=o,!1):!!e}):[],_(t),-1===t&&n(e)},E=c.SelectStyles();return r.default.createElement(r.default.Fragment,null,r.default.createElement(s.default,{inputId:e,className:"react-select",classNamePrefix:"react-select",components:d,inputValue:i,isClearable:!1,isMulti:!0,menuIsOpen:!1,onChange:y,onInputChange:e=>{m(e)},onKeyDown:e=>{if(i)switch(e.key){case",":case"Enter":case"Tab":v(),e.preventDefault()}},onBlur:v,placeholder:"Type something and press enter...",value:b,autoFocus:o,styles:E}),p<0||0===b.length?null:r.default.createElement(u.Message,{type:u.MessageType.WARNING,shake:!0,showIcon:!0,isDismissible:!0},r.default.createElement("code",null,b[p].label)," is already in the list"),h?r.default.createElement(u.Message,{type:u.MessageType.WARNING,shake:!0,showIcon:!0,isDismissible:!0},h):null)}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalFiltersModal=void 0;const o=a(n(0)),l=n(86),i=n(197),r=n(1),s=n(33),u=n(126),c=n(387);t.GlobalFiltersModal=function({isOpen:e,onClose:t,onSave:n}){const a=r.useDispatch(),d=r.useSelector(s.selectSettingsAreDirty),f=r.useSelector(s.selectSettingsAreSaving);return o.default.createElement(l.Modal,{title:"Global filters",isOpen:e,onClose:()=>{d&&!confirm("You have unsaved changes. If you close the window now, your settings will not be saved. Click OK to close anyway.")||t()}},o.default.createElement(l.Modal.Content,null,o.default.createElement(c.SettingsFiltersTab,null)),o.default.createElement(l.Modal.Footer,null,o.default.createElement(i.SaveButton,{disabled:!d,isSaving:f,onClick:()=>{a(u.saveSettings()).then(()=>{n&&n()})}})))}},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"}},function(e,t,n){e.exports={root:"SettingsPage__root layout__flex-column","after-groups":"SettingsPage__after-groups",afterGroups:"SettingsPage__after-groups","before-groups":"SettingsPage__before-groups",beforeGroups:"SettingsPage__before-groups","group-list":"SettingsPage__group-list layout__flex-column",groupList:"SettingsPage__group-list layout__flex-column"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsCaptionFiltersGroup=void 0;const o=a(n(0)),l=n(147),i=n(834),r=n(837);t.SettingsCaptionFiltersGroup=function(){return o.default.createElement(l.SettingsGroup,{title:"Caption filtering"},o.default.createElement(i.CaptionWhitelistField,null),o.default.createElement(r.CaptionBlacklistField,null))}},function(e,t,n){e.exports={root:"SettingsGroup__root layout__flex-column",title:"SettingsGroup__title","before-fields":"SettingsGroup__before-fields",beforeFields:"SettingsGroup__before-fields","after-fields":"SettingsGroup__after-fields",afterFields:"SettingsGroup__after-fields","field-list":"SettingsGroup__field-list layout__flex-column",fieldList:"SettingsGroup__field-list layout__flex-column"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CaptionWhitelistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(146),s=n(33),u=n(47);t.CaptionWhitelistField=function(){const e=l.useDispatch(),t=l.useSelector(s.selectSetting("captionWhitelist")),n=l.useSelector(s.selectSetting("captionBlacklist"));return o.default.createElement(i.SettingsField,{id:"captionWhitelist",label:"Only show posts with these words or phrases",fullWidth:!0},o.default.createElement(r.LimitedMultiTextInput,{id:"captionWhitelist",value:t,onChange:t=>e(u.updateSettings({captionWhitelist:t})),exclude:n,excludeMsg:"%s is already being used in the below option"}))}},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-column","control-partial-width":"SettingsField__control-partial-width SettingsField__control layout__flex-column",controlPartialWidth:"SettingsField__control-partial-width SettingsField__control layout__flex-column","control-full-width":"SettingsField__control-full-width SettingsField__control layout__flex-column",controlFullWidth:"SettingsField__control-full-width SettingsField__control layout__flex-column",tooltip:"SettingsField__tooltip layout__flex-column"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CaptionBlacklistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(146),s=n(33),u=n(47);t.CaptionBlacklistField=function(){const e=l.useDispatch(),t=l.useSelector(s.selectSetting("captionBlacklist")),n=l.useSelector(s.selectSetting("captionWhitelist"));return o.default.createElement(i.SettingsField,{id:"captionBlacklist",label:"Hide posts with these words or phrases",fullWidth:!0},o.default.createElement(r.LimitedMultiTextInput,{id:"captionBlacklist",value:t,onChange:t=>e(u.updateSettings({captionBlacklist:t})),exclude:n,excludeMsg:"%s is already being used in the above option"}))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsHashtagFiltersGroup=void 0;const o=a(n(0)),l=n(147),i=n(839),r=n(841);t.SettingsHashtagFiltersGroup=function(){return o.default.createElement(l.SettingsGroup,{title:"Hashtag filtering"},o.default.createElement(i.HashtagWhitelistField,null),o.default.createElement(r.HashtagBlacklistField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HashtagWhitelistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(33),s=n(47),u=n(198);t.HashtagWhitelistField=function(){const e=l.useDispatch(),t=l.useSelector(r.selectSetting("hashtagWhitelist")),n=l.useSelector(r.selectSetting("hashtagBlacklist"));return o.default.createElement(i.SettingsField,{id:"hashtagWhitelist",label:"Only show posts with these words or phrases",fullWidth:!0},o.default.createElement(u.MultiHashtagInput,{id:"hashtagWhitelist",value:t,onChange:t=>e(s.updateSettings({hashtagWhitelist:t})),exclude:n,excludeMsg:"The %s hashtag is already being used in the below option"}))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HashtagBlacklistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(146),s=n(33),u=n(47);t.HashtagBlacklistField=function(){const e=l.useDispatch(),t=l.useSelector(s.selectSetting("hashtagBlacklist")),n=l.useSelector(s.selectSetting("hashtagWhitelist"));return o.default.createElement(i.SettingsField,{id:"hashtagBlacklist",label:"Hide posts with these words or phrases",fullWidth:!0},o.default.createElement(r.LimitedMultiTextInput,{id:"hashtagBlacklist",value:t,onChange:t=>e(u.updateSettings({hashtagBlacklist:t})),exclude:n,excludeMsg:"The %s hashtag is already being used in the above option"}))}},,,,,,function(e,t,n){e.exports={layout:"SidebarLayout__layout","layout-primary-content":"SidebarLayout__layout-primary-content SidebarLayout__layout",layoutPrimaryContent:"SidebarLayout__layout-primary-content SidebarLayout__layout","layout-primary-sidebar":"SidebarLayout__layout-primary-sidebar SidebarLayout__layout",layoutPrimarySidebar:"SidebarLayout__layout-primary-sidebar SidebarLayout__layout",container:"SidebarLayout__container",content:"SidebarLayout__content SidebarLayout__container",sidebar:"SidebarLayout__sidebar SidebarLayout__container",navigation:"SidebarLayout__navigation","navigation-left":"SidebarLayout__navigation-left SidebarLayout__navigation",navigationLeft:"SidebarLayout__navigation-left SidebarLayout__navigation","navigation-right":"SidebarLayout__navigation-right SidebarLayout__navigation",navigationRight:"SidebarLayout__navigation-right SidebarLayout__navigation","nav-link":"SidebarLayout__nav-link",navLink:"SidebarLayout__nav-link"}},,,function(e,t,n){e.exports={content:"Sidebar__content",sidebar:"Sidebar__sidebar",padded:"Sidebar__padded","padded-content":"Sidebar__padded-content Sidebar__content Sidebar__padded",paddedContent:"Sidebar__padded-content Sidebar__content Sidebar__padded",disabled:"Sidebar__disabled Sidebar__sidebar"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RadioGroup=void 0;const o=a(n(0)),l=a(n(852));t.RadioGroup=function({name:e,className:t,disabled:n,value:a,onChange:i,options:r}){const s=e=>{!n&&e.target.checked&&i&&i(e.target.value)};return t=(n?l.default.disabled:l.default.radioGroup)+" "+(null!=t?t:""),o.default.createElement("div",{className:t},r.map((t,n)=>o.default.createElement("label",{className:l.default.option,key:n},o.default.createElement("input",{type:"radio",name:e,value:t.value,checked:a===t.value,onChange:s}),o.default.createElement("span",null,t.label))))}},function(e,t,n){e.exports={"radio-group":"RadioGroup__radio-group",radioGroup:"RadioGroup__radio-group",disabled:"RadioGroup__disabled RadioGroup__radio-group theme__disabled",option:"RadioGroup__option"}},,,function(e,t,n){e.exports={loading:"MediaSelectionGrid__loading",media:"MediaSelectionGrid__media","selected-media":"MediaSelectionGrid__selected-media MediaSelectionGrid__media",selectedMedia:"MediaSelectionGrid__selected-media MediaSelectionGrid__media",thumbnail:"MediaSelectionGrid__thumbnail"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionGrid=void 0;const s=l(n(0)),u=r(n(857)),c=n(220),d=n(155);t.SelectionGrid=function(e){var t,n,{items:a,disabled:o,controlled:l,canDeselect:r,children:d,onClick:m,onSelect:p}=e,_=i(e,["items","disabled","controlled","canDeselect","children","onClick","onSelect"]);let h=0;_.initialSelected&&_.keyFn&&(h=a.findIndex((e,t)=>_.keyFn(e,t)===_.initialSelected),h=-1===h?0:h);const[g,b]=s.useState(h),v=s.default.useRef(),y=s.default.useRef(),E=s.default.useRef(),S=l?_.selected:g,P=null!==(t=_.gridGap)&&void 0!==t?t:15,w=null===(n=_.useKeyBinds)||void 0===n||n;function O(e,t){o||(l||b(e),p&&p(a[e],e,t))}function C(e,t){o||(O(e,t),m&&m(a[e],e,t))}s.useLayoutEffect(()=>{var e;null===(e=E.current)||void 0===e||e.focus()},[E]);const N=s.useCallback(e=>{if(o||!w)return;const t=function(){const e=y.current.getBoundingClientRect(),t=E.current.getBoundingClientRect(),n=e.width,a=t.width;return Math.floor((n+P)/(a+P))}(),n=Math.ceil(a.length/t);switch(e.key){case" ":case"Enter":C(S);break;case"ArrowLeft":O(Math.max(S-1,0));break;case"ArrowRight":O(Math.min(S+1,a.length-1));break;case"ArrowUp":{const e=Math.max(0,S-t),a=Math.floor(S/t),o=Math.floor(e/t);n>1&&o!==a&&O(e);break}case"ArrowDown":{const e=Math.min(a.length-1,S+t),o=Math.floor(S/t),l=Math.floor(e/t);n>1&&l!==o&&O(e);break}default:return}e.preventDefault(),e.stopPropagation()},[o,w,a,O]);c.useDetectOutsideClick(y,()=>{r&&O(null)},[],[r,O]);const M=Object.assign(Object.assign({},_.gridStyle),{gridGap:P}),k=o?u.default.gridDisabled:u.default.grid;return s.default.createElement("div",{ref:v,className:u.default.root},s.default.createElement("div",{ref:y,className:k,style:M},a.map((e,t)=>s.default.createElement(f,{key:_.keyFn?_.keyFn(e,t):t,ref:0===t?E:null,focused:!o&&S===t,onClick:e=>C(t,e.currentTarget),onSelect:e=>O(t,e.currentTarget),onKeyDown:N},d({item:e,isSelected:S===t})))))};const f=s.default.forwardRef(({focused:e,onClick:t,onSelect:n,onKeyDown:a,children:o},l)=>{const i=s.useRef();return s.useLayoutEffect(()=>{var t;e&&(null===(t=null==i?void 0:i.current)||void 0===t||t.focus())},[e,i]),s.default.createElement("div",{ref:d.mergeRefs(i,l),className:u.default.item,onClick:t,onFocus:n,onKeyDown:a,tabIndex:0},o)})},function(e,t,n){e.exports={root:"SelectionGrid__root",grid:"SelectionGrid__grid","grid-disabled":"SelectionGrid__grid-disabled SelectionGrid__grid",gridDisabled:"SelectionGrid__grid-disabled SelectionGrid__grid",item:"SelectionGrid__item"}},function(e,t,n){},,,,,,,,,,,,function(e,t,n){e.exports={root:"PromotionsGrid__root",tile:"PromotionsGrid__tile","tile-selected":"PromotionsGrid__tile-selected PromotionsGrid__tile",tileSelected:"PromotionsGrid__tile-selected PromotionsGrid__tile",thumbnail:"PromotionsGrid__thumbnail","tile-icon":"PromotionsGrid__tile-icon",tileIcon:"PromotionsGrid__tile-icon","tile-thumbnail":"PromotionsGrid__tile-thumbnail",tileThumbnail:"PromotionsGrid__tile-thumbnail",navigation:"PromotionsGrid__navigation"}},function(e,t,n){e.exports={bottom:"MediaPromotionFields__bottom","remove-promo":"MediaPromotionFields__remove-promo",removePromo:"MediaPromotionFields__remove-promo",separator:"MediaPromotionFields__separator"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromoTypeComponents=void 0;const o=a(n(873)),l=a(n(874)),i=a(n(875));t.PromoTypeComponents=new Map([["link",{heading:"Link options",fields:o.default,tutorial:l.default}],["-more-",{heading:"Have your say...",fields:i.default,tutorial:i.default}]])},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=l(n(0)),u=n(40),c=n(21),d=r(n(42)),f=n(36),m=n(265),p=n(108),_=n(393),h=n(142),g=(n(20),[]),b={linkType:"",postId:0,postTitle:"",postUrl:"",url:"",linkText:"",newTab:!1,linkDirectly:!0};t.default=function({config:e,onChange:t}){e=null!=e?e:b,e=Object.assign(Object.assign({},b),e),0===g.length&&(g.push({value:"url",label:"URL"}),d.default.config.postTypes.forEach(e=>{if("attachment"!==e.slug){const t=s.default.createElement("span",null,e.labels.singularName,"post"!==e.slug&&"page"!==e.slug&&s.default.createElement("span",null," ",s.default.createElement("code",{style:{fontSize:"90%"}},e.slug)));g.push({value:e.slug,label:t})}}));const n=s.default.useRef(),a=s.default.useRef(!1),o=s.default.useRef(),[l,r]=s.default.useState([]),[u,c]=s.default.useState(!1);s.useEffect(()=>(a.current=!1,e.linkType&&"url"!==e.linkType&&(c(!0),N("").then(e=>{a.current||r(e)}).finally(()=>{a.current||c(!1)})),()=>a.current=!0),[e.linkType]);const f=s.default.useCallback(n=>{t({linkType:n,postId:0,postTitle:"",postUrl:"",url:e.url,newTab:e.newTab,linkText:e.linkText})},[e,t]),m=s.default.useCallback(n=>{if(null===n)t(Object.assign(Object.assign({},e),{postId:0,postTitle:"",postUrl:""}));else{const a=o.current.find(e=>e.id==n.value);t(Object.assign(Object.assign({},e),{postId:n.value,postTitle:a.title,postUrl:a.permalink}))}},[e,t]),p=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{url:n}))},[e,t]),h=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{newTab:n}))},[e,t]),S=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{linkDirectly:n}))},[e,t]),O=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{linkText:n}))},[e,t]),N=s.default.useCallback(t=>(clearTimeout(n.current),new Promise(a=>{n.current=setTimeout(()=>i(this,void 0,void 0,(function*(){try{const n=yield d.default.config.searchPosts(e.linkType,t);o.current=n,a(n.map(e=>({value:e.id,label:e.title})))}catch(e){}})),1e3)})),[e.linkType]),M=d.default.config.postTypes.find(t=>t.slug===e.linkType);return s.default.createElement(s.default.Fragment,null,s.default.createElement(v,{value:e.linkType,onChange:f}),"url"===e.linkType&&s.default.createElement(y,{value:e.url,onChange:p}),e.linkType&&"url"!==e.linkType&&s.default.createElement(E,{postType:M,postId:e.postId,postTitle:e.postTitle,onChange:m,loadOptions:N,isLoading:u,defaultPosts:l}),e.linkType&&s.default.createElement(P,{value:e.linkDirectly,onChange:S}),e.linkType&&s.default.createElement(w,{value:e.newTab,onChange:h}),e.linkType&&s.default.createElement(C,{value:e.linkText,onChange:O,placeholder:_.LinkPromoType.getDefaultLinkText(e)}))};const v=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-to",label:"Link to"},s.default.createElement(u.Select,{id:"promo-link-to",value:e||"",onChange:e=>t(e.value),options:g,isCreatable:!1}))})),y=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"link-promo-url",label:"URL",wide:!0},s.default.createElement(m.TextField,{id:"link-promo-url",value:e,onChange:t}))})),E=s.default.memo((function({postType:e,postId:t,postTitle:n,onChange:a,defaultPosts:o,isLoading:l,loadOptions:i}){const r=e?"Search for a "+e.labels.singularName:"Search";return s.default.createElement(h.FieldRow,{labelId:"link-promo-url",label:r,wide:!0},s.default.createElement(u.Select,{async:!0,cacheOptions:!0,key:p.uniqueNum(),id:"sli-promo-search-post",placeholder:"Select or start typing...",value:t||0,defaultValue:0,defaultInputValue:t?n:"",onChange:a,defaultOptions:o,loadOptions:i,noOptionsMessage:({inputValue:e})=>e.length?`No posts were found for "${e}"`:"Type to search for posts",loadingMessage:()=>"Searching...",isLoading:l,isSearchable:!0,isClearable:!0}))})),S=s.default.createElement(s.default.Fragment,null,s.default.createElement("p",null,"Tick this box to make posts go directly to the link. If left unticked, posts will open the popup box."),s.default.createElement("p",null,"To enable your feed's popup box and sidebar:"),s.default.createElement("ol",{style:{marginLeft:15}},s.default.createElement("li",null,"Set the ",s.default.createElement("b",null,"Design » Feed » Open posts in")," option to ",s.default.createElement("b",null,"Popup box")),s.default.createElement("li",null,"Enable the ",s.default.createElement("b",null,"Design » Popup box » Show sidebar")," option."))),P=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-directly",label:"Link directly",tooltip:S},s.default.createElement(f.CheckboxField,{id:"promo-link-directly",value:e,onChange:t}))})),w=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-new-tab",label:"Open in a new tab"},s.default.createElement(f.CheckboxField,{id:"promo-link-new-tab",value:e,onChange:t}))})),O=s.default.createElement(s.default.Fragment,null,s.default.createElement("p",null,"The text to use for the link in the popup box sidebar:",s.default.createElement("br",null),s.default.createElement("img",{src:c.Common.image("popup-link-text.png"),alt:""})),s.default.createElement("p",null,"Remember to enable your feed's popup box and sidebar, like so:"),s.default.createElement("ol",{style:{marginLeft:15}},s.default.createElement("li",null,"Set the ",s.default.createElement("b",null,"Design » Feed » Open posts in")," option to ",s.default.createElement("b",null,"Popup box")),s.default.createElement("li",null,"Enable the ",s.default.createElement("b",null,"Design » Popup box » Show sidebar")," option."))),C=s.default.memo((function({value:e,onChange:t,placeholder:n}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-text",label:"Popup box link text",tooltip:O},s.default.createElement(m.TextField,{id:"promo-link-text",value:e,onChange:t,placeholder:n}))}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0));t.default=function({}){return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",{style:{fontWeight:"bold"}},"How it works:"),o.default.createElement("ol",{style:{marginTop:0}},o.default.createElement("li",null,"Select a post from the preview on the left."),o.default.createElement("li",null,"Choose what the post should link to.")),o.default.createElement("p",null,"That’s it!"))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(8),i=n(45);t.default=function({}){return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,"Spotlight’s ‘Promote’ feature has lots more to come. Share your thoughts on what you’d like to"," ","promote and how."),o.default.createElement("p",null,"Take our 2-minute survey."),o.default.createElement("div",null,o.default.createElement(l.Button,{type:l.ButtonType.PRIMARY,size:l.ButtonSize.LARGE,onClick:function(){window.open(i.AdminResources.promoTypesSurvey)}},"Start Survey")))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionOverrideMessage=void 0;const o=a(n(0)),l=n(39),i=n(8),r=n(175);t.PromotionOverrideMessage=function({hasGlobal:e,hasAuto:t,isOverriding:n,onOverride:a}){return o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Message,{type:l.MessageType.WARNING,showIcon:!0},o.default.createElement("span",null,"You have")," ",t&&o.default.createElement(r.Link,{to:{screen:"promotions",tab:"automate"},absolute:!0,newTab:!0},"automated"),t&&e&&o.default.createElement(o.default.Fragment,null," ",o.default.createElement("span",null,"and")," "),e&&o.default.createElement(r.Link,{to:{screen:"promotions",tab:"global"},absolute:!0,newTab:!0},"global")," ",o.default.createElement("span",null,"promotions that apply to this post.")," ",n?o.default.createElement("span",null,"To stop overriding, simply remove the custom promotion."):o.default.createElement("span",null,"Click the button below to use a custom promotion instead.")),!n&&o.default.createElement(i.Button,{onClick:a},"Override"))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotePreviewTile=void 0;const o=a(n(0)),l=a(n(878)),i=n(149);t.PromotePreviewTile=function({media:e}){return o.default.createElement("div",{className:l.default.container},o.default.createElement("div",{className:l.default.sizer},o.default.createElement(i.MediaThumbnail,{media:e})))}},function(e,t,n){e.exports={container:"PromotePreviewTile__container",sizer:"PromotePreviewTile__sizer"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedNameField=void 0;const o=a(n(880)),l=a(n(0)),i=n(8),r=n(11),s=n(137),u=n(155);t.FeedNameField=function({name:e,label:t,onDone:n}){const a=l.default.useRef(),[c,d]=l.default.useState(""),[f,m]=l.default.useState(!1),p=()=>{d(e),m(!0)},_=()=>{m(!1),n&&n(c),a.current&&a.current.focus()},h=e=>{switch(e.key){case"Enter":case" ":p()}};return l.default.createElement("div",{className:o.default.root},l.default.createElement(s.Menu,{isOpen:f,onBlur:()=>m(!1),placement:"bottom"},({ref:e})=>l.default.createElement("div",{ref:u.mergeRefs(e,a),className:o.default.staticContainer,onClick:p,onKeyPress:h,tabIndex:0,role:"button"},l.default.createElement("span",{className:o.default.label},t),l.default.createElement(r.Dashicon,{icon:"edit",className:o.default.editIcon})),l.default.createElement(s.MenuContent,null,l.default.createElement(s.MenuStatic,null,l.default.createElement("div",{className:o.default.editContainer},l.default.createElement("input",{type:"text",value:c,onChange:e=>{d(e.target.value)},onKeyDown:e=>{switch(e.key){case"Enter":_();break;case"Escape":m(!1);break;default:return}e.preventDefault(),e.stopPropagation()},autoFocus:!0,placeholder:"Feed name"}),l.default.createElement(i.Button,{className:o.default.doneBtn,type:i.ButtonType.PRIMARY,size:i.ButtonSize.NORMAL,onClick:_},l.default.createElement(r.Dashicon,{icon:"yes"})))))))}},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"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedNamePrompt=void 0;const o=a(n(0)),l=a(n(882)),i=a(n(148));t.FeedNamePrompt=function({isOpen:e,onAccept:t,onCancel:n}){const[a,r]=o.default.useState("");function s(){t&&t(a)}return o.default.createElement(i.default,{title:"Feed name",isOpen:e,onCancel:function(){n&&n()},onAccept:s,buttons:["Save","Cancel"]},o.default.createElement("p",{className:l.default.message},"Give this feed a memorable name:"),o.default.createElement("input",{type:"text",className:l.default.input,value:a,onChange:e=>{r(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&(s(),e.preventDefault(),e.stopPropagation())},autoFocus:!0}))}},function(e,t,n){e.exports={message:"FeedNamePrompt__message",input:"FeedNamePrompt__input"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Screen=void 0,(t.Screen||(t.Screen={})).Sizes={WIDE:1200,LARGE:1180,MEDIUM:960,SMALL:782,NARROW:600,ALL:[1200,1180,960,782,600]}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(885)),i=a(n(163)),r=n(8),s=n(11);t.default=function({children:e,steps:t,current:n,onChangeStep:a,firstStep:u,lastStep:c}){var d;u=null!=u?u:[],c=null!=c?c:[];const f=null!==(d=t.findIndex(e=>e.key===n))&&void 0!==d?d:0,m=f<=0,p=f>=t.length-1,_=m?null:t[f-1],h=p?null:t[f+1],g=m?u:o.default.createElement(r.Button,{type:r.ButtonType.LINK,onClick:()=>!m&&a&&a(t[f-1].key),className:l.default.prevLink,disabled:_.disabled},o.default.createElement(s.Dashicon,{icon:"arrow-left-alt2"}),o.default.createElement("span",null,_.label)),b=p?c:o.default.createElement(r.Button,{type:r.ButtonType.LINK,onClick:()=>!p&&a&&a(t[f+1].key),className:l.default.nextLink,disabled:h.disabled},o.default.createElement("span",null,h.label),o.default.createElement(s.Dashicon,{icon:"arrow-right-alt2",style:{marginRight:0}}));return o.default.createElement(i.default,null,{path:[],left:g,right:b,center:e})}},function(e,t,n){e.exports={"arrow-link":"WizardNavbar__arrow-link",arrowLink:"WizardNavbar__arrow-link","prev-link":"WizardNavbar__prev-link WizardNavbar__arrow-link",prevLink:"WizardNavbar__prev-link WizardNavbar__arrow-link","next-link":"WizardNavbar__next-link WizardNavbar__arrow-link",nextLink:"WizardNavbar__next-link WizardNavbar__arrow-link"}},function(e,t,n){e.exports={root:"GenericNavbar__root",list:"GenericNavbar__list","left-list":"GenericNavbar__left-list GenericNavbar__list",leftList:"GenericNavbar__left-list GenericNavbar__list",item:"GenericNavbar__item","center-list":"GenericNavbar__center-list GenericNavbar__list",centerList:"GenericNavbar__center-list GenericNavbar__list","right-list":"GenericNavbar__right-list GenericNavbar__list",rightList:"GenericNavbar__right-list GenericNavbar__list","path-list":"GenericNavbar__path-list GenericNavbar__left-list GenericNavbar__list",pathList:"GenericNavbar__path-list GenericNavbar__left-list GenericNavbar__list","path-segment":"GenericNavbar__path-segment",pathSegment:"GenericNavbar__path-segment",separator:"GenericNavbar__separator GenericNavbar__item"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(888)),i=a(n(163)),r=n(8),s=n(11),u=n(137);function c({pages:e,current:t,onClickPage:n,children:a}){const[i,r]=o.default.useState(!1),s=()=>r(!0),c=()=>r(!1);return o.default.createElement(u.Menu,{isOpen:i,onBlur:c,placement:"bottom-start",refClassName:l.default.menuRef},({ref:e})=>o.default.createElement("a",{ref:e,className:l.default.menuLink,onClick:s},a),o.default.createElement(u.MenuContent,null,e.map(e=>{return o.default.createElement(u.MenuItem,{key:e.key,disabled:e.disabled,active:e.key===t,onClick:(a=e.key,()=>{n&&n(a),c()})},e.label);var a})))}t.default=function({pages:e,current:t,onChangePage:n,showNavArrows:a,hideMenuArrow:u,children:d}){var f,m;const{path:p,right:_}=d,h=null!==(f=e.findIndex(e=>e.key===t))&&void 0!==f?f:0,g=null!==(m=e[h].label)&&void 0!==m?m:"",b=h<=0,v=h>=e.length-1,y=b?null:e[h-1],E=v?null:e[h+1];let S=[];return a&&S.push(o.default.createElement(r.Button,{key:"page-menu-left",type:r.ButtonType.PILL,onClick:()=>!b&&n&&n(e[h-1].key),disabled:b||y.disabled},o.default.createElement(s.Dashicon,{icon:"arrow-left-alt2"}))),S.push(o.default.createElement(c,{key:"page-menu",pages:e,current:t,onClickPage:e=>n&&n(e)},o.default.createElement("span",null,g),!u&&o.default.createElement(s.Dashicon,{icon:"arrow-down-alt2",className:l.default.arrowDown}))),a&&S.push(o.default.createElement(r.Button,{key:"page-menu-left",type:r.ButtonType.PILL,onClick:()=>!v&&n&&n(e[h+1].key),disabled:v||E.disabled},o.default.createElement(s.Dashicon,{icon:"arrow-right-alt2"}))),o.default.createElement(i.default,{pathStyle:p.length>1?"line":"none"},{path:p,right:_,center:S})}},function(e,t,n){e.exports={"menu-link":"PageMenuNavbar__menu-link",menuLink:"PageMenuNavbar__menu-link","menu-ref":"PageMenuNavbar__menu-ref",menuRef:"PageMenuNavbar__menu-ref","arrow-down":"PageMenuNavbar__arrow-down",arrowDown:"PageMenuNavbar__arrow-down"}},function(e,t,n){e.exports={label:"TabNavbar__label",tab:"TabNavbar__tab",current:"TabNavbar__current TabNavbar__tab",disabled:"TabNavbar__disabled TabNavbar__tab"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WpMediaField=void 0;const o=a(n(0)),l=a(n(923)),i=n(308),r=n(8);t.WpMediaField=({id:e,title:t,mediaType:n,button:a,buttonSet:s,buttonChange:u,value:c,onChange:d})=>{s=void 0===a?s:a,u=void 0===a?u:a;const f=!!c,m=f?u:s,p=()=>{d&&d("")};return o.default.createElement(i.WpUploadMedia,{id:e,title:t,mediaType:n,button:m,value:c,onSelect:e=>{d&&d(e.attributes.url)}},({open:e})=>o.default.createElement("div",{className:l.default.wpMediaField},f&&o.default.createElement("div",{className:l.default.preview,tabIndex:0,onClick:e,role:"button"},o.default.createElement("img",{src:c,alt:"Custom profile picture"})),o.default.createElement(r.Button,{className:l.default.selectBtn,type:r.ButtonType.SECONDARY,onClick:e},m),f&&o.default.createElement(r.Button,{className:l.default.removeBtn,type:r.ButtonType.DANGER_LINK,onClick:p},"Remove custom photo")))}},function(e,t,n){e.exports={"wp-media-field":"WpMediaField__wp-media-field",wpMediaField:"WpMediaField__wp-media-field",preview:"WpMediaField__preview","select-btn":"WpMediaField__select-btn",selectBtn:"WpMediaField__select-btn","remove-btn":"WpMediaField__remove-btn",removeBtn:"WpMediaField__remove-btn"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EmbedSidebar=void 0;const r=l(n(0)),s=i(n(925)),u=n(12),c=n(1),d=n(63),f=i(n(42)),m=n(39),p=n(138),_=n(306),h=n(8),g=n(926),b=n(35),v=n(17),y=n(103),E=i(n(401)),S=n(21);function P({children:e}){const t=r.useRef(),[n,a]=r.useState(0),o=()=>t.current.slideTo((n+1)%e.length);return r.default.createElement("div",{className:s.default.imageSlider},r.default.createElement(E.default,{ref:t,activeIndex:n,onSlideChanged:e=>a(e.item),animationType:"slide",animationDuration:200,touchTracking:!0,preservePosition:!0,disableButtonsControls:!0,infinite:!0,items:e.map((e,t)=>r.default.createElement(w,{key:t,img:e.src,alt:e.label,onClick:o,annotation:t+1}))}))}function w({img:e,alt:t,annotation:n,onClick:a}){return r.default.createElement("figure",{className:s.default.example},r.default.createElement("figcaption",{className:s.default.caption}," ",t),r.default.createElement("img",{src:S.Common.image(e),alt:null!=t?t:"",style:{cursor:a?"pointer":"default"},onClick:a}),void 0!==n&&r.default.createElement("div",{className:s.default.exampleAnnotation},n))}t.EmbedSidebar=function(){const e=c.useSelector(d.selectQueryParam("id")),t=c.useSelector(y.selectFeedById(e)),n=c.useSelector(u.selectFeedName),a=c.useSelector(y.selectFeeds).length,o=b.useEditorSelector(e=>e.showProOptions),l=v.useFeedEditorContext().config.isPro,i=l||o,E=f.default.config.adminUrl+"/widgets.php",S=f.default.config.adminUrl+"/customize.php?autofocus%5Bpanel%5D=widgets";return e?r.default.createElement("div",{className:s.default.embedSidebar},t.usages.length>0&&r.default.createElement(p.Spoiler,{label:"Instances",defaultOpen:!0,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",{className:s.default.instances},r.default.createElement("p",null,"This feed is currently being shown in these pages:"),r.default.createElement("ul",null,t.usages.map((e,t)=>r.default.createElement("li",{key:t},r.default.createElement("a",{href:`${f.default.config.adminUrl}/post.php?action=edit&post=${e.id}`,target:"_blank"},e.name),r.default.createElement("span",null,"(",e.type,")")))))),r.default.createElement(p.Spoiler,{label:"Shortcode",defaultOpen:!0,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"Copy the shortcode below and paste it in any page or post to embed this feed:"),r.default.createElement("div",{className:s.default.shortcode},r.default.createElement("code",null,'[instagram feed="',e,'"]'),r.default.createElement(_.CopyShortcode,{feed:t},r.default.createElement(h.Button,{type:h.ButtonType.SECONDARY},"Copy"))))),f.default.config.hasElementor&&i&&r.default.createElement(p.Spoiler,{className:l?void 0:s.default.pro,label:l?"Elementor Widget":r.default.createElement(g.SpoilerProLabel,null,"Elementor widget"),defaultOpen:!0,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"To embed this feed in Elementor:"),r.default.createElement("ol",null,r.default.createElement("li",null,r.default.createElement("span",null,"Search for the ",r.default.createElement("b",null,"Spotlight Instagram feed")," widget",r.default.createElement(m.Message,{type:m.MessageType.INFO,showIcon:!0},"Choose the one with the Instagram logo. The other one is for the normal"," ","WordPress widget."))),r.default.createElement("li",null,"Add it to your post or page"),r.default.createElement("li",null,"Then choose ",r.default.createElement("strong",null,n)," from the list of feeds.")),r.default.createElement(P,null,[{src:"elementor-widget-search.png",label:"Choose the Spotlight widget"},{src:"elementor-widget-feed.png",label:"Choose the feed"}]))),r.default.createElement(p.Spoiler,{label:"WordPress Block",defaultOpen:!f.default.config.hasElementor,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"To embed this feed in the WordPress block editor:"),r.default.createElement("ol",null,r.default.createElement("li",null,"Search for the ",r.default.createElement("b",null,"Spotlight Instagram feed")," block"),r.default.createElement("li",null,"Add it to your post or page."),a>1?r.default.createElement("li",null,"Next, choose ",r.default.createElement("strong",null,n)," from the list of feeds."):r.default.createElement("li",null,"Since this is your only feed, Spotlight will automatically show this feed.")),a>1?r.default.createElement(P,null,[{src:"wp-block-search.png",label:"Search for the Spotlight block"},{src:"wp-block-select.png",label:"Choose the feed"},{src:"wp-block.png",label:"Done!"}]):r.default.createElement(P,null,[{src:"wp-block-search.png",label:"Search for the block"},{src:"wp-block.png",label:"Done!"}]))),r.default.createElement(p.Spoiler,{label:"WordPress Widget",defaultOpen:!1,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"To embed this feed as a WordPress widget:"),r.default.createElement("ol",null,r.default.createElement("li",null,"Go to the"," ",r.default.createElement("a",{href:E,target:"_blank"},"Appearance » Widgets")," ","page or the"," ",r.default.createElement("a",{href:S,target:"_blank"},"Widgets section of the Customizer")),r.default.createElement("li",null,"Then, add a ",r.default.createElement("strong",null,"Spotlight Instagram Feed")," widget"),r.default.createElement("li",null,"In the widget's settings, choose the ",r.default.createElement("strong",null,n)," as the feed"," ","to be shown.")),r.default.createElement(w,{img:"widget.png",alt:"Example of a widget"})))):r.default.createElement("div",{className:s.default.embedSidebar},r.default.createElement("div",{className:s.default.saveMessage},r.default.createElement(m.Message,{type:m.MessageType.INFO,showIcon:!0},"You're almost there... Click the ",r.default.createElement("strong",null,"Save")," button at the top-right to be"," ","able to embed this feed on your site!")))}},function(e,t,n){e.exports={"embed-sidebar":"EmbedSidebar__embed-sidebar",embedSidebar:"EmbedSidebar__embed-sidebar","save-message":"EmbedSidebar__save-message",saveMessage:"EmbedSidebar__save-message",shortcode:"EmbedSidebar__shortcode",example:"EmbedSidebar__example",caption:"EmbedSidebar__caption","example-annotation":"EmbedSidebar__example-annotation",exampleAnnotation:"EmbedSidebar__example-annotation",instances:"EmbedSidebar__instances",pro:"EmbedSidebar__pro"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpoilerProLabel=void 0;const o=a(n(0)),l=a(n(927)),i=n(76);t.SpoilerProLabel=function({children:e}){return o.default.createElement("div",null,o.default.createElement("div",{className:l.default.proPill},o.default.createElement(i.ProPill,null)),o.default.createElement("span",null,e))}},function(e,t,n){e.exports={"pro-pill":"SpoilerProLabel__pro-pill",proPill:"SpoilerProLabel__pro-pill"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.EditFeedScreen=void 0;const i=l(n(0)),r=n(208),s=n(39),u=n(324),c=n(1),d=n(103),f=n(273),m=n(63);function p(){const e=c.useSelector(m.selectRoute);return i.default.createElement("div",null,i.default.createElement(s.Message,{type:s.MessageType.ERROR,showIcon:!0},"Feed does not exist.",i.default.createElement(r.Link,{to:e.withQuery({screen:"feeds"})},"Go back")))}t.EditFeedScreen=function(){const e=c.useDispatch(),t=c.useSelector(m.selectRoute).getParam("id"),n=t?parseInt(t):0,a=c.useSelector(d.selectFeedById(n)),o=c.useStore(),[l]=i.useState(()=>o.getState().app.isEditingNewFeed);return i.useEffect(()=>{e(f.setIsEditingNewFeed(!1))},[]),n?a?i.default.createElement(u.AdminEditor,{feed:a,keepState:l}):i.default.createElement(p,null):null}},function(e,t,n){e.exports={screen:"PromotionsScreen__screen",navbar:"PromotionsScreen__navbar","navbar-item":"PromotionsScreen__navbar-item",navbarItem:"PromotionsScreen__navbar-item","navbar-fake-pro-item":"PromotionsScreen__navbar-fake-pro-item PromotionsScreen__navbar-item",navbarFakeProItem:"PromotionsScreen__navbar-fake-pro-item PromotionsScreen__navbar-item","navbar-pro-pill":"PromotionsScreen__navbar-pro-pill",navbarProPill:"PromotionsScreen__navbar-pro-pill"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AutomatePromotionsTab=void 0;const r=l(n(0)),s=i(n(964)),u=n(41),c=n(965),d=n(968),f=n(8),m=n(970),p=n(971),_=n(95);function h({onCreate:e}){return r.default.createElement("div",{className:s.default.tutorial},r.default.createElement("div",{className:s.default.tutorialBox},r.default.createElement("div",{className:s.default.tutorialText},r.default.createElement("h1",null,"Automatically drive more conversions with Instagram"),r.default.createElement("p",null,"Link Instagram posts to your products, blog posts, landing pages, and more."),r.default.createElement("p",null,r.default.createElement("b",null,"Promotions help you drive traffic and increase conversions through social proof.")),r.default.createElement("p",null,"For example, create an ",r.default.createElement("b",null,"Instagram hashtag"),", let’s call it ",r.default.createElement("b",null,"#mymaxidress"),"."," "," Display photos from Instagram that use this hashtag and feature your dress,"," "," then have them ",r.default.createElement("b",null,"link directly to your product page"),", whether it’s on the"," "," same website or not."),r.default.createElement("p",null,"Every new Instagram photo that Spotlight finds with this hashtag will then",r.default.createElement("br",null),r.default.createElement("b",null,"automatically link to the product page"),"."),r.default.createElement("p",null,r.default.createElement("b",null,"Simple. Powerful. Effective."))),r.default.createElement(f.Button,{type:f.ButtonType.SECONDARY,size:f.ButtonSize.HERO,onClick:e},"Create your first automation")))}t.AutomatePromotionsTab=function({automations:e,isFakePro:t,onChange:n}){e=null!=e?e:[],n=null!=n?n:_.fn.noop;const[a,o]=r.default.useState(0),[l,i]=r.default.useState("content"),f=p.clampIndex(a,e),g=e.length>0,b=()=>i("sidebar"),v=r.useCallback(()=>e[f],[e,f]);function y(e){o(e)}const E=r.useCallback((e,t)=>{n(e),void 0!==t&&o(t)},[n]),S=r.useCallback(t=>{n(m.arrayWith(e,f,t))},[f,n]),P=r.useCallback(()=>{n(e.concat({type:"hashtag",config:{},promotion:{type:"",config:{}}})),o(0),b()},[e]);return r.default.createElement(u.SidebarLayout,{primary:"content",current:l,sidebar:g&&r.default.createElement(r.default.Fragment,null,r.default.createElement(d.AutoPromotionsSidebar,{automation:v(),onChange:S,isFakePro:t,onClose:()=>i("content")})),content:r.default.createElement("div",{className:s.default.content},!g&&r.default.createElement(h,{onCreate:P}),g&&r.default.createElement(c.AutoPromotionsList,{automations:e,selected:f,isFakePro:t,onChange:E,onSelect:y,onClick:function(e){y(e),b()}}))})}},function(e,t,n){e.exports={content:"AutomatePromotionsTab__content","content-heading":"AutomatePromotionsTab__content-heading",contentHeading:"AutomatePromotionsTab__content-heading",tutorial:"AutomatePromotionsTab__tutorial","tutorial-box":"AutomatePromotionsTab__tutorial-box",tutorialBox:"AutomatePromotionsTab__tutorial-box","tutorial-text":"AutomatePromotionsTab__tutorial-text",tutorialText:"AutomatePromotionsTab__tutorial-text","tutorial-video":"AutomatePromotionsTab__tutorial-video",tutorialVideo:"AutomatePromotionsTab__tutorial-video","mobile-instructions":"AutomatePromotionsTab__mobile-instructions",mobileInstructions:"AutomatePromotionsTab__mobile-instructions"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AutoPromotionsList=void 0;const r=l(n(0)),s=i(n(966)),u=n(74),c=n(108),d=n(423),f=n(8),m=n(11),p=n(967),_=i(n(42)),h=i(n(148)),g=n(156),b=n(41),v=n(95);function y({automation:e,selected:t,disabled:n,onClick:a,onDuplicate:o,onRemove:l}){const i=g.PromotionSystem.getAutomationConfig(e),u=g.PromotionSystem.getAutomationPromo(e),c=g.PromotionSystem.getPromoConfig(u),d=_.default.config.postTypes.find(e=>e.slug===c.linkType),h=n?null:a,b=n?null:p.stopPropagation(o),v=n?null:p.stopPropagation(l);return r.default.createElement("div",{className:t?s.default.rowSelected:s.default.row,onClick:h},r.default.createElement("div",{className:s.default.rowDragHandle},r.default.createElement(m.Dashicon,{icon:"menu"})),r.default.createElement("div",{className:s.default.rowBox},r.default.createElement("div",{className:s.default.rowHashtags},i.hashtags&&Array.isArray(i.hashtags)?i.hashtags.map(e=>"#"+e).join(", "):r.default.createElement("span",{className:s.default.noHashtagsMessage},"No hashtags")),r.default.createElement("div",{className:s.default.rowSummary},r.default.createElement(E,{promoConfig:c,postType:d})),r.default.createElement("div",{className:s.default.rowActions},r.default.createElement(f.Button,{type:f.ButtonType.PILL,size:f.ButtonSize.SMALL,onClick:b,tooltip:"Duplicate automation",disabled:n},r.default.createElement(m.Dashicon,{icon:"admin-page"})),r.default.createElement(f.Button,{type:f.ButtonType.DANGER_PILL,size:f.ButtonSize.SMALL,onClick:v,tooltip:"Remove automation",disabled:n},r.default.createElement(m.Dashicon,{icon:"trash"})))))}function E({promoConfig:e,postType:t}){return"url"===e.linkType?r.default.createElement("span",{className:s.default.summaryItalics},"Custom URL"):t?r.default.createElement("span",null,r.default.createElement("span",{className:s.default.summaryBold},e.postTitle)," ",r.default.createElement("span",{className:s.default.summaryItalics},"(",t.labels.singularName,")")):r.default.createElement("span",{className:s.default.noPromoMessage},"No promotion")}t.AutoPromotionsList=function({automations:e,selected:t,isFakePro:n,onChange:a,onSelect:o,onClick:l}){const i=r.useContext(b.SidebarLayout.Context);!n&&a||(a=v.fn.noop);const[m,p]=r.default.useState(null);function _(e){o&&o(e)}const E=r.useCallback(()=>{a(e.concat({type:"hashtag",config:{},promotion:{type:"",config:{}}}),e.length)},[e]),S=r.useCallback(t=>()=>{const n=e[t],o=u.cloneObj(n),l=e.slice();l.splice(t+1,0,o),a(l,t+1)},[e]);function P(){p(null)}const w=r.useCallback(t=>{const n=e.slice();n.splice(t,1),a(n,0),P()},[e]),O=r.useCallback(n=>{const o=e[t],l=n.map(e=>({type:e.type,config:g.PromotionSystem.getAutomationConfig(e),promotion:g.PromotionSystem.getAutomationPromo(e)})),i=l.findIndex(e=>e.promotion===o.promotion);a(l,i)},[e]);function C(e){return()=>{_(e),l&&l(e)}}const N=e.map(e=>Object.assign(Object.assign({},e),{id:c.uniqueNum()}));return r.default.createElement(r.default.Fragment,null,i&&r.default.createElement("div",{className:s.default.mobileInstructions},r.default.createElement("p",null,"Click or tap on an automation to change its settings")),r.default.createElement("div",{className:s.default.list},r.default.createElement("div",{className:s.default.addButtonRow},r.default.createElement(f.Button,{type:f.ButtonType.SECONDARY,size:f.ButtonSize.LARGE,onClick:E,disabled:n},"Add automation")),r.default.createElement(d.ReactSortable,{list:N,handle:"."+s.default.rowDragHandle,setList:O,onStart:function(e){_(e.oldIndex)},animation:200,delay:1e3,fallbackTolerance:5,delayOnTouchOnly:!0},e.map((e,a)=>r.default.createElement(y,{key:a,automation:e,selected:t===a,onClick:C(a),onDuplicate:S(a),onRemove:()=>function(e){p(e)}(a),disabled:n}))),r.default.createElement(h.default,{isOpen:null!==m,title:"Are you sure?",buttons:["Yes, remove it","No, keep it"],onAccept:()=>w(m),onCancel:P},r.default.createElement("p",null,"Are you sure you want to remove this automation? This ",r.default.createElement("strong",null,"cannot")," be undone!"))))}},function(e,t,n){e.exports={list:"AutoPromotionsList__list","fake-pro-list":"AutoPromotionsList__fake-pro-list AutoPromotionsList__list",fakeProList:"AutoPromotionsList__fake-pro-list AutoPromotionsList__list",row:"AutoPromotionsList__row","row-selected":"AutoPromotionsList__row-selected AutoPromotionsList__row",rowSelected:"AutoPromotionsList__row-selected AutoPromotionsList__row","row-box":"AutoPromotionsList__row-box theme__panel",rowBox:"AutoPromotionsList__row-box theme__panel","row-hashtags":"AutoPromotionsList__row-hashtags",rowHashtags:"AutoPromotionsList__row-hashtags","row-summary":"AutoPromotionsList__row-summary",rowSummary:"AutoPromotionsList__row-summary","row-drag-handle":"AutoPromotionsList__row-drag-handle",rowDragHandle:"AutoPromotionsList__row-drag-handle","row-actions":"AutoPromotionsList__row-actions",rowActions:"AutoPromotionsList__row-actions","add-button-row":"AutoPromotionsList__add-button-row",addButtonRow:"AutoPromotionsList__add-button-row","no-hashtags-message":"AutoPromotionsList__no-hashtags-message",noHashtagsMessage:"AutoPromotionsList__no-hashtags-message","row-faded-text":"AutoPromotionsList__row-faded-text",rowFadedText:"AutoPromotionsList__row-faded-text","no-promo-message":"AutoPromotionsList__no-promo-message AutoPromotionsList__row-faded-text",noPromoMessage:"AutoPromotionsList__no-promo-message AutoPromotionsList__row-faded-text","summary-italics":"AutoPromotionsList__summary-italics",summaryItalics:"AutoPromotionsList__summary-italics","summary-bold":"AutoPromotionsList__summary-bold",summaryBold:"AutoPromotionsList__summary-bold"}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AutoPromotionsSidebar=void 0;const r=l(n(0)),s=i(n(969)),u=n(162),c=n(121),d=n(198),f=n(14),m=n(95),p=n(156),_=n(41),h=n(392),g=n(25),b=n(142);let v;t.AutoPromotionsSidebar=function({automation:e,isFakePro:t,onChange:n,onClose:a}){var o;const l=r.useContext(_.SidebarLayout.Context);!t&&n||(n=m.fn.noop),void 0===v&&(v=c.PromotionTypeStore.getAll().filter(e=>"-more-"!==e.id).map(e=>({value:e.id,label:e.label})));const i=p.PromotionSystem.getAutomationConfig(e),y=p.PromotionSystem.getAutomationPromo(e),E=null!==(o=i.hashtags)&&void 0!==o?o:[];return r.default.createElement(r.default.Fragment,null,l&&r.default.createElement(_.SidebarLayout.Navigation,{icon:"arrow-left-alt",text:"Automations",onClick:a}),r.default.createElement(u.Sidebar,null,e&&r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:f.classList(u.Sidebar.padded,t?s.default.fakePro:null)},r.default.createElement(b.FieldRow,{label:"Promote posts with any of these hashtags",labelId:"sli-auto-promo-hashtags",wide:!0},r.default.createElement(d.MultiHashtagInput,{id:"sli-auto-promo-hashtags",value:E,onChange:function(t){n(g.withPartial(e,{config:{hashtags:t}}))},autoFocus:!t})),r.default.createElement("div",{className:s.default.promoFields},r.default.createElement(h.MediaPromotionFields,{promo:y,onChange:function(t){n(Object.assign(Object.assign({},e),{promotion:t}))}})))),!e&&r.default.createElement("div",{className:u.Sidebar.padded},r.default.createElement("p",null,"Automatically link Instagram posts from any source that contain specific hashtags to"," ","posts, pages, products, custom links, and more. ",r.default.createElement("a",{href:"#"},"Learn more")),r.default.createElement("p",null,"To get started, create an automation or select an existing one."))))}},function(e,t,n){e.exports={"fake-pro":"AutoPromotionsSidebar__fake-pro",fakePro:"AutoPromotionsSidebar__fake-pro","promo-fields":"AutoPromotionsSidebar__promo-fields",promoFields:"AutoPromotionsSidebar__promo-fields"}},,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalPromotionsTab=void 0;const r=l(n(0)),s=n(1),u=i(n(973)),c=n(41),d=n(974),f=i(n(235)),m=n(975),p=n(31),_=n(69),h=n(56);t.GlobalPromotionsTab=function({isFakePro:e}){const t=s.useSelector(p.selectAccounts),[n,a]=r.useState(!1);_.useDocumentEventListener(h.RestApi.media.events.fetch.start,()=>a(!0)),_.useDocumentEventListener(h.RestApi.media.events.fetch.end,()=>a(!1));const[o,l]=r.useState("content"),[i,g]=r.default.useState(()=>(e=>e.length>0?e[0].id:null)(t)),b=r.useCallback(()=>l("content"),[l]),v=r.useCallback(()=>l("sidebar"),[l]);return r.default.createElement(r.default.Fragment,null,0===t.length&&r.default.createElement("div",{className:u.default.tutorial},r.default.createElement("div",{className:u.default.tutorialBox},r.default.createElement("div",{className:u.default.tutorialText},r.default.createElement("h1",null,"Set up global promotions across all feeds"),r.default.createElement("p",null,"Link Instagram posts to your products, blog posts, landing pages, and more."),r.default.createElement("p",null,r.default.createElement("b",null,"Promotions help you drive traffic and increase conversions through social proof.")),r.default.createElement("p",null,"Set up global promotions for each account that will apply across all feeds."," ","You may then choose to enable or disable promotions on a per-feed basis."),r.default.createElement("p",null,"Connect your first Instagram account to set up global promotions."),r.default.createElement("p",null,r.default.createElement("b",null,"Simple. Powerful. Effective."))),r.default.createElement(f.default,null,"Connect your Instagram account"))),t.length>0&&r.default.createElement(c.SidebarLayout,{primary:"content",current:o,sidebar:r.default.createElement(d.GlobalPromotionsSidebar,{disabled:n||e,account:i,onChangeAccount:g,onClose:b}),content:r.default.createElement(m.GlobalPromotionsContent,{disabled:n||e,account:i,onOpenSidebar:v})}))}},function(e,t,n){e.exports={tutorial:"GlobalPromotionsTab__tutorial","tutorial-box":"GlobalPromotionsTab__tutorial-box",tutorialBox:"GlobalPromotionsTab__tutorial-box","tutorial-text":"GlobalPromotionsTab__tutorial-text",tutorialText:"GlobalPromotionsTab__tutorial-text"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalPromotionsSidebar=void 0;const i=l(n(0)),r=n(1),s=n(162),u=n(41),c=n(237),d=n(138),f=n(31);t.GlobalPromotionsSidebar=function({account:e,onChangeAccount:t,disabled:n,onClose:a}){const o=r.useSelector(f.selectAccounts),l=i.useContext(u.SidebarLayout.Context);return i.default.createElement(i.default.Fragment,null,l&&i.default.createElement(i.default.Fragment,null,i.default.createElement(u.SidebarLayout.Navigation,{icon:"arrow-left-alt",text:"Back",onClick:a})),i.default.createElement(s.Sidebar,{disabled:n},i.default.createElement("div",{className:s.Sidebar.padded},i.default.createElement("p",null,"Promote your blog posts, landing pages, products, and much more through your Instagram feed."),i.default.createElement("p",{style:{fontWeight:"bold"}},"How it works:"),i.default.createElement("ol",{style:{marginTop:0}},i.default.createElement("li",null,"Pick an account."),l?i.default.createElement(i.default.Fragment,null,i.default.createElement("li",null,"Go back to the previous page."),i.default.createElement("li",null,"Select a post from the grid.")):i.default.createElement("li",null,"Select a post from the preview on the left."),i.default.createElement("li",null,"Choose what the post should link to."))),i.default.createElement(d.Spoiler,{label:"Pick an account",showIcon:!1,isOpen:!0,fitted:!0},i.default.createElement(c.AccountSelector,{accounts:o,value:[e],onChange:e=>t(e[0]),singleMode:!0}))))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalPromotionsContent=void 0;const r=l(n(0)),s=i(n(976)),u=n(1),c=n(41),d=n(391),f=n(230),m=n(33),p=n(47),_=n(8),h=n(11),g=n(31);t.GlobalPromotionsContent=function({account:e,disabled:t,onOpenSidebar:n}){const a=u.useDispatch(),o=u.useSelector(g.selectHasAccounts),l=u.useSelector(m.selectSetting("promotions")),i=r.useContext(c.SidebarLayout.Context),b=r.default.useCallback(e=>{t||a(p.updateSettings({promotions:e}))},[a,t]),v=f.createFeedOptions({accounts:[e],promotions:t?{}:l,globalPromotionsEnabled:!1});return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:s.default.content},i&&r.default.createElement("div",{className:s.default.heading},r.default.createElement("p",{className:s.default.mobileInstructions},"Click or tap a post to set up a promotion for it."),o&&r.default.createElement("div",{className:s.default.changeAccountButton},r.default.createElement(_.Button,{type:_.ButtonType.SECONDARY,size:_.ButtonSize.SMALL,onClick:n},r.default.createElement(h.Dashicon,{icon:"admin-users"})," Change account"))),r.default.createElement(d.PromotionsGrid,{feedOptions:v,onChange:b})))}},function(e,t,n){e.exports={content:"GlobalPromotionsContent__content",heading:"GlobalPromotionsContent__heading","mobile-instructions":"GlobalPromotionsContent__mobile-instructions",mobileInstructions:"GlobalPromotionsContent__mobile-instructions"}},function(e,t,n){},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsNavbar=void 0;const o=a(n(979)),l=a(n(0)),i=a(n(314)),r=n(8),s=n(315),u=n(197),c=n(275),d=n(1),f=n(33),m=n(47),p=n(126),_=n(21),h=n(63);function g({}){const e=d.useDispatch(),t=d.useSelector(f.selectSettingsAreDirty),n=d.useSelector(f.selectSettingsAreSaving);return l.default.createElement("div",{className:o.default.buttons},l.default.createElement(r.Button,{className:o.default.cancelBtn,type:r.ButtonType.DANGER_PILL,size:r.ButtonSize.LARGE,onClick:()=>e(m.restoreSettings()),disabled:!t},"Cancel"),l.default.createElement(u.SaveButton,{className:o.default.saveBtn,onClick:()=>e(p.saveSettings()),isSaving:n,tooltip:"Save the settings (Ctrl+S)",disabled:!t}))}t.SettingsNavbar=function(){const e=d.useSelector(h.selectQueryParam("tab")),t=_.Common.isPro?c.AdminSettings:c.AdminSettings.filter(e=>!e.isPro);return l.default.createElement(i.default,{chevron:!0,right:g},t.map((t,n)=>l.default.createElement(s.Navbar.Link,{key:t.id,linkTo:{tab:t.id},isCurrent:e===t.id||!e&&0===n},t.title)))}},function(e,t,n){e.exports={buttons:"SettingsNavbar__buttons layout__flex-row","cancel-btn":"SettingsNavbar__cancel-btn",cancelBtn:"SettingsNavbar__cancel-btn"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(981)),i=a(n(235)),r=a(n(982)),s=n(39),u=n(984),c=n(1),d=n(31),f=n(397);t.default=function(){const e=c.useSelector(d.selectAccounts),t=f.useForceUpdate(),[n,a]=o.default.useState("");return 0===e.length?o.default.createElement(u.AccountsOnboarding,null):o.default.createElement("div",{className:l.default.root},n.length>0&&o.default.createElement(s.Message,{type:s.MessageType.ERROR,showIcon:!0,isDismissible:!0,onDismiss:()=>a("")},n),o.default.createElement("div",{className:l.default.connectBtn},o.default.createElement(i.default,{onConnect:t})),o.default.createElement(r.default,{accounts:e,showDelete:!0,onDeleteError:a}))}},function(e,t,n){e.exports={"connect-btn":"AccountsPage__connect-btn",connectBtn:"AccountsPage__connect-btn"}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(983)),r=n(29),s=n(8),u=o(n(303)),c=n(172),d=o(n(221)),f=o(n(219)),m=o(n(148)),p=n(137),_=n(305),h=n(1),g=n(103),b=n(175),v=n(92),y=n(62),E=n(11);t.default=function({accounts:e,showDelete:t,onDeleteError:n}){const o=h.useStore(),S=h.useDispatch(),P=h.useSelector(g.selectFeeds),w=(e=null!=e?e:[]).filter(e=>e.type===r.Account.Type.BUSINESS).length,[O,C]=l.default.useState(!1),[N,M]=l.default.useState(null),[k,A]=l.default.useState(!1),[T,F]=l.default.useState(),[j,L]=l.default.useState(!1),x=e=>()=>{M(e.id),C(!0)},D=e=>()=>{c.AccountManager.openAuthWindow(o,e.type,0,()=>{y.AdminRestApi.media.deleteForAccount(e.id)})},I=e=>()=>{F(e),A(!0)},R=()=>{L(!1),F(null),A(!1)},B={cols:{username:i.default.usernameCol,type:i.default.typeCol,usages:i.default.usagesCol,actions:i.default.actionsCol},cells:{username:i.default.usernameCell,type:i.default.typeCell,usages:i.default.usagesCell,actions:i.default.actionsCell}};return l.default.createElement("div",{className:"accounts-list"},l.default.createElement(u.default,{styleMap:B,rows:e,cols:[{id:"username",label:"Username",render:e=>l.default.createElement("div",null,l.default.createElement(f.default,{account:e,className:i.default.profilePic}),l.default.createElement("a",{className:i.default.username,onClick:x(e)},e.username))},{id:"type",label:"Type",render:e=>l.default.createElement("span",{className:i.default.accountType},e.type)},{id:"usages",label:"Feeds",render:e=>l.default.createElement("span",{className:i.default.usages},e.usages.map((e,t)=>{const n=P[e];return!!n&&l.default.createElement(b.Link,{key:t,to:{screen:"edit",id:e.toString()}},n.name)}))},{id:"actions",label:"Actions",render:e=>t&&l.default.createElement(p.StatefulMenu,null,({ref:e,openMenu:t})=>l.default.createElement(s.Button,{ref:e,className:i.default.actionsBtn,type:s.ButtonType.PILL,size:s.ButtonSize.NORMAL,onClick:t},l.default.createElement(_.Ellipsis,null)),l.default.createElement(p.MenuContent,null,l.default.createElement(p.MenuItem,{onClick:x(e)},l.default.createElement(E.Dashicon,{icon:"info"}),"Info"),l.default.createElement(p.MenuItem,{onClick:D(e)},l.default.createElement(E.Dashicon,{icon:"image-rotate"}),"Reconnect"),l.default.createElement(p.MenuSeparator,null),l.default.createElement(p.MenuItem,{onClick:I(e),danger:!0},l.default.createElement(E.Dashicon,{icon:"trash"}),"Delete")))}]}),l.default.createElement(d.default,{isOpen:O,onClose:()=>C(!1),accountId:N}),l.default.createElement(m.default,{isOpen:k,title:"Are you sure?",buttons:[j?"Please wait ...":"Yes I'm sure","Cancel"],okDisabled:j,cancelDisabled:j,onAccept:()=>a(this,void 0,void 0,(function*(){L(!0);try{yield S(v.deleteAccount(T.id))}catch(e){n&&n("An error occurred while trying to remove the account.")}finally{R()}})),onCancel:R},l.default.createElement("p",null,"Are you sure you want to delete"," ",l.default.createElement("span",{style:{fontWeight:"bold"}},T?T.username:""),"?"," ","This will also delete all saved media associated with this account."),T&&T.type===r.Account.Type.BUSINESS&&1===w&&l.default.createElement("p",null,l.default.createElement("b",null,"Note:")," ",l.default.createElement("span",null,"Because this is your only connected Business account, deleting it will"," ","also cause any feeds that show public hashtag posts to no longer work."))))}},function(e,t,n){e.exports={"username-col":"AccountsList__username-col",usernameCol:"AccountsList__username-col","actions-col":"AccountsList__actions-col",actionsCol:"AccountsList__actions-col","username-cell":"AccountsList__username-cell",usernameCell:"AccountsList__username-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-btn":"AccountsList__actions-btn",actionsBtn:"AccountsList__actions-btn","usages-cell":"AccountsList__usages-cell",usagesCell:"AccountsList__usages-cell","usages-col":"AccountsList__usages-col",usagesCol:"AccountsList__usages-col","type-cell":"AccountsList__type-cell",typeCell:"AccountsList__type-cell","type-col":"AccountsList__type-col",typeCol:"AccountsList__type-col"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccountsOnboarding=void 0;const o=a(n(0)),l=a(n(985)),i=a(n(236)),r=n(225),s=n(45);t.AccountsOnboarding=function({onConnect:e,beforeConnect:t,isTransitioning:n}){return o.default.createElement(r.Onboarding,{className:l.default.root,isTransitioning:n},o.default.createElement("div",{className:l.default.left},o.default.createElement("h1",null,"Connect your Instagram account"),o.default.createElement("p",null,"You can connect the following types of accounts in Spotlight:"),o.default.createElement("ul",{className:l.default.list},o.default.createElement("li",null,o.default.createElement("a",{href:s.AdminResources.connectPersonalAccount,target:"_blank"},"Personal account")),o.default.createElement("li",null,o.default.createElement("a",{href:s.AdminResources.connectBusinessAccount,target:"_blank"},"Business account")),o.default.createElement("li",null,"Your client's account (",o.default.createElement("a",{href:s.AdminResources.connectAccessToken,target:"_blank"},"using an access token"),")")),o.default.createElement("p",null,o.default.createElement("a",{href:s.AdminResources.personalVsBusinessAccount,target:"_blank"},"What's the difference between a Personal account and a Business account?"))),o.default.createElement("div",null,o.default.createElement(i.default,{beforeConnect:e=>t&&t(e),onConnect:t=>e&&e(t),useColumns:!0,showPrompt:!1})))}},function(e,t,n){e.exports={root:"AccountsOnboarding__root",left:"AccountsOnboarding__left",list:"AccountsOnboarding__list","learn-more-business":"AccountsOnboarding__learn-more-business",learnMoreBusiness:"AccountsOnboarding__learn-more-business","first-msg":"AccountsOnboarding__first-msg",firstMsg:"AccountsOnboarding__first-msg",spacer:"AccountsOnboarding__spacer"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsConfigTab=void 0;const o=a(n(0)),l=n(266),i=n(987),r=n(989),s=n(995);t.SettingsConfigTab=function(){return o.default.createElement(l.SettingsPage,null,o.default.createElement(i.SettingsImportingGroup,null),o.default.createElement(r.SettingsOptimizationGroup,null),o.default.createElement(s.SettingsTweaksGroup,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsImportingGroup=void 0;const o=a(n(0)),l=n(147),i=n(988);t.SettingsImportingGroup=function(){return o.default.createElement(l.SettingsGroup,{title:"Import options"},o.default.createElement(i.ImportIntervalField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ImportIntervalField=void 0;const o=a(n(0)),l=n(88),i=a(n(42)),r=n(40),s=n(1),u=n(33),c=n(47);t.ImportIntervalField=function(){const e=s.useDispatch(),t=s.useSelector(u.selectSetting("importerInterval"));return o.default.createElement(l.SettingsField,{id:"settings-import-interval",label:"Check for new posts"},o.default.createElement(r.Select,{id:"settings-import-interval",width:250,value:t,onChange:t=>e(c.updateSettings({importerInterval:t.value})),options:i.default.config.cronScheduleOptions}))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsOptimizationGroup=void 0;const o=a(n(0)),l=n(138),i=n(147),r=n(990),s=n(993),u=n(994),c=o.default.createElement("div",null,o.default.createElement(l.Spoiler,{label:"What is this?",stealth:!0},o.default.createElement("div",null,o.default.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."),o.default.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.")))),d=o.default.createElement("div",null,o.default.createElement(u.CleanUpMediaButton,null));t.SettingsOptimizationGroup=function({}){return o.default.createElement(i.SettingsGroup,{title:"Optimization",before:c,after:d},o.default.createElement(r.OptimizeAgeLimitField,null),o.default.createElement(s.OptimizeIntervalField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OptimizeAgeLimitField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=a(n(991)),s=n(33),u=n(47);t.OptimizeAgeLimitField=function({}){var e,t,n;const a=l.useDispatch(),c=(null!==(e=l.useSelector(s.selectSetting("cleanerAgeLimit")))&&void 0!==e?e:"").split(" "),d=null!==(t=parseInt(c[0]))&&void 0!==t?t:0,f=null!==(n=c[1])&&void 0!==n?n:"days";return o.default.createElement(i.SettingsField,{id:"cleanerAgeLimit",label:"Delete unseen posts after"},o.default.createElement(r.default,{id:"cleanerAgeLimit",type:"number",value:d,unit:f,onChange:(e,t)=>a(u.updateSettings({cleanerAgeLimit:`${e} ${t}`})),min:1,units:{days:["day","days"],hours:["hour","hours"],minutes:["minute","minutes"]}}))}},function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(992)),r=n(137),s=n(11),u=n(43);function c(e,t){return 1===parseInt(e.toString())?t[0]:t[1]}t.default=function(e){var{type:t,unit:n,units:o,value:d,min:f,onChange:m}=e,p=a(e,["type","unit","units","value","min","onChange"]);const[_,h]=l.default.useState(!1),g="object"==typeof o&&!u.Dictionary.isEmpty(o),b=()=>h(e=>!e),v=e=>{switch(e.key){case" ":case"Enter":b();break;default:return}e.preventDefault(),e.stopPropagation()};return(null==d||isNaN(d))&&(d=""),l.default.createElement("div",{className:i.default.root},l.default.createElement("input",Object.assign({},p,{className:i.default.input,type:null!=t?t:"text",value:d,min:f,onChange:e=>m&&m(e.currentTarget.value,n)})),l.default.createElement("div",{className:i.default.unitContainer},g&&l.default.createElement(r.Menu,{isOpen:_,onBlur:()=>h(!1)},({ref:e})=>l.default.createElement("div",{ref:e,className:i.default.unitSelector,role:"button",onClick:b,onKeyDown:v,tabIndex:0},l.default.createElement("span",{className:i.default.currentUnit},c(d,u.Dictionary.get(o,n))),l.default.createElement(s.Dashicon,{icon:"arrow-down-alt2",className:_?i.default.menuChevronOpen:i.default.menuChevron})),u.Dictionary.keys(o).map(e=>{const t=u.Dictionary.get(o,e),n=c(d,t);return l.default.createElement(r.MenuItem,{key:n,onClick:()=>(m&&m(d,e),void h(!1))},n)})),!g&&l.default.createElement("div",{className:i.default.unitStatic},l.default.createElement("span",null,n))))}},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"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OptimizeIntervalField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=a(n(42)),s=n(40),u=n(33),c=n(47);t.OptimizeIntervalField=function({}){const e=l.useDispatch(),t=l.useSelector(u.selectSetting("cleanerInterval"));return o.default.createElement(i.SettingsField,{id:"cleanerInterval",label:"Run optimization"},o.default.createElement(s.Select,{id:"cleanerInterval",width:250,value:t,options:r.default.config.cronScheduleOptions,onChange:t=>e(c.updateSettings({cleanerInterval:t.value}))}))}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CleanUpMediaButton=void 0;const l=o(n(0)),i=n(8),r=n(1),s=n(75),u=n(33),c=n(62);t.CleanUpMediaButton=function(){const e=r.useDispatch(),t=r.useSelector(u.selectSetting("cleanerAgeLimit"));return l.default.createElement(i.Button,{type:i.ButtonType.SECONDARY,size:i.ButtonSize.NORMAL,onClick:()=>a(this,void 0,void 0,(function*(){var n;e(s.showToast({key:"admin/clean_up_media/wait",message:"Optimizing, please wait ...",type:s.ToastType.STICKY}));try{const a=null!==(n=(yield c.AdminRestApi.media.cleanUp(t)).data.numCleaned)&&void 0!==n?n:0;e(s.showToast({key:"admin/clean_up_media/done",message:`Done! ${a} old posts have been removed.`}))}finally{e(s.removeToast("admin/clean_up_media/wait"))}}))},"Optimize now")}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsTweaksGroup=void 0;const o=a(n(0)),l=n(138),i=n(147),r=n(996),s=o.default.createElement("div",null,o.default.createElement(l.Spoiler,{label:"What is this?",stealth:!0},o.default.createElement("div",null,o.default.createElement("p",null,"With this option enabled, Spotlight will pre-load the first set of posts into the page. This"," ","makes the feed load faster, but can make the page slightly slower."),o.default.createElement("p",null,"By default, this option is disabled. The feed will show grey loading boxes while the posts are"," ","being loaded in the background. This makes the feed slower, but won't impact the rest of the page."),o.default.createElement("p",null,"We recommend turning this option on when your feed is immediately visible when the page loads."," ","If your feed is further down the page, it will probably have enough time to load before your"," ","visitors can see it, so you can leave this turned off for faster page loading."))));t.SettingsTweaksGroup=function(){return o.default.createElement(i.SettingsGroup,{title:"Performance Tweaks",before:s},o.default.createElement(r.PreloadPostsField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PreloadPostsField=void 0;const o=a(n(0)),l=n(88),i=n(1),r=n(33),s=n(47);t.PreloadPostsField=function(){const e=i.useDispatch(),t=i.useSelector(r.selectSetting("preloadMedia"));return o.default.createElement(l.SettingsField,{id:"preloadMedia"},o.default.createElement("label",{htmlFor:"preloadMedia"},o.default.createElement("span",{style:{marginRight:10}},"Pre-load the first page of posts"),o.default.createElement("input",{id:"preloadMedia",type:"checkbox",checked:t,onChange:t=>e(s.updateSettings({preloadMedia:t.target.checked}))})))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsToolsTab=void 0;const o=a(n(0)),l=n(266),i=n(998);t.SettingsToolsTab=function(){return o.default.createElement(l.SettingsPage,null,o.default.createElement(i.SettingsCacheGroup,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsCacheGroup=void 0;const o=a(n(0)),l=n(88),i=a(n(999)),r=n(147);t.SettingsCacheGroup=function(){return o.default.createElement(r.SettingsGroup,{title:"Cache"},o.default.createElement(l.SettingsField,{id:"clearCache",label:"If you are experiencing issues, clearing the plugin's cache may help."},o.default.createElement(i.default,null)))}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(1e3)),r=n(8),s=n(408),u=n(1),c=n(75),d=n(20),f=n(62),m=n(45),p=n(139);t.default=function({}){const e=u.useDispatch(),[t,n]=l.default.useState(!1);s.useSafeEffect(e=>{e&&t&&o().then(()=>{e&&n(!1)})},[t]);const o=()=>a(this,void 0,void 0,(function*(){e(c.removeToast("admin/clear_cache/done")),e(c.showToast({key:"admin/clear_cache/please_wait",message:"Clearing the cache ...",type:c.ToastType.STICKY}));try{yield f.AdminRestApi.cache.clearAll(),e(c.showToast({key:"admin/clear_cache/done",message:"Cleared cache successfully!"}))}catch(e){p.triggerError({type:"clear_cache/error",message:d.getErrorResponseMessage(e)})}finally{e(c.removeToast("admin/clear_cache/please_wait"))}}));return l.default.createElement("div",{className:i.default.root},l.default.createElement(r.Button,{disabled:t,onClick:()=>{n(!0)}},"Clear the cache"),l.default.createElement("a",{href:m.AdminResources.cacheDocsUrl,target:"_blank",className:i.default.docLink},"What's this?"))}},function(e,t,n){e.exports={root:"ClearCacheButton__root layout__flex-row","doc-link":"ClearCacheButton__doc-link",docLink:"ClearCacheButton__doc-link"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";(function(e){var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminRootInner=t.AdminRoot=void 0;const i=n(289),r=l(n(0)),s=n(208),u=n(1003),c=n(84),d=n(411),f=n(1006),m=n(1007),p=n(1012),_=n(1017),h=n(9),g=n(1),b=n(409),v=n(1019),y=n(75),E=n(52),S=n(63),P=n(56),w=n(139),O=document.title.replace("Spotlight","%s ‹ Spotlight");function C(){const e=g.useDispatch(),t=g.useSelector(v.selectIsAdminAppLoaded),n=g.useSelector(v.selectIsAdminAppLoading),a=g.useSelector(S.selectScreen);r.useEffect(()=>{const e=c.Screens.getScreen(a);e&&(document.title=O.replace("%s",e.title))},[a]);const o=e=>{var t,n;const a=null!==(n=null!==(t=e.detail.message)&&void 0!==t?t:e.detail.response.data.message)&&void 0!==n?n:null;w.triggerError({type:"feed/fetch_media/error",message:a})},l=()=>{e(y.showToast({key:"admin/feed/import/pending",type:y.ToastType.STICKY,message:"Retrieving posts from Instagram. This may take around 30 seconds."}))},i=()=>{e(y.removeToast("admin/feed/import/pending"))},b=e=>{w.triggerError({type:"feed/import_media/error",message:e.message})};return r.useEffect(()=>(document.addEventListener(h.FetchFailEvent.Type,o),document.addEventListener(P.RestApi.media.events.import.start,l),document.addEventListener(P.RestApi.media.events.import.end,i),document.addEventListener(P.RestApi.media.events.import.fail,b),()=>{document.removeEventListener(h.FetchFailEvent.Type,o),document.removeEventListener(P.RestApi.media.events.import.start,l),document.removeEventListener(P.RestApi.media.events.import.end,i),document.removeEventListener(P.RestApi.media.events.import.fail,b)}),[]),n||!t?r.default.createElement(r.default.Fragment,null,r.default.createElement(d.AdminLoading,null),r.default.createElement(p.Toaster,null)):r.default.createElement(s.Router,{history:E.RouterHistory},c.Screens.getList().map((e,t)=>r.default.createElement(u.QueryRoute,{key:e.id,when:"screen",is:e.id,isRoot:0===t,render:()=>r.default.createElement(e.component)})),r.default.createElement(m.NewsBeacon,null),r.default.createElement(_.ModalLayer,null),r.default.createElement(f.ConnectAccountListener,null),r.default.createElement(p.Toaster,null))}t.AdminRoot=i.hot(e)((function(){return r.default.createElement(g.Provider,{store:b.AdminAppStore},r.default.createElement(C,null))})),t.AdminRootInner=C}).call(this,n(78)(e))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueryRoute=void 0;const a=n(1004);t.QueryRoute=function({when:e,is:t,isRoot:n,render:o}){const l=a.useUrlParams().get(e);return l===t||!t&&!l||n&&!l?o():null}},,function(e,t,n){},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectAccountListener=void 0;const o=a(n(0)),l=n(29),i=a(n(148)),r=a(n(221)),s=n(172),u=n(69),c=n(45);t.ConnectAccountListener=function(){const[e,t]=o.default.useState(null),[n,a]=o.default.useState(!1),[d,f]=o.default.useState(!1),m=()=>{s.AccountManager.State.connectedId=null};return u.useDocumentEventListener(s.AccountManager.ACCOUNT_CONNECTED_EVENT,e=>{const o=e.detail.account;n||d||o.type!==l.Account.Type.PERSONAL||o.customBio.length||o.customProfilePicUrl.length||(t(o.id),a(!0))}),o.default.createElement(o.default.Fragment,null,o.default.createElement(i.default,{title:"You've successfully connected your account!",buttons:["Yes","No, maybe later"],isOpen:n,onAccept:()=>{a(!1),f(!0)},onCancel:()=>{a(!1),m()}},o.default.createElement("p",null,"One more thing ..."),o.default.createElement("p",null,"Instagram doesn't provide the profile photo and bio text for Personal accounts."," ","Would you like to set a custom photo and a custom bio in Spotlight to match your Instagram profile?"),o.default.createElement("p",null,o.default.createElement("a",{href:c.AdminResources.customPersonalInfoUrl,target:"_blank"},"What's this about?"))),o.default.createElement(r.default,{isOpen:d,onClose:()=>{f(!1),m()},accountId:e}))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NewsBeacon=void 0;const o=a(n(0)),l=a(n(1008)),i=n(1),r=n(11),s=n(178),u=n(137),c=n(1009),d=n(410),f=n(1010);t.NewsBeacon=function(){const e=i.useDispatch(),t=i.useSelector(c.selectNewsMessages),n=i.useSelector(c.selectIsNewsHidden),a=i.useSelector(c.selectIsNewsOpen),m=()=>e(d.openNews()),p=s.useKeyboardActivate(m);return!n&&t.length>0&&o.default.createElement(u.Menu,{className:l.default.menu,isOpen:a,onBlur:()=>e(d.closeNews()),placement:"top-end"},({ref:e})=>o.default.createElement("div",{ref:e,className:l.default.beacon},o.default.createElement("button",{className:l.default.button,onClick:m,onKeyPress:p},o.default.createElement(r.Dashicon,{icon:"megaphone"}),t.length>0&&o.default.createElement("div",{className:l.default.counter},t.length))),o.default.createElement(u.MenuContent,null,t.map(e=>o.default.createElement(f.NewsBeaconMessage,{key:e.id,message:e})),a&&o.default.createElement("a",{className:l.default.hideLink,onClick:()=>e(d.hideNews())},"Hide")))}},function(e,t,n){e.exports={beacon:"NewsBeacon__beacon",button:"NewsBeacon__button","button-animation":"NewsBeacon__button-animation",buttonAnimation:"NewsBeacon__button-animation",counter:"NewsBeacon__counter","hide-link":"NewsBeacon__hide-link",hideLink:"NewsBeacon__hide-link",menu:"NewsBeacon__menu"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectIsNewsHidden=t.selectIsNewsOpen=t.selectNewsMessages=void 0,t.selectNewsMessages=e=>e.news.messages,t.selectIsNewsOpen=e=>e.news.isOpen,t.selectIsNewsHidden=e=>e.news.isHidden},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NewsBeaconMessage=void 0;const r=l(n(0)),s=i(n(1011)),u=i(n(216)),c=i(n(422)),d=n(104),f=n(1),m=n(63),p=n(52);t.NewsBeaconMessage=function({message:e}){const t=f.useDispatch(),n=f.useSelector(m.selectRoute),a=r.default.useRef();return r.useEffect(()=>{if(!a.current)return;const e=a.current.getElementsByTagName("a");for(let a=0;a<e.length;++a){const o=e.item(a);if("true"===o.getAttribute("data-sli-link"))continue;const l=o.getAttribute("href");if("string"!=typeof l||!l.startsWith("app://"))continue;const i=d.parse(l.substr("app://".length)),r=(n.setQuery(i),n.getAbsUrl(i));o.setAttribute("href",r),o.setAttribute("data-sli-link","true"),o.addEventListener("click",e=>{t(p.gotoRoute(i)),e.preventDefault(),e.stopPropagation()})}},[a.current]),r.default.createElement("article",{className:s.default.root},e.title&&e.title.length&&r.default.createElement("header",{className:s.default.title},e.title),r.default.createElement("main",{ref:a,className:s.default.content,dangerouslySetInnerHTML:{__html:e.content}}),e.date&&r.default.createElement("footer",{className:s.default.date},c.default(u.default(e.date),{addSuffix:!0})))}},function(e,t,n){e.exports={root:"NewsBeaconMessage__root",text:"NewsBeaconMessage__text",title:"NewsBeaconMessage__title NewsBeaconMessage__text",content:"NewsBeaconMessage__content NewsBeaconMessage__text",date:"NewsBeaconMessage__date"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Toaster=void 0;const o=a(n(0)),l=a(n(1013)),i=n(1),r=n(1014),s=n(1015);t.Toaster=function(){const e=i.useSelector(r.selectToasts);return o.default.createElement("div",{className:l.default.root},o.default.createElement("div",{className:l.default.container},e.map(e=>o.default.createElement(s.Toast,{key:e.key,toast:e}))))}},function(e,t,n){e.exports={root:"Toaster__root layout__z-highest",container:"Toaster__container"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectToasts=void 0;const a=n(43);t.selectToasts=e=>a.Dictionary.values(e.toasts)},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Toast=void 0;const r=l(n(0)),s=i(n(1016)),u=n(1),c=n(11),d=n(75),f=n(45);function m({toast:e}){return r.default.createElement("p",null,e.message)}function p({toast:e}){return r.default.createElement("div",null,r.default.createElement("p",{className:s.default.heading},"Spotlight has encountered an error:"),r.default.createElement("p",{className:s.default.message},e.message),e.details&&r.default.createElement("pre",{className:s.default.details},e.details),r.default.createElement("p",{className:s.default.footer},"If this error persists, kindly"," ",r.default.createElement("a",{href:f.AdminResources.supportUrl,target:"_blank"},"contact customer support"),"."))}t.Toast=function({toast:e}){var t;const n=u.useDispatch(),[a,o]=r.default.useState(!1);let l=r.default.useRef(),i=r.default.useRef();const f=null!==(t=e.type)&&void 0!==t?t:d.ToastType.NOTIFICATION,_=f===d.ToastType.NOTIFICATION,h=()=>n(d.removeToast(e.key)),g=()=>{_&&(l.current=setTimeout(v,5e3))},b=()=>{clearTimeout(l.current)},v=()=>{o(!0),i.current=setTimeout(h,200)};r.useEffect(()=>(g(),()=>{b(),clearTimeout(i.current)}),[]);const y=a?s.default.rootFadingOut:s.default.root;return r.default.createElement("div",{className:y,onMouseOver:b,onMouseOut:g},r.default.createElement("div",{className:s.default.content},f===d.ToastType.ERROR?r.default.createElement(p,{toast:e}):r.default.createElement(m,{toast:e})),r.default.createElement("button",{className:s.default.dismissBtn,onClick:()=>{b(),v()}},r.default.createElement(c.Dashicon,{icon:"no-alt",className:s.default.dismissIcon})))}},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"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ModalLayer=void 0;const o=a(n(0)),l=a(n(1018)),i=n(14);t.ModalLayer=function(){return o.default.createElement("div",{className:i.classList(l.default.modalLayer,"spotlight-modal-target")})}},function(e,t,n){e.exports={"modal-layer":"ModalLayer__modal-layer",modalLayer:"ModalLayer__modal-layer"}}]]);
1
+ (window.webpackJsonpSpotlight=window.webpackJsonpSpotlight||[]).push([[4],[,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Button=t.ButtonSize=t.ButtonType=void 0;const l=o(n(0)),i=n(14),r=n(155),s=o(n(218));n(302);const u=n(108);var c,d;!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"}(c=t.ButtonType||(t.ButtonType={})),function(e){e[e.SMALL=0]="SMALL",e[e.NORMAL=1]="NORMAL",e[e.LARGE=2]="LARGE",e[e.HERO=3]="HERO"}(d=t.ButtonSize||(t.ButtonSize={})),t.Button=l.default.forwardRef((e,t)=>{let{children:n,className:o,type:f,size:m,active:p,tooltip:_,tooltipPlacement:h,onClick:g,linkTo:b}=e,v=a(e,["children","className","type","size","active","tooltip","tooltipPlacement","onClick","linkTo"]);f=null!=f?f:c.SECONDARY,m=null!=m?m:d.NORMAL,h=null!=h?h:"bottom";const[y,E]=l.default.useState(!1),S=()=>E(!0),P=()=>E(!1),w=i.classList(o,f!==c.NONE?"button":null,f===c.PRIMARY?"button-primary":null,f===c.SECONDARY?"button-secondary":null,f===c.LINK?"button-secondary button-tertiary":null,f===c.PILL?"button-secondary button-tertiary button-pill":null,f===c.TOGGLE?"button-toggle":null,f===c.TOGGLE&&p?"button-secondary button-active":null,f!==c.TOGGLE||p?null:"button-secondary",f===c.DANGER?"button-secondary button-danger":null,f===c.DANGER_LINK?"button-tertiary button-danger":null,f===c.DANGER_PILL?"button-tertiary button-danger button-danger-pill":null,m===d.SMALL?"button-small":null,m===d.LARGE?"button-large":null,m===d.HERO?"button-hero":null),O=e=>{g&&g(e)};let C="button";if("string"==typeof b?(C="a",v.href=b):v.type="button",v.tabIndex=0,!_)return l.default.createElement(C,Object.assign({ref:t,className:w,onClick:O},v),n);const N="string"==typeof _,M="btn-tooltip-"+u.uniqueNum(),k=N?_:l.default.createElement(_,{id:M});return l.default.createElement(s.default,{visible:y&&!e.disabled,placement:h,delay:300},({ref:e})=>l.default.createElement(C,Object.assign({ref:t?r.mergeRefs(e,t):e,className:w,onClick:O,onMouseEnter:S,onMouseLeave:P},v),n),k)})},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectExpiringAccounts=t.selectBusinessAccounts=t.selectAccountList=t.selectHasBusinessAccounts=t.selectHasAccounts=t.selectAccountById=t.selectAccounts=void 0;const a=n(43),o=n(29),l=n(463);t.selectAccounts=e=>a.Dictionary.values(e.accounts),t.selectAccountById=e=>t=>a.Dictionary.get(t.accounts,e),t.selectHasAccounts=e=>!a.Dictionary.isEmpty(e.accounts),t.selectHasBusinessAccounts=e=>t.selectBusinessAccounts(e).length>0,t.selectAccountList=e=>n=>e.map(e=>t.selectAccountById(e)(n)).filter(e=>!!e),t.selectBusinessAccounts=e=>t.selectAccounts(e).filter(e=>e.type===o.Account.Type.BUSINESS),t.selectExpiringAccounts=e=>t.selectAccounts(e).filter(l.isAccountTokenExpiring)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NumberField=void 0;const o=a(n(0)),l=n(543),i=n(339);t.NumberField=function({value:e,onChange:t,min:n,max:a,emptyMin:r,placeholder:s,id:u,unit:c}){n=null!=n?n:0,a=null!=a?a:1/0,e=null!=e?e:"",e=isNaN(parseInt(e.toString()))?n:e,s=null!=s?s:"",r=null!=r&&r;const d=o.default.useCallback(e=>{const o=""===e.target.value?n:parseInt(e.target.value);isNaN(o)||t&&t(i.clampNum(o,n,a))},[n,a,t]),f=o.default.useCallback(()=>{r&&e<=n&&e>=a&&t&&t("")},[r,e,n,a,t]),m=o.default.useCallback(a=>{"ArrowUp"===a.key&&""===e&&t&&t(r?n+1:n)},[e,n,r,t]),p=r&&e<=n?"":e,[_,h]=Array.isArray(c)?c:[c,c],g=1===e?_:h;return g?o.default.createElement(l.UnitInput,{id:u,type:"number",unit:g,value:p,min:n,max:a,placeholder:s+"",onChange:d,onBlur:f,onKeyDown:m}):o.default.createElement("input",{id:u,type:"number",value:p,min:n,max:a,placeholder:s+"",onChange:d,onBlur:f,onKeyDown:m})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectSetting=t.selectSettingsValues=t.selectSettingsAreSaving=t.selectSettingsAreDirty=void 0,t.selectSettingsAreDirty=e=>{var t;return null===(t=e.settings)||void 0===t?void 0:t.isDirty},t.selectSettingsAreSaving=e=>{var t;return null===(t=e.settings)||void 0===t?void 0:t.isSaving},t.selectSettingsValues=e=>{var t,n;return null!==(n=null===(t=e.settings)||void 0===t?void 0:t.values)&&void 0!==n?n:{}},t.selectSetting=e=>t=>{var n,a;return null!==(a=null===(n=t.settings)||void 0===n?void 0:n.values[e])&&void 0!==a?a:null}},,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CheckboxField=void 0;const o=a(n(0)),l=a(n(554));t.CheckboxField=function({id:e,value:t,onChange:n,disabled:a}){return o.default.createElement("div",{className:l.default.checkboxField},o.default.createElement("div",{className:l.default.aligner},o.default.createElement("input",{id:e,type:"checkbox",value:"1",checked:!!t,onChange:e=>n(e.target.checked),disabled:a})))}},,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Message=t.MessageType=void 0;const o=a(n(0)),l=a(n(483)),i=n(14),r=n(11);var s;function u(e){switch(e){case s.SUCCESS:return"yes-alt";case s.PRO_TIP:return"lightbulb";case s.ERROR:case s.WARNING:return"warning";case s.INFO:default:return"info"}}!function(e){e.SUCCESS="success",e.INFO="info",e.PRO_TIP="pro-tip",e.WARNING="warning",e.ERROR="error",e.GREY="grey"}(s=t.MessageType||(t.MessageType={})),t.Message=({children:e,type:t,showIcon:n,shake:a,isDismissible:s,onDismiss:c})=>{const[d,f]=o.default.useState(!1),m=i.classList(l.default[t],a?l.default.shaking:null);return d?null:o.default.createElement("div",{className:m},n?o.default.createElement("div",null,o.default.createElement(r.Dashicon,{className:l.default.icon,icon:u(t)})):null,o.default.createElement("div",{className:l.default.content},e),s?o.default.createElement("button",{className:l.default.dismissBtn,onClick:()=>{s&&(f(!0),c&&c())}},o.default.createElement(r.Dashicon,{icon:"no"})):null)}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Select=t.SelectStyles=void 0;const o=a(n(0)),l=a(n(334)),i=a(n(537)),r=a(n(538)),s=a(n(539)),u=n(14);t.SelectStyles=(e={})=>({option:(e,t)=>Object.assign(Object.assign({},e),{cursor:"pointer",lineHeight:"24px"}),menu:(e,t)=>Object.assign(Object.assign({},e),{margin:"6px 0",boxShadow:"0 2px 8px "+s.default.shadowColor,overflow:"hidden"}),menuList:(e,t)=>({padding:"0px"}),control:(e,t)=>{let n=Object.assign(Object.assign({},e),{cursor:"pointer",lineHeight:"2",minHeight:"40px"});return t.isFocused&&(n.borderColor=s.default.primaryColor,n.boxShadow="0 0 0 1px "+s.default.primaryColor),n},valueContainer:(e,t)=>Object.assign(Object.assign({},e),{paddingTop:0,paddingBottom:0,paddingRight:0}),container:(t,n)=>Object.assign(Object.assign({},t),{width:e.width||"100%"}),multiValue:(e,t)=>Object.assign(Object.assign({},e),{padding:"0 6px"}),input:(e,t)=>Object.assign(Object.assign({},e),{outline:"0 transparent !important",border:"0 transparent !important",boxShadow:"0 0 0 transparent !important"}),indicatorSeparator:(e,t)=>Object.assign(Object.assign({},e),{margin:"0",backgroundColor:"transparent"}),menuPortal:e=>Object.assign(Object.assign({},e),{zIndex:9999999})}),t.Select=o.default.forwardRef((e,n)=>{var a;const c=(null!==(a=e.options)&&void 0!==a?a:[]).find(t=>t.value===e.value);e=Object.assign(Object.assign({},e),{id:void 0,className:u.classList("react-select",e.className),classNamePrefix:"react-select",inputId:e.id,menuPosition:"absolute"});const d=t.SelectStyles(e),f=e.isCreatable?i.default:e.async?r.default:l.default;return o.default.createElement(f,Object.assign({},e,{ref:n,isSearchable:e.isCreatable,value:c,styles:d,theme:e=>Object.assign(Object.assign({},e),{borderRadius:3,colors:Object.assign(Object.assign({},e.colors),{primary:s.default.primaryColor,primary25:s.default.washedColor})}),menuPlacement:"auto",menuPortalTarget:document.body,menuShouldScrollIntoView:!0}))})},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarLayout=void 0;const r=l(n(0)),s=i(n(847)),u=n(11),c=n(267);function d(e){return r.default.createElement(c.ResponsiveContainer,{breakpoints:[d.BREAKPOINT]},r.default.createElement(f,Object.assign({},e)))}function f({content:e,sidebar:t,primary:n,current:a,useDefaults:o}){const[l,i]=r.useState(n),u=r.default.useContext(c.ResponsiveContext)<=d.BREAKPOINT,f=()=>i(p?"content":"sidebar"),m=()=>i(p?"sidebar":"content"),p="content"===(n=null!=n?n:"content"),_="sidebar"===n,h="content"===(a=o?l:a),g="sidebar"===a,b=p?s.default.layoutPrimaryContent:s.default.layoutPrimarySidebar;return r.default.createElement("div",{className:b},r.default.createElement(d.Context.Provider,{value:u},e&&(h||!u)&&r.default.createElement("div",{className:s.default.content},o&&r.default.createElement(d.Navigation,{align:p?"right":"left",text:!p&&r.default.createElement("span",null,"Go back"),icon:p?"admin-generic":"arrow-left",onClick:p?m:f}),null!=e?e:null),t&&(g||!u)&&r.default.createElement("div",{className:s.default.sidebar},o&&r.default.createElement(d.Navigation,{align:_?"right":"left",text:!_&&r.default.createElement("span",null,"Go back"),icon:_?"admin-generic":"arrow-left",onClick:_?m:f}),null!=t?t:null)))}t.SidebarLayout=d,function(e){e.BREAKPOINT=968,e.Context=r.default.createContext(!1),e.Navigation=function({icon:e,text:t,align:n,onClick:a}){return t=null!=t?t:"Go back",e=null!=e?e:"arrow-left-alt",n=null!=n?n:"left",r.default.createElement("div",{className:"right"===n?s.default.navigationRight:s.default.navigationLeft},r.default.createElement("a",{className:s.default.navLink,onClick:a},e&&r.default.createElement(u.Dashicon,{icon:e}),r.default.createElement("span",null,null!=t?t:"")))}}(d=t.SidebarLayout||(t.SidebarLayout={}))},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminCommonConfig=void 0,n(430);const o=n(20),l=n(56),i=n(62);t.AdminCommonConfig=SliAdminCommonConfig,o.client.interceptors.request.use(e=>(e.headers["X-WP-Nonce"]=SliAdminCommonConfig.restApi.wpNonce,e),e=>Promise.reject(e));const r={config:{rootId:"spotlight-instagram-admin",adminUrl:SliAdminCommonConfig.adminUrl,doOnboarding:"1"==SliAdminCommonConfig.doOnboarding,cronSchedules:SliAdminCommonConfig.cronSchedules,cronScheduleOptions:SliAdminCommonConfig.cronSchedules.map(e=>({value:e.key,label:e.display})),postTypes:SliAdminCommonConfig.postTypes,hasElementor:SliAdminCommonConfig.hasElementor,searchPosts:(e,t="")=>a(void 0,void 0,void 0,(function*(){return(yield i.AdminRestApi.wp.posts.search(e,t)).data}))},restApi:{config:SliAdminCommonConfig.restApi},editor:{preview:SliAdminCommonConfig.preview}};t.default=r,l.RestApi.config.autoImportMedia=!0},,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AdminResources=void 0;const a=n(42);t.AdminResources={upgradeUrl:"https://spotlightwp.com/pricing/",upgradeNavbarUrl:"https://spotlightwp.com/pricing/?utm_source=sl_plugin&utm_medium=sl_plugin_upgrade&utm_campaign=sl_plugin_upgrade_list",pricingUrl:"https://spotlightwp.com/pricing/",proComingSoonUrl:"https://spotlightwp.com/pro-coming-soon/",supportUrl:"https://spotlightwp.com/support/",supportNavbarUrl:"https://spotlightwp.com/support/?utm_source=sl_plugin&utm_medium=sl_plugin_support&utm_campaign=sl_plugin_support_list",customPersonalInfoUrl:"https://docs.spotlightwp.com/article/624-custom-profile-photo-and-bio-text",connectPersonalAccount:"https://docs.spotlightwp.com/article/551-connect-a-personal-account",connectBusinessAccount:"https://docs.spotlightwp.com/article/552-connect-a-business-account",connectAccessToken:"https://docs.spotlightwp.com/article/731-connect-an-access-token",personalVsBusinessAccount:"https://docs.spotlightwp.com/article/553-personal-vs-business-accounts",businessAccounts:"https://docs.spotlightwp.com/article/555-how-to-switch-to-a-business-account",cacheDocsUrl:"https://docs.spotlightwp.com/article/639-cache",promoTypesSurvey:"https://spotlightwp.com/survey-promote/",tokenGenerator:"https://spotlightwp.com/access-token-generator",upgradeLocalUrl:a.AdminCommonConfig.adminUrl+"admin.php?page=spotlight-instagram-pricing",trialLocalUrl:a.AdminCommonConfig.adminUrl+"admin.php?page=spotlight-instagram-pricing&billing_cycle=annual&trial=true"}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.restoreSettings=t.updateSettings=t.SettingsSlice=void 0;const l=n(15),i=n(21),r=n(74),s=n(102),u=n(25),c=n(126);function d(e){i.Common.config.promotions.global=e.values.promotions,i.Common.config.promotions.autos=e.values.autoPromotions}t.SettingsSlice=l.createSlice({name:"settings",initialState:{values:{},original:{},isDirty:!1,isSaving:!1},reducers:{update(e,t){e.values=u.withPartial(e.values,t.payload),e.isDirty=!s.objectsEqual(e.values,e.original),d(e)},restore(e){e.values=r.cloneObj(e.original),e.isDirty=!1,d(e)}},extraReducers:e=>e.addCase(c.saveSettings.pending,e=>{e.isSaving=!0}).addCase(c.saveSettings.rejected,e=>{e.isSaving=!1}).addMatcher(l.isFulfilled(c.saveSettings,c.loadSettings),(e,t)=>{e.original=t.payload,e.values=r.cloneObj(e.original),e.isSaving=!1,e.isDirty=!1,d(e)})}),o(n(836),t),t.updateSettings=t.SettingsSlice.actions.update,t.restoreSettings=t.SettingsSlice.actions.restore},,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.modifyRoute=t.gotoScreen=t.gotoRoute=t.gotoUrl=t.RouterSlice=t.addRouteInterceptor=t.RouterHistory=void 0;const l=n(15),i=n(104),r=n(50),s=n(217),u=n(25),c=n(43),d=n(108);t.RouterHistory=r.createBrowserHistory();const f={};function m(e,n,a){if(!a&&!n)throw"updateRoute() must be given either a query or a path!";a=null!=a?a:s.createPath(e,n),n=null!=n?n:i.parse(a),c.Dictionary.values(f).some(e=>!1===e(n,a))||(e.query=n,function(e){setTimeout(()=>t.RouterHistory.push(e,{}))}(a))}var p;t.addRouteInterceptor=function(e){const t="ri"+d.uniqueNum();return c.Dictionary.set(f,t,e),()=>c.Dictionary.remove(f,t)},t.RouterSlice=l.createSlice({name:"router",initialState:{baseUrl:(p=null!=p?p:window.location).protocol+"//"+p.host,pathName:p.pathname,query:Object.assign({},i.parse(p.search))},reducers:{gotoUrl(e,t){m(e,null,t.payload)},gotoRoute(e,t){m(e,u.withPartial({page:e.query.page},t.payload))},gotoScreen(e,t){m(e,{page:e.query.page,screen:t.payload})},modifyRoute(e,t){const n=e.query.page,a=u.withPartial(e.query,t.payload);a.page=n,m(e,a)}}}),t.gotoUrl=t.RouterSlice.actions.gotoUrl,t.gotoRoute=t.RouterSlice.actions.gotoRoute,t.gotoScreen=t.RouterSlice.actions.gotoScreen,t.modifyRoute=t.RouterSlice.actions.modifyRoute,o(n(468),t)},,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ColorPicker=void 0;const r=l(n(0)),s=i(n(558)),u=i(n(559)),c=n(304),d=n(220),f=n(69),m=n(761),p=n(285),_=n(155),h=i(n(42));t.ColorPicker=function({id:e,value:t,disableAlpha:n,onChange:a}){t=null!=t?t:"#fff";const[o,l]=r.default.useState(t),[i,g]=r.default.useState(!1),b=r.default.useRef(),v=r.default.useRef(),y=r.default.useCallback(()=>g(!1),[]),E=r.default.useCallback(()=>g(e=>!e),[]),S=r.default.useCallback(e=>{l(e.rgb),a&&a(e)},[a]),P=r.default.useCallback(e=>{"Escape"===e.key&&i&&(y(),e.preventDefault(),e.stopPropagation())},[i]);r.useEffect(()=>l(t),[t]),d.useDetectOutsideClick(b,y,[v]),c.useDetectTabOut([b,v],y),f.useDocumentEventListener("keydown",P,[i]);const w={preventOverflow:{boundariesElement:document.getElementById(h.default.config.rootId),padding:5}};return r.default.createElement(p.Manager,null,r.default.createElement(p.Reference,null,({ref:t})=>r.default.createElement("button",{ref:_.mergeRefs(b,t),id:e,className:s.default.button,onClick:E},r.default.createElement("span",{className:s.default.colorPreview,style:{backgroundColor:m.colorToString(o)}}))),r.default.createElement(p.Popper,{placement:"bottom-end",positionFixed:!0,modifiers:w},({ref:e,style:t})=>i&&r.default.createElement("div",{className:s.default.popper,ref:_.mergeRefs(v,e),style:t},r.default.createElement(u.default,{color:o,onChange:S,disableAlpha:n}))))}},,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminRestApi=void 0;const o=a(n(453)),l=a(n(454)),i=a(n(455)),r=a(n(456)),s=a(n(457)),u=a(n(458)),c=a(n(459));t.AdminRestApi={feeds:o.default,accounts:l.default,media:i.default,settings:r.default,notifications:s.default,cache:u.default,wp:c.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectQueryParam=t.selectRoute=t.selectScreen=void 0;const a=n(300),o=n(217);t.selectScreen=e=>{var t;return null!==(t=a.extractFromArray(e.router.query.screen))&&void 0!==t?t:""},t.selectRoute=e=>new l(e.router),t.selectQueryParam=e=>t=>o.getRouteParam(t.router,e);class l{constructor(e){Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.state=e}get path(){return o.getRoutePath(this.state)}getParam(e){return o.getRouteParam(this.state,e)}withQuery(e){return o.routeWithQuery(this.state,e)}setQuery(e){return o.routeSetQuery(this.state,e)}withoutParam(e){return o.routeWithoutParam(this.state,e)}getRelUrl(e){return o.getRouteRelUrl(this.state,e)}getAbsUrl(e){return o.getRouteAbsUrl(this.state,e)}}},,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.removeToast=t.showToast=t.ToastsSlice=void 0;const l=n(15),i=n(43);t.ToastsSlice=l.createSlice({name:"toasts",initialState:{},reducers:{showToast(e,t){i.Dictionary.set(e,t.payload.key,t.payload)},removeToast(e,t){i.Dictionary.remove(e,t.payload)}}}),t.showToast=t.ToastsSlice.actions.showToast,t.removeToast=t.ToastsSlice.actions.removeToast,o(n(467),t)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ProPill=void 0;const o=a(n(0)),l=a(n(496)),i=n(14),r=n(45);t.ProPill=({className:e,children:t})=>{const n=o.default.useCallback(()=>{window.open(r.AdminResources.pricingUrl,"_blank")},[]);return o.default.createElement("span",{className:i.classList(l.default.pill,e),onClick:n,tabIndex:-1},"PRO",t)}},,,,,,,,function(e,t,n){"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.Screens=t.SCREENS=void 0,(a=t.SCREENS||(t.SCREENS={})).NEW_FEED="new",a.EDIT_FEED="edit",a.FEED_LIST="feeds",a.SETTINGS="settings",a.PROMOTIONS="promotions",function(e){const t=[];e.getList=function(){return t},e.register=function(n){return t.push(n),t.sort((e,t)=>{var n,a;const o=null!==(n=e.position)&&void 0!==n?n:0,l=null!==(a=t.position)&&void 0!==a?a:0;return Math.sign(o-l)}),e},e.getScreen=function(e){return t.find(t=>t.id===e)}}(t.Screens||(t.Screens={}))},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Modal=void 0;const s=l(n(0)),u=r(n(19)),c=r(n(478)),d=n(14),f=n(479),m=n(69),p=n(11),_=n(222),h=r(n(218));function g({rootRef:e,children:t,className:n,isOpen:a,icon:o,title:l,width:i,height:r,onClose:p,allowShadeClose:_,focusChild:h,portalTo:b}){const v=s.default.useRef(),[y]=f.useDelayedFlag(a,!1,g.ANIMATION_DELAY);if(m.useDocumentEventListener("keydown",e=>{a&&"Escape"===e.key&&(p&&p(),e.preventDefault(),e.stopPropagation())},[],[a,p]),s.useEffect(()=>{v&&v.current&&a&&(null!=h?h:v).current.focus()},[]),!y)return null;const E={width:i=null!=i?i:600,height:r},S=d.classList(c.default.modal,a?c.default.opening:c.default.closing,n,"wp-core-ui-override");_=null==_||_;const P=s.default.createElement("div",{className:S,ref:e},s.default.createElement("div",{className:c.default.shade,tabIndex:-1,onClick:()=>{_&&p&&p()}}),s.default.createElement("div",{ref:v,className:c.default.container,style:E,tabIndex:-1},l?s.default.createElement(g.Header,null,s.default.createElement("h1",null,s.default.createElement(g.Icon,{icon:o}),l),s.default.createElement(g.CloseBtn,{onClick:p})):null,t));let w=b;if(void 0===w){const e=document.getElementsByClassName("spotlight-modal-target");w=0===e.length?document.body:e.item(0)}return u.default.createPortal(P,w)}t.Modal=g,function(e){e.ANIMATION_DELAY=120,e.CloseBtn=({onClick:e})=>{const[t,n]=s.default.useState(!1),a=()=>n(!0),o=()=>n(!1);return s.default.createElement(h.default,{visible:t},({ref:t})=>s.default.createElement(_.DivButton,{ref:t,className:c.default.closeBtn,onClick:e,onMouseEnter:a,onMouseLeave:o,children:s.default.createElement(p.Dashicon,{icon:"no-alt"})}),"Close")},e.Icon=({icon:e})=>e?s.default.createElement(p.Dashicon,{icon:e,className:c.default.icon}):null,e.Header=({children:e})=>s.default.createElement("div",{className:c.default.header},e),e.Content=e=>{var{children:t}=e,n=i(e,["children"]);return s.default.createElement("div",{className:c.default.scroller},s.default.createElement("div",Object.assign({className:c.default.content},n),t))},e.Footer=({children:e})=>s.default.createElement("div",{className:c.default.footer},e)}(g=t.Modal||(t.Modal={}))},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsField=void 0;const o=a(n(0)),l=a(n(835)),i=a(n(238));t.SettingsField=function({id:e,label:t,tooltip:n,fullWidth:a,children:r}){return a=a||!t,o.default.createElement("div",{className:l.default.root},t&&o.default.createElement("div",{className:l.default.label},o.default.createElement("label",{htmlFor:e},t)),o.default.createElement("div",{className:l.default.container},o.default.createElement("div",{className:a?l.default.controlFullWidth:l.default.controlPartialWidth},r),n&&o.default.createElement("div",{className:l.default.tooltip},o.default.createElement(i.default,null,n))))}},,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.updateAccount=t.deleteAccount=t.loadAccounts=void 0;const o=n(15),l=n(56),i=n(62),r=n(20);t.loadAccounts=o.createAsyncThunk("accounts/load",()=>a(void 0,void 0,void 0,(function*(){var e;try{const t=yield l.RestApi.accounts.get();if("object"==typeof t&&Array.isArray(t.data))return null!==(e=null==t?void 0:t.data)&&void 0!==e?e:[]}catch(e){throw r.getErrorResponseMessage(e)}}))),t.deleteAccount=o.createAsyncThunk("accounts/delete",e=>a(void 0,void 0,void 0,(function*(){try{const t=yield i.AdminRestApi.accounts.delete(e);if("object"==typeof t&&Array.isArray(t.data))return t.data}catch(e){throw r.getErrorResponseMessage(e)}throw"Spotlight encountered a problem while trying to delete the account. Kindly contact customer support for assistance."}))),t.updateAccount=o.createAsyncThunk("accounts/update",e=>a(void 0,void 0,void 0,(function*(){return yield i.AdminRestApi.accounts.update(e),e})))},,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectHasFeeds=t.selectFeedById=t.selectFeeds=void 0;const a=n(43);t.selectFeeds=e=>a.Dictionary.values(e.feeds),t.selectFeedById=e=>t=>e?a.Dictionary.get(t.feeds,e):null,t.selectHasFeeds=e=>!a.Dictionary.isEmpty(e.feeds)},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.saveSettings=t.loadSettings=void 0;const o=n(15),l=n(386),i=n(328),r=n(20),s=n(62);function u(e){return a(this,void 0,void 0,(function*(){try{const t=yield e();if("object"==typeof t&&void 0!==t.data)return function(e){var t,n,a,o,l,i,r,s,u,c,d;const f={importerInterval:null!==(t=e.importerInterval)&&void 0!==t?t:"",cleanerAgeLimit:null!==(n=e.cleanerAgeLimit)&&void 0!==n?n:"",cleanerInterval:null!==(a=e.cleanerInterval)&&void 0!==a?a:"",preloadMedia:null!==(o=e.preloadMedia)&&void 0!==o&&o,hashtagWhitelist:null!==(l=e.hashtagWhitelist)&&void 0!==l?l:[],hashtagBlacklist:null!==(i=e.hashtagBlacklist)&&void 0!==i?i:[],captionWhitelist:null!==(r=e.captionWhitelist)&&void 0!==r?r:[],captionBlacklist:null!==(s=e.captionBlacklist)&&void 0!==s?s:[],autoPromotions:null!==(u=e.autoPromotions)&&void 0!==u?u:[],promotions:null!==(c=e.promotions)&&void 0!==c?c:{},thumbnails:null!==(d=e.thumbnails)&&void 0!==d?d:[]};return Array.isArray(f.promotions)&&0===f.promotions.length&&(f.promotions={}),f}(t.data)}catch(e){throw r.getErrorResponseMessage(e)}throw"Spotlight encountered a problem while trying to load your settings. Kindly contact customer support for assistance."}))}t.loadSettings=o.createAsyncThunk("settings/load",()=>a(void 0,void 0,void 0,(function*(){return yield u(()=>s.AdminRestApi.settings.get())}))),t.saveSettings=o.createAsyncThunk("settings/save",(e,t)=>a(void 0,void 0,void 0,(function*(){const e=t.getState().settings;try{const t=yield u(()=>s.AdminRestApi.settings.save(e.values));return document.dispatchEvent(i.createCustomEvent(l.SETTINGS_SAVE_SUCCESS)),t}catch(e){throw document.dispatchEvent(i.createCustomEvent(l.SETTINGS_SAVE_FAILED,{error:e})),e}})))},,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.deleteFeed=t.duplicateFeed=t.saveFeed=t.loadFeeds=void 0;const o=n(15),l=n(56),i=n(62),r=n(75),s=n(74),u=n(20);t.loadFeeds=o.createAsyncThunk("feeds/load",()=>a(void 0,void 0,void 0,(function*(){try{const e=yield l.RestApi.feeds.get();if("object"==typeof e&&Array.isArray(e.data))return e.data}catch(e){throw u.getErrorResponseMessage(e)}throw"Spotlight encountered a problem trying to load your feeds. Kindly contact customer support for assistance."}))),t.saveFeed=o.createAsyncThunk("feeds/save",(e,t)=>a(void 0,void 0,void 0,(function*(){t.dispatch(r.showToast({key:"feeds/saving",message:"Saving feed. Please wait ...",type:r.ToastType.STICKY}));const n=yield i.AdminRestApi.feeds.save(e);return t.dispatch(r.removeToast("feeds/saving")),t.dispatch(r.showToast({key:"feeds/saved",message:"Feed saved!"})),n.data.feed}))),t.duplicateFeed=o.createAsyncThunk("feeds/duplicate",(e,t)=>a(void 0,void 0,void 0,(function*(){t.dispatch(r.showToast({key:"admin/feeds/duplicate/wait",message:"Duplicating feed. Please wait ...",type:r.ToastType.STICKY}));const n={id:null,name:"Copy of "+e.name,usages:[],options:s.cloneObj(e.options)};try{return(yield i.AdminRestApi.feeds.save(n)).data.feed}finally{t.dispatch(r.removeToast("admin/feeds/duplicate/wait"))}}))),t.deleteFeed=o.createAsyncThunk("feeds/delete",(e,t)=>a(void 0,void 0,void 0,(function*(){try{return yield i.AdminRestApi.feeds.delete(e.id),e.id}catch(e){t.dispatch(r.showToast({key:"feeds/delete/error",message:e.toString(),type:r.ToastType.ERROR}))}})))},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MenuHeading=t.MenuStatic=t.MenuSeparator=t.MenuContent=t.MenuItem=t.StatefulMenu=t.Menu=void 0;const s=l(n(0)),u=n(285),c=n(304),d=n(220),f=r(n(42));n(474);const m=n(14);function p(e){var{children:n}=e,a=i(e,["children"]);const[o,l]=s.useState(!1),r=()=>l(!0),u=()=>l(!1),c={openMenu:r,closeMenu:u};return s.default.createElement(p.Context.Provider,{value:c},s.default.createElement(t.Menu,Object.assign({isOpen:o,onBlur:u},a),({ref:e})=>n[0]({ref:e,openMenu:r}),n[1]))}function _(e,t){return Object.assign(Object.assign({},e),{opacity:1,pointerEvents:"all",visibility:t?"hidden":"visible"})}t.Menu=({children:e,className:t,refClassName:n,isOpen:a,onBlur:o,placement:l,modifiers:i,useVisibility:r})=>{l=null!=l?l:"bottom-end",r=null!=r&&r;const p=s.default.useRef(),h=a||r,g=!a&&r,b=Object.assign({preventOverflow:{boundariesElement:document.getElementById(f.default.config.rootId),padding:5}},i),v=()=>{o()},y=e=>{switch(e.key){case"ArrowDown":break;case"Escape":v();break;default:return}e.preventDefault(),e.stopPropagation()};return d.useDetectOutsideClick(p,v,[p]),c.useDetectTabOut([p],v),s.default.createElement("div",{ref:p,className:m.classList("menu__ref",n)},s.default.createElement(u.Manager,null,s.default.createElement(u.Reference,null,t=>e[0](t)),s.default.createElement(u.Popper,{placement:l,positionFixed:!0,modifiers:b},({ref:n,style:a,placement:o})=>h?s.default.createElement("div",{ref:n,className:"menu",style:_(a,g),"data-placement":o,onKeyDown:y},s.default.createElement("div",{className:"menu__container"+(t?" "+t:"")},e[1])):null)))},t.StatefulMenu=p,function(e){e.Context=s.default.createContext({openMenu:null,closeMenu:null})}(p=t.StatefulMenu||(t.StatefulMenu={})),t.MenuItem=({children:e,onClick:t,disabled:n,active:a,danger:o})=>{const l=m.bemClass("menu__item",{"--disabled":n,"--active":a,"--danger":!n&&o});return s.default.createElement(p.Context.Consumer,null,({closeMenu:o})=>s.default.createElement("div",{className:l},s.default.createElement("button",{onClick:()=>{o&&o(),!a&&!n&&t&&t()}},e)))},t.MenuContent=({children:e})=>e,t.MenuSeparator=()=>s.default.createElement("div",{className:"menu__separator"}),t.MenuStatic=({children:e})=>s.default.createElement("div",{className:"menu__static"},e),t.MenuHeading=({children:e})=>s.default.createElement("div",{className:"menu__heading"},e)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Spoiler=void 0;const o=a(n(0)),l=n(14),i=n(155);n(482);const r=n(11),s=n(101);t.Spoiler=o.default.forwardRef((function({label:e,className:t,isOpen:n,defaultOpen:a,showIcon:u,disabled:c,stealth:d,fitted:f,scrollOnOpen:m,hideOnly:p,onClick:_,children:h},g){p=null!=p&&p,u=null==u||u,c=null!=c&&c,m=null!=m&&m;const[b,v]=o.default.useState(!!a),y=void 0!==n;y||(n=b);const E=o.default.useRef(),S=()=>{c||(!n&&m&&s.scrollIntoView(E.current,{behavior:"smooth"}),y||v(!n),_&&_())},P=n&&void 0===_&&!u,w=P?void 0:0,O=P?void 0:"button",C=l.bemClass("spoiler",{"--open":n,"--disabled":c,"--fitted":f,"--stealth":d,"--static":P}),N=l.classList(C,t),M=n?"arrow-up-alt2":"arrow-down-alt2",k=Array.isArray(e)?e.map((e,t)=>o.default.createElement(o.default.Fragment,{key:t},e)):"string"==typeof e?o.default.createElement("span",null,e):e;return o.default.createElement("div",{ref:i.mergeRefs(E,g),className:N},o.default.createElement("div",{className:"spoiler__header",onClick:S,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||S()},role:O,tabIndex:w},o.default.createElement("div",{className:"spoiler__label"},k),u&&o.default.createElement(r.Dashicon,{icon:M,className:"spoiler__icon"})),(n||p)&&o.default.createElement("div",{className:"spoiler__content"},h))}))},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsSlice=t.Feed=void 0;const l=n(15),i=n(43),r=n(136),s=n(230);function u(e,t){t.id&&(t.options=s.createFeedOptions(t.options),i.Dictionary.set(e,t.id,t))}(t.Feed||(t.Feed={})).getLabel=function(e){var t;const n=null===(t=e.name)||void 0===t?void 0:t.trim();return(null==n?void 0:n.length)>0?n:"(no name)"},t.FeedsSlice=l.createSlice({name:"feeds",initialState:{},reducers:{},extraReducers:e=>e.addCase(r.loadFeeds.fulfilled,(e,t)=>{t.payload.forEach(t=>u(e,t))}).addCase(r.deleteFeed.fulfilled,(e,t)=>{i.Dictionary.remove(e,t.payload)}).addMatcher(l.isFulfilled(r.saveFeed,r.duplicateFeed),(e,t)=>{u(e,t.payload)})}),o(n(136),t)},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FieldRow=void 0;const o=a(n(0)),l=a(n(520)),i=a(n(238)),r=n(76),s=n(331),u=n(21);t.FieldRow=function({label:e,labelId:t,wide:n,centered:a,tooltip:c,disabled:d,isResponsive:f,proOnly:m,isPro:p,children:_}){p=null!=p?p:u.Common.isPro;const h=m&&!p,g=(d=d||h)?n?l.default.disabledWide:l.default.disabled:n?l.default.containerWide:l.default.container;return o.default.createElement("div",{className:g},e&&o.default.createElement("div",{className:a?l.default.labelCentered:l.default.labelNormal},o.default.createElement("div",{className:l.default.labelAligner},o.default.createElement("label",{htmlFor:t},e,c&&o.default.createElement(o.default.Fragment,null," ",o.default.createElement(i.default,null,c))))),o.default.createElement("div",{className:l.default.content},f&&o.default.createElement("div",{className:l.default.responsiveContainer},o.default.createElement(s.FeedEditorDeviceCycleButton,null),o.default.createElement("div",{className:l.default.responsiveField},_)),!f&&o.default.createElement("div",{className:a?l.default.fieldCentered:l.default.fieldNormal},_)),h&&o.default.createElement(r.ProPill,{className:l.default.proPill}))}},,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FieldSet=void 0;const l=o(n(0)),i=o(n(763)),r=n(14);t.FieldSet=function(e){var{className:t}=e,n=a(e,["className"]);return l.default.createElement("div",Object.assign({className:r.classList(i.default.root,t)},n))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LimitedMultiTextInput=void 0;const o=a(n(0)),l=n(827);t.LimitedMultiTextInput=function(e){const[t,n]=o.default.useState("");e.exclude&&0===e.exclude.length&&t.length>0&&n("");let a=void 0;if(t.length>0){const n="%s",l=e.excludeMsg.indexOf("%s"),i=e.excludeMsg.substring(0,l),r=e.excludeMsg.substring(l+n.length);a=o.default.createElement(o.default.Fragment,null,i,o.default.createElement("code",null,t),r)}const i=Object.assign(Object.assign({},e),{message:a,onChange:t=>{const a=e.exclude?t.findIndex(t=>e.exclude.includes(t)):-1;a>-1?n(t[a]):e.onChange(t)}});return o.default.createElement(l.MultiTextInput,Object.assign({},i))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsGroup=void 0;const o=a(n(0)),l=a(n(833));t.SettingsGroup=function({title:e,before:t,after:n,children:a}){return o.default.createElement("div",{className:l.default.root},e&&e.length>0&&o.default.createElement("h1",{className:l.default.title},e),t&&o.default.createElement("div",{className:l.default.beforeFields},t),a&&o.default.createElement("div",{className:l.default.fieldList},a),n&&o.default.createElement("div",{className:l.default.afterFields},n))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(323)),i=n(86),r=n(8);t.default=function({children:e,title:t,buttons:n,onAccept:a,onCancel:s,isOpen:u,okDisabled:c,cancelDisabled:d}){n=null!=n?n:["OK","Cancel"];const f=()=>s&&s();return o.default.createElement(i.Modal,{isOpen:u,title:t,onClose:f,className:l.default.root},o.default.createElement(i.Modal.Content,null,"string"==typeof e?o.default.createElement("p",null,e):e),o.default.createElement(i.Modal.Footer,null,o.default.createElement(r.Button,{className:l.default.button,type:r.ButtonType.SECONDARY,onClick:f,disabled:d},n[1]),o.default.createElement(r.Button,{className:l.default.button,type:r.ButtonType.PRIMARY,onClick:()=>a&&a(),disabled:c},n[0])))}},,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Sidebar=void 0;const l=o(n(0)),i=o(n(850));function r(e){var{children:t,padded:n,disabled:o}=e,r=a(e,["children","padded","disabled"]);return l.default.createElement("div",Object.assign({className:o?i.default.disabled:i.default.sidebar},r),l.default.createElement("div",{className:n?i.default.paddedContent:i.default.content},null!=t?t:null))}t.Sidebar=r,function(e){e.padded=i.default.padded}(r=t.Sidebar||(t.Sidebar={}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpotlightNavbarLogo=void 0;const o=a(n(0)),l=a(n(886)),i=n(316);function r({children:e}){const t=Array.isArray(e)?e:[e];return o.default.createElement(o.default.Fragment,null,t.map((e,t)=>o.default.createElement(s,{key:t},e)))}function s({children:e}){return o.default.createElement("div",{className:l.default.item},e)}function u({children:e,style:t}){return o.default.createElement("div",{className:l.default.pathSegment},e,o.default.createElement(c,{style:t}))}function c({style:e}){if("none"===e)return null;const t="chevron"===e?"M0 0 L100 50 L0 100":"M50 0 L50 100";return o.default.createElement("div",{className:l.default.separator},o.default.createElement("svg",{viewBox:"0 0 100 100",width:"100%",height:"100%",preserveAspectRatio:"none"},o.default.createElement("path",{d:t,fill:"none",stroke:"currentcolor",strokeLinejoin:"bevel"})))}t.default=function({children:e,pathStyle:t}){let{path:n,left:a,right:i,center:s}=e;return n=null!=n?n:[],a=null!=a?a:[],i=null!=i?i:[],s=null!=s?s:[],o.default.createElement("div",{className:l.default.root},o.default.createElement("div",{className:l.default.leftList},o.default.createElement("div",{className:l.default.pathList},n.map((e,n)=>o.default.createElement(u,{key:n,style:t},o.default.createElement("div",{className:l.default.item},e)))),o.default.createElement("div",{className:l.default.leftList},o.default.createElement(r,null,a))),o.default.createElement("div",{className:l.default.centerList},o.default.createElement(r,null,s)),o.default.createElement("div",{className:l.default.rightList},o.default.createElement(r,null,i)))},t.SpotlightNavbarLogo=function(){return o.default.createElement(i.SpotlightLogo,null)}},,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.AccountManager=void 0;const o=n(29),l=n(173),i=n(42),r=n(92),s=n(31),u=n(62);!function(e){let t=null,n=null;function c(t,n,o){return a(this,void 0,void 0,(function*(){o&&o(e.State.connectedId),yield new Promise(o=>{setTimeout(()=>a(this,void 0,void 0,(function*(){yield t.dispatch(r.loadAccounts());const n=s.selectAccountById(e.State.connectedId)(t.getState()),a=new d(e.ACCOUNT_CONNECTED_EVENT,n);document.dispatchEvent(a),o()})),n)})}))}e.State=window.SliAccountManagerState={accessToken:null,connectSuccess:!1,connectedId:null},e.manualConnectPersonal=function(t,n,o=0,l){return a(this,void 0,void 0,(function*(){e.State.connectSuccess=!1;const a=yield u.AdminRestApi.accounts.connect(n);return e.State.connectSuccess=!0,e.State.connectedId=a.data.accountId,yield c(t,o,l),e.State.connectedId}))},e.manualConnectBusiness=function(t,n,o,l=0,i){return a(this,void 0,void 0,(function*(){e.State.connectSuccess=!1;const a=yield u.AdminRestApi.accounts.connect(n,o);return e.State.connectSuccess=!0,e.State.connectedId=a.data.accountId,yield c(t,l,i),e.State.connectedId}))},e.openAuthWindow=function(r,s,u=0,d){return new Promise((f,m)=>{if(e.State.connectedId=null,null==t||t.closed){const e=l.getWindowCenterBounds(700,800),n=s===o.Account.Type.PERSONAL?i.AdminCommonConfig.restApi.personalAuthUrl:i.AdminCommonConfig.restApi.businessAuthUrl;t=l.openWindow(n,"_blank",Object.assign({dependent:"yes",resizable:"yes",toolbar:"no",location:"no",scrollbars:"no"},e))}else t.focus();null==t||t.closed||(n=setInterval(()=>a(this,void 0,void 0,(function*(){t&&!t.closed||(clearInterval(n),null!==e.State.connectedId?(yield c(r,u,d),f(e.State.connectedId)):m&&m())})),500))})},e.ACCOUNT_CONNECTED_EVENT="sli/account/connected";class d extends CustomEvent{constructor(e,t){super(e,{detail:{account:t}})}}e.AccountConnectedEvent=d}(t.AccountManager||(t.AccountManager={}))},,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Link=void 0;const l=o(n(0)),i=n(1),r=n(63),s=n(52);t.Link=function(e){var{to:t,onClick:n,newTab:o,absolute:u}=e,c=a(e,["to","onClick","newTab","absolute"]);const d=i.useDispatch(),f=i.useSelector(r.selectRoute),m=u?f.setQuery(t):f.withQuery(t);return l.default.createElement("a",Object.assign({href:m,onClick:e=>{if(o||2===e.button)window.open(m,"_blank");else{const e=u?s.gotoRoute(t):s.modifyRoute(t);d(e)}e.preventDefault(),e.stopPropagation()}},c))}},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SaveButton=void 0;const o=a(n(830)),l=a(n(0)),i=n(8),r=n(14);t.SaveButton=function({className:e,content:t,tooltip:n,onClick:a,disabled:s,isSaving:u}){return t=null!=t?t:e=>e?"Saving ...":"Save",n=null!=n?n:"Save",l.default.createElement(i.Button,{className:r.classList(o.default.root,e),type:i.ButtonType.PRIMARY,size:i.ButtonSize.LARGE,tooltip:n,onClick:()=>a&&a(),disabled:s},u&&l.default.createElement("div",{className:o.default.savingOverlay}),t(u))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MultiHashtagInput=void 0;const o=a(n(0)),l=n(146),i=n(840),r=n(224);t.MultiHashtagInput=function(e){var t;const n="string"==typeof e.value?[e.value]:null!==(t=e.value)&&void 0!==t?t:[],a=Object.assign(Object.assign({},e),{value:n.map(e=>i.prefix(e,"#")),sanitize:r.sanitizeHashtag});return o.default.createElement(l.LimitedMultiTextInput,Object.assign({},a))}},,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.loadTemplates=void 0;const o=n(15),l=n(56);t.loadTemplates=o.createAsyncThunk("templates/load",()=>a(void 0,void 0,void 0,(function*(){var e;const t=yield l.RestApi.templates.get();return null!==(e=null==t?void 0:t.data)&&void 0!==e?e:[]})))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccountsSlice=void 0;const a=n(43),o=n(29),l=n(15),i=n(92);t.AccountsSlice=l.createSlice({name:"accounts",initialState:{},reducers:{},extraReducers:e=>e.addCase(i.updateAccount.fulfilled,(e,t)=>{const n=t.payload;a.Dictionary.set(e,n.id,n)}).addMatcher(l.isFulfilled(i.loadAccounts,i.deleteAccount),(e,t)=>{const n=t.payload.slice().sort((e,t)=>e.type===t.type?0:e.type===o.Account.Type.PERSONAL?-1:1);a.Dictionary.clear(e),n.forEach(t=>{a.Dictionary.set(e,t.id,t)})})})},,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPath=t.getRouteAbsUrl=t.getRouteRelUrl=t.routeWithoutParam=t.routeWithQuery=t.routeSetQuery=t.getRouteParam=t.getRoutePath=void 0;const a=n(104),o=n(74),l=n(25),i=n(300);function r(e,t){return s(e,l.withPartial({page:e.query.page},t))}function s(e,t){return e.pathName+"?"+a.stringify(function(e){const t=o.cloneObj(e);return Object.getOwnPropertyNames(e).forEach(n=>{e[n]&&0===e[n].length&&delete t[n]}),t}(t))}t.getRoutePath=function(e){return s(e,e.query)},t.getRouteParam=function(e,t){return i.extractFromArray(e.query[t])},t.routeSetQuery=function(e,t){return s(e,l.withPartial(t,{page:e.query.page}))},t.routeWithQuery=function(e,t){return s(e,l.withPartial(e.query,t))},t.routeWithoutParam=function(e,t){const n=o.cloneObj(e.query);return delete n[t],s(e,n)},t.getRouteRelUrl=r,t.getRouteAbsUrl=function(e,t){return e.baseUrl+r(e,t)},t.createPath=s},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=l(n(0)),s=i(n(469)),u=n(285),c=i(n(42)),d=n(14);function f(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}}t.default=function({visible:e,delay:t,placement:n,theme:a,children:o}){a=null!=a?a:{},n=n||"bottom";const[l,i]=r.default.useState(!1),m={preventOverflow:{boundariesElement:document.getElementById(c.default.config.rootId),padding:5}};r.useEffect(()=>{const n=setTimeout(()=>i(e),e?t:1);return()=>clearTimeout(n)},[e]);const p=f("container",n),_=f("arrow",n),h=d.classList(s.default[p],a.container,a[p]),g=d.classList(s.default[_],a.arrow,a[_]);return r.default.createElement(u.Manager,null,r.default.createElement(u.Reference,null,e=>o[0](e)),r.default.createElement(u.Popper,{placement:n,modifiers:m,positionFixed:!0},({ref:e,style:t,placement:n,arrowProps:i})=>l?r.default.createElement("div",{ref:e,className:d.classList(s.default.root,a.root),style:t,tabIndex:-1},r.default.createElement("div",{className:h,"data-placement":n},r.default.createElement("div",{className:d.classList(s.default.content,a.content)},o[1]),r.default.createElement("div",{className:g,ref:i.ref,style:i.style,"data-placement":n}))):null))}},function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(473)),r=n(29),s=n(14);t.default=function(e){var{account:t,square:n,className:o}=e,u=a(e,["account","square","className"]);const c=r.Account.getProfilePicUrl(t),d=s.classList(n?i.default.square:i.default.round,o);return l.default.createElement("img",Object.assign({},u,{className:d,src:r.Account.DefaultProfilePic,srcSet:c+" 1x",alt:t.username+" profile picture"}))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(86),i=a(n(480));t.default=function({accountId:e,isOpen:t,onClose:n,onUpdate:a}){return o.default.createElement(l.Modal,{isOpen:t&&!!e,title:"Account details",icon:"admin-users",onClose:n},o.default.createElement(l.Modal.Content,null,e&&o.default.createElement(i.default,{accountId:e,onUpdate:a})))}},,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Onboarding=void 0;const l=o(n(0)),i=n(14),r=n(8);n(491);const s=n(11);function u(e){var{className:t,children:n,fullWidth:o,isTransitioning:r}=e,s=a(e,["className","children","fullWidth","isTransitioning"]);const u=i.bemClass("onboarding",{"--full-width":o,"--transitioning":r});return l.default.createElement("div",Object.assign({className:i.classList(u,t)},s),n)}t.Onboarding=u,function(e){e.TRANSITION_DURATION=200,e.Thin=e=>{var{className:t,children:n}=e,o=a(e,["className","children"]);return l.default.createElement("div",Object.assign({className:i.classList("onboarding__thin",t)},o),n)},e.HelpMsg=e=>{var{className:t,children:n}=e,o=a(e,["className","children"]);return l.default.createElement("div",Object.assign({className:i.classList("onboarding__help-msg",t)},o),n)},e.ProTip=({children:t})=>l.default.createElement(e.HelpMsg,null,l.default.createElement("div",{className:"onboarding__pro-tip"},l.default.createElement("span",null,l.default.createElement(s.Dashicon,{icon:"lightbulb"}),l.default.createElement("strong",null,"Pro tip!")),t)),e.StepList=e=>{var{className:t,children:n}=e,o=a(e,["className","children"]);return l.default.createElement("ul",Object.assign({className:i.classList("onboarding__steps",t)},o),n)},e.Step=e=>{var{isDone:t,num:n,className:o,children:r}=e,s=a(e,["isDone","num","className","children"]);return l.default.createElement("li",Object.assign({className:i.classList(t?"onboarding__done":null,o)},s),l.default.createElement("strong",null,"Step ",n,":")," ",r)},e.HeroButton=e=>{var t,{className:n,children:o}=e,s=a(e,["className","children"]);return l.default.createElement(r.Button,Object.assign({type:null!==(t=s.type)&&void 0!==t?t:r.ButtonType.PRIMARY,size:r.ButtonSize.HERO,className:i.classList("onboarding__hero-button",n)},s),o)}}(u=t.Onboarding||(t.Onboarding={}))},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedTemplatePicker=void 0;const r=l(n(0)),s=i(n(492)),u=n(1),c=n(21),d=n(493),f=n(11),m=n(227),p=n(228),_=n(312),h=n(222),g=n(76),b=n(45);function v({template:e,isCurrent:t,onClick:n,onLoadImage:a}){const o=e.isPro&&!c.Common.isPro,l=o?s.default.templatePro:s.default.template;return r.default.createElement("div",{className:s.default.tile},r.default.createElement(h.DivButton,{className:l,onClick:n},r.default.createElement("img",{className:s.default.templateThumbnail,src:e.thumbnail,alt:"",onLoad:a}),r.default.createElement("div",{className:s.default.templateLabel},r.default.createElement("span",{className:s.default.templateName},e.name)),o&&r.default.createElement(r.default.Fragment,null,r.default.createElement("a",{className:s.default.proOverlay,href:b.AdminResources.upgradeUrl,target:"_blank"},r.default.createElement("div",{className:s.default.upgradeButton},"Upgrade to PRO")),r.default.createElement("div",{className:s.default.proPill},r.default.createElement(g.ProPill,null))),t&&r.default.createElement("span",{className:s.default.currentIndicator},"Current")))}function y({onClick:e}){return r.default.createElement(d.Square,{className:s.default.tile},r.default.createElement(h.DivButton,{className:s.default.customTemplate,onClick:e},r.default.createElement("div",{className:s.default.customTemplateIcon},r.default.createElement(f.Dashicon,{icon:"plus-alt"}),r.default.createElement("span",{className:s.default.customTemplateText},"Design your own"))))}t.FeedTemplatePicker=function({showCustomOption:e,value:t,onChange:n}){const a=u.useSelector(p.selectTemplates),o=r.useRef(),[l,i]=r.useState(3),d=r.useCallback(()=>{var e;const t=null===(e=null==o?void 0:o.current)||void 0===e?void 0:e.getBoundingClientRect();t&&i(function(e){const t=(e-40*(e/120-1))/3;return t<120?1:t<150?2:3}(t.width))},[o]);r.useLayoutEffect(()=>d(),[d]),m.useWindowSize(()=>d(),[d],!0);const f=r.useCallback(e=>{(null==e?void 0:e.isPro)&&!c.Common.isPro||n(null===(null==e?void 0:e.id)?null:e)},[n]);let h=a.map(e=>r.default.createElement(v,{key:e.id,template:e,isCurrent:e.id===t,onClick:()=>f(e),onLoadImage:d}));return e&&(h=[r.default.createElement(y,{key:"custom",onClick:()=>f(null)})].concat(h)),r.default.createElement("div",{className:s.default.root,ref:o},r.default.createElement(_.MasonryLayout,{columns:l,gap:40},h))}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectTemplateById=t.selectTemplates=void 0,t.selectTemplates=e=>e.templates.models,t.selectTemplateById=e=>t=>t.templates.models.find(t=>t.id===e)},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ProUpgradeBtn=void 0;const o=a(n(0)),l=a(n(499)),i=n(45);t.ProUpgradeBtn=function({url:e,children:t}){return o.default.createElement("a",{className:l.default.root,href:null!=e?e:i.AdminResources.pricingUrl,target:"_blank"},null!=t?t:"Free 14-day PRO trial")}},,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(512)),i=n(8),r=n(11),s=a(n(513));t.default=function({children:e,onConnect:t,beforeConnect:n}){const[a,u]=o.default.useState(!1);return o.default.createElement(o.default.Fragment,null,o.default.createElement(i.Button,{className:l.default.root,size:i.ButtonSize.HERO,type:i.ButtonType.SECONDARY,onClick:()=>u(!0)},o.default.createElement(r.Dashicon,{icon:"instagram"}),null!=e?e:o.default.createElement("span",null,"Connect more Instagram accounts")),o.default.createElement(s.default,{isOpen:a,onClose:()=>{u(!1)},onConnect:t,beforeConnect:n}))}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Capability=void 0;const i=l(n(0)),r=n(1),s=l(n(514)),u=n(172),c=n(29),d=n(86),f=n(8),m=n(11),p=l(n(515)),_=n(95),h=n(20),g=n(45),b=n(139);function v(){return i.default.createElement("div",{className:s.default.orSeparator},i.default.createElement("div",{className:s.default.orLine}),i.default.createElement("span",{className:s.default.orText},"OR"),i.default.createElement("div",{className:s.default.orLine}))}t.default=function({onConnect:e,beforeConnect:n,useColumns:o,showPrompt:l,showCapabilities:y}){const E=r.useStore();l=null==l||l,y=null==y||y,e=null!=e?e:_.fn.noop;const S=e=>{b.triggerError({type:"account/connect/fail",message:h.getErrorResponseMessage(e)})},P=e=>{u.AccountManager.State.connectSuccess&&n&&n(e)};return i.default.createElement("div",{className:o?s.default.vertical:s.default.horizontal},l&&i.default.createElement("p",{className:s.default.promptMsg},"Choose the type of account to connect:"),i.default.createElement("div",{className:s.default.types},i.default.createElement("div",{className:s.default.type},i.default.createElement(f.Button,{type:f.ButtonType.PRIMARY,size:f.ButtonSize.HERO,onClick:()=>a(this,void 0,void 0,(function*(){try{const t=yield u.AccountManager.openAuthWindow(E,c.Account.Type.PERSONAL,d.Modal.ANIMATION_DELAY,P);e(t)}catch(e){}}))},"Personal account"),y&&i.default.createElement("div",{className:s.default.capabilities},i.default.createElement(t.Capability,null,"Connects directly through Instagram"),i.default.createElement(t.Capability,null,"Show posts from your account"))),o&&i.default.createElement(v,null),i.default.createElement("div",{className:s.default.type},i.default.createElement(f.Button,{type:f.ButtonType.SECONDARY,size:f.ButtonSize.HERO,onClick:()=>a(this,void 0,void 0,(function*(){try{const t=yield u.AccountManager.openAuthWindow(E,c.Account.Type.BUSINESS,d.Modal.ANIMATION_DELAY,P);e(t)}catch(e){}}))},"Business account"),y&&i.default.createElement("div",{className:s.default.capabilities},i.default.createElement(t.Capability,null,"Connects through your Facebook page"),i.default.createElement(t.Capability,null,"Show posts from your account"),i.default.createElement(t.Capability,null,"Show posts where you are tagged"),i.default.createElement(t.Capability,null,"Show posts with a specific hashtag from all across Instagram")),i.default.createElement("div",{className:s.default.businessLearnMore},i.default.createElement(m.Dashicon,{icon:"editor-help"}),i.default.createElement("a",{href:g.AdminResources.businessAccounts,target:"_blank"},"Switch to a Business account for free")))),i.default.createElement(v,null),i.default.createElement("div",{className:l?s.default.connectAccessToken:null},(o||l)&&i.default.createElement("p",{className:s.default.promptMsg},"Connect without a login:"),i.default.createElement(p.default,{isColumn:o,onConnectPersonal:t=>a(this,void 0,void 0,(function*(){try{const n=yield u.AccountManager.manualConnectPersonal(E,t,d.Modal.ANIMATION_DELAY,P);e(n)}catch(e){S(e)}})),onConnectBusiness:(t,n)=>a(this,void 0,void 0,(function*(){try{const a=yield u.AccountManager.manualConnectBusiness(E,t,n,d.Modal.ANIMATION_DELAY,P);e(a)}catch(e){S(e)}}))})))},t.Capability=e=>{var{children:t}=e,n=o(e,["children"]);return i.default.createElement("div",Object.assign({className:s.default.capability},n),i.default.createElement(m.Dashicon,{icon:"yes"}),i.default.createElement("div",null,t))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Row=t.AccountSelector=void 0;const o=a(n(0)),l=a(n(519)),i=n(29),r=n(11),s=n(178);function u({account:e,selected:t,singleMode:n,disabled:a,onChange:u}){const c=`url("${i.Account.getProfilePicUrl(e)}")`,d=()=>{!a&&u(!t)},f=s.useKeyboardActivate(d),m=a?t?l.default.accountSelectedDisabled:l.default.accountDisabled:t?l.default.accountSelected:l.default.account;return o.default.createElement("div",{className:l.default.row},o.default.createElement("div",{className:m,onClick:d,onKeyPress:f,role:"button",tabIndex:0},o.default.createElement("div",{className:l.default.profilePic,style:{backgroundImage:c}}),o.default.createElement("div",{className:l.default.infoColumn},o.default.createElement("div",{className:l.default.username},e.username),o.default.createElement("div",{className:l.default.accountType},e.type)),t&&!n&&o.default.createElement(r.Dashicon,{icon:"yes-alt",className:l.default.tickIcon})))}t.AccountSelector=function({accounts:e,value:t,onChange:n,singleMode:a,disabled:i}){const r=(t=null!=t?t:[]).filter(t=>e.some(e=>e.id===t)),s=new Set(r),c=o.default.useCallback((e,t)=>{i||(t?(a&&s.clear(),s.add(e)):a||s.delete(e),n(Array.from(s)))},[i,s,n]);return o.default.createElement("div",{className:l.default.root},e.map((e,t)=>o.default.createElement(u,{key:t,account:e,selected:s.has(e.id),onChange:t=>c(e.id,t),singleMode:a,disabled:i})))},t.Row=u},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(521)),i=n(11),r=a(n(218));t.default=function({maxWidth:e,children:t}){e=null!=e?e:300;const[n,a]=o.default.useState(!1),s=()=>a(!0),u=()=>a(!1),c={content:l.default.tooltipContent,container:l.default.tooltipContainer};return o.default.createElement("div",{className:l.default.root},o.default.createElement(r.default,{visible:n,theme:c},({ref:e})=>o.default.createElement("span",{ref:e,className:l.default.icon,style:{opacity:n?1:.7},onMouseEnter:s,onMouseLeave:u},o.default.createElement(i.Dashicon,{icon:"info"})),o.default.createElement("div",{style:{maxWidth:e+"px"}},t)))}},,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ButtonDesignFields=void 0;const i=l(n(0)),r=n(799),s=n(8),u=n(234),c=n(58),d=n(25),f=n(141),m=n(800),p=n(142);function _({id:e,value:t,onChange:n,disabled:a,show:o}){var l,_,h,g;const[b,v]=i.useState(u.ButtonDesign.DEFAULT);t=null!=t?t:b,n=null!=n?n:v;const[y,E]=i.useState(!1),S=null!==(l=t.border)&&void 0!==l?l:{},P=u.ButtonDesign.getFullState(t,y),w=null!==(_=P.bgColor)&&void 0!==_?_:f.Color.WHITE,O=null!==(g=(null!==(h=P.text)&&void 0!==h?h:{}).color)&&void 0!==g?g:f.Color.BLACK;return i.default.createElement(i.default.Fragment,null,o.states&&i.default.createElement(p.FieldRow,{disabled:a,wide:!0,centered:!0},i.default.createElement(r.ButtonGroup,{wide:!0},i.default.createElement(s.Button,{type:s.ButtonType.TOGGLE,active:!y,onClick:()=>E(!1)},"Normal"),i.default.createElement(s.Button,{type:s.ButtonType.TOGGLE,active:y,onClick:()=>E(!0)},"Hover"))),o.textColor&&i.default.createElement(p.FieldRow,{label:"Text color",labelId:e+"-color",disabled:a},i.default.createElement(c.ColorPicker,{id:e+"-color",value:O,onChange:e=>{const a=u.ButtonDesign.withState(t,y,t=>{var n;return t.text=null!==(n=t.text)&&void 0!==n?n:{},t.text.color=e.rgb,t});n(a)}})),o.bgColor&&i.default.createElement(p.FieldRow,{label:"Background color",labelId:e+"-bg",disabled:a},i.default.createElement(c.ColorPicker,{id:e+"-bg",value:w,onChange:e=>{const a=u.ButtonDesign.withState(t,y,t=>(t.bgColor=e.rgb,t));n(a)}})),i.default.createElement("hr",null),o.border&&i.default.createElement(m.BorderDesignFields,{design:S,onChange:e=>{n(d.withPartial(t,{border:e}))},show:o.border,labels:!0}))}_.defaultProps={id:"",value:null,onChange:null,disabled:!1,show:{}},t.ButtonDesignFields=_},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TextField=void 0;const o=a(n(0));t.TextField=function({id:e,value:t,onChange:n,placeholder:a}){return o.default.createElement("input",{id:e,type:"text",value:t,onChange:e=>n(e.target.value),placeholder:a})}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsPage=void 0;const o=a(n(0)),l=a(n(831)),i=n(1),r=n(69),s=n(126);t.SettingsPage=function({before:e,after:t,children:n}){const a=i.useDispatch();return r.useDocumentEventListener("keydown",e=>{e.key&&"s"===e.key.toLowerCase()&&e.ctrlKey&&(a(s.saveSettings()),e.preventDefault(),e.stopPropagation())},[],[a]),o.default.createElement("article",{className:l.default.root},e&&o.default.createElement("div",{className:l.default.beforeGroups},e),n&&o.default.createElement("div",{className:l.default.groupList},n),t&&o.default.createElement("div",{className:l.default.afterGroups},t))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ResponsiveContainer=t.ResponsiveContext=void 0;const o=a(n(0)),l=n(227);t.ResponsiveContext=o.default.createContext(0),t.ResponsiveContainer=function({breakpoints:e,render:n,children:a}){const[i,r]=o.default.useState(null),s=o.default.useCallback(t=>{r(()=>e.reduce((e,n)=>t.width<=n&&n<e?n:e,1/0))},[e]);l.useWindowSize(s,[r],!0);const u=n?n(i):a;return o.default.createElement(t.ResponsiveContext.Provider,{value:i},null!==i?u:null)}},,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminSettings=void 0;const o=a(n(982)),l=n(988),i=n(999);t.AdminSettings=[{id:"accounts",title:"Accounts",component:o.default},{id:"config",title:"Configuration",component:l.SettingsConfigTab},{id:"tools",title:"Tools",component:i.SettingsToolsTab}]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplatesSlice=t.TemplatesInitialState=void 0;const a=n(15),o=n(204);t.TemplatesInitialState={models:[],isLoaded:!1},t.TemplatesSlice=a.createSlice({name:"templates",initialState:t.TemplatesInitialState,reducers:{},extraReducers:e=>e.addCase(o.loadTemplates.fulfilled,(e,t)=>{e.models=t.payload,e.isLoaded=!0})})},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminScreen=void 0;const i=l(n(0)),r=n(1),s=n(14),u=n(172),c=n(31),d=n(62),f={initialized:!1,list:[]};function m(){const e=Array.from(document.querySelectorAll(".sli-notice")),t=Array.from(document.querySelectorAll(".fs-notice.fs-slug-spotlight-social-photo-feeds"));f.list=e.concat(t),f.initialized=!0}t.AdminScreen=function({navbar:e,className:t,fillPage:n,children:a}){const o=r.useStore(),l=i.default.useRef(null);i.useEffect(()=>{l.current&&(f.initialized||m(),f.list.forEach(e=>{e.remove(),l.current.appendChild(e)}))},[]),i.useLayoutEffect(()=>{const e=new MutationObserver(e=>{for(const t of e)"childList"===t.type&&t.removedNodes.length>0&&m()});return e.observe(l.current,{childList:!0}),()=>e.disconnect()});const p=r.useSelector(c.selectExpiringAccounts),_=s.bemClass("admin-screen",{"--fill-page":n})+(t?" "+t:"");return i.default.createElement("div",{className:_},e&&i.default.createElement("div",{className:"admin-screen__navbar"},i.default.createElement(e)),i.default.createElement("div",{className:"admin-screen__content"},i.default.createElement("div",{className:"admin-screen__notices",ref:l},p.map(e=>i.default.createElement("div",{key:e.id,className:"notice notice-warning"},i.default.createElement("p",null,"The access token for the ",i.default.createElement("b",null,"@",e.username)," account is about to expire."," ",i.default.createElement("a",{className:"admin-screen__reconnect",onClick:t=>function(e,t){u.AccountManager.openAuthWindow(o,t.type,0,()=>{d.AdminRestApi.media.deleteForAccount(t.id)}),e.preventDefault()}(t,e)},"Re-connect the account")," ","to keep using it in Spotlight.")))),a))}},,,,function(e,t,n){},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(14),i=a(n(472));function r({idx:e,row:t,cols:n,styleMap:a}){return o.default.createElement("tr",{className:i.default.row},n.map(n=>o.default.createElement("td",{key:n.id,className:l.classList(i.default.cell,u(n),a.cells[n.id])},n.render(t,e))))}function s({cols:e,styleMap:t}){return o.default.createElement("tr",null,e.map(e=>{const n=l.classList(i.default.colHeading,u(e),t.cols[e.id]);return o.default.createElement("th",{key:e.id,className:n},e.label)}))}function u(e){return"center"===e.align?i.default.alignCenter:"right"===e.align?i.default.alignRight:i.default.alignLeft}t.default=function({className:e,cols:t,rows:n,footerCols:a,styleMap:u}){return u=null!=u?u:{cols:{},cells:{}},o.default.createElement("table",{className:l.classList(i.default.table,e)},o.default.createElement("thead",{className:i.default.header},o.default.createElement(s,{cols:t,styleMap:u})),o.default.createElement("tbody",null,n.map((e,n)=>o.default.createElement(r,{key:n,idx:n,row:e,cols:t,styleMap:u}))),a&&o.default.createElement("tfoot",{className:i.default.footer},o.default.createElement(s,{cols:t,styleMap:u})))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Ellipsis=void 0;const o=a(n(0));t.Ellipsis=()=>o.default.createElement("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-ellipsis",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},o.default.createElement("path",{d:"M5 10c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm12-2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-7 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CopyShortcode=void 0;const o=a(n(0)),l=a(n(307)),i=n(1),r=n(75);t.CopyShortcode=({feed:e,onCopy:t,children:n})=>{const a=i.useDispatch();return o.default.createElement(l.default,{text:`[instagram feed="${e.id}"]`,onCopy:()=>{a(r.showToast({key:"feeds/shortcode/copied",message:"Copied shortcode to clipboard."})),t&&t()}},n)}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WpUploadMedia=void 0;const o=a(n(0)),l=a(n(309)),i=n(108);t.WpUploadMedia=({id:e,value:t,title:n,button:a,mediaType:r,multiple:s,children:u,onOpen:c,onClose:d,onSelect:f})=>{e=null!=e?e:"wp-media-"+i.uniqueNum(),r=null!=r?r:"image",a=null!=a?a:"Select";const m=o.default.useRef();m.current||(m.current=l.default.media({id:e,title:n,library:{type:r},button:{text:a},multiple:s}));const p=()=>{const e=m.current.state().get("selection").first();f&&f(e)};return d&&m.current.on("close",d),m.current.on("open",()=>{if(t){const e="object"==typeof t?t:l.default.media.attachment(t);e.fetch(),m.current.state().get("selection").add(e?[e]:[])}c&&c()}),m.current.on("insert",p),m.current.on("select",p),u({open:()=>m.current.open()})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=wp},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsOnboarding=void 0;const o=a(n(0)),l=a(n(490)),i=n(225),r=n(226);t.FeedsOnboarding=function({showSteps:e,onSelectTemplate:t}){const[n,a]=o.default.useState(!1);return o.default.createElement("div",{className:n?l.default.rootTransitioning:l.default.root},o.default.createElement("div",{className:l.default.left},o.default.createElement("h1",{style:{fontWeight:"normal",lineHeight:"1.2em"}},"Pick a template to ",o.default.createElement("b",null,"get started!")),o.default.createElement(i.Onboarding.Thin,null,o.default.createElement("p",null,"Design your own Instagram feed or choose one of our beautiful pre-made templates."),o.default.createElement("p",null,"The templates are all fully customisable so you can design them to match your style."),e&&o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,"Once you've picked a template:"),o.default.createElement(i.Onboarding.StepList,null,o.default.createElement(i.Onboarding.Step,{num:1},o.default.createElement("span",null,"Connect your Instagram Account")),o.default.createElement(i.Onboarding.Step,{num:2},o.default.createElement("span",null,"Customize your feed")),o.default.createElement(i.Onboarding.Step,{num:3},o.default.createElement("span",null,"Embed it on your site")))),o.default.createElement("p",null,"Choose a template to get started."))),o.default.createElement("div",{className:l.default.right},o.default.createElement("div",{className:l.default.scrollPadding},o.default.createElement(r.FeedTemplatePicker,{onChange:function(e){a(!0),t(e)},showCustomOption:!0}))))}},,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(315),i=n(229),r=n(84),s=n(21),u=n(1),c=n(63),d=n(45),f={display:"flex",flexDirection:"column",justifyContent:"center",marginRight:25},m={textDecoration:"none"};t.default=function({right:e,chevron:t,children:n}){var a,p;const _=u.useSelector(c.selectScreen),h=o.default.createElement(l.Navbar.Item,null,null!==(p=null===(a=r.Screens.getScreen(_))||void 0===a?void 0:a.title)&&void 0!==p?p:"");return o.default.createElement(l.Navbar,null,o.default.createElement(o.default.Fragment,null,h,t&&o.default.createElement(l.Navbar.Chevron,null),n),e?o.default.createElement(e):o.default.createElement(o.default.Fragment,null,o.default.createElement("div",{style:f},o.default.createElement("a",{href:d.AdminResources.supportNavbarUrl,target:"_blank",style:m},o.default.createElement("span",null,"Need help?"))),!s.Common.isPro&&o.default.createElement(i.ProUpgradeBtn,{url:d.AdminResources.upgradeNavbarUrl})))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Navbar=void 0;const o=a(n(0)),l=a(n(497)),i=n(175),r=n(14),s=n(76),u=n(316);function c({children:e}){return o.default.createElement("div",{className:l.default.root},o.default.createElement(c.Item,null,o.default.createElement(u.SpotlightLogo,null)),o.default.createElement(c.Chevron,null),o.default.createElement("div",{className:l.default.leftContainer},e[0]),e[1]&&o.default.createElement("div",{className:l.default.rightContainer},e[1]))}t.Navbar=c,function(e){e.Item=({children:e})=>o.default.createElement("div",{className:l.default.item},e),e.Link=({linkTo:t,onClick:n,isCurrent:a,isDisabled:s,children:u})=>{const c=r.classMap({[l.default.link]:!0,[l.default.current]:a,[l.default.disabled]:s}),d=e=>{"Enter"!==e.key&&" "!==e.key||e.currentTarget.click()},f=s?-1:0;return o.default.createElement(e.Item,null,t?o.default.createElement(i.Link,{to:t,className:c,role:"button",onKeyPress:d,tabIndex:f},u):o.default.createElement("div",{className:c,role:"button",onClick:()=>!s&&n&&n(),onKeyPress:d,tabIndex:f},u))},e.ProPill=()=>o.default.createElement("div",{className:l.default.proPill},o.default.createElement(s.ProPill,null)),e.Chevron=()=>o.default.createElement("div",{className:l.default.chevron},o.default.createElement("svg",{viewBox:"0 0 100 100",width:"100%",height:"100%",preserveAspectRatio:"none"},o.default.createElement("path",{d:"M0 0 L100 50 L0 100",fill:"none",stroke:"currentcolor",strokeLinejoin:"bevel"})))}(c=t.Navbar||(t.Navbar={}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpotlightLogo=void 0;const o=a(n(0)),l=a(n(498)),i=n(21),r=n(317);t.SpotlightLogo=function(){return o.default.createElement("div",{className:l.default.logo},o.default.createElement("img",Object.assign({className:l.default.logoImage,src:i.Common.image("spotlight-favicon.png"),alt:"Spotlight"},r.noDrag)))}},,,,,,,function(e,t,n){e.exports={root:"ModalPrompt__root",button:"ModalPrompt__button"}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminEditor=void 0;const l=o(n(0)),i=n(1),r=n(21),s=n(84),u=n(325),c=n(140),d=n(52),f=n(181),m=n(926),p=f.FeedEditorDefaultConfig.tabs.slice();p.push({id:"embed",label:"Embed",requireSources:!0,sidebar:m.EmbedSidebar}),t.AdminEditor=function({feed:e,keepState:t}){const n=i.useDispatch(),o=null===e.id,f=l.default.useCallback(e=>a(this,void 0,void 0,(function*(){const t=yield n(c.saveFeed(e));o&&t.payload.id&&setTimeout(()=>{n(d.gotoRoute({screen:s.SCREENS.EDIT_FEED,id:t.payload.id}))},10)})),[o]),m=l.default.useCallback(()=>{n(d.gotoScreen(s.SCREENS.FEED_LIST))},[]);return l.default.createElement(u.CommonEditor,{feed:e,isPro:r.Common.isPro,onSave:f,onCancel:m,keepState:t,tabs:p,useCtrlS:!0,confirmOnCancel:!0})}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CommonEditor=t.LEAVE_MESSAGE=void 0;const s=l(n(0)),u=n(1),c=n(69),d=n(326),f=n(26),m=n(25),p=n(924),_=n(21),h=n(52),g=r(n(42));function b(e){return s.default.createElement(p.WpMediaField,Object.assign({},e,{title:"Select custom profile photo",buttonSet:"Choose custom photo",buttonChange:"Change custom photo",mediaType:"image"}))}t.LEAVE_MESSAGE="You have unsaved changes. If you leave now, your changes will be lost.",t.CommonEditor=function(e){var{feed:n,confirmOnCancel:a,keepState:o,useCtrlS:l,onSave:r,onCancel:p}=e,v=i(e,["feed","confirmOnCancel","keepState","useCtrlS","onSave","onCancel"]);const y=u.useDispatch(),E=u.useSelector(e=>e.editor.isSaving),S=u.useSelector(e=>e.editor.isDirty),[P,w]=s.default.useState(!1);s.useEffect(()=>{y(f.FeedEditorActions.editFeed({feedName:n.name,feedOptions:n.options,reset:!o}))},[y,n.id,o]),h.useUnload(t.LEAVE_MESSAGE,()=>a&&S&&!E&&!P,[a,S,E,P]),s.useEffect(()=>{P&&p&&p()},[P]),c.useDocumentEventListener("keydown",e=>{l&&e.key&&"s"===e.key.toLowerCase()&&e.ctrlKey&&(y(f.FeedEditorActions.saveFeed(O)),e.preventDefault(),e.stopPropagation())},[],[S]);const O=s.default.useCallback((e,t)=>{const a=m.withPartial(n,{name:e,options:t});return r?r(a):Promise.reject()},[n,r]),C=s.default.useCallback(()=>{(!S||!P&&a&&confirm(t.LEAVE_MESSAGE))&&w(!0)},[p,a]);return s.default.createElement(d.FeedEditor,Object.assign({},v,{isPro:_.Common.isPro,selectMediaField:b,onSave:O,onCancel:C,fakePreview:g.default.editor.preview}))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CheckboxListField=void 0;const o=a(n(0)),l=a(n(776)),i=n(76),r=a(n(238)),s=n(21);t.CheckboxListField=function({id:e,value:t,onChange:n,isPro:a,showProOptions:u,options:c}){a=null!=a?a:s.Common.isPro;const d=new Set(t.map(e=>e.toString())),f=e=>{const t=e.target.value,o=e.target.checked,l=c.find(e=>e.value.toString()===t);l.proOnly&&!a||l.isDisabled||(o?d.add(t):d.delete(t),n&&n(Array.from(d)))};return o.default.createElement("div",{className:l.default.checkboxList},c.filter(e=>!!e).map((t,n)=>{var s;if(!a&&t.proOnly&&!u)return null;const c=t.proOnly&&!a,m=t.isDisabled||c;return o.default.createElement("label",{key:n,className:m?l.default.disabledOption:l.default.option},o.default.createElement("input",{type:"checkbox",id:e,value:null!==(s=t.value.toString())&&void 0!==s?s:"",checked:d.has(t.value.toString()),onChange:f,disabled:m}),o.default.createElement("span",null,t.label,t.tooltip&&!c&&o.default.createElement(o.default.Fragment,null," ",o.default.createElement(r.default,null,t.tooltip))),c&&o.default.createElement("div",{className:l.default.proPill},o.default.createElement(i.ProPill,null)))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SETTINGS_SAVE_FAILED=t.SETTINGS_SAVE_SUCCESS=void 0,t.SETTINGS_SAVE_SUCCESS="sli/settings/save/success",t.SETTINGS_SAVE_FAILED="sli/settings/save/error"},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsFiltersTab=void 0;const o=a(n(0)),l=n(266),i=n(832),r=n(838);t.SettingsFiltersTab=function(){return o.default.createElement(l.SettingsPage,null,o.default.createElement(i.SettingsCaptionFiltersGroup,null),o.default.createElement(r.SettingsHashtagFiltersGroup,null))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},r=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MediaSelectionGrid=void 0;const u=l(n(0)),c=s(n(855)),d=n(856),f=n(389),m=n(9),p=n(74),_=n(149),h=n(56);function g({item:e,isSelected:t,children:n}){return n=null!=n?n:e=>u.default.createElement(_.MediaThumbnail,{media:e.item,className:c.default.thumbnail}),u.default.createElement("div",{className:t?c.default.selectedMedia:c.default.media},n({item:e,isSelected:t}))}t.MediaSelectionGrid=function(e){var{options:t,useFilters:n,useModeration:a,useTypeFilter:o,cache:l,onLoadMedia:s,onClick:_,onSelect:b}=e,v=r(e,["options","useFilters","useModeration","useTypeFilter","cache","onLoadMedia","onClick","onSelect"]);const y=function({options:e,useTypeFilter:t,useFilters:n,useModeration:a}){const o=p.cloneObj(e);return o.numPosts=999999,n||(o.captionWhitelist=[],o.captionBlacklist=[],o.hashtagWhitelist=[],o.hashtagBlacklist=[],o.captionWhitelistSettings=!1,o.captionBlacklistSettings=!1,o.hashtagWhitelistSettings=!1,o.hashtagBlacklistSettings=!1),a||(o.moderation=[],o.moderationMode=m.ModerationMode.BLACKLIST),t||(o.mediaType=m.MediaTypeFilter.ALL),o}({options:t,useTypeFilter:o,useFilters:n,useModeration:a}),[E,S]=u.useState(!0),[P,w]=u.useState([]),O=u.useRef(null);return l||(l={value:O.current,update:e=>O.current=e}),u.useEffect(()=>{!function(){var e;i(this,void 0,void 0,(function*(){if((null===(e=l.value)||void 0===e?void 0:e.key)===m.calculateFeedMediaHash(y))w(l.value.media),S(!1),s&&s(l.value.media);else{S(!0);const e=(yield h.RestApi.media.get(y)).data.media;l.update({key:m.calculateFeedMediaHash(y),media:e}),w(e),S(!1),s&&s(e)}}))}()},[y,n,a,o]),E?u.default.createElement("div",{className:c.default.loading},u.default.createElement(f.LoadingSpinner,{size:60})):u.default.createElement(d.SelectionGrid,Object.assign({},v,{items:P,onClick:function(e,t,n){_&&_(e,t,n)},onSelect:function(e,t,n){b&&b(e,t,n)},keyFn:e=>e.id.toString()}),e=>u.default.createElement(g,Object.assign({},e,{children:v.children})))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.LoadingSpinner=void 0;const o=a(n(0));n(858),t.LoadingSpinner=({size:e})=>{const t=(e=null!=e?e:24)+"px",n={width:t,height:t,boxShadow:`${.25*e+"px"} 0 0 ${.375*e+"px"} #999 inset`};return o.default.createElement("span",{className:"loading-spinner",style:n})}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionsGrid=void 0;const r=l(n(0)),s=i(n(870)),u=n(8),c=n(11),d=n(388),f=n(86),m=n(35),p=n(156),_=n(25),h=n(392),g=n(121),b=n(149),v=n(877),y=n(21),E={value:null,update:e=>E.value=e};function S({media:e,isFirst:t,isLast:n,onPrev:a,onNext:o,feedOptions:l,onChange:i}){const d=r.useRef(),f=p.PromotionSystem.getMediaPromoFromFeed(e,l),m=l.globalPromotionsEnabled&&!!p.PromotionSystem.getMediaGlobalPromo(e),g=l.autoPromotionsEnabled&&!!p.PromotionSystem.getMediaAutoPromo(e);return r.useEffect(()=>{var e;null===(e=null==d?void 0:d.current)||void 0===e||e.focus()},[d]),r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:s.default.navigation},r.default.createElement(u.Button,{type:u.ButtonType.PILL,size:u.ButtonSize.LARGE,disabled:t,onClick:a},r.default.createElement(c.Dashicon,{icon:"arrow-left-alt"})),r.default.createElement(v.PromotePreviewTile,{media:e}),r.default.createElement(u.Button,{type:u.ButtonType.PILL,size:u.ButtonSize.LARGE,disabled:n,onClick:o},r.default.createElement(c.Dashicon,{icon:"arrow-right-alt"}))),r.default.createElement(h.MediaPromotionFields,{promo:f,typeSelectorRef:d,hasGlobal:m,hasAuto:g,onChange:function(t){y.Common.isPro&&i(_.withPartial(l.promotions,{[e.id]:t}))}}))}function P({media:e,isSelected:t}){const n=m.useEditorSelector(e=>e.feedOptions),a=p.PromotionSystem.getMediaPromo(e,n),o=g.PromotionTypeStore.getForPromo(a),l=p.PromotionSystem.getPromoConfig(a),i=(null==o?void 0:o.isValid(l))?null==o?void 0:o.getIcon(e,l):void 0;return r.default.createElement("div",{className:t?s.default.tileSelected:s.default.tile},r.default.createElement(b.MediaThumbnail,{className:s.default.tileThumbnail,media:e}),r.default.createElement("div",{className:s.default.tileIcon},r.default.createElement(c.Dashicon,{icon:i})))}t.PromotionsGrid=function({feedOptions:e,onChange:t}){const n=r.useRef(),a=r.useRef(),[o,l]=r.useState(null),[i,c]=r.useState(0),[m,p]=r.useState(!1);function _(){var e;p(!1),null===(e=a.current)||void 0===e||e.focus()}const h=null!==o&&null!==i,g=h&&i<=0,b=h&&i>=o.length-1,v=h?o[i]:null;return r.default.createElement("div",{className:s.default.root},r.default.createElement(d.MediaSelectionGrid,{cache:E,options:e,selected:i,onClick:function(e,t,n){a.current=n,p(!0)},onSelect:function(e,t){c(t)},onLoadMedia:l,canDeselect:!m,useKeyBinds:!m,useFilters:!0,useModeration:!0,useTypeFilter:!0,controlled:!0},e=>r.default.createElement(P,{media:e.item,isSelected:e.isSelected})),r.default.createElement(f.Modal,{title:"Promotion",rootRef:n,isOpen:m&&null!==v,onClose:_},r.default.createElement(f.Modal.Content,null,r.default.createElement(S,{media:v,feedOptions:e,onChange:t,isFirst:g,isLast:b,onNext:()=>c(e=>e+1),onPrev:()=>c(e=>e-1)})),r.default.createElement(f.Modal.Footer,null,r.default.createElement(u.Button,{type:u.ButtonType.PRIMARY,size:u.ButtonSize.LARGE,onClick:_},"Done"))))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MediaPromotionFields=void 0;const s=l(n(0)),u=r(n(871)),c=n(25),d=n(199),f=n(121),m=n(872),p=n(876),_=n(40),h=n(142);t.MediaPromotionFields=function(e){var t,n,{promo:a,typeSelectorRef:o,onChange:l}=e,r=i(e,["promo","typeSelectorRef","onChange"]);a=null!=a?a:{type:"",config:{}};const[g,b]=s.useState(!1),v=s.useCallback(()=>{b(!0),l&&l({type:null,config:{}})},[l]),y=f.PromotionTypeStore.get(a.type),E=null!==(t=a.config)&&void 0!==t?t:{},S=!d.isObjectEmpty(E),P=r.hasGlobal||r.hasAuto,w=P&&(S||g),O=null!==(n=m.PromoTypeComponents.get(y?y.id:""))&&void 0!==n?n:{heading:"",fields:void 0,tutorial:void 0},C=[{value:"",label:"None"}].concat(f.PromotionTypeStore.getAll().map(e=>({value:e.id,label:e.label})));return s.default.createElement("div",null,P&&s.default.createElement(p.PromotionOverrideMessage,{hasAuto:r.hasAuto,hasGlobal:r.hasGlobal,isOverriding:w,onOverride:v}),(!P||w)&&!r.showTutorial&&s.default.createElement(s.default.Fragment,null,s.default.createElement(h.FieldRow,{label:"Promotion type",labelId:"promo-type",proOnly:!0},s.default.createElement(_.Select,{id:"promo-type",ref:o,value:a.type,onChange:e=>{l&&l(c.withPartial(a,{type:e.value}))},isSearchable:!1,isCreatable:!1,isClearable:!1,options:C})),O.fields&&s.default.createElement(s.default.Fragment,null,s.default.createElement("hr",{className:u.default.separator}),s.default.createElement(O.fields,{config:null!=E?E:{},onChange:e=>{l&&l(c.withPartial(a,{config:e}))}}))),r.showTutorial&&O.tutorial&&s.default.createElement(O.tutorial,null))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(889)),i=a(n(163)),r=n(178);function s({tab:e,isCurrent:t,onClick:n}){return o.default.createElement("a",{key:e.key,role:"button",tabIndex:0,className:e.disabled?l.default.disabled:t?l.default.current:l.default.tab,onClick:n,onKeyDown:r.useKeyboardActivate(n)},o.default.createElement("span",{className:l.default.label},e.label))}t.default=function({children:{path:e,tabs:t,right:n},current:a,onClickTab:l}){return o.default.createElement(i.default,{pathStyle:"chevron"},{path:e,right:n,left:t.map(e=>{return o.default.createElement(s,{tab:e,key:e.key,isCurrent:e.key===a,onClick:(t=e.key,()=>l&&l(t))});var t})})}},,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchNews=void 0;const o=n(15),l=(n(20),n(62));t.fetchNews=o.createAsyncThunk("news/fetch",()=>a(void 0,void 0,void 0,(function*(){try{const e=yield l.AdminRestApi.notifications.get();if("object"==typeof e&&Array.isArray(e.data))return e.data}catch(e){}})))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Decorate=void 0;const o=a(n(0));t.Decorate=function(e,t){return n=>o.default.createElement(e,Object.assign(Object.assign({},t),n))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionsScreen=void 0;const r=l(n(0)),s=i(n(964)),u=i(n(394)),c=n(8),d=n(163),f=n(965),m=n(974),p=n(197),_=n(406),h=n(84),g=n(69),b=n(76),v=n(1),y=n(33),E=n(126),S=n(47),P=n(63),w=n(52);function O({currTabId:e,isFakePro:t}){const n=v.useDispatch(),a=v.useSelector(y.selectSettingsAreDirty),o=v.useSelector(y.selectSettingsAreSaving);return r.default.createElement(r.default.Fragment,null,r.default.createElement(u.default,{current:e,onClickTab:e=>n(w.modifyRoute({tab:e}))},{path:[r.default.createElement(d.SpotlightNavbarLogo,{key:"logo"}),r.default.createElement("span",{key:"screen-title"},"Promotions")],tabs:[{key:"automate",label:r.default.createElement("span",{className:t?s.default.navbarFakeProItem:s.default.navbarItem},t&&r.default.createElement(b.ProPill,{className:s.default.navbarProPill}),r.default.createElement("span",null,"Automate"))},{key:"global",label:r.default.createElement("span",{className:t?s.default.navbarFakeProItem:s.default.navbarItem},t&&r.default.createElement(b.ProPill,{className:s.default.navbarProPill}),r.default.createElement("span",null,"Global Promotions"))}],right:[r.default.createElement(c.Button,{key:"cancel",onClick:()=>n(S.restoreSettings()),type:c.ButtonType.SECONDARY,disabled:!a,children:"Cancel"}),r.default.createElement(p.SaveButton,{key:"save",onClick:()=>n(E.saveSettings()),isSaving:o,disabled:!a})]}))}t.PromotionsScreen=function({isFakePro:e}){var t;const n=v.useDispatch(),a=v.useSelector(y.selectSettingsAreDirty),o=v.useSelector(y.selectSettingsAreSaving),l=v.useSelector(y.selectSetting("autoPromotions")),i=e?C:l,u=null!==(t=v.useSelector(P.selectQueryParam("tab")))&&void 0!==t?t:"automate";return w.useUnload(_.LEAVE_MESSAGE,e=>a&&e.screen!==h.SCREENS.PROMOTIONS,[a]),r.useEffect(()=>()=>a&&n(S.restoreSettings()),[a,n]),g.useDocumentEventListener("keydown",e=>{"s"===e.key.toLowerCase()&&e.ctrlKey&&(a&&!o&&n(E.saveSettings()),e.preventDefault(),e.stopPropagation())},[],[a,o]),r.default.createElement("div",{className:s.default.screen},r.default.createElement("div",{className:s.default.navbar},r.default.createElement(O,{currTabId:u,isFakePro:e})),"automate"===u&&r.default.createElement(f.AutomatePromotionsTab,{automations:i,onChange:function(t){e||n(S.updateSettings({autoPromotions:t}))},isFakePro:e}),"global"===u&&r.default.createElement(m.GlobalPromotionsTab,{isFakePro:e}))};const C=[{type:"hashtag",config:{hashtags:["product"]},promotion:{type:"link",config:{linkType:"page",postId:1,postTitle:"Product Page",linkText:"Buy this product"}}},{type:"hashtag",config:{hashtags:["myblog"]},promotion:{type:"link",config:{linkType:"post",postId:1,postTitle:"My Latest Blog Post",linkText:""}}},{type:"hashtag",config:{hashtags:["youtube"]},promotion:{type:"link",config:{linkType:"url",url:"",linkText:""}}}]},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsScreen=t.LEAVE_MESSAGE=void 0;const r=l(n(0)),s=i(n(979)),u=n(1),c=(n(104),n(298)),d=(n(84),n(980)),f=n(275),m=n(33),p=n(47),_=n(21),h=n(63),g=n(52);t.LEAVE_MESSAGE="You have unsaved changes. If you leave now, your changes will be lost.",t.SettingsScreen=function(){const e=u.useDispatch(),n=u.useSelector(m.selectSettingsAreDirty),a=u.useSelector(h.selectQueryParam("tab")),o=a?f.AdminSettings.find(e=>a===e.id):f.AdminSettings[0];return r.useEffect(()=>()=>n&&e(p.restoreSettings()),[n,e]),g.useUnload(t.LEAVE_MESSAGE,()=>n,[n]),r.default.createElement(r.default.Fragment,null,r.default.createElement(c.AdminScreen,{navbar:d.SettingsNavbar,className:s.default.root},o&&(_.Common.isPro||!o.isPro)&&r.default.createElement(o.component,null)))}},,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.hideNews=t.closeNews=t.openNews=t.removeNewsMessage=t.addNewsMessage=t.NewsSlice=void 0;const l=n(15),i=n(403);t.NewsSlice=l.createSlice({name:"news",initialState:{messages:[],isOpen:!1,isHidden:!1},reducers:{addNewsMessage(e,t){e.messages.push(t.payload)},removeNewsMessage(e,t){e.messages=e.messages.filter(e=>e.id!==t.payload)},openNews(e){e.isOpen=!0},closeNews(e){e.isOpen=!1},hideNews(e){e.isHidden=!0}},extraReducers:e=>e.addCase(i.fetchNews.fulfilled,(e,t)=>{e.messages=t.payload})}),o(n(1003),t),t.addNewsMessage=t.NewsSlice.actions.addNewsMessage,t.removeNewsMessage=t.NewsSlice.actions.removeNewsMessage,t.openNews=t.NewsSlice.actions.openNews,t.closeNews=t.NewsSlice.actions.closeNews,t.hideNews=t.NewsSlice.actions.hideNews},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminLoading=void 0;const o=a(n(0)),l=n(21);n(1007),t.AdminLoading=function(){const e=new Date,t=3===e.getMonth()&&1===e.getDate()?"spitloght-800w.png":"spotlight-800w.png";return o.default.createElement("div",{className:"admin-loading"},o.default.createElement("div",{className:"admin-loading__perspective"},o.default.createElement("div",{className:"admin-loading__container"},o.default.createElement("img",{src:l.Common.image(t),className:"admin-loading__logo",alt:"Spotlight"}))))}},,,,,,,,,,,,,,,,,function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={save:e=>a.client.post(e.id?"/feeds/"+e.id:"/feeds",{feed:e}),delete:e=>a.client.post("/feeds/delete/"+e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={update:e=>a.client.post("/accounts",e),delete:e=>a.client.post("/accounts/delete/"+e),connect:(e,t)=>{const n=t?{accessToken:e,userId:t}:{accessToken:e};return a.client.post("/connect",n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={deleteForAccount:e=>a.client.post("/account_media/delete/"+e),cleanUp:e=>a.client.post("/clean_up_media",{ageLimit:e})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={get:()=>a.client.get("/settings"),save:e=>a.client.post("/settings",{settings:e})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={get:()=>a.client.get("/notifications")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={clearAll:()=>a.client.post("/clear_cache"),clearForFeed:e=>a.client.post("/clear_cache/feed",{options:e.options})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(20);t.default={posts:{search:(e,t="")=>a.client.get(`/search_posts?search=${t}&type=${e}`)}}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsScreen=void 0;const r=l(n(0)),s=i(n(461)),u=n(298),c=n(84),d=n(465),f=n(311),m=i(n(314)),p=n(1),_=n(103),h=n(8),g=n(86),b=n(226),v=n(52),y=n(140),E=n(501),S=n(11);t.FeedsScreen=function(){const e=p.useDispatch(),t=p.useSelector(_.selectHasFeeds),n=r.useRef(),[a,o]=r.useState(!1);function l(t){const n={screen:c.SCREENS.NEW_FEED};t&&(n.template=t.id),e(v.gotoRoute(n))}return r.default.createElement(u.AdminScreen,{navbar:m.default,fillPage:!t},r.default.createElement("div",{className:s.default.root},t?r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:s.default.toolbar},r.default.createElement(h.Button,{ref:n,type:h.ButtonType.PRIMARY,size:h.ButtonSize.LARGE,onClick:function(){return o(!0)}},r.default.createElement(S.Dashicon,{icon:"plus-alt2"}),r.default.createElement("span",null,"Create a new feed")),"   ",r.default.createElement(E.FeedImportButton,{onImport:function(t){const n={id:null,name:t.name,options:t.options,usages:[]};e(y.saveFeed(n))}})),r.default.createElement(d.FeedsList,null)):r.default.createElement(f.FeedsOnboarding,{onSelectTemplate:l,showSteps:!0})),r.default.createElement(g.Modal,{title:"Select a template or design your own",isOpen:a,onClose:function(){var e;o(!1),null===(e=n.current)||void 0===e||e.focus()},width:1e3,portalTo:document.body},r.default.createElement(g.Modal.Content,null,r.default.createElement(b.FeedTemplatePicker,{onChange:l,showCustomOption:!0}))))}},function(e,t,n){e.exports={toolbar:"FeedsScreen__toolbar"}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccountTokenExpiring=void 0;const o=n(29),l=a(n(464)),i=a(n(216)),r=a(n(1078)),s={days:7};t.isAccountTokenExpiring=function(e){const t=r.default(new Date,s);return e.type===o.Account.Type.BUSINESS&&e.accessToken&&e.accessToken.expiry&&l.default(t,i.default(e.accessToken.expiry))}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedsList=void 0;const s=l(n(0)),u=n(1),c=r(n(466)),d=n(103),f=n(136),m=n(11),p=n(175),_=n(8),h=r(n(303)),g=n(84),b=r(n(219)),v=n(137),y=n(305),E=n(306),S=r(n(221)),P=n(223),w=n(22),O=n(75),C=n(52),N=r(n(307)),M=n(31),k=n(20),A=n(56),T=n(62),F=n(139);function j(e){return JSON.stringify({name:e.name,options:e.options})}function L({feed:e,onClickAccount:t}){const n=u.useSelector(M.selectAccountList(e.options.accounts)),a=u.useSelector(M.selectAccountList(e.options.tagged));let o=[];return n.forEach(e=>{e&&o.push(s.default.createElement(D,{account:e,onClick:()=>t(e.id)}))}),a.forEach(e=>{e&&o.push(s.default.createElement(D,{account:e,onClick:()=>t(e.id),isTagged:!0}))}),e.options.hashtags.forEach(e=>o.push(s.default.createElement(I,{hashtag:e}))),0===o.length&&o.push(s.default.createElement("div",{className:c.default.noSourcesMsg},s.default.createElement(m.Dashicon,{icon:"warning"}),s.default.createElement("span",null,"Feed has no sources"))),s.default.createElement("div",{className:c.default.sourcesList},o.map((e,t)=>e&&s.default.createElement(R,{key:t},e)))}t.FeedsList=function(){const e=u.useDispatch(),t=u.useSelector(d.selectFeeds),[n,a]=s.useState(null),o=t=>i(this,void 0,void 0,(function*(){(yield A.RestApi.media.import(t.options)).data.batching||e(O.showToast({key:"admin/feeds/import/done",message:`Imported the first set of posts for "${t.name}". Older posts are being imported in the background.`}))})),l=t=>i(this,void 0,void 0,(function*(){e(O.showToast({key:"admin/feeds/clear_cache/wait",message:`Clearing the cache for "${t.name}". Please wait ...`,type:O.ToastType.STICKY}));try{yield T.AdminRestApi.cache.clearForFeed(t),e(O.showToast({key:"admin/feeds/clear_cache/done",message:`Finished clearing the cache for "${t.name}."`}))}catch(e){F.triggerError({type:"feeds/clear_cache/error",message:k.getErrorResponseMessage(e)})}finally{e(O.removeToast("admin/feeds/clear_cache/wait"))}}));function r(){e(O.showToast({key:"admin/feeds/export",message:"Copied export code to clipboard!"}))}const b={cols:{name:c.default.nameCol,sources:c.default.sourcesCol,usages:c.default.usagesCol,actions:c.default.actionsCol},cells:{name:c.default.nameCell,sources:c.default.sourcesCell,usages:c.default.usagesCell,actions:c.default.actionsCell}};return s.default.createElement("div",{className:"feeds-list"},s.default.createElement(h.default,{styleMap:b,rows:t,cols:[{id:"name",label:"Name",render:e=>{var t,n;const a={screen:g.SCREENS.EDIT_FEED,id:e.id.toString()};return s.default.createElement("div",null,s.default.createElement(p.Link,{to:a,className:c.default.name},e.name?e.name:"(no name)"),s.default.createElement("div",{className:c.default.metaList},s.default.createElement("span",{className:c.default.id},"ID: ",e.id),s.default.createElement("span",{className:c.default.layout},null!==(n=null===(t=w.Responsive.extract(e.options.layout))||void 0===t?void 0:t.toUpperCase())&&void 0!==n?n:"GRID")))}},{id:"sources",label:"Shows posts from",render:e=>s.default.createElement(L,{feed:e,onClickAccount:a})},{id:"usages",label:"Instances",render:e=>s.default.createElement(x,{feed:e})},{id:"actions",label:"Actions",render:t=>s.default.createElement("div",{className:c.default.actionsList},s.default.createElement(v.StatefulMenu,null,({ref:e,openMenu:t})=>s.default.createElement(_.Button,{ref:e,className:c.default.actionsBtn,type:_.ButtonType.PILL,size:_.ButtonSize.NORMAL,onClick:t},s.default.createElement(y.Ellipsis,null)),s.default.createElement(v.MenuContent,null,s.default.createElement(v.MenuItem,{onClick:()=>(t=>{e(C.gotoRoute({screen:g.SCREENS.EDIT_FEED,id:t.id.toString()}))})(t)},s.default.createElement(m.Dashicon,{icon:"edit"}),"Edit feed"),s.default.createElement(v.MenuItem,{onClick:()=>(t=>{e(f.duplicateFeed(t))})(t)},s.default.createElement(m.Dashicon,{icon:"admin-page"}),"Duplicate feed"),s.default.createElement(v.MenuSeparator,null),s.default.createElement(E.CopyShortcode,{feed:t},s.default.createElement(v.MenuItem,null,s.default.createElement(m.Dashicon,{icon:"editor-code"}),"Copy shortcode")),s.default.createElement(N.default,{text:j(t),onCopy:r},s.default.createElement(v.MenuItem,null,s.default.createElement(m.Dashicon,{icon:"download"}),"Export feed")),s.default.createElement(v.MenuSeparator,null),s.default.createElement(v.MenuItem,{onClick:()=>o(t)},s.default.createElement(m.Dashicon,{icon:"image-rotate"}),"Update posts"),s.default.createElement(v.MenuItem,{onClick:()=>l(t)},s.default.createElement(m.Dashicon,{icon:"database-remove"}),"Clear cache"),s.default.createElement(v.MenuSeparator,null),s.default.createElement(v.MenuItem,{onClick:()=>(t=>{confirm("Are you sure you want to delete this feed? This cannot be undone.")&&e(f.deleteFeed(t))})(t),danger:!0},s.default.createElement(m.Dashicon,{icon:"trash"}),"Delete feed"))))}]}),s.default.createElement(S.default,{isOpen:null!==n,accountId:n,onClose:()=>a(null)}))};const x=({feed:e})=>s.default.createElement("div",{className:c.default.usagesList},e.usages.map((e,t)=>s.default.createElement("div",{key:t,className:c.default.usage},s.default.createElement("a",{className:c.default.usageLink,href:e.link,target:"_blank"},e.name),s.default.createElement("span",{className:c.default.usageType},"(",e.type,")"))));function D({account:e,isTagged:t,onClick:n}){return s.default.createElement("div",{className:c.default.accountSource,onClick:n,role:n?"button":void 0,tabIndex:0},t?s.default.createElement(m.Dashicon,{icon:"tag"}):s.default.createElement(b.default,{className:c.default.tinyAccountPic,account:e}),e.username)}function I({hashtag:e}){return s.default.createElement("a",{className:c.default.hashtagSource,href:P.getHashtagPageUrl(e.tag),target:"_blank"},s.default.createElement(m.Dashicon,{icon:"admin-site-alt3"}),s.default.createElement("span",null,"#",e.tag))}const R=({children:e})=>s.default.createElement("div",{className:c.default.source},e)},function(e,t,n){e.exports={"name-col":"FeedsList__name-col",nameCol:"FeedsList__name-col","sources-col":"FeedsList__sources-col",sourcesCol:"FeedsList__sources-col","actions-col":"FeedsList__actions-col",actionsCol:"FeedsList__actions-col","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","account-source":"FeedsList__account-source",accountSource:"FeedsList__account-source","tiny-account-pic":"FeedsList__tiny-account-pic",tinyAccountPic:"FeedsList__tiny-account-pic","hashtag-source":"FeedsList__hashtag-source",hashtagSource:"FeedsList__hashtag-source","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","actions-btn":"FeedsList__actions-btn",actionsBtn:"FeedsList__actions-btn","sources-cell":"FeedsList__sources-cell",sourcesCell:"FeedsList__sources-cell","usages-cell":"FeedsList__usages-cell",usagesCell:"FeedsList__usages-cell","usages-col":"FeedsList__usages-col",usagesCol:"FeedsList__usages-col"}},function(e,t,n){"use strict";var a;Object.defineProperty(t,"__esModule",{value:!0}),t.ToastType=void 0,(a=t.ToastType||(t.ToastType={})).NOTIFICATION="notification",a.STICKY="sticky",a.ERROR="error"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useUnload=t.useRouteInterceptor=void 0;const a=n(52),o=n(1),l=n(0),i=n(102);function r(e,t){l.useEffect(()=>a.addRouteInterceptor(e),t)}t.useRouteInterceptor=r,t.useUnload=function(e,t,n=[]){const a=o.useStore(),[s]=l.useState(()=>a.getState().router.query);r(l.useCallback((n,a)=>{if(!i.objectsEqual(n,s)&&t(n,a))return confirm(e)},[t,s,e]),n),l.useEffect(()=>{const n=n=>{if(t({},""))return(n||window.event).returnValue=e,e};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},n)}},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",content:"Tooltip__content",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"}},,,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"}},function(e,t,n){e.exports={root:"ProfilePic__root",round:"ProfilePic__round ProfilePic__root",square:"ProfilePic__square ProfilePic__root"}},function(e,t,n){},,,,function(e,t,n){e.exports={modal:"Modal__modal layout__z-higher",shade:"Modal__shade layout__fill-parent",container:"Modal__container",opening:"Modal__opening","modal-open-animation":"Modal__modal-open-animation",modalOpenAnimation:"Modal__modal-open-animation",closing:"Modal__closing","modal-close-animation":"Modal__modal-close-animation",modalCloseAnimation:"Modal__modal-close-animation",content:"Modal__content",header:"Modal__header",icon:"Modal__icon","close-btn":"Modal__close-btn",closeBtn:"Modal__close-btn",scroller:"Modal__scroller",footer:"Modal__footer"}},,function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(481)),r=n(29),s=o(n(420)),u=o(n(216)),c=n(138),d=n(308),f=o(n(309)),m=n(8),p=n(39),_=o(n(219)),h=n(25),g=n(1),b=n(92),v=n(31),y=n(45);t.default=function({accountId:e,onUpdate:t}){const n=g.useDispatch(),o=g.useSelector(v.selectAccountById(e)),[E,S]=l.default.useState(!1),[P,w]=l.default.useState(""),[O,C]=l.default.useState(!1),N=o.type===r.Account.Type.PERSONAL,M=r.Account.getBioText(o),k=()=>a(this,void 0,void 0,(function*(){C(!0);const e=h.withPartial(o,{customBio:P});yield n(b.updateAccount(e)),S(!1),C(!1),t&&t()})),A=e=>a(this,void 0,void 0,(function*(){C(!0);const a=h.withPartial(o,{customProfilePicUrl:e});yield n(b.updateAccount(a)),C(!1),t&&t()}));return l.default.createElement("div",{className:i.default.root},l.default.createElement("div",{className:i.default.container},l.default.createElement("div",{className:i.default.infoColumn},l.default.createElement("a",{href:r.Account.getProfileUrl(o),target:"_blank",className:i.default.username},"@",o.username),l.default.createElement("div",{className:i.default.row},l.default.createElement("span",{className:i.default.label},"Spotlight ID:"),o.id),l.default.createElement("div",{className:i.default.row},l.default.createElement("span",{className:i.default.label},"User ID:"),o.userId),l.default.createElement("div",{className:i.default.row},l.default.createElement("span",{className:i.default.label},"Type:"),o.type),!E&&l.default.createElement("div",{className:i.default.row},l.default.createElement("div",null,l.default.createElement("span",{className:i.default.label},"Bio:"),l.default.createElement("a",{className:i.default.editBioLink,onClick:()=>{w(r.Account.getBioText(o)),S(!0)}},"Edit bio"),l.default.createElement("pre",{className:i.default.bio},M.length>0?M:"(No bio)"))),E&&l.default.createElement("div",{className:i.default.row},l.default.createElement("textarea",{className:i.default.bioEditor,value:P,onChange:e=>{w(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.ctrlKey&&(k(),e.preventDefault(),e.stopPropagation())},rows:4}),l.default.createElement("div",{className:i.default.bioFooter},l.default.createElement("div",{className:i.default.bioEditingControls},O&&l.default.createElement("span",null,"Please wait ...")),l.default.createElement("div",{className:i.default.bioEditingControls},l.default.createElement(m.Button,{className:i.default.bioEditingButton,type:m.ButtonType.DANGER,disabled:O,onClick:()=>a(this,void 0,void 0,(function*(){C(!0);const e=h.withPartial(o,{customBio:""});yield n(b.updateAccount(e)),S(!1),C(!1),t&&t()}))},"Reset"),l.default.createElement(m.Button,{className:i.default.bioEditingButton,type:m.ButtonType.SECONDARY,disabled:O,onClick:()=>{S(!1)}},"Cancel"),l.default.createElement(m.Button,{className:i.default.bioEditingButton,type:m.ButtonType.PRIMARY,disabled:O,onClick:k},"Save"))))),l.default.createElement("div",{className:i.default.picColumn},l.default.createElement("div",null,l.default.createElement(_.default,{account:o,className:i.default.profilePic})),l.default.createElement(d.WpUploadMedia,{id:"account-custom-profile-pic",title:"Select profile picture",mediaType:"image",onSelect:e=>{const t=parseInt(e.attributes.id),n=f.default.media.attachment(t).attributes.url;A(n)}},({open:e})=>l.default.createElement(m.Button,{type:m.ButtonType.SECONDARY,className:i.default.setCustomPic,onClick:e},"Change profile picture")),o.customProfilePicUrl.length>0&&l.default.createElement("a",{className:i.default.resetCustomPic,onClick:()=>{A("")}},"Reset profile picture"))),N&&l.default.createElement("div",{className:i.default.personalInfoMessage},l.default.createElement(p.Message,{type:p.MessageType.INFO,showIcon:!0},"Due to restrictions set by Instagram, Spotlight cannot import the profile photo and bio"," ","text for Personal accounts."," ",l.default.createElement("a",{href:y.AdminResources.customPersonalInfoUrl,target:"_blank"},"Click here to learn more"),".")),l.default.createElement(c.Spoiler,{label:"View access token",stealth:!0},l.default.createElement("div",{className:i.default.row},o.accessToken&&l.default.createElement("div",null,l.default.createElement("p",null,l.default.createElement("span",{className:i.default.label},"Expires on:"),l.default.createElement("span",null,o.accessToken.expiry?s.default(u.default(o.accessToken.expiry),"PPPP"):"Unknown")),l.default.createElement("pre",{className:i.default.accessToken},o.accessToken.code)))))}},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"}},function(e,t,n){},function(e,t,n){e.exports={message:"Message__message",shaking:"Message__shaking","shake-animation":"Message__shake-animation",shakeAnimation:"Message__shake-animation",icon:"Message__icon",content:"Message__content","dismiss-btn":"Message__dismiss-btn",dismissBtn:"Message__dismiss-btn",success:"Message__success Message__message",info:"Message__info Message__message",warning:"Message__warning Message__message","pro-tip":"Message__pro-tip Message__message",proTip:"Message__pro-tip Message__message",error:"Message__error Message__message",grey:"Message__grey Message__message"}},,,,,,,function(e,t,n){e.exports={root:"FeedsOnboarding__root","root-transitioning":"FeedsOnboarding__root-transitioning FeedsOnboarding__root",rootTransitioning:"FeedsOnboarding__root-transitioning FeedsOnboarding__root",transition:"FeedsOnboarding__transition",left:"FeedsOnboarding__left",right:"FeedsOnboarding__right","scroll-padding":"FeedsOnboarding__scroll-padding",scrollPadding:"FeedsOnboarding__scroll-padding"}},function(e,t,n){},function(e,t,n){e.exports={root:"FeedTemplatePicker__root",tile:"FeedTemplatePicker__tile",button:"FeedTemplatePicker__button",template:"FeedTemplatePicker__template FeedTemplatePicker__button","template-pro":"FeedTemplatePicker__template-pro FeedTemplatePicker__template FeedTemplatePicker__button",templatePro:"FeedTemplatePicker__template-pro FeedTemplatePicker__template FeedTemplatePicker__button","template-label":"FeedTemplatePicker__template-label",templateLabel:"FeedTemplatePicker__template-label","template-thumbnail":"FeedTemplatePicker__template-thumbnail",templateThumbnail:"FeedTemplatePicker__template-thumbnail","template-name":"FeedTemplatePicker__template-name",templateName:"FeedTemplatePicker__template-name","current-indicator":"FeedTemplatePicker__current-indicator",currentIndicator:"FeedTemplatePicker__current-indicator","pro-pill":"FeedTemplatePicker__pro-pill",proPill:"FeedTemplatePicker__pro-pill","pro-overlay":"FeedTemplatePicker__pro-overlay",proOverlay:"FeedTemplatePicker__pro-overlay","upgrade-button":"FeedTemplatePicker__upgrade-button",upgradeButton:"FeedTemplatePicker__upgrade-button","custom-template":"FeedTemplatePicker__custom-template FeedTemplatePicker__button",customTemplate:"FeedTemplatePicker__custom-template FeedTemplatePicker__button","custom-template-icon":"FeedTemplatePicker__custom-template-icon",customTemplateIcon:"FeedTemplatePicker__custom-template-icon","custom-template-text":"FeedTemplatePicker__custom-template-text",customTemplateText:"FeedTemplatePicker__custom-template-text"}},,,,function(e,t,n){e.exports={pill:"ProPill__pill"}},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",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"}},function(e,t,n){e.exports={logo:"SpotlightLogo__logo","logo-image":"SpotlightLogo__logo-image",logoImage:"SpotlightLogo__logo-image"}},function(e,t,n){e.exports={root:"ProUpgradeBtn__root"}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedImportButton=void 0;const r=l(n(0)),s=i(n(502)),u=n(8),c=n(11),d=n(86),f=i(n(323)),m=n(135);t.FeedImportButton=function({onImport:e}){const t=r.useRef(),n=r.useRef(),[a,o]=r.useState(!1),[l,i]=r.useState(""),p=r.useCallback(()=>{i(""),o(!0)},[n,o]),_=r.useCallback(()=>{var e;o(!1),null===(e=t.current)||void 0===e||e.focus()},[t,o]),h=r.useCallback(e=>{i(e.target.value)},[i]),g=r.useCallback(()=>{let t;try{t=JSON.parse(l)}catch(e){t=null}m.isPlainObject(t)&&(null==t?void 0:t.hasOwnProperty("name"))&&(null==t?void 0:t.hasOwnProperty("options"))?(e(t),_()):alert("The imported code is not valid")},[l,e,_]);return r.default.createElement(r.default.Fragment,null,r.default.createElement(u.Button,{ref:t,type:u.ButtonType.SECONDARY,size:u.ButtonSize.LARGE,onClick:p},r.default.createElement(c.Dashicon,{icon:"upload"}),r.default.createElement("span",null,"Import a feed")),r.default.createElement(d.Modal,{isOpen:a,onClose:_,title:"Import feed"},r.default.createElement(d.Modal.Content,null,r.default.createElement("p",{className:s.default.message},"Paste your exported feed code:"),r.default.createElement("textarea",{ref:n,className:s.default.field,value:l,onChange:h,autoFocus:!0,rows:4})),r.default.createElement(d.Modal.Footer,null,r.default.createElement(u.Button,{className:f.default.button,type:u.ButtonType.SECONDARY,onClick:_,children:"Cancel"}),r.default.createElement(u.Button,{className:f.default.button,type:u.ButtonType.PRIMARY,onClick:g,children:"Import"}))))}},function(e,t,n){e.exports={message:"FeedImportButton__message",field:"FeedImportButton__field"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.NewFeedScreen=void 0;const i=l(n(0)),r=n(324),s=n(9),u=n(273),c=n(1),d=n(63),f=n(180),m=n(228);t.NewFeedScreen=function(){const e=c.useDispatch(),t=c.useSelector(d.selectQueryParam("template")),n=c.useSelector(m.selectTemplateById(t)),a=n?f.applyFeedTemplateModel(n,s.DefaultFeedOptions):s.DefaultFeedOptions;return i.useEffect(()=>{e(u.setIsEditingNewFeed(!0))},[]),i.default.createElement(r.AdminEditor,{feed:{id:null,name:"",options:a,usages:[]}})}},,,,,,,,,function(e,t,n){e.exports={root:"ConnectAccountButton__root"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(236)),i=n(86);t.default=function({isOpen:e,onClose:t,onConnect:n,beforeConnect:a}){return o.default.createElement(i.Modal,{title:"Connect an Instagram account",isOpen:e,width:650,onClose:t},o.default.createElement(i.Modal.Content,null,o.default.createElement(l.default,{onConnect:n,beforeConnect:e=>{a&&a(e),t()}})))}},function(e,t,n){e.exports={base:"ConnectAccount__base",horizontal:"ConnectAccount__horizontal ConnectAccount__base","prompt-msg":"ConnectAccount__prompt-msg",promptMsg:"ConnectAccount__prompt-msg",types:"ConnectAccount__types",vertical:"ConnectAccount__vertical ConnectAccount__base","or-separator":"ConnectAccount__or-separator",orSeparator:"ConnectAccount__or-separator",type:"ConnectAccount__type",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","or-line":"ConnectAccount__or-line",orLine:"ConnectAccount__or-line","or-text":"ConnectAccount__or-text",orText:"ConnectAccount__or-text","types-rows":"ConnectAccount__types-rows",typesRows:"ConnectAccount__types-rows"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(516)),i=n(8),r=n(39),s=n(45),u=/^(User ID: ([0-9]+)\s*)?Access Token: ([a-zA-Z0-9]+)$/im;t.default=function({isColumn:e,onConnectPersonal:t,onConnectBusiness:n}){const a=o.default.useRef(!1),[c,d]=o.default.useState(""),[f,m]=o.default.useState(""),p=c.length>145&&c.trimLeft().startsWith("EA"),_=e=>{"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),h())},h=o.default.useCallback(()=>{p?n(c,f):t(c)},[c,f,p]),g=o.default.createElement("div",{className:l.default.buttonContainer},o.default.createElement(i.Button,{className:l.default.button,onClick:h,type:i.ButtonType.PRIMARY,disabled:0===c.length&&(0===f.length||!p)},"Connect"));return o.default.createElement("div",{className:e?l.default.column:l.default.row},o.default.createElement("div",{className:l.default.content},o.default.createElement("div",{className:l.default.bottom},o.default.createElement("input",{id:"manual-connect-access-token",type:"text",value:c,onChange:e=>{const t=e.target.value;if(a.current){a.current=!1;const e=u.exec(t);if(e)switch(e.length){case 2:return void d(e[1]);case 4:return m(e[2]),void d(e[3])}}d(t)},onPaste:e=>{a.current=!0,e.persist()},onKeyDown:_,placeholder:"Instagram/Facebook access token"}),!p&&g)),p&&o.default.createElement("div",{className:l.default.content},o.default.createElement("label",{className:l.default.label,htmlFor:"manual-connect-user-id"},o.default.createElement("div",null,"This access token is for a ",o.default.createElement("strong",null,"Business")," account."," ","Please also enter the user ID:")),o.default.createElement("div",{className:l.default.bottom},o.default.createElement("input",{id:"manual-connect-user-id",type:"text",value:f,onChange:e=>{m(e.target.value)},onKeyDown:_,placeholder:"Enter the user ID"}),p&&g)),o.default.createElement(r.Message,{type:r.MessageType.GREY,showIcon:!0},"Connecting a client's account? Avoid sharing passwords and use our"," ",o.default.createElement("a",{href:s.AdminResources.tokenGenerator,target:"_blank"},"access token generator"),"."))}},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"}},,,function(e,t,n){e.exports={root:"AccountSelector__root",row:"AccountSelector__row",account:"AccountSelector__account button__toggle-button button__panel-button theme__panel","account-selected":"AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel",accountSelected:"AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel","account-disabled":"AccountSelector__account-disabled AccountSelector__account button__toggle-button button__panel-button theme__panel theme__disabled",accountDisabled:"AccountSelector__account-disabled AccountSelector__account button__toggle-button button__panel-button theme__panel theme__disabled","account-selected-disabled":"AccountSelector__account-selected-disabled AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel theme__disabled",accountSelectedDisabled:"AccountSelector__account-selected-disabled AccountSelector__account-selected AccountSelector__account button__toggle-button button__panel-button theme__panel button__toggle-button-on button__toggle-button button__panel-button theme__panel theme__disabled","profile-pic":"AccountSelector__profile-pic",profilePic:"AccountSelector__profile-pic","info-column":"AccountSelector__info-column",infoColumn:"AccountSelector__info-column","info-text":"AccountSelector__info-text",infoText:"AccountSelector__info-text",username:"AccountSelector__username AccountSelector__info-text","account-type":"AccountSelector__account-type AccountSelector__info-text",accountType:"AccountSelector__account-type AccountSelector__info-text","tick-icon":"AccountSelector__tick-icon",tickIcon:"AccountSelector__tick-icon"}},function(e,t,n){e.exports={container:"FieldRow__container","container-wide":"FieldRow__container-wide FieldRow__container",containerWide:"FieldRow__container-wide FieldRow__container",content:"FieldRow__content",label:"FieldRow__label",disabled:"FieldRow__disabled FieldRow__container","pro-pill":"FieldRow__pro-pill",proPill:"FieldRow__pro-pill","disabled-wide":"FieldRow__disabled-wide FieldRow__container-wide FieldRow__container FieldRow__disabled FieldRow__container",disabledWide:"FieldRow__disabled-wide FieldRow__container-wide FieldRow__container FieldRow__disabled FieldRow__container","label-normal":"FieldRow__label-normal FieldRow__label",labelNormal:"FieldRow__label-normal FieldRow__label","label-centered":"FieldRow__label-centered FieldRow__label",labelCentered:"FieldRow__label-centered FieldRow__label",field:"FieldRow__field","field-normal":"FieldRow__field-normal FieldRow__field",fieldNormal:"FieldRow__field-normal FieldRow__field","field-centered":"FieldRow__field-centered FieldRow__field",fieldCentered:"FieldRow__field-centered FieldRow__field","responsive-container":"FieldRow__responsive-container",responsiveContainer:"FieldRow__responsive-container","responsive-field":"FieldRow__responsive-field FieldRow__field",responsiveField:"FieldRow__responsive-field FieldRow__field","label-aligner":"FieldRow__label-aligner",labelAligner:"FieldRow__label-aligner"}},function(e,t,n){e.exports={root:"HelpTooltip__root",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"}},,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BusinessAccountSelector=void 0;const o=a(n(0)),l=n(1),i=n(237),r=n(39),s=n(31);t.BusinessAccountSelector=function(e){const t=l.useSelector(s.selectBusinessAccounts);return t.length>0?o.default.createElement(i.AccountSelector,Object.assign({accounts:t},e)):o.default.createElement(r.Message,{type:r.MessageType.WARNING},"Connect a business account to use this feature.")}},,,,,,,,,,,,,,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"}},,,,function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.UnitInput=void 0;const l=o(n(0)),i=o(n(544));t.UnitInput=function(e){var{className:t,unit:n}=e,o=a(e,["className","unit"]);return l.default.createElement("div",{className:i.default.root},l.default.createElement("input",Object.assign({},o,{className:`${i.default.field} ${null!=t?t:""}`})),l.default.createElement("div",{className:i.default.unit},l.default.createElement("span",null,n)))}},function(e,t,n){e.exports={root:"UnitInput__root",field:"UnitInput__field",unit:"UnitInput__unit"}},,,,,,,,,,function(e,t,n){e.exports={"checkbox-field":"CheckboxField__checkbox-field",checkboxField:"CheckboxField__checkbox-field",aligner:"CheckboxField__aligner"}},,,,function(e,t,n){e.exports={button:"ColorPicker__button","color-preview":"ColorPicker__color-preview",colorPreview:"ColorPicker__color-preview",popper:"ColorPicker__popper"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports={root:"FieldSet__root"}},,,,,,,,,,,,,function(e,t,n){e.exports={"checkbox-list":"CheckboxListField__checkbox-list",checkboxList:"CheckboxListField__checkbox-list",option:"CheckboxListField__option","disabled-option":"CheckboxListField__disabled-option CheckboxListField__option theme__disabled",disabledOption:"CheckboxListField__disabled-option CheckboxListField__option theme__disabled","pro-pill":"CheckboxListField__pro-pill",proPill:"CheckboxListField__pro-pill"}},,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TextAreaField=void 0;const o=a(n(0));t.TextAreaField=function({id:e,value:t,onChange:n}){return o.default.createElement("textarea",{id:e,value:t,onChange:e=>n(e.target.value)})}},,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ButtonGroup=void 0;const o=a(n(0));n(302);const l=n(14);t.ButtonGroup=({wide:e,children:t})=>o.default.createElement("div",{className:l.classList("button-group",e&&"button-group-wide")},t)},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BorderDesignFields=void 0;const r=l(n(0)),s=i(n(801)),u=n(32),c=n(233),d=n(40),f=n(58),m=n(25),p=n(142);t.BorderDesignFields=function({design:e,onChange:t,labels:n,show:a}){const[o,l]=r.useState(c.BorderDesign.DEFAULT);return e=null!=e?e:o,t=null!=t?t:l,r.default.createElement("div",{className:s.default.root},(a.width||a.style||a.color)&&r.default.createElement(p.FieldRow,{label:n&&"Border"},a.width&&r.default.createElement("div",{className:s.default.width},r.default.createElement(u.NumberField,{value:e.width,onChange:n=>{t(m.withPartial(e,{width:n}))},placeholder:"Thickness",min:0,unit:"px"})),a.style&&r.default.createElement("div",{className:s.default.style},r.default.createElement(d.Select,{value:e.style,onChange:n=>{t(m.withPartial(e,{style:n}))},options:[{value:"solid",label:"Solid line"},{value:"dotted",label:"Dotted line"},{value:"dashed",label:"Dashed line"},{value:"double",label:"Double line"},{value:"groove",label:"Grooved"}]})),a.color&&r.default.createElement("div",{className:s.default.color},r.default.createElement(f.ColorPicker,{value:e.color,onChange:n=>{t(m.withPartial(e,{color:n.rgb}))}}))),a.radius&&r.default.createElement(p.FieldRow,{label:n&&"Border Radius"},r.default.createElement(u.NumberField,{value:e.radius,onChange:n=>{const a=parseInt(n.toString());t(m.withPartial(e,{radius:a||0}))},min:0,unit:"px"})))}},function(e,t,n){e.exports={root:"BorderDesignFields__root",row:"BorderDesignFields__row",label:"BorderDesignFields__label",style:"BorderDesignFields__style",width:"BorderDesignFields__width",color:"BorderDesignFields__color"}},,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MultiTextInput=void 0;const r=l(n(0)),s=i(n(334)),u=n(39),c=n(40),d={DropdownIndicator:null},f=e=>({label:e,value:e});t.MultiTextInput=function({id:e,value:t,onChange:n,sanitize:a,autoFocus:o,message:l}){const[i,m]=r.default.useState(""),[p,_]=r.default.useState(-1),[h,g]=r.default.useState();r.useEffect(()=>{g(l)},[l]);const b=(t=Array.isArray(t)?t:[]).map(e=>f(e)),v=()=>{i.length&&(m(""),y([...b,f(i)]))},y=e=>{if(!n)return;let t=-1;e=e?e.map(e=>e&&a?a(e.value):e.value).filter((e,n,a)=>{const o=a.indexOf(e);return o!==n?(t=o,!1):!!e}):[],_(t),-1===t&&n(e)},E=c.SelectStyles();return r.default.createElement(r.default.Fragment,null,r.default.createElement(s.default,{inputId:e,className:"react-select",classNamePrefix:"react-select",components:d,inputValue:i,isClearable:!1,isMulti:!0,menuIsOpen:!1,onChange:y,onInputChange:e=>{m(e)},onKeyDown:e=>{if(i)switch(e.key){case",":case"Enter":case"Tab":v(),e.preventDefault()}},onBlur:v,placeholder:"Type something and press enter...",value:b,autoFocus:o,styles:E}),p<0||0===b.length?null:r.default.createElement(u.Message,{type:u.MessageType.WARNING,shake:!0,showIcon:!0,isDismissible:!0},r.default.createElement("code",null,b[p].label)," is already in the list"),h?r.default.createElement(u.Message,{type:u.MessageType.WARNING,shake:!0,showIcon:!0,isDismissible:!0},h):null)}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalFiltersModal=void 0;const o=a(n(0)),l=n(86),i=n(197),r=n(1),s=n(33),u=n(126),c=n(387);t.GlobalFiltersModal=function({isOpen:e,onClose:t,onSave:n}){const a=r.useDispatch(),d=r.useSelector(s.selectSettingsAreDirty),f=r.useSelector(s.selectSettingsAreSaving);return o.default.createElement(l.Modal,{title:"Global filters",isOpen:e,onClose:()=>{d&&!confirm("You have unsaved changes. If you close the window now, your settings will not be saved. Click OK to close anyway.")||t()}},o.default.createElement(l.Modal.Content,null,o.default.createElement(c.SettingsFiltersTab,null)),o.default.createElement(l.Modal.Footer,null,o.default.createElement(i.SaveButton,{disabled:!d,isSaving:f,onClick:()=>{a(u.saveSettings()).then(()=>{n&&n()})}})))}},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"}},function(e,t,n){e.exports={root:"SettingsPage__root layout__flex-column","after-groups":"SettingsPage__after-groups",afterGroups:"SettingsPage__after-groups","before-groups":"SettingsPage__before-groups",beforeGroups:"SettingsPage__before-groups","group-list":"SettingsPage__group-list layout__flex-column",groupList:"SettingsPage__group-list layout__flex-column"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsCaptionFiltersGroup=void 0;const o=a(n(0)),l=n(147),i=n(834),r=n(837);t.SettingsCaptionFiltersGroup=function(){return o.default.createElement(l.SettingsGroup,{title:"Caption filtering"},o.default.createElement(i.CaptionWhitelistField,null),o.default.createElement(r.CaptionBlacklistField,null))}},function(e,t,n){e.exports={root:"SettingsGroup__root layout__flex-column",title:"SettingsGroup__title","before-fields":"SettingsGroup__before-fields",beforeFields:"SettingsGroup__before-fields","after-fields":"SettingsGroup__after-fields",afterFields:"SettingsGroup__after-fields","field-list":"SettingsGroup__field-list layout__flex-column",fieldList:"SettingsGroup__field-list layout__flex-column"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CaptionWhitelistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(146),s=n(33),u=n(47);t.CaptionWhitelistField=function(){const e=l.useDispatch(),t=l.useSelector(s.selectSetting("captionWhitelist")),n=l.useSelector(s.selectSetting("captionBlacklist"));return o.default.createElement(i.SettingsField,{id:"captionWhitelist",label:"Only show posts with these words or phrases",fullWidth:!0},o.default.createElement(r.LimitedMultiTextInput,{id:"captionWhitelist",value:t,onChange:t=>e(u.updateSettings({captionWhitelist:t})),exclude:n,excludeMsg:"%s is already being used in the below option"}))}},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-column","control-partial-width":"SettingsField__control-partial-width SettingsField__control layout__flex-column",controlPartialWidth:"SettingsField__control-partial-width SettingsField__control layout__flex-column","control-full-width":"SettingsField__control-full-width SettingsField__control layout__flex-column",controlFullWidth:"SettingsField__control-full-width SettingsField__control layout__flex-column",tooltip:"SettingsField__tooltip layout__flex-column"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CaptionBlacklistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(146),s=n(33),u=n(47);t.CaptionBlacklistField=function(){const e=l.useDispatch(),t=l.useSelector(s.selectSetting("captionBlacklist")),n=l.useSelector(s.selectSetting("captionWhitelist"));return o.default.createElement(i.SettingsField,{id:"captionBlacklist",label:"Hide posts with these words or phrases",fullWidth:!0},o.default.createElement(r.LimitedMultiTextInput,{id:"captionBlacklist",value:t,onChange:t=>e(u.updateSettings({captionBlacklist:t})),exclude:n,excludeMsg:"%s is already being used in the above option"}))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsHashtagFiltersGroup=void 0;const o=a(n(0)),l=n(147),i=n(839),r=n(841);t.SettingsHashtagFiltersGroup=function(){return o.default.createElement(l.SettingsGroup,{title:"Hashtag filtering"},o.default.createElement(i.HashtagWhitelistField,null),o.default.createElement(r.HashtagBlacklistField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HashtagWhitelistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(33),s=n(47),u=n(198);t.HashtagWhitelistField=function(){const e=l.useDispatch(),t=l.useSelector(r.selectSetting("hashtagWhitelist")),n=l.useSelector(r.selectSetting("hashtagBlacklist"));return o.default.createElement(i.SettingsField,{id:"hashtagWhitelist",label:"Only show posts with these words or phrases",fullWidth:!0},o.default.createElement(u.MultiHashtagInput,{id:"hashtagWhitelist",value:t,onChange:t=>e(s.updateSettings({hashtagWhitelist:t})),exclude:n,excludeMsg:"The %s hashtag is already being used in the below option"}))}},,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HashtagBlacklistField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=n(146),s=n(33),u=n(47);t.HashtagBlacklistField=function(){const e=l.useDispatch(),t=l.useSelector(s.selectSetting("hashtagBlacklist")),n=l.useSelector(s.selectSetting("hashtagWhitelist"));return o.default.createElement(i.SettingsField,{id:"hashtagBlacklist",label:"Hide posts with these words or phrases",fullWidth:!0},o.default.createElement(r.LimitedMultiTextInput,{id:"hashtagBlacklist",value:t,onChange:t=>e(u.updateSettings({hashtagBlacklist:t})),exclude:n,excludeMsg:"The %s hashtag is already being used in the above option"}))}},,,,,,function(e,t,n){e.exports={layout:"SidebarLayout__layout","layout-primary-content":"SidebarLayout__layout-primary-content SidebarLayout__layout",layoutPrimaryContent:"SidebarLayout__layout-primary-content SidebarLayout__layout","layout-primary-sidebar":"SidebarLayout__layout-primary-sidebar SidebarLayout__layout",layoutPrimarySidebar:"SidebarLayout__layout-primary-sidebar SidebarLayout__layout",container:"SidebarLayout__container",content:"SidebarLayout__content SidebarLayout__container",sidebar:"SidebarLayout__sidebar SidebarLayout__container",navigation:"SidebarLayout__navigation","navigation-left":"SidebarLayout__navigation-left SidebarLayout__navigation",navigationLeft:"SidebarLayout__navigation-left SidebarLayout__navigation","navigation-right":"SidebarLayout__navigation-right SidebarLayout__navigation",navigationRight:"SidebarLayout__navigation-right SidebarLayout__navigation","nav-link":"SidebarLayout__nav-link",navLink:"SidebarLayout__nav-link"}},,,function(e,t,n){e.exports={content:"Sidebar__content",sidebar:"Sidebar__sidebar",padded:"Sidebar__padded","padded-content":"Sidebar__padded-content Sidebar__content Sidebar__padded",paddedContent:"Sidebar__padded-content Sidebar__content Sidebar__padded",disabled:"Sidebar__disabled Sidebar__sidebar"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RadioGroup=void 0;const o=a(n(0)),l=a(n(852));t.RadioGroup=function({name:e,className:t,disabled:n,value:a,onChange:i,options:r}){const s=e=>{!n&&e.target.checked&&i&&i(e.target.value)};return t=(n?l.default.disabled:l.default.radioGroup)+" "+(null!=t?t:""),o.default.createElement("div",{className:t},r.map((t,n)=>o.default.createElement("label",{className:l.default.option,key:n},o.default.createElement("input",{type:"radio",name:e,value:t.value,checked:a===t.value,onChange:s}),o.default.createElement("span",null,t.label))))}},function(e,t,n){e.exports={"radio-group":"RadioGroup__radio-group",radioGroup:"RadioGroup__radio-group",disabled:"RadioGroup__disabled RadioGroup__radio-group theme__disabled",option:"RadioGroup__option"}},,,function(e,t,n){e.exports={loading:"MediaSelectionGrid__loading",media:"MediaSelectionGrid__media","selected-media":"MediaSelectionGrid__selected-media MediaSelectionGrid__media",selectedMedia:"MediaSelectionGrid__selected-media MediaSelectionGrid__media",thumbnail:"MediaSelectionGrid__thumbnail"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionGrid=void 0;const s=l(n(0)),u=r(n(857)),c=n(220),d=n(155);t.SelectionGrid=function(e){var t,n,{items:a,disabled:o,controlled:l,canDeselect:r,children:d,onClick:m,onSelect:p}=e,_=i(e,["items","disabled","controlled","canDeselect","children","onClick","onSelect"]);let h=0;_.initialSelected&&_.keyFn&&(h=a.findIndex((e,t)=>_.keyFn(e,t)===_.initialSelected),h=-1===h?0:h);const[g,b]=s.useState(h),v=s.default.useRef(),y=s.default.useRef(),E=s.default.useRef(),S=l?_.selected:g,P=null!==(t=_.gridGap)&&void 0!==t?t:15,w=null===(n=_.useKeyBinds)||void 0===n||n;function O(e,t){o||(l||b(e),p&&p(a[e],e,t))}function C(e,t){o||(O(e,t),m&&m(a[e],e,t))}s.useLayoutEffect(()=>{var e;null===(e=E.current)||void 0===e||e.focus()},[E]);const N=s.useCallback(e=>{if(o||!w)return;const t=function(){const e=y.current.getBoundingClientRect(),t=E.current.getBoundingClientRect(),n=e.width,a=t.width;return Math.floor((n+P)/(a+P))}(),n=Math.ceil(a.length/t);switch(e.key){case" ":case"Enter":C(S);break;case"ArrowLeft":O(Math.max(S-1,0));break;case"ArrowRight":O(Math.min(S+1,a.length-1));break;case"ArrowUp":{const e=Math.max(0,S-t),a=Math.floor(S/t),o=Math.floor(e/t);n>1&&o!==a&&O(e);break}case"ArrowDown":{const e=Math.min(a.length-1,S+t),o=Math.floor(S/t),l=Math.floor(e/t);n>1&&l!==o&&O(e);break}default:return}e.preventDefault(),e.stopPropagation()},[o,w,a,O]);c.useDetectOutsideClick(y,()=>{r&&O(null)},[],[r,O]);const M=Object.assign(Object.assign({},_.gridStyle),{gridGap:P}),k=o?u.default.gridDisabled:u.default.grid;return s.default.createElement("div",{ref:v,className:u.default.root},s.default.createElement("div",{ref:y,className:k,style:M},a.map((e,t)=>s.default.createElement(f,{key:_.keyFn?_.keyFn(e,t):t,ref:0===t?E:null,focused:!o&&S===t,onClick:e=>C(t,e.currentTarget),onSelect:e=>O(t,e.currentTarget),onKeyDown:N},d({item:e,isSelected:S===t})))))};const f=s.default.forwardRef(({focused:e,onClick:t,onSelect:n,onKeyDown:a,children:o},l)=>{const i=s.useRef();return s.useLayoutEffect(()=>{var t;e&&(null===(t=null==i?void 0:i.current)||void 0===t||t.focus())},[e,i]),s.default.createElement("div",{ref:d.mergeRefs(i,l),className:u.default.item,onClick:t,onFocus:n,onKeyDown:a,tabIndex:0},o)})},function(e,t,n){e.exports={root:"SelectionGrid__root",grid:"SelectionGrid__grid","grid-disabled":"SelectionGrid__grid-disabled SelectionGrid__grid",gridDisabled:"SelectionGrid__grid-disabled SelectionGrid__grid",item:"SelectionGrid__item"}},function(e,t,n){},,,,,,,,,,,,function(e,t,n){e.exports={root:"PromotionsGrid__root",tile:"PromotionsGrid__tile","tile-selected":"PromotionsGrid__tile-selected PromotionsGrid__tile",tileSelected:"PromotionsGrid__tile-selected PromotionsGrid__tile",thumbnail:"PromotionsGrid__thumbnail","tile-icon":"PromotionsGrid__tile-icon",tileIcon:"PromotionsGrid__tile-icon","tile-thumbnail":"PromotionsGrid__tile-thumbnail",tileThumbnail:"PromotionsGrid__tile-thumbnail",navigation:"PromotionsGrid__navigation"}},function(e,t,n){e.exports={bottom:"MediaPromotionFields__bottom","remove-promo":"MediaPromotionFields__remove-promo",removePromo:"MediaPromotionFields__remove-promo",separator:"MediaPromotionFields__separator"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromoTypeComponents=void 0;const o=a(n(873)),l=a(n(874)),i=a(n(875));t.PromoTypeComponents=new Map([["link",{heading:"Link options",fields:o.default,tutorial:l.default}],["-more-",{heading:"Have your say...",fields:i.default,tutorial:i.default}]])},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=l(n(0)),u=n(40),c=n(21),d=r(n(42)),f=n(36),m=n(265),p=n(108),_=n(393),h=n(142),g=(n(20),[]),b={linkType:"",postId:0,postTitle:"",postUrl:"",url:"",linkText:"",newTab:!1,linkDirectly:!0};t.default=function({config:e,onChange:t}){e=null!=e?e:b,e=Object.assign(Object.assign({},b),e),0===g.length&&(g.push({value:"url",label:"URL"}),d.default.config.postTypes.forEach(e=>{if("attachment"!==e.slug){const t=s.default.createElement("span",null,e.labels.singularName,"post"!==e.slug&&"page"!==e.slug&&s.default.createElement("span",null," ",s.default.createElement("code",{style:{fontSize:"90%"}},e.slug)));g.push({value:e.slug,label:t})}}));const n=s.default.useRef(),a=s.default.useRef(!1),o=s.default.useRef(),[l,r]=s.default.useState([]),[u,c]=s.default.useState(!1);s.useEffect(()=>(a.current=!1,e.linkType&&"url"!==e.linkType&&(c(!0),N("").then(e=>{a.current||r(e)}).finally(()=>{a.current||c(!1)})),()=>a.current=!0),[e.linkType]);const f=s.default.useCallback(n=>{t({linkType:n,postId:0,postTitle:"",postUrl:"",url:e.url,newTab:e.newTab,linkText:e.linkText})},[e,t]),m=s.default.useCallback(n=>{if(null===n)t(Object.assign(Object.assign({},e),{postId:0,postTitle:"",postUrl:""}));else{const a=o.current.find(e=>e.id==n.value);t(Object.assign(Object.assign({},e),{postId:n.value,postTitle:a.title,postUrl:a.permalink}))}},[e,t]),p=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{url:n}))},[e,t]),h=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{newTab:n}))},[e,t]),S=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{linkDirectly:n}))},[e,t]),O=s.default.useCallback(n=>{t(Object.assign(Object.assign({},e),{linkText:n}))},[e,t]),N=s.default.useCallback(t=>(clearTimeout(n.current),new Promise(a=>{n.current=setTimeout(()=>i(this,void 0,void 0,(function*(){try{const n=yield d.default.config.searchPosts(e.linkType,t);o.current=n,a(n.map(e=>({value:e.id,label:e.title})))}catch(e){}})),1e3)})),[e.linkType]),M=d.default.config.postTypes.find(t=>t.slug===e.linkType);return s.default.createElement(s.default.Fragment,null,s.default.createElement(v,{value:e.linkType,onChange:f}),"url"===e.linkType&&s.default.createElement(y,{value:e.url,onChange:p}),e.linkType&&"url"!==e.linkType&&s.default.createElement(E,{postType:M,postId:e.postId,postTitle:e.postTitle,onChange:m,loadOptions:N,isLoading:u,defaultPosts:l}),e.linkType&&s.default.createElement(P,{value:e.linkDirectly,onChange:S}),e.linkType&&s.default.createElement(w,{value:e.newTab,onChange:h}),e.linkType&&s.default.createElement(C,{value:e.linkText,onChange:O,placeholder:_.LinkPromoType.getDefaultLinkText(e)}))};const v=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-to",label:"Link to"},s.default.createElement(u.Select,{id:"promo-link-to",value:e||"",onChange:e=>t(e.value),options:g,isCreatable:!1}))})),y=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"link-promo-url",label:"URL",wide:!0},s.default.createElement(m.TextField,{id:"link-promo-url",value:e,onChange:t}))})),E=s.default.memo((function({postType:e,postId:t,postTitle:n,onChange:a,defaultPosts:o,isLoading:l,loadOptions:i}){const r=e?"Search for a "+e.labels.singularName:"Search";return s.default.createElement(h.FieldRow,{labelId:"link-promo-url",label:r,wide:!0},s.default.createElement(u.Select,{async:!0,cacheOptions:!0,key:p.uniqueNum(),id:"sli-promo-search-post",placeholder:"Select or start typing...",value:t||0,defaultValue:0,defaultInputValue:t?n:"",onChange:a,defaultOptions:o,loadOptions:i,noOptionsMessage:({inputValue:e})=>e.length?`No posts were found for "${e}"`:"Type to search for posts",loadingMessage:()=>"Searching...",isLoading:l,isSearchable:!0,isClearable:!0}))})),S=s.default.createElement(s.default.Fragment,null,s.default.createElement("p",null,"Tick this box to make posts go directly to the link. If left unticked, posts will open the popup box."),s.default.createElement("p",null,"To enable your feed's popup box and sidebar:"),s.default.createElement("ol",{style:{marginLeft:15}},s.default.createElement("li",null,"Set the ",s.default.createElement("b",null,"Design » Feed » Open posts in")," option to ",s.default.createElement("b",null,"Popup box")),s.default.createElement("li",null,"Enable the ",s.default.createElement("b",null,"Design » Popup box » Show sidebar")," option."))),P=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-directly",label:"Link directly",tooltip:S},s.default.createElement(f.CheckboxField,{id:"promo-link-directly",value:e,onChange:t}))})),w=s.default.memo((function({value:e,onChange:t}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-new-tab",label:"Open in a new tab"},s.default.createElement(f.CheckboxField,{id:"promo-link-new-tab",value:e,onChange:t}))})),O=s.default.createElement(s.default.Fragment,null,s.default.createElement("p",null,"The text to use for the link in the popup box sidebar:",s.default.createElement("br",null),s.default.createElement("img",{src:c.Common.image("popup-link-text.png"),alt:""})),s.default.createElement("p",null,"Remember to enable your feed's popup box and sidebar, like so:"),s.default.createElement("ol",{style:{marginLeft:15}},s.default.createElement("li",null,"Set the ",s.default.createElement("b",null,"Design » Feed » Open posts in")," option to ",s.default.createElement("b",null,"Popup box")),s.default.createElement("li",null,"Enable the ",s.default.createElement("b",null,"Design » Popup box » Show sidebar")," option."))),C=s.default.memo((function({value:e,onChange:t,placeholder:n}){return s.default.createElement(h.FieldRow,{labelId:"promo-link-text",label:"Popup box link text",tooltip:O},s.default.createElement(m.TextField,{id:"promo-link-text",value:e,onChange:t,placeholder:n}))}))},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0));t.default=function({}){return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",{style:{fontWeight:"bold"}},"How it works:"),o.default.createElement("ol",{style:{marginTop:0}},o.default.createElement("li",null,"Select a post from the preview on the left."),o.default.createElement("li",null,"Choose what the post should link to.")),o.default.createElement("p",null,"That’s it!"))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=n(8),i=n(45);t.default=function({}){return o.default.createElement(o.default.Fragment,null,o.default.createElement("p",null,"Spotlight’s ‘Promote’ feature has lots more to come. Share your thoughts on what you’d like to"," ","promote and how."),o.default.createElement("p",null,"Take our 2-minute survey."),o.default.createElement("div",null,o.default.createElement(l.Button,{type:l.ButtonType.PRIMARY,size:l.ButtonSize.LARGE,onClick:function(){window.open(i.AdminResources.promoTypesSurvey)}},"Start Survey")))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotionOverrideMessage=void 0;const o=a(n(0)),l=n(39),i=n(8),r=n(175);t.PromotionOverrideMessage=function({hasGlobal:e,hasAuto:t,isOverriding:n,onOverride:a}){return o.default.createElement(o.default.Fragment,null,o.default.createElement(l.Message,{type:l.MessageType.WARNING,showIcon:!0},o.default.createElement("span",null,"You have")," ",t&&o.default.createElement(r.Link,{to:{screen:"promotions",tab:"automate"},absolute:!0,newTab:!0},"automated"),t&&e&&o.default.createElement(o.default.Fragment,null," ",o.default.createElement("span",null,"and")," "),e&&o.default.createElement(r.Link,{to:{screen:"promotions",tab:"global"},absolute:!0,newTab:!0},"global")," ",o.default.createElement("span",null,"promotions that apply to this post.")," ",n?o.default.createElement("span",null,"To stop overriding, simply remove the custom promotion."):o.default.createElement("span",null,"Click the button below to use a custom promotion instead.")),!n&&o.default.createElement(i.Button,{onClick:a},"Override"))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromotePreviewTile=void 0;const o=a(n(0)),l=a(n(878)),i=n(149);t.PromotePreviewTile=function({media:e}){return o.default.createElement("div",{className:l.default.container},o.default.createElement("div",{className:l.default.sizer},o.default.createElement(i.MediaThumbnail,{media:e})))}},function(e,t,n){e.exports={container:"PromotePreviewTile__container",sizer:"PromotePreviewTile__sizer"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedNameField=void 0;const o=a(n(880)),l=a(n(0)),i=n(8),r=n(11),s=n(137),u=n(155);t.FeedNameField=function({name:e,label:t,onDone:n}){const a=l.default.useRef(),[c,d]=l.default.useState(""),[f,m]=l.default.useState(!1),p=()=>{d(e),m(!0)},_=()=>{m(!1),n&&n(c),a.current&&a.current.focus()},h=e=>{switch(e.key){case"Enter":case" ":p()}};return l.default.createElement("div",{className:o.default.root},l.default.createElement(s.Menu,{isOpen:f,onBlur:()=>m(!1),placement:"bottom"},({ref:e})=>l.default.createElement("div",{ref:u.mergeRefs(e,a),className:o.default.staticContainer,onClick:p,onKeyPress:h,tabIndex:0,role:"button"},l.default.createElement("span",{className:o.default.label},t),l.default.createElement(r.Dashicon,{icon:"edit",className:o.default.editIcon})),l.default.createElement(s.MenuContent,null,l.default.createElement(s.MenuStatic,null,l.default.createElement("div",{className:o.default.editContainer},l.default.createElement("input",{type:"text",value:c,onChange:e=>{d(e.target.value)},onKeyDown:e=>{switch(e.key){case"Enter":_();break;case"Escape":m(!1);break;default:return}e.preventDefault(),e.stopPropagation()},autoFocus:!0,placeholder:"Feed name"}),l.default.createElement(i.Button,{className:o.default.doneBtn,type:i.ButtonType.PRIMARY,size:i.ButtonSize.NORMAL,onClick:_},l.default.createElement(r.Dashicon,{icon:"yes"})))))))}},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"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FeedNamePrompt=void 0;const o=a(n(0)),l=a(n(882)),i=a(n(148));t.FeedNamePrompt=function({isOpen:e,onAccept:t,onCancel:n}){const[a,r]=o.default.useState("");function s(){t&&t(a)}return o.default.createElement(i.default,{title:"Feed name",isOpen:e,onCancel:function(){n&&n()},onAccept:s,buttons:["Save","Cancel"]},o.default.createElement("p",{className:l.default.message},"Give this feed a memorable name:"),o.default.createElement("input",{type:"text",className:l.default.input,value:a,onChange:e=>{r(e.target.value)},onKeyDown:e=>{"Enter"===e.key&&(s(),e.preventDefault(),e.stopPropagation())},autoFocus:!0}))}},function(e,t,n){e.exports={message:"FeedNamePrompt__message",input:"FeedNamePrompt__input"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Screen=void 0,(t.Screen||(t.Screen={})).Sizes={WIDE:1200,LARGE:1180,MEDIUM:960,SMALL:782,NARROW:600,ALL:[1200,1180,960,782,600]}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(885)),i=a(n(163)),r=n(8),s=n(11);t.default=function({children:e,steps:t,current:n,onChangeStep:a,firstStep:u,lastStep:c}){var d;u=null!=u?u:[],c=null!=c?c:[];const f=null!==(d=t.findIndex(e=>e.key===n))&&void 0!==d?d:0,m=f<=0,p=f>=t.length-1,_=m?null:t[f-1],h=p?null:t[f+1],g=m?u:o.default.createElement(r.Button,{type:r.ButtonType.LINK,onClick:()=>!m&&a&&a(t[f-1].key),className:l.default.prevLink,disabled:_.disabled},o.default.createElement(s.Dashicon,{icon:"arrow-left-alt2"}),o.default.createElement("span",null,_.label)),b=p?c:o.default.createElement(r.Button,{type:r.ButtonType.LINK,onClick:()=>!p&&a&&a(t[f+1].key),className:l.default.nextLink,disabled:h.disabled},o.default.createElement("span",null,h.label),o.default.createElement(s.Dashicon,{icon:"arrow-right-alt2",style:{marginRight:0}}));return o.default.createElement(i.default,null,{path:[],left:g,right:b,center:e})}},function(e,t,n){e.exports={"arrow-link":"WizardNavbar__arrow-link",arrowLink:"WizardNavbar__arrow-link","prev-link":"WizardNavbar__prev-link WizardNavbar__arrow-link",prevLink:"WizardNavbar__prev-link WizardNavbar__arrow-link","next-link":"WizardNavbar__next-link WizardNavbar__arrow-link",nextLink:"WizardNavbar__next-link WizardNavbar__arrow-link"}},function(e,t,n){e.exports={root:"GenericNavbar__root",list:"GenericNavbar__list","left-list":"GenericNavbar__left-list GenericNavbar__list",leftList:"GenericNavbar__left-list GenericNavbar__list",item:"GenericNavbar__item","center-list":"GenericNavbar__center-list GenericNavbar__list",centerList:"GenericNavbar__center-list GenericNavbar__list","right-list":"GenericNavbar__right-list GenericNavbar__list",rightList:"GenericNavbar__right-list GenericNavbar__list","path-list":"GenericNavbar__path-list GenericNavbar__left-list GenericNavbar__list",pathList:"GenericNavbar__path-list GenericNavbar__left-list GenericNavbar__list","path-segment":"GenericNavbar__path-segment",pathSegment:"GenericNavbar__path-segment",separator:"GenericNavbar__separator GenericNavbar__item"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(888)),i=a(n(163)),r=n(8),s=n(11),u=n(137);function c({pages:e,current:t,onClickPage:n,children:a}){const[i,r]=o.default.useState(!1),s=()=>r(!0),c=()=>r(!1);return o.default.createElement(u.Menu,{isOpen:i,onBlur:c,placement:"bottom-start",refClassName:l.default.menuRef},({ref:e})=>o.default.createElement("a",{ref:e,className:l.default.menuLink,onClick:s},a),o.default.createElement(u.MenuContent,null,e.map(e=>{return o.default.createElement(u.MenuItem,{key:e.key,disabled:e.disabled,active:e.key===t,onClick:(a=e.key,()=>{n&&n(a),c()})},e.label);var a})))}t.default=function({pages:e,current:t,onChangePage:n,showNavArrows:a,hideMenuArrow:u,children:d}){var f,m;const{path:p,right:_}=d,h=null!==(f=e.findIndex(e=>e.key===t))&&void 0!==f?f:0,g=null!==(m=e[h].label)&&void 0!==m?m:"",b=h<=0,v=h>=e.length-1,y=b?null:e[h-1],E=v?null:e[h+1];let S=[];return a&&S.push(o.default.createElement(r.Button,{key:"page-menu-left",type:r.ButtonType.PILL,onClick:()=>!b&&n&&n(e[h-1].key),disabled:b||y.disabled},o.default.createElement(s.Dashicon,{icon:"arrow-left-alt2"}))),S.push(o.default.createElement(c,{key:"page-menu",pages:e,current:t,onClickPage:e=>n&&n(e)},o.default.createElement("span",null,g),!u&&o.default.createElement(s.Dashicon,{icon:"arrow-down-alt2",className:l.default.arrowDown}))),a&&S.push(o.default.createElement(r.Button,{key:"page-menu-left",type:r.ButtonType.PILL,onClick:()=>!v&&n&&n(e[h+1].key),disabled:v||E.disabled},o.default.createElement(s.Dashicon,{icon:"arrow-right-alt2"}))),o.default.createElement(i.default,{pathStyle:p.length>1?"line":"none"},{path:p,right:_,center:S})}},function(e,t,n){e.exports={"menu-link":"PageMenuNavbar__menu-link",menuLink:"PageMenuNavbar__menu-link","menu-ref":"PageMenuNavbar__menu-ref",menuRef:"PageMenuNavbar__menu-ref","arrow-down":"PageMenuNavbar__arrow-down",arrowDown:"PageMenuNavbar__arrow-down"}},function(e,t,n){e.exports={label:"TabNavbar__label",tab:"TabNavbar__tab",current:"TabNavbar__current TabNavbar__tab",disabled:"TabNavbar__disabled TabNavbar__tab"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WpMediaField=void 0;const o=a(n(0)),l=a(n(925)),i=n(308),r=n(8);t.WpMediaField=({id:e,title:t,mediaType:n,button:a,buttonSet:s,buttonChange:u,value:c,onChange:d})=>{s=void 0===a?s:a,u=void 0===a?u:a;const f=!!c,m=f?u:s,p=()=>{d&&d("")};return o.default.createElement(i.WpUploadMedia,{id:e,title:t,mediaType:n,button:m,value:c,onSelect:e=>{d&&d(e.attributes.url)}},({open:e})=>o.default.createElement("div",{className:l.default.wpMediaField},f&&o.default.createElement("div",{className:l.default.preview,tabIndex:0,onClick:e,role:"button"},o.default.createElement("img",{src:c,alt:"Custom profile picture"})),o.default.createElement(r.Button,{className:l.default.selectBtn,type:r.ButtonType.SECONDARY,onClick:e},m),f&&o.default.createElement(r.Button,{className:l.default.removeBtn,type:r.ButtonType.DANGER_LINK,onClick:p},"Remove custom photo")))}},function(e,t,n){e.exports={"wp-media-field":"WpMediaField__wp-media-field",wpMediaField:"WpMediaField__wp-media-field",preview:"WpMediaField__preview","select-btn":"WpMediaField__select-btn",selectBtn:"WpMediaField__select-btn","remove-btn":"WpMediaField__remove-btn",removeBtn:"WpMediaField__remove-btn"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EmbedSidebar=void 0;const r=l(n(0)),s=i(n(927)),u=n(12),c=n(1),d=n(63),f=i(n(42)),m=n(39),p=n(138),_=n(306),h=n(8),g=n(928),b=n(35),v=n(17),y=n(103),E=i(n(400)),S=n(21);function P({children:e}){const t=r.useRef(),[n,a]=r.useState(0),o=()=>t.current.slideTo((n+1)%e.length);return r.default.createElement("div",{className:s.default.imageSlider},r.default.createElement(E.default,{ref:t,activeIndex:n,onSlideChanged:e=>a(e.item),animationType:"slide",animationDuration:200,touchTracking:!0,preservePosition:!0,disableButtonsControls:!0,infinite:!0,items:e.map((e,t)=>r.default.createElement(w,{key:t,img:e.src,alt:e.label,onClick:o,annotation:t+1}))}))}function w({img:e,alt:t,annotation:n,onClick:a}){return r.default.createElement("figure",{className:s.default.example},r.default.createElement("figcaption",{className:s.default.caption}," ",t),r.default.createElement("img",{src:S.Common.image(e),alt:null!=t?t:"",style:{cursor:a?"pointer":"default"},onClick:a}),void 0!==n&&r.default.createElement("div",{className:s.default.exampleAnnotation},n))}t.EmbedSidebar=function(){const e=c.useSelector(d.selectQueryParam("id")),t=c.useSelector(y.selectFeedById(e)),n=c.useSelector(u.selectFeedName),a=c.useSelector(y.selectFeeds).length,o=b.useEditorSelector(e=>e.showProOptions),l=v.useFeedEditorContext().config.isPro,i=l||o,E=f.default.config.adminUrl+"/widgets.php",S=f.default.config.adminUrl+"/customize.php?autofocus%5Bpanel%5D=widgets";return e?r.default.createElement("div",{className:s.default.embedSidebar},t.usages.length>0&&r.default.createElement(p.Spoiler,{label:"Instances",defaultOpen:!0,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",{className:s.default.instances},r.default.createElement("p",null,"This feed is currently being shown in these pages:"),r.default.createElement("ul",null,t.usages.map((e,t)=>r.default.createElement("li",{key:t},r.default.createElement("a",{href:`${f.default.config.adminUrl}/post.php?action=edit&post=${e.id}`,target:"_blank"},e.name),r.default.createElement("span",null,"(",e.type,")")))))),r.default.createElement(p.Spoiler,{label:"Shortcode",defaultOpen:!0,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"Copy the shortcode below and paste it in any page or post to embed this feed:"),r.default.createElement("div",{className:s.default.shortcode},r.default.createElement("code",null,'[instagram feed="',e,'"]'),r.default.createElement(_.CopyShortcode,{feed:t},r.default.createElement(h.Button,{type:h.ButtonType.SECONDARY},"Copy"))))),f.default.config.hasElementor&&i&&r.default.createElement(p.Spoiler,{className:l?void 0:s.default.pro,label:l?"Elementor Widget":r.default.createElement(g.SpoilerProLabel,null,"Elementor widget"),defaultOpen:!0,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"To embed this feed in Elementor:"),r.default.createElement("ol",null,r.default.createElement("li",null,r.default.createElement("span",null,"Search for the ",r.default.createElement("b",null,"Spotlight Instagram feed")," widget",r.default.createElement(m.Message,{type:m.MessageType.INFO,showIcon:!0},"Choose the one with the Instagram logo. The other one is for the normal"," ","WordPress widget."))),r.default.createElement("li",null,"Add it to your post or page"),r.default.createElement("li",null,"Then choose ",r.default.createElement("strong",null,n)," from the list of feeds.")),r.default.createElement(P,null,[{src:"elementor-widget-search.png",label:"Choose the Spotlight widget"},{src:"elementor-widget-feed.png",label:"Choose the feed"}]))),r.default.createElement(p.Spoiler,{label:"WordPress Block",defaultOpen:!f.default.config.hasElementor,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"To embed this feed in the WordPress block editor:"),r.default.createElement("ol",null,r.default.createElement("li",null,"Search for the ",r.default.createElement("b",null,"Spotlight Instagram feed")," block"),r.default.createElement("li",null,"Add it to your post or page."),a>1?r.default.createElement("li",null,"Next, choose ",r.default.createElement("strong",null,n)," from the list of feeds."):r.default.createElement("li",null,"Since this is your only feed, Spotlight will automatically show this feed.")),a>1?r.default.createElement(P,null,[{src:"wp-block-search.png",label:"Search for the Spotlight block"},{src:"wp-block-select.png",label:"Choose the feed"},{src:"wp-block.png",label:"Done!"}]):r.default.createElement(P,null,[{src:"wp-block-search.png",label:"Search for the block"},{src:"wp-block.png",label:"Done!"}]))),r.default.createElement(p.Spoiler,{label:"WordPress Widget",defaultOpen:!1,fitted:!0,scrollOnOpen:!0},r.default.createElement("div",null,r.default.createElement("p",null,"To embed this feed as a WordPress widget:"),r.default.createElement("ol",null,r.default.createElement("li",null,"Go to the"," ",r.default.createElement("a",{href:E,target:"_blank"},"Appearance » Widgets")," ","page or the"," ",r.default.createElement("a",{href:S,target:"_blank"},"Widgets section of the Customizer")),r.default.createElement("li",null,"Then, add a ",r.default.createElement("strong",null,"Spotlight Instagram Feed")," widget"),r.default.createElement("li",null,"In the widget's settings, choose the ",r.default.createElement("strong",null,n)," as the feed"," ","to be shown.")),r.default.createElement(w,{img:"widget.png",alt:"Example of a widget"})))):r.default.createElement("div",{className:s.default.embedSidebar},r.default.createElement("div",{className:s.default.saveMessage},r.default.createElement(m.Message,{type:m.MessageType.INFO,showIcon:!0},"You're almost there... Click the ",r.default.createElement("strong",null,"Save")," button at the top-right to be"," ","able to embed this feed on your site!")))}},function(e,t,n){e.exports={"embed-sidebar":"EmbedSidebar__embed-sidebar",embedSidebar:"EmbedSidebar__embed-sidebar","save-message":"EmbedSidebar__save-message",saveMessage:"EmbedSidebar__save-message",shortcode:"EmbedSidebar__shortcode",example:"EmbedSidebar__example",caption:"EmbedSidebar__caption","example-annotation":"EmbedSidebar__example-annotation",exampleAnnotation:"EmbedSidebar__example-annotation",instances:"EmbedSidebar__instances",pro:"EmbedSidebar__pro"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpoilerProLabel=void 0;const o=a(n(0)),l=a(n(929)),i=n(76);t.SpoilerProLabel=function({children:e}){return o.default.createElement("div",null,o.default.createElement("div",{className:l.default.proPill},o.default.createElement(i.ProPill,null)),o.default.createElement("span",null,e))}},function(e,t,n){e.exports={"pro-pill":"SpoilerProLabel__pro-pill",proPill:"SpoilerProLabel__pro-pill"}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.EditFeedScreen=void 0;const i=l(n(0)),r=n(208),s=n(39),u=n(324),c=n(1),d=n(103),f=n(273),m=n(63);function p(){const e=c.useSelector(m.selectRoute);return i.default.createElement("div",null,i.default.createElement(s.Message,{type:s.MessageType.ERROR,showIcon:!0},"Feed does not exist.",i.default.createElement(r.Link,{to:e.withQuery({screen:"feeds"})},"Go back")))}t.EditFeedScreen=function(){const e=c.useDispatch(),t=c.useSelector(m.selectRoute).getParam("id"),n=t?parseInt(t):0,a=c.useSelector(d.selectFeedById(n)),o=c.useStore(),[l]=i.useState(()=>o.getState().app.isEditingNewFeed);return i.useEffect(()=>{e(f.setIsEditingNewFeed(!1))},[]),n?a?i.default.createElement(u.AdminEditor,{feed:a,keepState:l}):i.default.createElement(p,null):null}},function(e,t,n){e.exports={screen:"PromotionsScreen__screen",navbar:"PromotionsScreen__navbar","navbar-item":"PromotionsScreen__navbar-item",navbarItem:"PromotionsScreen__navbar-item","navbar-fake-pro-item":"PromotionsScreen__navbar-fake-pro-item PromotionsScreen__navbar-item",navbarFakeProItem:"PromotionsScreen__navbar-fake-pro-item PromotionsScreen__navbar-item","navbar-pro-pill":"PromotionsScreen__navbar-pro-pill",navbarProPill:"PromotionsScreen__navbar-pro-pill"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AutomatePromotionsTab=void 0;const r=l(n(0)),s=i(n(966)),u=n(41),c=n(967),d=n(970),f=n(8),m=n(972),p=n(973),_=n(95);function h({onCreate:e}){return r.default.createElement("div",{className:s.default.tutorial},r.default.createElement("div",{className:s.default.tutorialBox},r.default.createElement("div",{className:s.default.tutorialText},r.default.createElement("h1",null,"Automatically drive more conversions with Instagram"),r.default.createElement("p",null,"Link Instagram posts to your products, blog posts, landing pages, and more."),r.default.createElement("p",null,r.default.createElement("b",null,"Promotions help you drive traffic and increase conversions through social proof.")),r.default.createElement("p",null,"For example, create an ",r.default.createElement("b",null,"Instagram hashtag"),", let’s call it ",r.default.createElement("b",null,"#mymaxidress"),"."," "," Display photos from Instagram that use this hashtag and feature your dress,"," "," then have them ",r.default.createElement("b",null,"link directly to your product page"),", whether it’s on the"," "," same website or not."),r.default.createElement("p",null,"Every new Instagram photo that Spotlight finds with this hashtag will then",r.default.createElement("br",null),r.default.createElement("b",null,"automatically link to the product page"),"."),r.default.createElement("p",null,r.default.createElement("b",null,"Simple. Powerful. Effective."))),r.default.createElement(f.Button,{type:f.ButtonType.SECONDARY,size:f.ButtonSize.HERO,onClick:e},"Create your first automation")))}t.AutomatePromotionsTab=function({automations:e,isFakePro:t,onChange:n}){e=null!=e?e:[],n=null!=n?n:_.fn.noop;const[a,o]=r.default.useState(0),[l,i]=r.default.useState("content"),f=p.clampIndex(a,e),g=e.length>0,b=()=>i("sidebar"),v=r.useCallback(()=>e[f],[e,f]);function y(e){o(e)}const E=r.useCallback((e,t)=>{n(e),void 0!==t&&o(t)},[n]),S=r.useCallback(t=>{n(m.arrayWith(e,f,t))},[f,n]),P=r.useCallback(()=>{n(e.concat({type:"hashtag",config:{},promotion:{type:"",config:{}}})),o(0),b()},[e]);return r.default.createElement(u.SidebarLayout,{primary:"content",current:l,sidebar:g&&r.default.createElement(r.default.Fragment,null,r.default.createElement(d.AutoPromotionsSidebar,{automation:v(),onChange:S,isFakePro:t,onClose:()=>i("content")})),content:r.default.createElement("div",{className:s.default.content},!g&&r.default.createElement(h,{onCreate:P}),g&&r.default.createElement(c.AutoPromotionsList,{automations:e,selected:f,isFakePro:t,onChange:E,onSelect:y,onClick:function(e){y(e),b()}}))})}},function(e,t,n){e.exports={content:"AutomatePromotionsTab__content","content-heading":"AutomatePromotionsTab__content-heading",contentHeading:"AutomatePromotionsTab__content-heading",tutorial:"AutomatePromotionsTab__tutorial","tutorial-box":"AutomatePromotionsTab__tutorial-box",tutorialBox:"AutomatePromotionsTab__tutorial-box","tutorial-text":"AutomatePromotionsTab__tutorial-text",tutorialText:"AutomatePromotionsTab__tutorial-text","tutorial-video":"AutomatePromotionsTab__tutorial-video",tutorialVideo:"AutomatePromotionsTab__tutorial-video","mobile-instructions":"AutomatePromotionsTab__mobile-instructions",mobileInstructions:"AutomatePromotionsTab__mobile-instructions"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AutoPromotionsList=void 0;const r=l(n(0)),s=i(n(968)),u=n(74),c=n(108),d=n(422),f=n(8),m=n(11),p=n(969),_=i(n(42)),h=i(n(148)),g=n(156),b=n(41),v=n(95);function y({automation:e,selected:t,disabled:n,onClick:a,onDuplicate:o,onRemove:l}){const i=g.PromotionSystem.getAutomationConfig(e),u=g.PromotionSystem.getAutomationPromo(e),c=g.PromotionSystem.getPromoConfig(u),d=_.default.config.postTypes.find(e=>e.slug===c.linkType),h=n?null:a,b=n?null:p.stopPropagation(o),v=n?null:p.stopPropagation(l);return r.default.createElement("div",{className:t?s.default.rowSelected:s.default.row,onClick:h},r.default.createElement("div",{className:s.default.rowDragHandle},r.default.createElement(m.Dashicon,{icon:"menu"})),r.default.createElement("div",{className:s.default.rowBox},r.default.createElement("div",{className:s.default.rowHashtags},i.hashtags&&Array.isArray(i.hashtags)?i.hashtags.map(e=>"#"+e).join(", "):r.default.createElement("span",{className:s.default.noHashtagsMessage},"No hashtags")),r.default.createElement("div",{className:s.default.rowSummary},r.default.createElement(E,{promoConfig:c,postType:d})),r.default.createElement("div",{className:s.default.rowActions},r.default.createElement(f.Button,{type:f.ButtonType.PILL,size:f.ButtonSize.SMALL,onClick:b,tooltip:"Duplicate automation",disabled:n},r.default.createElement(m.Dashicon,{icon:"admin-page"})),r.default.createElement(f.Button,{type:f.ButtonType.DANGER_PILL,size:f.ButtonSize.SMALL,onClick:v,tooltip:"Remove automation",disabled:n},r.default.createElement(m.Dashicon,{icon:"trash"})))))}function E({promoConfig:e,postType:t}){return"url"===e.linkType?r.default.createElement("span",{className:s.default.summaryItalics},"Custom URL"):t?r.default.createElement("span",null,r.default.createElement("span",{className:s.default.summaryBold},e.postTitle)," ",r.default.createElement("span",{className:s.default.summaryItalics},"(",t.labels.singularName,")")):r.default.createElement("span",{className:s.default.noPromoMessage},"No promotion")}t.AutoPromotionsList=function({automations:e,selected:t,isFakePro:n,onChange:a,onSelect:o,onClick:l}){const i=r.useContext(b.SidebarLayout.Context);!n&&a||(a=v.fn.noop);const[m,p]=r.default.useState(null);function _(e){o&&o(e)}const E=r.useCallback(()=>{a(e.concat({type:"hashtag",config:{},promotion:{type:"",config:{}}}),e.length)},[e]),S=r.useCallback(t=>()=>{const n=e[t],o=u.cloneObj(n),l=e.slice();l.splice(t+1,0,o),a(l,t+1)},[e]);function P(){p(null)}const w=r.useCallback(t=>{const n=e.slice();n.splice(t,1),a(n,0),P()},[e]),O=r.useCallback(n=>{const o=e[t],l=n.map(e=>({type:e.type,config:g.PromotionSystem.getAutomationConfig(e),promotion:g.PromotionSystem.getAutomationPromo(e)})),i=l.findIndex(e=>e.promotion===o.promotion);a(l,i)},[e]);function C(e){return()=>{_(e),l&&l(e)}}const N=e.map(e=>Object.assign(Object.assign({},e),{id:c.uniqueNum()}));return r.default.createElement(r.default.Fragment,null,i&&r.default.createElement("div",{className:s.default.mobileInstructions},r.default.createElement("p",null,"Click or tap on an automation to change its settings")),r.default.createElement("div",{className:s.default.list},r.default.createElement("div",{className:s.default.addButtonRow},r.default.createElement(f.Button,{type:f.ButtonType.SECONDARY,size:f.ButtonSize.LARGE,onClick:E,disabled:n},"Add automation")),r.default.createElement(d.ReactSortable,{list:N,handle:"."+s.default.rowDragHandle,setList:O,onStart:function(e){_(e.oldIndex)},animation:200,delay:1e3,fallbackTolerance:5,delayOnTouchOnly:!0},e.map((e,a)=>r.default.createElement(y,{key:a,automation:e,selected:t===a,onClick:C(a),onDuplicate:S(a),onRemove:()=>function(e){p(e)}(a),disabled:n}))),r.default.createElement(h.default,{isOpen:null!==m,title:"Are you sure?",buttons:["Yes, remove it","No, keep it"],onAccept:()=>w(m),onCancel:P},r.default.createElement("p",null,"Are you sure you want to remove this automation? This ",r.default.createElement("strong",null,"cannot")," be undone!"))))}},function(e,t,n){e.exports={list:"AutoPromotionsList__list","fake-pro-list":"AutoPromotionsList__fake-pro-list AutoPromotionsList__list",fakeProList:"AutoPromotionsList__fake-pro-list AutoPromotionsList__list",row:"AutoPromotionsList__row","row-selected":"AutoPromotionsList__row-selected AutoPromotionsList__row",rowSelected:"AutoPromotionsList__row-selected AutoPromotionsList__row","row-box":"AutoPromotionsList__row-box theme__panel",rowBox:"AutoPromotionsList__row-box theme__panel","row-hashtags":"AutoPromotionsList__row-hashtags",rowHashtags:"AutoPromotionsList__row-hashtags","row-summary":"AutoPromotionsList__row-summary",rowSummary:"AutoPromotionsList__row-summary","row-drag-handle":"AutoPromotionsList__row-drag-handle",rowDragHandle:"AutoPromotionsList__row-drag-handle","row-actions":"AutoPromotionsList__row-actions",rowActions:"AutoPromotionsList__row-actions","add-button-row":"AutoPromotionsList__add-button-row",addButtonRow:"AutoPromotionsList__add-button-row","no-hashtags-message":"AutoPromotionsList__no-hashtags-message",noHashtagsMessage:"AutoPromotionsList__no-hashtags-message","row-faded-text":"AutoPromotionsList__row-faded-text",rowFadedText:"AutoPromotionsList__row-faded-text","no-promo-message":"AutoPromotionsList__no-promo-message AutoPromotionsList__row-faded-text",noPromoMessage:"AutoPromotionsList__no-promo-message AutoPromotionsList__row-faded-text","summary-italics":"AutoPromotionsList__summary-italics",summaryItalics:"AutoPromotionsList__summary-italics","summary-bold":"AutoPromotionsList__summary-bold",summaryBold:"AutoPromotionsList__summary-bold"}},,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AutoPromotionsSidebar=void 0;const r=l(n(0)),s=i(n(971)),u=n(162),c=n(121),d=n(198),f=n(14),m=n(95),p=n(156),_=n(41),h=n(392),g=n(25),b=n(142);let v;t.AutoPromotionsSidebar=function({automation:e,isFakePro:t,onChange:n,onClose:a}){var o;const l=r.useContext(_.SidebarLayout.Context);!t&&n||(n=m.fn.noop),void 0===v&&(v=c.PromotionTypeStore.getAll().filter(e=>"-more-"!==e.id).map(e=>({value:e.id,label:e.label})));const i=p.PromotionSystem.getAutomationConfig(e),y=p.PromotionSystem.getAutomationPromo(e),E=null!==(o=i.hashtags)&&void 0!==o?o:[];return r.default.createElement(r.default.Fragment,null,l&&r.default.createElement(_.SidebarLayout.Navigation,{icon:"arrow-left-alt",text:"Automations",onClick:a}),r.default.createElement(u.Sidebar,null,e&&r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:f.classList(u.Sidebar.padded,t?s.default.fakePro:null)},r.default.createElement(b.FieldRow,{label:"Promote posts with any of these hashtags",labelId:"sli-auto-promo-hashtags",wide:!0},r.default.createElement(d.MultiHashtagInput,{id:"sli-auto-promo-hashtags",value:E,onChange:function(t){n(g.withPartial(e,{config:{hashtags:t}}))},autoFocus:!t})),r.default.createElement("div",{className:s.default.promoFields},r.default.createElement(h.MediaPromotionFields,{promo:y,onChange:function(t){n(Object.assign(Object.assign({},e),{promotion:t}))}})))),!e&&r.default.createElement("div",{className:u.Sidebar.padded},r.default.createElement("p",null,"Automatically link Instagram posts from any source that contain specific hashtags to"," ","posts, pages, products, custom links, and more. ",r.default.createElement("a",{href:"#"},"Learn more")),r.default.createElement("p",null,"To get started, create an automation or select an existing one."))))}},function(e,t,n){e.exports={"fake-pro":"AutoPromotionsSidebar__fake-pro",fakePro:"AutoPromotionsSidebar__fake-pro","promo-fields":"AutoPromotionsSidebar__promo-fields",promoFields:"AutoPromotionsSidebar__promo-fields"}},,,function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalPromotionsTab=void 0;const r=l(n(0)),s=n(1),u=i(n(975)),c=n(41),d=n(976),f=i(n(235)),m=n(977),p=n(31),_=n(69),h=n(56);t.GlobalPromotionsTab=function({isFakePro:e}){const t=s.useSelector(p.selectAccounts),[n,a]=r.useState(!1);_.useDocumentEventListener(h.RestApi.media.events.fetch.start,()=>a(!0)),_.useDocumentEventListener(h.RestApi.media.events.fetch.end,()=>a(!1));const[o,l]=r.useState("content"),[i,g]=r.default.useState(()=>(e=>e.length>0?e[0].id:null)(t)),b=r.useCallback(()=>l("content"),[l]),v=r.useCallback(()=>l("sidebar"),[l]);return r.default.createElement(r.default.Fragment,null,0===t.length&&r.default.createElement("div",{className:u.default.tutorial},r.default.createElement("div",{className:u.default.tutorialBox},r.default.createElement("div",{className:u.default.tutorialText},r.default.createElement("h1",null,"Set up global promotions across all feeds"),r.default.createElement("p",null,"Link Instagram posts to your products, blog posts, landing pages, and more."),r.default.createElement("p",null,r.default.createElement("b",null,"Promotions help you drive traffic and increase conversions through social proof.")),r.default.createElement("p",null,"Set up global promotions for each account that will apply across all feeds."," ","You may then choose to enable or disable promotions on a per-feed basis."),r.default.createElement("p",null,"Connect your first Instagram account to set up global promotions."),r.default.createElement("p",null,r.default.createElement("b",null,"Simple. Powerful. Effective."))),r.default.createElement(f.default,null,"Connect your Instagram account"))),t.length>0&&r.default.createElement(c.SidebarLayout,{primary:"content",current:o,sidebar:r.default.createElement(d.GlobalPromotionsSidebar,{disabled:n||e,account:i,onChangeAccount:g,onClose:b}),content:r.default.createElement(m.GlobalPromotionsContent,{disabled:n||e,account:i,onOpenSidebar:v})}))}},function(e,t,n){e.exports={tutorial:"GlobalPromotionsTab__tutorial","tutorial-box":"GlobalPromotionsTab__tutorial-box",tutorialBox:"GlobalPromotionsTab__tutorial-box","tutorial-text":"GlobalPromotionsTab__tutorial-text",tutorialText:"GlobalPromotionsTab__tutorial-text"}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalPromotionsSidebar=void 0;const i=l(n(0)),r=n(1),s=n(162),u=n(41),c=n(237),d=n(138),f=n(31);t.GlobalPromotionsSidebar=function({account:e,onChangeAccount:t,disabled:n,onClose:a}){const o=r.useSelector(f.selectAccounts),l=i.useContext(u.SidebarLayout.Context);return i.default.createElement(i.default.Fragment,null,l&&i.default.createElement(i.default.Fragment,null,i.default.createElement(u.SidebarLayout.Navigation,{icon:"arrow-left-alt",text:"Back",onClick:a})),i.default.createElement(s.Sidebar,{disabled:n},i.default.createElement("div",{className:s.Sidebar.padded},i.default.createElement("p",null,"Promote your blog posts, landing pages, products, and much more through your Instagram feed."),i.default.createElement("p",{style:{fontWeight:"bold"}},"How it works:"),i.default.createElement("ol",{style:{marginTop:0}},i.default.createElement("li",null,"Pick an account."),l?i.default.createElement(i.default.Fragment,null,i.default.createElement("li",null,"Go back to the previous page."),i.default.createElement("li",null,"Select a post from the grid.")):i.default.createElement("li",null,"Select a post from the preview on the left."),i.default.createElement("li",null,"Choose what the post should link to."))),i.default.createElement(d.Spoiler,{label:"Pick an account",showIcon:!1,isOpen:!0,fitted:!0},i.default.createElement(c.AccountSelector,{accounts:o,value:[e],onChange:e=>t(e[0]),singleMode:!0}))))}},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalPromotionsContent=void 0;const r=l(n(0)),s=i(n(978)),u=n(1),c=n(41),d=n(391),f=n(230),m=n(33),p=n(47),_=n(8),h=n(11),g=n(31);t.GlobalPromotionsContent=function({account:e,disabled:t,onOpenSidebar:n}){const a=u.useDispatch(),o=u.useSelector(g.selectHasAccounts),l=u.useSelector(m.selectSetting("promotions")),i=r.useContext(c.SidebarLayout.Context),b=r.default.useCallback(e=>{t||a(p.updateSettings({promotions:e}))},[a,t]),v=f.createFeedOptions({accounts:[e],promotions:t?{}:l,globalPromotionsEnabled:!1});return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:s.default.content},i&&r.default.createElement("div",{className:s.default.heading},r.default.createElement("p",{className:s.default.mobileInstructions},"Click or tap a post to set up a promotion for it."),o&&r.default.createElement("div",{className:s.default.changeAccountButton},r.default.createElement(_.Button,{type:_.ButtonType.SECONDARY,size:_.ButtonSize.SMALL,onClick:n},r.default.createElement(h.Dashicon,{icon:"admin-users"})," Change account"))),r.default.createElement(d.PromotionsGrid,{feedOptions:v,onChange:b})))}},function(e,t,n){e.exports={content:"GlobalPromotionsContent__content",heading:"GlobalPromotionsContent__heading","mobile-instructions":"GlobalPromotionsContent__mobile-instructions",mobileInstructions:"GlobalPromotionsContent__mobile-instructions"}},function(e,t,n){},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsNavbar=void 0;const o=a(n(981)),l=a(n(0)),i=a(n(314)),r=n(8),s=n(315),u=n(197),c=n(275),d=n(1),f=n(33),m=n(47),p=n(126),_=n(21),h=n(63);function g({}){const e=d.useDispatch(),t=d.useSelector(f.selectSettingsAreDirty),n=d.useSelector(f.selectSettingsAreSaving);return l.default.createElement("div",{className:o.default.buttons},l.default.createElement(r.Button,{className:o.default.cancelBtn,type:r.ButtonType.DANGER_PILL,size:r.ButtonSize.LARGE,onClick:()=>e(m.restoreSettings()),disabled:!t},"Cancel"),l.default.createElement(u.SaveButton,{className:o.default.saveBtn,onClick:()=>e(p.saveSettings()),isSaving:n,tooltip:"Save the settings (Ctrl+S)",disabled:!t}))}t.SettingsNavbar=function(){const e=d.useSelector(h.selectQueryParam("tab")),t=_.Common.isPro?c.AdminSettings:c.AdminSettings.filter(e=>!e.isPro);return l.default.createElement(i.default,{chevron:!0,right:g},t.map((t,n)=>l.default.createElement(s.Navbar.Link,{key:t.id,linkTo:{tab:t.id},isCurrent:e===t.id||!e&&0===n},t.title)))}},function(e,t,n){e.exports={buttons:"SettingsNavbar__buttons layout__flex-row","cancel-btn":"SettingsNavbar__cancel-btn",cancelBtn:"SettingsNavbar__cancel-btn"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=a(n(0)),l=a(n(983)),i=a(n(235)),r=a(n(984)),s=n(39),u=n(986),c=n(1),d=n(31),f=n(397);t.default=function(){const e=c.useSelector(d.selectAccounts),t=f.useForceUpdate(),[n,a]=o.default.useState("");return 0===e.length?o.default.createElement(u.AccountsOnboarding,null):o.default.createElement("div",{className:l.default.root},n.length>0&&o.default.createElement(s.Message,{type:s.MessageType.ERROR,showIcon:!0,isDismissible:!0,onDismiss:()=>a("")},n),o.default.createElement("div",{className:l.default.connectBtn},o.default.createElement(i.default,{onConnect:t})),o.default.createElement(r.default,{accounts:e,showDelete:!0,onDeleteError:a}))}},function(e,t,n){e.exports={"connect-btn":"AccountsPage__connect-btn",connectBtn:"AccountsPage__connect-btn"}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(985)),r=n(29),s=n(8),u=o(n(303)),c=n(172),d=o(n(221)),f=o(n(219)),m=o(n(148)),p=n(137),_=n(305),h=n(1),g=n(103),b=n(175),v=n(92),y=n(62),E=n(11);t.default=function({accounts:e,showDelete:t,onDeleteError:n}){const o=h.useStore(),S=h.useDispatch(),P=h.useSelector(g.selectFeeds),w=(e=null!=e?e:[]).filter(e=>e.type===r.Account.Type.BUSINESS).length,[O,C]=l.default.useState(!1),[N,M]=l.default.useState(null),[k,A]=l.default.useState(!1),[T,F]=l.default.useState(),[j,L]=l.default.useState(!1),x=e=>()=>{M(e.id),C(!0)},D=e=>()=>{c.AccountManager.openAuthWindow(o,e.type,0,()=>{y.AdminRestApi.media.deleteForAccount(e.id)})},I=e=>()=>{F(e),A(!0)},R=()=>{L(!1),F(null),A(!1)},B={cols:{username:i.default.usernameCol,type:i.default.typeCol,usages:i.default.usagesCol,actions:i.default.actionsCol},cells:{username:i.default.usernameCell,type:i.default.typeCell,usages:i.default.usagesCell,actions:i.default.actionsCell}};return l.default.createElement("div",{className:"accounts-list"},l.default.createElement(u.default,{styleMap:B,rows:e,cols:[{id:"username",label:"Username",render:e=>l.default.createElement("div",null,l.default.createElement(f.default,{account:e,className:i.default.profilePic}),l.default.createElement("a",{className:i.default.username,onClick:x(e)},e.username))},{id:"type",label:"Type",render:e=>l.default.createElement("span",{className:i.default.accountType},e.type)},{id:"usages",label:"Feeds",render:e=>l.default.createElement("span",{className:i.default.usages},e.usages.map((e,t)=>{const n=P[e];return!!n&&l.default.createElement(b.Link,{key:t,to:{screen:"edit",id:e.toString()}},n.name)}))},{id:"actions",label:"Actions",render:e=>t&&l.default.createElement(p.StatefulMenu,null,({ref:e,openMenu:t})=>l.default.createElement(s.Button,{ref:e,className:i.default.actionsBtn,type:s.ButtonType.PILL,size:s.ButtonSize.NORMAL,onClick:t},l.default.createElement(_.Ellipsis,null)),l.default.createElement(p.MenuContent,null,l.default.createElement(p.MenuItem,{onClick:x(e)},l.default.createElement(E.Dashicon,{icon:"info"}),"Info"),l.default.createElement(p.MenuItem,{onClick:D(e)},l.default.createElement(E.Dashicon,{icon:"image-rotate"}),"Reconnect"),l.default.createElement(p.MenuSeparator,null),l.default.createElement(p.MenuItem,{onClick:I(e),danger:!0},l.default.createElement(E.Dashicon,{icon:"trash"}),"Delete")))}]}),l.default.createElement(d.default,{isOpen:O,onClose:()=>C(!1),accountId:N}),l.default.createElement(m.default,{isOpen:k,title:"Are you sure?",buttons:[j?"Please wait ...":"Yes I'm sure","Cancel"],okDisabled:j,cancelDisabled:j,onAccept:()=>a(this,void 0,void 0,(function*(){L(!0);try{yield S(v.deleteAccount(T.id))}catch(e){n&&n("An error occurred while trying to remove the account.")}finally{R()}})),onCancel:R},l.default.createElement("p",null,"Are you sure you want to delete"," ",l.default.createElement("span",{style:{fontWeight:"bold"}},T?T.username:""),"?"," ","This will also delete all saved media associated with this account."),T&&T.type===r.Account.Type.BUSINESS&&1===w&&l.default.createElement("p",null,l.default.createElement("b",null,"Note:")," ",l.default.createElement("span",null,"Because this is your only connected Business account, deleting it will"," ","also cause any feeds that show public hashtag posts to no longer work."))))}},function(e,t,n){e.exports={"username-col":"AccountsList__username-col",usernameCol:"AccountsList__username-col","actions-col":"AccountsList__actions-col",actionsCol:"AccountsList__actions-col","username-cell":"AccountsList__username-cell",usernameCell:"AccountsList__username-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-btn":"AccountsList__actions-btn",actionsBtn:"AccountsList__actions-btn","usages-cell":"AccountsList__usages-cell",usagesCell:"AccountsList__usages-cell","usages-col":"AccountsList__usages-col",usagesCol:"AccountsList__usages-col","type-cell":"AccountsList__type-cell",typeCell:"AccountsList__type-cell","type-col":"AccountsList__type-col",typeCol:"AccountsList__type-col"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccountsOnboarding=void 0;const o=a(n(0)),l=a(n(987)),i=a(n(236)),r=n(225),s=n(45);t.AccountsOnboarding=function({onConnect:e,beforeConnect:t,isTransitioning:n}){return o.default.createElement(r.Onboarding,{className:l.default.root,isTransitioning:n},o.default.createElement("div",{className:l.default.left},o.default.createElement("h1",null,"Connect your Instagram account"),o.default.createElement("p",null,"You can connect the following types of accounts in Spotlight:"),o.default.createElement("ul",{className:l.default.list},o.default.createElement("li",null,o.default.createElement("a",{href:s.AdminResources.connectPersonalAccount,target:"_blank"},"Personal account")),o.default.createElement("li",null,o.default.createElement("a",{href:s.AdminResources.connectBusinessAccount,target:"_blank"},"Business account")),o.default.createElement("li",null,"Your client's account (",o.default.createElement("a",{href:s.AdminResources.connectAccessToken,target:"_blank"},"using an access token"),")")),o.default.createElement("p",null,o.default.createElement("a",{href:s.AdminResources.personalVsBusinessAccount,target:"_blank"},"What's the difference between a Personal account and a Business account?"))),o.default.createElement("div",null,o.default.createElement(i.default,{beforeConnect:e=>t&&t(e),onConnect:t=>e&&e(t),useColumns:!0,showPrompt:!1})))}},function(e,t,n){e.exports={root:"AccountsOnboarding__root",left:"AccountsOnboarding__left",list:"AccountsOnboarding__list","learn-more-business":"AccountsOnboarding__learn-more-business",learnMoreBusiness:"AccountsOnboarding__learn-more-business","first-msg":"AccountsOnboarding__first-msg",firstMsg:"AccountsOnboarding__first-msg",spacer:"AccountsOnboarding__spacer"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsConfigTab=void 0;const o=a(n(0)),l=n(266),i=n(989),r=n(991),s=n(997);t.SettingsConfigTab=function(){return o.default.createElement(l.SettingsPage,null,o.default.createElement(i.SettingsImportingGroup,null),o.default.createElement(r.SettingsOptimizationGroup,null),o.default.createElement(s.SettingsTweaksGroup,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsImportingGroup=void 0;const o=a(n(0)),l=n(147),i=n(990);t.SettingsImportingGroup=function(){return o.default.createElement(l.SettingsGroup,{title:"Import options"},o.default.createElement(i.ImportIntervalField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ImportIntervalField=void 0;const o=a(n(0)),l=n(88),i=a(n(42)),r=n(40),s=n(1),u=n(33),c=n(47);t.ImportIntervalField=function(){const e=s.useDispatch(),t=s.useSelector(u.selectSetting("importerInterval"));return o.default.createElement(l.SettingsField,{id:"settings-import-interval",label:"Check for new posts"},o.default.createElement(r.Select,{id:"settings-import-interval",width:250,value:t,onChange:t=>e(c.updateSettings({importerInterval:t.value})),options:i.default.config.cronScheduleOptions}))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsOptimizationGroup=void 0;const o=a(n(0)),l=n(138),i=n(147),r=n(992),s=n(995),u=n(996),c=o.default.createElement("div",null,o.default.createElement(l.Spoiler,{label:"What is this?",stealth:!0},o.default.createElement("div",null,o.default.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."),o.default.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.")))),d=o.default.createElement("div",null,o.default.createElement(u.CleanUpMediaButton,null));t.SettingsOptimizationGroup=function({}){return o.default.createElement(i.SettingsGroup,{title:"Optimization",before:c,after:d},o.default.createElement(r.OptimizeAgeLimitField,null),o.default.createElement(s.OptimizeIntervalField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OptimizeAgeLimitField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=a(n(993)),s=n(33),u=n(47);t.OptimizeAgeLimitField=function({}){var e,t,n;const a=l.useDispatch(),c=(null!==(e=l.useSelector(s.selectSetting("cleanerAgeLimit")))&&void 0!==e?e:"").split(" "),d=null!==(t=parseInt(c[0]))&&void 0!==t?t:0,f=null!==(n=c[1])&&void 0!==n?n:"days";return o.default.createElement(i.SettingsField,{id:"cleanerAgeLimit",label:"Delete unseen posts after"},o.default.createElement(r.default,{id:"cleanerAgeLimit",type:"number",value:d,unit:f,onChange:(e,t)=>a(u.updateSettings({cleanerAgeLimit:`${e} ${t}`})),min:1,units:{days:["day","days"],hours:["hour","hours"],minutes:["minute","minutes"]}}))}},function(e,t,n){"use strict";var a=this&&this.__rest||function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(994)),r=n(137),s=n(11),u=n(43);function c(e,t){return 1===parseInt(e.toString())?t[0]:t[1]}t.default=function(e){var{type:t,unit:n,units:o,value:d,min:f,onChange:m}=e,p=a(e,["type","unit","units","value","min","onChange"]);const[_,h]=l.default.useState(!1),g="object"==typeof o&&!u.Dictionary.isEmpty(o),b=()=>h(e=>!e),v=e=>{switch(e.key){case" ":case"Enter":b();break;default:return}e.preventDefault(),e.stopPropagation()};return(null==d||isNaN(d))&&(d=""),l.default.createElement("div",{className:i.default.root},l.default.createElement("input",Object.assign({},p,{className:i.default.input,type:null!=t?t:"text",value:d,min:f,onChange:e=>m&&m(e.currentTarget.value,n)})),l.default.createElement("div",{className:i.default.unitContainer},g&&l.default.createElement(r.Menu,{isOpen:_,onBlur:()=>h(!1)},({ref:e})=>l.default.createElement("div",{ref:e,className:i.default.unitSelector,role:"button",onClick:b,onKeyDown:v,tabIndex:0},l.default.createElement("span",{className:i.default.currentUnit},c(d,u.Dictionary.get(o,n))),l.default.createElement(s.Dashicon,{icon:"arrow-down-alt2",className:_?i.default.menuChevronOpen:i.default.menuChevron})),u.Dictionary.keys(o).map(e=>{const t=u.Dictionary.get(o,e),n=c(d,t);return l.default.createElement(r.MenuItem,{key:n,onClick:()=>(m&&m(d,e),void h(!1))},n)})),!g&&l.default.createElement("div",{className:i.default.unitStatic},l.default.createElement("span",null,n))))}},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"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.OptimizeIntervalField=void 0;const o=a(n(0)),l=n(1),i=n(88),r=a(n(42)),s=n(40),u=n(33),c=n(47);t.OptimizeIntervalField=function({}){const e=l.useDispatch(),t=l.useSelector(u.selectSetting("cleanerInterval"));return o.default.createElement(i.SettingsField,{id:"cleanerInterval",label:"Run optimization"},o.default.createElement(s.Select,{id:"cleanerInterval",width:250,value:t,options:r.default.config.cronScheduleOptions,onChange:t=>e(c.updateSettings({cleanerInterval:t.value}))}))}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CleanUpMediaButton=void 0;const l=o(n(0)),i=n(8),r=n(1),s=n(75),u=n(33),c=n(62);t.CleanUpMediaButton=function(){const e=r.useDispatch(),t=r.useSelector(u.selectSetting("cleanerAgeLimit"));return l.default.createElement(i.Button,{type:i.ButtonType.SECONDARY,size:i.ButtonSize.NORMAL,onClick:()=>a(this,void 0,void 0,(function*(){var n;e(s.showToast({key:"admin/clean_up_media/wait",message:"Optimizing, please wait ...",type:s.ToastType.STICKY}));try{const a=null!==(n=(yield c.AdminRestApi.media.cleanUp(t)).data.numCleaned)&&void 0!==n?n:0;e(s.showToast({key:"admin/clean_up_media/done",message:`Done! ${a} old posts have been removed.`}))}finally{e(s.removeToast("admin/clean_up_media/wait"))}}))},"Optimize now")}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsTweaksGroup=void 0;const o=a(n(0)),l=n(138),i=n(147),r=n(998),s=o.default.createElement("div",null,o.default.createElement(l.Spoiler,{label:"What is this?",stealth:!0},o.default.createElement("div",null,o.default.createElement("p",null,"With this option enabled, Spotlight will pre-load the first set of posts into the page. This"," ","makes the feed load faster, but can make the page slightly slower."),o.default.createElement("p",null,"By default, this option is disabled. The feed will show grey loading boxes while the posts are"," ","being loaded in the background. This makes the feed slower, but won't impact the rest of the page."),o.default.createElement("p",null,"We recommend turning this option on when your feed is immediately visible when the page loads."," ","If your feed is further down the page, it will probably have enough time to load before your"," ","visitors can see it, so you can leave this turned off for faster page loading."))));t.SettingsTweaksGroup=function(){return o.default.createElement(i.SettingsGroup,{title:"Performance Tweaks",before:s},o.default.createElement(r.PreloadPostsField,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PreloadPostsField=void 0;const o=a(n(0)),l=n(88),i=n(1),r=n(33),s=n(47);t.PreloadPostsField=function(){const e=i.useDispatch(),t=i.useSelector(r.selectSetting("preloadMedia"));return o.default.createElement(l.SettingsField,{id:"preloadMedia"},o.default.createElement("label",{htmlFor:"preloadMedia"},o.default.createElement("span",{style:{marginRight:10}},"Pre-load the first page of posts"),o.default.createElement("input",{id:"preloadMedia",type:"checkbox",checked:t,onChange:t=>e(s.updateSettings({preloadMedia:t.target.checked}))})))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsToolsTab=void 0;const o=a(n(0)),l=n(266),i=n(1e3);t.SettingsToolsTab=function(){return o.default.createElement(l.SettingsPage,null,o.default.createElement(i.SettingsCacheGroup,null))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SettingsCacheGroup=void 0;const o=a(n(0)),l=n(88),i=a(n(1001)),r=n(147);t.SettingsCacheGroup=function(){return o.default.createElement(r.SettingsGroup,{title:"Cache"},o.default.createElement(l.SettingsField,{id:"clearCache",label:"If you are experiencing issues, clearing the plugin's cache may help."},o.default.createElement(i.default,null)))}},function(e,t,n){"use strict";var a=this&&this.__awaiter||function(e,t,n,a){return new(n||(n=Promise))((function(o,l){function i(e){try{s(a.next(e))}catch(e){l(e)}}function r(e){try{s(a.throw(e))}catch(e){l(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,r)}s((a=a.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=o(n(0)),i=o(n(1002)),r=n(8),s=n(407),u=n(1),c=n(75),d=n(20),f=n(62),m=n(45),p=n(139);t.default=function({}){const e=u.useDispatch(),[t,n]=l.default.useState(!1);s.useSafeEffect(e=>{e&&t&&o().then(()=>{e&&n(!1)})},[t]);const o=()=>a(this,void 0,void 0,(function*(){e(c.removeToast("admin/clear_cache/done")),e(c.showToast({key:"admin/clear_cache/please_wait",message:"Clearing the cache ...",type:c.ToastType.STICKY}));try{yield f.AdminRestApi.cache.clearAll(),e(c.showToast({key:"admin/clear_cache/done",message:"Cleared cache successfully!"}))}catch(e){p.triggerError({type:"clear_cache/error",message:d.getErrorResponseMessage(e)})}finally{e(c.removeToast("admin/clear_cache/please_wait"))}}));return l.default.createElement("div",{className:i.default.root},l.default.createElement(r.Button,{disabled:t,onClick:()=>{n(!0)}},"Clear the cache"),l.default.createElement("a",{href:m.AdminResources.cacheDocsUrl,target:"_blank",className:i.default.docLink},"What's this?"))}},function(e,t,n){e.exports={root:"ClearCacheButton__root layout__flex-row","doc-link":"ClearCacheButton__doc-link",docLink:"ClearCacheButton__doc-link"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";(function(e){var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AdminRootInner=t.AdminRoot=void 0;const i=n(289),r=l(n(0)),s=n(208),u=n(1005),c=n(84),d=n(410),f=n(1008),m=n(1009),p=n(1014),_=n(1019),h=n(9),g=n(1),b=n(408),v=n(1021),y=n(75),E=n(52),S=n(63),P=n(56),w=n(139),O=document.title.replace("Spotlight","%s ‹ Spotlight");function C(){const e=g.useDispatch(),t=g.useSelector(v.selectIsAdminAppLoaded),n=g.useSelector(v.selectIsAdminAppLoading),a=g.useSelector(S.selectScreen);r.useEffect(()=>{const e=c.Screens.getScreen(a);e&&(document.title=O.replace("%s",e.title))},[a]);const o=e=>{var t,n;const a=null!==(n=null!==(t=e.detail.message)&&void 0!==t?t:e.detail.response.data.message)&&void 0!==n?n:null;w.triggerError({type:"feed/fetch_media/error",message:a})},l=()=>{e(y.showToast({key:"admin/feed/import/pending",type:y.ToastType.STICKY,message:"Retrieving posts from Instagram. This may take around 30 seconds."}))},i=t=>{var n;(null===(n=null==t?void 0:t.detail)||void 0===n?void 0:n.batching)&&e(y.showToast({key:"admin/feed/import/done",type:y.ToastType.NOTIFICATION,message:"Imported the first set of posts from Instagram. Older posts are being imported in the background."}))},b=e=>{w.triggerError({type:"feed/import_media/error",message:e.message})},C=()=>{e(y.removeToast("admin/feed/import/pending"))};return r.useEffect(()=>(document.addEventListener(h.FetchFailEvent.Type,o),document.addEventListener(P.RestApi.media.events.import.start,l),document.addEventListener(P.RestApi.media.events.import.success,i),document.addEventListener(P.RestApi.media.events.import.fail,b),document.addEventListener(P.RestApi.media.events.import.end,C),()=>{document.removeEventListener(h.FetchFailEvent.Type,o),document.removeEventListener(P.RestApi.media.events.import.start,l),document.removeEventListener(P.RestApi.media.events.import.success,i),document.removeEventListener(P.RestApi.media.events.import.fail,b),document.removeEventListener(P.RestApi.media.events.import.end,C)}),[]),n||!t?r.default.createElement(r.default.Fragment,null,r.default.createElement(d.AdminLoading,null),r.default.createElement(p.Toaster,null)):r.default.createElement(s.Router,{history:E.RouterHistory},c.Screens.getList().map((e,t)=>r.default.createElement(u.QueryRoute,{key:e.id,when:"screen",is:e.id,isRoot:0===t,render:()=>r.default.createElement(e.component)})),r.default.createElement(m.NewsBeacon,null),r.default.createElement(_.ModalLayer,null),r.default.createElement(f.ConnectAccountListener,null),r.default.createElement(p.Toaster,null))}t.AdminRoot=i.hot(e)((function(){return r.default.createElement(g.Provider,{store:b.AdminAppStore},r.default.createElement(C,null))})),t.AdminRootInner=C}).call(this,n(78)(e))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueryRoute=void 0;const a=n(1006);t.QueryRoute=function({when:e,is:t,isRoot:n,render:o}){const l=a.useUrlParams().get(e);return l===t||!t&&!l||n&&!l?o():null}},,function(e,t,n){},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectAccountListener=void 0;const o=a(n(0)),l=n(29),i=a(n(148)),r=a(n(221)),s=n(172),u=n(69),c=n(45);t.ConnectAccountListener=function(){const[e,t]=o.default.useState(null),[n,a]=o.default.useState(!1),[d,f]=o.default.useState(!1),m=()=>{s.AccountManager.State.connectedId=null};return u.useDocumentEventListener(s.AccountManager.ACCOUNT_CONNECTED_EVENT,e=>{const o=e.detail.account;n||d||o.type!==l.Account.Type.PERSONAL||o.customBio.length||o.customProfilePicUrl.length||(t(o.id),a(!0))}),o.default.createElement(o.default.Fragment,null,o.default.createElement(i.default,{title:"You've successfully connected your account!",buttons:["Yes","No, maybe later"],isOpen:n,onAccept:()=>{a(!1),f(!0)},onCancel:()=>{a(!1),m()}},o.default.createElement("p",null,"One more thing ..."),o.default.createElement("p",null,"Instagram doesn't provide the profile photo and bio text for Personal accounts."," ","Would you like to set a custom photo and a custom bio in Spotlight to match your Instagram profile?"),o.default.createElement("p",null,o.default.createElement("a",{href:c.AdminResources.customPersonalInfoUrl,target:"_blank"},"What's this about?"))),o.default.createElement(r.default,{isOpen:d,onClose:()=>{f(!1),m()},accountId:e}))}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NewsBeacon=void 0;const o=a(n(0)),l=a(n(1010)),i=n(1),r=n(11),s=n(178),u=n(137),c=n(1011),d=n(409),f=n(1012);t.NewsBeacon=function(){const e=i.useDispatch(),t=i.useSelector(c.selectNewsMessages),n=i.useSelector(c.selectIsNewsHidden),a=i.useSelector(c.selectIsNewsOpen),m=()=>e(d.openNews()),p=s.useKeyboardActivate(m);return!n&&t.length>0&&o.default.createElement(u.Menu,{className:l.default.menu,isOpen:a,onBlur:()=>e(d.closeNews()),placement:"top-end"},({ref:e})=>o.default.createElement("div",{ref:e,className:l.default.beacon},o.default.createElement("button",{className:l.default.button,onClick:m,onKeyPress:p},o.default.createElement(r.Dashicon,{icon:"megaphone"}),t.length>0&&o.default.createElement("div",{className:l.default.counter},t.length))),o.default.createElement(u.MenuContent,null,t.map(e=>o.default.createElement(f.NewsBeaconMessage,{key:e.id,message:e})),a&&o.default.createElement("a",{className:l.default.hideLink,onClick:()=>e(d.hideNews())},"Hide")))}},function(e,t,n){e.exports={beacon:"NewsBeacon__beacon",button:"NewsBeacon__button","button-animation":"NewsBeacon__button-animation",buttonAnimation:"NewsBeacon__button-animation",counter:"NewsBeacon__counter","hide-link":"NewsBeacon__hide-link",hideLink:"NewsBeacon__hide-link",menu:"NewsBeacon__menu"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectIsNewsHidden=t.selectIsNewsOpen=t.selectNewsMessages=void 0,t.selectNewsMessages=e=>e.news.messages,t.selectIsNewsOpen=e=>e.news.isOpen,t.selectIsNewsHidden=e=>e.news.isHidden},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.NewsBeaconMessage=void 0;const r=l(n(0)),s=i(n(1013)),u=i(n(216)),c=i(n(421)),d=n(104),f=n(1),m=n(63),p=n(52);t.NewsBeaconMessage=function({message:e}){const t=f.useDispatch(),n=f.useSelector(m.selectRoute),a=r.default.useRef();return r.useEffect(()=>{if(!a.current)return;const e=a.current.getElementsByTagName("a");for(let a=0;a<e.length;++a){const o=e.item(a);if("true"===o.getAttribute("data-sli-link"))continue;const l=o.getAttribute("href");if("string"!=typeof l||!l.startsWith("app://"))continue;const i=d.parse(l.substr("app://".length)),r=(n.setQuery(i),n.getAbsUrl(i));o.setAttribute("href",r),o.setAttribute("data-sli-link","true"),o.addEventListener("click",e=>{t(p.gotoRoute(i)),e.preventDefault(),e.stopPropagation()})}},[a.current]),r.default.createElement("article",{className:s.default.root},e.title&&e.title.length&&r.default.createElement("header",{className:s.default.title},e.title),r.default.createElement("main",{ref:a,className:s.default.content,dangerouslySetInnerHTML:{__html:e.content}}),e.date&&r.default.createElement("footer",{className:s.default.date},c.default(u.default(e.date),{addSuffix:!0})))}},function(e,t,n){e.exports={root:"NewsBeaconMessage__root",text:"NewsBeaconMessage__text",title:"NewsBeaconMessage__title NewsBeaconMessage__text",content:"NewsBeaconMessage__content NewsBeaconMessage__text",date:"NewsBeaconMessage__date"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Toaster=void 0;const o=a(n(0)),l=a(n(1015)),i=n(1),r=n(1016),s=n(1017);t.Toaster=function(){const e=i.useSelector(r.selectToasts);return o.default.createElement("div",{className:l.default.root},o.default.createElement("div",{className:l.default.container},e.map(e=>o.default.createElement(s.Toast,{key:e.key,toast:e}))))}},function(e,t,n){e.exports={root:"Toaster__root layout__z-highest",container:"Toaster__container"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.selectToasts=void 0;const a=n(43);t.selectToasts=e=>a.Dictionary.values(e.toasts)},function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&a(t,e,n);return o(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Toast=void 0;const r=l(n(0)),s=i(n(1018)),u=n(1),c=n(11),d=n(75),f=n(45);function m({toast:e}){return r.default.createElement("p",null,e.message)}function p({toast:e}){return r.default.createElement("div",null,r.default.createElement("p",{className:s.default.heading},"Spotlight has encountered an error:"),r.default.createElement("p",{className:s.default.message},e.message),e.details&&r.default.createElement("pre",{className:s.default.details},e.details),r.default.createElement("p",{className:s.default.footer},"If this error persists, kindly"," ",r.default.createElement("a",{href:f.AdminResources.supportUrl,target:"_blank"},"contact customer support"),"."))}t.Toast=function({toast:e}){var t;const n=u.useDispatch(),[a,o]=r.default.useState(!1);let l=r.default.useRef(),i=r.default.useRef();const f=null!==(t=e.type)&&void 0!==t?t:d.ToastType.NOTIFICATION,_=f===d.ToastType.NOTIFICATION,h=()=>n(d.removeToast(e.key)),g=()=>{_&&(l.current=setTimeout(v,5e3))},b=()=>{clearTimeout(l.current)},v=()=>{o(!0),i.current=setTimeout(h,200)};r.useEffect(()=>(g(),()=>{b(),clearTimeout(i.current)}),[]);const y=a?s.default.rootFadingOut:s.default.root;return r.default.createElement("div",{className:y,onMouseOver:b,onMouseOut:g},r.default.createElement("div",{className:s.default.content},f===d.ToastType.ERROR?r.default.createElement(p,{toast:e}):r.default.createElement(m,{toast:e})),r.default.createElement("button",{className:s.default.dismissBtn,onClick:()=>{b(),v()}},r.default.createElement(c.Dashicon,{icon:"no-alt",className:s.default.dismissIcon})))}},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"}},function(e,t,n){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ModalLayer=void 0;const o=a(n(0)),l=a(n(1020)),i=n(14);t.ModalLayer=function(){return o.default.createElement("div",{className:i.classList(l.default.modalLayer,"spotlight-modal-target")})}},function(e,t,n){e.exports={"modal-layer":"ModalLayer__modal-layer",modalLayer:"ModalLayer__modal-layer"}}]]);
ui/dist/admin-vendors.js CHANGED
@@ -1,2 +1,2 @@
1
  /*! For license information please see admin-vendors.js.LICENSE.txt */
2
- (window.webpackJsonpSpotlight=window.webpackJsonpSpotlight||[]).push([[5],[,function(e,t,n){"use strict";n.r(t),n.d(t,"Provider",(function(){return l})),n.d(t,"connectAdvanced",(function(){return j})),n.d(t,"ReactReduxContext",(function(){return i})),n.d(t,"connect",(function(){return V})),n.d(t,"batch",(function(){return K.unstable_batchedUpdates})),n.d(t,"useDispatch",(function(){return $})),n.d(t,"createDispatchHook",(function(){return z})),n.d(t,"useSelector",(function(){return G})),n.d(t,"createSelectorHook",(function(){return q})),n.d(t,"useStore",(function(){return W})),n.d(t,"createStoreHook",(function(){return B})),n.d(t,"shallowEqual",(function(){return E}));var r=n(0),o=n.n(r),i=(n(27),o.a.createContext(null)),a=function(e){e()},u={notify:function(){}};var s=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=u,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){var e,t,n;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=a,t=null,n=null,{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=u)},e}(),c="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?r.useLayoutEffect:r.useEffect,l=function(e){var t=e.store,n=e.context,a=e.children,u=Object(r.useMemo)((function(){var e=new s(t);return e.onStateChange=e.notifyNestedSubs,{store:t,subscription:e}}),[t]),l=Object(r.useMemo)((function(){return t.getState()}),[t]);c((function(){var e=u.subscription;return e.trySubscribe(),l!==t.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[u,l]);var f=n||i;return o.a.createElement(f.Provider,{value:u},a)},f=n(13),p=n(49),d=n(59),h=n.n(d),v=n(98),b=[],y=[null,null];function g(e,t){var n=e[1];return[t.payload,n+1]}function m(e,t,n){c((function(){return e.apply(void 0,t)}),n)}function O(e,t,n,r,o,i,a){e.current=r,t.current=o,n.current=!1,i.current&&(i.current=null,a())}function w(e,t,n,r,o,i,a,u,s,c){if(e){var l=!1,f=null,p=function(){if(!l){var e,n,p=t.getState();try{e=r(p,o.current)}catch(e){n=e,f=e}n||(f=null),e===i.current?a.current||s():(i.current=e,u.current=e,a.current=!0,c({type:"STORE_UPDATED",payload:{error:n}}))}};return n.onStateChange=p,n.trySubscribe(),p(),function(){if(l=!0,n.tryUnsubscribe(),n.onStateChange=null,f)throw f}}}var x=function(){return[null,0]};function j(e,t){void 0===t&&(t={});var n=t,a=n.getDisplayName,u=void 0===a?function(e){return"ConnectAdvanced("+e+")"}:a,c=n.methodName,l=void 0===c?"connectAdvanced":c,d=n.renderCountProp,j=void 0===d?void 0:d,S=n.shouldHandleStateChanges,E=void 0===S||S,_=n.storeKey,P=void 0===_?"store":_,C=(n.withRef,n.forwardRef),A=void 0!==C&&C,M=n.context,k=void 0===M?i:M,I=Object(p.a)(n,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]),D=k;return function(t){var n=t.displayName||t.name||"Component",i=u(n),a=Object(f.a)({},I,{getDisplayName:u,methodName:l,renderCountProp:j,shouldHandleStateChanges:E,storeKey:P,displayName:i,wrappedComponentName:n,WrappedComponent:t}),c=I.pure,d=c?r.useMemo:function(e){return e()};function S(n){var i=Object(r.useMemo)((function(){var e=n.reactReduxForwardedRef,t=Object(p.a)(n,["reactReduxForwardedRef"]);return[n.context,e,t]}),[n]),u=i[0],c=i[1],l=i[2],h=Object(r.useMemo)((function(){return u&&u.Consumer&&Object(v.isContextConsumer)(o.a.createElement(u.Consumer,null))?u:D}),[u,D]),j=Object(r.useContext)(h),S=Boolean(n.store)&&Boolean(n.store.getState)&&Boolean(n.store.dispatch);Boolean(j)&&Boolean(j.store);var _=S?n.store:j.store,P=Object(r.useMemo)((function(){return function(t){return e(t.dispatch,a)}(_)}),[_]),C=Object(r.useMemo)((function(){if(!E)return y;var e=new s(_,S?null:j.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[_,S,j]),A=C[0],M=C[1],k=Object(r.useMemo)((function(){return S?j:Object(f.a)({},j,{subscription:A})}),[S,j,A]),I=Object(r.useReducer)(g,b,x),R=I[0][0],T=I[1];if(R&&R.error)throw R.error;var N=Object(r.useRef)(),L=Object(r.useRef)(l),F=Object(r.useRef)(),U=Object(r.useRef)(!1),V=d((function(){return F.current&&l===L.current?F.current:P(_.getState(),l)}),[_,R,l]);m(O,[L,N,U,l,V,F,M]),m(w,[E,_,A,P,L,N,U,F,M,T],[_,A,P]);var H=Object(r.useMemo)((function(){return o.a.createElement(t,Object(f.a)({},V,{ref:c}))}),[c,t,V]);return Object(r.useMemo)((function(){return E?o.a.createElement(h.Provider,{value:k},H):H}),[h,H,k])}var _=c?o.a.memo(S):S;if(_.WrappedComponent=t,_.displayName=i,A){var C=o.a.forwardRef((function(e,t){return o.a.createElement(_,Object(f.a)({},e,{reactReduxForwardedRef:t}))}));return C.displayName=i,C.WrappedComponent=t,h()(C,t)}return h()(_,t)}}function S(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function E(e,t){if(S(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.prototype.hasOwnProperty.call(t,n[o])||!S(e[n[o]],t[n[o]]))return!1;return!0}var _=n(72);function P(e){return function(t,n){var r=e(t,n);function o(){return r}return o.dependsOnOwnProps=!1,o}}function C(e){return null!==e.dependsOnOwnProps&&void 0!==e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function A(e,t){return function(t,n){n.displayName;var r=function(e,t){return r.dependsOnOwnProps?r.mapToProps(e,t):r.mapToProps(e)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=C(e);var o=r(t,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=C(o),o=r(t,n)),o},r}}var M=[function(e){return"function"==typeof e?A(e):void 0},function(e){return e?void 0:P((function(e){return{dispatch:e}}))},function(e){return e&&"object"==typeof e?P((function(t){return Object(_.c)(e,t)})):void 0}],k=[function(e){return"function"==typeof e?A(e):void 0},function(e){return e?void 0:P((function(){return{}}))}];function I(e,t,n){return Object(f.a)({},n,e,t)}var D=[function(e){return"function"==typeof e?function(e){return function(t,n){n.displayName;var r,o=n.pure,i=n.areMergedPropsEqual,a=!1;return function(t,n,u){var s=e(t,n,u);return a?o&&i(s,r)||(r=s):(a=!0,r=s),r}}}(e):void 0},function(e){return e?void 0:function(){return I}}];function R(e,t,n,r){return function(o,i){return n(e(o,i),t(r,i),i)}}function T(e,t,n,r,o){var i,a,u,s,c,l=o.areStatesEqual,f=o.areOwnPropsEqual,p=o.areStatePropsEqual,d=!1;return function(o,h){return d?function(o,d){var h,v,b=!f(d,a),y=!l(o,i);return i=o,a=d,b&&y?(u=e(i,a),t.dependsOnOwnProps&&(s=t(r,a)),c=n(u,s,a)):b?(e.dependsOnOwnProps&&(u=e(i,a)),t.dependsOnOwnProps&&(s=t(r,a)),c=n(u,s,a)):y?(h=e(i,a),v=!p(h,u),u=h,v&&(c=n(u,s,a)),c):c}(o,h):(u=e(i=o,a=h),s=t(r,a),c=n(u,s,a),d=!0,c)}}function N(e,t){var n=t.initMapStateToProps,r=t.initMapDispatchToProps,o=t.initMergeProps,i=Object(p.a)(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),a=n(e,i),u=r(e,i),s=o(e,i);return(i.pure?T:R)(a,u,s,e,i)}function L(e,t,n){for(var r=t.length-1;r>=0;r--){var o=t[r](e);if(o)return o}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function F(e,t){return e===t}function U(e){var t=void 0===e?{}:e,n=t.connectHOC,r=void 0===n?j:n,o=t.mapStateToPropsFactories,i=void 0===o?k:o,a=t.mapDispatchToPropsFactories,u=void 0===a?M:a,s=t.mergePropsFactories,c=void 0===s?D:s,l=t.selectorFactory,d=void 0===l?N:l;return function(e,t,n,o){void 0===o&&(o={});var a=o,s=a.pure,l=void 0===s||s,h=a.areStatesEqual,v=void 0===h?F:h,b=a.areOwnPropsEqual,y=void 0===b?E:b,g=a.areStatePropsEqual,m=void 0===g?E:g,O=a.areMergedPropsEqual,w=void 0===O?E:O,x=Object(p.a)(a,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),j=L(e,i,"mapStateToProps"),S=L(t,u,"mapDispatchToProps"),_=L(n,c,"mergeProps");return r(d,Object(f.a)({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:j,initMapDispatchToProps:S,initMergeProps:_,pure:l,areStatesEqual:v,areOwnPropsEqual:y,areStatePropsEqual:m,areMergedPropsEqual:w},x))}}var V=U();function H(){return Object(r.useContext)(i)}function B(e){void 0===e&&(e=i);var t=e===i?H:function(){return Object(r.useContext)(e)};return function(){return t().store}}var W=B();function z(e){void 0===e&&(e=i);var t=e===i?W:B(e);return function(){return t().dispatch}}var $=z(),Y=function(e,t){return e===t};function q(e){void 0===e&&(e=i);var t=e===i?H:function(){return Object(r.useContext)(e)};return function(e,n){void 0===n&&(n=Y);var o=t(),i=function(e,t,n,o){var i,a=Object(r.useReducer)((function(e){return e+1}),0)[1],u=Object(r.useMemo)((function(){return new s(n,o)}),[n,o]),l=Object(r.useRef)(),f=Object(r.useRef)(),p=Object(r.useRef)(),d=Object(r.useRef)(),h=n.getState();try{if(e!==f.current||h!==p.current||l.current){var v=e(h);i=void 0!==d.current&&t(v,d.current)?d.current:v}else i=d.current}catch(e){throw l.current&&(e.message+="\nThe error may be correlated with this previous error:\n"+l.current.stack+"\n\n"),e}return c((function(){f.current=e,p.current=h,d.current=i,l.current=void 0})),c((function(){function e(){try{var e=f.current(n.getState());if(t(e,d.current))return;d.current=e}catch(e){l.current=e}a()}return u.onStateChange=e,u.trySubscribe(),e(),function(){return u.tryUnsubscribe()}}),[n,u]),i}(e,n,o.store,o.subscription);return Object(r.useDebugValue)(i),i}}var X,G=q(),K=n(19);X=K.unstable_batchedUpdates,a=X},,function(e,t,n){"use strict";n.d(t,"a",(function(){return R})),n.d(t,"b",(function(){return j})),n.d(t,"c",(function(){return Ie})),n.d(t,"d",(function(){return P})),n.d(t,"e",(function(){return S})),n.d(t,"f",(function(){return I})),n.d(t,"g",(function(){return w})),n.d(t,"h",(function(){return _})),n.d(t,"i",(function(){return W})),n.d(t,"j",(function(){return O})),n.d(t,"k",(function(){return y})),n.d(t,"l",(function(){return le})),n.d(t,"m",(function(){return ke})),n.d(t,"n",(function(){return te})),n.d(t,"o",(function(){return be})),n.d(t,"p",(function(){return ce})),n.d(t,"q",(function(){return ye})),n.d(t,"r",(function(){return ge})),n.d(t,"s",(function(){return re})),n.d(t,"t",(function(){return fe})),n.d(t,"u",(function(){return me})),n.d(t,"v",(function(){return de})),n.d(t,"w",(function(){return q})),n.d(t,"x",(function(){return H})),n.d(t,"y",(function(){return z})),n.d(t,"z",(function(){return Q})),n.d(t,"A",(function(){return we})),n.d(t,"B",(function(){return xe})),n.d(t,"C",(function(){return F})),n.d(t,"D",(function(){return je})),n.d(t,"E",(function(){return Y})),n.d(t,"F",(function(){return Ce})),n.d(t,"G",(function(){return Ae})),n.d(t,"H",(function(){return Me})),n.d(t,"I",(function(){return ne})),n.d(t,"J",(function(){return D}));var r=n(7),o=n(5),i=n(73);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=n(168),s=n.n(u),c=n(53),l=n(54),f=n(55),p=n(61),d=n(0),h=n(19);function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(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 y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){v(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return!t||"object"!=typeof 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 O(e){var t=function(){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}}();return function(){var n,r=g(e);if(t){var o=g(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m(this,n)}}var w=function(){};function x(e,t){return t?"-"===t[0]?e+t:e+"__"+t:e}function j(e,t,n){var r=[n];if(t&&e)for(var o in t)t.hasOwnProperty(o)&&t[o]&&r.push("".concat(x(e,o)));return r.filter((function(e){return e})).map((function(e){return String(e).trim()})).join(" ")}var S=function(e){return Array.isArray(e)?e.filter(Boolean):"object"===a(e)&&null!==e?[e]:[]},E=function(e){return e.className,e.clearValue,e.cx,e.getStyles,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme,y({},Object(i.a)(e,["className","clearValue","cx","getStyles","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"]))};function _(e,t,n){if(n){var r=n(e,t);if("string"==typeof r)return r}return e}function P(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function C(e){return P(e)?window.pageYOffset:e.scrollTop}function A(e,t){P(e)?window.scrollTo(0,t):e.scrollTop=t}function M(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function k(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:w,o=C(e),i=t-o,a=10,u=0;function s(){var t=M(u+=a,o,i,n);A(e,t),u<n?window.requestAnimationFrame(s):r(e)}s()}function I(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=t.offsetHeight/3;r.bottom+o>n.bottom?A(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+o,e.scrollHeight)):r.top-o<n.top&&A(e,Math.max(t.offsetTop-o,0))}function D(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}}function R(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(e){return!1}}var T=!1,N={get passive(){return T=!0}},L="undefined"!=typeof window?window:{};L.addEventListener&&L.removeEventListener&&(L.addEventListener("p",w,N),L.removeEventListener("p",w,!1));var F=T;function U(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=function(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}(n),c={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return c;var l=s.getBoundingClientRect().height,f=n.getBoundingClientRect(),p=f.bottom,d=f.height,h=f.top,v=n.offsetParent.getBoundingClientRect().top,b=window.innerHeight,y=C(s),g=parseInt(getComputedStyle(n).marginBottom,10),m=parseInt(getComputedStyle(n).marginTop,10),O=v-m,w=b-h,x=O+y,j=l-y-h,S=p-b+y+g,E=y+h-m;switch(o){case"auto":case"bottom":if(w>=d)return{placement:"bottom",maxHeight:t};if(j>=d&&!a)return i&&k(s,S,160),{placement:"bottom",maxHeight:t};if(!a&&j>=r||a&&w>=r)return i&&k(s,S,160),{placement:"bottom",maxHeight:a?w-g:j-g};if("auto"===o||a){var _=t,P=a?O:x;return P>=r&&(_=Math.min(P-g-u.controlHeight,t)),{placement:"top",maxHeight:_}}if("bottom"===o)return i&&A(s,S),{placement:"bottom",maxHeight:t};break;case"top":if(O>=d)return{placement:"top",maxHeight:t};if(x>=d&&!a)return i&&k(s,E,160),{placement:"top",maxHeight:t};if(!a&&x>=r||a&&O>=r){var M=t;return(!a&&x>=r||a&&O>=r)&&(M=a?O-m:x-m),i&&k(s,E,160),{placement:"top",maxHeight:M}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(o,'".'))}return c}var V=function(e){return"auto"===e?"bottom":e},H=function(e){var t,n=e.placement,r=e.theme,o=r.borderRadius,i=r.spacing,a=r.colors;return t={label:"menu"},Object(p.a)(t,function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(n),"100%"),Object(p.a)(t,"backgroundColor",a.neutral0),Object(p.a)(t,"borderRadius",o),Object(p.a)(t,"boxShadow","0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)"),Object(p.a)(t,"marginBottom",i.menuGutter),Object(p.a)(t,"marginTop",i.menuGutter),Object(p.a)(t,"position","absolute"),Object(p.a)(t,"width","100%"),Object(p.a)(t,"zIndex",1),t},B=Object(d.createContext)({getPortalPlacement:null}),W=function(e){Object(f.a)(n,e);var t=O(n);function n(){var e;Object(c.a)(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))).state={maxHeight:e.props.maxMenuHeight,placement:null},e.getPlacement=function(t){var n=e.props,r=n.minMenuHeight,o=n.maxMenuHeight,i=n.menuPlacement,a=n.menuPosition,u=n.menuShouldScrollIntoView,s=n.theme;if(t){var c="fixed"===a,l=U({maxHeight:o,menuEl:t,minHeight:r,placement:i,shouldScroll:u&&!c,isFixedPosition:c,theme:s}),f=e.context.getPortalPlacement;f&&f(l),e.setState(l)}},e.getUpdatedProps=function(){var t=e.props.menuPlacement,n=e.state.placement||V(t);return y(y({},e.props),{},{placement:n,maxHeight:e.state.maxHeight})},e}return Object(l.a)(n,[{key:"render",value:function(){return(0,this.props.children)({ref:this.getPlacement,placerProps:this.getUpdatedProps()})}}]),n}(d.Component);W.contextType=B;var z=function(e){var t=e.maxHeight,n=e.theme.spacing.baseUnit;return{maxHeight:t,overflowY:"auto",paddingBottom:n,paddingTop:n,position:"relative",WebkitOverflowScrolling:"touch"}},$=function(e){var t=e.theme,n=t.spacing.baseUnit;return{color:t.colors.neutral40,padding:"".concat(2*n,"px ").concat(3*n,"px"),textAlign:"center"}},Y=$,q=$,X=function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("noOptionsMessage",e),className:i({"menu-notice":!0,"menu-notice--no-options":!0},n)},u),t)};X.defaultProps={children:"No options"};var G=function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("loadingMessage",e),className:i({"menu-notice":!0,"menu-notice--loading":!0},n)},u),t)};G.defaultProps={children:"Loading..."};var K,J,Z,Q=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}},ee=function(e){Object(f.a)(n,e);var t=O(n);function n(){var e;Object(c.a)(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))).state={placement:null},e.getPortalPlacement=function(t){var n=t.placement;n!==V(e.props.menuPlacement)&&e.setState({placement:n})},e}return Object(l.a)(n,[{key:"render",value:function(){var e=this.props,t=e.appendTo,n=e.children,i=e.className,a=e.controlElement,u=e.cx,s=e.innerProps,c=e.menuPlacement,l=e.menuPosition,f=e.getStyles,p="fixed"===l;if(!t&&!p||!a)return null;var d=this.state.placement||V(c),v=function(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}(a),b=p?0:window.pageYOffset,y={offset:v[d]+b,position:l,rect:v},g=Object(o.c)("div",Object(r.a)({css:f("menuPortal",y),className:u({"menu-portal":!0},i)},s),n);return Object(o.c)(B.Provider,{value:{getPortalPlacement:this.getPortalPlacement}},t?Object(h.createPortal)(g,t):g)}}]),n}(d.Component),te=function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":null,pointerEvents:t?"none":null,position:"relative"}},ne=function(e){var t=e.theme.spacing;return{alignItems:"center",display:"flex",flex:1,flexWrap:"wrap",padding:"".concat(t.baseUnit/2,"px ").concat(2*t.baseUnit,"px"),WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"}},re=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},oe={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},ie=function(e){var t=e.size,n=Object(i.a)(e,["size"]);return Object(o.c)("svg",Object(r.a)({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:oe},n))},ae=function(e){return Object(o.c)(ie,Object(r.a)({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"}))},ue=function(e){return Object(o.c)(ie,Object(r.a)({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"}))},se=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}}},ce=se,le=se,fe=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}},pe=Object(o.d)(K||(J=["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"],Z||(Z=J.slice(0)),K=Object.freeze(Object.defineProperties(J,{raw:{value:Object.freeze(Z)}})))),de=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"}},he=function(e){var t=e.delay,n=e.offset;return Object(o.c)("span",{css:Object(o.b)({animation:"".concat(pe," 1s ease-in-out ").concat(t,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":null,height:"1em",verticalAlign:"top",width:"1em"},"","")})},ve=function(e){var t=e.className,n=e.cx,i=e.getStyles,a=e.innerProps,u=e.isRtl;return Object(o.c)("div",Object(r.a)({css:i("loadingIndicator",e),className:n({indicator:!0,"loading-indicator":!0},t)},a),Object(o.c)(he,{delay:0,offset:u}),Object(o.c)(he,{delay:160,offset:!0}),Object(o.c)(he,{delay:320,offset:!u}))};ve.defaultProps={size:4};var be=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 ".concat(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}}},ye=function(e){var t=e.theme.spacing;return{paddingBottom:2*t.baseUnit,paddingTop:2*t.baseUnit}},ge=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"}},me=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}},Oe=function(e){return{label:"input",background:0,border:0,fontSize:"inherit",opacity:e?0:1,outline:0,padding:0,color:"inherit"}},we=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}},xe=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"}},je=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}}},Se=function(e){var t=e.children,n=e.innerProps;return Object(o.c)("div",n,t)},Ee=Se,_e=Se,Pe=function(e){var t=e.children,n=e.className,r=e.components,i=e.cx,a=e.data,u=e.getStyles,s=e.innerProps,c=e.isDisabled,l=e.removeProps,f=e.selectProps,p=r.Container,d=r.Label,h=r.Remove;return Object(o.c)(o.a,null,(function(r){var v=r.css,b=r.cx;return Object(o.c)(p,{data:a,innerProps:y({className:b(v(u("multiValue",e)),i({"multi-value":!0,"multi-value--is-disabled":c},n))},s),selectProps:f},Object(o.c)(d,{data:a,innerProps:{className:b(v(u("multiValueLabel",e)),i({"multi-value__label":!0},n))},selectProps:f},t),Object(o.c)(h,{data:a,innerProps:y({className:b(v(u("multiValueRemove",e)),i({"multi-value__remove":!0},n))},l),selectProps:f}))}))};Pe.defaultProps={cropWithEllipsis:!0};var Ce=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:"".concat(2*i.baseUnit,"px ").concat(3*i.baseUnit,"px"),width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",":active":{backgroundColor:!t&&(r?a.primary:a.primary50)}}},Ae=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%)"}},Me=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% - ".concat(2*r.baseUnit,"px)"),overflow:"hidden",position:"absolute",textOverflow:"ellipsis",whiteSpace:"nowrap",top:"50%",transform:"translateY(-50%)"}},ke={ClearIndicator:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("clearIndicator",e),className:i({indicator:!0,"clear-indicator":!0},n)},u),t||Object(o.c)(ae,null))},Control:function(e){var t=e.children,n=e.cx,i=e.getStyles,a=e.className,u=e.isDisabled,s=e.isFocused,c=e.innerRef,l=e.innerProps,f=e.menuIsOpen;return Object(o.c)("div",Object(r.a)({ref:c,css:i("control",e),className:n({control:!0,"control--is-disabled":u,"control--is-focused":s,"control--menu-is-open":f},a)},l),t)},DropdownIndicator:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("dropdownIndicator",e),className:i({indicator:!0,"dropdown-indicator":!0},n)},u),t||Object(o.c)(ue,null))},DownChevron:ue,CrossIcon:ae,Group:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.Heading,s=e.headingProps,c=e.innerProps,l=e.label,f=e.theme,p=e.selectProps;return Object(o.c)("div",Object(r.a)({css:a("group",e),className:i({group:!0},n)},c),Object(o.c)(u,Object(r.a)({},s,{selectProps:p,theme:f,getStyles:a,cx:i}),l),Object(o.c)("div",null,t))},GroupHeading:function(e){var t=e.getStyles,n=e.cx,a=e.className,u=E(e);u.data;var s=Object(i.a)(u,["data"]);return Object(o.c)("div",Object(r.a)({css:t("groupHeading",e),className:n({"group-heading":!0},a)},s))},IndicatorsContainer:function(e){var t=e.children,n=e.className,i=e.cx,a=e.innerProps,u=e.getStyles;return Object(o.c)("div",Object(r.a)({css:u("indicatorsContainer",e),className:i({indicators:!0},n)},a),t)},IndicatorSeparator:function(e){var t=e.className,n=e.cx,i=e.getStyles,a=e.innerProps;return Object(o.c)("span",Object(r.a)({},a,{css:i("indicatorSeparator",e),className:n({"indicator-separator":!0},t)}))},Input:function(e){var t=e.className,n=e.cx,a=e.getStyles,u=E(e),c=u.innerRef,l=u.isDisabled,f=u.isHidden,p=Object(i.a)(u,["innerRef","isDisabled","isHidden"]);return Object(o.c)("div",{css:a("input",e)},Object(o.c)(s.a,Object(r.a)({className:n({input:!0},t),inputRef:c,inputStyle:Oe(f),disabled:l},p)))},LoadingIndicator:ve,Menu:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerRef,s=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("menu",e),className:i({menu:!0},n),ref:u},s),t)},MenuList:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerProps,s=e.innerRef,c=e.isMulti;return Object(o.c)("div",Object(r.a)({css:a("menuList",e),className:i({"menu-list":!0,"menu-list--is-multi":c},n),ref:s},u),t)},MenuPortal:ee,LoadingMessage:G,NoOptionsMessage:X,MultiValue:Pe,MultiValueContainer:Ee,MultiValueLabel:_e,MultiValueRemove:function(e){var t=e.children,n=e.innerProps;return Object(o.c)("div",n,t||Object(o.c)(ae,{size:14}))},Option:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.isDisabled,s=e.isFocused,c=e.isSelected,l=e.innerRef,f=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("option",e),className:i({option:!0,"option--is-disabled":u,"option--is-focused":s,"option--is-selected":c},n),ref:l},f),t)},Placeholder:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("placeholder",e),className:i({placeholder:!0},n)},u),t)},SelectContainer:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.innerProps,s=e.isDisabled,c=e.isRtl;return Object(o.c)("div",Object(r.a)({css:a("container",e),className:i({"--is-disabled":s,"--is-rtl":c},n)},u),t)},SingleValue:function(e){var t=e.children,n=e.className,i=e.cx,a=e.getStyles,u=e.isDisabled,s=e.innerProps;return Object(o.c)("div",Object(r.a)({css:a("singleValue",e),className:i({"single-value":!0,"single-value--is-disabled":u},n)},s),t)},ValueContainer:function(e){var t=e.children,n=e.className,i=e.cx,a=e.innerProps,u=e.isMulti,s=e.getStyles,c=e.hasValue;return Object(o.c)("div",Object(r.a)({css:s("valueContainer",e),className:i({"value-container":!0,"value-container--is-multi":u,"value-container--has-value":c},n)},a),t)}},Ie=function(e){return y(y({},ke),e.components)}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return s})),n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return c}));var r=n(0),o=(n(169),n(37)),i=(n(530),n(170),n(59),n(133)),a=n(154),u=(n(209),function(e,t){var n=arguments;if(null==t||!o.e.call(t,"css"))return r.createElement.apply(void 0,n);var i=n.length,a=new Array(i);a[0]=o.b,a[1]=Object(o.d)(e,t);for(var u=2;u<i;u++)a[u]=n[u];return r.createElement.apply(null,a)});function s(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Object(a.a)(t)}var c=function(){var e=s.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_"}}},l=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 f(e,t,n){var r=[],o=Object(i.a)(e,r,n);return r.length<2?n:o+t(r)}var p=Object(o.f)((function(e,t){var n=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=Object(a.a)(n,t.registered);return Object(i.b)(t,o,!1),t.key+"-"+o.name},u={css:n,cx:function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return f(t.registered,n,l(r))},theme:Object(r.useContext)(o.c)};return e.children(u)}))},,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";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";function r(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function o(e){return!!e&&!!e[$]}function i(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&Function.toString.call(n)===Y}(e)||Array.isArray(e)||!!e[z]||!!e.constructor[z]||p(e)||d(e))}function a(e){return o(e)||r(23,e),e[$].t}function u(e,t,n){void 0===n&&(n=!1),0===s(e)?(n?Object.keys:q)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function s(e){var t=e[$];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:p(e)?2:d(e)?3:0}function c(e,t){return 2===s(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function l(e,t,n){var r=s(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function p(e){return V&&e instanceof Map}function d(e){return H&&e instanceof Set}function h(e){return e.o||e.t}function v(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=X(e);delete t[$];for(var n=q(t),r=0;r<n.length;r++){var o=n[r],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function b(e,t){return void 0===t&&(t=!1),g(e)||o(e)||!i(e)||(s(e)>1&&(e.set=e.add=e.clear=e.delete=y),Object.freeze(e),t&&u(e,(function(e,t){return b(t,!0)}),!0)),e}function y(){r(2)}function g(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function m(e){var t=G[e];return t||r(18,e),t}function O(){return F}function w(e,t){t&&(m("Patches"),e.u=[],e.s=[],e.v=t)}function x(e){j(e),e.p.forEach(E),e.p=null}function j(e){e===F&&(F=e.l)}function S(e){return F={p:[],l:F,h:e,m:!0,_:0}}function E(e){var t=e[$];0===t.i||1===t.i?t.j():t.g=!0}function _(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.O||m("ES5").S(t,e,o),o?(n[$].P&&(x(t),r(4)),i(e)&&(e=P(t,e),t.l||A(t,e)),t.u&&m("Patches").M(n[$],e,t.u,t.s)):e=P(t,n,[]),x(t),t.u&&t.v(t.u,t.s),e!==W?e:void 0}function P(e,t,n){if(g(t))return t;var r=t[$];if(!r)return u(t,(function(o,i){return C(e,r,t,o,i,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return A(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=v(r.k):r.o;u(3===r.i?new Set(o):o,(function(t,i){return C(e,r,o,t,i,n)})),A(e,o,!1),n&&e.u&&m("Patches").R(r,n,e.u,e.s)}return r.o}function C(e,t,n,r,a,u){if(o(a)){var s=P(e,a,u&&t&&3!==t.i&&!c(t.D,r)?u.concat(r):void 0);if(l(n,r,s),!o(s))return;e.m=!1}if(i(a)&&!g(a)){if(!e.h.F&&e._<1)return;P(e,a),t&&t.A.l||A(e,a)}}function A(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&b(t,n)}function M(e,t){var n=e[$];return(n?h(n):e)[t]}function k(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function I(e){e.P||(e.P=!0,e.l&&I(e.l))}function D(e){e.o||(e.o=v(e.t))}function R(e,t,n){var r=p(t)?m("MapSet").N(t,n):d(t)?m("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:O(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,i=K;n&&(o=[r],i=J);var a=Proxy.revocable(o,i),u=a.revoke,s=a.proxy;return r.k=s,r.j=u,s}(t,n):m("ES5").J(t,n);return(n?n.A:O()).p.push(r),r}function T(e){return o(e)||r(22,e),function e(t){if(!i(t))return t;var n,r=t[$],o=s(t);if(r){if(!r.P&&(r.i<4||!m("ES5").K(r)))return r.t;r.I=!0,n=N(t,o),r.I=!1}else n=N(t,o);return u(n,(function(t,o){r&&function(e,t){return 2===s(e)?e.get(t):e[t]}(r.t,t)===o||l(n,t,e(o))})),3===o?new Set(n):n}(e)}function N(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return v(e)}n.r(t),n.d(t,"createNextState",(function(){return ee})),n.d(t,"current",(function(){return T})),n.d(t,"freeze",(function(){return b})),n.d(t,"isDraft",(function(){return o})),n.d(t,"original",(function(){return a})),n.d(t,"__DO_NOT_USE__ActionTypes",(function(){return te.a})),n.d(t,"applyMiddleware",(function(){return te.b})),n.d(t,"bindActionCreators",(function(){return te.c})),n.d(t,"combineReducers",(function(){return te.d})),n.d(t,"compose",(function(){return te.e})),n.d(t,"createStore",(function(){return te.f})),n.d(t,"createSelector",(function(){return ne.a})),n.d(t,"MiddlewareArray",(function(){return de})),n.d(t,"configureStore",(function(){return Oe})),n.d(t,"createAction",(function(){return we})),n.d(t,"createAsyncThunk",(function(){return Te})),n.d(t,"createDraftSafeSelector",(function(){return oe})),n.d(t,"createEntityAdapter",(function(){return Me})),n.d(t,"createImmutableStateInvariantMiddleware",(function(){return ve})),n.d(t,"createReducer",(function(){return Ee})),n.d(t,"createSerializableStateInvariantMiddleware",(function(){return ge})),n.d(t,"createSlice",(function(){return _e})),n.d(t,"findNonSerializableValue",(function(){return ye})),n.d(t,"getDefaultMiddleware",(function(){return me})),n.d(t,"getType",(function(){return je})),n.d(t,"isAllOf",(function(){return Ue})),n.d(t,"isAnyOf",(function(){return Fe})),n.d(t,"isAsyncThunkAction",(function(){return Ye})),n.d(t,"isFulfilled",(function(){return $e})),n.d(t,"isImmutableDefault",(function(){return he})),n.d(t,"isPending",(function(){return Be})),n.d(t,"isPlain",(function(){return be})),n.d(t,"isPlainObject",(function(){return pe})),n.d(t,"isRejected",(function(){return We})),n.d(t,"isRejectedWithValue",(function(){return ze})),n.d(t,"nanoid",(function(){return ke})),n.d(t,"unwrapResult",(function(){return Ne}));var L,F,U="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),V="undefined"!=typeof Map,H="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,W=U?Symbol.for("immer-nothing"):((L={})["immer-nothing"]=!0,L),z=U?Symbol.for("immer-draftable"):"__$immer_draftable",$=U?Symbol.for("immer-state"):"__$immer_state",Y=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),q="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,X=Object.getOwnPropertyDescriptors||function(e){var t={};return q(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},G={},K={get:function(e,t){if(t===$)return e;var n=h(e);if(!c(n,t))return function(e,t,n){var r,o=k(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!i(r)?r:r===M(e.t,t)?(D(e),e.o[t]=R(e.A.h,r,e)):r},has:function(e,t){return t in h(e)},ownKeys:function(e){return Reflect.ownKeys(h(e))},set:function(e,t,n){var r=k(h(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=M(h(e),t),i=null==o?void 0:o[$];if(i&&i.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(f(n,o)&&(void 0!==n||c(e.t,t)))return!0;D(e),I(e)}return e.o[t]===n&&"number"!=typeof n||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==M(e.t,t)||t in e.t?(e.D[t]=!1,D(e),I(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=h(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){r(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){r(12)}},J={};u(K,(function(e,t){J[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),J.deleteProperty=function(e,t){return K.deleteProperty.call(this,e[0],t)},J.set=function(e,t,n){return K.set.call(this,e[0],t,n,e[0])};var Z=new(function(){function e(e){var t=this;this.O=B,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var a=n;n=e;var u=t;return function(e){var t=this;void 0===e&&(e=a);for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return u.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(o))}))}}var s;if("function"!=typeof n&&r(6),void 0!==o&&"function"!=typeof o&&r(7),i(e)){var c=S(t),l=R(t,e,void 0),f=!0;try{s=n(l),f=!1}finally{f?x(c):j(c)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return w(c,o),_(e,c)}),(function(e){throw x(c),e})):(w(c,o),_(s,c))}if(!e||"object"!=typeof e){if((s=n(e))===W)return;return void 0===s&&(s=e),t.F&&b(s,!0),s}r(21,e)},this.produceWithPatches=function(e,n){return"function"==typeof e?function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))}:[t.produce(e,n,(function(e,t){r=e,o=t})),r,o];var r,o},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){i(e)||r(8),o(e)&&(e=T(e));var t=S(this),n=R(this,e,void 0);return n[$].C=!0,j(t),n},t.finishDraft=function(e,t){var n=(e&&e[$]).A;return w(n,t),_(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!B&&r(20),this.O=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var i=m("Patches").$;return o(e)?i(e,t):this.produce(e,(function(e){return i(e,t.slice(n+1))}))},e}()),Q=Z.produce,ee=(Z.produceWithPatches.bind(Z),Z.setAutoFreeze.bind(Z),Z.setUseProxies.bind(Z),Z.applyPatches.bind(Z),Z.createDraft.bind(Z),Z.finishDraft.bind(Z),Q),te=n(72),ne=n(99),re=n(130),oe=function(){var e=ne.a.apply(void 0,arguments),t=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return e.apply(void 0,[o(t)?T(t):t].concat(r))};return t};function ie(){return(ie=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 ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ue(e,t){return(ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function se(){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 ce(e,t,n){return(ce=se()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ue(o,n.prototype),o}).apply(null,arguments)}function le(e){var t="function"==typeof Map?new Map:void 0;return(le=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;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,n)}function n(){return ce(e,arguments,ae(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ue(n,e)})(e)}var fe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?te.e:te.e.apply(null,arguments)};function pe(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var de=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.concat=function(){for(var t,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return ce(r,(t=e.prototype.concat).call.apply(t,[this].concat(o)))},o.prepend=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 1===t.length&&Array.isArray(t[0])?ce(r,t[0].concat(this)):ce(r,t.concat(this))},r}(le(Array));function he(e){return"object"!=typeof e||null==e||Object.isFrozen(e)}function ve(e){return void 0===e&&(e={}),function(){return function(e){return function(t){return e(t)}}}}function be(e){var t=typeof e;return"undefined"===t||null===e||"string"===t||"boolean"===t||"number"===t||Array.isArray(e)||pe(e)}function ye(e,t,n,r,o){var i;if(void 0===t&&(t=""),void 0===n&&(n=be),void 0===o&&(o=[]),!n(e))return{keyPath:t||"<root>",value:e};if("object"!=typeof e||null===e)return!1;var a=null!=r?r(e):Object.entries(e),u=o.length>0,s=a,c=Array.isArray(s),l=0;for(s=c?s:s[Symbol.iterator]();;){var f;if(c){if(l>=s.length)break;f=s[l++]}else{if((l=s.next()).done)break;f=l.value}var p=f,d=p[0],h=p[1],v=t?t+"."+d:d;if(!(u&&o.indexOf(v)>=0)){if(!n(h))return{keyPath:v,value:h};if("object"==typeof h&&(i=ye(h,v,n,r,o)))return i}}return!1}function ge(e){return void 0===e&&(e={}),function(){return function(e){return function(t){return e(t)}}}}function me(e){void 0===e&&(e={});var t=e,n=t.thunk,r=void 0===n||n,o=(t.immutableCheck,t.serializableCheck,new de);return r&&(function(e){return"boolean"==typeof e}(r)?o.push(re.a):o.push(re.a.withExtraArgument(r.extraArgument))),o}function Oe(e){var t,n=function(e){return me(e)},r=e||{},o=r.reducer,i=void 0===o?void 0:o,a=r.middleware,u=void 0===a?n():a,s=r.devTools,c=void 0===s||s,l=r.preloadedState,f=void 0===l?void 0:l,p=r.enhancers,d=void 0===p?void 0:p;if("function"==typeof i)t=i;else{if(!pe(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Object(te.d)(i)}var h=te.b.apply(void 0,"function"==typeof u?u(n):u),v=te.e;c&&(v=fe(ie({trace:!1},"object"==typeof c&&c)));var b=[h];Array.isArray(d)?b=[h].concat(d):"function"==typeof d&&(b=d(b));var y=v.apply(void 0,b);return Object(te.f)(t,f,y)}function we(e,t){function n(){if(t){var n=t.apply(void 0,arguments);if(!n)throw new Error("prepareAction did not return an object");return ie({type:e,payload:n.payload},"meta"in n&&{meta:n.meta},{},"error"in n&&{error:n.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function xe(e){return["type","payload","error","meta"].indexOf(e)>-1}function je(e){return""+e}function Se(e){var t,n={},r=[],o={addCase:function(e,t){var r="string"==typeof e?e:e.type;if(r in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[r]=t,o},addMatcher:function(e,t){return r.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,r,t]}function Ee(e,t,n,r){void 0===n&&(n=[]);var a="function"==typeof t?Se(t):[t,n,r],u=a[0],s=a[1],c=a[2],l=ee(e,(function(){}));return function(e,t){void 0===e&&(e=l);var n=[u[t.type]].concat(s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[c]),n.reduce((function(e,n){if(n){if(o(e)){var r=n(e,t);return void 0===r?e:r}if(i(e))return ee(e,(function(e){return n(e,t)}));var a=n(e,t);if(void 0===a){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return a}return e}),e)}}function _e(e){var t=e.name,n=e.initialState;if(!t)throw new Error("`name` is a required option for createSlice");var r=e.reducers||{},o=void 0===e.extraReducers?[]:"function"==typeof e.extraReducers?Se(e.extraReducers):[e.extraReducers],i=o[0],a=void 0===i?{}:i,u=o[1],s=void 0===u?[]:u,c=o[2],l=void 0===c?void 0:c,f=Object.keys(r),p={},d={},h={};f.forEach((function(e){var n,o,i=r[e],a=t+"/"+e;"reducer"in i?(n=i.reducer,o=i.prepare):n=i,p[e]=n,d[a]=n,h[e]=o?we(a,o):we(a)}));var v=Ee(n,ie({},a,{},d),s,l);return{name:t,reducer:v,actions:h,caseReducers:p}}function Pe(e){return function(t,n){var r=function(t){!function(e){return pe(t=e)&&"string"==typeof t.type&&Object.keys(t).every(xe);var t}(n)?e(n,t):e(n.payload,t)};return o(t)?(r(t),t):ee(t,r)}}function Ce(e,t){return t(e)}function Ae(e){function t(t,n){var r=Ce(t,e);r in n.entities||(n.ids.push(r),n.entities[r]=t)}function n(e,n){Array.isArray(e)||(e=Object.values(e));var r=e,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var a;if(o){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}t(a,n)}}function r(e,t){var n=!1;e.forEach((function(e){e in t.entities&&(delete t.entities[e],n=!0)})),n&&(t.ids=t.ids.filter((function(e){return e in t.entities})))}function o(t,n){var r={},o={};t.forEach((function(e){e.id in n.entities&&(o[e.id]={id:e.id,changes:ie({},o[e.id]?o[e.id].changes:null,{},e.changes)})})),(t=Object.values(o)).length>0&&t.filter((function(t){return function(t,n,r){var o=r.entities[n.id],i=Object.assign({},o,n.changes),a=Ce(i,e),u=a!==n.id;return u&&(t[n.id]=a,delete r.entities[n.id]),r.entities[a]=i,u}(r,t,n)})).length>0&&(n.ids=n.ids.map((function(e){return r[e]||e})))}function i(t,r){Array.isArray(t)||(t=Object.values(t));var i=[],a=[],u=t,s=Array.isArray(u),c=0;for(u=s?u:u[Symbol.iterator]();;){var l;if(s){if(c>=u.length)break;l=u[c++]}else{if((c=u.next()).done)break;l=c.value}var f=l,p=Ce(f,e);p in r.entities?a.push({id:p,changes:f}):i.push(f)}o(a,r),n(i,r)}return{removeAll:(a=function(e){Object.assign(e,{ids:[],entities:{}})},u=Pe((function(e,t){return a(t)})),function(e){return u(e,void 0)}),addOne:Pe(t),addMany:Pe(n),setAll:Pe((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.ids=[],t.entities={},n(e,t)})),updateOne:Pe((function(e,t){return o([e],t)})),updateMany:Pe(o),upsertOne:Pe((function(e,t){return i([e],t)})),upsertMany:Pe(i),removeOne:Pe((function(e,t){return r([e],t)})),removeMany:Pe(r)};var a,u}function Me(e){void 0===e&&(e={});var t=ie({sortComparer:!1,selectId:function(e){return e.id}},e),n=t.selectId,r=t.sortComparer;return ie({selectId:n,sortComparer:r},{getInitialState:function(e){return void 0===e&&(e={}),Object.assign({ids:[],entities:{}},e)}},{},{getSelectors:function(e){var t=function(e){return e.ids},n=function(e){return e.entities},r=oe(t,n,(function(e,t){return e.map((function(e){return t[e]}))})),o=function(e,t){return t},i=function(e,t){return e[t]},a=oe(t,(function(e){return e.length}));if(!e)return{selectIds:t,selectEntities:n,selectAll:r,selectTotal:a,selectById:oe(n,o,i)};var u=oe(e,n);return{selectIds:oe(e,t),selectEntities:u,selectAll:oe(e,r),selectTotal:oe(e,a),selectById:oe(u,o,i)}}},{},r?function(e,t){var n=Ae(e);function r(t,n){Array.isArray(t)||(t=Object.values(t));var r=t.filter((function(t){return!(Ce(t,e)in n.entities)}));0!==r.length&&a(r,n)}function o(t,n){var r=[];t.forEach((function(t){return function(t,n,r){if(!(n.id in r.entities))return!1;var o=r.entities[n.id],i=Object.assign({},o,n.changes),a=Ce(i,e);return delete r.entities[n.id],t.push(i),a!==n.id}(r,t,n)})),0!==r.length&&a(r,n)}function i(t,n){Array.isArray(t)||(t=Object.values(t));var i=[],a=[],u=t,s=Array.isArray(u),c=0;for(u=s?u:u[Symbol.iterator]();;){var l;if(s){if(c>=u.length)break;l=u[c++]}else{if((c=u.next()).done)break;l=c.value}var f=l,p=Ce(f,e);p in n.entities?a.push({id:p,changes:f}):i.push(f)}o(a,n),r(i,n)}function a(n,r){n.sort(t),n.forEach((function(t){r.entities[e(t)]=t}));var o=Object.values(r.entities);o.sort(t);var i=o.map(e);(function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(e[n]!==t[n])return!1;return!0})(r.ids,i)||(r.ids=i)}return{removeOne:n.removeOne,removeMany:n.removeMany,removeAll:n.removeAll,addOne:Pe((function(e,t){return r([e],t)})),updateOne:Pe((function(e,t){return o([e],t)})),upsertOne:Pe((function(e,t){return i([e],t)})),setAll:Pe((function(e,t){Array.isArray(e)||(e=Object.values(e)),t.entities={},t.ids=[],r(e,t)})),addMany:Pe(r),updateMany:Pe(o),upsertMany:Pe(i)}}(n,r):Ae(n))}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var ke=function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t},Ie=["name","message","stack","code"],De=function(e){this.payload=e,this.name="RejectWithValue",this.message="Rejected"},Re=function(e){if("object"==typeof e&&null!==e){var t={},n=Ie,r=Array.isArray(n),o=0;for(n=r?n:n[Symbol.iterator]();;){var i;if(r){if(o>=n.length)break;i=n[o++]}else{if((o=n.next()).done)break;i=o.value}var a=i;"string"==typeof e[a]&&(t[a]=e[a])}return t}return{message:String(e)}};function Te(e,t,n){var r=we(e+"/fulfilled",(function(e,t,n){return{payload:e,meta:{arg:n,requestId:t,requestStatus:"fulfilled"}}})),o=we(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e,requestStatus:"pending"}}})),i=we(e+"/rejected",(function(e,t,r){var o=e instanceof De,i=!!e&&"AbortError"===e.name,a=!!e&&"ConditionError"===e.name;return{payload:e instanceof De?e.payload:void 0,error:(n&&n.serializeError||Re)(e||"Rejected"),meta:{arg:r,requestId:t,rejectedWithValue:o,requestStatus:"rejected",aborted:i,condition:a}}})),a="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(u,s,c){var l,f=ke(),p=new a,d=new Promise((function(e,t){return p.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:l||"Aborted"})}))})),h=!1,v=function(){try{var a,l=function(e){return v?e:(n&&!n.dispatchConditionRejection&&i.match(a)&&a.meta.condition||u(a),a)},v=!1,b=function(l,v){try{var b=function(){if(n&&n.condition&&!1===n.condition(e,{getState:s,extra:c}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return h=!0,u(o(f,e)),Promise.resolve(Promise.race([d,Promise.resolve(t(e,{dispatch:u,getState:s,extra:c,requestId:f,signal:p.signal,rejectWithValue:function(e){return new De(e)}})).then((function(t){return t instanceof De?i(t,f,e):r(t,f,e)}))])).then((function(e){a=e}))}()}catch(e){return v(e)}return b&&b.then?b.then(void 0,v):b}(0,(function(t){a=i(t,f,e)}));return Promise.resolve(b&&b.then?b.then(l):l(b))}catch(e){return Promise.reject(e)}}();return Object.assign(v,{abort:function(e){h&&(l=e,p.abort())},requestId:f,arg:e})}}),{pending:o,rejected:i,fulfilled:r,typePrefix:e})}function Ne(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}var Le=function(e,t){return function(e){return e&&"function"==typeof e.match}(e)?e.match(t):e(t)};function Fe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.some((function(t){return Le(t,e)}))}}function Ue(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.every((function(t){return Le(t,e)}))}}function Ve(e,t){if(!e||!e.meta)return!1;var n="string"==typeof e.meta.requestId,r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function He(e){return"function"==typeof e[0]&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Be(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return Ve(e,["pending"])}:He(t)?function(e){var n=t.map((function(e){return e.pending}));return Fe.apply(void 0,n)(e)}:Be()(t[0])}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return Ve(e,["rejected"])}:He(t)?function(e){var n=t.map((function(e){return e.rejected}));return Fe.apply(void 0,n)(e)}:We()(t[0])}function ze(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=function(e){return e&&e.meta&&e.meta.rejectedWithValue};return 0===t.length||He(t)?function(e){return Ue(We.apply(void 0,t),r)(e)}:ze()(t[0])}function $e(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return Ve(e,["fulfilled"])}:He(t)?function(e){var n=t.map((function(e){return e.fulfilled}));return Fe.apply(void 0,n)(e)}:$e()(t[0])}function Ye(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return Ve(e,["pending","fulfilled","rejected"])}:He(t)?function(e){var n=[],r=t,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var a;if(o){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var u=a;n.push(u.pending,u.rejected,u.fulfilled)}return Fe.apply(void 0,n)(e)}:Ye()(t[0])}!function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[$];return K.get(t,e)},set:function(t){var n=this[$];K.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][$];if(!o.P)switch(o.i){case 5:r(o)&&I(o);break;case 4:n(o)&&I(o)}}}function n(e){for(var t=e.t,n=e.k,r=q(n),o=r.length-1;o>=0;o--){var i=r[o];if(i!==$){var a=t[i];if(void 0===a&&!c(t,i))return!0;var u=n[i],s=u&&u[$];if(s?s.t!==a:!f(u,a))return!0}}var l=!!t[$];return r.length!==q(t).length+(l?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!n||n.get)}var i={};!function(e,t){G[e]||(G[e]=t)}("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var i=X(n);delete i[$];for(var a=q(i),u=0;u<a.length;u++){var s=a[u];i[s]=e(s,t||!!i[s].enumerable)}return Object.create(Object.getPrototypeOf(n),i)}(r,t),i={i:r?5:4,A:n?n.A:O(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,g:!1,C:!1};return Object.defineProperty(o,$,{value:i,writable:!0}),o},S:function(e,n,i){i?o(n)&&n[$].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[$];if(n){var o=n.t,i=n.k,a=n.D,s=n.i;if(4===s)u(i,(function(t){t!==$&&(void 0!==o[t]||c(o,t)?a[t]||e(i[t]):(a[t]=!0,I(n)))})),u(o,(function(e){void 0!==i[e]||c(i,e)||(a[e]=!1,I(n))}));else if(5===s){if(r(n)&&(I(n),a.length=!0),i.length<o.length)for(var l=i.length;l<o.length;l++)a[l]=!1;else for(var f=o.length;f<i.length;f++)a[f]=!0;for(var p=Math.min(i.length,o.length),d=0;d<p;d++)void 0===a[d]&&e(i[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}()},,,,,,,,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 c})),n.d(t,"b",(function(){return h})),n.d(t,"c",(function(){return f})),n.d(t,"d",(function(){return d})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return l}));var r=n(0),o=n(169);n(170),n(287);var i=n(133),a=n(154),u=Object.prototype.hasOwnProperty,s=Object(r.createContext)("undefined"!=typeof HTMLElement?Object(o.a)({key:"css"}):null),c=s.Provider,l=function(e){return Object(r.forwardRef)((function(t,n){var o=Object(r.useContext)(s);return e(t,o,n)}))},f=Object(r.createContext)({}),p="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",d=function(e,t){var n={};for(var r in t)u.call(t,r)&&(n[r]=t[r]);return n[p]=e,n},h=l((function(e,t,n){var o=e.css;"string"==typeof o&&void 0!==t.registered[o]&&(o=t.registered[o]);var s=e[p],c=[o],l="";"string"==typeof e.className?l=Object(i.a)(t.registered,c,e.className):null!=e.className&&(l=e.className+" ");var d=Object(a.a)(c,void 0,"function"==typeof o||Array.isArray(o)?Object(r.useContext)(f):void 0);Object(i.b)(t,d,"string"==typeof s),l+=t.key+"-"+d.name;var h={};for(var v in e)u.call(e,v)&&"css"!==v&&v!==p&&(h[v]=e[v]);return h.ref=n,h.className=l,Object(r.createElement)(s,h)}))},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){"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.r(t),n.d(t,"createBrowserHistory",(function(){return m})),n.d(t,"createHashHistory",(function(){return S})),n.d(t,"createMemoryHistory",(function(){return _})),n.d(t,"createLocation",(function(){return d})),n.d(t,"locationsAreEqual",(function(){return h})),n.d(t,"parsePath",(function(){return f})),n.d(t,"createPath",(function(){return p}));var r=n(13),o=n(164),i=n(165),a=n(30);function u(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 l(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function f(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}}function p(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 d(e,t,n,i){var a;"string"==typeof e?(a=f(e)).state=t:(void 0===(a=Object(r.a)({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==t&&void 0===a.state&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(a.key=n),i?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=Object(o.a)(a.pathname,i.pathname)):a.pathname=i.pathname:a.pathname||(a.pathname="/"),a}function h(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&Object(i.a)(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 b=!("undefined"==typeof window||!window.document||!window.document.createElement);function y(e,t){t(window.confirm(e))}function g(){try{return window.history.state||{}}catch(e){return{}}}function m(e){void 0===e&&(e={}),b||Object(a.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")),s=e,f=s.forceRefresh,h=void 0!==f&&f,m=s.getUserConfirmation,O=void 0===m?y:m,w=s.keyLength,x=void 0===w?6:w,j=e.basename?l(u(e.basename)):"";function S(e){var t=e||{},n=t.key,r=t.state,o=window.location,i=o.pathname+o.search+o.hash;return j&&(i=c(i,j)),d(i,r,n)}function E(){return Math.random().toString(36).substr(2,x)}var _=v();function P(e){Object(r.a)(U,e),U.length=n.length,_.notifyListeners(U.location,U.action)}function C(e){(function(e){return void 0===e.state&&-1===navigator.userAgent.indexOf("CriOS")})(e)||k(S(e.state))}function A(){k(S(g()))}var M=!1;function k(e){M?(M=!1,P()):_.confirmTransitionTo(e,"POP",O,(function(t){t?P({action:"POP",location:e}):function(e){var t=U.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&&(M=!0,T(o))}(e)}))}var I=S(g()),D=[I.key];function R(e){return j+p(e)}function T(e){n.go(e)}var N=0;function L(e){1===(N+=e)&&1===e?(window.addEventListener("popstate",C),i&&window.addEventListener("hashchange",A)):0===N&&(window.removeEventListener("popstate",C),i&&window.removeEventListener("hashchange",A))}var F=!1,U={length:n.length,action:"POP",location:I,createHref:R,push:function(e,t){var r=d(e,t,E(),U.location);_.confirmTransitionTo(r,"PUSH",O,(function(e){if(e){var t=R(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(U.location.key),s=D.slice(0,u+1);s.push(r.key),D=s,P({action:"PUSH",location:r})}else window.location.href=t}}))},replace:function(e,t){var r=d(e,t,E(),U.location);_.confirmTransitionTo(r,"REPLACE",O,(function(e){if(e){var t=R(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(U.location.key);-1!==u&&(D[u]=r.key),P({action:"REPLACE",location:r})}else window.location.replace(t)}}))},go:T,goBack:function(){T(-1)},goForward:function(){T(1)},block:function(e){void 0===e&&(e=!1);var t=_.setPrompt(e);return F||(L(1),F=!0),function(){return F&&(F=!1,L(-1)),t()}},listen:function(e){var t=_.appendListener(e);return L(1),function(){L(-1),t()}}};return U}var O={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:u},slash:{encodePath:u,decodePath:u}};function w(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function x(){var e=window.location.href,t=e.indexOf("#");return-1===t?"":e.substring(t+1)}function j(e){window.location.replace(w(window.location.href)+"#"+e)}function S(e){void 0===e&&(e={}),b||Object(a.a)(!1);var t=window.history,n=(window.navigator.userAgent.indexOf("Firefox"),e),o=n.getUserConfirmation,i=void 0===o?y:o,s=n.hashType,f=void 0===s?"slash":s,h=e.basename?l(u(e.basename)):"",g=O[f],m=g.encodePath,S=g.decodePath;function E(){var e=S(x());return h&&(e=c(e,h)),d(e)}var _=v();function P(e){Object(r.a)(U,e),U.length=t.length,_.notifyListeners(U.location,U.action)}var C=!1,A=null;function M(){var e,t,n=x(),r=m(n);if(n!==r)j(r);else{var o=E(),a=U.location;if(!C&&(t=o,(e=a).pathname===t.pathname&&e.search===t.search&&e.hash===t.hash))return;if(A===p(o))return;A=null,function(e){C?(C=!1,P()):_.confirmTransitionTo(e,"POP",i,(function(t){t?P({action:"POP",location:e}):function(e){var t=U.location,n=R.lastIndexOf(p(t));-1===n&&(n=0);var r=R.lastIndexOf(p(e));-1===r&&(r=0);var o=n-r;o&&(C=!0,T(o))}(e)}))}(o)}}var k=x(),I=m(k);k!==I&&j(I);var D=E(),R=[p(D)];function T(e){t.go(e)}var N=0;function L(e){1===(N+=e)&&1===e?window.addEventListener("hashchange",M):0===N&&window.removeEventListener("hashchange",M)}var F=!1,U={length:t.length,action:"POP",location:D,createHref:function(e){var t=document.querySelector("base"),n="";return t&&t.getAttribute("href")&&(n=w(window.location.href)),n+"#"+m(h+p(e))},push:function(e,t){var n=d(e,void 0,void 0,U.location);_.confirmTransitionTo(n,"PUSH",i,(function(e){if(e){var t=p(n),r=m(h+t);if(x()!==r){A=t,function(e){window.location.hash=e}(r);var o=R.lastIndexOf(p(U.location)),i=R.slice(0,o+1);i.push(t),R=i,P({action:"PUSH",location:n})}else P()}}))},replace:function(e,t){var n=d(e,void 0,void 0,U.location);_.confirmTransitionTo(n,"REPLACE",i,(function(e){if(e){var t=p(n),r=m(h+t);x()!==r&&(A=t,j(r));var o=R.indexOf(p(U.location));-1!==o&&(R[o]=t),P({action:"REPLACE",location:n})}}))},go:T,goBack:function(){T(-1)},goForward:function(){T(1)},block:function(e){void 0===e&&(e=!1);var t=_.setPrompt(e);return F||(L(1),F=!0),function(){return F&&(F=!1,L(-1)),t()}},listen:function(e){var t=_.appendListener(e);return L(1),function(){L(-1),t()}}};return U}function E(e,t,n){return Math.min(Math.max(e,t),n)}function _(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,s=t.keyLength,c=void 0===s?6:s,l=v();function f(e){Object(r.a)(O,e),O.length=O.entries.length,l.notifyListeners(O.location,O.action)}function h(){return Math.random().toString(36).substr(2,c)}var b=E(u,0,i.length-1),y=i.map((function(e){return d(e,void 0,"string"==typeof e?h():e.key||h())})),g=p;function m(e){var t=E(O.index+e,0,O.entries.length-1),r=O.entries[t];l.confirmTransitionTo(r,"POP",n,(function(e){e?f({action:"POP",location:r,index:t}):f()}))}var O={length:y.length,action:"POP",location:y[b],index:b,entries:y,createHref:g,push:function(e,t){var r=d(e,t,h(),O.location);l.confirmTransitionTo(r,"PUSH",n,(function(e){if(e){var t=O.index+1,n=O.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=d(e,t,h(),O.location);l.confirmTransitionTo(r,"REPLACE",n,(function(e){e&&(O.entries[O.index]=r,f({action:"REPLACE",location:r}))}))},go:m,goBack:function(){m(-1)},goForward:function(){m(1)},canGo:function(e){var t=O.index+e;return t>=0&&t<O.entries.length},block:function(e){return void 0===e&&(e=!1),l.setPrompt(e)},listen:function(e){return l.appendListener(e)}};return O}},,,function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return 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)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,"a",(function(){return o}))},function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(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&&r(e,t)}n.d(t,"a",(function(){return o}))},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return ie})),n.d(t,"b",(function(){return B})),n.d(t,"c",(function(){return C})),n.d(t,"d",(function(){return Y})),n.d(t,"e",(function(){return W})),n.d(t,"f",(function(){return $}));for(var r=n(7),o=n(3),i=n(53),a=n(54),u=n(55),s=n(134),c=n(0),l=n.n(c),f=n(5),p=n(91),d=n(73),h={name:"7pg0cj-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"},v=function(e){return Object(f.c)("span",Object(r.a)({css:h},e))},b={guidance:function(e){var t=e.isSearchable,n=e.isMulti,r=e.isDisabled,o=e.tabSelectsValue;switch(e.context){case"menu":return"Use Up and Down to choose options".concat(r?"":", press Enter to select the currently focused option",", press Escape to exit the menu").concat(o?", press Tab to select the option and exit the menu":"",".");case"input":return"".concat(e["aria-label"]||"Select"," is focused ").concat(t?",type to refine list":"",", press Down to open the menu, ").concat(n?" 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";default:return""}},onChange:function(e){var t=e.action,n=e.label,r=void 0===n?"":n,o=e.isDisabled;switch(t){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(r,", deselected.");case"select-option":return"option ".concat(r,o?" is disabled. Select another option.":", selected.");default:return""}},onFocus:function(e){var t=e.context,n=e.focused,r=void 0===n?{}:n,o=e.options,i=e.label,a=void 0===i?"":i,u=e.selectValue,s=e.isDisabled,c=e.isSelected,l=function(e,t){return e&&e.length?"".concat(e.indexOf(t)+1," of ").concat(e.length):""};if("value"===t&&u)return"value ".concat(a," focused, ").concat(l(u,r),".");if("menu"===t){var f=s?" disabled":"",p="".concat(c?"selected":"focused").concat(f);return"option ".concat(a," ").concat(p,", ").concat(l(o,r),".")}return""},onFilter:function(e){var t=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(t?" for search term "+t:"",".")}},y=function(e){var t=e.ariaSelection,n=e.focusedOption,r=e.focusedValue,i=e.focusableOptions,a=e.isFocused,u=e.selectValue,s=e.selectProps,p=s.ariaLiveMessages,d=s.getOptionLabel,h=s.inputValue,y=s.isMulti,g=s.isOptionDisabled,m=s.isSearchable,O=s.menuIsOpen,w=s.options,x=s.screenReaderStatus,j=s.tabSelectsValue,S=s["aria-label"],E=s["aria-live"],_=Object(c.useMemo)((function(){return Object(o.k)(Object(o.k)({},b),p||{})}),[p]),P=Object(c.useMemo)((function(){var e,n="";if(t&&_.onChange){var r=t.option,i=t.removedValue,a=t.value,u=i||r||(e=a,Array.isArray(e)?null:e),s=Object(o.k)({isDisabled:u&&g(u),label:u?d(u):""},t);n=_.onChange(s)}return n}),[t,g,d,_]),C=Object(c.useMemo)((function(){var e="",t=n||r,o=!!(n&&u&&u.includes(n));if(t&&_.onFocus){var i={focused:t,label:d(t),isDisabled:g(t),isSelected:o,options:w,context:t===n?"menu":"value",selectValue:u};e=_.onFocus(i)}return e}),[n,r,d,g,_,w,u]),A=Object(c.useMemo)((function(){var e="";if(O&&w.length&&_.onFilter){var t=x({count:i.length});e=_.onFilter({inputValue:h,resultsMessage:t})}return e}),[i,h,O,_,w,x]),M=Object(c.useMemo)((function(){var e="";if(_.guidance){var t=r?"value":O?"menu":"input";e=_.guidance({"aria-label":S,context:t,isDisabled:n&&g(n),isMulti:y,isSearchable:m,tabSelectsValue:j})}return e}),[S,n,r,y,g,m,O,_,j]),k="".concat(C," ").concat(A," ").concat(M);return Object(f.c)(v,{"aria-live":E,"aria-atomic":"false","aria-relevant":"additions text"},a&&Object(f.c)(l.a.Fragment,null,Object(f.c)("span",{id:"aria-selection"},P),Object(f.c)("span",{id:"aria-context"},k)))},g=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],m=new RegExp("["+g.map((function(e){return e.letters})).join("")+"]","g"),O={},w=0;w<g.length;w++)for(var x=g[w],j=0;j<x.letters.length;j++)O[x.letters[j]]=x.base;var S=function(e){return e.replace(m,(function(e){return O[e]}))},E=Object(p.a)(S),_=function(e){return e.replace(/^\s+|\s+$/g,"")},P=function(e){return"".concat(e.label," ").concat(e.value)},C=function(e){return function(t,n){var r=Object(o.k)({ignoreCase:!0,ignoreAccents:!0,stringify:P,trim:!0,matchFrom:"any"},e),i=r.ignoreCase,a=r.ignoreAccents,u=r.stringify,s=r.trim,c=r.matchFrom,l=s?_(n):n,f=s?_(u(t)):u(t);return i&&(l=l.toLowerCase(),f=f.toLowerCase()),a&&(l=E(l),f=S(f)),"start"===c?f.substr(0,l.length)===l:f.indexOf(l)>-1}};function A(e){e.in,e.out,e.onExited,e.appear,e.enter,e.exit;var t=e.innerRef;e.emotion;var n=Object(d.a)(e,["in","out","onExited","appear","enter","exit","innerRef","emotion"]);return Object(f.c)("input",Object(r.a)({ref:t},n,{css:Object(f.b)({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 M=["boxSizing","height","overflow","paddingRight","position"],k={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function I(e){e.preventDefault()}function D(e){e.stopPropagation()}function R(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;0===e?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function T(){return"ontouchstart"in window||navigator.maxTouchPoints}var N=!("undefined"==typeof window||!window.document||!window.document.createElement),L=0,F={capture:!1,passive:!1},U=function(){return document.activeElement&&document.activeElement.blur()},V={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function H(e){var t=e.children,n=e.lockEnabled,r=e.captureEnabled,i=function(e){var t=e.isEnabled,n=e.onBottomArrive,r=e.onBottomLeave,i=e.onTopArrive,a=e.onTopLeave,u=Object(c.useRef)(!1),s=Object(c.useRef)(!1),l=Object(c.useRef)(0),f=Object(c.useRef)(null),p=Object(c.useCallback)((function(e,t){if(null!==f.current){var o=f.current,c=o.scrollTop,l=o.scrollHeight,p=o.clientHeight,d=f.current,h=t>0,v=l-p-c,b=!1;v>t&&u.current&&(r&&r(e),u.current=!1),h&&s.current&&(a&&a(e),s.current=!1),h&&t>v?(n&&!u.current&&n(e),d.scrollTop=l,b=!0,u.current=!0):!h&&-t>c&&(i&&!s.current&&i(e),d.scrollTop=0,b=!0,s.current=!0),b&&function(e){e.preventDefault(),e.stopPropagation()}(e)}}),[]),d=Object(c.useCallback)((function(e){p(e,e.deltaY)}),[p]),h=Object(c.useCallback)((function(e){l.current=e.changedTouches[0].clientY}),[]),v=Object(c.useCallback)((function(e){var t=l.current-e.changedTouches[0].clientY;p(e,t)}),[p]),b=Object(c.useCallback)((function(e){if(e){var t=!!o.C&&{passive:!1};"function"==typeof e.addEventListener&&e.addEventListener("wheel",d,t),"function"==typeof e.addEventListener&&e.addEventListener("touchstart",h,t),"function"==typeof e.addEventListener&&e.addEventListener("touchmove",v,t)}}),[v,h,d]),y=Object(c.useCallback)((function(e){e&&("function"==typeof e.removeEventListener&&e.removeEventListener("wheel",d,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchstart",h,!1),"function"==typeof e.removeEventListener&&e.removeEventListener("touchmove",v,!1))}),[v,h,d]);return Object(c.useEffect)((function(){if(t){var e=f.current;return b(e),function(){y(e)}}}),[t,b,y]),function(e){f.current=e}}({isEnabled:void 0===r||r,onBottomArrive:e.onBottomArrive,onBottomLeave:e.onBottomLeave,onTopArrive:e.onTopArrive,onTopLeave:e.onTopLeave}),a=function(e){var t=e.isEnabled,n=e.accountForScrollbars,r=void 0===n||n,o=Object(c.useRef)({}),i=Object(c.useRef)(null),a=Object(c.useCallback)((function(e){if(N){var t=document.body,n=t&&t.style;if(r&&M.forEach((function(e){var t=n&&n[e];o.current[e]=t})),r&&L<1){var i=parseInt(o.current.paddingRight,10)||0,a=document.body?document.body.clientWidth:0,u=window.innerWidth-a+i||0;Object.keys(k).forEach((function(e){var t=k[e];n&&(n[e]=t)})),n&&(n.paddingRight="".concat(u,"px"))}t&&T()&&(t.addEventListener("touchmove",I,F),e&&(e.addEventListener("touchstart",R,F),e.addEventListener("touchmove",D,F))),L+=1}}),[]),u=Object(c.useCallback)((function(e){if(N){var t=document.body,n=t&&t.style;L=Math.max(L-1,0),r&&L<1&&M.forEach((function(e){var t=o.current[e];n&&(n[e]=t)})),t&&T()&&(t.removeEventListener("touchmove",I,F),e&&(e.removeEventListener("touchstart",R,F),e.removeEventListener("touchmove",D,F)))}}),[]);return Object(c.useEffect)((function(){if(t){var e=i.current;return a(e),function(){u(e)}}}),[t,a,u]),function(e){i.current=e}}({isEnabled:n});return Object(f.c)(l.a.Fragment,null,n&&Object(f.c)("div",{onClick:U,css:V}),t((function(e){i(e),a(e)})))}var B=function(e){return e.label},W=function(e){return e.value},z={clearIndicator:o.l,container:o.n,control:o.o,dropdownIndicator:o.p,group:o.q,groupHeading:o.r,indicatorsContainer:o.s,indicatorSeparator:o.t,input:o.u,loadingIndicator:o.v,loadingMessage:o.w,menu:o.x,menuList:o.y,menuPortal:o.z,multiValue:o.A,multiValueLabel:o.B,multiValueRemove:o.D,noOptionsMessage:o.E,option:o.F,placeholder:o.G,singleValue:o.H,valueContainer:o.I};function $(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object(o.k)({},e);return Object.keys(t).forEach((function(r){e[r]?n[r]=function(n,o){return t[r](e[r](n,o),o)}:n[r]=t[r]})),n}var Y={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}},q={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Object(o.J)(),captureMenuScroll:!Object(o.J)(),closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:C(),formatGroupLabel:function(e){return e.label},getOptionLabel:B,getOptionValue:W,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:function(e){return!!e.isDisabled},loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Object(o.a)(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return"".concat(t," result").concat(1!==t?"s":""," available")},styles:{},tabIndex:"0",tabSelectsValue:!0};function X(e,t,n,r){return{type:"option",data:t,isDisabled:ee(e,t,n),isSelected:te(e,t,n),label:Z(e,t),value:Q(e,t),index:r}}function G(e,t){return e.options.map((function(n,r){if(n.options){var o=n.options.map((function(n,r){return X(e,n,t,r)})).filter((function(t){return J(e,t)}));return o.length>0?{type:"group",data:n,options:o,index:r}:void 0}var i=X(e,n,t,r);return J(e,i)?i:void 0})).filter((function(e){return!!e}))}function K(e){return e.reduce((function(e,t){return"group"===t.type?e.push.apply(e,Object(s.a)(t.options.map((function(e){return e.data})))):e.push(t.data),e}),[])}function J(e,t){var n=e.inputValue,r=void 0===n?"":n,o=t.data,i=t.isSelected,a=t.label,u=t.value;return(!re(e)||!i)&&ne(e,{label:a,value:u,data:o},r)}var Z=function(e,t){return e.getOptionLabel(t)},Q=function(e,t){return e.getOptionValue(t)};function ee(e,t,n){return"function"==typeof e.isOptionDisabled&&e.isOptionDisabled(t,n)}function te(e,t,n){if(n.indexOf(t)>-1)return!0;if("function"==typeof e.isOptionSelected)return e.isOptionSelected(t,n);var r=Q(e,t);return n.some((function(t){return Q(e,t)===r}))}function ne(e,t,n){return!e.filterOption||e.filterOption(t,n)}var re=function(e){var t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},oe=1,ie=function(e){Object(u.a)(n,e);var t=Object(o.j)(n);function n(e){var r;return Object(i.a)(this,n),(r=t.call(this,e)).state={ariaSelection:null,focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0},r.blockOptionHover=!1,r.isComposing=!1,r.commonProps=void 0,r.initialTouchX=0,r.initialTouchY=0,r.instancePrefix="",r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.controlRef=null,r.getControlRef=function(e){r.controlRef=e},r.focusedOptionRef=null,r.getFocusedOptionRef=function(e){r.focusedOptionRef=e},r.menuListRef=null,r.getMenuListRef=function(e){r.menuListRef=e},r.inputRef=null,r.getInputRef=function(e){r.inputRef=e},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(e,t){var n=r.props,o=n.onChange,i=n.name;t.name=i,r.ariaOnChange(e,t),o(e,t)},r.setValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"set-value",n=arguments.length>2?arguments[2]:void 0,o=r.props,i=o.closeMenuOnSelect,a=o.isMulti;r.onInputChange("",{action:"set-value"}),i&&(r.setState({inputIsHiddenAfterUpdate:!a}),r.onMenuClose()),r.setState({clearFocusValueOnUpdate:!0}),r.onChange(e,{action:t,option:n})},r.selectOption=function(e){var t=r.props,n=t.blurInputOnSelect,o=t.isMulti,i=t.name,a=r.state.selectValue,u=o&&r.isOptionSelected(e,a),c=r.isOptionDisabled(e,a);if(u){var l=r.getOptionValue(e);r.setValue(a.filter((function(e){return r.getOptionValue(e)!==l})),"deselect-option",e)}else{if(c)return void r.ariaOnChange(e,{action:"select-option",name:i});o?r.setValue([].concat(Object(s.a)(a),[e]),"select-option",e):r.setValue(e,"select-option")}n&&r.blurInput()},r.removeValue=function(e){var t=r.props.isMulti,n=r.state.selectValue,o=r.getOptionValue(e),i=n.filter((function(e){return r.getOptionValue(e)!==o})),a=t?i:i[0]||null;r.onChange(a,{action:"remove-value",removedValue:e}),r.focusInput()},r.clearValue=function(){var e=r.state.selectValue;r.onChange(r.props.isMulti?[]:null,{action:"clear",removedValues:e})},r.popValue=function(){var e=r.props.isMulti,t=r.state.selectValue,n=t[t.length-1],o=t.slice(0,t.length-1),i=e?o:o[0]||null;r.onChange(i,{action:"pop-value",removedValue:n})},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.b.apply(void 0,[r.props.classNamePrefix].concat(t))},r.getOptionLabel=function(e){return Z(r.props,e)},r.getOptionValue=function(e){return Q(r.props,e)},r.getStyles=function(e,t){var n=z[e](t);n.boxSizing="border-box";var o=r.props.styles[e];return o?o(n,t):n},r.getElementId=function(e){return"".concat(r.instancePrefix,"-").concat(e)},r.getComponents=function(){return Object(o.c)(r.props)},r.buildCategorizedOptions=function(){return G(r.props,r.state.selectValue)},r.getCategorizedOptions=function(){return r.props.menuIsOpen?r.buildCategorizedOptions():[]},r.buildFocusableOptions=function(){return K(r.buildCategorizedOptions())},r.getFocusableOptions=function(){return r.props.menuIsOpen?r.buildFocusableOptions():[]},r.ariaOnChange=function(e,t){r.setState({ariaSelection:Object(o.k)({value:e},t)})},r.onMenuMouseDown=function(e){0===e.button&&(e.stopPropagation(),e.preventDefault(),r.focusInput())},r.onMenuMouseMove=function(e){r.blockOptionHover=!1},r.onControlMouseDown=function(e){var t=r.props.openMenuOnClick;r.state.isFocused?r.props.menuIsOpen?"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&r.onMenuClose():t&&r.openMenu("first"):(t&&(r.openAfterFocus=!0),r.focusInput()),"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&e.preventDefault()},r.onDropdownIndicatorMouseDown=function(e){if(!(e&&"mousedown"===e.type&&0!==e.button||r.props.isDisabled)){var t=r.props,n=t.isMulti,o=t.menuIsOpen;r.focusInput(),o?(r.setState({inputIsHiddenAfterUpdate:!n}),r.onMenuClose()):r.openMenu("first"),e.preventDefault(),e.stopPropagation()}},r.onClearIndicatorMouseDown=function(e){e&&"mousedown"===e.type&&0!==e.button||(r.clearValue(),e.stopPropagation(),r.openAfterFocus=!1,"touchend"===e.type?r.focusInput():setTimeout((function(){return r.focusInput()})))},r.onScroll=function(e){"boolean"==typeof r.props.closeMenuOnScroll?e.target instanceof HTMLElement&&Object(o.d)(e.target)&&r.props.onMenuClose():"function"==typeof r.props.closeMenuOnScroll&&r.props.closeMenuOnScroll(e)&&r.props.onMenuClose()},r.onCompositionStart=function(){r.isComposing=!0},r.onCompositionEnd=function(){r.isComposing=!1},r.onTouchStart=function(e){var t=e.touches,n=t&&t.item(0);n&&(r.initialTouchX=n.clientX,r.initialTouchY=n.clientY,r.userIsDragging=!1)},r.onTouchMove=function(e){var t=e.touches,n=t&&t.item(0);if(n){var o=Math.abs(n.clientX-r.initialTouchX),i=Math.abs(n.clientY-r.initialTouchY);r.userIsDragging=o>5||i>5}},r.onTouchEnd=function(e){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(e.target)&&r.menuListRef&&!r.menuListRef.contains(e.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(e){r.userIsDragging||r.onControlMouseDown(e)},r.onClearIndicatorTouchEnd=function(e){r.userIsDragging||r.onClearIndicatorMouseDown(e)},r.onDropdownIndicatorTouchEnd=function(e){r.userIsDragging||r.onDropdownIndicatorMouseDown(e)},r.handleInputChange=function(e){var t=e.currentTarget.value;r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange(t,{action:"input-change"}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(e){r.props.onFocus&&r.props.onFocus(e),r.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(e){r.menuListRef&&r.menuListRef.contains(document.activeElement)?r.inputRef.focus():(r.props.onBlur&&r.props.onBlur(e),r.onInputChange("",{action:"input-blur"}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1}))},r.onOptionHover=function(e){r.blockOptionHover||r.state.focusedOption===e||r.setState({focusedOption:e})},r.shouldHideSelectedOptions=function(){return re(r.props)},r.onKeyDown=function(e){var t=r.props,n=t.isMulti,o=t.backspaceRemovesValue,i=t.escapeClearsValue,a=t.inputValue,u=t.isClearable,s=t.isDisabled,c=t.menuIsOpen,l=t.onKeyDown,f=t.tabSelectsValue,p=t.openMenuOnFocus,d=r.state,h=d.focusedOption,v=d.focusedValue,b=d.selectValue;if(!(s||"function"==typeof l&&(l(e),e.defaultPrevented))){switch(r.blockOptionHover=!0,e.key){case"ArrowLeft":if(!n||a)return;r.focusValue("previous");break;case"ArrowRight":if(!n||a)return;r.focusValue("next");break;case"Delete":case"Backspace":if(a)return;if(v)r.removeValue(v);else{if(!o)return;n?r.popValue():u&&r.clearValue()}break;case"Tab":if(r.isComposing)return;if(e.shiftKey||!c||!f||!h||p&&r.isOptionSelected(h,b))return;r.selectOption(h);break;case"Enter":if(229===e.keyCode)break;if(c){if(!h)return;if(r.isComposing)return;r.selectOption(h);break}return;case"Escape":c?(r.setState({inputIsHiddenAfterUpdate:!1}),r.onInputChange("",{action:"menu-close"}),r.onMenuClose()):u&&i&&r.clearValue();break;case" ":if(a)return;if(!c){r.openMenu("first");break}if(!h)return;r.selectOption(h);break;case"ArrowUp":c?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":c?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!c)return;r.focusOption("pageup");break;case"PageDown":if(!c)return;r.focusOption("pagedown");break;case"Home":if(!c)return;r.focusOption("first");break;case"End":if(!c)return;r.focusOption("last");break;default:return}e.preventDefault()}},r.instancePrefix="react-select-"+(r.props.instanceId||++oe),r.state.selectValue=Object(o.e)(e.value),r}return Object(a.a)(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDisabled,r=t.menuIsOpen,i=this.state.isFocused;(i&&!n&&e.isDisabled||i&&r&&!e.menuIsOpen)&&this.focusInput(),i&&n&&!e.isDisabled&&this.setState({isFocused:!1},this.onMenuClose),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Object(o.f)(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close"}),this.props.onMenuClose()}},{key:"onInputChange",value:function(e,t){this.props.onInputChange(e,t)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(e){var t=this,n=this.state,r=n.selectValue,o=n.isFocused,i=this.buildFocusableOptions(),a="first"===e?0:i.length-1;if(!this.props.isMulti){var u=i.indexOf(r[0]);u>-1&&(a=u)}this.scrollToFocusedOptionOnUpdate=!(o&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:i[a]},(function(){return t.onMenuOpen()}))}},{key:"focusValue",value:function(e){var t=this.state,n=t.selectValue,r=t.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var o=n.indexOf(r);r||(o=-1);var i=n.length-1,a=-1;if(n.length){switch(e){case"previous":a=0===o?0:-1===o?i:o-1;break;case"next":o>-1&&o<i&&(a=o+1)}this.setState({inputIsHidden:-1!==a,focusedValue:n[a]})}}}},{key:"focusOption",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"first",t=this.props.pageSize,n=this.state.focusedOption,r=this.getFocusableOptions();if(r.length){var o=0,i=r.indexOf(n);n||(i=-1),"up"===e?o=i>0?i-1:r.length-1:"down"===e?o=(i+1)%r.length:"pageup"===e?(o=i-t)<0&&(o=0):"pagedown"===e?(o=i+t)>r.length-1&&(o=r.length-1):"last"===e&&(o=r.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:r[o],focusedValue:null})}}},{key:"getTheme",value:function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(Y):Object(o.k)(Object(o.k)({},Y),this.props.theme):Y}},{key:"getCommonProps",value:function(){var e=this.clearValue,t=this.cx,n=this.getStyles,r=this.getValue,o=this.selectOption,i=this.setValue,a=this.props,u=a.isMulti,s=a.isRtl,c=a.options;return{clearValue:e,cx:t,getStyles:n,getValue:r,hasValue:this.hasValue(),isMulti:u,isRtl:s,options:c,selectOption:o,selectProps:a,setValue:i,theme:this.getTheme()}}},{key:"hasValue",value:function(){return this.state.selectValue.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var e=this.props,t=e.isClearable,n=e.isMulti;return void 0===t?n:t}},{key:"isOptionDisabled",value:function(e,t){return ee(this.props,e,t)}},{key:"isOptionSelected",value:function(e,t){return te(this.props,e,t)}},{key:"filterOption",value:function(e,t){return ne(this.props,e,t)}},{key:"formatOptionLabel",value: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)}},{key:"formatGroupLabel",value:function(e){return this.props.formatGroupLabel(e)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var e=this.props,t=e.isDisabled,n=e.isSearchable,i=e.inputId,a=e.inputValue,u=e.tabIndex,s=e.form,c=this.getComponents().Input,f=this.state.inputIsHidden,p=this.commonProps,d=i||this.getElementId("input"),h={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};return n?l.a.createElement(c,Object(r.a)({},p,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:d,innerRef:this.getInputRef,isDisabled:t,isHidden:f,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:u,form:s,type:"text",value:a},h)):l.a.createElement(A,Object(r.a)({id:d,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:o.g,onFocus:this.onInputFocus,readOnly:!0,disabled:t,tabIndex:u,form:s,value:""},h))}},{key:"renderPlaceholderOrValue",value:function(){var e=this,t=this.getComponents(),n=t.MultiValue,o=t.MultiValueContainer,i=t.MultiValueLabel,a=t.MultiValueRemove,u=t.SingleValue,s=t.Placeholder,c=this.commonProps,f=this.props,p=f.controlShouldRenderValue,d=f.isDisabled,h=f.isMulti,v=f.inputValue,b=f.placeholder,y=this.state,g=y.selectValue,m=y.focusedValue,O=y.isFocused;if(!this.hasValue()||!p)return v?null:l.a.createElement(s,Object(r.a)({},c,{key:"placeholder",isDisabled:d,isFocused:O}),b);if(h)return g.map((function(t,u){var s=t===m;return l.a.createElement(n,Object(r.a)({},c,{components:{Container:o,Label:i,Remove:a},isFocused:s,isDisabled:d,key:"".concat(e.getOptionValue(t)).concat(u),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(v)return null;var w=g[0];return l.a.createElement(u,Object(r.a)({},c,{data:w,isDisabled:d}),this.formatOptionLabel(w,"value"))}},{key:"renderClearIndicator",value:function(){var e=this.getComponents().ClearIndicator,t=this.commonProps,n=this.props,o=n.isDisabled,i=n.isLoading,a=this.state.isFocused;if(!this.isClearable()||!e||o||!this.hasValue()||i)return null;var u={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return l.a.createElement(e,Object(r.a)({},t,{innerProps:u,isFocused:a}))}},{key:"renderLoadingIndicator",value:function(){var e=this.getComponents().LoadingIndicator,t=this.commonProps,n=this.props,o=n.isDisabled,i=n.isLoading,a=this.state.isFocused;return e&&i?l.a.createElement(e,Object(r.a)({},t,{innerProps:{"aria-hidden":"true"},isDisabled:o,isFocused:a})):null}},{key:"renderIndicatorSeparator",value:function(){var e=this.getComponents(),t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var o=this.commonProps,i=this.props.isDisabled,a=this.state.isFocused;return l.a.createElement(n,Object(r.a)({},o,{isDisabled:i,isFocused:a}))}},{key:"renderDropdownIndicator",value:function(){var e=this.getComponents().DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,o=this.state.isFocused,i={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return l.a.createElement(e,Object(r.a)({},t,{innerProps:i,isDisabled:n,isFocused:o}))}},{key:"renderMenu",value:function(){var e=this,t=this.getComponents(),n=t.Group,i=t.GroupHeading,a=t.Menu,u=t.MenuList,s=t.MenuPortal,c=t.LoadingMessage,f=t.NoOptionsMessage,p=t.Option,d=this.commonProps,h=this.state.focusedOption,v=this.props,b=v.captureMenuScroll,y=v.inputValue,g=v.isLoading,m=v.loadingMessage,O=v.minMenuHeight,w=v.maxMenuHeight,x=v.menuIsOpen,j=v.menuPlacement,S=v.menuPosition,E=v.menuPortalTarget,_=v.menuShouldBlockScroll,P=v.menuShouldScrollIntoView,C=v.noOptionsMessage,A=v.onMenuScrollToTop,M=v.onMenuScrollToBottom;if(!x)return null;var k,I=function(t,n){var o=t.type,i=t.data,a=t.isDisabled,u=t.isSelected,s=t.label,c=t.value,f=h===i,v=a?void 0:function(){return e.onOptionHover(i)},b=a?void 0:function(){return e.selectOption(i)},y="".concat(e.getElementId("option"),"-").concat(n),g={id:y,onClick:b,onMouseMove:v,onMouseOver:v,tabIndex:-1};return l.a.createElement(p,Object(r.a)({},d,{innerProps:g,data:i,isDisabled:a,isSelected:u,key:y,label:s,type:o,value:c,isFocused:f,innerRef:f?e.getFocusedOptionRef:void 0}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())k=this.getCategorizedOptions().map((function(t){if("group"===t.type){var o=t.data,a=t.options,u=t.index,s="".concat(e.getElementId("group"),"-").concat(u),c="".concat(s,"-heading");return l.a.createElement(n,Object(r.a)({},d,{key:s,data:o,options:a,Heading:i,headingProps:{id:c,data:t.data},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return I(e,"".concat(u,"-").concat(e.index))})))}if("option"===t.type)return I(t,"".concat(t.index))}));else if(g){var D=m({inputValue:y});if(null===D)return null;k=l.a.createElement(c,d,D)}else{var R=C({inputValue:y});if(null===R)return null;k=l.a.createElement(f,d,R)}var T={minMenuHeight:O,maxMenuHeight:w,menuPlacement:j,menuPosition:S,menuShouldScrollIntoView:P},N=l.a.createElement(o.i,Object(r.a)({},d,T),(function(t){var n=t.ref,o=t.placerProps,i=o.placement,s=o.maxHeight;return l.a.createElement(a,Object(r.a)({},d,T,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:g,placement:i}),l.a.createElement(H,{captureEnabled:b,onTopArrive:A,onBottomArrive:M,lockEnabled:_},(function(t){return l.a.createElement(u,Object(r.a)({},d,{innerRef:function(n){e.getMenuListRef(n),t(n)},isLoading:g,maxHeight:s,focusedOption:h}),k)})))}));return E||"fixed"===S?l.a.createElement(s,Object(r.a)({},d,{appendTo:E,controlElement:this.controlRef,menuPlacement:j,menuPosition:S}),N):N}},{key:"renderFormField",value:function(){var e=this,t=this.props,n=t.delimiter,r=t.isDisabled,o=t.isMulti,i=t.name,a=this.state.selectValue;if(i&&!r){if(o){if(n){var u=a.map((function(t){return e.getOptionValue(t)})).join(n);return l.a.createElement("input",{name:i,type:"hidden",value:u})}var s=a.length>0?a.map((function(t,n){return l.a.createElement("input",{key:"i-".concat(n),name:i,type:"hidden",value:e.getOptionValue(t)})})):l.a.createElement("input",{name:i,type:"hidden"});return l.a.createElement("div",null,s)}var c=a[0]?this.getOptionValue(a[0]):"";return l.a.createElement("input",{name:i,type:"hidden",value:c})}}},{key:"renderLiveRegion",value:function(){var e=this.commonProps,t=this.state,n=t.ariaSelection,o=t.focusedOption,i=t.focusedValue,a=t.isFocused,u=t.selectValue,s=this.getFocusableOptions();return l.a.createElement(y,Object(r.a)({},e,{ariaSelection:n,focusedOption:o,focusedValue:i,isFocused:a,selectValue:u,focusableOptions:s}))}},{key:"render",value:function(){var e=this.getComponents(),t=e.Control,n=e.IndicatorsContainer,o=e.SelectContainer,i=e.ValueContainer,a=this.props,u=a.className,s=a.id,c=a.isDisabled,f=a.menuIsOpen,p=this.state.isFocused,d=this.commonProps=this.getCommonProps();return l.a.createElement(o,Object(r.a)({},d,{className:u,innerProps:{id:s,onKeyDown:this.onKeyDown},isDisabled:c,isFocused:p}),this.renderLiveRegion(),l.a.createElement(t,Object(r.a)({},d,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:c,isFocused:p,menuIsOpen:f}),l.a.createElement(i,Object(r.a)({},d,{isDisabled:c}),this.renderPlaceholderOrValue(),this.renderInput()),l.a.createElement(n,Object(r.a)({},d,{isDisabled:c}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,r=t.clearFocusValueOnUpdate,i=t.inputIsHiddenAfterUpdate,a=e.options,u=e.value,s=e.menuIsOpen,c=e.inputValue,l={};if(n&&(u!==n.value||a!==n.options||s!==n.menuIsOpen||c!==n.inputValue)){var f=Object(o.e)(u),p=s?function(e,t){return K(G(e,t))}(e,f):[],d=r?function(e,t){var n=e.focusedValue,r=e.selectValue.indexOf(n);if(r>-1){if(t.indexOf(n)>-1)return n;if(r<t.length)return t[r]}return null}(t,f):null;l={selectValue:f,focusedOption:function(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}(t,p),focusedValue:d,clearFocusValueOnUpdate:!1}}var h=null!=i&&e!==n?{inputIsHidden:i,inputIsHiddenAfterUpdate:void 0}:{};return Object(o.k)(Object(o.k)(Object(o.k)({},l),h),{},{prevProps:e})}}]),n}(c.Component);ie.defaultProps=q},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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=c(n(560)),o=c(n(636)),i=c(n(662)),a=c(n(663)),u=c(n(664)),s=c(n(665));function c(e){return e&&e.__esModule?e:{default:e}}t.hover=a.default,t.handleHover=a.default,t.handleActive=u.default,t.loop=s.default;var l=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),s=(0,o.default)(e,u);return(0,i.default)(s)};t.default=l},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return b})),n.d(t,"c",(function(){return f})),n.d(t,"d",(function(){return c})),n.d(t,"e",(function(){return v})),n.d(t,"f",(function(){return u}));var r=n(129),o=function(){return Math.random().toString(36).substring(7).split("").join(".")},i={INIT:"@@redux/INIT"+o(),REPLACE:"@@redux/REPLACE"+o(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+o()}};function a(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function u(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(u)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var s=e,c=t,l=[],f=l,p=!1;function d(){f===l&&(f=l.slice())}function h(){if(p)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return c}function v(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(p)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var t=!0;return d(),f.push(e),function(){if(t){if(p)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");t=!1,d();var n=f.indexOf(e);f.splice(n,1),l=null}}}function b(e){if(!a(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,c=s(c,e)}finally{p=!1}for(var t=l=f,n=0;n<t.length;n++)(0,t[n])();return e}function y(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");s=e,b({type:i.REPLACE})}function g(){var e,t=v;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(h())}return n(),{unsubscribe:t(n)}}})[r.a]=function(){return this},e}return b({type:i.INIT}),(o={dispatch:b,subscribe:v,getState:h,replaceReducer:y})[r.a]=g,o}function s(e,t){var n=t&&t.type;return"Given "+(n&&'action "'+String(n)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function c(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var a,u=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:i.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:i.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+i.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var r=!1,o={},i=0;i<u.length;i++){var c=u[i],l=n[c],f=e[c],p=l(f,t);if(void 0===p){var d=s(c,t);throw new Error(d)}o[c]=p,r=r||p!==f}return(r=r||u.length!==Object.keys(e).length)?o:e}}function l(e,t){return function(){return t(e.apply(this,arguments))}}function f(e,t){if("function"==typeof e)return l(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var n={};for(var r in e){var o=e[r];"function"==typeof o&&(n[r]=l(o,t))}return n}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 d(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(n,!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function v(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function b(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=t.map((function(e){return e(o)}));return h({},n,{dispatch:r=v.apply(void 0,i)(n.dispatch)})}}}},function(e,t,n){"use strict";function r(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}n.d(t,"a",(function(){return r}))},,,,function(e,t,n){var r=n(340),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},,function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},,,,,,,,function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},,,,,,function(e,t,n){"use strict";var r=Array.prototype.slice,o=n(301),i=Object.keys,a=i?function(e){return i(e)}:n(470),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=SyntaxError,o=Function,i=TypeError,a=function(e){try{return Function('"use strict"; return ('+e+").constructor;")()}catch(e){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(e){u=null}var s=function(){throw new i},c=u?function(){try{return s}catch(e){try{return u(arguments,"callee").get}catch(e){return s}}}():s,l=n(85)(),f=Object.getPrototypeOf||function(e){return e.__proto__},p=a("async function* () {}"),d=p?p.prototype:void 0,h=d?d.prototype:void 0,v="undefined"==typeof Uint8Array?void 0:f(Uint8Array),b={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":l?f([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":a("async function () {}"),"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":h?f(h):void 0,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":a("function* () {}"),"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?f(f([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l?f((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l?f((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?f(""[Symbol.iterator]()):void 0,"%Symbol%":l?Symbol:void 0,"%SyntaxError%":r,"%ThrowTypeError%":c,"%TypedArray%":v,"%TypeError%":i,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet},y={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=n(44),m=n(176),O=g.call(Function.call,Array.prototype.concat),w=g.call(Function.apply,Array.prototype.splice),x=g.call(Function.call,String.prototype.replace),j=g.call(Function.call,String.prototype.slice),S=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E=/\\(\\)?/g,_=function(e){var t=j(e,0,1),n=j(e,-1);if("%"===t&&"%"!==n)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var o=[];return x(e,S,(function(e,t,n,r){o[o.length]=n?x(r,E,"$1"):t||e})),o},P=function(e,t){var n,o=e;if(m(y,o)&&(o="%"+(n=y[o])[0]+"%"),m(b,o)){var a=b[o];if(void 0===a&&!t)throw new i("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:o,value:a}}throw new r("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new i('"allowMissing" argument must be a boolean');var n=_(e),o=n.length>0?n[0]:"",a=P("%"+o+"%",t),s=a.name,c=a.value,l=!1,f=a.alias;f&&(o=f[0],w(n,O([0,1],f)));for(var p=1,d=!0;p<n.length;p+=1){var h=n[p],v=j(h,0,1),y=j(h,-1);if(('"'===v||"'"===v||"`"===v||'"'===y||"'"===y||"`"===y)&&v!==y)throw new r("property names with quotes must have matching quotes");if("constructor"!==h&&d||(l=!0),m(b,s="%"+(o+="."+h)+"%"))c=b[s];else if(null!=c){if(!(h in c)){if(!t)throw new i("base intrinsic for "+e+" exists, but the property is not available.");return}if(u&&p+1>=n.length){var g=u(c,h);c=(d=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:c[h]}else d=m(c,h),c=c[h];d&&!l&&(b[s]=c)}}return c}},,,,function(e,t,n){"use strict";e.exports=n(462)},,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){var r=n(158),o=n(562),i=n(563),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(588),o=n(591);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(368),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},,,,,,,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";function r(e,t,n){var r="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):r+=n+" "})),r}n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));var o=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(t===o?"."+r:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}},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(e){return function(e){if(Array.isArray(e))return r(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 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}}(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.")}()}n.d(t,"a",(function(){return o}))},,,,,,,,,function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},,,,,,,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 p}));var r=n(7),o=n(73),i=n(53),a=n(54),u=n(55),s=n(3),c=n(0),l=n.n(c),f={defaultInputValue:"",defaultMenuIsOpen:!1,defaultValue:null},p=function(e){var t,n;return n=t=function(t){Object(u.a)(c,t);var n=Object(s.j)(c);function c(){var e;Object(i.a)(this,c);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n.call.apply(n,[this].concat(r))).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}return Object(a.a)(c,[{key:"focus",value:function(){this.select.focus()}},{key:"blur",value:function(){this.select.blur()}},{key:"getProp",value:function(e){return void 0!==this.props[e]?this.props[e]:this.state[e]}},{key:"callProp",value: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)}}},{key:"render",value:function(){var t=this,n=this.props;n.defaultInputValue,n.defaultMenuIsOpen,n.defaultValue;var i=Object(o.a)(n,["defaultInputValue","defaultMenuIsOpen","defaultValue"]);return l.a.createElement(e,Object(r.a)({},i,{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")}))}}]),c}(c.Component),t.defaultProps=f,n}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var r=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)},o={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},i=n(286),a=/[A-Z]|^ms/g,u=/_EMO_([^_]+?)_([^]*?)_EMO_/g,s=function(e){return 45===e.charCodeAt(1)},c=function(e){return null!=e&&"boolean"!=typeof e},l=Object(i.a)((function(e){return s(e)?e:e.replace(a,"-$&").toLowerCase()})),f=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(u,(function(e,t,n){return d={name:t,styles:n,next:d},t}))}return 1===o[e]||s(e)||"number"!=typeof t||0===t?t:t+"px"};function p(e,t,n){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 d={name:n.name,styles:n.styles,next:d},n.name;if(void 0!==n.styles){var r=n.next;if(void 0!==r)for(;void 0!==r;)d={name:r.name,styles:r.styles,next:d},r=r.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=p(e,t,n[o])+";";else for(var i in n){var a=n[i];if("object"!=typeof a)null!=t&&void 0!==t[a]?r+=i+"{"+t[a]+"}":c(a)&&(r+=l(i)+":"+f(i,a)+";");else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var u=p(e,t,a);switch(i){case"animation":case"animationName":r+=l(i)+":"+u+";";break;default:r+=i+"{"+u+"}"}}else for(var s=0;s<a.length;s++)c(a[s])&&(r+=l(i)+":"+f(i,a[s])+";")}return r}(e,t,n);case"function":if(void 0!==e){var o=d,i=n(e);return d=o,p(e,t,i)}}if(null==t)return n;var a=t[n];return void 0!==a?a:n}var d,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 o=!0,i="";d=void 0;var a=e[0];null==a||void 0===a.raw?(o=!1,i+=p(n,t,a)):i+=a[0];for(var u=1;u<e.length;u++)i+=p(n,t,e[u]),o&&(i+=a[u]);h.lastIndex=0;for(var s,c="";null!==(s=h.exec(i));)c+="-"+s[1];return{name:r(i)+c,styles:i,next:d}}},,,,function(e,t,n){var r=n(77).Symbol;e.exports=r},function(e,t,n){var r=n(342),o=n(570),i=n(183);e.exports=function(e){return i(e)?r(e):o(e)}},function(e,t,n){var r=n(367),o=n(679),i=n(680),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(258),o=n(375);e.exports=function(e){return null!=e&&o(e.length)&&!r(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=s(i),u=s(n(27));function s(e){return e&&e.__esModule?e:{default:e}}var c={position:"absolute",top:0,left:0,visibility:"hidden",height:0,overflow:"scroll",whiteSpace:"pre"},l=["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},p=!("undefined"==typeof window||!window.navigator)&&/MSIE |Trident\/|Edge\//.test(window.navigator.userAgent),d=function(){return p?"_"+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||d(),prevId:e.id},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,null,[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.id;return n!==t.prevId?{inputId:n||d(),prevId:n}:null}}]),o(t,[{key:"componentDidMount",value:function(){this.mounted=!0,this.copyInputStyles(),this.updateInputWidth()}},{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 p&&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){l.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:c},e),this.props.placeholder?a.default.createElement("div",{ref:this.placeHolderSizerRef,style:c},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";var r=n(209),o=n(28),i=(n(170),n(286),function(e,t){return Object(o.c)(function(e,t){var n=-1,r=44;do{switch(Object(o.o)(r)){case 0:38===r&&12===Object(o.i)()&&(t[n]=1),e[n]+=Object(o.f)(o.j-1);break;case 2:e[n]+=Object(o.d)(r);break;case 4:if(44===r){e[++n]=58===Object(o.i)()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=Object(o.e)(r)}}while(r=Object(o.h)());return e}(Object(o.a)(e),t))}),a=new WeakMap,u=function(e){if("rule"===e.type&&e.parent&&e.length){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||a.get(n))&&!r){a.set(e,!0);for(var o=[],u=i(t,o),s=n.props,c=0,l=0;c<u.length;c++)for(var f=0;f<s.length;f++,l++)e.props[l]=o[c]?u[c].replace(/&\f/g,s[f]):s[f]+" "+u[c]}}},s=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}},c=[o.k];t.a=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){document.head.appendChild(e),e.setAttribute("data-s","")}))}var i,a,l=e.stylisPlugins||c,f={},p=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll("style[data-emotion]"),(function(e){var n=e.getAttribute("data-emotion").split(" ");if(n[0]===t){for(var r=1;r<n.length;r++)f[n[r]]=!0;p.push(e)}}));var d,h=[u,s],v=[o.n,Object(o.l)((function(e){d.insert(e)}))],b=Object(o.g)(h.concat(l,v));a=function(e,t,n,r){var i;d=n,i=e?e+"{"+t.styles+"}":t.styles,Object(o.m)(Object(o.b)(i),b),r&&(y.inserted[t.name]=!0)};var y={key:t,sheet:new r.a({key:t,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend}),nonce:e.nonce,inserted:f,registered:{},insert:a};return y.sheet.hydrate(p),y}},function(e,t,n){"use strict";t.a=function(e){var t=new WeakMap;return function(n){if(t.has(n))return t.get(n);var r=e(n);return t.set(n,r),r}}},,,,,,,function(e,t,n){"use strict";var r=n(44),o=n(471),i=o("%Function.prototype.apply%"),a=o("%Function.prototype.call%"),u=o("%Reflect.apply%",!0)||r.call(a,i),s=o("%Object.defineProperty%",!0);if(s)try{s({},"a",{value:1})}catch(e){s=null}e.exports=function(){return u(r,a,arguments)};var c=function(){return u(r,i,arguments)};s?s(e.exports,"apply",{value:c}):e.exports.apply=c},,,,,,function(e,t,n){var r=n(347),o=n(243);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},function(e,t,n){var r=n(578),o=n(579),i=n(580),a=n(581),u=n(582);function s(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])}}s.prototype.clear=r,s.prototype.delete=o,s.prototype.get=i,s.prototype.has=a,s.prototype.set=u,e.exports=s},function(e,t,n){var r=n(249);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(124)(Object,"create");e.exports=r},function(e,t,n){var r=n(600);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(615),o=n(250),i=n(616),a=n(617),u=n(618),s=n(123),c=n(350),l=c(r),f=c(o),p=c(i),d=c(a),h=c(u),v=s;(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=s(e),n="[object Object]"==t?e.constructor:void 0,r=n?c(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case p:return"[object Promise]";case d:return"[object Set]";case h:return"[object WeakMap]"}return t}),e.exports=v},function(e,t,n){var r=n(254);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(362),o=n(363);e.exports=function(e,t,n,i){var a=!n;n||(n={});for(var u=-1,s=t.length;++u<s;){var c=t[u],l=i?i(n[c],e[c],c,n,e):void 0;void 0===l&&(l=e[c]),a?o(n,c,l):r(n,c,l)}return n}},function(e,t,n){var r=n(668),o=n(669),i=n(670),a=n(671),u=n(672);function s(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])}}s.prototype.clear=r,s.prototype.delete=o,s.prototype.get=i,s.prototype.has=a,s.prototype.set=u,e.exports=s},function(e,t,n){var r=n(193);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(257)(Object,"create");e.exports=r},function(e,t,n){var r=n(694);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"MemoryRouter",(function(){return g})),n.d(t,"Prompt",(function(){return O})),n.d(t,"Redirect",(function(){return S})),n.d(t,"Route",(function(){return C})),n.d(t,"Router",(function(){return y})),n.d(t,"StaticRouter",(function(){return R})),n.d(t,"Switch",(function(){return T})),n.d(t,"generatePath",(function(){return j})),n.d(t,"matchPath",(function(){return P})),n.d(t,"useHistory",(function(){return F})),n.d(t,"useLocation",(function(){return U})),n.d(t,"useParams",(function(){return V})),n.d(t,"useRouteMatch",(function(){return H})),n.d(t,"withRouter",(function(){return N})),n.d(t,"BrowserRouter",(function(){return B})),n.d(t,"HashRouter",(function(){return W})),n.d(t,"Link",(function(){return G})),n.d(t,"NavLink",(function(){return Z}));var r=n(38),o=n(0),i=n.n(o),a=(n(27),n(50)),u=n(210),s=n(30),c=n(13),l=n(211),f=n.n(l),p=(n(98),n(49)),d=n(59),h=n.n(d),v=function(e){var t=Object(u.a)();return t.displayName="Router-History",t}(),b=function(e){var t=Object(u.a)();return t.displayName="Router",t}(),y=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(b.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},i.a.createElement(v.Provider,{children:this.props.children||null,value:this.props.history}))},t}(i.a.Component),g=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).history=Object(a.createMemoryHistory)(t.props),t}return Object(r.a)(t,e),t.prototype.render=function(){return i.a.createElement(y,{history:this.history,children:this.props.children})},t}(i.a.Component),m=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 O(e){var t=e.message,n=e.when,r=void 0===n||n;return i.a.createElement(b.Consumer,null,(function(e){if(e||Object(s.a)(!1),!r||e.staticContext)return null;var n=e.history.block;return i.a.createElement(m,{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 w={},x=0;function j(e,t){return void 0===e&&(e="/"),void 0===t&&(t={}),"/"===e?e:function(e){if(w[e])return w[e];var t=f.a.compile(e);return x<1e4&&(w[e]=t,x++),t}(e)(t,{pretty:!0})}function S(e){var t=e.computedMatch,n=e.to,r=e.push,o=void 0!==r&&r;return i.a.createElement(b.Consumer,null,(function(e){e||Object(s.a)(!1);var r=e.history,u=e.staticContext,l=o?r.push:r.replace,f=Object(a.createLocation)(t?"string"==typeof n?j(n,t.params):Object(c.a)({},n,{pathname:j(n.pathname,t.params)}):n);return u?(l(f),null):i.a.createElement(m,{onMount:function(){l(f)},onUpdate:function(e,t){var n=Object(a.createLocation)(t.to);Object(a.locationsAreEqual)(n,Object(c.a)({},f,{key:n.key}))||l(f)},to:n})}))}var E={},_=0;function P(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,s=n.sensitive,c=void 0!==s&&s;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=E[n]||(E[n]={});if(r[e])return r[e];var o=[],i={regexp:f()(e,o,t),keys:o};return _<1e4&&(r[e]=i,_++),i}(n,{end:i,strict:u,sensitive:c}),o=r.regexp,a=r.keys,s=o.exec(e);if(!s)return null;var l=s[0],p=s.slice(1),d=e===l;return i&&!d?null:{path:n,url:"/"===n&&""===l?"/":l,isExact:d,params:a.reduce((function(e,t,n){return e[t.name]=p[n],e}),{})}}),null)}var C=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(b.Consumer,null,(function(t){t||Object(s.a)(!1);var n=e.props.location||t.location,r=e.props.computedMatch?e.props.computedMatch:e.props.path?P(n.pathname,e.props):t.match,o=Object(c.a)({},t,{location:n,match:r}),a=e.props,u=a.children,l=a.component,f=a.render;return Array.isArray(u)&&0===u.length&&(u=null),i.a.createElement(b.Provider,{value:o},o.match?u?"function"==typeof u?u(o):u:l?i.a.createElement(l,o):f?f(o):null:"function"==typeof u?u(o):null)}))},t}(i.a.Component);function A(e){return"/"===e.charAt(0)?e:"/"+e}function M(e,t){if(!e)return t;var n=A(e);return 0!==t.pathname.indexOf(n)?t:Object(c.a)({},t,{pathname:t.pathname.substr(n.length)})}function k(e){return"string"==typeof e?e:Object(a.createPath)(e)}function I(e){return function(){Object(s.a)(!1)}}function D(){}var R=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).handlePush=function(e){return t.navigateTo(e,"PUSH")},t.handleReplace=function(e){return t.navigateTo(e,"REPLACE")},t.handleListen=function(){return D},t.handleBlock=function(){return D},t}Object(r.a)(t,e);var n=t.prototype;return n.navigateTo=function(e,t){var n=this.props,r=n.basename,o=void 0===r?"":r,i=n.context,u=void 0===i?{}:i;u.action=t,u.location=function(e,t){return e?Object(c.a)({},t,{pathname:A(e)+t.pathname}):t}(o,Object(a.createLocation)(e)),u.url=k(u.location)},n.render=function(){var e=this.props,t=e.basename,n=void 0===t?"":t,r=e.context,o=void 0===r?{}:r,u=e.location,s=void 0===u?"/":u,l=Object(p.a)(e,["basename","context","location"]),f={createHref:function(e){return A(n+k(e))},action:"POP",location:M(n,Object(a.createLocation)(s)),push:this.handlePush,replace:this.handleReplace,go:I(),goBack:I(),goForward:I(),listen:this.handleListen,block:this.handleBlock};return i.a.createElement(y,Object(c.a)({},l,{history:f,staticContext:o}))},t}(i.a.Component),T=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(b.Consumer,null,(function(t){t||Object(s.a)(!1);var n,r,o=e.props.location||t.location;return i.a.Children.forEach(e.props.children,(function(e){if(null==r&&i.a.isValidElement(e)){n=e;var a=e.props.path||e.props.from;r=a?P(o.pathname,Object(c.a)({},e.props,{path:a})):t.match}})),r?i.a.cloneElement(n,{location:o,computedMatch:r}):null}))},t}(i.a.Component);function N(e){var t="withRouter("+(e.displayName||e.name)+")",n=function(t){var n=t.wrappedComponentRef,r=Object(p.a)(t,["wrappedComponentRef"]);return i.a.createElement(b.Consumer,null,(function(t){return t||Object(s.a)(!1),i.a.createElement(e,Object(c.a)({},r,t,{ref:n}))}))};return n.displayName=t,n.WrappedComponent=e,h()(n,e)}var L=i.a.useContext;function F(){return L(v)}function U(){return L(b).location}function V(){var e=L(b).match;return e?e.params:{}}function H(e){var t=U(),n=L(b).match;return e?P(t.pathname,e):n}var 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).history=Object(a.createBrowserHistory)(t.props),t}return Object(r.a)(t,e),t.prototype.render=function(){return i.a.createElement(y,{history:this.history,children:this.props.children})},t}(i.a.Component),W=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).history=Object(a.createHashHistory)(t.props),t}return Object(r.a)(t,e),t.prototype.render=function(){return i.a.createElement(y,{history:this.history,children:this.props.children})},t}(i.a.Component),z=function(e,t){return"function"==typeof e?e(t):e},$=function(e,t){return"string"==typeof e?Object(a.createLocation)(e,null,null,t):e},Y=function(e){return e},q=i.a.forwardRef;void 0===q&&(q=Y);var X=q((function(e,t){var n=e.innerRef,r=e.navigate,o=e.onClick,a=Object(p.a)(e,["innerRef","navigate","onClick"]),u=a.target,s=Object(c.a)({},a,{onClick:function(e){try{o&&o(e)}catch(t){throw e.preventDefault(),t}e.defaultPrevented||0!==e.button||u&&"_self"!==u||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e)||(e.preventDefault(),r())}});return s.ref=Y!==q&&t||n,i.a.createElement("a",s)})),G=q((function(e,t){var n=e.component,r=void 0===n?X:n,o=e.replace,a=e.to,u=e.innerRef,l=Object(p.a)(e,["component","replace","to","innerRef"]);return i.a.createElement(b.Consumer,null,(function(e){e||Object(s.a)(!1);var n=e.history,f=$(z(a,e.location),e.location),p=f?n.createHref(f):"",d=Object(c.a)({},l,{href:p,navigate:function(){var t=z(a,e.location);(o?n.replace:n.push)(t)}});return Y!==q?d.ref=t||u:d.innerRef=u,i.a.createElement(r,d)}))})),K=function(e){return e},J=i.a.forwardRef;void 0===J&&(J=K);var Z=J((function(e,t){var n=e["aria-current"],r=void 0===n?"page":n,o=e.activeClassName,a=void 0===o?"active":o,u=e.activeStyle,l=e.className,f=e.exact,d=e.isActive,h=e.location,v=e.sensitive,y=e.strict,g=e.style,m=e.to,O=e.innerRef,w=Object(p.a)(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return i.a.createElement(b.Consumer,null,(function(e){e||Object(s.a)(!1);var n=h||e.location,o=$(z(m,n),n),p=o.pathname,b=p&&p.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),x=b?P(n.pathname,{path:b,exact:f,sensitive:v,strict:y}):null,j=!!(d?d(x,n):x),S=j?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(" ")}(l,a):l,E=j?Object(c.a)({},g,{},u):g,_=Object(c.a)({"aria-current":j&&r||null,className:S,style:E,to:o},w);return K!==J?_.ref=t||O:_.innerRef=O,i.a.createElement(G,_)}))}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(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.prepend=e.prepend,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(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.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=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]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.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){e.exports=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(341),o=n(572);e.exports=function(e,t){return e&&r(e,o(t))}},function(e,t,n){(function(e){var r=n(77),o=n(568),i=t&&!t.nodeType&&t,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,u=a&&a.exports===i?r.Buffer:void 0,s=(u?u.isBuffer:void 0)||o;e.exports=s}).call(this,n(78)(e))},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(340),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(78)(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(346)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(184),o=n(583),i=n(584),a=n(585),u=n(586),s=n(587);function c(e){var t=this.__data__=new r(e);this.size=t.size}c.prototype.clear=o,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=u,c.prototype.set=s,e.exports=c},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(124)(n(77),"Map");e.exports=r},function(e,t,n){var r=n(592),o=n(599),i=n(601),a=n(602),u=n(603);function s(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])}}s.prototype.clear=r,s.prototype.delete=o,s.prototype.get=i,s.prototype.has=a,s.prototype.set=u,e.exports=s},function(e,t,n){var r=n(614),o=n(357),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(71),o=n(254),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(123),o=n(87);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(342),o=n(643),i=n(183);e.exports=function(e){return i(e)?r(e,!0):o(e)}},function(e,t,n){var r=n(353);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t,n){var r=n(678),o=n(684);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},function(e,t,n){var r=n(160),o=n(79);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(370);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){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e){return e}},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=s(o),a=s(n(70)),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(731));function s(e){return e&&e.__esModule?e:{default:e}}var c=t.Checkboard=function(e){var t=e.white,n=e.grey,s=e.size,c=e.renderers,l=e.borderRadius,f=e.boxShadow,p=e.children,d=(0,a.default)({default:{grid:{borderRadius:l,boxShadow:f,absolute:"0px 0px 0px 0px",background:"url("+u.get(t,n,s,c.canvas)+") center left"}}});return(0,o.isValidElement)(p)?i.default.cloneElement(p,r({},p.props,{style:r({},p.props.style,d.grid)})):i.default.createElement("div",{style:d.grid})};c.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}},t.default=c},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"Popper",(function(){return A})),n.d(t,"placements",(function(){return C})),n.d(t,"Manager",(function(){return w})),n.d(t,"Reference",(function(){return D}));var r=n(424),o=n.n(r),i=n(132),a=n.n(i),u=n(23),s=n.n(u),c=n(151),l=n.n(c),f=n(24),p=n.n(f),d=n(166),h=n.n(d),v=n(0),b=n(288),y=n(150),g=n.n(y),m=g()(),O=g()(),w=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,p()(s()(t),"referenceNode",void 0),p()(s()(t),"setReferenceNode",(function(e){e&&t.referenceNode!==e&&(t.referenceNode=e,t.forceUpdate())})),t}l()(t,e);var n=t.prototype;return n.componentWillUnmount=function(){this.referenceNode=null},n.render=function(){return v.createElement(m.Provider,{value:this.referenceNode},v.createElement(O.Provider,{value:this.setReferenceNode},this.props.children))},t}(v.Component),x=function(e){return Array.isArray(e)?e[0]:e},j=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)}},S=function(e,t){if("function"==typeof e)return j(e,t);null!=e&&(e.current=t)},E={position:"absolute",top:0,left:0,opacity:0,pointerEvents:"none"},_={},P=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,p()(s()(t),"state",{data:void 0,placement:void 0}),p()(s()(t),"popperInstance",void 0),p()(s()(t),"popperNode",null),p()(s()(t),"arrowNode",null),p()(s()(t),"setPopperNode",(function(e){e&&t.popperNode!==e&&(S(t.props.innerRef,e),t.popperNode=e,t.updatePopperInstance())})),p()(s()(t),"setArrowNode",(function(e){t.arrowNode=e})),p()(s()(t),"updateStateModifier",{enabled:!0,order:900,fn:function(e){var n=e.placement;return t.setState({data:e,placement:n}),e}}),p()(s()(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})}})),p()(s()(t),"getPopperStyle",(function(){return t.popperNode&&t.state.data?a()({position:t.state.data.offsets.popper.position},t.state.data.styles):E})),p()(s()(t),"getPopperPlacement",(function(){return t.state.data?t.state.placement:void 0})),p()(s()(t),"getArrowStyle",(function(){return t.arrowNode&&t.state.data?t.state.data.arrowStyles:_})),p()(s()(t),"getOutOfBoundariesState",(function(){return t.state.data?t.state.data.hide:void 0})),p()(s()(t),"destroyPopperInstance",(function(){t.popperInstance&&(t.popperInstance.destroy(),t.popperInstance=null)})),p()(s()(t),"updatePopperInstance",(function(){t.destroyPopperInstance();var e=s()(t).popperNode,n=t.props.referenceElement;n&&e&&(t.popperInstance=new b.a(n,e,t.getOptions()))})),p()(s()(t),"scheduleUpdate",(function(){t.popperInstance&&t.popperInstance.scheduleUpdate()})),t}l()(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(){S(this.props.innerRef,null),this.destroyPopperInstance()},n.render=function(){return x(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);p()(P,"defaultProps",{placement:"bottom",eventsEnabled:!0,referenceElement:void 0,positionFixed:!1});var C=b.a.placements;function A(e){var t=e.referenceElement,n=o()(e,["referenceElement"]);return v.createElement(m.Consumer,null,(function(e){return v.createElement(P,a()({referenceElement:void 0!==t?t:e},n))}))}var M=n(90),k=n.n(M),I=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,p()(s()(t),"refHandler",(function(e){S(t.props.innerRef,e),j(t.props.setReferenceNode,e)})),t}l()(t,e);var n=t.prototype;return n.componentWillUnmount=function(){S(this.props.innerRef,null)},n.render=function(){return k()(Boolean(this.props.setReferenceNode),"`Reference` should not be used outside of a `Manager` component."),x(this.props.children)({ref:this.refHandler})},t}(v.Component);function D(e){return v.createElement(O.Consumer,null,(function(t){return v.createElement(I,a()({setReferenceNode:t},e))}))}},function(e,t,n){"use strict";t.a=function(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}},function(e,t,n){"use strict";var r=n(59),o=n.n(r);t.a=function(e,t){return o()(e,t)}},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 s(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:s(u(e))}function c(e){return e&&e.referenceNode?e.referenceNode:e}var l=n&&!(!window.MSInputMethodContext||!document.documentMode),f=n&&/MSIE 10/.test(navigator.userAgent);function p(e){return 11===e?l:10===e?f:l||f}function d(e){if(!e)return document.documentElement;for(var t=p(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")?d(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,s=i.commonAncestorContainer;if(e!==s&&t!==s||r.contains(o))return"BODY"===(u=(a=s).nodeName)||"HTML"!==u&&d(a.firstElementChild)!==a?d(s):s;var c=h(e);return c.host?v(c.host,t):v(e,h(t).host)}function b(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 y(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=b(t,"top"),o=b(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 m(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],p(10)?parseInt(n["offset"+e])+parseInt(r["margin"+("Height"===e?"Top":"Left")])+parseInt(r["margin"+("Height"===e?"Bottom":"Right")]):0)}function O(e){var t=e.body,n=e.documentElement,r=p(10)&&getComputedStyle(n);return{height:m("Height",t,n,r),width:m("Width",t,n,r)}}var w=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},x=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}}(),j=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},S=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 E(e){return S({},e,{right:e.left+e.width,bottom:e.top+e.height})}function _(e){var t={};try{if(p(10)){t=e.getBoundingClientRect();var n=b(e,"top"),r=b(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?O(e.ownerDocument):{},u=i.width||e.clientWidth||o.width,s=i.height||e.clientHeight||o.height,c=e.offsetWidth-u,l=e.offsetHeight-s;if(c||l){var f=a(e);c-=g(f,"x"),l-=g(f,"y"),o.width-=c,o.height-=l}return E(o)}function P(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=p(10),o="HTML"===t.nodeName,i=_(e),u=_(t),c=s(e),l=a(t),f=parseFloat(l.borderTopWidth),d=parseFloat(l.borderLeftWidth);n&&o&&(u.top=Math.max(u.top,0),u.left=Math.max(u.left,0));var h=E({top:i.top-u.top-f,left:i.left-u.left-d,width:i.width,height:i.height});if(h.marginTop=0,h.marginLeft=0,!r&&o){var v=parseFloat(l.marginTop),b=parseFloat(l.marginLeft);h.top-=f-v,h.bottom-=f-v,h.left-=d-b,h.right-=d-b,h.marginTop=v,h.marginLeft=b}return(r&&!n?t.contains(c):t===c&&"BODY"!==c.nodeName)&&(h=y(h,t)),h}function C(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.ownerDocument.documentElement,r=P(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=t?0:b(n),u=t?0:b(n,"left"),s={top:a-r.top+r.marginTop,left:u-r.left+r.marginLeft,width:o,height:i};return E(s)}function A(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&&A(n)}function M(e){if(!e||!e.parentElement||p())return document.documentElement;for(var t=e.parentElement;t&&"none"===a(t,"transform");)t=t.parentElement;return t||document.documentElement}function k(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i={top:0,left:0},a=o?M(e):v(e,c(t));if("viewport"===r)i=C(a,o);else{var l=void 0;"scrollParent"===r?"BODY"===(l=s(u(t))).nodeName&&(l=e.ownerDocument.documentElement):l="window"===r?e.ownerDocument.documentElement:r;var f=P(l,a,o);if("HTML"!==l.nodeName||A(a))i=f;else{var p=O(e.ownerDocument),d=p.height,h=p.width;i.top+=f.top-f.marginTop,i.bottom=d+f.top,i.left+=f.left-f.marginLeft,i.right=h+f.left}}var b="number"==typeof(n=n||0);return i.left+=b?n:n.left||0,i.top+=b?n:n.top||0,i.right-=b?n:n.right||0,i.bottom-=b?n:n.bottom||0,i}function I(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=k(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}},s=Object.keys(u).map((function(e){return S({key:e},u[e],{area:I(u[e])})})).sort((function(e,t){return t.area-e.area})),c=s.filter((function(e){var t=e.width,r=e.height;return t>=n.clientWidth&&r>=n.clientHeight})),l=c.length>0?c[0].key:s[0].key,f=e.split("-")[1];return l+(f?"-"+f:"")}function R(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=r?M(t):v(t,c(n));return P(n,o,r)}function T(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 L(e,t,n){n=n.split("-")[0];var r=T(e),o={width:r.width,height:r.height},i=-1!==["right","left"].indexOf(n),a=i?"top":"left",u=i?"left":"top",s=i?"height":"width",c=i?"width":"height";return o[a]=t[a]+t[s]/2-r[s]/2,o[u]=n===u?t[u]-r[c]:t[N(u)],o}function F(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function U(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=F(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=E(t.offsets.popper),t.offsets.reference=E(t.offsets.reference),t=n(t,e))})),t}function V(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=R(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=L(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=U(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 B(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 W(){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[B("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function z(e){var t=e.ownerDocument;return t?t.defaultView:window}function $(){this.state.eventsEnabled||(this.state=function(e,t,n,r){n.updateBound=r,z(e).addEventListener("resize",n.updateBound,{passive:!0});var o=s(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(s(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 Y(){var e,t;this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=(e=this.reference,t=this.state,z(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 q(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function X(e,t){Object.keys(t).forEach((function(n){var r="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&q(t[n])&&(r="px"),e.style[n]=t[n]+r}))}var G=n&&/Firefox/i.test(navigator.userAgent);function K(e,t,n){var r=F(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 J=["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"],Z=J.slice(3);function Q(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Z.indexOf(e),r=Z.slice(n+1).concat(Z.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),s=u?"left":"top",c=u?"width":"height",l={start:j({},s,i[s]),end:j({},s,i[s]+i[c]-a[c])};e.offsets.popper=S({},a,l[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,s=o.split("-")[0];return n=q(+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(F(a,(function(e){return-1!==e.search(/,|\s/)})));a[u]&&a[u].indexOf(",");var s=/\s*,\s*|\s+/,c=-1!==u?[a.slice(0,u).concat([a[u].split(s)[0]]),[a[u].split(s)[1]].concat(a.slice(u+1))]:[a];return(c=c.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 E(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){q(n)&&(o[t]+=n*("-"===e[r-1]?-1:1))}))})),o}(r,a,u,s),"left"===s?(a.top+=n[0],a.left-=n[1]):"right"===s?(a.top+=n[0],a.left+=n[1]):"top"===s?(a.left+=n[0],a.top-=n[1]):"bottom"===s&&(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||d(e.instance.popper);e.instance.reference===n&&(n=d(n));var r=B("transform"),o=e.instance.popper.style,i=o.top,a=o.left,u=o[r];o.top="",o.left="",o[r]="";var s=k(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=a,o[r]=u,t.boundaries=s;var c=t.priority,l=e.offsets.popper,f={primary:function(e){var n=l[e];return l[e]<s[e]&&!t.escapeWithReference&&(n=Math.max(l[e],s[e])),j({},e,n)},secondary:function(e){var n="right"===e?"left":"top",r=l[n];return l[e]>s[e]&&!t.escapeWithReference&&(r=Math.min(l[n],s[e]-("right"===e?l.width:l.height))),j({},n,r)}};return c.forEach((function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";l=S({},l,f[t](e))})),e.offsets.popper=l,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",s=a?"left":"top",c=a?"width":"height";return n[u]<i(r[s])&&(e.offsets.popper[s]=i(r[s])-n[c]),n[s]>i(r[u])&&(e.offsets.popper[s]=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,s=i.reference,c=-1!==["left","right"].indexOf(o),l=c?"height":"width",f=c?"Top":"Left",p=f.toLowerCase(),d=c?"left":"top",h=c?"bottom":"right",v=T(r)[l];s[h]-v<u[p]&&(e.offsets.popper[p]-=u[p]-(s[h]-v)),s[p]+v>u[h]&&(e.offsets.popper[p]+=s[p]+v-u[h]),e.offsets.popper=E(e.offsets.popper);var b=s[p]+s[l]/2-v/2,y=a(e.instance.popper),g=parseFloat(y["margin"+f]),m=parseFloat(y["border"+f+"Width"]),O=b-e.offsets.popper[p]-g-m;return O=Math.max(Math.min(u[l]-v,O),0),e.arrowElement=r,e.offsets.arrow=(j(n={},p,Math.round(O)),j(n,d,""),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=k(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=Q(r);break;case"counterclockwise":a=Q(r,!0);break;default:a=t.behavior}return a.forEach((function(u,s){if(r!==u||a.length===s+1)return e;r=e.placement.split("-")[0],o=N(r);var c=e.offsets.popper,l=e.offsets.reference,f=Math.floor,p="left"===r&&f(c.right)>f(l.left)||"right"===r&&f(c.left)<f(l.right)||"top"===r&&f(c.bottom)>f(l.top)||"bottom"===r&&f(c.top)<f(l.bottom),d=f(c.left)<f(n.left),h=f(c.right)>f(n.right),v=f(c.top)<f(n.top),b=f(c.bottom)>f(n.bottom),y="left"===r&&d||"right"===r&&h||"top"===r&&v||"bottom"===r&&b,g=-1!==["top","bottom"].indexOf(r),m=!!t.flipVariations&&(g&&"start"===i&&d||g&&"end"===i&&h||!g&&"start"===i&&v||!g&&"end"===i&&b),O=!!t.flipVariationsByContent&&(g&&"start"===i&&h||g&&"end"===i&&d||!g&&"start"===i&&b||!g&&"end"===i&&v),w=m||O;(p||y||w)&&(e.flipped=!0,(p||y)&&(r=a[s+1]),w&&(i=function(e){return"end"===e?"start":"start"===e?"end":e}(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=S({},e.offsets.popper,L(e.instance.popper,e.offsets.reference,e.placement)),e=U(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=E(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=F(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=F(e.instance.modifiers,(function(e){return"applyStyle"===e.name})).gpuAcceleration,s=void 0!==u?u:t.gpuAcceleration,c=d(e.instance.popper),l=_(c),f={position:a.position},p=function(e,t){var n=e.offsets,r=n.popper,o=n.reference,i=Math.round,a=Math.floor,u=function(e){return e},s=i(o.width),c=i(r.width),l=-1!==["left","right"].indexOf(e.placement),f=-1!==e.placement.indexOf("-"),p=t?l||f||s%2==c%2?i:a:u,d=t?i:u;return{left:p(s%2==1&&c%2==1&&!f&&t?r.left-1:r.left),top:d(r.top),bottom:d(r.bottom),right:p(r.right)}}(e,window.devicePixelRatio<2||!G),h="bottom"===o?"top":"bottom",v="right"===i?"left":"right",b=B("transform");if(r="bottom"===h?"HTML"===c.nodeName?-c.clientHeight+p.bottom:-l.height+p.bottom:p.top,n="right"===v?"HTML"===c.nodeName?-c.clientWidth+p.right:-l.width+p.right:p.left,s&&b)f[b]="translate3d("+n+"px, "+r+"px, 0)",f[h]=0,f[v]=0,f.willChange="transform";else{var y="bottom"===h?-1:1,g="right"===v?-1:1;f[h]=r*y,f[v]=n*g,f.willChange=h+", "+v}var m={"x-placement":e.placement};return e.attributes=S({},m,e.attributes),e.styles=S({},f,e.styles),e.arrowStyles=S({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(e){var t,n;return X(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&&X(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,n,r,o){var i=R(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),X(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]:{};w(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=o(this.update.bind(this)),this.options=S({},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(S({},e.Defaults.modifiers,a.modifiers)).forEach((function(t){r.options.modifiers[t]=S({},e.Defaults.modifiers[t]||{},a.modifiers?a.modifiers[t]:{})})),this.modifiers=Object.keys(this.options.modifiers).map((function(e){return S({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 x(e,[{key:"update",value:function(){return V.call(this)}},{key:"destroy",value:function(){return W.call(this)}},{key:"enableEventListeners",value:function(){return $.call(this)}},{key:"disableEventListeners",value:function(){return Y.call(this)}}]),e}();te.Utils=("undefined"!=typeof window?window:e).PopperUtils,te.placements=J,te.Defaults=ee,t.a=te}).call(this,n(16))},,,,,,,,,,,,,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(475).CopyToClipboard;r.CopyToClipboard=r,e.exports=r},,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"NonceProvider",(function(){return h}));var r=n(60);n.d(t,"createFilter",(function(){return r.c})),n.d(t,"defaultTheme",(function(){return r.d})),n.d(t,"mergeStyles",(function(){return r.f}));var o=n(152),i=n(53),a=n(54),u=n(55),s=n(3);n.d(t,"components",(function(){return s.m}));var c=n(0),l=n.n(c),f=n(37),p=n(169),d=n(91),h=(n(531),n(335),n(337),n(239),n(240),n(168),n(338),n(19),function(e){Object(u.a)(n,e);var t=Object(s.j)(n);function n(e){var r;return Object(i.a)(this,n),(r=t.call(this,e)).createEmotionCache=function(e,t){return Object(p.a)({nonce:e,key:t})},r.createEmotionCache=Object(d.a)(r.createEmotionCache),r}return Object(a.a)(n,[{key:"render",value:function(){var e=this.createEmotionCache(this.props.nonce,this.props.cacheKey);return l.a.createElement(f.a,{value:e},this.props.children)}}]),n}(c.Component)),v=Object(o.a)(r.a);t.default=v},function(e,t,n){var r=n(532),o=n(533),i=n(534),a=n(535);e.exports=function(e){return r(e)||o(e)||i(e)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(536);e.exports=function(e,t){if(null==e)return{};var n,o,i=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i},e.exports.default=e.exports,e.exports.__esModule=!0},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},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(16))},function(e,t,n){var r=n(564),o=n(159);e.exports=function(e,t){return e&&r(e,t,o)}},function(e,t,n){var r=n(566),o=n(343),i=n(71),a=n(242),u=n(344),s=n(345),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),f=!n&&!l&&a(e),p=!n&&!l&&!f&&s(e),d=n||l||f||p,h=d?r(e.length,String):[],v=h.length;for(var b in e)!t&&!c.call(e,b)||d&&("length"==b||f&&("offset"==b||"parent"==b)||p&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||u(b,v))||h.push(b);return h}},function(e,t,n){var r=n(567),o=n(87),i=Object.prototype,a=i.hasOwnProperty,u=i.propertyIsEnumerable,s=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!u.call(e,"callee")};e.exports=s},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(569),o=n(244),i=n(245),a=i&&i.isTypedArray,u=a?o(a):r;e.exports=u},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(123),o=n(143);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){e.exports=function(e){return e}},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(604),o=n(87);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(605),o=n(608),i=n(609);e.exports=function(e,t,n,a,u,s){var c=1&n,l=e.length,f=t.length;if(l!=f&&!(c&&f>l))return!1;var p=s.get(e),d=s.get(t);if(p&&d)return p==t&&d==e;var h=-1,v=!0,b=2&n?new r:void 0;for(s.set(e,t),s.set(t,e);++h<l;){var y=e[h],g=t[h];if(a)var m=c?a(g,y,h,t,e,s):a(y,g,h,e,t,s);if(void 0!==m){if(m)continue;v=!1;break}if(b){if(!o(t,(function(e,t){if(!i(b,t)&&(y===e||u(y,e,n,a,s)))return b.push(t)}))){v=!1;break}}else if(y!==g&&!u(y,g,n,a,s)){v=!1;break}}return s.delete(e),s.delete(t),v}},function(e,t,n){var r=n(77).Uint8Array;e.exports=r},function(e,t,n){var r=n(355),o=n(252),i=n(159);e.exports=function(e){return r(e,i,o)}},function(e,t,n){var r=n(356),o=n(71);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(143);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(361),o=n(189);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(71),o=n(253),i=n(622),a=n(625);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(a(e))}},function(e,t,n){var r=n(363),o=n(249),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(640);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(356),o=n(247),i=n(252),a=n(357),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(666),o=n(720)((function(e,t,n){r(e,t,n)}));e.exports=o},function(e,t,n){var r=n(257)(n(125),"Map");e.exports=r},function(e,t,n){var r=n(125).Symbol;e.exports=r},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(16))},function(e,t,n){var r=n(259),o=n(193);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,n){var r=n(257),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){var r=n(698)();e.exports=r},function(e,t,n){var r=n(373)(Object.getPrototypeOf,Object);e.exports=r},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(707),o=n(144),i=Object.prototype,a=i.hasOwnProperty,u=i.propertyIsEnumerable,s=r(function(){return arguments}())?r:function(e){return o(e)&&a.call(e,"callee")&&!u.call(e,"callee")};e.exports=s},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t,n){(function(e){var r=n(125),o=n(709),i=t&&!t.nodeType&&t,a=i&&"object"==typeof e&&e&&!e.nodeType&&e,u=a&&a.exports===i?r.Buffer:void 0,s=(u?u.isBuffer:void 0)||o;e.exports=s}).call(this,n(78)(e))},function(e,t,n){var r=n(711),o=n(712),i=n(713),a=i&&i.isTypedArray,u=a?o(a):r;e.exports=u},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(380),o=n(718),i=n(161);e.exports=function(e){return i(e)?r(e,!0):o(e)}},function(e,t,n){var r=n(717),o=n(374),i=n(261),a=n(376),u=n(381),s=n(377),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),f=!n&&!l&&a(e),p=!n&&!l&&!f&&s(e),d=n||l||f||p,h=d?r(e.length,String):[],v=h.length;for(var b in e)!t&&!c.call(e,b)||d&&("length"==b||f&&("offset"==b||"parent"==b)||p&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||u(b,v))||h.push(b);return h}},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){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(729);Object.defineProperty(t,"Alpha",{enumerable:!0,get:function(){return f(r).default}});var o=n(263);Object.defineProperty(t,"Checkboard",{enumerable:!0,get:function(){return f(o).default}});var i=n(732);Object.defineProperty(t,"EditableInput",{enumerable:!0,get:function(){return f(i).default}});var a=n(733);Object.defineProperty(t,"Hue",{enumerable:!0,get:function(){return f(a).default}});var u=n(735);Object.defineProperty(t,"Raised",{enumerable:!0,get:function(){return f(u).default}});var s=n(736);Object.defineProperty(t,"Saturation",{enumerable:!0,get:function(){return f(s).default}});var c=n(742);Object.defineProperty(t,"ColorWrap",{enumerable:!0,get:function(){return f(c).default}});var l=n(754);function f(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"Swatch",{enumerable:!0,get:function(){return f(l).default}})},function(e,t,n){var r=n(79),o=n(738),i=n(739),a=Math.max,u=Math.min;e.exports=function(e,t,n){var s,c,l,f,p,d,h=0,v=!1,b=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var n=s,r=c;return s=c=void 0,h=t,f=e.apply(r,n)}function m(e){return h=e,p=setTimeout(w,t),v?g(e):f}function O(e){var n=e-d;return void 0===d||n>=t||n<0||b&&e-h>=l}function w(){var e=o();if(O(e))return x(e);p=setTimeout(w,function(e){var n=t-(e-d);return b?u(n,l-(e-h)):n}(e))}function x(e){return p=void 0,y&&s?g(e):(s=c=void 0,f)}function j(){var e=o(),n=O(e);if(s=arguments,c=this,d=e,n){if(void 0===p)return m(d);if(b)return clearTimeout(p),p=setTimeout(w,t),g(d)}return void 0===p&&(p=setTimeout(w,t)),f}return t=i(t)||0,r(n)&&(v=!!n.leading,l=(b="maxWait"in n)?a(i(n.maxWait)||0,t):l,y="trailing"in n?!!n.trailing:y),j.cancel=function(){void 0!==p&&clearTimeout(p),h=0,s=d=c=p=void 0},j.flush=function(){return void 0===p?f:x(o())},j}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isvalidColorString=t.red=t.getContrastingColor=t.isValidHex=t.toState=t.simpleCheckForValidColor=void 0;var r=i(n(743)),o=i(n(753));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){if("transparent"===e)return!0;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.isvalidColorString=function(e,t){var n=e.replace("°","");return(0,o.default)(t+" ("+n+")")._ok}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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 s(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}n.r(t),n.d(t,"MultiDrag",(function(){return yt})),n.d(t,"Sortable",(function(){return Ot})),n.d(t,"Swap",(function(){return at})),n.d(t,"ReactSortable",(function(){return Lt}));var c=s(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),l=s(/Edge/i),f=s(/firefox/i),p=s(/safari/i)&&!s(/chrome/i)&&!s(/android/i),d=s(/iP(ad|od|hone)/i),h=s(/chrome/i)&&s(/android/i),v={capture:!1,passive:!1};function b(e,t,n){e.addEventListener(t,n,!c&&v)}function y(e,t,n){e.removeEventListener(t,n,!c&&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 m(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function O(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=m(e))}return null}var w,x=/\s+/g;function j(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(x," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(x," ")}}function S(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 E(e,t){var n="";if("string"==typeof e)n=e;else do{var r=S(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function _(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 P(){return document.scrollingElement||document.documentElement}function C(e,t,n,r,o){if(e.getBoundingClientRect||e===window){var i,a,u,s,l,f,p;if(e!==window&&e.parentNode&&e!==P()?(a=(i=e.getBoundingClientRect()).top,u=i.left,s=i.bottom,l=i.right,f=i.height,p=i.width):(a=0,u=0,s=window.innerHeight,l=window.innerWidth,f=window.innerHeight,p=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!c))do{if(o&&o.getBoundingClientRect&&("none"!==S(o,"transform")||n&&"static"!==S(o,"position"))){var d=o.getBoundingClientRect();a-=d.top+parseInt(S(o,"border-top-width")),u-=d.left+parseInt(S(o,"border-left-width")),s=a+i.height,l=u+i.width;break}}while(o=o.parentNode);if(r&&e!==window){var h=E(o||e),v=h&&h.a,b=h&&h.d;h&&(s=(a/=b)+(f/=b),l=(u/=v)+(p/=v))}return{top:a,left:u,bottom:s,right:l,width:p,height:f}}}function A(e,t,n){for(var r=R(e,!0),o=C(e)[t];r;){var i=C(r)[n];if(!("top"===n||"left"===n?o>=i:o<=i))return r;if(r===P())break;r=R(r,!1)}return!1}function M(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&&O(i[o],n.draggable,e,!1)){if(r===t)return i[o];r++}o++}return null}function k(e,t){for(var n=e.lastElementChild;n&&(n===Fe.ghost||"none"===S(n,"display")||t&&!g(n,t));)n=n.previousElementSibling;return n||null}function I(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=P();if(e)do{var o=E(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 R(e,t){if(!e||!e.getBoundingClientRect)return P();var n=e,r=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=S(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 P();if(r||t)return n;r=!0}}}while(n=n.parentNode);return P()}function T(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(!w){var n=arguments,r=this;1===n.length?e.call(r,n[0]):e.apply(r,n),w=setTimeout((function(){w=void 0}),t)}}}function L(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function F(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)}function U(e,t){S(e,"position","absolute"),S(e,"top",t.top),S(e,"left",t.left),S(e,"width",t.width),S(e,"height",t.height)}function V(e){S(e,"position",""),S(e,"top",""),S(e,"left",""),S(e,"width",""),S(e,"height","")}var H="Sortable"+(new Date).getTime();var B=[],W={initializeByDefault:!0},z={mount:function(e){for(var t in W)W.hasOwnProperty(t)&&!(t in e)&&(e[t]=W[t]);B.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),B.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var o=e+"Global";B.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 B.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 B.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 B.forEach((function(o){e[o.pluginName]&&o.optionListeners&&"function"==typeof o.optionListeners[t]&&(r=o.optionListeners[t].call(e[o.pluginName],n))})),r}};function $(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,u=e.toEl,s=e.fromEl,f=e.oldIndex,p=e.newIndex,d=e.oldDraggableIndex,h=e.newDraggableIndex,v=e.originalEvent,b=e.putSortable,y=e.extraEventProperties;if(t=t||n&&n[H]){var g,m=t.options,O="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||c||l?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=u||n,g.from=s||n,g.item=o||n,g.clone=i,g.oldIndex=f,g.newIndex=p,g.oldDraggableIndex=d,g.newDraggableIndex=h,g.originalEvent=v,g.pullMode=b?b.lastPutMode:void 0;var w=a({},y,z.getEventProperties(r,t));for(var x in w)g[x]=w[x];n&&n.dispatchEvent(g),m[O]&&m[O].call(t,g)}}var Y=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:X,parentEl:G,ghostEl:K,rootEl:J,nextEl:Z,lastDownEl:Q,cloneEl:ee,cloneHidden:te,dragStarted:he,putSortable:ue,activeSortable:Fe.active,originalEvent:r,oldIndex:ne,oldDraggableIndex:oe,newIndex:re,newDraggableIndex:ie,hideGhostForTarget:Re,unhideGhostForTarget:Te,cloneNowHidden:function(){te=!0},cloneNowShown:function(){te=!1},dispatchSortableEvent:function(e){q({sortable:t,name:e,originalEvent:r})}},o))};function q(e){$(a({putSortable:ue,cloneEl:ee,targetEl:X,rootEl:J,oldIndex:ne,oldDraggableIndex:oe,newIndex:re,newDraggableIndex:ie},e))}var X,G,K,J,Z,Q,ee,te,ne,re,oe,ie,ae,ue,se,ce,le,fe,pe,de,he,ve,be,ye,ge,me=!1,Oe=!1,we=[],xe=!1,je=!1,Se=[],Ee=!1,_e=[],Pe="undefined"!=typeof document,Ce=d,Ae=l||c?"cssFloat":"float",Me=Pe&&!h&&!d&&"draggable"in document.createElement("div"),ke=function(){if(Pe){if(c)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Ie=function(e,t){var n=S(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=M(e,0,t),i=M(e,1,t),a=o&&S(o),u=i&&S(i),s=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+C(o).width,c=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+C(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 l="left"===a.float?"left":"right";return!i||"both"!==u.clear&&u.clear!==l?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||s>=r&&"none"===n[Ae]||i&&"none"===n[Ae]&&s+c>r)?"vertical":"horizontal"},De=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 s=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===s||e.join&&e.indexOf(s)>-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},Re=function(){!ke&&K&&S(K,"display","none")},Te=function(){!ke&&K&&S(K,"display","")};Pe&&document.addEventListener("click",(function(e){if(Oe)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Oe=!1,!1}),!0);var Ne=function(e){if(X){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,we.some((function(e){if(!k(e)){var t=C(e),n=e[H].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[H]._onDragOver(n)}}var o,i,a},Le=function(e){X&&X.parentNode[H]._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[H]=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 Ie(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&&!p,emptyInsertThreshold:5};for(var u in z.initializePlugins(this,e,o),o)!(u in t)&&(t[u]=o[u]);for(var s in De(t),this)"_"===s.charAt(0)&&"function"==typeof this[s]&&(this[s]=this[s].bind(this));this.nativeDraggable=!t.forceFallback&&Me,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?b(e,"pointerdown",this._onTapStart):(b(e,"mousedown",this._onTapStart),b(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(b(e,"dragover",this),b(e,"dragenter",this)),we.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"!==S(e,"display")&&e!==Fe.ghost){r.push({target:e,rect:C(e)});var t=a({},r[r.length-1].rect);if(e.thisAnimationDuration){var n=E(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=C(r),s=r.prevFromRect,c=r.prevToRect,l=e.rect,f=E(r,!0);f&&(u.top-=f.f,u.left-=f.e),r.toRect=u,r.thisAnimationDuration&&T(s,u)&&!T(a,u)&&(l.top-u.top)/(l.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}(l,s,c,t.options)),T(u,a)||(r.prevFromRect=a,r.prevToRect=u,n||(n=t.options.animation),t.animate(r,l,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){S(e,"transition",""),S(e,"transform","");var o=E(this.el),i=o&&o.a,a=o&&o.d,u=(t.left-n.left)/(i||1),s=(t.top-n.top)/(a||1);e.animatingX=!!u,e.animatingY=!!s,S(e,"transform","translate3d("+u+"px,"+s+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),S(e,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:"")),S(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){S(e,"transition",""),S(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),r)}}}))}function Ue(e,t,n,r,o,i,a,u){var s,f,p=e[H],d=p.options.onMove;return!window.CustomEvent||c||l?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=t,s.from=e,s.dragged=n,s.draggedRect=r,s.related=o||t,s.relatedRect=i||C(t),s.willInsertAfter=u,s.originalEvent=a,e.dispatchEvent(s),d&&(f=d.call(p,s,a)),f}function Ve(e){e.draggable=!1}function He(){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 We(e){return setTimeout(e,0)}function ze(e){return clearTimeout(e)}Fe.prototype={constructor:Fe,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(ve=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,X):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,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,c=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),!X&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!s.isContentEditable&&(this.nativeDraggable||!p||!u||"SELECT"!==u.tagName.toUpperCase())&&!((u=O(u,r.draggable,n,!1))&&u.animated||Q===u)){if(ne=I(u),oe=I(u,r.draggable),"function"==typeof c){if(c.call(this,e,u,this))return q({sortable:t,rootEl:s,name:"filter",targetEl:u,toEl:n,fromEl:n}),Y("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some((function(r){if(r=O(s,r.trim(),n,!1))return q({sortable:t,rootEl:r,name:"filter",targetEl:u,fromEl:n,toEl:n}),Y("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!O(s,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&&!X&&n.parentNode===i){var s=C(n);if(J=i,G=(X=n).parentNode,Z=X.nextSibling,Q=n,ae=a.group,Fe.dragged=X,se={target:X,clientX:(t||e).clientX,clientY:(t||e).clientY},pe=se.clientX-s.left,de=se.clientY-s.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,X.style["will-change"]="all",r=function(){Y("delayEnded",o,{evt:e}),Fe.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!f&&o.nativeDraggable&&(X.draggable=!0),o._triggerDragStart(e,t),q({sortable:o,name:"choose",originalEvent:e}),j(X,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){_(X,e.trim(),Ve)})),b(u,"dragover",Ne),b(u,"mousemove",Ne),b(u,"touchmove",Ne),b(u,"mouseup",o._onDrop),b(u,"touchend",o._onDrop),b(u,"touchcancel",o._onDrop),f&&this.nativeDraggable&&(this.options.touchStartThreshold=4,X.draggable=!0),Y("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(l||c))r();else{if(Fe.eventCanceled)return void this._onDrop();b(u,"mouseup",o._disableDelayedDrag),b(u,"touchend",o._disableDelayedDrag),b(u,"touchcancel",o._disableDelayedDrag),b(u,"mousemove",o._delayedDragTouchMoveHandler),b(u,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&b(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(){X&&Ve(X),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;y(e,"mouseup",this._disableDelayedDrag),y(e,"touchend",this._disableDelayedDrag),y(e,"touchcancel",this._disableDelayedDrag),y(e,"mousemove",this._delayedDragTouchMoveHandler),y(e,"touchmove",this._delayedDragTouchMoveHandler),y(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?b(document,"pointermove",this._onTouchMove):b(document,t?"touchmove":"mousemove",this._onTouchMove):(b(X,"dragend",this),b(J,"dragstart",this._onDragStart));try{document.selection?We((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(me=!1,J&&X){Y("dragStarted",this,{evt:t}),this.nativeDraggable&&b(document,"dragover",Le);var n=this.options;!e&&j(X,n.dragClass,!1),j(X,n.ghostClass,!0),Fe.active=this,e&&this._appendGhost(),q({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(ce){this._lastX=ce.clientX,this._lastY=ce.clientY,Re();for(var e=document.elementFromPoint(ce.clientX,ce.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ce.clientX,ce.clientY))!==t;)t=e;if(X.parentNode[H]._isOutsideThisEl(e),t)do{if(t[H]&&t[H]._onDragOver({clientX:ce.clientX,clientY:ce.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);Te()}},_onTouchMove:function(e){if(se){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=K&&E(K,!0),a=K&&i&&i.a,u=K&&i&&i.d,s=Ce&&ge&&D(ge),c=(o.clientX-se.clientX+r.x)/(a||1)+(s?s[0]-Se[0]:0)/(a||1),l=(o.clientY-se.clientY+r.y)/(u||1)+(s?s[1]-Se[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(K){i?(i.e+=c-(le||0),i.f+=l-(fe||0)):i={a:1,b:0,c:0,d:1,e:c,f:l};var f="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");S(K,"webkitTransform",f),S(K,"mozTransform",f),S(K,"msTransform",f),S(K,"transform",f),le=c,fe=l,ce=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!K){var e=this.options.fallbackOnBody?document.body:J,t=C(X,!0,Ce,!0,e),n=this.options;if(Ce){for(ge=e;"static"===S(ge,"position")&&"none"===S(ge,"transform")&&ge!==document;)ge=ge.parentNode;ge!==document.body&&ge!==document.documentElement?(ge===document&&(ge=P()),t.top+=ge.scrollTop,t.left+=ge.scrollLeft):ge=P(),Se=D(ge)}j(K=X.cloneNode(!0),n.ghostClass,!1),j(K,n.fallbackClass,!0),j(K,n.dragClass,!0),S(K,"transition",""),S(K,"transform",""),S(K,"box-sizing","border-box"),S(K,"margin",0),S(K,"top",t.top),S(K,"left",t.left),S(K,"width",t.width),S(K,"height",t.height),S(K,"opacity","0.8"),S(K,"position",Ce?"absolute":"fixed"),S(K,"zIndex","100000"),S(K,"pointerEvents","none"),Fe.ghost=K,e.appendChild(K),S(K,"transform-origin",pe/parseInt(K.style.width)*100+"% "+de/parseInt(K.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,o=n.options;Y("dragStart",this,{evt:e}),Fe.eventCanceled?this._onDrop():(Y("setupClone",this),Fe.eventCanceled||((ee=F(X)).draggable=!1,ee.style["will-change"]="",this._hideClone(),j(ee,this.options.chosenClass,!1),Fe.clone=ee),n.cloneId=We((function(){Y("clone",n),Fe.eventCanceled||(n.options.removeCloneOnHide||J.insertBefore(ee,X),n._hideClone(),q({sortable:n,name:"clone"}))})),!t&&j(X,o.dragClass,!0),t?(Oe=!0,n._loopId=setInterval(n._emulateDragOver,50)):(y(document,"mouseup",n._onDrop),y(document,"touchend",n._onDrop),y(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",o.setData&&o.setData.call(n,r,X)),b(document,"drop",n),S(X,"transform","translateZ(0)")),me=!0,n._dragStartId=We(n._dragStarted.bind(n,t,e)),b(document,"selectstart",n),he=!0,p&&S(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,r,o,i=this.el,u=e.target,s=this.options,c=s.group,l=Fe.active,f=ae===c,p=s.sort,d=ue||l,h=this,v=!1;if(!Ee){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),u=O(u,s.draggable,i,!0),N("dragOver"),Fe.eventCanceled)return v;if(X.contains(e.target)||u.animated&&u.animatingX&&u.animatingY||h._ignoreWhileAnimating===u)return U(!1);if(Oe=!1,l&&!s.disabled&&(f?p||(r=!J.contains(X)):ue===this||(this.lastPutMode=ae.checkPull(this,l,X,e))&&c.checkPut(this,l,X,e))){if(o="vertical"===this._getDirection(e,u),t=C(X),N("dragOverValid"),Fe.eventCanceled)return v;if(r)return G=J,F(),this._hideClone(),N("revert"),Fe.eventCanceled||(Z?J.insertBefore(X,Z):J.appendChild(X)),U(!0);var b=k(i,s.draggable);if(!b||function(e,t,n){var r=C(k(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)&&!b.animated){if(b===X)return U(!1);if(b&&i===e.target&&(u=b),u&&(n=C(u)),!1!==Ue(J,i,X,t,u,n,e,!!u))return F(),i.appendChild(X),G=i,V(),U(!0)}else if(u.parentNode===i){n=C(u);var y,g,m,w=X.parentNode!==i,x=!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,s=n?t.width:t.height;return r===a||o===u||r+i/2===a+s/2}(X.animated&&X.toRect||t,u.animated&&u.toRect||n,o),E=o?"top":"left",_=A(u,"top","top")||A(X,"top","top"),P=_?_.scrollTop:void 0;if(ve!==u&&(g=n[E],xe=!1,je=!x&&s.invertSwap||w),0!==(y=function(e,t,n,r,o,i,a,u){var s=r?e.clientY:e.clientX,c=r?n.height:n.width,l=r?n.top:n.left,f=r?n.bottom:n.right,p=!1;if(!a)if(u&&ye<c*o){if(!xe&&(1===be?s>l+c*i/2:s<f-c*i/2)&&(xe=!0),xe)p=!0;else if(1===be?s<l+ye:s>f-ye)return-be}else if(s>l+c*(1-o)/2&&s<f-c*(1-o)/2)return function(e){return I(X)<I(e)?1:-1}(t);return(p=p||a)&&(s<l+c*i/2||s>f-c*i/2)?s>l+c/2?1:-1:0}(e,u,n,o,x?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,je,ve===u))){var M=I(X);do{M-=y,m=G.children[M]}while(m&&("none"===S(m,"display")||m===K))}if(0===y||m===u)return U(!1);ve=u,be=y;var D=u.nextElementSibling,R=!1,T=Ue(J,i,X,t,u,n,e,R=1===y);if(!1!==T)return 1!==T&&-1!==T||(R=1===T),Ee=!0,setTimeout(He,30),F(),R&&!D?i.appendChild(X):u.parentNode.insertBefore(X,R?D:u),_&&L(_,0,P-_.scrollTop),G=X.parentNode,void 0===g||je||(ye=Math.abs(g-C(u)[E])),V(),U(!0)}if(i.contains(X))return U(!1)}return!1}function N(s,c){Y(s,h,a({evt:e,isOwner:f,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:p,fromSortable:d,target:u,completed:U,onMove:function(n,r){return Ue(J,i,X,t,n,C(n),e,r)},changed:V},c))}function F(){N("dragOverAnimationCapture"),h.captureAnimationState(),h!==d&&d.captureAnimationState()}function U(t){return N("dragOverCompleted",{insertion:t}),t&&(f?l._hideClone():l._showClone(h),h!==d&&(j(X,ue?ue.options.ghostClass:l.options.ghostClass,!1),j(X,s.ghostClass,!0)),ue!==h&&h!==Fe.active?ue=h:h===Fe.active&&ue&&(ue=null),d===h&&(h._ignoreWhileAnimating=u),h.animateAll((function(){N("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(u===X&&!X.animated||u===i&&!u.animated)&&(ve=null),s.dragoverBubble||e.rootEl||u===document||(X.parentNode[H]._isOutsideThisEl(e.target),!t&&Ne(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),v=!0}function V(){re=I(X),ie=I(X,s.draggable),q({sortable:h,name:"change",toEl:i,newIndex:re,newDraggableIndex:ie,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){y(document,"mousemove",this._onTouchMove),y(document,"touchmove",this._onTouchMove),y(document,"pointermove",this._onTouchMove),y(document,"dragover",Ne),y(document,"mousemove",Ne),y(document,"touchmove",Ne)},_offUpEvents:function(){var e=this.el.ownerDocument;y(e,"mouseup",this._onDrop),y(e,"touchend",this._onDrop),y(e,"pointerup",this._onDrop),y(e,"touchcancel",this._onDrop),y(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;re=I(X),ie=I(X,n.draggable),Y("drop",this,{evt:e}),G=X&&X.parentNode,re=I(X),ie=I(X,n.draggable),Fe.eventCanc
1
  /*! For license information please see admin-vendors.js.LICENSE.txt */