Version Description
- New Posts Carousel block.
- New Premium Content block.
- Update header button styling and full width block margins for Gutenberg v8.0.0.
- Only load common module assets if they are required.
- Remove loading of blank.css for Global Styles.
Download this release
Release Info
Developer | mppfeiffer |
Plugin | Full Site Editing |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.2
- block-patterns/patterns/call-to-action-02.php +43 -0
- blog-posts-block/README.md +0 -40
- blog-posts-block/index.php +0 -97
- blog-posts-block/view.js +0 -1
- common/dist/common.asset.php +1 -1
- common/index.php +41 -8
- dotcom-fse/dist/dotcom-fse.asset.php +1 -1
- dotcom-fse/dist/dotcom-fse.css +1 -1
- dotcom-fse/dist/dotcom-fse.rtl.css +1 -1
- dotcom-fse/editor/style.scss +2 -1
- dotcom-fse/helpers.php +3 -1
- dotcom-fse/plugins/close-button-override/style.scss +10 -0
- event-countdown-block/dist/event-countdown-block.asset.php +1 -1
- full-site-editing-plugin.php +17 -3
- global-styles/class-global-styles.php +63 -61
- global-styles/dist/global-styles.asset.php +1 -1
- global-styles/static/blank.css +0 -6
- jetpack-timeline/dist/jetpack-timeline.asset.php +1 -1
- newspack-blocks/README.md +50 -0
- blog-posts-block/editor.js → newspack-blocks/blog-posts-block-editor.js +4 -4
- newspack-blocks/blog-posts-block-view.js +4 -0
- newspack-blocks/carousel-block-editor.js +34 -0
- newspack-blocks/carousel-block-view.js +4 -0
- blog-posts-block/dist/editor.asset.php → newspack-blocks/dist/blog-posts-block-editor.asset.php +1 -1
- blog-posts-block/dist/editor.css → newspack-blocks/dist/blog-posts-block-editor.css +0 -0
- blog-posts-block/dist/editor.js → newspack-blocks/dist/blog-posts-block-editor.js +2 -2
- blog-posts-block/dist/editor.rtl.css → newspack-blocks/dist/blog-posts-block-editor.rtl.css +0 -0
- blog-posts-block/dist/view.asset.php → newspack-blocks/dist/blog-posts-block-view.asset.php +1 -1
- blog-posts-block/dist/view.css → newspack-blocks/dist/blog-posts-block-view.css +0 -0
- blog-posts-block/dist/view.js → newspack-blocks/dist/blog-posts-block-view.js +1 -1
- blog-posts-block/dist/view.rtl.css → newspack-blocks/dist/blog-posts-block-view.rtl.css +0 -0
- newspack-blocks/dist/carousel-block-editor.asset.php +1 -0
- newspack-blocks/dist/carousel-block-editor.css +1 -0
- newspack-blocks/dist/carousel-block-editor.js +6 -0
- newspack-blocks/dist/carousel-block-editor.rtl.css +1 -0
- newspack-blocks/dist/carousel-block-view.asset.php +1 -0
- newspack-blocks/dist/carousel-block-view.css +1 -0
- newspack-blocks/dist/carousel-block-view.js +1 -0
- newspack-blocks/dist/carousel-block-view.rtl.css +1 -0
- newspack-blocks/index.php +117 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/create-swiper.js +35 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/edit.js +285 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/editor.js +7 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/editor.scss +49 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/index.js +83 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/view.js +67 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/view.php +341 -0
- newspack-blocks/synced-newspack-blocks/blocks/carousel/view.scss +246 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/block.json +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/edit.js +4 -32
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/editor.js +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/editor.scss +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/index.js +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/store.js +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/templates/article.php +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/templates/articles-list.php +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/templates/articles-loop.php +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/utils.js +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/view.js +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/view.php +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/view.scss +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/class-newspack-blocks-api.php +43 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/class-newspack-blocks.php +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/components/autocomplete-tokenfield.js +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/components/autocomplete-tokenfield.scss +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/components/query-controls.js +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/js/newspack-icon.js +0 -0
- newspack-blocks/synced-newspack-blocks/shared/js/utils.js +34 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_colors.scss +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_mixins.scss +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_placeholder.scss +0 -0
- {blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_variables.scss +0 -0
- posts-list-block/dist/posts-list-block.asset.php +1 -1
- premium-content/blocks/container/blocks.js +19 -0
- premium-content/blocks/container/context.js +27 -0
- premium-content/blocks/container/controls.js +64 -0
- premium-content/blocks/container/edit.js +439 -0
- premium-content/blocks/container/index.js +92 -0
- premium-content/blocks/container/inspector.js +243 -0
- premium-content/blocks/container/new-plan.js +34 -0
- premium-content/blocks/container/plan.js +46 -0
- premium-content/blocks/container/plans.js +39 -0
- premium-content/blocks/container/save.js +15 -0
- premium-content/blocks/container/stripe-nudge.js +80 -0
- premium-content/blocks/container/tab.js +33 -0
- premium-content/blocks/container/tabs.js +50 -0
- premium-content/blocks/logged-out-view/edit.js +103 -0
- premium-content/blocks/logged-out-view/index.js +120 -0
- premium-content/blocks/logged-out-view/save.js +15 -0
- premium-content/blocks/logged-out-view/submit-buttons.js +188 -0
- premium-content/blocks/subscriber-view/edit.js +75 -0
- premium-content/blocks/subscriber-view/index.js +32 -0
- premium-content/blocks/subscriber-view/save.js +15 -0
- premium-content/dist/premium-content.asset.php +1 -0
- premium-content/dist/premium-content.js +6 -0
- premium-content/editor.css +107 -0
- premium-content/index.js +43 -0
- premium-content/premium-content-dom.php +101 -0
- premium-content/premium-content.php +285 -0
- premium-content/style.css +41 -0
- premium-content/subscription-service/class-jetpack-token-subscription-service.php +41 -0
- premium-content/subscription-service/class-jwt.php +379 -0
- premium-content/subscription-service/class-subscription-service.php +56 -0
- premium-content/subscription-service/class-token-subscription-service.php +186 -0
- premium-content/subscription-service/class-token-subscription.php +11 -0
- premium-content/subscription-service/class-unconfigured-subscription-service.php +49 -0
- premium-content/subscription-service/class-wpcom-token-subscription-service.php +35 -0
- premium-content/subscription-service/include.php +9 -0
- premium-content/view.js +44 -0
- readme.txt +8 -1
- starter-page-templates/dist/starter-page-templates.asset.php +1 -1
- starter-page-templates/dist/starter-page-templates.js +1 -1
- starter-page-templates/page-template-modal/components/block-preview.js +1 -1
- starter-page-templates/page-template-modal/components/template-selector-preview.js +1 -1
- wpcom-block-editor-nux/dist/wpcom-block-editor-nux.asset.php +1 -1
block-patterns/patterns/call-to-action-02.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Call to Action pattern.
|
4 |
+
*
|
5 |
+
* @package A8C\FSE
|
6 |
+
*/
|
7 |
+
|
8 |
+
$markup = '
|
9 |
+
<!-- wp:cover {"url":"https://dotcompatterns.files.wordpress.com/2020/04/louis-hansel-shotsoflouis-d0ueoxdvj5i-unsplash.jpg","id":181,"dimRatio":20,"customOverlayColor":"#000000","focalPoint":{"x":0.5,"y":"0.70"},"minHeight":620,"align":"full"} -->
|
10 |
+
<div class="wp-block-cover alignfull has-background-dim-20 has-background-dim" style="background-image:url(https://dotcompatterns.files.wordpress.com/2020/04/louis-hansel-shotsoflouis-d0ueoxdvj5i-unsplash.jpg);background-color:#000000;background-position:50% 70%;min-height:620px">
|
11 |
+
<div class="wp-block-cover__inner-container">
|
12 |
+
<!-- wp:jetpack/layout-grid {"addGutterEnds":false,"column1DesktopSpan":10,"column1DesktopOffset":1,"column1TabletSpan":8,"column1MobileSpan":4,"column2DesktopOffset":1,"className":"column1-desktop-grid__span-10 column1-desktop-grid__start-2 column1-desktop-grid__row-1 column1-tablet-grid__span-8 column1-tablet-grid__row-1 column1-mobile-grid__span-4 column1-mobile-grid__row-1"} -->
|
13 |
+
<div class="wp-block-jetpack-layout-grid alignfull column1-desktop-grid__span-10 column1-desktop-grid__start-2 column1-desktop-grid__row-1 column1-tablet-grid__span-8 column1-tablet-grid__row-1 column1-mobile-grid__span-4 column1-mobile-grid__row-1 wp-block-jetpack-layout-gutter__nowrap">
|
14 |
+
<!-- wp:jetpack/layout-grid-column -->
|
15 |
+
<div class="wp-block-jetpack-layout-grid-column wp-block-jetpack-layout-grid__padding-none">
|
16 |
+
<!-- wp:paragraph {"align":"center","customTextColor":"#ffffff","customFontSize":80,"className":"margin-bottom-none"} -->
|
17 |
+
<p style="color:#ffffff;font-size:80px" class="has-text-color has-text-align-center margin-bottom-none"><strong>' . esc_html__( 'Get it delivered', 'full-site-editing' ) . '</strong></p>
|
18 |
+
<!-- /wp:paragraph -->
|
19 |
+
|
20 |
+
<!-- wp:paragraph {"align":"center","customTextColor":"#ffffff","className":"margin-top-none"} -->
|
21 |
+
<p style="color:#ffffff" class="has-text-color has-text-align-center margin-top-none">' . esc_html__( 'If you can’t come to us, we’ll go to you.', 'full-site-editing' ) . '</p>
|
22 |
+
<!-- /wp:paragraph -->
|
23 |
+
|
24 |
+
<!-- wp:buttons {"align":"center"} -->
|
25 |
+
<div class="wp-block-buttons aligncenter"><!-- wp:button {"customBackgroundColor":"#a5150f","customTextColor":"#ffffff"} -->
|
26 |
+
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background" style="background-color:#a5150f;color:#ffffff">' . esc_html__( 'Order now', 'full-site-editing' ) . '</a></div>
|
27 |
+
<!-- /wp:button -->
|
28 |
+
</div>
|
29 |
+
<!-- /wp:buttons -->
|
30 |
+
</div>
|
31 |
+
<!-- /wp:jetpack/layout-grid-column -->
|
32 |
+
</div>
|
33 |
+
<!-- /wp:jetpack/layout-grid -->
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
<!-- /wp:cover -->
|
37 |
+
';
|
38 |
+
|
39 |
+
return array(
|
40 |
+
'__file' => 'wp_block',
|
41 |
+
'title' => esc_html__( 'Call to Action', 'full-site-editing' ),
|
42 |
+
'content' => $markup,
|
43 |
+
);
|
blog-posts-block/README.md
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
# Blog Posts Block
|
2 |
-
|
3 |
-
This block allows you to list your posts in various layouts and filter them by criteria like category, tag or author.
|
4 |
-
|
5 |
-
It originally comes from the [Newspack Blocks collection](https://github.com/automattic/newspack-blocks) and the block is still being developed there.
|
6 |
-
|
7 |
-
It was added to this repository in order to make it available to other parts of the FSE plugin, such as Starter Page Templates where this block will be used.
|
8 |
-
|
9 |
-
## Structure
|
10 |
-
|
11 |
-
```
|
12 |
-
index.php — main entry file, registers the block on backend
|
13 |
-
editor.js — assets for the block editor
|
14 |
-
view.js — assets for the block rendered on frontend
|
15 |
-
newspack-homepage-articles/** — source code synced from the Newspack Blocks repository
|
16 |
-
```
|
17 |
-
|
18 |
-
`editor.js`, `view.js` and `index.php` are files written in order to bridge the parent plugin with the Blog Posts Block. It changes the block name to `a8c/blog-posts` and does things like registering REST fields or styles and scripts. In these files we are free to do all those changes because they are not shared with Newspack and only live here in this repository.
|
19 |
-
|
20 |
-
### Synchronizing the code
|
21 |
-
|
22 |
-
You can see that `newspack-homepage-articles` is being synced with the Newspack Blocks repository. Please make all improvements and additions on the Newspack side. Please don't make any direct changes to files in this directory as the next synchronization will overwrite them.
|
23 |
-
|
24 |
-
Once your changes land on the Newspack side, coordinate with the team (over issues/PRs) to [make a new release](https://github.com/Automattic/newspack-blocks/releases) and once you have the release ID, you can pull the code into here.
|
25 |
-
|
26 |
-
While being in `apps/full-site-editing/` directory, you can run:
|
27 |
-
|
28 |
-
```
|
29 |
-
yarn run sync:blog-posts-block --release=1.0.0-alpha.17
|
30 |
-
```
|
31 |
-
|
32 |
-
This will pull the code from the release and integrate it into this repository. Please review changes, make sure to update `NEWSPACK_BLOCKS__VERSION` in [index.php](./index.php) and commit.
|
33 |
-
|
34 |
-
### Local development
|
35 |
-
|
36 |
-
Sometimes, probably, you will need to sync the NHA code straight in your local environment. It means you will get working on both projects at the same time. For this situation, you'd like to reference the code source through the `path` bin script argument.
|
37 |
-
|
38 |
-
```js
|
39 |
-
yarn run sync:blog-posts-block --path=/Absolute/path/of/newspack-blocks/
|
40 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blog-posts-block/index.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Blog posts file.
|
4 |
-
*
|
5 |
-
* @package A8C\FSE
|
6 |
-
*/
|
7 |
-
|
8 |
-
namespace A8C\FSE;
|
9 |
-
|
10 |
-
define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
|
11 |
-
define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
12 |
-
|
13 |
-
// Autogenerated by apps/full-site-editing/bin/sync-blog-posts-block.sh.
|
14 |
-
define( 'NEWSPACK_BLOCKS__VERSION', 'v1.2.1' );
|
15 |
-
// End autogenerated area.
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Filters block name.
|
19 |
-
*
|
20 |
-
* @param string $name Block name.
|
21 |
-
* @return string
|
22 |
-
*/
|
23 |
-
function blog_posts_block_name( $name ) {
|
24 |
-
if ( 'newspack-blocks/homepage-articles' === $name ) {
|
25 |
-
return 'a8c/blog-posts';
|
26 |
-
}
|
27 |
-
return $name;
|
28 |
-
}
|
29 |
-
add_filter( 'newspack_blocks_block_name', __NAMESPACE__ . '\blog_posts_block_name' );
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Filters block arguments for `register_block_type()`.
|
33 |
-
*
|
34 |
-
* @param array $args Arguments to `register_block_type()`.
|
35 |
-
* @param string $name Block name.
|
36 |
-
* @return array
|
37 |
-
*/
|
38 |
-
function blog_posts_block_args( $args, $name ) {
|
39 |
-
if ( 'homepage-articles' !== $name ) {
|
40 |
-
return $args;
|
41 |
-
}
|
42 |
-
|
43 |
-
// Editor script.
|
44 |
-
$script_data = require NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'editor.asset.php';
|
45 |
-
wp_register_script(
|
46 |
-
'blog-posts-block-editor',
|
47 |
-
plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'editor.js', __FILE__ ),
|
48 |
-
$script_data['dependencies'],
|
49 |
-
$script_data['version'],
|
50 |
-
true
|
51 |
-
);
|
52 |
-
|
53 |
-
// Editor style.
|
54 |
-
$editor_style = plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'editor.css', __FILE__ );
|
55 |
-
wp_register_style( 'blog-posts-block-editor', $editor_style, array(), NEWSPACK_BLOCKS__VERSION );
|
56 |
-
|
57 |
-
// View script.
|
58 |
-
$script_data = require NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'view.asset.php';
|
59 |
-
wp_register_script(
|
60 |
-
'blog-posts-block-view',
|
61 |
-
plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'view.js', __FILE__ ),
|
62 |
-
$script_data['dependencies'],
|
63 |
-
$script_data['version'],
|
64 |
-
true
|
65 |
-
);
|
66 |
-
|
67 |
-
// View style.
|
68 |
-
$editor_style = plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . 'view.css', __FILE__ );
|
69 |
-
wp_register_style( 'blog-posts-block-view', $editor_style, array(), NEWSPACK_BLOCKS__VERSION );
|
70 |
-
|
71 |
-
$args['editor_script'] = 'blog-posts-block-editor';
|
72 |
-
$args['editor_style'] = 'blog-posts-block-editor';
|
73 |
-
$args['script'] = 'blog-posts-block-view';
|
74 |
-
$args['style'] = 'blog-posts-block-view';
|
75 |
-
|
76 |
-
wp_set_script_translations( 'blog-posts-block-editor', 'full-site-editing' );
|
77 |
-
|
78 |
-
return $args;
|
79 |
-
}
|
80 |
-
add_filter( 'newspack_blocks_block_args', __NAMESPACE__ . '\blog_posts_block_args', 10, 2 );
|
81 |
-
|
82 |
-
require_once __DIR__ . '/newspack-homepage-articles/class-newspack-blocks.php';
|
83 |
-
require_once __DIR__ . '/newspack-homepage-articles/class-newspack-blocks-api.php';
|
84 |
-
|
85 |
-
require_once __DIR__ . '/newspack-homepage-articles/blocks/homepage-articles/view.php';
|
86 |
-
|
87 |
-
// REST Controller for Articles Block.
|
88 |
-
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'newspack-homepage-articles/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php';
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Registers Articles block routes.
|
92 |
-
*/
|
93 |
-
function register_rest_routes() {
|
94 |
-
$articles_controller = new \WP_REST_Newspack_Articles_Controller();
|
95 |
-
$articles_controller->register_routes();
|
96 |
-
}
|
97 |
-
add_action( 'rest_api_init', __NAMESPACE__ . '\register_rest_routes' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blog-posts-block/view.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
import './newspack-homepage-articles/blocks/homepage-articles/view';
|
|
common/dist/common.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'f4a7961ae4443a3a457a3914c25c2c35');
|
common/index.php
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* File for various functionality which needs to be added to Simple and Atomic
|
4 |
-
* sites. The code in this file is always loaded.
|
|
|
|
|
|
|
5 |
*
|
6 |
* @package A8C\FSE
|
7 |
*/
|
@@ -17,24 +20,49 @@ function is_block_editor_screen() {
|
|
17 |
return is_callable( 'get_current_screen' ) && get_current_screen() && get_current_screen()->is_block_editor();
|
18 |
}
|
19 |
|
|
|
20 |
/**
|
21 |
-
*
|
|
|
22 |
*
|
23 |
-
* @
|
24 |
-
* @return string
|
25 |
*/
|
26 |
-
function
|
27 |
global $post;
|
28 |
|
29 |
// Handle the case where we are not rendering a post.
|
30 |
if ( ! isset( $post ) ) {
|
31 |
-
return
|
32 |
}
|
33 |
|
34 |
$hide_homepage_title = (bool) get_theme_mod( 'hide_front_page_title', false );
|
35 |
$is_homepage = ( (int) get_option( 'page_on_front' ) === $post->ID );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
$classes .= ' hide-homepage-title';
|
39 |
}
|
40 |
|
@@ -46,6 +74,11 @@ add_filter( 'admin_body_class', __NAMESPACE__ . '\admin_body_classes' );
|
|
46 |
* Enqueue script and style for the common package.
|
47 |
*/
|
48 |
function enqueue_script_and_style() {
|
|
|
|
|
|
|
|
|
|
|
49 |
$asset_file = include plugin_dir_path( __FILE__ ) . 'dist/common.asset.php';
|
50 |
$script_dependencies = $asset_file['dependencies'];
|
51 |
wp_enqueue_script(
|
@@ -66,4 +99,4 @@ function enqueue_script_and_style() {
|
|
66 |
filemtime( plugin_dir_path( __FILE__ ) . 'dist/' . $style_file )
|
67 |
);
|
68 |
}
|
69 |
-
add_action( '
|
1 |
<?php
|
2 |
/**
|
3 |
* File for various functionality which needs to be added to Simple and Atomic
|
4 |
+
* sites. The code in this file is always loaded in the block editor.
|
5 |
+
*
|
6 |
+
* Currently, this module may not be the best place if you need to load
|
7 |
+
* front-end assets, but you could always add a separate action for that.
|
8 |
*
|
9 |
* @package A8C\FSE
|
10 |
*/
|
20 |
return is_callable( 'get_current_screen' ) && get_current_screen() && get_current_screen()->is_block_editor();
|
21 |
}
|
22 |
|
23 |
+
|
24 |
/**
|
25 |
+
* Detects if the current page is the homepage post editor, and if the homepage
|
26 |
+
* title is hidden.
|
27 |
*
|
28 |
+
* @return bool True if the homepage title features should be used. (See above.)
|
|
|
29 |
*/
|
30 |
+
function is_homepage_title_hidden() {
|
31 |
global $post;
|
32 |
|
33 |
// Handle the case where we are not rendering a post.
|
34 |
if ( ! isset( $post ) ) {
|
35 |
+
return false;
|
36 |
}
|
37 |
|
38 |
$hide_homepage_title = (bool) get_theme_mod( 'hide_front_page_title', false );
|
39 |
$is_homepage = ( (int) get_option( 'page_on_front' ) === $post->ID );
|
40 |
+
return (bool) is_block_editor_screen() && $hide_homepage_title && $is_homepage;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Detects if assets for the common module should be loaded.
|
45 |
+
*
|
46 |
+
* It should return true if any of the features added to the common module need
|
47 |
+
* to be loaded. To accomplish this, please create separate functions if you add
|
48 |
+
* other small features to this file. The separate function should detect if your
|
49 |
+
* individual feature ought to be loaded. Then, "or" (||) that together with the
|
50 |
+
* return value here.
|
51 |
+
*
|
52 |
+
* @return bool True if the common module assets should be loaded.
|
53 |
+
*/
|
54 |
+
function should_load_assets() {
|
55 |
+
return (bool) is_homepage_title_hidden();
|
56 |
+
}
|
57 |
|
58 |
+
/**
|
59 |
+
* Adds custom classes to the admin body classes.
|
60 |
+
*
|
61 |
+
* @param string $classes Classes for the body element.
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
+
function admin_body_classes( $classes ) {
|
65 |
+
if ( is_homepage_title_hidden() ) {
|
66 |
$classes .= ' hide-homepage-title';
|
67 |
}
|
68 |
|
74 |
* Enqueue script and style for the common package.
|
75 |
*/
|
76 |
function enqueue_script_and_style() {
|
77 |
+
// Avoid loading assets if possible.
|
78 |
+
if ( ! should_load_assets() ) {
|
79 |
+
return;
|
80 |
+
}
|
81 |
+
|
82 |
$asset_file = include plugin_dir_path( __FILE__ ) . 'dist/common.asset.php';
|
83 |
$script_dependencies = $asset_file['dependencies'];
|
84 |
wp_enqueue_script(
|
99 |
filemtime( plugin_dir_path( __FILE__ ) . 'dist/' . $style_file )
|
100 |
);
|
101 |
}
|
102 |
+
add_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\enqueue_script_and_style' );
|
dotcom-fse/dist/dotcom-fse.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-server-side-render', 'wp-url'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-server-side-render', 'wp-url'), 'version' => '73faf3fa2565925c023276cfd91bdc1f');
|
dotcom-fse/dist/dotcom-fse.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-left:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative;margin-top:20px}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding:0}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar[data-type="a8c/template"],.template__block-container:before{display:none}.template__block-container:hover{cursor:pointer}.template__block-container .block-editor-block-list__block-edit [data-block]{margin:0}.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled,.template__block-container:hover .components-disabled{filter:blur(2px);transition:filter .2s linear}.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay,.template__block-container.is-selected .template-block__overlay .components-button,.template__block-container:hover .template-block__overlay,.template__block-container:hover .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template__block-container .template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template__block-container .template-block__overlay{border-color:rgba(66,88,99,.4)}.block-editor-block-list__block:first-child .template__block-container .template-block__overlay{border-bottom-width:1px}.block-editor-block-list__block:last-child .template__block-container .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template__block-container .template-block__overlay{border-width:1px}}.template__block-container .template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s;margin:0 auto}.template__block-container .template-block__overlay .components-button.hidden{display:none}.template__block-container .template-block__overlay .template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions{display:none}.template-block__placeholder .components-spinner{margin:0 auto}.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-page .edit-post-header .edit-post-fullscreen-mode-close,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-header .edit-post-fullscreen-mode-close,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-header .edit-post-fullscreen-mode-close{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;margin-right:10px;margin-left:-24px;border:none;border-right:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2{margin-left:-7px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-24px;margin-right:24px}@media (max-width:782px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{display:none}}@media (max-width:960px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}@media (max-width:599px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-24px}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .block-editor-editor-skeleton__content,.post-type-page .edit-post-editor-regions__content,.post-type-wp_template_part .block-editor-editor-skeleton__content,.post-type-wp_template_part .edit-post-editor-regions__content{background:#eee}.post-type-page .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-page .edit-post-visual-editor.editor-styles-wrapper,.post-type-wp_template_part .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-visual-editor.editor-styles-wrapper{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-left:0;padding-right:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-page .block-editor-block-list__layout .block-editor-block-list__block[data-align=full],.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{margin-left:0;margin-right:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-right:14px;margin-left:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .block-editor-writing-flow__click-redirect,.post-type-wp_template_part .block-editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container .wp-block-column [data-type="core/social-links"] [data-block]{margin:0}@media (max-width:600px){.components-dropdown.table-of-contents{display:none}}
|
1 |
+
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-left:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-left:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative;margin-top:20px}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding:0}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar[data-type="a8c/template"],.template__block-container:before{display:none}.template__block-container:hover{cursor:pointer}.template__block-container .block-editor-block-list__block-edit [data-block]{margin:0}.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled,.template__block-container:hover .components-disabled{filter:blur(2px);transition:filter .2s linear}.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay,.template__block-container.is-selected .template-block__overlay .components-button,.template__block-container:hover .template-block__overlay,.template__block-container:hover .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template__block-container .template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;left:0;margin:0;opacity:0;padding:0;position:absolute;right:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template__block-container .template-block__overlay{border-color:rgba(66,88,99,.4)}.block-editor-block-list__block:first-child .template__block-container .template-block__overlay{border-bottom-width:1px}.block-editor-block-list__block:last-child .template__block-container .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template__block-container .template-block__overlay{border-width:1px}}.template__block-container .template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s;margin:0 auto}.template__block-container .template-block__overlay .components-button.hidden{display:none}.template__block-container .template-block__overlay .template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions{display:none}.template-block__placeholder .components-spinner{margin:0 auto}.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-page .edit-post-header .edit-post-fullscreen-mode-close,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-header .edit-post-fullscreen-mode-close,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-header .edit-post-fullscreen-mode-close{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;margin-right:10px;margin-left:-24px;border:none;border-right:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2{margin-left:-7px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-24px;margin-right:24px}@media (max-width:782px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{display:none}}@media (max-width:960px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}@media (max-width:599px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-left:-24px}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .block-editor-editor-skeleton__content,.post-type-page .edit-post-editor-regions__content,.post-type-wp_template_part .block-editor-editor-skeleton__content,.post-type-wp_template_part .edit-post-editor-regions__content{background:#eee}.post-type-page .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-page .edit-post-visual-editor.editor-styles-wrapper,.post-type-wp_template_part .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-visual-editor.editor-styles-wrapper{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-left:0;padding-right:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-page .block-editor-block-list__layout .block-editor-block-list__block[data-align=full],.post-type-page .block-editor-block-list__layout .wp-block[data-align=full],.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__layout .block-editor-block-list__block[data-align=full],.post-type-wp_template_part .block-editor-block-list__layout .wp-block[data-align=full]{margin-left:0;margin-right:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-right:14px;margin-left:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .block-editor-writing-flow__click-redirect,.post-type-wp_template_part .block-editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container .wp-block-column [data-type="core/social-links"] [data-block]{margin:0}@media (max-width:600px){.components-dropdown.table-of-contents{display:none}}
|
dotcom-fse/dist/dotcom-fse.rtl.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-right:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative;margin-top:20px}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding:0}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar[data-type="a8c/template"],.template__block-container:before{display:none}.template__block-container:hover{cursor:pointer}.template__block-container .block-editor-block-list__block-edit [data-block]{margin:0}.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled,.template__block-container:hover .components-disabled{filter:blur(2px);transition:filter .2s linear}.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay,.template__block-container.is-selected .template-block__overlay .components-button,.template__block-container:hover .template-block__overlay,.template__block-container:hover .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template__block-container .template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;right:0;margin:0;opacity:0;padding:0;position:absolute;left:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template__block-container .template-block__overlay{border-color:rgba(66,88,99,.4)}.block-editor-block-list__block:first-child .template__block-container .template-block__overlay{border-bottom-width:1px}.block-editor-block-list__block:last-child .template__block-container .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template__block-container .template-block__overlay{border-width:1px}}.template__block-container .template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s;margin:0 auto}.template__block-container .template-block__overlay .components-button.hidden{display:none}.template__block-container .template-block__overlay .template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions{display:none}.template-block__placeholder .components-spinner{margin:0 auto}.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-page .edit-post-header .edit-post-fullscreen-mode-close,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-header .edit-post-fullscreen-mode-close,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-header .edit-post-fullscreen-mode-close{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;margin-left:10px;margin-right:-24px;border:none;border-left:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2{margin-right:-7px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-24px;margin-left:24px}@media (max-width:782px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{display:none}}@media (max-width:960px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}@media (max-width:599px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-24px}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .block-editor-editor-skeleton__content,.post-type-page .edit-post-editor-regions__content,.post-type-wp_template_part .block-editor-editor-skeleton__content,.post-type-wp_template_part .edit-post-editor-regions__content{background:#eee}.post-type-page .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-page .edit-post-visual-editor.editor-styles-wrapper,.post-type-wp_template_part .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-visual-editor.editor-styles-wrapper{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-right:0;padding-left:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-page .block-editor-block-list__layout .block-editor-block-list__block[data-align=full],.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__layout .block-editor-block-list__block[data-align=full]{margin-right:0;margin-left:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-left:14px;margin-right:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .block-editor-writing-flow__click-redirect,.post-type-wp_template_part .block-editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container .wp-block-column [data-type="core/social-links"] [data-block]{margin:0}@media (max-width:600px){.components-dropdown.table-of-contents{display:none}}
|
1 |
+
.wp-block-a8c-navigation-menu.main-navigation{pointer-events:none}.post-content-block__selector{width:300px}.post-content-block__selector a{font-family:sans-serif;font-size:13px;padding-right:8px}.post-content-block__preview{pointer-events:none}.post-content-block__preview:after{content:"";clear:both;display:table}.post-content-block .editor-post-title,.show-post-title-before-content .editor-post-title{display:none}.show-post-title-before-content .post-content-block .editor-post-title{display:block}.block-editor-block-list__layout .post-content__block.is-selected .block-editor-block-contextual-toolbar{display:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit:before,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit:before{transition:none;border:none;outline:none;box-shadow:none}.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.has-child-selected>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-hovered>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block.is-navigate-mode>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb,.block-editor-block-list__layout .post-content__block.block-editor-block-list__block>.block-editor-block-list__block-edit>.block-editor-block-list__breadcrumb{display:none}.site-credit__block{display:flex;flex-direction:row;align-items:center;font-size:14px;color:grey}.site-credit__block.has-text-align-center{justify-content:center}.site-credit__block.has-text-align-left{justify-content:flex-start}.site-credit__block.has-text-align-right{justify-content:flex-end}.site-credit__block .site-name{font-weight:700}.site-credit__block .site-credit__selection{margin-right:5px;display:flex;flex-direction:row;align-items:center}.site-credit__block .site-credit__selection .components-base-control .components-base-control__field{margin-bottom:0}.block-editor .wp-block-a8c-site-description:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-description::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-description:-ms-input-placeholder{color:transparent}.block-editor .wp-block-a8c-site-title:focus{box-shadow:none;background-color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-webkit-input-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-moz-placeholder,.block-editor .wp-block.is-selected .wp-block-a8c-site-title::-moz-placeholder{color:transparent}.block-editor .wp-block.is-selected .wp-block-a8c-site-title:-ms-input-placeholder{color:transparent}.template-block{min-height:200px;overflow:hidden;position:relative;margin-top:20px}.post-type-page .editor-styles-wrapper .template-block .fse-template-part{padding:0}.components-popover.block-editor-block-list__block-popover .components-popover__content .block-editor-block-contextual-toolbar[data-type="a8c/template"],.template__block-container:before{display:none}.template__block-container:hover{cursor:pointer}.template__block-container .block-editor-block-list__block-edit [data-block]{margin:0}.template__block-container .is-navigating-to-template .components-disabled,.template__block-container.is-selected .components-disabled,.template__block-container:hover .components-disabled{filter:blur(2px);transition:filter .2s linear}.template__block-container .is-navigating-to-template .template-block__overlay,.template__block-container .is-navigating-to-template .template-block__overlay .components-button,.template__block-container.is-selected .template-block__overlay,.template__block-container.is-selected .template-block__overlay .components-button,.template__block-container:hover .template-block__overlay,.template__block-container:hover .template-block__overlay .components-button{opacity:1;transition:opacity .2s linear}.template__block-container .components-disabled{filter:blur(0);transition:filter .2s linear 0s}.template__block-container .block-editor-block-contextual-toolbar,.template__block-container .block-editor-block-list__block-edit:before,.template__block-container .block-editor-block-list__block-mobile-toolbar,.template__block-container .block-editor-block-list__breadcrumb,.template__block-container .block-editor-block-list__insertion-point{display:none}.template__block-container .template-block__overlay{background:hsla(0,0%,100%,.8);border:0 solid rgba(123,134,162,.3);bottom:0;right:0;margin:0;opacity:0;padding:0;position:absolute;left:0;transition:opacity .2s linear 0s;top:0;z-index:2}.is-selected .template__block-container .template-block__overlay{border-color:rgba(66,88,99,.4)}.block-editor-block-list__block:first-child .template__block-container .template-block__overlay{border-bottom-width:1px}.block-editor-block-list__block:last-child .template__block-container .template-block__overlay{border-top-width:1px}@media only screen and (min-width:768px){.template__block-container .template-block__overlay{border-width:1px}}.template__block-container .template-block__overlay .components-button{opacity:0;transition:opacity .2s linear 0s;margin:0 auto}.template__block-container .template-block__overlay .components-button.hidden{display:none}.template__block-container .template-block__overlay .template-block__loading{display:flex;align-items:center;color:#191e23}.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__fieldset,.block-editor-page:not(.post-type-wp_template_part) .fse-site-logo .components-placeholder__instructions{display:none}.template-block__placeholder .components-spinner{margin:0 auto}.close-button-override-thin,.post-type-page .edit-post-fullscreen-mode-close__toolbar,.post-type-page .edit-post-header .edit-post-fullscreen-mode-close,.post-type-post .edit-post-fullscreen-mode-close__toolbar,.post-type-post .edit-post-header .edit-post-fullscreen-mode-close,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar,.post-type-wp_template_part .edit-post-header .edit-post-fullscreen-mode-close{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{display:flex;align-items:center;margin-left:10px;margin-right:-24px;border:none;border-left:1px solid #e2e4e7}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-page .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override a:visited,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:active,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:hover,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:link,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override a:visited{text-decoration:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{font-size:13px}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .dashicons-arrow-left-alt2{margin-right:-7px}@media (max-width:599px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-2px}}@media (max-width:400px){.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-wide{display:none}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override-thin{display:flex}.post-type-page .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-24px;margin-left:24px}@media (max-width:782px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{display:none}}@media (max-width:960px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override .close-button-override__label{display:none}}@media (max-width:599px){.post-type-page .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-page .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-post .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .block-editor-editor-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override,.post-type-wp_template_part .interface-interface-skeleton__header .edit-post-fullscreen-mode-close__toolbar__override{margin-right:-24px}}.post-type-wp_template_part .edit-post-post-status,.post-type-wp_template_part .editor-post-title,.post-type-wp_template_part .editor-post-trash{display:none}.post-type-wp_template_part .edit-post-visual-editor{margin-top:20px;padding-top:0}.post-type-wp_template_part .editor-post-switch-to-draft{display:none}@media (min-width:768px){.post-type-page .block-editor-editor-skeleton__content,.post-type-page .edit-post-editor-regions__content,.post-type-wp_template_part .block-editor-editor-skeleton__content,.post-type-wp_template_part .edit-post-editor-regions__content{background:#eee}.post-type-page .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-page .edit-post-visual-editor.editor-styles-wrapper,.post-type-wp_template_part .edit-post-editor-regions__content .edit-post-visual-editor,.post-type-wp_template_part .edit-post-visual-editor.editor-styles-wrapper{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.12),0 1px 5px 0 rgba(0,0,0,.2);flex:none;margin:36px 32px}}.post-type-page .block-editor-block-list__layout,.post-type-wp_template_part .block-editor-block-list__layout{padding-right:0;padding-left:0}.post-type-page .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-page .block-editor-block-list__layout .block-editor-block-list__block[data-align=full],.post-type-page .block-editor-block-list__layout .wp-block[data-align=full],.post-type-wp_template_part .block-editor-block-list__block[data-align=full]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__layout .block-editor-block-list__block[data-align=full],.post-type-wp_template_part .block-editor-block-list__layout .wp-block[data-align=full]{margin-right:0;margin-left:0}.post-type-page .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit,.post-type-wp_template_part .block-editor-block-list__block[data-align=wide]>.block-editor-block-list__block-edit{margin-left:14px;margin-right:14px}@media (max-width:1200px){.post-type-page .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .wp-block:not([data-align=full]):not([data-align=wide]){max-width:580px}.post-type-page .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]),.post-type-wp_template_part .is-sidebar-opened .wp-block:not([data-align=full]):not([data-align=wide]){max-width:400px}}.post-type-page .block-editor-writing-flow__click-redirect,.post-type-wp_template_part .block-editor-writing-flow__click-redirect{display:none}.editor-styles-wrapper{background:#fff}.post-type-page .edit-post-visual-editor{padding-top:0}.post-type-page .block-editor-writing-flow{display:block}.post-type-page .wp-block.template__block-container .wp-block-column [data-type="core/social-links"] [data-block]{margin:0}@media (max-width:600px){.components-dropdown.table-of-contents{display:none}}
|
dotcom-fse/editor/style.scss
CHANGED
@@ -43,7 +43,8 @@
|
|
43 |
padding-left: 0;
|
44 |
padding-right: 0;
|
45 |
|
46 |
-
.block-editor-block-list__block[data-align='full']
|
|
|
47 |
margin-left: 0;
|
48 |
margin-right: 0;
|
49 |
}
|
43 |
padding-left: 0;
|
44 |
padding-right: 0;
|
45 |
|
46 |
+
.block-editor-block-list__block[data-align='full'],
|
47 |
+
.wp-block[data-align='full'] { // Gutenberg >= 8.0.0
|
48 |
margin-left: 0;
|
49 |
margin-right: 0;
|
50 |
}
|
dotcom-fse/helpers.php
CHANGED
@@ -106,6 +106,8 @@ function normalize_theme_slug( $theme_slug ) {
|
|
106 |
* Whether or not the site is eligible for FSE. This is essentially a feature
|
107 |
* gate to disable FSE on some sites which could theoretically otherwise use it.
|
108 |
*
|
|
|
|
|
109 |
* @return bool True if current site is eligible for FSE, false otherwise.
|
110 |
*/
|
111 |
function is_site_eligible_for_full_site_editing() {
|
@@ -116,7 +118,7 @@ function is_site_eligible_for_full_site_editing() {
|
|
116 |
*
|
117 |
* @param bool true if Full Site Editing should be disabled, false otherwise.
|
118 |
*/
|
119 |
-
return ! apply_filters( 'a8c_disable_full_site_editing',
|
120 |
}
|
121 |
|
122 |
/**
|
106 |
* Whether or not the site is eligible for FSE. This is essentially a feature
|
107 |
* gate to disable FSE on some sites which could theoretically otherwise use it.
|
108 |
*
|
109 |
+
* By default, sites should not be eligible.
|
110 |
+
*
|
111 |
* @return bool True if current site is eligible for FSE, false otherwise.
|
112 |
*/
|
113 |
function is_site_eligible_for_full_site_editing() {
|
118 |
*
|
119 |
* @param bool true if Full Site Editing should be disabled, false otherwise.
|
120 |
*/
|
121 |
+
return ! apply_filters( 'a8c_disable_full_site_editing', true );
|
122 |
}
|
123 |
|
124 |
/**
|
dotcom-fse/plugins/close-button-override/style.scss
CHANGED
@@ -53,6 +53,7 @@
|
|
53 |
}
|
54 |
|
55 |
// add an extra class specific for the new Gutenberg plugin version so the main override above stays compatible with < v7.7
|
|
|
56 |
.post-type-wp_template_part
|
57 |
.block-editor-editor-skeleton__header
|
58 |
.edit-post-fullscreen-mode-close__toolbar__override,
|
@@ -61,6 +62,15 @@
|
|
61 |
.edit-post-fullscreen-mode-close__toolbar__override,
|
62 |
.post-type-post
|
63 |
.block-editor-editor-skeleton__header
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
.edit-post-fullscreen-mode-close__toolbar__override {
|
65 |
// Close button override doesn't need the extraneous left-padding
|
66 |
// provided by .edit-post-header__toolbar from WP. So here we
|
53 |
}
|
54 |
|
55 |
// add an extra class specific for the new Gutenberg plugin version so the main override above stays compatible with < v7.7
|
56 |
+
// includes additional `.interface-interface-skeleton__header` classes for compatibility with Gutenberg >= 8.0.0
|
57 |
.post-type-wp_template_part
|
58 |
.block-editor-editor-skeleton__header
|
59 |
.edit-post-fullscreen-mode-close__toolbar__override,
|
62 |
.edit-post-fullscreen-mode-close__toolbar__override,
|
63 |
.post-type-post
|
64 |
.block-editor-editor-skeleton__header
|
65 |
+
.edit-post-fullscreen-mode-close__toolbar__override,
|
66 |
+
.post-type-wp_template_part
|
67 |
+
.interface-interface-skeleton__header
|
68 |
+
.edit-post-fullscreen-mode-close__toolbar__override,
|
69 |
+
.post-type-page
|
70 |
+
.interface-interface-skeleton__header
|
71 |
+
.edit-post-fullscreen-mode-close__toolbar__override,
|
72 |
+
.post-type-post
|
73 |
+
.interface-interface-skeleton__header
|
74 |
.edit-post-fullscreen-mode-close__toolbar__override {
|
75 |
// Close button override doesn't need the extraneous left-padding
|
76 |
// provided by .edit-post-header__toolbar from WP. So here we
|
event-countdown-block/dist/event-countdown-block.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-blocks', 'wp-components', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-blocks', 'wp-components', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '63445db0eb6ff7223607ac07ce0730b9');
|
full-site-editing-plugin.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Full Site Editing
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
-
* Version: 1.
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com/wordpress-plugins/
|
8 |
* License: GPLv2 or later
|
@@ -35,7 +35,7 @@ namespace A8C\FSE;
|
|
35 |
*
|
36 |
* @var string
|
37 |
*/
|
38 |
-
define( 'PLUGIN_VERSION', '1.
|
39 |
|
40 |
// Always include these helper files for dotcom FSE.
|
41 |
require_once __DIR__ . '/dotcom-fse/helpers.php';
|
@@ -225,7 +225,7 @@ function load_blog_posts_block() {
|
|
225 |
return;
|
226 |
}
|
227 |
|
228 |
-
require_once __DIR__ . '/
|
229 |
}
|
230 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_blog_posts_block' );
|
231 |
|
@@ -251,3 +251,17 @@ function load_block_patterns() {
|
|
251 |
Block_Patterns::get_instance();
|
252 |
}
|
253 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_block_patterns' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* Plugin Name: Full Site Editing
|
4 |
* Description: Enhances your page creation workflow within the Block Editor.
|
5 |
+
* Version: 1.2
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com/wordpress-plugins/
|
8 |
* License: GPLv2 or later
|
35 |
*
|
36 |
* @var string
|
37 |
*/
|
38 |
+
define( 'PLUGIN_VERSION', '1.2' );
|
39 |
|
40 |
// Always include these helper files for dotcom FSE.
|
41 |
require_once __DIR__ . '/dotcom-fse/helpers.php';
|
225 |
return;
|
226 |
}
|
227 |
|
228 |
+
require_once __DIR__ . '/newspack-blocks/index.php';
|
229 |
}
|
230 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_blog_posts_block' );
|
231 |
|
251 |
Block_Patterns::get_instance();
|
252 |
}
|
253 |
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_block_patterns' );
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Load Premium Content Block
|
257 |
+
*/
|
258 |
+
function load_premium_content() {
|
259 |
+
/**
|
260 |
+
* Disabled until we're ready to disable the premium content plugin in mp-plugins/earn
|
261 |
+
*/
|
262 |
+
if ( function_exists( '\A8C\FSE\Earn\PremiumContent\premium_content_block_init' ) ) {
|
263 |
+
return;
|
264 |
+
}
|
265 |
+
require_once __DIR__ . '/premium-content/premium-content.php';
|
266 |
+
}
|
267 |
+
add_action( 'plugins_loaded', __NAMESPACE__ . '\load_premium_content' );
|
global-styles/class-global-styles.php
CHANGED
@@ -81,15 +81,15 @@ class Global_Styles {
|
|
81 |
const VERSION = '2003121439';
|
82 |
|
83 |
const SYSTEM_FONT = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif';
|
84 |
-
const AVAILABLE_FONTS =
|
85 |
-
|
86 |
'label' => 'Theme Default',
|
87 |
'value' => 'unset',
|
88 |
-
|
89 |
-
|
90 |
'label' => 'System Font',
|
91 |
'value' => self::SYSTEM_FONT,
|
92 |
-
|
93 |
'Arvo',
|
94 |
'Cabin',
|
95 |
'Chivo',
|
@@ -111,7 +111,7 @@ class Global_Styles {
|
|
111 |
'Source Serif Pro',
|
112 |
'Space Mono',
|
113 |
'Work Sans',
|
114 |
-
|
115 |
|
116 |
/**
|
117 |
* Creates instance.
|
@@ -135,87 +135,87 @@ class Global_Styles {
|
|
135 |
// DATA TO EXPOSE THROUGH THE REST API.
|
136 |
require_once __DIR__ . '/includes/class-data-set.php';
|
137 |
$this->rest_api_data = new Data_Set(
|
138 |
-
|
139 |
-
'blogname' =>
|
140 |
'type' => 'option',
|
141 |
'name' => 'blogname',
|
142 |
'default' => 'Your site name',
|
143 |
-
|
144 |
-
'font_base' =>
|
145 |
'type' => 'option',
|
146 |
-
'name' =>
|
147 |
'default' => 'unset',
|
148 |
'updatable' => true,
|
149 |
-
|
150 |
-
'font_headings' =>
|
151 |
'type' => 'option',
|
152 |
-
'name' =>
|
153 |
'default' => 'unset',
|
154 |
'updatable' => true,
|
155 |
-
|
156 |
-
'font_base_default' =>
|
157 |
'type' => 'theme',
|
158 |
-
'name' =>
|
159 |
'default' => self::SYSTEM_FONT,
|
160 |
-
|
161 |
-
'font_headings_default' =>
|
162 |
'type' => 'theme',
|
163 |
-
'name' =>
|
164 |
'default' => self::SYSTEM_FONT,
|
165 |
-
|
166 |
-
'font_options' =>
|
167 |
'type' => 'literal',
|
168 |
'default' => self::AVAILABLE_FONTS,
|
169 |
-
|
170 |
-
'font_pairings' =>
|
171 |
'type' => 'literal',
|
172 |
-
'default' =>
|
173 |
-
|
174 |
'label' => 'Playfair Display & Roboto',
|
175 |
'headings' => 'Playfair Display',
|
176 |
'base' => 'Roboto',
|
177 |
'preview' => 'PLAY_ROBOTO', // See font-pairings-panel-previews.js.
|
178 |
-
|
179 |
-
|
180 |
'label' => 'Rubik & Work Sans',
|
181 |
'headings' => 'Rubik',
|
182 |
'base' => 'Work Sans',
|
183 |
'preview' => 'RUBIK_WORK', // See font-pairings-panel-previews.js.
|
184 |
-
|
185 |
-
|
186 |
'label' => 'System Font & Libre Baskerville',
|
187 |
'headings' => self::SYSTEM_FONT,
|
188 |
'base' => 'Libre Baskerville',
|
189 |
'preview' => 'SYSTEM_BASKER', // See font-pairings-panel-previews.js.
|
190 |
-
|
191 |
-
|
192 |
'label' => 'Space Mono & Lora',
|
193 |
'headings' => 'Space Mono',
|
194 |
'base' => 'Lora',
|
195 |
'preview' => 'SPACE_LORA', // See font-pairings-panel-previews.js.
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
);
|
201 |
|
202 |
// Setup REST API for the editor. Some environments (WordPress.com)
|
203 |
// may not load the theme functions for REST API calls,
|
204 |
// so we need to initialize it independently of theme support.
|
205 |
-
add_action( 'rest_api_init',
|
206 |
|
207 |
-
add_filter( 'jetpack_global_styles_data_set_get_data',
|
208 |
-
add_filter( 'jetpack_global_styles_data_set_save_data',
|
209 |
|
210 |
// Setup editor.
|
211 |
if ( $this->can_use_global_styles() ) {
|
212 |
add_action(
|
213 |
'enqueue_block_editor_assets',
|
214 |
-
|
215 |
);
|
216 |
add_filter(
|
217 |
'block_editor_settings',
|
218 |
-
|
219 |
PHP_INT_MAX // So it runs last and overrides any style provided by the theme.
|
220 |
);
|
221 |
}
|
@@ -223,7 +223,7 @@ class Global_Styles {
|
|
223 |
// Setup front-end.
|
224 |
add_action(
|
225 |
'wp_enqueue_scripts',
|
226 |
-
|
227 |
PHP_INT_MAX // So it runs last and overrides any style provided by the theme.
|
228 |
);
|
229 |
}
|
@@ -234,7 +234,7 @@ class Global_Styles {
|
|
234 |
private function update_plugin_settings() {
|
235 |
$settings = apply_filters(
|
236 |
'jetpack_global_styles_settings',
|
237 |
-
|
238 |
// Server-side settings.
|
239 |
'rest_namespace' => $this->rest_namespace,
|
240 |
'rest_route' => $this->rest_route,
|
@@ -244,7 +244,7 @@ class Global_Styles {
|
|
244 |
'rest_path_client' => $this->rest_path_client,
|
245 |
'redux_store_name' => $this->redux_store_name,
|
246 |
'plugin_name' => $this->plugin_name,
|
247 |
-
|
248 |
);
|
249 |
|
250 |
$this->rest_namespace = $settings['rest_namespace'];
|
@@ -265,7 +265,7 @@ class Global_Styles {
|
|
265 |
$this->rest_namespace,
|
266 |
$this->rest_route,
|
267 |
$this->rest_api_data,
|
268 |
-
|
269 |
);
|
270 |
$rest_api->setup();
|
271 |
}
|
@@ -321,7 +321,7 @@ class Global_Styles {
|
|
321 |
: null;
|
322 |
$dependencies = isset( $asset['dependencies'] ) ?
|
323 |
$asset['dependencies'] :
|
324 |
-
|
325 |
$version = isset( $asset['version'] ) ?
|
326 |
$asset['version'] :
|
327 |
filemtime( plugin_dir_path( __FILE__ ) . 'dist/global-styles.js' );
|
@@ -336,16 +336,16 @@ class Global_Styles {
|
|
336 |
wp_localize_script(
|
337 |
'jetpack-global-styles-editor-script',
|
338 |
'JETPACK_GLOBAL_STYLES_EDITOR_CONSTANTS',
|
339 |
-
|
340 |
'PLUGIN_NAME' => $this->plugin_name,
|
341 |
'REST_PATH' => $this->rest_path_client,
|
342 |
'STORE_NAME' => $this->redux_store_name,
|
343 |
-
|
344 |
);
|
345 |
wp_enqueue_style(
|
346 |
'jetpack-global-styles-editor-style',
|
347 |
plugins_url( 'dist/global-styles.css', __FILE__ ),
|
348 |
-
|
349 |
filemtime( plugin_dir_path( __FILE__ ) . 'dist/global-styles.css' )
|
350 |
);
|
351 |
}
|
@@ -359,13 +359,15 @@ class Global_Styles {
|
|
359 |
* @return void
|
360 |
*/
|
361 |
public function wp_enqueue_scripts() {
|
362 |
-
|
363 |
'jetpack-global-styles-frontend-style',
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
367 |
);
|
368 |
wp_add_inline_style( 'jetpack-global-styles-frontend-style', $this->get_inline_css( true ) );
|
|
|
369 |
}
|
370 |
|
371 |
/**
|
@@ -385,12 +387,12 @@ class Global_Styles {
|
|
385 |
* - all of them for the backend
|
386 |
* - only the selected ones for the frontend
|
387 |
*/
|
388 |
-
$font_list =
|
389 |
// We want $font_list to only contain valid Google Font values,
|
390 |
// so we filter out things like 'unset' on the system font.
|
391 |
-
$font_values = array_diff( $this->get_font_values( $data['font_options'] ),
|
392 |
if ( true === $only_selected_fonts ) {
|
393 |
-
foreach (
|
394 |
if ( in_array( $data[ $key ], $font_values, true ) ) {
|
395 |
$font_list[] = $data[ $key ];
|
396 |
}
|
@@ -423,7 +425,7 @@ class Global_Styles {
|
|
423 |
*/
|
424 |
$result = $result . ':root {';
|
425 |
$value = '';
|
426 |
-
$keys =
|
427 |
foreach ( $keys as $key ) {
|
428 |
$value = $data[ $key ];
|
429 |
$result = $result . ' --' . str_replace( '_', '-', $key ) . ': ' . $value . ';';
|
@@ -479,7 +481,7 @@ class Global_Styles {
|
|
479 |
* @return array Font values.
|
480 |
*/
|
481 |
private function get_font_values( $font_list ) {
|
482 |
-
$font_values =
|
483 |
foreach ( $font_list as $font ) {
|
484 |
if ( is_array( $font ) ) {
|
485 |
$font_values[] = $font['value'];
|
@@ -497,10 +499,10 @@ class Global_Styles {
|
|
497 |
* @return array Filtered result.
|
498 |
*/
|
499 |
public function filter_and_validate_font_options( $incoming_data ) {
|
500 |
-
$result =
|
501 |
|
502 |
$font_values = $this->get_font_values( self::AVAILABLE_FONTS );
|
503 |
-
foreach (
|
504 |
if (
|
505 |
array_key_exists( $key, $incoming_data ) &&
|
506 |
in_array( $incoming_data[ $key ], $font_values, true )
|
@@ -513,4 +515,4 @@ class Global_Styles {
|
|
513 |
}
|
514 |
}
|
515 |
|
516 |
-
add_action( 'init',
|
81 |
const VERSION = '2003121439';
|
82 |
|
83 |
const SYSTEM_FONT = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif';
|
84 |
+
const AVAILABLE_FONTS = array(
|
85 |
+
array(
|
86 |
'label' => 'Theme Default',
|
87 |
'value' => 'unset',
|
88 |
+
),
|
89 |
+
array(
|
90 |
'label' => 'System Font',
|
91 |
'value' => self::SYSTEM_FONT,
|
92 |
+
),
|
93 |
'Arvo',
|
94 |
'Cabin',
|
95 |
'Chivo',
|
111 |
'Source Serif Pro',
|
112 |
'Space Mono',
|
113 |
'Work Sans',
|
114 |
+
);
|
115 |
|
116 |
/**
|
117 |
* Creates instance.
|
135 |
// DATA TO EXPOSE THROUGH THE REST API.
|
136 |
require_once __DIR__ . '/includes/class-data-set.php';
|
137 |
$this->rest_api_data = new Data_Set(
|
138 |
+
array(
|
139 |
+
'blogname' => array(
|
140 |
'type' => 'option',
|
141 |
'name' => 'blogname',
|
142 |
'default' => 'Your site name',
|
143 |
+
),
|
144 |
+
'font_base' => array(
|
145 |
'type' => 'option',
|
146 |
+
'name' => array( 'jetpack_global_styles', 'font_base' ),
|
147 |
'default' => 'unset',
|
148 |
'updatable' => true,
|
149 |
+
),
|
150 |
+
'font_headings' => array(
|
151 |
'type' => 'option',
|
152 |
+
'name' => array( 'jetpack_global_styles', 'font_headings' ),
|
153 |
'default' => 'unset',
|
154 |
'updatable' => true,
|
155 |
+
),
|
156 |
+
'font_base_default' => array(
|
157 |
'type' => 'theme',
|
158 |
+
'name' => array( 'jetpack-global-styles', 'font_base' ),
|
159 |
'default' => self::SYSTEM_FONT,
|
160 |
+
),
|
161 |
+
'font_headings_default' => array(
|
162 |
'type' => 'theme',
|
163 |
+
'name' => array( 'jetpack-global-styles', 'font_headings' ),
|
164 |
'default' => self::SYSTEM_FONT,
|
165 |
+
),
|
166 |
+
'font_options' => array(
|
167 |
'type' => 'literal',
|
168 |
'default' => self::AVAILABLE_FONTS,
|
169 |
+
),
|
170 |
+
'font_pairings' => array(
|
171 |
'type' => 'literal',
|
172 |
+
'default' => array(
|
173 |
+
array(
|
174 |
'label' => 'Playfair Display & Roboto',
|
175 |
'headings' => 'Playfair Display',
|
176 |
'base' => 'Roboto',
|
177 |
'preview' => 'PLAY_ROBOTO', // See font-pairings-panel-previews.js.
|
178 |
+
),
|
179 |
+
array(
|
180 |
'label' => 'Rubik & Work Sans',
|
181 |
'headings' => 'Rubik',
|
182 |
'base' => 'Work Sans',
|
183 |
'preview' => 'RUBIK_WORK', // See font-pairings-panel-previews.js.
|
184 |
+
),
|
185 |
+
array(
|
186 |
'label' => 'System Font & Libre Baskerville',
|
187 |
'headings' => self::SYSTEM_FONT,
|
188 |
'base' => 'Libre Baskerville',
|
189 |
'preview' => 'SYSTEM_BASKER', // See font-pairings-panel-previews.js.
|
190 |
+
),
|
191 |
+
array(
|
192 |
'label' => 'Space Mono & Lora',
|
193 |
'headings' => 'Space Mono',
|
194 |
'base' => 'Lora',
|
195 |
'preview' => 'SPACE_LORA', // See font-pairings-panel-previews.js.
|
196 |
+
),
|
197 |
+
),
|
198 |
+
),
|
199 |
+
)
|
200 |
);
|
201 |
|
202 |
// Setup REST API for the editor. Some environments (WordPress.com)
|
203 |
// may not load the theme functions for REST API calls,
|
204 |
// so we need to initialize it independently of theme support.
|
205 |
+
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
|
206 |
|
207 |
+
add_filter( 'jetpack_global_styles_data_set_get_data', array( $this, 'maybe_filter_font_list' ) );
|
208 |
+
add_filter( 'jetpack_global_styles_data_set_save_data', array( $this, 'filter_and_validate_font_options' ) );
|
209 |
|
210 |
// Setup editor.
|
211 |
if ( $this->can_use_global_styles() ) {
|
212 |
add_action(
|
213 |
'enqueue_block_editor_assets',
|
214 |
+
array( $this, 'enqueue_block_editor_assets' )
|
215 |
);
|
216 |
add_filter(
|
217 |
'block_editor_settings',
|
218 |
+
array( $this, 'block_editor_settings' ),
|
219 |
PHP_INT_MAX // So it runs last and overrides any style provided by the theme.
|
220 |
);
|
221 |
}
|
223 |
// Setup front-end.
|
224 |
add_action(
|
225 |
'wp_enqueue_scripts',
|
226 |
+
array( $this, 'wp_enqueue_scripts' ),
|
227 |
PHP_INT_MAX // So it runs last and overrides any style provided by the theme.
|
228 |
);
|
229 |
}
|
234 |
private function update_plugin_settings() {
|
235 |
$settings = apply_filters(
|
236 |
'jetpack_global_styles_settings',
|
237 |
+
array(
|
238 |
// Server-side settings.
|
239 |
'rest_namespace' => $this->rest_namespace,
|
240 |
'rest_route' => $this->rest_route,
|
244 |
'rest_path_client' => $this->rest_path_client,
|
245 |
'redux_store_name' => $this->redux_store_name,
|
246 |
'plugin_name' => $this->plugin_name,
|
247 |
+
)
|
248 |
);
|
249 |
|
250 |
$this->rest_namespace = $settings['rest_namespace'];
|
265 |
$this->rest_namespace,
|
266 |
$this->rest_route,
|
267 |
$this->rest_api_data,
|
268 |
+
array( $this, 'can_use_global_styles' )
|
269 |
);
|
270 |
$rest_api->setup();
|
271 |
}
|
321 |
: null;
|
322 |
$dependencies = isset( $asset['dependencies'] ) ?
|
323 |
$asset['dependencies'] :
|
324 |
+
array();
|
325 |
$version = isset( $asset['version'] ) ?
|
326 |
$asset['version'] :
|
327 |
filemtime( plugin_dir_path( __FILE__ ) . 'dist/global-styles.js' );
|
336 |
wp_localize_script(
|
337 |
'jetpack-global-styles-editor-script',
|
338 |
'JETPACK_GLOBAL_STYLES_EDITOR_CONSTANTS',
|
339 |
+
array(
|
340 |
'PLUGIN_NAME' => $this->plugin_name,
|
341 |
'REST_PATH' => $this->rest_path_client,
|
342 |
'STORE_NAME' => $this->redux_store_name,
|
343 |
+
)
|
344 |
);
|
345 |
wp_enqueue_style(
|
346 |
'jetpack-global-styles-editor-style',
|
347 |
plugins_url( 'dist/global-styles.css', __FILE__ ),
|
348 |
+
array(),
|
349 |
filemtime( plugin_dir_path( __FILE__ ) . 'dist/global-styles.css' )
|
350 |
);
|
351 |
}
|
359 |
* @return void
|
360 |
*/
|
361 |
public function wp_enqueue_scripts() {
|
362 |
+
wp_register_style(
|
363 |
'jetpack-global-styles-frontend-style',
|
364 |
+
false,
|
365 |
+
array(),
|
366 |
+
true,
|
367 |
+
true
|
368 |
);
|
369 |
wp_add_inline_style( 'jetpack-global-styles-frontend-style', $this->get_inline_css( true ) );
|
370 |
+
wp_enqueue_style( 'jetpack-global-styles-frontend-style' );
|
371 |
}
|
372 |
|
373 |
/**
|
387 |
* - all of them for the backend
|
388 |
* - only the selected ones for the frontend
|
389 |
*/
|
390 |
+
$font_list = array();
|
391 |
// We want $font_list to only contain valid Google Font values,
|
392 |
// so we filter out things like 'unset' on the system font.
|
393 |
+
$font_values = array_diff( $this->get_font_values( $data['font_options'] ), array( 'unset', self::SYSTEM_FONT ) );
|
394 |
if ( true === $only_selected_fonts ) {
|
395 |
+
foreach ( array( 'font_base', 'font_base_default', 'font_headings', 'font_headings_default' ) as $key ) {
|
396 |
if ( in_array( $data[ $key ], $font_values, true ) ) {
|
397 |
$font_list[] = $data[ $key ];
|
398 |
}
|
425 |
*/
|
426 |
$result = $result . ':root {';
|
427 |
$value = '';
|
428 |
+
$keys = array( 'font_headings', 'font_base', 'font_headings_default', 'font_base_default' );
|
429 |
foreach ( $keys as $key ) {
|
430 |
$value = $data[ $key ];
|
431 |
$result = $result . ' --' . str_replace( '_', '-', $key ) . ': ' . $value . ';';
|
481 |
* @return array Font values.
|
482 |
*/
|
483 |
private function get_font_values( $font_list ) {
|
484 |
+
$font_values = array();
|
485 |
foreach ( $font_list as $font ) {
|
486 |
if ( is_array( $font ) ) {
|
487 |
$font_values[] = $font['value'];
|
499 |
* @return array Filtered result.
|
500 |
*/
|
501 |
public function filter_and_validate_font_options( $incoming_data ) {
|
502 |
+
$result = array();
|
503 |
|
504 |
$font_values = $this->get_font_values( self::AVAILABLE_FONTS );
|
505 |
+
foreach ( array( 'font_base', 'font_headings' ) as $key ) {
|
506 |
if (
|
507 |
array_key_exists( $key, $incoming_data ) &&
|
508 |
in_array( $incoming_data[ $key ], $font_values, true )
|
515 |
}
|
516 |
}
|
517 |
|
518 |
+
add_action( 'init', array( __NAMESPACE__ . '\Global_Styles', 'init' ) );
|
global-styles/dist/global-styles.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill'), 'version' => '64a772dd5562ecd0d834719b8a397275');
|
global-styles/static/blank.css
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* DO NOT DELETE.
|
3 |
-
*
|
4 |
-
* Placeholder file so we can use wp_add_inline_styles
|
5 |
-
* to dynamically add fonts, custom properties, etc.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
jetpack-timeline/dist/jetpack-timeline.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '1e4d5d0d22a5647b9c7de0aa358d6c17');
|
newspack-blocks/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Newspack Blocks
|
2 |
+
|
3 |
+
Some of the Newspack blocks were added to this repository in order to make it available to other parts of the FSE plugin, such as Starter Page Templates where these blocks will be used.
|
4 |
+
|
5 |
+
## Block Posts Block
|
6 |
+
|
7 |
+
This block allows you to list your posts in various layouts and filter them by criteria like category, tag or author.
|
8 |
+
|
9 |
+
It originally comes from the [Newspack Blocks collection](https://github.com/automattic/newspack-blocks) and the block is still being developed there.
|
10 |
+
|
11 |
+
## Posts Carousel Block
|
12 |
+
|
13 |
+
This block allows you to create a carousel of post's featured images and filter them by criteria like category, tag or author.
|
14 |
+
|
15 |
+
It originally comes from the [Newspack Blocks collection](https://github.com/automattic/newspack-blocks) and the block is still being developed there.
|
16 |
+
|
17 |
+
## Structure
|
18 |
+
|
19 |
+
```
|
20 |
+
index.php — main entry file, registers the blocks on backend
|
21 |
+
blog-posts-block-editor.js — assets for the blog-posts-block editor
|
22 |
+
blog-posts-block-view.js — assets for the blog-posts-block rendered on frontend
|
23 |
+
carousel-block-editor.js — assets for the carousel-block editor
|
24 |
+
carousel-block-view.js — assets for the carousel-block rendered on frontend
|
25 |
+
synced-newspack-blocks/** — source code synced from the Newspack Blocks repository, not tracked in Calypso git repo
|
26 |
+
```
|
27 |
+
|
28 |
+
`blog-posts-block-editor.js`, `blog-posts-block-view.js`, `carousel-block-editor.js`, `carousel-block-view.js` and `index.php` are files written in order to bridge the parent plugin with the Newspack Blocks. It changes the block names to an `a8c/` namespace and does things like registering REST fields or styles and scripts. In these files we are free to do all those changes because they are not shared with Newspack and only live here in this repository.
|
29 |
+
|
30 |
+
### Synchronizing the code
|
31 |
+
|
32 |
+
You can see that `synced-newspack-blocks` is being synced with the Newspack Blocks repository. Please make all improvements and additions on the Newspack side. Please don't make any direct changes to files in this directory as the next synchronization will overwrite them. Synced files are not being tracked in git and they are always downloaded fresh using the sync script explained further in this document.
|
33 |
+
|
34 |
+
Once your changes land on the Newspack side, coordinate with the team (over issues/PRs) to [make a new release](https://github.com/Automattic/newspack-blocks/releases) and once you have the release ID, you can pull the code into here.
|
35 |
+
|
36 |
+
While being in `apps/full-site-editing/` directory, you can run:
|
37 |
+
|
38 |
+
```
|
39 |
+
yarn run sync:newspack-blocks --release=1.0.0-alpha.17
|
40 |
+
```
|
41 |
+
|
42 |
+
This will pull the code from the release and integrate it into this repository. Please review changes, make sure to update `NEWSPACK_BLOCKS__VERSION` in [index.php](./index.php) and commit.
|
43 |
+
|
44 |
+
### Local development
|
45 |
+
|
46 |
+
Sometimes, probably, you will need to sync the NHA code straight in your local environment. It means you will get working on both projects at the same time. For this situation, you'd like to reference the code source through the `path` bin script argument.
|
47 |
+
|
48 |
+
```
|
49 |
+
yarn run sync:newspack-blocks --path=/Absolute/path/of/newspack-blocks/
|
50 |
+
```
|
blog-posts-block/editor.js → newspack-blocks/blog-posts-block-editor.js
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
/* eslint-disable import/no-extraneous-dependencies */
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
import { registerBlockType } from '@wordpress/blocks';
|
6 |
import { __ } from '@wordpress/i18n';
|
@@ -8,10 +8,10 @@ import { addFilter } from '@wordpress/hooks';
|
|
8 |
/* eslint-enable import/no-extraneous-dependencies */
|
9 |
|
10 |
/**
|
11 |
-
*
|
12 |
*/
|
13 |
-
import { settings } from './newspack-
|
14 |
-
import { registerQueryStore } from './newspack-
|
15 |
|
16 |
/**
|
17 |
* Block name in the A8C\FSE context.
|
1 |
/* eslint-disable import/no-extraneous-dependencies */
|
2 |
/**
|
3 |
+
* External dependencies
|
4 |
*/
|
5 |
import { registerBlockType } from '@wordpress/blocks';
|
6 |
import { __ } from '@wordpress/i18n';
|
8 |
/* eslint-enable import/no-extraneous-dependencies */
|
9 |
|
10 |
/**
|
11 |
+
* Internal dependencies
|
12 |
*/
|
13 |
+
import { settings } from './synced-newspack-blocks/blocks/homepage-articles/index';
|
14 |
+
import { registerQueryStore } from './synced-newspack-blocks/blocks/homepage-articles/store';
|
15 |
|
16 |
/**
|
17 |
* Block name in the A8C\FSE context.
|
newspack-blocks/blog-posts-block-view.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import './synced-newspack-blocks/blocks/homepage-articles/view';
|
newspack-blocks/carousel-block-editor.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* eslint-disable import/no-extraneous-dependencies */
|
2 |
+
/**
|
3 |
+
* External dependencies
|
4 |
+
*/
|
5 |
+
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
import { __ } from '@wordpress/i18n';
|
7 |
+
import { addFilter } from '@wordpress/hooks';
|
8 |
+
/* eslint-enable import/no-extraneous-dependencies */
|
9 |
+
|
10 |
+
/**
|
11 |
+
* External dependencies
|
12 |
+
*/
|
13 |
+
import { settings } from './synced-newspack-blocks/blocks/carousel/index';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Block name in the A8C\FSE context.
|
17 |
+
*/
|
18 |
+
const blockName = 'a8c/posts-carousel';
|
19 |
+
|
20 |
+
function setBlockTransformationName( name ) {
|
21 |
+
return name !== 'newspack-blocks/carousel' ? name : blockName;
|
22 |
+
}
|
23 |
+
|
24 |
+
addFilter(
|
25 |
+
'blocks.transforms_from_name',
|
26 |
+
'set-transformed-block-name',
|
27 |
+
setBlockTransformationName
|
28 |
+
);
|
29 |
+
|
30 |
+
registerBlockType( blockName, {
|
31 |
+
...settings,
|
32 |
+
title: __( 'Posts Carousel', 'full-site-editing' ),
|
33 |
+
category: 'layout',
|
34 |
+
} );
|
newspack-blocks/carousel-block-view.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import './synced-newspack-blocks/blocks/carousel/view';
|
blog-posts-block/dist/editor.asset.php → newspack-blocks/dist/blog-posts-block-editor.asset.php
RENAMED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '5e33115f59348cf111668309cf2f6406');
|
blog-posts-block/dist/editor.css → newspack-blocks/dist/blog-posts-block-editor.css
RENAMED
File without changes
|
blog-posts-block/dist/editor.js → newspack-blocks/dist/blog-posts-block-editor.js
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=37)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},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){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){!function(){e.exports=this.wp.htmlEntities}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t,n){var o=n(3);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var o=n(
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
-
*/!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var c=typeof o;if("string"===c||"number"===c)e.push(o);else if(Array.isArray(o)&&o.length){var a=r.apply(null,o);a&&e.push(a)}else if("object"===c)for(var i in o)n.call(o,i)&&o[i]&&e.push(i)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,n){var o=n(21);e.exports=function(e){if(Array.isArray(e))return o(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t,n){var o=n(21);e.exports=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t){e.exports=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}}},function(e,t,n){var o=n(33),r=n(4);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?r(e):t}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var o=n(9),r=n.n(o),c=n(16),a=n(1),i=n(17),s=n(0),l=n(2),u=n(18),p=n.n(u),f=n(12),d=n.n(f),h=n(19),g=n.n(h),b=n(4),m=n.n(b),O=n(13),y=n.n(O),j=n(14),v=n.n(j),w=n(3),_=n.n(w),k=n(22),S=n.n(k),E=n(6),C=n.n(E),P=n(7),x=n(5),A=n(11),T=(n(34),function(e){y()(n,e);var t=v()(n);function n(e){var o;return d()(this,n),o=t.call(this,e),_()(m()(o),"isFetchingInfoOnLoad",(function(){var e=o.props,t=e.tokens,n=e.fetchSavedInfo;return Boolean(t.length&&n)})),o.state={suggestions:[],validValues:{},loading:o.isFetchingInfoOnLoad()},o.debouncedUpdateSuggestions=Object(A.debounce)(o.updateSuggestions,500),o}return g()(n,[{key:"componentDidMount",value:function(){var e=this;if(this.isFetchingInfoOnLoad()){var t=this.props,n=t.tokens;(0,t.fetchSavedInfo)(n).then((function(t){var n=e.state.validValues;t.forEach((function(e){n[e.value]=e.label})),e.setState({validValues:n,loading:!1})}))}}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest,this.debouncedUpdateSuggestions.cancel()}},{key:"getLabelsForValues",value:function(e){var t=this.state.validValues;return e.reduce((function(e,n){return t[n]?[].concat(p()(e),[t[n]]):e}),[])}},{key:"getValuesForLabels",value:function(e){var t=this.state.validValues;return e.map((function(e){return Object.keys(t).find((function(n){return t[n]===e}))}))}},{key:"updateSuggestions",value:function(e){var t=this,n=this.props.fetchSuggestions;n&&this.setState({loading:!0},(function(){var o=n(e);o.then((function(e){if(t.suggestionsRequest===o){var n=t.state.validValues,r=[];e.forEach((function(e){r.push(e.label),n[e.value]=e.label})),t.setState({suggestions:r,validValues:n,loading:!1})}})).catch((function(){t.suggestionsRequest===o&&t.setState({loading:!1})})),t.suggestionsRequest=o}))}},{key:"handleOnChange",value:function(e){(0,this.props.onChange)(this.getValuesForLabels(e))}},{key:"getTokens",value:function(){var e=this.props.tokens;return this.getLabelsForValues(e)}},{key:"render",value:function(){var e=this,t=this.props,n=t.help,o=t.label,r=void 0===o?"":o,c=this.state,a=c.suggestions,i=c.loading;return Object(s.createElement)("div",{className:"autocomplete-tokenfield"},Object(s.createElement)(l.FormTokenField,{value:this.getTokens(),suggestions:a,onChange:function(t){return e.handleOnChange(t)},onInputChange:function(t){return e.debouncedUpdateSuggestions(t)},label:r}),i&&Object(s.createElement)(l.Spinner,null),n&&Object(s.createElement)("p",{className:"autocomplete-tokenfield__help"},n))}}]),n}(s.Component)),I=function(e){y()(n,e);var t=v()(n);function n(){var e;d()(this,n);for(var o=arguments.length,r=new Array(o),c=0;c<o;c++)r[c]=arguments[c];return e=t.call.apply(t,[this].concat(r)),_()(m()(e),"state",{showAdvancedFilters:!1}),_()(m()(e),"fetchPostSuggestions",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/search",{search:e,per_page:20,_fields:"id,title",type:"post"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.title)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),_()(m()(e),"fetchSavedPosts",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/posts",{per_page:100,include:e.join(","),_fields:"id,title"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.title.rendered)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),_()(m()(e),"fetchAuthorSuggestions",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/users",{search:e,per_page:20,_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.name)||Object(a.__)("(no name)","newspack-blocks")}}))}))})),_()(m()(e),"fetchSavedAuthors",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/users",{per_page:100,include:e.join(","),_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.name)||Object(a.__)("(no name)","newspack-blocks")}}))}))})),_()(m()(e),"fetchCategorySuggestions",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/categories",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),_()(m()(e),"fetchSavedCategories",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/categories",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),_()(m()(e),"fetchTagSuggestions",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/tags",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),_()(m()(e),"fetchSavedTags",(function(e){return C()({path:Object(P.addQueryArgs)("/wp/v2/tags",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(x.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),_()(m()(e),"render",(function(){var t=e.props,n=t.specificMode,o=t.onSpecificModeChange,r=t.specificPosts,c=t.onSpecificPostsChange,i=t.authors,u=t.onAuthorsChange,p=t.categories,f=t.onCategoriesChange,d=t.tags,h=t.onTagsChange,g=t.tagExclusions,b=t.onTagExclusionsChange,m=t.enableSpecific,O=e.state.showAdvancedFilters;return[m&&Object(s.createElement)(l.ToggleControl,{key:"specificMode",checked:n,onChange:o,label:Object(a.__)("Choose Specific Posts","newspack-blocks")}),n&&Object(s.createElement)(T,{key:"posts",tokens:r||[],onChange:c,fetchSuggestions:e.fetchPostSuggestions,fetchSavedInfo:e.fetchSavedPosts,label:Object(a.__)("Posts","newspack-blocks"),help:Object(a.__)("Begin typing post title, click autocomplete result to select.","newspack-blocks")}),!n&&Object(s.createElement)(l.QueryControls,S()({key:"queryControls"},e.props)),!n&&u&&Object(s.createElement)(T,{key:"authors",tokens:i||[],onChange:u,fetchSuggestions:e.fetchAuthorSuggestions,fetchSavedInfo:e.fetchSavedAuthors,label:Object(a.__)("Authors","newspack-blocks")}),!n&&f&&Object(s.createElement)(T,{key:"categories",tokens:p||[],onChange:f,fetchSuggestions:e.fetchCategorySuggestions,fetchSavedInfo:e.fetchSavedCategories,label:Object(a.__)("Categories","newspack-blocks")}),!n&&h&&Object(s.createElement)(T,{key:"tags",tokens:d||[],onChange:h,fetchSuggestions:e.fetchTagSuggestions,fetchSavedInfo:e.fetchSavedTags,label:Object(a.__)("Tags","newspack-blocks")}),!n&&b&&Object(s.createElement)("p",{key:"toggle-advanced-filters"},Object(s.createElement)(l.Button,{isLink:!0,onClick:function(){return e.setState({showAdvancedFilters:!O})}},O?Object(a.__)("Hide Advanced Filters","newspack-blocks"):Object(a.__)("Show Advanced Filters","newspack-blocks"))),!n&&b&&O&&Object(s.createElement)(T,{key:"tag-exclusion",tokens:g||[],onChange:b,fetchSuggestions:e.fetchTagSuggestions,fetchSavedInfo:e.fetchSavedTags,label:Object(a.__)("Excluded Tags","newspack-blocks")})]})),e}return n}(s.Component);I.defaultProps={enableSpecific:!0,specificPosts:[],authors:[],categories:[],tags:[],tagExclusions:[]};var B,M=I,D=n(10),H=n(15),L=H.name,N={queryBlocks:[],postsByBlock:{},specificPostsByBlock:{}},R={updateBlocks:function(e){return{type:"UPDATE_BLOCKS",blocks:e}},markPostsAsDisplayed:function(e,t){return{type:"MARK_POSTS_DISPLAYED",clientId:e,posts:t}},markSpecificPostsAsDisplayed:function(e,t){return{type:"MARK_SPECIFIC_POSTS_DISPLAYED",clientId:e,posts:t}}},V={previousPostIds:function(e,t){var n,o,r,c=e.queryBlocks,a=e.specificPostsByBlock,i=e.postsByBlock,s=c.filter((function(e){var t=e.clientId;return a[t]})).flatMap((function(e){var t=e.clientId;return a[t].map((function(e){return e.id}))})),l=(n=c,o=t,r=n.findIndex((function(e){return e.clientId===o})),n.slice(0,r)).filter((function(e){var t=e.clientId;return i[t]})).flatMap((function(e){var t=e.clientId;return i[t].map((function(e){return e.id}))}));return Object(A.uniq)(s.concat(l)).sort()}},z=function(){return"object"==typeof window&&window.wpcomGutenberg&&-1===Number(window.wpcomGutenberg.blogPublic)},F=function(e){var t=e.specificMode,n=e.specificPosts;return t&&n&&n.length},q=n(23),G=n.n(q),Q=n(20),U=n(8),K=n(24);"object"==typeof window&&window.newspackIsPostSubtitleSupported&&window.newspackIsPostSubtitleSupported.post_subtitle&&(B=!0);var Y=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z"})),W=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M17 3H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7V5h10v14z"})),J=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H6V6h12v12z"})),X=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"})),$=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M4 4h7V2H4c-1.1 0-2 .9-2 2v7h2V4zm6 9l-4 5h12l-3-4-2.03 2.71L10 13zm7-4.5c0-.83-.67-1.5-1.5-1.5S14 7.67 14 8.5s.67 1.5 1.5 1.5S17 9.33 17 8.5zM20 2h-7v2h7v7h2V4c0-1.1-.9-2-2-2zm0 18h-7v2h7c1.1 0 2-.9 2-2v-7h-2v7zM4 13H2v7c0 1.1.9 2 2 2h7v-2H4v-7z"})),Z=function(e){y()(n,e);var t=v()(n);function n(){var e;d()(this,n);for(var o=arguments.length,r=new Array(o),c=0;c<o;c++)r[c]=arguments[c];return e=t.call.apply(t,[this].concat(r)),_()(m()(e),"renderPost",(function(t){var n=e.props.attributes,o=n.showImage,r=n.imageShape,c=n.mediaPosition,a=n.minHeight,i=n.showCaption,l=n.showExcerpt,u=n.showSubtitle,p=n.showAuthor,f=n.showAvatar,d=n.showDate,h=n.showCategory,g=n.sectionHeader,b={minHeight:"behind"===c&&o&&t.newspack_featured_image_src&&a+"vh",paddingTop:"behind"===c&&o&&t.newspack_featured_image_src&&a/5+"vh"},m=e.titleForPost(t),O=Object(Q.__experimentalGetSettings)().formats.date;return Object(s.createElement)("article",{className:t.newspack_featured_image_src?"post-has-image":null,key:t.id,style:b},o&&t.newspack_featured_image_src&&Object(s.createElement)("figure",{className:"post-thumbnail",key:"thumbnail"},Object(s.createElement)("a",{href:"#"},"landscape"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.landscape,alt:""}),"portrait"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.portrait,alt:""}),"square"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.square,alt:""}),"uncropped"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.uncropped,alt:""})),i&&""!==t.newspack_featured_image_caption&&Object(s.createElement)("figcaption",null,t.newspack_featured_image_caption)),Object(s.createElement)("div",{className:"entry-wrapper"},h&&t.newspack_category_info.length&&Object(s.createElement)("div",{className:"cat-links"},Object(s.createElement)("a",{href:"#"},t.newspack_category_info)),U.RichText.isEmpty(g)?Object(s.createElement)("h2",{className:"entry-title",key:"title"},Object(s.createElement)("a",{href:"#"},m)):Object(s.createElement)("h3",{className:"entry-title",key:"title"},Object(s.createElement)("a",{href:"#"},m)),B&&u&&Object(s.createElement)(s.RawHTML,{key:"subtitle",className:"newspack-post-subtitle newspack-post-subtitle--in-homepage-block"},t.meta.newspack_post_subtitle||""),l&&Object(s.createElement)(s.RawHTML,{key:"excerpt",className:"excerpt-contain"},t.excerpt.rendered),Object(s.createElement)("div",{className:"entry-meta"},p&&f&&e.formatAvatars(t.newspack_author_info),p&&e.formatByline(t.newspack_author_info),d&&Object(s.createElement)("time",{className:"entry-date published",key:"pub-date"},Object(Q.dateI18n)(O,t.date_gmt)))))})),_()(m()(e),"titleForPost",(function(e){return e.title?"string"==typeof e.title?Object(x.decodeEntities)(e.title.trim()):"object"==typeof e.title&&e.title.rendered?Object(x.decodeEntities)(e.title.rendered.trim()):void 0:""})),_()(m()(e),"formatAvatars",(function(e){return e.map((function(e){return Object(s.createElement)("span",{className:"avatar author-avatar",key:e.id},Object(s.createElement)("a",{className:"url fn n",href:"#"},Object(s.createElement)(s.RawHTML,null,e.avatar)))}))})),_()(m()(e),"formatByline",(function(e){return Object(s.createElement)("span",{className:"byline"},Object(a._x)("by","post author","full-site-editing")," ",e.reduce((function(t,n,o){return[].concat(p()(t),[Object(s.createElement)("span",{className:"author vcard",key:n.id},Object(s.createElement)("a",{className:"url fn n",href:"#"},n.display_name)),o<e.length-2&&", ",e.length>1&&o===e.length-2&&Object(a._x)(" and ","post author","full-site-editing")])}),[]))})),_()(m()(e),"renderInspectorControls",(function(){var t=e.props,n=t.attributes,o=t.setAttributes,r=t.textColor,c=t.setTextColor,i=n.authors,u=n.specificPosts,p=n.postsToShow,f=n.categories,d=n.columns,h=n.showImage,g=n.showCaption,b=n.imageScale,m=n.mobileStack,O=n.minHeight,y=n.moreButton,j=n.showExcerpt,v=n.showSubtitle,w=n.typeScale,_=n.showDate,k=n.showAuthor,S=n.showAvatar,E=n.showCategory,C=n.postLayout,P=n.mediaPosition,x=n.specificMode,A=n.tags,T=n.tagExclusions,I=[{value:1,label:Object(a.__)("Small","full-site-editing"),shortName:Object(a.__)("S","full-site-editing")},{value:2,label:Object(a.__)("Medium","full-site-editing"),shortName:Object(a.__)("M","full-site-editing")},{value:3,label:Object(a.__)("Large","full-site-editing"),shortName:Object(a.__)("L","full-site-editing")},{value:4,label:Object(a.__)("Extra Large","newspack-blocks"),shortName:Object(a.__)("XL","newspack-blocks")}];return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Display Settings","full-site-editing"),initialOpen:!0},p&&Object(s.createElement)(M,{numberOfItems:p,onNumberOfItemsChange:function(e){return o({postsToShow:e})},specificMode:x,onSpecificModeChange:function(e){return o({specificMode:e})},specificPosts:u,onSpecificPostsChange:function(e){return o({specificPosts:e})},authors:i,onAuthorsChange:function(e){return o({authors:e})},categories:f,onCategoriesChange:function(e){return o({categories:e})},tags:A,onTagsChange:function(e){o({tags:e})},tagExclusions:T,onTagExclusionsChange:function(e){return o({tagExclusions:e})}}),"grid"===C&&Object(s.createElement)(l.RangeControl,{label:Object(a.__)("Columns","full-site-editing"),value:d,onChange:function(e){return o({columns:e})},min:2,max:6,required:!0}),!x&&!z()&&Object(s.createElement)(l.ToggleControl,{label:Object(a.__)('Show "More" Button',"full-site-editing"),checked:y,onChange:function(){return o({moreButton:!y})}})),Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Featured Image Settings","full-site-editing")},Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Featured Image","full-site-editing"),checked:h,onChange:function(){return o({showImage:!h})}})),h&&Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Featured Image Caption","full-site-editing"),checked:g,onChange:function(){return o({showCaption:!g})}})),h&&"top"!==P&&"behind"!==P&&Object(s.createElement)(s.Fragment,null,Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Stack on mobile","full-site-editing"),checked:m,onChange:function(){return o({mobileStack:!m})}})),Object(s.createElement)(l.BaseControl,{label:Object(a.__)("Featured Image Size","full-site-editing"),id:"newspackfeatured-image-size"},Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ButtonGroup,{id:"newspackfeatured-image-size","aria-label":Object(a.__)("Featured Image Size","full-site-editing")},I.map((function(e){var t=b===e.value;return Object(s.createElement)(l.Button,{isLarge:!0,isPrimary:t,"aria-pressed":t,"aria-label":e.label,key:e.value,onClick:function(){return o({imageScale:e.value})}},e.shortName)})))))),h&&"behind"===P&&Object(s.createElement)(l.RangeControl,{label:Object(a.__)("Minimum height","full-site-editing"),help:Object(a.__)("Sets a minimum height for the block, using a percentage of the screen's current height.","newspack-blocks"),value:O,onChange:function(e){return o({minHeight:e})},min:0,max:100,required:!0})),Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Post Control Settings","full-site-editing")},B&&Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Subtitle","full-site-editing"),checked:v,onChange:function(){return o({showSubtitle:!v})}})),Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Excerpt","full-site-editing"),checked:j,onChange:function(){return o({showExcerpt:!j})}})),Object(s.createElement)(l.RangeControl,{className:"type-scale-slider",label:Object(a.__)("Type Scale","full-site-editing"),value:w,onChange:function(e){return o({typeScale:e})},min:1,max:10,beforeIcon:"editor-textcolor",afterIcon:"editor-textcolor",required:!0})),Object(s.createElement)(U.PanelColorSettings,{title:Object(a.__)("Color Settings","full-site-editing"),initialOpen:!0,colorSettings:[{value:r.color,onChange:c,label:Object(a.__)("Text Color","full-site-editing")}]}),Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Post Meta Settings","full-site-editing")},Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Date","full-site-editing"),checked:_,onChange:function(){return o({showDate:!_})}})),Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Category","full-site-editing"),checked:E,onChange:function(){return o({showCategory:!E})}})),Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Author","full-site-editing"),checked:k,onChange:function(){return o({showAuthor:!k})}})),k&&Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Author Avatar","full-site-editing"),checked:S,onChange:function(){return o({showAvatar:!S})}}))))})),e}return g()(n,[{key:"render",value:function(){var e,t=this,n=this.props,o=n.attributes,r=n.className,c=n.clientId,i=n.setAttributes,u=n.isSelected,p=n.latestPosts,f=n.textColor,d=n.markPostsAsDisplayed,h=o.showImage,g=o.imageShape,b=o.postLayout,m=o.mediaPosition,O=o.moreButton,y=o.moreButtonText,j=o.columns,v=o.typeScale,w=o.imageScale,k=o.mobileStack,S=o.sectionHeader,E=o.showCaption,C=o.showCategory,P=o.specificMode,x=G()(r,(e={"is-grid":"grid"===b,"show-image":h},_()(e,"columns-".concat(j),"grid"===b),_()(e,"ts-".concat(v),"5"!==v),_()(e,"image-align".concat(m),h),_()(e,"is-".concat(w),"1"!==w&&h),_()(e,"mobile-stack",k),_()(e,"image-shape".concat(g),"landscape"!==g),_()(e,"has-text-color",""!==f.color),_()(e,"show-caption",E),_()(e,"show-category",C),_()(e,"wpnbha",!0),e)),A=[{icon:"list-view",title:Object(a.__)("List View","full-site-editing"),onClick:function(){return i({postLayout:"list"})},isActive:"list"===b},{icon:"grid-view",title:Object(a.__)("Grid View","full-site-editing"),onClick:function(){return i({postLayout:"grid"})},isActive:"grid"===b}],T=[{icon:"align-none",title:Object(a.__)("Show media on top","full-site-editing"),isActive:"top"===m,onClick:function(){return i({mediaPosition:"top"})}},{icon:"align-pull-left",title:Object(a.__)("Show media on left","full-site-editing"),isActive:"left"===m,onClick:function(){return i({mediaPosition:"left"})}},{icon:"align-pull-right",title:Object(a.__)("Show media on right","full-site-editing"),isActive:"right"===m,onClick:function(){return i({mediaPosition:"right"})}},{icon:$,title:Object(a.__)("Show media behind","full-site-editing"),isActive:"behind"===m,onClick:function(){return i({mediaPosition:"behind"})}}],I=[{icon:Y,title:Object(a.__)("Landscape Image Shape","full-site-editing"),isActive:"landscape"===g,onClick:function(){return i({imageShape:"landscape"})}},{icon:W,title:Object(a.__)("portrait Image Shape","full-site-editing"),isActive:"portrait"===g,onClick:function(){return i({imageShape:"portrait"})}},{icon:J,title:Object(a.__)("Square Image Shape","full-site-editing"),isActive:"square"===g,onClick:function(){return i({imageShape:"square"})}},{icon:X,title:Object(a.__)("Uncropped","full-site-editing"),isActive:"uncropped"===g,onClick:function(){return i({imageShape:"uncropped"})}}];return d(c,p),Object(s.createElement)(s.Fragment,null,Object(s.createElement)("div",{className:x,style:{color:f.color}},Object(s.createElement)("div",null,p&&(!U.RichText.isEmpty(S)||u)&&Object(s.createElement)(U.RichText,{onChange:function(e){return i({sectionHeader:e})},placeholder:Object(a.__)("Write header…","full-site-editing"),value:S,tagName:"h2",className:"article-section-title"}),p&&!p.length&&Object(s.createElement)(l.Placeholder,null,Object(a.__)("Sorry, no posts were found.","full-site-editing")),!p&&Object(s.createElement)(l.Placeholder,{icon:Object(s.createElement)(l.Spinner,null),className:"component-placeholder__align-center"}),p&&p.map((function(e){return t.renderPost(e)})))),!P&&p&&O&&!z()&&Object(s.createElement)("div",{className:"editor-styles-wrapper wpnbha__wp-block-button__wrapper"},Object(s.createElement)("div",{className:"wp-block-button"},Object(s.createElement)(U.RichText,{placeholder:Object(a.__)("Load more posts","full-site-editing"),value:y,onChange:function(e){return i({moreButtonText:e})},className:"wp-block-button__link",keepPlaceholderOnFocus:!0,allowedFormats:[]}))),Object(s.createElement)(U.BlockControls,null,Object(s.createElement)(l.Toolbar,{controls:A}),h&&Object(s.createElement)(l.Toolbar,{controls:T}),h&&Object(s.createElement)(l.Toolbar,{controls:I})),Object(s.createElement)(U.InspectorControls,null,this.renderInspectorControls()))}}]),n}(s.Component),ee=Object(K.compose)([Object(U.withColors)({textColor:"color"}),Object(D.withSelect)((function(e,t){var n=t.attributes,o=t.clientId,r=function(e){var t=e.postsToShow,n=e.authors,o=e.categories,r=e.tags,c=e.specificPosts,a=e.tagExclusions;return Object(A.pickBy)(F(e)?{include:c,orderby:"include",per_page:c.length}:{per_page:t,categories:o,author:n,tags:r,tags_exclude:a},(function(e){return!Object(A.isUndefined)(e)}))}(n);if(!F(n)){var c=e(L).previousPostIds(o);r.exclude=c.join(",")}return{latestPosts:e("core").getEntityRecords("postType","post",r)}})),Object(D.withDispatch)((function(e,t){var n=t.attributes;return{markPostsAsDisplayed:F(n)?e(L).markSpecificPostsAsDisplayed:e(L).markPostsAsDisplayed}}))])(Z),te=(n(35),n(36),H.name,H.attributes),ne=H.category,oe={title:Object(a.__)("Homepage Posts","full-site-editing"),icon:Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM10 9h8v2h-8zm0 3h4v2h-4zm0-6h8v2h-8z"})),attributes:te,category:ne,keywords:[Object(a.__)("posts","full-site-editing"),Object(a.__)("articles","full-site-editing"),Object(a.__)("latest","full-site-editing")],description:Object(a.__)("A block for displaying homepage posts.","full-site-editing"),styles:[{name:"default",label:Object(a._x)("Default","block style","full-site-editing"),isDefault:!0},{name:"borders",label:Object(a._x)("Borders","block style","full-site-editing")}],supports:{html:!1,align:["wide","full"],default:""},edit:ee,save:function(){return null},transforms:{from:[{type:"block",blocks:["core/latest-posts"],transform:function(e){var t=e.displayPostContent,n=e.displayPostDate,o=e.postLayout,r=e.columns,a=e.postsToShow,s=e.categories;return Object(c.createBlock)(Object(i.applyFilters)("blocks.transforms_from_name","newspack-blocks/homepage-articles"),{showExcerpt:t,showDate:n,postLayout:o,columns:r,postsToShow:a,showAuthor:!1,categories:s?[s]:[]})}}],to:[{type:"block",blocks:["core/latest-posts"],transform:function(e){var t=e.showExcerpt,n=e.showDate,o=e.postLayout,r=e.columns,a=e.postsToShow,i=e.categories;return Object(c.createBlock)("core/latest-posts",{displayPostContent:t,displayPostDate:n,postLayout:o,columns:r,postsToShow:a,categories:i[0]||""})}}]}},re="a8c/blog-posts";Object(i.addFilter)("blocks.transforms_from_name","set-transformed-block-name",(function(e){return"newspack-blocks/homepage-articles"!==e?e:re})),Object(c.registerBlockType)(re,r()({},oe,{title:Object(a.__)("Blog Posts","full-site-editing"),category:"layout"})),function(e){var t=function t(n){return n.flatMap((function(n){var o=[];return n.name===e&&o.push(n),o.concat(t(n.innerBlocks))}))};Object(D.registerStore)(L,{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:N,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"UPDATE_BLOCKS":return r()({},e,{queryBlocks:t(n.blocks)});case"MARK_POSTS_DISPLAYED":return r()({},e,{postsByBlock:r()({},e.postsByBlock,_()({},n.clientId,n.posts))});case"MARK_SPECIFIC_POSTS_DISPLAYED":return r()({},e,{specificPostsByBlock:r()({},e.specificPostsByBlock,_()({},n.clientId,n.posts))})}return e},actions:R,selectors:V,initialState:N});var n,o=Object(D.select)("core/block-editor"),c=o.getClientIdsWithDescendants,a=o.getBlocks,i=Object(D.dispatch)(L).updateBlocks;Object(D.subscribe)((function(){var e=c(),t=e!==n;n=e,t&&i(a())}))}(re)}]));
|
1 |
+
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=37)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},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){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){!function(){e.exports=this.wp.htmlEntities}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t,n){var o=n(3);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var o=n(25);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}},function(e,t,n){var o=n(26),r=n(27),c=n(28);e.exports=function(e){return function(){var t,n=o(e);if(r()){var a=o(this).constructor;t=Reflect.construct(n,arguments,a)}else t=n.apply(this,arguments);return c(this,t)}}},function(e){e.exports=JSON.parse('{"name":"homepage-articles","category":"newspack","attributes":{"className":{"type":"string","default":""},"showExcerpt":{"type":"boolean","default":true},"showDate":{"type":"boolean","default":true},"showImage":{"type":"boolean","default":true},"showCaption":{"type":"boolean","default":false},"imageShape":{"type":"string","default":"landscape"},"minHeight":{"type":"integer","default":0},"moreButton":{"type":"boolean","default":false},"moreButtonText":{"type":"string","default":""},"showAuthor":{"type":"boolean","default":true},"showAvatar":{"type":"boolean","default":true},"showCategory":{"type":"boolean","default":false},"postLayout":{"type":"string","default":"list"},"columns":{"type":"integer","default":3},"postsToShow":{"type":"integer","default":3},"mediaPosition":{"type":"string","default":"top"},"authors":{"type":"array","default":[],"items":{"type":"integer"}},"categories":{"type":"array","default":[],"items":{"type":"integer"}},"tags":{"type":"array","default":[],"items":{"type":"integer"}},"tagExclusions":{"type":"array","default":[],"items":{"type":"integer"}},"specificPosts":{"type":"array","default":[],"items":{"type":"integer"}},"typeScale":{"type":"integer","default":4},"imageScale":{"type":"integer","default":3},"mobileStack":{"type":"boolean","default":false},"sectionHeader":{"type":"string","default":""},"specificMode":{"type":"boolean","default":false},"textColor":{"type":"string","default":""},"customTextColor":{"type":"string","default":""},"singleMode":{"type":"boolean","default":false},"showSubtitle":{"type":"boolean","default":false}}}')},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(e,t,n){var o=n(30),r=n(31),c=n(32),a=n(33);e.exports=function(e){return o(e)||r(e)||c(e)||a()}},function(e,t){!function(){e.exports=this.wp.date}()},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}},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 o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var o;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var c=typeof o;if("string"===c||"number"===c)e.push(o);else if(Array.isArray(o)&&o.length){var a=r.apply(null,o);a&&e.push(a)}else if("object"===c)for(var i in o)n.call(o,i)&&o[i]&&e.push(i)}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){function n(t,o){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,o)}e.exports=n},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t){e.exports=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}}},function(e,t,n){var o=n(29),r=n(4);e.exports=function(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?r(e):t}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){var o=n(21);e.exports=function(e){if(Array.isArray(e))return o(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t,n){var o=n(21);e.exports=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var o=n(9),r=n.n(o),c=n(16),a=n(1),i=n(17),s=n(0),l=n(2),u=n(12),p=n.n(u),f=n(18),d=n.n(f),h=n(4),g=n.n(h),b=n(13),m=n.n(b),O=n(14),y=n.n(O),j=n(3),v=n.n(j),w=n(22),_=n.n(w),k=n(6),S=n.n(k),E=n(7),C=n(5),P=n(19),x=n.n(P),A=n(11),T=(n(34),function(e){m()(n,e);var t=y()(n);function n(e){var o;return p()(this,n),o=t.call(this,e),v()(g()(o),"isFetchingInfoOnLoad",(function(){var e=o.props,t=e.tokens,n=e.fetchSavedInfo;return Boolean(t.length&&n)})),o.state={suggestions:[],validValues:{},loading:o.isFetchingInfoOnLoad()},o.debouncedUpdateSuggestions=Object(A.debounce)(o.updateSuggestions,500),o}return d()(n,[{key:"componentDidMount",value:function(){var e=this;if(this.isFetchingInfoOnLoad()){var t=this.props,n=t.tokens;(0,t.fetchSavedInfo)(n).then((function(t){var n=e.state.validValues;t.forEach((function(e){n[e.value]=e.label})),e.setState({validValues:n,loading:!1})}))}}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest,this.debouncedUpdateSuggestions.cancel()}},{key:"getLabelsForValues",value:function(e){var t=this.state.validValues;return e.reduce((function(e,n){return t[n]?[].concat(x()(e),[t[n]]):e}),[])}},{key:"getValuesForLabels",value:function(e){var t=this.state.validValues;return e.map((function(e){return Object.keys(t).find((function(n){return t[n]===e}))}))}},{key:"updateSuggestions",value:function(e){var t=this,n=this.props.fetchSuggestions;n&&this.setState({loading:!0},(function(){var o=n(e);o.then((function(e){if(t.suggestionsRequest===o){var n=t.state.validValues,r=[];e.forEach((function(e){r.push(e.label),n[e.value]=e.label})),t.setState({suggestions:r,validValues:n,loading:!1})}})).catch((function(){t.suggestionsRequest===o&&t.setState({loading:!1})})),t.suggestionsRequest=o}))}},{key:"handleOnChange",value:function(e){(0,this.props.onChange)(this.getValuesForLabels(e))}},{key:"getTokens",value:function(){var e=this.props.tokens;return this.getLabelsForValues(e)}},{key:"render",value:function(){var e=this,t=this.props,n=t.help,o=t.label,r=void 0===o?"":o,c=this.state,a=c.suggestions,i=c.loading;return Object(s.createElement)("div",{className:"autocomplete-tokenfield"},Object(s.createElement)(l.FormTokenField,{value:this.getTokens(),suggestions:a,onChange:function(t){return e.handleOnChange(t)},onInputChange:function(t){return e.debouncedUpdateSuggestions(t)},label:r}),i&&Object(s.createElement)(l.Spinner,null),n&&Object(s.createElement)("p",{className:"autocomplete-tokenfield__help"},n))}}]),n}(s.Component)),I=function(e){m()(n,e);var t=y()(n);function n(){var e;p()(this,n);for(var o=arguments.length,r=new Array(o),c=0;c<o;c++)r[c]=arguments[c];return e=t.call.apply(t,[this].concat(r)),v()(g()(e),"state",{showAdvancedFilters:!1}),v()(g()(e),"fetchPostSuggestions",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/search",{search:e,per_page:20,_fields:"id,title",type:"post"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.title)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),v()(g()(e),"fetchSavedPosts",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/posts",{per_page:100,include:e.join(","),_fields:"id,title"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.title.rendered)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),v()(g()(e),"fetchAuthorSuggestions",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/users",{search:e,per_page:20,_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.name)||Object(a.__)("(no name)","newspack-blocks")}}))}))})),v()(g()(e),"fetchSavedAuthors",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/users",{per_page:100,include:e.join(","),_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.name)||Object(a.__)("(no name)","newspack-blocks")}}))}))})),v()(g()(e),"fetchCategorySuggestions",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/categories",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),v()(g()(e),"fetchSavedCategories",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/categories",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),v()(g()(e),"fetchTagSuggestions",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/tags",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),v()(g()(e),"fetchSavedTags",(function(e){return S()({path:Object(E.addQueryArgs)("/wp/v2/tags",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object(C.decodeEntities)(e.name)||Object(a.__)("(no title)","newspack-blocks")}}))}))})),v()(g()(e),"render",(function(){var t=e.props,n=t.specificMode,o=t.onSpecificModeChange,r=t.specificPosts,c=t.onSpecificPostsChange,i=t.authors,u=t.onAuthorsChange,p=t.categories,f=t.onCategoriesChange,d=t.tags,h=t.onTagsChange,g=t.tagExclusions,b=t.onTagExclusionsChange,m=t.enableSpecific,O=e.state.showAdvancedFilters;return[m&&Object(s.createElement)(l.ToggleControl,{key:"specificMode",checked:n,onChange:o,label:Object(a.__)("Choose Specific Posts","newspack-blocks")}),n&&Object(s.createElement)(T,{key:"posts",tokens:r||[],onChange:c,fetchSuggestions:e.fetchPostSuggestions,fetchSavedInfo:e.fetchSavedPosts,label:Object(a.__)("Posts","newspack-blocks"),help:Object(a.__)("Begin typing post title, click autocomplete result to select.","newspack-blocks")}),!n&&Object(s.createElement)(l.QueryControls,_()({key:"queryControls"},e.props)),!n&&u&&Object(s.createElement)(T,{key:"authors",tokens:i||[],onChange:u,fetchSuggestions:e.fetchAuthorSuggestions,fetchSavedInfo:e.fetchSavedAuthors,label:Object(a.__)("Authors","newspack-blocks")}),!n&&f&&Object(s.createElement)(T,{key:"categories",tokens:p||[],onChange:f,fetchSuggestions:e.fetchCategorySuggestions,fetchSavedInfo:e.fetchSavedCategories,label:Object(a.__)("Categories","newspack-blocks")}),!n&&h&&Object(s.createElement)(T,{key:"tags",tokens:d||[],onChange:h,fetchSuggestions:e.fetchTagSuggestions,fetchSavedInfo:e.fetchSavedTags,label:Object(a.__)("Tags","newspack-blocks")}),!n&&b&&Object(s.createElement)("p",{key:"toggle-advanced-filters"},Object(s.createElement)(l.Button,{isLink:!0,onClick:function(){return e.setState({showAdvancedFilters:!O})}},O?Object(a.__)("Hide Advanced Filters","newspack-blocks"):Object(a.__)("Show Advanced Filters","newspack-blocks"))),!n&&b&&O&&Object(s.createElement)(T,{key:"tag-exclusion",tokens:g||[],onChange:b,fetchSuggestions:e.fetchTagSuggestions,fetchSavedInfo:e.fetchSavedTags,label:Object(a.__)("Excluded Tags","newspack-blocks")})]})),e}return n}(s.Component);I.defaultProps={enableSpecific:!0,specificPosts:[],authors:[],categories:[],tags:[],tagExclusions:[]};var B,M=I,D=n(10),H=n(15),L=H.name,N={queryBlocks:[],postsByBlock:{},specificPostsByBlock:{}},R={updateBlocks:function(e){return{type:"UPDATE_BLOCKS",blocks:e}},markPostsAsDisplayed:function(e,t){return{type:"MARK_POSTS_DISPLAYED",clientId:e,posts:t}},markSpecificPostsAsDisplayed:function(e,t){return{type:"MARK_SPECIFIC_POSTS_DISPLAYED",clientId:e,posts:t}}},V={previousPostIds:function(e,t){var n,o,r,c=e.queryBlocks,a=e.specificPostsByBlock,i=e.postsByBlock,s=c.filter((function(e){var t=e.clientId;return a[t]})).flatMap((function(e){var t=e.clientId;return a[t].map((function(e){return e.id}))})),l=(n=c,o=t,r=n.findIndex((function(e){return e.clientId===o})),n.slice(0,r)).filter((function(e){var t=e.clientId;return i[t]})).flatMap((function(e){var t=e.clientId;return i[t].map((function(e){return e.id}))}));return Object(A.uniq)(s.concat(l)).sort()}},z=function(){return"object"==typeof window&&window.wpcomGutenberg&&-1===Number(window.wpcomGutenberg.blogPublic)},F=function(e){var t=e.specificMode,n=e.specificPosts;return t&&n&&n.length},q=function(e){return e.map((function(e){return Object(s.createElement)("span",{className:"avatar author-avatar",key:e.id},Object(s.createElement)("a",{className:"url fn n",href:e.author_link},Object(s.createElement)(s.RawHTML,null,e.avatar)))}))},G=function(e){return Object(s.createElement)("span",{className:"byline"},Object(a._x)("by","post author","newspack-blocks")," ",e.reduce((function(t,n,o){return[].concat(x()(t),[Object(s.createElement)("span",{className:"author vcard",key:n.id},Object(s.createElement)("a",{className:"url fn n",href:n.author_link},n.display_name)),o<e.length-2&&", ",e.length>1&&o===e.length-2&&Object(a._x)(" and ","post author","newspack-blocks")])}),[]))},Q=n(23),U=n.n(Q),K=n(20),Y=n(8),W=n(24);"object"==typeof window&&window.newspackIsPostSubtitleSupported&&window.newspackIsPostSubtitleSupported.post_subtitle&&(B=!0);var J=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z"})),X=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M17 3H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7V5h10v14z"})),$=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H6V6h12v12z"})),Z=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"})),ee=Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M4 4h7V2H4c-1.1 0-2 .9-2 2v7h2V4zm6 9l-4 5h12l-3-4-2.03 2.71L10 13zm7-4.5c0-.83-.67-1.5-1.5-1.5S14 7.67 14 8.5s.67 1.5 1.5 1.5S17 9.33 17 8.5zM20 2h-7v2h7v7h2V4c0-1.1-.9-2-2-2zm0 18h-7v2h7c1.1 0 2-.9 2-2v-7h-2v7zM4 13H2v7c0 1.1.9 2 2 2h7v-2H4v-7z"})),te=function(e){m()(n,e);var t=y()(n);function n(){var e;p()(this,n);for(var o=arguments.length,r=new Array(o),c=0;c<o;c++)r[c]=arguments[c];return e=t.call.apply(t,[this].concat(r)),v()(g()(e),"renderPost",(function(t){var n=e.props.attributes,o=n.showImage,r=n.imageShape,c=n.mediaPosition,a=n.minHeight,i=n.showCaption,l=n.showExcerpt,u=n.showSubtitle,p=n.showAuthor,f=n.showAvatar,d=n.showDate,h=n.showCategory,g=n.sectionHeader,b={minHeight:"behind"===c&&o&&t.newspack_featured_image_src&&a+"vh",paddingTop:"behind"===c&&o&&t.newspack_featured_image_src&&a/5+"vh"},m=e.titleForPost(t),O=Object(K.__experimentalGetSettings)().formats.date;return Object(s.createElement)("article",{className:t.newspack_featured_image_src?"post-has-image":null,key:t.id,style:b},o&&t.newspack_featured_image_src&&Object(s.createElement)("figure",{className:"post-thumbnail",key:"thumbnail"},Object(s.createElement)("a",{href:"#"},"landscape"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.landscape,alt:""}),"portrait"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.portrait,alt:""}),"square"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.square,alt:""}),"uncropped"===r&&Object(s.createElement)("img",{src:t.newspack_featured_image_src.uncropped,alt:""})),i&&""!==t.newspack_featured_image_caption&&Object(s.createElement)("figcaption",null,t.newspack_featured_image_caption)),Object(s.createElement)("div",{className:"entry-wrapper"},h&&t.newspack_category_info.length&&Object(s.createElement)("div",{className:"cat-links"},Object(s.createElement)("a",{href:"#"},t.newspack_category_info)),Y.RichText.isEmpty(g)?Object(s.createElement)("h2",{className:"entry-title",key:"title"},Object(s.createElement)("a",{href:"#"},m)):Object(s.createElement)("h3",{className:"entry-title",key:"title"},Object(s.createElement)("a",{href:"#"},m)),B&&u&&Object(s.createElement)(s.RawHTML,{key:"subtitle",className:"newspack-post-subtitle newspack-post-subtitle--in-homepage-block"},t.meta.newspack_post_subtitle||""),l&&Object(s.createElement)(s.RawHTML,{key:"excerpt",className:"excerpt-contain"},t.excerpt.rendered),Object(s.createElement)("div",{className:"entry-meta"},p&&f&&q(t.newspack_author_info),p&&G(t.newspack_author_info),d&&Object(s.createElement)("time",{className:"entry-date published",key:"pub-date"},Object(K.dateI18n)(O,t.date_gmt)))))})),v()(g()(e),"titleForPost",(function(e){return e.title?"string"==typeof e.title?Object(C.decodeEntities)(e.title.trim()):"object"==typeof e.title&&e.title.rendered?Object(C.decodeEntities)(e.title.rendered.trim()):void 0:""})),v()(g()(e),"renderInspectorControls",(function(){var t=e.props,n=t.attributes,o=t.setAttributes,r=t.textColor,c=t.setTextColor,i=n.authors,u=n.specificPosts,p=n.postsToShow,f=n.categories,d=n.columns,h=n.showImage,g=n.showCaption,b=n.imageScale,m=n.mobileStack,O=n.minHeight,y=n.moreButton,j=n.showExcerpt,v=n.showSubtitle,w=n.typeScale,_=n.showDate,k=n.showAuthor,S=n.showAvatar,E=n.showCategory,C=n.postLayout,P=n.mediaPosition,x=n.specificMode,A=n.tags,T=n.tagExclusions,I=[{value:1,label:Object(a.__)("Small","full-site-editing"),shortName:Object(a.__)("S","full-site-editing")},{value:2,label:Object(a.__)("Medium","full-site-editing"),shortName:Object(a.__)("M","full-site-editing")},{value:3,label:Object(a.__)("Large","full-site-editing"),shortName:Object(a.__)("L","full-site-editing")},{value:4,label:Object(a.__)("Extra Large","newspack-blocks"),shortName:Object(a.__)("XL","newspack-blocks")}];return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Display Settings","full-site-editing"),initialOpen:!0},p&&Object(s.createElement)(M,{numberOfItems:p,onNumberOfItemsChange:function(e){return o({postsToShow:e})},specificMode:x,onSpecificModeChange:function(e){return o({specificMode:e})},specificPosts:u,onSpecificPostsChange:function(e){return o({specificPosts:e})},authors:i,onAuthorsChange:function(e){return o({authors:e})},categories:f,onCategoriesChange:function(e){return o({categories:e})},tags:A,onTagsChange:function(e){o({tags:e})},tagExclusions:T,onTagExclusionsChange:function(e){return o({tagExclusions:e})}}),"grid"===C&&Object(s.createElement)(l.RangeControl,{label:Object(a.__)("Columns","full-site-editing"),value:d,onChange:function(e){return o({columns:e})},min:2,max:6,required:!0}),!x&&!z()&&Object(s.createElement)(l.ToggleControl,{label:Object(a.__)('Show "More" Button',"full-site-editing"),checked:y,onChange:function(){return o({moreButton:!y})}})),Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Featured Image Settings","full-site-editing")},Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Featured Image","full-site-editing"),checked:h,onChange:function(){return o({showImage:!h})}})),h&&Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Featured Image Caption","full-site-editing"),checked:g,onChange:function(){return o({showCaption:!g})}})),h&&"top"!==P&&"behind"!==P&&Object(s.createElement)(s.Fragment,null,Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Stack on mobile","full-site-editing"),checked:m,onChange:function(){return o({mobileStack:!m})}})),Object(s.createElement)(l.BaseControl,{label:Object(a.__)("Featured Image Size","full-site-editing"),id:"newspackfeatured-image-size"},Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ButtonGroup,{id:"newspackfeatured-image-size","aria-label":Object(a.__)("Featured Image Size","full-site-editing")},I.map((function(e){var t=b===e.value;return Object(s.createElement)(l.Button,{isLarge:!0,isPrimary:t,"aria-pressed":t,"aria-label":e.label,key:e.value,onClick:function(){return o({imageScale:e.value})}},e.shortName)})))))),h&&"behind"===P&&Object(s.createElement)(l.RangeControl,{label:Object(a.__)("Minimum height","full-site-editing"),help:Object(a.__)("Sets a minimum height for the block, using a percentage of the screen's current height.","newspack-blocks"),value:O,onChange:function(e){return o({minHeight:e})},min:0,max:100,required:!0})),Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Post Control Settings","full-site-editing")},B&&Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Subtitle","full-site-editing"),checked:v,onChange:function(){return o({showSubtitle:!v})}})),Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Excerpt","full-site-editing"),checked:j,onChange:function(){return o({showExcerpt:!j})}})),Object(s.createElement)(l.RangeControl,{className:"type-scale-slider",label:Object(a.__)("Type Scale","full-site-editing"),value:w,onChange:function(e){return o({typeScale:e})},min:1,max:10,beforeIcon:"editor-textcolor",afterIcon:"editor-textcolor",required:!0})),Object(s.createElement)(Y.PanelColorSettings,{title:Object(a.__)("Color Settings","full-site-editing"),initialOpen:!0,colorSettings:[{value:r.color,onChange:c,label:Object(a.__)("Text Color","full-site-editing")}]}),Object(s.createElement)(l.PanelBody,{title:Object(a.__)("Post Meta Settings","full-site-editing")},Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Date","full-site-editing"),checked:_,onChange:function(){return o({showDate:!_})}})),Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Category","full-site-editing"),checked:E,onChange:function(){return o({showCategory:!E})}})),Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Author","full-site-editing"),checked:k,onChange:function(){return o({showAuthor:!k})}})),k&&Object(s.createElement)(l.PanelRow,null,Object(s.createElement)(l.ToggleControl,{label:Object(a.__)("Show Author Avatar","full-site-editing"),checked:S,onChange:function(){return o({showAvatar:!S})}}))))})),e}return d()(n,[{key:"render",value:function(){var e,t=this,n=this.props,o=n.attributes,r=n.className,c=n.clientId,i=n.setAttributes,u=n.isSelected,p=n.latestPosts,f=n.textColor,d=n.markPostsAsDisplayed,h=o.showImage,g=o.imageShape,b=o.postLayout,m=o.mediaPosition,O=o.moreButton,y=o.moreButtonText,j=o.columns,w=o.typeScale,_=o.imageScale,k=o.mobileStack,S=o.sectionHeader,E=o.showCaption,C=o.showCategory,P=o.specificMode,x=U()(r,(e={"is-grid":"grid"===b,"show-image":h},v()(e,"columns-".concat(j),"grid"===b),v()(e,"ts-".concat(w),"5"!==w),v()(e,"image-align".concat(m),h),v()(e,"is-".concat(_),"1"!==_&&h),v()(e,"mobile-stack",k),v()(e,"image-shape".concat(g),"landscape"!==g),v()(e,"has-text-color",""!==f.color),v()(e,"show-caption",E),v()(e,"show-category",C),v()(e,"wpnbha",!0),e)),A=[{icon:"list-view",title:Object(a.__)("List View","full-site-editing"),onClick:function(){return i({postLayout:"list"})},isActive:"list"===b},{icon:"grid-view",title:Object(a.__)("Grid View","full-site-editing"),onClick:function(){return i({postLayout:"grid"})},isActive:"grid"===b}],T=[{icon:"align-none",title:Object(a.__)("Show media on top","full-site-editing"),isActive:"top"===m,onClick:function(){return i({mediaPosition:"top"})}},{icon:"align-pull-left",title:Object(a.__)("Show media on left","full-site-editing"),isActive:"left"===m,onClick:function(){return i({mediaPosition:"left"})}},{icon:"align-pull-right",title:Object(a.__)("Show media on right","full-site-editing"),isActive:"right"===m,onClick:function(){return i({mediaPosition:"right"})}},{icon:ee,title:Object(a.__)("Show media behind","full-site-editing"),isActive:"behind"===m,onClick:function(){return i({mediaPosition:"behind"})}}],I=[{icon:J,title:Object(a.__)("Landscape Image Shape","full-site-editing"),isActive:"landscape"===g,onClick:function(){return i({imageShape:"landscape"})}},{icon:X,title:Object(a.__)("portrait Image Shape","full-site-editing"),isActive:"portrait"===g,onClick:function(){return i({imageShape:"portrait"})}},{icon:$,title:Object(a.__)("Square Image Shape","full-site-editing"),isActive:"square"===g,onClick:function(){return i({imageShape:"square"})}},{icon:Z,title:Object(a.__)("Uncropped","full-site-editing"),isActive:"uncropped"===g,onClick:function(){return i({imageShape:"uncropped"})}}];return d(c,p),Object(s.createElement)(s.Fragment,null,Object(s.createElement)("div",{className:x,style:{color:f.color}},Object(s.createElement)("div",null,p&&(!Y.RichText.isEmpty(S)||u)&&Object(s.createElement)(Y.RichText,{onChange:function(e){return i({sectionHeader:e})},placeholder:Object(a.__)("Write header…","full-site-editing"),value:S,tagName:"h2",className:"article-section-title"}),p&&!p.length&&Object(s.createElement)(l.Placeholder,null,Object(a.__)("Sorry, no posts were found.","full-site-editing")),!p&&Object(s.createElement)(l.Placeholder,{icon:Object(s.createElement)(l.Spinner,null),className:"component-placeholder__align-center"}),p&&p.map((function(e){return t.renderPost(e)})))),!P&&p&&O&&!z()&&Object(s.createElement)("div",{className:"editor-styles-wrapper wpnbha__wp-block-button__wrapper"},Object(s.createElement)("div",{className:"wp-block-button"},Object(s.createElement)(Y.RichText,{placeholder:Object(a.__)("Load more posts","full-site-editing"),value:y,onChange:function(e){return i({moreButtonText:e})},className:"wp-block-button__link",keepPlaceholderOnFocus:!0,allowedFormats:[]}))),Object(s.createElement)(Y.BlockControls,null,Object(s.createElement)(l.Toolbar,{controls:A}),h&&Object(s.createElement)(l.Toolbar,{controls:T}),h&&Object(s.createElement)(l.Toolbar,{controls:I})),Object(s.createElement)(Y.InspectorControls,null,this.renderInspectorControls()))}}]),n}(s.Component),ne=Object(W.compose)([Object(Y.withColors)({textColor:"color"}),Object(D.withSelect)((function(e,t){var n=t.attributes,o=t.clientId,r=function(e){var t=e.postsToShow,n=e.authors,o=e.categories,r=e.tags,c=e.specificPosts,a=e.tagExclusions;return Object(A.pickBy)(F(e)?{include:c,orderby:"include",per_page:c.length}:{per_page:t,categories:o,author:n,tags:r,tags_exclude:a},(function(e){return!Object(A.isUndefined)(e)}))}(n);if(!F(n)){var c=e(L).previousPostIds(o);r.exclude=c.join(",")}return{latestPosts:e("core").getEntityRecords("postType","post",r)}})),Object(D.withDispatch)((function(e,t){var n=t.attributes;return{markPostsAsDisplayed:F(n)?e(L).markSpecificPostsAsDisplayed:e(L).markPostsAsDisplayed}}))])(te),oe=(n(35),n(36),H.name,H.attributes),re=H.category,ce={title:Object(a.__)("Homepage Posts","full-site-editing"),icon:Object(s.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(s.createElement)(l.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(s.createElement)(l.Path,{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM10 9h8v2h-8zm0 3h4v2h-4zm0-6h8v2h-8z"})),attributes:oe,category:re,keywords:[Object(a.__)("posts","full-site-editing"),Object(a.__)("articles","full-site-editing"),Object(a.__)("latest","full-site-editing")],description:Object(a.__)("A block for displaying homepage posts.","full-site-editing"),styles:[{name:"default",label:Object(a._x)("Default","block style","full-site-editing"),isDefault:!0},{name:"borders",label:Object(a._x)("Borders","block style","full-site-editing")}],supports:{html:!1,align:["wide","full"],default:""},edit:ne,save:function(){return null},transforms:{from:[{type:"block",blocks:["core/latest-posts"],transform:function(e){var t=e.displayPostContent,n=e.displayPostDate,o=e.postLayout,r=e.columns,a=e.postsToShow,s=e.categories;return Object(c.createBlock)(Object(i.applyFilters)("blocks.transforms_from_name","newspack-blocks/homepage-articles"),{showExcerpt:t,showDate:n,postLayout:o,columns:r,postsToShow:a,showAuthor:!1,categories:s?[s]:[]})}}],to:[{type:"block",blocks:["core/latest-posts"],transform:function(e){var t=e.showExcerpt,n=e.showDate,o=e.postLayout,r=e.columns,a=e.postsToShow,i=e.categories;return Object(c.createBlock)("core/latest-posts",{displayPostContent:t,displayPostDate:n,postLayout:o,columns:r,postsToShow:a,categories:i[0]||""})}}]}};Object(i.addFilter)("blocks.transforms_from_name","set-transformed-block-name",(function(e){return"newspack-blocks/homepage-articles"!==e?e:"a8c/blog-posts"})),Object(c.registerBlockType)("a8c/blog-posts",r()({},ce,{title:Object(a.__)("Blog Posts","full-site-editing"),category:"layout"})),function(e){var t=function t(n){return n.flatMap((function(n){var o=[];return n.name===e&&o.push(n),o.concat(t(n.innerBlocks))}))};Object(D.registerStore)(L,{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:N,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"UPDATE_BLOCKS":return r()({},e,{queryBlocks:t(n.blocks)});case"MARK_POSTS_DISPLAYED":return r()({},e,{postsByBlock:r()({},e.postsByBlock,v()({},n.clientId,n.posts))});case"MARK_SPECIFIC_POSTS_DISPLAYED":return r()({},e,{specificPostsByBlock:r()({},e.specificPostsByBlock,v()({},n.clientId,n.posts))})}return e},actions:R,selectors:V,initialState:N});var n,o=Object(D.select)("core/block-editor"),c=o.getClientIdsWithDescendants,a=o.getBlocks,i=Object(D.dispatch)(L).updateBlocks;Object(D.subscribe)((function(){var e=c(),t=e!==n;n=e,t&&i(a())}))}("a8c/blog-posts")}]));
|
blog-posts-block/dist/editor.rtl.css → newspack-blocks/dist/blog-posts-block-editor.rtl.css
RENAMED
File without changes
|
blog-posts-block/dist/view.asset.php → newspack-blocks/dist/blog-posts-block-view.asset.php
RENAMED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'dcb8604476ddae12373c72bc3da08443');
|
blog-posts-block/dist/view.css → newspack-blocks/dist/blog-posts-block-view.css
RENAMED
File without changes
|
blog-posts-block/dist/view.js → newspack-blocks/dist/blog-posts-block-view.js
RENAMED
@@ -1 +1 @@
|
|
1 |
-
!function(t,e){for(var r in e)t[r]=e[r]}(window,function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},function(t,e,r){var n=r(2),o=r(3),i=r(4),a=r(5);t.exports=function(t){return n(t)||o(t)||i(t)||a()}},function(t,e,r){var n=r(0);t.exports=function(t){if(Array.isArray(t))return n(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e,r){var n=r(0);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,r){},function(t,e,r){"use strict";r.r(e);var n=r(1),o=r.n(n)
|
1 |
+
!function(t,e){for(var r in e)t[r]=e[r]}(window,function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},function(t,e,r){var n=r(2),o=r(3),i=r(4),a=r(5);t.exports=function(t){return n(t)||o(t)||i(t)||a()}},function(t,e,r){var n=r(0);t.exports=function(t){if(Array.isArray(t))return n(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e,r){var n=r(0);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e,r){},function(t,e,r){"use strict";r.r(e);var n=r(1),o=r.n(n);r(6);function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}Array.prototype.forEach.call(document.querySelectorAll(".wp-block-newspack-blocks-homepage-articles.has-more-button"),(function(t){var e=t.querySelector("[data-next]");if(!e)return;var r=t.querySelector("[data-posts]"),n=!1,a=!1;e.addEventListener("click",(function(){if(n||a)return!1;var u,s;function c(){n=!1,t.classList.remove("is-loading"),t.classList.add("is-error")}n=!0,t.classList.remove("is-error"),t.classList.add("is-loading"),function t(e,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(n.status>=200&&n.status<300){var o=JSON.parse(n.responseText);return e.onSuccess(o)}return r?t(e,r-1):e.onError()}},n.open("GET",e.url),n.send()}({url:e.getAttribute("data-next")+"&exclude_ids="+(u=document.querySelectorAll(".wp-block-newspack-blocks-homepage-articles [data-post-id]"),s=Array.from(u).map((function(t){return t.getAttribute("data-post-id")})),o()(new Set(s))).join(","),onSuccess:function(o){if(!function(t){var e=!1;t&&i(t,"items")&&Array.isArray(t.items)&&i(t,"next")&&"string"==typeof t.next&&(e=!0,!t.items.length||i(t.items[0],"html")&&"string"==typeof t.items[0].html||(e=!1));return e}(o))return c();if(o.items.length){var u=o.items.map((function(t){return t.html})).join("");r.insertAdjacentHTML("beforeend",u)}o.next&&e.setAttribute("data-next",o.next);o.items.length&&o.next||(a=!0,t.classList.remove("has-more-button"));n=!1,t.classList.remove("is-loading")},onError:c},3)}))}))}]));
|
blog-posts-block/dist/view.rtl.css → newspack-blocks/dist/blog-posts-block-view.rtl.css
RENAMED
File without changes
|
newspack-blocks/dist/carousel-block-editor.asset.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => 'f3a5698314eb5c19d507fcdd6f8205d1');
|
newspack-blocks/dist/carousel-block-editor.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.autocomplete-tokenfield{position:relative}.autocomplete-tokenfield .components-spinner{position:absolute;top:2em;right:0}.autocomplete-tokenfield .components-form-token-field>.components-form-token-field__help{display:none}.autocomplete-tokenfield .autocomplete-tokenfield__help{font-style:italic}.swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-container-no-flexbox .swiper-slide{float:left}.swiper-container-vertical>.swiper-wrapper{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-container-android .swiper-slide,.swiper-wrapper{-webkit-transform:translateZ(0);transform:translateZ(0)}.swiper-container-multirow>.swiper-wrapper{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.swiper-container-free-mode>.swiper-wrapper{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out;margin:0 auto}.swiper-slide{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-container-autoheight,.swiper-container-autoheight .swiper-slide{height:auto}.swiper-container-autoheight .swiper-wrapper{-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height,-webkit-transform;transition-property:height,-webkit-transform;-o-transition-property:transform,height;transition-property:transform,height;transition-property:transform,height,-webkit-transform}.swiper-container-3d{-webkit-perspective:1200px;perspective:1200px}.swiper-container-3d .swiper-cube-shadow,.swiper-container-3d .swiper-slide,.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top,.swiper-container-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-container-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear,right top,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:linear-gradient(270deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:linear-gradient(90deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear,left bottom,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:linear-gradient(0deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:linear-gradient(180deg,rgba(0,0,0,.5),transparent)}.swiper-container-wp8-horizontal,.swiper-container-wp8-horizontal>.swiper-wrapper{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-container-wp8-vertical,.swiper-container-wp8-vertical>.swiper-wrapper{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:27px;height:44px;margin-top:-22px;z-index:10;cursor:pointer;background-size:27px 44px;background-position:50%;background-repeat:no-repeat}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-prev,.swiper-container-rtl .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23007aff'/%3E%3C/svg%3E");left:10px;right:auto}.swiper-button-next,.swiper-container-rtl .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23007aff'/%3E%3C/svg%3E");right:10px;left:auto}.swiper-button-prev.swiper-button-white,.swiper-container-rtl .swiper-button-next.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-white,.swiper-container-rtl .swiper-button-prev.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-prev.swiper-button-black,.swiper-container-rtl .swiper-button-next.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-black,.swiper-container-rtl .swiper-button-prev.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z'/%3E%3C/svg%3E")}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:opacity .3s;-o-transition:.3s opacity;transition:opacity .3s;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:10px;left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active,.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;border-radius:100%;background:#000;opacity:.2}button.swiper-pagination-bullet{border:none;margin:0;padding:0;-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet-active{opacity:1;background:#007aff}.swiper-container-vertical>.swiper-pagination-bullets{right:10px;top:50%;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:6px 0;display:block}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:8px}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;-webkit-transition:top .2s,-webkit-transform .2s;transition:top .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s top;transition:transform .2s,top .2s;transition:transform .2s,top .2s,-webkit-transform .2s}.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 4px}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);white-space:nowrap}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:left .2s,-webkit-transform .2s;transition:left .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s left;transition:transform .2s,left .2s;transition:transform .2s,left .2s,-webkit-transform .2s}.swiper-container-horizontal.swiper-container-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:right .2s,-webkit-transform .2s;transition:right .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s right;transition:transform .2s,right .2s;transition:transform .2s,right .2s,-webkit-transform .2s}.swiper-pagination-progressbar{background:rgba(0,0,0,.25);position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:#007aff;position:absolute;left:0;top:0;width:100%;height:100%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top}.swiper-container-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{-webkit-transform-origin:right top;-ms-transform-origin:right top;transform-origin:right top}.swiper-container-horizontal>.swiper-pagination-progressbar,.swiper-container-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:4px;left:0;top:0}.swiper-container-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-container-vertical>.swiper-pagination-progressbar{width:4px;height:100%;left:0;top:0}.swiper-pagination-white .swiper-pagination-bullet-active{background:#fff}.swiper-pagination-progressbar.swiper-pagination-white{background:hsla(0,0%,100%,.25)}.swiper-pagination-progressbar.swiper-pagination-white .swiper-pagination-progressbar-fill{background:#fff}.swiper-pagination-black .swiper-pagination-bullet-active{background:#000}.swiper-pagination-progressbar.swiper-pagination-black{background:rgba(0,0,0,.25)}.swiper-pagination-progressbar.swiper-pagination-black .swiper-pagination-progressbar-fill{background:#000}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:10px;position:relative;-ms-touch-action:none;background:rgba(0,0,0,.1)}.swiper-container-horizontal>.swiper-scrollbar{position:absolute;left:1%;bottom:3px;z-index:50;height:5px;width:98%}.swiper-container-vertical>.swiper-scrollbar{position:absolute;right:3px;top:1%;z-index:50;width:5px;height:98%}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:rgba(0,0,0,.5);border-radius:10px;left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}.swiper-slide-zoomed{cursor:move}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-animation:swiper-preloader-spin 1s steps(12) infinite;animation:swiper-preloader-spin 1s steps(12) infinite}.swiper-lazy-preloader:after{display:block;content:"";width:100%;height:100%;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%236c6c6c' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E");background-position:50%;background-size:100%;background-repeat:no-repeat}.swiper-lazy-preloader-white:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%23fff' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E")}@-webkit-keyframes swiper-preloader-spin{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes swiper-preloader-spin{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.swiper-container .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-container-fade.swiper-container-free-mode .swiper-slide{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out}.swiper-container-fade .swiper-slide{pointer-events:none;-webkit-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity}.swiper-container-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-fade .swiper-slide-active,.swiper-container-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube{overflow:visible}.swiper-container-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;width:100%;height:100%}.swiper-container-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-cube.swiper-container-rtl .swiper-slide{-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-next,.swiper-container-cube .swiper-slide-next+.swiper-slide,.swiper-container-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-container-cube .swiper-slide-shadow-bottom,.swiper-container-cube .swiper-slide-shadow-left,.swiper-container-cube .swiper-slide-shadow-right,.swiper-container-cube .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0;width:100%;height:100%;background:#000;opacity:.6;-webkit-filter:blur(50px);filter:blur(50px);z-index:0}.swiper-container-flip{overflow:visible}.swiper-container-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-container-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-flip .swiper-slide-active,.swiper-container-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-flip .swiper-slide-shadow-bottom,.swiper-container-flip .swiper-slide-shadow-left,.swiper-container-flip .swiper-slide-shadow-right,.swiper-container-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-coverflow .swiper-wrapper{-ms-perspective:1200px}.wp-block-newspack-blocks-carousel{position:relative;margin-top:0}.wp-block-newspack-blocks-carousel article{max-width:100%;padding:0;position:relative;margin-bottom:0;word-break:break-word;overflow-wrap:break-word}.wp-block-newspack-blocks-carousel article a{color:inherit}.wp-block-newspack-blocks-carousel article a:active,.wp-block-newspack-blocks-carousel article a:focus,.wp-block-newspack-blocks-carousel article a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.2em}.wp-block-newspack-blocks-carousel article .entry-title a{-webkit-box-orient:vertical;display:-webkit-box;-webkit-line-clamp:3;max-height:3.5625em;overflow:hidden;text-overflow:ellipsis}.wp-block-newspack-blocks-carousel article .avatar{height:1.8em;width:1.8em}@media only screen and (min-width:782px){.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.6em}.wp-block-newspack-blocks-carousel article .avatar{height:40px;width:40px}}.wp-block-newspack-blocks-carousel article .entry-wrapper{bottom:0;background-color:rgba(0,0,0,.5);color:#fff;left:0;padding:1.5em;position:absolute;right:0}.wp-block-newspack-blocks-carousel article .entry-meta{color:inherit;margin-bottom:0;font-size:.8em}.wp-block-newspack-blocks-carousel article .entry-meta a{color:inherit;font-weight:700;text-decoration:none}.wp-block-newspack-blocks-carousel article .entry-meta a:active,.wp-block-newspack-blocks-carousel article .entry-meta a:focus,.wp-block-newspack-blocks-carousel article .entry-meta a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel figure.post-thumbnail{margin:0;height:100%;padding:0}.wp-block-newspack-blocks-carousel figure.post-thumbnail a,.wp-block-newspack-blocks-carousel figure.post-thumbnail img{display:block;height:100%;width:100%}.wp-block-newspack-blocks-carousel p{white-space:normal}.wp-block-newspack-blocks-carousel .swiper-pagination-bullets{align-items:flex-end;bottom:0;display:flex;flex-wrap:wrap;height:calc(1.5em + 12px);justify-content:center;padding:0;position:relative}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet{background:#000;border-radius:6px;display:inline-block;height:12px;margin:0 4px;opacity:.5;padding:0;transition:box-shadow .25s,opacity .25s,width .25s;width:12px}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #000;outline:0}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet.swiper-pagination-bullet-active,.wp-block-newspack-blocks-carousel .swiper-pagination-bullet[selected]{opacity:1;outline:0;width:24px}.wp-block-newspack-blocks-carousel .amp-carousel-button,.wp-block-newspack-blocks-carousel .swiper-button{background-color:rgba(0,0,0,.5);background-position:50%;background-repeat:no-repeat;background-size:24px;border:0;border-radius:4px;box-shadow:none;cursor:pointer;height:48px;margin:0;padding:0;transition:background-color .25s,box-shadow .25s;width:48px}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .amp-carousel-button:hover,.wp-block-newspack-blocks-carousel .swiper-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:hover{background-color:rgba(0,0,0,.75)}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:focus{box-shadow:inset 0 0 0 2px rgba(0,0,0,.75),inset 0 0 0 4px #fff;outline:0}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{left:1.5em;display:none}@media only screen and (min-width:600px){.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{display:block}}.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{margin-top:-24px}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E");left:auto;right:1.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M18 4.12L10.12 12 18 19.88 15.88 22l-10-10 10-10z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");display:none;margin-top:0;position:absolute;right:1.5em;top:1.5em;transform:none;z-index:1}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M8 5v14l11-7z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .swiper-slide{height:auto}.wp-block-newspack-blocks-carousel figcaption{font-size:.6em}.wp-block-newspack-blocks-carousel .entry-title{margin:0 0 .25em}.wp-block-newspack-blocks-carousel .entry-title a{color:inherit;text-decoration:none}.wp-block-newspack-blocks-carousel .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wp-block-newspack-blocks-carousel .entry-meta .byline:not(:last-child){margin-right:1.5em}.wp-block-newspack-blocks-carousel .cat-links{color:inherit;font-size:.6em;font-weight:700;margin:0 0 .5em}.wp-block-newspack-blocks-carousel .cat-links a{text-decoration:none}.wp-block-newspack-blocks-carousel .avatar{border-radius:100%;display:block;margin-right:.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-pause{display:block}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-play{display:none}.wp-block[data-type^="newspack-blocks/"] .component-placeholder__align-center{align-items:center}.wp-block-newspack-blocks-carousel .entry-title{color:#fff}.wp-block-newspack-blocks-carousel a{color:inherit}.wp-block-newspack-blocks-carousel a:active,.wp-block-newspack-blocks-carousel a:focus,.wp-block-newspack-blocks-carousel a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel .post-thumbnail img{display:block}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet.swiper-pagination-bullet-active{opacity:1;width:24px}.wp-block-newspack-blocks-carousel .amp-carousel-button.amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button.amp-carousel-button-prev{left:1.5em;margin-top:-24px;transform:translateY(-50%)}.wp-block-newspack-blocks-carousel .amp-carousel-button.amp-carousel-button-next{left:auto;right:1.5em}.editor-block-list__layout .editor-block-list__block .wp-block-newspack-blocks-carousel .entry-meta .byline a,.editor-block-list__layout .editor-block-list__block .wp-block-newspack-blocks-carousel .entry-title a{color:inherit}
|
newspack-blocks/dist/carousel-block-editor.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
!function(e,t){for(var s in t)e[s]=t[s]}(window,function(e){var t={};function s(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=e,s.c=t,s.d=function(e,t,a){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(s.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(a,i,function(t){return e[t]}.bind(null,i));return a},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=37)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,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){!function(){e.exports=this.wp.htmlEntities}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,s){var a=s(24);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}},function(e,t,s){var a=s(25),i=s(26),n=s(27);e.exports=function(e){return function(){var t,s=a(e);if(i()){var r=a(this).constructor;t=Reflect.construct(s,arguments,r)}else t=s.apply(this,arguments);return n(this,t)}}},function(e,t){function s(e,t){for(var s=0;s<t.length;s++){var a=t[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}e.exports=function(e,t,a){return t&&s(e.prototype,t),a&&s(e,a),e}},function(e,t,s){var a=s(29),i=s(30),n=s(31),r=s(32);e.exports=function(e){return a(e)||i(e)||n(e)||r()}},function(e,t){!function(){e.exports=this.wp.date}()},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var s=0,a=new Array(t);s<t;s++)a[s]=e[s];return a}},function(e,t,s){var a=s(3);function i(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,a)}return s}e.exports=function(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?i(Object(s),!0).forEach((function(t){a(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):i(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){function s(){return e.exports=s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},s.apply(this,arguments)}e.exports=s},function(e,t,s){var a;
|
2 |
+
/*!
|
3 |
+
Copyright (c) 2017 Jed Watson.
|
4 |
+
Licensed under the MIT License (MIT), see
|
5 |
+
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var s={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var n=typeof a;if("string"===n||"number"===n)e.push(a);else if(Array.isArray(a)&&a.length){var r=i.apply(null,a);r&&e.push(r)}else if("object"===n)for(var o in a)s.call(a,o)&&a[o]&&e.push(o)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(a=function(){return i}.apply(t,[]))||(e.exports=a)}()},function(e,t){!function(){e.exports=this.wp.editor}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){function s(t,a){return e.exports=s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(t,a)}e.exports=s},function(e,t){function s(t){return e.exports=s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},s(t)}e.exports=s},function(e,t){e.exports=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}}},function(e,t,s){var a=s(28),i=s(4);e.exports=function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?i(e):t}},function(e,t){function s(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=s=function(e){return typeof e}:e.exports=s=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(t)}e.exports=s},function(e,t,s){var a=s(15);e.exports=function(e){if(Array.isArray(e))return a(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t,s){var a=s(15);e.exports=function(e,t){if(e){if("string"==typeof e)return a(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);return"Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s?Array.from(s):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?a(e,t):void 0}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,s){},function(e,t,s){},function(e,t,s){},function(e,t,s){},function(e,t,s){"use strict";s.r(t);var a=s(16),i=s.n(a),n=s(17),r=s(1),o=s(18),l=s(0),d=s(2),c=s(9),p=s.n(c),u=s(12),h=s.n(u),m=s(10),f=s.n(m),g=s(11),v=s.n(g),b=s(19),w=s.n(b),y=s(4),x=s.n(y),E=s(3),S=s.n(E),T=s(6),C=s.n(T),k=s(7),$=s(5),M=s(13),P=s.n(M),O=s(8),z=(s(33),function(e){f()(s,e);var t=v()(s);function s(e){var a;return p()(this,s),a=t.call(this,e),S()(x()(a),"isFetchingInfoOnLoad",(function(){var e=a.props,t=e.tokens,s=e.fetchSavedInfo;return Boolean(t.length&&s)})),a.state={suggestions:[],validValues:{},loading:a.isFetchingInfoOnLoad()},a.debouncedUpdateSuggestions=Object(O.debounce)(a.updateSuggestions,500),a}return h()(s,[{key:"componentDidMount",value:function(){var e=this;if(this.isFetchingInfoOnLoad()){var t=this.props,s=t.tokens;(0,t.fetchSavedInfo)(s).then((function(t){var s=e.state.validValues;t.forEach((function(e){s[e.value]=e.label})),e.setState({validValues:s,loading:!1})}))}}},{key:"componentWillUnmount",value:function(){delete this.suggestionsRequest,this.debouncedUpdateSuggestions.cancel()}},{key:"getLabelsForValues",value:function(e){var t=this.state.validValues;return e.reduce((function(e,s){return t[s]?[].concat(P()(e),[t[s]]):e}),[])}},{key:"getValuesForLabels",value:function(e){var t=this.state.validValues;return e.map((function(e){return Object.keys(t).find((function(s){return t[s]===e}))}))}},{key:"updateSuggestions",value:function(e){var t=this,s=this.props.fetchSuggestions;s&&this.setState({loading:!0},(function(){var a=s(e);a.then((function(e){if(t.suggestionsRequest===a){var s=t.state.validValues,i=[];e.forEach((function(e){i.push(e.label),s[e.value]=e.label})),t.setState({suggestions:i,validValues:s,loading:!1})}})).catch((function(){t.suggestionsRequest===a&&t.setState({loading:!1})})),t.suggestionsRequest=a}))}},{key:"handleOnChange",value:function(e){(0,this.props.onChange)(this.getValuesForLabels(e))}},{key:"getTokens",value:function(){var e=this.props.tokens;return this.getLabelsForValues(e)}},{key:"render",value:function(){var e=this,t=this.props,s=t.help,a=t.label,i=void 0===a?"":a,n=this.state,r=n.suggestions,o=n.loading;return Object(l.createElement)("div",{className:"autocomplete-tokenfield"},Object(l.createElement)(d.FormTokenField,{value:this.getTokens(),suggestions:r,onChange:function(t){return e.handleOnChange(t)},onInputChange:function(t){return e.debouncedUpdateSuggestions(t)},label:i}),o&&Object(l.createElement)(d.Spinner,null),s&&Object(l.createElement)("p",{className:"autocomplete-tokenfield__help"},s))}}]),s}(l.Component)),I=function(e){f()(s,e);var t=v()(s);function s(){var e;p()(this,s);for(var a=arguments.length,i=new Array(a),n=0;n<a;n++)i[n]=arguments[n];return e=t.call.apply(t,[this].concat(i)),S()(x()(e),"state",{showAdvancedFilters:!1}),S()(x()(e),"fetchPostSuggestions",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/search",{search:e,per_page:20,_fields:"id,title",type:"post"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.title)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(x()(e),"fetchSavedPosts",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/posts",{per_page:100,include:e.join(","),_fields:"id,title"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.title.rendered)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(x()(e),"fetchAuthorSuggestions",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/users",{search:e,per_page:20,_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.name)||Object(r.__)("(no name)","newspack-blocks")}}))}))})),S()(x()(e),"fetchSavedAuthors",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/users",{per_page:100,include:e.join(","),_fields:"id,name"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.name)||Object(r.__)("(no name)","newspack-blocks")}}))}))})),S()(x()(e),"fetchCategorySuggestions",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/categories",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(x()(e),"fetchSavedCategories",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/categories",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(x()(e),"fetchTagSuggestions",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/tags",{search:e,per_page:20,_fields:"id,name",orderby:"count",order:"desc"})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(x()(e),"fetchSavedTags",(function(e){return C()({path:Object(k.addQueryArgs)("/wp/v2/tags",{per_page:100,_fields:"id,name",include:e.join(",")})}).then((function(e){return e.map((function(e){return{value:e.id,label:Object($.decodeEntities)(e.name)||Object(r.__)("(no title)","newspack-blocks")}}))}))})),S()(x()(e),"render",(function(){var t=e.props,s=t.specificMode,a=t.onSpecificModeChange,i=t.specificPosts,n=t.onSpecificPostsChange,o=t.authors,c=t.onAuthorsChange,p=t.categories,u=t.onCategoriesChange,h=t.tags,m=t.onTagsChange,f=t.tagExclusions,g=t.onTagExclusionsChange,v=t.enableSpecific,b=e.state.showAdvancedFilters;return[v&&Object(l.createElement)(d.ToggleControl,{key:"specificMode",checked:s,onChange:a,label:Object(r.__)("Choose Specific Posts","newspack-blocks")}),s&&Object(l.createElement)(z,{key:"posts",tokens:i||[],onChange:n,fetchSuggestions:e.fetchPostSuggestions,fetchSavedInfo:e.fetchSavedPosts,label:Object(r.__)("Posts","newspack-blocks"),help:Object(r.__)("Begin typing post title, click autocomplete result to select.","newspack-blocks")}),!s&&Object(l.createElement)(d.QueryControls,w()({key:"queryControls"},e.props)),!s&&c&&Object(l.createElement)(z,{key:"authors",tokens:o||[],onChange:c,fetchSuggestions:e.fetchAuthorSuggestions,fetchSavedInfo:e.fetchSavedAuthors,label:Object(r.__)("Authors","newspack-blocks")}),!s&&u&&Object(l.createElement)(z,{key:"categories",tokens:p||[],onChange:u,fetchSuggestions:e.fetchCategorySuggestions,fetchSavedInfo:e.fetchSavedCategories,label:Object(r.__)("Categories","newspack-blocks")}),!s&&m&&Object(l.createElement)(z,{key:"tags",tokens:h||[],onChange:m,fetchSuggestions:e.fetchTagSuggestions,fetchSavedInfo:e.fetchSavedTags,label:Object(r.__)("Tags","newspack-blocks")}),!s&&g&&Object(l.createElement)("p",{key:"toggle-advanced-filters"},Object(l.createElement)(d.Button,{isLink:!0,onClick:function(){return e.setState({showAdvancedFilters:!b})}},b?Object(r.__)("Hide Advanced Filters","newspack-blocks"):Object(r.__)("Show Advanced Filters","newspack-blocks"))),!s&&g&&b&&Object(l.createElement)(z,{key:"tag-exclusion",tokens:f||[],onChange:g,fetchSuggestions:e.fetchTagSuggestions,fetchSavedInfo:e.fetchSavedTags,label:Object(r.__)("Excluded Tags","newspack-blocks")})]})),e}return s}(l.Component);I.defaultProps={enableSpecific:!0,specificPosts:[],authors:[],categories:[],tags:[],tagExclusions:[]};var L=I,j="undefined"==typeof document?{body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},location:{hash:""}}:document,D="undefined"==typeof window?{document:j,navigator:{userAgent:""},location:{},history:{},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){}}:window;class A{constructor(e){const t=this;for(let s=0;s<e.length;s+=1)t[s]=e[s];return t.length=e.length,this}}function _(e,t){const s=[];let a=0;if(e&&!t&&e instanceof A)return e;if(e)if("string"==typeof e){let i,n;const r=e.trim();if(r.indexOf("<")>=0&&r.indexOf(">")>=0){let e="div";for(0===r.indexOf("<li")&&(e="ul"),0===r.indexOf("<tr")&&(e="tbody"),0!==r.indexOf("<td")&&0!==r.indexOf("<th")||(e="tr"),0===r.indexOf("<tbody")&&(e="table"),0===r.indexOf("<option")&&(e="select"),n=j.createElement(e),n.innerHTML=r,a=0;a<n.childNodes.length;a+=1)s.push(n.childNodes[a])}else for(i=t||"#"!==e[0]||e.match(/[ .<>:~]/)?(t||j).querySelectorAll(e.trim()):[j.getElementById(e.trim().split("#")[1])],a=0;a<i.length;a+=1)i[a]&&s.push(i[a])}else if(e.nodeType||e===D||e===j)s.push(e);else if(e.length>0&&e[0].nodeType)for(a=0;a<e.length;a+=1)s.push(e[a]);return new A(s)}function N(e){const t=[];for(let s=0;s<e.length;s+=1)-1===t.indexOf(e[s])&&t.push(e[s]);return t}_.fn=A.prototype,_.Class=A,_.Dom7=A;"resize scroll".split(" ");const B={addClass:function(e){if(void 0===e)return this;const t=e.split(" ");for(let s=0;s<t.length;s+=1)for(let e=0;e<this.length;e+=1)void 0!==this[e]&&void 0!==this[e].classList&&this[e].classList.add(t[s]);return this},removeClass:function(e){const t=e.split(" ");for(let s=0;s<t.length;s+=1)for(let e=0;e<this.length;e+=1)void 0!==this[e]&&void 0!==this[e].classList&&this[e].classList.remove(t[s]);return this},hasClass:function(e){return!!this[0]&&this[0].classList.contains(e)},toggleClass:function(e){const t=e.split(" ");for(let s=0;s<t.length;s+=1)for(let e=0;e<this.length;e+=1)void 0!==this[e]&&void 0!==this[e].classList&&this[e].classList.toggle(t[s]);return this},attr:function(e,t){if(1===arguments.length&&"string"==typeof e)return this[0]?this[0].getAttribute(e):void 0;for(let s=0;s<this.length;s+=1)if(2===arguments.length)this[s].setAttribute(e,t);else for(const t in e)this[s][t]=e[t],this[s].setAttribute(t,e[t]);return this},removeAttr:function(e){for(let t=0;t<this.length;t+=1)this[t].removeAttribute(e);return this},data:function(e,t){let s;if(void 0!==t){for(let a=0;a<this.length;a+=1)s=this[a],s.dom7ElementDataStorage||(s.dom7ElementDataStorage={}),s.dom7ElementDataStorage[e]=t;return this}if(s=this[0],s){if(s.dom7ElementDataStorage&&e in s.dom7ElementDataStorage)return s.dom7ElementDataStorage[e];const t=s.getAttribute("data-"+e);return t||void 0}},transform:function(e){for(let t=0;t<this.length;t+=1){const s=this[t].style;s.webkitTransform=e,s.transform=e}return this},transition:function(e){"string"!=typeof e&&(e+="ms");for(let t=0;t<this.length;t+=1){const s=this[t].style;s.webkitTransitionDuration=e,s.transitionDuration=e}return this},on:function(...e){let[t,s,a,i]=e;function n(e){const t=e.target;if(!t)return;const i=e.target.dom7EventData||[];if(i.indexOf(e)<0&&i.unshift(e),_(t).is(s))a.apply(t,i);else{const e=_(t).parents();for(let t=0;t<e.length;t+=1)_(e[t]).is(s)&&a.apply(e[t],i)}}function r(e){const t=e&&e.target&&e.target.dom7EventData||[];t.indexOf(e)<0&&t.unshift(e),a.apply(this,t)}"function"==typeof e[1]&&([t,a,i]=e,s=void 0),i||(i=!1);const o=t.split(" ");let l;for(let d=0;d<this.length;d+=1){const e=this[d];if(s)for(l=0;l<o.length;l+=1){const t=o[l];e.dom7LiveListeners||(e.dom7LiveListeners={}),e.dom7LiveListeners[t]||(e.dom7LiveListeners[t]=[]),e.dom7LiveListeners[t].push({listener:a,proxyListener:n}),e.addEventListener(t,n,i)}else for(l=0;l<o.length;l+=1){const t=o[l];e.dom7Listeners||(e.dom7Listeners={}),e.dom7Listeners[t]||(e.dom7Listeners[t]=[]),e.dom7Listeners[t].push({listener:a,proxyListener:r}),e.addEventListener(t,r,i)}}return this},off:function(...e){let[t,s,a,i]=e;"function"==typeof e[1]&&([t,a,i]=e,s=void 0),i||(i=!1);const n=t.split(" ");for(let r=0;r<n.length;r+=1){const e=n[r];for(let t=0;t<this.length;t+=1){const n=this[t];let r;if(!s&&n.dom7Listeners?r=n.dom7Listeners[e]:s&&n.dom7LiveListeners&&(r=n.dom7LiveListeners[e]),r&&r.length)for(let t=r.length-1;t>=0;t-=1){const s=r[t];a&&s.listener===a||a&&s.listener&&s.listener.dom7proxy&&s.listener.dom7proxy===a?(n.removeEventListener(e,s.proxyListener,i),r.splice(t,1)):a||(n.removeEventListener(e,s.proxyListener,i),r.splice(t,1))}}}return this},trigger:function(...e){const t=e[0].split(" "),s=e[1];for(let i=0;i<t.length;i+=1){const n=t[i];for(let t=0;t<this.length;t+=1){const i=this[t];let r;try{r=new D.CustomEvent(n,{detail:s,bubbles:!0,cancelable:!0})}catch(a){r=j.createEvent("Event"),r.initEvent(n,!0,!0),r.detail=s}i.dom7EventData=e.filter((e,t)=>t>0),i.dispatchEvent(r),i.dom7EventData=[],delete i.dom7EventData}}return this},transitionEnd:function(e){const t=["webkitTransitionEnd","transitionend"],s=this;let a;function i(n){if(n.target===this)for(e.call(this,n),a=0;a<t.length;a+=1)s.off(t[a],i)}if(e)for(a=0;a<t.length;a+=1)s.on(t[a],i);return this},outerWidth:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},outerHeight:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},offset:function(){if(this.length>0){const e=this[0],t=e.getBoundingClientRect(),s=j.body,a=e.clientTop||s.clientTop||0,i=e.clientLeft||s.clientLeft||0,n=e===D?D.scrollY:e.scrollTop,r=e===D?D.scrollX:e.scrollLeft;return{top:t.top+n-a,left:t.left+r-i}}return null},css:function(e,t){let s;if(1===arguments.length){if("string"!=typeof e){for(s=0;s<this.length;s+=1)for(let t in e)this[s].style[t]=e[t];return this}if(this[0])return D.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(s=0;s<this.length;s+=1)this[s].style[e]=t;return this}return this},each:function(e){if(!e)return this;for(let t=0;t<this.length;t+=1)if(!1===e.call(this[t],t,this[t]))return this;return this},html:function(e){if(void 0===e)return this[0]?this[0].innerHTML:void 0;for(let t=0;t<this.length;t+=1)this[t].innerHTML=e;return this},text:function(e){if(void 0===e)return this[0]?this[0].textContent.trim():null;for(let t=0;t<this.length;t+=1)this[t].textContent=e;return this},is:function(e){const t=this[0];let s,a;if(!t||void 0===e)return!1;if("string"==typeof e){if(t.matches)return t.matches(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);for(s=_(e),a=0;a<s.length;a+=1)if(s[a]===t)return!0;return!1}if(e===j)return t===j;if(e===D)return t===D;if(e.nodeType||e instanceof A){for(s=e.nodeType?[e]:e,a=0;a<s.length;a+=1)if(s[a]===t)return!0;return!1}return!1},index:function(){let e,t=this[0];if(t){for(e=0;null!==(t=t.previousSibling);)1===t.nodeType&&(e+=1);return e}},eq:function(e){if(void 0===e)return this;const t=this.length;let s;return e>t-1?new A([]):e<0?(s=t+e,new A(s<0?[]:[this[s]])):new A([this[e]])},append:function(...e){let t;for(let s=0;s<e.length;s+=1){t=e[s];for(let e=0;e<this.length;e+=1)if("string"==typeof t){const s=j.createElement("div");for(s.innerHTML=t;s.firstChild;)this[e].appendChild(s.firstChild)}else if(t instanceof A)for(let s=0;s<t.length;s+=1)this[e].appendChild(t[s]);else this[e].appendChild(t)}return this},prepend:function(e){let t,s;for(t=0;t<this.length;t+=1)if("string"==typeof e){const a=j.createElement("div");for(a.innerHTML=e,s=a.childNodes.length-1;s>=0;s-=1)this[t].insertBefore(a.childNodes[s],this[t].childNodes[0])}else if(e instanceof A)for(s=0;s<e.length;s+=1)this[t].insertBefore(e[s],this[t].childNodes[0]);else this[t].insertBefore(e,this[t].childNodes[0]);return this},next:function(e){return this.length>0?e?this[0].nextElementSibling&&_(this[0].nextElementSibling).is(e)?new A([this[0].nextElementSibling]):new A([]):this[0].nextElementSibling?new A([this[0].nextElementSibling]):new A([]):new A([])},nextAll:function(e){const t=[];let s=this[0];if(!s)return new A([]);for(;s.nextElementSibling;){const a=s.nextElementSibling;e?_(a).is(e)&&t.push(a):t.push(a),s=a}return new A(t)},prev:function(e){if(this.length>0){const t=this[0];return e?t.previousElementSibling&&_(t.previousElementSibling).is(e)?new A([t.previousElementSibling]):new A([]):t.previousElementSibling?new A([t.previousElementSibling]):new A([])}return new A([])},prevAll:function(e){const t=[];let s=this[0];if(!s)return new A([]);for(;s.previousElementSibling;){const a=s.previousElementSibling;e?_(a).is(e)&&t.push(a):t.push(a),s=a}return new A(t)},parent:function(e){const t=[];for(let s=0;s<this.length;s+=1)null!==this[s].parentNode&&(e?_(this[s].parentNode).is(e)&&t.push(this[s].parentNode):t.push(this[s].parentNode));return _(N(t))},parents:function(e){const t=[];for(let s=0;s<this.length;s+=1){let a=this[s].parentNode;for(;a;)e?_(a).is(e)&&t.push(a):t.push(a),a=a.parentNode}return _(N(t))},closest:function(e){let t=this;return void 0===e?new A([]):(t.is(e)||(t=t.parents(e).eq(0)),t)},find:function(e){const t=[];for(let s=0;s<this.length;s+=1){const a=this[s].querySelectorAll(e);for(let e=0;e<a.length;e+=1)t.push(a[e])}return new A(t)},children:function(e){const t=[];for(let s=0;s<this.length;s+=1){const a=this[s].childNodes;for(let s=0;s<a.length;s+=1)e?1===a[s].nodeType&&_(a[s]).is(e)&&t.push(a[s]):1===a[s].nodeType&&t.push(a[s])}return new A(N(t))},remove:function(){for(let e=0;e<this.length;e+=1)this[e].parentNode&&this[e].parentNode.removeChild(this[e]);return this},add:function(...e){const t=this;let s,a;for(s=0;s<e.length;s+=1){const i=_(e[s]);for(a=0;a<i.length;a+=1)t[t.length]=i[a],t.length+=1}return t},styles:function(){return this[0]?D.getComputedStyle(this[0],null):{}}};Object.keys(B).forEach(e=>{_.fn[e]=_.fn[e]||B[e]});const H={deleteProps(e){const t=e;Object.keys(t).forEach(e=>{try{t[e]=null}catch(s){}try{delete t[e]}catch(s){}})},nextTick:(e,t=0)=>setTimeout(e,t),now:()=>Date.now(),getTranslate(e,t="x"){let s,a,i;const n=D.getComputedStyle(e,null);return D.WebKitCSSMatrix?(a=n.transform||n.webkitTransform,a.split(",").length>6&&(a=a.split(", ").map(e=>e.replace(",",".")).join(", ")),i=new D.WebKitCSSMatrix("none"===a?"":a)):(i=n.MozTransform||n.OTransform||n.MsTransform||n.msTransform||n.transform||n.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),s=i.toString().split(",")),"x"===t&&(a=D.WebKitCSSMatrix?i.m41:16===s.length?parseFloat(s[12]):parseFloat(s[4])),"y"===t&&(a=D.WebKitCSSMatrix?i.m42:16===s.length?parseFloat(s[13]):parseFloat(s[5])),a||0},parseUrlQuery(e){const t={};let s,a,i,n,r=e||D.location.href;if("string"==typeof r&&r.length)for(r=r.indexOf("?")>-1?r.replace(/\S*\?/,""):"",a=r.split("&").filter(e=>""!==e),n=a.length,s=0;s<n;s+=1)i=a[s].replace(/#\S+/g,"").split("="),t[decodeURIComponent(i[0])]=void 0===i[1]?void 0:decodeURIComponent(i[1])||"";return t},isObject:e=>"object"==typeof e&&null!==e&&e.constructor&&e.constructor===Object,extend(...e){const t=Object(e[0]);for(let s=1;s<e.length;s+=1){const a=e[s];if(null!=a){const e=Object.keys(Object(a));for(let s=0,i=e.length;s<i;s+=1){const i=e[s],n=Object.getOwnPropertyDescriptor(a,i);void 0!==n&&n.enumerable&&(H.isObject(t[i])&&H.isObject(a[i])?H.extend(t[i],a[i]):!H.isObject(t[i])&&H.isObject(a[i])?(t[i]={},H.extend(t[i],a[i])):t[i]=a[i])}}}return t}},V=function(){const e=j.createElement("div");return{touch:D.Modernizr&&!0===D.Modernizr.touch||!!(D.navigator.maxTouchPoints>0||"ontouchstart"in D||D.DocumentTouch&&j instanceof D.DocumentTouch),pointerEvents:!!(D.navigator.pointerEnabled||D.PointerEvent||"maxTouchPoints"in D.navigator&&D.navigator.maxTouchPoints>0),prefixedPointerEvents:!!D.navigator.msPointerEnabled,transition:function(){const t=e.style;return"transition"in t||"webkitTransition"in t||"MozTransition"in t}(),transforms3d:D.Modernizr&&!0===D.Modernizr.csstransforms3d||function(){const t=e.style;return"webkitPerspective"in t||"MozPerspective"in t||"OPerspective"in t||"MsPerspective"in t||"perspective"in t}(),flexbox:function(){const t=e.style,s="alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient".split(" ");for(let e=0;e<s.length;e+=1)if(s[e]in t)return!0;return!1}(),observer:"MutationObserver"in D||"WebkitMutationObserver"in D,passiveListener:function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get(){e=!0}});D.addEventListener("testPassiveListener",null,t)}catch(t){}return e}(),gestures:"ongesturestart"in D}}(),G={isIE:!!D.navigator.userAgent.match(/Trident/g)||!!D.navigator.userAgent.match(/MSIE/g),isEdge:!!D.navigator.userAgent.match(/Edge/g),isSafari:function(){const e=D.navigator.userAgent.toLowerCase();return e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0}(),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(D.navigator.userAgent)};class X{constructor(e={}){const t=this;t.params=e,t.eventsListeners={},t.params&&t.params.on&&Object.keys(t.params.on).forEach(e=>{t.on(e,t.params.on[e])})}on(e,t,s){const a=this;if("function"!=typeof t)return a;const i=s?"unshift":"push";return e.split(" ").forEach(e=>{a.eventsListeners[e]||(a.eventsListeners[e]=[]),a.eventsListeners[e][i](t)}),a}once(e,t,s){const a=this;if("function"!=typeof t)return a;function i(...s){t.apply(a,s),a.off(e,i),i.f7proxy&&delete i.f7proxy}return i.f7proxy=t,a.on(e,i,s)}off(e,t){const s=this;return s.eventsListeners?(e.split(" ").forEach(e=>{void 0===t?s.eventsListeners[e]=[]:s.eventsListeners[e]&&s.eventsListeners[e].length&&s.eventsListeners[e].forEach((a,i)=>{(a===t||a.f7proxy&&a.f7proxy===t)&&s.eventsListeners[e].splice(i,1)})}),s):s}emit(...e){const t=this;if(!t.eventsListeners)return t;let s,a,i;return"string"==typeof e[0]||Array.isArray(e[0])?(s=e[0],a=e.slice(1,e.length),i=t):(s=e[0].events,a=e[0].data,i=e[0].context||t),(Array.isArray(s)?s:s.split(" ")).forEach(e=>{if(t.eventsListeners&&t.eventsListeners[e]){const s=[];t.eventsListeners[e].forEach(e=>{s.push(e)}),s.forEach(e=>{e.apply(i,a)})}}),t}useModulesParams(e){const t=this;t.modules&&Object.keys(t.modules).forEach(s=>{const a=t.modules[s];a.params&&H.extend(e,a.params)})}useModules(e={}){const t=this;t.modules&&Object.keys(t.modules).forEach(s=>{const a=t.modules[s],i=e[s]||{};a.instance&&Object.keys(a.instance).forEach(e=>{const s=a.instance[e];t[e]="function"==typeof s?s.bind(t):s}),a.on&&t.on&&Object.keys(a.on).forEach(e=>{t.on(e,a.on[e])}),a.create&&a.create.bind(t)(i)})}static set components(e){this.use&&this.use(e)}static installModule(e,...t){const s=this;s.prototype.modules||(s.prototype.modules={});const a=e.name||`${Object.keys(s.prototype.modules).length}_${H.now()}`;return s.prototype.modules[a]=e,e.proto&&Object.keys(e.proto).forEach(t=>{s.prototype[t]=e.proto[t]}),e.static&&Object.keys(e.static).forEach(t=>{s[t]=e.static[t]}),e.install&&e.install.apply(s,t),s}static use(e,...t){const s=this;return Array.isArray(e)?(e.forEach(e=>s.installModule(e)),s):s.installModule(e,...t)}}var Y={updateSize:function(){const e=this;let t,s;const a=e.$el;t=void 0!==e.params.width?e.params.width:a[0].clientWidth,s=void 0!==e.params.height?e.params.height:a[0].clientHeight,0===t&&e.isHorizontal()||0===s&&e.isVertical()||(t=t-parseInt(a.css("padding-left"),10)-parseInt(a.css("padding-right"),10),s=s-parseInt(a.css("padding-top"),10)-parseInt(a.css("padding-bottom"),10),H.extend(e,{width:t,height:s,size:e.isHorizontal()?t:s}))},updateSlides:function(){const e=this,t=e.params,{$wrapperEl:s,size:a,rtlTranslate:i,wrongRTL:n}=e,r=e.virtual&&t.virtual.enabled,o=r?e.virtual.slides.length:e.slides.length,l=s.children("."+e.params.slideClass),d=r?e.virtual.slides.length:l.length;let c=[];const p=[],u=[];let h=t.slidesOffsetBefore;"function"==typeof h&&(h=t.slidesOffsetBefore.call(e));let m=t.slidesOffsetAfter;"function"==typeof m&&(m=t.slidesOffsetAfter.call(e));const f=e.snapGrid.length,g=e.snapGrid.length;let v,b,w=t.spaceBetween,y=-h,x=0,E=0;if(void 0===a)return;"string"==typeof w&&w.indexOf("%")>=0&&(w=parseFloat(w.replace("%",""))/100*a),e.virtualSize=-w,i?l.css({marginLeft:"",marginTop:""}):l.css({marginRight:"",marginBottom:""}),t.slidesPerColumn>1&&(v=Math.floor(d/t.slidesPerColumn)===d/e.params.slidesPerColumn?d:Math.ceil(d/t.slidesPerColumn)*t.slidesPerColumn,"auto"!==t.slidesPerView&&"row"===t.slidesPerColumnFill&&(v=Math.max(v,t.slidesPerView*t.slidesPerColumn)));const S=t.slidesPerColumn,T=v/S,C=Math.floor(d/t.slidesPerColumn);for(let $=0;$<d;$+=1){b=0;const s=l.eq($);if(t.slidesPerColumn>1){let a,i,n;if("column"===t.slidesPerColumnFill||"row"===t.slidesPerColumnFill&&t.slidesPerGroup>1){if("column"===t.slidesPerColumnFill)i=Math.floor($/S),n=$-i*S,(i>C||i===C&&n===S-1)&&(n+=1,n>=S&&(n=0,i+=1));else{const e=Math.floor($/t.slidesPerGroup);n=Math.floor($/t.slidesPerView)-e*t.slidesPerColumn,i=$-n*t.slidesPerView-e*t.slidesPerView}a=i+n*v/S,s.css({"-webkit-box-ordinal-group":a,"-moz-box-ordinal-group":a,"-ms-flex-order":a,"-webkit-order":a,order:a})}else n=Math.floor($/T),i=$-n*T;s.css("margin-"+(e.isHorizontal()?"top":"left"),0!==n&&t.spaceBetween&&t.spaceBetween+"px").attr("data-swiper-column",i).attr("data-swiper-row",n)}if("none"!==s.css("display")){if("auto"===t.slidesPerView){const a=D.getComputedStyle(s[0],null),i=s[0].style.transform,n=s[0].style.webkitTransform;if(i&&(s[0].style.transform="none"),n&&(s[0].style.webkitTransform="none"),t.roundLengths)b=e.isHorizontal()?s.outerWidth(!0):s.outerHeight(!0);else if(e.isHorizontal()){const e=parseFloat(a.getPropertyValue("width")),t=parseFloat(a.getPropertyValue("padding-left")),s=parseFloat(a.getPropertyValue("padding-right")),i=parseFloat(a.getPropertyValue("margin-left")),n=parseFloat(a.getPropertyValue("margin-right")),r=a.getPropertyValue("box-sizing");b=r&&"border-box"===r&&!G.isIE?e+i+n:e+t+s+i+n}else{const e=parseFloat(a.getPropertyValue("height")),t=parseFloat(a.getPropertyValue("padding-top")),s=parseFloat(a.getPropertyValue("padding-bottom")),i=parseFloat(a.getPropertyValue("margin-top")),n=parseFloat(a.getPropertyValue("margin-bottom")),r=a.getPropertyValue("box-sizing");b=r&&"border-box"===r&&!G.isIE?e+i+n:e+t+s+i+n}i&&(s[0].style.transform=i),n&&(s[0].style.webkitTransform=n),t.roundLengths&&(b=Math.floor(b))}else b=(a-(t.slidesPerView-1)*w)/t.slidesPerView,t.roundLengths&&(b=Math.floor(b)),l[$]&&(e.isHorizontal()?l[$].style.width=b+"px":l[$].style.height=b+"px");l[$]&&(l[$].swiperSlideSize=b),u.push(b),t.centeredSlides?(y=y+b/2+x/2+w,0===x&&0!==$&&(y=y-a/2-w),0===$&&(y=y-a/2-w),Math.abs(y)<.001&&(y=0),t.roundLengths&&(y=Math.floor(y)),E%t.slidesPerGroup==0&&c.push(y),p.push(y)):(t.roundLengths&&(y=Math.floor(y)),E%t.slidesPerGroup==0&&c.push(y),p.push(y),y=y+b+w),e.virtualSize+=b+w,x=b,E+=1}}let k;if(e.virtualSize=Math.max(e.virtualSize,a)+m,i&&n&&("slide"===t.effect||"coverflow"===t.effect)&&s.css({width:e.virtualSize+t.spaceBetween+"px"}),V.flexbox&&!t.setWrapperSize||(e.isHorizontal()?s.css({width:e.virtualSize+t.spaceBetween+"px"}):s.css({height:e.virtualSize+t.spaceBetween+"px"})),t.slidesPerColumn>1&&(e.virtualSize=(b+t.spaceBetween)*v,e.virtualSize=Math.ceil(e.virtualSize/t.slidesPerColumn)-t.spaceBetween,e.isHorizontal()?s.css({width:e.virtualSize+t.spaceBetween+"px"}):s.css({height:e.virtualSize+t.spaceBetween+"px"}),t.centeredSlides)){k=[];for(let s=0;s<c.length;s+=1){let a=c[s];t.roundLengths&&(a=Math.floor(a)),c[s]<e.virtualSize+c[0]&&k.push(a)}c=k}if(!t.centeredSlides){k=[];for(let s=0;s<c.length;s+=1){let i=c[s];t.roundLengths&&(i=Math.floor(i)),c[s]<=e.virtualSize-a&&k.push(i)}c=k,Math.floor(e.virtualSize-a)-Math.floor(c[c.length-1])>1&&c.push(e.virtualSize-a)}if(0===c.length&&(c=[0]),0!==t.spaceBetween&&(e.isHorizontal()?i?l.css({marginLeft:w+"px"}):l.css({marginRight:w+"px"}):l.css({marginBottom:w+"px"})),t.centerInsufficientSlides){let e=0;if(u.forEach(s=>{e+=s+(t.spaceBetween?t.spaceBetween:0)}),e-=t.spaceBetween,e<a){const t=(a-e)/2;c.forEach((e,s)=>{c[s]=e-t}),p.forEach((e,s)=>{p[s]=e+t})}}H.extend(e,{slides:l,snapGrid:c,slidesGrid:p,slidesSizesGrid:u}),d!==o&&e.emit("slidesLengthChange"),c.length!==f&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),p.length!==g&&e.emit("slidesGridLengthChange"),(t.watchSlidesProgress||t.watchSlidesVisibility)&&e.updateSlidesOffset()},updateAutoHeight:function(e){const t=this,s=[];let a,i=0;if("number"==typeof e?t.setTransition(e):!0===e&&t.setTransition(t.params.speed),"auto"!==t.params.slidesPerView&&t.params.slidesPerView>1)for(a=0;a<Math.ceil(t.params.slidesPerView);a+=1){const e=t.activeIndex+a;if(e>t.slides.length)break;s.push(t.slides.eq(e)[0])}else s.push(t.slides.eq(t.activeIndex)[0]);for(a=0;a<s.length;a+=1)if(void 0!==s[a]){const e=s[a].offsetHeight;i=e>i?e:i}i&&t.$wrapperEl.css("height",i+"px")},updateSlidesOffset:function(){const e=this,t=e.slides;for(let s=0;s<t.length;s+=1)t[s].swiperSlideOffset=e.isHorizontal()?t[s].offsetLeft:t[s].offsetTop},updateSlidesProgress:function(e=this&&this.translate||0){const t=this,s=t.params,{slides:a,rtlTranslate:i}=t;if(0===a.length)return;void 0===a[0].swiperSlideOffset&&t.updateSlidesOffset();let n=-e;i&&(n=e),a.removeClass(s.slideVisibleClass),t.visibleSlidesIndexes=[],t.visibleSlides=[];for(let r=0;r<a.length;r+=1){const e=a[r],o=(n+(s.centeredSlides?t.minTranslate():0)-e.swiperSlideOffset)/(e.swiperSlideSize+s.spaceBetween);if(s.watchSlidesVisibility){const i=-(n-e.swiperSlideOffset),o=i+t.slidesSizesGrid[r];(i>=0&&i<t.size-1||o>1&&o<=t.size||i<=0&&o>=t.size)&&(t.visibleSlides.push(e),t.visibleSlidesIndexes.push(r),a.eq(r).addClass(s.slideVisibleClass))}e.progress=i?-o:o}t.visibleSlides=_(t.visibleSlides)},updateProgress:function(e=this&&this.translate||0){const t=this,s=t.params,a=t.maxTranslate()-t.minTranslate();let{progress:i,isBeginning:n,isEnd:r}=t;const o=n,l=r;0===a?(i=0,n=!0,r=!0):(i=(e-t.minTranslate())/a,n=i<=0,r=i>=1),H.extend(t,{progress:i,isBeginning:n,isEnd:r}),(s.watchSlidesProgress||s.watchSlidesVisibility)&&t.updateSlidesProgress(e),n&&!o&&t.emit("reachBeginning toEdge"),r&&!l&&t.emit("reachEnd toEdge"),(o&&!n||l&&!r)&&t.emit("fromEdge"),t.emit("progress",i)},updateSlidesClasses:function(){const e=this,{slides:t,params:s,$wrapperEl:a,activeIndex:i,realIndex:n}=e,r=e.virtual&&s.virtual.enabled;let o;t.removeClass(`${s.slideActiveClass} ${s.slideNextClass} ${s.slidePrevClass} ${s.slideDuplicateActiveClass} ${s.slideDuplicateNextClass} ${s.slideDuplicatePrevClass}`),o=r?e.$wrapperEl.find(`.${s.slideClass}[data-swiper-slide-index="${i}"]`):t.eq(i),o.addClass(s.slideActiveClass),s.loop&&(o.hasClass(s.slideDuplicateClass)?a.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${n}"]`).addClass(s.slideDuplicateActiveClass):a.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${n}"]`).addClass(s.slideDuplicateActiveClass));let l=o.nextAll("."+s.slideClass).eq(0).addClass(s.slideNextClass);s.loop&&0===l.length&&(l=t.eq(0),l.addClass(s.slideNextClass));let d=o.prevAll("."+s.slideClass).eq(0).addClass(s.slidePrevClass);s.loop&&0===d.length&&(d=t.eq(-1),d.addClass(s.slidePrevClass)),s.loop&&(l.hasClass(s.slideDuplicateClass)?a.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${l.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicateNextClass):a.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${l.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicateNextClass),d.hasClass(s.slideDuplicateClass)?a.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${d.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicatePrevClass):a.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${d.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicatePrevClass))},updateActiveIndex:function(e){const t=this,s=t.rtlTranslate?t.translate:-t.translate,{slidesGrid:a,snapGrid:i,params:n,activeIndex:r,realIndex:o,snapIndex:l}=t;let d,c=e;if(void 0===c){for(let e=0;e<a.length;e+=1)void 0!==a[e+1]?s>=a[e]&&s<a[e+1]-(a[e+1]-a[e])/2?c=e:s>=a[e]&&s<a[e+1]&&(c=e+1):s>=a[e]&&(c=e);n.normalizeSlideIndex&&(c<0||void 0===c)&&(c=0)}if(d=i.indexOf(s)>=0?i.indexOf(s):Math.floor(c/n.slidesPerGroup),d>=i.length&&(d=i.length-1),c===r)return void(d!==l&&(t.snapIndex=d,t.emit("snapIndexChange")));const p=parseInt(t.slides.eq(c).attr("data-swiper-slide-index")||c,10);H.extend(t,{snapIndex:d,realIndex:p,previousIndex:r,activeIndex:c}),t.emit("activeIndexChange"),t.emit("snapIndexChange"),o!==p&&t.emit("realIndexChange"),(t.initialized||t.runCallbacksOnInit)&&t.emit("slideChange")},updateClickedSlide:function(e){const t=this,s=t.params,a=_(e.target).closest("."+s.slideClass)[0];let i=!1;if(a)for(let n=0;n<t.slides.length;n+=1)t.slides[n]===a&&(i=!0);if(!a||!i)return t.clickedSlide=void 0,void(t.clickedIndex=void 0);t.clickedSlide=a,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(_(a).attr("data-swiper-slide-index"),10):t.clickedIndex=_(a).index(),s.slideToClickedSlide&&void 0!==t.clickedIndex&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}};var R={getTranslate:function(e=(this.isHorizontal()?"x":"y")){const{params:t,rtlTranslate:s,translate:a,$wrapperEl:i}=this;if(t.virtualTranslate)return s?-a:a;let n=H.getTranslate(i[0],e);return s&&(n=-n),n||0},setTranslate:function(e,t){const s=this,{rtlTranslate:a,params:i,$wrapperEl:n,progress:r}=s;let o,l=0,d=0;s.isHorizontal()?l=a?-e:e:d=e,i.roundLengths&&(l=Math.floor(l),d=Math.floor(d)),i.virtualTranslate||(V.transforms3d?n.transform(`translate3d(${l}px, ${d}px, 0px)`):n.transform(`translate(${l}px, ${d}px)`)),s.previousTranslate=s.translate,s.translate=s.isHorizontal()?l:d;const c=s.maxTranslate()-s.minTranslate();o=0===c?0:(e-s.minTranslate())/c,o!==r&&s.updateProgress(e),s.emit("setTranslate",s.translate,t)},minTranslate:function(){return-this.snapGrid[0]},maxTranslate:function(){return-this.snapGrid[this.snapGrid.length-1]}};var F={setTransition:function(e,t){this.$wrapperEl.transition(e),this.emit("setTransition",e,t)},transitionStart:function(e=!0,t){const s=this,{activeIndex:a,params:i,previousIndex:n}=s;i.autoHeight&&s.updateAutoHeight();let r=t;if(r||(r=a>n?"next":a<n?"prev":"reset"),s.emit("transitionStart"),e&&a!==n){if("reset"===r)return void s.emit("slideResetTransitionStart");s.emit("slideChangeTransitionStart"),"next"===r?s.emit("slideNextTransitionStart"):s.emit("slidePrevTransitionStart")}},transitionEnd:function(e=!0,t){const s=this,{activeIndex:a,previousIndex:i}=s;s.animating=!1,s.setTransition(0);let n=t;if(n||(n=a>i?"next":a<i?"prev":"reset"),s.emit("transitionEnd"),e&&a!==i){if("reset"===n)return void s.emit("slideResetTransitionEnd");s.emit("slideChangeTransitionEnd"),"next"===n?s.emit("slideNextTransitionEnd"):s.emit("slidePrevTransitionEnd")}}};var q={slideTo:function(e=0,t=this.params.speed,s=!0,a){const i=this;let n=e;n<0&&(n=0);const{params:r,snapGrid:o,slidesGrid:l,previousIndex:d,activeIndex:c,rtlTranslate:p}=i;if(i.animating&&r.preventInteractionOnTransition)return!1;let u=Math.floor(n/r.slidesPerGroup);u>=o.length&&(u=o.length-1),(c||r.initialSlide||0)===(d||0)&&s&&i.emit("beforeSlideChangeStart");const h=-o[u];if(i.updateProgress(h),r.normalizeSlideIndex)for(let f=0;f<l.length;f+=1)-Math.floor(100*h)>=Math.floor(100*l[f])&&(n=f);if(i.initialized&&n!==c){if(!i.allowSlideNext&&h<i.translate&&h<i.minTranslate())return!1;if(!i.allowSlidePrev&&h>i.translate&&h>i.maxTranslate()&&(c||0)!==n)return!1}let m;return m=n>c?"next":n<c?"prev":"reset",p&&-h===i.translate||!p&&h===i.translate?(i.updateActiveIndex(n),r.autoHeight&&i.updateAutoHeight(),i.updateSlidesClasses(),"slide"!==r.effect&&i.setTranslate(h),"reset"!==m&&(i.transitionStart(s,m),i.transitionEnd(s,m)),!1):(0!==t&&V.transition?(i.setTransition(t),i.setTranslate(h),i.updateActiveIndex(n),i.updateSlidesClasses(),i.emit("beforeTransitionStart",t,a),i.transitionStart(s,m),i.animating||(i.animating=!0,i.onSlideToWrapperTransitionEnd||(i.onSlideToWrapperTransitionEnd=function(e){i&&!i.destroyed&&e.target===this&&(i.$wrapperEl[0].removeEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.$wrapperEl[0].removeEventListener("webkitTransitionEnd",i.onSlideToWrapperTransitionEnd),i.onSlideToWrapperTransitionEnd=null,delete i.onSlideToWrapperTransitionEnd,i.transitionEnd(s,m))}),i.$wrapperEl[0].addEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.$wrapperEl[0].addEventListener("webkitTransitionEnd",i.onSlideToWrapperTransitionEnd))):(i.setTransition(0),i.setTranslate(h),i.updateActiveIndex(n),i.updateSlidesClasses(),i.emit("beforeTransitionStart",t,a),i.transitionStart(s,m),i.transitionEnd(s,m)),!0)},slideToLoop:function(e=0,t=this.params.speed,s=!0,a){const i=this;let n=e;return i.params.loop&&(n+=i.loopedSlides),i.slideTo(n,t,s,a)},slideNext:function(e=this.params.speed,t=!0,s){const a=this,{params:i,animating:n}=a;return i.loop?!n&&(a.loopFix(),a._clientLeft=a.$wrapperEl[0].clientLeft,a.slideTo(a.activeIndex+i.slidesPerGroup,e,t,s)):a.slideTo(a.activeIndex+i.slidesPerGroup,e,t,s)},slidePrev:function(e=this.params.speed,t=!0,s){const a=this,{params:i,animating:n,snapGrid:r,slidesGrid:o,rtlTranslate:l}=a;if(i.loop){if(n)return!1;a.loopFix(),a._clientLeft=a.$wrapperEl[0].clientLeft}function d(e){return e<0?-Math.floor(Math.abs(e)):Math.floor(e)}const c=d(l?a.translate:-a.translate),p=r.map(e=>d(e)),u=(o.map(e=>d(e)),r[p.indexOf(c)],r[p.indexOf(c)-1]);let h;return void 0!==u&&(h=o.indexOf(u),h<0&&(h=a.activeIndex-1)),a.slideTo(h,e,t,s)},slideReset:function(e=this.params.speed,t=!0,s){return this.slideTo(this.activeIndex,e,t,s)},slideToClosest:function(e=this.params.speed,t=!0,s){const a=this;let i=a.activeIndex;const n=Math.floor(i/a.params.slidesPerGroup);if(n<a.snapGrid.length-1){const e=a.rtlTranslate?a.translate:-a.translate,t=a.snapGrid[n];e-t>(a.snapGrid[n+1]-t)/2&&(i=a.params.slidesPerGroup)}return a.slideTo(i,e,t,s)},slideToClickedSlide:function(){const e=this,{params:t,$wrapperEl:s}=e,a="auto"===t.slidesPerView?e.slidesPerViewDynamic():t.slidesPerView;let i,n=e.clickedIndex;if(t.loop){if(e.animating)return;i=parseInt(_(e.clickedSlide).attr("data-swiper-slide-index"),10),t.centeredSlides?n<e.loopedSlides-a/2||n>e.slides.length-e.loopedSlides+a/2?(e.loopFix(),n=s.children(`.${t.slideClass}[data-swiper-slide-index="${i}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),H.nextTick(()=>{e.slideTo(n)})):e.slideTo(n):n>e.slides.length-a?(e.loopFix(),n=s.children(`.${t.slideClass}[data-swiper-slide-index="${i}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),H.nextTick(()=>{e.slideTo(n)})):e.slideTo(n)}else e.slideTo(n)}};var W={loopCreate:function(){const e=this,{params:t,$wrapperEl:s}=e;s.children(`.${t.slideClass}.${t.slideDuplicateClass}`).remove();let a=s.children("."+t.slideClass);if(t.loopFillGroupWithBlank){const e=t.slidesPerGroup-a.length%t.slidesPerGroup;if(e!==t.slidesPerGroup){for(let a=0;a<e;a+=1){const e=_(j.createElement("div")).addClass(`${t.slideClass} ${t.slideBlankClass}`);s.append(e)}a=s.children("."+t.slideClass)}}"auto"!==t.slidesPerView||t.loopedSlides||(t.loopedSlides=a.length),e.loopedSlides=parseInt(t.loopedSlides||t.slidesPerView,10),e.loopedSlides+=t.loopAdditionalSlides,e.loopedSlides>a.length&&(e.loopedSlides=a.length);const i=[],n=[];a.each((t,s)=>{const r=_(s);t<e.loopedSlides&&n.push(s),t<a.length&&t>=a.length-e.loopedSlides&&i.push(s),r.attr("data-swiper-slide-index",t)});for(let r=0;r<n.length;r+=1)s.append(_(n[r].cloneNode(!0)).addClass(t.slideDuplicateClass));for(let r=i.length-1;r>=0;r-=1)s.prepend(_(i[r].cloneNode(!0)).addClass(t.slideDuplicateClass))},loopFix:function(){const e=this,{params:t,activeIndex:s,slides:a,loopedSlides:i,allowSlidePrev:n,allowSlideNext:r,snapGrid:o,rtlTranslate:l}=e;let d;e.allowSlidePrev=!0,e.allowSlideNext=!0;const c=-o[s]-e.getTranslate();if(s<i){d=a.length-3*i+s,d+=i,e.slideTo(d,0,!1,!0)&&0!==c&&e.setTranslate((l?-e.translate:e.translate)-c)}else if("auto"===t.slidesPerView&&s>=2*i||s>=a.length-i){d=-a.length+s+i,d+=i,e.slideTo(d,0,!1,!0)&&0!==c&&e.setTranslate((l?-e.translate:e.translate)-c)}e.allowSlidePrev=n,e.allowSlideNext=r},loopDestroy:function(){const{$wrapperEl:e,params:t,slides:s}=this;e.children(`.${t.slideClass}.${t.slideDuplicateClass},.${t.slideClass}.${t.slideBlankClass}`).remove(),s.removeAttr("data-swiper-slide-index")}};var U={setGrabCursor:function(e){if(V.touch||!this.params.simulateTouch||this.params.watchOverflow&&this.isLocked)return;const t=this.el;t.style.cursor="move",t.style.cursor=e?"-webkit-grabbing":"-webkit-grab",t.style.cursor=e?"-moz-grabbin":"-moz-grab",t.style.cursor=e?"grabbing":"grab"},unsetGrabCursor:function(){V.touch||this.params.watchOverflow&&this.isLocked||(this.el.style.cursor="")}};var K={appendSlide:function(e){const t=this,{$wrapperEl:s,params:a}=t;if(a.loop&&t.loopDestroy(),"object"==typeof e&&"length"in e)for(let i=0;i<e.length;i+=1)e[i]&&s.append(e[i]);else s.append(e);a.loop&&t.loopCreate(),a.observer&&V.observer||t.update()},prependSlide:function(e){const t=this,{params:s,$wrapperEl:a,activeIndex:i}=t;s.loop&&t.loopDestroy();let n=i+1;if("object"==typeof e&&"length"in e){for(let t=0;t<e.length;t+=1)e[t]&&a.prepend(e[t]);n=i+e.length}else a.prepend(e);s.loop&&t.loopCreate(),s.observer&&V.observer||t.update(),t.slideTo(n,0,!1)},addSlide:function(e,t){const s=this,{$wrapperEl:a,params:i,activeIndex:n}=s;let r=n;i.loop&&(r-=s.loopedSlides,s.loopDestroy(),s.slides=a.children("."+i.slideClass));const o=s.slides.length;if(e<=0)return void s.prependSlide(t);if(e>=o)return void s.appendSlide(t);let l=r>e?r+1:r;const d=[];for(let c=o-1;c>=e;c-=1){const e=s.slides.eq(c);e.remove(),d.unshift(e)}if("object"==typeof t&&"length"in t){for(let e=0;e<t.length;e+=1)t[e]&&a.append(t[e]);l=r>e?r+t.length:r}else a.append(t);for(let c=0;c<d.length;c+=1)a.append(d[c]);i.loop&&s.loopCreate(),i.observer&&V.observer||s.update(),i.loop?s.slideTo(l+s.loopedSlides,0,!1):s.slideTo(l,0,!1)},removeSlide:function(e){const t=this,{params:s,$wrapperEl:a,activeIndex:i}=t;let n=i;s.loop&&(n-=t.loopedSlides,t.loopDestroy(),t.slides=a.children("."+s.slideClass));let r,o=n;if("object"==typeof e&&"length"in e){for(let s=0;s<e.length;s+=1)r=e[s],t.slides[r]&&t.slides.eq(r).remove(),r<o&&(o-=1);o=Math.max(o,0)}else r=e,t.slides[r]&&t.slides.eq(r).remove(),r<o&&(o-=1),o=Math.max(o,0);s.loop&&t.loopCreate(),s.observer&&V.observer||t.update(),s.loop?t.slideTo(o+t.loopedSlides,0,!1):t.slideTo(o,0,!1)},removeAllSlides:function(){const e=this,t=[];for(let s=0;s<e.slides.length;s+=1)t.push(s);e.removeSlide(t)}};const Q=function(){const e=D.navigator.userAgent,t={ios:!1,android:!1,androidChrome:!1,desktop:!1,windows:!1,iphone:!1,ipod:!1,ipad:!1,cordova:D.cordova||D.phonegap,phonegap:D.cordova||D.phonegap},s=e.match(/(Windows Phone);?[\s\/]+([\d.]+)?/),a=e.match(/(Android);?[\s\/]+([\d.]+)?/),i=e.match(/(iPad).*OS\s([\d_]+)/),n=e.match(/(iPod)(.*OS\s([\d_]+))?/),r=!i&&e.match(/(iPhone\sOS|iOS)\s([\d_]+)/);if(s&&(t.os="windows",t.osVersion=s[2],t.windows=!0),a&&!s&&(t.os="android",t.osVersion=a[2],t.android=!0,t.androidChrome=e.toLowerCase().indexOf("chrome")>=0),(i||r||n)&&(t.os="ios",t.ios=!0),r&&!n&&(t.osVersion=r[2].replace(/_/g,"."),t.iphone=!0),i&&(t.osVersion=i[2].replace(/_/g,"."),t.ipad=!0),n&&(t.osVersion=n[3]?n[3].replace(/_/g,"."):null,t.iphone=!0),t.ios&&t.osVersion&&e.indexOf("Version/")>=0&&"10"===t.osVersion.split(".")[0]&&(t.osVersion=e.toLowerCase().split("version/")[1].split(" ")[0]),t.desktop=!(t.os||t.android||t.webView),t.webView=(r||i||n)&&e.match(/.*AppleWebKit(?!.*Safari)/i),t.os&&"ios"===t.os){const e=t.osVersion.split("."),s=j.querySelector('meta[name="viewport"]');t.minimalUi=!t.webView&&(n||r)&&(1*e[0]==7?1*e[1]>=1:1*e[0]>7)&&s&&s.getAttribute("content").indexOf("minimal-ui")>=0}return t.pixelRatio=D.devicePixelRatio||1,t}();function Z(e){const t=this,s=t.touchEventsData,{params:a,touches:i}=t;if(t.animating&&a.preventInteractionOnTransition)return;let n=e;if(n.originalEvent&&(n=n.originalEvent),s.isTouchEvent="touchstart"===n.type,!s.isTouchEvent&&"which"in n&&3===n.which)return;if(!s.isTouchEvent&&"button"in n&&n.button>0)return;if(s.isTouched&&s.isMoved)return;if(a.noSwiping&&_(n.target).closest(a.noSwipingSelector?a.noSwipingSelector:"."+a.noSwipingClass)[0])return void(t.allowClick=!0);if(a.swipeHandler&&!_(n).closest(a.swipeHandler)[0])return;i.currentX="touchstart"===n.type?n.targetTouches[0].pageX:n.pageX,i.currentY="touchstart"===n.type?n.targetTouches[0].pageY:n.pageY;const r=i.currentX,o=i.currentY,l=a.edgeSwipeDetection||a.iOSEdgeSwipeDetection,d=a.edgeSwipeThreshold||a.iOSEdgeSwipeThreshold;if(!l||!(r<=d||r>=D.screen.width-d)){if(H.extend(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),i.startX=r,i.startY=o,s.touchStartTime=H.now(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,a.threshold>0&&(s.allowThresholdMove=!1),"touchstart"!==n.type){let e=!0;_(n.target).is(s.formElements)&&(e=!1),j.activeElement&&_(j.activeElement).is(s.formElements)&&j.activeElement!==n.target&&j.activeElement.blur();const i=e&&t.allowTouchMove&&a.touchStartPreventDefault;(a.touchStartForcePreventDefault||i)&&n.preventDefault()}t.emit("touchStart",n)}}function J(e){const t=this,s=t.touchEventsData,{params:a,touches:i,rtlTranslate:n}=t;let r=e;if(r.originalEvent&&(r=r.originalEvent),!s.isTouched)return void(s.startMoving&&s.isScrolling&&t.emit("touchMoveOpposite",r));if(s.isTouchEvent&&"mousemove"===r.type)return;const o="touchmove"===r.type?r.targetTouches[0].pageX:r.pageX,l="touchmove"===r.type?r.targetTouches[0].pageY:r.pageY;if(r.preventedByNestedSwiper)return i.startX=o,void(i.startY=l);if(!t.allowTouchMove)return t.allowClick=!1,void(s.isTouched&&(H.extend(i,{startX:o,startY:l,currentX:o,currentY:l}),s.touchStartTime=H.now()));if(s.isTouchEvent&&a.touchReleaseOnEdges&&!a.loop)if(t.isVertical()){if(l<i.startY&&t.translate<=t.maxTranslate()||l>i.startY&&t.translate>=t.minTranslate())return s.isTouched=!1,void(s.isMoved=!1)}else if(o<i.startX&&t.translate<=t.maxTranslate()||o>i.startX&&t.translate>=t.minTranslate())return;if(s.isTouchEvent&&j.activeElement&&r.target===j.activeElement&&_(r.target).is(s.formElements))return s.isMoved=!0,void(t.allowClick=!1);if(s.allowTouchCallbacks&&t.emit("touchMove",r),r.targetTouches&&r.targetTouches.length>1)return;i.currentX=o,i.currentY=l;const d=i.currentX-i.startX,c=i.currentY-i.startY;if(t.params.threshold&&Math.sqrt(d**2+c**2)<t.params.threshold)return;if(void 0===s.isScrolling){let e;t.isHorizontal()&&i.currentY===i.startY||t.isVertical()&&i.currentX===i.startX?s.isScrolling=!1:d*d+c*c>=25&&(e=180*Math.atan2(Math.abs(c),Math.abs(d))/Math.PI,s.isScrolling=t.isHorizontal()?e>a.touchAngle:90-e>a.touchAngle)}if(s.isScrolling&&t.emit("touchMoveOpposite",r),void 0===s.startMoving&&(i.currentX===i.startX&&i.currentY===i.startY||(s.startMoving=!0)),s.isScrolling)return void(s.isTouched=!1);if(!s.startMoving)return;t.allowClick=!1,r.preventDefault(),a.touchMoveStopPropagation&&!a.nested&&r.stopPropagation(),s.isMoved||(a.loop&&t.loopFix(),s.startTranslate=t.getTranslate(),t.setTransition(0),t.animating&&t.$wrapperEl.trigger("webkitTransitionEnd transitionend"),s.allowMomentumBounce=!1,!a.grabCursor||!0!==t.allowSlideNext&&!0!==t.allowSlidePrev||t.setGrabCursor(!0),t.emit("sliderFirstMove",r)),t.emit("sliderMove",r),s.isMoved=!0;let p=t.isHorizontal()?d:c;i.diff=p,p*=a.touchRatio,n&&(p=-p),t.swipeDirection=p>0?"prev":"next",s.currentTranslate=p+s.startTranslate;let u=!0,h=a.resistanceRatio;if(a.touchReleaseOnEdges&&(h=0),p>0&&s.currentTranslate>t.minTranslate()?(u=!1,a.resistance&&(s.currentTranslate=t.minTranslate()-1+(-t.minTranslate()+s.startTranslate+p)**h)):p<0&&s.currentTranslate<t.maxTranslate()&&(u=!1,a.resistance&&(s.currentTranslate=t.maxTranslate()+1-(t.maxTranslate()-s.startTranslate-p)**h)),u&&(r.preventedByNestedSwiper=!0),!t.allowSlideNext&&"next"===t.swipeDirection&&s.currentTranslate<s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&"prev"===t.swipeDirection&&s.currentTranslate>s.startTranslate&&(s.currentTranslate=s.startTranslate),a.threshold>0){if(!(Math.abs(p)>a.threshold||s.allowThresholdMove))return void(s.currentTranslate=s.startTranslate);if(!s.allowThresholdMove)return s.allowThresholdMove=!0,i.startX=i.currentX,i.startY=i.currentY,s.currentTranslate=s.startTranslate,void(i.diff=t.isHorizontal()?i.currentX-i.startX:i.currentY-i.startY)}a.followFinger&&((a.freeMode||a.watchSlidesProgress||a.watchSlidesVisibility)&&(t.updateActiveIndex(),t.updateSlidesClasses()),a.freeMode&&(0===s.velocities.length&&s.velocities.push({position:i[t.isHorizontal()?"startX":"startY"],time:s.touchStartTime}),s.velocities.push({position:i[t.isHorizontal()?"currentX":"currentY"],time:H.now()})),t.updateProgress(s.currentTranslate),t.setTranslate(s.currentTranslate))}function ee(e){const t=this,s=t.touchEventsData,{params:a,touches:i,rtlTranslate:n,$wrapperEl:r,slidesGrid:o,snapGrid:l}=t;let d=e;if(d.originalEvent&&(d=d.originalEvent),s.allowTouchCallbacks&&t.emit("touchEnd",d),s.allowTouchCallbacks=!1,!s.isTouched)return s.isMoved&&a.grabCursor&&t.setGrabCursor(!1),s.isMoved=!1,void(s.startMoving=!1);a.grabCursor&&s.isMoved&&s.isTouched&&(!0===t.allowSlideNext||!0===t.allowSlidePrev)&&t.setGrabCursor(!1);const c=H.now(),p=c-s.touchStartTime;if(t.allowClick&&(t.updateClickedSlide(d),t.emit("tap",d),p<300&&c-s.lastClickTime>300&&(s.clickTimeout&&clearTimeout(s.clickTimeout),s.clickTimeout=H.nextTick(()=>{t&&!t.destroyed&&t.emit("click",d)},300)),p<300&&c-s.lastClickTime<300&&(s.clickTimeout&&clearTimeout(s.clickTimeout),t.emit("doubleTap",d))),s.lastClickTime=H.now(),H.nextTick(()=>{t.destroyed||(t.allowClick=!0)}),!s.isTouched||!s.isMoved||!t.swipeDirection||0===i.diff||s.currentTranslate===s.startTranslate)return s.isTouched=!1,s.isMoved=!1,void(s.startMoving=!1);let u;if(s.isTouched=!1,s.isMoved=!1,s.startMoving=!1,u=a.followFinger?n?t.translate:-t.translate:-s.currentTranslate,a.freeMode){if(u<-t.minTranslate())return void t.slideTo(t.activeIndex);if(u>-t.maxTranslate())return void(t.slides.length<l.length?t.slideTo(l.length-1):t.slideTo(t.slides.length-1));if(a.freeModeMomentum){if(s.velocities.length>1){const e=s.velocities.pop(),i=s.velocities.pop(),n=e.position-i.position,r=e.time-i.time;t.velocity=n/r,t.velocity/=2,Math.abs(t.velocity)<a.freeModeMinimumVelocity&&(t.velocity=0),(r>150||H.now()-e.time>300)&&(t.velocity=0)}else t.velocity=0;t.velocity*=a.freeModeMomentumVelocityRatio,s.velocities.length=0;let e=1e3*a.freeModeMomentumRatio;const i=t.velocity*e;let o=t.translate+i;n&&(o=-o);let d,c=!1;const p=20*Math.abs(t.velocity)*a.freeModeMomentumBounceRatio;let u;if(o<t.maxTranslate())a.freeModeMomentumBounce?(o+t.maxTranslate()<-p&&(o=t.maxTranslate()-p),d=t.maxTranslate(),c=!0,s.allowMomentumBounce=!0):o=t.maxTranslate(),a.loop&&a.centeredSlides&&(u=!0);else if(o>t.minTranslate())a.freeModeMomentumBounce?(o-t.minTranslate()>p&&(o=t.minTranslate()+p),d=t.minTranslate(),c=!0,s.allowMomentumBounce=!0):o=t.minTranslate(),a.loop&&a.centeredSlides&&(u=!0);else if(a.freeModeSticky){let e;for(let t=0;t<l.length;t+=1)if(l[t]>-o){e=t;break}o=Math.abs(l[e]-o)<Math.abs(l[e-1]-o)||"next"===t.swipeDirection?l[e]:l[e-1],o=-o}if(u&&t.once("transitionEnd",()=>{t.loopFix()}),0!==t.velocity)e=n?Math.abs((-o-t.translate)/t.velocity):Math.abs((o-t.translate)/t.velocity);else if(a.freeModeSticky)return void t.slideToClosest();a.freeModeMomentumBounce&&c?(t.updateProgress(d),t.setTransition(e),t.setTranslate(o),t.transitionStart(!0,t.swipeDirection),t.animating=!0,r.transitionEnd(()=>{t&&!t.destroyed&&s.allowMomentumBounce&&(t.emit("momentumBounce"),t.setTransition(a.speed),t.setTranslate(d),r.transitionEnd(()=>{t&&!t.destroyed&&t.transitionEnd()}))})):t.velocity?(t.updateProgress(o),t.setTransition(e),t.setTranslate(o),t.transitionStart(!0,t.swipeDirection),t.animating||(t.animating=!0,r.transitionEnd(()=>{t&&!t.destroyed&&t.transitionEnd()}))):t.updateProgress(o),t.updateActiveIndex(),t.updateSlidesClasses()}else if(a.freeModeSticky)return void t.slideToClosest();return void((!a.freeModeMomentum||p>=a.longSwipesMs)&&(t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses()))}let h=0,m=t.slidesSizesGrid[0];for(let g=0;g<o.length;g+=a.slidesPerGroup)void 0!==o[g+a.slidesPerGroup]?u>=o[g]&&u<o[g+a.slidesPerGroup]&&(h=g,m=o[g+a.slidesPerGroup]-o[g]):u>=o[g]&&(h=g,m=o[o.length-1]-o[o.length-2]);const f=(u-o[h])/m;if(p>a.longSwipesMs){if(!a.longSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&(f>=a.longSwipesRatio?t.slideTo(h+a.slidesPerGroup):t.slideTo(h)),"prev"===t.swipeDirection&&(f>1-a.longSwipesRatio?t.slideTo(h+a.slidesPerGroup):t.slideTo(h))}else{if(!a.shortSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&t.slideTo(h+a.slidesPerGroup),"prev"===t.swipeDirection&&t.slideTo(h)}}function te(){const e=this,{params:t,el:s}=e;if(s&&0===s.offsetWidth)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:a,allowSlidePrev:i,snapGrid:n}=e;if(e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),t.freeMode){const s=Math.min(Math.max(e.translate,e.maxTranslate()),e.minTranslate());e.setTranslate(s),e.updateActiveIndex(),e.updateSlidesClasses(),t.autoHeight&&e.updateAutoHeight()}else e.updateSlidesClasses(),("auto"===t.slidesPerView||t.slidesPerView>1)&&e.isEnd&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0);e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.run(),e.allowSlidePrev=i,e.allowSlideNext=a,e.params.watchOverflow&&n!==e.snapGrid&&e.checkOverflow()}function se(e){const t=this;t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation()))}var ae={init:!0,direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,preventInteractionOnTransition:!1,edgeSwipeDetection:!1,edgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeMomentumVelocityRatio:1,freeModeSticky:!1,freeModeMinimumVelocity:.02,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsInverse:!1,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!1,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:0,touchMoveStopPropagation:!0,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,loopFillGroupWithBlank:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,containerModifierClass:"swiper-container-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-invisible-blank",slideActiveClass:"swiper-slide-active",slideDuplicateActiveClass:"swiper-slide-duplicate-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slideDuplicateNextClass:"swiper-slide-duplicate-next",slidePrevClass:"swiper-slide-prev",slideDuplicatePrevClass:"swiper-slide-duplicate-prev",wrapperClass:"swiper-wrapper",runCallbacksOnInit:!0};const ie={update:Y,translate:R,transition:F,slide:q,loop:W,grabCursor:U,manipulation:K,events:{attachEvents:function(){const e=this,{params:t,touchEvents:s,el:a,wrapperEl:i}=e;e.onTouchStart=Z.bind(e),e.onTouchMove=J.bind(e),e.onTouchEnd=ee.bind(e),e.onClick=se.bind(e);const n="container"===t.touchEventsTarget?a:i,r=!!t.nested;if(V.touch||!V.pointerEvents&&!V.prefixedPointerEvents){if(V.touch){const a=!("touchstart"!==s.start||!V.passiveListener||!t.passiveListeners)&&{passive:!0,capture:!1};n.addEventListener(s.start,e.onTouchStart,a),n.addEventListener(s.move,e.onTouchMove,V.passiveListener?{passive:!1,capture:r}:r),n.addEventListener(s.end,e.onTouchEnd,a)}(t.simulateTouch&&!Q.ios&&!Q.android||t.simulateTouch&&!V.touch&&Q.ios)&&(n.addEventListener("mousedown",e.onTouchStart,!1),j.addEventListener("mousemove",e.onTouchMove,r),j.addEventListener("mouseup",e.onTouchEnd,!1))}else n.addEventListener(s.start,e.onTouchStart,!1),j.addEventListener(s.move,e.onTouchMove,r),j.addEventListener(s.end,e.onTouchEnd,!1);(t.preventClicks||t.preventClicksPropagation)&&n.addEventListener("click",e.onClick,!0),e.on(Q.ios||Q.android?"resize orientationchange observerUpdate":"resize observerUpdate",te,!0)},detachEvents:function(){const e=this,{params:t,touchEvents:s,el:a,wrapperEl:i}=e,n="container"===t.touchEventsTarget?a:i,r=!!t.nested;if(V.touch||!V.pointerEvents&&!V.prefixedPointerEvents){if(V.touch){const a=!("onTouchStart"!==s.start||!V.passiveListener||!t.passiveListeners)&&{passive:!0,capture:!1};n.removeEventListener(s.start,e.onTouchStart,a),n.removeEventListener(s.move,e.onTouchMove,r),n.removeEventListener(s.end,e.onTouchEnd,a)}(t.simulateTouch&&!Q.ios&&!Q.android||t.simulateTouch&&!V.touch&&Q.ios)&&(n.removeEventListener("mousedown",e.onTouchStart,!1),j.removeEventListener("mousemove",e.onTouchMove,r),j.removeEventListener("mouseup",e.onTouchEnd,!1))}else n.removeEventListener(s.start,e.onTouchStart,!1),j.removeEventListener(s.move,e.onTouchMove,r),j.removeEventListener(s.end,e.onTouchEnd,!1);(t.preventClicks||t.preventClicksPropagation)&&n.removeEventListener("click",e.onClick,!0),e.off(Q.ios||Q.android?"resize orientationchange observerUpdate":"resize observerUpdate",te)}},breakpoints:{setBreakpoint:function(){const e=this,{activeIndex:t,initialized:s,loopedSlides:a=0,params:i}=e,n=i.breakpoints;if(!n||n&&0===Object.keys(n).length)return;const r=e.getBreakpoint(n);if(r&&e.currentBreakpoint!==r){const o=r in n?n[r]:void 0;o&&["slidesPerView","spaceBetween","slidesPerGroup"].forEach(e=>{const t=o[e];void 0!==t&&(o[e]="slidesPerView"!==e||"AUTO"!==t&&"auto"!==t?"slidesPerView"===e?parseFloat(t):parseInt(t,10):"auto")});const l=o||e.originalParams,d=l.direction&&l.direction!==i.direction,c=i.loop&&(l.slidesPerView!==i.slidesPerView||d);d&&s&&e.changeDirection(),H.extend(e.params,l),H.extend(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),e.currentBreakpoint=r,c&&s&&(e.loopDestroy(),e.loopCreate(),e.updateSlides(),e.slideTo(t-a+e.loopedSlides,0,!1)),e.emit("breakpoint",l)}},getBreakpoint:function(e){const t=this;if(!e)return;let s=!1;const a=[];Object.keys(e).forEach(e=>{a.push(e)}),a.sort((e,t)=>parseInt(e,10)-parseInt(t,10));for(let i=0;i<a.length;i+=1){const e=a[i];t.params.breakpointsInverse?e<=D.innerWidth&&(s=e):e>=D.innerWidth&&!s&&(s=e)}return s||"max"}},checkOverflow:{checkOverflow:function(){const e=this,t=e.isLocked;e.isLocked=1===e.snapGrid.length,e.allowSlideNext=!e.isLocked,e.allowSlidePrev=!e.isLocked,t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock"),t&&t!==e.isLocked&&(e.isEnd=!1,e.navigation.update())}},classes:{addClasses:function(){const{classNames:e,params:t,rtl:s,$el:a}=this,i=[];i.push("initialized"),i.push(t.direction),t.freeMode&&i.push("free-mode"),V.flexbox||i.push("no-flexbox"),t.autoHeight&&i.push("autoheight"),s&&i.push("rtl"),t.slidesPerColumn>1&&i.push("multirow"),Q.android&&i.push("android"),Q.ios&&i.push("ios"),(G.isIE||G.isEdge)&&(V.pointerEvents||V.prefixedPointerEvents)&&i.push("wp8-"+t.direction),i.forEach(s=>{e.push(t.containerModifierClass+s)}),a.addClass(e.join(" "))},removeClasses:function(){const{$el:e,classNames:t}=this;e.removeClass(t.join(" "))}},images:{loadImage:function(e,t,s,a,i,n){let r;function o(){n&&n()}e.complete&&i?o():t?(r=new D.Image,r.onload=o,r.onerror=o,a&&(r.sizes=a),s&&(r.srcset=s),t&&(r.src=t)):o()},preloadImages:function(){const e=this;function t(){null!=e&&e&&!e.destroyed&&(void 0!==e.imagesLoaded&&(e.imagesLoaded+=1),e.imagesLoaded===e.imagesToLoad.length&&(e.params.updateOnImagesReady&&e.update(),e.emit("imagesReady")))}e.imagesToLoad=e.$el.find("img");for(let s=0;s<e.imagesToLoad.length;s+=1){const a=e.imagesToLoad[s];e.loadImage(a,a.currentSrc||a.getAttribute("src"),a.srcset||a.getAttribute("srcset"),a.sizes||a.getAttribute("sizes"),!0,t)}}}},ne={};class re extends X{constructor(...e){let t,s;1===e.length&&e[0].constructor&&e[0].constructor===Object?s=e[0]:[t,s]=e,s||(s={}),s=H.extend({},s),t&&!s.el&&(s.el=t),super(s),Object.keys(ie).forEach(e=>{Object.keys(ie[e]).forEach(t=>{re.prototype[t]||(re.prototype[t]=ie[e][t])})});const a=this;void 0===a.modules&&(a.modules={}),Object.keys(a.modules).forEach(e=>{const t=a.modules[e];if(t.params){const e=Object.keys(t.params)[0],a=t.params[e];if("object"!=typeof a||null===a)return;if(!(e in s)||!("enabled"in a))return;!0===s[e]&&(s[e]={enabled:!0}),"object"!=typeof s[e]||"enabled"in s[e]||(s[e].enabled=!0),s[e]||(s[e]={enabled:!1})}});const i=H.extend({},ae);a.useModulesParams(i),a.params=H.extend({},i,ne,s),a.originalParams=H.extend({},a.params),a.passedParams=H.extend({},s),a.$=_;const n=_(a.params.el);if(t=n[0],!t)return;if(n.length>1){const e=[];return n.each((t,a)=>{const i=H.extend({},s,{el:a});e.push(new re(i))}),e}t.swiper=a,n.data("swiper",a);const r=n.children("."+a.params.wrapperClass);return H.extend(a,{$el:n,el:t,$wrapperEl:r,wrapperEl:r[0],classNames:[],slides:_(),slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal:()=>"horizontal"===a.params.direction,isVertical:()=>"vertical"===a.params.direction,rtl:"rtl"===t.dir.toLowerCase()||"rtl"===n.css("direction"),rtlTranslate:"horizontal"===a.params.direction&&("rtl"===t.dir.toLowerCase()||"rtl"===n.css("direction")),wrongRTL:"-webkit-box"===r.css("display"),activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,allowSlideNext:a.params.allowSlideNext,allowSlidePrev:a.params.allowSlidePrev,touchEvents:function(){const e=["touchstart","touchmove","touchend"];let t=["mousedown","mousemove","mouseup"];return V.pointerEvents?t=["pointerdown","pointermove","pointerup"]:V.prefixedPointerEvents&&(t=["MSPointerDown","MSPointerMove","MSPointerUp"]),a.touchEventsTouch={start:e[0],move:e[1],end:e[2]},a.touchEventsDesktop={start:t[0],move:t[1],end:t[2]},V.touch||!a.params.simulateTouch?a.touchEventsTouch:a.touchEventsDesktop}(),touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,formElements:"input, select, option, textarea, button, video",lastClickTime:H.now(),clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,isTouchEvent:void 0,startMoving:void 0},allowClick:!0,allowTouchMove:a.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),a.useModules(),a.params.init&&a.init(),a}slidesPerViewDynamic(){const{params:e,slides:t,slidesGrid:s,size:a,activeIndex:i}=this;let n=1;if(e.centeredSlides){let e,s=t[i].swiperSlideSize;for(let r=i+1;r<t.length;r+=1)t[r]&&!e&&(s+=t[r].swiperSlideSize,n+=1,s>a&&(e=!0));for(let r=i-1;r>=0;r-=1)t[r]&&!e&&(s+=t[r].swiperSlideSize,n+=1,s>a&&(e=!0))}else for(let r=i+1;r<t.length;r+=1)s[r]-s[i]<a&&(n+=1);return n}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:s}=e;function a(){const t=e.rtlTranslate?-1*e.translate:e.translate,s=Math.min(Math.max(t,e.maxTranslate()),e.minTranslate());e.setTranslate(s),e.updateActiveIndex(),e.updateSlidesClasses()}let i;s.breakpoints&&e.setBreakpoint(),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),e.params.freeMode?(a(),e.params.autoHeight&&e.updateAutoHeight()):(i=("auto"===e.params.slidesPerView||e.params.slidesPerView>1)&&e.isEnd&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0),i||a()),s.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t=!0){const s=this,a=s.params.direction;return e||(e="horizontal"===a?"vertical":"horizontal"),e===a||"horizontal"!==e&&"vertical"!==e||(s.$el.removeClass(`${s.params.containerModifierClass}${a} wp8-${a}`).addClass(`${s.params.containerModifierClass}${e}`),(G.isIE||G.isEdge)&&(V.pointerEvents||V.prefixedPointerEvents)&&s.$el.addClass(`${s.params.containerModifierClass}wp8-${e}`),s.params.direction=e,s.slides.each((t,s)=>{"vertical"===e?s.style.width="":s.style.height=""}),s.emit("changeDirection"),t&&s.update()),s}init(){const e=this;e.initialized||(e.emit("beforeInit"),e.params.breakpoints&&e.setBreakpoint(),e.addClasses(),e.params.loop&&e.loopCreate(),e.updateSize(),e.updateSlides(),e.params.watchOverflow&&e.checkOverflow(),e.params.grabCursor&&e.setGrabCursor(),e.params.preloadImages&&e.preloadImages(),e.params.loop?e.slideTo(e.params.initialSlide+e.loopedSlides,0,e.params.runCallbacksOnInit):e.slideTo(e.params.initialSlide,0,e.params.runCallbacksOnInit),e.attachEvents(),e.initialized=!0,e.emit("init"))}destroy(e=!0,t=!0){const s=this,{params:a,$el:i,$wrapperEl:n,slides:r}=s;return void 0===s.params||s.destroyed||(s.emit("beforeDestroy"),s.initialized=!1,s.detachEvents(),a.loop&&s.loopDestroy(),t&&(s.removeClasses(),i.removeAttr("style"),n.removeAttr("style"),r&&r.length&&r.removeClass([a.slideVisibleClass,a.slideActiveClass,a.slideNextClass,a.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-slide-index").removeAttr("data-swiper-column").removeAttr("data-swiper-row")),s.emit("destroy"),Object.keys(s.eventsListeners).forEach(e=>{s.off(e)}),!1!==e&&(s.$el[0].swiper=null,s.$el.data("swiper",null),H.deleteProps(s)),s.destroyed=!0),null}static extendDefaults(e){H.extend(ne,e)}static get extendedDefaults(){return ne}static get defaults(){return ae}static get Class(){return X}static get $(){return _}}var oe={name:"device",proto:{device:Q},static:{device:Q}},le={name:"support",proto:{support:V},static:{support:V}},de={name:"browser",proto:{browser:G},static:{browser:G}},ce={name:"resize",create(){const e=this;H.extend(e,{resize:{resizeHandler(){e&&!e.destroyed&&e.initialized&&(e.emit("beforeResize"),e.emit("resize"))},orientationChangeHandler(){e&&!e.destroyed&&e.initialized&&e.emit("orientationchange")}}})},on:{init(){D.addEventListener("resize",this.resize.resizeHandler),D.addEventListener("orientationchange",this.resize.orientationChangeHandler)},destroy(){D.removeEventListener("resize",this.resize.resizeHandler),D.removeEventListener("orientationchange",this.resize.orientationChangeHandler)}}};const pe={func:D.MutationObserver||D.WebkitMutationObserver,attach(e,t={}){const s=this,a=new(0,pe.func)(e=>{if(1===e.length)return void s.emit("observerUpdate",e[0]);const t=function(){s.emit("observerUpdate",e[0])};D.requestAnimationFrame?D.requestAnimationFrame(t):D.setTimeout(t,0)});a.observe(e,{attributes:void 0===t.attributes||t.attributes,childList:void 0===t.childList||t.childList,characterData:void 0===t.characterData||t.characterData}),s.observer.observers.push(a)},init(){const e=this;if(V.observer&&e.params.observer){if(e.params.observeParents){const t=e.$el.parents();for(let s=0;s<t.length;s+=1)e.observer.attach(t[s])}e.observer.attach(e.$el[0],{childList:e.params.observeSlideChildren}),e.observer.attach(e.$wrapperEl[0],{attributes:!1})}},destroy(){this.observer.observers.forEach(e=>{e.disconnect()}),this.observer.observers=[]}};var ue={name:"observer",params:{observer:!1,observeParents:!1,observeSlideChildren:!1},create(){H.extend(this,{observer:{init:pe.init.bind(this),attach:pe.attach.bind(this),destroy:pe.destroy.bind(this),observers:[]}})},on:{init(){this.observer.init()},destroy(){this.observer.destroy()}}};const he={update(e){const t=this,{slidesPerView:s,slidesPerGroup:a,centeredSlides:i}=t.params,{addSlidesBefore:n,addSlidesAfter:r}=t.params.virtual,{from:o,to:l,slides:d,slidesGrid:c,renderSlide:p,offset:u}=t.virtual;t.updateActiveIndex();const h=t.activeIndex||0;let m,f,g;m=t.rtlTranslate?"right":t.isHorizontal()?"left":"top",i?(f=Math.floor(s/2)+a+n,g=Math.floor(s/2)+a+r):(f=s+(a-1)+n,g=a+r);const v=Math.max((h||0)-g,0),b=Math.min((h||0)+f,d.length-1),w=(t.slidesGrid[v]||0)-(t.slidesGrid[0]||0);function y(){t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.lazy&&t.params.lazy.enabled&&t.lazy.load()}if(H.extend(t.virtual,{from:v,to:b,offset:w,slidesGrid:t.slidesGrid}),o===v&&l===b&&!e)return t.slidesGrid!==c&&w!==u&&t.slides.css(m,w+"px"),void t.updateProgress();if(t.params.virtual.renderExternal)return t.params.virtual.renderExternal.call(t,{offset:w,from:v,to:b,slides:function(){const e=[];for(let t=v;t<=b;t+=1)e.push(d[t]);return e}()}),void y();const x=[],E=[];if(e)t.$wrapperEl.find("."+t.params.slideClass).remove();else for(let S=o;S<=l;S+=1)(S<v||S>b)&&t.$wrapperEl.find(`.${t.params.slideClass}[data-swiper-slide-index="${S}"]`).remove();for(let S=0;S<d.length;S+=1)S>=v&&S<=b&&(void 0===l||e?E.push(S):(S>l&&E.push(S),S<o&&x.push(S)));E.forEach(e=>{t.$wrapperEl.append(p(d[e],e))}),x.sort((e,t)=>t-e).forEach(e=>{t.$wrapperEl.prepend(p(d[e],e))}),t.$wrapperEl.children(".swiper-slide").css(m,w+"px"),y()},renderSlide(e,t){const s=this,a=s.params.virtual;if(a.cache&&s.virtual.cache[t])return s.virtual.cache[t];const i=a.renderSlide?_(a.renderSlide.call(s,e,t)):_(`<div class="${s.params.slideClass}" data-swiper-slide-index="${t}">${e}</div>`);return i.attr("data-swiper-slide-index")||i.attr("data-swiper-slide-index",t),a.cache&&(s.virtual.cache[t]=i),i},appendSlide(e){const t=this;if("object"==typeof e&&"length"in e)for(let s=0;s<e.length;s+=1)e[s]&&t.virtual.slides.push(e[s]);else t.virtual.slides.push(e);t.virtual.update(!0)},prependSlide(e){const t=this,s=t.activeIndex;let a=s+1,i=1;if(Array.isArray(e)){for(let s=0;s<e.length;s+=1)e[s]&&t.virtual.slides.unshift(e[s]);a=s+e.length,i=e.length}else t.virtual.slides.unshift(e);if(t.params.virtual.cache){const e=t.virtual.cache,s={};Object.keys(e).forEach(t=>{s[parseInt(t,10)+i]=e[t]}),t.virtual.cache=s}t.virtual.update(!0),t.slideTo(a,0)},removeSlide(e){const t=this;if(null==e)return;let s=t.activeIndex;if(Array.isArray(e))for(let a=e.length-1;a>=0;a-=1)t.virtual.slides.splice(e[a],1),t.params.virtual.cache&&delete t.virtual.cache[e[a]],e[a]<s&&(s-=1),s=Math.max(s,0);else t.virtual.slides.splice(e,1),t.params.virtual.cache&&delete t.virtual.cache[e],e<s&&(s-=1),s=Math.max(s,0);t.virtual.update(!0),t.slideTo(s,0)},removeAllSlides(){const e=this;e.virtual.slides=[],e.params.virtual.cache&&(e.virtual.cache={}),e.virtual.update(!0),e.slideTo(0,0)}};var me={name:"virtual",params:{virtual:{enabled:!1,slides:[],cache:!0,renderSlide:null,renderExternal:null,addSlidesBefore:0,addSlidesAfter:0}},create(){H.extend(this,{virtual:{update:he.update.bind(this),appendSlide:he.appendSlide.bind(this),prependSlide:he.prependSlide.bind(this),removeSlide:he.removeSlide.bind(this),removeAllSlides:he.removeAllSlides.bind(this),renderSlide:he.renderSlide.bind(this),slides:this.params.virtual.slides,cache:{}}})},on:{beforeInit(){const e=this;if(!e.params.virtual.enabled)return;e.classNames.push(e.params.containerModifierClass+"virtual");const t={watchSlidesProgress:!0};H.extend(e.params,t),H.extend(e.originalParams,t),e.params.initialSlide||e.virtual.update()},setTranslate(){this.params.virtual.enabled&&this.virtual.update()}}};const fe={handle(e){const t=this,{rtlTranslate:s}=t;let a=e;a.originalEvent&&(a=a.originalEvent);const i=a.keyCode||a.charCode;if(!t.allowSlideNext&&(t.isHorizontal()&&39===i||t.isVertical()&&40===i||34===i))return!1;if(!t.allowSlidePrev&&(t.isHorizontal()&&37===i||t.isVertical()&&38===i||33===i))return!1;if(!(a.shiftKey||a.altKey||a.ctrlKey||a.metaKey||j.activeElement&&j.activeElement.nodeName&&("input"===j.activeElement.nodeName.toLowerCase()||"textarea"===j.activeElement.nodeName.toLowerCase()))){if(t.params.keyboard.onlyInViewport&&(33===i||34===i||37===i||39===i||38===i||40===i)){let e=!1;if(t.$el.parents("."+t.params.slideClass).length>0&&0===t.$el.parents("."+t.params.slideActiveClass).length)return;const a=D.innerWidth,i=D.innerHeight,n=t.$el.offset();s&&(n.left-=t.$el[0].scrollLeft);const r=[[n.left,n.top],[n.left+t.width,n.top],[n.left,n.top+t.height],[n.left+t.width,n.top+t.height]];for(let t=0;t<r.length;t+=1){const s=r[t];s[0]>=0&&s[0]<=a&&s[1]>=0&&s[1]<=i&&(e=!0)}if(!e)return}t.isHorizontal()?(33!==i&&34!==i&&37!==i&&39!==i||(a.preventDefault?a.preventDefault():a.returnValue=!1),(34!==i&&39!==i||s)&&(33!==i&&37!==i||!s)||t.slideNext(),(33!==i&&37!==i||s)&&(34!==i&&39!==i||!s)||t.slidePrev()):(33!==i&&34!==i&&38!==i&&40!==i||(a.preventDefault?a.preventDefault():a.returnValue=!1),34!==i&&40!==i||t.slideNext(),33!==i&&38!==i||t.slidePrev()),t.emit("keyPress",i)}},enable(){this.keyboard.enabled||(_(j).on("keydown",this.keyboard.handle),this.keyboard.enabled=!0)},disable(){this.keyboard.enabled&&(_(j).off("keydown",this.keyboard.handle),this.keyboard.enabled=!1)}};var ge={name:"keyboard",params:{keyboard:{enabled:!1,onlyInViewport:!0}},create(){H.extend(this,{keyboard:{enabled:!1,enable:fe.enable.bind(this),disable:fe.disable.bind(this),handle:fe.handle.bind(this)}})},on:{init(){const e=this;e.params.keyboard.enabled&&e.keyboard.enable()},destroy(){const e=this;e.keyboard.enabled&&e.keyboard.disable()}}};const ve={lastScrollTime:H.now(),event:D.navigator.userAgent.indexOf("firefox")>-1?"DOMMouseScroll":function(){let e="onwheel"in j;if(!e){const t=j.createElement("div");t.setAttribute("onwheel","return;"),e="function"==typeof t.onwheel}return!e&&j.implementation&&j.implementation.hasFeature&&!0!==j.implementation.hasFeature("","")&&(e=j.implementation.hasFeature("Events.wheel","3.0")),e}()?"wheel":"mousewheel",normalize(e){let t=0,s=0,a=0,i=0;return"detail"in e&&(s=e.detail),"wheelDelta"in e&&(s=-e.wheelDelta/120),"wheelDeltaY"in e&&(s=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=s,s=0),a=10*t,i=10*s,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(a=e.deltaX),(a||i)&&e.deltaMode&&(1===e.deltaMode?(a*=40,i*=40):(a*=800,i*=800)),a&&!t&&(t=a<1?-1:1),i&&!s&&(s=i<1?-1:1),{spinX:t,spinY:s,pixelX:a,pixelY:i}},handleMouseEnter(){this.mouseEntered=!0},handleMouseLeave(){this.mouseEntered=!1},handle(e){let t=e;const s=this,a=s.params.mousewheel;if(!s.mouseEntered&&!a.releaseOnEdges)return!0;t.originalEvent&&(t=t.originalEvent);let i=0;const n=s.rtlTranslate?-1:1,r=ve.normalize(t);if(a.forceToAxis)if(s.isHorizontal()){if(!(Math.abs(r.pixelX)>Math.abs(r.pixelY)))return!0;i=r.pixelX*n}else{if(!(Math.abs(r.pixelY)>Math.abs(r.pixelX)))return!0;i=r.pixelY}else i=Math.abs(r.pixelX)>Math.abs(r.pixelY)?-r.pixelX*n:-r.pixelY;if(0===i)return!0;if(a.invert&&(i=-i),s.params.freeMode){s.params.loop&&s.loopFix();let e=s.getTranslate()+i*a.sensitivity;const n=s.isBeginning,r=s.isEnd;if(e>=s.minTranslate()&&(e=s.minTranslate()),e<=s.maxTranslate()&&(e=s.maxTranslate()),s.setTransition(0),s.setTranslate(e),s.updateProgress(),s.updateActiveIndex(),s.updateSlidesClasses(),(!n&&s.isBeginning||!r&&s.isEnd)&&s.updateSlidesClasses(),s.params.freeModeSticky&&(clearTimeout(s.mousewheel.timeout),s.mousewheel.timeout=H.nextTick(()=>{s.slideToClosest()},300)),s.emit("scroll",t),s.params.autoplay&&s.params.autoplayDisableOnInteraction&&s.autoplay.stop(),e===s.minTranslate()||e===s.maxTranslate())return!0}else{if(H.now()-s.mousewheel.lastScrollTime>60)if(i<0)if(s.isEnd&&!s.params.loop||s.animating){if(a.releaseOnEdges)return!0}else s.slideNext(),s.emit("scroll",t);else if(s.isBeginning&&!s.params.loop||s.animating){if(a.releaseOnEdges)return!0}else s.slidePrev(),s.emit("scroll",t);s.mousewheel.lastScrollTime=(new D.Date).getTime()}return t.preventDefault?t.preventDefault():t.returnValue=!1,!1},enable(){const e=this;if(!ve.event)return!1;if(e.mousewheel.enabled)return!1;let t=e.$el;return"container"!==e.params.mousewheel.eventsTarged&&(t=_(e.params.mousewheel.eventsTarged)),t.on("mouseenter",e.mousewheel.handleMouseEnter),t.on("mouseleave",e.mousewheel.handleMouseLeave),t.on(ve.event,e.mousewheel.handle),e.mousewheel.enabled=!0,!0},disable(){const e=this;if(!ve.event)return!1;if(!e.mousewheel.enabled)return!1;let t=e.$el;return"container"!==e.params.mousewheel.eventsTarged&&(t=_(e.params.mousewheel.eventsTarged)),t.off(ve.event,e.mousewheel.handle),e.mousewheel.enabled=!1,!0}};const be={update(){const e=this,t=e.params.navigation;if(e.params.loop)return;const{$nextEl:s,$prevEl:a}=e.navigation;a&&a.length>0&&(e.isBeginning?a.addClass(t.disabledClass):a.removeClass(t.disabledClass),a[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass)),s&&s.length>0&&(e.isEnd?s.addClass(t.disabledClass):s.removeClass(t.disabledClass),s[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass))},onPrevClick(e){e.preventDefault(),this.isBeginning&&!this.params.loop||this.slidePrev()},onNextClick(e){e.preventDefault(),this.isEnd&&!this.params.loop||this.slideNext()},init(){const e=this,t=e.params.navigation;if(!t.nextEl&&!t.prevEl)return;let s,a;t.nextEl&&(s=_(t.nextEl),e.params.uniqueNavElements&&"string"==typeof t.nextEl&&s.length>1&&1===e.$el.find(t.nextEl).length&&(s=e.$el.find(t.nextEl))),t.prevEl&&(a=_(t.prevEl),e.params.uniqueNavElements&&"string"==typeof t.prevEl&&a.length>1&&1===e.$el.find(t.prevEl).length&&(a=e.$el.find(t.prevEl))),s&&s.length>0&&s.on("click",e.navigation.onNextClick),a&&a.length>0&&a.on("click",e.navigation.onPrevClick),H.extend(e.navigation,{$nextEl:s,nextEl:s&&s[0],$prevEl:a,prevEl:a&&a[0]})},destroy(){const e=this,{$nextEl:t,$prevEl:s}=e.navigation;t&&t.length&&(t.off("click",e.navigation.onNextClick),t.removeClass(e.params.navigation.disabledClass)),s&&s.length&&(s.off("click",e.navigation.onPrevClick),s.removeClass(e.params.navigation.disabledClass))}};const we={update(){const e=this,t=e.rtl,s=e.params.pagination;if(!s.el||!e.pagination.el||!e.pagination.$el||0===e.pagination.$el.length)return;const a=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,i=e.pagination.$el;let n;const r=e.params.loop?Math.ceil((a-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?(n=Math.ceil((e.activeIndex-e.loopedSlides)/e.params.slidesPerGroup),n>a-1-2*e.loopedSlides&&(n-=a-2*e.loopedSlides),n>r-1&&(n-=r),n<0&&"bullets"!==e.params.paginationType&&(n=r+n)):n=void 0!==e.snapIndex?e.snapIndex:e.activeIndex||0,"bullets"===s.type&&e.pagination.bullets&&e.pagination.bullets.length>0){const a=e.pagination.bullets;let r,o,l;if(s.dynamicBullets&&(e.pagination.bulletSize=a.eq(0)[e.isHorizontal()?"outerWidth":"outerHeight"](!0),i.css(e.isHorizontal()?"width":"height",e.pagination.bulletSize*(s.dynamicMainBullets+4)+"px"),s.dynamicMainBullets>1&&void 0!==e.previousIndex&&(e.pagination.dynamicBulletIndex+=n-e.previousIndex,e.pagination.dynamicBulletIndex>s.dynamicMainBullets-1?e.pagination.dynamicBulletIndex=s.dynamicMainBullets-1:e.pagination.dynamicBulletIndex<0&&(e.pagination.dynamicBulletIndex=0)),r=n-e.pagination.dynamicBulletIndex,o=r+(Math.min(a.length,s.dynamicMainBullets)-1),l=(o+r)/2),a.removeClass(`${s.bulletActiveClass} ${s.bulletActiveClass}-next ${s.bulletActiveClass}-next-next ${s.bulletActiveClass}-prev ${s.bulletActiveClass}-prev-prev ${s.bulletActiveClass}-main`),i.length>1)a.each((e,t)=>{const a=_(t),i=a.index();i===n&&a.addClass(s.bulletActiveClass),s.dynamicBullets&&(i>=r&&i<=o&&a.addClass(s.bulletActiveClass+"-main"),i===r&&a.prev().addClass(s.bulletActiveClass+"-prev").prev().addClass(s.bulletActiveClass+"-prev-prev"),i===o&&a.next().addClass(s.bulletActiveClass+"-next").next().addClass(s.bulletActiveClass+"-next-next"))});else{if(a.eq(n).addClass(s.bulletActiveClass),s.dynamicBullets){const e=a.eq(r),t=a.eq(o);for(let i=r;i<=o;i+=1)a.eq(i).addClass(s.bulletActiveClass+"-main");e.prev().addClass(s.bulletActiveClass+"-prev").prev().addClass(s.bulletActiveClass+"-prev-prev"),t.next().addClass(s.bulletActiveClass+"-next").next().addClass(s.bulletActiveClass+"-next-next")}}if(s.dynamicBullets){const i=Math.min(a.length,s.dynamicMainBullets+4),n=(e.pagination.bulletSize*i-e.pagination.bulletSize)/2-l*e.pagination.bulletSize,r=t?"right":"left";a.css(e.isHorizontal()?r:"top",n+"px")}}if("fraction"===s.type&&(i.find("."+s.currentClass).text(s.formatFractionCurrent(n+1)),i.find("."+s.totalClass).text(s.formatFractionTotal(r))),"progressbar"===s.type){let t;t=s.progressbarOpposite?e.isHorizontal()?"vertical":"horizontal":e.isHorizontal()?"horizontal":"vertical";const a=(n+1)/r;let o=1,l=1;"horizontal"===t?o=a:l=a,i.find("."+s.progressbarFillClass).transform(`translate3d(0,0,0) scaleX(${o}) scaleY(${l})`).transition(e.params.speed)}"custom"===s.type&&s.renderCustom?(i.html(s.renderCustom(e,n+1,r)),e.emit("paginationRender",e,i[0])):e.emit("paginationUpdate",e,i[0]),i[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](s.lockClass)},render(){const e=this,t=e.params.pagination;if(!t.el||!e.pagination.el||!e.pagination.$el||0===e.pagination.$el.length)return;const s=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,a=e.pagination.$el;let i="";if("bullets"===t.type){const n=e.params.loop?Math.ceil((s-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length;for(let s=0;s<n;s+=1)t.renderBullet?i+=t.renderBullet.call(e,s,t.bulletClass):i+=`<${t.bulletElement} class="${t.bulletClass}"></${t.bulletElement}>`;a.html(i),e.pagination.bullets=a.find("."+t.bulletClass)}"fraction"===t.type&&(i=t.renderFraction?t.renderFraction.call(e,t.currentClass,t.totalClass):`<span class="${t.currentClass}"></span> / <span class="${t.totalClass}"></span>`,a.html(i)),"progressbar"===t.type&&(i=t.renderProgressbar?t.renderProgressbar.call(e,t.progressbarFillClass):`<span class="${t.progressbarFillClass}"></span>`,a.html(i)),"custom"!==t.type&&e.emit("paginationRender",e.pagination.$el[0])},init(){const e=this,t=e.params.pagination;if(!t.el)return;let s=_(t.el);0!==s.length&&(e.params.uniqueNavElements&&"string"==typeof t.el&&s.length>1&&1===e.$el.find(t.el).length&&(s=e.$el.find(t.el)),"bullets"===t.type&&t.clickable&&s.addClass(t.clickableClass),s.addClass(t.modifierClass+t.type),"bullets"===t.type&&t.dynamicBullets&&(s.addClass(`${t.modifierClass}${t.type}-dynamic`),e.pagination.dynamicBulletIndex=0,t.dynamicMainBullets<1&&(t.dynamicMainBullets=1)),"progressbar"===t.type&&t.progressbarOpposite&&s.addClass(t.progressbarOppositeClass),t.clickable&&s.on("click","."+t.bulletClass,(function(t){t.preventDefault();let s=_(this).index()*e.params.slidesPerGroup;e.params.loop&&(s+=e.loopedSlides),e.slideTo(s)})),H.extend(e.pagination,{$el:s,el:s[0]}))},destroy(){const e=this.params.pagination;if(!e.el||!this.pagination.el||!this.pagination.$el||0===this.pagination.$el.length)return;const t=this.pagination.$el;t.removeClass(e.hiddenClass),t.removeClass(e.modifierClass+e.type),this.pagination.bullets&&this.pagination.bullets.removeClass(e.bulletActiveClass),e.clickable&&t.off("click","."+e.bulletClass)}};const ye={setTranslate(){const e=this;if(!e.params.scrollbar.el||!e.scrollbar.el)return;const{scrollbar:t,rtlTranslate:s,progress:a}=e,{dragSize:i,trackSize:n,$dragEl:r,$el:o}=t,l=e.params.scrollbar;let d=i,c=(n-i)*a;s?(c=-c,c>0?(d=i-c,c=0):-c+i>n&&(d=n+c)):c<0?(d=i+c,c=0):c+i>n&&(d=n-c),e.isHorizontal()?(V.transforms3d?r.transform(`translate3d(${c}px, 0, 0)`):r.transform(`translateX(${c}px)`),r[0].style.width=d+"px"):(V.transforms3d?r.transform(`translate3d(0px, ${c}px, 0)`):r.transform(`translateY(${c}px)`),r[0].style.height=d+"px"),l.hide&&(clearTimeout(e.scrollbar.timeout),o[0].style.opacity=1,e.scrollbar.timeout=setTimeout(()=>{o[0].style.opacity=0,o.transition(400)},1e3))},setTransition(e){this.params.scrollbar.el&&this.scrollbar.el&&this.scrollbar.$dragEl.transition(e)},updateSize(){const e=this;if(!e.params.scrollbar.el||!e.scrollbar.el)return;const{scrollbar:t}=e,{$dragEl:s,$el:a}=t;s[0].style.width="",s[0].style.height="";const i=e.isHorizontal()?a[0].offsetWidth:a[0].offsetHeight,n=e.size/e.virtualSize,r=n*(i/e.size);let o;o="auto"===e.params.scrollbar.dragSize?i*n:parseInt(e.params.scrollbar.dragSize,10),e.isHorizontal()?s[0].style.width=o+"px":s[0].style.height=o+"px",a[0].style.display=n>=1?"none":"",e.params.scrollbar.hide&&(a[0].style.opacity=0),H.extend(t,{trackSize:i,divider:n,moveDivider:r,dragSize:o}),t.$el[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](e.params.scrollbar.lockClass)},getPointerPosition(e){return this.isHorizontal()?"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageX:e.pageX||e.clientX:"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageY:e.pageY||e.clientY},setDragPosition(e){const{scrollbar:t,rtlTranslate:s}=this,{$el:a,dragSize:i,trackSize:n,dragStartPos:r}=t;let o;o=(t.getPointerPosition(e)-a.offset()[this.isHorizontal()?"left":"top"]-(null!==r?r:i/2))/(n-i),o=Math.max(Math.min(o,1),0),s&&(o=1-o);const l=this.minTranslate()+(this.maxTranslate()-this.minTranslate())*o;this.updateProgress(l),this.setTranslate(l),this.updateActiveIndex(),this.updateSlidesClasses()},onDragStart(e){const t=this.params.scrollbar,{scrollbar:s,$wrapperEl:a}=this,{$el:i,$dragEl:n}=s;this.scrollbar.isTouched=!0,this.scrollbar.dragStartPos=e.target===n[0]||e.target===n?s.getPointerPosition(e)-e.target.getBoundingClientRect()[this.isHorizontal()?"left":"top"]:null,e.preventDefault(),e.stopPropagation(),a.transition(100),n.transition(100),s.setDragPosition(e),clearTimeout(this.scrollbar.dragTimeout),i.transition(0),t.hide&&i.css("opacity",1),this.emit("scrollbarDragStart",e)},onDragMove(e){const{scrollbar:t,$wrapperEl:s}=this,{$el:a,$dragEl:i}=t;this.scrollbar.isTouched&&(e.preventDefault?e.preventDefault():e.returnValue=!1,t.setDragPosition(e),s.transition(0),a.transition(0),i.transition(0),this.emit("scrollbarDragMove",e))},onDragEnd(e){const t=this,s=t.params.scrollbar,{scrollbar:a}=t,{$el:i}=a;t.scrollbar.isTouched&&(t.scrollbar.isTouched=!1,s.hide&&(clearTimeout(t.scrollbar.dragTimeout),t.scrollbar.dragTimeout=H.nextTick(()=>{i.css("opacity",0),i.transition(400)},1e3)),t.emit("scrollbarDragEnd",e),s.snapOnRelease&&t.slideToClosest())},enableDraggable(){const e=this;if(!e.params.scrollbar.el)return;const{scrollbar:t,touchEventsTouch:s,touchEventsDesktop:a,params:i}=e,n=t.$el[0],r=!(!V.passiveListener||!i.passiveListeners)&&{passive:!1,capture:!1},o=!(!V.passiveListener||!i.passiveListeners)&&{passive:!0,capture:!1};V.touch?(n.addEventListener(s.start,e.scrollbar.onDragStart,r),n.addEventListener(s.move,e.scrollbar.onDragMove,r),n.addEventListener(s.end,e.scrollbar.onDragEnd,o)):(n.addEventListener(a.start,e.scrollbar.onDragStart,r),j.addEventListener(a.move,e.scrollbar.onDragMove,r),j.addEventListener(a.end,e.scrollbar.onDragEnd,o))},disableDraggable(){const e=this;if(!e.params.scrollbar.el)return;const{scrollbar:t,touchEventsTouch:s,touchEventsDesktop:a,params:i}=e,n=t.$el[0],r=!(!V.passiveListener||!i.passiveListeners)&&{passive:!1,capture:!1},o=!(!V.passiveListener||!i.passiveListeners)&&{passive:!0,capture:!1};V.touch?(n.removeEventListener(s.start,e.scrollbar.onDragStart,r),n.removeEventListener(s.move,e.scrollbar.onDragMove,r),n.removeEventListener(s.end,e.scrollbar.onDragEnd,o)):(n.removeEventListener(a.start,e.scrollbar.onDragStart,r),j.removeEventListener(a.move,e.scrollbar.onDragMove,r),j.removeEventListener(a.end,e.scrollbar.onDragEnd,o))},init(){const e=this;if(!e.params.scrollbar.el)return;const{scrollbar:t,$el:s}=e,a=e.params.scrollbar;let i=_(a.el);e.params.uniqueNavElements&&"string"==typeof a.el&&i.length>1&&1===s.find(a.el).length&&(i=s.find(a.el));let n=i.find("."+e.params.scrollbar.dragClass);0===n.length&&(n=_(`<div class="${e.params.scrollbar.dragClass}"></div>`),i.append(n)),H.extend(t,{$el:i,el:i[0],$dragEl:n,dragEl:n[0]}),a.draggable&&t.enableDraggable()},destroy(){this.scrollbar.disableDraggable()}};const xe={setTransform(e,t){const{rtl:s}=this,a=_(e),i=s?-1:1,n=a.attr("data-swiper-parallax")||"0";let r=a.attr("data-swiper-parallax-x"),o=a.attr("data-swiper-parallax-y");const l=a.attr("data-swiper-parallax-scale"),d=a.attr("data-swiper-parallax-opacity");if(r||o?(r=r||"0",o=o||"0"):this.isHorizontal()?(r=n,o="0"):(o=n,r="0"),r=r.indexOf("%")>=0?parseInt(r,10)*t*i+"%":r*t*i+"px",o=o.indexOf("%")>=0?parseInt(o,10)*t+"%":o*t+"px",null!=d){const e=d-(d-1)*(1-Math.abs(t));a[0].style.opacity=e}if(null==l)a.transform(`translate3d(${r}, ${o}, 0px)`);else{const e=l-(l-1)*(1-Math.abs(t));a.transform(`translate3d(${r}, ${o}, 0px) scale(${e})`)}},setTranslate(){const e=this,{$el:t,slides:s,progress:a,snapGrid:i}=e;t.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((t,s)=>{e.parallax.setTransform(s,a)}),s.each((t,s)=>{let n=s.progress;e.params.slidesPerGroup>1&&"auto"!==e.params.slidesPerView&&(n+=Math.ceil(t/2)-a*(i.length-1)),n=Math.min(Math.max(n,-1),1),_(s).find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((t,s)=>{e.parallax.setTransform(s,n)})})},setTransition(e=this.params.speed){const{$el:t}=this;t.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((t,s)=>{const a=_(s);let i=parseInt(a.attr("data-swiper-parallax-duration"),10)||e;0===e&&(i=0),a.transition(i)})}};const Ee={getDistanceBetweenTouches(e){if(e.targetTouches.length<2)return 1;const t=e.targetTouches[0].pageX,s=e.targetTouches[0].pageY,a=e.targetTouches[1].pageX,i=e.targetTouches[1].pageY;return Math.sqrt((a-t)**2+(i-s)**2)},onGestureStart(e){const t=this,s=t.params.zoom,a=t.zoom,{gesture:i}=a;if(a.fakeGestureTouched=!1,a.fakeGestureMoved=!1,!V.gestures){if("touchstart"!==e.type||"touchstart"===e.type&&e.targetTouches.length<2)return;a.fakeGestureTouched=!0,i.scaleStart=Ee.getDistanceBetweenTouches(e)}i.$slideEl&&i.$slideEl.length||(i.$slideEl=_(e.target).closest(".swiper-slide"),0===i.$slideEl.length&&(i.$slideEl=t.slides.eq(t.activeIndex)),i.$imageEl=i.$slideEl.find("img, svg, canvas"),i.$imageWrapEl=i.$imageEl.parent("."+s.containerClass),i.maxRatio=i.$imageWrapEl.attr("data-swiper-zoom")||s.maxRatio,0!==i.$imageWrapEl.length)?(i.$imageEl.transition(0),t.zoom.isScaling=!0):i.$imageEl=void 0},onGestureChange(e){const t=this.params.zoom,s=this.zoom,{gesture:a}=s;if(!V.gestures){if("touchmove"!==e.type||"touchmove"===e.type&&e.targetTouches.length<2)return;s.fakeGestureMoved=!0,a.scaleMove=Ee.getDistanceBetweenTouches(e)}a.$imageEl&&0!==a.$imageEl.length&&(V.gestures?s.scale=e.scale*s.currentScale:s.scale=a.scaleMove/a.scaleStart*s.currentScale,s.scale>a.maxRatio&&(s.scale=a.maxRatio-1+(s.scale-a.maxRatio+1)**.5),s.scale<t.minRatio&&(s.scale=t.minRatio+1-(t.minRatio-s.scale+1)**.5),a.$imageEl.transform(`translate3d(0,0,0) scale(${s.scale})`))},onGestureEnd(e){const t=this.params.zoom,s=this.zoom,{gesture:a}=s;if(!V.gestures){if(!s.fakeGestureTouched||!s.fakeGestureMoved)return;if("touchend"!==e.type||"touchend"===e.type&&e.changedTouches.length<2&&!Q.android)return;s.fakeGestureTouched=!1,s.fakeGestureMoved=!1}a.$imageEl&&0!==a.$imageEl.length&&(s.scale=Math.max(Math.min(s.scale,a.maxRatio),t.minRatio),a.$imageEl.transition(this.params.speed).transform(`translate3d(0,0,0) scale(${s.scale})`),s.currentScale=s.scale,s.isScaling=!1,1===s.scale&&(a.$slideEl=void 0))},onTouchStart(e){const t=this.zoom,{gesture:s,image:a}=t;s.$imageEl&&0!==s.$imageEl.length&&(a.isTouched||(Q.android&&e.preventDefault(),a.isTouched=!0,a.touchesStart.x="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,a.touchesStart.y="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY))},onTouchMove(e){const t=this,s=t.zoom,{gesture:a,image:i,velocity:n}=s;if(!a.$imageEl||0===a.$imageEl.length)return;if(t.allowClick=!1,!i.isTouched||!a.$slideEl)return;i.isMoved||(i.width=a.$imageEl[0].offsetWidth,i.height=a.$imageEl[0].offsetHeight,i.startX=H.getTranslate(a.$imageWrapEl[0],"x")||0,i.startY=H.getTranslate(a.$imageWrapEl[0],"y")||0,a.slideWidth=a.$slideEl[0].offsetWidth,a.slideHeight=a.$slideEl[0].offsetHeight,a.$imageWrapEl.transition(0),t.rtl&&(i.startX=-i.startX,i.startY=-i.startY));const r=i.width*s.scale,o=i.height*s.scale;if(!(r<a.slideWidth&&o<a.slideHeight)){if(i.minX=Math.min(a.slideWidth/2-r/2,0),i.maxX=-i.minX,i.minY=Math.min(a.slideHeight/2-o/2,0),i.maxY=-i.minY,i.touchesCurrent.x="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,i.touchesCurrent.y="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,!i.isMoved&&!s.isScaling){if(t.isHorizontal()&&(Math.floor(i.minX)===Math.floor(i.startX)&&i.touchesCurrent.x<i.touchesStart.x||Math.floor(i.maxX)===Math.floor(i.startX)&&i.touchesCurrent.x>i.touchesStart.x))return void(i.isTouched=!1);if(!t.isHorizontal()&&(Math.floor(i.minY)===Math.floor(i.startY)&&i.touchesCurrent.y<i.touchesStart.y||Math.floor(i.maxY)===Math.floor(i.startY)&&i.touchesCurrent.y>i.touchesStart.y))return void(i.isTouched=!1)}e.preventDefault(),e.stopPropagation(),i.isMoved=!0,i.currentX=i.touchesCurrent.x-i.touchesStart.x+i.startX,i.currentY=i.touchesCurrent.y-i.touchesStart.y+i.startY,i.currentX<i.minX&&(i.currentX=i.minX+1-(i.minX-i.currentX+1)**.8),i.currentX>i.maxX&&(i.currentX=i.maxX-1+(i.currentX-i.maxX+1)**.8),i.currentY<i.minY&&(i.currentY=i.minY+1-(i.minY-i.currentY+1)**.8),i.currentY>i.maxY&&(i.currentY=i.maxY-1+(i.currentY-i.maxY+1)**.8),n.prevPositionX||(n.prevPositionX=i.touchesCurrent.x),n.prevPositionY||(n.prevPositionY=i.touchesCurrent.y),n.prevTime||(n.prevTime=Date.now()),n.x=(i.touchesCurrent.x-n.prevPositionX)/(Date.now()-n.prevTime)/2,n.y=(i.touchesCurrent.y-n.prevPositionY)/(Date.now()-n.prevTime)/2,Math.abs(i.touchesCurrent.x-n.prevPositionX)<2&&(n.x=0),Math.abs(i.touchesCurrent.y-n.prevPositionY)<2&&(n.y=0),n.prevPositionX=i.touchesCurrent.x,n.prevPositionY=i.touchesCurrent.y,n.prevTime=Date.now(),a.$imageWrapEl.transform(`translate3d(${i.currentX}px, ${i.currentY}px,0)`)}},onTouchEnd(){const e=this.zoom,{gesture:t,image:s,velocity:a}=e;if(!t.$imageEl||0===t.$imageEl.length)return;if(!s.isTouched||!s.isMoved)return s.isTouched=!1,void(s.isMoved=!1);s.isTouched=!1,s.isMoved=!1;let i=300,n=300;const r=a.x*i,o=s.currentX+r,l=a.y*n,d=s.currentY+l;0!==a.x&&(i=Math.abs((o-s.currentX)/a.x)),0!==a.y&&(n=Math.abs((d-s.currentY)/a.y));const c=Math.max(i,n);s.currentX=o,s.currentY=d;const p=s.width*e.scale,u=s.height*e.scale;s.minX=Math.min(t.slideWidth/2-p/2,0),s.maxX=-s.minX,s.minY=Math.min(t.slideHeight/2-u/2,0),s.maxY=-s.minY,s.currentX=Math.max(Math.min(s.currentX,s.maxX),s.minX),s.currentY=Math.max(Math.min(s.currentY,s.maxY),s.minY),t.$imageWrapEl.transition(c).transform(`translate3d(${s.currentX}px, ${s.currentY}px,0)`)},onTransitionEnd(){const e=this.zoom,{gesture:t}=e;t.$slideEl&&this.previousIndex!==this.activeIndex&&(t.$imageEl.transform("translate3d(0,0,0) scale(1)"),t.$imageWrapEl.transform("translate3d(0,0,0)"),e.scale=1,e.currentScale=1,t.$slideEl=void 0,t.$imageEl=void 0,t.$imageWrapEl=void 0)},toggle(e){const t=this.zoom;t.scale&&1!==t.scale?t.out():t.in(e)},in(e){const t=this,s=t.zoom,a=t.params.zoom,{gesture:i,image:n}=s;if(i.$slideEl||(i.$slideEl=t.clickedSlide?_(t.clickedSlide):t.slides.eq(t.activeIndex),i.$imageEl=i.$slideEl.find("img, svg, canvas"),i.$imageWrapEl=i.$imageEl.parent("."+a.containerClass)),!i.$imageEl||0===i.$imageEl.length)return;let r,o,l,d,c,p,u,h,m,f,g,v,b,w,y,x,E,S;i.$slideEl.addClass(""+a.zoomedSlideClass),void 0===n.touchesStart.x&&e?(r="touchend"===e.type?e.changedTouches[0].pageX:e.pageX,o="touchend"===e.type?e.changedTouches[0].pageY:e.pageY):(r=n.touchesStart.x,o=n.touchesStart.y),s.scale=i.$imageWrapEl.attr("data-swiper-zoom")||a.maxRatio,s.currentScale=i.$imageWrapEl.attr("data-swiper-zoom")||a.maxRatio,e?(E=i.$slideEl[0].offsetWidth,S=i.$slideEl[0].offsetHeight,l=i.$slideEl.offset().left,d=i.$slideEl.offset().top,c=l+E/2-r,p=d+S/2-o,m=i.$imageEl[0].offsetWidth,f=i.$imageEl[0].offsetHeight,g=m*s.scale,v=f*s.scale,b=Math.min(E/2-g/2,0),w=Math.min(S/2-v/2,0),y=-b,x=-w,u=c*s.scale,h=p*s.scale,u<b&&(u=b),u>y&&(u=y),h<w&&(h=w),h>x&&(h=x)):(u=0,h=0),i.$imageWrapEl.transition(300).transform(`translate3d(${u}px, ${h}px,0)`),i.$imageEl.transition(300).transform(`translate3d(0,0,0) scale(${s.scale})`)},out(){const e=this,t=e.zoom,s=e.params.zoom,{gesture:a}=t;a.$slideEl||(a.$slideEl=e.clickedSlide?_(e.clickedSlide):e.slides.eq(e.activeIndex),a.$imageEl=a.$slideEl.find("img, svg, canvas"),a.$imageWrapEl=a.$imageEl.parent("."+s.containerClass)),a.$imageEl&&0!==a.$imageEl.length&&(t.scale=1,t.currentScale=1,a.$imageWrapEl.transition(300).transform("translate3d(0,0,0)"),a.$imageEl.transition(300).transform("translate3d(0,0,0) scale(1)"),a.$slideEl.removeClass(""+s.zoomedSlideClass),a.$slideEl=void 0)},enable(){const e=this,t=e.zoom;if(t.enabled)return;t.enabled=!0;const s=!("touchstart"!==e.touchEvents.start||!V.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1};V.gestures?(e.$wrapperEl.on("gesturestart",".swiper-slide",t.onGestureStart,s),e.$wrapperEl.on("gesturechange",".swiper-slide",t.onGestureChange,s),e.$wrapperEl.on("gestureend",".swiper-slide",t.onGestureEnd,s)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.on(e.touchEvents.start,".swiper-slide",t.onGestureStart,s),e.$wrapperEl.on(e.touchEvents.move,".swiper-slide",t.onGestureChange,s),e.$wrapperEl.on(e.touchEvents.end,".swiper-slide",t.onGestureEnd,s)),e.$wrapperEl.on(e.touchEvents.move,"."+e.params.zoom.containerClass,t.onTouchMove)},disable(){const e=this,t=e.zoom;if(!t.enabled)return;e.zoom.enabled=!1;const s=!("touchstart"!==e.touchEvents.start||!V.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1};V.gestures?(e.$wrapperEl.off("gesturestart",".swiper-slide",t.onGestureStart,s),e.$wrapperEl.off("gesturechange",".swiper-slide",t.onGestureChange,s),e.$wrapperEl.off("gestureend",".swiper-slide",t.onGestureEnd,s)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.off(e.touchEvents.start,".swiper-slide",t.onGestureStart,s),e.$wrapperEl.off(e.touchEvents.move,".swiper-slide",t.onGestureChange,s),e.$wrapperEl.off(e.touchEvents.end,".swiper-slide",t.onGestureEnd,s)),e.$wrapperEl.off(e.touchEvents.move,"."+e.params.zoom.containerClass,t.onTouchMove)}};const Se={loadInSlide(e,t=!0){const s=this,a=s.params.lazy;if(void 0===e)return;if(0===s.slides.length)return;const i=s.virtual&&s.params.virtual.enabled?s.$wrapperEl.children(`.${s.params.slideClass}[data-swiper-slide-index="${e}"]`):s.slides.eq(e);let n=i.find(`.${a.elementClass}:not(.${a.loadedClass}):not(.${a.loadingClass})`);!i.hasClass(a.elementClass)||i.hasClass(a.loadedClass)||i.hasClass(a.loadingClass)||(n=n.add(i[0])),0!==n.length&&n.each((e,n)=>{const r=_(n);r.addClass(a.loadingClass);const o=r.attr("data-background"),l=r.attr("data-src"),d=r.attr("data-srcset"),c=r.attr("data-sizes");s.loadImage(r[0],l||o,d,c,!1,()=>{if(null!=s&&s&&(!s||s.params)&&!s.destroyed){if(o?(r.css("background-image",`url("${o}")`),r.removeAttr("data-background")):(d&&(r.attr("srcset",d),r.removeAttr("data-srcset")),c&&(r.attr("sizes",c),r.removeAttr("data-sizes")),l&&(r.attr("src",l),r.removeAttr("data-src"))),r.addClass(a.loadedClass).removeClass(a.loadingClass),i.find("."+a.preloaderClass).remove(),s.params.loop&&t){const e=i.attr("data-swiper-slide-index");if(i.hasClass(s.params.slideDuplicateClass)){const t=s.$wrapperEl.children(`[data-swiper-slide-index="${e}"]:not(.${s.params.slideDuplicateClass})`);s.lazy.loadInSlide(t.index(),!1)}else{const t=s.$wrapperEl.children(`.${s.params.slideDuplicateClass}[data-swiper-slide-index="${e}"]`);s.lazy.loadInSlide(t.index(),!1)}}s.emit("lazyImageReady",i[0],r[0])}}),s.emit("lazyImageLoad",i[0],r[0])})},load(){const e=this,{$wrapperEl:t,params:s,slides:a,activeIndex:i}=e,n=e.virtual&&s.virtual.enabled,r=s.lazy;let o=s.slidesPerView;function l(e){if(n){if(t.children(`.${s.slideClass}[data-swiper-slide-index="${e}"]`).length)return!0}else if(a[e])return!0;return!1}function d(e){return n?_(e).attr("data-swiper-slide-index"):_(e).index()}if("auto"===o&&(o=0),e.lazy.initialImageLoaded||(e.lazy.initialImageLoaded=!0),e.params.watchSlidesVisibility)t.children("."+s.slideVisibleClass).each((t,s)=>{const a=n?_(s).attr("data-swiper-slide-index"):_(s).index();e.lazy.loadInSlide(a)});else if(o>1)for(let c=i;c<i+o;c+=1)l(c)&&e.lazy.loadInSlide(c);else e.lazy.loadInSlide(i);if(r.loadPrevNext)if(o>1||r.loadPrevNextAmount&&r.loadPrevNextAmount>1){const t=r.loadPrevNextAmount,s=o,n=Math.min(i+s+Math.max(t,s),a.length),d=Math.max(i-Math.max(s,t),0);for(let a=i+o;a<n;a+=1)l(a)&&e.lazy.loadInSlide(a);for(let a=d;a<i;a+=1)l(a)&&e.lazy.loadInSlide(a)}else{const a=t.children("."+s.slideNextClass);a.length>0&&e.lazy.loadInSlide(d(a));const i=t.children("."+s.slidePrevClass);i.length>0&&e.lazy.loadInSlide(d(i))}}};const Te={LinearSpline:function(e,t){const s=function(){let e,t,s;return(a,i)=>{for(t=-1,e=a.length;e-t>1;)s=e+t>>1,a[s]<=i?t=s:e=s;return e}}();let a,i;return this.x=e,this.y=t,this.lastIndex=e.length-1,this.interpolate=function(e){return e?(i=s(this.x,e),a=i-1,(e-this.x[a])*(this.y[i]-this.y[a])/(this.x[i]-this.x[a])+this.y[a]):0},this},getInterpolateFunction(e){const t=this;t.controller.spline||(t.controller.spline=t.params.loop?new Te.LinearSpline(t.slidesGrid,e.slidesGrid):new Te.LinearSpline(t.snapGrid,e.snapGrid))},setTranslate(e,t){const s=this,a=s.controller.control;let i,n;function r(e){const t=s.rtlTranslate?-s.translate:s.translate;"slide"===s.params.controller.by&&(s.controller.getInterpolateFunction(e),n=-s.controller.spline.interpolate(-t)),n&&"container"!==s.params.controller.by||(i=(e.maxTranslate()-e.minTranslate())/(s.maxTranslate()-s.minTranslate()),n=(t-s.minTranslate())*i+e.minTranslate()),s.params.controller.inverse&&(n=e.maxTranslate()-n),e.updateProgress(n),e.setTranslate(n,s),e.updateActiveIndex(),e.updateSlidesClasses()}if(Array.isArray(a))for(let o=0;o<a.length;o+=1)a[o]!==t&&a[o]instanceof re&&r(a[o]);else a instanceof re&&t!==a&&r(a)},setTransition(e,t){const s=this,a=s.controller.control;let i;function n(t){t.setTransition(e,s),0!==e&&(t.transitionStart(),t.params.autoHeight&&H.nextTick(()=>{t.updateAutoHeight()}),t.$wrapperEl.transitionEnd(()=>{a&&(t.params.loop&&"slide"===s.params.controller.by&&t.loopFix(),t.transitionEnd())}))}if(Array.isArray(a))for(i=0;i<a.length;i+=1)a[i]!==t&&a[i]instanceof re&&n(a[i]);else a instanceof re&&t!==a&&n(a)}};const Ce={makeElFocusable:e=>(e.attr("tabIndex","0"),e),addElRole:(e,t)=>(e.attr("role",t),e),addElLabel:(e,t)=>(e.attr("aria-label",t),e),disableEl:e=>(e.attr("aria-disabled",!0),e),enableEl:e=>(e.attr("aria-disabled",!1),e),onEnterKey(e){const t=this,s=t.params.a11y;if(13!==e.keyCode)return;const a=_(e.target);t.navigation&&t.navigation.$nextEl&&a.is(t.navigation.$nextEl)&&(t.isEnd&&!t.params.loop||t.slideNext(),t.isEnd?t.a11y.notify(s.lastSlideMessage):t.a11y.notify(s.nextSlideMessage)),t.navigation&&t.navigation.$prevEl&&a.is(t.navigation.$prevEl)&&(t.isBeginning&&!t.params.loop||t.slidePrev(),t.isBeginning?t.a11y.notify(s.firstSlideMessage):t.a11y.notify(s.prevSlideMessage)),t.pagination&&a.is("."+t.params.pagination.bulletClass)&&a[0].click()},notify(e){const t=this.a11y.liveRegion;0!==t.length&&(t.html(""),t.html(e))},updateNavigation(){const e=this;if(e.params.loop)return;const{$nextEl:t,$prevEl:s}=e.navigation;s&&s.length>0&&(e.isBeginning?e.a11y.disableEl(s):e.a11y.enableEl(s)),t&&t.length>0&&(e.isEnd?e.a11y.disableEl(t):e.a11y.enableEl(t))},updatePagination(){const e=this,t=e.params.a11y;e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.bullets.each((s,a)=>{const i=_(a);e.a11y.makeElFocusable(i),e.a11y.addElRole(i,"button"),e.a11y.addElLabel(i,t.paginationBulletMessage.replace(/{{index}}/,i.index()+1))})},init(){const e=this;e.$el.append(e.a11y.liveRegion);const t=e.params.a11y;let s,a;e.navigation&&e.navigation.$nextEl&&(s=e.navigation.$nextEl),e.navigation&&e.navigation.$prevEl&&(a=e.navigation.$prevEl),s&&(e.a11y.makeElFocusable(s),e.a11y.addElRole(s,"button"),e.a11y.addElLabel(s,t.nextSlideMessage),s.on("keydown",e.a11y.onEnterKey)),a&&(e.a11y.makeElFocusable(a),e.a11y.addElRole(a,"button"),e.a11y.addElLabel(a,t.prevSlideMessage),a.on("keydown",e.a11y.onEnterKey)),e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.$el.on("keydown","."+e.params.pagination.bulletClass,e.a11y.onEnterKey)},destroy(){const e=this;let t,s;e.a11y.liveRegion&&e.a11y.liveRegion.length>0&&e.a11y.liveRegion.remove(),e.navigation&&e.navigation.$nextEl&&(t=e.navigation.$nextEl),e.navigation&&e.navigation.$prevEl&&(s=e.navigation.$prevEl),t&&t.off("keydown",e.a11y.onEnterKey),s&&s.off("keydown",e.a11y.onEnterKey),e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.$el.off("keydown","."+e.params.pagination.bulletClass,e.a11y.onEnterKey)}};const ke={init(){const e=this;if(!e.params.history)return;if(!D.history||!D.history.pushState)return e.params.history.enabled=!1,void(e.params.hashNavigation.enabled=!0);const t=e.history;t.initialized=!0,t.paths=ke.getPathValues(),(t.paths.key||t.paths.value)&&(t.scrollToSlide(0,t.paths.value,e.params.runCallbacksOnInit),e.params.history.replaceState||D.addEventListener("popstate",e.history.setHistoryPopState))},destroy(){const e=this;e.params.history.replaceState||D.removeEventListener("popstate",e.history.setHistoryPopState)},setHistoryPopState(){this.history.paths=ke.getPathValues(),this.history.scrollToSlide(this.params.speed,this.history.paths.value,!1)},getPathValues(){const e=D.location.pathname.slice(1).split("/").filter(e=>""!==e),t=e.length;return{key:e[t-2],value:e[t-1]}},setHistory(e,t){if(!this.history.initialized||!this.params.history.enabled)return;const s=this.slides.eq(t);let a=ke.slugify(s.attr("data-history"));D.location.pathname.includes(e)||(a=`${e}/${a}`);const i=D.history.state;i&&i.value===a||(this.params.history.replaceState?D.history.replaceState({value:a},null,a):D.history.pushState({value:a},null,a))},slugify:e=>e.toString().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,""),scrollToSlide(e,t,s){const a=this;if(t)for(let i=0,n=a.slides.length;i<n;i+=1){const n=a.slides.eq(i);if(ke.slugify(n.attr("data-history"))===t&&!n.hasClass(a.params.slideDuplicateClass)){const t=n.index();a.slideTo(t,e,s)}}else a.slideTo(0,e,s)}};const $e={onHashCange(){const e=this,t=j.location.hash.replace("#","");if(t!==e.slides.eq(e.activeIndex).attr("data-hash")){const s=e.$wrapperEl.children(`.${e.params.slideClass}[data-hash="${t}"]`).index();if(void 0===s)return;e.slideTo(s)}},setHash(){const e=this;if(e.hashNavigation.initialized&&e.params.hashNavigation.enabled)if(e.params.hashNavigation.replaceState&&D.history&&D.history.replaceState)D.history.replaceState(null,null,"#"+e.slides.eq(e.activeIndex).attr("data-hash")||"");else{const t=e.slides.eq(e.activeIndex),s=t.attr("data-hash")||t.attr("data-history");j.location.hash=s||""}},init(){const e=this;if(!e.params.hashNavigation.enabled||e.params.history&&e.params.history.enabled)return;e.hashNavigation.initialized=!0;const t=j.location.hash.replace("#","");if(t){const s=0;for(let a=0,i=e.slides.length;a<i;a+=1){const i=e.slides.eq(a);if((i.attr("data-hash")||i.attr("data-history"))===t&&!i.hasClass(e.params.slideDuplicateClass)){const t=i.index();e.slideTo(t,s,e.params.runCallbacksOnInit,!0)}}}e.params.hashNavigation.watchState&&_(D).on("hashchange",e.hashNavigation.onHashCange)},destroy(){const e=this;e.params.hashNavigation.watchState&&_(D).off("hashchange",e.hashNavigation.onHashCange)}};const Me={run(){const e=this,t=e.slides.eq(e.activeIndex);let s=e.params.autoplay.delay;t.attr("data-swiper-autoplay")&&(s=t.attr("data-swiper-autoplay")||e.params.autoplay.delay),clearTimeout(e.autoplay.timeout),e.autoplay.timeout=H.nextTick(()=>{e.params.autoplay.reverseDirection?e.params.loop?(e.loopFix(),e.slidePrev(e.params.speed,!0,!0),e.emit("autoplay")):e.isBeginning?e.params.autoplay.stopOnLastSlide?e.autoplay.stop():(e.slideTo(e.slides.length-1,e.params.speed,!0,!0),e.emit("autoplay")):(e.slidePrev(e.params.speed,!0,!0),e.emit("autoplay")):e.params.loop?(e.loopFix(),e.slideNext(e.params.speed,!0,!0),e.emit("autoplay")):e.isEnd?e.params.autoplay.stopOnLastSlide?e.autoplay.stop():(e.slideTo(0,e.params.speed,!0,!0),e.emit("autoplay")):(e.slideNext(e.params.speed,!0,!0),e.emit("autoplay"))},s)},start(){return void 0===this.autoplay.timeout&&(!this.autoplay.running&&(this.autoplay.running=!0,this.emit("autoplayStart"),this.autoplay.run(),!0))},stop(){const e=this;return!!e.autoplay.running&&(void 0!==e.autoplay.timeout&&(e.autoplay.timeout&&(clearTimeout(e.autoplay.timeout),e.autoplay.timeout=void 0),e.autoplay.running=!1,e.emit("autoplayStop"),!0))},pause(e){const t=this;t.autoplay.running&&(t.autoplay.paused||(t.autoplay.timeout&&clearTimeout(t.autoplay.timeout),t.autoplay.paused=!0,0!==e&&t.params.autoplay.waitForTransition?(t.$wrapperEl[0].addEventListener("transitionend",t.autoplay.onTransitionEnd),t.$wrapperEl[0].addEventListener("webkitTransitionEnd",t.autoplay.onTransitionEnd)):(t.autoplay.paused=!1,t.autoplay.run())))}};const Pe={setTranslate(){const e=this,{slides:t}=e;for(let s=0;s<t.length;s+=1){const t=e.slides.eq(s);let a=-t[0].swiperSlideOffset;e.params.virtualTranslate||(a-=e.translate);let i=0;e.isHorizontal()||(i=a,a=0);const n=e.params.fadeEffect.crossFade?Math.max(1-Math.abs(t[0].progress),0):1+Math.min(Math.max(t[0].progress,-1),0);t.css({opacity:n}).transform(`translate3d(${a}px, ${i}px, 0px)`)}},setTransition(e){const t=this,{slides:s,$wrapperEl:a}=t;if(s.transition(e),t.params.virtualTranslate&&0!==e){let e=!1;s.transitionEnd(()=>{if(e)return;if(!t||t.destroyed)return;e=!0,t.animating=!1;const s=["webkitTransitionEnd","transitionend"];for(let e=0;e<s.length;e+=1)a.trigger(s[e])})}}};const Oe={setTranslate(){const{$el:e,$wrapperEl:t,slides:s,width:a,height:i,rtlTranslate:n,size:r}=this,o=this.params.cubeEffect,l=this.isHorizontal(),d=this.virtual&&this.params.virtual.enabled;let c,p=0;o.shadow&&(l?(c=t.find(".swiper-cube-shadow"),0===c.length&&(c=_('<div class="swiper-cube-shadow"></div>'),t.append(c)),c.css({height:a+"px"})):(c=e.find(".swiper-cube-shadow"),0===c.length&&(c=_('<div class="swiper-cube-shadow"></div>'),e.append(c))));for(let h=0;h<s.length;h+=1){const e=s.eq(h);let t=h;d&&(t=parseInt(e.attr("data-swiper-slide-index"),10));let a=90*t,i=Math.floor(a/360);n&&(a=-a,i=Math.floor(-a/360));const c=Math.max(Math.min(e[0].progress,1),-1);let u=0,m=0,f=0;t%4==0?(u=4*-i*r,f=0):(t-1)%4==0?(u=0,f=4*-i*r):(t-2)%4==0?(u=r+4*i*r,f=r):(t-3)%4==0&&(u=-r,f=3*r+4*r*i),n&&(u=-u),l||(m=u,u=0);const g=`rotateX(${l?0:-a}deg) rotateY(${l?a:0}deg) translate3d(${u}px, ${m}px, ${f}px)`;if(c<=1&&c>-1&&(p=90*t+90*c,n&&(p=90*-t-90*c)),e.transform(g),o.slideShadows){let t=l?e.find(".swiper-slide-shadow-left"):e.find(".swiper-slide-shadow-top"),s=l?e.find(".swiper-slide-shadow-right"):e.find(".swiper-slide-shadow-bottom");0===t.length&&(t=_(`<div class="swiper-slide-shadow-${l?"left":"top"}"></div>`),e.append(t)),0===s.length&&(s=_(`<div class="swiper-slide-shadow-${l?"right":"bottom"}"></div>`),e.append(s)),t.length&&(t[0].style.opacity=Math.max(-c,0)),s.length&&(s[0].style.opacity=Math.max(c,0))}}if(t.css({"-webkit-transform-origin":`50% 50% -${r/2}px`,"-moz-transform-origin":`50% 50% -${r/2}px`,"-ms-transform-origin":`50% 50% -${r/2}px`,"transform-origin":`50% 50% -${r/2}px`}),o.shadow)if(l)c.transform(`translate3d(0px, ${a/2+o.shadowOffset}px, ${-a/2}px) rotateX(90deg) rotateZ(0deg) scale(${o.shadowScale})`);else{const e=Math.abs(p)-90*Math.floor(Math.abs(p)/90),t=1.5-(Math.sin(2*e*Math.PI/360)/2+Math.cos(2*e*Math.PI/360)/2),s=o.shadowScale,a=o.shadowScale/t,n=o.shadowOffset;c.transform(`scale3d(${s}, 1, ${a}) translate3d(0px, ${i/2+n}px, ${-i/2/a}px) rotateX(-90deg)`)}const u=G.isSafari||G.isUiWebView?-r/2:0;t.transform(`translate3d(0px,0,${u}px) rotateX(${this.isHorizontal()?0:p}deg) rotateY(${this.isHorizontal()?-p:0}deg)`)},setTransition(e){const{$el:t,slides:s}=this;s.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),this.params.cubeEffect.shadow&&!this.isHorizontal()&&t.find(".swiper-cube-shadow").transition(e)}};const ze={setTranslate(){const e=this,{slides:t,rtlTranslate:s}=e;for(let a=0;a<t.length;a+=1){const i=t.eq(a);let n=i[0].progress;e.params.flipEffect.limitRotation&&(n=Math.max(Math.min(i[0].progress,1),-1));let r=-180*n,o=0,l=-i[0].swiperSlideOffset,d=0;if(e.isHorizontal()?s&&(r=-r):(d=l,l=0,o=-r,r=0),i[0].style.zIndex=-Math.abs(Math.round(n))+t.length,e.params.flipEffect.slideShadows){let t=e.isHorizontal()?i.find(".swiper-slide-shadow-left"):i.find(".swiper-slide-shadow-top"),s=e.isHorizontal()?i.find(".swiper-slide-shadow-right"):i.find(".swiper-slide-shadow-bottom");0===t.length&&(t=_(`<div class="swiper-slide-shadow-${e.isHorizontal()?"left":"top"}"></div>`),i.append(t)),0===s.length&&(s=_(`<div class="swiper-slide-shadow-${e.isHorizontal()?"right":"bottom"}"></div>`),i.append(s)),t.length&&(t[0].style.opacity=Math.max(-n,0)),s.length&&(s[0].style.opacity=Math.max(n,0))}i.transform(`translate3d(${l}px, ${d}px, 0px) rotateX(${o}deg) rotateY(${r}deg)`)}},setTransition(e){const t=this,{slides:s,activeIndex:a,$wrapperEl:i}=t;if(s.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),t.params.virtualTranslate&&0!==e){let e=!1;s.eq(a).transitionEnd((function(){if(e)return;if(!t||t.destroyed)return;e=!0,t.animating=!1;const s=["webkitTransitionEnd","transitionend"];for(let e=0;e<s.length;e+=1)i.trigger(s[e])}))}}};const Ie={setTranslate(){const{width:e,height:t,slides:s,$wrapperEl:a,slidesSizesGrid:i}=this,n=this.params.coverflowEffect,r=this.isHorizontal(),o=this.translate,l=r?e/2-o:t/2-o,d=r?n.rotate:-n.rotate,c=n.depth;for(let p=0,u=s.length;p<u;p+=1){const e=s.eq(p),t=i[p],a=(l-e[0].swiperSlideOffset-t/2)/t*n.modifier;let o=r?d*a:0,u=r?0:d*a,h=-c*Math.abs(a),m=r?0:n.stretch*a,f=r?n.stretch*a:0;Math.abs(f)<.001&&(f=0),Math.abs(m)<.001&&(m=0),Math.abs(h)<.001&&(h=0),Math.abs(o)<.001&&(o=0),Math.abs(u)<.001&&(u=0);const g=`translate3d(${f}px,${m}px,${h}px) rotateX(${u}deg) rotateY(${o}deg)`;if(e.transform(g),e[0].style.zIndex=1-Math.abs(Math.round(a)),n.slideShadows){let t=r?e.find(".swiper-slide-shadow-left"):e.find(".swiper-slide-shadow-top"),s=r?e.find(".swiper-slide-shadow-right"):e.find(".swiper-slide-shadow-bottom");0===t.length&&(t=_(`<div class="swiper-slide-shadow-${r?"left":"top"}"></div>`),e.append(t)),0===s.length&&(s=_(`<div class="swiper-slide-shadow-${r?"right":"bottom"}"></div>`),e.append(s)),t.length&&(t[0].style.opacity=a>0?a:0),s.length&&(s[0].style.opacity=-a>0?-a:0)}}if(V.pointerEvents||V.prefixedPointerEvents){a[0].style.perspectiveOrigin=l+"px 50%"}},setTransition(e){this.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}};const Le={init(){const e=this,{thumbs:t}=e.params,s=e.constructor;t.swiper instanceof s?(e.thumbs.swiper=t.swiper,H.extend(e.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),H.extend(e.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1})):H.isObject(t.swiper)&&(e.thumbs.swiper=new s(H.extend({},t.swiper,{watchSlidesVisibility:!0,watchSlidesProgress:!0,slideToClickedSlide:!1})),e.thumbs.swiperCreated=!0),e.thumbs.swiper.$el.addClass(e.params.thumbs.thumbsContainerClass),e.thumbs.swiper.on("tap",e.thumbs.onThumbClick)},onThumbClick(){const e=this,t=e.thumbs.swiper;if(!t)return;const s=t.clickedIndex,a=t.clickedSlide;if(a&&_(a).hasClass(e.params.thumbs.slideThumbActiveClass))return;if(null==s)return;let i;if(i=t.params.loop?parseInt(_(t.clickedSlide).attr("data-swiper-slide-index"),10):s,e.params.loop){let t=e.activeIndex;e.slides.eq(t).hasClass(e.params.slideDuplicateClass)&&(e.loopFix(),e._clientLeft=e.$wrapperEl[0].clientLeft,t=e.activeIndex);const s=e.slides.eq(t).prevAll(`[data-swiper-slide-index="${i}"]`).eq(0).index(),a=e.slides.eq(t).nextAll(`[data-swiper-slide-index="${i}"]`).eq(0).index();i=void 0===s?a:void 0===a?s:a-t<t-s?a:s}e.slideTo(i)},update(e){const t=this,s=t.thumbs.swiper;if(!s)return;const a="auto"===s.params.slidesPerView?s.slidesPerViewDynamic():s.params.slidesPerView;if(t.realIndex!==s.realIndex){let i,n=s.activeIndex;if(s.params.loop){s.slides.eq(n).hasClass(s.params.slideDuplicateClass)&&(s.loopFix(),s._clientLeft=s.$wrapperEl[0].clientLeft,n=s.activeIndex);const e=s.slides.eq(n).prevAll(`[data-swiper-slide-index="${t.realIndex}"]`).eq(0).index(),a=s.slides.eq(n).nextAll(`[data-swiper-slide-index="${t.realIndex}"]`).eq(0).index();i=void 0===e?a:void 0===a?e:a-n==n-e?n:a-n<n-e?a:e}else i=t.realIndex;s.visibleSlidesIndexes&&s.visibleSlidesIndexes.indexOf(i)<0&&(s.params.centeredSlides?i=i>n?i-Math.floor(a/2)+1:i+Math.floor(a/2)-1:i>n&&(i=i-a+1),s.slideTo(i,e?0:void 0))}let i=1;const n=t.params.thumbs.slideThumbActiveClass;if(t.params.slidesPerView>1&&!t.params.centeredSlides&&(i=t.params.slidesPerView),s.slides.removeClass(n),s.params.loop||s.params.virtual)for(let r=0;r<i;r+=1)s.$wrapperEl.children(`[data-swiper-slide-index="${t.realIndex+r}"]`).addClass(n);else for(let r=0;r<i;r+=1)s.slides.eq(t.realIndex+r).addClass(n)}};const je=[oe,le,de,ce,ue,me,ge,{name:"mousewheel",params:{mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarged:"container"}},create(){H.extend(this,{mousewheel:{enabled:!1,enable:ve.enable.bind(this),disable:ve.disable.bind(this),handle:ve.handle.bind(this),handleMouseEnter:ve.handleMouseEnter.bind(this),handleMouseLeave:ve.handleMouseLeave.bind(this),lastScrollTime:H.now()}})},on:{init(){this.params.mousewheel.enabled&&this.mousewheel.enable()},destroy(){this.mousewheel.enabled&&this.mousewheel.disable()}}},{name:"navigation",params:{navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock"}},create(){H.extend(this,{navigation:{init:be.init.bind(this),update:be.update.bind(this),destroy:be.destroy.bind(this),onNextClick:be.onNextClick.bind(this),onPrevClick:be.onPrevClick.bind(this)}})},on:{init(){this.navigation.init(),this.navigation.update()},toEdge(){this.navigation.update()},fromEdge(){this.navigation.update()},destroy(){this.navigation.destroy()},click(e){const t=this,{$nextEl:s,$prevEl:a}=t.navigation;if(t.params.navigation.hideOnClick&&!_(e.target).is(a)&&!_(e.target).is(s)){let e;s?e=s.hasClass(t.params.navigation.hiddenClass):a&&(e=a.hasClass(t.params.navigation.hiddenClass)),!0===e?t.emit("navigationShow",t):t.emit("navigationHide",t),s&&s.toggleClass(t.params.navigation.hiddenClass),a&&a.toggleClass(t.params.navigation.hiddenClass)}}}},{name:"pagination",params:{pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:e=>e,formatFractionTotal:e=>e,bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",modifierClass:"swiper-pagination-",currentClass:"swiper-pagination-current",totalClass:"swiper-pagination-total",hiddenClass:"swiper-pagination-hidden",progressbarFillClass:"swiper-pagination-progressbar-fill",progressbarOppositeClass:"swiper-pagination-progressbar-opposite",clickableClass:"swiper-pagination-clickable",lockClass:"swiper-pagination-lock"}},create(){H.extend(this,{pagination:{init:we.init.bind(this),render:we.render.bind(this),update:we.update.bind(this),destroy:we.destroy.bind(this),dynamicBulletIndex:0}})},on:{init(){this.pagination.init(),this.pagination.render(),this.pagination.update()},activeIndexChange(){const e=this;(e.params.loop||void 0===e.snapIndex)&&e.pagination.update()},snapIndexChange(){const e=this;e.params.loop||e.pagination.update()},slidesLengthChange(){const e=this;e.params.loop&&(e.pagination.render(),e.pagination.update())},snapGridLengthChange(){const e=this;e.params.loop||(e.pagination.render(),e.pagination.update())},destroy(){this.pagination.destroy()},click(e){const t=this;if(t.params.pagination.el&&t.params.pagination.hideOnClick&&t.pagination.$el.length>0&&!_(e.target).hasClass(t.params.pagination.bulletClass)){!0===t.pagination.$el.hasClass(t.params.pagination.hiddenClass)?t.emit("paginationShow",t):t.emit("paginationHide",t),t.pagination.$el.toggleClass(t.params.pagination.hiddenClass)}}}},{name:"scrollbar",params:{scrollbar:{el:null,dragSize:"auto",hide:!1,draggable:!1,snapOnRelease:!0,lockClass:"swiper-scrollbar-lock",dragClass:"swiper-scrollbar-drag"}},create(){H.extend(this,{scrollbar:{init:ye.init.bind(this),destroy:ye.destroy.bind(this),updateSize:ye.updateSize.bind(this),setTranslate:ye.setTranslate.bind(this),setTransition:ye.setTransition.bind(this),enableDraggable:ye.enableDraggable.bind(this),disableDraggable:ye.disableDraggable.bind(this),setDragPosition:ye.setDragPosition.bind(this),getPointerPosition:ye.getPointerPosition.bind(this),onDragStart:ye.onDragStart.bind(this),onDragMove:ye.onDragMove.bind(this),onDragEnd:ye.onDragEnd.bind(this),isTouched:!1,timeout:null,dragTimeout:null}})},on:{init(){this.scrollbar.init(),this.scrollbar.updateSize(),this.scrollbar.setTranslate()},update(){this.scrollbar.updateSize()},resize(){this.scrollbar.updateSize()},observerUpdate(){this.scrollbar.updateSize()},setTranslate(){this.scrollbar.setTranslate()},setTransition(e){this.scrollbar.setTransition(e)},destroy(){this.scrollbar.destroy()}}},{name:"parallax",params:{parallax:{enabled:!1}},create(){H.extend(this,{parallax:{setTransform:xe.setTransform.bind(this),setTranslate:xe.setTranslate.bind(this),setTransition:xe.setTransition.bind(this)}})},on:{beforeInit(){this.params.parallax.enabled&&(this.params.watchSlidesProgress=!0,this.originalParams.watchSlidesProgress=!0)},init(){this.params.parallax.enabled&&this.parallax.setTranslate()},setTranslate(){this.params.parallax.enabled&&this.parallax.setTranslate()},setTransition(e){this.params.parallax.enabled&&this.parallax.setTransition(e)}}},{name:"zoom",params:{zoom:{enabled:!1,maxRatio:3,minRatio:1,toggle:!0,containerClass:"swiper-zoom-container",zoomedSlideClass:"swiper-slide-zoomed"}},create(){const e=this,t={enabled:!1,scale:1,currentScale:1,isScaling:!1,gesture:{$slideEl:void 0,slideWidth:void 0,slideHeight:void 0,$imageEl:void 0,$imageWrapEl:void 0,maxRatio:3},image:{isTouched:void 0,isMoved:void 0,currentX:void 0,currentY:void 0,minX:void 0,minY:void 0,maxX:void 0,maxY:void 0,width:void 0,height:void 0,startX:void 0,startY:void 0,touchesStart:{},touchesCurrent:{}},velocity:{x:void 0,y:void 0,prevPositionX:void 0,prevPositionY:void 0,prevTime:void 0}};"onGestureStart onGestureChange onGestureEnd onTouchStart onTouchMove onTouchEnd onTransitionEnd toggle enable disable in out".split(" ").forEach(s=>{t[s]=Ee[s].bind(e)}),H.extend(e,{zoom:t});let s=1;Object.defineProperty(e.zoom,"scale",{get:()=>s,set(t){if(s!==t){const s=e.zoom.gesture.$imageEl?e.zoom.gesture.$imageEl[0]:void 0,a=e.zoom.gesture.$slideEl?e.zoom.gesture.$slideEl[0]:void 0;e.emit("zoomChange",t,s,a)}s=t}})},on:{init(){const e=this;e.params.zoom.enabled&&e.zoom.enable()},destroy(){this.zoom.disable()},touchStart(e){this.zoom.enabled&&this.zoom.onTouchStart(e)},touchEnd(e){this.zoom.enabled&&this.zoom.onTouchEnd(e)},doubleTap(e){const t=this;t.params.zoom.enabled&&t.zoom.enabled&&t.params.zoom.toggle&&t.zoom.toggle(e)},transitionEnd(){const e=this;e.zoom.enabled&&e.params.zoom.enabled&&e.zoom.onTransitionEnd()}}},{name:"lazy",params:{lazy:{enabled:!1,loadPrevNext:!1,loadPrevNextAmount:1,loadOnTransitionStart:!1,elementClass:"swiper-lazy",loadingClass:"swiper-lazy-loading",loadedClass:"swiper-lazy-loaded",preloaderClass:"swiper-lazy-preloader"}},create(){H.extend(this,{lazy:{initialImageLoaded:!1,load:Se.load.bind(this),loadInSlide:Se.loadInSlide.bind(this)}})},on:{beforeInit(){const e=this;e.params.lazy.enabled&&e.params.preloadImages&&(e.params.preloadImages=!1)},init(){const e=this;e.params.lazy.enabled&&!e.params.loop&&0===e.params.initialSlide&&e.lazy.load()},scroll(){const e=this;e.params.freeMode&&!e.params.freeModeSticky&&e.lazy.load()},resize(){const e=this;e.params.lazy.enabled&&e.lazy.load()},scrollbarDragMove(){const e=this;e.params.lazy.enabled&&e.lazy.load()},transitionStart(){const e=this;e.params.lazy.enabled&&(e.params.lazy.loadOnTransitionStart||!e.params.lazy.loadOnTransitionStart&&!e.lazy.initialImageLoaded)&&e.lazy.load()},transitionEnd(){const e=this;e.params.lazy.enabled&&!e.params.lazy.loadOnTransitionStart&&e.lazy.load()}}},{name:"controller",params:{controller:{control:void 0,inverse:!1,by:"slide"}},create(){H.extend(this,{controller:{control:this.params.controller.control,getInterpolateFunction:Te.getInterpolateFunction.bind(this),setTranslate:Te.setTranslate.bind(this),setTransition:Te.setTransition.bind(this)}})},on:{update(){const e=this;e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},resize(){const e=this;e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},observerUpdate(){const e=this;e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},setTranslate(e,t){this.controller.control&&this.controller.setTranslate(e,t)},setTransition(e,t){this.controller.control&&this.controller.setTransition(e,t)}}},{name:"a11y",params:{a11y:{enabled:!0,notificationClass:"swiper-notification",prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}"}},create(){const e=this;H.extend(e,{a11y:{liveRegion:_(`<span class="${e.params.a11y.notificationClass}" aria-live="assertive" aria-atomic="true"></span>`)}}),Object.keys(Ce).forEach(t=>{e.a11y[t]=Ce[t].bind(e)})},on:{init(){this.params.a11y.enabled&&(this.a11y.init(),this.a11y.updateNavigation())},toEdge(){this.params.a11y.enabled&&this.a11y.updateNavigation()},fromEdge(){this.params.a11y.enabled&&this.a11y.updateNavigation()},paginationUpdate(){this.params.a11y.enabled&&this.a11y.updatePagination()},destroy(){this.params.a11y.enabled&&this.a11y.destroy()}}},{name:"history",params:{history:{enabled:!1,replaceState:!1,key:"slides"}},create(){H.extend(this,{history:{init:ke.init.bind(this),setHistory:ke.setHistory.bind(this),setHistoryPopState:ke.setHistoryPopState.bind(this),scrollToSlide:ke.scrollToSlide.bind(this),destroy:ke.destroy.bind(this)}})},on:{init(){const e=this;e.params.history.enabled&&e.history.init()},destroy(){const e=this;e.params.history.enabled&&e.history.destroy()},transitionEnd(){const e=this;e.history.initialized&&e.history.setHistory(e.params.history.key,e.activeIndex)}}},{name:"hash-navigation",params:{hashNavigation:{enabled:!1,replaceState:!1,watchState:!1}},create(){H.extend(this,{hashNavigation:{initialized:!1,init:$e.init.bind(this),destroy:$e.destroy.bind(this),setHash:$e.setHash.bind(this),onHashCange:$e.onHashCange.bind(this)}})},on:{init(){const e=this;e.params.hashNavigation.enabled&&e.hashNavigation.init()},destroy(){const e=this;e.params.hashNavigation.enabled&&e.hashNavigation.destroy()},transitionEnd(){const e=this;e.hashNavigation.initialized&&e.hashNavigation.setHash()}}},{name:"autoplay",params:{autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!0,stopOnLastSlide:!1,reverseDirection:!1}},create(){const e=this;H.extend(e,{autoplay:{running:!1,paused:!1,run:Me.run.bind(e),start:Me.start.bind(e),stop:Me.stop.bind(e),pause:Me.pause.bind(e),onTransitionEnd(t){e&&!e.destroyed&&e.$wrapperEl&&t.target===this&&(e.$wrapperEl[0].removeEventListener("transitionend",e.autoplay.onTransitionEnd),e.$wrapperEl[0].removeEventListener("webkitTransitionEnd",e.autoplay.onTransitionEnd),e.autoplay.paused=!1,e.autoplay.running?e.autoplay.run():e.autoplay.stop())}}})},on:{init(){const e=this;e.params.autoplay.enabled&&e.autoplay.start()},beforeTransitionStart(e,t){const s=this;s.autoplay.running&&(t||!s.params.autoplay.disableOnInteraction?s.autoplay.pause(e):s.autoplay.stop())},sliderFirstMove(){const e=this;e.autoplay.running&&(e.params.autoplay.disableOnInteraction?e.autoplay.stop():e.autoplay.pause())},destroy(){const e=this;e.autoplay.running&&e.autoplay.stop()}}},{name:"effect-fade",params:{fadeEffect:{crossFade:!1}},create(){H.extend(this,{fadeEffect:{setTranslate:Pe.setTranslate.bind(this),setTransition:Pe.setTransition.bind(this)}})},on:{beforeInit(){if("fade"!==this.params.effect)return;this.classNames.push(this.params.containerModifierClass+"fade");const e={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};H.extend(this.params,e),H.extend(this.originalParams,e)},setTranslate(){"fade"===this.params.effect&&this.fadeEffect.setTranslate()},setTransition(e){"fade"===this.params.effect&&this.fadeEffect.setTransition(e)}}},{name:"effect-cube",params:{cubeEffect:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94}},create(){H.extend(this,{cubeEffect:{setTranslate:Oe.setTranslate.bind(this),setTransition:Oe.setTransition.bind(this)}})},on:{beforeInit(){if("cube"!==this.params.effect)return;this.classNames.push(this.params.containerModifierClass+"cube"),this.classNames.push(this.params.containerModifierClass+"3d");const e={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,resistanceRatio:0,spaceBetween:0,centeredSlides:!1,virtualTranslate:!0};H.extend(this.params,e),H.extend(this.originalParams,e)},setTranslate(){"cube"===this.params.effect&&this.cubeEffect.setTranslate()},setTransition(e){"cube"===this.params.effect&&this.cubeEffect.setTransition(e)}}},{name:"effect-flip",params:{flipEffect:{slideShadows:!0,limitRotation:!0}},create(){H.extend(this,{flipEffect:{setTranslate:ze.setTranslate.bind(this),setTransition:ze.setTransition.bind(this)}})},on:{beforeInit(){if("flip"!==this.params.effect)return;this.classNames.push(this.params.containerModifierClass+"flip"),this.classNames.push(this.params.containerModifierClass+"3d");const e={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};H.extend(this.params,e),H.extend(this.originalParams,e)},setTranslate(){"flip"===this.params.effect&&this.flipEffect.setTranslate()},setTransition(e){"flip"===this.params.effect&&this.flipEffect.setTransition(e)}}},{name:"effect-coverflow",params:{coverflowEffect:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0}},create(){H.extend(this,{coverflowEffect:{setTranslate:Ie.setTranslate.bind(this),setTransition:Ie.setTransition.bind(this)}})},on:{beforeInit(){"coverflow"===this.params.effect&&(this.classNames.push(this.params.containerModifierClass+"coverflow"),this.classNames.push(this.params.containerModifierClass+"3d"),this.params.watchSlidesProgress=!0,this.originalParams.watchSlidesProgress=!0)},setTranslate(){"coverflow"===this.params.effect&&this.coverflowEffect.setTranslate()},setTransition(e){"coverflow"===this.params.effect&&this.coverflowEffect.setTransition(e)}}},{name:"thumbs",params:{thumbs:{swiper:null,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-container-thumbs"}},create(){H.extend(this,{thumbs:{swiper:null,init:Le.init.bind(this),update:Le.update.bind(this),onThumbClick:Le.onThumbClick.bind(this)}})},on:{beforeInit(){const{thumbs:e}=this.params;e&&e.swiper&&(this.thumbs.init(),this.thumbs.update(!0))},slideChange(){this.thumbs.swiper&&this.thumbs.update()},update(){this.thumbs.swiper&&this.thumbs.update()},resize(){this.thumbs.swiper&&this.thumbs.update()},observerUpdate(){this.thumbs.swiper&&this.thumbs.update()},setTransition(e){const t=this.thumbs.swiper;t&&t.setTransition(e)},beforeDestroy(){const e=this.thumbs.swiper;e&&this.thumbs.swiperCreated&&e&&e.destroy()}}}];void 0===re.use&&(re.use=re.Class.use,re.installModule=re.Class.installModule),re.use(je);var De=re;s(34);var Ae=s(20),_e=s.n(Ae),Ne=s(14),Be=s(21),He=s(22),Ve=s(23),Ge=function(e){f()(s,e);var t=v()(s);function s(e){var a;return p()(this,s),(a=t.call(this,e)).state={autoPlayState:!0},a.btnNextRef=Object(l.createRef)(),a.btnPrevRef=Object(l.createRef)(),a.carouselRef=Object(l.createRef)(),a.paginationRef=Object(l.createRef)(),a}return h()(s,[{key:"componentDidUpdate",value:function(){var e=this.props,t=e.attributes,s=e.latestPosts,a=this.state.autoPlayState,i=t.autoplay,n=t.delay,r=this.swiperInstance&&s&&this.swiperInstance.realIndex<s.length?this.swiperInstance.realIndex:0;this.swiperInstance&&this.swiperInstance.destroy(!0,!0),this.swiperInstance=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".swiper-container",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s={effect:"slide",grabCursor:!0,init:!0,initialSlide:0,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},pagination:{bulletElement:"button",clickable:!0,el:".swiper-pagination",type:"bullets"},preventClicksPropagation:!1,releaseFormElements:!1,setWrapperSize:!0,touchStartPreventDefault:!1};return new De(e,Object(O.merge)({},s,t))}(this.carouselRef.current,{autoplay:!(!i||!a)&&{delay:1e3*n,disableOnInteraction:!1},effect:"slide",initialSlide:r,loop:!0,navigation:{nextEl:this.btnNextRef.current,prevEl:this.btnPrevRef.current},pagination:{clickable:!0,el:this.paginationRef.current,type:"bullets"}},{})}},{key:"render",value:function(){var e=this,t=this.props,s=t.attributes,a=t.className,i=t.setAttributes,n=t.latestPosts,o=this.state.autoPlayState,c=s.authors,p=s.autoplay,u=s.categories,h=s.delay,m=s.postsToShow,f=s.showCategory,g=s.showDate,v=s.showAuthor,b=s.showAvatar,w=s.tags,y=_e()(a,"wp-block-newspack-blocks-carousel","swiper-container",p&&o&&"wp-block-newspack-blocks-carousel__autoplay-playing"),x=Object(Ne.__experimentalGetSettings)().formats.date;return Object(l.createElement)(l.Fragment,null,Object(l.createElement)("div",{className:y,ref:this.carouselRef},n&&!n.length&&Object(l.createElement)(d.Placeholder,null,Object(r.__)("Sorry, no posts were found.")),!n&&Object(l.createElement)(d.Placeholder,{icon:Object(l.createElement)(d.Spinner,null),className:"component-placeholder__align-center"}),n&&Object(l.createElement)(l.Fragment,null,Object(l.createElement)("div",{className:"swiper-wrapper"},n.map((function(e){return e.newspack_featured_image_src&&Object(l.createElement)("article",{className:"post-has-image swiper-slide",key:e.id},Object(l.createElement)("figure",{className:"post-thumbnail"},e.newspack_featured_image_src&&Object(l.createElement)("a",{href:"#",rel:"bookmark"},Object(l.createElement)("img",{src:e.newspack_featured_image_src.large,alt:""}))),Object(l.createElement)("div",{className:"entry-wrapper"},f&&e.newspack_category_info.length&&Object(l.createElement)("div",{className:"cat-links"},Object(l.createElement)("a",{href:"#"},e.newspack_category_info)),Object(l.createElement)("h3",{className:"entry-title"},Object(l.createElement)("a",{href:"#"},Object($.decodeEntities)(e.title.rendered.trim()))),Object(l.createElement)("div",{className:"entry-meta"},v&&b&&e.newspack_author_info.map((function(e){return Object(l.createElement)("span",{className:"avatar author-avatar",key:e.id},Object(l.createElement)("a",{className:"url fn n",href:e.author_link},Object(l.createElement)(l.RawHTML,null,e.avatar)))})),v&&function(e){return Object(l.createElement)("span",{className:"byline"},Object(r._x)("by","post author","newspack-blocks")," ",e.reduce((function(t,s,a){return[].concat(P()(t),[Object(l.createElement)("span",{className:"author vcard",key:s.id},Object(l.createElement)("a",{className:"url fn n",href:s.author_link},s.display_name)),a<e.length-2&&", ",e.length>1&&a===e.length-2&&Object(r._x)(" and ","post author","newspack-blocks")])}),[]))}(e.newspack_author_info),g&&Object(l.createElement)("time",{className:"entry-date published",key:"pub-date"},Object(Ne.dateI18n)(x,e.date_gmt)))))}))),Object(l.createElement)("a",{className:"amp-carousel-button amp-carousel-button-prev swiper-button-prev",ref:this.btnPrevRef,role:"button"}),Object(l.createElement)("a",{className:"amp-carousel-button amp-carousel-button-next swiper-button-next",ref:this.btnNextRef,role:"button"}),p&&Object(l.createElement)(l.Fragment,null,Object(l.createElement)("a",{className:"amp-carousel-button-pause amp-carousel-button",role:"button",onClick:function(){e.swiperInstance.autoplay.stop(),e.setState({autoPlayState:!1})}}),Object(l.createElement)("a",{className:"amp-carousel-button-play amp-carousel-button",role:"button",onClick:function(){e.swiperInstance.autoplay.start(),e.setState({autoPlayState:!0})}})),Object(l.createElement)("div",{className:"swiper-pagination-bullets amp-pagination",ref:this.paginationRef}))),Object(l.createElement)(Be.InspectorControls,null,Object(l.createElement)(d.PanelBody,{title:Object(r.__)("Display Settings"),initialOpen:!0},m&&Object(l.createElement)(L,{enableSpecific:!1,numberOfItems:m,onNumberOfItemsChange:function(e){return i({postsToShow:e})},authors:c,onAuthorsChange:function(e){return i({authors:e})},categories:u,onCategoriesChange:function(e){return i({categories:e})},tags:w,onTagsChange:function(e){return i({tags:e})}})),Object(l.createElement)(d.PanelBody,{title:Object(r.__)("Slideshow Settings"),initialOpen:!0},Object(l.createElement)(d.ToggleControl,{label:Object(r.__)("Autoplay"),help:Object(r.__)("Autoplay between slides"),checked:p,onChange:function(e){i({autoplay:e})}}),p&&Object(l.createElement)(d.RangeControl,{label:Object(r.__)("Delay between transitions (in seconds)"),value:h,onChange:function(e){i({delay:e})},min:1,max:20})),Object(l.createElement)(d.PanelBody,{title:Object(r.__)("Article Meta Settings","full-site-editing")},Object(l.createElement)(d.PanelRow,null,Object(l.createElement)(d.ToggleControl,{label:Object(r.__)("Show Date","full-site-editing"),checked:g,onChange:function(){return i({showDate:!g})}})),Object(l.createElement)(d.PanelRow,null,Object(l.createElement)(d.ToggleControl,{label:Object(r.__)("Show Category","full-site-editing"),checked:f,onChange:function(){return i({showCategory:!f})}})),Object(l.createElement)(d.PanelRow,null,Object(l.createElement)(d.ToggleControl,{label:Object(r.__)("Show Author","full-site-editing"),checked:v,onChange:function(){return i({showAuthor:!v})}})),v&&Object(l.createElement)(d.PanelRow,null,Object(l.createElement)(d.ToggleControl,{label:Object(r.__)("Show Author Avatar","full-site-editing"),checked:b,onChange:function(){return i({showAvatar:!b})}})))))}}]),s}(l.Component),Xe=Object(Ve.compose)([Object(He.withSelect)((function(e,t){var s=t.attributes,a=s.postsToShow,i=s.authors,n=s.categories,r=s.tags;return{latestPosts:(0,e("core").getEntityRecords)("postType","post",Object(O.pickBy)({per_page:a,categories:n,author:i,tags:r,meta_key:"_thumbnail_id",meta_value_num:0,meta_compare:">"},(function(e){return!Object(O.isUndefined)(e)})))}}))])(Ge),Ye=(s(35),s(36),{title:Object(r.__)("Articles Carousel"),icon:Object(l.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(l.createElement)(d.Path,{d:"M0 0h24v24H0z",fill:"none"}),Object(l.createElement)(d.Path,{d:"M7 19h10V4H7v15zm-5-2h4V6H2v11zM18 6v11h4V6h-4z"})),category:"newspack",keywords:[Object(r.__)("posts"),Object(r.__)("slideshow"),Object(r.__)("carousel")],description:Object(r.__)("A carousel of articles."),attributes:{className:{type:"string"},autoplay:{type:"boolean",default:!1},delay:{type:"number",default:5},postsToShow:{type:"integer",default:3},authors:{type:"array"},categories:{type:"array"},tags:{type:"array"},showDate:{type:"boolean",default:!0},showAuthor:{type:"boolean",default:!0},showAvatar:{type:"boolean",default:!0},showCategory:{type:"boolean",default:!1}},supports:{html:!1,align:!1},edit:Xe,save:function(){return null}});Object(o.addFilter)("blocks.transforms_from_name","set-transformed-block-name",(function(e){return"newspack-blocks/carousel"!==e?e:"a8c/posts-carousel"})),Object(n.registerBlockType)("a8c/posts-carousel",i()({},Ye,{title:Object(r.__)("Posts Carousel","full-site-editing"),category:"layout"}))}]));
|
newspack-blocks/dist/carousel-block-editor.rtl.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.autocomplete-tokenfield{position:relative}.autocomplete-tokenfield .components-spinner{position:absolute;top:2em;left:0}.autocomplete-tokenfield .components-form-token-field>.components-form-token-field__help{display:none}.autocomplete-tokenfield .autocomplete-tokenfield__help{font-style:italic}.swiper-container{margin-right:auto;margin-left:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-container-no-flexbox .swiper-slide{float:right}.swiper-container-vertical>.swiper-wrapper{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-container-android .swiper-slide,.swiper-wrapper{-webkit-transform:translateZ(0);transform:translateZ(0)}.swiper-container-multirow>.swiper-wrapper{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.swiper-container-free-mode>.swiper-wrapper{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out;margin:0 auto}.swiper-slide{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-container-autoheight,.swiper-container-autoheight .swiper-slide{height:auto}.swiper-container-autoheight .swiper-wrapper{-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height,-webkit-transform;transition-property:height,-webkit-transform;-o-transition-property:transform,height;transition-property:transform,height;transition-property:transform,height,-webkit-transform}.swiper-container-3d{-webkit-perspective:1200px;perspective:1200px}.swiper-container-3d .swiper-cube-shadow,.swiper-container-3d .swiper-slide,.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top,.swiper-container-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top{position:absolute;right:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-container-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:linear-gradient(90deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear,right top,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:linear-gradient(270deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear,right bottom,right top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:linear-gradient(0deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear,right top,right bottom,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:linear-gradient(180deg,rgba(0,0,0,.5),transparent)}.swiper-container-wp8-horizontal,.swiper-container-wp8-horizontal>.swiper-wrapper{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-container-wp8-vertical,.swiper-container-wp8-vertical>.swiper-wrapper{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:27px;height:44px;margin-top:-22px;z-index:10;cursor:pointer;background-size:27px 44px;background-position:50%;background-repeat:no-repeat}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-prev,.swiper-container-rtl .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23007aff'/%3E%3C/svg%3E");right:10px;left:auto}.swiper-button-next,.swiper-container-rtl .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23007aff'/%3E%3C/svg%3E");left:10px;right:auto}.swiper-button-prev.swiper-button-white,.swiper-container-rtl .swiper-button-next.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-white,.swiper-container-rtl .swiper-button-prev.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-prev.swiper-button-black,.swiper-container-rtl .swiper-button-next.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-black,.swiper-container-rtl .swiper-button-prev.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z'/%3E%3C/svg%3E")}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:opacity .3s;-o-transition:.3s opacity;transition:opacity .3s;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:10px;right:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active,.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;border-radius:100%;background:#000;opacity:.2}button.swiper-pagination-bullet{border:none;margin:0;padding:0;-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet-active{opacity:1;background:#007aff}.swiper-container-vertical>.swiper-pagination-bullets{left:10px;top:50%;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:6px 0;display:block}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:8px}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;-webkit-transition:top .2s,-webkit-transform .2s;transition:top .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s top;transition:transform .2s,top .2s;transition:transform .2s,top .2s,-webkit-transform .2s}.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 4px}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{right:50%;-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);white-space:nowrap}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:right .2s,-webkit-transform .2s;transition:right .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s right;transition:transform .2s,right .2s;transition:transform .2s,right .2s,-webkit-transform .2s}.swiper-container-horizontal.swiper-container-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:left .2s,-webkit-transform .2s;transition:left .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s left;transition:transform .2s,left .2s;transition:transform .2s,left .2s,-webkit-transform .2s}.swiper-pagination-progressbar{background:rgba(0,0,0,.25);position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:#007aff;position:absolute;right:0;top:0;width:100%;height:100%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:right top;-ms-transform-origin:right top;transform-origin:right top}.swiper-container-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top}.swiper-container-horizontal>.swiper-pagination-progressbar,.swiper-container-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:4px;right:0;top:0}.swiper-container-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-container-vertical>.swiper-pagination-progressbar{width:4px;height:100%;right:0;top:0}.swiper-pagination-white .swiper-pagination-bullet-active{background:#fff}.swiper-pagination-progressbar.swiper-pagination-white{background:hsla(0,0%,100%,.25)}.swiper-pagination-progressbar.swiper-pagination-white .swiper-pagination-progressbar-fill{background:#fff}.swiper-pagination-black .swiper-pagination-bullet-active{background:#000}.swiper-pagination-progressbar.swiper-pagination-black{background:rgba(0,0,0,.25)}.swiper-pagination-progressbar.swiper-pagination-black .swiper-pagination-progressbar-fill{background:#000}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:10px;position:relative;-ms-touch-action:none;background:rgba(0,0,0,.1)}.swiper-container-horizontal>.swiper-scrollbar{position:absolute;right:1%;bottom:3px;z-index:50;height:5px;width:98%}.swiper-container-vertical>.swiper-scrollbar{position:absolute;left:3px;top:1%;z-index:50;width:5px;height:98%}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:rgba(0,0,0,.5);border-radius:10px;right:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}.swiper-slide-zoomed{cursor:move}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;right:50%;top:50%;margin-right:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-animation:swiper-preloader-spin 1s steps(12) infinite;animation:swiper-preloader-spin 1s steps(12) infinite}.swiper-lazy-preloader:after{display:block;content:"";width:100%;height:100%;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%236c6c6c' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E");background-position:50%;background-size:100%;background-repeat:no-repeat}.swiper-lazy-preloader-white:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%23fff' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E")}@-webkit-keyframes swiper-preloader-spin{to{-webkit-transform:rotate(-1turn);transform:rotate(-1turn)}}@keyframes swiper-preloader-spin{to{-webkit-transform:rotate(-1turn);transform:rotate(-1turn)}}.swiper-container .swiper-notification{position:absolute;right:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-container-fade.swiper-container-free-mode .swiper-slide{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out}.swiper-container-fade .swiper-slide{pointer-events:none;-webkit-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity}.swiper-container-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-fade .swiper-slide-active,.swiper-container-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube{overflow:visible}.swiper-container-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0;width:100%;height:100%}.swiper-container-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-cube.swiper-container-rtl .swiper-slide{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-next,.swiper-container-cube .swiper-slide-next+.swiper-slide,.swiper-container-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-container-cube .swiper-slide-shadow-bottom,.swiper-container-cube .swiper-slide-shadow-left,.swiper-container-cube .swiper-slide-shadow-right,.swiper-container-cube .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-cube .swiper-cube-shadow{position:absolute;right:0;bottom:0;width:100%;height:100%;background:#000;opacity:.6;-webkit-filter:blur(50px);filter:blur(50px);z-index:0}.swiper-container-flip{overflow:visible}.swiper-container-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-container-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-flip .swiper-slide-active,.swiper-container-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-flip .swiper-slide-shadow-bottom,.swiper-container-flip .swiper-slide-shadow-left,.swiper-container-flip .swiper-slide-shadow-right,.swiper-container-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-coverflow .swiper-wrapper{-ms-perspective:1200px}.wp-block-newspack-blocks-carousel{position:relative;margin-top:0}.wp-block-newspack-blocks-carousel article{max-width:100%;padding:0;position:relative;margin-bottom:0;word-break:break-word;overflow-wrap:break-word}.wp-block-newspack-blocks-carousel article a{color:inherit}.wp-block-newspack-blocks-carousel article a:active,.wp-block-newspack-blocks-carousel article a:focus,.wp-block-newspack-blocks-carousel article a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.2em}.wp-block-newspack-blocks-carousel article .entry-title a{-webkit-box-orient:vertical;display:-webkit-box;-webkit-line-clamp:3;max-height:3.5625em;overflow:hidden;text-overflow:ellipsis}.wp-block-newspack-blocks-carousel article .avatar{height:1.8em;width:1.8em}@media only screen and (min-width:782px){.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.6em}.wp-block-newspack-blocks-carousel article .avatar{height:40px;width:40px}}.wp-block-newspack-blocks-carousel article .entry-wrapper{bottom:0;background-color:rgba(0,0,0,.5);color:#fff;right:0;padding:1.5em;position:absolute;left:0}.wp-block-newspack-blocks-carousel article .entry-meta{color:inherit;margin-bottom:0;font-size:.8em}.wp-block-newspack-blocks-carousel article .entry-meta a{color:inherit;font-weight:700;text-decoration:none}.wp-block-newspack-blocks-carousel article .entry-meta a:active,.wp-block-newspack-blocks-carousel article .entry-meta a:focus,.wp-block-newspack-blocks-carousel article .entry-meta a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel figure.post-thumbnail{margin:0;height:100%;padding:0}.wp-block-newspack-blocks-carousel figure.post-thumbnail a,.wp-block-newspack-blocks-carousel figure.post-thumbnail img{display:block;height:100%;width:100%}.wp-block-newspack-blocks-carousel p{white-space:normal}.wp-block-newspack-blocks-carousel .swiper-pagination-bullets{align-items:flex-end;bottom:0;display:flex;flex-wrap:wrap;height:calc(1.5em + 12px);justify-content:center;padding:0;position:relative}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet{background:#000;border-radius:6px;display:inline-block;height:12px;margin:0 4px;opacity:.5;padding:0;transition:box-shadow .25s,opacity .25s,width .25s;width:12px}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #000;outline:0}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet.swiper-pagination-bullet-active,.wp-block-newspack-blocks-carousel .swiper-pagination-bullet[selected]{opacity:1;outline:0;width:24px}.wp-block-newspack-blocks-carousel .amp-carousel-button,.wp-block-newspack-blocks-carousel .swiper-button{background-color:rgba(0,0,0,.5);background-position:50%;background-repeat:no-repeat;background-size:24px;border:0;border-radius:4px;box-shadow:none;cursor:pointer;height:48px;margin:0;padding:0;transition:background-color .25s,box-shadow .25s;width:48px}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .amp-carousel-button:hover,.wp-block-newspack-blocks-carousel .swiper-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:hover{background-color:rgba(0,0,0,.75)}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:focus{box-shadow:inset 0 0 0 2px rgba(0,0,0,.75),inset 0 0 0 4px #fff;outline:0}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{right:1.5em;display:none}@media only screen and (min-width:600px){.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{display:block}}.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{margin-top:-24px}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E");right:auto;left:1.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M18 4.12L10.12 12 18 19.88 15.88 22l-10-10 10-10z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");display:none;margin-top:0;position:absolute;left:1.5em;top:1.5em;transform:none;z-index:1}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M8 5v14l11-7z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .swiper-slide{height:auto}.wp-block-newspack-blocks-carousel figcaption{font-size:.6em}.wp-block-newspack-blocks-carousel .entry-title{margin:0 0 .25em}.wp-block-newspack-blocks-carousel .entry-title a{color:inherit;text-decoration:none}.wp-block-newspack-blocks-carousel .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wp-block-newspack-blocks-carousel .entry-meta .byline:not(:last-child){margin-left:1.5em}.wp-block-newspack-blocks-carousel .cat-links{color:inherit;font-size:.6em;font-weight:700;margin:0 0 .5em}.wp-block-newspack-blocks-carousel .cat-links a{text-decoration:none}.wp-block-newspack-blocks-carousel .avatar{border-radius:100%;display:block;margin-left:.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-pause{display:block}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-play{display:none}.wp-block[data-type^="newspack-blocks/"] .component-placeholder__align-center{align-items:center}.wp-block-newspack-blocks-carousel .entry-title{color:#fff}.wp-block-newspack-blocks-carousel a{color:inherit}.wp-block-newspack-blocks-carousel a:active,.wp-block-newspack-blocks-carousel a:focus,.wp-block-newspack-blocks-carousel a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel .post-thumbnail img{display:block}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet.swiper-pagination-bullet-active{opacity:1;width:24px}.wp-block-newspack-blocks-carousel .amp-carousel-button.amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button.amp-carousel-button-prev{right:1.5em;margin-top:-24px;transform:translateY(-50%)}.wp-block-newspack-blocks-carousel .amp-carousel-button.amp-carousel-button-next{right:auto;left:1.5em}.editor-block-list__layout .editor-block-list__block .wp-block-newspack-blocks-carousel .entry-meta .byline a,.editor-block-list__layout .editor-block-list__block .wp-block-newspack-blocks-carousel .entry-title a{color:inherit}
|
newspack-blocks/dist/carousel-block-view.asset.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-dom-ready', 'wp-polyfill'), 'version' => 'c3340b4647730ed4eb17dd5e84c4be51');
|
newspack-blocks/dist/carousel-block-view.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-container-no-flexbox .swiper-slide{float:left}.swiper-container-vertical>.swiper-wrapper{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-container-android .swiper-slide,.swiper-wrapper{-webkit-transform:translateZ(0);transform:translateZ(0)}.swiper-container-multirow>.swiper-wrapper{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.swiper-container-free-mode>.swiper-wrapper{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out;margin:0 auto}.swiper-slide{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-container-autoheight,.swiper-container-autoheight .swiper-slide{height:auto}.swiper-container-autoheight .swiper-wrapper{-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height,-webkit-transform;transition-property:height,-webkit-transform;-o-transition-property:transform,height;transition-property:transform,height;transition-property:transform,height,-webkit-transform}.swiper-container-3d{-webkit-perspective:1200px;perspective:1200px}.swiper-container-3d .swiper-cube-shadow,.swiper-container-3d .swiper-slide,.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top,.swiper-container-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-container-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear,right top,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:linear-gradient(270deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:linear-gradient(90deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear,left bottom,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:linear-gradient(0deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:linear-gradient(180deg,rgba(0,0,0,.5),transparent)}.swiper-container-wp8-horizontal,.swiper-container-wp8-horizontal>.swiper-wrapper{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-container-wp8-vertical,.swiper-container-wp8-vertical>.swiper-wrapper{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:27px;height:44px;margin-top:-22px;z-index:10;cursor:pointer;background-size:27px 44px;background-position:50%;background-repeat:no-repeat}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-prev,.swiper-container-rtl .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23007aff'/%3E%3C/svg%3E");left:10px;right:auto}.swiper-button-next,.swiper-container-rtl .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23007aff'/%3E%3C/svg%3E");right:10px;left:auto}.swiper-button-prev.swiper-button-white,.swiper-container-rtl .swiper-button-next.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-white,.swiper-container-rtl .swiper-button-prev.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-prev.swiper-button-black,.swiper-container-rtl .swiper-button-next.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-black,.swiper-container-rtl .swiper-button-prev.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z'/%3E%3C/svg%3E")}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:opacity .3s;-o-transition:.3s opacity;transition:opacity .3s;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:10px;left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active,.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;border-radius:100%;background:#000;opacity:.2}button.swiper-pagination-bullet{border:none;margin:0;padding:0;-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet-active{opacity:1;background:#007aff}.swiper-container-vertical>.swiper-pagination-bullets{right:10px;top:50%;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:6px 0;display:block}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:8px}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;-webkit-transition:top .2s,-webkit-transform .2s;transition:top .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s top;transition:transform .2s,top .2s;transition:transform .2s,top .2s,-webkit-transform .2s}.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 4px}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);white-space:nowrap}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:left .2s,-webkit-transform .2s;transition:left .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s left;transition:transform .2s,left .2s;transition:transform .2s,left .2s,-webkit-transform .2s}.swiper-container-horizontal.swiper-container-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:right .2s,-webkit-transform .2s;transition:right .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s right;transition:transform .2s,right .2s;transition:transform .2s,right .2s,-webkit-transform .2s}.swiper-pagination-progressbar{background:rgba(0,0,0,.25);position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:#007aff;position:absolute;left:0;top:0;width:100%;height:100%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top}.swiper-container-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{-webkit-transform-origin:right top;-ms-transform-origin:right top;transform-origin:right top}.swiper-container-horizontal>.swiper-pagination-progressbar,.swiper-container-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:4px;left:0;top:0}.swiper-container-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-container-vertical>.swiper-pagination-progressbar{width:4px;height:100%;left:0;top:0}.swiper-pagination-white .swiper-pagination-bullet-active{background:#fff}.swiper-pagination-progressbar.swiper-pagination-white{background:hsla(0,0%,100%,.25)}.swiper-pagination-progressbar.swiper-pagination-white .swiper-pagination-progressbar-fill{background:#fff}.swiper-pagination-black .swiper-pagination-bullet-active{background:#000}.swiper-pagination-progressbar.swiper-pagination-black{background:rgba(0,0,0,.25)}.swiper-pagination-progressbar.swiper-pagination-black .swiper-pagination-progressbar-fill{background:#000}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:10px;position:relative;-ms-touch-action:none;background:rgba(0,0,0,.1)}.swiper-container-horizontal>.swiper-scrollbar{position:absolute;left:1%;bottom:3px;z-index:50;height:5px;width:98%}.swiper-container-vertical>.swiper-scrollbar{position:absolute;right:3px;top:1%;z-index:50;width:5px;height:98%}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:rgba(0,0,0,.5);border-radius:10px;left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}.swiper-slide-zoomed{cursor:move}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-animation:swiper-preloader-spin 1s steps(12) infinite;animation:swiper-preloader-spin 1s steps(12) infinite}.swiper-lazy-preloader:after{display:block;content:"";width:100%;height:100%;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%236c6c6c' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E");background-position:50%;background-size:100%;background-repeat:no-repeat}.swiper-lazy-preloader-white:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%23fff' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E")}@-webkit-keyframes swiper-preloader-spin{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes swiper-preloader-spin{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.swiper-container .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-container-fade.swiper-container-free-mode .swiper-slide{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out}.swiper-container-fade .swiper-slide{pointer-events:none;-webkit-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity}.swiper-container-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-fade .swiper-slide-active,.swiper-container-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube{overflow:visible}.swiper-container-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;width:100%;height:100%}.swiper-container-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-cube.swiper-container-rtl .swiper-slide{-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-next,.swiper-container-cube .swiper-slide-next+.swiper-slide,.swiper-container-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-container-cube .swiper-slide-shadow-bottom,.swiper-container-cube .swiper-slide-shadow-left,.swiper-container-cube .swiper-slide-shadow-right,.swiper-container-cube .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0;width:100%;height:100%;background:#000;opacity:.6;-webkit-filter:blur(50px);filter:blur(50px);z-index:0}.swiper-container-flip{overflow:visible}.swiper-container-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-container-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-flip .swiper-slide-active,.swiper-container-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-flip .swiper-slide-shadow-bottom,.swiper-container-flip .swiper-slide-shadow-left,.swiper-container-flip .swiper-slide-shadow-right,.swiper-container-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-coverflow .swiper-wrapper{-ms-perspective:1200px}.wp-block-newspack-blocks-carousel{position:relative;margin-top:0}.wp-block-newspack-blocks-carousel article{max-width:100%;padding:0;position:relative;margin-bottom:0;word-break:break-word;overflow-wrap:break-word}.wp-block-newspack-blocks-carousel article a{color:inherit}.wp-block-newspack-blocks-carousel article a:active,.wp-block-newspack-blocks-carousel article a:focus,.wp-block-newspack-blocks-carousel article a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.2em}.wp-block-newspack-blocks-carousel article .entry-title a{-webkit-box-orient:vertical;display:-webkit-box;-webkit-line-clamp:3;max-height:3.5625em;overflow:hidden;text-overflow:ellipsis}.wp-block-newspack-blocks-carousel article .avatar{height:1.8em;width:1.8em}@media only screen and (min-width:782px){.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.6em}.wp-block-newspack-blocks-carousel article .avatar{height:40px;width:40px}}.wp-block-newspack-blocks-carousel article .entry-wrapper{bottom:0;background-color:rgba(0,0,0,.5);color:#fff;left:0;padding:1.5em;position:absolute;right:0}.wp-block-newspack-blocks-carousel article .entry-meta{color:inherit;margin-bottom:0;font-size:.8em}.wp-block-newspack-blocks-carousel article .entry-meta a{color:inherit;font-weight:700;text-decoration:none}.wp-block-newspack-blocks-carousel article .entry-meta a:active,.wp-block-newspack-blocks-carousel article .entry-meta a:focus,.wp-block-newspack-blocks-carousel article .entry-meta a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel figure.post-thumbnail{margin:0;height:100%;padding:0}.wp-block-newspack-blocks-carousel figure.post-thumbnail a,.wp-block-newspack-blocks-carousel figure.post-thumbnail img{display:block;height:100%;width:100%}.wp-block-newspack-blocks-carousel p{white-space:normal}.wp-block-newspack-blocks-carousel .swiper-pagination-bullets{align-items:flex-end;bottom:0;display:flex;flex-wrap:wrap;height:calc(1.5em + 12px);justify-content:center;padding:0;position:relative}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet{background:#000;border-radius:6px;display:inline-block;height:12px;margin:0 4px;opacity:.5;padding:0;transition:box-shadow .25s,opacity .25s,width .25s;width:12px}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #000;outline:0}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet.swiper-pagination-bullet-active,.wp-block-newspack-blocks-carousel .swiper-pagination-bullet[selected]{opacity:1;outline:0;width:24px}.wp-block-newspack-blocks-carousel .amp-carousel-button,.wp-block-newspack-blocks-carousel .swiper-button{background-color:rgba(0,0,0,.5);background-position:50%;background-repeat:no-repeat;background-size:24px;border:0;border-radius:4px;box-shadow:none;cursor:pointer;height:48px;margin:0;padding:0;transition:background-color .25s,box-shadow .25s;width:48px}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .amp-carousel-button:hover,.wp-block-newspack-blocks-carousel .swiper-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:hover{background-color:rgba(0,0,0,.75)}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:focus{box-shadow:inset 0 0 0 2px rgba(0,0,0,.75),inset 0 0 0 4px #fff;outline:0}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{left:1.5em;display:none}@media only screen and (min-width:600px){.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{display:block}}.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{margin-top:-24px}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E");left:auto;right:1.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M18 4.12L10.12 12 18 19.88 15.88 22l-10-10 10-10z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");display:none;margin-top:0;position:absolute;right:1.5em;top:1.5em;transform:none;z-index:1}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M8 5v14l11-7z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .swiper-slide{height:auto}.wp-block-newspack-blocks-carousel figcaption{font-size:.6em}.wp-block-newspack-blocks-carousel .entry-title{margin:0 0 .25em}.wp-block-newspack-blocks-carousel .entry-title a{color:inherit;text-decoration:none}.wp-block-newspack-blocks-carousel .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wp-block-newspack-blocks-carousel .entry-meta .byline:not(:last-child){margin-right:1.5em}.wp-block-newspack-blocks-carousel .cat-links{color:inherit;font-size:.6em;font-weight:700;margin:0 0 .5em}.wp-block-newspack-blocks-carousel .cat-links a{text-decoration:none}.wp-block-newspack-blocks-carousel .avatar{border-radius:100%;display:block;margin-right:.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-pause{display:block}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-play{display:none}
|
newspack-blocks/dist/carousel-block-view.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,t){for(var s in t)e[s]=t[s]}(window,function(e){var t={};function s(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,s),a.l=!0,a.exports}return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)s.d(i,a,function(t){return e[t]}.bind(null,a));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=4)}([function(e,t){!function(){e.exports=this.wp.domReady}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t,s){},function(e,t,s){},function(e,t,s){"use strict";s.r(t);var i=s(0),a=s.n(i),n=s(1),r="undefined"==typeof document?{body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},location:{hash:""}}:document,l="undefined"==typeof window?{document:r,navigator:{userAgent:""},location:{},history:{},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){}}:window;class o{constructor(e){const t=this;for(let s=0;s<e.length;s+=1)t[s]=e[s];return t.length=e.length,this}}function d(e,t){const s=[];let i=0;if(e&&!t&&e instanceof o)return e;if(e)if("string"==typeof e){let a,n;const l=e.trim();if(l.indexOf("<")>=0&&l.indexOf(">")>=0){let e="div";for(0===l.indexOf("<li")&&(e="ul"),0===l.indexOf("<tr")&&(e="tbody"),0!==l.indexOf("<td")&&0!==l.indexOf("<th")||(e="tr"),0===l.indexOf("<tbody")&&(e="table"),0===l.indexOf("<option")&&(e="select"),n=r.createElement(e),n.innerHTML=l,i=0;i<n.childNodes.length;i+=1)s.push(n.childNodes[i])}else for(a=t||"#"!==e[0]||e.match(/[ .<>:~]/)?(t||r).querySelectorAll(e.trim()):[r.getElementById(e.trim().split("#")[1])],i=0;i<a.length;i+=1)a[i]&&s.push(a[i])}else if(e.nodeType||e===l||e===r)s.push(e);else if(e.length>0&&e[0].nodeType)for(i=0;i<e.length;i+=1)s.push(e[i]);return new o(s)}function p(e){const t=[];for(let s=0;s<e.length;s+=1)-1===t.indexOf(e[s])&&t.push(e[s]);return t}d.fn=o.prototype,d.Class=o,d.Dom7=o;"resize scroll".split(" ");const c={addClass:function(e){if(void 0===e)return this;const t=e.split(" ");for(let s=0;s<t.length;s+=1)for(let e=0;e<this.length;e+=1)void 0!==this[e]&&void 0!==this[e].classList&&this[e].classList.add(t[s]);return this},removeClass:function(e){const t=e.split(" ");for(let s=0;s<t.length;s+=1)for(let e=0;e<this.length;e+=1)void 0!==this[e]&&void 0!==this[e].classList&&this[e].classList.remove(t[s]);return this},hasClass:function(e){return!!this[0]&&this[0].classList.contains(e)},toggleClass:function(e){const t=e.split(" ");for(let s=0;s<t.length;s+=1)for(let e=0;e<this.length;e+=1)void 0!==this[e]&&void 0!==this[e].classList&&this[e].classList.toggle(t[s]);return this},attr:function(e,t){if(1===arguments.length&&"string"==typeof e)return this[0]?this[0].getAttribute(e):void 0;for(let s=0;s<this.length;s+=1)if(2===arguments.length)this[s].setAttribute(e,t);else for(const t in e)this[s][t]=e[t],this[s].setAttribute(t,e[t]);return this},removeAttr:function(e){for(let t=0;t<this.length;t+=1)this[t].removeAttribute(e);return this},data:function(e,t){let s;if(void 0!==t){for(let i=0;i<this.length;i+=1)s=this[i],s.dom7ElementDataStorage||(s.dom7ElementDataStorage={}),s.dom7ElementDataStorage[e]=t;return this}if(s=this[0],s){if(s.dom7ElementDataStorage&&e in s.dom7ElementDataStorage)return s.dom7ElementDataStorage[e];const t=s.getAttribute("data-"+e);return t||void 0}},transform:function(e){for(let t=0;t<this.length;t+=1){const s=this[t].style;s.webkitTransform=e,s.transform=e}return this},transition:function(e){"string"!=typeof e&&(e+="ms");for(let t=0;t<this.length;t+=1){const s=this[t].style;s.webkitTransitionDuration=e,s.transitionDuration=e}return this},on:function(...e){let[t,s,i,a]=e;function n(e){const t=e.target;if(!t)return;const a=e.target.dom7EventData||[];if(a.indexOf(e)<0&&a.unshift(e),d(t).is(s))i.apply(t,a);else{const e=d(t).parents();for(let t=0;t<e.length;t+=1)d(e[t]).is(s)&&i.apply(e[t],a)}}function r(e){const t=e&&e.target&&e.target.dom7EventData||[];t.indexOf(e)<0&&t.unshift(e),i.apply(this,t)}"function"==typeof e[1]&&([t,i,a]=e,s=void 0),a||(a=!1);const l=t.split(" ");let o;for(let d=0;d<this.length;d+=1){const e=this[d];if(s)for(o=0;o<l.length;o+=1){const t=l[o];e.dom7LiveListeners||(e.dom7LiveListeners={}),e.dom7LiveListeners[t]||(e.dom7LiveListeners[t]=[]),e.dom7LiveListeners[t].push({listener:i,proxyListener:n}),e.addEventListener(t,n,a)}else for(o=0;o<l.length;o+=1){const t=l[o];e.dom7Listeners||(e.dom7Listeners={}),e.dom7Listeners[t]||(e.dom7Listeners[t]=[]),e.dom7Listeners[t].push({listener:i,proxyListener:r}),e.addEventListener(t,r,a)}}return this},off:function(...e){let[t,s,i,a]=e;"function"==typeof e[1]&&([t,i,a]=e,s=void 0),a||(a=!1);const n=t.split(" ");for(let r=0;r<n.length;r+=1){const e=n[r];for(let t=0;t<this.length;t+=1){const n=this[t];let r;if(!s&&n.dom7Listeners?r=n.dom7Listeners[e]:s&&n.dom7LiveListeners&&(r=n.dom7LiveListeners[e]),r&&r.length)for(let t=r.length-1;t>=0;t-=1){const s=r[t];i&&s.listener===i||i&&s.listener&&s.listener.dom7proxy&&s.listener.dom7proxy===i?(n.removeEventListener(e,s.proxyListener,a),r.splice(t,1)):i||(n.removeEventListener(e,s.proxyListener,a),r.splice(t,1))}}}return this},trigger:function(...e){const t=e[0].split(" "),s=e[1];for(let a=0;a<t.length;a+=1){const n=t[a];for(let t=0;t<this.length;t+=1){const a=this[t];let o;try{o=new l.CustomEvent(n,{detail:s,bubbles:!0,cancelable:!0})}catch(i){o=r.createEvent("Event"),o.initEvent(n,!0,!0),o.detail=s}a.dom7EventData=e.filter((e,t)=>t>0),a.dispatchEvent(o),a.dom7EventData=[],delete a.dom7EventData}}return this},transitionEnd:function(e){const t=["webkitTransitionEnd","transitionend"],s=this;let i;function a(n){if(n.target===this)for(e.call(this,n),i=0;i<t.length;i+=1)s.off(t[i],a)}if(e)for(i=0;i<t.length;i+=1)s.on(t[i],a);return this},outerWidth:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},outerHeight:function(e){if(this.length>0){if(e){const e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},offset:function(){if(this.length>0){const e=this[0],t=e.getBoundingClientRect(),s=r.body,i=e.clientTop||s.clientTop||0,a=e.clientLeft||s.clientLeft||0,n=e===l?l.scrollY:e.scrollTop,o=e===l?l.scrollX:e.scrollLeft;return{top:t.top+n-i,left:t.left+o-a}}return null},css:function(e,t){let s;if(1===arguments.length){if("string"!=typeof e){for(s=0;s<this.length;s+=1)for(let t in e)this[s].style[t]=e[t];return this}if(this[0])return l.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(s=0;s<this.length;s+=1)this[s].style[e]=t;return this}return this},each:function(e){if(!e)return this;for(let t=0;t<this.length;t+=1)if(!1===e.call(this[t],t,this[t]))return this;return this},html:function(e){if(void 0===e)return this[0]?this[0].innerHTML:void 0;for(let t=0;t<this.length;t+=1)this[t].innerHTML=e;return this},text:function(e){if(void 0===e)return this[0]?this[0].textContent.trim():null;for(let t=0;t<this.length;t+=1)this[t].textContent=e;return this},is:function(e){const t=this[0];let s,i;if(!t||void 0===e)return!1;if("string"==typeof e){if(t.matches)return t.matches(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);for(s=d(e),i=0;i<s.length;i+=1)if(s[i]===t)return!0;return!1}if(e===r)return t===r;if(e===l)return t===l;if(e.nodeType||e instanceof o){for(s=e.nodeType?[e]:e,i=0;i<s.length;i+=1)if(s[i]===t)return!0;return!1}return!1},index:function(){let e,t=this[0];if(t){for(e=0;null!==(t=t.previousSibling);)1===t.nodeType&&(e+=1);return e}},eq:function(e){if(void 0===e)return this;const t=this.length;let s;return e>t-1?new o([]):e<0?(s=t+e,new o(s<0?[]:[this[s]])):new o([this[e]])},append:function(...e){let t;for(let s=0;s<e.length;s+=1){t=e[s];for(let e=0;e<this.length;e+=1)if("string"==typeof t){const s=r.createElement("div");for(s.innerHTML=t;s.firstChild;)this[e].appendChild(s.firstChild)}else if(t instanceof o)for(let s=0;s<t.length;s+=1)this[e].appendChild(t[s]);else this[e].appendChild(t)}return this},prepend:function(e){let t,s;for(t=0;t<this.length;t+=1)if("string"==typeof e){const i=r.createElement("div");for(i.innerHTML=e,s=i.childNodes.length-1;s>=0;s-=1)this[t].insertBefore(i.childNodes[s],this[t].childNodes[0])}else if(e instanceof o)for(s=0;s<e.length;s+=1)this[t].insertBefore(e[s],this[t].childNodes[0]);else this[t].insertBefore(e,this[t].childNodes[0]);return this},next:function(e){return this.length>0?e?this[0].nextElementSibling&&d(this[0].nextElementSibling).is(e)?new o([this[0].nextElementSibling]):new o([]):this[0].nextElementSibling?new o([this[0].nextElementSibling]):new o([]):new o([])},nextAll:function(e){const t=[];let s=this[0];if(!s)return new o([]);for(;s.nextElementSibling;){const i=s.nextElementSibling;e?d(i).is(e)&&t.push(i):t.push(i),s=i}return new o(t)},prev:function(e){if(this.length>0){const t=this[0];return e?t.previousElementSibling&&d(t.previousElementSibling).is(e)?new o([t.previousElementSibling]):new o([]):t.previousElementSibling?new o([t.previousElementSibling]):new o([])}return new o([])},prevAll:function(e){const t=[];let s=this[0];if(!s)return new o([]);for(;s.previousElementSibling;){const i=s.previousElementSibling;e?d(i).is(e)&&t.push(i):t.push(i),s=i}return new o(t)},parent:function(e){const t=[];for(let s=0;s<this.length;s+=1)null!==this[s].parentNode&&(e?d(this[s].parentNode).is(e)&&t.push(this[s].parentNode):t.push(this[s].parentNode));return d(p(t))},parents:function(e){const t=[];for(let s=0;s<this.length;s+=1){let i=this[s].parentNode;for(;i;)e?d(i).is(e)&&t.push(i):t.push(i),i=i.parentNode}return d(p(t))},closest:function(e){let t=this;return void 0===e?new o([]):(t.is(e)||(t=t.parents(e).eq(0)),t)},find:function(e){const t=[];for(let s=0;s<this.length;s+=1){const i=this[s].querySelectorAll(e);for(let e=0;e<i.length;e+=1)t.push(i[e])}return new o(t)},children:function(e){const t=[];for(let s=0;s<this.length;s+=1){const i=this[s].childNodes;for(let s=0;s<i.length;s+=1)e?1===i[s].nodeType&&d(i[s]).is(e)&&t.push(i[s]):1===i[s].nodeType&&t.push(i[s])}return new o(p(t))},remove:function(){for(let e=0;e<this.length;e+=1)this[e].parentNode&&this[e].parentNode.removeChild(this[e]);return this},add:function(...e){const t=this;let s,i;for(s=0;s<e.length;s+=1){const a=d(e[s]);for(i=0;i<a.length;i+=1)t[t.length]=a[i],t.length+=1}return t},styles:function(){return this[0]?l.getComputedStyle(this[0],null):{}}};Object.keys(c).forEach(e=>{d.fn[e]=d.fn[e]||c[e]});const h={deleteProps(e){const t=e;Object.keys(t).forEach(e=>{try{t[e]=null}catch(s){}try{delete t[e]}catch(s){}})},nextTick:(e,t=0)=>setTimeout(e,t),now:()=>Date.now(),getTranslate(e,t="x"){let s,i,a;const n=l.getComputedStyle(e,null);return l.WebKitCSSMatrix?(i=n.transform||n.webkitTransform,i.split(",").length>6&&(i=i.split(", ").map(e=>e.replace(",",".")).join(", ")),a=new l.WebKitCSSMatrix("none"===i?"":i)):(a=n.MozTransform||n.OTransform||n.MsTransform||n.msTransform||n.transform||n.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),s=a.toString().split(",")),"x"===t&&(i=l.WebKitCSSMatrix?a.m41:16===s.length?parseFloat(s[12]):parseFloat(s[4])),"y"===t&&(i=l.WebKitCSSMatrix?a.m42:16===s.length?parseFloat(s[13]):parseFloat(s[5])),i||0},parseUrlQuery(e){const t={};let s,i,a,n,r=e||l.location.href;if("string"==typeof r&&r.length)for(r=r.indexOf("?")>-1?r.replace(/\S*\?/,""):"",i=r.split("&").filter(e=>""!==e),n=i.length,s=0;s<n;s+=1)a=i[s].replace(/#\S+/g,"").split("="),t[decodeURIComponent(a[0])]=void 0===a[1]?void 0:decodeURIComponent(a[1])||"";return t},isObject:e=>"object"==typeof e&&null!==e&&e.constructor&&e.constructor===Object,extend(...e){const t=Object(e[0]);for(let s=1;s<e.length;s+=1){const i=e[s];if(null!=i){const e=Object.keys(Object(i));for(let s=0,a=e.length;s<a;s+=1){const a=e[s],n=Object.getOwnPropertyDescriptor(i,a);void 0!==n&&n.enumerable&&(h.isObject(t[a])&&h.isObject(i[a])?h.extend(t[a],i[a]):!h.isObject(t[a])&&h.isObject(i[a])?(t[a]={},h.extend(t[a],i[a])):t[a]=i[a])}}}return t}},u=function(){const e=r.createElement("div");return{touch:l.Modernizr&&!0===l.Modernizr.touch||!!(l.navigator.maxTouchPoints>0||"ontouchstart"in l||l.DocumentTouch&&r instanceof l.DocumentTouch),pointerEvents:!!(l.navigator.pointerEnabled||l.PointerEvent||"maxTouchPoints"in l.navigator&&l.navigator.maxTouchPoints>0),prefixedPointerEvents:!!l.navigator.msPointerEnabled,transition:function(){const t=e.style;return"transition"in t||"webkitTransition"in t||"MozTransition"in t}(),transforms3d:l.Modernizr&&!0===l.Modernizr.csstransforms3d||function(){const t=e.style;return"webkitPerspective"in t||"MozPerspective"in t||"OPerspective"in t||"MsPerspective"in t||"perspective"in t}(),flexbox:function(){const t=e.style,s="alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient".split(" ");for(let e=0;e<s.length;e+=1)if(s[e]in t)return!0;return!1}(),observer:"MutationObserver"in l||"WebkitMutationObserver"in l,passiveListener:function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get(){e=!0}});l.addEventListener("testPassiveListener",null,t)}catch(t){}return e}(),gestures:"ongesturestart"in l}}(),m={isIE:!!l.navigator.userAgent.match(/Trident/g)||!!l.navigator.userAgent.match(/MSIE/g),isEdge:!!l.navigator.userAgent.match(/Edge/g),isSafari:function(){const e=l.navigator.userAgent.toLowerCase();return e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0}(),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(l.navigator.userAgent)};class f{constructor(e={}){const t=this;t.params=e,t.eventsListeners={},t.params&&t.params.on&&Object.keys(t.params.on).forEach(e=>{t.on(e,t.params.on[e])})}on(e,t,s){const i=this;if("function"!=typeof t)return i;const a=s?"unshift":"push";return e.split(" ").forEach(e=>{i.eventsListeners[e]||(i.eventsListeners[e]=[]),i.eventsListeners[e][a](t)}),i}once(e,t,s){const i=this;if("function"!=typeof t)return i;function a(...s){t.apply(i,s),i.off(e,a),a.f7proxy&&delete a.f7proxy}return a.f7proxy=t,i.on(e,a,s)}off(e,t){const s=this;return s.eventsListeners?(e.split(" ").forEach(e=>{void 0===t?s.eventsListeners[e]=[]:s.eventsListeners[e]&&s.eventsListeners[e].length&&s.eventsListeners[e].forEach((i,a)=>{(i===t||i.f7proxy&&i.f7proxy===t)&&s.eventsListeners[e].splice(a,1)})}),s):s}emit(...e){const t=this;if(!t.eventsListeners)return t;let s,i,a;return"string"==typeof e[0]||Array.isArray(e[0])?(s=e[0],i=e.slice(1,e.length),a=t):(s=e[0].events,i=e[0].data,a=e[0].context||t),(Array.isArray(s)?s:s.split(" ")).forEach(e=>{if(t.eventsListeners&&t.eventsListeners[e]){const s=[];t.eventsListeners[e].forEach(e=>{s.push(e)}),s.forEach(e=>{e.apply(a,i)})}}),t}useModulesParams(e){const t=this;t.modules&&Object.keys(t.modules).forEach(s=>{const i=t.modules[s];i.params&&h.extend(e,i.params)})}useModules(e={}){const t=this;t.modules&&Object.keys(t.modules).forEach(s=>{const i=t.modules[s],a=e[s]||{};i.instance&&Object.keys(i.instance).forEach(e=>{const s=i.instance[e];t[e]="function"==typeof s?s.bind(t):s}),i.on&&t.on&&Object.keys(i.on).forEach(e=>{t.on(e,i.on[e])}),i.create&&i.create.bind(t)(a)})}static set components(e){this.use&&this.use(e)}static installModule(e,...t){const s=this;s.prototype.modules||(s.prototype.modules={});const i=e.name||`${Object.keys(s.prototype.modules).length}_${h.now()}`;return s.prototype.modules[i]=e,e.proto&&Object.keys(e.proto).forEach(t=>{s.prototype[t]=e.proto[t]}),e.static&&Object.keys(e.static).forEach(t=>{s[t]=e.static[t]}),e.install&&e.install.apply(s,t),s}static use(e,...t){const s=this;return Array.isArray(e)?(e.forEach(e=>s.installModule(e)),s):s.installModule(e,...t)}}var g={updateSize:function(){const e=this;let t,s;const i=e.$el;t=void 0!==e.params.width?e.params.width:i[0].clientWidth,s=void 0!==e.params.height?e.params.height:i[0].clientHeight,0===t&&e.isHorizontal()||0===s&&e.isVertical()||(t=t-parseInt(i.css("padding-left"),10)-parseInt(i.css("padding-right"),10),s=s-parseInt(i.css("padding-top"),10)-parseInt(i.css("padding-bottom"),10),h.extend(e,{width:t,height:s,size:e.isHorizontal()?t:s}))},updateSlides:function(){const e=this,t=e.params,{$wrapperEl:s,size:i,rtlTranslate:a,wrongRTL:n}=e,r=e.virtual&&t.virtual.enabled,o=r?e.virtual.slides.length:e.slides.length,d=s.children("."+e.params.slideClass),p=r?e.virtual.slides.length:d.length;let c=[];const f=[],g=[];let v=t.slidesOffsetBefore;"function"==typeof v&&(v=t.slidesOffsetBefore.call(e));let b=t.slidesOffsetAfter;"function"==typeof b&&(b=t.slidesOffsetAfter.call(e));const w=e.snapGrid.length,y=e.snapGrid.length;let x,T,E=t.spaceBetween,S=-v,C=0,$=0;if(void 0===i)return;"string"==typeof E&&E.indexOf("%")>=0&&(E=parseFloat(E.replace("%",""))/100*i),e.virtualSize=-E,a?d.css({marginLeft:"",marginTop:""}):d.css({marginRight:"",marginBottom:""}),t.slidesPerColumn>1&&(x=Math.floor(p/t.slidesPerColumn)===p/e.params.slidesPerColumn?p:Math.ceil(p/t.slidesPerColumn)*t.slidesPerColumn,"auto"!==t.slidesPerView&&"row"===t.slidesPerColumnFill&&(x=Math.max(x,t.slidesPerView*t.slidesPerColumn)));const M=t.slidesPerColumn,P=x/M,k=Math.floor(p/t.slidesPerColumn);for(let h=0;h<p;h+=1){T=0;const s=d.eq(h);if(t.slidesPerColumn>1){let i,a,n;if("column"===t.slidesPerColumnFill||"row"===t.slidesPerColumnFill&&t.slidesPerGroup>1){if("column"===t.slidesPerColumnFill)a=Math.floor(h/M),n=h-a*M,(a>k||a===k&&n===M-1)&&(n+=1,n>=M&&(n=0,a+=1));else{const e=Math.floor(h/t.slidesPerGroup);n=Math.floor(h/t.slidesPerView)-e*t.slidesPerColumn,a=h-n*t.slidesPerView-e*t.slidesPerView}i=a+n*x/M,s.css({"-webkit-box-ordinal-group":i,"-moz-box-ordinal-group":i,"-ms-flex-order":i,"-webkit-order":i,order:i})}else n=Math.floor(h/P),a=h-n*P;s.css("margin-"+(e.isHorizontal()?"top":"left"),0!==n&&t.spaceBetween&&t.spaceBetween+"px").attr("data-swiper-column",a).attr("data-swiper-row",n)}if("none"!==s.css("display")){if("auto"===t.slidesPerView){const i=l.getComputedStyle(s[0],null),a=s[0].style.transform,n=s[0].style.webkitTransform;if(a&&(s[0].style.transform="none"),n&&(s[0].style.webkitTransform="none"),t.roundLengths)T=e.isHorizontal()?s.outerWidth(!0):s.outerHeight(!0);else if(e.isHorizontal()){const e=parseFloat(i.getPropertyValue("width")),t=parseFloat(i.getPropertyValue("padding-left")),s=parseFloat(i.getPropertyValue("padding-right")),a=parseFloat(i.getPropertyValue("margin-left")),n=parseFloat(i.getPropertyValue("margin-right")),r=i.getPropertyValue("box-sizing");T=r&&"border-box"===r&&!m.isIE?e+a+n:e+t+s+a+n}else{const e=parseFloat(i.getPropertyValue("height")),t=parseFloat(i.getPropertyValue("padding-top")),s=parseFloat(i.getPropertyValue("padding-bottom")),a=parseFloat(i.getPropertyValue("margin-top")),n=parseFloat(i.getPropertyValue("margin-bottom")),r=i.getPropertyValue("box-sizing");T=r&&"border-box"===r&&!m.isIE?e+a+n:e+t+s+a+n}a&&(s[0].style.transform=a),n&&(s[0].style.webkitTransform=n),t.roundLengths&&(T=Math.floor(T))}else T=(i-(t.slidesPerView-1)*E)/t.slidesPerView,t.roundLengths&&(T=Math.floor(T)),d[h]&&(e.isHorizontal()?d[h].style.width=T+"px":d[h].style.height=T+"px");d[h]&&(d[h].swiperSlideSize=T),g.push(T),t.centeredSlides?(S=S+T/2+C/2+E,0===C&&0!==h&&(S=S-i/2-E),0===h&&(S=S-i/2-E),Math.abs(S)<.001&&(S=0),t.roundLengths&&(S=Math.floor(S)),$%t.slidesPerGroup==0&&c.push(S),f.push(S)):(t.roundLengths&&(S=Math.floor(S)),$%t.slidesPerGroup==0&&c.push(S),f.push(S),S=S+T+E),e.virtualSize+=T+E,C=T,$+=1}}let z;if(e.virtualSize=Math.max(e.virtualSize,i)+b,a&&n&&("slide"===t.effect||"coverflow"===t.effect)&&s.css({width:e.virtualSize+t.spaceBetween+"px"}),u.flexbox&&!t.setWrapperSize||(e.isHorizontal()?s.css({width:e.virtualSize+t.spaceBetween+"px"}):s.css({height:e.virtualSize+t.spaceBetween+"px"})),t.slidesPerColumn>1&&(e.virtualSize=(T+t.spaceBetween)*x,e.virtualSize=Math.ceil(e.virtualSize/t.slidesPerColumn)-t.spaceBetween,e.isHorizontal()?s.css({width:e.virtualSize+t.spaceBetween+"px"}):s.css({height:e.virtualSize+t.spaceBetween+"px"}),t.centeredSlides)){z=[];for(let s=0;s<c.length;s+=1){let i=c[s];t.roundLengths&&(i=Math.floor(i)),c[s]<e.virtualSize+c[0]&&z.push(i)}c=z}if(!t.centeredSlides){z=[];for(let s=0;s<c.length;s+=1){let a=c[s];t.roundLengths&&(a=Math.floor(a)),c[s]<=e.virtualSize-i&&z.push(a)}c=z,Math.floor(e.virtualSize-i)-Math.floor(c[c.length-1])>1&&c.push(e.virtualSize-i)}if(0===c.length&&(c=[0]),0!==t.spaceBetween&&(e.isHorizontal()?a?d.css({marginLeft:E+"px"}):d.css({marginRight:E+"px"}):d.css({marginBottom:E+"px"})),t.centerInsufficientSlides){let e=0;if(g.forEach(s=>{e+=s+(t.spaceBetween?t.spaceBetween:0)}),e-=t.spaceBetween,e<i){const t=(i-e)/2;c.forEach((e,s)=>{c[s]=e-t}),f.forEach((e,s)=>{f[s]=e+t})}}h.extend(e,{slides:d,snapGrid:c,slidesGrid:f,slidesSizesGrid:g}),p!==o&&e.emit("slidesLengthChange"),c.length!==w&&(e.params.watchOverflow&&e.checkOverflow(),e.emit("snapGridLengthChange")),f.length!==y&&e.emit("slidesGridLengthChange"),(t.watchSlidesProgress||t.watchSlidesVisibility)&&e.updateSlidesOffset()},updateAutoHeight:function(e){const t=this,s=[];let i,a=0;if("number"==typeof e?t.setTransition(e):!0===e&&t.setTransition(t.params.speed),"auto"!==t.params.slidesPerView&&t.params.slidesPerView>1)for(i=0;i<Math.ceil(t.params.slidesPerView);i+=1){const e=t.activeIndex+i;if(e>t.slides.length)break;s.push(t.slides.eq(e)[0])}else s.push(t.slides.eq(t.activeIndex)[0]);for(i=0;i<s.length;i+=1)if(void 0!==s[i]){const e=s[i].offsetHeight;a=e>a?e:a}a&&t.$wrapperEl.css("height",a+"px")},updateSlidesOffset:function(){const e=this,t=e.slides;for(let s=0;s<t.length;s+=1)t[s].swiperSlideOffset=e.isHorizontal()?t[s].offsetLeft:t[s].offsetTop},updateSlidesProgress:function(e=this&&this.translate||0){const t=this,s=t.params,{slides:i,rtlTranslate:a}=t;if(0===i.length)return;void 0===i[0].swiperSlideOffset&&t.updateSlidesOffset();let n=-e;a&&(n=e),i.removeClass(s.slideVisibleClass),t.visibleSlidesIndexes=[],t.visibleSlides=[];for(let r=0;r<i.length;r+=1){const e=i[r],l=(n+(s.centeredSlides?t.minTranslate():0)-e.swiperSlideOffset)/(e.swiperSlideSize+s.spaceBetween);if(s.watchSlidesVisibility){const a=-(n-e.swiperSlideOffset),l=a+t.slidesSizesGrid[r];(a>=0&&a<t.size-1||l>1&&l<=t.size||a<=0&&l>=t.size)&&(t.visibleSlides.push(e),t.visibleSlidesIndexes.push(r),i.eq(r).addClass(s.slideVisibleClass))}e.progress=a?-l:l}t.visibleSlides=d(t.visibleSlides)},updateProgress:function(e=this&&this.translate||0){const t=this,s=t.params,i=t.maxTranslate()-t.minTranslate();let{progress:a,isBeginning:n,isEnd:r}=t;const l=n,o=r;0===i?(a=0,n=!0,r=!0):(a=(e-t.minTranslate())/i,n=a<=0,r=a>=1),h.extend(t,{progress:a,isBeginning:n,isEnd:r}),(s.watchSlidesProgress||s.watchSlidesVisibility)&&t.updateSlidesProgress(e),n&&!l&&t.emit("reachBeginning toEdge"),r&&!o&&t.emit("reachEnd toEdge"),(l&&!n||o&&!r)&&t.emit("fromEdge"),t.emit("progress",a)},updateSlidesClasses:function(){const e=this,{slides:t,params:s,$wrapperEl:i,activeIndex:a,realIndex:n}=e,r=e.virtual&&s.virtual.enabled;let l;t.removeClass(`${s.slideActiveClass} ${s.slideNextClass} ${s.slidePrevClass} ${s.slideDuplicateActiveClass} ${s.slideDuplicateNextClass} ${s.slideDuplicatePrevClass}`),l=r?e.$wrapperEl.find(`.${s.slideClass}[data-swiper-slide-index="${a}"]`):t.eq(a),l.addClass(s.slideActiveClass),s.loop&&(l.hasClass(s.slideDuplicateClass)?i.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${n}"]`).addClass(s.slideDuplicateActiveClass):i.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${n}"]`).addClass(s.slideDuplicateActiveClass));let o=l.nextAll("."+s.slideClass).eq(0).addClass(s.slideNextClass);s.loop&&0===o.length&&(o=t.eq(0),o.addClass(s.slideNextClass));let d=l.prevAll("."+s.slideClass).eq(0).addClass(s.slidePrevClass);s.loop&&0===d.length&&(d=t.eq(-1),d.addClass(s.slidePrevClass)),s.loop&&(o.hasClass(s.slideDuplicateClass)?i.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${o.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicateNextClass):i.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${o.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicateNextClass),d.hasClass(s.slideDuplicateClass)?i.children(`.${s.slideClass}:not(.${s.slideDuplicateClass})[data-swiper-slide-index="${d.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicatePrevClass):i.children(`.${s.slideClass}.${s.slideDuplicateClass}[data-swiper-slide-index="${d.attr("data-swiper-slide-index")}"]`).addClass(s.slideDuplicatePrevClass))},updateActiveIndex:function(e){const t=this,s=t.rtlTranslate?t.translate:-t.translate,{slidesGrid:i,snapGrid:a,params:n,activeIndex:r,realIndex:l,snapIndex:o}=t;let d,p=e;if(void 0===p){for(let e=0;e<i.length;e+=1)void 0!==i[e+1]?s>=i[e]&&s<i[e+1]-(i[e+1]-i[e])/2?p=e:s>=i[e]&&s<i[e+1]&&(p=e+1):s>=i[e]&&(p=e);n.normalizeSlideIndex&&(p<0||void 0===p)&&(p=0)}if(d=a.indexOf(s)>=0?a.indexOf(s):Math.floor(p/n.slidesPerGroup),d>=a.length&&(d=a.length-1),p===r)return void(d!==o&&(t.snapIndex=d,t.emit("snapIndexChange")));const c=parseInt(t.slides.eq(p).attr("data-swiper-slide-index")||p,10);h.extend(t,{snapIndex:d,realIndex:c,previousIndex:r,activeIndex:p}),t.emit("activeIndexChange"),t.emit("snapIndexChange"),l!==c&&t.emit("realIndexChange"),(t.initialized||t.runCallbacksOnInit)&&t.emit("slideChange")},updateClickedSlide:function(e){const t=this,s=t.params,i=d(e.target).closest("."+s.slideClass)[0];let a=!1;if(i)for(let n=0;n<t.slides.length;n+=1)t.slides[n]===i&&(a=!0);if(!i||!a)return t.clickedSlide=void 0,void(t.clickedIndex=void 0);t.clickedSlide=i,t.virtual&&t.params.virtual.enabled?t.clickedIndex=parseInt(d(i).attr("data-swiper-slide-index"),10):t.clickedIndex=d(i).index(),s.slideToClickedSlide&&void 0!==t.clickedIndex&&t.clickedIndex!==t.activeIndex&&t.slideToClickedSlide()}};var v={getTranslate:function(e=(this.isHorizontal()?"x":"y")){const{params:t,rtlTranslate:s,translate:i,$wrapperEl:a}=this;if(t.virtualTranslate)return s?-i:i;let n=h.getTranslate(a[0],e);return s&&(n=-n),n||0},setTranslate:function(e,t){const s=this,{rtlTranslate:i,params:a,$wrapperEl:n,progress:r}=s;let l,o=0,d=0;s.isHorizontal()?o=i?-e:e:d=e,a.roundLengths&&(o=Math.floor(o),d=Math.floor(d)),a.virtualTranslate||(u.transforms3d?n.transform(`translate3d(${o}px, ${d}px, 0px)`):n.transform(`translate(${o}px, ${d}px)`)),s.previousTranslate=s.translate,s.translate=s.isHorizontal()?o:d;const p=s.maxTranslate()-s.minTranslate();l=0===p?0:(e-s.minTranslate())/p,l!==r&&s.updateProgress(e),s.emit("setTranslate",s.translate,t)},minTranslate:function(){return-this.snapGrid[0]},maxTranslate:function(){return-this.snapGrid[this.snapGrid.length-1]}};var b={setTransition:function(e,t){this.$wrapperEl.transition(e),this.emit("setTransition",e,t)},transitionStart:function(e=!0,t){const s=this,{activeIndex:i,params:a,previousIndex:n}=s;a.autoHeight&&s.updateAutoHeight();let r=t;if(r||(r=i>n?"next":i<n?"prev":"reset"),s.emit("transitionStart"),e&&i!==n){if("reset"===r)return void s.emit("slideResetTransitionStart");s.emit("slideChangeTransitionStart"),"next"===r?s.emit("slideNextTransitionStart"):s.emit("slidePrevTransitionStart")}},transitionEnd:function(e=!0,t){const s=this,{activeIndex:i,previousIndex:a}=s;s.animating=!1,s.setTransition(0);let n=t;if(n||(n=i>a?"next":i<a?"prev":"reset"),s.emit("transitionEnd"),e&&i!==a){if("reset"===n)return void s.emit("slideResetTransitionEnd");s.emit("slideChangeTransitionEnd"),"next"===n?s.emit("slideNextTransitionEnd"):s.emit("slidePrevTransitionEnd")}}};var w={slideTo:function(e=0,t=this.params.speed,s=!0,i){const a=this;let n=e;n<0&&(n=0);const{params:r,snapGrid:l,slidesGrid:o,previousIndex:d,activeIndex:p,rtlTranslate:c}=a;if(a.animating&&r.preventInteractionOnTransition)return!1;let h=Math.floor(n/r.slidesPerGroup);h>=l.length&&(h=l.length-1),(p||r.initialSlide||0)===(d||0)&&s&&a.emit("beforeSlideChangeStart");const m=-l[h];if(a.updateProgress(m),r.normalizeSlideIndex)for(let u=0;u<o.length;u+=1)-Math.floor(100*m)>=Math.floor(100*o[u])&&(n=u);if(a.initialized&&n!==p){if(!a.allowSlideNext&&m<a.translate&&m<a.minTranslate())return!1;if(!a.allowSlidePrev&&m>a.translate&&m>a.maxTranslate()&&(p||0)!==n)return!1}let f;return f=n>p?"next":n<p?"prev":"reset",c&&-m===a.translate||!c&&m===a.translate?(a.updateActiveIndex(n),r.autoHeight&&a.updateAutoHeight(),a.updateSlidesClasses(),"slide"!==r.effect&&a.setTranslate(m),"reset"!==f&&(a.transitionStart(s,f),a.transitionEnd(s,f)),!1):(0!==t&&u.transition?(a.setTransition(t),a.setTranslate(m),a.updateActiveIndex(n),a.updateSlidesClasses(),a.emit("beforeTransitionStart",t,i),a.transitionStart(s,f),a.animating||(a.animating=!0,a.onSlideToWrapperTransitionEnd||(a.onSlideToWrapperTransitionEnd=function(e){a&&!a.destroyed&&e.target===this&&(a.$wrapperEl[0].removeEventListener("transitionend",a.onSlideToWrapperTransitionEnd),a.$wrapperEl[0].removeEventListener("webkitTransitionEnd",a.onSlideToWrapperTransitionEnd),a.onSlideToWrapperTransitionEnd=null,delete a.onSlideToWrapperTransitionEnd,a.transitionEnd(s,f))}),a.$wrapperEl[0].addEventListener("transitionend",a.onSlideToWrapperTransitionEnd),a.$wrapperEl[0].addEventListener("webkitTransitionEnd",a.onSlideToWrapperTransitionEnd))):(a.setTransition(0),a.setTranslate(m),a.updateActiveIndex(n),a.updateSlidesClasses(),a.emit("beforeTransitionStart",t,i),a.transitionStart(s,f),a.transitionEnd(s,f)),!0)},slideToLoop:function(e=0,t=this.params.speed,s=!0,i){const a=this;let n=e;return a.params.loop&&(n+=a.loopedSlides),a.slideTo(n,t,s,i)},slideNext:function(e=this.params.speed,t=!0,s){const i=this,{params:a,animating:n}=i;return a.loop?!n&&(i.loopFix(),i._clientLeft=i.$wrapperEl[0].clientLeft,i.slideTo(i.activeIndex+a.slidesPerGroup,e,t,s)):i.slideTo(i.activeIndex+a.slidesPerGroup,e,t,s)},slidePrev:function(e=this.params.speed,t=!0,s){const i=this,{params:a,animating:n,snapGrid:r,slidesGrid:l,rtlTranslate:o}=i;if(a.loop){if(n)return!1;i.loopFix(),i._clientLeft=i.$wrapperEl[0].clientLeft}function d(e){return e<0?-Math.floor(Math.abs(e)):Math.floor(e)}const p=d(o?i.translate:-i.translate),c=r.map(e=>d(e)),h=(l.map(e=>d(e)),r[c.indexOf(p)],r[c.indexOf(p)-1]);let u;return void 0!==h&&(u=l.indexOf(h),u<0&&(u=i.activeIndex-1)),i.slideTo(u,e,t,s)},slideReset:function(e=this.params.speed,t=!0,s){return this.slideTo(this.activeIndex,e,t,s)},slideToClosest:function(e=this.params.speed,t=!0,s){const i=this;let a=i.activeIndex;const n=Math.floor(a/i.params.slidesPerGroup);if(n<i.snapGrid.length-1){const e=i.rtlTranslate?i.translate:-i.translate,t=i.snapGrid[n];e-t>(i.snapGrid[n+1]-t)/2&&(a=i.params.slidesPerGroup)}return i.slideTo(a,e,t,s)},slideToClickedSlide:function(){const e=this,{params:t,$wrapperEl:s}=e,i="auto"===t.slidesPerView?e.slidesPerViewDynamic():t.slidesPerView;let a,n=e.clickedIndex;if(t.loop){if(e.animating)return;a=parseInt(d(e.clickedSlide).attr("data-swiper-slide-index"),10),t.centeredSlides?n<e.loopedSlides-i/2||n>e.slides.length-e.loopedSlides+i/2?(e.loopFix(),n=s.children(`.${t.slideClass}[data-swiper-slide-index="${a}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),h.nextTick(()=>{e.slideTo(n)})):e.slideTo(n):n>e.slides.length-i?(e.loopFix(),n=s.children(`.${t.slideClass}[data-swiper-slide-index="${a}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),h.nextTick(()=>{e.slideTo(n)})):e.slideTo(n)}else e.slideTo(n)}};var y={loopCreate:function(){const e=this,{params:t,$wrapperEl:s}=e;s.children(`.${t.slideClass}.${t.slideDuplicateClass}`).remove();let i=s.children("."+t.slideClass);if(t.loopFillGroupWithBlank){const e=t.slidesPerGroup-i.length%t.slidesPerGroup;if(e!==t.slidesPerGroup){for(let i=0;i<e;i+=1){const e=d(r.createElement("div")).addClass(`${t.slideClass} ${t.slideBlankClass}`);s.append(e)}i=s.children("."+t.slideClass)}}"auto"!==t.slidesPerView||t.loopedSlides||(t.loopedSlides=i.length),e.loopedSlides=parseInt(t.loopedSlides||t.slidesPerView,10),e.loopedSlides+=t.loopAdditionalSlides,e.loopedSlides>i.length&&(e.loopedSlides=i.length);const a=[],n=[];i.each((t,s)=>{const r=d(s);t<e.loopedSlides&&n.push(s),t<i.length&&t>=i.length-e.loopedSlides&&a.push(s),r.attr("data-swiper-slide-index",t)});for(let r=0;r<n.length;r+=1)s.append(d(n[r].cloneNode(!0)).addClass(t.slideDuplicateClass));for(let r=a.length-1;r>=0;r-=1)s.prepend(d(a[r].cloneNode(!0)).addClass(t.slideDuplicateClass))},loopFix:function(){const e=this,{params:t,activeIndex:s,slides:i,loopedSlides:a,allowSlidePrev:n,allowSlideNext:r,snapGrid:l,rtlTranslate:o}=e;let d;e.allowSlidePrev=!0,e.allowSlideNext=!0;const p=-l[s]-e.getTranslate();if(s<a){d=i.length-3*a+s,d+=a,e.slideTo(d,0,!1,!0)&&0!==p&&e.setTranslate((o?-e.translate:e.translate)-p)}else if("auto"===t.slidesPerView&&s>=2*a||s>=i.length-a){d=-i.length+s+a,d+=a,e.slideTo(d,0,!1,!0)&&0!==p&&e.setTranslate((o?-e.translate:e.translate)-p)}e.allowSlidePrev=n,e.allowSlideNext=r},loopDestroy:function(){const{$wrapperEl:e,params:t,slides:s}=this;e.children(`.${t.slideClass}.${t.slideDuplicateClass},.${t.slideClass}.${t.slideBlankClass}`).remove(),s.removeAttr("data-swiper-slide-index")}};var x={setGrabCursor:function(e){if(u.touch||!this.params.simulateTouch||this.params.watchOverflow&&this.isLocked)return;const t=this.el;t.style.cursor="move",t.style.cursor=e?"-webkit-grabbing":"-webkit-grab",t.style.cursor=e?"-moz-grabbin":"-moz-grab",t.style.cursor=e?"grabbing":"grab"},unsetGrabCursor:function(){u.touch||this.params.watchOverflow&&this.isLocked||(this.el.style.cursor="")}};var T={appendSlide:function(e){const t=this,{$wrapperEl:s,params:i}=t;if(i.loop&&t.loopDestroy(),"object"==typeof e&&"length"in e)for(let a=0;a<e.length;a+=1)e[a]&&s.append(e[a]);else s.append(e);i.loop&&t.loopCreate(),i.observer&&u.observer||t.update()},prependSlide:function(e){const t=this,{params:s,$wrapperEl:i,activeIndex:a}=t;s.loop&&t.loopDestroy();let n=a+1;if("object"==typeof e&&"length"in e){for(let t=0;t<e.length;t+=1)e[t]&&i.prepend(e[t]);n=a+e.length}else i.prepend(e);s.loop&&t.loopCreate(),s.observer&&u.observer||t.update(),t.slideTo(n,0,!1)},addSlide:function(e,t){const s=this,{$wrapperEl:i,params:a,activeIndex:n}=s;let r=n;a.loop&&(r-=s.loopedSlides,s.loopDestroy(),s.slides=i.children("."+a.slideClass));const l=s.slides.length;if(e<=0)return void s.prependSlide(t);if(e>=l)return void s.appendSlide(t);let o=r>e?r+1:r;const d=[];for(let p=l-1;p>=e;p-=1){const e=s.slides.eq(p);e.remove(),d.unshift(e)}if("object"==typeof t&&"length"in t){for(let e=0;e<t.length;e+=1)t[e]&&i.append(t[e]);o=r>e?r+t.length:r}else i.append(t);for(let p=0;p<d.length;p+=1)i.append(d[p]);a.loop&&s.loopCreate(),a.observer&&u.observer||s.update(),a.loop?s.slideTo(o+s.loopedSlides,0,!1):s.slideTo(o,0,!1)},removeSlide:function(e){const t=this,{params:s,$wrapperEl:i,activeIndex:a}=t;let n=a;s.loop&&(n-=t.loopedSlides,t.loopDestroy(),t.slides=i.children("."+s.slideClass));let r,l=n;if("object"==typeof e&&"length"in e){for(let s=0;s<e.length;s+=1)r=e[s],t.slides[r]&&t.slides.eq(r).remove(),r<l&&(l-=1);l=Math.max(l,0)}else r=e,t.slides[r]&&t.slides.eq(r).remove(),r<l&&(l-=1),l=Math.max(l,0);s.loop&&t.loopCreate(),s.observer&&u.observer||t.update(),s.loop?t.slideTo(l+t.loopedSlides,0,!1):t.slideTo(l,0,!1)},removeAllSlides:function(){const e=this,t=[];for(let s=0;s<e.slides.length;s+=1)t.push(s);e.removeSlide(t)}};const E=function(){const e=l.navigator.userAgent,t={ios:!1,android:!1,androidChrome:!1,desktop:!1,windows:!1,iphone:!1,ipod:!1,ipad:!1,cordova:l.cordova||l.phonegap,phonegap:l.cordova||l.phonegap},s=e.match(/(Windows Phone);?[\s\/]+([\d.]+)?/),i=e.match(/(Android);?[\s\/]+([\d.]+)?/),a=e.match(/(iPad).*OS\s([\d_]+)/),n=e.match(/(iPod)(.*OS\s([\d_]+))?/),o=!a&&e.match(/(iPhone\sOS|iOS)\s([\d_]+)/);if(s&&(t.os="windows",t.osVersion=s[2],t.windows=!0),i&&!s&&(t.os="android",t.osVersion=i[2],t.android=!0,t.androidChrome=e.toLowerCase().indexOf("chrome")>=0),(a||o||n)&&(t.os="ios",t.ios=!0),o&&!n&&(t.osVersion=o[2].replace(/_/g,"."),t.iphone=!0),a&&(t.osVersion=a[2].replace(/_/g,"."),t.ipad=!0),n&&(t.osVersion=n[3]?n[3].replace(/_/g,"."):null,t.iphone=!0),t.ios&&t.osVersion&&e.indexOf("Version/")>=0&&"10"===t.osVersion.split(".")[0]&&(t.osVersion=e.toLowerCase().split("version/")[1].split(" ")[0]),t.desktop=!(t.os||t.android||t.webView),t.webView=(o||a||n)&&e.match(/.*AppleWebKit(?!.*Safari)/i),t.os&&"ios"===t.os){const e=t.osVersion.split("."),s=r.querySelector('meta[name="viewport"]');t.minimalUi=!t.webView&&(n||o)&&(1*e[0]==7?1*e[1]>=1:1*e[0]>7)&&s&&s.getAttribute("content").indexOf("minimal-ui")>=0}return t.pixelRatio=l.devicePixelRatio||1,t}();function S(e){const t=this,s=t.touchEventsData,{params:i,touches:a}=t;if(t.animating&&i.preventInteractionOnTransition)return;let n=e;if(n.originalEvent&&(n=n.originalEvent),s.isTouchEvent="touchstart"===n.type,!s.isTouchEvent&&"which"in n&&3===n.which)return;if(!s.isTouchEvent&&"button"in n&&n.button>0)return;if(s.isTouched&&s.isMoved)return;if(i.noSwiping&&d(n.target).closest(i.noSwipingSelector?i.noSwipingSelector:"."+i.noSwipingClass)[0])return void(t.allowClick=!0);if(i.swipeHandler&&!d(n).closest(i.swipeHandler)[0])return;a.currentX="touchstart"===n.type?n.targetTouches[0].pageX:n.pageX,a.currentY="touchstart"===n.type?n.targetTouches[0].pageY:n.pageY;const o=a.currentX,p=a.currentY,c=i.edgeSwipeDetection||i.iOSEdgeSwipeDetection,u=i.edgeSwipeThreshold||i.iOSEdgeSwipeThreshold;if(!c||!(o<=u||o>=l.screen.width-u)){if(h.extend(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),a.startX=o,a.startY=p,s.touchStartTime=h.now(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,i.threshold>0&&(s.allowThresholdMove=!1),"touchstart"!==n.type){let e=!0;d(n.target).is(s.formElements)&&(e=!1),r.activeElement&&d(r.activeElement).is(s.formElements)&&r.activeElement!==n.target&&r.activeElement.blur();const a=e&&t.allowTouchMove&&i.touchStartPreventDefault;(i.touchStartForcePreventDefault||a)&&n.preventDefault()}t.emit("touchStart",n)}}function C(e){const t=this,s=t.touchEventsData,{params:i,touches:a,rtlTranslate:n}=t;let l=e;if(l.originalEvent&&(l=l.originalEvent),!s.isTouched)return void(s.startMoving&&s.isScrolling&&t.emit("touchMoveOpposite",l));if(s.isTouchEvent&&"mousemove"===l.type)return;const o="touchmove"===l.type?l.targetTouches[0].pageX:l.pageX,p="touchmove"===l.type?l.targetTouches[0].pageY:l.pageY;if(l.preventedByNestedSwiper)return a.startX=o,void(a.startY=p);if(!t.allowTouchMove)return t.allowClick=!1,void(s.isTouched&&(h.extend(a,{startX:o,startY:p,currentX:o,currentY:p}),s.touchStartTime=h.now()));if(s.isTouchEvent&&i.touchReleaseOnEdges&&!i.loop)if(t.isVertical()){if(p<a.startY&&t.translate<=t.maxTranslate()||p>a.startY&&t.translate>=t.minTranslate())return s.isTouched=!1,void(s.isMoved=!1)}else if(o<a.startX&&t.translate<=t.maxTranslate()||o>a.startX&&t.translate>=t.minTranslate())return;if(s.isTouchEvent&&r.activeElement&&l.target===r.activeElement&&d(l.target).is(s.formElements))return s.isMoved=!0,void(t.allowClick=!1);if(s.allowTouchCallbacks&&t.emit("touchMove",l),l.targetTouches&&l.targetTouches.length>1)return;a.currentX=o,a.currentY=p;const c=a.currentX-a.startX,u=a.currentY-a.startY;if(t.params.threshold&&Math.sqrt(c**2+u**2)<t.params.threshold)return;if(void 0===s.isScrolling){let e;t.isHorizontal()&&a.currentY===a.startY||t.isVertical()&&a.currentX===a.startX?s.isScrolling=!1:c*c+u*u>=25&&(e=180*Math.atan2(Math.abs(u),Math.abs(c))/Math.PI,s.isScrolling=t.isHorizontal()?e>i.touchAngle:90-e>i.touchAngle)}if(s.isScrolling&&t.emit("touchMoveOpposite",l),void 0===s.startMoving&&(a.currentX===a.startX&&a.currentY===a.startY||(s.startMoving=!0)),s.isScrolling)return void(s.isTouched=!1);if(!s.startMoving)return;t.allowClick=!1,l.preventDefault(),i.touchMoveStopPropagation&&!i.nested&&l.stopPropagation(),s.isMoved||(i.loop&&t.loopFix(),s.startTranslate=t.getTranslate(),t.setTransition(0),t.animating&&t.$wrapperEl.trigger("webkitTransitionEnd transitionend"),s.allowMomentumBounce=!1,!i.grabCursor||!0!==t.allowSlideNext&&!0!==t.allowSlidePrev||t.setGrabCursor(!0),t.emit("sliderFirstMove",l)),t.emit("sliderMove",l),s.isMoved=!0;let m=t.isHorizontal()?c:u;a.diff=m,m*=i.touchRatio,n&&(m=-m),t.swipeDirection=m>0?"prev":"next",s.currentTranslate=m+s.startTranslate;let f=!0,g=i.resistanceRatio;if(i.touchReleaseOnEdges&&(g=0),m>0&&s.currentTranslate>t.minTranslate()?(f=!1,i.resistance&&(s.currentTranslate=t.minTranslate()-1+(-t.minTranslate()+s.startTranslate+m)**g)):m<0&&s.currentTranslate<t.maxTranslate()&&(f=!1,i.resistance&&(s.currentTranslate=t.maxTranslate()+1-(t.maxTranslate()-s.startTranslate-m)**g)),f&&(l.preventedByNestedSwiper=!0),!t.allowSlideNext&&"next"===t.swipeDirection&&s.currentTranslate<s.startTranslate&&(s.currentTranslate=s.startTranslate),!t.allowSlidePrev&&"prev"===t.swipeDirection&&s.currentTranslate>s.startTranslate&&(s.currentTranslate=s.startTranslate),i.threshold>0){if(!(Math.abs(m)>i.threshold||s.allowThresholdMove))return void(s.currentTranslate=s.startTranslate);if(!s.allowThresholdMove)return s.allowThresholdMove=!0,a.startX=a.currentX,a.startY=a.currentY,s.currentTranslate=s.startTranslate,void(a.diff=t.isHorizontal()?a.currentX-a.startX:a.currentY-a.startY)}i.followFinger&&((i.freeMode||i.watchSlidesProgress||i.watchSlidesVisibility)&&(t.updateActiveIndex(),t.updateSlidesClasses()),i.freeMode&&(0===s.velocities.length&&s.velocities.push({position:a[t.isHorizontal()?"startX":"startY"],time:s.touchStartTime}),s.velocities.push({position:a[t.isHorizontal()?"currentX":"currentY"],time:h.now()})),t.updateProgress(s.currentTranslate),t.setTranslate(s.currentTranslate))}function $(e){const t=this,s=t.touchEventsData,{params:i,touches:a,rtlTranslate:n,$wrapperEl:r,slidesGrid:l,snapGrid:o}=t;let d=e;if(d.originalEvent&&(d=d.originalEvent),s.allowTouchCallbacks&&t.emit("touchEnd",d),s.allowTouchCallbacks=!1,!s.isTouched)return s.isMoved&&i.grabCursor&&t.setGrabCursor(!1),s.isMoved=!1,void(s.startMoving=!1);i.grabCursor&&s.isMoved&&s.isTouched&&(!0===t.allowSlideNext||!0===t.allowSlidePrev)&&t.setGrabCursor(!1);const p=h.now(),c=p-s.touchStartTime;if(t.allowClick&&(t.updateClickedSlide(d),t.emit("tap",d),c<300&&p-s.lastClickTime>300&&(s.clickTimeout&&clearTimeout(s.clickTimeout),s.clickTimeout=h.nextTick(()=>{t&&!t.destroyed&&t.emit("click",d)},300)),c<300&&p-s.lastClickTime<300&&(s.clickTimeout&&clearTimeout(s.clickTimeout),t.emit("doubleTap",d))),s.lastClickTime=h.now(),h.nextTick(()=>{t.destroyed||(t.allowClick=!0)}),!s.isTouched||!s.isMoved||!t.swipeDirection||0===a.diff||s.currentTranslate===s.startTranslate)return s.isTouched=!1,s.isMoved=!1,void(s.startMoving=!1);let u;if(s.isTouched=!1,s.isMoved=!1,s.startMoving=!1,u=i.followFinger?n?t.translate:-t.translate:-s.currentTranslate,i.freeMode){if(u<-t.minTranslate())return void t.slideTo(t.activeIndex);if(u>-t.maxTranslate())return void(t.slides.length<o.length?t.slideTo(o.length-1):t.slideTo(t.slides.length-1));if(i.freeModeMomentum){if(s.velocities.length>1){const e=s.velocities.pop(),a=s.velocities.pop(),n=e.position-a.position,r=e.time-a.time;t.velocity=n/r,t.velocity/=2,Math.abs(t.velocity)<i.freeModeMinimumVelocity&&(t.velocity=0),(r>150||h.now()-e.time>300)&&(t.velocity=0)}else t.velocity=0;t.velocity*=i.freeModeMomentumVelocityRatio,s.velocities.length=0;let e=1e3*i.freeModeMomentumRatio;const a=t.velocity*e;let l=t.translate+a;n&&(l=-l);let d,p=!1;const c=20*Math.abs(t.velocity)*i.freeModeMomentumBounceRatio;let u;if(l<t.maxTranslate())i.freeModeMomentumBounce?(l+t.maxTranslate()<-c&&(l=t.maxTranslate()-c),d=t.maxTranslate(),p=!0,s.allowMomentumBounce=!0):l=t.maxTranslate(),i.loop&&i.centeredSlides&&(u=!0);else if(l>t.minTranslate())i.freeModeMomentumBounce?(l-t.minTranslate()>c&&(l=t.minTranslate()+c),d=t.minTranslate(),p=!0,s.allowMomentumBounce=!0):l=t.minTranslate(),i.loop&&i.centeredSlides&&(u=!0);else if(i.freeModeSticky){let e;for(let t=0;t<o.length;t+=1)if(o[t]>-l){e=t;break}l=Math.abs(o[e]-l)<Math.abs(o[e-1]-l)||"next"===t.swipeDirection?o[e]:o[e-1],l=-l}if(u&&t.once("transitionEnd",()=>{t.loopFix()}),0!==t.velocity)e=n?Math.abs((-l-t.translate)/t.velocity):Math.abs((l-t.translate)/t.velocity);else if(i.freeModeSticky)return void t.slideToClosest();i.freeModeMomentumBounce&&p?(t.updateProgress(d),t.setTransition(e),t.setTranslate(l),t.transitionStart(!0,t.swipeDirection),t.animating=!0,r.transitionEnd(()=>{t&&!t.destroyed&&s.allowMomentumBounce&&(t.emit("momentumBounce"),t.setTransition(i.speed),t.setTranslate(d),r.transitionEnd(()=>{t&&!t.destroyed&&t.transitionEnd()}))})):t.velocity?(t.updateProgress(l),t.setTransition(e),t.setTranslate(l),t.transitionStart(!0,t.swipeDirection),t.animating||(t.animating=!0,r.transitionEnd(()=>{t&&!t.destroyed&&t.transitionEnd()}))):t.updateProgress(l),t.updateActiveIndex(),t.updateSlidesClasses()}else if(i.freeModeSticky)return void t.slideToClosest();return void((!i.freeModeMomentum||c>=i.longSwipesMs)&&(t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses()))}let m=0,f=t.slidesSizesGrid[0];for(let h=0;h<l.length;h+=i.slidesPerGroup)void 0!==l[h+i.slidesPerGroup]?u>=l[h]&&u<l[h+i.slidesPerGroup]&&(m=h,f=l[h+i.slidesPerGroup]-l[h]):u>=l[h]&&(m=h,f=l[l.length-1]-l[l.length-2]);const g=(u-l[m])/f;if(c>i.longSwipesMs){if(!i.longSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&(g>=i.longSwipesRatio?t.slideTo(m+i.slidesPerGroup):t.slideTo(m)),"prev"===t.swipeDirection&&(g>1-i.longSwipesRatio?t.slideTo(m+i.slidesPerGroup):t.slideTo(m))}else{if(!i.shortSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&t.slideTo(m+i.slidesPerGroup),"prev"===t.swipeDirection&&t.slideTo(m)}}function M(){const e=this,{params:t,el:s}=e;if(s&&0===s.offsetWidth)return;t.breakpoints&&e.setBreakpoint();const{allowSlideNext:i,allowSlidePrev:a,snapGrid:n}=e;if(e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),t.freeMode){const s=Math.min(Math.max(e.translate,e.maxTranslate()),e.minTranslate());e.setTranslate(s),e.updateActiveIndex(),e.updateSlidesClasses(),t.autoHeight&&e.updateAutoHeight()}else e.updateSlidesClasses(),("auto"===t.slidesPerView||t.slidesPerView>1)&&e.isEnd&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0);e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.run(),e.allowSlidePrev=a,e.allowSlideNext=i,e.params.watchOverflow&&n!==e.snapGrid&&e.checkOverflow()}function P(e){const t=this;t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation()))}var k={init:!0,direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,preventInteractionOnTransition:!1,edgeSwipeDetection:!1,edgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeMomentumVelocityRatio:1,freeModeSticky:!1,freeModeMinimumVelocity:.02,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsInverse:!1,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!1,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:0,touchMoveStopPropagation:!0,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,loopFillGroupWithBlank:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,containerModifierClass:"swiper-container-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-invisible-blank",slideActiveClass:"swiper-slide-active",slideDuplicateActiveClass:"swiper-slide-duplicate-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slideDuplicateNextClass:"swiper-slide-duplicate-next",slidePrevClass:"swiper-slide-prev",slideDuplicatePrevClass:"swiper-slide-duplicate-prev",wrapperClass:"swiper-wrapper",runCallbacksOnInit:!0};const z={update:g,translate:v,transition:b,slide:w,loop:y,grabCursor:x,manipulation:T,events:{attachEvents:function(){const e=this,{params:t,touchEvents:s,el:i,wrapperEl:a}=e;e.onTouchStart=S.bind(e),e.onTouchMove=C.bind(e),e.onTouchEnd=$.bind(e),e.onClick=P.bind(e);const n="container"===t.touchEventsTarget?i:a,l=!!t.nested;if(u.touch||!u.pointerEvents&&!u.prefixedPointerEvents){if(u.touch){const i=!("touchstart"!==s.start||!u.passiveListener||!t.passiveListeners)&&{passive:!0,capture:!1};n.addEventListener(s.start,e.onTouchStart,i),n.addEventListener(s.move,e.onTouchMove,u.passiveListener?{passive:!1,capture:l}:l),n.addEventListener(s.end,e.onTouchEnd,i)}(t.simulateTouch&&!E.ios&&!E.android||t.simulateTouch&&!u.touch&&E.ios)&&(n.addEventListener("mousedown",e.onTouchStart,!1),r.addEventListener("mousemove",e.onTouchMove,l),r.addEventListener("mouseup",e.onTouchEnd,!1))}else n.addEventListener(s.start,e.onTouchStart,!1),r.addEventListener(s.move,e.onTouchMove,l),r.addEventListener(s.end,e.onTouchEnd,!1);(t.preventClicks||t.preventClicksPropagation)&&n.addEventListener("click",e.onClick,!0),e.on(E.ios||E.android?"resize orientationchange observerUpdate":"resize observerUpdate",M,!0)},detachEvents:function(){const e=this,{params:t,touchEvents:s,el:i,wrapperEl:a}=e,n="container"===t.touchEventsTarget?i:a,l=!!t.nested;if(u.touch||!u.pointerEvents&&!u.prefixedPointerEvents){if(u.touch){const i=!("onTouchStart"!==s.start||!u.passiveListener||!t.passiveListeners)&&{passive:!0,capture:!1};n.removeEventListener(s.start,e.onTouchStart,i),n.removeEventListener(s.move,e.onTouchMove,l),n.removeEventListener(s.end,e.onTouchEnd,i)}(t.simulateTouch&&!E.ios&&!E.android||t.simulateTouch&&!u.touch&&E.ios)&&(n.removeEventListener("mousedown",e.onTouchStart,!1),r.removeEventListener("mousemove",e.onTouchMove,l),r.removeEventListener("mouseup",e.onTouchEnd,!1))}else n.removeEventListener(s.start,e.onTouchStart,!1),r.removeEventListener(s.move,e.onTouchMove,l),r.removeEventListener(s.end,e.onTouchEnd,!1);(t.preventClicks||t.preventClicksPropagation)&&n.removeEventListener("click",e.onClick,!0),e.off(E.ios||E.android?"resize orientationchange observerUpdate":"resize observerUpdate",M)}},breakpoints:{setBreakpoint:function(){const e=this,{activeIndex:t,initialized:s,loopedSlides:i=0,params:a}=e,n=a.breakpoints;if(!n||n&&0===Object.keys(n).length)return;const r=e.getBreakpoint(n);if(r&&e.currentBreakpoint!==r){const l=r in n?n[r]:void 0;l&&["slidesPerView","spaceBetween","slidesPerGroup"].forEach(e=>{const t=l[e];void 0!==t&&(l[e]="slidesPerView"!==e||"AUTO"!==t&&"auto"!==t?"slidesPerView"===e?parseFloat(t):parseInt(t,10):"auto")});const o=l||e.originalParams,d=o.direction&&o.direction!==a.direction,p=a.loop&&(o.slidesPerView!==a.slidesPerView||d);d&&s&&e.changeDirection(),h.extend(e.params,o),h.extend(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),e.currentBreakpoint=r,p&&s&&(e.loopDestroy(),e.loopCreate(),e.updateSlides(),e.slideTo(t-i+e.loopedSlides,0,!1)),e.emit("breakpoint",o)}},getBreakpoint:function(e){const t=this;if(!e)return;let s=!1;const i=[];Object.keys(e).forEach(e=>{i.push(e)}),i.sort((e,t)=>parseInt(e,10)-parseInt(t,10));for(let a=0;a<i.length;a+=1){const e=i[a];t.params.breakpointsInverse?e<=l.innerWidth&&(s=e):e>=l.innerWidth&&!s&&(s=e)}return s||"max"}},checkOverflow:{checkOverflow:function(){const e=this,t=e.isLocked;e.isLocked=1===e.snapGrid.length,e.allowSlideNext=!e.isLocked,e.allowSlidePrev=!e.isLocked,t!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock"),t&&t!==e.isLocked&&(e.isEnd=!1,e.navigation.update())}},classes:{addClasses:function(){const{classNames:e,params:t,rtl:s,$el:i}=this,a=[];a.push("initialized"),a.push(t.direction),t.freeMode&&a.push("free-mode"),u.flexbox||a.push("no-flexbox"),t.autoHeight&&a.push("autoheight"),s&&a.push("rtl"),t.slidesPerColumn>1&&a.push("multirow"),E.android&&a.push("android"),E.ios&&a.push("ios"),(m.isIE||m.isEdge)&&(u.pointerEvents||u.prefixedPointerEvents)&&a.push("wp8-"+t.direction),a.forEach(s=>{e.push(t.containerModifierClass+s)}),i.addClass(e.join(" "))},removeClasses:function(){const{$el:e,classNames:t}=this;e.removeClass(t.join(" "))}},images:{loadImage:function(e,t,s,i,a,n){let r;function o(){n&&n()}e.complete&&a?o():t?(r=new l.Image,r.onload=o,r.onerror=o,i&&(r.sizes=i),s&&(r.srcset=s),t&&(r.src=t)):o()},preloadImages:function(){const e=this;function t(){null!=e&&e&&!e.destroyed&&(void 0!==e.imagesLoaded&&(e.imagesLoaded+=1),e.imagesLoaded===e.imagesToLoad.length&&(e.params.updateOnImagesReady&&e.update(),e.emit("imagesReady")))}e.imagesToLoad=e.$el.find("img");for(let s=0;s<e.imagesToLoad.length;s+=1){const i=e.imagesToLoad[s];e.loadImage(i,i.currentSrc||i.getAttribute("src"),i.srcset||i.getAttribute("srcset"),i.sizes||i.getAttribute("sizes"),!0,t)}}}},I={};class L extends f{constructor(...e){let t,s;1===e.length&&e[0].constructor&&e[0].constructor===Object?s=e[0]:[t,s]=e,s||(s={}),s=h.extend({},s),t&&!s.el&&(s.el=t),super(s),Object.keys(z).forEach(e=>{Object.keys(z[e]).forEach(t=>{L.prototype[t]||(L.prototype[t]=z[e][t])})});const i=this;void 0===i.modules&&(i.modules={}),Object.keys(i.modules).forEach(e=>{const t=i.modules[e];if(t.params){const e=Object.keys(t.params)[0],i=t.params[e];if("object"!=typeof i||null===i)return;if(!(e in s)||!("enabled"in i))return;!0===s[e]&&(s[e]={enabled:!0}),"object"!=typeof s[e]||"enabled"in s[e]||(s[e].enabled=!0),s[e]||(s[e]={enabled:!1})}});const a=h.extend({},k);i.useModulesParams(a),i.params=h.extend({},a,I,s),i.originalParams=h.extend({},i.params),i.passedParams=h.extend({},s),i.$=d;const n=d(i.params.el);if(t=n[0],!t)return;if(n.length>1){const e=[];return n.each((t,i)=>{const a=h.extend({},s,{el:i});e.push(new L(a))}),e}t.swiper=i,n.data("swiper",i);const r=n.children("."+i.params.wrapperClass);return h.extend(i,{$el:n,el:t,$wrapperEl:r,wrapperEl:r[0],classNames:[],slides:d(),slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal:()=>"horizontal"===i.params.direction,isVertical:()=>"vertical"===i.params.direction,rtl:"rtl"===t.dir.toLowerCase()||"rtl"===n.css("direction"),rtlTranslate:"horizontal"===i.params.direction&&("rtl"===t.dir.toLowerCase()||"rtl"===n.css("direction")),wrongRTL:"-webkit-box"===r.css("display"),activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev,touchEvents:function(){const e=["touchstart","touchmove","touchend"];let t=["mousedown","mousemove","mouseup"];return u.pointerEvents?t=["pointerdown","pointermove","pointerup"]:u.prefixedPointerEvents&&(t=["MSPointerDown","MSPointerMove","MSPointerUp"]),i.touchEventsTouch={start:e[0],move:e[1],end:e[2]},i.touchEventsDesktop={start:t[0],move:t[1],end:t[2]},u.touch||!i.params.simulateTouch?i.touchEventsTouch:i.touchEventsDesktop}(),touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,formElements:"input, select, option, textarea, button, video",lastClickTime:h.now(),clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,isTouchEvent:void 0,startMoving:void 0},allowClick:!0,allowTouchMove:i.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),i.useModules(),i.params.init&&i.init(),i}slidesPerViewDynamic(){const{params:e,slides:t,slidesGrid:s,size:i,activeIndex:a}=this;let n=1;if(e.centeredSlides){let e,s=t[a].swiperSlideSize;for(let r=a+1;r<t.length;r+=1)t[r]&&!e&&(s+=t[r].swiperSlideSize,n+=1,s>i&&(e=!0));for(let r=a-1;r>=0;r-=1)t[r]&&!e&&(s+=t[r].swiperSlideSize,n+=1,s>i&&(e=!0))}else for(let r=a+1;r<t.length;r+=1)s[r]-s[a]<i&&(n+=1);return n}update(){const e=this;if(!e||e.destroyed)return;const{snapGrid:t,params:s}=e;function i(){const t=e.rtlTranslate?-1*e.translate:e.translate,s=Math.min(Math.max(t,e.maxTranslate()),e.minTranslate());e.setTranslate(s),e.updateActiveIndex(),e.updateSlidesClasses()}let a;s.breakpoints&&e.setBreakpoint(),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses(),e.params.freeMode?(i(),e.params.autoHeight&&e.updateAutoHeight()):(a=("auto"===e.params.slidesPerView||e.params.slidesPerView>1)&&e.isEnd&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0),a||i()),s.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,t=!0){const s=this,i=s.params.direction;return e||(e="horizontal"===i?"vertical":"horizontal"),e===i||"horizontal"!==e&&"vertical"!==e||(s.$el.removeClass(`${s.params.containerModifierClass}${i} wp8-${i}`).addClass(`${s.params.containerModifierClass}${e}`),(m.isIE||m.isEdge)&&(u.pointerEvents||u.prefixedPointerEvents)&&s.$el.addClass(`${s.params.containerModifierClass}wp8-${e}`),s.params.direction=e,s.slides.each((t,s)=>{"vertical"===e?s.style.width="":s.style.height=""}),s.emit("changeDirection"),t&&s.update()),s}init(){const e=this;e.initialized||(e.emit("beforeInit"),e.params.breakpoints&&e.setBreakpoint(),e.addClasses(),e.params.loop&&e.loopCreate(),e.updateSize(),e.updateSlides(),e.params.watchOverflow&&e.checkOverflow(),e.params.grabCursor&&e.setGrabCursor(),e.params.preloadImages&&e.preloadImages(),e.params.loop?e.slideTo(e.params.initialSlide+e.loopedSlides,0,e.params.runCallbacksOnInit):e.slideTo(e.params.initialSlide,0,e.params.runCallbacksOnInit),e.attachEvents(),e.initialized=!0,e.emit("init"))}destroy(e=!0,t=!0){const s=this,{params:i,$el:a,$wrapperEl:n,slides:r}=s;return void 0===s.params||s.destroyed||(s.emit("beforeDestroy"),s.initialized=!1,s.detachEvents(),i.loop&&s.loopDestroy(),t&&(s.removeClasses(),a.removeAttr("style"),n.removeAttr("style"),r&&r.length&&r.removeClass([i.slideVisibleClass,i.slideActiveClass,i.slideNextClass,i.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-slide-index").removeAttr("data-swiper-column").removeAttr("data-swiper-row")),s.emit("destroy"),Object.keys(s.eventsListeners).forEach(e=>{s.off(e)}),!1!==e&&(s.$el[0].swiper=null,s.$el.data("swiper",null),h.deleteProps(s)),s.destroyed=!0),null}static extendDefaults(e){h.extend(I,e)}static get extendedDefaults(){return I}static get defaults(){return k}static get Class(){return f}static get $(){return d}}var D={name:"device",proto:{device:E},static:{device:E}},O={name:"support",proto:{support:u},static:{support:u}},A={name:"browser",proto:{browser:m},static:{browser:m}},H={name:"resize",create(){const e=this;h.extend(e,{resize:{resizeHandler(){e&&!e.destroyed&&e.initialized&&(e.emit("beforeResize"),e.emit("resize"))},orientationChangeHandler(){e&&!e.destroyed&&e.initialized&&e.emit("orientationchange")}}})},on:{init(){l.addEventListener("resize",this.resize.resizeHandler),l.addEventListener("orientationchange",this.resize.orientationChangeHandler)},destroy(){l.removeEventListener("resize",this.resize.resizeHandler),l.removeEventListener("orientationchange",this.resize.orientationChangeHandler)}}};const G={func:l.MutationObserver||l.WebkitMutationObserver,attach(e,t={}){const s=this,i=new(0,G.func)(e=>{if(1===e.length)return void s.emit("observerUpdate",e[0]);const t=function(){s.emit("observerUpdate",e[0])};l.requestAnimationFrame?l.requestAnimationFrame(t):l.setTimeout(t,0)});i.observe(e,{attributes:void 0===t.attributes||t.attributes,childList:void 0===t.childList||t.childList,characterData:void 0===t.characterData||t.characterData}),s.observer.observers.push(i)},init(){const e=this;if(u.observer&&e.params.observer){if(e.params.observeParents){const t=e.$el.parents();for(let s=0;s<t.length;s+=1)e.observer.attach(t[s])}e.observer.attach(e.$el[0],{childList:e.params.observeSlideChildren}),e.observer.attach(e.$wrapperEl[0],{attributes:!1})}},destroy(){this.observer.observers.forEach(e=>{e.disconnect()}),this.observer.observers=[]}};var N={name:"observer",params:{observer:!1,observeParents:!1,observeSlideChildren:!1},create(){h.extend(this,{observer:{init:G.init.bind(this),attach:G.attach.bind(this),destroy:G.destroy.bind(this),observers:[]}})},on:{init(){this.observer.init()},destroy(){this.observer.destroy()}}};const B={update(e){const t=this,{slidesPerView:s,slidesPerGroup:i,centeredSlides:a}=t.params,{addSlidesBefore:n,addSlidesAfter:r}=t.params.virtual,{from:l,to:o,slides:d,slidesGrid:p,renderSlide:c,offset:u}=t.virtual;t.updateActiveIndex();const m=t.activeIndex||0;let f,g,v;f=t.rtlTranslate?"right":t.isHorizontal()?"left":"top",a?(g=Math.floor(s/2)+i+n,v=Math.floor(s/2)+i+r):(g=s+(i-1)+n,v=i+r);const b=Math.max((m||0)-v,0),w=Math.min((m||0)+g,d.length-1),y=(t.slidesGrid[b]||0)-(t.slidesGrid[0]||0);function x(){t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.lazy&&t.params.lazy.enabled&&t.lazy.load()}if(h.extend(t.virtual,{from:b,to:w,offset:y,slidesGrid:t.slidesGrid}),l===b&&o===w&&!e)return t.slidesGrid!==p&&y!==u&&t.slides.css(f,y+"px"),void t.updateProgress();if(t.params.virtual.renderExternal)return t.params.virtual.renderExternal.call(t,{offset:y,from:b,to:w,slides:function(){const e=[];for(let t=b;t<=w;t+=1)e.push(d[t]);return e}()}),void x();const T=[],E=[];if(e)t.$wrapperEl.find("."+t.params.slideClass).remove();else for(let h=l;h<=o;h+=1)(h<b||h>w)&&t.$wrapperEl.find(`.${t.params.slideClass}[data-swiper-slide-index="${h}"]`).remove();for(let h=0;h<d.length;h+=1)h>=b&&h<=w&&(void 0===o||e?E.push(h):(h>o&&E.push(h),h<l&&T.push(h)));E.forEach(e=>{t.$wrapperEl.append(c(d[e],e))}),T.sort((e,t)=>t-e).forEach(e=>{t.$wrapperEl.prepend(c(d[e],e))}),t.$wrapperEl.children(".swiper-slide").css(f,y+"px"),x()},renderSlide(e,t){const s=this,i=s.params.virtual;if(i.cache&&s.virtual.cache[t])return s.virtual.cache[t];const a=i.renderSlide?d(i.renderSlide.call(s,e,t)):d(`<div class="${s.params.slideClass}" data-swiper-slide-index="${t}">${e}</div>`);return a.attr("data-swiper-slide-index")||a.attr("data-swiper-slide-index",t),i.cache&&(s.virtual.cache[t]=a),a},appendSlide(e){const t=this;if("object"==typeof e&&"length"in e)for(let s=0;s<e.length;s+=1)e[s]&&t.virtual.slides.push(e[s]);else t.virtual.slides.push(e);t.virtual.update(!0)},prependSlide(e){const t=this,s=t.activeIndex;let i=s+1,a=1;if(Array.isArray(e)){for(let s=0;s<e.length;s+=1)e[s]&&t.virtual.slides.unshift(e[s]);i=s+e.length,a=e.length}else t.virtual.slides.unshift(e);if(t.params.virtual.cache){const e=t.virtual.cache,s={};Object.keys(e).forEach(t=>{s[parseInt(t,10)+a]=e[t]}),t.virtual.cache=s}t.virtual.update(!0),t.slideTo(i,0)},removeSlide(e){const t=this;if(null==e)return;let s=t.activeIndex;if(Array.isArray(e))for(let i=e.length-1;i>=0;i-=1)t.virtual.slides.splice(e[i],1),t.params.virtual.cache&&delete t.virtual.cache[e[i]],e[i]<s&&(s-=1),s=Math.max(s,0);else t.virtual.slides.splice(e,1),t.params.virtual.cache&&delete t.virtual.cache[e],e<s&&(s-=1),s=Math.max(s,0);t.virtual.update(!0),t.slideTo(s,0)},removeAllSlides(){const e=this;e.virtual.slides=[],e.params.virtual.cache&&(e.virtual.cache={}),e.virtual.update(!0),e.slideTo(0,0)}};var X={name:"virtual",params:{virtual:{enabled:!1,slides:[],cache:!0,renderSlide:null,renderExternal:null,addSlidesBefore:0,addSlidesAfter:0}},create(){h.extend(this,{virtual:{update:B.update.bind(this),appendSlide:B.appendSlide.bind(this),prependSlide:B.prependSlide.bind(this),removeSlide:B.removeSlide.bind(this),removeAllSlides:B.removeAllSlides.bind(this),renderSlide:B.renderSlide.bind(this),slides:this.params.virtual.slides,cache:{}}})},on:{beforeInit(){const e=this;if(!e.params.virtual.enabled)return;e.classNames.push(e.params.containerModifierClass+"virtual");const t={watchSlidesProgress:!0};h.extend(e.params,t),h.extend(e.originalParams,t),e.params.initialSlide||e.virtual.update()},setTranslate(){this.params.virtual.enabled&&this.virtual.update()}}};const V={handle(e){const t=this,{rtlTranslate:s}=t;let i=e;i.originalEvent&&(i=i.originalEvent);const a=i.keyCode||i.charCode;if(!t.allowSlideNext&&(t.isHorizontal()&&39===a||t.isVertical()&&40===a||34===a))return!1;if(!t.allowSlidePrev&&(t.isHorizontal()&&37===a||t.isVertical()&&38===a||33===a))return!1;if(!(i.shiftKey||i.altKey||i.ctrlKey||i.metaKey||r.activeElement&&r.activeElement.nodeName&&("input"===r.activeElement.nodeName.toLowerCase()||"textarea"===r.activeElement.nodeName.toLowerCase()))){if(t.params.keyboard.onlyInViewport&&(33===a||34===a||37===a||39===a||38===a||40===a)){let e=!1;if(t.$el.parents("."+t.params.slideClass).length>0&&0===t.$el.parents("."+t.params.slideActiveClass).length)return;const i=l.innerWidth,a=l.innerHeight,n=t.$el.offset();s&&(n.left-=t.$el[0].scrollLeft);const r=[[n.left,n.top],[n.left+t.width,n.top],[n.left,n.top+t.height],[n.left+t.width,n.top+t.height]];for(let t=0;t<r.length;t+=1){const s=r[t];s[0]>=0&&s[0]<=i&&s[1]>=0&&s[1]<=a&&(e=!0)}if(!e)return}t.isHorizontal()?(33!==a&&34!==a&&37!==a&&39!==a||(i.preventDefault?i.preventDefault():i.returnValue=!1),(34!==a&&39!==a||s)&&(33!==a&&37!==a||!s)||t.slideNext(),(33!==a&&37!==a||s)&&(34!==a&&39!==a||!s)||t.slidePrev()):(33!==a&&34!==a&&38!==a&&40!==a||(i.preventDefault?i.preventDefault():i.returnValue=!1),34!==a&&40!==a||t.slideNext(),33!==a&&38!==a||t.slidePrev()),t.emit("keyPress",a)}},enable(){this.keyboard.enabled||(d(r).on("keydown",this.keyboard.handle),this.keyboard.enabled=!0)},disable(){this.keyboard.enabled&&(d(r).off("keydown",this.keyboard.handle),this.keyboard.enabled=!1)}};var Y={name:"keyboard",params:{keyboard:{enabled:!1,onlyInViewport:!0}},create(){h.extend(this,{keyboard:{enabled:!1,enable:V.enable.bind(this),disable:V.disable.bind(this),handle:V.handle.bind(this)}})},on:{init(){const e=this;e.params.keyboard.enabled&&e.keyboard.enable()},destroy(){const e=this;e.keyboard.enabled&&e.keyboard.disable()}}};const F={lastScrollTime:h.now(),event:l.navigator.userAgent.indexOf("firefox")>-1?"DOMMouseScroll":function(){let e="onwheel"in r;if(!e){const t=r.createElement("div");t.setAttribute("onwheel","return;"),e="function"==typeof t.onwheel}return!e&&r.implementation&&r.implementation.hasFeature&&!0!==r.implementation.hasFeature("","")&&(e=r.implementation.hasFeature("Events.wheel","3.0")),e}()?"wheel":"mousewheel",normalize(e){let t=0,s=0,i=0,a=0;return"detail"in e&&(s=e.detail),"wheelDelta"in e&&(s=-e.wheelDelta/120),"wheelDeltaY"in e&&(s=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=s,s=0),i=10*t,a=10*s,"deltaY"in e&&(a=e.deltaY),"deltaX"in e&&(i=e.deltaX),(i||a)&&e.deltaMode&&(1===e.deltaMode?(i*=40,a*=40):(i*=800,a*=800)),i&&!t&&(t=i<1?-1:1),a&&!s&&(s=a<1?-1:1),{spinX:t,spinY:s,pixelX:i,pixelY:a}},handleMouseEnter(){this.mouseEntered=!0},handleMouseLeave(){this.mouseEntered=!1},handle(e){let t=e;const s=this,i=s.params.mousewheel;if(!s.mouseEntered&&!i.releaseOnEdges)return!0;t.originalEvent&&(t=t.originalEvent);let a=0;const n=s.rtlTranslate?-1:1,r=F.normalize(t);if(i.forceToAxis)if(s.isHorizontal()){if(!(Math.abs(r.pixelX)>Math.abs(r.pixelY)))return!0;a=r.pixelX*n}else{if(!(Math.abs(r.pixelY)>Math.abs(r.pixelX)))return!0;a=r.pixelY}else a=Math.abs(r.pixelX)>Math.abs(r.pixelY)?-r.pixelX*n:-r.pixelY;if(0===a)return!0;if(i.invert&&(a=-a),s.params.freeMode){s.params.loop&&s.loopFix();let e=s.getTranslate()+a*i.sensitivity;const n=s.isBeginning,r=s.isEnd;if(e>=s.minTranslate()&&(e=s.minTranslate()),e<=s.maxTranslate()&&(e=s.maxTranslate()),s.setTransition(0),s.setTranslate(e),s.updateProgress(),s.updateActiveIndex(),s.updateSlidesClasses(),(!n&&s.isBeginning||!r&&s.isEnd)&&s.updateSlidesClasses(),s.params.freeModeSticky&&(clearTimeout(s.mousewheel.timeout),s.mousewheel.timeout=h.nextTick(()=>{s.slideToClosest()},300)),s.emit("scroll",t),s.params.autoplay&&s.params.autoplayDisableOnInteraction&&s.autoplay.stop(),e===s.minTranslate()||e===s.maxTranslate())return!0}else{if(h.now()-s.mousewheel.lastScrollTime>60)if(a<0)if(s.isEnd&&!s.params.loop||s.animating){if(i.releaseOnEdges)return!0}else s.slideNext(),s.emit("scroll",t);else if(s.isBeginning&&!s.params.loop||s.animating){if(i.releaseOnEdges)return!0}else s.slidePrev(),s.emit("scroll",t);s.mousewheel.lastScrollTime=(new l.Date).getTime()}return t.preventDefault?t.preventDefault():t.returnValue=!1,!1},enable(){const e=this;if(!F.event)return!1;if(e.mousewheel.enabled)return!1;let t=e.$el;return"container"!==e.params.mousewheel.eventsTarged&&(t=d(e.params.mousewheel.eventsTarged)),t.on("mouseenter",e.mousewheel.handleMouseEnter),t.on("mouseleave",e.mousewheel.handleMouseLeave),t.on(F.event,e.mousewheel.handle),e.mousewheel.enabled=!0,!0},disable(){const e=this;if(!F.event)return!1;if(!e.mousewheel.enabled)return!1;let t=e.$el;return"container"!==e.params.mousewheel.eventsTarged&&(t=d(e.params.mousewheel.eventsTarged)),t.off(F.event,e.mousewheel.handle),e.mousewheel.enabled=!1,!0}};const q={update(){const e=this,t=e.params.navigation;if(e.params.loop)return;const{$nextEl:s,$prevEl:i}=e.navigation;i&&i.length>0&&(e.isBeginning?i.addClass(t.disabledClass):i.removeClass(t.disabledClass),i[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass)),s&&s.length>0&&(e.isEnd?s.addClass(t.disabledClass):s.removeClass(t.disabledClass),s[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass))},onPrevClick(e){e.preventDefault(),this.isBeginning&&!this.params.loop||this.slidePrev()},onNextClick(e){e.preventDefault(),this.isEnd&&!this.params.loop||this.slideNext()},init(){const e=this,t=e.params.navigation;if(!t.nextEl&&!t.prevEl)return;let s,i;t.nextEl&&(s=d(t.nextEl),e.params.uniqueNavElements&&"string"==typeof t.nextEl&&s.length>1&&1===e.$el.find(t.nextEl).length&&(s=e.$el.find(t.nextEl))),t.prevEl&&(i=d(t.prevEl),e.params.uniqueNavElements&&"string"==typeof t.prevEl&&i.length>1&&1===e.$el.find(t.prevEl).length&&(i=e.$el.find(t.prevEl))),s&&s.length>0&&s.on("click",e.navigation.onNextClick),i&&i.length>0&&i.on("click",e.navigation.onPrevClick),h.extend(e.navigation,{$nextEl:s,nextEl:s&&s[0],$prevEl:i,prevEl:i&&i[0]})},destroy(){const e=this,{$nextEl:t,$prevEl:s}=e.navigation;t&&t.length&&(t.off("click",e.navigation.onNextClick),t.removeClass(e.params.navigation.disabledClass)),s&&s.length&&(s.off("click",e.navigation.onPrevClick),s.removeClass(e.params.navigation.disabledClass))}};const R={update(){const e=this,t=e.rtl,s=e.params.pagination;if(!s.el||!e.pagination.el||!e.pagination.$el||0===e.pagination.$el.length)return;const i=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,a=e.pagination.$el;let n;const r=e.params.loop?Math.ceil((i-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?(n=Math.ceil((e.activeIndex-e.loopedSlides)/e.params.slidesPerGroup),n>i-1-2*e.loopedSlides&&(n-=i-2*e.loopedSlides),n>r-1&&(n-=r),n<0&&"bullets"!==e.params.paginationType&&(n=r+n)):n=void 0!==e.snapIndex?e.snapIndex:e.activeIndex||0,"bullets"===s.type&&e.pagination.bullets&&e.pagination.bullets.length>0){const i=e.pagination.bullets;let r,l,o;if(s.dynamicBullets&&(e.pagination.bulletSize=i.eq(0)[e.isHorizontal()?"outerWidth":"outerHeight"](!0),a.css(e.isHorizontal()?"width":"height",e.pagination.bulletSize*(s.dynamicMainBullets+4)+"px"),s.dynamicMainBullets>1&&void 0!==e.previousIndex&&(e.pagination.dynamicBulletIndex+=n-e.previousIndex,e.pagination.dynamicBulletIndex>s.dynamicMainBullets-1?e.pagination.dynamicBulletIndex=s.dynamicMainBullets-1:e.pagination.dynamicBulletIndex<0&&(e.pagination.dynamicBulletIndex=0)),r=n-e.pagination.dynamicBulletIndex,l=r+(Math.min(i.length,s.dynamicMainBullets)-1),o=(l+r)/2),i.removeClass(`${s.bulletActiveClass} ${s.bulletActiveClass}-next ${s.bulletActiveClass}-next-next ${s.bulletActiveClass}-prev ${s.bulletActiveClass}-prev-prev ${s.bulletActiveClass}-main`),a.length>1)i.each((e,t)=>{const i=d(t),a=i.index();a===n&&i.addClass(s.bulletActiveClass),s.dynamicBullets&&(a>=r&&a<=l&&i.addClass(s.bulletActiveClass+"-main"),a===r&&i.prev().addClass(s.bulletActiveClass+"-prev").prev().addClass(s.bulletActiveClass+"-prev-prev"),a===l&&i.next().addClass(s.bulletActiveClass+"-next").next().addClass(s.bulletActiveClass+"-next-next"))});else{if(i.eq(n).addClass(s.bulletActiveClass),s.dynamicBullets){const e=i.eq(r),t=i.eq(l);for(let a=r;a<=l;a+=1)i.eq(a).addClass(s.bulletActiveClass+"-main");e.prev().addClass(s.bulletActiveClass+"-prev").prev().addClass(s.bulletActiveClass+"-prev-prev"),t.next().addClass(s.bulletActiveClass+"-next").next().addClass(s.bulletActiveClass+"-next-next")}}if(s.dynamicBullets){const a=Math.min(i.length,s.dynamicMainBullets+4),n=(e.pagination.bulletSize*a-e.pagination.bulletSize)/2-o*e.pagination.bulletSize,r=t?"right":"left";i.css(e.isHorizontal()?r:"top",n+"px")}}if("fraction"===s.type&&(a.find("."+s.currentClass).text(s.formatFractionCurrent(n+1)),a.find("."+s.totalClass).text(s.formatFractionTotal(r))),"progressbar"===s.type){let t;t=s.progressbarOpposite?e.isHorizontal()?"vertical":"horizontal":e.isHorizontal()?"horizontal":"vertical";const i=(n+1)/r;let l=1,o=1;"horizontal"===t?l=i:o=i,a.find("."+s.progressbarFillClass).transform(`translate3d(0,0,0) scaleX(${l}) scaleY(${o})`).transition(e.params.speed)}"custom"===s.type&&s.renderCustom?(a.html(s.renderCustom(e,n+1,r)),e.emit("paginationRender",e,a[0])):e.emit("paginationUpdate",e,a[0]),a[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](s.lockClass)},render(){const e=this,t=e.params.pagination;if(!t.el||!e.pagination.el||!e.pagination.$el||0===e.pagination.$el.length)return;const s=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,i=e.pagination.$el;let a="";if("bullets"===t.type){const n=e.params.loop?Math.ceil((s-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length;for(let s=0;s<n;s+=1)t.renderBullet?a+=t.renderBullet.call(e,s,t.bulletClass):a+=`<${t.bulletElement} class="${t.bulletClass}"></${t.bulletElement}>`;i.html(a),e.pagination.bullets=i.find("."+t.bulletClass)}"fraction"===t.type&&(a=t.renderFraction?t.renderFraction.call(e,t.currentClass,t.totalClass):`<span class="${t.currentClass}"></span> / <span class="${t.totalClass}"></span>`,i.html(a)),"progressbar"===t.type&&(a=t.renderProgressbar?t.renderProgressbar.call(e,t.progressbarFillClass):`<span class="${t.progressbarFillClass}"></span>`,i.html(a)),"custom"!==t.type&&e.emit("paginationRender",e.pagination.$el[0])},init(){const e=this,t=e.params.pagination;if(!t.el)return;let s=d(t.el);0!==s.length&&(e.params.uniqueNavElements&&"string"==typeof t.el&&s.length>1&&1===e.$el.find(t.el).length&&(s=e.$el.find(t.el)),"bullets"===t.type&&t.clickable&&s.addClass(t.clickableClass),s.addClass(t.modifierClass+t.type),"bullets"===t.type&&t.dynamicBullets&&(s.addClass(`${t.modifierClass}${t.type}-dynamic`),e.pagination.dynamicBulletIndex=0,t.dynamicMainBullets<1&&(t.dynamicMainBullets=1)),"progressbar"===t.type&&t.progressbarOpposite&&s.addClass(t.progressbarOppositeClass),t.clickable&&s.on("click","."+t.bulletClass,(function(t){t.preventDefault();let s=d(this).index()*e.params.slidesPerGroup;e.params.loop&&(s+=e.loopedSlides),e.slideTo(s)})),h.extend(e.pagination,{$el:s,el:s[0]}))},destroy(){const e=this.params.pagination;if(!e.el||!this.pagination.el||!this.pagination.$el||0===this.pagination.$el.length)return;const t=this.pagination.$el;t.removeClass(e.hiddenClass),t.removeClass(e.modifierClass+e.type),this.pagination.bullets&&this.pagination.bullets.removeClass(e.bulletActiveClass),e.clickable&&t.off("click","."+e.bulletClass)}};const W={setTranslate(){const e=this;if(!e.params.scrollbar.el||!e.scrollbar.el)return;const{scrollbar:t,rtlTranslate:s,progress:i}=e,{dragSize:a,trackSize:n,$dragEl:r,$el:l}=t,o=e.params.scrollbar;let d=a,p=(n-a)*i;s?(p=-p,p>0?(d=a-p,p=0):-p+a>n&&(d=n+p)):p<0?(d=a+p,p=0):p+a>n&&(d=n-p),e.isHorizontal()?(u.transforms3d?r.transform(`translate3d(${p}px, 0, 0)`):r.transform(`translateX(${p}px)`),r[0].style.width=d+"px"):(u.transforms3d?r.transform(`translate3d(0px, ${p}px, 0)`):r.transform(`translateY(${p}px)`),r[0].style.height=d+"px"),o.hide&&(clearTimeout(e.scrollbar.timeout),l[0].style.opacity=1,e.scrollbar.timeout=setTimeout(()=>{l[0].style.opacity=0,l.transition(400)},1e3))},setTransition(e){this.params.scrollbar.el&&this.scrollbar.el&&this.scrollbar.$dragEl.transition(e)},updateSize(){const e=this;if(!e.params.scrollbar.el||!e.scrollbar.el)return;const{scrollbar:t}=e,{$dragEl:s,$el:i}=t;s[0].style.width="",s[0].style.height="";const a=e.isHorizontal()?i[0].offsetWidth:i[0].offsetHeight,n=e.size/e.virtualSize,r=n*(a/e.size);let l;l="auto"===e.params.scrollbar.dragSize?a*n:parseInt(e.params.scrollbar.dragSize,10),e.isHorizontal()?s[0].style.width=l+"px":s[0].style.height=l+"px",i[0].style.display=n>=1?"none":"",e.params.scrollbar.hide&&(i[0].style.opacity=0),h.extend(t,{trackSize:a,divider:n,moveDivider:r,dragSize:l}),t.$el[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](e.params.scrollbar.lockClass)},getPointerPosition(e){return this.isHorizontal()?"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageX:e.pageX||e.clientX:"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].pageY:e.pageY||e.clientY},setDragPosition(e){const{scrollbar:t,rtlTranslate:s}=this,{$el:i,dragSize:a,trackSize:n,dragStartPos:r}=t;let l;l=(t.getPointerPosition(e)-i.offset()[this.isHorizontal()?"left":"top"]-(null!==r?r:a/2))/(n-a),l=Math.max(Math.min(l,1),0),s&&(l=1-l);const o=this.minTranslate()+(this.maxTranslate()-this.minTranslate())*l;this.updateProgress(o),this.setTranslate(o),this.updateActiveIndex(),this.updateSlidesClasses()},onDragStart(e){const t=this.params.scrollbar,{scrollbar:s,$wrapperEl:i}=this,{$el:a,$dragEl:n}=s;this.scrollbar.isTouched=!0,this.scrollbar.dragStartPos=e.target===n[0]||e.target===n?s.getPointerPosition(e)-e.target.getBoundingClientRect()[this.isHorizontal()?"left":"top"]:null,e.preventDefault(),e.stopPropagation(),i.transition(100),n.transition(100),s.setDragPosition(e),clearTimeout(this.scrollbar.dragTimeout),a.transition(0),t.hide&&a.css("opacity",1),this.emit("scrollbarDragStart",e)},onDragMove(e){const{scrollbar:t,$wrapperEl:s}=this,{$el:i,$dragEl:a}=t;this.scrollbar.isTouched&&(e.preventDefault?e.preventDefault():e.returnValue=!1,t.setDragPosition(e),s.transition(0),i.transition(0),a.transition(0),this.emit("scrollbarDragMove",e))},onDragEnd(e){const t=this,s=t.params.scrollbar,{scrollbar:i}=t,{$el:a}=i;t.scrollbar.isTouched&&(t.scrollbar.isTouched=!1,s.hide&&(clearTimeout(t.scrollbar.dragTimeout),t.scrollbar.dragTimeout=h.nextTick(()=>{a.css("opacity",0),a.transition(400)},1e3)),t.emit("scrollbarDragEnd",e),s.snapOnRelease&&t.slideToClosest())},enableDraggable(){const e=this;if(!e.params.scrollbar.el)return;const{scrollbar:t,touchEventsTouch:s,touchEventsDesktop:i,params:a}=e,n=t.$el[0],l=!(!u.passiveListener||!a.passiveListeners)&&{passive:!1,capture:!1},o=!(!u.passiveListener||!a.passiveListeners)&&{passive:!0,capture:!1};u.touch?(n.addEventListener(s.start,e.scrollbar.onDragStart,l),n.addEventListener(s.move,e.scrollbar.onDragMove,l),n.addEventListener(s.end,e.scrollbar.onDragEnd,o)):(n.addEventListener(i.start,e.scrollbar.onDragStart,l),r.addEventListener(i.move,e.scrollbar.onDragMove,l),r.addEventListener(i.end,e.scrollbar.onDragEnd,o))},disableDraggable(){const e=this;if(!e.params.scrollbar.el)return;const{scrollbar:t,touchEventsTouch:s,touchEventsDesktop:i,params:a}=e,n=t.$el[0],l=!(!u.passiveListener||!a.passiveListeners)&&{passive:!1,capture:!1},o=!(!u.passiveListener||!a.passiveListeners)&&{passive:!0,capture:!1};u.touch?(n.removeEventListener(s.start,e.scrollbar.onDragStart,l),n.removeEventListener(s.move,e.scrollbar.onDragMove,l),n.removeEventListener(s.end,e.scrollbar.onDragEnd,o)):(n.removeEventListener(i.start,e.scrollbar.onDragStart,l),r.removeEventListener(i.move,e.scrollbar.onDragMove,l),r.removeEventListener(i.end,e.scrollbar.onDragEnd,o))},init(){const e=this;if(!e.params.scrollbar.el)return;const{scrollbar:t,$el:s}=e,i=e.params.scrollbar;let a=d(i.el);e.params.uniqueNavElements&&"string"==typeof i.el&&a.length>1&&1===s.find(i.el).length&&(a=s.find(i.el));let n=a.find("."+e.params.scrollbar.dragClass);0===n.length&&(n=d(`<div class="${e.params.scrollbar.dragClass}"></div>`),a.append(n)),h.extend(t,{$el:a,el:a[0],$dragEl:n,dragEl:n[0]}),i.draggable&&t.enableDraggable()},destroy(){this.scrollbar.disableDraggable()}};const j={setTransform(e,t){const{rtl:s}=this,i=d(e),a=s?-1:1,n=i.attr("data-swiper-parallax")||"0";let r=i.attr("data-swiper-parallax-x"),l=i.attr("data-swiper-parallax-y");const o=i.attr("data-swiper-parallax-scale"),p=i.attr("data-swiper-parallax-opacity");if(r||l?(r=r||"0",l=l||"0"):this.isHorizontal()?(r=n,l="0"):(l=n,r="0"),r=r.indexOf("%")>=0?parseInt(r,10)*t*a+"%":r*t*a+"px",l=l.indexOf("%")>=0?parseInt(l,10)*t+"%":l*t+"px",null!=p){const e=p-(p-1)*(1-Math.abs(t));i[0].style.opacity=e}if(null==o)i.transform(`translate3d(${r}, ${l}, 0px)`);else{const e=o-(o-1)*(1-Math.abs(t));i.transform(`translate3d(${r}, ${l}, 0px) scale(${e})`)}},setTranslate(){const e=this,{$el:t,slides:s,progress:i,snapGrid:a}=e;t.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((t,s)=>{e.parallax.setTransform(s,i)}),s.each((t,s)=>{let n=s.progress;e.params.slidesPerGroup>1&&"auto"!==e.params.slidesPerView&&(n+=Math.ceil(t/2)-i*(a.length-1)),n=Math.min(Math.max(n,-1),1),d(s).find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((t,s)=>{e.parallax.setTransform(s,n)})})},setTransition(e=this.params.speed){const{$el:t}=this;t.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((t,s)=>{const i=d(s);let a=parseInt(i.attr("data-swiper-parallax-duration"),10)||e;0===e&&(a=0),i.transition(a)})}};const _={getDistanceBetweenTouches(e){if(e.targetTouches.length<2)return 1;const t=e.targetTouches[0].pageX,s=e.targetTouches[0].pageY,i=e.targetTouches[1].pageX,a=e.targetTouches[1].pageY;return Math.sqrt((i-t)**2+(a-s)**2)},onGestureStart(e){const t=this,s=t.params.zoom,i=t.zoom,{gesture:a}=i;if(i.fakeGestureTouched=!1,i.fakeGestureMoved=!1,!u.gestures){if("touchstart"!==e.type||"touchstart"===e.type&&e.targetTouches.length<2)return;i.fakeGestureTouched=!0,a.scaleStart=_.getDistanceBetweenTouches(e)}a.$slideEl&&a.$slideEl.length||(a.$slideEl=d(e.target).closest(".swiper-slide"),0===a.$slideEl.length&&(a.$slideEl=t.slides.eq(t.activeIndex)),a.$imageEl=a.$slideEl.find("img, svg, canvas"),a.$imageWrapEl=a.$imageEl.parent("."+s.containerClass),a.maxRatio=a.$imageWrapEl.attr("data-swiper-zoom")||s.maxRatio,0!==a.$imageWrapEl.length)?(a.$imageEl.transition(0),t.zoom.isScaling=!0):a.$imageEl=void 0},onGestureChange(e){const t=this.params.zoom,s=this.zoom,{gesture:i}=s;if(!u.gestures){if("touchmove"!==e.type||"touchmove"===e.type&&e.targetTouches.length<2)return;s.fakeGestureMoved=!0,i.scaleMove=_.getDistanceBetweenTouches(e)}i.$imageEl&&0!==i.$imageEl.length&&(u.gestures?s.scale=e.scale*s.currentScale:s.scale=i.scaleMove/i.scaleStart*s.currentScale,s.scale>i.maxRatio&&(s.scale=i.maxRatio-1+(s.scale-i.maxRatio+1)**.5),s.scale<t.minRatio&&(s.scale=t.minRatio+1-(t.minRatio-s.scale+1)**.5),i.$imageEl.transform(`translate3d(0,0,0) scale(${s.scale})`))},onGestureEnd(e){const t=this.params.zoom,s=this.zoom,{gesture:i}=s;if(!u.gestures){if(!s.fakeGestureTouched||!s.fakeGestureMoved)return;if("touchend"!==e.type||"touchend"===e.type&&e.changedTouches.length<2&&!E.android)return;s.fakeGestureTouched=!1,s.fakeGestureMoved=!1}i.$imageEl&&0!==i.$imageEl.length&&(s.scale=Math.max(Math.min(s.scale,i.maxRatio),t.minRatio),i.$imageEl.transition(this.params.speed).transform(`translate3d(0,0,0) scale(${s.scale})`),s.currentScale=s.scale,s.isScaling=!1,1===s.scale&&(i.$slideEl=void 0))},onTouchStart(e){const t=this.zoom,{gesture:s,image:i}=t;s.$imageEl&&0!==s.$imageEl.length&&(i.isTouched||(E.android&&e.preventDefault(),i.isTouched=!0,i.touchesStart.x="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,i.touchesStart.y="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY))},onTouchMove(e){const t=this,s=t.zoom,{gesture:i,image:a,velocity:n}=s;if(!i.$imageEl||0===i.$imageEl.length)return;if(t.allowClick=!1,!a.isTouched||!i.$slideEl)return;a.isMoved||(a.width=i.$imageEl[0].offsetWidth,a.height=i.$imageEl[0].offsetHeight,a.startX=h.getTranslate(i.$imageWrapEl[0],"x")||0,a.startY=h.getTranslate(i.$imageWrapEl[0],"y")||0,i.slideWidth=i.$slideEl[0].offsetWidth,i.slideHeight=i.$slideEl[0].offsetHeight,i.$imageWrapEl.transition(0),t.rtl&&(a.startX=-a.startX,a.startY=-a.startY));const r=a.width*s.scale,l=a.height*s.scale;if(!(r<i.slideWidth&&l<i.slideHeight)){if(a.minX=Math.min(i.slideWidth/2-r/2,0),a.maxX=-a.minX,a.minY=Math.min(i.slideHeight/2-l/2,0),a.maxY=-a.minY,a.touchesCurrent.x="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,a.touchesCurrent.y="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,!a.isMoved&&!s.isScaling){if(t.isHorizontal()&&(Math.floor(a.minX)===Math.floor(a.startX)&&a.touchesCurrent.x<a.touchesStart.x||Math.floor(a.maxX)===Math.floor(a.startX)&&a.touchesCurrent.x>a.touchesStart.x))return void(a.isTouched=!1);if(!t.isHorizontal()&&(Math.floor(a.minY)===Math.floor(a.startY)&&a.touchesCurrent.y<a.touchesStart.y||Math.floor(a.maxY)===Math.floor(a.startY)&&a.touchesCurrent.y>a.touchesStart.y))return void(a.isTouched=!1)}e.preventDefault(),e.stopPropagation(),a.isMoved=!0,a.currentX=a.touchesCurrent.x-a.touchesStart.x+a.startX,a.currentY=a.touchesCurrent.y-a.touchesStart.y+a.startY,a.currentX<a.minX&&(a.currentX=a.minX+1-(a.minX-a.currentX+1)**.8),a.currentX>a.maxX&&(a.currentX=a.maxX-1+(a.currentX-a.maxX+1)**.8),a.currentY<a.minY&&(a.currentY=a.minY+1-(a.minY-a.currentY+1)**.8),a.currentY>a.maxY&&(a.currentY=a.maxY-1+(a.currentY-a.maxY+1)**.8),n.prevPositionX||(n.prevPositionX=a.touchesCurrent.x),n.prevPositionY||(n.prevPositionY=a.touchesCurrent.y),n.prevTime||(n.prevTime=Date.now()),n.x=(a.touchesCurrent.x-n.prevPositionX)/(Date.now()-n.prevTime)/2,n.y=(a.touchesCurrent.y-n.prevPositionY)/(Date.now()-n.prevTime)/2,Math.abs(a.touchesCurrent.x-n.prevPositionX)<2&&(n.x=0),Math.abs(a.touchesCurrent.y-n.prevPositionY)<2&&(n.y=0),n.prevPositionX=a.touchesCurrent.x,n.prevPositionY=a.touchesCurrent.y,n.prevTime=Date.now(),i.$imageWrapEl.transform(`translate3d(${a.currentX}px, ${a.currentY}px,0)`)}},onTouchEnd(){const e=this.zoom,{gesture:t,image:s,velocity:i}=e;if(!t.$imageEl||0===t.$imageEl.length)return;if(!s.isTouched||!s.isMoved)return s.isTouched=!1,void(s.isMoved=!1);s.isTouched=!1,s.isMoved=!1;let a=300,n=300;const r=i.x*a,l=s.currentX+r,o=i.y*n,d=s.currentY+o;0!==i.x&&(a=Math.abs((l-s.currentX)/i.x)),0!==i.y&&(n=Math.abs((d-s.currentY)/i.y));const p=Math.max(a,n);s.currentX=l,s.currentY=d;const c=s.width*e.scale,h=s.height*e.scale;s.minX=Math.min(t.slideWidth/2-c/2,0),s.maxX=-s.minX,s.minY=Math.min(t.slideHeight/2-h/2,0),s.maxY=-s.minY,s.currentX=Math.max(Math.min(s.currentX,s.maxX),s.minX),s.currentY=Math.max(Math.min(s.currentY,s.maxY),s.minY),t.$imageWrapEl.transition(p).transform(`translate3d(${s.currentX}px, ${s.currentY}px,0)`)},onTransitionEnd(){const e=this.zoom,{gesture:t}=e;t.$slideEl&&this.previousIndex!==this.activeIndex&&(t.$imageEl.transform("translate3d(0,0,0) scale(1)"),t.$imageWrapEl.transform("translate3d(0,0,0)"),e.scale=1,e.currentScale=1,t.$slideEl=void 0,t.$imageEl=void 0,t.$imageWrapEl=void 0)},toggle(e){const t=this.zoom;t.scale&&1!==t.scale?t.out():t.in(e)},in(e){const t=this,s=t.zoom,i=t.params.zoom,{gesture:a,image:n}=s;if(a.$slideEl||(a.$slideEl=t.clickedSlide?d(t.clickedSlide):t.slides.eq(t.activeIndex),a.$imageEl=a.$slideEl.find("img, svg, canvas"),a.$imageWrapEl=a.$imageEl.parent("."+i.containerClass)),!a.$imageEl||0===a.$imageEl.length)return;let r,l,o,p,c,h,u,m,f,g,v,b,w,y,x,T,E,S;a.$slideEl.addClass(""+i.zoomedSlideClass),void 0===n.touchesStart.x&&e?(r="touchend"===e.type?e.changedTouches[0].pageX:e.pageX,l="touchend"===e.type?e.changedTouches[0].pageY:e.pageY):(r=n.touchesStart.x,l=n.touchesStart.y),s.scale=a.$imageWrapEl.attr("data-swiper-zoom")||i.maxRatio,s.currentScale=a.$imageWrapEl.attr("data-swiper-zoom")||i.maxRatio,e?(E=a.$slideEl[0].offsetWidth,S=a.$slideEl[0].offsetHeight,o=a.$slideEl.offset().left,p=a.$slideEl.offset().top,c=o+E/2-r,h=p+S/2-l,f=a.$imageEl[0].offsetWidth,g=a.$imageEl[0].offsetHeight,v=f*s.scale,b=g*s.scale,w=Math.min(E/2-v/2,0),y=Math.min(S/2-b/2,0),x=-w,T=-y,u=c*s.scale,m=h*s.scale,u<w&&(u=w),u>x&&(u=x),m<y&&(m=y),m>T&&(m=T)):(u=0,m=0),a.$imageWrapEl.transition(300).transform(`translate3d(${u}px, ${m}px,0)`),a.$imageEl.transition(300).transform(`translate3d(0,0,0) scale(${s.scale})`)},out(){const e=this,t=e.zoom,s=e.params.zoom,{gesture:i}=t;i.$slideEl||(i.$slideEl=e.clickedSlide?d(e.clickedSlide):e.slides.eq(e.activeIndex),i.$imageEl=i.$slideEl.find("img, svg, canvas"),i.$imageWrapEl=i.$imageEl.parent("."+s.containerClass)),i.$imageEl&&0!==i.$imageEl.length&&(t.scale=1,t.currentScale=1,i.$imageWrapEl.transition(300).transform("translate3d(0,0,0)"),i.$imageEl.transition(300).transform("translate3d(0,0,0) scale(1)"),i.$slideEl.removeClass(""+s.zoomedSlideClass),i.$slideEl=void 0)},enable(){const e=this,t=e.zoom;if(t.enabled)return;t.enabled=!0;const s=!("touchstart"!==e.touchEvents.start||!u.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1};u.gestures?(e.$wrapperEl.on("gesturestart",".swiper-slide",t.onGestureStart,s),e.$wrapperEl.on("gesturechange",".swiper-slide",t.onGestureChange,s),e.$wrapperEl.on("gestureend",".swiper-slide",t.onGestureEnd,s)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.on(e.touchEvents.start,".swiper-slide",t.onGestureStart,s),e.$wrapperEl.on(e.touchEvents.move,".swiper-slide",t.onGestureChange,s),e.$wrapperEl.on(e.touchEvents.end,".swiper-slide",t.onGestureEnd,s)),e.$wrapperEl.on(e.touchEvents.move,"."+e.params.zoom.containerClass,t.onTouchMove)},disable(){const e=this,t=e.zoom;if(!t.enabled)return;e.zoom.enabled=!1;const s=!("touchstart"!==e.touchEvents.start||!u.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1};u.gestures?(e.$wrapperEl.off("gesturestart",".swiper-slide",t.onGestureStart,s),e.$wrapperEl.off("gesturechange",".swiper-slide",t.onGestureChange,s),e.$wrapperEl.off("gestureend",".swiper-slide",t.onGestureEnd,s)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.off(e.touchEvents.start,".swiper-slide",t.onGestureStart,s),e.$wrapperEl.off(e.touchEvents.move,".swiper-slide",t.onGestureChange,s),e.$wrapperEl.off(e.touchEvents.end,".swiper-slide",t.onGestureEnd,s)),e.$wrapperEl.off(e.touchEvents.move,"."+e.params.zoom.containerClass,t.onTouchMove)}};const U={loadInSlide(e,t=!0){const s=this,i=s.params.lazy;if(void 0===e)return;if(0===s.slides.length)return;const a=s.virtual&&s.params.virtual.enabled?s.$wrapperEl.children(`.${s.params.slideClass}[data-swiper-slide-index="${e}"]`):s.slides.eq(e);let n=a.find(`.${i.elementClass}:not(.${i.loadedClass}):not(.${i.loadingClass})`);!a.hasClass(i.elementClass)||a.hasClass(i.loadedClass)||a.hasClass(i.loadingClass)||(n=n.add(a[0])),0!==n.length&&n.each((e,n)=>{const r=d(n);r.addClass(i.loadingClass);const l=r.attr("data-background"),o=r.attr("data-src"),p=r.attr("data-srcset"),c=r.attr("data-sizes");s.loadImage(r[0],o||l,p,c,!1,()=>{if(null!=s&&s&&(!s||s.params)&&!s.destroyed){if(l?(r.css("background-image",`url("${l}")`),r.removeAttr("data-background")):(p&&(r.attr("srcset",p),r.removeAttr("data-srcset")),c&&(r.attr("sizes",c),r.removeAttr("data-sizes")),o&&(r.attr("src",o),r.removeAttr("data-src"))),r.addClass(i.loadedClass).removeClass(i.loadingClass),a.find("."+i.preloaderClass).remove(),s.params.loop&&t){const e=a.attr("data-swiper-slide-index");if(a.hasClass(s.params.slideDuplicateClass)){const t=s.$wrapperEl.children(`[data-swiper-slide-index="${e}"]:not(.${s.params.slideDuplicateClass})`);s.lazy.loadInSlide(t.index(),!1)}else{const t=s.$wrapperEl.children(`.${s.params.slideDuplicateClass}[data-swiper-slide-index="${e}"]`);s.lazy.loadInSlide(t.index(),!1)}}s.emit("lazyImageReady",a[0],r[0])}}),s.emit("lazyImageLoad",a[0],r[0])})},load(){const e=this,{$wrapperEl:t,params:s,slides:i,activeIndex:a}=e,n=e.virtual&&s.virtual.enabled,r=s.lazy;let l=s.slidesPerView;function o(e){if(n){if(t.children(`.${s.slideClass}[data-swiper-slide-index="${e}"]`).length)return!0}else if(i[e])return!0;return!1}function p(e){return n?d(e).attr("data-swiper-slide-index"):d(e).index()}if("auto"===l&&(l=0),e.lazy.initialImageLoaded||(e.lazy.initialImageLoaded=!0),e.params.watchSlidesVisibility)t.children("."+s.slideVisibleClass).each((t,s)=>{const i=n?d(s).attr("data-swiper-slide-index"):d(s).index();e.lazy.loadInSlide(i)});else if(l>1)for(let d=a;d<a+l;d+=1)o(d)&&e.lazy.loadInSlide(d);else e.lazy.loadInSlide(a);if(r.loadPrevNext)if(l>1||r.loadPrevNextAmount&&r.loadPrevNextAmount>1){const t=r.loadPrevNextAmount,s=l,n=Math.min(a+s+Math.max(t,s),i.length),d=Math.max(a-Math.max(s,t),0);for(let i=a+l;i<n;i+=1)o(i)&&e.lazy.loadInSlide(i);for(let i=d;i<a;i+=1)o(i)&&e.lazy.loadInSlide(i)}else{const i=t.children("."+s.slideNextClass);i.length>0&&e.lazy.loadInSlide(p(i));const a=t.children("."+s.slidePrevClass);a.length>0&&e.lazy.loadInSlide(p(a))}}};const K={LinearSpline:function(e,t){const s=function(){let e,t,s;return(i,a)=>{for(t=-1,e=i.length;e-t>1;)s=e+t>>1,i[s]<=a?t=s:e=s;return e}}();let i,a;return this.x=e,this.y=t,this.lastIndex=e.length-1,this.interpolate=function(e){return e?(a=s(this.x,e),i=a-1,(e-this.x[i])*(this.y[a]-this.y[i])/(this.x[a]-this.x[i])+this.y[i]):0},this},getInterpolateFunction(e){const t=this;t.controller.spline||(t.controller.spline=t.params.loop?new K.LinearSpline(t.slidesGrid,e.slidesGrid):new K.LinearSpline(t.snapGrid,e.snapGrid))},setTranslate(e,t){const s=this,i=s.controller.control;let a,n;function r(e){const t=s.rtlTranslate?-s.translate:s.translate;"slide"===s.params.controller.by&&(s.controller.getInterpolateFunction(e),n=-s.controller.spline.interpolate(-t)),n&&"container"!==s.params.controller.by||(a=(e.maxTranslate()-e.minTranslate())/(s.maxTranslate()-s.minTranslate()),n=(t-s.minTranslate())*a+e.minTranslate()),s.params.controller.inverse&&(n=e.maxTranslate()-n),e.updateProgress(n),e.setTranslate(n,s),e.updateActiveIndex(),e.updateSlidesClasses()}if(Array.isArray(i))for(let l=0;l<i.length;l+=1)i[l]!==t&&i[l]instanceof L&&r(i[l]);else i instanceof L&&t!==i&&r(i)},setTransition(e,t){const s=this,i=s.controller.control;let a;function n(t){t.setTransition(e,s),0!==e&&(t.transitionStart(),t.params.autoHeight&&h.nextTick(()=>{t.updateAutoHeight()}),t.$wrapperEl.transitionEnd(()=>{i&&(t.params.loop&&"slide"===s.params.controller.by&&t.loopFix(),t.transitionEnd())}))}if(Array.isArray(i))for(a=0;a<i.length;a+=1)i[a]!==t&&i[a]instanceof L&&n(i[a]);else i instanceof L&&t!==i&&n(i)}};const Z={makeElFocusable:e=>(e.attr("tabIndex","0"),e),addElRole:(e,t)=>(e.attr("role",t),e),addElLabel:(e,t)=>(e.attr("aria-label",t),e),disableEl:e=>(e.attr("aria-disabled",!0),e),enableEl:e=>(e.attr("aria-disabled",!1),e),onEnterKey(e){const t=this,s=t.params.a11y;if(13!==e.keyCode)return;const i=d(e.target);t.navigation&&t.navigation.$nextEl&&i.is(t.navigation.$nextEl)&&(t.isEnd&&!t.params.loop||t.slideNext(),t.isEnd?t.a11y.notify(s.lastSlideMessage):t.a11y.notify(s.nextSlideMessage)),t.navigation&&t.navigation.$prevEl&&i.is(t.navigation.$prevEl)&&(t.isBeginning&&!t.params.loop||t.slidePrev(),t.isBeginning?t.a11y.notify(s.firstSlideMessage):t.a11y.notify(s.prevSlideMessage)),t.pagination&&i.is("."+t.params.pagination.bulletClass)&&i[0].click()},notify(e){const t=this.a11y.liveRegion;0!==t.length&&(t.html(""),t.html(e))},updateNavigation(){const e=this;if(e.params.loop)return;const{$nextEl:t,$prevEl:s}=e.navigation;s&&s.length>0&&(e.isBeginning?e.a11y.disableEl(s):e.a11y.enableEl(s)),t&&t.length>0&&(e.isEnd?e.a11y.disableEl(t):e.a11y.enableEl(t))},updatePagination(){const e=this,t=e.params.a11y;e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.bullets.each((s,i)=>{const a=d(i);e.a11y.makeElFocusable(a),e.a11y.addElRole(a,"button"),e.a11y.addElLabel(a,t.paginationBulletMessage.replace(/{{index}}/,a.index()+1))})},init(){const e=this;e.$el.append(e.a11y.liveRegion);const t=e.params.a11y;let s,i;e.navigation&&e.navigation.$nextEl&&(s=e.navigation.$nextEl),e.navigation&&e.navigation.$prevEl&&(i=e.navigation.$prevEl),s&&(e.a11y.makeElFocusable(s),e.a11y.addElRole(s,"button"),e.a11y.addElLabel(s,t.nextSlideMessage),s.on("keydown",e.a11y.onEnterKey)),i&&(e.a11y.makeElFocusable(i),e.a11y.addElRole(i,"button"),e.a11y.addElLabel(i,t.prevSlideMessage),i.on("keydown",e.a11y.onEnterKey)),e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.$el.on("keydown","."+e.params.pagination.bulletClass,e.a11y.onEnterKey)},destroy(){const e=this;let t,s;e.a11y.liveRegion&&e.a11y.liveRegion.length>0&&e.a11y.liveRegion.remove(),e.navigation&&e.navigation.$nextEl&&(t=e.navigation.$nextEl),e.navigation&&e.navigation.$prevEl&&(s=e.navigation.$prevEl),t&&t.off("keydown",e.a11y.onEnterKey),s&&s.off("keydown",e.a11y.onEnterKey),e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.$el.off("keydown","."+e.params.pagination.bulletClass,e.a11y.onEnterKey)}};const Q={init(){const e=this;if(!e.params.history)return;if(!l.history||!l.history.pushState)return e.params.history.enabled=!1,void(e.params.hashNavigation.enabled=!0);const t=e.history;t.initialized=!0,t.paths=Q.getPathValues(),(t.paths.key||t.paths.value)&&(t.scrollToSlide(0,t.paths.value,e.params.runCallbacksOnInit),e.params.history.replaceState||l.addEventListener("popstate",e.history.setHistoryPopState))},destroy(){const e=this;e.params.history.replaceState||l.removeEventListener("popstate",e.history.setHistoryPopState)},setHistoryPopState(){this.history.paths=Q.getPathValues(),this.history.scrollToSlide(this.params.speed,this.history.paths.value,!1)},getPathValues(){const e=l.location.pathname.slice(1).split("/").filter(e=>""!==e),t=e.length;return{key:e[t-2],value:e[t-1]}},setHistory(e,t){if(!this.history.initialized||!this.params.history.enabled)return;const s=this.slides.eq(t);let i=Q.slugify(s.attr("data-history"));l.location.pathname.includes(e)||(i=`${e}/${i}`);const a=l.history.state;a&&a.value===i||(this.params.history.replaceState?l.history.replaceState({value:i},null,i):l.history.pushState({value:i},null,i))},slugify:e=>e.toString().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,""),scrollToSlide(e,t,s){const i=this;if(t)for(let a=0,n=i.slides.length;a<n;a+=1){const n=i.slides.eq(a);if(Q.slugify(n.attr("data-history"))===t&&!n.hasClass(i.params.slideDuplicateClass)){const t=n.index();i.slideTo(t,e,s)}}else i.slideTo(0,e,s)}};const J={onHashCange(){const e=this,t=r.location.hash.replace("#","");if(t!==e.slides.eq(e.activeIndex).attr("data-hash")){const s=e.$wrapperEl.children(`.${e.params.slideClass}[data-hash="${t}"]`).index();if(void 0===s)return;e.slideTo(s)}},setHash(){const e=this;if(e.hashNavigation.initialized&&e.params.hashNavigation.enabled)if(e.params.hashNavigation.replaceState&&l.history&&l.history.replaceState)l.history.replaceState(null,null,"#"+e.slides.eq(e.activeIndex).attr("data-hash")||"");else{const t=e.slides.eq(e.activeIndex),s=t.attr("data-hash")||t.attr("data-history");r.location.hash=s||""}},init(){const e=this;if(!e.params.hashNavigation.enabled||e.params.history&&e.params.history.enabled)return;e.hashNavigation.initialized=!0;const t=r.location.hash.replace("#","");if(t){const s=0;for(let i=0,a=e.slides.length;i<a;i+=1){const a=e.slides.eq(i);if((a.attr("data-hash")||a.attr("data-history"))===t&&!a.hasClass(e.params.slideDuplicateClass)){const t=a.index();e.slideTo(t,s,e.params.runCallbacksOnInit,!0)}}}e.params.hashNavigation.watchState&&d(l).on("hashchange",e.hashNavigation.onHashCange)},destroy(){const e=this;e.params.hashNavigation.watchState&&d(l).off("hashchange",e.hashNavigation.onHashCange)}};const ee={run(){const e=this,t=e.slides.eq(e.activeIndex);let s=e.params.autoplay.delay;t.attr("data-swiper-autoplay")&&(s=t.attr("data-swiper-autoplay")||e.params.autoplay.delay),clearTimeout(e.autoplay.timeout),e.autoplay.timeout=h.nextTick(()=>{e.params.autoplay.reverseDirection?e.params.loop?(e.loopFix(),e.slidePrev(e.params.speed,!0,!0),e.emit("autoplay")):e.isBeginning?e.params.autoplay.stopOnLastSlide?e.autoplay.stop():(e.slideTo(e.slides.length-1,e.params.speed,!0,!0),e.emit("autoplay")):(e.slidePrev(e.params.speed,!0,!0),e.emit("autoplay")):e.params.loop?(e.loopFix(),e.slideNext(e.params.speed,!0,!0),e.emit("autoplay")):e.isEnd?e.params.autoplay.stopOnLastSlide?e.autoplay.stop():(e.slideTo(0,e.params.speed,!0,!0),e.emit("autoplay")):(e.slideNext(e.params.speed,!0,!0),e.emit("autoplay"))},s)},start(){return void 0===this.autoplay.timeout&&(!this.autoplay.running&&(this.autoplay.running=!0,this.emit("autoplayStart"),this.autoplay.run(),!0))},stop(){const e=this;return!!e.autoplay.running&&(void 0!==e.autoplay.timeout&&(e.autoplay.timeout&&(clearTimeout(e.autoplay.timeout),e.autoplay.timeout=void 0),e.autoplay.running=!1,e.emit("autoplayStop"),!0))},pause(e){const t=this;t.autoplay.running&&(t.autoplay.paused||(t.autoplay.timeout&&clearTimeout(t.autoplay.timeout),t.autoplay.paused=!0,0!==e&&t.params.autoplay.waitForTransition?(t.$wrapperEl[0].addEventListener("transitionend",t.autoplay.onTransitionEnd),t.$wrapperEl[0].addEventListener("webkitTransitionEnd",t.autoplay.onTransitionEnd)):(t.autoplay.paused=!1,t.autoplay.run())))}};const te={setTranslate(){const e=this,{slides:t}=e;for(let s=0;s<t.length;s+=1){const t=e.slides.eq(s);let i=-t[0].swiperSlideOffset;e.params.virtualTranslate||(i-=e.translate);let a=0;e.isHorizontal()||(a=i,i=0);const n=e.params.fadeEffect.crossFade?Math.max(1-Math.abs(t[0].progress),0):1+Math.min(Math.max(t[0].progress,-1),0);t.css({opacity:n}).transform(`translate3d(${i}px, ${a}px, 0px)`)}},setTransition(e){const t=this,{slides:s,$wrapperEl:i}=t;if(s.transition(e),t.params.virtualTranslate&&0!==e){let e=!1;s.transitionEnd(()=>{if(e)return;if(!t||t.destroyed)return;e=!0,t.animating=!1;const s=["webkitTransitionEnd","transitionend"];for(let e=0;e<s.length;e+=1)i.trigger(s[e])})}}};const se={setTranslate(){const{$el:e,$wrapperEl:t,slides:s,width:i,height:a,rtlTranslate:n,size:r}=this,l=this.params.cubeEffect,o=this.isHorizontal(),p=this.virtual&&this.params.virtual.enabled;let c,h=0;l.shadow&&(o?(c=t.find(".swiper-cube-shadow"),0===c.length&&(c=d('<div class="swiper-cube-shadow"></div>'),t.append(c)),c.css({height:i+"px"})):(c=e.find(".swiper-cube-shadow"),0===c.length&&(c=d('<div class="swiper-cube-shadow"></div>'),e.append(c))));for(let m=0;m<s.length;m+=1){const e=s.eq(m);let t=m;p&&(t=parseInt(e.attr("data-swiper-slide-index"),10));let i=90*t,a=Math.floor(i/360);n&&(i=-i,a=Math.floor(-i/360));const c=Math.max(Math.min(e[0].progress,1),-1);let u=0,f=0,g=0;t%4==0?(u=4*-a*r,g=0):(t-1)%4==0?(u=0,g=4*-a*r):(t-2)%4==0?(u=r+4*a*r,g=r):(t-3)%4==0&&(u=-r,g=3*r+4*r*a),n&&(u=-u),o||(f=u,u=0);const v=`rotateX(${o?0:-i}deg) rotateY(${o?i:0}deg) translate3d(${u}px, ${f}px, ${g}px)`;if(c<=1&&c>-1&&(h=90*t+90*c,n&&(h=90*-t-90*c)),e.transform(v),l.slideShadows){let t=o?e.find(".swiper-slide-shadow-left"):e.find(".swiper-slide-shadow-top"),s=o?e.find(".swiper-slide-shadow-right"):e.find(".swiper-slide-shadow-bottom");0===t.length&&(t=d(`<div class="swiper-slide-shadow-${o?"left":"top"}"></div>`),e.append(t)),0===s.length&&(s=d(`<div class="swiper-slide-shadow-${o?"right":"bottom"}"></div>`),e.append(s)),t.length&&(t[0].style.opacity=Math.max(-c,0)),s.length&&(s[0].style.opacity=Math.max(c,0))}}if(t.css({"-webkit-transform-origin":`50% 50% -${r/2}px`,"-moz-transform-origin":`50% 50% -${r/2}px`,"-ms-transform-origin":`50% 50% -${r/2}px`,"transform-origin":`50% 50% -${r/2}px`}),l.shadow)if(o)c.transform(`translate3d(0px, ${i/2+l.shadowOffset}px, ${-i/2}px) rotateX(90deg) rotateZ(0deg) scale(${l.shadowScale})`);else{const e=Math.abs(h)-90*Math.floor(Math.abs(h)/90),t=1.5-(Math.sin(2*e*Math.PI/360)/2+Math.cos(2*e*Math.PI/360)/2),s=l.shadowScale,i=l.shadowScale/t,n=l.shadowOffset;c.transform(`scale3d(${s}, 1, ${i}) translate3d(0px, ${a/2+n}px, ${-a/2/i}px) rotateX(-90deg)`)}const u=m.isSafari||m.isUiWebView?-r/2:0;t.transform(`translate3d(0px,0,${u}px) rotateX(${this.isHorizontal()?0:h}deg) rotateY(${this.isHorizontal()?-h:0}deg)`)},setTransition(e){const{$el:t,slides:s}=this;s.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),this.params.cubeEffect.shadow&&!this.isHorizontal()&&t.find(".swiper-cube-shadow").transition(e)}};const ie={setTranslate(){const e=this,{slides:t,rtlTranslate:s}=e;for(let i=0;i<t.length;i+=1){const a=t.eq(i);let n=a[0].progress;e.params.flipEffect.limitRotation&&(n=Math.max(Math.min(a[0].progress,1),-1));let r=-180*n,l=0,o=-a[0].swiperSlideOffset,p=0;if(e.isHorizontal()?s&&(r=-r):(p=o,o=0,l=-r,r=0),a[0].style.zIndex=-Math.abs(Math.round(n))+t.length,e.params.flipEffect.slideShadows){let t=e.isHorizontal()?a.find(".swiper-slide-shadow-left"):a.find(".swiper-slide-shadow-top"),s=e.isHorizontal()?a.find(".swiper-slide-shadow-right"):a.find(".swiper-slide-shadow-bottom");0===t.length&&(t=d(`<div class="swiper-slide-shadow-${e.isHorizontal()?"left":"top"}"></div>`),a.append(t)),0===s.length&&(s=d(`<div class="swiper-slide-shadow-${e.isHorizontal()?"right":"bottom"}"></div>`),a.append(s)),t.length&&(t[0].style.opacity=Math.max(-n,0)),s.length&&(s[0].style.opacity=Math.max(n,0))}a.transform(`translate3d(${o}px, ${p}px, 0px) rotateX(${l}deg) rotateY(${r}deg)`)}},setTransition(e){const t=this,{slides:s,activeIndex:i,$wrapperEl:a}=t;if(s.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),t.params.virtualTranslate&&0!==e){let e=!1;s.eq(i).transitionEnd((function(){if(e)return;if(!t||t.destroyed)return;e=!0,t.animating=!1;const s=["webkitTransitionEnd","transitionend"];for(let e=0;e<s.length;e+=1)a.trigger(s[e])}))}}};const ae={setTranslate(){const{width:e,height:t,slides:s,$wrapperEl:i,slidesSizesGrid:a}=this,n=this.params.coverflowEffect,r=this.isHorizontal(),l=this.translate,o=r?e/2-l:t/2-l,p=r?n.rotate:-n.rotate,c=n.depth;for(let h=0,u=s.length;h<u;h+=1){const e=s.eq(h),t=a[h],i=(o-e[0].swiperSlideOffset-t/2)/t*n.modifier;let l=r?p*i:0,u=r?0:p*i,m=-c*Math.abs(i),f=r?0:n.stretch*i,g=r?n.stretch*i:0;Math.abs(g)<.001&&(g=0),Math.abs(f)<.001&&(f=0),Math.abs(m)<.001&&(m=0),Math.abs(l)<.001&&(l=0),Math.abs(u)<.001&&(u=0);const v=`translate3d(${g}px,${f}px,${m}px) rotateX(${u}deg) rotateY(${l}deg)`;if(e.transform(v),e[0].style.zIndex=1-Math.abs(Math.round(i)),n.slideShadows){let t=r?e.find(".swiper-slide-shadow-left"):e.find(".swiper-slide-shadow-top"),s=r?e.find(".swiper-slide-shadow-right"):e.find(".swiper-slide-shadow-bottom");0===t.length&&(t=d(`<div class="swiper-slide-shadow-${r?"left":"top"}"></div>`),e.append(t)),0===s.length&&(s=d(`<div class="swiper-slide-shadow-${r?"right":"bottom"}"></div>`),e.append(s)),t.length&&(t[0].style.opacity=i>0?i:0),s.length&&(s[0].style.opacity=-i>0?-i:0)}}if(u.pointerEvents||u.prefixedPointerEvents){i[0].style.perspectiveOrigin=o+"px 50%"}},setTransition(e){this.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}};const ne={init(){const e=this,{thumbs:t}=e.params,s=e.constructor;t.swiper instanceof s?(e.thumbs.swiper=t.swiper,h.extend(e.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),h.extend(e.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1})):h.isObject(t.swiper)&&(e.thumbs.swiper=new s(h.extend({},t.swiper,{watchSlidesVisibility:!0,watchSlidesProgress:!0,slideToClickedSlide:!1})),e.thumbs.swiperCreated=!0),e.thumbs.swiper.$el.addClass(e.params.thumbs.thumbsContainerClass),e.thumbs.swiper.on("tap",e.thumbs.onThumbClick)},onThumbClick(){const e=this,t=e.thumbs.swiper;if(!t)return;const s=t.clickedIndex,i=t.clickedSlide;if(i&&d(i).hasClass(e.params.thumbs.slideThumbActiveClass))return;if(null==s)return;let a;if(a=t.params.loop?parseInt(d(t.clickedSlide).attr("data-swiper-slide-index"),10):s,e.params.loop){let t=e.activeIndex;e.slides.eq(t).hasClass(e.params.slideDuplicateClass)&&(e.loopFix(),e._clientLeft=e.$wrapperEl[0].clientLeft,t=e.activeIndex);const s=e.slides.eq(t).prevAll(`[data-swiper-slide-index="${a}"]`).eq(0).index(),i=e.slides.eq(t).nextAll(`[data-swiper-slide-index="${a}"]`).eq(0).index();a=void 0===s?i:void 0===i?s:i-t<t-s?i:s}e.slideTo(a)},update(e){const t=this,s=t.thumbs.swiper;if(!s)return;const i="auto"===s.params.slidesPerView?s.slidesPerViewDynamic():s.params.slidesPerView;if(t.realIndex!==s.realIndex){let a,n=s.activeIndex;if(s.params.loop){s.slides.eq(n).hasClass(s.params.slideDuplicateClass)&&(s.loopFix(),s._clientLeft=s.$wrapperEl[0].clientLeft,n=s.activeIndex);const e=s.slides.eq(n).prevAll(`[data-swiper-slide-index="${t.realIndex}"]`).eq(0).index(),i=s.slides.eq(n).nextAll(`[data-swiper-slide-index="${t.realIndex}"]`).eq(0).index();a=void 0===e?i:void 0===i?e:i-n==n-e?n:i-n<n-e?i:e}else a=t.realIndex;s.visibleSlidesIndexes&&s.visibleSlidesIndexes.indexOf(a)<0&&(s.params.centeredSlides?a=a>n?a-Math.floor(i/2)+1:a+Math.floor(i/2)-1:a>n&&(a=a-i+1),s.slideTo(a,e?0:void 0))}let a=1;const n=t.params.thumbs.slideThumbActiveClass;if(t.params.slidesPerView>1&&!t.params.centeredSlides&&(a=t.params.slidesPerView),s.slides.removeClass(n),s.params.loop||s.params.virtual)for(let r=0;r<a;r+=1)s.$wrapperEl.children(`[data-swiper-slide-index="${t.realIndex+r}"]`).addClass(n);else for(let r=0;r<a;r+=1)s.slides.eq(t.realIndex+r).addClass(n)}};const re=[D,O,A,H,N,X,Y,{name:"mousewheel",params:{mousewheel:{enabled:!1,releaseOnEdges:!1,invert:!1,forceToAxis:!1,sensitivity:1,eventsTarged:"container"}},create(){h.extend(this,{mousewheel:{enabled:!1,enable:F.enable.bind(this),disable:F.disable.bind(this),handle:F.handle.bind(this),handleMouseEnter:F.handleMouseEnter.bind(this),handleMouseLeave:F.handleMouseLeave.bind(this),lastScrollTime:h.now()}})},on:{init(){this.params.mousewheel.enabled&&this.mousewheel.enable()},destroy(){this.mousewheel.enabled&&this.mousewheel.disable()}}},{name:"navigation",params:{navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock"}},create(){h.extend(this,{navigation:{init:q.init.bind(this),update:q.update.bind(this),destroy:q.destroy.bind(this),onNextClick:q.onNextClick.bind(this),onPrevClick:q.onPrevClick.bind(this)}})},on:{init(){this.navigation.init(),this.navigation.update()},toEdge(){this.navigation.update()},fromEdge(){this.navigation.update()},destroy(){this.navigation.destroy()},click(e){const t=this,{$nextEl:s,$prevEl:i}=t.navigation;if(t.params.navigation.hideOnClick&&!d(e.target).is(i)&&!d(e.target).is(s)){let e;s?e=s.hasClass(t.params.navigation.hiddenClass):i&&(e=i.hasClass(t.params.navigation.hiddenClass)),!0===e?t.emit("navigationShow",t):t.emit("navigationHide",t),s&&s.toggleClass(t.params.navigation.hiddenClass),i&&i.toggleClass(t.params.navigation.hiddenClass)}}}},{name:"pagination",params:{pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:e=>e,formatFractionTotal:e=>e,bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",modifierClass:"swiper-pagination-",currentClass:"swiper-pagination-current",totalClass:"swiper-pagination-total",hiddenClass:"swiper-pagination-hidden",progressbarFillClass:"swiper-pagination-progressbar-fill",progressbarOppositeClass:"swiper-pagination-progressbar-opposite",clickableClass:"swiper-pagination-clickable",lockClass:"swiper-pagination-lock"}},create(){h.extend(this,{pagination:{init:R.init.bind(this),render:R.render.bind(this),update:R.update.bind(this),destroy:R.destroy.bind(this),dynamicBulletIndex:0}})},on:{init(){this.pagination.init(),this.pagination.render(),this.pagination.update()},activeIndexChange(){const e=this;(e.params.loop||void 0===e.snapIndex)&&e.pagination.update()},snapIndexChange(){const e=this;e.params.loop||e.pagination.update()},slidesLengthChange(){const e=this;e.params.loop&&(e.pagination.render(),e.pagination.update())},snapGridLengthChange(){const e=this;e.params.loop||(e.pagination.render(),e.pagination.update())},destroy(){this.pagination.destroy()},click(e){const t=this;if(t.params.pagination.el&&t.params.pagination.hideOnClick&&t.pagination.$el.length>0&&!d(e.target).hasClass(t.params.pagination.bulletClass)){!0===t.pagination.$el.hasClass(t.params.pagination.hiddenClass)?t.emit("paginationShow",t):t.emit("paginationHide",t),t.pagination.$el.toggleClass(t.params.pagination.hiddenClass)}}}},{name:"scrollbar",params:{scrollbar:{el:null,dragSize:"auto",hide:!1,draggable:!1,snapOnRelease:!0,lockClass:"swiper-scrollbar-lock",dragClass:"swiper-scrollbar-drag"}},create(){h.extend(this,{scrollbar:{init:W.init.bind(this),destroy:W.destroy.bind(this),updateSize:W.updateSize.bind(this),setTranslate:W.setTranslate.bind(this),setTransition:W.setTransition.bind(this),enableDraggable:W.enableDraggable.bind(this),disableDraggable:W.disableDraggable.bind(this),setDragPosition:W.setDragPosition.bind(this),getPointerPosition:W.getPointerPosition.bind(this),onDragStart:W.onDragStart.bind(this),onDragMove:W.onDragMove.bind(this),onDragEnd:W.onDragEnd.bind(this),isTouched:!1,timeout:null,dragTimeout:null}})},on:{init(){this.scrollbar.init(),this.scrollbar.updateSize(),this.scrollbar.setTranslate()},update(){this.scrollbar.updateSize()},resize(){this.scrollbar.updateSize()},observerUpdate(){this.scrollbar.updateSize()},setTranslate(){this.scrollbar.setTranslate()},setTransition(e){this.scrollbar.setTransition(e)},destroy(){this.scrollbar.destroy()}}},{name:"parallax",params:{parallax:{enabled:!1}},create(){h.extend(this,{parallax:{setTransform:j.setTransform.bind(this),setTranslate:j.setTranslate.bind(this),setTransition:j.setTransition.bind(this)}})},on:{beforeInit(){this.params.parallax.enabled&&(this.params.watchSlidesProgress=!0,this.originalParams.watchSlidesProgress=!0)},init(){this.params.parallax.enabled&&this.parallax.setTranslate()},setTranslate(){this.params.parallax.enabled&&this.parallax.setTranslate()},setTransition(e){this.params.parallax.enabled&&this.parallax.setTransition(e)}}},{name:"zoom",params:{zoom:{enabled:!1,maxRatio:3,minRatio:1,toggle:!0,containerClass:"swiper-zoom-container",zoomedSlideClass:"swiper-slide-zoomed"}},create(){const e=this,t={enabled:!1,scale:1,currentScale:1,isScaling:!1,gesture:{$slideEl:void 0,slideWidth:void 0,slideHeight:void 0,$imageEl:void 0,$imageWrapEl:void 0,maxRatio:3},image:{isTouched:void 0,isMoved:void 0,currentX:void 0,currentY:void 0,minX:void 0,minY:void 0,maxX:void 0,maxY:void 0,width:void 0,height:void 0,startX:void 0,startY:void 0,touchesStart:{},touchesCurrent:{}},velocity:{x:void 0,y:void 0,prevPositionX:void 0,prevPositionY:void 0,prevTime:void 0}};"onGestureStart onGestureChange onGestureEnd onTouchStart onTouchMove onTouchEnd onTransitionEnd toggle enable disable in out".split(" ").forEach(s=>{t[s]=_[s].bind(e)}),h.extend(e,{zoom:t});let s=1;Object.defineProperty(e.zoom,"scale",{get:()=>s,set(t){if(s!==t){const s=e.zoom.gesture.$imageEl?e.zoom.gesture.$imageEl[0]:void 0,i=e.zoom.gesture.$slideEl?e.zoom.gesture.$slideEl[0]:void 0;e.emit("zoomChange",t,s,i)}s=t}})},on:{init(){const e=this;e.params.zoom.enabled&&e.zoom.enable()},destroy(){this.zoom.disable()},touchStart(e){this.zoom.enabled&&this.zoom.onTouchStart(e)},touchEnd(e){this.zoom.enabled&&this.zoom.onTouchEnd(e)},doubleTap(e){const t=this;t.params.zoom.enabled&&t.zoom.enabled&&t.params.zoom.toggle&&t.zoom.toggle(e)},transitionEnd(){const e=this;e.zoom.enabled&&e.params.zoom.enabled&&e.zoom.onTransitionEnd()}}},{name:"lazy",params:{lazy:{enabled:!1,loadPrevNext:!1,loadPrevNextAmount:1,loadOnTransitionStart:!1,elementClass:"swiper-lazy",loadingClass:"swiper-lazy-loading",loadedClass:"swiper-lazy-loaded",preloaderClass:"swiper-lazy-preloader"}},create(){h.extend(this,{lazy:{initialImageLoaded:!1,load:U.load.bind(this),loadInSlide:U.loadInSlide.bind(this)}})},on:{beforeInit(){const e=this;e.params.lazy.enabled&&e.params.preloadImages&&(e.params.preloadImages=!1)},init(){const e=this;e.params.lazy.enabled&&!e.params.loop&&0===e.params.initialSlide&&e.lazy.load()},scroll(){const e=this;e.params.freeMode&&!e.params.freeModeSticky&&e.lazy.load()},resize(){const e=this;e.params.lazy.enabled&&e.lazy.load()},scrollbarDragMove(){const e=this;e.params.lazy.enabled&&e.lazy.load()},transitionStart(){const e=this;e.params.lazy.enabled&&(e.params.lazy.loadOnTransitionStart||!e.params.lazy.loadOnTransitionStart&&!e.lazy.initialImageLoaded)&&e.lazy.load()},transitionEnd(){const e=this;e.params.lazy.enabled&&!e.params.lazy.loadOnTransitionStart&&e.lazy.load()}}},{name:"controller",params:{controller:{control:void 0,inverse:!1,by:"slide"}},create(){h.extend(this,{controller:{control:this.params.controller.control,getInterpolateFunction:K.getInterpolateFunction.bind(this),setTranslate:K.setTranslate.bind(this),setTransition:K.setTransition.bind(this)}})},on:{update(){const e=this;e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},resize(){const e=this;e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},observerUpdate(){const e=this;e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},setTranslate(e,t){this.controller.control&&this.controller.setTranslate(e,t)},setTransition(e,t){this.controller.control&&this.controller.setTransition(e,t)}}},{name:"a11y",params:{a11y:{enabled:!0,notificationClass:"swiper-notification",prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}"}},create(){const e=this;h.extend(e,{a11y:{liveRegion:d(`<span class="${e.params.a11y.notificationClass}" aria-live="assertive" aria-atomic="true"></span>`)}}),Object.keys(Z).forEach(t=>{e.a11y[t]=Z[t].bind(e)})},on:{init(){this.params.a11y.enabled&&(this.a11y.init(),this.a11y.updateNavigation())},toEdge(){this.params.a11y.enabled&&this.a11y.updateNavigation()},fromEdge(){this.params.a11y.enabled&&this.a11y.updateNavigation()},paginationUpdate(){this.params.a11y.enabled&&this.a11y.updatePagination()},destroy(){this.params.a11y.enabled&&this.a11y.destroy()}}},{name:"history",params:{history:{enabled:!1,replaceState:!1,key:"slides"}},create(){h.extend(this,{history:{init:Q.init.bind(this),setHistory:Q.setHistory.bind(this),setHistoryPopState:Q.setHistoryPopState.bind(this),scrollToSlide:Q.scrollToSlide.bind(this),destroy:Q.destroy.bind(this)}})},on:{init(){const e=this;e.params.history.enabled&&e.history.init()},destroy(){const e=this;e.params.history.enabled&&e.history.destroy()},transitionEnd(){const e=this;e.history.initialized&&e.history.setHistory(e.params.history.key,e.activeIndex)}}},{name:"hash-navigation",params:{hashNavigation:{enabled:!1,replaceState:!1,watchState:!1}},create(){h.extend(this,{hashNavigation:{initialized:!1,init:J.init.bind(this),destroy:J.destroy.bind(this),setHash:J.setHash.bind(this),onHashCange:J.onHashCange.bind(this)}})},on:{init(){const e=this;e.params.hashNavigation.enabled&&e.hashNavigation.init()},destroy(){const e=this;e.params.hashNavigation.enabled&&e.hashNavigation.destroy()},transitionEnd(){const e=this;e.hashNavigation.initialized&&e.hashNavigation.setHash()}}},{name:"autoplay",params:{autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!0,stopOnLastSlide:!1,reverseDirection:!1}},create(){const e=this;h.extend(e,{autoplay:{running:!1,paused:!1,run:ee.run.bind(e),start:ee.start.bind(e),stop:ee.stop.bind(e),pause:ee.pause.bind(e),onTransitionEnd(t){e&&!e.destroyed&&e.$wrapperEl&&t.target===this&&(e.$wrapperEl[0].removeEventListener("transitionend",e.autoplay.onTransitionEnd),e.$wrapperEl[0].removeEventListener("webkitTransitionEnd",e.autoplay.onTransitionEnd),e.autoplay.paused=!1,e.autoplay.running?e.autoplay.run():e.autoplay.stop())}}})},on:{init(){const e=this;e.params.autoplay.enabled&&e.autoplay.start()},beforeTransitionStart(e,t){const s=this;s.autoplay.running&&(t||!s.params.autoplay.disableOnInteraction?s.autoplay.pause(e):s.autoplay.stop())},sliderFirstMove(){const e=this;e.autoplay.running&&(e.params.autoplay.disableOnInteraction?e.autoplay.stop():e.autoplay.pause())},destroy(){const e=this;e.autoplay.running&&e.autoplay.stop()}}},{name:"effect-fade",params:{fadeEffect:{crossFade:!1}},create(){h.extend(this,{fadeEffect:{setTranslate:te.setTranslate.bind(this),setTransition:te.setTransition.bind(this)}})},on:{beforeInit(){if("fade"!==this.params.effect)return;this.classNames.push(this.params.containerModifierClass+"fade");const e={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};h.extend(this.params,e),h.extend(this.originalParams,e)},setTranslate(){"fade"===this.params.effect&&this.fadeEffect.setTranslate()},setTransition(e){"fade"===this.params.effect&&this.fadeEffect.setTransition(e)}}},{name:"effect-cube",params:{cubeEffect:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94}},create(){h.extend(this,{cubeEffect:{setTranslate:se.setTranslate.bind(this),setTransition:se.setTransition.bind(this)}})},on:{beforeInit(){if("cube"!==this.params.effect)return;this.classNames.push(this.params.containerModifierClass+"cube"),this.classNames.push(this.params.containerModifierClass+"3d");const e={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,resistanceRatio:0,spaceBetween:0,centeredSlides:!1,virtualTranslate:!0};h.extend(this.params,e),h.extend(this.originalParams,e)},setTranslate(){"cube"===this.params.effect&&this.cubeEffect.setTranslate()},setTransition(e){"cube"===this.params.effect&&this.cubeEffect.setTransition(e)}}},{name:"effect-flip",params:{flipEffect:{slideShadows:!0,limitRotation:!0}},create(){h.extend(this,{flipEffect:{setTranslate:ie.setTranslate.bind(this),setTransition:ie.setTransition.bind(this)}})},on:{beforeInit(){if("flip"!==this.params.effect)return;this.classNames.push(this.params.containerModifierClass+"flip"),this.classNames.push(this.params.containerModifierClass+"3d");const e={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};h.extend(this.params,e),h.extend(this.originalParams,e)},setTranslate(){"flip"===this.params.effect&&this.flipEffect.setTranslate()},setTransition(e){"flip"===this.params.effect&&this.flipEffect.setTransition(e)}}},{name:"effect-coverflow",params:{coverflowEffect:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0}},create(){h.extend(this,{coverflowEffect:{setTranslate:ae.setTranslate.bind(this),setTransition:ae.setTransition.bind(this)}})},on:{beforeInit(){"coverflow"===this.params.effect&&(this.classNames.push(this.params.containerModifierClass+"coverflow"),this.classNames.push(this.params.containerModifierClass+"3d"),this.params.watchSlidesProgress=!0,this.originalParams.watchSlidesProgress=!0)},setTranslate(){"coverflow"===this.params.effect&&this.coverflowEffect.setTranslate()},setTransition(e){"coverflow"===this.params.effect&&this.coverflowEffect.setTransition(e)}}},{name:"thumbs",params:{thumbs:{swiper:null,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-container-thumbs"}},create(){h.extend(this,{thumbs:{swiper:null,init:ne.init.bind(this),update:ne.update.bind(this),onThumbClick:ne.onThumbClick.bind(this)}})},on:{beforeInit(){const{thumbs:e}=this.params;e&&e.swiper&&(this.thumbs.init(),this.thumbs.update(!0))},slideChange(){this.thumbs.swiper&&this.thumbs.update()},update(){this.thumbs.swiper&&this.thumbs.update()},resize(){this.thumbs.swiper&&this.thumbs.update()},observerUpdate(){this.thumbs.swiper&&this.thumbs.update()},setTransition(e){const t=this.thumbs.swiper;t&&t.setTransition(e)},beforeDestroy(){const e=this.thumbs.swiper;e&&this.thumbs.swiperCreated&&e&&e.destroy()}}}];void 0===L.use&&(L.use=L.Class.use,L.installModule=L.Class.installModule),L.use(re);var le=L;s(2);s(3);"undefined"!=typeof window&&a()((function(){Array.from(document.querySelectorAll(".wp-block-newspack-blocks-carousel")).forEach((function(e){var t=e.querySelector(".swiper-container"),s={prev:e.querySelector(".swiper-button-prev"),next:e.querySelector(".swiper-button-next"),pagination:e.querySelector(".swiper-pagination-bullets"),pause:e.querySelector(".swiper-button-pause"),play:e.querySelector(".swiper-button-play")},i=!!parseInt(e.dataset.autoplay),a=1e3*parseInt(e.dataset.autoplay_delay);!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".swiper-container",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s={effect:"slide",grabCursor:!0,init:!0,initialSlide:0,navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},pagination:{bulletElement:"button",clickable:!0,el:".swiper-pagination",type:"bullets"},preventClicksPropagation:!1,releaseFormElements:!1,setWrapperSize:!0,touchStartPreventDefault:!1};new le(e,Object(n.merge)({},s,t))}(t,{autoplay:!!i&&{delay:a,disableOnInteraction:!1},effect:"slide",initialSlide:0,loop:!0,navigation:{nextEl:s.next,prevEl:s.prev},pagination:{clickable:!0,el:s.pagination,type:"bullets"},on:{init:function(){var t=this;s.pause&&s.pause.addEventListener("click",(function(){t.autoplay.stop(),e.classList.remove("wp-block-newspack-blocks-carousel__autoplay-playing")})),s.play&&s.play.addEventListener("click",(function(){t.autoplay.start(),e.classList.add("wp-block-newspack-blocks-carousel__autoplay-playing")}))}}})}))}))}]));
|
newspack-blocks/dist/carousel-block-view.rtl.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.swiper-container{margin-right:auto;margin-left:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-container-no-flexbox .swiper-slide{float:right}.swiper-container-vertical>.swiper-wrapper{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform;-webkit-box-sizing:content-box;box-sizing:content-box}.swiper-container-android .swiper-slide,.swiper-wrapper{-webkit-transform:translateZ(0);transform:translateZ(0)}.swiper-container-multirow>.swiper-wrapper{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.swiper-container-free-mode>.swiper-wrapper{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out;margin:0 auto}.swiper-slide{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:100%;height:100%;position:relative;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;-o-transition-property:transform;transition-property:transform;transition-property:transform,-webkit-transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-container-autoheight,.swiper-container-autoheight .swiper-slide{height:auto}.swiper-container-autoheight .swiper-wrapper{-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;-webkit-transition-property:height,-webkit-transform;transition-property:height,-webkit-transform;-o-transition-property:transform,height;transition-property:transform,height;transition-property:transform,height,-webkit-transform}.swiper-container-3d{-webkit-perspective:1200px;perspective:1200px}.swiper-container-3d .swiper-cube-shadow,.swiper-container-3d .swiper-slide,.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top,.swiper-container-3d .swiper-wrapper{-webkit-transform-style:preserve-3d;transform-style:preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top{position:absolute;right:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-container-3d .swiper-slide-shadow-left{background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(left,rgba(0,0,0,.5),transparent);background-image:linear-gradient(90deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-right{background-image:-webkit-gradient(linear,right top,left top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(right,rgba(0,0,0,.5),transparent);background-image:linear-gradient(270deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-top{background-image:-webkit-gradient(linear,right bottom,right top,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(bottom,rgba(0,0,0,.5),transparent);background-image:linear-gradient(0deg,rgba(0,0,0,.5),transparent)}.swiper-container-3d .swiper-slide-shadow-bottom{background-image:-webkit-gradient(linear,right top,right bottom,from(rgba(0,0,0,.5)),to(transparent));background-image:-webkit-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:-o-linear-gradient(top,rgba(0,0,0,.5),transparent);background-image:linear-gradient(180deg,rgba(0,0,0,.5),transparent)}.swiper-container-wp8-horizontal,.swiper-container-wp8-horizontal>.swiper-wrapper{-ms-touch-action:pan-y;touch-action:pan-y}.swiper-container-wp8-vertical,.swiper-container-wp8-vertical>.swiper-wrapper{-ms-touch-action:pan-x;touch-action:pan-x}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:27px;height:44px;margin-top:-22px;z-index:10;cursor:pointer;background-size:27px 44px;background-position:50%;background-repeat:no-repeat}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-prev,.swiper-container-rtl .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23007aff'/%3E%3C/svg%3E");right:10px;left:auto}.swiper-button-next,.swiper-container-rtl .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23007aff'/%3E%3C/svg%3E");left:10px;right:auto}.swiper-button-prev.swiper-button-white,.swiper-container-rtl .swiper-button-next.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-white,.swiper-container-rtl .swiper-button-prev.swiper-button-white{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z' fill='%23fff'/%3E%3C/svg%3E")}.swiper-button-prev.swiper-button-black,.swiper-container-rtl .swiper-button-next.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M0 22L22 0l2.1 2.1L4.2 22l19.9 19.9L22 44 0 22z'/%3E%3C/svg%3E")}.swiper-button-next.swiper-button-black,.swiper-container-rtl .swiper-button-prev.swiper-button-black{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 44'%3E%3Cpath d='M27 22L5 44l-2.1-2.1L22.8 22 2.9 2.1 5 0l22 22z'/%3E%3C/svg%3E")}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;-webkit-transition:opacity .3s;-o-transition:.3s opacity;transition:opacity .3s;-webkit-transform:translateZ(0);transform:translateZ(0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:10px;right:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active,.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{-webkit-transform:scale(.66);-ms-transform:scale(.66);transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{-webkit-transform:scale(.33);-ms-transform:scale(.33);transform:scale(.33)}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;border-radius:100%;background:#000;opacity:.2}button.swiper-pagination-bullet{border:none;margin:0;padding:0;-webkit-box-shadow:none;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet-active{opacity:1;background:#007aff}.swiper-container-vertical>.swiper-pagination-bullets{left:10px;top:50%;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:6px 0;display:block}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:8px}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;-webkit-transition:top .2s,-webkit-transform .2s;transition:top .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s top;transition:transform .2s,top .2s;transition:transform .2s,top .2s,-webkit-transform .2s}.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 4px}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{right:50%;-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);white-space:nowrap}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:right .2s,-webkit-transform .2s;transition:right .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s right;transition:transform .2s,right .2s;transition:transform .2s,right .2s,-webkit-transform .2s}.swiper-container-horizontal.swiper-container-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{-webkit-transition:left .2s,-webkit-transform .2s;transition:left .2s,-webkit-transform .2s;-o-transition:.2s transform,.2s left;transition:transform .2s,left .2s;transition:transform .2s,left .2s,-webkit-transform .2s}.swiper-pagination-progressbar{background:rgba(0,0,0,.25);position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:#007aff;position:absolute;right:0;top:0;width:100%;height:100%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:right top;-ms-transform-origin:right top;transform-origin:right top}.swiper-container-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top}.swiper-container-horizontal>.swiper-pagination-progressbar,.swiper-container-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:4px;right:0;top:0}.swiper-container-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-container-vertical>.swiper-pagination-progressbar{width:4px;height:100%;right:0;top:0}.swiper-pagination-white .swiper-pagination-bullet-active{background:#fff}.swiper-pagination-progressbar.swiper-pagination-white{background:hsla(0,0%,100%,.25)}.swiper-pagination-progressbar.swiper-pagination-white .swiper-pagination-progressbar-fill{background:#fff}.swiper-pagination-black .swiper-pagination-bullet-active{background:#000}.swiper-pagination-progressbar.swiper-pagination-black{background:rgba(0,0,0,.25)}.swiper-pagination-progressbar.swiper-pagination-black .swiper-pagination-progressbar-fill{background:#000}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:10px;position:relative;-ms-touch-action:none;background:rgba(0,0,0,.1)}.swiper-container-horizontal>.swiper-scrollbar{position:absolute;right:1%;bottom:3px;z-index:50;height:5px;width:98%}.swiper-container-vertical>.swiper-scrollbar{position:absolute;left:3px;top:1%;z-index:50;width:5px;height:98%}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:rgba(0,0,0,.5);border-radius:10px;right:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}.swiper-slide-zoomed{cursor:move}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;right:50%;top:50%;margin-right:-21px;margin-top:-21px;z-index:10;-webkit-transform-origin:50%;-ms-transform-origin:50%;transform-origin:50%;-webkit-animation:swiper-preloader-spin 1s steps(12) infinite;animation:swiper-preloader-spin 1s steps(12) infinite}.swiper-lazy-preloader:after{display:block;content:"";width:100%;height:100%;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%236c6c6c' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E");background-position:50%;background-size:100%;background-repeat:no-repeat}.swiper-lazy-preloader-white:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cdefs%3E%3Cpath id='a' stroke='%23fff' stroke-width='11' stroke-linecap='round' d='M60 7v20'/%3E%3C/defs%3E%3Cuse xlink:href='%23a' opacity='.27'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(30 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(60 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(90 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(120 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.27' transform='rotate(150 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.37' transform='rotate(180 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.46' transform='rotate(210 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.56' transform='rotate(240 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.66' transform='rotate(270 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.75' transform='rotate(300 60 60)'/%3E%3Cuse xlink:href='%23a' opacity='.85' transform='rotate(330 60 60)'/%3E%3C/svg%3E")}@-webkit-keyframes swiper-preloader-spin{to{-webkit-transform:rotate(-1turn);transform:rotate(-1turn)}}@keyframes swiper-preloader-spin{to{-webkit-transform:rotate(-1turn);transform:rotate(-1turn)}}.swiper-container .swiper-notification{position:absolute;right:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-container-fade.swiper-container-free-mode .swiper-slide{-webkit-transition-timing-function:ease-out;-o-transition-timing-function:ease-out;transition-timing-function:ease-out}.swiper-container-fade .swiper-slide{pointer-events:none;-webkit-transition-property:opacity;-o-transition-property:opacity;transition-property:opacity}.swiper-container-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-fade .swiper-slide-active,.swiper-container-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube{overflow:visible}.swiper-container-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;-webkit-transform-origin:100% 0;-ms-transform-origin:100% 0;transform-origin:100% 0;width:100%;height:100%}.swiper-container-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-cube.swiper-container-rtl .swiper-slide{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-next,.swiper-container-cube .swiper-slide-next+.swiper-slide,.swiper-container-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-container-cube .swiper-slide-shadow-bottom,.swiper-container-cube .swiper-slide-shadow-left,.swiper-container-cube .swiper-slide-shadow-right,.swiper-container-cube .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-cube .swiper-cube-shadow{position:absolute;right:0;bottom:0;width:100%;height:100%;background:#000;opacity:.6;-webkit-filter:blur(50px);filter:blur(50px);z-index:0}.swiper-container-flip{overflow:visible}.swiper-container-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-container-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-flip .swiper-slide-active,.swiper-container-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-flip .swiper-slide-shadow-bottom,.swiper-container-flip .swiper-slide-shadow-left,.swiper-container-flip .swiper-slide-shadow-right,.swiper-container-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-coverflow .swiper-wrapper{-ms-perspective:1200px}.wp-block-newspack-blocks-carousel{position:relative;margin-top:0}.wp-block-newspack-blocks-carousel article{max-width:100%;padding:0;position:relative;margin-bottom:0;word-break:break-word;overflow-wrap:break-word}.wp-block-newspack-blocks-carousel article a{color:inherit}.wp-block-newspack-blocks-carousel article a:active,.wp-block-newspack-blocks-carousel article a:focus,.wp-block-newspack-blocks-carousel article a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.2em}.wp-block-newspack-blocks-carousel article .entry-title a{-webkit-box-orient:vertical;display:-webkit-box;-webkit-line-clamp:3;max-height:3.5625em;overflow:hidden;text-overflow:ellipsis}.wp-block-newspack-blocks-carousel article .avatar{height:1.8em;width:1.8em}@media only screen and (min-width:782px){.wp-block-newspack-blocks-carousel article .entry-title{font-size:1.6em}.wp-block-newspack-blocks-carousel article .avatar{height:40px;width:40px}}.wp-block-newspack-blocks-carousel article .entry-wrapper{bottom:0;background-color:rgba(0,0,0,.5);color:#fff;right:0;padding:1.5em;position:absolute;left:0}.wp-block-newspack-blocks-carousel article .entry-meta{color:inherit;margin-bottom:0;font-size:.8em}.wp-block-newspack-blocks-carousel article .entry-meta a{color:inherit;font-weight:700;text-decoration:none}.wp-block-newspack-blocks-carousel article .entry-meta a:active,.wp-block-newspack-blocks-carousel article .entry-meta a:focus,.wp-block-newspack-blocks-carousel article .entry-meta a:hover{color:hsla(0,0%,100%,.75)}.wp-block-newspack-blocks-carousel figure.post-thumbnail{margin:0;height:100%;padding:0}.wp-block-newspack-blocks-carousel figure.post-thumbnail a,.wp-block-newspack-blocks-carousel figure.post-thumbnail img{display:block;height:100%;width:100%}.wp-block-newspack-blocks-carousel p{white-space:normal}.wp-block-newspack-blocks-carousel .swiper-pagination-bullets{align-items:flex-end;bottom:0;display:flex;flex-wrap:wrap;height:calc(1.5em + 12px);justify-content:center;padding:0;position:relative}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet{background:#000;border-radius:6px;display:inline-block;height:12px;margin:0 4px;opacity:.5;padding:0;transition:box-shadow .25s,opacity .25s,width .25s;width:12px}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #000;outline:0}.wp-block-newspack-blocks-carousel .swiper-pagination-bullet.swiper-pagination-bullet-active,.wp-block-newspack-blocks-carousel .swiper-pagination-bullet[selected]{opacity:1;outline:0;width:24px}.wp-block-newspack-blocks-carousel .amp-carousel-button,.wp-block-newspack-blocks-carousel .swiper-button{background-color:rgba(0,0,0,.5);background-position:50%;background-repeat:no-repeat;background-size:24px;border:0;border-radius:4px;box-shadow:none;cursor:pointer;height:48px;margin:0;padding:0;transition:background-color .25s,box-shadow .25s;width:48px}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .amp-carousel-button:hover,.wp-block-newspack-blocks-carousel .swiper-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:hover{background-color:rgba(0,0,0,.75)}.wp-block-newspack-blocks-carousel .amp-carousel-button:focus,.wp-block-newspack-blocks-carousel .swiper-button:focus{box-shadow:inset 0 0 0 2px rgba(0,0,0,.75),inset 0 0 0 4px #fff;outline:0}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{right:1.5em;display:none}@media only screen and (min-width:600px){.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{display:block}}.wp-block-newspack-blocks-carousel .swiper-button-next,.wp-block-newspack-blocks-carousel .swiper-button-prev{margin-top:-24px}.wp-block-newspack-blocks-carousel .amp-carousel-button-next,.wp-block-newspack-blocks-carousel .swiper-button-next{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M5.88 4.12L13.76 12l-7.88 7.88L8 22l10-10L8 2z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E");right:auto;left:1.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-prev,.wp-block-newspack-blocks-carousel .swiper-button-prev{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M18 4.12L10.12 12 18 19.88 15.88 22l-10-10 10-10z' fill='%23fff'/%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");display:none;margin-top:0;position:absolute;left:1.5em;top:1.5em;transform:none;z-index:1}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M8 5v14l11-7z' fill='%23fff'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E")}.wp-block-newspack-blocks-carousel .swiper-slide{height:auto}.wp-block-newspack-blocks-carousel figcaption{font-size:.6em}.wp-block-newspack-blocks-carousel .entry-title{margin:0 0 .25em}.wp-block-newspack-blocks-carousel .entry-title a{color:inherit;text-decoration:none}.wp-block-newspack-blocks-carousel .entry-meta{display:flex;flex-wrap:wrap;align-items:center;margin-top:.5em}.wp-block-newspack-blocks-carousel .entry-meta .byline:not(:last-child){margin-left:1.5em}.wp-block-newspack-blocks-carousel .cat-links{color:inherit;font-size:.6em;font-weight:700;margin:0 0 .5em}.wp-block-newspack-blocks-carousel .cat-links a{text-decoration:none}.wp-block-newspack-blocks-carousel .avatar{border-radius:100%;display:block;margin-left:.5em}.wp-block-newspack-blocks-carousel .amp-carousel-button-play,.wp-block-newspack-blocks-carousel .swiper-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-pause{display:block}.wp-block-newspack-blocks-carousel .amp-carousel-button-pause,.wp-block-newspack-blocks-carousel .swiper-button-pause,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-play,.wp-block-newspack-blocks-carousel.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-play{display:none}
|
newspack-blocks/index.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Blog posts file.
|
4 |
+
*
|
5 |
+
* @package A8C\FSE
|
6 |
+
*/
|
7 |
+
|
8 |
+
namespace A8C\FSE;
|
9 |
+
|
10 |
+
define( 'NEWSPACK_BLOCKS__BLOCKS_DIRECTORY', 'dist/' );
|
11 |
+
define( 'NEWSPACK_BLOCKS__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
12 |
+
|
13 |
+
// Autogenerated by apps/full-site-editing/bin/sync-newspack-blocks.sh.
|
14 |
+
define( 'NEWSPACK_BLOCKS__VERSION', 'v1.4.0' );
|
15 |
+
// End autogenerated area.
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Filters block name.
|
19 |
+
*
|
20 |
+
* @param string $name Block name.
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
function blog_posts_block_name( $name ) {
|
24 |
+
if ( 'newspack-blocks/homepage-articles' === $name ) {
|
25 |
+
return 'a8c/blog-posts';
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( 'newspack-blocks/carousel' === $name ) {
|
29 |
+
return 'a8c/posts-carousel';
|
30 |
+
}
|
31 |
+
|
32 |
+
return $name;
|
33 |
+
}
|
34 |
+
add_filter( 'newspack_blocks_block_name', __NAMESPACE__ . '\blog_posts_block_name' );
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Filters block arguments for `register_block_type()`.
|
38 |
+
*
|
39 |
+
* @param array $args Arguments to `register_block_type()`.
|
40 |
+
* @param string $name Block name.
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
function newspack_blocks_block_args( $args, $name ) {
|
44 |
+
if ( 'homepage-articles' !== $name && 'carousel' !== $name ) {
|
45 |
+
return $args;
|
46 |
+
}
|
47 |
+
|
48 |
+
$block_prefix = 'homepage-articles' === $name
|
49 |
+
? 'blog-posts-block-'
|
50 |
+
: 'carousel-block-';
|
51 |
+
|
52 |
+
// Editor script.
|
53 |
+
$script_data = require NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . $block_prefix . 'editor.asset.php';
|
54 |
+
wp_register_script(
|
55 |
+
$block_prefix . 'editor',
|
56 |
+
plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . $block_prefix . 'editor.js', __FILE__ ),
|
57 |
+
$script_data['dependencies'],
|
58 |
+
$script_data['version'],
|
59 |
+
true
|
60 |
+
);
|
61 |
+
|
62 |
+
// Editor style.
|
63 |
+
$editor_style = plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . $block_prefix . 'editor.css', __FILE__ );
|
64 |
+
wp_register_style( $block_prefix . 'editor', $editor_style, array(), NEWSPACK_BLOCKS__VERSION );
|
65 |
+
|
66 |
+
// View script.
|
67 |
+
$script_data = require NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . $block_prefix . 'view.asset.php';
|
68 |
+
wp_register_script(
|
69 |
+
$block_prefix . 'view',
|
70 |
+
plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . $block_prefix . 'view.js', __FILE__ ),
|
71 |
+
$script_data['dependencies'],
|
72 |
+
$script_data['version'],
|
73 |
+
true
|
74 |
+
);
|
75 |
+
|
76 |
+
// View style.
|
77 |
+
$editor_style = plugins_url( NEWSPACK_BLOCKS__BLOCKS_DIRECTORY . $block_prefix . 'view.css', __FILE__ );
|
78 |
+
wp_register_style( $block_prefix . 'view', $editor_style, array(), NEWSPACK_BLOCKS__VERSION );
|
79 |
+
|
80 |
+
$args['editor_script'] = $block_prefix . 'editor';
|
81 |
+
$args['editor_style'] = $block_prefix . 'editor';
|
82 |
+
$args['script'] = $block_prefix . 'view';
|
83 |
+
$args['style'] = $block_prefix . 'view';
|
84 |
+
|
85 |
+
wp_set_script_translations( $block_prefix . 'editor', 'full-site-editing' );
|
86 |
+
|
87 |
+
return $args;
|
88 |
+
}
|
89 |
+
add_filter( 'newspack_blocks_block_args', __NAMESPACE__ . '\newspack_blocks_block_args', 10, 2 );
|
90 |
+
|
91 |
+
require_once __DIR__ . '/synced-newspack-blocks/class-newspack-blocks.php';
|
92 |
+
require_once __DIR__ . '/synced-newspack-blocks/class-newspack-blocks-api.php';
|
93 |
+
|
94 |
+
require_once __DIR__ . '/synced-newspack-blocks/blocks/homepage-articles/view.php';
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Can be used to disable the Posts Carousel Block.
|
98 |
+
*
|
99 |
+
* @since 1.2
|
100 |
+
*
|
101 |
+
* @param bool true if Posts Carousel Block should be disabled, false otherwise.
|
102 |
+
*/
|
103 |
+
if ( ! apply_filters( 'a8c_disable_posts_carousel_block', false ) ) {
|
104 |
+
require_once __DIR__ . '/synced-newspack-blocks/blocks/carousel/view.php';
|
105 |
+
}
|
106 |
+
|
107 |
+
// REST Controller for Articles Block.
|
108 |
+
require_once NEWSPACK_BLOCKS__PLUGIN_DIR . 'synced-newspack-blocks/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php';
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Registers Articles block routes.
|
112 |
+
*/
|
113 |
+
function register_rest_routes() {
|
114 |
+
$articles_controller = new \WP_REST_Newspack_Articles_Controller();
|
115 |
+
$articles_controller->register_routes();
|
116 |
+
}
|
117 |
+
add_action( 'rest_api_init', __NAMESPACE__ . '\register_rest_routes' );
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/create-swiper.js
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { merge } from 'lodash';
|
5 |
+
import Swiper from 'swiper';
|
6 |
+
import 'swiper/dist/css/swiper.css';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @param {string} container Selector
|
10 |
+
* @param {Object} params Params passed to Swiper
|
11 |
+
*/
|
12 |
+
export default function createSwiper( container = '.swiper-container', params = {} ) {
|
13 |
+
const defaultParams = {
|
14 |
+
effect: 'slide',
|
15 |
+
grabCursor: true,
|
16 |
+
init: true,
|
17 |
+
initialSlide: 0,
|
18 |
+
navigation: {
|
19 |
+
nextEl: '.swiper-button-next',
|
20 |
+
prevEl: '.swiper-button-prev',
|
21 |
+
},
|
22 |
+
pagination: {
|
23 |
+
bulletElement: 'button',
|
24 |
+
clickable: true,
|
25 |
+
el: '.swiper-pagination',
|
26 |
+
type: 'bullets',
|
27 |
+
},
|
28 |
+
preventClicksPropagation: false /* Necessary for normal block interactions */,
|
29 |
+
releaseFormElements: false,
|
30 |
+
setWrapperSize: true,
|
31 |
+
touchStartPreventDefault: false,
|
32 |
+
};
|
33 |
+
|
34 |
+
return new Swiper( container, merge( {}, defaultParams, params ) );
|
35 |
+
}
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/edit.js
ADDED
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* eslint-disable jsx-a11y/anchor-is-valid, jsx-a11y/anchor-has-content, jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus */
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Internal dependencies
|
5 |
+
*/
|
6 |
+
import QueryControls from '../../components/query-controls';
|
7 |
+
import createSwiper from './create-swiper';
|
8 |
+
import { formatAvatars, formatByline } from '../../shared/js/utils';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* External dependencies
|
12 |
+
*/
|
13 |
+
import { isUndefined, pickBy } from 'lodash';
|
14 |
+
import classnames from 'classnames';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* WordPress dependencies
|
18 |
+
*/
|
19 |
+
import { __ } from '@wordpress/i18n';
|
20 |
+
import { dateI18n, __experimentalGetSettings } from '@wordpress/date';
|
21 |
+
import { Component, createRef, Fragment } from '@wordpress/element';
|
22 |
+
import { InspectorControls } from '@wordpress/editor';
|
23 |
+
import {
|
24 |
+
PanelBody,
|
25 |
+
PanelRow,
|
26 |
+
Placeholder,
|
27 |
+
RangeControl,
|
28 |
+
Spinner,
|
29 |
+
ToggleControl,
|
30 |
+
} from '@wordpress/components';
|
31 |
+
import { withSelect } from '@wordpress/data';
|
32 |
+
import { compose } from '@wordpress/compose';
|
33 |
+
import { decodeEntities } from '@wordpress/html-entities';
|
34 |
+
|
35 |
+
class Edit extends Component {
|
36 |
+
constructor( props ) {
|
37 |
+
super( props );
|
38 |
+
this.state = {
|
39 |
+
autoPlayState: true,
|
40 |
+
};
|
41 |
+
this.btnNextRef = createRef();
|
42 |
+
this.btnPrevRef = createRef();
|
43 |
+
this.carouselRef = createRef();
|
44 |
+
this.paginationRef = createRef();
|
45 |
+
}
|
46 |
+
componentDidUpdate() {
|
47 |
+
const { attributes, latestPosts } = this.props;
|
48 |
+
const { autoPlayState } = this.state;
|
49 |
+
const { autoplay, delay } = attributes;
|
50 |
+
const realIndex =
|
51 |
+
this.swiperInstance && latestPosts && this.swiperInstance.realIndex < latestPosts.length
|
52 |
+
? this.swiperInstance.realIndex
|
53 |
+
: 0;
|
54 |
+
// eslint-disable-next-line no-unused-expressions
|
55 |
+
this.swiperInstance && this.swiperInstance.destroy( true, true );
|
56 |
+
this.swiperInstance = createSwiper(
|
57 |
+
this.carouselRef.current,
|
58 |
+
{
|
59 |
+
autoplay:
|
60 |
+
autoplay && autoPlayState
|
61 |
+
? {
|
62 |
+
delay: delay * 1000,
|
63 |
+
disableOnInteraction: false,
|
64 |
+
}
|
65 |
+
: false,
|
66 |
+
effect: 'slide',
|
67 |
+
initialSlide: realIndex,
|
68 |
+
loop: true,
|
69 |
+
navigation: {
|
70 |
+
nextEl: this.btnNextRef.current,
|
71 |
+
prevEl: this.btnPrevRef.current,
|
72 |
+
},
|
73 |
+
pagination: {
|
74 |
+
clickable: true,
|
75 |
+
el: this.paginationRef.current,
|
76 |
+
type: 'bullets',
|
77 |
+
},
|
78 |
+
},
|
79 |
+
{}
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
render() {
|
84 |
+
const { attributes, className, setAttributes, latestPosts } = this.props;
|
85 |
+
const { autoPlayState } = this.state;
|
86 |
+
const {
|
87 |
+
authors,
|
88 |
+
autoplay,
|
89 |
+
categories,
|
90 |
+
delay,
|
91 |
+
postsToShow,
|
92 |
+
showCategory,
|
93 |
+
showDate,
|
94 |
+
showAuthor,
|
95 |
+
showAvatar,
|
96 |
+
tags,
|
97 |
+
} = attributes;
|
98 |
+
const classes = classnames(
|
99 |
+
className,
|
100 |
+
'wp-block-newspack-blocks-carousel', // Default to make styles work for third-party consumers.
|
101 |
+
'swiper-container',
|
102 |
+
autoplay && autoPlayState && 'wp-block-newspack-blocks-carousel__autoplay-playing'
|
103 |
+
);
|
104 |
+
const dateFormat = __experimentalGetSettings().formats.date;
|
105 |
+
return (
|
106 |
+
<Fragment>
|
107 |
+
<div className={ classes } ref={ this.carouselRef }>
|
108 |
+
{ latestPosts && ! latestPosts.length && (
|
109 |
+
<Placeholder>{ __( 'Sorry, no posts were found.' ) }</Placeholder>
|
110 |
+
) }
|
111 |
+
{ ! latestPosts && (
|
112 |
+
<Placeholder icon={ <Spinner /> } className="component-placeholder__align-center" />
|
113 |
+
) }
|
114 |
+
{ latestPosts && (
|
115 |
+
<Fragment>
|
116 |
+
<div className="swiper-wrapper">
|
117 |
+
{ latestPosts.map(
|
118 |
+
post =>
|
119 |
+
post.newspack_featured_image_src && (
|
120 |
+
<article className="post-has-image swiper-slide" key={ post.id }>
|
121 |
+
<figure className="post-thumbnail">
|
122 |
+
{ post.newspack_featured_image_src && (
|
123 |
+
<a href="#" rel="bookmark">
|
124 |
+
<img src={ post.newspack_featured_image_src.large } alt="" />
|
125 |
+
</a>
|
126 |
+
) }
|
127 |
+
</figure>
|
128 |
+
<div className="entry-wrapper">
|
129 |
+
{ showCategory && post.newspack_category_info.length && (
|
130 |
+
<div className="cat-links">
|
131 |
+
<a href="#">{ post.newspack_category_info }</a>
|
132 |
+
</div>
|
133 |
+
) }
|
134 |
+
<h3 className="entry-title">
|
135 |
+
<a href="#">{ decodeEntities( post.title.rendered.trim() ) }</a>
|
136 |
+
</h3>
|
137 |
+
<div className="entry-meta">
|
138 |
+
{ showAuthor &&
|
139 |
+
showAvatar &&
|
140 |
+
formatAvatars( post.newspack_author_info ) }
|
141 |
+
{ showAuthor && formatByline( post.newspack_author_info ) }
|
142 |
+
{ showDate && (
|
143 |
+
<time className="entry-date published" key="pub-date">
|
144 |
+
{ dateI18n( dateFormat, post.date_gmt ) }
|
145 |
+
</time>
|
146 |
+
) }
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
</article>
|
150 |
+
)
|
151 |
+
) }
|
152 |
+
</div>
|
153 |
+
<a
|
154 |
+
className="amp-carousel-button amp-carousel-button-prev swiper-button-prev"
|
155 |
+
ref={ this.btnPrevRef }
|
156 |
+
role="button"
|
157 |
+
/>
|
158 |
+
<a
|
159 |
+
className="amp-carousel-button amp-carousel-button-next swiper-button-next"
|
160 |
+
ref={ this.btnNextRef }
|
161 |
+
role="button"
|
162 |
+
/>
|
163 |
+
{ autoplay && (
|
164 |
+
<Fragment>
|
165 |
+
<a
|
166 |
+
className="amp-carousel-button-pause amp-carousel-button"
|
167 |
+
role="button"
|
168 |
+
onClick={ () => {
|
169 |
+
this.swiperInstance.autoplay.stop();
|
170 |
+
this.setState( { autoPlayState: false } );
|
171 |
+
} }
|
172 |
+
/>
|
173 |
+
<a
|
174 |
+
className="amp-carousel-button-play amp-carousel-button"
|
175 |
+
role="button"
|
176 |
+
onClick={ () => {
|
177 |
+
this.swiperInstance.autoplay.start();
|
178 |
+
this.setState( { autoPlayState: true } );
|
179 |
+
} }
|
180 |
+
/>
|
181 |
+
</Fragment>
|
182 |
+
) }
|
183 |
+
<div
|
184 |
+
className="swiper-pagination-bullets amp-pagination"
|
185 |
+
ref={ this.paginationRef }
|
186 |
+
/>
|
187 |
+
</Fragment>
|
188 |
+
) }
|
189 |
+
</div>
|
190 |
+
<InspectorControls>
|
191 |
+
<PanelBody title={ __( 'Display Settings' ) } initialOpen={ true }>
|
192 |
+
{ postsToShow && (
|
193 |
+
<QueryControls
|
194 |
+
enableSpecific={ false }
|
195 |
+
numberOfItems={ postsToShow }
|
196 |
+
onNumberOfItemsChange={ value => setAttributes( { postsToShow: value } ) }
|
197 |
+
authors={ authors }
|
198 |
+
onAuthorsChange={ value => setAttributes( { authors: value } ) }
|
199 |
+
categories={ categories }
|
200 |
+
onCategoriesChange={ value => setAttributes( { categories: value } ) }
|
201 |
+
tags={ tags }
|
202 |
+
onTagsChange={ value => setAttributes( { tags: value } ) }
|
203 |
+
/>
|
204 |
+
) }
|
205 |
+
</PanelBody>
|
206 |
+
<PanelBody title={ __( 'Slideshow Settings' ) } initialOpen={ true }>
|
207 |
+
<ToggleControl
|
208 |
+
label={ __( 'Autoplay' ) }
|
209 |
+
help={ __( 'Autoplay between slides' ) }
|
210 |
+
checked={ autoplay }
|
211 |
+
onChange={ _autoplay => {
|
212 |
+
setAttributes( { autoplay: _autoplay } );
|
213 |
+
} }
|
214 |
+
/>
|
215 |
+
{ autoplay && (
|
216 |
+
<RangeControl
|
217 |
+
label={ __( 'Delay between transitions (in seconds)' ) }
|
218 |
+
value={ delay }
|
219 |
+
onChange={ _delay => {
|
220 |
+
setAttributes( { delay: _delay } );
|
221 |
+
} }
|
222 |
+
min={ 1 }
|
223 |
+
max={ 20 }
|
224 |
+
/>
|
225 |
+
) }
|
226 |
+
</PanelBody>
|
227 |
+
<PanelBody title={ __( 'Article Meta Settings', 'full-site-editing' ) }>
|
228 |
+
<PanelRow>
|
229 |
+
<ToggleControl
|
230 |
+
label={ __( 'Show Date', 'full-site-editing' ) }
|
231 |
+
checked={ showDate }
|
232 |
+
onChange={ () => setAttributes( { showDate: ! showDate } ) }
|
233 |
+
/>
|
234 |
+
</PanelRow>
|
235 |
+
<PanelRow>
|
236 |
+
<ToggleControl
|
237 |
+
label={ __( 'Show Category', 'full-site-editing' ) }
|
238 |
+
checked={ showCategory }
|
239 |
+
onChange={ () => setAttributes( { showCategory: ! showCategory } ) }
|
240 |
+
/>
|
241 |
+
</PanelRow>
|
242 |
+
<PanelRow>
|
243 |
+
<ToggleControl
|
244 |
+
label={ __( 'Show Author', 'full-site-editing' ) }
|
245 |
+
checked={ showAuthor }
|
246 |
+
onChange={ () => setAttributes( { showAuthor: ! showAuthor } ) }
|
247 |
+
/>
|
248 |
+
</PanelRow>
|
249 |
+
{ showAuthor && (
|
250 |
+
<PanelRow>
|
251 |
+
<ToggleControl
|
252 |
+
label={ __( 'Show Author Avatar', 'full-site-editing' ) }
|
253 |
+
checked={ showAvatar }
|
254 |
+
onChange={ () => setAttributes( { showAvatar: ! showAvatar } ) }
|
255 |
+
/>
|
256 |
+
</PanelRow>
|
257 |
+
) }
|
258 |
+
</PanelBody>
|
259 |
+
</InspectorControls>
|
260 |
+
</Fragment>
|
261 |
+
);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
export default compose( [
|
266 |
+
withSelect( ( select, props ) => {
|
267 |
+
const { postsToShow, authors, categories, tags } = props.attributes;
|
268 |
+
const { getEntityRecords } = select( 'core' );
|
269 |
+
const latestPostsQuery = pickBy(
|
270 |
+
{
|
271 |
+
per_page: postsToShow,
|
272 |
+
categories,
|
273 |
+
author: authors,
|
274 |
+
tags,
|
275 |
+
meta_key: '_thumbnail_id',
|
276 |
+
meta_value_num: 0,
|
277 |
+
meta_compare: '>',
|
278 |
+
},
|
279 |
+
value => ! isUndefined( value )
|
280 |
+
);
|
281 |
+
return {
|
282 |
+
latestPosts: getEntityRecords( 'postType', 'post', latestPostsQuery ),
|
283 |
+
};
|
284 |
+
} ),
|
285 |
+
] )( Edit );
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/editor.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import { registerBlockType } from '@wordpress/blocks';
|
5 |
+
import { name, settings } from '.';
|
6 |
+
|
7 |
+
registerBlockType( `newspack-blocks/${ name }`, settings );
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/editor.scss
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../../shared/sass/placeholder';
|
2 |
+
|
3 |
+
.wp-block-newspack-blocks-carousel {
|
4 |
+
.entry-title {
|
5 |
+
color: white;
|
6 |
+
}
|
7 |
+
a {
|
8 |
+
color: inherit;
|
9 |
+
|
10 |
+
&:active,
|
11 |
+
&:focus,
|
12 |
+
&:hover {
|
13 |
+
color: rgba( 255, 255, 255, 0.75 );
|
14 |
+
}
|
15 |
+
}
|
16 |
+
.post-thumbnail img {
|
17 |
+
display: block;
|
18 |
+
}
|
19 |
+
.swiper-pagination-bullet.swiper-pagination-bullet-active {
|
20 |
+
opacity: 1;
|
21 |
+
width: 24px;
|
22 |
+
}
|
23 |
+
.amp-carousel-button {
|
24 |
+
&.amp-carousel-button-next,
|
25 |
+
&.amp-carousel-button-prev {
|
26 |
+
left: 1.5em;
|
27 |
+
margin-top: -24px; // buttons height / 2
|
28 |
+
transform: translateY( -50% );
|
29 |
+
}
|
30 |
+
|
31 |
+
&.amp-carousel-button-next {
|
32 |
+
left: auto;
|
33 |
+
right: 1.5em;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
.editor-block-list__layout
|
38 |
+
.editor-block-list__block
|
39 |
+
.wp-block-newspack-blocks-carousel
|
40 |
+
.entry-title
|
41 |
+
a,
|
42 |
+
.editor-block-list__layout
|
43 |
+
.editor-block-list__block
|
44 |
+
.wp-block-newspack-blocks-carousel
|
45 |
+
.entry-meta
|
46 |
+
.byline
|
47 |
+
a {
|
48 |
+
color: inherit;
|
49 |
+
}
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/index.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Path, SVG } from '@wordpress/components';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import { __ } from '@wordpress/i18n';
|
10 |
+
import edit from './edit';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Style dependencies - will load in editor
|
14 |
+
*/
|
15 |
+
import './view.scss';
|
16 |
+
import './editor.scss';
|
17 |
+
|
18 |
+
export const name = 'carousel';
|
19 |
+
export const title = __( 'Articles Carousel' );
|
20 |
+
|
21 |
+
/* From https://material.io/tools/icons */
|
22 |
+
export const icon = (
|
23 |
+
<SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
24 |
+
<Path d="M0 0h24v24H0z" fill="none" />
|
25 |
+
<Path d="M7 19h10V4H7v15zm-5-2h4V6H2v11zM18 6v11h4V6h-4z" />
|
26 |
+
</SVG>
|
27 |
+
);
|
28 |
+
|
29 |
+
export const settings = {
|
30 |
+
title,
|
31 |
+
icon,
|
32 |
+
category: 'newspack',
|
33 |
+
keywords: [ __( 'posts' ), __( 'slideshow' ), __( 'carousel' ) ],
|
34 |
+
description: __( 'A carousel of articles.' ),
|
35 |
+
attributes: {
|
36 |
+
className: {
|
37 |
+
type: 'string',
|
38 |
+
},
|
39 |
+
autoplay: {
|
40 |
+
type: 'boolean',
|
41 |
+
default: false,
|
42 |
+
},
|
43 |
+
delay: {
|
44 |
+
type: 'number',
|
45 |
+
default: 5,
|
46 |
+
},
|
47 |
+
postsToShow: {
|
48 |
+
type: 'integer',
|
49 |
+
default: 3,
|
50 |
+
},
|
51 |
+
authors: {
|
52 |
+
type: 'array',
|
53 |
+
},
|
54 |
+
categories: {
|
55 |
+
type: 'array',
|
56 |
+
},
|
57 |
+
tags: {
|
58 |
+
type: 'array',
|
59 |
+
},
|
60 |
+
showDate: {
|
61 |
+
type: 'boolean',
|
62 |
+
default: true,
|
63 |
+
},
|
64 |
+
showAuthor: {
|
65 |
+
type: 'boolean',
|
66 |
+
default: true,
|
67 |
+
},
|
68 |
+
showAvatar: {
|
69 |
+
type: 'boolean',
|
70 |
+
default: true,
|
71 |
+
},
|
72 |
+
showCategory: {
|
73 |
+
type: 'boolean',
|
74 |
+
default: false,
|
75 |
+
},
|
76 |
+
},
|
77 |
+
supports: {
|
78 |
+
html: false,
|
79 |
+
align: false,
|
80 |
+
},
|
81 |
+
edit,
|
82 |
+
save: () => null, // to use view.php
|
83 |
+
};
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/view.js
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import domReady from '@wordpress/dom-ready';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import createSwiper from './create-swiper';
|
10 |
+
import './view.scss';
|
11 |
+
|
12 |
+
if ( typeof window !== 'undefined' ) {
|
13 |
+
domReady( () => {
|
14 |
+
const blocksArray = Array.from(
|
15 |
+
document.querySelectorAll( '.wp-block-newspack-blocks-carousel' )
|
16 |
+
);
|
17 |
+
blocksArray.forEach( block => {
|
18 |
+
const container = block.querySelector( '.swiper-container' );
|
19 |
+
const els = {
|
20 |
+
prev: block.querySelector( '.swiper-button-prev' ),
|
21 |
+
next: block.querySelector( '.swiper-button-next' ),
|
22 |
+
pagination: block.querySelector( '.swiper-pagination-bullets' ),
|
23 |
+
pause: block.querySelector( '.swiper-button-pause' ),
|
24 |
+
play: block.querySelector( '.swiper-button-play' ),
|
25 |
+
};
|
26 |
+
const autoplay = parseInt( block.dataset.autoplay ) ? true : false;
|
27 |
+
const delay = parseInt( block.dataset.autoplay_delay ) * 1000;
|
28 |
+
const swiperConfig = {
|
29 |
+
autoplay: autoplay
|
30 |
+
? {
|
31 |
+
delay,
|
32 |
+
disableOnInteraction: false,
|
33 |
+
}
|
34 |
+
: false,
|
35 |
+
effect: 'slide',
|
36 |
+
initialSlide: 0,
|
37 |
+
loop: true,
|
38 |
+
navigation: {
|
39 |
+
nextEl: els.next,
|
40 |
+
prevEl: els.prev,
|
41 |
+
},
|
42 |
+
pagination: {
|
43 |
+
clickable: true,
|
44 |
+
el: els.pagination,
|
45 |
+
type: 'bullets',
|
46 |
+
},
|
47 |
+
on: {
|
48 |
+
init() {
|
49 |
+
if ( els.pause ) {
|
50 |
+
els.pause.addEventListener( 'click', () => {
|
51 |
+
this.autoplay.stop();
|
52 |
+
block.classList.remove( 'wp-block-newspack-blocks-carousel__autoplay-playing' );
|
53 |
+
} );
|
54 |
+
}
|
55 |
+
if ( els.play ) {
|
56 |
+
els.play.addEventListener( 'click', () => {
|
57 |
+
this.autoplay.start();
|
58 |
+
block.classList.add( 'wp-block-newspack-blocks-carousel__autoplay-playing' );
|
59 |
+
} );
|
60 |
+
}
|
61 |
+
},
|
62 |
+
},
|
63 |
+
};
|
64 |
+
createSwiper( container, swiperConfig );
|
65 |
+
} );
|
66 |
+
} );
|
67 |
+
}
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/view.php
ADDED
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Server-side rendering of the `newspack-blocks/carousel` block.
|
4 |
+
*
|
5 |
+
* @package WordPress
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Renders the `newspack-blocks/carousel` block on server.
|
10 |
+
*
|
11 |
+
* @param array $attributes The block attributes.
|
12 |
+
*
|
13 |
+
* @return string Returns the post content with latest posts added.
|
14 |
+
*/
|
15 |
+
function newspack_blocks_render_block_carousel( $attributes ) {
|
16 |
+
static $newspack_blocks_carousel_id = 0;
|
17 |
+
$newspack_blocks_carousel_id++;
|
18 |
+
$autoplay = isset( $attributes['autoplay'] ) ? $attributes['autoplay'] : false;
|
19 |
+
$delay = isset( $attributes['delay'] ) ? absint( $attributes['delay'] ) : 3;
|
20 |
+
$posts_to_show = intval( $attributes['postsToShow'] );
|
21 |
+
$authors = isset( $attributes['authors'] ) ? $attributes['authors'] : array();
|
22 |
+
$categories = isset( $attributes['categories'] ) ? $attributes['categories'] : array();
|
23 |
+
$tags = isset( $attributes['tags'] ) ? $attributes['tags'] : array();
|
24 |
+
$is_amp = function_exists( 'is_amp_endpoint' ) && is_amp_endpoint();
|
25 |
+
|
26 |
+
$other = array();
|
27 |
+
if ( $autoplay ) {
|
28 |
+
$other[] = 'wp-block-newspack-blocks-carousel__autoplay-playing';
|
29 |
+
}
|
30 |
+
$classes = Newspack_Blocks::block_classes( 'carousel', $attributes, $other );
|
31 |
+
|
32 |
+
$args = array(
|
33 |
+
'posts_per_page' => $posts_to_show,
|
34 |
+
'post_status' => 'publish',
|
35 |
+
'suppress_filters' => false,
|
36 |
+
'ignore_sticky_posts' => true,
|
37 |
+
'meta_key' => '_thumbnail_id', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
|
38 |
+
'meta_value_num' => 0,
|
39 |
+
'meta_compare' => '>',
|
40 |
+
);
|
41 |
+
|
42 |
+
if ( $authors ) {
|
43 |
+
$args['author__in'] = $authors;
|
44 |
+
}
|
45 |
+
if ( $categories ) {
|
46 |
+
$args['category__in'] = $categories;
|
47 |
+
}
|
48 |
+
if ( $tags ) {
|
49 |
+
$args['tag__in'] = $tags;
|
50 |
+
}
|
51 |
+
|
52 |
+
$article_query = new WP_Query( $args );
|
53 |
+
$counter = 0;
|
54 |
+
$article_classes = [
|
55 |
+
'post-has-image',
|
56 |
+
];
|
57 |
+
if ( ! $is_amp ) {
|
58 |
+
$article_classes[] = 'swiper-slide';
|
59 |
+
}
|
60 |
+
ob_start();
|
61 |
+
if ( $article_query->have_posts() ) :
|
62 |
+
while ( $article_query->have_posts() ) :
|
63 |
+
$article_query->the_post();
|
64 |
+
if ( ! has_post_thumbnail() ) {
|
65 |
+
continue;
|
66 |
+
}
|
67 |
+
$counter++;
|
68 |
+
?>
|
69 |
+
|
70 |
+
<article class="<?php echo esc_attr( implode( ' ', $article_classes ) ); ?>">
|
71 |
+
<figure class="post-thumbnail">
|
72 |
+
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
|
73 |
+
<?php
|
74 |
+
the_post_thumbnail(
|
75 |
+
'large',
|
76 |
+
array(
|
77 |
+
'object-fit' => 'cover',
|
78 |
+
'layout' => 'fill',
|
79 |
+
)
|
80 |
+
);
|
81 |
+
?>
|
82 |
+
</a>
|
83 |
+
</figure>
|
84 |
+
<div class="entry-wrapper">
|
85 |
+
|
86 |
+
<?php
|
87 |
+
$category = false;
|
88 |
+
|
89 |
+
// Use Yoast primary category if set.
|
90 |
+
if ( class_exists( 'WPSEO_Primary_Term' ) ) {
|
91 |
+
$primary_term = new WPSEO_Primary_Term( 'category', get_the_ID() );
|
92 |
+
$category_id = $primary_term->get_primary_term();
|
93 |
+
if ( $category_id ) {
|
94 |
+
$category = get_term( $category_id );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( ! $category ) {
|
99 |
+
$categories_list = get_the_category();
|
100 |
+
if ( ! empty( $categories_list ) ) {
|
101 |
+
$category = $categories_list[0];
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
if ( $attributes['showCategory'] && $category ) :
|
106 |
+
?>
|
107 |
+
<div class="cat-links">
|
108 |
+
<a href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>">
|
109 |
+
<?php echo esc_html( $category->name ); ?>
|
110 |
+
</a>
|
111 |
+
</div>
|
112 |
+
<?php
|
113 |
+
endif;
|
114 |
+
?>
|
115 |
+
|
116 |
+
<?php
|
117 |
+
the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
|
118 |
+
?>
|
119 |
+
|
120 |
+
<div class="entry-meta">
|
121 |
+
<?php if ( $attributes['showAuthor'] ) : ?>
|
122 |
+
<?php
|
123 |
+
if ( $attributes['showAvatar'] ) {
|
124 |
+
echo get_avatar( get_the_author_meta( 'ID' ) );
|
125 |
+
}
|
126 |
+
?>
|
127 |
+
<span class="byline">
|
128 |
+
<?php
|
129 |
+
printf(
|
130 |
+
/* translators: %s: post author. */
|
131 |
+
esc_html_x( 'by %s', 'post author', 'full-site-editing' ),
|
132 |
+
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
133 |
+
);
|
134 |
+
?>
|
135 |
+
</span><!-- .author-name -->
|
136 |
+
<?php
|
137 |
+
endif;
|
138 |
+
|
139 |
+
if ( $attributes['showDate'] ) {
|
140 |
+
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
141 |
+
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
142 |
+
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
|
143 |
+
}
|
144 |
+
$time_string = sprintf(
|
145 |
+
$time_string,
|
146 |
+
esc_attr( get_the_date( DATE_W3C ) ),
|
147 |
+
esc_html( get_the_date() ),
|
148 |
+
esc_attr( get_the_modified_date( DATE_W3C ) ),
|
149 |
+
esc_html( get_the_modified_date() )
|
150 |
+
);
|
151 |
+
echo $time_string; // phpcs:ignore
|
152 |
+
}
|
153 |
+
?>
|
154 |
+
</div><!-- .entry-meta -->
|
155 |
+
</div><!-- .entry-wrapper -->
|
156 |
+
</article>
|
157 |
+
<?php
|
158 |
+
endwhile;
|
159 |
+
endif;
|
160 |
+
wp_reset_postdata();
|
161 |
+
$slides = ob_get_clean();
|
162 |
+
$buttons = array();
|
163 |
+
for ( $x = 0; $x < $counter; $x++ ) {
|
164 |
+
$aria_label = sprintf(
|
165 |
+
/* translators: %d: Slide number. */
|
166 |
+
__( 'Go to slide %d', 'full-site-editing' ),
|
167 |
+
absint( $x + 1 )
|
168 |
+
);
|
169 |
+
$buttons[] = sprintf(
|
170 |
+
'<button option="%d" class="swiper-pagination-bullet" tabindex="0" role="button" aria-label="%s" %s></button>',
|
171 |
+
absint( $x ),
|
172 |
+
esc_attr( $aria_label ),
|
173 |
+
0 === $x ? 'selected' : ''
|
174 |
+
);
|
175 |
+
}
|
176 |
+
if ( $is_amp ) {
|
177 |
+
$selector = sprintf(
|
178 |
+
'<amp-selector id="wp-block-newspack-carousel__amp-pagination__%1$d" class="swiper-pagination-bullets amp-pagination" on="select:wp-block-newspack-carousel__amp-carousel__%1$d.goToSlide(index=event.targetOption)" layout="container">%2$s</amp-selector>',
|
179 |
+
absint( $newspack_blocks_carousel_id ),
|
180 |
+
implode( '', $buttons )
|
181 |
+
);
|
182 |
+
$carousel = sprintf(
|
183 |
+
'<amp-carousel width="4" height="3" layout="responsive" type="slides" data-next-button-aria-label="%1$s" data-prev-button-aria-label="%2$s" controls loop %3$s id="wp-block-newspack-carousel__amp-carousel__%4$s" on="slideChange:wp-block-newspack-carousel__amp-pagination__%4$s.toggle(index=event.index, value=true)">%5$s</amp-carousel>',
|
184 |
+
esc_attr__( 'Next Slide', 'full-site-editing' ),
|
185 |
+
esc_attr__( 'Previous Slide', 'full-site-editing' ),
|
186 |
+
$autoplay ? 'autoplay delay=' . esc_attr( $delay * 1000 ) : '',
|
187 |
+
absint( $newspack_blocks_carousel_id ),
|
188 |
+
$slides
|
189 |
+
);
|
190 |
+
$autoplay_ui = $autoplay ? newspack_blocks_carousel_block_autoplay_ui_amp( $newspack_blocks_carousel_id ) : '';
|
191 |
+
} else {
|
192 |
+
$selector = sprintf(
|
193 |
+
'<div class="swiper-pagination-bullets amp-pagination">%s</div>',
|
194 |
+
implode( '', $buttons )
|
195 |
+
);
|
196 |
+
$navigation = sprintf(
|
197 |
+
'<a class="swiper-button swiper-button-prev" role="button" aria-label="%s"></a><a class="swiper-button swiper-button-next" role="button" aria-labvel="%s"></a>',
|
198 |
+
esc_attr__( 'Previous Slide', 'full-site-editing' ),
|
199 |
+
esc_attr__( 'Next Slide', 'full-site-editing' )
|
200 |
+
);
|
201 |
+
$carousel = sprintf(
|
202 |
+
'<div class="swiper-container"><div class="swiper-wrapper">%s</div>%s</div>',
|
203 |
+
$slides,
|
204 |
+
$navigation
|
205 |
+
);
|
206 |
+
$autoplay_ui = $autoplay ? newspack_blocks_carousel_block_autoplay_ui( $newspack_blocks_carousel_id ) : '';
|
207 |
+
}
|
208 |
+
$data_attributes = [];
|
209 |
+
|
210 |
+
if ( $autoplay && ! $is_amp ) {
|
211 |
+
$data_attributes[] = 'data-autoplay=1';
|
212 |
+
$data_attributes[] = sprintf( 'data-autoplay_delay=%s', esc_attr( $delay ) );
|
213 |
+
}
|
214 |
+
Newspack_Blocks::enqueue_view_assets( 'carousel' );
|
215 |
+
return sprintf(
|
216 |
+
'<div class="%1$s" id="wp-block-newspack-carousel__%2$d" %3$s>%4$s%5$s%6$s</div>',
|
217 |
+
esc_attr( $classes ),
|
218 |
+
absint( $newspack_blocks_carousel_id ),
|
219 |
+
esc_attr( implode( ' ', $data_attributes ) ),
|
220 |
+
$carousel,
|
221 |
+
$autoplay_ui,
|
222 |
+
$selector
|
223 |
+
);
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Generate autoplay play/pause UI for non-AMP requests.
|
228 |
+
*
|
229 |
+
* @param int $block_ordinal The ordinal number of the block, used in unique ID.
|
230 |
+
*
|
231 |
+
* @return string Autoplay UI markup.
|
232 |
+
*/
|
233 |
+
function newspack_blocks_carousel_block_autoplay_ui( $block_ordinal = 0 ) {
|
234 |
+
return sprintf(
|
235 |
+
'<a aria-label="%s" class="swiper-button swiper-button-pause" role="button"></a><a aria-label="%s" class="swiper-button swiper-button-play" role="button"></a>',
|
236 |
+
esc_attr__( 'Pause Slideshow', 'full-site-editing' ),
|
237 |
+
esc_attr__( 'Play Slideshow', 'full-site-editing' )
|
238 |
+
);
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Generate autoplay play/pause UI for AMP requests.
|
243 |
+
*
|
244 |
+
* @param int $block_ordinal The ordinal number of the block, used in unique ID.
|
245 |
+
*
|
246 |
+
* @return string Autoplay UI markup.
|
247 |
+
*/
|
248 |
+
function newspack_blocks_carousel_block_autoplay_ui_amp( $block_ordinal = 0 ) {
|
249 |
+
$block_id = sprintf(
|
250 |
+
'wp-block-newspack-carousel__%d',
|
251 |
+
absint( $block_ordinal )
|
252 |
+
);
|
253 |
+
$amp_carousel_id = sprintf(
|
254 |
+
'wp-block-newspack-carousel__amp-carousel__%d',
|
255 |
+
absint( $block_ordinal )
|
256 |
+
);
|
257 |
+
$autoplay_pause = sprintf(
|
258 |
+
'<a aria-label="%s" class="amp-carousel-button-pause amp-carousel-button" role="button" on="tap:%s.toggleAutoplay(toggleOn=false),%s.toggleClass(class=wp-block-newspack-blocks-carousel__autoplay-playing,force=false)"></a>',
|
259 |
+
esc_attr__( 'Pause Slideshow', 'full-site-editing' ),
|
260 |
+
esc_attr( $amp_carousel_id ),
|
261 |
+
esc_attr( $block_id )
|
262 |
+
);
|
263 |
+
$autoplay_play = sprintf(
|
264 |
+
'<a aria-label="%s" class="amp-carousel-button-play amp-carousel-button" role="button" on="tap:%s.toggleAutoplay(toggleOn=true),%s.toggleClass(class=wp-block-newspack-blocks-carousel__autoplay-playing,force=true)"></a>',
|
265 |
+
esc_attr__( 'Play Slideshow', 'full-site-editing' ),
|
266 |
+
esc_attr( $amp_carousel_id ),
|
267 |
+
esc_attr( $block_id )
|
268 |
+
);
|
269 |
+
return $autoplay_pause . $autoplay_play;
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Registers the `newspack-blocks/carousel` block on server.
|
274 |
+
*/
|
275 |
+
function newspack_blocks_register_carousel() {
|
276 |
+
register_block_type(
|
277 |
+
apply_filters( 'newspack_blocks_block_name', 'newspack-blocks/carousel' ),
|
278 |
+
apply_filters(
|
279 |
+
'newspack_blocks_block_args',
|
280 |
+
array(
|
281 |
+
'attributes' => array(
|
282 |
+
'className' => array(
|
283 |
+
'type' => 'string',
|
284 |
+
),
|
285 |
+
'postsToShow' => array(
|
286 |
+
'type' => 'integer',
|
287 |
+
'default' => 3,
|
288 |
+
),
|
289 |
+
'authors' => array(
|
290 |
+
'type' => 'array',
|
291 |
+
'default' => array(),
|
292 |
+
'items' => array(
|
293 |
+
'type' => 'integer',
|
294 |
+
),
|
295 |
+
),
|
296 |
+
'categories' => array(
|
297 |
+
'type' => 'array',
|
298 |
+
'default' => array(),
|
299 |
+
'items' => array(
|
300 |
+
'type' => 'integer',
|
301 |
+
),
|
302 |
+
),
|
303 |
+
'tags' => array(
|
304 |
+
'type' => 'array',
|
305 |
+
'default' => array(),
|
306 |
+
'items' => array(
|
307 |
+
'type' => 'integer',
|
308 |
+
),
|
309 |
+
),
|
310 |
+
'autoplay' => array(
|
311 |
+
'type' => 'boolean',
|
312 |
+
'default' => false,
|
313 |
+
),
|
314 |
+
'delay' => array(
|
315 |
+
'type' => 'integer',
|
316 |
+
'default' => 5,
|
317 |
+
),
|
318 |
+
'showAuthor' => array(
|
319 |
+
'type' => 'boolean',
|
320 |
+
'default' => true,
|
321 |
+
),
|
322 |
+
'showAvatar' => array(
|
323 |
+
'type' => 'boolean',
|
324 |
+
'default' => true,
|
325 |
+
),
|
326 |
+
'showCategory' => array(
|
327 |
+
'type' => 'boolean',
|
328 |
+
'default' => false,
|
329 |
+
),
|
330 |
+
'showDate' => array(
|
331 |
+
'type' => 'boolean',
|
332 |
+
'default' => true,
|
333 |
+
),
|
334 |
+
),
|
335 |
+
'render_callback' => 'newspack_blocks_render_block_carousel',
|
336 |
+
),
|
337 |
+
'carousel'
|
338 |
+
)
|
339 |
+
);
|
340 |
+
}
|
341 |
+
add_action( 'init', 'newspack_blocks_register_carousel' );
|
newspack-blocks/synced-newspack-blocks/blocks/carousel/view.scss
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@import '../../shared/sass/variables';
|
2 |
+
@import '../../shared/sass/mixins';
|
3 |
+
|
4 |
+
.wp-block-newspack-blocks-carousel {
|
5 |
+
position: relative;
|
6 |
+
margin-top: 0;
|
7 |
+
article {
|
8 |
+
max-width: 100%;
|
9 |
+
padding: 0;
|
10 |
+
position: relative;
|
11 |
+
margin-bottom: 0;
|
12 |
+
word-break: break-word;
|
13 |
+
overflow-wrap: break-word;
|
14 |
+
|
15 |
+
a {
|
16 |
+
color: inherit;
|
17 |
+
|
18 |
+
&:active,
|
19 |
+
&:focus,
|
20 |
+
&:hover {
|
21 |
+
color: rgba( 255, 255, 255, 0.75 );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
.entry-title {
|
25 |
+
font-size: 1.2em;
|
26 |
+
|
27 |
+
a {
|
28 |
+
/* autoprefixer: off */
|
29 |
+
-webkit-box-orient: vertical;
|
30 |
+
/* autoprefixer: on */
|
31 |
+
display: -webkit-box;
|
32 |
+
-webkit-line-clamp: 3;
|
33 |
+
max-height: 3.5625em;
|
34 |
+
overflow: hidden;
|
35 |
+
text-overflow: ellipsis;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
.avatar {
|
39 |
+
height: 1.8em;
|
40 |
+
width: 1.8em;
|
41 |
+
}
|
42 |
+
|
43 |
+
@include media( tablet ) {
|
44 |
+
.entry-title {
|
45 |
+
font-size: 1.6em;
|
46 |
+
}
|
47 |
+
.avatar {
|
48 |
+
height: 40px;
|
49 |
+
width: 40px;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
.entry-wrapper {
|
53 |
+
bottom: 0;
|
54 |
+
background-color: rgba( black, 0.5 );
|
55 |
+
color: white;
|
56 |
+
left: 0;
|
57 |
+
padding: 1.5em;
|
58 |
+
position: absolute;
|
59 |
+
right: 0;
|
60 |
+
}
|
61 |
+
.entry-meta {
|
62 |
+
color: inherit;
|
63 |
+
margin-bottom: 0;
|
64 |
+
font-size: 0.8em;
|
65 |
+
|
66 |
+
a {
|
67 |
+
color: inherit;
|
68 |
+
font-weight: bold;
|
69 |
+
text-decoration: none;
|
70 |
+
|
71 |
+
&:active,
|
72 |
+
&:focus,
|
73 |
+
&:hover {
|
74 |
+
color: rgba( 255, 255, 255, 0.75 );
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
figure.post-thumbnail {
|
80 |
+
margin: 0;
|
81 |
+
height: 100%;
|
82 |
+
padding: 0;
|
83 |
+
a,
|
84 |
+
img {
|
85 |
+
display: block;
|
86 |
+
height: 100%;
|
87 |
+
width: 100%;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
p {
|
91 |
+
white-space: normal;
|
92 |
+
}
|
93 |
+
.swiper-pagination-bullets {
|
94 |
+
align-items: flex-end;
|
95 |
+
bottom: 0;
|
96 |
+
display: flex;
|
97 |
+
flex-wrap: wrap;
|
98 |
+
height: calc( 1.5em + 12px );
|
99 |
+
justify-content: center;
|
100 |
+
padding: 0;
|
101 |
+
position: relative;
|
102 |
+
}
|
103 |
+
.swiper-pagination-bullet {
|
104 |
+
background: black;
|
105 |
+
border-radius: 6px;
|
106 |
+
display: inline-block;
|
107 |
+
height: 12px;
|
108 |
+
margin: 0 4px;
|
109 |
+
opacity: 0.5;
|
110 |
+
padding: 0;
|
111 |
+
transition: box-shadow 250ms, opacity 250ms, width 250ms;
|
112 |
+
width: 12px;
|
113 |
+
&:focus {
|
114 |
+
box-shadow: 0 0 0 2px white, 0 0 0 4px black;
|
115 |
+
outline: 0;
|
116 |
+
}
|
117 |
+
&.swiper-pagination-bullet-active,
|
118 |
+
&[selected] {
|
119 |
+
opacity: 1;
|
120 |
+
outline: 0;
|
121 |
+
width: 24px;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
.swiper-button,
|
125 |
+
.amp-carousel-button {
|
126 |
+
background-color: rgba( black, 0.5 );
|
127 |
+
background-position: center;
|
128 |
+
background-repeat: no-repeat;
|
129 |
+
background-size: 24px;
|
130 |
+
border: 0;
|
131 |
+
border-radius: 4px;
|
132 |
+
box-shadow: none;
|
133 |
+
cursor: pointer;
|
134 |
+
height: 48px;
|
135 |
+
margin: 0;
|
136 |
+
padding: 0;
|
137 |
+
transition: background-color 250ms, box-shadow 250ms;
|
138 |
+
width: 48px;
|
139 |
+
&:focus,
|
140 |
+
&:hover {
|
141 |
+
background-color: rgba( black, 0.75 );
|
142 |
+
}
|
143 |
+
&:focus {
|
144 |
+
box-shadow: inset 0 0 0 2px rgba( black, 0.75 ), inset 0 0 0 4px white;
|
145 |
+
outline: 0;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
.amp-carousel-button-next,
|
149 |
+
.amp-carousel-button-prev,
|
150 |
+
.swiper-button-next,
|
151 |
+
.swiper-button-prev {
|
152 |
+
left: 1.5em;
|
153 |
+
display: none;
|
154 |
+
|
155 |
+
@include media( mobile ) {
|
156 |
+
display: block;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
.swiper-button-next,
|
160 |
+
.swiper-button-prev {
|
161 |
+
margin-top: -24px;
|
162 |
+
}
|
163 |
+
.amp-carousel-button-next,
|
164 |
+
.swiper-button-next {
|
165 |
+
background-image: url( "data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M5.88%204.12L13.76%2012l-7.88%207.88L8%2022l10-10L8%202z'%20fill='white'/%3E%3Cpath%20fill='none'%20d='M0 0h24v24H0z'/%3E%3C/svg%3E" );
|
166 |
+
left: auto;
|
167 |
+
right: 1.5em;
|
168 |
+
}
|
169 |
+
.amp-carousel-button-prev,
|
170 |
+
.swiper-button-prev {
|
171 |
+
background-image: url( "data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M18%204.12L10.12%2012%2018%2019.88%2015.88%2022l-10-10%2010-10z'%20fill='white'/%3E%3Cpath%20fill='none'%20d='M0 0h24v24H0z'/%3E%3C/svg%3E" );
|
172 |
+
}
|
173 |
+
.amp-carousel-button-pause,
|
174 |
+
.amp-carousel-button-play,
|
175 |
+
.swiper-button-pause,
|
176 |
+
.swiper-button-play {
|
177 |
+
background-image: url( "data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M6%2019h4V5H6v14zm8-14v14h4V5h-4z'%20fill='white'/%3E%3Cpath%20d='M0%200h24v24H0z'%20fill='none'/%3E%3C/svg%3E" );
|
178 |
+
display: none;
|
179 |
+
margin-top: 0;
|
180 |
+
position: absolute;
|
181 |
+
right: 1.5em;
|
182 |
+
top: 1.5em;
|
183 |
+
transform: none;
|
184 |
+
z-index: 1;
|
185 |
+
}
|
186 |
+
.amp-carousel-button-play,
|
187 |
+
.swiper-button-play {
|
188 |
+
background-image: url( "data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M8%205v14l11-7z'%20fill='white'/%3E%3Cpath%20d='M0 0h24v24H0z'%20fill='none'/%3E%3C/svg%3E" );
|
189 |
+
}
|
190 |
+
|
191 |
+
/* Swiper Slide */
|
192 |
+
.swiper-slide {
|
193 |
+
height: auto;
|
194 |
+
}
|
195 |
+
|
196 |
+
/* Image styles */
|
197 |
+
figcaption {
|
198 |
+
font-size: $font__size-xxs;
|
199 |
+
}
|
200 |
+
|
201 |
+
/* Headings */
|
202 |
+
.entry-title {
|
203 |
+
margin: 0 0 0.25em;
|
204 |
+
a {
|
205 |
+
color: inherit;
|
206 |
+
text-decoration: none;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/* Article meta */
|
211 |
+
.entry-meta {
|
212 |
+
display: flex;
|
213 |
+
flex-wrap: wrap;
|
214 |
+
align-items: center;
|
215 |
+
margin-top: 0.5em;
|
216 |
+
.byline:not( :last-child ) {
|
217 |
+
margin-right: 1.5em;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
.cat-links {
|
221 |
+
color: inherit;
|
222 |
+
font-size: 0.6em;
|
223 |
+
font-weight: bold;
|
224 |
+
margin: 0 0 0.5em;
|
225 |
+
a {
|
226 |
+
text-decoration: none;
|
227 |
+
}
|
228 |
+
}
|
229 |
+
.avatar {
|
230 |
+
border-radius: 100%;
|
231 |
+
display: block;
|
232 |
+
margin-right: 0.5em;
|
233 |
+
}
|
234 |
+
&.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-pause,
|
235 |
+
&.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-pause,
|
236 |
+
.amp-carousel-button-play,
|
237 |
+
.swiper-button-play {
|
238 |
+
display: block;
|
239 |
+
}
|
240 |
+
&.wp-block-newspack-blocks-carousel__autoplay-playing .amp-carousel-button-play,
|
241 |
+
&.wp-block-newspack-blocks-carousel__autoplay-playing .swiper-button-play,
|
242 |
+
.amp-carousel-button-pause,
|
243 |
+
.swiper-button-pause {
|
244 |
+
display: none;
|
245 |
+
}
|
246 |
+
}
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/block.json
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/edit.js
RENAMED
@@ -6,6 +6,7 @@
|
|
6 |
import QueryControls from '../../components/query-controls';
|
7 |
import { STORE_NAMESPACE } from './store';
|
8 |
import { isBlogPrivate, isSpecificPostModeActive, queryCriteriaFromAttributes } from './utils';
|
|
|
9 |
|
10 |
/**
|
11 |
* External dependencies
|
@@ -15,7 +16,7 @@ import classNames from 'classnames';
|
|
15 |
/**
|
16 |
* WordPress dependencies
|
17 |
*/
|
18 |
-
import { __
|
19 |
import { dateI18n, __experimentalGetSettings } from '@wordpress/date';
|
20 |
import { Component, Fragment, RawHTML } from '@wordpress/element';
|
21 |
import {
|
@@ -178,8 +179,8 @@ class Edit extends Component {
|
|
178 |
</RawHTML>
|
179 |
) }
|
180 |
<div className="entry-meta">
|
181 |
-
{ showAuthor && showAvatar &&
|
182 |
-
{ showAuthor &&
|
183 |
{ showDate && (
|
184 |
<time className="entry-date published" key="pub-date">
|
185 |
{ dateI18n( dateFormat, post.date_gmt ) }
|
@@ -203,35 +204,6 @@ class Edit extends Component {
|
|
203 |
}
|
204 |
};
|
205 |
|
206 |
-
formatAvatars = authorInfo =>
|
207 |
-
authorInfo.map( author => (
|
208 |
-
<span className="avatar author-avatar" key={ author.id }>
|
209 |
-
<a className="url fn n" href="#">
|
210 |
-
<RawHTML>{ author.avatar }</RawHTML>
|
211 |
-
</a>
|
212 |
-
</span>
|
213 |
-
) );
|
214 |
-
|
215 |
-
formatByline = authorInfo => (
|
216 |
-
<span className="byline">
|
217 |
-
{ _x( 'by', 'post author', 'full-site-editing' ) }{' '}
|
218 |
-
{ authorInfo.reduce( ( accumulator, author, index ) => {
|
219 |
-
return [
|
220 |
-
...accumulator,
|
221 |
-
<span className="author vcard" key={ author.id }>
|
222 |
-
<a className="url fn n" href="#">
|
223 |
-
{ author.display_name }
|
224 |
-
</a>
|
225 |
-
</span>,
|
226 |
-
index < authorInfo.length - 2 && ', ',
|
227 |
-
authorInfo.length > 1 &&
|
228 |
-
index === authorInfo.length - 2 &&
|
229 |
-
_x( ' and ', 'post author', 'full-site-editing' ),
|
230 |
-
];
|
231 |
-
}, [] ) }
|
232 |
-
</span>
|
233 |
-
);
|
234 |
-
|
235 |
renderInspectorControls = () => {
|
236 |
const { attributes, setAttributes, textColor, setTextColor } = this.props;
|
237 |
|
6 |
import QueryControls from '../../components/query-controls';
|
7 |
import { STORE_NAMESPACE } from './store';
|
8 |
import { isBlogPrivate, isSpecificPostModeActive, queryCriteriaFromAttributes } from './utils';
|
9 |
+
import { formatAvatars, formatByline } from '../../shared/js/utils';
|
10 |
|
11 |
/**
|
12 |
* External dependencies
|
16 |
/**
|
17 |
* WordPress dependencies
|
18 |
*/
|
19 |
+
import { __ } from '@wordpress/i18n';
|
20 |
import { dateI18n, __experimentalGetSettings } from '@wordpress/date';
|
21 |
import { Component, Fragment, RawHTML } from '@wordpress/element';
|
22 |
import {
|
179 |
</RawHTML>
|
180 |
) }
|
181 |
<div className="entry-meta">
|
182 |
+
{ showAuthor && showAvatar && formatAvatars( post.newspack_author_info ) }
|
183 |
+
{ showAuthor && formatByline( post.newspack_author_info ) }
|
184 |
{ showDate && (
|
185 |
<time className="entry-date published" key="pub-date">
|
186 |
{ dateI18n( dateFormat, post.date_gmt ) }
|
204 |
}
|
205 |
};
|
206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
renderInspectorControls = () => {
|
208 |
const { attributes, setAttributes, textColor, setTextColor } = this.props;
|
209 |
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/editor.js
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/editor.scss
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/index.js
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/store.js
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/templates/article.php
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/templates/articles-list.php
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/templates/articles-loop.php
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/utils.js
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/view.js
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/view.php
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/blocks/homepage-articles/view.scss
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/class-newspack-blocks-api.php
RENAMED
@@ -86,6 +86,14 @@ class Newspack_Blocks_API {
|
|
86 |
return false;
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
// Landscape image.
|
90 |
$landscape_size = Newspack_Blocks::image_size_for_orientation( 'landscape' );
|
91 |
|
@@ -164,6 +172,10 @@ class Newspack_Blocks_API {
|
|
164 |
} else {
|
165 |
$author_avatar = coauthors_get_avatar( $author, 48 );
|
166 |
}
|
|
|
|
|
|
|
|
|
167 |
$author_data[] = array(
|
168 |
/* Get the author name */
|
169 |
'display_name' => esc_html( $author->display_name ),
|
@@ -171,6 +183,8 @@ class Newspack_Blocks_API {
|
|
171 |
'avatar' => wp_kses_post( $author_avatar ),
|
172 |
/* Get the author ID */
|
173 |
'id' => $author->ID,
|
|
|
|
|
174 |
);
|
175 |
}
|
176 |
else :
|
@@ -181,6 +195,8 @@ class Newspack_Blocks_API {
|
|
181 |
'avatar' => get_avatar( $object['author'], 48 ),
|
182 |
/* Get the author ID */
|
183 |
'id' => $object['author'],
|
|
|
|
|
184 |
);
|
185 |
endif;
|
186 |
|
@@ -244,7 +260,34 @@ class Newspack_Blocks_API {
|
|
244 |
$args = $request->get_params();
|
245 |
return new \WP_REST_Response( newspack_blocks_get_video_playlist( $args ), 200 );
|
246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
add_action( 'rest_api_init', array( 'Newspack_Blocks_API', 'register_rest_fields' ) );
|
250 |
add_action( 'rest_api_init', array( 'Newspack_Blocks_API', 'register_video_playlist_endpoint' ) );
|
|
86 |
return false;
|
87 |
}
|
88 |
|
89 |
+
// Large image.
|
90 |
+
$feat_img_array_large = wp_get_attachment_image_src(
|
91 |
+
$object['featured_media'],
|
92 |
+
'large',
|
93 |
+
false
|
94 |
+
);
|
95 |
+
$featured_image_set['large'] = $feat_img_array_large[0];
|
96 |
+
|
97 |
// Landscape image.
|
98 |
$landscape_size = Newspack_Blocks::image_size_for_orientation( 'landscape' );
|
99 |
|
172 |
} else {
|
173 |
$author_avatar = coauthors_get_avatar( $author, 48 );
|
174 |
}
|
175 |
+
$author_link = null;
|
176 |
+
if ( function_exists( 'coauthors_posts_links' ) ) {
|
177 |
+
$author_link = get_author_posts_url( $author->ID, $author->user_nicename );
|
178 |
+
}
|
179 |
$author_data[] = array(
|
180 |
/* Get the author name */
|
181 |
'display_name' => esc_html( $author->display_name ),
|
183 |
'avatar' => wp_kses_post( $author_avatar ),
|
184 |
/* Get the author ID */
|
185 |
'id' => $author->ID,
|
186 |
+
/* Get the author Link */
|
187 |
+
'author_link' => $author_link,
|
188 |
);
|
189 |
}
|
190 |
else :
|
195 |
'avatar' => get_avatar( $object['author'], 48 ),
|
196 |
/* Get the author ID */
|
197 |
'id' => $object['author'],
|
198 |
+
/* Get the author Link */
|
199 |
+
'author_link' => get_author_posts_url( $object['author'] ),
|
200 |
);
|
201 |
endif;
|
202 |
|
260 |
$args = $request->get_params();
|
261 |
return new \WP_REST_Response( newspack_blocks_get_video_playlist( $args ), 200 );
|
262 |
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Adds meta query support to API rest endpoint.
|
266 |
+
*
|
267 |
+
* @param array $args Key value array of query var to query value.
|
268 |
+
* @param WP_REST_Request $request The request used.
|
269 |
+
* @return array $args Filtered request parameters.
|
270 |
+
*/
|
271 |
+
public static function post_meta_request_params( $args, $request ) {
|
272 |
+
$params = $request->get_params();
|
273 |
+
|
274 |
+
if (
|
275 |
+
isset( $params['meta_key'], $params['meta_value_num'], $params['meta_compare'] ) &&
|
276 |
+
'_thumbnail_id' === $params['meta_key'] &&
|
277 |
+
'0' === $params['meta_value_num'] &&
|
278 |
+
'>' === $params['meta_compare']
|
279 |
+
) {
|
280 |
+
// phpcs:disable WordPress.DB.SlowDBQuery
|
281 |
+
$args['meta_key'] = $params['meta_key'];
|
282 |
+
$args['meta_value_num'] = $params['meta_value_num'];
|
283 |
+
$args['meta_compare'] = $params['meta_compare'];
|
284 |
+
// phpcs:enable WordPress.DB.SlowDBQuery
|
285 |
+
}
|
286 |
+
|
287 |
+
return $args;
|
288 |
+
}
|
289 |
}
|
290 |
|
291 |
add_action( 'rest_api_init', array( 'Newspack_Blocks_API', 'register_rest_fields' ) );
|
292 |
add_action( 'rest_api_init', array( 'Newspack_Blocks_API', 'register_video_playlist_endpoint' ) );
|
293 |
+
add_filter( 'rest_post_query', array( 'Newspack_Blocks_API', 'post_meta_request_params' ), 10, 2 );
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/class-newspack-blocks.php
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/components/autocomplete-tokenfield.js
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/components/autocomplete-tokenfield.scss
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/components/query-controls.js
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/js/newspack-icon.js
RENAMED
File without changes
|
newspack-blocks/synced-newspack-blocks/shared/js/utils.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { _x } from '@wordpress/i18n';
|
5 |
+
import { RawHTML } from '@wordpress/element';
|
6 |
+
|
7 |
+
export const formatAvatars = authorInfo =>
|
8 |
+
authorInfo.map( author => (
|
9 |
+
<span className="avatar author-avatar" key={ author.id }>
|
10 |
+
<a className="url fn n" href={ author.author_link }>
|
11 |
+
<RawHTML>{ author.avatar }</RawHTML>
|
12 |
+
</a>
|
13 |
+
</span>
|
14 |
+
) );
|
15 |
+
|
16 |
+
export const formatByline = authorInfo => (
|
17 |
+
<span className="byline">
|
18 |
+
{ _x( 'by', 'post author', 'newspack-blocks' ) }{' '}
|
19 |
+
{ authorInfo.reduce( ( accumulator, author, index ) => {
|
20 |
+
return [
|
21 |
+
...accumulator,
|
22 |
+
<span className="author vcard" key={ author.id }>
|
23 |
+
<a className="url fn n" href={ author.author_link }>
|
24 |
+
{ author.display_name }
|
25 |
+
</a>
|
26 |
+
</span>,
|
27 |
+
index < authorInfo.length - 2 && ', ',
|
28 |
+
authorInfo.length > 1 &&
|
29 |
+
index === authorInfo.length - 2 &&
|
30 |
+
_x( ' and ', 'post author', 'newspack-blocks' ),
|
31 |
+
];
|
32 |
+
}, [] ) }
|
33 |
+
</span>
|
34 |
+
);
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_colors.scss
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_mixins.scss
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_placeholder.scss
RENAMED
File without changes
|
{blog-posts-block/newspack-homepage-articles → newspack-blocks/synced-newspack-blocks}/shared/sass/_variables.scss
RENAMED
File without changes
|
posts-list-block/dist/posts-list-block.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '9b1987838d08ac086aa2a37430e1df50');
|
premium-content/blocks/container/blocks.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { InnerBlocks } from '@wordpress/block-editor';
|
5 |
+
|
6 |
+
export default function Blocks() {
|
7 |
+
return (
|
8 |
+
<div className="premium-content-wrapper">
|
9 |
+
<InnerBlocks
|
10 |
+
allowedBlocks={ [ 'premium-content/subscriber-view', 'premium-content/logged-out-view' ] }
|
11 |
+
templateLock={ 'all' }
|
12 |
+
template={ [
|
13 |
+
[ 'premium-content/subscriber-view' ],
|
14 |
+
[ 'premium-content/logged-out-view' ],
|
15 |
+
] }
|
16 |
+
/>
|
17 |
+
</div>
|
18 |
+
);
|
19 |
+
}
|
premium-content/blocks/container/context.js
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { createContext } from '@wordpress/element';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* @typedef { import('react').ReactElement } ReactElement
|
8 |
+
* @typedef { import('./tab').Tab } Tab
|
9 |
+
* @typedef { (isSelected: boolean) => void } Callback
|
10 |
+
* @typedef { {selectedTab: Tab, stripeNudge: ?ReactElement } } TabbedInterface
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @type { TabbedInterface }
|
15 |
+
*/
|
16 |
+
const defaultContext = {
|
17 |
+
selectedTab: { id: '', className: '', label: <></> },
|
18 |
+
stripeNudge: null,
|
19 |
+
};
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @typedef { import('react').Context<TabbedInterface> } TabContext
|
23 |
+
* @type { TabContext }
|
24 |
+
*/
|
25 |
+
const Context = createContext( defaultContext );
|
26 |
+
|
27 |
+
export default Context;
|
premium-content/blocks/container/controls.js
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { Fragment } from '@wordpress/element';
|
5 |
+
import { BlockControls } from '@wordpress/block-editor';
|
6 |
+
import { Dashicon, DropdownMenu, Toolbar } from '@wordpress/components';
|
7 |
+
import { __ } from '@wordpress/i18n';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Internal dependencies
|
11 |
+
*/
|
12 |
+
import Plans from './plans';
|
13 |
+
import NewPlan from './new-plan';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @typedef { import('./plans').Plan } Plan
|
17 |
+
*
|
18 |
+
* @typedef { Object } Props
|
19 |
+
* @property { number } selectedPlanId
|
20 |
+
* @property { (plan: Plan) => void } onSelected
|
21 |
+
* @property { string } className
|
22 |
+
* @property { Plan[] } plans
|
23 |
+
*
|
24 |
+
* @param { Props } props
|
25 |
+
*/
|
26 |
+
export default function Controls( props ) {
|
27 |
+
const { selectedPlanId, onSelected, plans } = props;
|
28 |
+
const currentPlan = plans.find( ( plan ) => plan.id === selectedPlanId );
|
29 |
+
return (
|
30 |
+
<BlockControls>
|
31 |
+
<Toolbar>
|
32 |
+
<DropdownMenu
|
33 |
+
// @ts-ignore We want a label with our Dashicon.Icon
|
34 |
+
icon={
|
35 |
+
<Fragment>
|
36 |
+
<Dashicon icon="update" />{ ' ' }
|
37 |
+
{ currentPlan && (
|
38 |
+
<Fragment>
|
39 |
+
{ ' ' }
|
40 |
+
{ currentPlan.title } : { currentPlan.price } { currentPlan.currency } /{ ' ' }
|
41 |
+
{ currentPlan.interval }{ ' ' }
|
42 |
+
</Fragment>
|
43 |
+
) }
|
44 |
+
</Fragment>
|
45 |
+
}
|
46 |
+
label={ __( 'Select a plan', 'premium-content' ) }
|
47 |
+
className={ 'premium-content-toolbar-button' }
|
48 |
+
>
|
49 |
+
{ ( { onClose } ) => (
|
50 |
+
<Fragment>
|
51 |
+
<Plans
|
52 |
+
{ ...props }
|
53 |
+
onSelected={ onSelected }
|
54 |
+
onClose={ onClose }
|
55 |
+
selectedPlan={ currentPlan }
|
56 |
+
/>
|
57 |
+
<NewPlan { ...props } onClose={ onClose } />
|
58 |
+
</Fragment>
|
59 |
+
) }
|
60 |
+
</DropdownMenu>
|
61 |
+
</Toolbar>
|
62 |
+
</BlockControls>
|
63 |
+
);
|
64 |
+
}
|
premium-content/blocks/container/edit.js
ADDED
@@ -0,0 +1,439 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { useEffect, useState, useRef } from '@wordpress/element';
|
5 |
+
import { Placeholder, Button, ExternalLink, withNotices, Spinner } from '@wordpress/components';
|
6 |
+
import { __, sprintf } from '@wordpress/i18n';
|
7 |
+
import { compose } from '@wordpress/compose';
|
8 |
+
import { withSelect, withDispatch } from '@wordpress/data';
|
9 |
+
import { addQueryArgs, getQueryArg, isURL } from '@wordpress/url';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Internal dependencies
|
13 |
+
*/
|
14 |
+
import Tabs from './tabs';
|
15 |
+
import Blocks from './blocks';
|
16 |
+
import Controls from './controls';
|
17 |
+
import Inspector from './inspector';
|
18 |
+
import StripeNudge from './stripe-nudge';
|
19 |
+
import Context from './context';
|
20 |
+
import apiFetch from '@wordpress/api-fetch';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @typedef { import('./plan').Plan } Plan
|
24 |
+
*/
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @typedef { import('./tabs').Tab } Tab
|
28 |
+
* @type { Tab[] }
|
29 |
+
*/
|
30 |
+
const tabs = [
|
31 |
+
{
|
32 |
+
id: 'premium',
|
33 |
+
label: <span>{ __( 'Subscriber View', 'premium-content' ) }</span>,
|
34 |
+
className: 'wp-premium-content-subscriber-view',
|
35 |
+
},
|
36 |
+
{
|
37 |
+
id: 'wall',
|
38 |
+
label: <span>{ __( 'Logged Out View', 'premium-content' ) }</span>,
|
39 |
+
className: 'wp-premium-content-logged-out-view',
|
40 |
+
},
|
41 |
+
];
|
42 |
+
|
43 |
+
const API_STATE_LOADING = 0;
|
44 |
+
const API_STATE_CONNECTED = 1;
|
45 |
+
const API_STATE_NOTCONNECTED = 2;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @type { Plan[] }
|
49 |
+
*/
|
50 |
+
const emptyProducts = [];
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @type {?string}
|
54 |
+
*/
|
55 |
+
const defaultString = null;
|
56 |
+
|
57 |
+
/**
|
58 |
+
*
|
59 |
+
* @typedef { import('react').MutableRefObject<?HTMLDivElement> } ContainerRef
|
60 |
+
*/
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Block edit function
|
64 |
+
*
|
65 |
+
* @typedef { import('@wordpress/components').withNotices.Props } NoticeProps
|
66 |
+
* @typedef { import('./').Attributes } Attributes
|
67 |
+
* @typedef { Object } OwnProps
|
68 |
+
* @property { boolean } isSelected
|
69 |
+
* @property { string } className
|
70 |
+
* @property { string } clientId
|
71 |
+
* @property { string } containerClientId
|
72 |
+
* @property { Attributes } attributes
|
73 |
+
* @property { (attributes: Partial<Attributes>) => void } setAttributes
|
74 |
+
* @property { ?Element } noticeUI
|
75 |
+
* @property { number } postId
|
76 |
+
* @property { () => void } selectBlock
|
77 |
+
*
|
78 |
+
* @typedef { NoticeProps & OwnProps } Props
|
79 |
+
*
|
80 |
+
* @param { Props } props
|
81 |
+
*/
|
82 |
+
|
83 |
+
function Edit( props ) {
|
84 |
+
const [ selectedTab, selectTab ] = useState( tabs[ 1 ] );
|
85 |
+
const [ selectedInnerBlock, hasSelectedInnerBlock ] = useState( false );
|
86 |
+
const [ products, setProducts ] = useState( emptyProducts );
|
87 |
+
const [ connectURL, setConnectURL ] = useState( defaultString );
|
88 |
+
const [ apiState, setApiState ] = useState( API_STATE_LOADING );
|
89 |
+
const [ shouldUpgrade, setShouldUpgrade ] = useState( false );
|
90 |
+
const [ upgradeURL, setUpgradeURL ] = useState( '' );
|
91 |
+
// @ts-ignore needed in some upgrade flows - depending how we implement this
|
92 |
+
const [ siteSlug, setSiteSlug ] = useState( '' ); // eslint-disable-line
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Hook to save a new plan.
|
96 |
+
*
|
97 |
+
* @typedef {import('./inspector').PlanAttributes} PlanAttributes
|
98 |
+
* @param {PlanAttributes} attributes
|
99 |
+
* @param {(isSuccessful: boolean) => void} callback
|
100 |
+
*/
|
101 |
+
function savePlan( attributes, callback ) {
|
102 |
+
const path = '/wpcom/v2/memberships/product';
|
103 |
+
const method = 'POST';
|
104 |
+
if ( ! attributes.newPlanName || attributes.newPlanName.length === 0 ) {
|
105 |
+
onError( props, __( 'Plan requires a name', 'premium-content' ) );
|
106 |
+
callback( false );
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
// TODO: change that to minimumTransactionAmountForCurrency when formatcurrency works.
|
111 |
+
if (
|
112 |
+
attributes.newPlanPrice &&
|
113 |
+
( attributes.newPlanPrice < 5 || isNaN( attributes.newPlanPrice ) )
|
114 |
+
) {
|
115 |
+
onError( props, sprintf( __( 'Minimum allowed price is %s.' ), 5 ) );
|
116 |
+
callback( false );
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( ! attributes.newPlanPrice ) {
|
121 |
+
onError( props, __( 'Plan requires a valid price' ) );
|
122 |
+
callback( false );
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
const data = {
|
127 |
+
currency: attributes.newPlanCurrency,
|
128 |
+
price: attributes.newPlanPrice,
|
129 |
+
title: attributes.newPlanName,
|
130 |
+
interval: attributes.newPlanInterval,
|
131 |
+
};
|
132 |
+
const fetch = { path, method, data };
|
133 |
+
apiFetch( fetch ).then(
|
134 |
+
/**
|
135 |
+
* @param { any } result
|
136 |
+
* @return { void }
|
137 |
+
*/
|
138 |
+
( result ) => {
|
139 |
+
/**
|
140 |
+
* @type { Plan }
|
141 |
+
*/
|
142 |
+
const newProduct = {
|
143 |
+
id: result.id,
|
144 |
+
title: result.title,
|
145 |
+
interval: result.interval,
|
146 |
+
price: result.price,
|
147 |
+
currency: result.currency,
|
148 |
+
};
|
149 |
+
setProducts( products.concat( [ newProduct ] ) );
|
150 |
+
// After successful adding of product, we want to select it. Presumably that is the product user wants.
|
151 |
+
selectPlan( newProduct );
|
152 |
+
if ( callback ) {
|
153 |
+
callback( true );
|
154 |
+
}
|
155 |
+
},
|
156 |
+
/**
|
157 |
+
* @param { Error } error
|
158 |
+
* @return { void }
|
159 |
+
*/
|
160 |
+
() => {
|
161 |
+
onError( props, __( 'There was an error when adding the plan.' ) );
|
162 |
+
if ( callback ) {
|
163 |
+
callback( false );
|
164 |
+
}
|
165 |
+
}
|
166 |
+
);
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* @param {Plan} plan
|
171 |
+
*/
|
172 |
+
function selectPlan( plan ) {
|
173 |
+
props.setAttributes( { selectedPlanId: plan.id } );
|
174 |
+
}
|
175 |
+
//We would like to hide the tabs and controls when user clicks outside the premium content block
|
176 |
+
/**
|
177 |
+
* @type { ContainerRef }
|
178 |
+
*/
|
179 |
+
const wrapperRef = useRef( null );
|
180 |
+
useOutsideAlerter( wrapperRef, hasSelectedInnerBlock );
|
181 |
+
|
182 |
+
const { isSelected, className } = props;
|
183 |
+
|
184 |
+
useEffect( () => {
|
185 |
+
const path = '/wpcom/v2/memberships/status';
|
186 |
+
const method = 'GET';
|
187 |
+
const fetch = { path, method };
|
188 |
+
apiFetch( fetch ).then(
|
189 |
+
/**
|
190 |
+
* @param {any} result
|
191 |
+
*/
|
192 |
+
( result ) => {
|
193 |
+
if ( ! result && typeof result !== 'object' ) {
|
194 |
+
return;
|
195 |
+
}
|
196 |
+
if (
|
197 |
+
result.errors &&
|
198 |
+
Object.values( result.errors ) &&
|
199 |
+
Object.values( result.errors )[ 0 ][ 0 ]
|
200 |
+
) {
|
201 |
+
setApiState( API_STATE_NOTCONNECTED );
|
202 |
+
onError( props, Object.values( result.errors )[ 0 ][ 0 ] );
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
|
206 |
+
setConnectURL( result.connect_url );
|
207 |
+
setShouldUpgrade( result.should_upgrade_to_access_memberships );
|
208 |
+
setUpgradeURL( result.upgrade_url );
|
209 |
+
setSiteSlug( result.site_slug );
|
210 |
+
|
211 |
+
if (
|
212 |
+
result.products &&
|
213 |
+
result.products.length === 0 &&
|
214 |
+
! result.should_upgrade_to_access_memberships &&
|
215 |
+
result.connected_account_id
|
216 |
+
) {
|
217 |
+
// Is ready to use and has no product set up yet. Let's create one!
|
218 |
+
savePlan(
|
219 |
+
{
|
220 |
+
newPlanCurrency: 'USD',
|
221 |
+
newPlanPrice: 5,
|
222 |
+
newPlanName: __( 'Monthly Subscription' ),
|
223 |
+
newPlanInterval: '1 month',
|
224 |
+
},
|
225 |
+
() => {
|
226 |
+
setApiState(
|
227 |
+
result.connected_account_id ? API_STATE_CONNECTED : API_STATE_NOTCONNECTED
|
228 |
+
);
|
229 |
+
}
|
230 |
+
);
|
231 |
+
return;
|
232 |
+
} else if ( result.products && result.products.length > 0 ) {
|
233 |
+
setProducts( result.products );
|
234 |
+
if ( ! props.attributes.selectedPlanId ) {
|
235 |
+
selectPlan( result.products[ 0 ] );
|
236 |
+
}
|
237 |
+
}
|
238 |
+
setApiState( result.connected_account_id ? API_STATE_CONNECTED : API_STATE_NOTCONNECTED );
|
239 |
+
},
|
240 |
+
/**
|
241 |
+
* @param { Error } result
|
242 |
+
*/
|
243 |
+
( result ) => {
|
244 |
+
setConnectURL( null );
|
245 |
+
setApiState( API_STATE_NOTCONNECTED );
|
246 |
+
onError( props, result.message );
|
247 |
+
}
|
248 |
+
);
|
249 |
+
props.selectBlock();
|
250 |
+
}, [] );
|
251 |
+
|
252 |
+
if ( apiState === API_STATE_LOADING ) {
|
253 |
+
return (
|
254 |
+
<div className={ className } ref={ wrapperRef }>
|
255 |
+
{ props.noticeUI }
|
256 |
+
<Placeholder
|
257 |
+
icon="lock"
|
258 |
+
label={ __( 'Premium Content', 'premium-content' ) }
|
259 |
+
instructions={ __( 'Loading data...', 'premium-content' ) }
|
260 |
+
>
|
261 |
+
<Spinner />
|
262 |
+
</Placeholder>
|
263 |
+
</div>
|
264 |
+
);
|
265 |
+
}
|
266 |
+
|
267 |
+
if ( shouldUpgrade ) {
|
268 |
+
return (
|
269 |
+
<div className={ className } ref={ wrapperRef }>
|
270 |
+
{ props.noticeUI }
|
271 |
+
<Placeholder
|
272 |
+
icon="lock"
|
273 |
+
label={ __( 'Premium Content', 'premium-content' ) }
|
274 |
+
instructions={ __(
|
275 |
+
"You'll need to upgrade your plan to use the Premium Content block.",
|
276 |
+
'premium-content'
|
277 |
+
) }
|
278 |
+
>
|
279 |
+
<Button
|
280 |
+
/**
|
281 |
+
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42883
|
282 |
+
*/
|
283 |
+
// @ts-ignore isSecondary is missing from the type definition
|
284 |
+
isSecondary
|
285 |
+
isLarge
|
286 |
+
href={ upgradeURL }
|
287 |
+
target="_blank"
|
288 |
+
className="premium-content-block-nudge__button"
|
289 |
+
>
|
290 |
+
{ __( 'Upgrade Your Plan', 'premium-content' ) }
|
291 |
+
</Button>
|
292 |
+
<div className="membership-button__disclaimer">
|
293 |
+
<ExternalLink href="https://wordpress.com/support/premium-content-block/">
|
294 |
+
{ __( 'Read more about Premium Content and related fees.', 'premium-content' ) }
|
295 |
+
</ExternalLink>
|
296 |
+
</div>
|
297 |
+
</Placeholder>
|
298 |
+
</div>
|
299 |
+
);
|
300 |
+
}
|
301 |
+
|
302 |
+
let stripeNudge = null;
|
303 |
+
|
304 |
+
if ( ! shouldUpgrade && apiState !== API_STATE_CONNECTED && connectURL ) {
|
305 |
+
const stripeConnectUrl = getConnectUrl( props, connectURL );
|
306 |
+
|
307 |
+
stripeNudge = <StripeNudge { ...props } stripeConnectUrl={ stripeConnectUrl } />;
|
308 |
+
}
|
309 |
+
|
310 |
+
return (
|
311 |
+
<div className={ className } ref={ wrapperRef }>
|
312 |
+
{ props.noticeUI }
|
313 |
+
{ ( isSelected || selectedInnerBlock ) && (
|
314 |
+
<Controls
|
315 |
+
{ ...props }
|
316 |
+
plans={ products }
|
317 |
+
selectedPlanId={ props.attributes.selectedPlanId }
|
318 |
+
onSelected={ selectPlan }
|
319 |
+
/>
|
320 |
+
) }
|
321 |
+
{ ( isSelected || selectedInnerBlock ) && (
|
322 |
+
<Inspector { ...props } savePlan={ savePlan } siteSlug={ siteSlug } />
|
323 |
+
) }
|
324 |
+
{ ( isSelected || selectedInnerBlock ) && (
|
325 |
+
<Tabs { ...props } tabs={ tabs } selectedTab={ selectedTab } onSelected={ selectTab } />
|
326 |
+
) }
|
327 |
+
<Context.Provider
|
328 |
+
value={ {
|
329 |
+
selectedTab,
|
330 |
+
stripeNudge,
|
331 |
+
} }
|
332 |
+
>
|
333 |
+
<Blocks />
|
334 |
+
</Context.Provider>
|
335 |
+
</div>
|
336 |
+
);
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Hook that alerts clicks outside of the passed ref
|
341 |
+
*
|
342 |
+
* @param { ContainerRef } ref
|
343 |
+
* @param { (clickedInside: boolean) => void } callback
|
344 |
+
*/
|
345 |
+
function useOutsideAlerter( ref, callback ) {
|
346 |
+
/**
|
347 |
+
* Alert if clicked on outside of element
|
348 |
+
*
|
349 |
+
* @param {MouseEvent} event
|
350 |
+
*/
|
351 |
+
function handleClickOutside( event ) {
|
352 |
+
if (
|
353 |
+
ref.current &&
|
354 |
+
event.target &&
|
355 |
+
event.target instanceof Node &&
|
356 |
+
! ref.current.contains( event.target )
|
357 |
+
) {
|
358 |
+
callback( false );
|
359 |
+
} else {
|
360 |
+
callback( true );
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
useEffect( () => {
|
365 |
+
// Bind the event listener
|
366 |
+
document.addEventListener( 'mousedown', handleClickOutside );
|
367 |
+
return () => {
|
368 |
+
// Unbind the event listener on clean up
|
369 |
+
document.removeEventListener( 'mousedown', handleClickOutside );
|
370 |
+
};
|
371 |
+
} );
|
372 |
+
}
|
373 |
+
/**
|
374 |
+
* @param { Props } props
|
375 |
+
* @param { string } message
|
376 |
+
* @return { void }
|
377 |
+
*/
|
378 |
+
function onError( props, message ) {
|
379 |
+
const { noticeOperations } = props;
|
380 |
+
noticeOperations.removeAllNotices();
|
381 |
+
noticeOperations.createErrorNotice( message );
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* @param { Props } props
|
386 |
+
* @param { string } connectURL
|
387 |
+
* @return { null | string } URL
|
388 |
+
*/
|
389 |
+
function getConnectUrl( props, connectURL ) {
|
390 |
+
const { postId } = props;
|
391 |
+
|
392 |
+
if ( ! isURL( connectURL ) ) {
|
393 |
+
return null;
|
394 |
+
}
|
395 |
+
|
396 |
+
if ( ! postId ) {
|
397 |
+
return connectURL;
|
398 |
+
}
|
399 |
+
|
400 |
+
let decodedState;
|
401 |
+
try {
|
402 |
+
const state = getQueryArg( connectURL, 'state' );
|
403 |
+
if ( typeof state === 'string' ) {
|
404 |
+
decodedState = JSON.parse( atob( state ) );
|
405 |
+
}
|
406 |
+
} catch ( err ) {
|
407 |
+
if ( process.env.NODE_ENV !== 'production' ) {
|
408 |
+
console.error( err ); // eslint-disable-line no-console
|
409 |
+
}
|
410 |
+
return connectURL;
|
411 |
+
}
|
412 |
+
|
413 |
+
decodedState.from_editor_post_id = postId;
|
414 |
+
|
415 |
+
return addQueryArgs( connectURL, { state: btoa( JSON.stringify( decodedState ) ) } );
|
416 |
+
}
|
417 |
+
|
418 |
+
export default compose( [
|
419 |
+
withSelect( ( select, ownProps ) => {
|
420 |
+
const { getCurrentPostId } = select( 'core/editor' );
|
421 |
+
return {
|
422 |
+
postId: getCurrentPostId(),
|
423 |
+
// @ts-ignore difficult to type via JSDoc
|
424 |
+
containerClientId: select( 'core/block-editor' ).getBlockHierarchyRootClientId(
|
425 |
+
ownProps.clientId
|
426 |
+
),
|
427 |
+
};
|
428 |
+
} ),
|
429 |
+
withNotices,
|
430 |
+
withDispatch( ( dispatch, ownProps ) => {
|
431 |
+
const blockEditor = dispatch( 'core/block-editor' );
|
432 |
+
return {
|
433 |
+
selectBlock() {
|
434 |
+
// @ts-ignore difficult to type via JSDoc
|
435 |
+
blockEditor.selectBlock( ownProps.containerClientId );
|
436 |
+
},
|
437 |
+
};
|
438 |
+
} ),
|
439 |
+
] )( Edit );
|
premium-content/blocks/container/index.js
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import edit from './edit';
|
10 |
+
import save from './save';
|
11 |
+
|
12 |
+
const name = 'premium-content/container';
|
13 |
+
const category = 'common';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @typedef { Object } Attributes
|
17 |
+
* @property { string } newPlanName
|
18 |
+
* @property { string } newPlanCurrency
|
19 |
+
* @property { number } newPlanPrice
|
20 |
+
* @property { string } newPlanInterval
|
21 |
+
* @property { number } selectedPlanId
|
22 |
+
*
|
23 |
+
* @typedef {import('@wordpress/blocks').BlockConfiguration<Attributes>} BlockConfiguration
|
24 |
+
* @type {BlockConfiguration}
|
25 |
+
*/
|
26 |
+
const settings = {
|
27 |
+
name,
|
28 |
+
attributes: {
|
29 |
+
newPlanName: {
|
30 |
+
type: 'string',
|
31 |
+
default: 'Monthly Subscription',
|
32 |
+
},
|
33 |
+
newPlanCurrency: {
|
34 |
+
type: 'string',
|
35 |
+
default: 'USD',
|
36 |
+
},
|
37 |
+
newPlanPrice: {
|
38 |
+
type: 'number',
|
39 |
+
default: 5,
|
40 |
+
},
|
41 |
+
newPlanInterval: {
|
42 |
+
type: 'string',
|
43 |
+
default: '1 month',
|
44 |
+
},
|
45 |
+
selectedPlanId: {
|
46 |
+
type: 'number',
|
47 |
+
default: 0,
|
48 |
+
},
|
49 |
+
},
|
50 |
+
/**
|
51 |
+
* This is the display title for your block, which can be translated with `i18n` functions.
|
52 |
+
* The block inserter will show this name.
|
53 |
+
*/
|
54 |
+
title: __( 'Premium Content', 'premium-content' ),
|
55 |
+
|
56 |
+
/**
|
57 |
+
* This is a short description for your block, can be translated with `i18n` functions.
|
58 |
+
* It will be shown in the Block Tab in the Settings Sidebar.
|
59 |
+
*/
|
60 |
+
description: __( 'Restrict access to your content for paying subscribers.', 'premium-content' ),
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Blocks are grouped into categories to help users browse and discover them.
|
64 |
+
* The categories provided by core are `common`, `embed`, `formatting`, `layout` and `widgets`.
|
65 |
+
*/
|
66 |
+
category,
|
67 |
+
|
68 |
+
/**
|
69 |
+
* An icon property should be specified to make it easier to identify a block.
|
70 |
+
* These can be any of WordPress’ Dashicons, or a custom svg element.
|
71 |
+
*/
|
72 |
+
icon: 'lock',
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Optional block extended support features.
|
76 |
+
*/
|
77 |
+
supports: {
|
78 |
+
// Removes support for an HTML mode.
|
79 |
+
html: false,
|
80 |
+
},
|
81 |
+
keywords: [
|
82 |
+
'premium-content',
|
83 |
+
/* translators: block keyword */
|
84 |
+
__( 'premium', 'premium-content' ),
|
85 |
+
/* translators: block keyword */
|
86 |
+
__( 'paywall', 'premium-content' ),
|
87 |
+
],
|
88 |
+
edit,
|
89 |
+
save,
|
90 |
+
};
|
91 |
+
|
92 |
+
export { name, category, settings };
|
premium-content/blocks/container/inspector.js
ADDED
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import {
|
5 |
+
Button,
|
6 |
+
PanelBody,
|
7 |
+
PanelRow,
|
8 |
+
SelectControl,
|
9 |
+
TextControl,
|
10 |
+
ExternalLink,
|
11 |
+
Placeholder,
|
12 |
+
Spinner,
|
13 |
+
} from '@wordpress/components';
|
14 |
+
import { InspectorControls } from '@wordpress/block-editor';
|
15 |
+
import { __ } from '@wordpress/i18n';
|
16 |
+
import { useState } from '@wordpress/element';
|
17 |
+
|
18 |
+
const API_STATE_NOT_REQUESTING = 0;
|
19 |
+
const API_STATE_REQUESTING = 1;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @typedef { Object } PlanAttributes
|
23 |
+
* @property { string } newPlanCurrency
|
24 |
+
* @property { string } newPlanName
|
25 |
+
* @property { number } newPlanPrice
|
26 |
+
* @property { string } newPlanInterval
|
27 |
+
*
|
28 |
+
* @typedef { Object } Currency
|
29 |
+
* @property { string } label
|
30 |
+
* @property { string } symbol
|
31 |
+
*
|
32 |
+
* @typedef { Object } Props
|
33 |
+
* @property { PlanAttributes } attributes
|
34 |
+
* @property { (attributes: Partial<PlanAttributes>) => void } setAttributes
|
35 |
+
* @property { string } className
|
36 |
+
* @property { (attributes: PlanAttributes, onComplete:(isSuccesful: boolean)=>void) => void } savePlan
|
37 |
+
* @property { Currency[] } currencies
|
38 |
+
* @property { string } siteSlug
|
39 |
+
*
|
40 |
+
* @param { Props } props
|
41 |
+
*/
|
42 |
+
export default function Inspector( props ) {
|
43 |
+
const [ apiState, setApiState ] = useState( API_STATE_NOT_REQUESTING );
|
44 |
+
const { attributes, setAttributes, className, savePlan, currencies, siteSlug } = props;
|
45 |
+
|
46 |
+
return (
|
47 |
+
<InspectorControls>
|
48 |
+
{ siteSlug && (
|
49 |
+
<ExternalLink
|
50 |
+
href={ `https://wordpress.com/earn/payments/${ siteSlug }` }
|
51 |
+
className={ 'wp-block-premium-content-container---link-to-earn' }
|
52 |
+
>
|
53 |
+
{ __( 'Manage your subscriptions.', 'premium-content' ) }
|
54 |
+
</ExternalLink>
|
55 |
+
) }
|
56 |
+
<PanelBody
|
57 |
+
title="Add a new subscription"
|
58 |
+
initialOpen={ true }
|
59 |
+
className={ `${ className }---settings-add_plan` }
|
60 |
+
>
|
61 |
+
{ apiState === API_STATE_REQUESTING && (
|
62 |
+
<Placeholder
|
63 |
+
icon="lock"
|
64 |
+
label={ __( 'Premium Content', 'premium-content' ) }
|
65 |
+
instructions={ __( 'Saving plan...', 'premium-content' ) }
|
66 |
+
>
|
67 |
+
<Spinner />
|
68 |
+
</Placeholder>
|
69 |
+
) }
|
70 |
+
{ apiState === API_STATE_NOT_REQUESTING && (
|
71 |
+
<div>
|
72 |
+
<PanelRow className="plan-name">
|
73 |
+
<TextControl
|
74 |
+
id="new-plan-name"
|
75 |
+
label="Name"
|
76 |
+
value={ attributes.newPlanName }
|
77 |
+
onChange={ ( set ) => setAttributes( { newPlanName: set } ) }
|
78 |
+
/>
|
79 |
+
</PanelRow>
|
80 |
+
<PanelRow className="plan-price">
|
81 |
+
<SelectControl
|
82 |
+
label="Currency"
|
83 |
+
onChange={ ( set ) => setAttributes( { newPlanCurrency: set } ) }
|
84 |
+
value={ attributes.newPlanCurrency }
|
85 |
+
options={ currencies.map( ( currency ) => ( {
|
86 |
+
label: currency.label,
|
87 |
+
value: currency.label,
|
88 |
+
} ) ) }
|
89 |
+
></SelectControl>
|
90 |
+
<TextControl
|
91 |
+
label="Price"
|
92 |
+
value={ attributes.newPlanPrice }
|
93 |
+
onChange={ ( set ) => setAttributes( { newPlanPrice: parseFloat( set ) } ) }
|
94 |
+
type="number"
|
95 |
+
></TextControl>
|
96 |
+
</PanelRow>
|
97 |
+
<PanelRow className="plan-interval">
|
98 |
+
<SelectControl
|
99 |
+
label="Interval"
|
100 |
+
onChange={ ( set ) => setAttributes( { newPlanInterval: set } ) }
|
101 |
+
value={ attributes.newPlanInterval }
|
102 |
+
options={ [
|
103 |
+
{ label: 'Month', value: '1 month' },
|
104 |
+
{ label: 'Year', value: '1 year' },
|
105 |
+
] }
|
106 |
+
></SelectControl>
|
107 |
+
</PanelRow>
|
108 |
+
<PanelRow>
|
109 |
+
<Button
|
110 |
+
// @ts-ignore isSecondary is missing from the type definition
|
111 |
+
isSecondary={ true }
|
112 |
+
isLarge={ true }
|
113 |
+
onClick={
|
114 |
+
/**
|
115 |
+
* @param { import('react').MouseEvent<HTMLElement> } e
|
116 |
+
*/
|
117 |
+
( e ) => {
|
118 |
+
e.preventDefault();
|
119 |
+
setApiState( API_STATE_REQUESTING );
|
120 |
+
savePlan( props.attributes, ( success ) => {
|
121 |
+
setApiState( API_STATE_NOT_REQUESTING );
|
122 |
+
if ( success ) {
|
123 |
+
setAttributes( { newPlanPrice: 5 } );
|
124 |
+
setAttributes( { newPlanName: '' } );
|
125 |
+
}
|
126 |
+
} );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
>
|
130 |
+
{ __( 'Add subscription', 'premium-content' ) }
|
131 |
+
</Button>
|
132 |
+
</PanelRow>
|
133 |
+
</div>
|
134 |
+
) }
|
135 |
+
</PanelBody>
|
136 |
+
</InspectorControls>
|
137 |
+
);
|
138 |
+
}
|
139 |
+
|
140 |
+
Inspector.defaultProps = {
|
141 |
+
currencies: [
|
142 |
+
{
|
143 |
+
label: 'USD',
|
144 |
+
symbol: '$',
|
145 |
+
},
|
146 |
+
{
|
147 |
+
label: 'GBP',
|
148 |
+
symbol: '£',
|
149 |
+
},
|
150 |
+
{
|
151 |
+
label: 'JPY',
|
152 |
+
symbol: '¥',
|
153 |
+
},
|
154 |
+
{
|
155 |
+
label: 'BRL',
|
156 |
+
symbol: 'R$',
|
157 |
+
},
|
158 |
+
{
|
159 |
+
label: 'EUR',
|
160 |
+
symbol: '€',
|
161 |
+
},
|
162 |
+
{
|
163 |
+
label: 'NZD',
|
164 |
+
symbol: 'NZ$',
|
165 |
+
},
|
166 |
+
{
|
167 |
+
label: 'AUD',
|
168 |
+
symbol: 'A$',
|
169 |
+
},
|
170 |
+
{
|
171 |
+
label: 'CAD',
|
172 |
+
symbol: 'C$',
|
173 |
+
},
|
174 |
+
{
|
175 |
+
label: 'INR',
|
176 |
+
symbol: '\u20b9',
|
177 |
+
},
|
178 |
+
{
|
179 |
+
label: 'ILS',
|
180 |
+
symbol: '\u20aa',
|
181 |
+
},
|
182 |
+
{
|
183 |
+
label: 'RUB',
|
184 |
+
symbol: '\u20bd',
|
185 |
+
},
|
186 |
+
{
|
187 |
+
label: 'MXN',
|
188 |
+
symbol: 'MX$',
|
189 |
+
},
|
190 |
+
{
|
191 |
+
label: 'SEK',
|
192 |
+
symbol: 'SEK',
|
193 |
+
},
|
194 |
+
{
|
195 |
+
label: 'HUF',
|
196 |
+
symbol: 'Ft',
|
197 |
+
},
|
198 |
+
{
|
199 |
+
label: 'CHF',
|
200 |
+
symbol: 'CHF',
|
201 |
+
},
|
202 |
+
{
|
203 |
+
label: 'CZK',
|
204 |
+
symbol: 'K\u010d',
|
205 |
+
},
|
206 |
+
{
|
207 |
+
label: 'DKK',
|
208 |
+
symbol: 'Dkr',
|
209 |
+
},
|
210 |
+
{
|
211 |
+
label: 'HKD',
|
212 |
+
symbol: 'HK$',
|
213 |
+
},
|
214 |
+
{
|
215 |
+
label: 'NOK',
|
216 |
+
symbol: 'Kr',
|
217 |
+
},
|
218 |
+
{
|
219 |
+
label: 'PHP',
|
220 |
+
symbol: '\u20b1',
|
221 |
+
},
|
222 |
+
{
|
223 |
+
label: 'PLN',
|
224 |
+
symbol: 'PLN',
|
225 |
+
},
|
226 |
+
{
|
227 |
+
label: 'SGD',
|
228 |
+
symbol: 'S$',
|
229 |
+
},
|
230 |
+
{
|
231 |
+
label: 'TWD',
|
232 |
+
symbol: 'NT$',
|
233 |
+
},
|
234 |
+
{
|
235 |
+
label: 'THB',
|
236 |
+
symbol: '\u0e3f',
|
237 |
+
},
|
238 |
+
{
|
239 |
+
label: 'TRY',
|
240 |
+
symbol: 'TL',
|
241 |
+
},
|
242 |
+
],
|
243 |
+
};
|
premium-content/blocks/container/new-plan.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { dispatch, select } from '@wordpress/data';
|
5 |
+
import { MenuGroup, MenuItem } from '@wordpress/components';
|
6 |
+
import { __ } from '@wordpress/i18n';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @typedef {{ onClose: () => void}} Props
|
10 |
+
* @param {Props} props
|
11 |
+
*/
|
12 |
+
export default function NewPlan( props ) {
|
13 |
+
return (
|
14 |
+
<MenuGroup>
|
15 |
+
<MenuItem
|
16 |
+
onClick={ ( e ) => {
|
17 |
+
e.preventDefault();
|
18 |
+
//Open the sidebar if not open
|
19 |
+
if ( ! select( 'core/edit-post' ).isEditorSidebarOpened() ) {
|
20 |
+
dispatch( 'core/edit-post' ).openGeneralSidebar( 'edit-post/block' );
|
21 |
+
}
|
22 |
+
const input = document.getElementById( 'new-plan-name' );
|
23 |
+
if ( input !== null ) {
|
24 |
+
//Focus on the new plan name input
|
25 |
+
input.focus();
|
26 |
+
}
|
27 |
+
props.onClose();
|
28 |
+
} }
|
29 |
+
>
|
30 |
+
{ __( 'Add a new subscription', 'premium-content' ) }
|
31 |
+
</MenuItem>
|
32 |
+
</MenuGroup>
|
33 |
+
);
|
34 |
+
}
|
premium-content/blocks/container/plan.js
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { MenuItem } from '@wordpress/components';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* @typedef { Object } Plan
|
8 |
+
* @property { number } id
|
9 |
+
* @property { string } title
|
10 |
+
* @property { string } price
|
11 |
+
* @property { string } currency
|
12 |
+
* @property { string } interval
|
13 |
+
*
|
14 |
+
* @typedef { Object } Props
|
15 |
+
* @property { Plan } plan
|
16 |
+
* @property { string } className
|
17 |
+
* @property { undefined | Plan } selectedPlan
|
18 |
+
* @property { () => void } onClose
|
19 |
+
* @property { (plan: Plan) => void } onSelected
|
20 |
+
*
|
21 |
+
* @param { Props } props
|
22 |
+
*/
|
23 |
+
export default function Plan( props ) {
|
24 |
+
const { className, plan, selectedPlan, onSelected, onClose } = props;
|
25 |
+
|
26 |
+
const isSelected = selectedPlan && plan.id === selectedPlan.id;
|
27 |
+
const classNames = ( isSelected ? [ 'is-selected' ] : [] ).concat( [ className ] ).join( ' ' );
|
28 |
+
const icon = isSelected ? 'yes' : undefined;
|
29 |
+
|
30 |
+
return (
|
31 |
+
<MenuItem
|
32 |
+
onClick={ ( e ) => {
|
33 |
+
e.preventDefault();
|
34 |
+
onSelected( plan );
|
35 |
+
onClose();
|
36 |
+
} }
|
37 |
+
className={ classNames }
|
38 |
+
key={ plan.id }
|
39 |
+
value={ plan.id }
|
40 |
+
selected={ isSelected }
|
41 |
+
icon={ icon }
|
42 |
+
>
|
43 |
+
{ plan.title } : { plan.price } { plan.currency } / { plan.interval }
|
44 |
+
</MenuItem>
|
45 |
+
);
|
46 |
+
}
|
premium-content/blocks/container/plans.js
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { MenuGroup } from '@wordpress/components';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import Plan from './plan';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @typedef { import('./plan').Plan } Plan
|
13 |
+
*
|
14 |
+
* @typedef { Object } Props
|
15 |
+
* @property { Plan[] } plans
|
16 |
+
* @property { undefined | Plan } selectedPlan
|
17 |
+
* @property { (plan: Plan) => void } onSelected
|
18 |
+
* @property { () => void } onClose
|
19 |
+
* @property { string } className
|
20 |
+
*
|
21 |
+
* @param {Props} props
|
22 |
+
*/
|
23 |
+
export default function Plans( props ) {
|
24 |
+
const { plans, selectedPlan, onSelected } = props;
|
25 |
+
|
26 |
+
return (
|
27 |
+
<MenuGroup>
|
28 |
+
{ plans.map( ( plan ) => (
|
29 |
+
<Plan
|
30 |
+
{ ...props }
|
31 |
+
key={ plan.id }
|
32 |
+
selectedPlan={ selectedPlan }
|
33 |
+
onSelected={ onSelected }
|
34 |
+
plan={ plan }
|
35 |
+
/>
|
36 |
+
) ) }
|
37 |
+
</MenuGroup>
|
38 |
+
);
|
39 |
+
}
|
premium-content/blocks/container/save.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { InnerBlocks } from '@wordpress/block-editor';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Block Save function
|
8 |
+
*/
|
9 |
+
export default function Save() {
|
10 |
+
return (
|
11 |
+
<div className="wp-block-premium-content-container">
|
12 |
+
<InnerBlocks.Content />
|
13 |
+
</div>
|
14 |
+
);
|
15 |
+
}
|
premium-content/blocks/container/stripe-nudge.js
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { Button, Dashicon } from '@wordpress/components';
|
5 |
+
import { Warning } from '@wordpress/block-editor';
|
6 |
+
import { compose } from '@wordpress/compose';
|
7 |
+
import { __ } from '@wordpress/i18n';
|
8 |
+
import { withDispatch } from '@wordpress/data';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @typedef { import('react').MouseEvent<HTMLElement> } MouseEvent
|
12 |
+
*
|
13 |
+
* @typedef { Object } Props
|
14 |
+
* @property { (event: MouseEvent) => void } autosaveAndRedirect
|
15 |
+
* @property { string } stripeConnectUrl
|
16 |
+
* @property { () => void } onClick
|
17 |
+
* @param { Props } props
|
18 |
+
*/
|
19 |
+
export const StripeNudge = ( { autosaveAndRedirect, stripeConnectUrl } ) => (
|
20 |
+
<Warning
|
21 |
+
actions={
|
22 |
+
// Use href to determine whether or not to display the Upgrade button.
|
23 |
+
stripeConnectUrl && [
|
24 |
+
<Button
|
25 |
+
key="connect"
|
26 |
+
href={ stripeConnectUrl } // Only for server-side rendering, since onClick doesn't work there.
|
27 |
+
onClick={ autosaveAndRedirect }
|
28 |
+
target="_top"
|
29 |
+
isDefault
|
30 |
+
className="premium-content-block-nudge__button"
|
31 |
+
>
|
32 |
+
{ __( 'Connect', 'premium-content' ) }
|
33 |
+
</Button>,
|
34 |
+
]
|
35 |
+
}
|
36 |
+
className="premium-content-block-nudge"
|
37 |
+
>
|
38 |
+
<span className="premium-content-block-nudge__info">
|
39 |
+
{ <Dashicon icon="star-filled" /> }
|
40 |
+
<span className="premium-content-block-nudge__text-container">
|
41 |
+
<span className="premium-content-block-nudge__title">
|
42 |
+
{ __( 'Connect to Stripe to use this block on your site', 'premium-content' ) }
|
43 |
+
</span>
|
44 |
+
<span className="premium-content-block-nudge__message">
|
45 |
+
{ __(
|
46 |
+
'This block will be hidden from your visitors until you connect to Stripe.',
|
47 |
+
'premium-content'
|
48 |
+
) }
|
49 |
+
</span>
|
50 |
+
</span>
|
51 |
+
</span>
|
52 |
+
</Warning>
|
53 |
+
);
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Exports a component with the same props as StripeNudge but omits autosaveAndRedirect
|
57 |
+
* due to it being provided here.
|
58 |
+
*
|
59 |
+
* @type { import('react').ComponentType<Omit<Props, 'autosaveAndRedirect'>> }
|
60 |
+
*/
|
61 |
+
export default compose( [
|
62 |
+
withDispatch(
|
63 |
+
/**
|
64 |
+
* Complicated to define the valid type with JSDoc
|
65 |
+
*/
|
66 |
+
// @ts-ignore
|
67 |
+
( dispatch, { stripeConnectUrl } ) => ( {
|
68 |
+
/**
|
69 |
+
* @param { MouseEvent } event
|
70 |
+
* @return { Promise<void> } When completed
|
71 |
+
*/
|
72 |
+
autosaveAndRedirect: async ( event ) => {
|
73 |
+
event.preventDefault(); // Don't follow the href before autosaving
|
74 |
+
await dispatch( 'core/editor' ).savePost();
|
75 |
+
// Using window.top to escape from the editor iframe on WordPress.com
|
76 |
+
window.top.location.href = stripeConnectUrl;
|
77 |
+
},
|
78 |
+
} )
|
79 |
+
),
|
80 |
+
] )( StripeNudge );
|
premium-content/blocks/container/tab.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
*
|
3 |
+
* @typedef { import('react').ReactNode } ReactNode
|
4 |
+
*
|
5 |
+
* @typedef { Object } Tab
|
6 |
+
* @property { string } id
|
7 |
+
* @property { (ReactNode | string) } label
|
8 |
+
* @property { string } className
|
9 |
+
*
|
10 |
+
* @typedef { Object } Props
|
11 |
+
* @property { Tab } tab
|
12 |
+
* @property { Tab } selectedTab
|
13 |
+
* @property { string } className
|
14 |
+
* @property { ReactNode } label
|
15 |
+
* @property { (tab: Tab) => void } onSelected
|
16 |
+
*
|
17 |
+
* @param { Props } props
|
18 |
+
*/
|
19 |
+
export default function Tab( props ) {
|
20 |
+
const { className, tab, label, selectedTab, onSelected } = props;
|
21 |
+
|
22 |
+
const classNames = ( tab.id === selectedTab.id ? [ 'is-pressed', 'is-active' ] : [] ).concat( [
|
23 |
+
className,
|
24 |
+
'components-button',
|
25 |
+
'components-tab-button',
|
26 |
+
] );
|
27 |
+
|
28 |
+
return (
|
29 |
+
<button type="button" onClick={ () => onSelected( tab ) } className={ classNames.join( ' ' ) }>
|
30 |
+
{ label }
|
31 |
+
</button>
|
32 |
+
);
|
33 |
+
}
|
premium-content/blocks/container/tabs.js
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import Tab from './tab';
|
5 |
+
import { __ } from '@wordpress/i18n';
|
6 |
+
import { dispatch, select } from '@wordpress/data';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @typedef { import('./tab').Tab } Tab
|
10 |
+
* @typedef { Object } Props
|
11 |
+
* @property { string } className
|
12 |
+
* @property { Tab } selectedTab
|
13 |
+
* @property { Tab[] } tabs
|
14 |
+
* @property { (tab: Tab) => void } onSelected
|
15 |
+
* @property { () => void } selectBlock
|
16 |
+
*
|
17 |
+
* @param { Props } props
|
18 |
+
*/
|
19 |
+
export default function Tabs( props ) {
|
20 |
+
const { className, tabs, selectedTab, onSelected, selectBlock } = props;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* If the sidebar is closed, open it and select the premium-content block.
|
24 |
+
*/
|
25 |
+
const focusBlock = () => {
|
26 |
+
if ( ! select( 'core/edit-post' ).isEditorSidebarOpened() ) {
|
27 |
+
dispatch( 'core/edit-post' ).openGeneralSidebar( 'edit-post/block' );
|
28 |
+
}
|
29 |
+
selectBlock();
|
30 |
+
};
|
31 |
+
|
32 |
+
return (
|
33 |
+
<div className="premium-content-tabs block-editor-block-toolbar">
|
34 |
+
{ tabs.map( ( tab ) => (
|
35 |
+
<Tab
|
36 |
+
key={ tab.id }
|
37 |
+
{ ...props }
|
38 |
+
tab={ tab }
|
39 |
+
selectedTab={ selectedTab }
|
40 |
+
className={ `${ className }--tab` }
|
41 |
+
label={ tab.label }
|
42 |
+
onSelected={ onSelected }
|
43 |
+
/>
|
44 |
+
) ) }
|
45 |
+
<button onClick={ focusBlock } className="edit components-button is-button is-secondary">
|
46 |
+
{ __( 'Edit', 'premium-content' ) }
|
47 |
+
</button>
|
48 |
+
</div>
|
49 |
+
);
|
50 |
+
}
|
premium-content/blocks/logged-out-view/edit.js
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { InnerBlocks } from '@wordpress/block-editor';
|
5 |
+
import { __ } from '@wordpress/i18n';
|
6 |
+
import { useEffect } from '@wordpress/element';
|
7 |
+
import { compose } from '@wordpress/compose';
|
8 |
+
import { withDispatch, withSelect } from '@wordpress/data';
|
9 |
+
import { pick } from 'lodash';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Internal dependencies
|
13 |
+
*/
|
14 |
+
import Context from '../container/context';
|
15 |
+
import SubmitButtons from './submit-buttons';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Block edit function
|
19 |
+
*
|
20 |
+
* @typedef { import('./').Attributes } Attributes
|
21 |
+
* @typedef { Object } Props
|
22 |
+
* @property { boolean } isSelected
|
23 |
+
* @property { string } className
|
24 |
+
* @property { string } clientId
|
25 |
+
* @property { string } containerClientId
|
26 |
+
* @property { Attributes } attributes
|
27 |
+
* @property { (attributes: Partial<Attributes>) => void } setAttributes
|
28 |
+
* @property { () => void } selectBlock
|
29 |
+
*
|
30 |
+
* @param { Props } props
|
31 |
+
*/
|
32 |
+
function Edit( props ) {
|
33 |
+
useEffect( () => {
|
34 |
+
props.selectBlock();
|
35 |
+
}, [] );
|
36 |
+
|
37 |
+
const buttons = (
|
38 |
+
<SubmitButtons
|
39 |
+
{ ...{
|
40 |
+
attributes: pick( props.attributes, [
|
41 |
+
'subscribeButtonText',
|
42 |
+
'loginButtonText',
|
43 |
+
'backgroundButtonColor',
|
44 |
+
'textButtonColor',
|
45 |
+
'customBackgroundButtonColor',
|
46 |
+
'customTextButtonColor',
|
47 |
+
] ),
|
48 |
+
setAttributes: props.setAttributes,
|
49 |
+
} }
|
50 |
+
/>
|
51 |
+
);
|
52 |
+
|
53 |
+
return (
|
54 |
+
<Context.Consumer>
|
55 |
+
{ ( { selectedTab, stripeNudge } ) => (
|
56 |
+
/** @see https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md#case-the-event-handler-is-only-being-used-to-capture-bubbled-events */
|
57 |
+
// eslint-disable-next-line
|
58 |
+
<div hidden={ selectedTab.id === 'premium' } className={ selectedTab.className }>
|
59 |
+
{ stripeNudge }
|
60 |
+
<InnerBlocks
|
61 |
+
templateLock={ false }
|
62 |
+
template={ [
|
63 |
+
[
|
64 |
+
'core/heading',
|
65 |
+
{ content: __( 'Subscribe to get access', 'premium-content' ), level: 3 },
|
66 |
+
],
|
67 |
+
[
|
68 |
+
'core/paragraph',
|
69 |
+
{
|
70 |
+
content: __(
|
71 |
+
'Read more of this content when you subscribe today.',
|
72 |
+
'premium-content'
|
73 |
+
),
|
74 |
+
},
|
75 |
+
],
|
76 |
+
] }
|
77 |
+
/>
|
78 |
+
{ buttons }
|
79 |
+
</div>
|
80 |
+
) }
|
81 |
+
</Context.Consumer>
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
+
export default compose( [
|
86 |
+
withSelect( ( select, props ) => {
|
87 |
+
return {
|
88 |
+
// @ts-ignore difficult to type with JSDoc
|
89 |
+
containerClientId: select( 'core/block-editor' ).getBlockHierarchyRootClientId(
|
90 |
+
props.clientId
|
91 |
+
),
|
92 |
+
};
|
93 |
+
} ),
|
94 |
+
withDispatch( ( dispatch, props ) => {
|
95 |
+
const blockEditor = dispatch( 'core/block-editor' );
|
96 |
+
return {
|
97 |
+
selectBlock() {
|
98 |
+
// @ts-ignore difficult to type with JSDoc
|
99 |
+
blockEditor.selectBlock( props.containerClientId );
|
100 |
+
},
|
101 |
+
};
|
102 |
+
} ),
|
103 |
+
] )( Edit );
|
premium-content/blocks/logged-out-view/index.js
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import edit from './edit';
|
5 |
+
import save from './save';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* WordPress dependencies
|
9 |
+
*/
|
10 |
+
import { compose, ifCondition } from '@wordpress/compose';
|
11 |
+
import { withSelect, select, subscribe } from '@wordpress/data';
|
12 |
+
import { __ } from '@wordpress/i18n';
|
13 |
+
import { registerFormatType, unregisterFormatType } from '@wordpress/rich-text';
|
14 |
+
|
15 |
+
const name = 'premium-content/logged-out-view';
|
16 |
+
const category = 'common';
|
17 |
+
/**
|
18 |
+
* @typedef {Object} Attributes
|
19 |
+
* @property {string} subscribeButtonText
|
20 |
+
* @property {string} loginButtonText
|
21 |
+
* @property {string} buttonClasses
|
22 |
+
* @property {string} backgroundButtonColor
|
23 |
+
* @property {string} textButtonColor
|
24 |
+
* @property {string} customBackgroundButtonColor
|
25 |
+
* @property {string} customTextButtonColor
|
26 |
+
*
|
27 |
+
* @typedef {import('@wordpress/blocks').BlockConfiguration<Attributes>} BlockConfiguration
|
28 |
+
* @type {BlockConfiguration}
|
29 |
+
*/
|
30 |
+
const settings = {
|
31 |
+
name,
|
32 |
+
category,
|
33 |
+
attributes: {
|
34 |
+
subscribeButtonText: {
|
35 |
+
type: 'string',
|
36 |
+
default: 'Subscribe',
|
37 |
+
},
|
38 |
+
loginButtonText: {
|
39 |
+
type: 'string',
|
40 |
+
default: 'Log In',
|
41 |
+
},
|
42 |
+
buttonClasses: {
|
43 |
+
type: 'string',
|
44 |
+
default: '',
|
45 |
+
},
|
46 |
+
backgroundButtonColor: {
|
47 |
+
type: 'string',
|
48 |
+
default: '',
|
49 |
+
},
|
50 |
+
textButtonColor: {
|
51 |
+
type: 'string',
|
52 |
+
default: '',
|
53 |
+
},
|
54 |
+
customBackgroundButtonColor: {
|
55 |
+
type: 'string',
|
56 |
+
default: '',
|
57 |
+
},
|
58 |
+
customTextButtonColor: {
|
59 |
+
type: 'string',
|
60 |
+
default: '',
|
61 |
+
},
|
62 |
+
},
|
63 |
+
|
64 |
+
/* translators: block name */
|
65 |
+
title: __( 'Logged Out View', 'premium-content' ),
|
66 |
+
/* translators: block description */
|
67 |
+
description: __( 'Logged Out View.', 'premium-content' ),
|
68 |
+
parent: [ 'premium-content/container' ],
|
69 |
+
supports: {
|
70 |
+
// Hide this block from the inserter.
|
71 |
+
inserter: false,
|
72 |
+
},
|
73 |
+
edit,
|
74 |
+
save,
|
75 |
+
};
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Modify the rich text link button to not be enabled on the logged-in view (This is visible when the block is selected
|
79 |
+
* (including when the buttons are selected).
|
80 |
+
*
|
81 |
+
* This gets wrapped in `subscribe` to return an unsubscribe function which we can call to unregister the function after
|
82 |
+
* the rich text data is defined.
|
83 |
+
*/
|
84 |
+
// @ts-ignore
|
85 |
+
const unsubscribe = subscribe( () => {
|
86 |
+
// Keep running until the 'core/link' format is defined
|
87 |
+
const linkFormat = select( 'core/rich-text' ).getFormatType( 'core/link' );
|
88 |
+
if ( ! linkFormat ) {
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
// It's defined so we can stop after this iteration...
|
92 |
+
// @ts-ignore
|
93 |
+
unsubscribe();
|
94 |
+
|
95 |
+
unregisterFormatType( 'core/link' );
|
96 |
+
|
97 |
+
// Use the existing link button functionality but limit it so that it doesn't run inside this view.
|
98 |
+
const newLinkButton = compose(
|
99 |
+
withSelect( ( composeSelect ) => {
|
100 |
+
return {
|
101 |
+
selectedBlock: composeSelect( 'core/block-editor' ).getSelectedBlock(),
|
102 |
+
};
|
103 |
+
} ),
|
104 |
+
// @ts-ignore
|
105 |
+
ifCondition( ( props ) => {
|
106 |
+
// @ts-ignore
|
107 |
+
return props.selectedBlock && props.selectedBlock.name !== name;
|
108 |
+
} )
|
109 |
+
// @ts-ignore
|
110 |
+
)( linkFormat.edit );
|
111 |
+
|
112 |
+
// Overwrite the previous 'core/link' so others can extend
|
113 |
+
registerFormatType( 'core/link', {
|
114 |
+
...linkFormat,
|
115 |
+
// @ts-ignore
|
116 |
+
edit: newLinkButton,
|
117 |
+
} );
|
118 |
+
} );
|
119 |
+
|
120 |
+
export { name, category, settings };
|
premium-content/blocks/logged-out-view/save.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { InnerBlocks } from '@wordpress/block-editor';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Block Save function
|
8 |
+
*/
|
9 |
+
export default function Save() {
|
10 |
+
return (
|
11 |
+
<div className="wp-block-premium-content-logged-out-view">
|
12 |
+
<InnerBlocks.Content />
|
13 |
+
</div>
|
14 |
+
);
|
15 |
+
}
|
premium-content/blocks/logged-out-view/submit-buttons.js
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import classnames from 'classnames';
|
6 |
+
import { useEffect } from '@wordpress/element';
|
7 |
+
import { compose } from '@wordpress/compose';
|
8 |
+
import { withFallbackStyles } from '@wordpress/components';
|
9 |
+
import {
|
10 |
+
InspectorControls,
|
11 |
+
PanelColorSettings,
|
12 |
+
ContrastChecker,
|
13 |
+
RichText,
|
14 |
+
withColors,
|
15 |
+
} from '@wordpress/block-editor';
|
16 |
+
import { get } from 'lodash';
|
17 |
+
|
18 |
+
const { getComputedStyle } = window;
|
19 |
+
|
20 |
+
const applyFallbackStyles = withFallbackStyles( ( node, ownProps ) => {
|
21 |
+
const { textButtonColor, backgroundButtonColor } = ownProps;
|
22 |
+
const backgroundColorValue = backgroundButtonColor && backgroundButtonColor.color;
|
23 |
+
const textColorValue = textButtonColor && textButtonColor.color;
|
24 |
+
//avoid the use of querySelector if textColor color is known and verify if node is available.
|
25 |
+
|
26 |
+
let textNode;
|
27 |
+
let button;
|
28 |
+
|
29 |
+
if ( ! textColorValue && node ) {
|
30 |
+
textNode = node.querySelector( '[contenteditable="true"]' );
|
31 |
+
}
|
32 |
+
|
33 |
+
if ( node.querySelector( '.wp-block-button__link' ) ) {
|
34 |
+
button = node.querySelector( '.wp-block-button__link' );
|
35 |
+
} else {
|
36 |
+
button = node;
|
37 |
+
}
|
38 |
+
|
39 |
+
let fallbackBackgroundColor;
|
40 |
+
let fallbackTextColor;
|
41 |
+
|
42 |
+
if ( node && button ) {
|
43 |
+
fallbackBackgroundColor = getComputedStyle( button ).backgroundColor;
|
44 |
+
}
|
45 |
+
|
46 |
+
if ( textNode ) {
|
47 |
+
fallbackTextColor = getComputedStyle( textNode ).color;
|
48 |
+
}
|
49 |
+
|
50 |
+
return {
|
51 |
+
fallbackBackgroundColor: backgroundColorValue || fallbackBackgroundColor,
|
52 |
+
fallbackTextColor: textColorValue || fallbackTextColor,
|
53 |
+
};
|
54 |
+
} );
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Block edit function
|
58 |
+
*
|
59 |
+
* @typedef { import('@wordpress/block-editor').ColorPalette.Color } Color
|
60 |
+
* @property { string } class
|
61 |
+
* @property { string } color
|
62 |
+
* @property { string } name
|
63 |
+
* @property { string } slug
|
64 |
+
*
|
65 |
+
* @typedef { import('./').Attributes } Attributes
|
66 |
+
* @typedef { Object } Props
|
67 |
+
* @property { Color } backgroundButtonColor
|
68 |
+
* @property { Color } textButtonColor
|
69 |
+
* @property { string } fallbackBackgroundColor
|
70 |
+
* @property { string } fallbackTextColor
|
71 |
+
* @property { Attributes } attributes
|
72 |
+
* @property { () => void } setBackgroundButtonColor
|
73 |
+
* @property { () => void } setTextButtonColor
|
74 |
+
* @property { (attributes: Partial<Attributes>) => void } setAttributes
|
75 |
+
*
|
76 |
+
* @param { Props } props
|
77 |
+
*/
|
78 |
+
function SubmitButtons( props ) {
|
79 |
+
useEffect( () => {
|
80 |
+
setButtonClasses();
|
81 |
+
setCustomButtonColors();
|
82 |
+
}, [ props.backgroundButtonColor, props.textButtonColor ] );
|
83 |
+
|
84 |
+
function setButtonClasses() {
|
85 |
+
const buttonClasses = getButtonClasses();
|
86 |
+
props.setAttributes( { buttonClasses } );
|
87 |
+
}
|
88 |
+
|
89 |
+
function setCustomButtonColors() {
|
90 |
+
const customTextButtonColor = getTextButtonColor();
|
91 |
+
const customBackgroundButtonColor = getBackgroundButtonColor();
|
92 |
+
|
93 |
+
if ( customTextButtonColor !== undefined ) {
|
94 |
+
props.setAttributes( { customTextButtonColor } );
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( customBackgroundButtonColor !== undefined ) {
|
98 |
+
props.setAttributes( { customBackgroundButtonColor } );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
function getTextButtonColor() {
|
103 |
+
return get( props.textButtonColor, 'color' );
|
104 |
+
}
|
105 |
+
|
106 |
+
function getBackgroundButtonColor() {
|
107 |
+
return get( props.backgroundButtonColor, 'color' );
|
108 |
+
}
|
109 |
+
|
110 |
+
function getButtonClasses() {
|
111 |
+
const { textButtonColor, backgroundButtonColor } = props;
|
112 |
+
const textClass = get( textButtonColor, 'class' );
|
113 |
+
const backgroundClass = get( backgroundButtonColor, 'class' );
|
114 |
+
return classnames( 'wp-block-button__link', {
|
115 |
+
'has-text-color': textButtonColor.color,
|
116 |
+
[ textClass ]: textClass,
|
117 |
+
'has-background': backgroundButtonColor.color,
|
118 |
+
[ backgroundClass ]: backgroundClass,
|
119 |
+
} );
|
120 |
+
}
|
121 |
+
|
122 |
+
const {
|
123 |
+
attributes,
|
124 |
+
setAttributes,
|
125 |
+
backgroundButtonColor,
|
126 |
+
textButtonColor,
|
127 |
+
setBackgroundButtonColor,
|
128 |
+
setTextButtonColor,
|
129 |
+
fallbackBackgroundColor,
|
130 |
+
fallbackTextColor,
|
131 |
+
} = props;
|
132 |
+
|
133 |
+
const backgroundColor = backgroundButtonColor.color || fallbackBackgroundColor;
|
134 |
+
const color = textButtonColor.color || fallbackTextColor;
|
135 |
+
const buttonStyle = { border: 'none', backgroundColor, color };
|
136 |
+
const buttonClasses = getButtonClasses();
|
137 |
+
|
138 |
+
return (
|
139 |
+
<div>
|
140 |
+
<div className="wp-block-button premium-content-logged-out-view-button">
|
141 |
+
<RichText
|
142 |
+
placeholder={ __( 'Add text…', 'premium-content' ) }
|
143 |
+
value={ attributes.subscribeButtonText }
|
144 |
+
onChange={ ( nextValue ) => setAttributes( { subscribeButtonText: nextValue } ) }
|
145 |
+
className={ buttonClasses }
|
146 |
+
style={ buttonStyle }
|
147 |
+
keepPlaceholderOnFocus
|
148 |
+
/>
|
149 |
+
<RichText
|
150 |
+
placeholder={ __( 'Add text…', 'premium-content' ) }
|
151 |
+
value={ attributes.loginButtonText }
|
152 |
+
onChange={ ( nextValue ) => setAttributes( { loginButtonText: nextValue } ) }
|
153 |
+
className={ buttonClasses }
|
154 |
+
style={ buttonStyle }
|
155 |
+
keepPlaceholderOnFocus
|
156 |
+
/>
|
157 |
+
</div>
|
158 |
+
<InspectorControls>
|
159 |
+
<PanelColorSettings
|
160 |
+
title={ __( 'Button Color Settings', 'premium-content' ) }
|
161 |
+
colorSettings={ [
|
162 |
+
{
|
163 |
+
value: backgroundButtonColor || undefined,
|
164 |
+
onChange: setBackgroundButtonColor,
|
165 |
+
label: __( 'Background Color', 'premium-content' ),
|
166 |
+
},
|
167 |
+
{
|
168 |
+
value: textButtonColor || undefined,
|
169 |
+
onChange: setTextButtonColor,
|
170 |
+
label: __( 'Text Color', 'premium-content' ),
|
171 |
+
},
|
172 |
+
] }
|
173 |
+
/>
|
174 |
+
<ContrastChecker
|
175 |
+
textColor={ color }
|
176 |
+
backgroundColor={ backgroundColor }
|
177 |
+
fallbackBackgroundColor={ fallbackBackgroundColor }
|
178 |
+
fallbackTextColor={ fallbackTextColor }
|
179 |
+
/>
|
180 |
+
</InspectorControls>
|
181 |
+
</div>
|
182 |
+
);
|
183 |
+
}
|
184 |
+
|
185 |
+
export default compose( [
|
186 |
+
withColors( { backgroundButtonColor: 'background-color' }, { textButtonColor: 'color' } ),
|
187 |
+
applyFallbackStyles,
|
188 |
+
] )( SubmitButtons );
|
premium-content/blocks/subscriber-view/edit.js
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { InnerBlocks } from '@wordpress/block-editor';
|
5 |
+
import { __ } from '@wordpress/i18n';
|
6 |
+
import { useEffect } from '@wordpress/element';
|
7 |
+
import { compose } from '@wordpress/compose';
|
8 |
+
import { withDispatch, withSelect } from '@wordpress/data';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import Context from '../container/context';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Block edit function
|
17 |
+
*
|
18 |
+
* @typedef { Object } Props
|
19 |
+
* @property { string } clientId
|
20 |
+
* @property { string } containerClientId
|
21 |
+
* @property { () => void } selectBlock
|
22 |
+
*
|
23 |
+
* @param { Props } props
|
24 |
+
*/
|
25 |
+
function Edit( props ) {
|
26 |
+
useEffect( () => {
|
27 |
+
props.selectBlock();
|
28 |
+
}, [] );
|
29 |
+
|
30 |
+
return (
|
31 |
+
<Context.Consumer>
|
32 |
+
{ ( { selectedTab, stripeNudge } ) => (
|
33 |
+
/** @see https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md#case-the-event-handler-is-only-being-used-to-capture-bubbled-events */
|
34 |
+
// eslint-disable-next-line
|
35 |
+
<div hidden={ selectedTab.id === 'wall' } className={ selectedTab.className }>
|
36 |
+
{ stripeNudge }
|
37 |
+
<InnerBlocks
|
38 |
+
templateLock={ false }
|
39 |
+
template={ [
|
40 |
+
[
|
41 |
+
'core/paragraph',
|
42 |
+
{
|
43 |
+
placeholder: __(
|
44 |
+
'Insert the piece of content you want your visitors to see after they subscribe.',
|
45 |
+
'premium-content'
|
46 |
+
),
|
47 |
+
},
|
48 |
+
],
|
49 |
+
] }
|
50 |
+
/>
|
51 |
+
</div>
|
52 |
+
) }
|
53 |
+
</Context.Consumer>
|
54 |
+
);
|
55 |
+
}
|
56 |
+
|
57 |
+
export default compose( [
|
58 |
+
withSelect( ( select, props ) => {
|
59 |
+
return {
|
60 |
+
// @ts-ignore difficult to type with JSDoc
|
61 |
+
containerClientId: select( 'core/block-editor' ).getBlockHierarchyRootClientId(
|
62 |
+
props.clientId
|
63 |
+
),
|
64 |
+
};
|
65 |
+
} ),
|
66 |
+
withDispatch( ( dispatch, props ) => {
|
67 |
+
const blockEditor = dispatch( 'core/block-editor' );
|
68 |
+
return {
|
69 |
+
selectBlock() {
|
70 |
+
// @ts-ignore difficult to type with JSDoc
|
71 |
+
blockEditor.selectBlock( props.containerClientId );
|
72 |
+
},
|
73 |
+
};
|
74 |
+
} ),
|
75 |
+
] )( Edit );
|
premium-content/blocks/subscriber-view/index.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import edit from './edit';
|
5 |
+
import save from './save';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* WordPress dependencies
|
9 |
+
*/
|
10 |
+
import { __ } from '@wordpress/i18n';
|
11 |
+
|
12 |
+
const name = 'premium-content/subscriber-view';
|
13 |
+
const category = 'common';
|
14 |
+
const settings = {
|
15 |
+
name,
|
16 |
+
category,
|
17 |
+
attributes: {},
|
18 |
+
|
19 |
+
/* translators: block name */
|
20 |
+
title: __( 'Subscriber View', 'premium-content' ),
|
21 |
+
/* translators: block description */
|
22 |
+
description: __( 'Subscriber View.', 'premium-content' ),
|
23 |
+
parent: [ 'premium-content/container' ],
|
24 |
+
supports: {
|
25 |
+
// Hide this block from the inserter.
|
26 |
+
inserter: false,
|
27 |
+
},
|
28 |
+
edit,
|
29 |
+
save,
|
30 |
+
};
|
31 |
+
|
32 |
+
export { name, category, settings };
|
premium-content/blocks/subscriber-view/save.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { InnerBlocks } from '@wordpress/block-editor';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Block Save function
|
8 |
+
*/
|
9 |
+
export default function Save() {
|
10 |
+
return (
|
11 |
+
<div className="wp-block-premium-content-subscriber-view">
|
12 |
+
<InnerBlocks.Content />
|
13 |
+
</div>
|
14 |
+
);
|
15 |
+
}
|
premium-content/dist/premium-content.asset.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-rich-text', 'wp-url'), 'version' => '48d5caf8b8f5c4a84a43b20d02076479');
|
premium-content/dist/premium-content.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=22)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.compose}()},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){var r=n(17),o=n(18),c=n(19),l=n(21);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||l()}},function(e,t){!function(){e.exports=this.lodash}()},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){var r=n(9);function o(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}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.richText}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){function n(e,t,n,r,o,c,l){try{var a=e[c](l),i=a.value}catch(u){return void n(u)}a.done?t(i):Promise.resolve(i).then(r,o)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(o,c){var l=e.apply(t,r);function a(e){n(l,o,c,a,i,"next",e)}function i(e){n(l,o,c,a,i,"throw",e)}a(void 0)}))}}},function(e,t,n){var r;
|
2 |
+
/*!
|
3 |
+
Copyright (c) 2017 Jed Watson.
|
4 |
+
Licensed under the MIT License (MIT), see
|
5 |
+
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var l=o.apply(null,r);l&&e.push(l)}else if("object"===c)for(var a in r)n.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var l,a=e[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(i){o=!0,c=i}finally{try{r||null==a.return||a.return()}finally{if(o)throw c}}return n}}},function(e,t,n){var r=n(20);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 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}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){"use strict";n.r(t),n.d(t,"registerPremiumContentBlocks",(function(){return ae}));var r={};n.r(r),n.d(r,"name",(function(){return F})),n.d(r,"category",(function(){return U})),n.d(r,"settings",(function(){return H}));var o={};n.r(o),n.d(o,"name",(function(){return $})),n.d(o,"category",(function(){return G})),n.d(o,"settings",(function(){return V}));var c={};n.r(c),n.d(c,"name",(function(){return ne})),n.d(c,"category",(function(){return re})),n.d(c,"settings",(function(){return oe}));var l=n(10),a=n.n(l),i=n(14),u=n(1),s=n(6),b=n.n(s),m=n(7),p=n.n(m),d=n(0),f=n(2),O=n(5),j=n(4),v=n(11);function g(e){var t=e.className,n=e.tab,r=e.label,o=e.selectedTab,c=e.onSelected,l=(n.id===o.id?["is-pressed","is-active"]:[]).concat([t,"components-button","components-tab-button"]);return Object(d.createElement)("button",{type:"button",onClick:function(){return c(n)},className:l.join(" ")},r)}function y(e){var t=e.className,n=e.tabs,r=e.selectedTab,o=e.onSelected,c=e.selectBlock;return Object(d.createElement)("div",{className:"premium-content-tabs block-editor-block-toolbar"},n.map((function(n){return Object(d.createElement)(g,b()({key:n.id},e,{tab:n,selectedTab:r,className:"".concat(t,"--tab"),label:n.label,onSelected:o}))})),Object(d.createElement)("button",{onClick:function(){Object(j.select)("core/edit-post").isEditorSidebarOpened()||Object(j.dispatch)("core/edit-post").openGeneralSidebar("edit-post/block"),c()},className:"edit components-button is-button is-secondary"},Object(u.__)("Edit","premium-content")))}var h=n(3);function w(){return Object(d.createElement)("div",{className:"premium-content-wrapper"},Object(d.createElement)(h.InnerBlocks,{allowedBlocks:["premium-content/subscriber-view","premium-content/logged-out-view"],templateLock:"all",template:[["premium-content/subscriber-view"],["premium-content/logged-out-view"]]}))}function _(e){var t=e.className,n=e.plan,r=e.selectedPlan,o=e.onSelected,c=e.onClose,l=r&&n.id===r.id,a=(l?["is-selected"]:[]).concat([t]).join(" "),i=l?"yes":void 0;return Object(d.createElement)(f.MenuItem,{onClick:function(e){e.preventDefault(),o(n),c()},className:a,key:n.id,value:n.id,selected:l,icon:i},n.title," : ",n.price," ",n.currency," / ",n.interval)}function k(e){var t=e.plans,n=e.selectedPlan,r=e.onSelected;return Object(d.createElement)(f.MenuGroup,null,t.map((function(t){return Object(d.createElement)(_,b()({},e,{key:t.id,selectedPlan:n,onSelected:r,plan:t}))})))}function C(e){return Object(d.createElement)(f.MenuGroup,null,Object(d.createElement)(f.MenuItem,{onClick:function(t){t.preventDefault(),Object(j.select)("core/edit-post").isEditorSidebarOpened()||Object(j.dispatch)("core/edit-post").openGeneralSidebar("edit-post/block");var n=document.getElementById("new-plan-name");null!==n&&n.focus(),e.onClose()}},Object(u.__)("Add a new subscription","premium-content")))}function E(e){var t=e.selectedPlanId,n=e.onSelected,r=e.plans.find((function(e){return e.id===t}));return Object(d.createElement)(h.BlockControls,null,Object(d.createElement)(f.Toolbar,null,Object(d.createElement)(f.DropdownMenu,{icon:Object(d.createElement)(d.Fragment,null,Object(d.createElement)(f.Dashicon,{icon:"update"})," ",r&&Object(d.createElement)(d.Fragment,null," ",r.title," : ",r.price," ",r.currency," /"," ",r.interval," ")),label:Object(u.__)("Select a plan","premium-content"),className:"premium-content-toolbar-button"},(function(t){var o=t.onClose;return Object(d.createElement)(d.Fragment,null,Object(d.createElement)(k,b()({},e,{onSelected:n,onClose:o,selectedPlan:r})),Object(d.createElement)(C,b()({},e,{onClose:o})))}))))}function P(e){var t=Object(d.useState)(0),n=p()(t,2),r=n[0],o=n[1],c=e.attributes,l=e.setAttributes,a=e.className,i=e.savePlan,s=e.currencies,b=e.siteSlug;return Object(d.createElement)(h.InspectorControls,null,b&&Object(d.createElement)(f.ExternalLink,{href:"https://wordpress.com/earn/payments/".concat(b),className:"wp-block-premium-content-container---link-to-earn"},Object(u.__)("Manage your subscriptions.","premium-content")),Object(d.createElement)(f.PanelBody,{title:"Add a new subscription",initialOpen:!0,className:"".concat(a,"---settings-add_plan")},1===r&&Object(d.createElement)(f.Placeholder,{icon:"lock",label:Object(u.__)("Premium Content","premium-content"),instructions:Object(u.__)("Saving plan...","premium-content")},Object(d.createElement)(f.Spinner,null)),0===r&&Object(d.createElement)("div",null,Object(d.createElement)(f.PanelRow,{className:"plan-name"},Object(d.createElement)(f.TextControl,{id:"new-plan-name",label:"Name",value:c.newPlanName,onChange:function(e){return l({newPlanName:e})}})),Object(d.createElement)(f.PanelRow,{className:"plan-price"},Object(d.createElement)(f.SelectControl,{label:"Currency",onChange:function(e){return l({newPlanCurrency:e})},value:c.newPlanCurrency,options:s.map((function(e){return{label:e.label,value:e.label}}))}),Object(d.createElement)(f.TextControl,{label:"Price",value:c.newPlanPrice,onChange:function(e){return l({newPlanPrice:parseFloat(e)})},type:"number"})),Object(d.createElement)(f.PanelRow,{className:"plan-interval"},Object(d.createElement)(f.SelectControl,{label:"Interval",onChange:function(e){return l({newPlanInterval:e})},value:c.newPlanInterval,options:[{label:"Month",value:"1 month"},{label:"Year",value:"1 year"}]})),Object(d.createElement)(f.PanelRow,null,Object(d.createElement)(f.Button,{isSecondary:!0,isLarge:!0,onClick:function(t){t.preventDefault(),o(1),i(e.attributes,(function(e){o(0),e&&(l({newPlanPrice:5}),l({newPlanName:""}))}))}},Object(u.__)("Add subscription","premium-content"))))))}P.defaultProps={currencies:[{label:"USD",symbol:"$"},{label:"GBP",symbol:"£"},{label:"JPY",symbol:"¥"},{label:"BRL",symbol:"R$"},{label:"EUR",symbol:"€"},{label:"NZD",symbol:"NZ$"},{label:"AUD",symbol:"A$"},{label:"CAD",symbol:"C$"},{label:"INR",symbol:"₹"},{label:"ILS",symbol:"₪"},{label:"RUB",symbol:"₽"},{label:"MXN",symbol:"MX$"},{label:"SEK",symbol:"SEK"},{label:"HUF",symbol:"Ft"},{label:"CHF",symbol:"CHF"},{label:"CZK",symbol:"Kč"},{label:"DKK",symbol:"Dkr"},{label:"HKD",symbol:"HK$"},{label:"NOK",symbol:"Kr"},{label:"PHP",symbol:"₱"},{label:"PLN",symbol:"PLN"},{label:"SGD",symbol:"S$"},{label:"TWD",symbol:"NT$"},{label:"THB",symbol:"฿"},{label:"TRY",symbol:"TL"}]};var S=n(15),B=n.n(S),x=Object(O.compose)([Object(j.withDispatch)((function(e,t){var n,r=t.stripeConnectUrl;return{autosaveAndRedirect:(n=B()(regeneratorRuntime.mark((function t(n){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.preventDefault(),t.next=3,e("core/editor").savePost();case 3:window.top.location.href=r;case 4:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)})}}))])((function(e){var t=e.autosaveAndRedirect,n=e.stripeConnectUrl;return Object(d.createElement)(h.Warning,{actions:n&&[Object(d.createElement)(f.Button,{key:"connect",href:n,onClick:t,target:"_top",isDefault:!0,className:"premium-content-block-nudge__button"},Object(u.__)("Connect","premium-content"))],className:"premium-content-block-nudge"},Object(d.createElement)("span",{className:"premium-content-block-nudge__info"},Object(d.createElement)(f.Dashicon,{icon:"star-filled"}),Object(d.createElement)("span",{className:"premium-content-block-nudge__text-container"},Object(d.createElement)("span",{className:"premium-content-block-nudge__title"},Object(u.__)("Connect to Stripe to use this block on your site","premium-content")),Object(d.createElement)("span",{className:"premium-content-block-nudge__message"},Object(u.__)("This block will be hidden from your visitors until you connect to Stripe.","premium-content")))))})),N={selectedTab:{id:"",className:"",label:Object(d.createElement)(d.Fragment,null)},stripeNudge:null},I=Object(d.createContext)(N),T=n(12),A=n.n(T),D=[{id:"premium",label:Object(d.createElement)("span",null,Object(u.__)("Subscriber View","premium-content")),className:"wp-premium-content-subscriber-view"},{id:"wall",label:Object(d.createElement)("span",null,Object(u.__)("Logged Out View","premium-content")),className:"wp-premium-content-logged-out-view"}],R=[];function L(e,t){var n=e.noticeOperations;n.removeAllNotices(),n.createErrorNotice(t)}var M=Object(O.compose)([Object(j.withSelect)((function(e,t){return{postId:(0,e("core/editor").getCurrentPostId)(),containerClientId:e("core/block-editor").getBlockHierarchyRootClientId(t.clientId)}})),f.withNotices,Object(j.withDispatch)((function(e,t){var n=e("core/block-editor");return{selectBlock:function(){n.selectBlock(t.containerClientId)}}}))])((function(e){var t=Object(d.useState)(D[1]),n=p()(t,2),r=n[0],o=n[1],c=Object(d.useState)(!1),l=p()(c,2),a=l[0],i=l[1],s=Object(d.useState)(R),m=p()(s,2),O=m[0],j=m[1],g=Object(d.useState)(null),h=p()(g,2),_=h[0],k=h[1],C=Object(d.useState)(0),S=p()(C,2),B=S[0],N=S[1],T=Object(d.useState)(!1),M=p()(T,2),F=M[0],U=M[1],H=Object(d.useState)(""),K=p()(H,2),$=K[0],G=K[1],V=Object(d.useState)(""),q=p()(V,2),Y=q[0],J=q[1];function Z(t,n){if(!t.newPlanName||0===t.newPlanName.length)return L(e,Object(u.__)("Plan requires a name","premium-content")),void n(!1);if(t.newPlanPrice&&(t.newPlanPrice<5||isNaN(t.newPlanPrice)))return L(e,Object(u.sprintf)(Object(u.__)("Minimum allowed price is %s."),5)),void n(!1);if(!t.newPlanPrice)return L(e,Object(u.__)("Plan requires a valid price")),void n(!1);var r={path:"/wpcom/v2/memberships/product",method:"POST",data:{currency:t.newPlanCurrency,price:t.newPlanPrice,title:t.newPlanName,interval:t.newPlanInterval}};A()(r).then((function(e){var t={id:e.id,title:e.title,interval:e.interval,price:e.price,currency:e.currency};j(O.concat([t])),Q(t),n&&n(!0)}),(function(){L(e,Object(u.__)("There was an error when adding the plan.")),n&&n(!1)}))}function Q(t){e.setAttributes({selectedPlanId:t.id})}var W=Object(d.useRef)(null);!function(e,t){function n(n){e.current&&n.target&&n.target instanceof Node&&!e.current.contains(n.target)?t(!1):t(!0)}Object(d.useEffect)((function(){return document.addEventListener("mousedown",n),function(){document.removeEventListener("mousedown",n)}}))}(W,i);var X=e.isSelected,z=e.className;if(Object(d.useEffect)((function(){var t={path:"/wpcom/v2/memberships/status",method:"GET"};A()(t).then((function(t){if(t||"object"==typeof t){if(t.errors&&Object.values(t.errors)&&Object.values(t.errors)[0][0])return N(2),void L(e,Object.values(t.errors)[0][0]);k(t.connect_url),U(t.should_upgrade_to_access_memberships),G(t.upgrade_url),J(t.site_slug),t.products&&0===t.products.length&&!t.should_upgrade_to_access_memberships&&t.connected_account_id?Z({newPlanCurrency:"USD",newPlanPrice:5,newPlanName:Object(u.__)("Monthly Subscription"),newPlanInterval:"1 month"},(function(){N(t.connected_account_id?1:2)})):(t.products&&t.products.length>0&&(j(t.products),e.attributes.selectedPlanId||Q(t.products[0])),N(t.connected_account_id?1:2))}}),(function(t){k(null),N(2),L(e,t.message)})),e.selectBlock()}),[]),0===B)return Object(d.createElement)("div",{className:z,ref:W},e.noticeUI,Object(d.createElement)(f.Placeholder,{icon:"lock",label:Object(u.__)("Premium Content","premium-content"),instructions:Object(u.__)("Loading data...","premium-content")},Object(d.createElement)(f.Spinner,null)));if(F)return Object(d.createElement)("div",{className:z,ref:W},e.noticeUI,Object(d.createElement)(f.Placeholder,{icon:"lock",label:Object(u.__)("Premium Content","premium-content"),instructions:Object(u.__)("You'll need to upgrade your plan to use the Premium Content block.","premium-content")},Object(d.createElement)(f.Button,{isSecondary:!0,isLarge:!0,href:$,target:"_blank",className:"premium-content-block-nudge__button"},Object(u.__)("Upgrade Your Plan","premium-content")),Object(d.createElement)("div",{className:"membership-button__disclaimer"},Object(d.createElement)(f.ExternalLink,{href:"https://wordpress.com/support/premium-content-block/"},Object(u.__)("Read more about Premium Content and related fees.","premium-content")))));var ee=null;if(!F&&1!==B&&_){var te=function(e,t){var n,r=e.postId;if(!Object(v.isURL)(t))return null;if(!r)return t;try{var o=Object(v.getQueryArg)(t,"state");"string"==typeof o&&(n=JSON.parse(atob(o)))}catch(c){return t}return n.from_editor_post_id=r,Object(v.addQueryArgs)(t,{state:btoa(JSON.stringify(n))})}(e,_);ee=Object(d.createElement)(x,b()({},e,{stripeConnectUrl:te}))}return Object(d.createElement)("div",{className:z,ref:W},e.noticeUI,(X||a)&&Object(d.createElement)(E,b()({},e,{plans:O,selectedPlanId:e.attributes.selectedPlanId,onSelected:Q})),(X||a)&&Object(d.createElement)(P,b()({},e,{savePlan:Z,siteSlug:Y})),(X||a)&&Object(d.createElement)(y,b()({},e,{tabs:D,selectedTab:r,onSelected:o})),Object(d.createElement)(I.Provider,{value:{selectedTab:r,stripeNudge:ee}},Object(d.createElement)(w,null)))}));var F="premium-content/container",U="common",H={name:F,attributes:{newPlanName:{type:"string",default:"Monthly Subscription"},newPlanCurrency:{type:"string",default:"USD"},newPlanPrice:{type:"number",default:5},newPlanInterval:{type:"string",default:"1 month"},selectedPlanId:{type:"number",default:0}},title:Object(u.__)("Premium Content","premium-content"),description:Object(u.__)("Restrict access to your content for paying subscribers.","premium-content"),category:U,icon:"lock",supports:{html:!1},keywords:["premium-content",Object(u.__)("premium","premium-content"),Object(u.__)("paywall","premium-content")],edit:M,save:function(){return Object(d.createElement)("div",{className:"wp-block-premium-content-container"},Object(d.createElement)(h.InnerBlocks.Content,null))}};var K=Object(O.compose)([Object(j.withSelect)((function(e,t){return{containerClientId:e("core/block-editor").getBlockHierarchyRootClientId(t.clientId)}})),Object(j.withDispatch)((function(e,t){var n=e("core/block-editor");return{selectBlock:function(){n.selectBlock(t.containerClientId)}}}))])((function(e){return Object(d.useEffect)((function(){e.selectBlock()}),[]),Object(d.createElement)(I.Consumer,null,(function(e){var t=e.selectedTab,n=e.stripeNudge;return Object(d.createElement)("div",{hidden:"wall"===t.id,className:t.className},n,Object(d.createElement)(h.InnerBlocks,{templateLock:!1,template:[["core/paragraph",{placeholder:Object(u.__)("Insert the piece of content you want your visitors to see after they subscribe.","premium-content")}]]}))}))}));var $="premium-content/subscriber-view",G="common",V={name:$,category:G,attributes:{},title:Object(u.__)("Subscriber View","premium-content"),description:Object(u.__)("Subscriber View.","premium-content"),parent:["premium-content/container"],supports:{inserter:!1},edit:K,save:function(){return Object(d.createElement)("div",{className:"wp-block-premium-content-subscriber-view"},Object(d.createElement)(h.InnerBlocks.Content,null))}},q=n(8),Y=n(9),J=n.n(Y),Z=n(16),Q=n.n(Z),W=window.getComputedStyle,X=Object(f.withFallbackStyles)((function(e,t){var n,r,o,c,l=t.textButtonColor,a=t.backgroundButtonColor,i=a&&a.color,u=l&&l.color;return!u&&e&&(n=e.querySelector('[contenteditable="true"]')),r=e.querySelector(".wp-block-button__link")?e.querySelector(".wp-block-button__link"):e,e&&r&&(o=W(r).backgroundColor),n&&(c=W(n).color),{fallbackBackgroundColor:i||o,fallbackTextColor:u||c}}));var z=Object(O.compose)([Object(h.withColors)({backgroundButtonColor:"background-color"},{textButtonColor:"color"}),X])((function(e){function t(){var t,n=e.textButtonColor,r=e.backgroundButtonColor,o=Object(q.get)(n,"class"),c=Object(q.get)(r,"class");return Q()("wp-block-button__link",(t={"has-text-color":n.color},J()(t,o,o),J()(t,"has-background",r.color),J()(t,c,c),t))}Object(d.useEffect)((function(){!function(){var n=t();e.setAttributes({buttonClasses:n})}(),function(){var t=Object(q.get)(e.textButtonColor,"color"),n=Object(q.get)(e.backgroundButtonColor,"color");void 0!==t&&e.setAttributes({customTextButtonColor:t});void 0!==n&&e.setAttributes({customBackgroundButtonColor:n})}()}),[e.backgroundButtonColor,e.textButtonColor]);var n=e.attributes,r=e.setAttributes,o=e.backgroundButtonColor,c=e.textButtonColor,l=e.setBackgroundButtonColor,a=e.setTextButtonColor,i=e.fallbackBackgroundColor,s=e.fallbackTextColor,b=o.color||i,m=c.color||s,p={border:"none",backgroundColor:b,color:m},f=t();return Object(d.createElement)("div",null,Object(d.createElement)("div",{className:"wp-block-button premium-content-logged-out-view-button"},Object(d.createElement)(h.RichText,{placeholder:Object(u.__)("Add text…","premium-content"),value:n.subscribeButtonText,onChange:function(e){return r({subscribeButtonText:e})},className:f,style:p,keepPlaceholderOnFocus:!0}),Object(d.createElement)(h.RichText,{placeholder:Object(u.__)("Add text…","premium-content"),value:n.loginButtonText,onChange:function(e){return r({loginButtonText:e})},className:f,style:p,keepPlaceholderOnFocus:!0})),Object(d.createElement)(h.InspectorControls,null,Object(d.createElement)(h.PanelColorSettings,{title:Object(u.__)("Button Color Settings","premium-content"),colorSettings:[{value:o||void 0,onChange:l,label:Object(u.__)("Background Color","premium-content")},{value:c||void 0,onChange:a,label:Object(u.__)("Text Color","premium-content")}]}),Object(d.createElement)(h.ContrastChecker,{textColor:m,backgroundColor:b,fallbackBackgroundColor:i,fallbackTextColor:s})))}));var ee=Object(O.compose)([Object(j.withSelect)((function(e,t){return{containerClientId:e("core/block-editor").getBlockHierarchyRootClientId(t.clientId)}})),Object(j.withDispatch)((function(e,t){var n=e("core/block-editor");return{selectBlock:function(){n.selectBlock(t.containerClientId)}}}))])((function(e){Object(d.useEffect)((function(){e.selectBlock()}),[]);var t=Object(d.createElement)(z,{attributes:Object(q.pick)(e.attributes,["subscribeButtonText","loginButtonText","backgroundButtonColor","textButtonColor","customBackgroundButtonColor","customTextButtonColor"]),setAttributes:e.setAttributes});return Object(d.createElement)(I.Consumer,null,(function(e){var n=e.selectedTab,r=e.stripeNudge;return Object(d.createElement)("div",{hidden:"premium"===n.id,className:n.className},r,Object(d.createElement)(h.InnerBlocks,{templateLock:!1,template:[["core/heading",{content:Object(u.__)("Subscribe to get access","premium-content"),level:3}],["core/paragraph",{content:Object(u.__)("Read more of this content when you subscribe today.","premium-content")}]]}),t)}))}));var te=n(13),ne="premium-content/logged-out-view",re="common",oe={name:ne,category:re,attributes:{subscribeButtonText:{type:"string",default:"Subscribe"},loginButtonText:{type:"string",default:"Log In"},buttonClasses:{type:"string",default:""},backgroundButtonColor:{type:"string",default:""},textButtonColor:{type:"string",default:""},customBackgroundButtonColor:{type:"string",default:""},customTextButtonColor:{type:"string",default:""}},title:Object(u.__)("Logged Out View","premium-content"),description:Object(u.__)("Logged Out View.","premium-content"),parent:["premium-content/container"],supports:{inserter:!1},edit:ee,save:function(){return Object(d.createElement)("div",{className:"wp-block-premium-content-logged-out-view"},Object(d.createElement)(h.InnerBlocks.Content,null))}},ce=Object(j.subscribe)((function(){var e=Object(j.select)("core/rich-text").getFormatType("core/link");if(e){ce(),Object(te.unregisterFormatType)("core/link");var t=Object(O.compose)(Object(j.withSelect)((function(e){return{selectedBlock:e("core/block-editor").getSelectedBlock()}})),Object(O.ifCondition)((function(e){return e.selectedBlock&&e.selectedBlock.name!==ne})))(e.edit);Object(te.registerFormatType)("core/link",a()({},e,{edit:t}))}})),le=function(e){if(e){var t=e.name,n=e.category,r=e.settings;Object(i.registerBlockType)(t,a()({category:n},r))}},ae=function(){[r,c,o].forEach(le)};ae()}]));
|
premium-content/editor.css
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wp-block-premium-content-container .premium-content-tabs {
|
2 |
+
align-items: center;
|
3 |
+
background: #fff;
|
4 |
+
color: #555d66;
|
5 |
+
display: flex;
|
6 |
+
flex-wrap: wrap;
|
7 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
8 |
+
font-size: 13px;
|
9 |
+
position: relative;
|
10 |
+
margin: 0 0 0 -1px;
|
11 |
+
padding: 8px 14px;
|
12 |
+
border: 1px solid #1e1e1e;
|
13 |
+
border-radius: 2px;
|
14 |
+
}
|
15 |
+
|
16 |
+
.wp-block-premium-content-container--tab {
|
17 |
+
display: flex;
|
18 |
+
flex-direction: row;
|
19 |
+
align-items: center;
|
20 |
+
border: none;
|
21 |
+
background: transparent;
|
22 |
+
padding: 5px;
|
23 |
+
margin-right: 5px;
|
24 |
+
text-decoration: none;
|
25 |
+
}
|
26 |
+
|
27 |
+
.premium-content-tabs > button.edit {
|
28 |
+
margin-left: auto;
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
.premium-content-wrapper {
|
33 |
+
margin: 0;
|
34 |
+
}
|
35 |
+
|
36 |
+
.premium-content-toolbar-button {
|
37 |
+
min-width: 150px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.premium-content-block-nudge .editor-warning {
|
41 |
+
margin-bottom: 0;
|
42 |
+
}
|
43 |
+
|
44 |
+
.premium-content-block-nudge .editor-warning__message {
|
45 |
+
margin: 13px 0;
|
46 |
+
}
|
47 |
+
|
48 |
+
.premium-content-block-nudge .editor-warning__actions {
|
49 |
+
line-height: 1;
|
50 |
+
}
|
51 |
+
|
52 |
+
.premium-content-block-nudge .premium-content-block-nudge__info {
|
53 |
+
font-size: 13px;
|
54 |
+
display: flex;
|
55 |
+
flex-direction: row;
|
56 |
+
line-height: 1.4;
|
57 |
+
}
|
58 |
+
|
59 |
+
.premium-content-block-nudge .premium-content-block-nudge__text-container {
|
60 |
+
display: flex;
|
61 |
+
flex-direction: column;
|
62 |
+
padding-left: 10px;
|
63 |
+
}
|
64 |
+
|
65 |
+
.premium-content-block-nudge .premium-content-block-nudge__title {
|
66 |
+
font-size: 14px;
|
67 |
+
}
|
68 |
+
|
69 |
+
.premium-content-block-nudge__message {
|
70 |
+
color: var(--color-text-subtle);
|
71 |
+
}
|
72 |
+
|
73 |
+
.editor-styles-wrapper a.premium-content-block-nudge__button {
|
74 |
+
color: #0075af;
|
75 |
+
text-decoration: none;
|
76 |
+
}
|
77 |
+
|
78 |
+
.membership-button__disclaimer {
|
79 |
+
color: var(--color-gray-200);
|
80 |
+
flex-basis: 100%;
|
81 |
+
margin: 0;
|
82 |
+
font-style: italic;
|
83 |
+
}
|
84 |
+
|
85 |
+
.membership-button__disclaimer a {
|
86 |
+
color: var(--color-gray-400);
|
87 |
+
line-height: 36px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.wp-block-premium-content-container---settings-add_plan .components-panel__row.plan-name .components-base-control,
|
91 |
+
.wp-block-premium-content-container---settings-add_plan .components-panel__row.plan-interval .components-base-control {
|
92 |
+
width: 100%;
|
93 |
+
}
|
94 |
+
|
95 |
+
.wp-block-premium-content-container---settings-add_plan .components-panel__row.plan-price .components-base-control {
|
96 |
+
width: 45%;
|
97 |
+
margin: 0;
|
98 |
+
}
|
99 |
+
|
100 |
+
.wp-block-premium-content-container---settings-add_plan .components-panel__row.plan-price {
|
101 |
+
margin-bottom: 28px;
|
102 |
+
}
|
103 |
+
|
104 |
+
.wp-block-premium-content-container---link-to-earn {
|
105 |
+
margin: 16px;
|
106 |
+
display: block;
|
107 |
+
}
|
premium-content/index.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* WordPress dependencies
|
3 |
+
*/
|
4 |
+
import { registerBlockType } from '@wordpress/blocks';
|
5 |
+
|
6 |
+
// Register Blocks
|
7 |
+
import * as container from './blocks/container';
|
8 |
+
import * as subscriberView from './blocks/subscriber-view';
|
9 |
+
import * as loggedOutView from './blocks/logged-out-view';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Function to register an individual block.
|
13 |
+
*
|
14 |
+
* @typedef {import('@wordpress/blocks').BlockConfiguration} BlockConfiguration
|
15 |
+
*
|
16 |
+
* @typedef {Object} Block
|
17 |
+
* @property {string} name
|
18 |
+
* @property {string} category
|
19 |
+
* @property {BlockConfiguration} settings
|
20 |
+
*
|
21 |
+
* @param {Block} block The block to be registered.
|
22 |
+
*/
|
23 |
+
const registerBlock = ( block ) => {
|
24 |
+
if ( ! block ) {
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
|
28 |
+
const { name, category, settings } = block;
|
29 |
+
|
30 |
+
registerBlockType( name, {
|
31 |
+
category,
|
32 |
+
...settings,
|
33 |
+
} );
|
34 |
+
};
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Function to register blocks provided by CoBlocks.
|
38 |
+
*/
|
39 |
+
export const registerPremiumContentBlocks = () => {
|
40 |
+
[ container, loggedOutView, subscriberView ].forEach( registerBlock );
|
41 |
+
};
|
42 |
+
|
43 |
+
registerPremiumContentBlocks();
|
premium-content/premium-content-dom.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
|
3 |
+
namespace A8C\FSE\Earn\PremiumContent;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Premium_Content_Dom
|
7 |
+
*
|
8 |
+
* Manipulate an HTML string.
|
9 |
+
*
|
10 |
+
* @package Automattic\Earn\PremiumContent
|
11 |
+
*/
|
12 |
+
class Premium_Content_Dom {
|
13 |
+
|
14 |
+
const SUBSCRIBER_VIEW_CLASS = 'wp-block-premium-content-subscriber-view';
|
15 |
+
const LOGGED_OUT_VIEW_CLASS = 'wp-block-premium-content-logged-out-view';
|
16 |
+
const LOGGED_OUT_BUTTONS_CLASS = 'wp-block-premium-content-logged-out-view__buttons';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var \DOMDocument
|
20 |
+
*/
|
21 |
+
private $doc;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Premium_Content_Dom constructor.
|
25 |
+
*
|
26 |
+
* @param string $content HTML
|
27 |
+
*/
|
28 |
+
function __construct( $content ) {
|
29 |
+
$this->doc = new \DOMDocument();
|
30 |
+
libxml_use_internal_errors( true );
|
31 |
+
// Do not set doctype, html, or body tags
|
32 |
+
$status = $this->doc->loadHTML( $content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
|
33 |
+
if ( $status === false ) {
|
34 |
+
throw new \InvalidArgumentException( 'Unable to load HTML' );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param string $class
|
40 |
+
*
|
41 |
+
* @return $this
|
42 |
+
* @throws \Exception
|
43 |
+
*/
|
44 |
+
public function remove_element_by_class( string $class ) {
|
45 |
+
$xpath = new \DOMXPath( $this->doc );
|
46 |
+
$elements = $xpath->query( "//*[contains(concat(' ', normalize-space(@class), ' '), ' $class ')]" );
|
47 |
+
if ( empty( $elements ) ) {
|
48 |
+
throw new \Exception( 'problem parsing the query' );
|
49 |
+
}
|
50 |
+
for ( $i = $elements->length; --$i >= 0; ) {
|
51 |
+
$element = $elements->item( $i );
|
52 |
+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
53 |
+
$element->parentNode->removeChild( $element );
|
54 |
+
}
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function to_html() {
|
62 |
+
return $this->doc->saveHTML();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Remove the subscription div.
|
67 |
+
*
|
68 |
+
* @param string $content
|
69 |
+
*
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public static function logged_out( string $content ) {
|
73 |
+
try {
|
74 |
+
$dom = new Premium_Content_Dom( $content );
|
75 |
+
return $dom
|
76 |
+
->remove_element_by_class( self::SUBSCRIBER_VIEW_CLASS )
|
77 |
+
->to_html();
|
78 |
+
} catch ( \Exception $exception ) {
|
79 |
+
return $content;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Remove the logged out view
|
85 |
+
*
|
86 |
+
* @param string $content
|
87 |
+
*
|
88 |
+
* @return string
|
89 |
+
*/
|
90 |
+
public static function subscriber( string $content ) {
|
91 |
+
try {
|
92 |
+
$dom = new Premium_Content_Dom( $content );
|
93 |
+
return $dom
|
94 |
+
->remove_element_by_class( self::LOGGED_OUT_VIEW_CLASS )
|
95 |
+
->remove_element_by_class( self::LOGGED_OUT_BUTTONS_CLASS )
|
96 |
+
->to_html();
|
97 |
+
} catch ( \Exception $exception ) {
|
98 |
+
return $content;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
premium-content/premium-content.php
ADDED
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
/**
|
3 |
+
* Plugin Name: Premium Content
|
4 |
+
* Description: Example block written with ESNext standard and JSX support – build step required.
|
5 |
+
* Version: 0.1.0
|
6 |
+
* Author: The WordPress Contributors
|
7 |
+
* License: GPL-2.0-or-later
|
8 |
+
* Text Domain: create-block
|
9 |
+
*
|
10 |
+
* @package create-block
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace A8C\FSE\Earn\PremiumContent;
|
14 |
+
|
15 |
+
use RuntimeException;
|
16 |
+
use function register_block_type;
|
17 |
+
use function plugin_dir_url;
|
18 |
+
use function apply_filters;
|
19 |
+
use A8C\FSE\Earn\PremiumContent\Premium_Content_Dom;
|
20 |
+
use A8C\FSE\Earn\PremiumContent\SubscriptionService\{
|
21 |
+
Subscription_Service,
|
22 |
+
Jetpack_Token_Subscription_Service,
|
23 |
+
Unconfigured_Subscription_Service,
|
24 |
+
WPCOM_Token_Subscription_Service
|
25 |
+
};
|
26 |
+
|
27 |
+
const PAYWALL_FILTER = 'earn_premium_content_subscription_service';
|
28 |
+
|
29 |
+
require_once __DIR__ . '/subscription-service/include.php';
|
30 |
+
require_once __DIR__ . '/premium-content-dom.php';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Registers all block assets so that they can be enqueued through the block editor
|
34 |
+
* in the corresponding context.
|
35 |
+
*
|
36 |
+
* @see https://developer.wordpress.org/block-editor/tutorials/block-tutorial/applying-styles-with-stylesheets/
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
function premium_content_block_init() {
|
40 |
+
$url_path = plugin_dir_url( __FILE__ );
|
41 |
+
$dir = __DIR__;
|
42 |
+
|
43 |
+
$script_asset_path = "$dir/dist/premium-content.asset.php";
|
44 |
+
if ( ! file_exists( $script_asset_path ) ) {
|
45 |
+
throw new RuntimeException(
|
46 |
+
'You need to run `npm start` or `npm run build` for the "create-block/premium-content" block first.'
|
47 |
+
);
|
48 |
+
}
|
49 |
+
$index_js = 'dist/premium-content.js';
|
50 |
+
$script_asset = include $script_asset_path;
|
51 |
+
wp_register_script(
|
52 |
+
'premium-content-container-block-editor',
|
53 |
+
"$url_path/$index_js",
|
54 |
+
$script_asset['dependencies'],
|
55 |
+
$script_asset['version']
|
56 |
+
);
|
57 |
+
|
58 |
+
wp_register_script(
|
59 |
+
'premium-content-frontend',
|
60 |
+
"$url_path/view.js",
|
61 |
+
array( 'jquery' ),
|
62 |
+
$script_asset['version']
|
63 |
+
);
|
64 |
+
|
65 |
+
$editor_css = 'editor.css';
|
66 |
+
wp_register_style(
|
67 |
+
'premium-content-container-block-editor',
|
68 |
+
"$url_path/$editor_css",
|
69 |
+
array(),
|
70 |
+
filemtime( "$dir/$editor_css" )
|
71 |
+
);
|
72 |
+
|
73 |
+
$style_css = 'style.css';
|
74 |
+
wp_register_style(
|
75 |
+
'premium-content-container-block',
|
76 |
+
"$url_path/$style_css",
|
77 |
+
array(),
|
78 |
+
filemtime( "$dir/$style_css" )
|
79 |
+
);
|
80 |
+
register_block_type(
|
81 |
+
'premium-content/container',
|
82 |
+
array(
|
83 |
+
'editor_script' => 'premium-content-container-block-editor',
|
84 |
+
'editor_style' => 'premium-content-container-block-editor',
|
85 |
+
'style' => 'premium-content-container-block',
|
86 |
+
'render_callback' => '\A8C\FSE\Earn\PremiumContent\premium_content_container_render',
|
87 |
+
)
|
88 |
+
);
|
89 |
+
register_block_type( 'premium-content/subscriber-view' );
|
90 |
+
register_block_type(
|
91 |
+
'premium-content/logged-out-view',
|
92 |
+
array(
|
93 |
+
'render_callback' => '\A8C\FSE\Earn\PremiumContent\premium_content_block_logged_out_view_render',
|
94 |
+
)
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* @param array $attributes
|
100 |
+
*
|
101 |
+
* @return bool
|
102 |
+
*/
|
103 |
+
function premium_content_current_visitor_can_access( $attributes ) {
|
104 |
+
$user = wp_get_current_user();
|
105 |
+
|
106 |
+
/**
|
107 |
+
* If the current WordPress install has as signed in user
|
108 |
+
* they can see the content.
|
109 |
+
*
|
110 |
+
* Ideas:
|
111 |
+
* - Capability check?
|
112 |
+
*/
|
113 |
+
// phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
|
114 |
+
if ( $user->ID !== 0 && current_user_can( 'edit_post', get_the_ID() ) ) {
|
115 |
+
return true;
|
116 |
+
}
|
117 |
+
|
118 |
+
if ( ! isset( $attributes['selectedPlanId'] ) ) {
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
$paywall = premium_content_subscription_service();
|
122 |
+
$can_view = $paywall->visitor_can_view_content( array( $attributes['selectedPlanId'] ) );
|
123 |
+
|
124 |
+
if ( $can_view ) {
|
125 |
+
do_action( 'earn_remove_cache_headers' );
|
126 |
+
}
|
127 |
+
|
128 |
+
return $can_view;
|
129 |
+
}
|
130 |
+
|
131 |
+
// TODO: I am planning to kill the other render methods and pull everything here. The data is too tightly coupled for the render methods being seperate
|
132 |
+
/**
|
133 |
+
* @param array $attributes
|
134 |
+
* @param string $content
|
135 |
+
* @return string
|
136 |
+
* @psalm-suppress InvalidArgument
|
137 |
+
*/
|
138 |
+
function premium_content_container_render( $attributes, $content ) {
|
139 |
+
// If Jetpack is not yet configured, don't show anything ...
|
140 |
+
if ( ! class_exists( '\Jetpack_Memberships' ) ) {
|
141 |
+
return '';
|
142 |
+
}
|
143 |
+
// if stripe not connected don't show anything...
|
144 |
+
if ( empty( \Jetpack_Memberships::get_connected_account_id() ) ) {
|
145 |
+
return '';
|
146 |
+
}
|
147 |
+
|
148 |
+
// Parse the content so that subscribers see the subscriber view and logged out users see the logged-out view.
|
149 |
+
$visitor_has_access = premium_content_current_visitor_can_access( $attributes );
|
150 |
+
if ( ! $visitor_has_access ) {
|
151 |
+
$content = Premium_Content_Dom::logged_out( $content );
|
152 |
+
// TODO: consider moving this into the DOM editing class... (or javascript)
|
153 |
+
$content = preg_replace_callback(
|
154 |
+
'#<subscribeButtonText classNames="(.*?)" customTextButtonColor="(.*?)" customBackgroundButtonColor="(.*?)">(.*?)<\/subscribeButtonText>#is',
|
155 |
+
/**
|
156 |
+
* @param array $matches
|
157 |
+
*
|
158 |
+
* @return null|string
|
159 |
+
*/
|
160 |
+
function ( $matches ) use ( $attributes ) {
|
161 |
+
return \Jetpack_Memberships::get_instance()->render_button(
|
162 |
+
array(
|
163 |
+
'planId' => $attributes['selectedPlanId'],
|
164 |
+
'submitButtonClasses' => $matches[1],
|
165 |
+
'customTextButtonColor' => $matches[2],
|
166 |
+
'customBackgroundButtonColor' => $matches[3],
|
167 |
+
'submitButtonText' => $matches[4], // This should be the text actually selected in the editor. I think I'll pass it in attributes.
|
168 |
+
)
|
169 |
+
);
|
170 |
+
},
|
171 |
+
$content
|
172 |
+
);
|
173 |
+
} else {
|
174 |
+
$content = Premium_Content_Dom::subscriber( $content );
|
175 |
+
}
|
176 |
+
|
177 |
+
return $content;
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* WordPress Gutenberg block render callback for the premium-content/logged-out-view
|
182 |
+
* block.
|
183 |
+
*
|
184 |
+
* Determines if the current visitor should be allowed to see the protected/premium
|
185 |
+
* content contained within the block.
|
186 |
+
*
|
187 |
+
* TODO: consider moving this to the DOM editing class or in javascript
|
188 |
+
*
|
189 |
+
* @param array $attributes
|
190 |
+
* @param string $content
|
191 |
+
* @return string
|
192 |
+
*/
|
193 |
+
function premium_content_block_logged_out_view_render( $attributes, $content ) {
|
194 |
+
wp_enqueue_script( 'premium-content-frontend' );
|
195 |
+
|
196 |
+
$button_styles = array();
|
197 |
+
if ( ! empty( $attributes['customBackgroundButtonColor'] ) ) {
|
198 |
+
/**
|
199 |
+
* @psalm-suppress PossiblyNullArgument
|
200 |
+
*/
|
201 |
+
array_push(
|
202 |
+
$button_styles,
|
203 |
+
sprintf(
|
204 |
+
'background-color: %s',
|
205 |
+
sanitize_hex_color( $attributes['customBackgroundButtonColor'] ) ?? 'transparent'
|
206 |
+
)
|
207 |
+
);
|
208 |
+
}
|
209 |
+
if ( ! empty( $attributes['customTextButtonColor'] ) ) {
|
210 |
+
/**
|
211 |
+
* @psalm-suppress PossiblyNullArgument
|
212 |
+
*/
|
213 |
+
array_push(
|
214 |
+
$button_styles,
|
215 |
+
sprintf(
|
216 |
+
'color: %s',
|
217 |
+
sanitize_hex_color( $attributes['customTextButtonColor'] ) ?? 'inherit'
|
218 |
+
)
|
219 |
+
);
|
220 |
+
}
|
221 |
+
$button_styles = implode( ';', $button_styles );
|
222 |
+
|
223 |
+
$login_button = sprintf(
|
224 |
+
'<div class="wp-block-button"><a role="button" href="%1$s" class="%2$s" style="%3$s">%4$s</a></div>',
|
225 |
+
premium_content_subscription_service()->access_url(),
|
226 |
+
empty( $attributes['buttonClasses'] ) ? 'wp-block-button__link' : esc_attr( $attributes['buttonClasses'] ),
|
227 |
+
esc_attr( $button_styles ),
|
228 |
+
empty( $attributes['loginButtonText'] ) ? __( 'Log In', 'premium-content' ) : $attributes['loginButtonText']
|
229 |
+
);
|
230 |
+
|
231 |
+
$subscribe_button = sprintf(
|
232 |
+
'<subscribeButtonText classNames="%1$s" customTextButtonColor="%2$s" customBackgroundButtonColor="%3$s">%4$s</subscribeButtonText>', // I don't know how to pass this data in a different way. We could also turn it into a class and pass it via a variable.
|
233 |
+
empty( $attributes['buttonClasses'] ) ? 'wp-block-button__link' : esc_attr( $attributes['buttonClasses'] ),
|
234 |
+
empty( $attributes['customTextButtonColor'] ) ? '' : esc_attr( $attributes['customTextButtonColor'] ),
|
235 |
+
empty( $attributes['customBackgroundButtonColor'] ) ? '' : esc_attr( $attributes['customBackgroundButtonColor'] ),
|
236 |
+
empty( $attributes['subscribeButtonText'] ) ? __( 'Subscribe' ) : esc_attr( $attributes['subscribeButtonText'] )
|
237 |
+
);
|
238 |
+
|
239 |
+
return $content . "<div class='wp-block-premium-content-logged-out-view__buttons'>{$subscribe_button}{$login_button}</div>";
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* @return void
|
244 |
+
*/
|
245 |
+
function premium_content_paywall_initialize() {
|
246 |
+
$paywall = premium_content_subscription_service();
|
247 |
+
if ( $paywall ) {
|
248 |
+
$paywall->initialize();
|
249 |
+
}
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* @return Subscription_Service
|
254 |
+
*/
|
255 |
+
function premium_content_subscription_service() {
|
256 |
+
$interface = apply_filters( 'earn_premium_content_subscription_service', null );
|
257 |
+
if ( ! $interface instanceof Subscription_Service ) {
|
258 |
+
_doing_it_wrong( __FUNCTION__, 'No Subscription_Service registered for the earn_premium_content_subscription_service filter', 'premium-content' );
|
259 |
+
}
|
260 |
+
return $interface;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* @param ?Subscription_Service $service
|
265 |
+
* @return ?Subscription_Service
|
266 |
+
*/
|
267 |
+
function premium_content_default_service( $service ) {
|
268 |
+
if ( $service !== null ) {
|
269 |
+
return $service;
|
270 |
+
}
|
271 |
+
|
272 |
+
if ( WPCOM_Token_Subscription_Service::available() ) {
|
273 |
+
return new WPCOM_Token_Subscription_Service();
|
274 |
+
}
|
275 |
+
|
276 |
+
if ( Jetpack_Token_Subscription_Service::available() ) {
|
277 |
+
return new Jetpack_Token_Subscription_Service();
|
278 |
+
}
|
279 |
+
|
280 |
+
return new Unconfigured_Subscription_Service();
|
281 |
+
}
|
282 |
+
|
283 |
+
add_action( 'init', 'A8C\FSE\Earn\PremiumContent\premium_content_paywall_initialize', 9 );
|
284 |
+
add_action( 'init', 'A8C\FSE\Earn\PremiumContent\premium_content_block_init' );
|
285 |
+
add_filter( PAYWALL_FILTER, 'A8C\FSE\Earn\PremiumContent\premium_content_default_service' );
|
premium-content/style.css
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* The following styles get applied both on the front of your site
|
3 |
+
* and in the editor.
|
4 |
+
*
|
5 |
+
* Replace them with your own styles or remove the file completely.
|
6 |
+
*/
|
7 |
+
|
8 |
+
.wp-block-premium-content-container {
|
9 |
+
padding: 2px;
|
10 |
+
}
|
11 |
+
|
12 |
+
.premium-content-logged-out-view-button {
|
13 |
+
margin: 5px;
|
14 |
+
}
|
15 |
+
|
16 |
+
.wp-block-premium-content-logged-out-view__buttons {
|
17 |
+
display: flex;
|
18 |
+
margin: 5px;
|
19 |
+
}
|
20 |
+
|
21 |
+
.premium-content-toolbar-button .components-dropdown-menu__toggle::after {
|
22 |
+
display: block;
|
23 |
+
content: "";
|
24 |
+
position: absolute;
|
25 |
+
bottom: 1px;
|
26 |
+
right: 0;
|
27 |
+
border-color: transparent currentColor currentColor transparent;
|
28 |
+
border-style: solid;
|
29 |
+
border-width: 4px;
|
30 |
+
}
|
31 |
+
|
32 |
+
.premium-content-logged-out-view-button.wp-block-button .wp-block-button__link,
|
33 |
+
.wp-block-premium-content-logged-out-view__buttons .wp-block-button .wp-block-button__link {
|
34 |
+
min-width: 200px;
|
35 |
+
margin-right: 20px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.wp-block-premium-content-logged-out-view p:last-child,
|
39 |
+
.wp-block-premium-content-logged-out-view h3 {
|
40 |
+
margin-bottom: 20px;
|
41 |
+
}
|
premium-content/subscription-service/class-jetpack-token-subscription-service.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @package A8C\FSE\Earn
|
5 |
+
*
|
6 |
+
* A paywall that exchanges JWT tokens from WordPress.com to allow
|
7 |
+
* a current visitor to view content that has been deemed "Premium content".
|
8 |
+
*/
|
9 |
+
namespace A8C\FSE\Earn\PremiumContent\SubscriptionService;
|
10 |
+
|
11 |
+
use Automattic\Jetpack\Connection\Manager;
|
12 |
+
|
13 |
+
// phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
|
14 |
+
class Jetpack_Token_Subscription_Service extends Token_Subscription_Service {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @inheritDoc
|
18 |
+
*/
|
19 |
+
public static function available() {
|
20 |
+
return class_exists( '\Jetpack_Options' );
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @inheritDoc
|
25 |
+
* @throws \Exception
|
26 |
+
*/
|
27 |
+
public function get_site_id() {
|
28 |
+
return \Jetpack_Options::get_option( 'id' );
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @inheritDoc
|
33 |
+
*/
|
34 |
+
function get_key() {
|
35 |
+
$token = Manager::get_access_token();
|
36 |
+
if ( ! isset( $token->secret ) ) {
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
return $token->secret;
|
40 |
+
}
|
41 |
+
}
|
premium-content/subscription-service/class-jwt.php
ADDED
@@ -0,0 +1,379 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This is a copy of https://packagist.org/packages/firebase/php-jwt
|
4 |
+
*
|
5 |
+
* Copied here and placed in this namespace due to the complexity of
|
6 |
+
* using composer dependencies with production packages of the FSE
|
7 |
+
* plugin.
|
8 |
+
*/
|
9 |
+
namespace A8C\FSE\Earn\PremiumContent;
|
10 |
+
|
11 |
+
use \DomainException;
|
12 |
+
use \InvalidArgumentException;
|
13 |
+
use \UnexpectedValueException;
|
14 |
+
use \DateTime;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* JSON Web Token implementation, based on this spec:
|
18 |
+
* https://tools.ietf.org/html/rfc7519
|
19 |
+
*
|
20 |
+
* PHP version 5
|
21 |
+
*
|
22 |
+
* @category Authentication
|
23 |
+
* @package Authentication_JWT
|
24 |
+
* @author Neuman Vong <neuman@twilio.com>
|
25 |
+
* @author Anant Narayanan <anant@php.net>
|
26 |
+
* @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
|
27 |
+
* @link https://github.com/firebase/php-jwt
|
28 |
+
*/
|
29 |
+
class JWT {
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* When checking nbf, iat or expiration times,
|
34 |
+
* we want to provide some extra leeway time to
|
35 |
+
* account for clock skew.
|
36 |
+
*/
|
37 |
+
public static $leeway = 0;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Allow the current timestamp to be specified.
|
41 |
+
* Useful for fixing a value within unit testing.
|
42 |
+
*
|
43 |
+
* Will default to PHP time() value if null.
|
44 |
+
*/
|
45 |
+
public static $timestamp = null;
|
46 |
+
|
47 |
+
public static $supported_algs = array(
|
48 |
+
'HS256' => array( 'hash_hmac', 'SHA256' ),
|
49 |
+
'HS512' => array( 'hash_hmac', 'SHA512' ),
|
50 |
+
'HS384' => array( 'hash_hmac', 'SHA384' ),
|
51 |
+
'RS256' => array( 'openssl', 'SHA256' ),
|
52 |
+
'RS384' => array( 'openssl', 'SHA384' ),
|
53 |
+
'RS512' => array( 'openssl', 'SHA512' ),
|
54 |
+
);
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Decodes a JWT string into a PHP object.
|
58 |
+
*
|
59 |
+
* @param string $jwt The JWT
|
60 |
+
* @param string|array $key The key, or map of keys.
|
61 |
+
* If the algorithm used is asymmetric, this is the public key
|
62 |
+
* @param array $allowed_algs List of supported verification algorithms
|
63 |
+
* Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'
|
64 |
+
*
|
65 |
+
* @return object The JWT's payload as a PHP object
|
66 |
+
*
|
67 |
+
* @throws UnexpectedValueException Provided JWT was invalid
|
68 |
+
* @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed
|
69 |
+
* @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf'
|
70 |
+
* @throws BeforeValidException Provided JWT is trying to be used before it's been created as defined by 'iat'
|
71 |
+
* @throws ExpiredException Provided JWT has since expired, as defined by the 'exp' claim
|
72 |
+
*
|
73 |
+
* @uses jsonDecode
|
74 |
+
* @uses urlsafeB64Decode
|
75 |
+
*/
|
76 |
+
public static function decode( $jwt, $key, array $allowed_algs = array() ) {
|
77 |
+
$timestamp = is_null( static::$timestamp ) ? time() : static::$timestamp;
|
78 |
+
|
79 |
+
if ( empty( $key ) ) {
|
80 |
+
throw new InvalidArgumentException( 'Key may not be empty' );
|
81 |
+
}
|
82 |
+
$tks = explode( '.', $jwt );
|
83 |
+
if ( count( $tks ) != 3 ) {
|
84 |
+
throw new UnexpectedValueException( 'Wrong number of segments' );
|
85 |
+
}
|
86 |
+
list($headb64, $bodyb64, $cryptob64) = $tks;
|
87 |
+
if ( null === ( $header = static::jsonDecode( static::urlsafeB64Decode( $headb64 ) ) ) ) {
|
88 |
+
throw new UnexpectedValueException( 'Invalid header encoding' );
|
89 |
+
}
|
90 |
+
if ( null === $payload = static::jsonDecode( static::urlsafeB64Decode( $bodyb64 ) ) ) {
|
91 |
+
throw new UnexpectedValueException( 'Invalid claims encoding' );
|
92 |
+
}
|
93 |
+
if ( false === ( $sig = static::urlsafeB64Decode( $cryptob64 ) ) ) {
|
94 |
+
throw new UnexpectedValueException( 'Invalid signature encoding' );
|
95 |
+
}
|
96 |
+
if ( empty( $header->alg ) ) {
|
97 |
+
throw new UnexpectedValueException( 'Empty algorithm' );
|
98 |
+
}
|
99 |
+
if ( empty( static::$supported_algs[ $header->alg ] ) ) {
|
100 |
+
throw new UnexpectedValueException( 'Algorithm not supported' );
|
101 |
+
}
|
102 |
+
if ( ! in_array( $header->alg, $allowed_algs ) ) {
|
103 |
+
throw new UnexpectedValueException( 'Algorithm not allowed' );
|
104 |
+
}
|
105 |
+
if ( is_array( $key ) || $key instanceof \ArrayAccess ) {
|
106 |
+
if ( isset( $header->kid ) ) {
|
107 |
+
if ( ! isset( $key[ $header->kid ] ) ) {
|
108 |
+
throw new UnexpectedValueException( '"kid" invalid, unable to lookup correct key' );
|
109 |
+
}
|
110 |
+
$key = $key[ $header->kid ];
|
111 |
+
} else {
|
112 |
+
throw new UnexpectedValueException( '"kid" empty, unable to lookup correct key' );
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
// Check the signature
|
117 |
+
if ( ! static::verify( "$headb64.$bodyb64", $sig, $key, $header->alg ) ) {
|
118 |
+
throw new SignatureInvalidException( 'Signature verification failed' );
|
119 |
+
}
|
120 |
+
|
121 |
+
// Check if the nbf if it is defined. This is the time that the
|
122 |
+
// token can actually be used. If it's not yet that time, abort.
|
123 |
+
if ( isset( $payload->nbf ) && $payload->nbf > ( $timestamp + static::$leeway ) ) {
|
124 |
+
throw new BeforeValidException(
|
125 |
+
'Cannot handle token prior to ' . date( DateTime::ISO8601, $payload->nbf )
|
126 |
+
);
|
127 |
+
}
|
128 |
+
|
129 |
+
// Check that this token has been created before 'now'. This prevents
|
130 |
+
// using tokens that have been created for later use (and haven't
|
131 |
+
// correctly used the nbf claim).
|
132 |
+
if ( isset( $payload->iat ) && $payload->iat > ( $timestamp + static::$leeway ) ) {
|
133 |
+
throw new BeforeValidException(
|
134 |
+
'Cannot handle token prior to ' . date( DateTime::ISO8601, $payload->iat )
|
135 |
+
);
|
136 |
+
}
|
137 |
+
|
138 |
+
// Check if this token has expired.
|
139 |
+
if ( isset( $payload->exp ) && ( $timestamp - static::$leeway ) >= $payload->exp ) {
|
140 |
+
throw new ExpiredException( 'Expired token' );
|
141 |
+
}
|
142 |
+
|
143 |
+
return $payload;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Converts and signs a PHP object or array into a JWT string.
|
148 |
+
*
|
149 |
+
* @param object|array $payload PHP object or array
|
150 |
+
* @param string $key The secret key.
|
151 |
+
* If the algorithm used is asymmetric, this is the private key
|
152 |
+
* @param string $alg The signing algorithm.
|
153 |
+
* Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'
|
154 |
+
* @param mixed $keyId
|
155 |
+
* @param array $head An array with header elements to attach
|
156 |
+
*
|
157 |
+
* @return string A signed JWT
|
158 |
+
*
|
159 |
+
* @uses jsonEncode
|
160 |
+
* @uses urlsafeB64Encode
|
161 |
+
*/
|
162 |
+
public static function encode( $payload, $key, $alg = 'HS256', $keyId = null, $head = null ) {
|
163 |
+
$header = array(
|
164 |
+
'typ' => 'JWT',
|
165 |
+
'alg' => $alg,
|
166 |
+
);
|
167 |
+
if ( $keyId !== null ) {
|
168 |
+
$header['kid'] = $keyId;
|
169 |
+
}
|
170 |
+
if ( isset( $head ) && is_array( $head ) ) {
|
171 |
+
$header = array_merge( $head, $header );
|
172 |
+
}
|
173 |
+
$segments = array();
|
174 |
+
$segments[] = static::urlsafeB64Encode( static::jsonEncode( $header ) );
|
175 |
+
$segments[] = static::urlsafeB64Encode( static::jsonEncode( $payload ) );
|
176 |
+
$signing_input = implode( '.', $segments );
|
177 |
+
|
178 |
+
$signature = static::sign( $signing_input, $key, $alg );
|
179 |
+
$segments[] = static::urlsafeB64Encode( $signature );
|
180 |
+
|
181 |
+
return implode( '.', $segments );
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Sign a string with a given key and algorithm.
|
186 |
+
*
|
187 |
+
* @param string $msg The message to sign
|
188 |
+
* @param string|resource $key The secret key
|
189 |
+
* @param string $alg The signing algorithm.
|
190 |
+
* Supported algorithms are 'HS256', 'HS384', 'HS512' and 'RS256'
|
191 |
+
*
|
192 |
+
* @return string An encrypted message
|
193 |
+
*
|
194 |
+
* @throws DomainException Unsupported algorithm was specified
|
195 |
+
*/
|
196 |
+
public static function sign( $msg, $key, $alg = 'HS256' ) {
|
197 |
+
if ( empty( static::$supported_algs[ $alg ] ) ) {
|
198 |
+
throw new DomainException( 'Algorithm not supported' );
|
199 |
+
}
|
200 |
+
list($function, $algorithm) = static::$supported_algs[ $alg ];
|
201 |
+
switch ( $function ) {
|
202 |
+
case 'hash_hmac':
|
203 |
+
return hash_hmac( $algorithm, $msg, $key, true );
|
204 |
+
case 'openssl':
|
205 |
+
$signature = '';
|
206 |
+
$success = openssl_sign( $msg, $signature, $key, $algorithm );
|
207 |
+
if ( ! $success ) {
|
208 |
+
throw new DomainException( 'OpenSSL unable to sign data' );
|
209 |
+
} else {
|
210 |
+
return $signature;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Verify a signature with the message, key and method. Not all methods
|
217 |
+
* are symmetric, so we must have a separate verify and sign method.
|
218 |
+
*
|
219 |
+
* @param string $msg The original message (header and body)
|
220 |
+
* @param string $signature The original signature
|
221 |
+
* @param string|resource $key For HS*, a string key works. for RS*, must be a resource of an openssl public key
|
222 |
+
* @param string $alg The algorithm
|
223 |
+
*
|
224 |
+
* @return bool
|
225 |
+
*
|
226 |
+
* @throws DomainException Invalid Algorithm or OpenSSL failure
|
227 |
+
*/
|
228 |
+
private static function verify( $msg, $signature, $key, $alg ) {
|
229 |
+
if ( empty( static::$supported_algs[ $alg ] ) ) {
|
230 |
+
throw new DomainException( 'Algorithm not supported' );
|
231 |
+
}
|
232 |
+
|
233 |
+
list($function, $algorithm) = static::$supported_algs[ $alg ];
|
234 |
+
switch ( $function ) {
|
235 |
+
case 'openssl':
|
236 |
+
$success = openssl_verify( $msg, $signature, $key, $algorithm );
|
237 |
+
if ( $success === 1 ) {
|
238 |
+
return true;
|
239 |
+
} elseif ( $success === 0 ) {
|
240 |
+
return false;
|
241 |
+
}
|
242 |
+
// returns 1 on success, 0 on failure, -1 on error.
|
243 |
+
throw new DomainException(
|
244 |
+
'OpenSSL error: ' . openssl_error_string()
|
245 |
+
);
|
246 |
+
case 'hash_hmac':
|
247 |
+
default:
|
248 |
+
$hash = hash_hmac( $algorithm, $msg, $key, true );
|
249 |
+
if ( function_exists( 'hash_equals' ) ) {
|
250 |
+
return hash_equals( $signature, $hash );
|
251 |
+
}
|
252 |
+
$len = min( static::safeStrlen( $signature ), static::safeStrlen( $hash ) );
|
253 |
+
|
254 |
+
$status = 0;
|
255 |
+
for ( $i = 0; $i < $len; $i++ ) {
|
256 |
+
$status |= ( ord( $signature[ $i ] ) ^ ord( $hash[ $i ] ) );
|
257 |
+
}
|
258 |
+
$status |= ( static::safeStrlen( $signature ) ^ static::safeStrlen( $hash ) );
|
259 |
+
|
260 |
+
return ( $status === 0 );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Decode a JSON string into a PHP object.
|
266 |
+
*
|
267 |
+
* @param string $input JSON string
|
268 |
+
*
|
269 |
+
* @return object Object representation of JSON string
|
270 |
+
*
|
271 |
+
* @throws DomainException Provided string was invalid JSON
|
272 |
+
*/
|
273 |
+
public static function jsonDecode( $input ) {
|
274 |
+
if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) && ! ( defined( 'JSON_C_VERSION' ) && PHP_INT_SIZE > 4 ) ) {
|
275 |
+
/** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
|
276 |
+
* to specify that large ints (like Steam Transaction IDs) should be treated as
|
277 |
+
* strings, rather than the PHP default behaviour of converting them to floats.
|
278 |
+
*/
|
279 |
+
$obj = json_decode( $input, false, 512, JSON_BIGINT_AS_STRING );
|
280 |
+
} else {
|
281 |
+
/** Not all servers will support that, however, so for older versions we must
|
282 |
+
* manually detect large ints in the JSON string and quote them (thus converting
|
283 |
+
*them to strings) before decoding, hence the preg_replace() call.
|
284 |
+
*/
|
285 |
+
$max_int_length = strlen( (string) PHP_INT_MAX ) - 1;
|
286 |
+
$json_without_bigints = preg_replace( '/:\s*(-?\d{' . $max_int_length . ',})/', ': "$1"', $input );
|
287 |
+
$obj = json_decode( $json_without_bigints );
|
288 |
+
}
|
289 |
+
|
290 |
+
if ( function_exists( 'json_last_error' ) && $errno = json_last_error() ) {
|
291 |
+
static::handleJsonError( $errno );
|
292 |
+
} elseif ( $obj === null && $input !== 'null' ) {
|
293 |
+
throw new DomainException( 'Null result with non-null input' );
|
294 |
+
}
|
295 |
+
return $obj;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Encode a PHP object into a JSON string.
|
300 |
+
*
|
301 |
+
* @param object|array $input A PHP object or array
|
302 |
+
*
|
303 |
+
* @return string JSON representation of the PHP object or array
|
304 |
+
*
|
305 |
+
* @throws DomainException Provided object could not be encoded to valid JSON
|
306 |
+
*/
|
307 |
+
public static function jsonEncode( $input ) {
|
308 |
+
$json = json_encode( $input );
|
309 |
+
if ( function_exists( 'json_last_error' ) && $errno = json_last_error() ) {
|
310 |
+
static::handleJsonError( $errno );
|
311 |
+
} elseif ( $json === 'null' && $input !== null ) {
|
312 |
+
throw new DomainException( 'Null result with non-null input' );
|
313 |
+
}
|
314 |
+
return $json;
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Decode a string with URL-safe Base64.
|
319 |
+
*
|
320 |
+
* @param string $input A Base64 encoded string
|
321 |
+
*
|
322 |
+
* @return string A decoded string
|
323 |
+
*/
|
324 |
+
public static function urlsafeB64Decode( $input ) {
|
325 |
+
$remainder = strlen( $input ) % 4;
|
326 |
+
if ( $remainder ) {
|
327 |
+
$padlen = 4 - $remainder;
|
328 |
+
$input .= str_repeat( '=', $padlen );
|
329 |
+
}
|
330 |
+
return base64_decode( strtr( $input, '-_', '+/' ) );
|
331 |
+
}
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Encode a string with URL-safe Base64.
|
335 |
+
*
|
336 |
+
* @param string $input The string you want encoded
|
337 |
+
*
|
338 |
+
* @return string The base64 encode of what you passed in
|
339 |
+
*/
|
340 |
+
public static function urlsafeB64Encode( $input ) {
|
341 |
+
return str_replace( '=', '', strtr( base64_encode( $input ), '+/', '-_' ) );
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Helper method to create a JSON error.
|
346 |
+
*
|
347 |
+
* @param int $errno An error number from json_last_error()
|
348 |
+
*
|
349 |
+
* @return void
|
350 |
+
*/
|
351 |
+
private static function handleJsonError( $errno ) {
|
352 |
+
$messages = array(
|
353 |
+
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
|
354 |
+
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',
|
355 |
+
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
|
356 |
+
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
|
357 |
+
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters', // PHP >= 5.3.3
|
358 |
+
);
|
359 |
+
throw new DomainException(
|
360 |
+
isset( $messages[ $errno ] )
|
361 |
+
? $messages[ $errno ]
|
362 |
+
: 'Unknown JSON error: ' . $errno
|
363 |
+
);
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Get the number of bytes in cryptographic strings.
|
368 |
+
*
|
369 |
+
* @param string
|
370 |
+
*
|
371 |
+
* @return int
|
372 |
+
*/
|
373 |
+
private static function safeStrlen( $str ) {
|
374 |
+
if ( function_exists( 'mb_strlen' ) ) {
|
375 |
+
return mb_strlen( $str, '8bit' );
|
376 |
+
}
|
377 |
+
return strlen( $str );
|
378 |
+
}
|
379 |
+
}
|
premium-content/subscription-service/class-subscription-service.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
/**
|
3 |
+
* @package A8C\FSE\Earn\PremiumContent;
|
4 |
+
*
|
5 |
+
* The Subscription Service represents the entity responsible for making sure a visitor
|
6 |
+
* can see blocks that are considered premium content.
|
7 |
+
*
|
8 |
+
* If a visitor is not allowed to see they need to be given a way gain access.
|
9 |
+
*
|
10 |
+
* It is assumed that it will be a monetary exchange but that is up to the host
|
11 |
+
* that brokers the content exchange.
|
12 |
+
*/
|
13 |
+
namespace A8C\FSE\Earn\PremiumContent\SubscriptionService;
|
14 |
+
|
15 |
+
interface Subscription_Service {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* The subscription service can be used.
|
19 |
+
*
|
20 |
+
* @return boolean
|
21 |
+
*/
|
22 |
+
static function available();
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Allows a Subscription Service to setup anything it needs to provide its features.
|
26 |
+
*
|
27 |
+
* This is called during an `init` action hook callback.
|
28 |
+
*
|
29 |
+
* Examples of things a Service may want to do here:
|
30 |
+
* - Determine a visitor is arriving with a new token to unlock content and
|
31 |
+
* store the token for future browsing (e.g. in a cookie)
|
32 |
+
* - Set up WP-API endpoints necessary for the function to work
|
33 |
+
* - Token refreshes
|
34 |
+
*
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
+
function initialize();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Given a token (this could be from a cookie, a querystring, or some other means)
|
41 |
+
* can the visitor see the premium content?
|
42 |
+
*
|
43 |
+
* @param int[] $valid_plan_ids
|
44 |
+
*
|
45 |
+
* @return boolean
|
46 |
+
*/
|
47 |
+
function visitor_can_view_content( $valid_plan_ids );
|
48 |
+
|
49 |
+
/**
|
50 |
+
* The current visitor would like to obtain access. Where do they go?
|
51 |
+
*
|
52 |
+
* @param ('subscribe'|'login') $mode
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
function access_url( $mode = 'subscribe' );
|
56 |
+
}
|
premium-content/subscription-service/class-token-subscription-service.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
/**
|
3 |
+
* @package A8C\FSE\Earn
|
4 |
+
*
|
5 |
+
* A paywall that exchanges JWT tokens from WordPress.com to allow
|
6 |
+
* a current visitor to view content that has been deemed "Premium content".
|
7 |
+
*/
|
8 |
+
namespace A8C\FSE\Earn\PremiumContent\SubscriptionService;
|
9 |
+
|
10 |
+
use A8C\FSE\Earn\PremiumContent\JWT;
|
11 |
+
|
12 |
+
// phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
|
13 |
+
abstract class Token_Subscription_Service implements Subscription_Service {
|
14 |
+
|
15 |
+
|
16 |
+
const JWT_AUTH_TOKEN_COOKIE_NAME = 'jp-premium-content-session';
|
17 |
+
const DECODE_EXCEPTION_FEATURE = 'memberships';
|
18 |
+
const DECODE_EXCEPTION_MESSAGE = 'Problem decoding provided token';
|
19 |
+
const REST_URL_ORIGIN = 'https://subscribe.wordpress.com/';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @inheritDoc
|
23 |
+
*/
|
24 |
+
public function initialize() {
|
25 |
+
$token = $this->token_from_request();
|
26 |
+
if ( $token !== null ) {
|
27 |
+
$this->set_token_cookie( $token );
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The user is visiting with a subscriber token cookie.
|
33 |
+
*
|
34 |
+
* This is theoretically where the cookie JWT signature verification
|
35 |
+
* thing will happen.
|
36 |
+
*
|
37 |
+
* How to obtain one of these (or what exactly it is) is
|
38 |
+
* still a WIP (see api/auth branch)
|
39 |
+
*
|
40 |
+
* @inheritDoc
|
41 |
+
*/
|
42 |
+
public function visitor_can_view_content( $valid_plan_ids ) {
|
43 |
+
|
44 |
+
// URL token always has a precedence, so it can overwrite the cookie when new data available.
|
45 |
+
$token = $this->token_from_request();
|
46 |
+
if ( $token ) {
|
47 |
+
$this->set_token_cookie( $token );
|
48 |
+
} else {
|
49 |
+
$token = $this->token_from_cookie();
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( empty( $token ) ) {
|
53 |
+
// no token, no access
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
$payload = $this->decode_token( $token );
|
58 |
+
if ( empty( $payload ) ) {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
$subscriptions = (array) $payload['subscriptions'];
|
63 |
+
return $this->validate_subscriptions( $valid_plan_ids, $subscriptions );
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param string $token
|
68 |
+
*
|
69 |
+
* @return array|false
|
70 |
+
*/
|
71 |
+
public function decode_token( $token ) {
|
72 |
+
try {
|
73 |
+
$key = $this->get_key();
|
74 |
+
return $key ? (array) JWT::decode( $token, $key, array( 'HS256' ) ) : false;
|
75 |
+
} catch ( \Exception $exception ) {
|
76 |
+
// TODO: The SignatureInvalidException is in a different namespace from JWT, so if we want to catch that
|
77 |
+
// one specifically then we'll have to alias it.
|
78 |
+
$logstash = array(
|
79 |
+
'feature' => self::DECODE_EXCEPTION_FEATURE,
|
80 |
+
'message' => self::DECODE_EXCEPTION_MESSAGE,
|
81 |
+
'extra' => json_encode( compact( 'exception', 'token' ) ),
|
82 |
+
);
|
83 |
+
// phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
|
84 |
+
log2logstash( $logstash );
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @return string|false
|
91 |
+
*/
|
92 |
+
abstract function get_key();
|
93 |
+
|
94 |
+
/**
|
95 |
+
* @return int
|
96 |
+
*/
|
97 |
+
abstract function get_site_id();
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @inheritDoc
|
101 |
+
*/
|
102 |
+
public function access_url( $mode = 'subscribe' ) {
|
103 |
+
global $wp;
|
104 |
+
$permalink = get_permalink();
|
105 |
+
if ( empty( $permalink ) ) {
|
106 |
+
$permalink = add_query_arg( $wp->query_vars, home_url( $wp->request ) );
|
107 |
+
}
|
108 |
+
|
109 |
+
$login_url = $this->get_rest_api_token_url( $this->get_site_id(), $permalink );
|
110 |
+
return $login_url;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @return ?string
|
115 |
+
*/
|
116 |
+
private function token_from_cookie() {
|
117 |
+
if ( isset( $_COOKIE[ self::JWT_AUTH_TOKEN_COOKIE_NAME ] ) ) {
|
118 |
+
return $_COOKIE[ self::JWT_AUTH_TOKEN_COOKIE_NAME ];
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @param string $token
|
124 |
+
* @return void
|
125 |
+
*/
|
126 |
+
private function set_token_cookie( $token ) {
|
127 |
+
if ( ! empty( $token ) ) {
|
128 |
+
setcookie( self::JWT_AUTH_TOKEN_COOKIE_NAME, $token, 0, '/' );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* @return ?string
|
134 |
+
*/
|
135 |
+
private function token_from_request() {
|
136 |
+
$token = null;
|
137 |
+
if ( isset( $_GET['token'] ) ) {
|
138 |
+
if ( preg_match( '/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/', $_GET['token'], $matches ) ) {
|
139 |
+
// token matches a valid JWT token pattern
|
140 |
+
$token = reset( $matches );
|
141 |
+
}
|
142 |
+
}
|
143 |
+
return $token;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Return true if any ID/date pairs are valid. Otherwise false.
|
148 |
+
*
|
149 |
+
* @param int[] $valid_plan_ids
|
150 |
+
* @param array<int, Token_Subscription> $token_subscriptions : ID must exist in the provided <code>$valid_subscriptions</code> parameter.
|
151 |
+
* The provided end date needs to be greater than <code>now()</code>.
|
152 |
+
*
|
153 |
+
* @return bool
|
154 |
+
*/
|
155 |
+
private function validate_subscriptions( $valid_plan_ids, $token_subscriptions ) {
|
156 |
+
// Create a list of product_ids to compare against:
|
157 |
+
$product_ids = array();
|
158 |
+
foreach ( $valid_plan_ids as $plan_id ) {
|
159 |
+
$product_id = (int) get_post_meta( $plan_id, 'jetpack_memberships_product_id', true );
|
160 |
+
if ( isset( $product_id ) ) {
|
161 |
+
$product_ids[] = $product_id;
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* @var int $product_id
|
167 |
+
* @var Token_Subscription $token_subscription
|
168 |
+
*/
|
169 |
+
foreach ( $token_subscriptions as $product_id => $token_subscription ) {
|
170 |
+
if ( in_array( $product_id, $product_ids, true ) && strtotime( $token_subscription->end_date ) > time() ) {
|
171 |
+
return true;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
return false;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* @param int $site_id
|
179 |
+
* @param string $redirect_url
|
180 |
+
* @return string
|
181 |
+
*/
|
182 |
+
private function get_rest_api_token_url( $site_id, $redirect_url ) {
|
183 |
+
return sprintf( '%smemberships/jwt?site_id=%d&redirect_url=%s', self::REST_URL_ORIGIN, $site_id, urlencode( $redirect_url ) );
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|
premium-content/subscription-service/class-token-subscription.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
|
3 |
+
namespace A8C\FSE\Earn\PremiumContent\SubscriptionService;
|
4 |
+
|
5 |
+
class Token_Subscription {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* @var string
|
9 |
+
*/
|
10 |
+
public $end_date = '';
|
11 |
+
}
|
premium-content/subscription-service/class-unconfigured-subscription-service.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
/**
|
3 |
+
* @package A8C\FSE\Earn
|
4 |
+
*
|
5 |
+
* The environment does not have a subscription service available.
|
6 |
+
*
|
7 |
+
* This represents this scenario.
|
8 |
+
*/
|
9 |
+
namespace A8C\FSE\Earn\PremiumContent\SubscriptionService;
|
10 |
+
|
11 |
+
use function site_url;
|
12 |
+
|
13 |
+
class Unconfigured_Subscription_Service implements Subscription_Service {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Is always available because it is the fallback.
|
17 |
+
*
|
18 |
+
* @inheritDoc
|
19 |
+
*/
|
20 |
+
public static function available() {
|
21 |
+
return true;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @inheritDoc
|
26 |
+
*/
|
27 |
+
function initialize() {
|
28 |
+
// noop
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* No subscription service available, no users can see this content.
|
33 |
+
*
|
34 |
+
* @inheritDoc
|
35 |
+
*/
|
36 |
+
function visitor_can_view_content( $valid_plan_ids ) {
|
37 |
+
return false;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The current visitor would like to obtain access. Where do they go?
|
42 |
+
*
|
43 |
+
* @inheritDoc
|
44 |
+
*/
|
45 |
+
function access_url( $mode = 'subscribe' ) {
|
46 |
+
return site_url();
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
premium-content/subscription-service/class-wpcom-token-subscription-service.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
/**
|
3 |
+
* @package A8C\FSE\Earn
|
4 |
+
*
|
5 |
+
* A paywall that exchanges JWT tokens from WordPress.com to allow
|
6 |
+
* a current visitor to view content that has been deemed "Premium content".
|
7 |
+
*/
|
8 |
+
namespace A8C\FSE\Earn\PremiumContent\SubscriptionService;
|
9 |
+
|
10 |
+
// phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
|
11 |
+
class WPCOM_Token_Subscription_Service extends Token_Subscription_Service {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @inheritDoc
|
15 |
+
*/
|
16 |
+
public static function available() {
|
17 |
+
// phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
|
18 |
+
return defined( 'IS_WPCOM' ) && IS_WPCOM === true;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @inheritDoc
|
23 |
+
*/
|
24 |
+
public function get_site_id() {
|
25 |
+
return get_current_blog_id();
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @inheritDoc
|
30 |
+
*/
|
31 |
+
function get_key() {
|
32 |
+
// phpcs:ignore ImportDetection.Imports.RequireImports.Symbol
|
33 |
+
return defined( 'EARN_JWT_SIGNING_KEY' ) ? EARN_JWT_SIGNING_KEY : false;
|
34 |
+
}
|
35 |
+
}
|
premium-content/subscription-service/include.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php declare( strict_types = 1 );
|
2 |
+
|
3 |
+
require_once __DIR__ . '/class-jwt.php';
|
4 |
+
require_once __DIR__ . '/class-subscription-service.php';
|
5 |
+
require_once __DIR__ . '/class-token-subscription.php';
|
6 |
+
require_once __DIR__ . '/class-token-subscription-service.php';
|
7 |
+
require_once __DIR__ . '/class-wpcom-token-subscription-service.php';
|
8 |
+
require_once __DIR__ . '/class-jetpack-token-subscription-service.php';
|
9 |
+
require_once __DIR__ . '/class-unconfigured-subscription-service.php';
|
premium-content/view.js
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*global jQuery */
|
2 |
+
jQuery( document ).ready( function () {
|
3 |
+
function updateQueryStringParameter( uri, key, value ) {
|
4 |
+
const re = new RegExp( '([?&])' + key + '=.*?(&|$)', 'i' );
|
5 |
+
const separator = uri.indexOf( '?' ) !== -1 ? '&' : '?';
|
6 |
+
if ( uri.match( re ) ) {
|
7 |
+
return uri.replace( re, '$1' + key + '=' + value + '$2' );
|
8 |
+
}
|
9 |
+
return uri + separator + key + '=' + value;
|
10 |
+
}
|
11 |
+
let premiumContentJWTToken = '';
|
12 |
+
|
13 |
+
window.addEventListener(
|
14 |
+
'message',
|
15 |
+
function handleIframeResult( eventFromIframe ) {
|
16 |
+
if ( eventFromIframe.origin === 'https://subscribe.wordpress.com' && eventFromIframe.data ) {
|
17 |
+
const data = JSON.parse( eventFromIframe.data );
|
18 |
+
if ( data && data.result && data.result.jwt_token ) {
|
19 |
+
// We save the token for now, doing nothing.
|
20 |
+
premiumContentJWTToken = data.result.jwt_token;
|
21 |
+
// We will also set this in a cookie - just in case. This will be reloaded in the refresh, when user clicks OK.
|
22 |
+
// But user can close the browser window before clicking OK. IN that case, we want to leave a cookie behind.
|
23 |
+
const date = new Date();
|
24 |
+
date.setTime( date.getTime() + 365 * 24 * 60 * 60 * 1000 );
|
25 |
+
document.cookie =
|
26 |
+
'jp-premium-content-session' +
|
27 |
+
'=' +
|
28 |
+
premiumContentJWTToken +
|
29 |
+
'; expires=' +
|
30 |
+
date.toGMTString() +
|
31 |
+
'; path=/';
|
32 |
+
}
|
33 |
+
if ( data && data.action === 'close' && premiumContentJWTToken ) {
|
34 |
+
document.location.href = updateQueryStringParameter(
|
35 |
+
document.location.href,
|
36 |
+
'token',
|
37 |
+
premiumContentJWTToken
|
38 |
+
);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
},
|
42 |
+
false
|
43 |
+
);
|
44 |
+
} );
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: alexislloyd, allancole, automattic, bartkalisz, codebykat, copons,
|
|
3 |
Tags: block, blocks, editor, gutenberg, page
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 1.
|
7 |
Requires PHP: 5.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -41,6 +41,13 @@ This plugin is experimental, so we don't provide any support for it outside of w
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 1.1 =
|
45 |
* New block patterns.
|
46 |
* Performance and style improvements.
|
3 |
Tags: block, blocks, editor, gutenberg, page
|
4 |
Requires at least: 5.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 1.2
|
7 |
Requires PHP: 5.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 1.2 =
|
45 |
+
* New Posts Carousel block.
|
46 |
+
* New Premium Content block.
|
47 |
+
* Update header button styling and full width block margins for Gutenberg v8.0.0.
|
48 |
+
* Only load common module assets if they are required.
|
49 |
+
* Remove loading of blank.css for Global Styles.
|
50 |
+
|
51 |
= 1.1 =
|
52 |
* New block patterns.
|
53 |
* Performance and style improvements.
|
starter-page-templates/dist/starter-page-templates.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => 'd29cec8cad031a3b41e8e209ccbe58c9');
|
starter-page-templates/dist/starter-page-templates.js
CHANGED
@@ -3,4 +3,4 @@
|
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
-
*/!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)&&r.length){var a=i.apply(null,r);a&&e.push(a)}else if("object"===o)for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){var r=n(3);function i(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}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(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)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(29);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(30),i=n(31),o=n(32);e.exports=function(e){return function(){var t,n=r(e);if(i()){var a=r(this).constructor;t=Reflect.construct(n,arguments,a)}else t=n.apply(this,arguments);return o(this,t)}}},function(e,t){!function(){e.exports=this.wp.blocks}()},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){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t,n){var r=n(36),i=n(37),o=n(22),a=n(38);e.exports=function(e,t){return r(e)||i(e,t)||o(e,t)||a()}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){function n(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(l){return void n(l)}s.done?t(c):Promise.resolve(c).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function s(e){n(a,i,o,s,c,"next",e)}function c(e){n(a,i,o,s,c,"throw",e)}s(void 0)}))}}},function(e,t,n){var r=n(39),i=n(40),o=n(22),a=n(41);e.exports=function(e){return r(e)||i(e)||o(e)||a()}},function(e,t,n){var r=n(23);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 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}},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.editor}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t,n){var r=n(42);e.exports=function(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t){e.exports=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}}},function(e,t,n){var r=n(33),i=n(4);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){!function(){e.exports=this.wp.nux}()},function(e,t,n){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(c){i=!0,o=c}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){var r=n(23);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}},function(e,t,n){"use strict";n.r(t);var r=n(15),i=n.n(r),o=n(0),a=n(2),s=n(16),c=n(6),l=n(24),u=n(9),p=n.n(u),m=n(10),d=n.n(m),f=n(11),b=n.n(f),g=n(4),O=n.n(g),v=n(12),h=n.n(v),y=n(13),j=n.n(y),_=n(3),w=n.n(_),T=n(1),P=n(8),k=n.n(P),E=(n(34),n(7)),S=n(5),x=n(14),B=n(17),I=(n(35),n(18)),C=n.n(I),N=n(19),A=n(25),L=function(e){var t=e.blocks,n=e.settings,r=e.hidePageTitle,i=e.recomputeBlockListKey;return Object(o.createElement)(N.BlockEditorProvider,{value:t,settings:n},Object(o.createElement)(S.Disabled,{key:i},!r&&Object(o.createElement)("div",{className:"block-iframe-preview__template-title"},Object(o.createElement)(A.PostTitle,null)),Object(o.createElement)(N.BlockList,null)))},D=Object(E.compose)(E.withSafeTimeout,Object(c.withSelect)((function(e){var t=e("core/block-editor");return{settings:t?t.getSettings():{}}})))((function(e){var t=e.className,n=void 0===t?"block-iframe-preview":t,r=e.bodyClassName,i=void 0===r?"block-iframe-preview-body":r,s=e.viewportWidth,c=e.blocks,l=e.settings,u=e.setTimeout,p=void 0===u?T.noop:u,m=e.title,d=Object(o.useRef)(),f=Object(o.useRef)(),b=Object(o.useRef)(),g=Object(o.useState)({transform:"scale( 1 )"}),O=C()(g,2),v=O[0],h=O[1],y=Object(o.useMemo)((function(){return Object(T.castArray)(c)}),[c]),j=Object(o.useReducer)((function(e){return e+1}),0),_=C()(j,2),w=_[0],P=_[1];Object(o.useLayoutEffect)(P,[c]);var E=Object(o.useCallback)((function(){var e=Object(T.get)(d,["current","parentNode"]);if(e){var t=s||d.current.offsetWidth,n=e.offsetWidth/s,r=e.offsetHeight/n;h({width:t,height:r,transform:"scale( ".concat(n," )")})}}),[s]);return Object(o.useEffect)((function(){if(m){var e=Object(T.get)(b,["current","contentDocument","body"]);if(e){var t=e.querySelector(".editor-post-title .editor-post-title__input");t&&(t.value=m)}}}),[w]),Object(o.useEffect)((function(){p((function(){var e,t,n,r;e=window.document,t=b.current.contentDocument,n=["link","style"],r={head:document.createDocumentFragment(),body:document.createDocumentFragment()},Object(T.each)(Object.keys(r),(function(t){return Object(T.each)(Object(T.filter)(e[t].children,(function(e){var t=e.localName;return(n.includes(t))})),(function(e){r[t].appendChild(e.cloneNode(!0))}))})),t.head.appendChild(r.head),t.body.appendChild(r.body),b.current.contentDocument.body.classList.add(i,"editor-styles-wrapper","block-editor__container"),E()}),0)}),[p,i,E]),Object(o.useEffect)((function(){var e=Object(T.get)(b,["current","contentDocument","body"]);e&&(e.scrollTop=0)}),[w]),Object(o.useEffect)((function(){var e=f&&f.current;e&&b.current.contentDocument.body.appendChild(e)}),[w]),Object(o.useEffect)((function(){var e=Object(T.debounce)(E,300);return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[E]),Object(o.useEffect)((function(){return window.jQuery&&window.jQuery(window.document).on("wp-collapse-menu",E),function(){window.jQuery&&window.jQuery(window.document).off("wp-collapse-menu",E)}}),[E]),Object(o.createElement)("div",{ref:d},Object(o.createElement)("iframe",{ref:b,title:Object(a.__)("Preview"),className:k()("editor-styles-wrapper",n),style:v}),Object(o.createElement)("div",{ref:f,className:"block-editor"},Object(o.createElement)("div",{className:"edit-post-visual-editor"},Object(o.createElement)("div",{className:"editor-styles-wrapper"},Object(o.createElement)("div",{className:"editor-writing-flow"},Object(o.createElement)(L,{blocks:y,settings:l,hidePageTitle:!m,recomputeBlockListKey:w}))))))})),M=function(e){var t=e.id,n=e.value,r=e.onSelect,i=e.label,a=e.useDynamicPreview,s=void 0!==a&&a,c=e.staticPreviewImg,l=e.staticPreviewImgAlt,u=void 0===l?"":l,p=e.blocks,m=void 0===p?[]:p,d=e.isSelected;if(Object(T.isNil)(t)||Object(T.isNil)(i)||Object(T.isNil)(n))return null;if(s&&(Object(T.isNil)(m)||Object(T.isEmpty)(m)))return null;var f=s?Object(o.createElement)(S.Disabled,null,Object(o.createElement)(D,{blocks:m,viewportWidth:960})):Object(o.createElement)("img",{className:"template-selector-item__media",src:c,alt:u}),b="label-".concat(t,"-").concat(n);return Object(o.createElement)("button",{type:"button",className:k()("template-selector-item__label",{"is-selected":d}),value:n,onClick:function(){r(n)},"aria-labelledby":"".concat(t," ").concat(b)},Object(o.createElement)("span",{className:"template-selector-item__preview-wrap"},f))},F={Address:Object(a._x)("123 Main St","default address","full-site-editing"),Phone:Object(a._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(a._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(a._x)("Business","default vertical name","full-site-editing")},W={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?e.replace(/{{(\w+)}}/g,(function(e,n){var r=F[n];return t[W[n]]||r||n})):""},U=Object(E.compose)(o.memo,E.withInstanceId)((function(e){var t=e.label,n=e.className,r=e.help,i=e.instanceId,a=e.templates,s=void 0===a?[]:a,c=e.blocksByTemplates,l=void 0===c?{}:c,u=e.useDynamicPreview,p=void 0!==u&&u,m=e.onTemplateSelect,d=void 0===m?T.noop:m,f=e.siteInformation,b=void 0===f?{}:f,g=e.selectedTemplate;if(Object(T.isEmpty)(s)||!Object(T.isArray)(s))return null;if(!0===p&&Object(T.isEmpty)(l))return null;var O="template-selector-control-".concat(i);return Object(o.createElement)(S.BaseControl,{label:t,id:O,help:r,className:k()(n,"template-selector-control")},Object(o.createElement)("ul",{className:"template-selector-control__options","data-testid":"template-selector-control-options"},Object(T.map)(s,(function(e){var t=e.slug,n=e.title,i=e.preview,a=e.previewAlt;return Object(o.createElement)("li",{key:"".concat(O,"-").concat(t),className:"template-selector-control__template"},Object(o.createElement)(M,{id:O,value:t,label:R(n,b),help:r,onSelect:d,staticPreviewImg:i,staticPreviewImgAlt:a,blocks:l.hasOwnProperty(t)?l[t]:[],useDynamicPreview:p,isSelected:t===g}))}))))})),G=function(e){var t=e.blocks,n=void 0===t?[]:t,r=e.viewportWidth,i=e.title,s=!n.length;return Object(o.createElement)("div",{className:"template-selector-preview ".concat(s?"not-selected":"")},s&&Object(o.createElement)("div",{className:"editor-styles-wrapper"},Object(o.createElement)("div",{className:"template-selector-preview__empty-state"},Object(a.__)("Select a layout to preview.","full-site-editing"))),Object(o.createElement)(D,{blocks:n,viewportWidth:r,title:i}))};window._tkq=window._tkq||[];var q=null,z=function(e,t){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:q.blogid,segment_id:e,vertical_id:t}])},V=function(e,t,n){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:q.blogid,segment_id:e,vertical_id:t,template:n}])},Q=n(20),H=n.n(Q),K=n(21),Y=n.n(K),$=n(26),J=n.n($),X=n(27),Z=function(e,t,n){var r=e[t=Object(X.removeQueryArgs)(t,"w","s")]||{url:t,usages:[]};return p()({},e,w()({},t,p()({},r,{usages:[].concat(Y()(r.usages),Y()(n))})))},ee=function e(t,n){switch(t.blocksByClientId[n.clientId]=n,n.name){case"core/cover":case"core/image":var r=n.attributes.url;r&&(t.assets=Z(t.assets,r,[{prop:"url",path:[n.clientId,"attributes","url"]},{prop:"id",path:[n.clientId,"attributes","id"]}]));case"core/media-text":var i=n.attributes.mediaUrl;i&&"image"===n.attributes.mediaType&&(t.assets=Z(t.assets,i,[{prop:"url",path:[n.clientId,"attributes","mediaUrl"]},{prop:"id",path:[n.clientId,"attributes","mediaId"]}]));case"core/gallery":Object(T.forEach)(n.attributes.images,(function(e,r){t.assets=Z(t.assets,e.url,[{prop:"url",path:[n.clientId,"attributes","images",r,"url"]},{prop:"url",path:[n.clientId,"attributes","images",r,"link"]},{prop:"id",path:[n.clientId,"attributes","images",r,"id"]},{prop:"id",path:[n.clientId,"attributes","ids",r]}])}))}return Object(T.isEmpty)(n.innerBlocks)?t:Object(T.reduce)(n.innerBlocks,e,t)},te=function(){var e=H()(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J()({method:"POST",path:"/fse/v1/sideload/image/batch",data:{resources:Object(T.map)(t)}}).then((function(e){return Object(T.reduce)(t,(function(t,n){var r=e.shift(),i=r.id,o=r.source_url;return p()({},t,w()({},n.url,{id:i,url:o}))}),{})}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ne=function(e,t){return Object(T.forEach)(e.assets,(function(n){var r=t[n.url];r&&Object(T.forEach)(n.usages,(function(t){Object(T.set)(e.blocksByClientId,t.path,r[t.prop])}))})),e.blocks},re=function(){var e=H()(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Object(T.reduce)(t,ee,{assets:{},blocksByClientId:{},blocks:t}),!Object(T.isEmpty)(n.assets)){e.next=3;break}return e.abrupt("return",t);case 3:return e.abrupt("return",te(n.assets).then((function(e){return ne(n,e)})));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var ie=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T.identity;return t.map((function(t){return(t=n(Object(x.cloneBlock)(t))).innerBlocks&&t.innerBlocks.length&&(t.innerBlocks=e(t.innerBlocks,n)),t}))},oe="core/missing";var ae=function e(t){return!!t.find((function(t){return t.name===oe||!(!t.innerBlocks||!t.innerBlocks.length)&&e(t.innerBlocks)}))},se=function(e){h()(n,e);var t=j()(n);function n(){var e;d()(this,n);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return e=t.call.apply(t,[this].concat(i)),w()(O()(e),"state",{isLoading:!1,previewedTemplate:null,error:null}),w()(O()(e),"getTitlesByTemplateSlugs",Object(T.memoize)((function(e){return Object(T.mapValues)(Object(T.keyBy)(e,"slug"),"title")}))),w()(O()(e),"getBlocksByTemplateSlugs",Object(T.memoize)((function(t){var n=Object(T.reduce)(t,(function(t,n){var r=n.slug,i=n.content;return t[r]=i?Object(x.parse)(R(i,e.props.siteInformation)):[],t}),{});return e.filterTemplatesWithMissingBlocks(n)}))),w()(O()(e),"getBlocksForPreview",Object(T.memoize)((function(t){var n=e.getBlocksByTemplateSlug(t);return ie(n,(function(e){return"jetpack/contact-form"===e.name&&void 0!==e.attributes.hasFormSettingsSet&&(e.attributes.hasFormSettingsSet=!0),e}))}))),w()(O()(e),"getBlocksForSelection",(function(t){var n=e.getBlocksByTemplateSlug(t);return ie(n,(function(e){return"core/button"===e.name&&void 0!==e.attributes.url&&(e.attributes.url="#"),e}))})),w()(O()(e),"setTemplate",(function(t){if(V(e.props.segment.id,e.props.vertical.id,t),e.props.saveTemplateChoice(t),"blank"===t)return e.props.insertTemplate("",[]),void e.props.setIsOpen(!1);var n=Object(T.find)(e.props.templates,{slug:t,category:"home"}),r=e.getBlocksForSelection(t),i=n?null:e.getTitleByTemplateSlug(t);r&&r.length?(e.setState({error:null,isLoading:!0}),e.maybePrefetchAssets(r).then((function(t){e.setState({isLoading:!1}),e.props.isOpen&&(e.props.insertTemplate(i,t),e.props.setIsOpen(!1))})).catch((function(t){e.setState({isLoading:!1,error:t})}))):e.props.setIsOpen(!1)})),w()(O()(e),"maybePrefetchAssets",(function(t){return e.props.shouldPrefetchAssets?re(t):Promise.resolve(t)})),w()(O()(e),"handleConfirmation",(function(t){"string"!=typeof t&&(t=e.state.previewedTemplate),e.setTemplate(t),e.props.isPromptedFromSidebar&&e.props.toggleTemplateModal()})),w()(O()(e),"previewTemplate",(function(t){e.setState({previewedTemplate:t}),window.matchMedia("(min-width: 660px)").matches||e.handleConfirmation(t)})),w()(O()(e),"closeModal",(function(t){if(t.target.matches("button.template-selector-item__label"))return!1;z(e.props.segment.id,e.props.vertical.id);var n=Object(T.get)(window,["calypsoifyGutenberg","closeUrl"]);window.top.location=n||"edit.php?post_type=page"})),w()(O()(e),"getTemplateGroups",(function(){return{blankTemplate:Object(T.filter)(e.props.templates,{slug:"blank"}),aboutTemplates:Object(T.filter)(e.props.templates,{category:"about"}),blogTemplates:Object(T.filter)(e.props.templates,{category:"blog"}),contactTemplates:Object(T.filter)(e.props.templates,{category:"contact"}),eventTemplates:Object(T.filter)(e.props.templates,{category:"event"}),menuTemplates:Object(T.filter)(e.props.templates,{category:"menu"}),portfolioTemplates:Object(T.filter)(e.props.templates,{category:"portfolio"}),productTemplates:Object(T.filter)(e.props.templates,{category:"product"}),servicesTemplates:Object(T.filter)(e.props.templates,{category:"services"}),teamTemplates:Object(T.filter)(e.props.templates,{category:"team"}),homepageTemplates:Object(T.sortBy)(Object(T.filter)(e.props.templates,{category:"home"}),"title")}})),w()(O()(e),"renderTemplatesList",(function(t,n){if(!t.length)return null;var r,i=e.getBlocksByTemplateSlugs(e.props.templates),s=Object.keys(i),c=(r=s,t.filter((function(e){return r.includes(e.slug)})));return c.length?Object(o.createElement)("fieldset",{className:"page-template-modal__list"},Object(o.createElement)("legend",{className:"page-template-modal__form-title"},n),Object(o.createElement)(U,{label:Object(a.__)("Layout","full-site-editing"),templates:c,blocksByTemplates:i,onTemplateSelect:e.previewTemplate,useDynamicPreview:!1,siteInformation:e.props.siteInformation,selectedTemplate:e.state.previewedTemplate})):null})),e}return b()(n,[{key:"filterTemplatesWithMissingBlocks",value:function(e){return Object(T.reduce)(e,(function(e,t,n){return ae(t)&&t.length||(e[n]=t),e}),{})}},{key:"componentDidMount",value:function(){this.props.isOpen&&this.trackCurrentView()}},{key:"componentDidUpdate",value:function(e){!e.isOpen&&this.props.isOpen&&this.trackCurrentView(),(this.props.isWelcomeGuideActive||this.props.areTipsEnabled)&&this.props.hideWelcomeGuide()}},{key:"trackCurrentView",value:function(){var e,t,n;e=this.props.segment.id,t=this.props.vertical.id,n=this.props.isPromptedFromSidebar?"sidebar":"add-page",q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:q.blogid,segment_id:e,vertical_id:t,source:n}])}},{key:"getBlocksByTemplateSlug",value:function(e){return Object(T.get)(this.getBlocksByTemplateSlugs(this.props.templates),[e],[])}},{key:"getTitleByTemplateSlug",value:function(e){return Object(T.get)(this.getTitlesByTemplateSlugs(this.props.templates),[e],"")}},{key:"render",value:function(){var e=this.state,t=e.previewedTemplate,n=e.isLoading,r=this.props,i=r.isPromptedFromSidebar,s=r.hidePageTitle;if(!r.isOpen)return null;var c=this.getTemplateGroups(),l=c.blankTemplate,u=c.aboutTemplates,p=c.blogTemplates,m=c.contactTemplates,d=c.eventTemplates,f=c.menuTemplates,b=c.portfolioTemplates,g=c.productTemplates,O=c.servicesTemplates,v=c.teamTemplates,h=c.homepageTemplates;return Object(o.createElement)(S.Modal,{title:Object(a.__)("Select Page Layout","full-site-editing"),className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay",shouldCloseOnClickOutside:!1,isDismissable:!1,isDismissible:!1},i?Object(o.createElement)(S.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.props.toggleTemplateModal,icon:"no-alt",label:Object(a.__)("Close Layout Selector")}):Object(o.createElement)(S.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.closeModal,icon:"arrow-left-alt2",label:Object(a.__)("Go back")}),Object(o.createElement)("div",{className:"page-template-modal__inner"},n?Object(o.createElement)("div",{className:"page-template-modal__loading"},Object(o.createElement)(S.Spinner,null),Object(a.__)("Adding layout…","full-site-editing")):Object(o.createElement)(o.Fragment,null,Object(o.createElement)("form",{className:"page-template-modal__form"},this.props.isFrontPage&&this.renderTemplatesList(h,Object(a.__)("Home Pages","full-site-editing")),this.renderTemplatesList(l,Object(a.__)("Blank","full-site-editing")),this.renderTemplatesList(u,Object(a.__)("About Pages","full-site-editing")),this.renderTemplatesList(p,Object(a.__)("Blog Pages","full-site-editing")),this.renderTemplatesList(m,Object(a.__)("Contact Pages","full-site-editing")),this.renderTemplatesList(d,Object(a.__)("Event Pages","full-site-editing")),this.renderTemplatesList(f,Object(a.__)("Menu Pages","full-site-editing")),this.renderTemplatesList(b,Object(a.__)("Portfolio Pages","full-site-editing")),this.renderTemplatesList(g,Object(a.__)("Product Pages","full-site-editing")),this.renderTemplatesList(O,Object(a.__)("Services Pages","full-site-editing")),this.renderTemplatesList(v,Object(a.__)("Team Pages","full-site-editing")),!this.props.isFrontPage&&this.renderTemplatesList(h,Object(a.__)("Home Pages","full-site-editing"))),Object(o.createElement)(G,{blocks:this.getBlocksForPreview(t),viewportWidth:1200,title:!s&&this.getTitleByTemplateSlug(t)}))),Object(o.createElement)("div",{className:k()("page-template-modal__buttons",{"is-visually-hidden":Object(T.isEmpty)(t)||n})},Object(o.createElement)(S.Button,{isPrimary:!0,isLarge:!0,disabled:Object(T.isEmpty)(t)||n,onClick:this.handleConfirmation},Object(a.sprintf)(Object(a.__)("Use %s layout","full-site-editing"),this.getTitleByTemplateSlug(t)))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return t.previewedTemplate||Object(T.isEmpty)(e.templates)?null:{previewedTemplate:n.getDefaultSelectedTemplate(e)}}}]),n}(o.Component);w()(se,"getDefaultSelectedTemplate",(function(e){var t=Object(T.get)(e.templates,[0,"slug"]),n=e._starter_page_template;if(!e.isFrontPage&&!n)return t;"home"===n&&(n=e.theme);var r=n||e.theme;return Object(T.find)(e.templates,{slug:r})?r:Object(T.find)(e.templates,{slug:"maywood"})?"maywood":t}));var ce=Object(E.compose)(Object(c.withSelect)((function(e){var t=function(){return e("core/editor").getEditedPostAttribute("meta")},n=t()._starter_page_template;return{isOpen:e("automattic/starter-page-layouts").isOpen(),getMeta:t,_starter_page_template:n,postContentBlock:e("core/editor").getBlocks().find((function(e){return"a8c/post-content"===e.name})),isWelcomeGuideActive:e("core/edit-post").isFeatureActive("welcomeGuide"),areTipsEnabled:!!e("core/nux")&&e("core/nux").areTipsEnabled()}})),Object(c.withDispatch)((function(e,t){var n=e("core/editor");return{setIsOpen:e("automattic/starter-page-layouts").setIsOpen,saveTemplateChoice:function(e){var r=t.getMeta();n.editPost({meta:p()({},r,{_starter_page_template:e})})},insertTemplate:function(r,i){Object(B.addFilter)("isInsertingPageTemplate","automattic/full-site-editing/inserting-template",T.stubTrue),r&&n.editPost({title:r});var o=t.postContentBlock;e("core/block-editor").replaceInnerBlocks(o?o.clientId:"",i,!1),Object(B.removeFilter)("isInsertingPageTemplate","automattic/full-site-editing/inserting-template")},hideWelcomeGuide:function(){t.isWelcomeGuideActive?e("core/edit-post").toggleFeature("welcomeGuide"):t.areTipsEnabled&&e("core/nux").disableTips()}}})))(se),le=function(e){h()(n,e);var t=j()(n);function n(){var e;d()(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return e=t.call.apply(t,[this].concat(i)),w()(O()(e),"state",{isWarningOpen:!1}),w()(O()(e),"toggleTemplateModal",(function(){e.props.setIsOpen(!e.props.isOpen)})),w()(O()(e),"toggleWarningModal",(function(){e.setState({isWarningOpen:!e.state.isWarningOpen})})),w()(O()(e),"getLastTemplateUsed",(function(){var t=e.props,n=t.isFrontPage,r=t.templates,i=t.theme,o=e.props.lastTemplateUsedSlug;if(!o&&n&&(o=i),!o||"blank"===o)return r[0];var a=r.find((function(e){return e.slug===o}));return a||r[0]})),e}return b()(n,[{key:"render",value:function(){var e=this.getLastTemplateUsed(),t=e.slug,n=e.title,r=e.preview,i=e.previewAlt,s=this.props,c=s.templates,l=s.theme,u=s.vertical,p=s.segment,m=s.siteInformation,d=s.hidePageTitle,f=s.isFrontPage,b=s.isOpen;return Object(o.createElement)("div",{className:"sidebar-modal-opener"},Object(o.createElement)(M,{id:"sidebar-modal-opener__last-template-used-preview",value:t,label:R(n,m),staticPreviewImg:r,staticPreviewImgAlt:i,onSelect:this.toggleWarningModal}),Object(o.createElement)(S.Button,{isPrimary:!0,onClick:this.toggleWarningModal,className:"sidebar-modal-opener__button"},Object(a.__)("Change Layout")),b&&Object(o.createElement)(ce,{shouldPrefetchAssets:!1,templates:c,theme:l,vertical:u,segment:p,toggleTemplateModal:this.toggleTemplateModal,hidePageTitle:d,isFrontPage:f,isPromptedFromSidebar:!0}),this.state.isWarningOpen&&Object(o.createElement)(S.Modal,{title:Object(a.__)("Overwrite Page Content?"),isDismissible:!1,onRequestClose:this.toggleWarningModal,className:"sidebar-modal-opener__warning-modal"},Object(o.createElement)("div",{className:"sidebar-modal-opener__warning-text"},Object(a.__)("Changing the page's layout will remove any customizations or edits you have already made.")),Object(o.createElement)("div",{className:"sidebar-modal-opener__warning-options"},Object(o.createElement)(S.Button,{isDefault:!0,onClick:this.toggleWarningModal},Object(a.__)("Cancel")),Object(o.createElement)(S.Button,{isPrimary:!0,onClick:this.toggleTemplateModal},Object(a.__)("Change Layout")))))}}]),n}(o.Component),ue=Object(E.compose)(Object(c.withSelect)((function(e){return{lastTemplateUsedSlug:e("core/editor").getEditedPostAttribute("meta")._starter_page_template,isOpen:e("automattic/starter-page-layouts").isOpen()}})),Object(c.withDispatch)((function(e){return{setIsOpen:e("automattic/starter-page-layouts").setIsOpen}})))(le),pe=n(28),me=n.n(pe);Object(c.registerStore)("automattic/starter-page-layouts",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isOpen:!1},t=arguments.length>1?arguments[1]:void 0,n=t.type,r=me()(t,["type"]);return"SET_IS_OPEN"===n?p()({},e,{isOpen:r.isOpen}):e},actions:{setIsOpen:function(e){return{type:"SET_IS_OPEN",isOpen:e}}},selectors:{isOpen:function(e){return e.isOpen}}});var de,fe=window.starterPageTemplatesConfig,be=fe.templates,ge=void 0===be?[]:be,Oe=fe.vertical,ve=fe.segment,he=fe.tracksUserData,ye=fe.siteInformation,je=void 0===ye?{}:ye,_e=fe.screenAction,we=fe.theme,Te=fe.isFrontPage,Pe=fe.hideFrontPageTitle;he&&(q=de=he,window._tkq.push(["identifyUser",de.userid,de.username]));var ke={segment:ve,templates:ge,theme:we,vertical:Oe,isFrontPage:Te,hidePageTitle:Boolean(Te&&Pe)};"add"===_e&&(Object(c.dispatch)("automattic/starter-page-layouts").setIsOpen(!0),Object(s.registerPlugin)("page-templates",{render:function(){return Object(o.createElement)(ce,i()({},ke,{shouldPrefetchAssets:!1}))}})),Object(s.registerPlugin)("page-templates-sidebar",{render:function(){return Object(o.createElement)(l.PluginDocumentSettingPanel,{name:"Template Modal Opener",title:Object(a.__)("Page Layout"),className:"page-template-modal__sidebar",icon:"none"},Object(o.createElement)(ue,i()({},ke,{siteInformation:je})))}});var Ee=Object(c.subscribe)((function(){Object(c.select)("core/edit-post").isEditorPanelOpened("page-templates-sidebar/Template Modal Opener")||Object(c.dispatch)("core/edit-post").toggleEditorPanelOpened("page-templates-sidebar/Template Modal Opener"),Ee()}))}]));
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)&&r.length){var a=i.apply(null,r);a&&e.push(a)}else if("object"===o)for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()},function(e,t,n){var r=n(3);function i(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}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(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)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(29);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(30),i=n(31),o=n(32);e.exports=function(e){return function(){var t,n=r(e);if(i()){var a=r(this).constructor;t=Reflect.construct(n,arguments,a)}else t=n.apply(this,arguments);return o(this,t)}}},function(e,t){!function(){e.exports=this.wp.blocks}()},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){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t,n){var r=n(36),i=n(37),o=n(22),a=n(38);e.exports=function(e,t){return r(e)||i(e,t)||o(e,t)||a()}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){function n(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(l){return void n(l)}s.done?t(c):Promise.resolve(c).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function s(e){n(a,i,o,s,c,"next",e)}function c(e){n(a,i,o,s,c,"throw",e)}s(void 0)}))}}},function(e,t,n){var r=n(39),i=n(40),o=n(22),a=n(41);e.exports=function(e){return r(e)||i(e)||o(e)||a()}},function(e,t,n){var r=n(23);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 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}},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.editor}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t,n){var r=n(42);e.exports=function(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t){e.exports=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}}},function(e,t,n){var r=n(33),i=n(4);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){!function(){e.exports=this.wp.nux}()},function(e,t,n){},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(c){i=!0,o=c}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,n){var r=n(23);e.exports=function(e){if(Array.isArray(e))return r(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}},function(e,t,n){"use strict";n.r(t);var r=n(15),i=n.n(r),o=n(0),a=n(2),s=n(16),c=n(6),l=n(24),u=n(9),p=n.n(u),m=n(10),d=n.n(m),f=n(11),b=n.n(f),g=n(4),O=n.n(g),v=n(12),h=n.n(v),y=n(13),j=n.n(y),_=n(3),w=n.n(_),T=n(1),P=n(8),k=n.n(P),E=(n(34),n(7)),S=n(5),x=n(14),B=n(17),I=(n(35),n(18)),C=n.n(I),N=n(19),A=n(25),L=function(e){var t=e.blocks,n=e.settings,r=e.hidePageTitle,i=e.recomputeBlockListKey;return Object(o.createElement)(N.BlockEditorProvider,{value:t,settings:n},Object(o.createElement)(S.Disabled,{key:i},!r&&Object(o.createElement)("div",{className:"block-iframe-preview__template-title edit-post-visual-editor__post-title-wrapper"},Object(o.createElement)(A.PostTitle,null)),Object(o.createElement)(N.BlockList,null)))},D=Object(E.compose)(E.withSafeTimeout,Object(c.withSelect)((function(e){var t=e("core/block-editor");return{settings:t?t.getSettings():{}}})))((function(e){var t=e.className,n=void 0===t?"block-iframe-preview":t,r=e.bodyClassName,i=void 0===r?"block-iframe-preview-body":r,s=e.viewportWidth,c=e.blocks,l=e.settings,u=e.setTimeout,p=void 0===u?T.noop:u,m=e.title,d=Object(o.useRef)(),f=Object(o.useRef)(),b=Object(o.useRef)(),g=Object(o.useState)({transform:"scale( 1 )"}),O=C()(g,2),v=O[0],h=O[1],y=Object(o.useMemo)((function(){return Object(T.castArray)(c)}),[c]),j=Object(o.useReducer)((function(e){return e+1}),0),_=C()(j,2),w=_[0],P=_[1];Object(o.useLayoutEffect)(P,[c]);var E=Object(o.useCallback)((function(){var e=Object(T.get)(d,["current","parentNode"]);if(e){var t=s||d.current.offsetWidth,n=e.offsetWidth/s,r=e.offsetHeight/n;h({width:t,height:r,transform:"scale( ".concat(n," )")})}}),[s]);return Object(o.useEffect)((function(){if(m){var e=Object(T.get)(b,["current","contentDocument","body"]);if(e){var t=e.querySelector(".editor-post-title .editor-post-title__input");t&&(t.value=m)}}}),[w]),Object(o.useEffect)((function(){p((function(){var e,t,n,r;e=window.document,t=b.current.contentDocument,n=["link","style"],r={head:document.createDocumentFragment(),body:document.createDocumentFragment()},Object(T.each)(Object.keys(r),(function(t){return Object(T.each)(Object(T.filter)(e[t].children,(function(e){var t=e.localName;return n.includes(t)})),(function(e){r[t].appendChild(e.cloneNode(!0))}))})),t.head.appendChild(r.head),t.body.appendChild(r.body),b.current.contentDocument.body.classList.add(i,"editor-styles-wrapper","block-editor__container"),E()}),0)}),[p,i,E]),Object(o.useEffect)((function(){var e=Object(T.get)(b,["current","contentDocument","body"]);e&&(e.scrollTop=0)}),[w]),Object(o.useEffect)((function(){var e=f&&f.current;e&&b.current.contentDocument.body.appendChild(e)}),[w]),Object(o.useEffect)((function(){var e=Object(T.debounce)(E,300);return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[E]),Object(o.useEffect)((function(){return window.jQuery&&window.jQuery(window.document).on("wp-collapse-menu",E),function(){window.jQuery&&window.jQuery(window.document).off("wp-collapse-menu",E)}}),[E]),Object(o.createElement)("div",{ref:d},Object(o.createElement)("iframe",{ref:b,title:Object(a.__)("Preview"),className:k()("editor-styles-wrapper",n),style:v}),Object(o.createElement)("div",{ref:f,className:"block-editor"},Object(o.createElement)("div",{className:"edit-post-visual-editor"},Object(o.createElement)("div",{className:"editor-styles-wrapper"},Object(o.createElement)("div",{className:"editor-writing-flow"},Object(o.createElement)(L,{blocks:y,settings:l,hidePageTitle:!m,recomputeBlockListKey:w}))))))})),M=function(e){var t=e.id,n=e.value,r=e.onSelect,i=e.label,a=e.useDynamicPreview,s=void 0!==a&&a,c=e.staticPreviewImg,l=e.staticPreviewImgAlt,u=void 0===l?"":l,p=e.blocks,m=void 0===p?[]:p,d=e.isSelected;if(Object(T.isNil)(t)||Object(T.isNil)(i)||Object(T.isNil)(n))return null;if(s&&(Object(T.isNil)(m)||Object(T.isEmpty)(m)))return null;var f=s?Object(o.createElement)(S.Disabled,null,Object(o.createElement)(D,{blocks:m,viewportWidth:960})):Object(o.createElement)("img",{className:"template-selector-item__media",src:c,alt:u}),b="label-".concat(t,"-").concat(n);return Object(o.createElement)("button",{type:"button",className:k()("template-selector-item__label",{"is-selected":d}),value:n,onClick:function(){r(n)},"aria-labelledby":"".concat(t," ").concat(b)},Object(o.createElement)("span",{className:"template-selector-item__preview-wrap"},f))},F={Address:Object(a._x)("123 Main St","default address","full-site-editing"),Phone:Object(a._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(a._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(a._x)("Business","default vertical name","full-site-editing")},W={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?e.replace(/{{(\w+)}}/g,(function(e,n){var r=F[n];return t[W[n]]||r||n})):""},U=Object(E.compose)(o.memo,E.withInstanceId)((function(e){var t=e.label,n=e.className,r=e.help,i=e.instanceId,a=e.templates,s=void 0===a?[]:a,c=e.blocksByTemplates,l=void 0===c?{}:c,u=e.useDynamicPreview,p=void 0!==u&&u,m=e.onTemplateSelect,d=void 0===m?T.noop:m,f=e.siteInformation,b=void 0===f?{}:f,g=e.selectedTemplate;if(Object(T.isEmpty)(s)||!Object(T.isArray)(s))return null;if(!0===p&&Object(T.isEmpty)(l))return null;var O="template-selector-control-".concat(i);return Object(o.createElement)(S.BaseControl,{label:t,id:O,help:r,className:k()(n,"template-selector-control")},Object(o.createElement)("ul",{className:"template-selector-control__options","data-testid":"template-selector-control-options"},Object(T.map)(s,(function(e){var t=e.slug,n=e.title,i=e.preview,a=e.previewAlt;return Object(o.createElement)("li",{key:"".concat(O,"-").concat(t),className:"template-selector-control__template"},Object(o.createElement)(M,{id:O,value:t,label:R(n,b),help:r,onSelect:d,staticPreviewImg:i,staticPreviewImgAlt:a,blocks:l.hasOwnProperty(t)?l[t]:[],useDynamicPreview:p,isSelected:t===g}))}))))})),G=function(e){var t=e.blocks,n=void 0===t?[]:t,r=e.viewportWidth,i=e.title,s=!n.length;return Object(o.createElement)("div",{className:"template-selector-preview ".concat(s?"not-selected":"")},s&&Object(o.createElement)("div",{className:"editor-styles-wrapper"},Object(o.createElement)("div",{className:"template-selector-preview__empty-state"},Object(a.__)("Select a layout to preview.","full-site-editing"))),Object(o.createElement)(D,{blocks:n,viewportWidth:r,title:i}))};window._tkq=window._tkq||[];var q=null,z=function(e,t){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:q.blogid,segment_id:e,vertical_id:t}])},V=function(e,t,n){q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:q.blogid,segment_id:e,vertical_id:t,template:n}])},Q=n(20),H=n.n(Q),K=n(21),Y=n.n(K),$=n(26),J=n.n($),X=n(27),Z=function(e,t,n){var r=e[t=Object(X.removeQueryArgs)(t,"w","s")]||{url:t,usages:[]};return p()({},e,w()({},t,p()({},r,{usages:[].concat(Y()(r.usages),Y()(n))})))},ee=function e(t,n){switch(t.blocksByClientId[n.clientId]=n,n.name){case"core/cover":case"core/image":var r=n.attributes.url;r&&(t.assets=Z(t.assets,r,[{prop:"url",path:[n.clientId,"attributes","url"]},{prop:"id",path:[n.clientId,"attributes","id"]}]));case"core/media-text":var i=n.attributes.mediaUrl;i&&"image"===n.attributes.mediaType&&(t.assets=Z(t.assets,i,[{prop:"url",path:[n.clientId,"attributes","mediaUrl"]},{prop:"id",path:[n.clientId,"attributes","mediaId"]}]));case"core/gallery":Object(T.forEach)(n.attributes.images,(function(e,r){t.assets=Z(t.assets,e.url,[{prop:"url",path:[n.clientId,"attributes","images",r,"url"]},{prop:"url",path:[n.clientId,"attributes","images",r,"link"]},{prop:"id",path:[n.clientId,"attributes","images",r,"id"]},{prop:"id",path:[n.clientId,"attributes","ids",r]}])}))}return Object(T.isEmpty)(n.innerBlocks)?t:Object(T.reduce)(n.innerBlocks,e,t)},te=function(){var e=H()(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J()({method:"POST",path:"/fse/v1/sideload/image/batch",data:{resources:Object(T.map)(t)}}).then((function(e){return Object(T.reduce)(t,(function(t,n){var r=e.shift(),i=r.id,o=r.source_url;return p()({},t,w()({},n.url,{id:i,url:o}))}),{})}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ne=function(e,t){return Object(T.forEach)(e.assets,(function(n){var r=t[n.url];r&&Object(T.forEach)(n.usages,(function(t){Object(T.set)(e.blocksByClientId,t.path,r[t.prop])}))})),e.blocks},re=function(){var e=H()(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Object(T.reduce)(t,ee,{assets:{},blocksByClientId:{},blocks:t}),!Object(T.isEmpty)(n.assets)){e.next=3;break}return e.abrupt("return",t);case 3:return e.abrupt("return",te(n.assets).then((function(e){return ne(n,e)})));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var ie=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:T.identity;return t.map((function(t){return(t=n(Object(x.cloneBlock)(t))).innerBlocks&&t.innerBlocks.length&&(t.innerBlocks=e(t.innerBlocks,n)),t}))};var oe=function e(t){return!!t.find((function(t){return"core/missing"===t.name||!(!t.innerBlocks||!t.innerBlocks.length)&&e(t.innerBlocks)}))},ae=function(e){h()(n,e);var t=j()(n);function n(){var e;d()(this,n);for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];return e=t.call.apply(t,[this].concat(i)),w()(O()(e),"state",{isLoading:!1,previewedTemplate:null,error:null}),w()(O()(e),"getTitlesByTemplateSlugs",Object(T.memoize)((function(e){return Object(T.mapValues)(Object(T.keyBy)(e,"slug"),"title")}))),w()(O()(e),"getBlocksByTemplateSlugs",Object(T.memoize)((function(t){var n=Object(T.reduce)(t,(function(t,n){var r=n.slug,i=n.content;return t[r]=i?Object(x.parse)(R(i,e.props.siteInformation)):[],t}),{});return e.filterTemplatesWithMissingBlocks(n)}))),w()(O()(e),"getBlocksForPreview",Object(T.memoize)((function(t){var n=e.getBlocksByTemplateSlug(t);return ie(n,(function(e){return"jetpack/contact-form"===e.name&&void 0!==e.attributes.hasFormSettingsSet&&(e.attributes.hasFormSettingsSet=!0),e}))}))),w()(O()(e),"getBlocksForSelection",(function(t){var n=e.getBlocksByTemplateSlug(t);return ie(n,(function(e){return"core/button"===e.name&&void 0!==e.attributes.url&&(e.attributes.url="#"),e}))})),w()(O()(e),"setTemplate",(function(t){if(V(e.props.segment.id,e.props.vertical.id,t),e.props.saveTemplateChoice(t),"blank"===t)return e.props.insertTemplate("",[]),void e.props.setIsOpen(!1);var n=Object(T.find)(e.props.templates,{slug:t,category:"home"}),r=e.getBlocksForSelection(t),i=n?null:e.getTitleByTemplateSlug(t);r&&r.length?(e.setState({error:null,isLoading:!0}),e.maybePrefetchAssets(r).then((function(t){e.setState({isLoading:!1}),e.props.isOpen&&(e.props.insertTemplate(i,t),e.props.setIsOpen(!1))})).catch((function(t){e.setState({isLoading:!1,error:t})}))):e.props.setIsOpen(!1)})),w()(O()(e),"maybePrefetchAssets",(function(t){return e.props.shouldPrefetchAssets?re(t):Promise.resolve(t)})),w()(O()(e),"handleConfirmation",(function(t){"string"!=typeof t&&(t=e.state.previewedTemplate),e.setTemplate(t),e.props.isPromptedFromSidebar&&e.props.toggleTemplateModal()})),w()(O()(e),"previewTemplate",(function(t){e.setState({previewedTemplate:t}),window.matchMedia("(min-width: 660px)").matches||e.handleConfirmation(t)})),w()(O()(e),"closeModal",(function(t){if(t.target.matches("button.template-selector-item__label"))return!1;z(e.props.segment.id,e.props.vertical.id);var n=Object(T.get)(window,["calypsoifyGutenberg","closeUrl"]);window.top.location=n||"edit.php?post_type=page"})),w()(O()(e),"getTemplateGroups",(function(){return{blankTemplate:Object(T.filter)(e.props.templates,{slug:"blank"}),aboutTemplates:Object(T.filter)(e.props.templates,{category:"about"}),blogTemplates:Object(T.filter)(e.props.templates,{category:"blog"}),contactTemplates:Object(T.filter)(e.props.templates,{category:"contact"}),eventTemplates:Object(T.filter)(e.props.templates,{category:"event"}),menuTemplates:Object(T.filter)(e.props.templates,{category:"menu"}),portfolioTemplates:Object(T.filter)(e.props.templates,{category:"portfolio"}),productTemplates:Object(T.filter)(e.props.templates,{category:"product"}),servicesTemplates:Object(T.filter)(e.props.templates,{category:"services"}),teamTemplates:Object(T.filter)(e.props.templates,{category:"team"}),homepageTemplates:Object(T.sortBy)(Object(T.filter)(e.props.templates,{category:"home"}),"title")}})),w()(O()(e),"renderTemplatesList",(function(t,n){if(!t.length)return null;var r,i=e.getBlocksByTemplateSlugs(e.props.templates),s=Object.keys(i),c=(r=s,t.filter((function(e){return r.includes(e.slug)})));return c.length?Object(o.createElement)("fieldset",{className:"page-template-modal__list"},Object(o.createElement)("legend",{className:"page-template-modal__form-title"},n),Object(o.createElement)(U,{label:Object(a.__)("Layout","full-site-editing"),templates:c,blocksByTemplates:i,onTemplateSelect:e.previewTemplate,useDynamicPreview:!1,siteInformation:e.props.siteInformation,selectedTemplate:e.state.previewedTemplate})):null})),e}return b()(n,[{key:"filterTemplatesWithMissingBlocks",value:function(e){return Object(T.reduce)(e,(function(e,t,n){return oe(t)&&t.length||(e[n]=t),e}),{})}},{key:"componentDidMount",value:function(){this.props.isOpen&&this.trackCurrentView()}},{key:"componentDidUpdate",value:function(e){!e.isOpen&&this.props.isOpen&&this.trackCurrentView(),(this.props.isWelcomeGuideActive||this.props.areTipsEnabled)&&this.props.hideWelcomeGuide()}},{key:"trackCurrentView",value:function(){var e,t,n;e=this.props.segment.id,t=this.props.vertical.id,n=this.props.isPromptedFromSidebar?"sidebar":"add-page",q&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:q.blogid,segment_id:e,vertical_id:t,source:n}])}},{key:"getBlocksByTemplateSlug",value:function(e){return Object(T.get)(this.getBlocksByTemplateSlugs(this.props.templates),[e],[])}},{key:"getTitleByTemplateSlug",value:function(e){return Object(T.get)(this.getTitlesByTemplateSlugs(this.props.templates),[e],"")}},{key:"render",value:function(){var e=this.state,t=e.previewedTemplate,n=e.isLoading,r=this.props,i=r.isPromptedFromSidebar,s=r.hidePageTitle;if(!r.isOpen)return null;var c=this.getTemplateGroups(),l=c.blankTemplate,u=c.aboutTemplates,p=c.blogTemplates,m=c.contactTemplates,d=c.eventTemplates,f=c.menuTemplates,b=c.portfolioTemplates,g=c.productTemplates,O=c.servicesTemplates,v=c.teamTemplates,h=c.homepageTemplates;return Object(o.createElement)(S.Modal,{title:Object(a.__)("Select Page Layout","full-site-editing"),className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay",shouldCloseOnClickOutside:!1,isDismissable:!1,isDismissible:!1},i?Object(o.createElement)(S.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.props.toggleTemplateModal,icon:"no-alt",label:Object(a.__)("Close Layout Selector")}):Object(o.createElement)(S.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.closeModal,icon:"arrow-left-alt2",label:Object(a.__)("Go back")}),Object(o.createElement)("div",{className:"page-template-modal__inner"},n?Object(o.createElement)("div",{className:"page-template-modal__loading"},Object(o.createElement)(S.Spinner,null),Object(a.__)("Adding layout…","full-site-editing")):Object(o.createElement)(o.Fragment,null,Object(o.createElement)("form",{className:"page-template-modal__form"},this.props.isFrontPage&&this.renderTemplatesList(h,Object(a.__)("Home Pages","full-site-editing")),this.renderTemplatesList(l,Object(a.__)("Blank","full-site-editing")),this.renderTemplatesList(u,Object(a.__)("About Pages","full-site-editing")),this.renderTemplatesList(p,Object(a.__)("Blog Pages","full-site-editing")),this.renderTemplatesList(m,Object(a.__)("Contact Pages","full-site-editing")),this.renderTemplatesList(d,Object(a.__)("Event Pages","full-site-editing")),this.renderTemplatesList(f,Object(a.__)("Menu Pages","full-site-editing")),this.renderTemplatesList(b,Object(a.__)("Portfolio Pages","full-site-editing")),this.renderTemplatesList(g,Object(a.__)("Product Pages","full-site-editing")),this.renderTemplatesList(O,Object(a.__)("Services Pages","full-site-editing")),this.renderTemplatesList(v,Object(a.__)("Team Pages","full-site-editing")),!this.props.isFrontPage&&this.renderTemplatesList(h,Object(a.__)("Home Pages","full-site-editing"))),Object(o.createElement)(G,{blocks:this.getBlocksForPreview(t),viewportWidth:1200,title:!s&&this.getTitleByTemplateSlug(t)}))),Object(o.createElement)("div",{className:k()("page-template-modal__buttons",{"is-visually-hidden":Object(T.isEmpty)(t)||n})},Object(o.createElement)(S.Button,{isPrimary:!0,isLarge:!0,disabled:Object(T.isEmpty)(t)||n,onClick:this.handleConfirmation},Object(a.sprintf)(Object(a.__)("Use %s layout","full-site-editing"),this.getTitleByTemplateSlug(t)))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return t.previewedTemplate||Object(T.isEmpty)(e.templates)?null:{previewedTemplate:n.getDefaultSelectedTemplate(e)}}}]),n}(o.Component);w()(ae,"getDefaultSelectedTemplate",(function(e){var t=Object(T.get)(e.templates,[0,"slug"]),n=e._starter_page_template;if(!e.isFrontPage&&!n)return t;"home"===n&&(n=e.theme);var r=n||e.theme;return Object(T.find)(e.templates,{slug:r})?r:Object(T.find)(e.templates,{slug:"maywood"})?"maywood":t}));var se=Object(E.compose)(Object(c.withSelect)((function(e){var t=function(){return e("core/editor").getEditedPostAttribute("meta")},n=t()._starter_page_template;return{isOpen:e("automattic/starter-page-layouts").isOpen(),getMeta:t,_starter_page_template:n,postContentBlock:e("core/editor").getBlocks().find((function(e){return"a8c/post-content"===e.name})),isWelcomeGuideActive:e("core/edit-post").isFeatureActive("welcomeGuide"),areTipsEnabled:!!e("core/nux")&&e("core/nux").areTipsEnabled()}})),Object(c.withDispatch)((function(e,t){var n=e("core/editor");return{setIsOpen:e("automattic/starter-page-layouts").setIsOpen,saveTemplateChoice:function(e){var r=t.getMeta();n.editPost({meta:p()({},r,{_starter_page_template:e})})},insertTemplate:function(r,i){Object(B.addFilter)("isInsertingPageTemplate","automattic/full-site-editing/inserting-template",T.stubTrue),r&&n.editPost({title:r});var o=t.postContentBlock;e("core/block-editor").replaceInnerBlocks(o?o.clientId:"",i,!1),Object(B.removeFilter)("isInsertingPageTemplate","automattic/full-site-editing/inserting-template")},hideWelcomeGuide:function(){t.isWelcomeGuideActive?e("core/edit-post").toggleFeature("welcomeGuide"):t.areTipsEnabled&&e("core/nux").disableTips()}}})))(ae),ce=function(e){h()(n,e);var t=j()(n);function n(){var e;d()(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return e=t.call.apply(t,[this].concat(i)),w()(O()(e),"state",{isWarningOpen:!1}),w()(O()(e),"toggleTemplateModal",(function(){e.props.setIsOpen(!e.props.isOpen)})),w()(O()(e),"toggleWarningModal",(function(){e.setState({isWarningOpen:!e.state.isWarningOpen})})),w()(O()(e),"getLastTemplateUsed",(function(){var t=e.props,n=t.isFrontPage,r=t.templates,i=t.theme,o=e.props.lastTemplateUsedSlug;if(!o&&n&&(o=i),!o||"blank"===o)return r[0];var a=r.find((function(e){return e.slug===o}));return a||r[0]})),e}return b()(n,[{key:"render",value:function(){var e=this.getLastTemplateUsed(),t=e.slug,n=e.title,r=e.preview,i=e.previewAlt,s=this.props,c=s.templates,l=s.theme,u=s.vertical,p=s.segment,m=s.siteInformation,d=s.hidePageTitle,f=s.isFrontPage,b=s.isOpen;return Object(o.createElement)("div",{className:"sidebar-modal-opener"},Object(o.createElement)(M,{id:"sidebar-modal-opener__last-template-used-preview",value:t,label:R(n,m),staticPreviewImg:r,staticPreviewImgAlt:i,onSelect:this.toggleWarningModal}),Object(o.createElement)(S.Button,{isPrimary:!0,onClick:this.toggleWarningModal,className:"sidebar-modal-opener__button"},Object(a.__)("Change Layout")),b&&Object(o.createElement)(se,{shouldPrefetchAssets:!1,templates:c,theme:l,vertical:u,segment:p,toggleTemplateModal:this.toggleTemplateModal,hidePageTitle:d,isFrontPage:f,isPromptedFromSidebar:!0}),this.state.isWarningOpen&&Object(o.createElement)(S.Modal,{title:Object(a.__)("Overwrite Page Content?"),isDismissible:!1,onRequestClose:this.toggleWarningModal,className:"sidebar-modal-opener__warning-modal"},Object(o.createElement)("div",{className:"sidebar-modal-opener__warning-text"},Object(a.__)("Changing the page's layout will remove any customizations or edits you have already made.")),Object(o.createElement)("div",{className:"sidebar-modal-opener__warning-options"},Object(o.createElement)(S.Button,{isDefault:!0,onClick:this.toggleWarningModal},Object(a.__)("Cancel")),Object(o.createElement)(S.Button,{isPrimary:!0,onClick:this.toggleTemplateModal},Object(a.__)("Change Layout")))))}}]),n}(o.Component),le=Object(E.compose)(Object(c.withSelect)((function(e){return{lastTemplateUsedSlug:e("core/editor").getEditedPostAttribute("meta")._starter_page_template,isOpen:e("automattic/starter-page-layouts").isOpen()}})),Object(c.withDispatch)((function(e){return{setIsOpen:e("automattic/starter-page-layouts").setIsOpen}})))(ce),ue=n(28),pe=n.n(ue);Object(c.registerStore)("automattic/starter-page-layouts",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isOpen:!1},t=arguments.length>1?arguments[1]:void 0,n=t.type,r=pe()(t,["type"]);return"SET_IS_OPEN"===n?p()({},e,{isOpen:r.isOpen}):e},actions:{setIsOpen:function(e){return{type:"SET_IS_OPEN",isOpen:e}}},selectors:{isOpen:function(e){return e.isOpen}}});var me,de=window.starterPageTemplatesConfig,fe=de.templates,be=void 0===fe?[]:fe,ge=de.vertical,Oe=de.segment,ve=de.tracksUserData,he=de.siteInformation,ye=void 0===he?{}:he,je=de.screenAction,_e=de.theme,we=de.isFrontPage,Te=de.hideFrontPageTitle;ve&&(q=me=ve,window._tkq.push(["identifyUser",me.userid,me.username]));var Pe={segment:Oe,templates:be,theme:_e,vertical:ge,isFrontPage:we,hidePageTitle:Boolean(we&&Te)};"add"===je&&(Object(c.dispatch)("automattic/starter-page-layouts").setIsOpen(!0),Object(s.registerPlugin)("page-templates",{render:function(){return Object(o.createElement)(se,i()({},Pe,{shouldPrefetchAssets:!1}))}})),Object(s.registerPlugin)("page-templates-sidebar",{render:function(){return Object(o.createElement)(l.PluginDocumentSettingPanel,{name:"Template Modal Opener",title:Object(a.__)("Page Layout"),className:"page-template-modal__sidebar",icon:"none"},Object(o.createElement)(le,i()({},Pe,{siteInformation:ye})))}});var ke=Object(c.subscribe)((function(){Object(c.select)("core/edit-post").isEditorPanelOpened("page-templates-sidebar/Template Modal Opener")||Object(c.dispatch)("core/edit-post").toggleEditorPanelOpened("page-templates-sidebar/Template Modal Opener"),ke()}))}]));
|
starter-page-templates/page-template-modal/components/block-preview.js
CHANGED
@@ -24,7 +24,7 @@ export default function ( { blocks, settings, hidePageTitle, recomputeBlockListK
|
|
24 |
<BlockEditorProvider value={ blocks } settings={ settings }>
|
25 |
<Disabled key={ recomputeBlockListKey }>
|
26 |
{ ! hidePageTitle && (
|
27 |
-
<div className="block-iframe-preview__template-title">
|
28 |
<PostTitle />
|
29 |
</div>
|
30 |
) }
|
24 |
<BlockEditorProvider value={ blocks } settings={ settings }>
|
25 |
<Disabled key={ recomputeBlockListKey }>
|
26 |
{ ! hidePageTitle && (
|
27 |
+
<div className="block-iframe-preview__template-title edit-post-visual-editor__post-title-wrapper">
|
28 |
<PostTitle />
|
29 |
</div>
|
30 |
) }
|
starter-page-templates/page-template-modal/components/template-selector-preview.js
CHANGED
@@ -14,7 +14,7 @@ const TemplateSelectorPreview = ( { blocks = [], viewportWidth, title } ) => {
|
|
14 |
const noBlocks = ! blocks.length;
|
15 |
return (
|
16 |
/* eslint-disable wpcalypso/jsx-classname-namespace */
|
17 |
-
<div className={ `template-selector-preview ${ noBlocks ? 'not-selected' : ''}` }>
|
18 |
{ noBlocks && (
|
19 |
<div className="editor-styles-wrapper">
|
20 |
<div className="template-selector-preview__empty-state">
|
14 |
const noBlocks = ! blocks.length;
|
15 |
return (
|
16 |
/* eslint-disable wpcalypso/jsx-classname-namespace */
|
17 |
+
<div className={ `template-selector-preview ${ noBlocks ? 'not-selected' : '' }` }>
|
18 |
{ noBlocks && (
|
19 |
<div className="editor-styles-wrapper">
|
20 |
<div className="template-selector-preview__empty-state">
|
wpcom-block-editor-nux/dist/wpcom-block-editor-nux.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill'), 'version' => '6cecd567afe9f5a0b92707b56a2bc396');
|