WooCommerce Gutenberg Products Block - Version 8.8.0

Version Description

  • 2022-10-24 =

Enhancements

  • Filter by Ratings: Add the Filter by Rating block to the feature plugin build. (7384)
  • Filter by Ratings: Improve accessibility by announcing the rating filter change. (7370)
  • Prevent resource hinting when cart/checkout blocks are not in use. (7364)
  • Separate filter title and filter controls by converting the Rating filter block to use Inner Blocks. (7362)
  • Products by Rating: Add support for Display Options. (7311)
  • Store API: Introduced woocommerce_store_api_add_to_cart_data hook. (7252)

Bug Fixes

  • Fix performance issue with the sidebar notices. (7435)
  • Fix mini cart items alignment issues in Editor. (7387)
  • Fix: Product Query: Update the Editor preview when custom attributes are changed. (7366)
  • Store API: Replaced wc()->api->get_endpoint_data usage in /cart/extensions to fix inconsistencies via filter hooks. (7361)
  • Fixes a fatal error with Cart Block usage in specific site configurations with multiple shipping countries. (6896)
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Gutenberg Products Block
Version 8.8.0
Comparing to
See all releases

Code changes from version 8.7.4 to 8.8.0

Files changed (49) hide show
  1. assets/js/atomic/blocks/product-elements/button/index.js +0 -1
  2. assets/js/atomic/blocks/product-elements/shared/config.tsx +1 -1
  3. assets/js/base/components/product-rating/index.tsx +2 -2
  4. assets/js/base/context/providers/cart-checkout/checkout-processor.js +1 -1
  5. assets/js/blocks/active-filters/block.tsx +10 -8
  6. assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-card.js +1 -1
  7. assets/js/blocks/cart-checkout-shared/sidebar-notices/index.tsx +7 -0
  8. assets/js/blocks/filter-wrapper/index.tsx +35 -1
  9. assets/js/blocks/filter-wrapper/register-components.ts +11 -0
  10. assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx +1 -1
  11. assets/js/blocks/product-query/constants.ts +1 -1
  12. assets/js/blocks/product-query/inspector-controls.tsx +12 -8
  13. assets/js/blocks/product-query/types.ts +1 -1
  14. assets/js/blocks/product-query/utils.tsx +1 -1
  15. assets/js/blocks/product-query/variations/product-query.tsx +1 -1
  16. assets/js/blocks/product-query/variations/products-on-sale.tsx +1 -1
  17. assets/js/blocks/rating-filter/attributes.ts +0 -11
  18. assets/js/blocks/rating-filter/block-wrapper.tsx +26 -0
  19. assets/js/blocks/rating-filter/block.json +16 -5
  20. assets/js/blocks/rating-filter/block.tsx +169 -84
  21. assets/js/blocks/rating-filter/edit.tsx +60 -12
  22. assets/js/blocks/rating-filter/frontend.ts +2 -8
  23. assets/js/blocks/rating-filter/index.tsx +5 -18
  24. assets/js/blocks/rating-filter/preview.tsx +63 -0
  25. assets/js/blocks/rating-filter/style.scss +35 -0
  26. assets/js/blocks/rating-filter/types.ts +2 -2
  27. assets/js/blocks/rating-filter/utils.ts +8 -0
  28. assets/js/data/payment/selectors.ts +0 -4
  29. build/active-filters-frontend.asset.php +1 -1
  30. build/active-filters-frontend.js +4 -4
  31. build/active-filters-wrapper-frontend.js +4 -4
  32. build/active-filters.asset.php +1 -1
  33. build/active-filters.js +4 -4
  34. build/all-products-frontend.asset.php +1 -1
  35. build/all-products-frontend.js +4 -4
  36. build/all-products.asset.php +1 -1
  37. build/all-products.js +14 -14
  38. build/all-reviews.asset.php +1 -1
  39. build/all-reviews.js +3 -3
  40. build/attribute-filter-frontend.asset.php +1 -1
  41. build/attribute-filter-frontend.js +7 -7
  42. build/attribute-filter-wrapper-frontend.js +5 -5
  43. build/attribute-filter.asset.php +1 -1
  44. build/attribute-filter.js +9 -9
  45. build/cart-blocks/cart-accepted-payment-methods-frontend.js +1 -1
  46. build/cart-blocks/cart-cross-sells-frontend.js +1 -1
  47. build/cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js +2 -2
  48. build/cart-blocks/cart-cross-sells-products-frontend.js +5 -5
  49. build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js +2 -2
assets/js/atomic/blocks/product-elements/button/index.js CHANGED
@@ -20,7 +20,6 @@ const blockConfig = {
20
  apiVersion: 2,
21
  title,
22
  description,
23
- parent: [ 'core/group' ],
24
  ancestor: [
25
  '@woocommerce/all-products',
26
  '@woocommerce/single-product',
20
  apiVersion: 2,
21
  title,
22
  description,
 
23
  ancestor: [
24
  '@woocommerce/all-products',
25
  '@woocommerce/single-product',
assets/js/atomic/blocks/product-elements/shared/config.tsx CHANGED
@@ -28,7 +28,7 @@ const sharedConfig: Omit< BlockConfiguration, 'attributes' | 'title' > = {
28
  supports: {
29
  html: false,
30
  },
31
- parent: [ '@woocommerce/all-products', '@woocommerce/single-product' ],
32
  save,
33
  deprecated: [
34
  {
28
  supports: {
29
  html: false,
30
  },
31
+ ancestor: [ '@woocommerce/all-products', '@woocommerce/single-product' ],
32
  save,
33
  deprecated: [
34
  {
assets/js/base/components/product-rating/index.tsx CHANGED
@@ -50,7 +50,7 @@ const Rating = ( {
50
  dangerouslySetInnerHTML={ ratingHTML }
51
  />
52
  </div>
53
- { ratedProductsCount ? `(${ ratedProductsCount })` : null }
54
  </div>
55
  );
56
  };
@@ -58,7 +58,7 @@ interface RatingProps {
58
  className: string;
59
  key: 0 | 1 | 2 | 3 | 4 | 5;
60
  rating: 0 | 1 | 2 | 3 | 4 | 5;
61
- ratedProductsCount: number;
62
  }
63
 
64
  export default Rating;
50
  dangerouslySetInnerHTML={ ratingHTML }
51
  />
52
  </div>
53
+ { ratedProductsCount !== null ? `(${ ratedProductsCount })` : null }
54
  </div>
55
  );
56
  };
58
  className: string;
59
  key: 0 | 1 | 2 | 3 | 4 | 5;
60
  rating: 0 | 1 | 2 | 3 | 4 | 5;
61
+ ratedProductsCount?: number | null;
62
  }
63
 
64
  export default Rating;
assets/js/base/context/providers/cart-checkout/checkout-processor.js CHANGED
@@ -86,7 +86,7 @@ const CheckoutProcessor = () => {
86
  paymentMethodData: store.getPaymentMethodData(),
87
  isExpressPaymentMethodActive: store.isExpressPaymentMethodActive(),
88
  currentPaymentStatus: store.getCurrentStatus(),
89
- shouldSavePayment: store.shouldSavePaymentMethod(),
90
  };
91
  }, [] );
92
 
86
  paymentMethodData: store.getPaymentMethodData(),
87
  isExpressPaymentMethodActive: store.isExpressPaymentMethodActive(),
88
  currentPaymentStatus: store.getCurrentStatus(),
89
+ shouldSavePayment: store.getShouldSavePaymentMethod(),
90
  };
91
  }, [] );
92
 
assets/js/blocks/active-filters/block.tsx CHANGED
@@ -234,15 +234,17 @@ const ActiveFiltersBlock = ( {
234
  slug
235
  ),
236
  removeCallback: () => {
237
- if ( filteringForPhpTemplate ) {
238
- return removeArgsFromFilterUrl( {
239
- rating_filter: slug,
240
- } );
241
- }
242
- const newRatings = productRatings.filter( ( rating ) => {
243
- return rating !== slug;
244
  } );
245
- setProductRatings( newRatings );
 
 
 
 
 
 
 
246
  },
247
  displayStyle: blockAttributes.displayStyle,
248
  } );
234
  slug
235
  ),
236
  removeCallback: () => {
237
+ removeArgsFromFilterUrl( {
238
+ rating_filter: slug,
 
 
 
 
 
239
  } );
240
+ if ( ! filteringForPhpTemplate ) {
241
+ const newRatings = productRatings.filter(
242
+ ( rating ) => {
243
+ return rating !== slug;
244
+ }
245
+ );
246
+ setProductRatings( newRatings );
247
+ }
248
  },
249
  displayStyle: blockAttributes.displayStyle,
250
  } );
assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-card.js CHANGED
@@ -30,7 +30,7 @@ const PaymentMethodCard = ( { children, showSaveOption } ) => {
30
  const checkoutStore = select( CHECKOUT_STORE_KEY );
31
  return {
32
  shouldSavePaymentMethod:
33
- paymentMethodStore.shouldSavePaymentMethod(),
34
  customerId: checkoutStore.getCustomerId(),
35
  };
36
  } );
30
  const checkoutStore = select( CHECKOUT_STORE_KEY );
31
  return {
32
  shouldSavePaymentMethod:
33
+ paymentMethodStore.getShouldSavePaymentMethod(),
34
  customerId: checkoutStore.getCustomerId(),
35
  };
36
  } );
assets/js/blocks/cart-checkout-shared/sidebar-notices/index.tsx CHANGED
@@ -30,6 +30,13 @@ declare module '@wordpress/block-editor' {
30
 
31
  const withSidebarNotices = createHigherOrderComponent(
32
  ( BlockEdit ) => ( props ) => {
 
 
 
 
 
 
 
33
  const addressFieldOrAccountBlocks = [
34
  'woocommerce/checkout-shipping-address-block',
35
  'woocommerce/checkout-billing-address-block',
30
 
31
  const withSidebarNotices = createHigherOrderComponent(
32
  ( BlockEdit ) => ( props ) => {
33
+ const { name: blockName, isSelected: isBlockSelected } = props;
34
+
35
+ // Show sidebar notices only when a WooCommerce block is selected.
36
+ if ( ! blockName.startsWith( 'woocommerce/' ) || ! isBlockSelected ) {
37
+ return <BlockEdit { ...props } />;
38
+ }
39
+
40
  const addressFieldOrAccountBlocks = [
41
  'woocommerce/checkout-shipping-address-block',
42
  'woocommerce/checkout-billing-address-block',
assets/js/blocks/filter-wrapper/index.tsx CHANGED
@@ -5,7 +5,14 @@ import { __ } from '@wordpress/i18n';
5
  import { registerBlockType } from '@wordpress/blocks';
6
  import { toggle } from '@woocommerce/icons';
7
  import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
8
- import { Icon, category, currencyDollar, box } from '@wordpress/icons';
 
 
 
 
 
 
 
9
 
10
  /**
11
  * Internal dependencies
@@ -129,5 +136,32 @@ registerBlockType( metadata, {
129
  ),
130
  },
131
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  ],
133
  } );
5
  import { registerBlockType } from '@wordpress/blocks';
6
  import { toggle } from '@woocommerce/icons';
7
  import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
8
+ import {
9
+ Icon,
10
+ category,
11
+ currencyDollar,
12
+ box,
13
+ starEmpty,
14
+ } from '@wordpress/icons';
15
+ import { isFeaturePluginBuild } from '@woocommerce/block-settings';
16
 
17
  /**
18
  * Internal dependencies
136
  ),
137
  },
138
  },
139
+ {
140
+ ...( isFeaturePluginBuild() && {
141
+ name: 'rating-filter',
142
+ title: __( 'Filter by Rating', 'woo-gutenberg-products-block' ),
143
+ description: __(
144
+ 'Enable customers to filter the product grid by rating.',
145
+ 'woo-gutenberg-products-block'
146
+ ),
147
+ isActive: ( attributes ) =>
148
+ attributes.filterType === 'rating-filter',
149
+ attributes: {
150
+ filterType: 'rating-filter',
151
+ heading: __(
152
+ 'Filter by rating',
153
+ 'woo-gutenberg-products-block'
154
+ ),
155
+ },
156
+ icon: {
157
+ src: (
158
+ <Icon
159
+ icon={ starEmpty }
160
+ className="wc-block-editor-components-block-icon"
161
+ />
162
+ ),
163
+ },
164
+ } ),
165
+ },
166
  ],
167
  } );
assets/js/blocks/filter-wrapper/register-components.ts CHANGED
@@ -52,3 +52,14 @@ registerBlockComponent( {
52
  )
53
  ),
54
  } );
 
 
 
 
 
 
 
 
 
 
 
52
  )
53
  ),
54
  } );
55
+
56
+ registerBlockComponent( {
57
+ blockName: 'woocommerce/rating-filter',
58
+ component: lazy(
59
+ () =>
60
+ import(
61
+ /* webpackChunkName: "rating-filter-wrapper" */
62
+ '../rating-filter/block-wrapper'
63
+ )
64
+ ),
65
+ } );
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx CHANGED
@@ -15,7 +15,7 @@ export const Edit = (): JSX.Element => {
15
  return (
16
  <div { ...blockProps }>
17
  <Noninteractive>
18
- <Block />
19
  </Noninteractive>
20
  </div>
21
  );
15
  return (
16
  <div { ...blockProps }>
17
  <Noninteractive>
18
+ <Block className="is-mobile" />
19
  </Noninteractive>
20
  </div>
21
  );
assets/js/blocks/product-query/constants.ts CHANGED
@@ -18,7 +18,7 @@ export const DEFAULT_ALLOWED_CONTROLS = [
18
  ];
19
 
20
  export const QUERY_DEFAULT_ATTRIBUTES: QueryBlockAttributes = {
21
- allowControls: DEFAULT_ALLOWED_CONTROLS,
22
  displayLayout: {
23
  type: 'flex',
24
  columns: 3,
18
  ];
19
 
20
  export const QUERY_DEFAULT_ATTRIBUTES: QueryBlockAttributes = {
21
+ allowedControls: DEFAULT_ALLOWED_CONTROLS,
22
  displayLayout: {
23
  type: 'flex',
24
  columns: 3,
assets/js/blocks/product-query/inspector-controls.tsx CHANGED
@@ -3,7 +3,7 @@
3
  */
4
  import { __ } from '@wordpress/i18n';
5
  import { InspectorControls } from '@wordpress/block-editor';
6
- import { ToggleControl } from '@wordpress/components';
7
  import { addFilter } from '@wordpress/hooks';
8
  import { EditorBlock } from '@woocommerce/types';
9
  import { ElementType } from 'react';
@@ -37,16 +37,20 @@ export const withProductQueryControls =
37
  < T extends EditorBlock< T > >( BlockEdit: ElementType ) =>
38
  ( props: ProductQueryBlock ) => {
39
  const allowedControls = useAllowedControls( props.attributes );
40
- return isWooQueryBlockVariation( props ) ? (
 
 
 
 
 
41
  <>
42
  <BlockEdit { ...props } />
43
  <InspectorControls>
44
- { Object.entries( INSPECTOR_CONTROLS ).map(
45
- ( [ key, Control ] ) =>
46
- allowedControls?.includes( key ) ? (
47
- <Control { ...props } />
48
- ) : null
49
- ) }
50
  </InspectorControls>
51
  </>
52
  ) : (
3
  */
4
  import { __ } from '@wordpress/i18n';
5
  import { InspectorControls } from '@wordpress/block-editor';
6
+ import { PanelBody, ToggleControl } from '@wordpress/components';
7
  import { addFilter } from '@wordpress/hooks';
8
  import { EditorBlock } from '@woocommerce/types';
9
  import { ElementType } from 'react';
37
  < T extends EditorBlock< T > >( BlockEdit: ElementType ) =>
38
  ( props: ProductQueryBlock ) => {
39
  const allowedControls = useAllowedControls( props.attributes );
40
+
41
+ const availableControls = Object.entries( INSPECTOR_CONTROLS ).filter(
42
+ ( [ key ] ) => allowedControls?.includes( key )
43
+ );
44
+ return isWooQueryBlockVariation( props ) &&
45
+ availableControls.length > 0 ? (
46
  <>
47
  <BlockEdit { ...props } />
48
  <InspectorControls>
49
+ <PanelBody>
50
+ { availableControls.map( ( [ key, Control ] ) => (
51
+ <Control key={ key } { ...props } />
52
+ ) ) }
53
+ </PanelBody>
 
54
  </InspectorControls>
55
  </>
56
  ) : (
assets/js/blocks/product-query/types.ts CHANGED
@@ -50,7 +50,7 @@ export interface ProductQueryAttributes {
50
  }
51
 
52
  export interface QueryBlockAttributes {
53
- allowControls?: string[];
54
  displayLayout?: {
55
  type: 'flex' | 'list';
56
  columns?: number;
50
  }
51
 
52
  export interface QueryBlockAttributes {
53
+ allowedControls?: string[];
54
  displayLayout?: {
55
  type: 'flex' | 'list';
56
  columns?: number;
assets/js/blocks/product-query/utils.tsx CHANGED
@@ -73,7 +73,7 @@ export function useAllowedControls(
73
  select( WP_BLOCKS_STORE ).getActiveBlockVariation(
74
  'core/query',
75
  attributes
76
- )?.allowControls,
77
 
78
  [ attributes ]
79
  );
73
  select( WP_BLOCKS_STORE ).getActiveBlockVariation(
74
  'core/query',
75
  attributes
76
+ )?.allowedControls,
77
 
78
  [ attributes ]
79
  );
assets/js/blocks/product-query/variations/product-query.tsx CHANGED
@@ -40,7 +40,7 @@ if ( isExperimentalBuild() ) {
40
  // https://github.com/WordPress/gutenberg/pull/43632
41
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
  // @ts-ignore
43
- allowControls: DEFAULT_ALLOWED_CONTROLS,
44
  innerBlocks: INNER_BLOCKS_TEMPLATE,
45
  scope: [ 'block', 'inserter' ],
46
  } );
40
  // https://github.com/WordPress/gutenberg/pull/43632
41
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
  // @ts-ignore
43
+ allowedControls: DEFAULT_ALLOWED_CONTROLS,
44
  innerBlocks: INNER_BLOCKS_TEMPLATE,
45
  scope: [ 'block', 'inserter' ],
46
  } );
assets/js/blocks/product-query/variations/products-on-sale.tsx CHANGED
@@ -46,7 +46,7 @@ if ( isExperimentalBuild() ) {
46
  // https://github.com/WordPress/gutenberg/pull/43632
47
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
48
  // @ts-ignore
49
- allowControls: ArrayXOR(
50
  DEFAULT_CORE_ALLOWED_CONTROLS,
51
  DISABLED_INSPECTOR_CONTROLS
52
  ),
46
  // https://github.com/WordPress/gutenberg/pull/43632
47
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
48
  // @ts-ignore
49
+ allowedControls: ArrayXOR(
50
  DEFAULT_CORE_ALLOWED_CONTROLS,
51
  DISABLED_INSPECTOR_CONTROLS
52
  ),
assets/js/blocks/rating-filter/attributes.ts DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
-
6
- export const blockAttributes = {
7
- heading: {
8
- type: 'string',
9
- default: __( 'Filter by rating', 'woo-gutenberg-products-block' ),
10
- },
11
- };
 
 
 
 
 
 
 
 
 
 
 
assets/js/blocks/rating-filter/block-wrapper.tsx ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { useColorProps } from '@woocommerce/base-hooks';
5
+ import { isString } from '@woocommerce/types';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import Block from './block';
11
+ import { parseAttributes } from './utils';
12
+
13
+ const BlockWrapper = ( props: Record< string, unknown > ) => {
14
+ const colorProps = useColorProps( props );
15
+
16
+ return (
17
+ <div
18
+ className={ isString( props.className ) ? props.className : '' }
19
+ style={ { ...colorProps.style } }
20
+ >
21
+ <Block isEditor={ false } attributes={ parseAttributes( props ) } />
22
+ </div>
23
+ );
24
+ };
25
+
26
+ export default BlockWrapper;
assets/js/blocks/rating-filter/block.json CHANGED
@@ -1,13 +1,20 @@
1
  {
2
  "name": "woocommerce/rating-filter",
3
  "version": "1.0.0",
4
- "title": "Filter by Rating",
5
  "description": "Enable customers to filter the product grid by rating.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
9
  "html": false,
10
- "multiple": false
 
 
 
 
 
 
 
11
  },
12
  "example": {
13
  "attributes": {
@@ -19,9 +26,13 @@
19
  "type": "string",
20
  "default": ""
21
  },
22
- "headingLevel": {
23
- "type": "number",
24
- "default": 3
 
 
 
 
25
  },
26
  "isPreview": {
27
  "type": "boolean",
1
  {
2
  "name": "woocommerce/rating-filter",
3
  "version": "1.0.0",
4
+ "title": "Filter by Rating Controls",
5
  "description": "Enable customers to filter the product grid by rating.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
9
  "html": false,
10
+ "multiple": false,
11
+ "color": {
12
+ "__experimentalDefaultControls": {
13
+ "text": true
14
+ }
15
+ },
16
+ "inserter": false,
17
+ "lock": false
18
  },
19
  "example": {
20
  "attributes": {
26
  "type": "string",
27
  "default": ""
28
  },
29
+ "showCounts": {
30
+ "type": "boolean",
31
+ "default": true
32
+ },
33
+ "showFilterButton": {
34
+ "type": "boolean",
35
+ "default": false
36
  },
37
  "isPreview": {
38
  "type": "boolean",
assets/js/blocks/rating-filter/block.tsx CHANGED
@@ -1,6 +1,8 @@
1
  /**
2
  * External dependencies
3
  */
 
 
4
  import Rating from '@woocommerce/base-components/product-rating';
5
  import { usePrevious, useShallowEqual } from '@woocommerce/base-hooks';
6
  import {
@@ -10,10 +12,11 @@ import {
10
  } from '@woocommerce/base-context/hooks';
11
  import { getSettingWithCoercion } from '@woocommerce/settings';
12
  import { isBoolean, isObject, objectHasProp } from '@woocommerce/types';
13
- import FilterTitlePlaceholder from '@woocommerce/base-components/filter-placeholder';
14
  import isShallowEqual from '@wordpress/is-shallow-equal';
15
  import { useState, useCallback, useMemo, useEffect } from '@wordpress/element';
16
  import CheckboxList from '@woocommerce/base-components/checkbox-list';
 
 
17
  import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
18
  import { changeUrl } from '@woocommerce/utils';
19
  import classnames from 'classnames';
@@ -21,14 +24,16 @@ import classnames from 'classnames';
21
  /**
22
  * Internal dependencies
23
  */
 
24
  import './style.scss';
25
  import { Attributes } from './types';
26
  import { getActiveFilters } from './utils';
 
27
 
28
  export const QUERY_PARAM_KEY = 'rating_filter';
29
 
30
  /**
31
- * Component displaying an stock status filter.
32
  *
33
  * @param {Object} props Incoming props for the component.
34
  * @param {Object} props.attributes Incoming block attributes.
@@ -41,6 +46,8 @@ const RatingFilterBlock = ( {
41
  attributes: Attributes;
42
  isEditor?: boolean;
43
  } ) => {
 
 
44
  const filteringForPhpTemplate = getSettingWithCoercion(
45
  'is_rendering_php_template',
46
  false,
@@ -57,17 +64,23 @@ const RatingFilterBlock = ( {
57
  queryState,
58
  } );
59
 
60
- const TagName =
61
- `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
62
- const isLoading = ! blockAttributes.isPreview && filteredCountsLoading;
63
- const isDisabled = ! blockAttributes.isPreview && ! filteredCountsLoading;
 
 
 
 
 
 
64
 
65
  const initialFilters = useMemo(
66
  () => getActiveFilters( 'rating_filter' ),
67
  []
68
  );
69
 
70
- const [ clicked, setClicked ] = useState( initialFilters );
71
 
72
  const [ productRatings, setProductRatings ] =
73
  useQueryStateByKey( 'rating' );
@@ -77,19 +90,17 @@ const RatingFilterBlock = ( {
77
  initialFilters
78
  );
79
 
80
- const productRatingsArray: string[] = Array.from( productRatings );
81
-
82
  /**
83
  * Used to redirect the page when filters are changed so templates using the Classic Template block can filter.
84
  *
85
- * @param {Array} clickedRatings Array of clicked ratings.
86
  */
87
- const updateFilterUrl = ( clickedRatings: string[] ) => {
88
  if ( ! window ) {
89
  return;
90
  }
91
 
92
- if ( clickedRatings.length === 0 ) {
93
  const url = removeQueryArgs(
94
  window.location.href,
95
  QUERY_PARAM_KEY
@@ -103,7 +114,7 @@ const RatingFilterBlock = ( {
103
  }
104
 
105
  const newUrl = addQueryArgs( window.location.href, {
106
- [ QUERY_PARAM_KEY ]: clickedRatings.join( ',' ),
107
  } );
108
 
109
  if ( newUrl === window.location.href ) {
@@ -114,39 +125,41 @@ const RatingFilterBlock = ( {
114
  };
115
 
116
  const onSubmit = useCallback(
117
- ( isClicked ) => {
118
  if ( isEditor ) {
119
  return;
120
  }
121
- if ( isClicked && ! filteringForPhpTemplate ) {
122
- setProductRatingsQuery( clicked );
123
  }
124
 
125
- updateFilterUrl( clicked );
126
  },
127
- [ isEditor, setProductRatingsQuery, clicked, filteringForPhpTemplate ]
128
  );
129
 
130
- // Track clicked STATE changes - if state changes, update the query.
131
  useEffect( () => {
132
- onSubmit( clicked );
133
- }, [ clicked, onSubmit ] );
 
 
134
 
135
- const clickedQuery = useMemo( () => {
136
  return productRatingsQuery;
137
  }, [ productRatingsQuery ] );
138
 
139
- const currentClickedQuery = useShallowEqual( clickedQuery );
140
- const previousClickedQuery = usePrevious( currentClickedQuery );
141
  // Track Rating query changes so the block reflects current filters.
142
  useEffect( () => {
143
  if (
144
- ! isShallowEqual( previousClickedQuery, currentClickedQuery ) && // Clicked query changed.
145
- ! isShallowEqual( clicked, currentClickedQuery ) // Clicked query doesn't match the UI.
146
  ) {
147
- setClicked( currentClickedQuery );
148
  }
149
- }, [ clicked, currentClickedQuery, previousClickedQuery ] );
150
 
151
  /**
152
  * Try get the rating filter from the URL.
@@ -163,75 +176,122 @@ const RatingFilterBlock = ( {
163
  initialFilters,
164
  ] );
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  /**
167
  * When a checkbox in the list changes, update state.
168
  */
169
  const onClick = useCallback(
170
- ( clickedValue: string ) => {
171
- if ( ! productRatingsArray.length ) {
172
- setProductRatings( [ clickedValue ] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  } else {
174
- const previouslyClicked =
175
- productRatingsArray.includes( clickedValue );
176
- const newClicked = productRatingsArray.filter(
177
- ( value ) => value !== clickedValue
 
 
 
 
 
178
  );
179
- if ( ! previouslyClicked ) {
180
- newClicked.push( clickedValue );
181
- newClicked.sort();
182
- }
183
- setProductRatings( newClicked );
184
  }
 
185
  },
186
- [ productRatingsArray, setProductRatings ]
187
  );
188
 
189
- const heading = (
190
- <TagName className="wc-block-rating-filter__title">
191
- { blockAttributes.heading }
192
- </TagName>
193
- );
194
 
195
- const filterHeading = isLoading ? (
196
- <FilterTitlePlaceholder>{ heading }</FilterTitlePlaceholder>
197
- ) : (
198
- heading
199
  );
200
 
201
- const orderedRatings =
202
- ! filteredCountsLoading &&
203
- objectHasProp( filteredCounts, 'rating_counts' ) &&
204
- Array.isArray( filteredCounts.rating_counts )
205
- ? [ ...filteredCounts.rating_counts ].reverse()
206
- : [];
207
-
208
- const displayedOptions = orderedRatings
209
- .filter(
210
- ( item ) => isObject( item ) && Object.keys( item ).length > 0
211
- )
212
- .map( ( item ) => {
213
- return {
214
- label: (
215
- <Rating
216
- className={
217
- productRatingsArray.includes(
218
- item?.rating?.toString()
219
- )
220
- ? 'is-active'
221
- : ''
222
- }
223
- key={ item?.rating }
224
- rating={ item?.rating }
225
- ratedProductsCount={ item?.count }
226
- />
227
- ),
228
- value: item?.rating?.toString(),
229
- };
230
- } );
231
 
232
  return (
233
  <>
234
- { ! isEditor && blockAttributes.heading && filterHeading }
235
  <div
236
  className={ classnames( 'wc-block-rating-filter', {
237
  'is-loading': isLoading,
@@ -240,14 +300,39 @@ const RatingFilterBlock = ( {
240
  <CheckboxList
241
  className={ 'wc-block-rating-filter-list' }
242
  options={ displayedOptions }
243
- checked={ productRatingsArray }
244
- onChange={ ( checked ) => {
245
- onClick( checked.toString() );
246
  } }
247
  isLoading={ isLoading }
248
  isDisabled={ isDisabled }
249
  />
250
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  </>
252
  );
253
  };
1
  /**
2
  * External dependencies
3
  */
4
+ import { __, sprintf } from '@wordpress/i18n';
5
+ import { speak } from '@wordpress/a11y';
6
  import Rating from '@woocommerce/base-components/product-rating';
7
  import { usePrevious, useShallowEqual } from '@woocommerce/base-hooks';
8
  import {
12
  } from '@woocommerce/base-context/hooks';
13
  import { getSettingWithCoercion } from '@woocommerce/settings';
14
  import { isBoolean, isObject, objectHasProp } from '@woocommerce/types';
 
15
  import isShallowEqual from '@wordpress/is-shallow-equal';
16
  import { useState, useCallback, useMemo, useEffect } from '@wordpress/element';
17
  import CheckboxList from '@woocommerce/base-components/checkbox-list';
18
+ import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
19
+ import FilterResetButton from '@woocommerce/base-components/filter-reset-button';
20
  import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
21
  import { changeUrl } from '@woocommerce/utils';
22
  import classnames from 'classnames';
24
  /**
25
  * Internal dependencies
26
  */
27
+ import { previewOptions } from './preview';
28
  import './style.scss';
29
  import { Attributes } from './types';
30
  import { getActiveFilters } from './utils';
31
+ import { useSetWraperVisibility } from '../filter-wrapper/context';
32
 
33
  export const QUERY_PARAM_KEY = 'rating_filter';
34
 
35
  /**
36
+ * Component displaying a rating filter.
37
  *
38
  * @param {Object} props Incoming props for the component.
39
  * @param {Object} props.attributes Incoming block attributes.
46
  attributes: Attributes;
47
  isEditor?: boolean;
48
  } ) => {
49
+ const setWrapperVisibility = useSetWraperVisibility();
50
+
51
  const filteringForPhpTemplate = getSettingWithCoercion(
52
  'is_rendering_php_template',
53
  false,
64
  queryState,
65
  } );
66
 
67
+ const [ displayedOptions, setDisplayedOptions ] = useState(
68
+ blockAttributes.isPreview ? previewOptions : []
69
+ );
70
+
71
+ const isLoading =
72
+ ! blockAttributes.isPreview &&
73
+ filteredCountsLoading &&
74
+ displayedOptions.length === 0;
75
+
76
+ const isDisabled = ! blockAttributes.isPreview && filteredCountsLoading;
77
 
78
  const initialFilters = useMemo(
79
  () => getActiveFilters( 'rating_filter' ),
80
  []
81
  );
82
 
83
+ const [ checked, setChecked ] = useState( initialFilters );
84
 
85
  const [ productRatings, setProductRatings ] =
86
  useQueryStateByKey( 'rating' );
90
  initialFilters
91
  );
92
 
 
 
93
  /**
94
  * Used to redirect the page when filters are changed so templates using the Classic Template block can filter.
95
  *
96
+ * @param {Array} checkedRatings Array of checked ratings.
97
  */
98
+ const updateFilterUrl = ( checkedRatings: string[] ) => {
99
  if ( ! window ) {
100
  return;
101
  }
102
 
103
+ if ( checkedRatings.length === 0 ) {
104
  const url = removeQueryArgs(
105
  window.location.href,
106
  QUERY_PARAM_KEY
114
  }
115
 
116
  const newUrl = addQueryArgs( window.location.href, {
117
+ [ QUERY_PARAM_KEY ]: checkedRatings.join( ',' ),
118
  } );
119
 
120
  if ( newUrl === window.location.href ) {
125
  };
126
 
127
  const onSubmit = useCallback(
128
+ ( checkedOptions ) => {
129
  if ( isEditor ) {
130
  return;
131
  }
132
+ if ( checkedOptions && ! filteringForPhpTemplate ) {
133
+ setProductRatingsQuery( checkedOptions );
134
  }
135
 
136
+ updateFilterUrl( checkedOptions );
137
  },
138
+ [ isEditor, setProductRatingsQuery, filteringForPhpTemplate ]
139
  );
140
 
141
+ // Track checked STATE changes - if state changes, update the query.
142
  useEffect( () => {
143
+ if ( ! blockAttributes.showFilterButton ) {
144
+ onSubmit( checked );
145
+ }
146
+ }, [ blockAttributes.showFilterButton, checked, onSubmit ] );
147
 
148
+ const checkedQuery = useMemo( () => {
149
  return productRatingsQuery;
150
  }, [ productRatingsQuery ] );
151
 
152
+ const currentCheckedQuery = useShallowEqual( checkedQuery );
153
+ const previousCheckedQuery = usePrevious( currentCheckedQuery );
154
  // Track Rating query changes so the block reflects current filters.
155
  useEffect( () => {
156
  if (
157
+ ! isShallowEqual( previousCheckedQuery, currentCheckedQuery ) && // Checked query changed.
158
+ ! isShallowEqual( checked, currentCheckedQuery ) // Checked query doesn't match the UI.
159
  ) {
160
+ setChecked( currentCheckedQuery );
161
  }
162
+ }, [ checked, currentCheckedQuery, previousCheckedQuery ] );
163
 
164
  /**
165
  * Try get the rating filter from the URL.
176
  initialFilters,
177
  ] );
178
 
179
+ /**
180
+ * Compare intersection of all ratings and filtered counts to get a list of options to display.
181
+ */
182
+ useEffect( () => {
183
+ /**
184
+ * Checks if a status slug is in the query state.
185
+ *
186
+ * @param {string} queryStatus The status slug to check.
187
+ */
188
+
189
+ if ( filteredCountsLoading || blockAttributes.isPreview ) {
190
+ return;
191
+ }
192
+ const orderedRatings =
193
+ ! filteredCountsLoading &&
194
+ objectHasProp( filteredCounts, 'rating_counts' ) &&
195
+ Array.isArray( filteredCounts.rating_counts )
196
+ ? [ ...filteredCounts.rating_counts ].reverse()
197
+ : [];
198
+
199
+ const newOptions = orderedRatings
200
+ .filter(
201
+ ( item ) => isObject( item ) && Object.keys( item ).length > 0
202
+ )
203
+ .map( ( item ) => {
204
+ return {
205
+ label: (
206
+ <Rating
207
+ className={
208
+ Array.from( productRatings ).includes(
209
+ item?.rating?.toString()
210
+ )
211
+ ? 'is-active'
212
+ : ''
213
+ }
214
+ key={ item?.rating }
215
+ rating={ item?.rating }
216
+ ratedProductsCount={
217
+ blockAttributes.showCounts ? item?.count : null
218
+ }
219
+ />
220
+ ),
221
+ value: item?.rating?.toString(),
222
+ };
223
+ } );
224
+
225
+ setDisplayedOptions( newOptions );
226
+ }, [
227
+ blockAttributes.showCounts,
228
+ blockAttributes.isPreview,
229
+ filteredCounts,
230
+ filteredCountsLoading,
231
+ productRatings,
232
+ ] );
233
+
234
  /**
235
  * When a checkbox in the list changes, update state.
236
  */
237
  const onClick = useCallback(
238
+ ( checkedValue: string ) => {
239
+ const previouslyChecked = checked.includes( checkedValue );
240
+
241
+ const newChecked = checked.filter(
242
+ ( value ) => value !== checkedValue
243
+ );
244
+
245
+ if ( ! previouslyChecked ) {
246
+ newChecked.push( checkedValue );
247
+ newChecked.sort();
248
+ speak(
249
+ sprintf(
250
+ /* translators: %s is referring to the average rating value */
251
+ __(
252
+ 'Rated %s out of 5 filter added.',
253
+ 'woo-gutenberg-products-block'
254
+ ),
255
+ checkedValue
256
+ )
257
+ );
258
  } else {
259
+ speak(
260
+ sprintf(
261
+ /* translators: %s is referring to the average rating value */
262
+ __(
263
+ 'Rated %s out of 5 filter removed.',
264
+ 'woo-gutenberg-products-block'
265
+ ),
266
+ checkedValue
267
+ )
268
  );
 
 
 
 
 
269
  }
270
+ setChecked( newChecked );
271
  },
272
+ [ checked ]
273
  );
274
 
275
+ if ( ! filteredCountsLoading && displayedOptions.length === 0 ) {
276
+ setWrapperVisibility( false );
277
+ return null;
278
+ }
 
279
 
280
+ const hasFilterableProducts = getSettingWithCoercion(
281
+ 'has_filterable_products',
282
+ false,
283
+ isBoolean
284
  );
285
 
286
+ if ( ! hasFilterableProducts ) {
287
+ setWrapperVisibility( false );
288
+ return null;
289
+ }
290
+
291
+ setWrapperVisibility( true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
 
293
  return (
294
  <>
 
295
  <div
296
  className={ classnames( 'wc-block-rating-filter', {
297
  'is-loading': isLoading,
300
  <CheckboxList
301
  className={ 'wc-block-rating-filter-list' }
302
  options={ displayedOptions }
303
+ checked={ checked }
304
+ onChange={ ( item ) => {
305
+ onClick( item.toString() );
306
  } }
307
  isLoading={ isLoading }
308
  isDisabled={ isDisabled }
309
  />
310
  </div>
311
+ {
312
+ <div className="wc-block-rating-filter__actions">
313
+ { checked.length > 0 && ! isLoading && (
314
+ <FilterResetButton
315
+ onClick={ () => {
316
+ setChecked( [] );
317
+ setProductRatings( [] );
318
+ onSubmit( [] );
319
+ } }
320
+ screenReaderLabel={ __(
321
+ 'Reset rating filter',
322
+ 'woo-gutenberg-products-block'
323
+ ) }
324
+ />
325
+ ) }
326
+ { blockAttributes.showFilterButton && (
327
+ <FilterSubmitButton
328
+ className="wc-block-rating-filter__button"
329
+ isLoading={ isLoading }
330
+ disabled={ isLoading || isDisabled }
331
+ onClick={ () => onSubmit( checked ) }
332
+ />
333
+ ) }
334
+ </div>
335
+ }
336
  </>
337
  );
338
  };
assets/js/blocks/rating-filter/edit.tsx CHANGED
@@ -1,10 +1,15 @@
1
  /**
2
  * External dependencies
3
  */
 
4
  import classnames from 'classnames';
5
- import { useBlockProps } from '@wordpress/block-editor';
6
- import { Disabled, withSpokenMessages } from '@wordpress/components';
7
- import BlockTitle from '@woocommerce/editor-components/block-title';
 
 
 
 
8
  import type { BlockEditProps } from '@wordpress/blocks';
9
 
10
  /**
@@ -17,24 +22,67 @@ const Edit = ( {
17
  attributes,
18
  setAttributes,
19
  }: BlockEditProps< Attributes > ) => {
20
- const { className, heading, headingLevel } = attributes;
21
 
22
  const blockProps = useBlockProps( {
23
  className: classnames( 'wc-block-rating-filter', className ),
24
  } );
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  return (
27
  <>
 
28
  {
29
  <div { ...blockProps }>
30
- <BlockTitle
31
- className="wc-block-rating-filter__title"
32
- headingLevel={ headingLevel }
33
- heading={ heading }
34
- onChange={ ( value: string ) =>
35
- setAttributes( { heading: value } )
36
- }
37
- />
38
  <Disabled>
39
  <Block attributes={ attributes } isEditor={ true } />
40
  </Disabled>
1
  /**
2
  * External dependencies
3
  */
4
+ import { __ } from '@wordpress/i18n';
5
  import classnames from 'classnames';
6
+ import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
7
+ import {
8
+ Disabled,
9
+ PanelBody,
10
+ ToggleControl,
11
+ withSpokenMessages,
12
+ } from '@wordpress/components';
13
  import type { BlockEditProps } from '@wordpress/blocks';
14
 
15
  /**
22
  attributes,
23
  setAttributes,
24
  }: BlockEditProps< Attributes > ) => {
25
+ const { className, showCounts, showFilterButton } = attributes;
26
 
27
  const blockProps = useBlockProps( {
28
  className: classnames( 'wc-block-rating-filter', className ),
29
  } );
30
 
31
+ const getInspectorControls = () => {
32
+ return (
33
+ <InspectorControls key="inspector">
34
+ <PanelBody
35
+ title={ __( 'Content', 'woo-gutenberg-products-block' ) }
36
+ >
37
+ <ToggleControl
38
+ label={ __(
39
+ 'Display product count',
40
+ 'woo-gutenberg-products-block'
41
+ ) }
42
+ checked={ showCounts }
43
+ onChange={ () =>
44
+ setAttributes( {
45
+ showCounts: ! showCounts,
46
+ } )
47
+ }
48
+ />
49
+ </PanelBody>
50
+ <PanelBody
51
+ title={ __( 'Settings', 'woo-gutenberg-products-block' ) }
52
+ >
53
+ <ToggleControl
54
+ label={ __(
55
+ "Show 'Apply filters' button",
56
+ 'woo-gutenberg-products-block'
57
+ ) }
58
+ help={
59
+ showFilterButton
60
+ ? __(
61
+ 'Products will only update when the button is clicked.',
62
+ 'woo-gutenberg-products-block'
63
+ )
64
+ : __(
65
+ 'Products will update as soon as attributes are selected.',
66
+ 'woo-gutenberg-products-block'
67
+ )
68
+ }
69
+ checked={ showFilterButton }
70
+ onChange={ ( value ) =>
71
+ setAttributes( {
72
+ showFilterButton: value,
73
+ } )
74
+ }
75
+ />
76
+ </PanelBody>
77
+ </InspectorControls>
78
+ );
79
+ };
80
+
81
  return (
82
  <>
83
+ { getInspectorControls() }
84
  {
85
  <div { ...blockProps }>
 
 
 
 
 
 
 
 
86
  <Disabled>
87
  <Block attributes={ attributes } isEditor={ true } />
88
  </Disabled>
assets/js/blocks/rating-filter/frontend.ts CHANGED
@@ -7,17 +7,11 @@ import { renderFrontend } from '@woocommerce/base-utils';
7
  * Internal dependencies
8
  */
9
  import Block from './block';
10
- import metadata from './block.json';
11
- import { blockAttributes } from './attributes';
12
 
13
  const getProps = ( el: HTMLElement ) => {
14
  return {
15
- attributes: {
16
- heading: el.dataset.heading || blockAttributes.heading.default,
17
- headingLevel: el.dataset.headingLevel
18
- ? parseInt( el.dataset.headingLevel, 10 )
19
- : metadata.attributes.headingLevel.default,
20
- },
21
  isEditor: false,
22
  };
23
  };
7
  * Internal dependencies
8
  */
9
  import Block from './block';
10
+ import { parseAttributes } from './utils';
 
11
 
12
  const getProps = ( el: HTMLElement ) => {
13
  return {
14
+ attributes: parseAttributes( el.dataset ),
 
 
 
 
 
15
  isEditor: false,
16
  };
17
  };
assets/js/blocks/rating-filter/index.tsx CHANGED
@@ -1,8 +1,7 @@
1
  /**
2
  * External dependencies
3
  */
4
- import { __ } from '@wordpress/i18n';
5
- import { isExperimentalBuild } from '@woocommerce/block-settings';
6
  import { createBlock, registerBlockType } from '@wordpress/blocks';
7
  import { Icon, starEmpty } from '@wordpress/icons';
8
  import classNames from 'classnames';
@@ -13,10 +12,9 @@ import { useBlockProps } from '@wordpress/block-editor';
13
  */
14
  import edit from './edit';
15
  import metadata from './block.json';
16
- import { blockAttributes } from './attributes';
17
  import type { Attributes } from './types';
18
 
19
- if ( isExperimentalBuild() ) {
20
  registerBlockType( metadata, {
21
  icon: {
22
  src: (
@@ -28,7 +26,6 @@ if ( isExperimentalBuild() ) {
28
  },
29
  attributes: {
30
  ...metadata.attributes,
31
- ...blockAttributes,
32
  },
33
  transforms: {
34
  from: [
@@ -39,26 +36,16 @@ if ( isExperimentalBuild() ) {
39
  isMatch: ( { idBase, instance } ) =>
40
  idBase === 'woocommerce_rating_filter' &&
41
  !! instance?.raw,
42
- transform: ( { instance } ) =>
43
- createBlock( 'woocommerce/rating-filter', {
44
- heading:
45
- instance?.raw?.title ||
46
- __(
47
- 'Filter by rating',
48
- 'woo-gutenberg-products-block'
49
- ),
50
- headingLevel: 3,
51
- } ),
52
  },
53
  ],
54
  },
55
  edit,
56
  // Save the props to post content.
57
  save( { attributes }: { attributes: Attributes } ) {
58
- const { className, heading, headingLevel } = attributes;
59
  const data: Record< string, unknown > = {
60
- 'data-heading': heading,
61
- 'data-heading-level': headingLevel,
62
  };
63
  return (
64
  <div
1
  /**
2
  * External dependencies
3
  */
4
+ import { isFeaturePluginBuild } from '@woocommerce/block-settings';
 
5
  import { createBlock, registerBlockType } from '@wordpress/blocks';
6
  import { Icon, starEmpty } from '@wordpress/icons';
7
  import classNames from 'classnames';
12
  */
13
  import edit from './edit';
14
  import metadata from './block.json';
 
15
  import type { Attributes } from './types';
16
 
17
+ if ( isFeaturePluginBuild() ) {
18
  registerBlockType( metadata, {
19
  icon: {
20
  src: (
26
  },
27
  attributes: {
28
  ...metadata.attributes,
 
29
  },
30
  transforms: {
31
  from: [
36
  isMatch: ( { idBase, instance } ) =>
37
  idBase === 'woocommerce_rating_filter' &&
38
  !! instance?.raw,
39
+ transform: () => createBlock( 'woocommerce/rating-filter' ),
 
 
 
 
 
 
 
 
 
40
  },
41
  ],
42
  },
43
  edit,
44
  // Save the props to post content.
45
  save( { attributes }: { attributes: Attributes } ) {
46
+ const { className, showCounts } = attributes;
47
  const data: Record< string, unknown > = {
48
+ 'data-show-counts': showCounts,
 
49
  };
50
  return (
51
  <div
assets/js/blocks/rating-filter/preview.tsx ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+
5
+ import Rating from '@woocommerce/base-components/product-rating';
6
+
7
+ export const previewOptions = [
8
+ {
9
+ label: (
10
+ <Rating
11
+ className={ '' }
12
+ key={ 5 }
13
+ rating={ 5 }
14
+ ratedProductsCount={ 5 }
15
+ />
16
+ ),
17
+ value: '5',
18
+ },
19
+ {
20
+ label: (
21
+ <Rating
22
+ className={ '' }
23
+ key={ 4 }
24
+ rating={ 4 }
25
+ ratedProductsCount={ 4 }
26
+ />
27
+ ),
28
+ value: '4',
29
+ },
30
+ {
31
+ label: (
32
+ <Rating
33
+ className={ '' }
34
+ key={ 3 }
35
+ rating={ 3 }
36
+ ratedProductsCount={ 3 }
37
+ />
38
+ ),
39
+ value: '3',
40
+ },
41
+ {
42
+ label: (
43
+ <Rating
44
+ className={ '' }
45
+ key={ 2 }
46
+ rating={ 2 }
47
+ ratedProductsCount={ 2 }
48
+ />
49
+ ),
50
+ value: '2',
51
+ },
52
+ {
53
+ label: (
54
+ <Rating
55
+ className={ '' }
56
+ key={ 1 }
57
+ rating={ 1 }
58
+ ratedProductsCount={ 1 }
59
+ />
60
+ ),
61
+ value: '1',
62
+ },
63
+ ];
assets/js/blocks/rating-filter/style.scss CHANGED
@@ -24,3 +24,38 @@
24
  cursor: pointer;
25
  }
26
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  cursor: pointer;
25
  }
26
  }
27
+
28
+ .wc-block-rating-filter__actions {
29
+ align-items: center;
30
+ display: flex;
31
+ gap: $gap;
32
+ justify-content: flex-end;
33
+ margin-top: $gap;
34
+
35
+ .wc-block-components-filter-submit-button {
36
+ margin-left: 0;
37
+
38
+ &:disabled {
39
+ opacity: 0.6;
40
+ cursor: auto;
41
+ }
42
+ }
43
+
44
+ // The specificity here is needed to overwrite the margin-top that is inherited on WC block template pages such as Shop.
45
+ button[type="submit"]:not(.wp-block-search__button).wc-block-components-filter-submit-button {
46
+ margin-left: 0;
47
+ margin-top: 0;
48
+ }
49
+
50
+ .wc-block-rating-filter__button {
51
+ margin-top: em($gap-smaller);
52
+ padding: em($gap-smaller) em($gap);
53
+ @include font-size(small);
54
+ }
55
+ }
56
+
57
+ .editor-styles-wrapper .wc-block-rating-filter .wc-block-rating-filter__button {
58
+ margin-top: em($gap-smaller);
59
+ padding: em($gap-smaller) em($gap);
60
+ @include font-size(small);
61
+ }
assets/js/blocks/rating-filter/types.ts CHANGED
@@ -1,7 +1,7 @@
1
  export interface Attributes {
2
  className?: string;
3
- heading: string;
4
- headingLevel: number;
5
  isPreview?: boolean;
6
  }
7
 
1
  export interface Attributes {
2
  className?: string;
3
+ showCounts: boolean;
4
+ showFilterButton: boolean;
5
  isPreview?: boolean;
6
  }
7
 
assets/js/blocks/rating-filter/utils.ts CHANGED
@@ -17,3 +17,11 @@ export const getActiveFilters = ( queryParamKey = 'filter_rating' ) => {
17
 
18
  return parsedParams;
19
  };
 
 
 
 
 
 
 
 
17
 
18
  return parsedParams;
19
  };
20
+
21
+ export const parseAttributes = ( data: Record< string, unknown > ) => {
22
+ return {
23
+ showFilterButton: data?.showFilterButton === 'true',
24
+ showCounts: data?.showCounts !== 'false',
25
+ isPreview: false,
26
+ };
27
+ };
assets/js/data/payment/selectors.ts CHANGED
@@ -63,10 +63,6 @@ export const getActiveSavedPaymentMethods = (
63
  );
64
  };
65
 
66
- export const shouldSavePaymentMethod = ( state: PaymentMethodDataState ) => {
67
- return state.shouldSavePaymentMethod;
68
- };
69
-
70
  export const paymentMethodsInitialized = ( state: PaymentMethodDataState ) => {
71
  return state.paymentMethodsInitialized;
72
  };
63
  );
64
  };
65
 
 
 
 
 
66
  export const paymentMethodsInitialized = ( state: PaymentMethodDataState ) => {
67
  return state.paymentMethodsInitialized;
68
  };
build/active-filters-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '5ada1a664e1e4b33b0857d9d6f466cc6');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '5cd9b5d858dbe1ca1b541239d6a504fd');
build/active-filters-frontend.js CHANGED
@@ -1,10 +1,10 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=247)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},11:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},111:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...c}=e;return Object(n.cloneElement)(t,{width:r,height:r,...c})}},112:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(6);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),s=o.length?o[0]:null;if(!(s&&s.slug&&Array.isArray(s.slug)&&s.slug.includes(c)))return;const a=s.slug.filter(e=>e!==c),i=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(s.slug=a.sort(),i.push(s)),t(Object(n.sortBy)(i,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const s=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(s):(s.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(s,"attribute"))),s}},119:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},s=e=>{if(e)return c.find(t=>t.taxonomy===e)}},12:function(e,t){e.exports=window.wp.isShallowEqual},13:function(e,t){e.exports=window.wp.url},138:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters Controls","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},14:function(e,t){e.exports=window.wp.primitives},15:function(e,t,r){"use strict";var n=r(16),c=r.n(n),o=r(0),s=r(7),a=r(1),i=r(44),l=e=>{let{imageUrl:t=i.l+"/block-error.svg",header:r=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:c,errorMessagePrefix:s=Object(a.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(o.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(o.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(o.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(o.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(o.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),c&&Object(o.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",c),l&&Object(o.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(33);class u extends s.Component{constructor(){super(...arguments),c()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(o.createElement)(o.Fragment,null,Object(o.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:c,errorMessagePrefix:s,renderError:a,button:i}=this.props,{errorMessage:u,hasError:b}=this.state;return b?"function"==typeof a?a({errorMessage:u}):Object(o.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:c,errorMessagePrefix:s,button:i}):this.props.children}}t.a=u},158:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(30),s=r(2),a=r(5),i=r.n(a),l=r(22),u=r(69),b=r(18),p=r(224),d=r(70),f=r(51);r(228);var m=r(119),g=r(41),O=r(60),j=r(21),y=r(112),_=e=>{let{attributeObject:t,slugs:r=[],operator:a="in",displayStyle:i,isLoadingCallback:l}=e;const{results:b,isLoading:d}=Object(O.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[f,m]=Object(o.b)("attributes",[]);if(Object(n.useEffect)(()=>{l(d)},[d,l]),!Array.isArray(b)||!Object(p.b)(b)||!Object(p.a)(f))return null;const _=t.label,w=Object(s.getSettingWithCoercion)("is_rendering_php_template",!1,u.a);return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},_,":"),Object(n.createElement)("ul",null,r.map((e,r)=>{const o=b.find(t=>t.slug===e);if(!o)return null;let s="";return r>0&&"and"===a&&(s=Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("All","woo-gutenberg-products-block"))),Object(g.f)({type:_,name:Object(j.decodeEntities)(o.name||e),prefix:s,isLoading:d,removeCallback:()=>{const r=f.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?Object(g.e)("query_type_"+t.name,"filter_"+t.name):Object(g.e)({["filter_"+t.name]:e}),w||Object(y.a)(f,m,t,e)},showLabel:!1,displayStyle:i})})))},w=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(n.createElement)(n.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(n.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(n.createElement)("span",{className:"show-loading-state__inner"})))):null},h=r(55);t.a=e=>{let{attributes:t,isEditor:r=!1}=e;const a=Object(h.b)(),O=function(){const e=Object(n.useRef)(!1);return Object(n.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(n.useCallback)(()=>e.current,[])}()(),j=Object(s.getSettingWithCoercion)("is_rendering_php_template",!1,u.a),[y,v]=Object(n.useState)(!0),E=Object(g.c)()&&!r&&y,[k,S]=Object(o.b)("attributes",[]),[x,A]=Object(o.b)("stock_status",[]),[P,N]=Object(o.b)("min_price"),[C,R]=Object(o.b)("max_price"),[T,B]=Object(o.b)("rating"),L=Object(s.getSetting)("stockStatusOptions",[]),F=Object(s.getSetting)("attributes",[]),M=Object(n.useMemo)(()=>{return!E&&0!==x.length&&(e=x,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(b.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(L)?x.map(e=>Object(g.f)({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:L[e],removeCallback:()=>{if(Object(g.e)({filter_stock_status:e}),!j){const t=x.filter(t=>t!==e);A(t)}},displayStyle:t.displayStyle})):null;var e},[E,L,x,A,t.displayStyle,j]),Q=Object(n.useMemo)(()=>E||!Number.isFinite(P)&&!Number.isFinite(C)?null:Object(g.f)({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:Object(g.b)(P,C),removeCallback:()=>{Object(g.e)("max_price","min_price"),j||(N(void 0),R(void 0))},displayStyle:t.displayStyle}),[E,P,C,t.displayStyle,N,R,j]),G=Object(n.useMemo)(()=>!Object(p.a)(k)&&O||!k.length&&!Object(g.g)(F)?(y&&v(!1),null):k.map(e=>{const r=Object(m.b)(e.attribute);return r?Object(n.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:v}):(y&&v(!1),null)}),[k,O,F,y,t.displayStyle]);Object(n.useEffect)(()=>{var e;if(!j)return;if(T.length&&T.length>0)return;const t=null===(e=Object(d.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&B(t.split(","))},[j,T,B]);const U=Object(n.useMemo)(()=>{return!E&&0!==T.length&&(e=T,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?T.map(e=>Object(g.f)({type:Object(c.__)("Rating","woo-gutenberg-products-block"),name:Object(c.sprintf)(
2
  /* translators: %s is referring to the average rating value */
3
- Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(j)return Object(g.e)({rating_filter:e});const t=T.filter(t=>t!==e);B(t)},displayStyle:t.displayStyle})):null;var e},[E,T,B,t.displayStyle,j]);if(!E&&!(k.length>0||x.length>0||T.length>0||Number.isFinite(P)||Number.isFinite(C))&&!r)return a(!1),null;const Y="h"+t.headingLevel,q=Object(n.createElement)(Y,{className:"wc-block-active-filters__title"},t.heading),V=E?Object(n.createElement)(f.a,null,q):q;if(!Object(s.getSettingWithCoercion)("has_filterable_products",!1,u.a))return a(!1),null;a(!0);const D=i()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":E});return Object(n.createElement)(n.Fragment,null,!r&&t.heading&&V,Object(n.createElement)("div",{className:"wc-block-active-filters"},Object(n.createElement)("ul",{className:D},r?Object(n.createElement)(n.Fragment,null,Object(g.f)({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),Object(g.f)({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(w,{isLoading:E,displayStyle:t.displayStyle}),Q,M,G,U)),E?Object(n.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(n.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{Object(g.a)(),j||(N(void 0),R(void 0),S([]),A([]),B([]))}},Object(n.createElement)(l.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))}},16:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},18:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},2:function(e,t){e.exports=window.wc.wcSettings},21:function(e,t){e.exports=window.wp.htmlEntities},217:function(e,t){},22:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:s,wrapperProps:a={}}=e;const i=null!=r,l=null!=c;return!i&&l?(t=s||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,c)):(t=s||n.Fragment,i&&l&&r!==c?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,a,r))}},224:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a}));var n=r(18);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),s=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(s)},227:function(e,t,r){"use strict";var n=r(0),c=r(14);const o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=o},228:function(e,t){},23:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},231:function(e,t,r){"use strict";var n=r(11),c=r.n(n),o=r(0),s=r(5),a=r.n(s),i=r(1),l=r(111),u=r(227);r(217);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:i="small",children:l=null,...u}=e;const b=n,p=a()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+i),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),l)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:f="",...m}=e;const g=p?"span":"button";if(!t){const e=f&&"string"==typeof f?f:d;t="string"!=typeof e?
4
  /* translators: Remove chip. */
5
  Object(i.__)("Remove","woo-gutenberg-products-block"):Object(i.sprintf)(
6
  /* translators: %s text of the chip to remove. */
7
- Object(i.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},m,j,{className:a()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},y),Object(o.createElement)(l.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},247:function(e,t,r){e.exports=r(248)},248:function(e,t,r){"use strict";r.r(t);var n=r(38),c=r(158),o=r(41);Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:c.a,getProps:e=>({attributes:Object(o.d)(e.dataset),isEditor:!1})})},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),c=r(12),o=r.n(c);function s(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},3:function(e,t){e.exports=window.wc.wcBlocksData},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(3),c=r(4),o=r(0),s=r(12),a=r.n(s),i=r(27),l=r(61),u=r(23);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{s(e,t)},[e,s])]},p=(e,t,r)=>{const s=Object(u.a)();r=r||s;const a=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:i}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{i(r,e,t)},[r,e,i])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),s=Object(i.a)(n),p=Object(i.a)(e),d=Object(l.a)(p),f=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(c(Object.assign({},s,p)),f.current=!0)},[s,p,d,c]),f.current?[n,c]:[e,c]}},33:function(e,t){},38:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(11),c=r.n(n),o=r(0),s=r(15);const a=[".wp-block-woocommerce-cart"],i=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const i=n(e,r),l=a(e,r),u={...e.dataset,...i.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:i={}}=e;Object(o.render)(Object(o.createElement)(s.a,i,Object(o.createElement)(o.Suspense,{fallback:Object(o.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(o.createElement)(t,c()({},a,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:i,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:c,selector:o}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrappers:o}=e;const s=document.body.querySelectorAll(c);o&&o.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,o)),i({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:c,selector:o,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrapper:o}=e;const s=o.querySelectorAll(c);i({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},39:function(e,t){e.exports=window.wc.priceFormat},4:function(e,t){e.exports=window.wp.data},41:function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"f",(function(){return m})),r.d(t,"e",(function(){return g})),r.d(t,"a",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"g",(function(){return w})),r.d(t,"d",(function(){return h}));var n=r(0),c=r(1),o=r(39),s=r(231),a=r(22),i=r(13),l=r(70),u=r(111),b=r(227),p=r(28),d=r(138);const f=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)(
8
  /* translators: %1$s min price, %2$s max price */
9
  Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(o.formatPrice)(e),Object(o.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
10
  /* translators: %s min price */
@@ -12,4 +12,4 @@ Object(c.__)("From %s","woo-gutenberg-products-block"),Object(o.formatPrice)(e))
12
  /* translators: %s max price */
13
  Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(o.formatPrice)(t)),m=e=>{let{type:t,name:r,prefix:o="",removeCallback:i=(()=>null),showLabel:l=!0,displayStyle:p}=e;const d=o?Object(n.createElement)(n.Fragment,null,o," ",r):r,f=Object(c.sprintf)(
14
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
15
- Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(n.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},l&&Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===p?Object(n.createElement)(s.a,{element:"span",text:d,onRemove:i,radius:"large",ariaLabel:f}):Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(n.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:i},Object(n.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:b.a,size:16}),Object(n.createElement)(a.a,{screenReaderLabel:f})),d))},g=function(){if(!window)return;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object(i.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const s=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),a=Object(i.addQueryArgs)(r,s);Object(l.c)(a)},O=["min_price","max_price","rating_filter","filter_","query_type_"],j=e=>{let t=!1;for(let r=0;O.length>r;r++){const n=O[r];if(n===e.substring(0,n.length)){t=!0;break}}return t},y=()=>{if(!window)return;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object(i.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!j(e)).map(e=>[e,t[e]])),c=Object(i.addQueryArgs)(r,n);Object(l.c)(c)},_=()=>{if(!window)return!1;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(j(t)){n=!0;break}}return n},w=e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(i.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o},h=e=>({heading:Object(p.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(p.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||d.attributes.headingLevel.default,displayStyle:Object(p.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||d.attributes.displayStyle.default})},44:function(e,t,r){"use strict";r.d(t,"n",(function(){return o})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"m",(function(){return i})),r.d(t,"i",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return b})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"g",(function(){return m})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return O})),r.d(t,"b",(function(){return j}));var n,c=r(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=o.pluginUrl+"images/",a=o.pluginUrl+"build/",i=o.buildPhase,l=null===(n=c.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(c.STORE_PAGES.checkout.id,c.STORE_PAGES.checkout.permalink),b=c.STORE_PAGES.privacy.permalink,p=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),d=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id,c.STORE_PAGES.cart.permalink),f=c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(c.getSetting)("shippingCountries",{}),g=Object(c.getSetting)("allowedCountries",{}),O=Object(c.getSetting)("shippingStates",{}),j=Object(c.getSetting)("allowedStates",{})},5:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var s=c.apply(null,n);s&&e.push(s)}}else if("object"===o)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},51:function(e,t,r){"use strict";var n=r(0);r(71),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},55:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(0);const c=Object(n.createContext)({}),o=()=>{const{wrapper:e}=Object(n.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},6:function(e,t){e.exports=window.lodash},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(3),c=r(4),o=r(0),s=r(27),a=r(73);const i=e=>{const{namespace:t,resourceName:r,resourceValues:i=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(s.a)(l),d=Object(s.a)(i),f=Object(a.a)(),m=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],s=c.getCollectionError(...o);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");f(s)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==m&&(b.current=m),b.current}},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(7);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},69:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},7:function(e,t){e.exports=window.React},70:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"d",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(13),c=r(2),o=r(69);const s=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",i="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){s?window.location.href=e:window.history.replaceState({},"",e)}},71:function(e,t){},73:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}}});
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=251)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},101:function(e,t){},114:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...c}=e;return Object(n.cloneElement)(t,{width:r,height:r,...c})}},115:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(7);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),s=o.length?o[0]:null;if(!(s&&s.slug&&Array.isArray(s.slug)&&s.slug.includes(c)))return;const a=s.slug.filter(e=>e!==c),i=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(s.slug=a.sort(),i.push(s)),t(Object(n.sortBy)(i,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const s=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(s):(s.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(s,"attribute"))),s}},12:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},120:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},s=e=>{if(e)return c.find(t=>t.taxonomy===e)}},13:function(e,t){e.exports=window.wp.isShallowEqual},14:function(e,t){e.exports=window.wp.url},140:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters Controls","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},15:function(e,t){e.exports=window.wp.primitives},16:function(e,t,r){"use strict";var n=r(17),c=r.n(n),o=r(0),s=r(8),a=r(1),i=r(46),l=e=>{let{imageUrl:t=i.l+"/block-error.svg",header:r=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:c,errorMessagePrefix:s=Object(a.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(o.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(o.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(o.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(o.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(o.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),c&&Object(o.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",c),l&&Object(o.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(35);class u extends s.Component{constructor(){super(...arguments),c()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(o.createElement)(o.Fragment,null,Object(o.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:c,errorMessagePrefix:s,renderError:a,button:i}=this.props,{errorMessage:u,hasError:b}=this.state;return b?"function"==typeof a?a({errorMessage:u}):Object(o.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:c,errorMessagePrefix:s,button:i}):this.props.children}}t.a=u},160:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(32),s=r(2),a=r(4),i=r.n(a),l=r(20),u=r(74),b=r(19),p=r(226),d=r(71),f=r(67);r(230);var m=r(120),g=r(42),O=r(61),j=r(23),y=r(115),_=e=>{let{attributeObject:t,slugs:r=[],operator:a="in",displayStyle:i,isLoadingCallback:l}=e;const{results:b,isLoading:d}=Object(O.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[f,m]=Object(o.b)("attributes",[]);if(Object(n.useEffect)(()=>{l(d)},[d,l]),!Array.isArray(b)||!Object(p.b)(b)||!Object(p.a)(f))return null;const _=t.label,w=Object(s.getSettingWithCoercion)("is_rendering_php_template",!1,u.a);return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},_,":"),Object(n.createElement)("ul",null,r.map((e,r)=>{const o=b.find(t=>t.slug===e);if(!o)return null;let s="";return r>0&&"and"===a&&(s=Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("All","woo-gutenberg-products-block"))),Object(g.f)({type:_,name:Object(j.decodeEntities)(o.name||e),prefix:s,isLoading:d,removeCallback:()=>{const r=f.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?Object(g.e)("query_type_"+t.name,"filter_"+t.name):Object(g.e)({["filter_"+t.name]:e}),w||Object(y.a)(f,m,t,e)},showLabel:!1,displayStyle:i})})))},w=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(n.createElement)(n.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(n.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(n.createElement)("span",{className:"show-loading-state__inner"})))):null},h=r(45);t.a=e=>{let{attributes:t,isEditor:r=!1}=e;const a=Object(h.b)(),O=function(){const e=Object(n.useRef)(!1);return Object(n.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(n.useCallback)(()=>e.current,[])}()(),j=Object(s.getSettingWithCoercion)("is_rendering_php_template",!1,u.a),[y,v]=Object(n.useState)(!0),E=Object(g.c)()&&!r&&y,[k,S]=Object(o.b)("attributes",[]),[x,A]=Object(o.b)("stock_status",[]),[P,N]=Object(o.b)("min_price"),[C,R]=Object(o.b)("max_price"),[T,B]=Object(o.b)("rating"),L=Object(s.getSetting)("stockStatusOptions",[]),F=Object(s.getSetting)("attributes",[]),M=Object(n.useMemo)(()=>{return!E&&0!==x.length&&(e=x,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(b.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(L)?x.map(e=>Object(g.f)({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:L[e],removeCallback:()=>{if(Object(g.e)({filter_stock_status:e}),!j){const t=x.filter(t=>t!==e);A(t)}},displayStyle:t.displayStyle})):null;var e},[E,L,x,A,t.displayStyle,j]),Q=Object(n.useMemo)(()=>E||!Number.isFinite(P)&&!Number.isFinite(C)?null:Object(g.f)({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:Object(g.b)(P,C),removeCallback:()=>{Object(g.e)("max_price","min_price"),j||(N(void 0),R(void 0))},displayStyle:t.displayStyle}),[E,P,C,t.displayStyle,N,R,j]),G=Object(n.useMemo)(()=>!Object(p.a)(k)&&O||!k.length&&!Object(g.g)(F)?(y&&v(!1),null):k.map(e=>{const r=Object(m.b)(e.attribute);return r?Object(n.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:v}):(y&&v(!1),null)}),[k,O,F,y,t.displayStyle]);Object(n.useEffect)(()=>{var e;if(!j)return;if(T.length&&T.length>0)return;const t=null===(e=Object(d.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&B(t.split(","))},[j,T,B]);const U=Object(n.useMemo)(()=>{return!E&&0!==T.length&&(e=T,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?T.map(e=>Object(g.f)({type:Object(c.__)("Rating","woo-gutenberg-products-block"),name:Object(c.sprintf)(
2
  /* translators: %s is referring to the average rating value */
3
+ Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(Object(g.e)({rating_filter:e}),!j){const t=T.filter(t=>t!==e);B(t)}},displayStyle:t.displayStyle})):null;var e},[E,T,B,t.displayStyle,j]);if(!E&&!(k.length>0||x.length>0||T.length>0||Number.isFinite(P)||Number.isFinite(C))&&!r)return a(!1),null;const Y="h"+t.headingLevel,q=Object(n.createElement)(Y,{className:"wc-block-active-filters__title"},t.heading),V=E?Object(n.createElement)(f.a,null,q):q;if(!Object(s.getSettingWithCoercion)("has_filterable_products",!1,u.a))return a(!1),null;a(!0);const D=i()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":E});return Object(n.createElement)(n.Fragment,null,!r&&t.heading&&V,Object(n.createElement)("div",{className:"wc-block-active-filters"},Object(n.createElement)("ul",{className:D},r?Object(n.createElement)(n.Fragment,null,Object(g.f)({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),Object(g.f)({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(w,{isLoading:E,displayStyle:t.displayStyle}),Q,M,G,U)),E?Object(n.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(n.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{Object(g.a)(),j||(N(void 0),R(void 0),S([]),A([]),B([]))}},Object(n.createElement)(l.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))}},17:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},19:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},2:function(e,t){e.exports=window.wc.wcSettings},20:function(e,t,r){"use strict";var n=r(0),c=r(4),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:s,wrapperProps:a={}}=e;const i=null!=r,l=null!=c;return!i&&l?(t=s||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,c)):(t=s||n.Fragment,i&&l&&r!==c?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,a,r))}},219:function(e,t){},226:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a}));var n=r(19);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),s=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(s)},229:function(e,t,r){"use strict";var n=r(0),c=r(15);const o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=o},23:function(e,t){e.exports=window.wp.htmlEntities},230:function(e,t){},235:function(e,t,r){"use strict";var n=r(12),c=r.n(n),o=r(0),s=r(4),a=r.n(s),i=r(1),l=r(114),u=r(229);r(219);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:i="small",children:l=null,...u}=e;const b=n,p=a()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+i),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),l)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:f="",...m}=e;const g=p?"span":"button";if(!t){const e=f&&"string"==typeof f?f:d;t="string"!=typeof e?
4
  /* translators: Remove chip. */
5
  Object(i.__)("Remove","woo-gutenberg-products-block"):Object(i.sprintf)(
6
  /* translators: %s text of the chip to remove. */
7
+ Object(i.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},m,j,{className:a()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},y),Object(o.createElement)(l.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},25:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},251:function(e,t,r){e.exports=r(252)},252:function(e,t,r){"use strict";r.r(t);var n=r(48),c=r(160),o=r(42);Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:c.a,getProps:e=>({attributes:Object(o.d)(e.dataset),isEditor:!1})})},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),c=r(13),o=r.n(c);function s(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},3:function(e,t){e.exports=window.wc.wcBlocksData},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(3),c=r(5),o=r(0),s=r(13),a=r.n(s),i=r(29),l=r(62),u=r(25);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{s(e,t)},[e,s])]},p=(e,t,r)=>{const s=Object(u.a)();r=r||s;const a=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:i}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{i(r,e,t)},[r,e,i])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),s=Object(i.a)(n),p=Object(i.a)(e),d=Object(l.a)(p),f=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(c(Object.assign({},s,p)),f.current=!0)},[s,p,d,c]),f.current?[n,c]:[e,c]}},35:function(e,t){},4:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var s=c.apply(null,n);s&&e.push(s)}}else if("object"===o)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},40:function(e,t){e.exports=window.wc.priceFormat},42:function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"f",(function(){return m})),r.d(t,"e",(function(){return g})),r.d(t,"a",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"g",(function(){return w})),r.d(t,"d",(function(){return h}));var n=r(0),c=r(1),o=r(40),s=r(235),a=r(20),i=r(14),l=r(71),u=r(114),b=r(229),p=r(30),d=r(140);const f=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)(
8
  /* translators: %1$s min price, %2$s max price */
9
  Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(o.formatPrice)(e),Object(o.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
10
  /* translators: %s min price */
12
  /* translators: %s max price */
13
  Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(o.formatPrice)(t)),m=e=>{let{type:t,name:r,prefix:o="",removeCallback:i=(()=>null),showLabel:l=!0,displayStyle:p}=e;const d=o?Object(n.createElement)(n.Fragment,null,o," ",r):r,f=Object(c.sprintf)(
14
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
15
+ Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(n.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},l&&Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===p?Object(n.createElement)(s.a,{element:"span",text:d,onRemove:i,radius:"large",ariaLabel:f}):Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(n.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:i},Object(n.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:b.a,size:16}),Object(n.createElement)(a.a,{screenReaderLabel:f})),d))},g=function(){if(!window)return;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object(i.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const s=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),a=Object(i.addQueryArgs)(r,s);Object(l.c)(a)},O=["min_price","max_price","rating_filter","filter_","query_type_"],j=e=>{let t=!1;for(let r=0;O.length>r;r++){const n=O[r];if(n===e.substring(0,n.length)){t=!0;break}}return t},y=()=>{if(!window)return;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object(i.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!j(e)).map(e=>[e,t[e]])),c=Object(i.addQueryArgs)(r,n);Object(l.c)(c)},_=()=>{if(!window)return!1;const e=window.location.href,t=Object(i.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(j(t)){n=!0;break}}return n},w=e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(i.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o},h=e=>({heading:Object(p.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(p.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||d.attributes.headingLevel.default,displayStyle:Object(p.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||d.attributes.displayStyle.default})},45:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(0);const c=Object(n.createContext)({}),o=()=>{const{wrapper:e}=Object(n.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},46:function(e,t,r){"use strict";r.d(t,"n",(function(){return o})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"m",(function(){return i})),r.d(t,"i",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return b})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"g",(function(){return m})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return O})),r.d(t,"b",(function(){return j}));var n,c=r(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=o.pluginUrl+"images/",a=o.pluginUrl+"build/",i=o.buildPhase,l=null===(n=c.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(c.STORE_PAGES.checkout.id,c.STORE_PAGES.checkout.permalink),b=c.STORE_PAGES.privacy.permalink,p=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),d=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id,c.STORE_PAGES.cart.permalink),f=c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(c.getSetting)("shippingCountries",{}),g=Object(c.getSetting)("allowedCountries",{}),O=Object(c.getSetting)("shippingStates",{}),j=Object(c.getSetting)("allowedStates",{})},48:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(12),c=r.n(n),o=r(0),s=r(16);const a=[".wp-block-woocommerce-cart"],i=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const i=n(e,r),l=a(e,r),u={...e.dataset,...i.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:i={}}=e;Object(o.render)(Object(o.createElement)(s.a,i,Object(o.createElement)(o.Suspense,{fallback:Object(o.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(o.createElement)(t,c()({},a,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:i,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:c,selector:o}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrappers:o}=e;const s=document.body.querySelectorAll(c);o&&o.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,o)),i({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:c,selector:o,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrapper:o}=e;const s=o.querySelectorAll(c);i({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},5:function(e,t){e.exports=window.wp.data},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(3),c=r(5),o=r(0),s=r(29),a=r(76);const i=e=>{const{namespace:t,resourceName:r,resourceValues:i=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(s.a)(l),d=Object(s.a)(i),f=Object(a.a)(),m=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],s=c.getCollectionError(...o);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");f(s)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==m&&(b.current=m),b.current}},62:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},67:function(e,t,r){"use strict";var n=r(0);r(101),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},7:function(e,t){e.exports=window.lodash},71:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"d",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(14),c=r(2),o=r(74);const s=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",i="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){s?window.location.href=e:window.history.replaceState({},"",e)}},74:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},76:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},8:function(e,t){e.exports=window.React}});
build/active-filters-wrapper-frontend.js CHANGED
@@ -1,10 +1,10 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{111:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...c}=e;return Object(n.cloneElement)(t,{width:r,height:r,...c})}},112:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var n=r(6);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const a=e.filter(e=>e.attribute===r.taxonomy),o=a.length?a[0]:null;if(!(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(c)))return;const i=o.slug.filter(e=>e!==c),s=e.filter(e=>e.attribute!==r.taxonomy);i.length>0&&(o.slug=i.sort(),s.push(o)),t(Object(n.sortBy)(s,"attribute"))},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const o=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(o):(o.push({attribute:r.taxonomy,operator:a,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(o,"attribute"))),o}},119:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return o}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),a=e=>{if(e)return c.find(t=>t.id===e)},o=e=>{if(e)return c.find(t=>t.taxonomy===e)}},133:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(28),c=r(18);const a=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},138:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters Controls","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},158:function(e,t,r){"use strict";var n=r(0),c=r(1),a=r(30),o=r(2),i=r(5),s=r.n(i),l=r(22),u=r(69),b=r(18),f=r(224),d=r(70),p=r(51);r(228);var O=r(119),m=r(41),j=r(60),g=r(21),y=r(112),_=e=>{let{attributeObject:t,slugs:r=[],operator:i="in",displayStyle:s,isLoadingCallback:l}=e;const{results:b,isLoading:d}=Object(j.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[p,O]=Object(a.b)("attributes",[]);if(Object(n.useEffect)(()=>{l(d)},[d,l]),!Array.isArray(b)||!Object(f.b)(b)||!Object(f.a)(p))return null;const _=t.label,v=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,u.a);return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},_,":"),Object(n.createElement)("ul",null,r.map((e,r)=>{const a=b.find(t=>t.slug===e);if(!a)return null;let o="";return r>0&&"and"===i&&(o=Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("All","woo-gutenberg-products-block"))),Object(m.f)({type:_,name:Object(g.decodeEntities)(a.name||e),prefix:o,isLoading:d,removeCallback:()=>{const r=p.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?Object(m.e)("query_type_"+t.name,"filter_"+t.name):Object(m.e)({["filter_"+t.name]:e}),v||Object(y.a)(p,O,t,e)},showLabel:!1,displayStyle:s})})))},v=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(n.createElement)(n.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(n.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(n.createElement)("span",{className:"show-loading-state__inner"})))):null},h=r(55);t.a=e=>{let{attributes:t,isEditor:r=!1}=e;const i=Object(h.b)(),j=function(){const e=Object(n.useRef)(!1);return Object(n.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(n.useCallback)(()=>e.current,[])}()(),g=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,u.a),[y,w]=Object(n.useState)(!0),k=Object(m.c)()&&!r&&y,[E,S]=Object(a.b)("attributes",[]),[N,x]=Object(a.b)("stock_status",[]),[A,C]=Object(a.b)("min_price"),[R,L]=Object(a.b)("max_price"),[F,T]=Object(a.b)("rating"),Q=Object(o.getSetting)("stockStatusOptions",[]),P=Object(o.getSetting)("attributes",[]),B=Object(n.useMemo)(()=>{return!k&&0!==N.length&&(e=N,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(b.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(Q)?N.map(e=>Object(m.f)({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:Q[e],removeCallback:()=>{if(Object(m.e)({filter_stock_status:e}),!g){const t=N.filter(t=>t!==e);x(t)}},displayStyle:t.displayStyle})):null;var e},[k,Q,N,x,t.displayStyle,g]),Y=Object(n.useMemo)(()=>k||!Number.isFinite(A)&&!Number.isFinite(R)?null:Object(m.f)({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:Object(m.b)(A,R),removeCallback:()=>{Object(m.e)("max_price","min_price"),g||(C(void 0),L(void 0))},displayStyle:t.displayStyle}),[k,A,R,t.displayStyle,C,L,g]),V=Object(n.useMemo)(()=>!Object(f.a)(E)&&j||!E.length&&!Object(m.g)(P)?(y&&w(!1),null):E.map(e=>{const r=Object(O.b)(e.attribute);return r?Object(n.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:w}):(y&&w(!1),null)}),[E,j,P,y,t.displayStyle]);Object(n.useEffect)(()=>{var e;if(!g)return;if(F.length&&F.length>0)return;const t=null===(e=Object(d.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&T(t.split(","))},[g,F,T]);const K=Object(n.useMemo)(()=>{return!k&&0!==F.length&&(e=F,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?F.map(e=>Object(m.f)({type:Object(c.__)("Rating","woo-gutenberg-products-block"),name:Object(c.sprintf)(
2
  /* translators: %s is referring to the average rating value */
3
- Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(g)return Object(m.e)({rating_filter:e});const t=F.filter(t=>t!==e);T(t)},displayStyle:t.displayStyle})):null;var e},[k,F,T,t.displayStyle,g]);if(!k&&!(E.length>0||N.length>0||F.length>0||Number.isFinite(A)||Number.isFinite(R))&&!r)return i(!1),null;const W="h"+t.headingLevel,U=Object(n.createElement)(W,{className:"wc-block-active-filters__title"},t.heading),z=k?Object(n.createElement)(p.a,null,U):U;if(!Object(o.getSettingWithCoercion)("has_filterable_products",!1,u.a))return i(!1),null;i(!0);const D=s()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":k});return Object(n.createElement)(n.Fragment,null,!r&&t.heading&&z,Object(n.createElement)("div",{className:"wc-block-active-filters"},Object(n.createElement)("ul",{className:D},r?Object(n.createElement)(n.Fragment,null,Object(m.f)({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),Object(m.f)({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(v,{isLoading:k,displayStyle:t.displayStyle}),Y,B,V,K)),k?Object(n.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(n.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{Object(m.a)(),g||(C(void 0),L(void 0),S([]),x([]),T([]))}},Object(n.createElement)(l.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))}},18:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},215:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r(100);var n=r(44);const c=()=>n.m>1},217:function(e,t){},22:function(e,t,r){"use strict";var n=r(0),c=r(5),a=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:o,wrapperProps:i={}}=e;const s=null!=r,l=null!=c;return!s&&l?(t=o||"span",i={...i,className:a()(i.className,"screen-reader-text")},Object(n.createElement)(t,i,c)):(t=o||n.Fragment,s&&l&&r!==c?Object(n.createElement)(t,i,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,i,r))}},224:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i}));var n=r(18);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,a=e=>Array.isArray(e)&&e.every(c),o=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),i=e=>Array.isArray(e)&&e.every(o)},227:function(e,t,r){"use strict";var n=r(0),c=r(14);const a=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=a},228:function(e,t){},23:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0);const c=Object(n.createContext)("page"),a=()=>Object(n.useContext)(c);c.Provider},231:function(e,t,r){"use strict";var n=r(11),c=r.n(n),a=r(0),o=r(5),i=r.n(o),s=r(1),l=r(111),u=r(227);r(217);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:o="",radius:s="small",children:l=null,...u}=e;const b=n,f=i()(o,"wc-block-components-chip","wc-block-components-chip--radius-"+s),d=Boolean(r&&r!==t);return Object(a.createElement)(b,c()({className:f},u),Object(a.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(a.createElement)("span",{className:"screen-reader-text"},r),l)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:o=(()=>{}),removeOnAnyClick:f=!1,text:d,screenReaderText:p="",...O}=e;const m=f?"span":"button";if(!t){const e=p&&"string"==typeof p?p:d;t="string"!=typeof e?
4
  /* translators: Remove chip. */
5
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
6
  /* translators: %s text of the chip to remove. */
7
- Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:n,onClick:o,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||o()}},g=f?j:{},y=f?{"aria-hidden":!0}:j;return Object(a.createElement)(b,c()({},O,g,{className:i()(r,"is-removable"),element:f?"button":O.element,screenReaderText:p,text:d}),Object(a.createElement)(m,c()({className:"wc-block-components-chip__remove"},y),Object(a.createElement)(l.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=r(12),a=r.n(c);function o(e){const t=Object(n.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},292:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(108),c=r(215),a=r(18),o=r(133);const i=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},r=Object(o.a)(t.style);return Object(n.__experimentalUseColorProps)({...t,style:r})}},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return f})),r.d(t,"c",(function(){return d}));var n=r(3),c=r(4),a=r(0),o=r(12),i=r.n(o),s=r(27),l=r(61),u=r(23);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:o}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(a.useCallback)(t=>{o(e,t)},[e,o])]},f=(e,t,r)=>{const o=Object(u.a)();r=r||o;const i=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:s}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[i,Object(a.useCallback)(t=>{s(r,e,t)},[r,e,s])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),o=Object(s.a)(n),f=Object(s.a)(e),d=Object(l.a)(f),p=Object(a.useRef)(!1);return Object(a.useEffect)(()=>{i()(d,f)||(c(Object.assign({},o,f)),p.current=!0)},[o,f,d,c]),p.current?[n,c]:[e,c]}},41:function(e,t,r){"use strict";r.d(t,"b",(function(){return p})),r.d(t,"f",(function(){return O})),r.d(t,"e",(function(){return m})),r.d(t,"a",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"g",(function(){return v})),r.d(t,"d",(function(){return h}));var n=r(0),c=r(1),a=r(39),o=r(231),i=r(22),s=r(13),l=r(70),u=r(111),b=r(227),f=r(28),d=r(138);const p=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)(
8
  /* translators: %1$s min price, %2$s max price */
9
  Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(a.formatPrice)(e),Object(a.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
10
  /* translators: %s min price */
@@ -12,4 +12,4 @@ Object(c.__)("From %s","woo-gutenberg-products-block"),Object(a.formatPrice)(e))
12
  /* translators: %s max price */
13
  Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(a.formatPrice)(t)),O=e=>{let{type:t,name:r,prefix:a="",removeCallback:s=(()=>null),showLabel:l=!0,displayStyle:f}=e;const d=a?Object(n.createElement)(n.Fragment,null,a," ",r):r,p=Object(c.sprintf)(
14
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
15
- Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(n.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},l&&Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===f?Object(n.createElement)(o.a,{element:"span",text:d,onRemove:s,radius:"large",ariaLabel:p}):Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(n.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},Object(n.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:b.a,size:16}),Object(n.createElement)(i.a,{screenReaderLabel:p})),d))},m=function(){if(!window)return;const e=window.location.href,t=Object(s.getQueryArgs)(e),r=Object(s.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),a=0;a<n;a++)c[a]=arguments[a];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const o=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),i=Object(s.addQueryArgs)(r,o);Object(l.c)(i)},j=["min_price","max_price","rating_filter","filter_","query_type_"],g=e=>{let t=!1;for(let r=0;j.length>r;r++){const n=j[r];if(n===e.substring(0,n.length)){t=!0;break}}return t},y=()=>{if(!window)return;const e=window.location.href,t=Object(s.getQueryArgs)(e),r=Object(s.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!g(e)).map(e=>[e,t[e]])),c=Object(s.addQueryArgs)(r,n);Object(l.c)(c)},_=()=>{if(!window)return!1;const e=window.location.href,t=Object(s.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(g(t)){n=!0;break}}return n},v=e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(s.getQueryArgs)(r),c=Object.keys(n);let a=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){a=!0;break}}return a},h=e=>({heading:Object(f.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(f.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||d.attributes.headingLevel.default,displayStyle:Object(f.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||d.attributes.displayStyle.default})},454:function(e,t,r){"use strict";r.r(t);var n=r(0),c=r(292),a=r(28),o=r(158),i=r(41);t.default=e=>{const t=Object(c.a)(e);return Object(n.createElement)("div",{className:Object(a.a)(e.className)?e.className:"",style:{...t.style}},Object(n.createElement)(o.a,{isEditor:!1,attributes:Object(i.d)(e)}))}},5:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var o=c.apply(null,n);o&&e.push(o)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var i in n)r.call(n,i)&&n[i]&&e.push(i);else e.push(n.toString())}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},51:function(e,t,r){"use strict";var n=r(0);r(71),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(3),c=r(4),a=r(0),o=r(27),i=r(73);const s=e=>{const{namespace:t,resourceName:r,resourceValues:s=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(a.useRef)({results:[],isLoading:!0}),f=Object(o.a)(l),d=Object(o.a)(s),p=Object(i.a)(),O=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),a=[t,r,f,d],o=c.getCollectionError(...a);if(o){if(!(o instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(o)}return{results:c.getCollection(...a),isLoading:!c.hasFinishedResolution("getCollection",a)}},[t,r,d,f,u]);return null!==O&&(b.current=O),b.current}},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(7);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},69:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},70:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return s})),r.d(t,"d",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(13),c=r(2),a=r(69);const o=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,a.a),i="query_type_",s="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){o?window.location.href=e:window.history.replaceState({},"",e)}},71:function(e,t){},73:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{101:function(e,t){},114:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...c}=e;return Object(n.cloneElement)(t,{width:r,height:r,...c})}},115:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var n=r(7);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const a=e.filter(e=>e.attribute===r.taxonomy),o=a.length?a[0]:null;if(!(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(c)))return;const i=o.slug.filter(e=>e!==c),s=e.filter(e=>e.attribute!==r.taxonomy);i.length>0&&(o.slug=i.sort(),s.push(o)),t(Object(n.sortBy)(s,"attribute"))},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const o=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(o):(o.push({attribute:r.taxonomy,operator:a,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(o,"attribute"))),o}},120:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return o}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),a=e=>{if(e)return c.find(t=>t.id===e)},o=e=>{if(e)return c.find(t=>t.taxonomy===e)}},135:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(30),c=r(19);const a=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},140:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters Controls","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},160:function(e,t,r){"use strict";var n=r(0),c=r(1),a=r(32),o=r(2),i=r(4),s=r.n(i),l=r(20),u=r(74),b=r(19),f=r(226),d=r(71),p=r(67);r(230);var O=r(120),m=r(42),j=r(61),g=r(23),y=r(115),_=e=>{let{attributeObject:t,slugs:r=[],operator:i="in",displayStyle:s,isLoadingCallback:l}=e;const{results:b,isLoading:d}=Object(j.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[p,O]=Object(a.b)("attributes",[]);if(Object(n.useEffect)(()=>{l(d)},[d,l]),!Array.isArray(b)||!Object(f.b)(b)||!Object(f.a)(p))return null;const _=t.label,v=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,u.a);return Object(n.createElement)("li",null,Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},_,":"),Object(n.createElement)("ul",null,r.map((e,r)=>{const a=b.find(t=>t.slug===e);if(!a)return null;let o="";return r>0&&"and"===i&&(o=Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("All","woo-gutenberg-products-block"))),Object(m.f)({type:_,name:Object(g.decodeEntities)(a.name||e),prefix:o,isLoading:d,removeCallback:()=>{const r=p.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?Object(m.e)("query_type_"+t.name,"filter_"+t.name):Object(m.e)({["filter_"+t.name]:e}),v||Object(y.a)(p,O,t,e)},showLabel:!1,displayStyle:s})})))},v=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(n.createElement)(n.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(n.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(n.createElement)("span",{className:"show-loading-state__inner"})))):null},h=r(45);t.a=e=>{let{attributes:t,isEditor:r=!1}=e;const i=Object(h.b)(),j=function(){const e=Object(n.useRef)(!1);return Object(n.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(n.useCallback)(()=>e.current,[])}()(),g=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,u.a),[y,w]=Object(n.useState)(!0),k=Object(m.c)()&&!r&&y,[E,S]=Object(a.b)("attributes",[]),[N,x]=Object(a.b)("stock_status",[]),[A,C]=Object(a.b)("min_price"),[R,L]=Object(a.b)("max_price"),[F,T]=Object(a.b)("rating"),Q=Object(o.getSetting)("stockStatusOptions",[]),P=Object(o.getSetting)("attributes",[]),B=Object(n.useMemo)(()=>{return!k&&0!==N.length&&(e=N,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(b.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(Q)?N.map(e=>Object(m.f)({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:Q[e],removeCallback:()=>{if(Object(m.e)({filter_stock_status:e}),!g){const t=N.filter(t=>t!==e);x(t)}},displayStyle:t.displayStyle})):null;var e},[k,Q,N,x,t.displayStyle,g]),Y=Object(n.useMemo)(()=>k||!Number.isFinite(A)&&!Number.isFinite(R)?null:Object(m.f)({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:Object(m.b)(A,R),removeCallback:()=>{Object(m.e)("max_price","min_price"),g||(C(void 0),L(void 0))},displayStyle:t.displayStyle}),[k,A,R,t.displayStyle,C,L,g]),V=Object(n.useMemo)(()=>!Object(f.a)(E)&&j||!E.length&&!Object(m.g)(P)?(y&&w(!1),null):E.map(e=>{const r=Object(O.b)(e.attribute);return r?Object(n.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:w}):(y&&w(!1),null)}),[E,j,P,y,t.displayStyle]);Object(n.useEffect)(()=>{var e;if(!g)return;if(F.length&&F.length>0)return;const t=null===(e=Object(d.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&T(t.split(","))},[g,F,T]);const K=Object(n.useMemo)(()=>{return!k&&0!==F.length&&(e=F,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?F.map(e=>Object(m.f)({type:Object(c.__)("Rating","woo-gutenberg-products-block"),name:Object(c.sprintf)(
2
  /* translators: %s is referring to the average rating value */
3
+ Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(Object(m.e)({rating_filter:e}),!g){const t=F.filter(t=>t!==e);T(t)}},displayStyle:t.displayStyle})):null;var e},[k,F,T,t.displayStyle,g]);if(!k&&!(E.length>0||N.length>0||F.length>0||Number.isFinite(A)||Number.isFinite(R))&&!r)return i(!1),null;const W="h"+t.headingLevel,U=Object(n.createElement)(W,{className:"wc-block-active-filters__title"},t.heading),z=k?Object(n.createElement)(p.a,null,U):U;if(!Object(o.getSettingWithCoercion)("has_filterable_products",!1,u.a))return i(!1),null;i(!0);const D=s()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":k});return Object(n.createElement)(n.Fragment,null,!r&&t.heading&&z,Object(n.createElement)("div",{className:"wc-block-active-filters"},Object(n.createElement)("ul",{className:D},r?Object(n.createElement)(n.Fragment,null,Object(m.f)({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),Object(m.f)({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(v,{isLoading:k,displayStyle:t.displayStyle}),Y,B,V,K)),k?Object(n.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(n.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{Object(m.a)(),g||(C(void 0),L(void 0),S([]),x([]),T([]))}},Object(n.createElement)(l.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))}},19:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},20:function(e,t,r){"use strict";var n=r(0),c=r(4),a=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:o,wrapperProps:i={}}=e;const s=null!=r,l=null!=c;return!s&&l?(t=o||"span",i={...i,className:a()(i.className,"screen-reader-text")},Object(n.createElement)(t,i,c)):(t=o||n.Fragment,s&&l&&r!==c?Object(n.createElement)(t,i,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,i,r))}},217:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r(100);var n=r(46);const c=()=>n.m>1},219:function(e,t){},226:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i}));var n=r(19);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,a=e=>Array.isArray(e)&&e.every(c),o=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),i=e=>Array.isArray(e)&&e.every(o)},229:function(e,t,r){"use strict";var n=r(0),c=r(15);const a=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=a},230:function(e,t){},235:function(e,t,r){"use strict";var n=r(12),c=r.n(n),a=r(0),o=r(4),i=r.n(o),s=r(1),l=r(114),u=r(229);r(219);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:o="",radius:s="small",children:l=null,...u}=e;const b=n,f=i()(o,"wc-block-components-chip","wc-block-components-chip--radius-"+s),d=Boolean(r&&r!==t);return Object(a.createElement)(b,c()({className:f},u),Object(a.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(a.createElement)("span",{className:"screen-reader-text"},r),l)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:o=(()=>{}),removeOnAnyClick:f=!1,text:d,screenReaderText:p="",...O}=e;const m=f?"span":"button";if(!t){const e=p&&"string"==typeof p?p:d;t="string"!=typeof e?
4
  /* translators: Remove chip. */
5
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
6
  /* translators: %s text of the chip to remove. */
7
+ Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:n,onClick:o,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||o()}},g=f?j:{},y=f?{"aria-hidden":!0}:j;return Object(a.createElement)(b,c()({},O,g,{className:i()(r,"is-removable"),element:f?"button":O.element,screenReaderText:p,text:d}),Object(a.createElement)(m,c()({className:"wc-block-components-chip__remove"},y),Object(a.createElement)(l.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},25:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0);const c=Object(n.createContext)("page"),a=()=>Object(n.useContext)(c);c.Provider},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=r(13),a=r.n(c);function o(e){const t=Object(n.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},293:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(111),c=r(217),a=r(19),o=r(135);const i=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},r=Object(o.a)(t.style);return Object(n.__experimentalUseColorProps)({...t,style:r})}},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return f})),r.d(t,"c",(function(){return d}));var n=r(3),c=r(5),a=r(0),o=r(13),i=r.n(o),s=r(29),l=r(62),u=r(25);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:o}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(a.useCallback)(t=>{o(e,t)},[e,o])]},f=(e,t,r)=>{const o=Object(u.a)();r=r||o;const i=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:s}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[i,Object(a.useCallback)(t=>{s(r,e,t)},[r,e,s])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),o=Object(s.a)(n),f=Object(s.a)(e),d=Object(l.a)(f),p=Object(a.useRef)(!1);return Object(a.useEffect)(()=>{i()(d,f)||(c(Object.assign({},o,f)),p.current=!0)},[o,f,d,c]),p.current?[n,c]:[e,c]}},4:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var o=c.apply(null,n);o&&e.push(o)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var i in n)r.call(n,i)&&n[i]&&e.push(i);else e.push(n.toString())}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},42:function(e,t,r){"use strict";r.d(t,"b",(function(){return p})),r.d(t,"f",(function(){return O})),r.d(t,"e",(function(){return m})),r.d(t,"a",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"g",(function(){return v})),r.d(t,"d",(function(){return h}));var n=r(0),c=r(1),a=r(40),o=r(235),i=r(20),s=r(14),l=r(71),u=r(114),b=r(229),f=r(30),d=r(140);const p=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)(
8
  /* translators: %1$s min price, %2$s max price */
9
  Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(a.formatPrice)(e),Object(a.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
10
  /* translators: %s min price */
12
  /* translators: %s max price */
13
  Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(a.formatPrice)(t)),O=e=>{let{type:t,name:r,prefix:a="",removeCallback:s=(()=>null),showLabel:l=!0,displayStyle:f}=e;const d=a?Object(n.createElement)(n.Fragment,null,a," ",r):r,p=Object(c.sprintf)(
14
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
15
+ Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(n.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},l&&Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===f?Object(n.createElement)(o.a,{element:"span",text:d,onRemove:s,radius:"large",ariaLabel:p}):Object(n.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(n.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},Object(n.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:b.a,size:16}),Object(n.createElement)(i.a,{screenReaderLabel:p})),d))},m=function(){if(!window)return;const e=window.location.href,t=Object(s.getQueryArgs)(e),r=Object(s.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),a=0;a<n;a++)c[a]=arguments[a];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const o=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),i=Object(s.addQueryArgs)(r,o);Object(l.c)(i)},j=["min_price","max_price","rating_filter","filter_","query_type_"],g=e=>{let t=!1;for(let r=0;j.length>r;r++){const n=j[r];if(n===e.substring(0,n.length)){t=!0;break}}return t},y=()=>{if(!window)return;const e=window.location.href,t=Object(s.getQueryArgs)(e),r=Object(s.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!g(e)).map(e=>[e,t[e]])),c=Object(s.addQueryArgs)(r,n);Object(l.c)(c)},_=()=>{if(!window)return!1;const e=window.location.href,t=Object(s.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(g(t)){n=!0;break}}return n},v=e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(s.getQueryArgs)(r),c=Object.keys(n);let a=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){a=!0;break}}return a},h=e=>({heading:Object(f.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(f.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||d.attributes.headingLevel.default,displayStyle:Object(f.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||d.attributes.displayStyle.default})},456:function(e,t,r){"use strict";r.r(t);var n=r(0),c=r(293),a=r(30),o=r(160),i=r(42);t.default=e=>{const t=Object(c.a)(e);return Object(n.createElement)("div",{className:Object(a.a)(e.className)?e.className:"",style:{...t.style}},Object(n.createElement)(o.a,{isEditor:!1,attributes:Object(i.d)(e)}))}},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(3),c=r(5),a=r(0),o=r(29),i=r(76);const s=e=>{const{namespace:t,resourceName:r,resourceValues:s=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(a.useRef)({results:[],isLoading:!0}),f=Object(o.a)(l),d=Object(o.a)(s),p=Object(i.a)(),O=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),a=[t,r,f,d],o=c.getCollectionError(...a);if(o){if(!(o instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(o)}return{results:c.getCollection(...a),isLoading:!c.hasFinishedResolution("getCollection",a)}},[t,r,d,f,u]);return null!==O&&(b.current=O),b.current}},62:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},67:function(e,t,r){"use strict";var n=r(0);r(101),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},71:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return s})),r.d(t,"d",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(14),c=r(2),a=r(74);const o=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,a.a),i="query_type_",s="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){o?window.location.href=e:window.history.replaceState({},"",e)}},74:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},76:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}}}]);
build/active-filters.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'c4b8d728ebd36454e60840a807054ced');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '0dcf07dc60254a641cd7c56d82da2a46');
build/active-filters.js CHANGED
@@ -1,8 +1,8 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,l,i=t[0],a=t[1],s=t[2],b=0,p=[];b<i.length;b++)l=i[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&p.push(c[l][0]),c[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,i=1;i<r.length;i++){var a=r[i];0!==c[a]&&(n=!1)}n&&(o.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},c={5:0,1:0},o=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=a;return o.push([417,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.blocks},102:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r(11),l=r(1);r(139),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:r,onChange:o,heading:i,instanceId:a}=e;const s="h"+r;return Object(n.createElement)(s,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+a},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(c.PlainText,{id:"block-title-"+a,className:"wc-block-editor-components-title",value:i,onChange:o}))})},103:function(e,t,r){"use strict";var n=r(0);r(140),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},104:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},108:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(9),c=r(7),o=r(0),l=r(40),i=r(142);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:s={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(l.a)(s),d=Object(l.a)(a),f=Object(i.a)(),m=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");f(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==m&&(b.current=m),b.current}},11:function(e,t){e.exports=window.wp.compose},12:function(e,t){e.exports=window.React},124:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),c=r(1),o=r(10),l=r(7),i=r(3),a=r(5);const s=e=>{let{clientId:t,setAttributes:r,filterType:s,attributes:u}=e;const{replaceBlock:b}=Object(l.useDispatch)("core/block-editor"),{heading:p,headingLevel:d}=u;if(Object(l.useSelect)(e=>{const{getBlockParentsByBlockName:r}=e("core/block-editor");return r(t,"woocommerce/filter-wrapper").length>0},[t])||!s)return null;const f=[Object(n.createElement)(i.Button,{key:"convert",onClick:()=>{const e=[Object(o.createBlock)("woocommerce/"+s,{...u,heading:""})];p&&""!==p&&e.unshift(Object(o.createBlock)("core/heading",{content:p,level:null!=d?d:2})),b(t,Object(o.createBlock)("woocommerce/filter-wrapper",{heading:p,filterType:s},[...e])),r({heading:"",lock:{remove:!0}})},variant:"primary"},Object(c.__)("Upgrade block","woo-gutenberg-products-block"))];return Object(n.createElement)(a.Warning,{actions:f},Object(c.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woo-gutenberg-products-block"))}},125:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)({}),o=()=>{const{wrapper:e}=Object(n.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},126:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},13:function(e,t){e.exports=window.wp.primitives},139:function(e,t){},140:function(e,t){},142:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},15:function(e,t){e.exports=window.wp.htmlEntities},16:function(e,t){e.exports=window.wp.url},181:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(8);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const i=l.slug.filter(e=>e!==c),a=e.filter(e=>e.attribute!==r.taxonomy);i.length>0&&(l.slug=i.sort(),a.push(l)),t(Object(n.sortBy)(a,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const l=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(l):(l.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute"))),l}},183:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters Controls","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},2:function(e,t){e.exports=window.wc.wcSettings},200:function(e,t){},223:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return l}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},241:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return a})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return u}));var n=r(16),c=r(2),o=r(126);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),i="query_type_",a="filter_";function s(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},25:function(e,t){e.exports=window.wp.isShallowEqual},256:function(e,t,r){"use strict";var n=r(6),c=r.n(n),o=r(0),l=r(4),i=r.n(l),a=r(1),s=r(119),u=r(551);r(200);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:l="",radius:a="small",children:s=null,...u}=e;const b=n,p=i()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+a),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),s)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:f="",...m}=e;const g=p?"span":"button";if(!t){const e=f&&"string"==typeof f?f:d;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
  Object(a.__)("Remove","woo-gutenberg-products-block"):Object(a.sprintf)(
4
  /* translators: %s text of the chip to remove. */
5
- Object(a.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},m,j,{className:i()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},y),Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},26:function(e,t){e.exports=window.wc.priceFormat},29:function(e,t,r){"use strict";var n=r(0),c=r(4),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:l,wrapperProps:i={}}=e;const a=null!=r,s=null!=c;return!a&&s?(t=l||"span",i={...i,className:o()(i.className,"screen-reader-text")},Object(n.createElement)(t,i,c)):(t=l||n.Fragment,a&&s&&r!==c?Object(n.createElement)(t,i,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,i,r))}},3:function(e,t){e.exports=window.wp.components},33:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},40:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),c=r(25),o=r.n(c);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},410:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return i}));var n=r(33);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),i=e=>Array.isArray(e)&&e.every(l)},417:function(e,t,r){e.exports=r(483)},418:function(e,t,r){"use strict";var n=r(0),c=r(13);const o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(n.createElement)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}));t.a=o},419:function(e,t){},420:function(e,t){},44:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},483:function(e,t,r){"use strict";r.r(t);var n=r(6),c=r.n(n),o=r(0),l=r(1),i=r(10),a=r(418),s=r(119),u=r(4),b=r.n(u),p=r(5),d=r(102),f=r(3),m=r(53),g=r(2),O=r(29),j=r(126),y=r(33),w=r(410),_=r(241),h=r(103);r(420);var v=r(223),k=r(26),E=r(256),S=r(16),x=r(551),N=(r(86),r(183));const C=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(l.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
  Object(l.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(k.formatPrice)(e),Object(k.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
8
  /* translators: %s min price */
@@ -10,6 +10,6 @@ Object(l.__)("From %s","woo-gutenberg-products-block"),Object(k.formatPrice)(e))
10
  /* translators: %s max price */
11
  Object(l.__)("Up to %s","woo-gutenberg-products-block"),Object(k.formatPrice)(t)),A=e=>{let{type:t,name:r,prefix:n="",removeCallback:c=(()=>null),showLabel:i=!0,displayStyle:a}=e;const u=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,b=Object(l.sprintf)(
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
- Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},i&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===a?Object(o.createElement)(E.a,{element:"span",text:u,onRemove:c,radius:"large",ariaLabel:b}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:c},Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:x.a,size:16}),Object(o.createElement)(O.a,{screenReaderLabel:b})),u))},R=function(){if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),i=Object(S.addQueryArgs)(r,l);Object(_.c)(i)},T=["min_price","max_price","rating_filter","filter_","query_type_"],L=e=>{let t=!1;for(let r=0;T.length>r;r++){const n=T[r];if(n===e.substring(0,n.length)){t=!0;break}}return t};var B=r(108),F=r(15),P=r(181),Q=e=>{let{attributeObject:t,slugs:r=[],operator:n="in",displayStyle:c,isLoadingCallback:i}=e;const{results:a,isLoading:s}=Object(B.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[u,b]=Object(m.b)("attributes",[]);if(Object(o.useEffect)(()=>{i(s)},[s,i]),!Array.isArray(a)||!Object(w.b)(a)||!Object(w.a)(u))return null;const p=t.label,d=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,j.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},p,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const i=a.find(t=>t.slug===e);if(!i)return null;let f="";return r>0&&"and"===n&&(f=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(l.__)("All","woo-gutenberg-products-block"))),A({type:p,name:Object(F.decodeEntities)(i.name||e),prefix:f,isLoading:s,removeCallback:()=>{const r=u.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?R("query_type_"+t.name,"filter_"+t.name):R({["filter_"+t.name]:e}),d||Object(P.a)(u,b,t,e)},showLabel:!1,displayStyle:c})})))},M=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(o.createElement)(o.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(o.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(o.createElement)("span",{className:"show-loading-state__inner"})))):null},D=r(125),I=e=>{let{attributes:t,isEditor:r=!1}=e;const n=Object(D.a)(),c=function(){const e=Object(o.useRef)(!1);return Object(o.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(o.useCallback)(()=>e.current,[])}()(),i=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,j.a),[a,s]=Object(o.useState)(!0),u=(()=>{if(!window)return!1;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(L(t)){n=!0;break}}return n})()&&!r&&a,[p,d]=Object(m.b)("attributes",[]),[f,k]=Object(m.b)("stock_status",[]),[E,x]=Object(m.b)("min_price"),[N,T]=Object(m.b)("max_price"),[B,F]=Object(m.b)("rating"),P=Object(g.getSetting)("stockStatusOptions",[]),I=Object(g.getSetting)("attributes",[]),V=Object(o.useMemo)(()=>{return!u&&0!==f.length&&(e=f,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(y.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(P)?f.map(e=>A({type:Object(l.__)("Stock Status","woo-gutenberg-products-block"),name:P[e],removeCallback:()=>{if(R({filter_stock_status:e}),!i){const t=f.filter(t=>t!==e);k(t)}},displayStyle:t.displayStyle})):null;var e},[u,P,f,k,t.displayStyle,i]),W=Object(o.useMemo)(()=>u||!Number.isFinite(E)&&!Number.isFinite(N)?null:A({type:Object(l.__)("Price","woo-gutenberg-products-block"),name:C(E,N),removeCallback:()=>{R("max_price","min_price"),i||(x(void 0),T(void 0))},displayStyle:t.displayStyle}),[u,E,N,t.displayStyle,x,T,i]),Y=Object(o.useMemo)(()=>!Object(w.a)(p)&&c||!p.length&&!(e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(S.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o})(I)?(a&&s(!1),null):p.map(e=>{const r=Object(v.b)(e.attribute);return r?Object(o.createElement)(Q,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:s}):(a&&s(!1),null)}),[p,c,I,a,t.displayStyle]);Object(o.useEffect)(()=>{var e;if(!i)return;if(B.length&&B.length>0)return;const t=null===(e=Object(_.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&F(t.split(","))},[i,B,F]);const z=Object(o.useMemo)(()=>{return!u&&0!==B.length&&(e=B,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?B.map(e=>A({type:Object(l.__)("Rating","woo-gutenberg-products-block"),name:Object(l.sprintf)(
14
  /* translators: %s is referring to the average rating value */
15
- Object(l.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(i)return R({rating_filter:e});const t=B.filter(t=>t!==e);F(t)},displayStyle:t.displayStyle})):null;var e},[u,B,F,t.displayStyle,i]);if(!u&&!(p.length>0||f.length>0||B.length>0||Number.isFinite(E)||Number.isFinite(N))&&!r)return n(!1),null;const K="h"+t.headingLevel,U=Object(o.createElement)(K,{className:"wc-block-active-filters__title"},t.heading),q=u?Object(o.createElement)(h.a,null,U):U;if(!Object(g.getSettingWithCoercion)("has_filterable_products",!1,j.a))return n(!1),null;n(!0);const G=b()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":u});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&q,Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:G},r?Object(o.createElement)(o.Fragment,null,A({type:Object(l.__)("Size","woo-gutenberg-products-block"),name:Object(l.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),A({type:Object(l.__)("Color","woo-gutenberg-products-block"),name:Object(l.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(M,{isLoading:u,displayStyle:t.displayStyle}),W,V,Y,z)),u?Object(o.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{(()=>{if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!L(e)).map(e=>[e,t[e]])),c=Object(S.addQueryArgs)(r,n);Object(_.c)(c)})(),i||(x(void 0),T(void 0),d([]),k([]),F([]))}},Object(o.createElement)(O.a,{label:Object(l.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(l.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=(r(419),r(124)),W=Object(f.withSpokenMessages)(e=>{let{attributes:t,setAttributes:r,clientId:n}=e;const{className:c,displayStyle:i,heading:a,headingLevel:s}=t,u=Object(p.useBlockProps)({className:c});return Object(o.createElement)("div",u,Object(o.createElement)(p.InspectorControls,{key:"inspector"},Object(o.createElement)(f.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(f.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,onChange:e=>r({displayStyle:e}),className:"wc-block-active-filter__style-toggle"},Object(o.createElement)(f.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(f.__experimentalToggleGroupControlOption,{value:"chips",label:Object(l.__)("Chips","woo-gutenberg-products-block")})))),Object(o.createElement)(V.a,{attributes:t,clientId:n,setAttributes:r,filterType:"active-filters"}),a&&Object(o.createElement)(d.a,{className:"wc-block-active-filters__title",headingLevel:s,heading:a,onChange:e=>r({heading:e})}),Object(o.createElement)(f.Disabled,null,Object(o.createElement)(I,{attributes:t,isEditor:!0})))});const Y={heading:{type:"string",default:Object(l.__)("Active filters","woo-gutenberg-products-block")}};Object(i.registerBlockType)(N,{icon:{src:Object(o.createElement)(s.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},attributes:{...N.attributes,...Y},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_layered_nav_filters"===t&&!(null==r||!r.raw)},transform:e=>{var t;let{instance:r}=e;return Object(i.createBlock)("woocommerce/active-filters",{displayStyle:"list",heading:(null==r||null===(t=r.raw)||void 0===t?void 0:t.title)||Object(l.__)("Active filters","woo-gutenberg-products-block"),headingLevel:3})}}]},edit:W,save(e){let{attributes:t}=e;const{className:r,displayStyle:n,heading:l,headingLevel:i}=t,a={"data-display-style":n,"data-heading":l,"data-heading-level":i};return Object(o.createElement)("div",c()({},p.useBlockProps.save({className:b()("is-loading",r)}),a),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},53:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(9),c=r(7),o=r(0),l=r(25),i=r.n(l),a=r(40),s=r(104),u=r(44);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},p=(e,t,r)=>{const l=Object(u.a)();r=r||l;const i=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[i,Object(o.useCallback)(t=>{a(r,e,t)},[r,e,a])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),l=Object(a.a)(n),p=Object(a.a)(e),d=Object(s.a)(p),f=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{i()(d,p)||(c(Object.assign({},l,p)),f.current=!0)},[l,p,d,c]),f.current?[n,c]:[e,c]}},7:function(e,t){e.exports=window.wp.data},8:function(e,t){e.exports=window.lodash},86:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},9:function(e,t){e.exports=window.wc.wcBlocksData}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,l,i=t[0],a=t[1],s=t[2],b=0,p=[];b<i.length;b++)l=i[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&p.push(c[l][0]),c[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,i=1;i<r.length;i++){var a=r[i];0!==c[a]&&(n=!1)}n&&(o.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},c={5:0,1:0},o=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=a;return o.push([417,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.blocks},102:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)({}),o=()=>{const{wrapper:e}=Object(n.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},103:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},107:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(9),c=r(7),o=r(0),l=r(40),i=r(142);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:s={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(l.a)(s),d=Object(l.a)(a),f=Object(i.a)(),m=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");f(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==m&&(b.current=m),b.current}},11:function(e,t){e.exports=window.wp.compose},12:function(e,t){e.exports=window.React},123:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),c=r(1),o=r(10),l=r(7),i=r(3),a=r(5);const s=e=>{let{clientId:t,setAttributes:r,filterType:s,attributes:u}=e;const{replaceBlock:b}=Object(l.useDispatch)("core/block-editor"),{heading:p,headingLevel:d}=u;if(Object(l.useSelect)(e=>{const{getBlockParentsByBlockName:r}=e("core/block-editor");return r(t,"woocommerce/filter-wrapper").length>0},[t])||!s)return null;const f=[Object(n.createElement)(i.Button,{key:"convert",onClick:()=>{const e=[Object(o.createBlock)("woocommerce/"+s,{...u,heading:""})];p&&""!==p&&e.unshift(Object(o.createBlock)("core/heading",{content:p,level:null!=d?d:2})),b(t,Object(o.createBlock)("woocommerce/filter-wrapper",{heading:p,filterType:s},[...e])),r({heading:"",lock:{remove:!0}})},variant:"primary"},Object(c.__)("Upgrade block","woo-gutenberg-products-block"))];return Object(n.createElement)(a.Warning,{actions:f},Object(c.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woo-gutenberg-products-block"))}},124:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r(11),l=r(1);r(167),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:r,onChange:o,heading:i,instanceId:a}=e;const s="h"+r;return Object(n.createElement)(s,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+a},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(c.PlainText,{id:"block-title-"+a,className:"wc-block-editor-components-title",value:i,onChange:o}))})},125:function(e,t,r){"use strict";var n=r(0);r(168),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},128:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},13:function(e,t){e.exports=window.wp.primitives},142:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},15:function(e,t){e.exports=window.wp.htmlEntities},16:function(e,t){e.exports=window.wp.url},167:function(e,t){},168:function(e,t){},183:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(8);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const i=l.slug.filter(e=>e!==c),a=e.filter(e=>e.attribute!==r.taxonomy);i.length>0&&(l.slug=i.sort(),a.push(l)),t(Object(n.sortBy)(a,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const l=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(l):(l.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute"))),l}},185:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters Controls","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"inserter":false,"color":{"text":true,"background":false},"lock":false},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},2:function(e,t){e.exports=window.wc.wcSettings},200:function(e,t){},223:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return l}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},241:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return a})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return u}));var n=r(16),c=r(2),o=r(128);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),i="query_type_",a="filter_";function s(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},25:function(e,t){e.exports=window.wp.isShallowEqual},256:function(e,t,r){"use strict";var n=r(6),c=r.n(n),o=r(0),l=r(4),i=r.n(l),a=r(1),s=r(118),u=r(548);r(200);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:l="",radius:a="small",children:s=null,...u}=e;const b=n,p=i()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+a),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),s)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:f="",...m}=e;const g=p?"span":"button";if(!t){const e=f&&"string"==typeof f?f:d;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
  Object(a.__)("Remove","woo-gutenberg-products-block"):Object(a.sprintf)(
4
  /* translators: %s text of the chip to remove. */
5
+ Object(a.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},m,j,{className:i()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},y),Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},26:function(e,t){e.exports=window.wc.priceFormat},28:function(e,t,r){"use strict";var n=r(0),c=r(4),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:l,wrapperProps:i={}}=e;const a=null!=r,s=null!=c;return!a&&s?(t=l||"span",i={...i,className:o()(i.className,"screen-reader-text")},Object(n.createElement)(t,i,c)):(t=l||n.Fragment,a&&s&&r!==c?Object(n.createElement)(t,i,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,i,r))}},3:function(e,t){e.exports=window.wp.components},33:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},40:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),c=r(25),o=r.n(c);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},410:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return i}));var n=r(33);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),i=e=>Array.isArray(e)&&e.every(l)},417:function(e,t,r){e.exports=r(482)},418:function(e,t,r){"use strict";var n=r(0),c=r(13);const o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(n.createElement)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"}));t.a=o},419:function(e,t){},420:function(e,t){},46:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},482:function(e,t,r){"use strict";r.r(t);var n=r(6),c=r.n(n),o=r(0),l=r(1),i=r(10),a=r(418),s=r(118),u=r(4),b=r.n(u),p=r(5),d=r(124),f=r(3),m=r(53),g=r(2),O=r(28),j=r(128),y=r(33),w=r(410),_=r(241),h=r(125);r(420);var v=r(223),k=r(26),E=r(256),S=r(16),x=r(548),N=(r(86),r(185));const C=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(l.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
  Object(l.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(k.formatPrice)(e),Object(k.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
8
  /* translators: %s min price */
10
  /* translators: %s max price */
11
  Object(l.__)("Up to %s","woo-gutenberg-products-block"),Object(k.formatPrice)(t)),A=e=>{let{type:t,name:r,prefix:n="",removeCallback:c=(()=>null),showLabel:i=!0,displayStyle:a}=e;const u=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,b=Object(l.sprintf)(
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
+ Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},i&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===a?Object(o.createElement)(E.a,{element:"span",text:u,onRemove:c,radius:"large",ariaLabel:b}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:c},Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:x.a,size:16}),Object(o.createElement)(O.a,{screenReaderLabel:b})),u))},R=function(){if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),i=Object(S.addQueryArgs)(r,l);Object(_.c)(i)},T=["min_price","max_price","rating_filter","filter_","query_type_"],L=e=>{let t=!1;for(let r=0;T.length>r;r++){const n=T[r];if(n===e.substring(0,n.length)){t=!0;break}}return t};var B=r(107),F=r(15),P=r(183),Q=e=>{let{attributeObject:t,slugs:r=[],operator:n="in",displayStyle:c,isLoadingCallback:i}=e;const{results:a,isLoading:s}=Object(B.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[u,b]=Object(m.b)("attributes",[]);if(Object(o.useEffect)(()=>{i(s)},[s,i]),!Array.isArray(a)||!Object(w.b)(a)||!Object(w.a)(u))return null;const p=t.label,d=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,j.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},p,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const i=a.find(t=>t.slug===e);if(!i)return null;let f="";return r>0&&"and"===n&&(f=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(l.__)("All","woo-gutenberg-products-block"))),A({type:p,name:Object(F.decodeEntities)(i.name||e),prefix:f,isLoading:s,removeCallback:()=>{const r=u.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?R("query_type_"+t.name,"filter_"+t.name):R({["filter_"+t.name]:e}),d||Object(P.a)(u,b,t,e)},showLabel:!1,displayStyle:c})})))},M=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(o.createElement)(o.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(o.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(o.createElement)("span",{className:"show-loading-state__inner"})))):null},D=r(102),I=e=>{let{attributes:t,isEditor:r=!1}=e;const n=Object(D.a)(),c=function(){const e=Object(o.useRef)(!1);return Object(o.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(o.useCallback)(()=>e.current,[])}()(),i=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,j.a),[a,s]=Object(o.useState)(!0),u=(()=>{if(!window)return!1;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(L(t)){n=!0;break}}return n})()&&!r&&a,[p,d]=Object(m.b)("attributes",[]),[f,k]=Object(m.b)("stock_status",[]),[E,x]=Object(m.b)("min_price"),[N,T]=Object(m.b)("max_price"),[B,F]=Object(m.b)("rating"),P=Object(g.getSetting)("stockStatusOptions",[]),I=Object(g.getSetting)("attributes",[]),V=Object(o.useMemo)(()=>{return!u&&0!==f.length&&(e=f,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(y.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(P)?f.map(e=>A({type:Object(l.__)("Stock Status","woo-gutenberg-products-block"),name:P[e],removeCallback:()=>{if(R({filter_stock_status:e}),!i){const t=f.filter(t=>t!==e);k(t)}},displayStyle:t.displayStyle})):null;var e},[u,P,f,k,t.displayStyle,i]),W=Object(o.useMemo)(()=>u||!Number.isFinite(E)&&!Number.isFinite(N)?null:A({type:Object(l.__)("Price","woo-gutenberg-products-block"),name:C(E,N),removeCallback:()=>{R("max_price","min_price"),i||(x(void 0),T(void 0))},displayStyle:t.displayStyle}),[u,E,N,t.displayStyle,x,T,i]),Y=Object(o.useMemo)(()=>!Object(w.a)(p)&&c||!p.length&&!(e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(S.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o})(I)?(a&&s(!1),null):p.map(e=>{const r=Object(v.b)(e.attribute);return r?Object(o.createElement)(Q,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:s}):(a&&s(!1),null)}),[p,c,I,a,t.displayStyle]);Object(o.useEffect)(()=>{var e;if(!i)return;if(B.length&&B.length>0)return;const t=null===(e=Object(_.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&F(t.split(","))},[i,B,F]);const z=Object(o.useMemo)(()=>{return!u&&0!==B.length&&(e=B,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?B.map(e=>A({type:Object(l.__)("Rating","woo-gutenberg-products-block"),name:Object(l.sprintf)(
14
  /* translators: %s is referring to the average rating value */
15
+ Object(l.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(R({rating_filter:e}),!i){const t=B.filter(t=>t!==e);F(t)}},displayStyle:t.displayStyle})):null;var e},[u,B,F,t.displayStyle,i]);if(!u&&!(p.length>0||f.length>0||B.length>0||Number.isFinite(E)||Number.isFinite(N))&&!r)return n(!1),null;const K="h"+t.headingLevel,U=Object(o.createElement)(K,{className:"wc-block-active-filters__title"},t.heading),q=u?Object(o.createElement)(h.a,null,U):U;if(!Object(g.getSettingWithCoercion)("has_filterable_products",!1,j.a))return n(!1),null;n(!0);const G=b()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":u});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&q,Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:G},r?Object(o.createElement)(o.Fragment,null,A({type:Object(l.__)("Size","woo-gutenberg-products-block"),name:Object(l.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),A({type:Object(l.__)("Color","woo-gutenberg-products-block"),name:Object(l.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(M,{isLoading:u,displayStyle:t.displayStyle}),W,V,Y,z)),u?Object(o.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{(()=>{if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!L(e)).map(e=>[e,t[e]])),c=Object(S.addQueryArgs)(r,n);Object(_.c)(c)})(),i||(x(void 0),T(void 0),d([]),k([]),F([]))}},Object(o.createElement)(O.a,{label:Object(l.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(l.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=(r(419),r(123)),W=Object(f.withSpokenMessages)(e=>{let{attributes:t,setAttributes:r,clientId:n}=e;const{className:c,displayStyle:i,heading:a,headingLevel:s}=t,u=Object(p.useBlockProps)({className:c});return Object(o.createElement)("div",u,Object(o.createElement)(p.InspectorControls,{key:"inspector"},Object(o.createElement)(f.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(f.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,onChange:e=>r({displayStyle:e}),className:"wc-block-active-filter__style-toggle"},Object(o.createElement)(f.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(f.__experimentalToggleGroupControlOption,{value:"chips",label:Object(l.__)("Chips","woo-gutenberg-products-block")})))),Object(o.createElement)(V.a,{attributes:t,clientId:n,setAttributes:r,filterType:"active-filters"}),a&&Object(o.createElement)(d.a,{className:"wc-block-active-filters__title",headingLevel:s,heading:a,onChange:e=>r({heading:e})}),Object(o.createElement)(f.Disabled,null,Object(o.createElement)(I,{attributes:t,isEditor:!0})))});const Y={heading:{type:"string",default:Object(l.__)("Active filters","woo-gutenberg-products-block")}};Object(i.registerBlockType)(N,{icon:{src:Object(o.createElement)(s.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},attributes:{...N.attributes,...Y},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_layered_nav_filters"===t&&!(null==r||!r.raw)},transform:e=>{var t;let{instance:r}=e;return Object(i.createBlock)("woocommerce/active-filters",{displayStyle:"list",heading:(null==r||null===(t=r.raw)||void 0===t?void 0:t.title)||Object(l.__)("Active filters","woo-gutenberg-products-block"),headingLevel:3})}}]},edit:W,save(e){let{attributes:t}=e;const{className:r,displayStyle:n,heading:l,headingLevel:i}=t,a={"data-display-style":n,"data-heading":l,"data-heading-level":i};return Object(o.createElement)("div",c()({},p.useBlockProps.save({className:b()("is-loading",r)}),a),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},53:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(9),c=r(7),o=r(0),l=r(25),i=r.n(l),a=r(40),s=r(103),u=r(46);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},p=(e,t,r)=>{const l=Object(u.a)();r=r||l;const i=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[i,Object(o.useCallback)(t=>{a(r,e,t)},[r,e,a])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),l=Object(a.a)(n),p=Object(a.a)(e),d=Object(s.a)(p),f=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{i()(d,p)||(c(Object.assign({},l,p)),f.current=!0)},[l,p,d,c]),f.current?[n,c]:[e,c]}},7:function(e,t){e.exports=window.wp.data},8:function(e,t){e.exports=window.lodash},86:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},9:function(e,t){e.exports=window.wc.wcBlocksData}});
build/all-products-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '762a7730afa7aa5516dd289f3b068ea4');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '54c24026da965f63278dc59ddc4cc398');
build/all-products-frontend.js CHANGED
@@ -1,11 +1,11 @@
1
- !function(e){function t(t){for(var n,o,c=t[0],i=t[1],a=0,s=[];a<c.length;a++)o=c[a],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(l&&l(t);s.length;)s.shift()()}var n={},r={13:0,9:0};function o(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var c=new Promise((function(t,o){n=r[e]=[t,o]}));t.push(n[2]=c);var i,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(e){return o.p+""+({0:"vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--671ca56f",1:"vendors--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary-shipping--checkout-blocks--18f9376a",4:"cart-blocks/cart-cross-sells-products--product-add-to-cart",10:"vendors--cart-blocks/cart-cross-sells-products--product-add-to-cart",67:"product-add-to-cart",68:"product-button",69:"product-category-list",70:"product-image",71:"product-price",72:"product-rating",73:"product-sale-badge",74:"product-sku",75:"product-stock-indicator",76:"product-summary",77:"product-tag-list",78:"product-title"}[e]||e)+"-frontend.js?ver="+{0:"57e05ea9ff2ec18b2173",1:"ac9f9ace474f492db2d1",4:"f9ccd5f8b020ae11aad8",10:"9b3325642e17a25a3f2f",67:"b854724dcb721f3154ca",68:"79df5554e3d121cf86c9",69:"ee28f6d44a243e246691",70:"46ab4d0eca0a03cdf411",71:"5a11b2dd2a3e45bf5039",72:"e33571a23b3982a22bb4",73:"cd7912c7e1f93b1bcbf7",74:"3d4e0936bf29626c7fe7",75:"37bfa489d901c21edd93",76:"2120e5303ac2c50f9a11",77:"af981af1ce6c97429407",78:"fe5b6f4f27c7d3821916"}[e]}(e);var l=new Error;i=function(t){a.onerror=a.onload=null,clearTimeout(s);var n=r[e];if(0!==n){if(n){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",l.name="ChunkLoadError",l.type=o,l.request=c,n[1](l)}r[e]=void 0}};var s=setTimeout((function(){i({type:"timeout",target:a})}),12e4);a.onerror=a.onload=i,document.head.appendChild(a)}return Promise.all(t)},o.m=e,o.c=n,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var c=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var a=0;a<c.length;a++)t(c[a]);var l=i;o(o.s=237)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.data},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===c)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}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=window.lodash},function(e,t){e.exports=window.React},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},,function(e,t){e.exports=window.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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(16),o=n.n(r),c=n(0),i=n(7),a=n(1),l=n(44),s=e=>{let{imageUrl:t=l.l+"/block-error.svg",header:n=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(a.__)("Error:","woo-gutenberg-products-block"),button:s,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),s&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},s))):null};n(33);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:i,renderError:a,button:l}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof a?a({errorMessage:u}):Object(c.createElement)(s,{showErrorBlock:r,errorMessage:n?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:l}):this.props.children}}t.a=u},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wc.wcBlocksRegistry},,,function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wp.htmlEntities},function(e,t,n){"use strict";var r=n(0),o=n(5),c=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:i,wrapperProps:a={}}=e;const l=null!=n,s=null!=o;return!l&&s?(t=i||"span",a={...a,className:c()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=i||r.Fragment,l&&s&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const o=Object(r.createContext)("page"),c=()=>Object(r.useContext)(o);o.Provider},function(e,t){e.exports=window.wp.a11y},,function(e,t,n){"use strict";(function(e){var r=n(0);n(37);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(65))},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(12),c=n.n(o);function i(e){const t=Object(r.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return m}));var r=n(3),o=n(4),c=n(0),i=n(12),a=n.n(i),l=n(27),s=n(61),u=n(23);const d=e=>{const t=Object(u.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const a=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(c.useCallback)(t=>{l(n,e,t)},[n,e,l])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,o]=d(t),i=Object(l.a)(r),p=Object(l.a)(e),m=Object(s.a)(p),b=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{a()(m,p)||(o(Object.assign({},i,p)),b.current=!0)},[i,p,m,o]),b.current?[r,o]:[e,o]}},function(e,t){e.exports=window.wp.apiFetch},,function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);n(4);const o=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(r.useContext)(o)},function(e,t,n){"use strict";var r=n(5),o=n.n(r),c=n(0);t.a=Object(c.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(c.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return O}));var r=n(6),o=n(0),c=n(3),i=n(4),a=n(21),l=n(130),s=n(34),u=n(89);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},m=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),p),[])},b={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},f={...b,email:""},g={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:c.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},h=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,n]=e;return[t,Object(a.decodeEntities)(n)]})),E={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:c.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:b,shippingRates:c.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:n}=Object(s.a)(),a=null==n?void 0:n.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();m();const p=Object(i.useSelect)((e,n)=>{let{dispatch:r}=n;if(!u)return E;if(t)return{cartCoupons:a.coupons,cartItems:a.items,crossSellsProducts:a.cross_sells,cartFees:a.fees,cartItemsCount:a.items_count,cartItemsWeight:a.items_weight,cartNeedsPayment:a.needs_payment,cartNeedsShipping:a.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:a.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingData:f,billingAddress:f,shippingAddress:b,extensions:c.EMPTY_EXTENSIONS,shippingRates:a.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:a.has_calculated_shipping,paymentRequirements:a.paymentRequirements,receiveCart:"function"==typeof(null==a?void 0:a.receiveCart)?a.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),s=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),m=o.isCustomerDataUpdating(),{receiveCart:g}=r(c.CART_STORE_KEY),O=h(i.billingAddress),w=i.needsShipping?h(i.shippingAddress):O,y=i.fees.length>0?i.fees.map(e=>h(e)):c.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map(e=>({...e,label:e.code})):c.EMPTY_CART_COUPONS,cartItems:i.items,crossSellsProducts:i.crossSells,cartFees:y,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:s,billingData:Object(l.a)(O),billingAddress:Object(l.a)(O),shippingAddress:Object(l.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,isLoadingRates:m,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:g}},[u]);return d.current&&Object(r.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(11),o=n.n(r),c=n(0),i=n(15);const a=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const l=r(e,n),s=a(e,n),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:a={},errorBoundaryProps:l={}}=e;Object(c.render)(Object(c.createElement)(i.a,l,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},a,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:l,attributes:u,errorBoundaryProps:s})})},s=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:c}=e;const i=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),l({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:c}=e;const i=c.querySelectorAll(o);l({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},function(e,t){e.exports=window.wc.priceFormat},function(e,t,n){"use strict";var r=n(8),o=n(0),c=n(14),i=function({icon:e,className:t,...n}){const c=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:c},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(i,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===c.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(c.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},,,function(e,t,n){"use strict";var r=n(8),o=n(0),c=n(5),i=n.n(c),a=n(6),l=n(20),s=n.n(l),u=n(10),d=n(45),p=n(90),m=n(1);function b(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const c=o.getBoundingClientRect();return new r.DOMRect(e.left+c.left,e.top+c.top,e.width,e.height)}let f=0;function g(e){const t=document.scrollingElement||document.body;e&&(f=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=f)}let h=0;function E(){return Object(o.useEffect)(()=>(0===h&&g(!0),++h,()=>{1===h&&g(!1),--h}),[]),null}var O=n(26);function w(e){const t=Object(o.useContext)(O.a),n=t.slots[e]||{},r=t.fills[e],c=Object(o.useMemo)(()=>r||[],[r]);return{...n,updateSlot:Object(o.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:c,registerFill:Object(o.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var y=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function v({name:e,children:t,registerFill:n,unregisterFill:r}){const c=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(y),[r,c]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(c(t(e)),n(()=>{c(t(e))})),[e]),r})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,i.current),()=>r(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,c&&c.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))},[e]),c&&c.node?(Object(a.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var j=e=>Object(o.createElement)(y.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(v,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class _ extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,c=Object(a.map)(r(t,this),e=>{const t=Object(a.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(a.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(a.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(a.isFunction)(e)?e(c):c)}}var x=e=>Object(o.createElement)(y.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:c})=>Object(o.createElement)(_,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:c})));function k(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function S({name:e,children:t}){const n=w(e),r=Object(o.useRef)({rerender:k()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var T=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...c},i){const a=Object(o.useContext)(O.a),l=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(a.registerSlot(e,l,t),()=>{a.unregisterSlot(e,l)}),[a.registerSlot,a.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{a.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,l])},c))}));function N(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(j,e),Object(o.createElement)(S,e))}n(12),o.Component;const C=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(T,Object(r.a)({},t,{ref:n})):Object(o.createElement)(x,t));function R(e){return"appear"===e?"top":"left"}function A(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const a=n?parseInt(n,10):0,l=r?parseInt(r,10):0,s=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+s,y:e.top+a,width:e.width-s-u,height:e.height-a-l,left:e.left+s,right:e.right-u,top:e.top+a,bottom:e.bottom-l}}function L(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function P(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function M(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const D=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:c,noArrow:a=!0,isAlternate:l,position:f="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:O,shouldAnchorIncludePadding:y,anchorRect:v,getAnchorRect:j,expandOnMobile:_,animate:x=!0,onClickOutside:k,onFocusOutside:S,__unstableStickyBoundaryElement:T,__unstableSlotName:C="Popover",__unstableObserveElement:D,__unstableBoundaryParent:F,__unstableForcePosition:B,__unstableForceXAlignment:I,...H},z)=>{const U=Object(o.useRef)(null),W=Object(o.useRef)(null),G=Object(o.useRef)(),Y=Object(u.useViewportMatch)("medium","<"),[V,Q]=Object(o.useState)(),K=w(C),X=_&&Y,[$,J]=Object(u.useResizeObserver)();a=X||a,Object(o.useLayoutEffect)(()=>{if(X)return M(G.current,"is-without-arrow",a),M(G.current,"is-alternate",l),L(G.current,"data-x-axis"),L(G.current,"data-y-axis"),P(G.current,"top"),P(G.current,"left"),P(W.current,"maxHeight"),void P(W.current,"maxWidth");const e=()=>{if(!G.current||!W.current)return;let e=function(e,t,n,r=!1,o,c){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return b(t,t.ownerDocument||e.current.ownerDocument,c)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,c);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,c);return o?e:A(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=b(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,c);return o?a:A(a,r)}if(!e.current)return;const{parentNode:i}=e.current,a=i.getBoundingClientRect();return o?a:A(a,i)}(U,v,j,O,y,G.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=G.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var c;F&&(r=null===(c=G.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=J.height?J:W.current.getBoundingClientRect(),{popoverTop:s,popoverLeft:u,xAxis:p,yAxis:g,contentHeight:h,contentWidth:E}=function(e,t,n="top",r,o,c,i,a,l){const[s,u="center",d]=n.split(" "),p=function(e,t,n,r,o,c,i,a){const{height:l}=t;if(o){const t=o.getBoundingClientRect().top+l-i;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let s=e.top+e.height/2;"bottom"===r?s=e.bottom:"top"===r&&(s=e.top);const u={popoverTop:s,contentHeight:(s-l/2>0?l/2:s)+(s+l/2>window.innerHeight?window.innerHeight-s:l/2)},d={popoverTop:e.top,contentHeight:e.top-10-l>0?l:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+l>window.innerHeight?window.innerHeight-10-e.bottom:l};let m,b=n,f=null;if(!o&&!a)if("middle"===n&&u.contentHeight===l)b="middle";else if("top"===n&&d.contentHeight===l)b="top";else if("bottom"===n&&p.contentHeight===l)b="bottom";else{b=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===b?d.contentHeight:p.contentHeight;f=e!==l?e:null}return m="middle"===b?u.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:m,contentHeight:f}}(e,t,s,d,r,0,c,a);return{...function(e,t,n,r,o,c,i,a,l){const{width:s}=t;"left"===n&&Object(m.isRTL)()?n="right":"right"===n&&Object(m.isRTL)()&&(n="left"),"left"===r&&Object(m.isRTL)()?r="right":"right"===r&&Object(m.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-s/2>0?s/2:u)+(u+s/2>window.innerWidth?window.innerWidth-u:s/2)};let p=e.left;"right"===r?p=e.right:"middle"===c||l||(p=u);let b=e.right;"left"===r?b=e.left:"middle"===c||l||(b=u);const f={popoverLeft:p,contentWidth:p-s>0?s:p},g={popoverLeft:b,contentWidth:b+s>window.innerWidth?window.innerWidth-b:s};let h,E=n,O=null;if(!o&&!a)if("center"===n&&d.contentWidth===s)E="center";else if("left"===n&&f.contentWidth===s)E="left";else if("right"===n&&g.contentWidth===s)E="right";else{E=f.contentWidth>g.contentWidth?"left":"right";const e="left"===E?f.contentWidth:g.contentWidth;s>window.innerWidth&&(O=window.innerWidth),e!==s&&(E="center",d.popoverLeft=window.innerWidth/2)}if(h="center"===E?d.popoverLeft:"left"===E?f.popoverLeft:g.popoverLeft,i){const e=i.getBoundingClientRect();h=Math.min(h,e.right-s),Object(m.isRTL)()||(h=Math.max(h,0))}return{xAxis:E,popoverLeft:h,contentWidth:O}}(e,t,u,d,r,p.yAxis,i,a,l),...p}}(e,i,f,T,G.current,o,r,B,I);"number"==typeof s&&"number"==typeof u&&(P(G.current,"top",s+"px"),P(G.current,"left",u+"px")),M(G.current,"is-without-arrow",a||"center"===p&&"middle"===g),M(G.current,"is-alternate",l),L(G.current,"data-x-axis",p),L(G.current,"data-y-axis",g),P(W.current,"maxHeight","number"==typeof h?h+"px":""),P(W.current,"maxWidth","number"==typeof E?E+"px":""),Q(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=G.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const c=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",c),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let s;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),D&&(s=new n.MutationObserver(e),s.observe(D,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",c),n.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),s&&s.disconnect()}},[X,v,j,O,y,f,J,T,D,F]);const Z=(e,n)=>{if("focus-outside"===e&&S)S(n);else if("focus-outside"===e&&k){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),s()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),k(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:Z,onClose:Z}),ne=Object(u.useMergeRefs)([G,ee,z]),re=Boolean(x&&V)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=R(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:V});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",c,re,{"is-expanded":X,"is-without-arrow":a,"is-alternate":l})},H,{ref:ne},te,{tabIndex:"-1"}),X&&Object(o.createElement)(E,null),X&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(q,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:W,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},$,n)));return K.ref&&(oe=Object(o.createElement)(N,{name:C},oe)),O||v?oe:Object(o.createElement)("span",{ref:U},oe)});D.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(C,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=D,B=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(a.isString)(e)&&(n=e),Object(a.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const I=Object(o.createElement)("div",{className:"event-catcher"}),H=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(I,e),Object(o.cloneElement)(t,{children:n}),","),e),z=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),U=(e,t,n)=>{if(1!==o.Children.count(e))return;const r=o.Children.only(e);"function"==typeof r.props[t]&&r.props[t](n)};var W=function({children:e,position:t,text:n,shortcut:r}){const[c,i]=Object(o.useState)(!1),[l,s]=Object(o.useState)(!1),d=Object(u.useDebounce)(s,700),p=t=>{U(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},m=t=>{U(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},b=e=>"mouseUp"===e?m:"mouseDown"===e?p:void 0,f=b("mouseUp"),g=(t,n)=>r=>{if(U(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&c)return;d.cancel();const o=Object(a.includes)(["focus","mouseenter"],r.type);o!==l&&(n?d(o):s(o))},h=()=>{d.cancel(),document.removeEventListener("mouseup",f)};if(Object(o.useEffect)(()=>h,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:g("onMouseEnter",!0),onMouseLeave:g("onMouseLeave"),onClick:g("onClick"),onFocus:g("onFocus"),onBlur:g("onBlur"),onMouseDown:b("mouseDown")},O=o.Children.only(e),{children:w,disabled:y}=O.props;return(y?H:z)({child:O,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:c})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(F,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},r,Object(o.createElement)(B,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:l,position:t,text:n,shortcut:r})})},G=n(40),Y=n(35);const V=["onMouseDown","onClick"];var q=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:c,isSmall:l,isPressed:u,isBusy:d,isDestructive:p,className:m,disabled:b,icon:f,iconPosition:g="left",iconSize:h,showTooltip:E,tooltipPosition:O,shortcut:w,label:y,children:v,text:j,variant:_,__experimentalIsFocusable:x,describedBy:k,...S}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:c,...i}){let a=c;var l,u,d,p,m;return t&&(null!==(l=a)&&void 0!==l||(a="primary")),r&&(null!==(u=a)&&void 0!==u||(a="tertiary")),n&&(null!==(d=a)&&void 0!==d||(a="secondary")),e&&(s()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=a)&&void 0!==p||(a="secondary")),o&&(null!==(m=a)&&void 0!==m||(a="link")),{...i,variant:a}}(e),T=i()("components-button",m,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":l,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!v,"has-icon":!!f}),N=b&&!x,C=void 0===n||N?"button":"a",R="a"===C?{href:n,target:c}:{type:"button",disabled:N,"aria-pressed":u};if(b&&x){R["aria-disabled"]=!0;for(const e of V)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const A=!N&&(E&&y||w||!!y&&(!v||Object(a.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(a.uniqueId)():null,P=S["aria-describedby"]||L,M=Object(o.createElement)(C,Object(r.a)({},R,S,{className:T,"aria-label":S["aria-label"]||y,"aria-describedby":P,ref:t}),f&&"left"===g&&Object(o.createElement)(G.a,{icon:f,size:h}),j&&Object(o.createElement)(o.Fragment,null,j),f&&"right"===g&&Object(o.createElement)(G.a,{icon:f,size:h}),v);return A?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(W,{text:k||y,shortcut:w,position:O},M),k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k))):Object(o.createElement)(o.Fragment,null,M,k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k)))}))},function(e,t,n){"use strict";n.d(t,"n",(function(){return c})),n.d(t,"l",(function(){return i})),n.d(t,"k",(function(){return a})),n.d(t,"m",(function(){return l})),n.d(t,"i",(function(){return s})),n.d(t,"d",(function(){return u})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return m})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return f})),n.d(t,"a",(function(){return g})),n.d(t,"h",(function(){return h})),n.d(t,"b",(function(){return E}));var r,o=n(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",a=c.pluginUrl+"build/",l=c.buildPhase,s=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t){e.exports=window.wp.dom},function(e,t){e.exports=window.wp.hooks},function(e,t){e.exports=window.wc.wcBlocksSharedContext},,,,,,,,,function(e,t,n){"use strict";var r=n(2),o=n(1),c=n(92),i=n(28);const a=Object(r.getSetting)("countryLocale",{}),l=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
2
  /* translators: %s Field label. */
3
- Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(c.a)(e.priority)&&(t.index=e.priority),Object(i.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},s=Object.entries(a).map(e=>{let[t,n]=e;return[t,Object.entries(n).map(e=>{let[t,n]=e;return[t,l(n)]}).reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{})]}).reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{});t.a=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=n&&void 0!==s[n]?s[n]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(3),o=n(4),c=n(0),i=n(27),a=n(73);const l=e=>{const{namespace:t,resourceName:n,resourceValues:l=[],query:s={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(s),m=Object(i.a)(l),b=Object(a.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),c=[t,n,p,m],i=o.getCollectionError(...c);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(i)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,n,m,p,u]);return null!==f&&(d.current=f),d.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(7);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},,,,function(e,t){var n,r,o=e.exports={};function c(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===c||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:c}catch(e){n=c}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l,s=[],u=!1,d=-1;function p(){u&&l&&(u=!1,l.length?s=l.concat(s):d=-1,s.length&&m())}function m(){if(!u){var e=a(p);u=!0;for(var t=s.length;t;){for(l=s,s=[];++d<t;)l&&l[d].run();d=-1,t=s.length}l=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function f(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new b(e,t)),1!==s.length||u||a(m)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(46),o=n(0),c=n(36);const i=()=>{const e=Object(c.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...n,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t,n){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,n){return(t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,o,c){return(r=n()?Reflect.construct:function(e,n,r){var o=[null];o.push.apply(o,n);var c=new(Function.bind.apply(e,o));return r&&t(c,r.prototype),c}).apply(null,arguments)}function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,void 0):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var i=Object.hasOwnProperty,a=Object.setPrototypeOf,l=Object.isFrozen,s=Object.getPrototypeOf,u=Object.getOwnPropertyDescriptor,d=Object.freeze,p=Object.seal,m=Object.create,b="undefined"!=typeof Reflect&&Reflect,f=b.apply,g=b.construct;f||(f=function(e,t,n){return e.apply(t,n)}),d||(d=function(e){return e}),p||(p=function(e){return e}),g||(g=function(e,t){return r(e,o(t))});var h,E=T(Array.prototype.forEach),O=T(Array.prototype.pop),w=T(Array.prototype.push),y=T(String.prototype.toLowerCase),v=T(String.prototype.match),j=T(String.prototype.replace),_=T(String.prototype.indexOf),x=T(String.prototype.trim),k=T(RegExp.prototype.test),S=(h=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g(h,t)});function T(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return f(e,t,r)}}function N(e,t,n){n=n||y,a&&a(e,null);for(var r=t.length;r--;){var o=t[r];if("string"==typeof o){var c=n(o);c!==o&&(l(t)||(t[r]=c),o=c)}e[o]=!0}return e}function C(e){var t,n=m(null);for(t in e)f(i,e,[t])&&(n[t]=e[t]);return n}function R(e,t){for(;null!==e;){var n=u(e,t);if(n){if(n.get)return T(n.get);if("function"==typeof n.value)return T(n.value)}e=s(e)}return function(e){return console.warn("fallback value for",e),null}}var A=d(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),L=d(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),P=d(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),M=d(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),D=d(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),F=d(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),B=d(["#text"]),I=d(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),H=d(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),z=d(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),U=d(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),W=p(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=p(/<%[\w\W]*|[\w\W]*%>/gm),Y=p(/^data-[\-\w.\u00B7-\uFFFF]/),V=p(/^aria-[\-\w]+$/),q=p(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q=p(/^(?:\w+script|data):/i),K=p(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),X=p(/^html$/i),$=function(){return"undefined"==typeof window?null:window},J=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null;n.currentScript&&n.currentScript.hasAttribute("data-tt-policy-suffix")&&(r=n.currentScript.getAttribute("data-tt-policy-suffix"));var o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};return function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$(),r=function(e){return t(e)};if(r.version="2.4.0",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var c=n.document,i=n.document,a=n.DocumentFragment,l=n.HTMLTemplateElement,s=n.Node,u=n.Element,p=n.NodeFilter,m=n.NamedNodeMap,b=void 0===m?n.NamedNodeMap||n.MozNamedAttrMap:m,f=n.HTMLFormElement,g=n.DOMParser,h=n.trustedTypes,T=u.prototype,Z=R(T,"cloneNode"),ee=R(T,"nextSibling"),te=R(T,"childNodes"),ne=R(T,"parentNode");if("function"==typeof l){var re=i.createElement("template");re.content&&re.content.ownerDocument&&(i=re.content.ownerDocument)}var oe=J(h,c),ce=oe?oe.createHTML(""):"",ie=i,ae=ie.implementation,le=ie.createNodeIterator,se=ie.createDocumentFragment,ue=ie.getElementsByTagName,de=c.importNode,pe={};try{pe=C(i).documentMode?i.documentMode:{}}catch(e){}var me={};r.isSupported="function"==typeof ne&&ae&&void 0!==ae.createHTMLDocument&&9!==pe;var be,fe,ge=W,he=G,Ee=Y,Oe=V,we=Q,ye=K,ve=q,je=null,_e=N({},[].concat(o(A),o(L),o(P),o(D),o(B))),xe=null,ke=N({},[].concat(o(I),o(H),o(z),o(U))),Se=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ne=null,Ce=!0,Re=!0,Ae=!1,Le=!1,Pe=!1,Me=!1,De=!1,Fe=!1,Be=!1,Ie=!1,He=!0,ze=!1,Ue="user-content-",We=!0,Ge=!1,Ye={},Ve=null,qe=N({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Qe=null,Ke=N({},["audio","video","img","source","image","track"]),Xe=null,$e=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml",tt=et,nt=!1,rt=["application/xhtml+xml","text/html"],ot="text/html",ct=null,it=i.createElement("form"),at=function(e){return e instanceof RegExp||e instanceof Function},lt=function(t){ct&&ct===t||(t&&"object"===e(t)||(t={}),t=C(t),be=be=-1===rt.indexOf(t.PARSER_MEDIA_TYPE)?ot:t.PARSER_MEDIA_TYPE,fe="application/xhtml+xml"===be?function(e){return e}:y,je="ALLOWED_TAGS"in t?N({},t.ALLOWED_TAGS,fe):_e,xe="ALLOWED_ATTR"in t?N({},t.ALLOWED_ATTR,fe):ke,Xe="ADD_URI_SAFE_ATTR"in t?N(C($e),t.ADD_URI_SAFE_ATTR,fe):$e,Qe="ADD_DATA_URI_TAGS"in t?N(C(Ke),t.ADD_DATA_URI_TAGS,fe):Ke,Ve="FORBID_CONTENTS"in t?N({},t.FORBID_CONTENTS,fe):qe,Te="FORBID_TAGS"in t?N({},t.FORBID_TAGS,fe):{},Ne="FORBID_ATTR"in t?N({},t.FORBID_ATTR,fe):{},Ye="USE_PROFILES"in t&&t.USE_PROFILES,Ce=!1!==t.ALLOW_ARIA_ATTR,Re=!1!==t.ALLOW_DATA_ATTR,Ae=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=t.SAFE_FOR_TEMPLATES||!1,Pe=t.WHOLE_DOCUMENT||!1,Fe=t.RETURN_DOM||!1,Be=t.RETURN_DOM_FRAGMENT||!1,Ie=t.RETURN_TRUSTED_TYPE||!1,De=t.FORCE_BODY||!1,He=!1!==t.SANITIZE_DOM,ze=t.SANITIZE_NAMED_PROPS||!1,We=!1!==t.KEEP_CONTENT,Ge=t.IN_PLACE||!1,ve=t.ALLOWED_URI_REGEXP||ve,tt=t.NAMESPACE||et,t.CUSTOM_ELEMENT_HANDLING&&at(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Se.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&at(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Se.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Se.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(Re=!1),Be&&(Fe=!0),Ye&&(je=N({},o(B)),xe=[],!0===Ye.html&&(N(je,A),N(xe,I)),!0===Ye.svg&&(N(je,L),N(xe,H),N(xe,U)),!0===Ye.svgFilters&&(N(je,P),N(xe,H),N(xe,U)),!0===Ye.mathMl&&(N(je,D),N(xe,z),N(xe,U))),t.ADD_TAGS&&(je===_e&&(je=C(je)),N(je,t.ADD_TAGS,fe)),t.ADD_ATTR&&(xe===ke&&(xe=C(xe)),N(xe,t.ADD_ATTR,fe)),t.ADD_URI_SAFE_ATTR&&N(Xe,t.ADD_URI_SAFE_ATTR,fe),t.FORBID_CONTENTS&&(Ve===qe&&(Ve=C(Ve)),N(Ve,t.FORBID_CONTENTS,fe)),We&&(je["#text"]=!0),Pe&&N(je,["html","head","body"]),je.table&&(N(je,["tbody"]),delete Te.tbody),d&&d(t),ct=t)},st=N({},["mi","mo","mn","ms","mtext"]),ut=N({},["foreignobject","desc","title","annotation-xml"]),dt=N({},["title","style","font","a","script"]),pt=N({},L);N(pt,P),N(pt,M);var mt=N({},D);N(mt,F);var bt=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:et,tagName:"template"});var n=y(e.tagName),r=y(t.tagName);return e.namespaceURI===Ze?t.namespaceURI===et?"svg"===n:t.namespaceURI===Je?"svg"===n&&("annotation-xml"===r||st[r]):Boolean(pt[n]):e.namespaceURI===Je?t.namespaceURI===et?"math"===n:t.namespaceURI===Ze?"math"===n&&ut[r]:Boolean(mt[n]):e.namespaceURI===et&&!(t.namespaceURI===Ze&&!ut[r])&&!(t.namespaceURI===Je&&!st[r])&&!mt[n]&&(dt[n]||!pt[n])},ft=function(e){w(r.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ce}catch(t){e.remove()}}},gt=function(e,t){try{w(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){w(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!xe[e])if(Fe||Be)try{ft(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},ht=function(e){var t,n;if(De)e="<remove></remove>"+e;else{var r=v(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===be&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var o=oe?oe.createHTML(e):e;if(tt===et)try{t=(new g).parseFromString(o,be)}catch(e){}if(!t||!t.documentElement){t=ae.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?"":o}catch(e){}}var c=t.body||t.documentElement;return e&&n&&c.insertBefore(i.createTextNode(n),c.childNodes[0]||null),tt===et?ue.call(t,Pe?"html":"body")[0]:Pe?t.documentElement:c},Et=function(e){return le.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT,null,!1)},Ot=function(e){return e instanceof f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof b)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},wt=function(t){return"object"===e(s)?t instanceof s:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},yt=function(e,t,n){me[e]&&E(me[e],(function(e){e.call(r,t,n,ct)}))},vt=function(e){var t;if(yt("beforeSanitizeElements",e,null),Ot(e))return ft(e),!0;if(k(/[\u0080-\uFFFF]/,e.nodeName))return ft(e),!0;var n=fe(e.nodeName);if(yt("uponSanitizeElement",e,{tagName:n,allowedTags:je}),e.hasChildNodes()&&!wt(e.firstElementChild)&&(!wt(e.content)||!wt(e.content.firstElementChild))&&k(/<[/\w]/g,e.innerHTML)&&k(/<[/\w]/g,e.textContent))return ft(e),!0;if("select"===n&&k(/<template/i,e.innerHTML))return ft(e),!0;if(!je[n]||Te[n]){if(!Te[n]&&_t(n)){if(Se.tagNameCheck instanceof RegExp&&k(Se.tagNameCheck,n))return!1;if(Se.tagNameCheck instanceof Function&&Se.tagNameCheck(n))return!1}if(We&&!Ve[n]){var o=ne(e)||e.parentNode,c=te(e)||e.childNodes;if(c&&o)for(var i=c.length-1;i>=0;--i)o.insertBefore(Z(c[i],!0),ee(e))}return ft(e),!0}return e instanceof u&&!bt(e)?(ft(e),!0):"noscript"!==n&&"noembed"!==n||!k(/<\/no(script|embed)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,t=j(t,ge," "),t=j(t,he," "),e.textContent!==t&&(w(r.removed,{element:e.cloneNode()}),e.textContent=t)),yt("afterSanitizeElements",e,null),!1):(ft(e),!0)},jt=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in i||n in it))return!1;if(Re&&!Ne[t]&&k(Ee,t));else if(Ce&&k(Oe,t));else if(!xe[t]||Ne[t]){if(!(_t(e)&&(Se.tagNameCheck instanceof RegExp&&k(Se.tagNameCheck,e)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(e))&&(Se.attributeNameCheck instanceof RegExp&&k(Se.attributeNameCheck,t)||Se.attributeNameCheck instanceof Function&&Se.attributeNameCheck(t))||"is"===t&&Se.allowCustomizedBuiltInElements&&(Se.tagNameCheck instanceof RegExp&&k(Se.tagNameCheck,n)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(n))))return!1}else if(Xe[t]);else if(k(ve,j(n,ye,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==_(n,"data:")||!Qe[e])if(Ae&&!k(we,j(n,ye,"")));else if(n)return!1;return!0},_t=function(e){return e.indexOf("-")>0},xt=function(t){var n,o,c,i;yt("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe};for(i=a.length;i--;){var s=n=a[i],u=s.name,d=s.namespaceURI;if(o="value"===u?n.value:x(n.value),c=fe(u),l.attrName=c,l.attrValue=o,l.keepAttr=!0,l.forceKeepAttr=void 0,yt("uponSanitizeAttribute",t,l),o=l.attrValue,!l.forceKeepAttr&&(gt(u,t),l.keepAttr))if(k(/\/>/i,o))gt(u,t);else{Le&&(o=j(o,ge," "),o=j(o,he," "));var p=fe(t.nodeName);if(jt(p,c,o)){if(!ze||"id"!==c&&"name"!==c||(gt(u,t),o=Ue+o),oe&&"object"===e(h)&&"function"==typeof h.getAttributeType)if(d);else switch(h.getAttributeType(p,c)){case"TrustedHTML":o=oe.createHTML(o);break;case"TrustedScriptURL":o=oe.createScriptURL(o)}try{d?t.setAttributeNS(d,u,o):t.setAttribute(u,o),O(r.removed)}catch(e){}}}}yt("afterSanitizeAttributes",t,null)}},kt=function e(t){var n,r=Et(t);for(yt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)yt("uponSanitizeShadowNode",n,null),vt(n)||(n.content instanceof a&&e(n.content),xt(n));yt("afterSanitizeShadowDOM",t,null)};return r.sanitize=function(t){var o,i,l,u,d,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((nt=!t)&&(t="\x3c!--\x3e"),"string"!=typeof t&&!wt(t)){if("function"!=typeof t.toString)throw S("toString is not a function");if("string"!=typeof(t=t.toString()))throw S("dirty is not a string, aborting")}if(!r.isSupported){if("object"===e(n.toStaticHTML)||"function"==typeof n.toStaticHTML){if("string"==typeof t)return n.toStaticHTML(t);if(wt(t))return n.toStaticHTML(t.outerHTML)}return t}if(Me||lt(p),r.removed=[],"string"==typeof t&&(Ge=!1),Ge){if(t.nodeName){var m=fe(t.nodeName);if(!je[m]||Te[m])throw S("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof s)1===(i=(o=ht("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i);else{if(!Fe&&!Le&&!Pe&&-1===t.indexOf("<"))return oe&&Ie?oe.createHTML(t):t;if(!(o=ht(t)))return Fe?null:Ie?ce:""}o&&De&&ft(o.firstChild);for(var b=Et(Ge?t:o);l=b.nextNode();)3===l.nodeType&&l===u||vt(l)||(l.content instanceof a&&kt(l.content),xt(l),u=l);if(u=null,Ge)return t;if(Fe){if(Be)for(d=se.call(o.ownerDocument);o.firstChild;)d.appendChild(o.firstChild);else d=o;return xe.shadowroot&&(d=de.call(c,d,!0)),d}var f=Pe?o.outerHTML:o.innerHTML;return Pe&&je["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&k(X,o.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+f),Le&&(f=j(f,ge," "),f=j(f,he," ")),oe&&Ie?oe.createHTML(f):f},r.setConfig=function(e){lt(e),Me=!0},r.clearConfig=function(){ct=null,Me=!1},r.isValidAttribute=function(e,t,n){ct||lt({});var r=fe(e),o=fe(t);return jt(r,o,n)},r.addHook=function(e,t){"function"==typeof t&&(me[e]=me[e]||[],w(me[e],t))},r.removeHook=function(e){if(me[e])return O(me[e])},r.removeHooks=function(e){me[e]&&(me[e]=[])},r.removeAllHooks=function(){me={}},r}()}()},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"b",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:n=!1,cancelable:o=!1,element:c,detail:i={}}=t;if(!r)return;c||(c=document.body);const a=new r(e,{bubbles:n,cancelable:o,detail:i});c.dispatchEvent(a)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},a=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const c=()=>{o(t,{bubbles:n,cancelable:r})};return jQuery(document).on(e,c),()=>jQuery(document).off(e,c)}},function(e,t,n){"use strict";var r=n(0),o=n(14);const c=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=c},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,,,function(e,t,n){"use strict";var r=n(0),o=n(6),c=n(5),i=n.n(c),a=n(1),l=n(24),s=n(90),u=n(43);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:c=n,onRemove:p=o.noop,isDismissible:m=!0,actions:b=[],politeness:f=d(t),__unstableHTML:g,onDismiss:h=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(l.speak)(n,t)},[n,t])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":m});return g&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:E},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},b.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:c=!1,onClick:a,url:l},s)=>{let d=o;return"primary"===o||c||(d=l?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(u.a,{key:s,href:l,variant:d,onClick:l?void 0:a,className:i()("components-notice__action",e)},t)}))),m&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:s.a,label:Object(a.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),h(),p()},showTooltip:!1}))}},function(e,t,n){"use strict";var r=n(11),o=n.n(r),c=n(0);n(122);const i=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const n=Object(c.useRef)(null);return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:n,"aria-hidden":!0}),Object(c.createElement)(e,o()({},t,{scrollToTop:e=>{null!==n.current&&((e,t)=>{const{focusableSelector:n}=t||{};window&&Number.isFinite(window.innerHeight)&&(n?((e,t)=>{var n;const r=(null===(n=e.parentElement)||void 0===n?void 0:n.querySelectorAll(t))||[];if(r.length){const e=r[0];i(e),null==e||e.focus()}else i(e)})(e,n):i(e))})(n.current,e)}})))}},function(e,t){e.exports=window.wp.blocks},,function(e,t){},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(67);const o=["a","b","em","i","strong","p","br"],c=["target","href","rel","name","download"],i=(e,t)=>{const n=(null==t?void 0:t.tags)||o,i=(null==t?void 0:t.attr)||c;return Object(r.sanitize)(e,{ALLOWED_TAGS:n,ALLOWED_ATTR:i})}},,function(e,t){e.exports=window.wp.blockEditor},,,function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},,,,,,,,,,,function(e,t){},function(e,t,n){"use strict";var r=n(0),o=n(5),c=n.n(o),i=n(22),a=n(10);n(136),t.a=Object(a.withInstanceId)(e=>{let{className:t,instanceId:n,label:o="",onChange:a,options:l,screenReaderLabel:s,value:u=""}=e;const d="wc-block-components-sort-select__select-"+n;return Object(r.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(i.a,{label:o,screenReaderLabel:s,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:a,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,function(e,t){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(56),o=(n(13),n(2));const c=e=>{const t=Object.keys(o.defaultAddressFields),n=Object(r.a)(t,{},e.country),c=Object.assign({},e);return n.forEach(t=>{let{key:n="",hidden:r=!1}=t;r&&((e,t)=>e in t)(n,e)&&(c[n]="")}),c}},,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,,function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n(11),o=n.n(r),c=n(0),i=n(5),a=n.n(i),l=n(98),s=n(106),u=n(4),d=n(3);n(102);const p=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},m=e=>{let{className:t,context:n="default",additionalNotices:r=[]}=e;const i=Object(u.useSelect)(e=>e(d.PAYMENT_STORE_KEY).isExpressPaymentMethodActive()),{notices:m}=Object(u.useSelect)(e=>({notices:e("core/notices").getNotices(n)})),{removeNotice:b}=Object(u.useDispatch)("core/notices"),f=m.filter(e=>"snackbar"!==e.type).concat(r);if(!f.length)return null;const g=a()(t,"wc-block-components-notices");return i?null:Object(c.createElement)("div",{className:g},f.map(e=>Object(c.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:a()("wc-block-components-notices__notice",p(e)),onRemove:()=>{e.isDismissible&&b(e.id,n)}}),Object(s.a)(e.content))))}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(17),o=n(0),c=n(44);n.p=c.k,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([n.e(0),n.e(71)]).then(n.bind(null,359)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>n.e(70).then(n.bind(null,499)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>n.e(78).then(n.bind(null,500)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>n.e(72).then(n.bind(null,360)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>n.e(68).then(n.bind(null,361)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>n.e(76).then(n.bind(null,436)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>n.e(73).then(n.bind(null,317)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>n.e(74).then(n.bind(null,437)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>n.e(69).then(n.bind(null,438)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>n.e(77).then(n.bind(null,439)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>n.e(75).then(n.bind(null,440)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([n.e(1),n.e(10),n.e(4),n.e(67)]).then(n.bind(null,501)))});const i=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(263)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(38),c=n(7),i=n(1),a=n(6),l=n(5),s=n.n(l),u=n(22);n(240);var d=e=>{let{currentPage:t,displayFirstAndLastPages:n=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:c=3,onPageChange:a,totalPages:l}=e,{minIndex:d,maxIndex:p}=((e,t,n)=>{if(n<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),c=Math.min(Math.ceil(t+(r-(t-o))),n-1);return{minIndex:Math.max(Math.floor(t-(r-(c-t))),2),maxIndex:c}})(c,t,l);const m=n&&Boolean(1!==d),b=n&&Boolean(p!==l),f=n&&Boolean(d&&d>3),g=n&&Boolean(p&&p<l-2);m&&3===d&&(d-=1),b&&p===l-2&&(p+=1);const h=[];if(d&&p)for(let e=d;e<=p;e++)h.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(u.a,{screenReaderLabel:Object(i.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t-1),title:Object(i.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(u.a,{label:"←",screenReaderLabel:Object(i.__)("Previous page","woo-gutenberg-products-block")})),m&&Object(r.createElement)("button",{className:s()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>a(1),disabled:1===t},Object(r.createElement)(u.a,{label:"1",screenReaderLabel:Object(i.sprintf)(
4
  /* translators: %d is the page number (1, 2, 3...). */
5
  Object(i.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(i.__)("…","woo-gutenberg-products-block")),h.map(e=>Object(r.createElement)("button",{key:e,className:s()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>a(e),disabled:t===e},Object(r.createElement)(u.a,{label:e.toString(),screenReaderLabel:Object(i.sprintf)(
6
  /* translators: %d is the page number (1, 2, 3...). */
7
  Object(i.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(i.__)("…","woo-gutenberg-products-block")),b&&Object(r.createElement)("button",{className:s()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===l,"wc-block-components-pagination__page--active":t===l}),onClick:()=>a(l),disabled:t===l},Object(r.createElement)(u.a,{label:l.toString(),screenReaderLabel:Object(i.sprintf)(
8
  /* translators: %d is the page number (1, 2, 3...). */
9
- Object(i.__)("Page %d","woo-gutenberg-products-block"),l)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t+1),title:Object(i.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(r.createElement)(u.a,{label:"→",screenReaderLabel:Object(i.__)("Next page","woo-gutenberg-products-block")})))},p=n(61),m=n(30),b=n(280),f=n(66),g=n(99),h=n(47),E=n(24),O=n(111),w=n(14),y=Object(r.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)(w.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"})),v=()=>{const{parentClassName:e}=Object(h.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(O.a,{className:e+"__no-products-image",icon:y,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(i.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(i.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},j=Object(r.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(w.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),_=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:n}=Object(h.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:n+"__no-products"},Object(r.createElement)(O.a,{className:n+"__no-products-image",icon:j,size:100}),Object(r.createElement)("strong",{className:n+"__no-products-title"},Object(i.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:n+"__no-products-description"},Object(i.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(i.__)("Reset Search","woo-gutenberg-products-block")))},x=n(123);n(239);var k=e=>{let{onChange:t,value:n}=e;return Object(r.createElement)(x.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(i.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(i.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(i.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(i.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(i.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(i.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(i.__)("Order products by","woo-gutenberg-products-block"),value:n})},S=n(10),T=n(11),N=n.n(T),C=n(144);const R=(e,t,n,o)=>{if(!n)return;const c=Object(C.a)(e);return n.map((n,i)=>{let[a,l={}]=n,s=[];l.children&&l.children.length>0&&(s=R(e,t,l.children,o));const u=c[a];if(!u)return null;const d=t.id||0,p=["layout",a,i,o,d];return Object(r.createElement)(r.Suspense,{key:p.join("_"),fallback:Object(r.createElement)("div",{className:"wc-block-placeholder"})},Object(r.createElement)(u,N()({},l,{children:s,product:t})))})};var A=Object(S.withInstanceId)(e=>{let{product:t={},attributes:n,instanceId:o}=e;const{layoutConfig:c}=n,{parentClassName:i,parentName:a}=Object(h.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,u=s()(i+"__product","wc-block-layout",{"is-loading":l});return Object(r.createElement)("li",{className:u,"aria-hidden":l},R(a,t,c,o))});n(238);const L=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},P=function(e){let{totalQuery:t,totalProducts:n}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(a.isEqual)(t,r)&&Number.isFinite(n)};var M=Object(g.a)(e=>{let{attributes:t,currentPage:n,onPageChange:o,onSortChange:c,sortValue:l,scrollToTop:u}=e;const[g,O]=Object(m.b)("attributes",[]),[w,y]=Object(m.b)("stock_status",[]),[j,x]=Object(m.b)("rating",[]),[S,T]=Object(m.b)("min_price"),[N,C]=Object(m.b)("max_price"),[R]=Object(m.c)((e=>{let{sortValue:t,currentPage:n,attributes:r}=e;const{columns:o,rows:c}=r;return{...L(t),catalog_visibility:"catalog",per_page:o*c,page:n}})({attributes:t,sortValue:l,currentPage:n})),{products:M,totalProducts:D,productsLoading:F}=Object(b.a)(R),{parentClassName:B,parentName:I}=Object(h.useInnerBlockLayoutContext)(),H=(e=>{const{order:t,orderby:n,page:r,per_page:o,...c}=e;return c||{}})(R),{dispatchStoreEvent:z}=Object(f.a)(),U=Object(p.a)({totalQuery:H,totalProducts:D},P);Object(r.useEffect)(()=>{z("product-list-render",{products:M,listName:I})},[M,I,z]),Object(r.useEffect)(()=>{Object(a.isEqual)(H,null==U?void 0:U.totalQuery)||(o(1),null!=U&&U.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(E.speak)(Object(i.__)("No products found","woo-gutenberg-products-block")):Object(E.speak)(Object(i.sprintf)(
10
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
11
- Object(i._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(D))},[null==U?void 0:U.totalQuery,D,o,H]);const{contentVisibility:W}=t,G=t.columns*t.rows,Y=!Number.isFinite(D)&&Number.isFinite(null==U?void 0:U.totalProducts)&&Object(a.isEqual)(H,null==U?void 0:U.totalQuery)?Math.ceil(((null==U?void 0:U.totalProducts)||0)/G):Math.ceil(D/G),V=M.length?M:Array.from({length:G}),q=0!==M.length||F,Q=g.length>0||w.length>0||j.length>0||Number.isFinite(S)||Number.isFinite(N);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:n,alignButtons:r,align:o}=t,c=void 0!==o?"align"+o:"";return s()(B,c,"has-"+e+"-columns",{"has-multiple-rows":n>1,"has-aligned-buttons":r})})()},(null==W?void 0:W.orderBy)&&q&&Object(r.createElement)(k,{onChange:c,value:l}),!q&&Q&&Object(r.createElement)(_,{resetCallback:()=>{O([]),y([]),x([]),T(null),C(null)}}),!q&&!Q&&Object(r.createElement)(v,null),q&&Object(r.createElement)("ul",{className:s()(B+"__products",{"is-loading-products":F})},V.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return Object(r.createElement)(A,{key:e.id||n,attributes:t,product:e})}))),Y>1&&Object(r.createElement)(d,{currentPage:n,onPageChange:e=>{u({focusableSelector:"a, button"}),o(e)},totalPages:Y}))}),D=e=>{let{attributes:t}=e;const[n,o]=Object(r.useState)(1),[c,i]=Object(r.useState)(t.orderby);return Object(r.useEffect)(()=>{i(t.orderby)},[t.orderby]),Object(r.createElement)(M,{attributes:t,currentPage:n,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const n=null==e||null===(t=e.target)||void 0===t?void 0:t.value;i(n),o(1)},sortValue:c})};const F=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}));var B=n(137);class I extends c.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?F:Object(r.createElement)(h.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(B.a,{context:"wc/all-products"}),Object(r.createElement)(D,{attributes:e,urlParameterSuffix:t}))}}var H=I;Object(o.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(r.createElement)(H,e),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})},,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(60),o=n(3),c=n(4),i=n(27);const a=e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:n,isLoading:a}=Object(r.a)({...t,query:e}),{value:l}=((e,t)=>{const{namespace:n,resourceName:r,resourceValues:a=[],query:l={}}=t;if(!n||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const s=Object(i.a)(l),u=Object(i.a)(a),{value:d,isLoading:p=!0}=Object(c.useSelect)(e=>{const t=e(o.COLLECTIONS_STORE_KEY),c=["x-wp-total",n,r,s,u];return{value:t.getCollectionHeader(...c),isLoading:t.hasFinishedResolution("getCollectionHeader",c)}},["x-wp-total",n,r,u,s]);return{value:d,isLoading:p}})(0,{...t,query:e});return{products:n,totalProducts:parseInt(l,10),productsLoading:a}}}]);
1
+ !function(e){function t(t){for(var n,o,c=t[0],i=t[1],a=0,s=[];a<c.length;a++)o=c[a],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(l&&l(t);s.length;)s.shift()()}var n={},r={13:0,9:0};function o(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var c=new Promise((function(t,o){n=r[e]=[t,o]}));t.push(n[2]=c);var i,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(e){return o.p+""+({0:"vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--671ca56f",1:"vendors--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary-shipping--checkout-blocks--18f9376a",4:"cart-blocks/cart-cross-sells-products--product-add-to-cart",10:"vendors--cart-blocks/cart-cross-sells-products--product-add-to-cart",67:"product-add-to-cart",68:"product-button",69:"product-category-list",70:"product-image",71:"product-price",72:"product-rating",73:"product-sale-badge",74:"product-sku",75:"product-stock-indicator",76:"product-summary",77:"product-tag-list",78:"product-title"}[e]||e)+"-frontend.js?ver="+{0:"d395d179e20a1049eb3f",1:"4e49e54972b26a7c49cc",4:"5e33f08c0b5b3893592d",10:"537e22428827f7bb3b24",67:"e435e3c05334727782dc",68:"b338a1b552f6c27220c1",69:"88ceff215ec2e079c4de",70:"4e1bd95ed4f8df46c20a",71:"a057b5d153b3a40ec92d",72:"ec3b57eda5a0412acb2a",73:"4ca8ec7c64aeb4540c58",74:"619da9a8346ee7175161",75:"c23a839f4b4e76504b35",76:"127f7ad250768a79fdf3",77:"ea6257970355a33f9cb6",78:"00f635ce1a389f2d59eb"}[e]}(e);var l=new Error;i=function(t){a.onerror=a.onload=null,clearTimeout(s);var n=r[e];if(0!==n){if(n){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",l.name="ChunkLoadError",l.type=o,l.request=c,n[1](l)}r[e]=void 0}};var s=setTimeout((function(){i({type:"timeout",target:a})}),12e4);a.onerror=a.onload=i,document.head.appendChild(a)}return Promise.all(t)},o.m=e,o.c=n,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var c=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var a=0;a<c.length;a++)t(c[a]);var l=i;o(o.s=241)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===c)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}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=window.wp.data},,function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.React},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},,function(e,t){e.exports=window.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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(17),o=n.n(r),c=n(0),i=n(8),a=n(1),l=n(46),s=e=>{let{imageUrl:t=l.l+"/block-error.svg",header:n=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(a.__)("Error:","woo-gutenberg-products-block"),button:s,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),s&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},s))):null};n(35);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:i,renderError:a,button:l}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof a?a({errorMessage:u}):Object(c.createElement)(s,{showErrorBlock:r,errorMessage:n?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:l}):this.props.children}}t.a=u},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wc.wcBlocksRegistry},,function(e,t,n){"use strict";var r=n(0),o=n(4),c=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:i,wrapperProps:a={}}=e;const l=null!=n,s=null!=o;return!l&&s?(t=i||"span",a={...a,className:c()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=i||r.Fragment,l&&s&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))}},,function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.a11y},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const o=Object(r.createContext)("page"),c=()=>Object(r.useContext)(o);o.Provider},,function(e,t,n){"use strict";(function(e){var r=n(0);n(39);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(66))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(13),c=n.n(o);function i(e){const t=Object(r.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return m}));var r=n(3),o=n(5),c=n(0),i=n(13),a=n.n(i),l=n(29),s=n(62),u=n(25);const d=e=>{const t=Object(u.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const a=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(c.useCallback)(t=>{l(n,e,t)},[n,e,l])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,o]=d(t),i=Object(l.a)(r),p=Object(l.a)(e),m=Object(s.a)(p),b=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{a()(m,p)||(o(Object.assign({},i,p)),b.current=!0)},[i,p,m,o]),b.current?[r,o]:[e,o]}},function(e,t){e.exports=window.wp.apiFetch},,function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);n(5);const o=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(r.useContext)(o)},function(e,t,n){"use strict";var r=n(4),o=n.n(r),c=n(0);t.a=Object(c.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(c.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return O}));var r=n(7),o=n(0),c=n(3),i=n(5),a=n(23),l=n(132),s=n(36),u=n(91);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},m=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),p),[])},b={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},f={...b,email:""},g={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:c.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},h=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,n]=e;return[t,Object(a.decodeEntities)(n)]})),E={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:c.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:b,shippingRates:c.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:n}=Object(s.a)(),a=null==n?void 0:n.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();m();const p=Object(i.useSelect)((e,n)=>{let{dispatch:r}=n;if(!u)return E;if(t)return{cartCoupons:a.coupons,cartItems:a.items,crossSellsProducts:a.cross_sells,cartFees:a.fees,cartItemsCount:a.items_count,cartItemsWeight:a.items_weight,cartNeedsPayment:a.needs_payment,cartNeedsShipping:a.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:a.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingData:f,billingAddress:f,shippingAddress:b,extensions:c.EMPTY_EXTENSIONS,shippingRates:a.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:a.has_calculated_shipping,paymentRequirements:a.paymentRequirements,receiveCart:"function"==typeof(null==a?void 0:a.receiveCart)?a.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),s=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),m=o.isCustomerDataUpdating(),{receiveCart:g}=r(c.CART_STORE_KEY),O=h(i.billingAddress),w=i.needsShipping?h(i.shippingAddress):O,y=i.fees.length>0?i.fees.map(e=>h(e)):c.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map(e=>({...e,label:e.code})):c.EMPTY_CART_COUPONS,cartItems:i.items,crossSellsProducts:i.crossSells,cartFees:y,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:s,billingData:Object(l.a)(O),billingAddress:Object(l.a)(O),shippingAddress:Object(l.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,isLoadingRates:m,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:g}},[u]);return d.current&&Object(r.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){e.exports=window.wp.warning},function(e,t){e.exports=window.wc.priceFormat},function(e,t,n){"use strict";var r=n(9),o=n(0),c=n(15),i=function({icon:e,className:t,...n}){const c=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:c},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(i,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===c.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(c.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},,,function(e,t,n){"use strict";var r=n(9),o=n(0),c=n(4),i=n.n(c),a=n(7),l=n(22),s=n.n(l),u=n(11),d=n(47),p=n(92),m=n(1);function b(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const c=o.getBoundingClientRect();return new r.DOMRect(e.left+c.left,e.top+c.top,e.width,e.height)}let f=0;function g(e){const t=document.scrollingElement||document.body;e&&(f=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=f)}let h=0;function E(){return Object(o.useEffect)(()=>(0===h&&g(!0),++h,()=>{1===h&&g(!1),--h}),[]),null}var O=n(27);function w(e){const t=Object(o.useContext)(O.a),n=t.slots[e]||{},r=t.fills[e],c=Object(o.useMemo)(()=>r||[],[r]);return{...n,updateSlot:Object(o.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:c,registerFill:Object(o.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var y=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function v({name:e,children:t,registerFill:n,unregisterFill:r}){const c=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(y),[r,c]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(c(t(e)),n(()=>{c(t(e))})),[e]),r})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,i.current),()=>r(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,c&&c.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))},[e]),c&&c.node?(Object(a.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var j=e=>Object(o.createElement)(y.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(v,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class _ extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,c=Object(a.map)(r(t,this),e=>{const t=Object(a.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(a.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(a.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(a.isFunction)(e)?e(c):c)}}var x=e=>Object(o.createElement)(y.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:c})=>Object(o.createElement)(_,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:c})));function k(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function S({name:e,children:t}){const n=w(e),r=Object(o.useRef)({rerender:k()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var T=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...c},i){const a=Object(o.useContext)(O.a),l=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(a.registerSlot(e,l,t),()=>{a.unregisterSlot(e,l)}),[a.registerSlot,a.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{a.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,l])},c))}));function N(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(j,e),Object(o.createElement)(S,e))}n(13),o.Component;const C=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(T,Object(r.a)({},t,{ref:n})):Object(o.createElement)(x,t));function R(e){return"appear"===e?"top":"left"}function A(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const a=n?parseInt(n,10):0,l=r?parseInt(r,10):0,s=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+s,y:e.top+a,width:e.width-s-u,height:e.height-a-l,left:e.left+s,right:e.right-u,top:e.top+a,bottom:e.bottom-l}}function L(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function P(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function M(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const D=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:c,noArrow:a=!0,isAlternate:l,position:f="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:O,shouldAnchorIncludePadding:y,anchorRect:v,getAnchorRect:j,expandOnMobile:_,animate:x=!0,onClickOutside:k,onFocusOutside:S,__unstableStickyBoundaryElement:T,__unstableSlotName:C="Popover",__unstableObserveElement:D,__unstableBoundaryParent:F,__unstableForcePosition:B,__unstableForceXAlignment:I,...H},z)=>{const U=Object(o.useRef)(null),W=Object(o.useRef)(null),G=Object(o.useRef)(),Y=Object(u.useViewportMatch)("medium","<"),[V,Q]=Object(o.useState)(),K=w(C),X=_&&Y,[$,J]=Object(u.useResizeObserver)();a=X||a,Object(o.useLayoutEffect)(()=>{if(X)return M(G.current,"is-without-arrow",a),M(G.current,"is-alternate",l),L(G.current,"data-x-axis"),L(G.current,"data-y-axis"),P(G.current,"top"),P(G.current,"left"),P(W.current,"maxHeight"),void P(W.current,"maxWidth");const e=()=>{if(!G.current||!W.current)return;let e=function(e,t,n,r=!1,o,c){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return b(t,t.ownerDocument||e.current.ownerDocument,c)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,c);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,c);return o?e:A(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=b(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,c);return o?a:A(a,r)}if(!e.current)return;const{parentNode:i}=e.current,a=i.getBoundingClientRect();return o?a:A(a,i)}(U,v,j,O,y,G.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=G.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var c;F&&(r=null===(c=G.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=J.height?J:W.current.getBoundingClientRect(),{popoverTop:s,popoverLeft:u,xAxis:p,yAxis:g,contentHeight:h,contentWidth:E}=function(e,t,n="top",r,o,c,i,a,l){const[s,u="center",d]=n.split(" "),p=function(e,t,n,r,o,c,i,a){const{height:l}=t;if(o){const t=o.getBoundingClientRect().top+l-i;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let s=e.top+e.height/2;"bottom"===r?s=e.bottom:"top"===r&&(s=e.top);const u={popoverTop:s,contentHeight:(s-l/2>0?l/2:s)+(s+l/2>window.innerHeight?window.innerHeight-s:l/2)},d={popoverTop:e.top,contentHeight:e.top-10-l>0?l:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+l>window.innerHeight?window.innerHeight-10-e.bottom:l};let m,b=n,f=null;if(!o&&!a)if("middle"===n&&u.contentHeight===l)b="middle";else if("top"===n&&d.contentHeight===l)b="top";else if("bottom"===n&&p.contentHeight===l)b="bottom";else{b=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===b?d.contentHeight:p.contentHeight;f=e!==l?e:null}return m="middle"===b?u.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:m,contentHeight:f}}(e,t,s,d,r,0,c,a);return{...function(e,t,n,r,o,c,i,a,l){const{width:s}=t;"left"===n&&Object(m.isRTL)()?n="right":"right"===n&&Object(m.isRTL)()&&(n="left"),"left"===r&&Object(m.isRTL)()?r="right":"right"===r&&Object(m.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-s/2>0?s/2:u)+(u+s/2>window.innerWidth?window.innerWidth-u:s/2)};let p=e.left;"right"===r?p=e.right:"middle"===c||l||(p=u);let b=e.right;"left"===r?b=e.left:"middle"===c||l||(b=u);const f={popoverLeft:p,contentWidth:p-s>0?s:p},g={popoverLeft:b,contentWidth:b+s>window.innerWidth?window.innerWidth-b:s};let h,E=n,O=null;if(!o&&!a)if("center"===n&&d.contentWidth===s)E="center";else if("left"===n&&f.contentWidth===s)E="left";else if("right"===n&&g.contentWidth===s)E="right";else{E=f.contentWidth>g.contentWidth?"left":"right";const e="left"===E?f.contentWidth:g.contentWidth;s>window.innerWidth&&(O=window.innerWidth),e!==s&&(E="center",d.popoverLeft=window.innerWidth/2)}if(h="center"===E?d.popoverLeft:"left"===E?f.popoverLeft:g.popoverLeft,i){const e=i.getBoundingClientRect();h=Math.min(h,e.right-s),Object(m.isRTL)()||(h=Math.max(h,0))}return{xAxis:E,popoverLeft:h,contentWidth:O}}(e,t,u,d,r,p.yAxis,i,a,l),...p}}(e,i,f,T,G.current,o,r,B,I);"number"==typeof s&&"number"==typeof u&&(P(G.current,"top",s+"px"),P(G.current,"left",u+"px")),M(G.current,"is-without-arrow",a||"center"===p&&"middle"===g),M(G.current,"is-alternate",l),L(G.current,"data-x-axis",p),L(G.current,"data-y-axis",g),P(W.current,"maxHeight","number"==typeof h?h+"px":""),P(W.current,"maxWidth","number"==typeof E?E+"px":""),Q(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=G.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const c=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",c),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let s;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),D&&(s=new n.MutationObserver(e),s.observe(D,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",c),n.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),s&&s.disconnect()}},[X,v,j,O,y,f,J,T,D,F]);const Z=(e,n)=>{if("focus-outside"===e&&S)S(n);else if("focus-outside"===e&&k){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),s()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),k(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:Z,onClose:Z}),ne=Object(u.useMergeRefs)([G,ee,z]),re=Boolean(x&&V)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=R(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:V});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",c,re,{"is-expanded":X,"is-without-arrow":a,"is-alternate":l})},H,{ref:ne},te,{tabIndex:"-1"}),X&&Object(o.createElement)(E,null),X&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(q,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:W,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},$,n)));return K.ref&&(oe=Object(o.createElement)(N,{name:C},oe)),O||v?oe:Object(o.createElement)("span",{ref:U},oe)});D.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(C,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=D,B=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(a.isString)(e)&&(n=e),Object(a.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const I=Object(o.createElement)("div",{className:"event-catcher"}),H=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(I,e),Object(o.cloneElement)(t,{children:n}),","),e),z=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),U=(e,t,n)=>{if(1!==o.Children.count(e))return;const r=o.Children.only(e);"function"==typeof r.props[t]&&r.props[t](n)};var W=function({children:e,position:t,text:n,shortcut:r}){const[c,i]=Object(o.useState)(!1),[l,s]=Object(o.useState)(!1),d=Object(u.useDebounce)(s,700),p=t=>{U(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},m=t=>{U(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},b=e=>"mouseUp"===e?m:"mouseDown"===e?p:void 0,f=b("mouseUp"),g=(t,n)=>r=>{if(U(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&c)return;d.cancel();const o=Object(a.includes)(["focus","mouseenter"],r.type);o!==l&&(n?d(o):s(o))},h=()=>{d.cancel(),document.removeEventListener("mouseup",f)};if(Object(o.useEffect)(()=>h,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:g("onMouseEnter",!0),onMouseLeave:g("onMouseLeave"),onClick:g("onClick"),onFocus:g("onFocus"),onBlur:g("onBlur"),onMouseDown:b("mouseDown")},O=o.Children.only(e),{children:w,disabled:y}=O.props;return(y?H:z)({child:O,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:c})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(F,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},r,Object(o.createElement)(B,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:l,position:t,text:n,shortcut:r})})},G=n(41),Y=n(37);const V=["onMouseDown","onClick"];var q=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:c,isSmall:l,isPressed:u,isBusy:d,isDestructive:p,className:m,disabled:b,icon:f,iconPosition:g="left",iconSize:h,showTooltip:E,tooltipPosition:O,shortcut:w,label:y,children:v,text:j,variant:_,__experimentalIsFocusable:x,describedBy:k,...S}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:c,...i}){let a=c;var l,u,d,p,m;return t&&(null!==(l=a)&&void 0!==l||(a="primary")),r&&(null!==(u=a)&&void 0!==u||(a="tertiary")),n&&(null!==(d=a)&&void 0!==d||(a="secondary")),e&&(s()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=a)&&void 0!==p||(a="secondary")),o&&(null!==(m=a)&&void 0!==m||(a="link")),{...i,variant:a}}(e),T=i()("components-button",m,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":l,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!v,"has-icon":!!f}),N=b&&!x,C=void 0===n||N?"button":"a",R="a"===C?{href:n,target:c}:{type:"button",disabled:N,"aria-pressed":u};if(b&&x){R["aria-disabled"]=!0;for(const e of V)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const A=!N&&(E&&y||w||!!y&&(!v||Object(a.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(a.uniqueId)():null,P=S["aria-describedby"]||L,M=Object(o.createElement)(C,Object(r.a)({},R,S,{className:T,"aria-label":S["aria-label"]||y,"aria-describedby":P,ref:t}),f&&"left"===g&&Object(o.createElement)(G.a,{icon:f,size:h}),j&&Object(o.createElement)(o.Fragment,null,j),f&&"right"===g&&Object(o.createElement)(G.a,{icon:f,size:h}),v);return A?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(W,{text:k||y,shortcut:w,position:O},M),k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k))):Object(o.createElement)(o.Fragment,null,M,k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k)))}))},,function(e,t,n){"use strict";n.d(t,"n",(function(){return c})),n.d(t,"l",(function(){return i})),n.d(t,"k",(function(){return a})),n.d(t,"m",(function(){return l})),n.d(t,"i",(function(){return s})),n.d(t,"d",(function(){return u})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return m})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return f})),n.d(t,"a",(function(){return g})),n.d(t,"h",(function(){return h})),n.d(t,"b",(function(){return E}));var r,o=n(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",a=c.pluginUrl+"build/",l=c.buildPhase,s=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t){e.exports=window.wp.dom},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(12),o=n.n(r),c=n(0),i=n(16);const a=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const l=r(e,n),s=a(e,n),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:a={},errorBoundaryProps:l={}}=e;Object(c.render)(Object(c.createElement)(i.a,l,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},a,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:l,attributes:u,errorBoundaryProps:s})})},s=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:c}=e;const i=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),l({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:c}=e;const i=c.querySelectorAll(o);l({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},function(e,t){e.exports=window.wp.hooks},function(e,t){e.exports=window.wc.wcBlocksSharedContext},,,,,,function(e,t,n){"use strict";var r=n(2),o=n(1),c=n(94),i=n(30);const a=Object(r.getSetting)("countryLocale",{}),l=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
2
  /* translators: %s Field label. */
3
+ Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(c.a)(e.priority)&&(t.index=e.priority),Object(i.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},s=Object.entries(a).map(e=>{let[t,n]=e;return[t,Object.entries(n).map(e=>{let[t,n]=e;return[t,l(n)]}).reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{})]}).reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{});t.a=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=n&&void 0!==s[n]?s[n]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(3),o=n(5),c=n(0),i=n(29),a=n(76);const l=e=>{const{namespace:t,resourceName:n,resourceValues:l=[],query:s={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(s),m=Object(i.a)(l),b=Object(a.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),c=[t,n,p,m],i=o.getCollectionError(...c);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(i)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,n,m,p,u]);return null!==f&&(d.current=f),d.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(8);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},,,,function(e,t){var n,r,o=e.exports={};function c(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===c||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:c}catch(e){n=c}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l,s=[],u=!1,d=-1;function p(){u&&l&&(u=!1,l.length?s=l.concat(s):d=-1,s.length&&m())}function m(){if(!u){var e=a(p);u=!0;for(var t=s.length;t;){for(l=s,s=[];++d<t;)l&&l[d].run();d=-1,t=s.length}l=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function f(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new b(e,t)),1!==s.length||u||a(m)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(49),o=n(0),c=n(38);const i=()=>{const e=Object(c.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...n,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},,function(e,t,n){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,n){return(t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,n)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function r(e,o,c){return(r=n()?Reflect.construct:function(e,n,r){var o=[null];o.push.apply(o,n);var c=new(Function.bind.apply(e,o));return r&&t(c,r.prototype),c}).apply(null,arguments)}function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,void 0):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var i=Object.hasOwnProperty,a=Object.setPrototypeOf,l=Object.isFrozen,s=Object.getPrototypeOf,u=Object.getOwnPropertyDescriptor,d=Object.freeze,p=Object.seal,m=Object.create,b="undefined"!=typeof Reflect&&Reflect,f=b.apply,g=b.construct;f||(f=function(e,t,n){return e.apply(t,n)}),d||(d=function(e){return e}),p||(p=function(e){return e}),g||(g=function(e,t){return r(e,o(t))});var h,E=T(Array.prototype.forEach),O=T(Array.prototype.pop),w=T(Array.prototype.push),y=T(String.prototype.toLowerCase),v=T(String.prototype.match),j=T(String.prototype.replace),_=T(String.prototype.indexOf),x=T(String.prototype.trim),k=T(RegExp.prototype.test),S=(h=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g(h,t)});function T(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return f(e,t,r)}}function N(e,t,n){n=n||y,a&&a(e,null);for(var r=t.length;r--;){var o=t[r];if("string"==typeof o){var c=n(o);c!==o&&(l(t)||(t[r]=c),o=c)}e[o]=!0}return e}function C(e){var t,n=m(null);for(t in e)f(i,e,[t])&&(n[t]=e[t]);return n}function R(e,t){for(;null!==e;){var n=u(e,t);if(n){if(n.get)return T(n.get);if("function"==typeof n.value)return T(n.value)}e=s(e)}return function(e){return console.warn("fallback value for",e),null}}var A=d(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),L=d(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),P=d(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),M=d(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),D=d(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),F=d(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),B=d(["#text"]),I=d(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),H=d(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),z=d(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),U=d(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),W=p(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G=p(/<%[\w\W]*|[\w\W]*%>/gm),Y=p(/^data-[\-\w.\u00B7-\uFFFF]/),V=p(/^aria-[\-\w]+$/),q=p(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q=p(/^(?:\w+script|data):/i),K=p(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),X=p(/^html$/i),$=function(){return"undefined"==typeof window?null:window},J=function(t,n){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;var r=null;n.currentScript&&n.currentScript.hasAttribute("data-tt-policy-suffix")&&(r=n.currentScript.getAttribute("data-tt-policy-suffix"));var o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}};return function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$(),r=function(e){return t(e)};if(r.version="2.4.0",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var c=n.document,i=n.document,a=n.DocumentFragment,l=n.HTMLTemplateElement,s=n.Node,u=n.Element,p=n.NodeFilter,m=n.NamedNodeMap,b=void 0===m?n.NamedNodeMap||n.MozNamedAttrMap:m,f=n.HTMLFormElement,g=n.DOMParser,h=n.trustedTypes,T=u.prototype,Z=R(T,"cloneNode"),ee=R(T,"nextSibling"),te=R(T,"childNodes"),ne=R(T,"parentNode");if("function"==typeof l){var re=i.createElement("template");re.content&&re.content.ownerDocument&&(i=re.content.ownerDocument)}var oe=J(h,c),ce=oe?oe.createHTML(""):"",ie=i,ae=ie.implementation,le=ie.createNodeIterator,se=ie.createDocumentFragment,ue=ie.getElementsByTagName,de=c.importNode,pe={};try{pe=C(i).documentMode?i.documentMode:{}}catch(e){}var me={};r.isSupported="function"==typeof ne&&ae&&void 0!==ae.createHTMLDocument&&9!==pe;var be,fe,ge=W,he=G,Ee=Y,Oe=V,we=Q,ye=K,ve=q,je=null,_e=N({},[].concat(o(A),o(L),o(P),o(D),o(B))),xe=null,ke=N({},[].concat(o(I),o(H),o(z),o(U))),Se=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ne=null,Ce=!0,Re=!0,Ae=!1,Le=!1,Pe=!1,Me=!1,De=!1,Fe=!1,Be=!1,Ie=!1,He=!0,ze=!1,Ue="user-content-",We=!0,Ge=!1,Ye={},Ve=null,qe=N({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Qe=null,Ke=N({},["audio","video","img","source","image","track"]),Xe=null,$e=N({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Je="http://www.w3.org/1998/Math/MathML",Ze="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml",tt=et,nt=!1,rt=["application/xhtml+xml","text/html"],ot="text/html",ct=null,it=i.createElement("form"),at=function(e){return e instanceof RegExp||e instanceof Function},lt=function(t){ct&&ct===t||(t&&"object"===e(t)||(t={}),t=C(t),be=be=-1===rt.indexOf(t.PARSER_MEDIA_TYPE)?ot:t.PARSER_MEDIA_TYPE,fe="application/xhtml+xml"===be?function(e){return e}:y,je="ALLOWED_TAGS"in t?N({},t.ALLOWED_TAGS,fe):_e,xe="ALLOWED_ATTR"in t?N({},t.ALLOWED_ATTR,fe):ke,Xe="ADD_URI_SAFE_ATTR"in t?N(C($e),t.ADD_URI_SAFE_ATTR,fe):$e,Qe="ADD_DATA_URI_TAGS"in t?N(C(Ke),t.ADD_DATA_URI_TAGS,fe):Ke,Ve="FORBID_CONTENTS"in t?N({},t.FORBID_CONTENTS,fe):qe,Te="FORBID_TAGS"in t?N({},t.FORBID_TAGS,fe):{},Ne="FORBID_ATTR"in t?N({},t.FORBID_ATTR,fe):{},Ye="USE_PROFILES"in t&&t.USE_PROFILES,Ce=!1!==t.ALLOW_ARIA_ATTR,Re=!1!==t.ALLOW_DATA_ATTR,Ae=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=t.SAFE_FOR_TEMPLATES||!1,Pe=t.WHOLE_DOCUMENT||!1,Fe=t.RETURN_DOM||!1,Be=t.RETURN_DOM_FRAGMENT||!1,Ie=t.RETURN_TRUSTED_TYPE||!1,De=t.FORCE_BODY||!1,He=!1!==t.SANITIZE_DOM,ze=t.SANITIZE_NAMED_PROPS||!1,We=!1!==t.KEEP_CONTENT,Ge=t.IN_PLACE||!1,ve=t.ALLOWED_URI_REGEXP||ve,tt=t.NAMESPACE||et,t.CUSTOM_ELEMENT_HANDLING&&at(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Se.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&at(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Se.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Se.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Le&&(Re=!1),Be&&(Fe=!0),Ye&&(je=N({},o(B)),xe=[],!0===Ye.html&&(N(je,A),N(xe,I)),!0===Ye.svg&&(N(je,L),N(xe,H),N(xe,U)),!0===Ye.svgFilters&&(N(je,P),N(xe,H),N(xe,U)),!0===Ye.mathMl&&(N(je,D),N(xe,z),N(xe,U))),t.ADD_TAGS&&(je===_e&&(je=C(je)),N(je,t.ADD_TAGS,fe)),t.ADD_ATTR&&(xe===ke&&(xe=C(xe)),N(xe,t.ADD_ATTR,fe)),t.ADD_URI_SAFE_ATTR&&N(Xe,t.ADD_URI_SAFE_ATTR,fe),t.FORBID_CONTENTS&&(Ve===qe&&(Ve=C(Ve)),N(Ve,t.FORBID_CONTENTS,fe)),We&&(je["#text"]=!0),Pe&&N(je,["html","head","body"]),je.table&&(N(je,["tbody"]),delete Te.tbody),d&&d(t),ct=t)},st=N({},["mi","mo","mn","ms","mtext"]),ut=N({},["foreignobject","desc","title","annotation-xml"]),dt=N({},["title","style","font","a","script"]),pt=N({},L);N(pt,P),N(pt,M);var mt=N({},D);N(mt,F);var bt=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:et,tagName:"template"});var n=y(e.tagName),r=y(t.tagName);return e.namespaceURI===Ze?t.namespaceURI===et?"svg"===n:t.namespaceURI===Je?"svg"===n&&("annotation-xml"===r||st[r]):Boolean(pt[n]):e.namespaceURI===Je?t.namespaceURI===et?"math"===n:t.namespaceURI===Ze?"math"===n&&ut[r]:Boolean(mt[n]):e.namespaceURI===et&&!(t.namespaceURI===Ze&&!ut[r])&&!(t.namespaceURI===Je&&!st[r])&&!mt[n]&&(dt[n]||!pt[n])},ft=function(e){w(r.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ce}catch(t){e.remove()}}},gt=function(e,t){try{w(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){w(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!xe[e])if(Fe||Be)try{ft(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},ht=function(e){var t,n;if(De)e="<remove></remove>"+e;else{var r=v(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===be&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var o=oe?oe.createHTML(e):e;if(tt===et)try{t=(new g).parseFromString(o,be)}catch(e){}if(!t||!t.documentElement){t=ae.createDocument(tt,"template",null);try{t.documentElement.innerHTML=nt?"":o}catch(e){}}var c=t.body||t.documentElement;return e&&n&&c.insertBefore(i.createTextNode(n),c.childNodes[0]||null),tt===et?ue.call(t,Pe?"html":"body")[0]:Pe?t.documentElement:c},Et=function(e){return le.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT,null,!1)},Ot=function(e){return e instanceof f&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof b)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},wt=function(t){return"object"===e(s)?t instanceof s:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},yt=function(e,t,n){me[e]&&E(me[e],(function(e){e.call(r,t,n,ct)}))},vt=function(e){var t;if(yt("beforeSanitizeElements",e,null),Ot(e))return ft(e),!0;if(k(/[\u0080-\uFFFF]/,e.nodeName))return ft(e),!0;var n=fe(e.nodeName);if(yt("uponSanitizeElement",e,{tagName:n,allowedTags:je}),e.hasChildNodes()&&!wt(e.firstElementChild)&&(!wt(e.content)||!wt(e.content.firstElementChild))&&k(/<[/\w]/g,e.innerHTML)&&k(/<[/\w]/g,e.textContent))return ft(e),!0;if("select"===n&&k(/<template/i,e.innerHTML))return ft(e),!0;if(!je[n]||Te[n]){if(!Te[n]&&_t(n)){if(Se.tagNameCheck instanceof RegExp&&k(Se.tagNameCheck,n))return!1;if(Se.tagNameCheck instanceof Function&&Se.tagNameCheck(n))return!1}if(We&&!Ve[n]){var o=ne(e)||e.parentNode,c=te(e)||e.childNodes;if(c&&o)for(var i=c.length-1;i>=0;--i)o.insertBefore(Z(c[i],!0),ee(e))}return ft(e),!0}return e instanceof u&&!bt(e)?(ft(e),!0):"noscript"!==n&&"noembed"!==n||!k(/<\/no(script|embed)/i,e.innerHTML)?(Le&&3===e.nodeType&&(t=e.textContent,t=j(t,ge," "),t=j(t,he," "),e.textContent!==t&&(w(r.removed,{element:e.cloneNode()}),e.textContent=t)),yt("afterSanitizeElements",e,null),!1):(ft(e),!0)},jt=function(e,t,n){if(He&&("id"===t||"name"===t)&&(n in i||n in it))return!1;if(Re&&!Ne[t]&&k(Ee,t));else if(Ce&&k(Oe,t));else if(!xe[t]||Ne[t]){if(!(_t(e)&&(Se.tagNameCheck instanceof RegExp&&k(Se.tagNameCheck,e)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(e))&&(Se.attributeNameCheck instanceof RegExp&&k(Se.attributeNameCheck,t)||Se.attributeNameCheck instanceof Function&&Se.attributeNameCheck(t))||"is"===t&&Se.allowCustomizedBuiltInElements&&(Se.tagNameCheck instanceof RegExp&&k(Se.tagNameCheck,n)||Se.tagNameCheck instanceof Function&&Se.tagNameCheck(n))))return!1}else if(Xe[t]);else if(k(ve,j(n,ye,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==_(n,"data:")||!Qe[e])if(Ae&&!k(we,j(n,ye,"")));else if(n)return!1;return!0},_t=function(e){return e.indexOf("-")>0},xt=function(t){var n,o,c,i;yt("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe};for(i=a.length;i--;){var s=n=a[i],u=s.name,d=s.namespaceURI;if(o="value"===u?n.value:x(n.value),c=fe(u),l.attrName=c,l.attrValue=o,l.keepAttr=!0,l.forceKeepAttr=void 0,yt("uponSanitizeAttribute",t,l),o=l.attrValue,!l.forceKeepAttr&&(gt(u,t),l.keepAttr))if(k(/\/>/i,o))gt(u,t);else{Le&&(o=j(o,ge," "),o=j(o,he," "));var p=fe(t.nodeName);if(jt(p,c,o)){if(!ze||"id"!==c&&"name"!==c||(gt(u,t),o=Ue+o),oe&&"object"===e(h)&&"function"==typeof h.getAttributeType)if(d);else switch(h.getAttributeType(p,c)){case"TrustedHTML":o=oe.createHTML(o);break;case"TrustedScriptURL":o=oe.createScriptURL(o)}try{d?t.setAttributeNS(d,u,o):t.setAttribute(u,o),O(r.removed)}catch(e){}}}}yt("afterSanitizeAttributes",t,null)}},kt=function e(t){var n,r=Et(t);for(yt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)yt("uponSanitizeShadowNode",n,null),vt(n)||(n.content instanceof a&&e(n.content),xt(n));yt("afterSanitizeShadowDOM",t,null)};return r.sanitize=function(t){var o,i,l,u,d,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((nt=!t)&&(t="\x3c!--\x3e"),"string"!=typeof t&&!wt(t)){if("function"!=typeof t.toString)throw S("toString is not a function");if("string"!=typeof(t=t.toString()))throw S("dirty is not a string, aborting")}if(!r.isSupported){if("object"===e(n.toStaticHTML)||"function"==typeof n.toStaticHTML){if("string"==typeof t)return n.toStaticHTML(t);if(wt(t))return n.toStaticHTML(t.outerHTML)}return t}if(Me||lt(p),r.removed=[],"string"==typeof t&&(Ge=!1),Ge){if(t.nodeName){var m=fe(t.nodeName);if(!je[m]||Te[m])throw S("root node is forbidden and cannot be sanitized in-place")}}else if(t instanceof s)1===(i=(o=ht("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i);else{if(!Fe&&!Le&&!Pe&&-1===t.indexOf("<"))return oe&&Ie?oe.createHTML(t):t;if(!(o=ht(t)))return Fe?null:Ie?ce:""}o&&De&&ft(o.firstChild);for(var b=Et(Ge?t:o);l=b.nextNode();)3===l.nodeType&&l===u||vt(l)||(l.content instanceof a&&kt(l.content),xt(l),u=l);if(u=null,Ge)return t;if(Fe){if(Be)for(d=se.call(o.ownerDocument);o.firstChild;)d.appendChild(o.firstChild);else d=o;return xe.shadowroot&&(d=de.call(c,d,!0)),d}var f=Pe?o.outerHTML:o.innerHTML;return Pe&&je["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&k(X,o.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+f),Le&&(f=j(f,ge," "),f=j(f,he," ")),oe&&Ie?oe.createHTML(f):f},r.setConfig=function(e){lt(e),Me=!0},r.clearConfig=function(){ct=null,Me=!1},r.isValidAttribute=function(e,t,n){ct||lt({});var r=fe(e),o=fe(t);return jt(r,o,n)},r.addHook=function(e,t){"function"==typeof t&&(me[e]=me[e]||[],w(me[e],t))},r.removeHook=function(e){if(me[e])return O(me[e])},r.removeHooks=function(e){me[e]&&(me[e]=[])},r.removeAllHooks=function(){me={}},r}()}()},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"b",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:n=!1,cancelable:o=!1,element:c,detail:i={}}=t;if(!r)return;c||(c=document.body);const a=new r(e,{bubbles:n,cancelable:o,detail:i});c.dispatchEvent(a)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},a=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const c=()=>{o(t,{bubbles:n,cancelable:r})};return jQuery(document).on(e,c),()=>jQuery(document).off(e,c)}},function(e,t,n){"use strict";var r=n(0),o=n(15);const c=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=c},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,function(e,t,n){"use strict";var r=n(0),o=n(7),c=n(4),i=n.n(c),a=n(1),l=n(24),s=n(92),u=n(44);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:c=n,onRemove:p=o.noop,isDismissible:m=!0,actions:b=[],politeness:f=d(t),__unstableHTML:g,onDismiss:h=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(l.speak)(n,t)},[n,t])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":m});return g&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:E},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},b.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:c=!1,onClick:a,url:l},s)=>{let d=o;return"primary"===o||c||(d=l?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(u.a,{key:s,href:l,variant:d,onClick:l?void 0:a,className:i()("components-notice__action",e)},t)}))),m&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:s.a,label:Object(a.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),h(),p()},showTooltip:!1}))}},function(e,t,n){"use strict";var r=n(12),o=n.n(r),c=n(0);n(123);const i=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const n=Object(c.useRef)(null);return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:n,"aria-hidden":!0}),Object(c.createElement)(e,o()({},t,{scrollToTop:e=>{null!==n.current&&((e,t)=>{const{focusableSelector:n}=t||{};window&&Number.isFinite(window.innerHeight)&&(n?((e,t)=>{var n;const r=(null===(n=e.parentElement)||void 0===n?void 0:n.querySelectorAll(t))||[];if(r.length){const e=r[0];i(e),null==e||e.focus()}else i(e)})(e,n):i(e))})(n.current,e)}})))}},function(e,t){e.exports=window.wp.blocks},,,,,function(e,t){},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(72);const o=["a","b","em","i","strong","p","br"],c=["target","href","rel","name","download"],i=(e,t)=>{const n=(null==t?void 0:t.tags)||o,i=(null==t?void 0:t.attr)||c;return Object(r.sanitize)(e,{ALLOWED_TAGS:n,ALLOWED_ATTR:i})}},,function(e,t){e.exports=window.wp.blockEditor},,,function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},,,,,,,,,function(e,t){},function(e,t,n){"use strict";var r=n(0),o=n(4),c=n.n(o),i=n(20),a=n(11);n(138),t.a=Object(a.withInstanceId)(e=>{let{className:t,instanceId:n,label:o="",onChange:a,options:l,screenReaderLabel:s,value:u=""}=e;const d="wc-block-components-sort-select__select-"+n;return Object(r.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(i.a,{label:o,screenReaderLabel:s,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:a,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,function(e,t){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(56),o=(n(14),n(2));const c=e=>{const t=Object.keys(o.defaultAddressFields),n=Object(r.a)(t,{},e.country),c=Object.assign({},e);return n.forEach(t=>{let{key:n="",hidden:r=!1}=t;r&&((e,t)=>e in t)(n,e)&&(c[n]="")}),c}},,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,,function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n(12),o=n.n(r),c=n(0),i=n(4),a=n.n(i),l=n(98),s=n(109),u=n(5),d=n(3);n(105);const p=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},m=e=>{let{className:t,context:n="default",additionalNotices:r=[]}=e;const i=Object(u.useSelect)(e=>e(d.PAYMENT_STORE_KEY).isExpressPaymentMethodActive()),{notices:m}=Object(u.useSelect)(e=>({notices:e("core/notices").getNotices(n)})),{removeNotice:b}=Object(u.useDispatch)("core/notices"),f=m.filter(e=>"snackbar"!==e.type).concat(r);if(!f.length)return null;const g=a()(t,"wc-block-components-notices");return i?null:Object(c.createElement)("div",{className:g},f.map(e=>Object(c.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:a()("wc-block-components-notices__notice",p(e)),onRemove:()=>{e.isDismissible&&b(e.id,n)}}),Object(s.a)(e.content))))}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(18),o=n(0),c=n(46);n.p=c.k,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([n.e(0),n.e(71)]).then(n.bind(null,361)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>n.e(70).then(n.bind(null,502)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>n.e(78).then(n.bind(null,503)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>n.e(72).then(n.bind(null,362)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>n.e(68).then(n.bind(null,363)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>n.e(76).then(n.bind(null,438)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>n.e(73).then(n.bind(null,319)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>n.e(74).then(n.bind(null,439)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>n.e(69).then(n.bind(null,440)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>n.e(77).then(n.bind(null,441)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>n.e(75).then(n.bind(null,442)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([n.e(1),n.e(10),n.e(4),n.e(67)]).then(n.bind(null,504)))});const i=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(266)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(48),c=n(8),i=n(1),a=n(7),l=n(4),s=n.n(l),u=n(20);n(244);var d=e=>{let{currentPage:t,displayFirstAndLastPages:n=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:c=3,onPageChange:a,totalPages:l}=e,{minIndex:d,maxIndex:p}=((e,t,n)=>{if(n<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),c=Math.min(Math.ceil(t+(r-(t-o))),n-1);return{minIndex:Math.max(Math.floor(t-(r-(c-t))),2),maxIndex:c}})(c,t,l);const m=n&&Boolean(1!==d),b=n&&Boolean(p!==l),f=n&&Boolean(d&&d>3),g=n&&Boolean(p&&p<l-2);m&&3===d&&(d-=1),b&&p===l-2&&(p+=1);const h=[];if(d&&p)for(let e=d;e<=p;e++)h.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(u.a,{screenReaderLabel:Object(i.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t-1),title:Object(i.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(u.a,{label:"←",screenReaderLabel:Object(i.__)("Previous page","woo-gutenberg-products-block")})),m&&Object(r.createElement)("button",{className:s()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>a(1),disabled:1===t},Object(r.createElement)(u.a,{label:"1",screenReaderLabel:Object(i.sprintf)(
4
  /* translators: %d is the page number (1, 2, 3...). */
5
  Object(i.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(i.__)("…","woo-gutenberg-products-block")),h.map(e=>Object(r.createElement)("button",{key:e,className:s()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>a(e),disabled:t===e},Object(r.createElement)(u.a,{label:e.toString(),screenReaderLabel:Object(i.sprintf)(
6
  /* translators: %d is the page number (1, 2, 3...). */
7
  Object(i.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(i.__)("…","woo-gutenberg-products-block")),b&&Object(r.createElement)("button",{className:s()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===l,"wc-block-components-pagination__page--active":t===l}),onClick:()=>a(l),disabled:t===l},Object(r.createElement)(u.a,{label:l.toString(),screenReaderLabel:Object(i.sprintf)(
8
  /* translators: %d is the page number (1, 2, 3...). */
9
+ Object(i.__)("Page %d","woo-gutenberg-products-block"),l)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t+1),title:Object(i.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(r.createElement)(u.a,{label:"→",screenReaderLabel:Object(i.__)("Next page","woo-gutenberg-products-block")})))},p=n(62),m=n(32),b=n(282),f=n(70),g=n(99),h=n(50),E=n(24),O=n(114),w=n(15),y=Object(r.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)(w.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"})),v=()=>{const{parentClassName:e}=Object(h.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(O.a,{className:e+"__no-products-image",icon:y,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(i.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(i.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},j=Object(r.createElement)(w.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(w.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),_=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:n}=Object(h.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:n+"__no-products"},Object(r.createElement)(O.a,{className:n+"__no-products-image",icon:j,size:100}),Object(r.createElement)("strong",{className:n+"__no-products-title"},Object(i.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:n+"__no-products-description"},Object(i.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(i.__)("Reset Search","woo-gutenberg-products-block")))},x=n(124);n(243);var k=e=>{let{onChange:t,value:n}=e;return Object(r.createElement)(x.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(i.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(i.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(i.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(i.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(i.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(i.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(i.__)("Order products by","woo-gutenberg-products-block"),value:n})},S=n(11),T=n(12),N=n.n(T),C=n(146);const R=(e,t,n,o)=>{if(!n)return;const c=Object(C.a)(e);return n.map((n,i)=>{let[a,l={}]=n,s=[];l.children&&l.children.length>0&&(s=R(e,t,l.children,o));const u=c[a];if(!u)return null;const d=t.id||0,p=["layout",a,i,o,d];return Object(r.createElement)(r.Suspense,{key:p.join("_"),fallback:Object(r.createElement)("div",{className:"wc-block-placeholder"})},Object(r.createElement)(u,N()({},l,{children:s,product:t})))})};var A=Object(S.withInstanceId)(e=>{let{product:t={},attributes:n,instanceId:o}=e;const{layoutConfig:c}=n,{parentClassName:i,parentName:a}=Object(h.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,u=s()(i+"__product","wc-block-layout",{"is-loading":l});return Object(r.createElement)("li",{className:u,"aria-hidden":l},R(a,t,c,o))});n(242);const L=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},P=function(e){let{totalQuery:t,totalProducts:n}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(a.isEqual)(t,r)&&Number.isFinite(n)};var M=Object(g.a)(e=>{let{attributes:t,currentPage:n,onPageChange:o,onSortChange:c,sortValue:l,scrollToTop:u}=e;const[g,O]=Object(m.b)("attributes",[]),[w,y]=Object(m.b)("stock_status",[]),[j,x]=Object(m.b)("rating",[]),[S,T]=Object(m.b)("min_price"),[N,C]=Object(m.b)("max_price"),[R]=Object(m.c)((e=>{let{sortValue:t,currentPage:n,attributes:r}=e;const{columns:o,rows:c}=r;return{...L(t),catalog_visibility:"catalog",per_page:o*c,page:n}})({attributes:t,sortValue:l,currentPage:n})),{products:M,totalProducts:D,productsLoading:F}=Object(b.a)(R),{parentClassName:B,parentName:I}=Object(h.useInnerBlockLayoutContext)(),H=(e=>{const{order:t,orderby:n,page:r,per_page:o,...c}=e;return c||{}})(R),{dispatchStoreEvent:z}=Object(f.a)(),U=Object(p.a)({totalQuery:H,totalProducts:D},P);Object(r.useEffect)(()=>{z("product-list-render",{products:M,listName:I})},[M,I,z]),Object(r.useEffect)(()=>{Object(a.isEqual)(H,null==U?void 0:U.totalQuery)||(o(1),null!=U&&U.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(E.speak)(Object(i.__)("No products found","woo-gutenberg-products-block")):Object(E.speak)(Object(i.sprintf)(
10
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
11
+ Object(i._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(D))},[null==U?void 0:U.totalQuery,D,o,H]);const{contentVisibility:W}=t,G=t.columns*t.rows,Y=!Number.isFinite(D)&&Number.isFinite(null==U?void 0:U.totalProducts)&&Object(a.isEqual)(H,null==U?void 0:U.totalQuery)?Math.ceil(((null==U?void 0:U.totalProducts)||0)/G):Math.ceil(D/G),V=M.length?M:Array.from({length:G}),q=0!==M.length||F,Q=g.length>0||w.length>0||j.length>0||Number.isFinite(S)||Number.isFinite(N);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:n,alignButtons:r,align:o}=t,c=void 0!==o?"align"+o:"";return s()(B,c,"has-"+e+"-columns",{"has-multiple-rows":n>1,"has-aligned-buttons":r})})()},(null==W?void 0:W.orderBy)&&q&&Object(r.createElement)(k,{onChange:c,value:l}),!q&&Q&&Object(r.createElement)(_,{resetCallback:()=>{O([]),y([]),x([]),T(null),C(null)}}),!q&&!Q&&Object(r.createElement)(v,null),q&&Object(r.createElement)("ul",{className:s()(B+"__products",{"is-loading-products":F})},V.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return Object(r.createElement)(A,{key:e.id||n,attributes:t,product:e})}))),Y>1&&Object(r.createElement)(d,{currentPage:n,onPageChange:e=>{u({focusableSelector:"a, button"}),o(e)},totalPages:Y}))}),D=e=>{let{attributes:t}=e;const[n,o]=Object(r.useState)(1),[c,i]=Object(r.useState)(t.orderby);return Object(r.useEffect)(()=>{i(t.orderby)},[t.orderby]),Object(r.createElement)(M,{attributes:t,currentPage:n,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const n=null==e||null===(t=e.target)||void 0===t?void 0:t.value;i(n),o(1)},sortValue:c})};const F=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}));var B=n(139);class I extends c.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?F:Object(r.createElement)(h.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(B.a,{context:"wc/all-products"}),Object(r.createElement)(D,{attributes:e,urlParameterSuffix:t}))}}var H=I;Object(o.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(r.createElement)(H,e),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})},,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(61),o=n(3),c=n(5),i=n(29);const a=e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:n,isLoading:a}=Object(r.a)({...t,query:e}),{value:l}=((e,t)=>{const{namespace:n,resourceName:r,resourceValues:a=[],query:l={}}=t;if(!n||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const s=Object(i.a)(l),u=Object(i.a)(a),{value:d,isLoading:p=!0}=Object(c.useSelect)(e=>{const t=e(o.COLLECTIONS_STORE_KEY),c=["x-wp-total",n,r,s,u];return{value:t.getCollectionHeader(...c),isLoading:t.hasFinishedResolution("getCollectionHeader",c)}},["x-wp-total",n,r,u,s]);return{value:d,isLoading:p}})(0,{...t,query:e});return{products:n,totalProducts:parseInt(l,10),productsLoading:a}}}]);
build/all-products.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '567f04f228d06d82303ad579472891e2');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'a13941c732e6d5798bc8671323de7954');
build/all-products.js CHANGED
@@ -1,36 +1,36 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],i=t[2],d=0,b=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);b.length;)b.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],r=!0,s=1;s<c.length;s++){var l=c[s];0!==o[l]&&(r=!1)}r&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var r={},o={6:0,1:0,2:0,3:0,4:0,21:0,24:0,28:0,30:0,31:0,33:0,34:0,35:0,37:0},n=[];function a(t){if(r[t])return r[t].exports;var c=r[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,a),c.l=!0,c.exports}a.e=function(e){var t=[],c=o[e];if(0!==c)if(c)t.push(c[2]);else{var r=new Promise((function(t,r){c=o[e]=[t,r]}));t.push(c[2]=r);var n,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(e){return a.p+""+({1:"product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00",2:"product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01",3:"product-button--product-image--product-rating--product-sale-badge--product-title",4:"product-add-to-cart--product-button--product-image--product-title",19:"product-add-to-cart",21:"product-button",24:"product-category-list",25:"product-image",28:"product-price",30:"product-rating",31:"product-sale-badge",33:"product-sku",34:"product-stock-indicator",35:"product-summary",37:"product-tag-list",38:"product-title"}[e]||e)+".js?ver="+{1:"3f52017722306fd43b44",2:"73dd6bd21b6e5778da04",3:"25c5397c432aad147164",4:"32be25b969f9aa8ae7c7",19:"c0787eaac97461425974",21:"d6a711ee51fce04c5aab",24:"354311380a8611028a3a",25:"5c1876778b55c5ef9ae1",28:"dcafbeb08bea8e40f305",30:"88502b4adb9c8db8f111",31:"fe9d57586258ed416c8e",33:"7ec1f49ffd46d608c4bf",34:"9a2bc5fa9cc942c6a6cd",35:"ba9a930662868e2d5566",37:"0a4d7d8bde8b701d447a",38:"e663d9b91d47debbebc7"}[e]}(e);var l=new Error;n=function(t){s.onerror=s.onload=null,clearTimeout(i);var c=o[e];if(0!==c){if(c){var r=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+r+": "+n+")",l.name="ChunkLoadError",l.type=r,l.request=n,c[1](l)}o[e]=void 0}};var i=setTimeout((function(){n({type:"timeout",target:s})}),12e4);s.onerror=s.onload=n,document.head.appendChild(s)}return Promise.all(t)},a.m=e,a.c=r,a.d=function(e,t,c){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(c,r,function(t){return e[t]}.bind(null,r));return c},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e};var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var u=l;return n.push([392,0]),c()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wp.components},,function(e,t){e.exports=window.wp.blockEditor},,function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.url},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a})),c.d(t,"c",(function(){return l})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var r=c(0),o=c(8),n=c(1);const a={clear:Object(n.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(n.__)("No items found.","woo-gutenberg-products-block"),
2
  /* Translators: %s search term */
3
  noResults:Object(n.__)("No results for %s","woo-gutenberg-products-block"),search:Object(n.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(n.sprintf)(
4
  /* translators: Number of items selected from list. */
5
- Object(n._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(n.__)("Search results updated.","woo-gutenberg-products-block")},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=a(r[e.parent]);return[...t,e.name]},s=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}}),l=s(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||l.push(...s(c||[]))}),l},l=(e,t,c)=>{if(!t)return c?s(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?s(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(c).map((e,t)=>c.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},,,function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return a})),c.d(t,"l",(function(){return s})),c.d(t,"n",(function(){return l})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return d})),c.d(t,"g",(function(){return b})),c.d(t,"k",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return _}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,b=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{})},function(e,t){e.exports=window.wc.wcBlocksSharedContext},,function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"i",(function(){return b})),c.d(t,"f",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return j}));var r=c(16),o=c(14),n=c.n(o),a=c(8),s=c(2),l=c(22);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(r.addQueryArgs)("/wc/store/v1/products",{...a,...o})];return n&&t.length&&s.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:o});return Promise.all(s.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),d=()=>n()({path:"wc/store/v1/products/attributes"}),b=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),p=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(s.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/v1/products/categories/"+e}),O=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),j=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));var r=c(1),o=c(15);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(o.decodeEntities)(e.message):Object(r.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=a||r.Fragment,l&&i&&c!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,c))}},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(35);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t){e.exports=window.wp.escapeHtml},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(6),o=c.n(r),n=c(0),a=c(19);const s=e=>{let{countLabel:t,className:c,depth:r=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:d,search:b="",...p}=e;const m=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,j=p.name||"search-list-item-"+s,h=`${j}-${l.id}`;return Object(n.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(n.createElement)("input",o()({type:"checkbox",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(a.b)(l.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(a.d)(l.name,b))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(131),s=c(4),l=c.n(s);c(137);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**r.minorUnit;if(!Number.isFinite(p))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,o()({className:m,displayType:u},g,{value:p,onValueChange:O}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(25),n=c.n(o);function a(e){const t=Object(r.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var r=c(8),o=c(0),n=c(9),a=c(7),s=c(15),l=c(267),i=c(85),u=c(266);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},g={...m,email:""},O={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},j=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),h={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:n.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:O,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:n.EMPTY_EXTENSIONS},_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:c}=Object(i.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();p();const b=Object(a.useSelect)((e,c)=>{let{dispatch:r}=c;if(!u)return h;if(t)return{cartCoupons:s.coupons,cartItems:s.items,crossSellsProducts:s.cross_sells,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingData:g,billingAddress:g,shippingAddress:m,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:O}=r(n.CART_STORE_KEY),_=j(a.billingAddress),E=a.needsShipping?j(a.shippingAddress):_,w=a.fees.length>0?a.fees.map(e=>j(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,crossSellsProducts:a.crossSells,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingData:Object(l.a)(_),billingAddress:Object(l.a)(_),shippingAddress:Object(l.a)(E),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:O}},[u]);return d.current&&Object(r.isEqual)(d.current,b)||(d.current=b),d.current}},function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},,function(e,t){e.exports=window.wp.hooks},,function(e,t){e.exports=window.wp.a11y},,,,function(e,t){e.exports=window.wp.deprecated},function(e,t,c){"use strict";c.d(t,"a",(function(){return d})),c.d(t,"b",(function(){return b})),c.d(t,"c",(function(){return p}));var r=c(9),o=c(7),n=c(0),a=c(25),s=c.n(a),l=c(40),i=c(104),u=c(44);const d=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[r,o]=d(t),a=Object(l.a)(r),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[r,o]:[e,o]}},,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"e",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"b",(function(){return l})),c.d(t,"c",(function(){return i}));var r=c(33);const o=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];let n,a;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(a||(a={}));const s=(e,t)=>Object(r.a)(e)&&"type"in e&&e.type===t,l=e=>s(e,n.ERROR),i=e=>s(e,n.FAIL)},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(136),s=c(4),l=c.n(s),i=c(96);c(163),t.a=e=>{let{className:t,showSpinner:c=!1,children:r,variant:s="contained",...u}=e;const d=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,o()({className:d},u),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},r))}},function(e,t){e.exports=window.wp.autop},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var r=c(10),o=c(22);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=()=>o.n>2,s=()=>o.n>1},,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(8),a=c(3);t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);s({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,d,b);s({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(r.createElement)(a.ToggleControl,{label:Object(o.__)("Align the last block to the bottom","woo-gutenberg-products-block"),help:l?Object(o.__)("Align the last block to the bottom.","woo-gutenberg-products-block"):Object(o.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:()=>s({alignButtons:!l})}))}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(7),n=c(9);c(185);const a=e=>{let{errorMessage:t="",propertyName:c="",elementId:a=""}=e;const{validationError:s,validationErrorId:l}=Object(o.useSelect)(e=>{const t=e(n.VALIDATION_STORE_KEY);return{validationError:t.getValidationError(c),validationErrorId:t.getValidationErrorId(a)}});if(!t||"string"!=typeof t){if(null==s||!s.message||null!=s&&s.hidden)return null;t=s.message}return Object(r.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(r.createElement)("p",{id:l},t))};t.b=a},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(46),o=c(0),n=c(41);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},,,function(e,t){e.exports=window.wp.dom},,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(38),a=c(4),s=c.n(a),l=c(26);c(162);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
- Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:a,regularPrice:l,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:o,format:a="<price/>",maxPrice:l,minPrice:d,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}=e;const h=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=g&&b!==g;let E=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",p)});return _?E=Object(r.createElement)(u,{currency:o,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}):void 0!==d&&void 0!==l?E=Object(r.createElement)(i,{currency:o,maxPrice:l,minPrice:d,priceClassName:p,priceStyle:m}):b&&(E=Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",p),currency:o,value:b,style:m})),Object(r.createElement)("span",{className:h},Object(r.createInterpolateElement)(a,{price:E}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(33),o=c(115);const n=e=>{const t=Object(r.a)(e)?e:{},c=Object(o.a)(t.style),n=Object(r.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:n.fontSize,lineHeight:n.lineHeight,fontWeight:n.fontWeight,textTransform:n.textTransform,fontFamily:t.fontFamily}}}},,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(37),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:r,isLoading:l,onSelect:u,disabled:d,...b}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,o()({},b,{key:c.id,className:t,isSelected:r,item:c,onSelect:u,isSingle:!0,disabled:d})),r&&l&&Object(n.createElement)("div",{key:"loading",className:i()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(n.createElement)(s.Spinner,null)))}},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var r=c(0),o=c(7);const n=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(r.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(o.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(r.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(r.createElement)(n.Provider,{value:u},t)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,,,,function(e,t){e.exports=window.wp.wordcount},,,,function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(169),a=c(86);const s=Object(r.getSetting)("countryLocale",{}),l=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
8
  /* translators: %s Field label. */
9
- Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,l(c)]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{})]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=c&&void 0!==i[c]?i[c]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var r=c(0);c(164),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(8),l=c(37),i=c(100),u=c(11),d=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Array.isArray(t)?Object(n.createElement)(e,this.props):Object(n.createElement)(e,o()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),b=c(188),p=c(24),m=c.n(p),g=c(25),O=c.n(g),j=c(27),h=c(28),_=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),m()(this,"state",{error:null,loading:!1,variations:{}}),m()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const r=this.getExpandedProduct();if(!r||c[r])return;const o=e.find(e=>e.id===r);o.variations&&0!==o.variations.length?(this.setState({loading:!0}),Object(j.g)(r).then(e=>{const t=e.map(e=>({...e,parent:r}));this.setState({variations:{...this.state.variations,[r]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(h.a)(e);this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:null})})}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:c,showVariations:r}=this.props;r&&(!O()(e.selected,c)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){var t;const{products:c}=this.props;return null===(t=c.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0])||void 0===t?void 0:t.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem)),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:c}=this.props,{error:r,loading:a,variations:s}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:r||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return m()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),E=c(34),w=c(4),f=c.n(w),k=c(84);c(138);const y={list:Object(a.__)("Products","woo-gutenberg-products-block"),noItems:Object(a.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(a.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(a.__)("Product search results updated.","woo-gutenberg-products-block")},v=e=>{let{expandedProduct:t,error:c,instanceId:r,isCompact:u,isLoading:d,onChange:b,onSearch:p,products:m,renderItem:g,selected:O,showVariations:j,variations:h,variationsLoading:_}=e;if(c)return Object(n.createElement)(E.a,{error:c});const w=[...m,...h&&h[t]?h[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:w,isCompact:u,isLoading:d,isSingle:!0,selected:w.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:b,renderItem:g||(j?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:b}=e,p=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=f()("woocommerce-search-product__item","woocommerce-search-list__item","depth-"+i,"has-count",{"is-searching":c.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":p>0});if(!t.breadcrumbs.length)return Object(n.createElement)(k.a,o()({},e,{className:f()(m,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{b(t)()},isLoading:d||_,countLabel:t.variations.length>0?Object(a.sprintf)(
10
  /* translators: %1$d is the number of variations of a product product. */
11
  Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
12
  /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
13
- Object(a._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,"woo-gutenberg-products-block"),t.name,t.variations.length)}));const g=Object(s.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(n.createElement)(l.a,o()({},g,{className:m,name:"variations-"+r}))}:null),onSearch:p,messages:y,isHierarchical:!0})};v.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=d(Object(b.a)(_(Object(u.withInstanceId)(v))))},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var r=c(8);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(r.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:c,id:r,callback:n,priority:s}=arguments.length>1?arguments[1]:void 0;const l=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return l.set(r,{priority:s,callback:n}),{...e,[c]:l};case o.REMOVE_EVENT_CALLBACK:return l.delete(r),{...e,[c]:l}}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(61),n=c(33),a=c(115);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})}},function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(119),i=c(527),u=c(4),d=c.n(u),b=c(11),p=c(19),m=c(37),g=c(526),O=c(15);const j=e=>{let{id:t,label:c,popoverContents:r,remove:o,screenReaderLabel:i,className:u=""}=e;const[p,m]=Object(n.useState)(!1),h=Object(b.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const _=d()("woocommerce-tag",u,{"has-remove":!!o}),E="woocommerce-tag__label-"+h,w=Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},i),Object(n.createElement)("span",{"aria-hidden":"true"},c));return Object(n.createElement)("span",{className:_},r?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:E,onClick:()=>m(!0)},w):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:E},w),r&&p&&Object(n.createElement)(s.Popover,{onClose:()=>m(!1)},r),o&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(a.sprintf)(// Translators: %s label.
14
- Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":E},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const _=e=>Object(n.createElement)(m.b,e),E=e=>{const{list:t,selected:c,renderItem:r,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const d=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:d,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(E,o()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:l,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":o.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...s}=e;const{messages:u,renderItem:d,selected:b,isSingle:p}=s,m=d||_;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(l.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(a.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(E,{list:t,selected:b,renderItem:m,onSelect:r,instanceId:o,isSingle:p,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:a,isSingle:l,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,_]=Object(n.useState)(""),E=Object(b.useInstanceId)(k),y=Object(n.useMemo)(()=>({...p.a,...u}),[u]),v=Object(n.useMemo)(()=>Object(p.c)(i,h,r),[i,h,r]);Object(n.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(n.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(n.useCallback)(e=>()=>{l&&m([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});m([...O.slice(0,t),...O.slice(t+1)])},[l,O,m]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?m(l?[e]:[...O,e]):S(e.id)()},[l,S,m,O]);return Object(n.createElement)("div",{className:d()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,o()({},e,{onRemove:S,messages:y})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:y.search,type:"search",value:h,onChange:e=>_(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,o()({},e,{search:h,filteredList:v,messages:y,onSelect:C,instanceId:E})))};Object(s.withSpokenMessages)(k)},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(12);function o(e,t){const c=Object(r.useRef)();return Object(r.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(15),s=c(4),l=c.n(s);c(161),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:b,...p}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",o()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:m,href:s,target:i},p,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:d}))}},function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(9),o=c(7),n=c(0),a=c(40),s=c(142);const l=e=>{const{namespace:t,resourceName:c,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(n.useRef)({results:[],isLoading:!0}),b=Object(a.a)(i),p=Object(a.a)(l),m=Object(s.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),n=[t,c,b,p],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,c,p,b,u]);return null!==g&&(d.current=g),d.current}},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(119),a=c(258),s=c(2),l=c(5),i=c(23);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(r.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(o.__)("Edit this product's details","woo-gutenberg-products-block"),Object(r.createElement)(n.a,{icon:a.a,size:16}))),Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(o.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(86),o=c(33);const n=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},,,,,,function(e,t,c){"use strict";var r=c(0),o=c(91),n=c(60);const a=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},s=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),l=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,i=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"&hellip;";const r=s(e),o=r.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(o,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const o=s(e),a=o.slice(0,t);if(c)return Object(n.autop)(l(a,r));const i=a.match(/([\s]+)/g),u=i?i.length:0,d=o.slice(0,t+u);return Object(n.autop)(l(d,r))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:d={}}=e;const b=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const r=Object(n.autop)(e),s=Object(o.count)(r,c);if(s<=t)return r;const l=a(r),d=Object(o.count)(l,c);return d<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(r.createElement)(r.RawHTML,{style:d,className:l},b)}},,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(29),s=c(11);c(167),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u=""}=e;const d="wc-block-components-sort-select__select-"+c;return Object(r.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(5);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(5),o=c(61),n=c(33),a=c(127),s=c(115);const l=e=>{if(!Object(o.b)()||!Object(a.a)())return{style:{}};const t=Object(n.a)(e)?e:{},c=Object(s.a)(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})}},,,,,,,function(e,t){},function(e,t){},,,function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return m}));var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(29),l=c(23),i=c(154),u=c(99),d=c(82),b=c(130),p=c(42);c(260);const m=e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=Object(d.a)(e),j=Object(b.a)(e);if(!p.id||!p.on_sale)return null;const h="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,h,{[n+"__product-onsale"]:n},g.className,m.className),style:{...g.style,...m.style,...O.style,...j.style}},Object(r.createElement)(s.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))};t.default=Object(p.withProductDataContext)(m)},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(189),t.a=function(e){let{className:t="",...c}=e;const r=l()("wc-block-text-toolbar-button",t);return Object(n.createElement)(a.Button,o()({className:r},c))}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(61),n=c(33),a=c(115);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var r=c(0),o=c(7),n=c(9),a=c(15),s=c(41);const l=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},i=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:i}=Object(s.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(r.useState)(!1),m=Object(r.useRef)(l(c,e));return Object(r.useEffect)(()=>{const t=l(c,e);t!==m.current&&(m.current=t)},[c,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:i,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),t(e,c).then(()=>{d("add-to-cart")}).catch(e=>{u(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,,,,,,,,,,,,,function(e,t){},,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(22),s=c(27),l=c(118),i=c(28);t.a=e=>t=>{let{selected:c,...r}=t;const[u,d]=Object(n.useState)(!0),[b,p]=Object(n.useState)(null),[m,g]=Object(n.useState)([]),O=a.o.productCount>100,j=async e=>{const t=await Object(i.a)(e);p(t),d(!1)},h=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:h.current}).then(e=>{g(e),d(!1)}).catch(j)},[h]);const _=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),d(!1)}).catch(j)},400),E=Object(n.useCallback)(e=>{d(!0),_(e)},[d,_]);return Object(n.createElement)(e,o()({},r,{selected:c,error:b,products:m,isLoading:u,onSearch:O?E:null}))}},function(e,t){},,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return g}));var r=c(0),o=c(4),n=c.n(o),a=c(23),s=c(61),l=c(42),i=c(106),u=c(70),d=c(99),b=c(130),p=c(82);c(261);const m=e=>{let{children:t,headingLevel:c,elementType:o="h"+c,...n}=e;return Object(r.createElement)(o,n,t)},g=e=>{const{className:t,headingLevel:c=2,showProductLink:o=!0,linkTarget:l,align:g}=e,{parentClassName:O}=Object(a.useInnerBlockLayoutContext)(),{product:j}=Object(a.useProductDataContext)(),{dispatchStoreEvent:h}=Object(u.a)(),_=Object(d.a)(e),E=Object(b.a)(e),w=Object(p.a)(e);return j.id?Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:j.name,permalink:j.permalink,target:l,onClick:()=>{h("product-view-link",{product:j})}})):Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}})};t.b=Object(l.withProductDataContext)(g)},function(e,t,c){"use strict";c.d(t,"a",(function(){return j}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(23),d=c(82),b=c(154),p=c(130),m=c(42),g=c(70),O=c(141);c(262);const j=e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:m,isLoading:j}=Object(u.useProductDataContext)(),{dispatchStoreEvent:E}=Object(g.a)(),w=Object(d.a)(e),f=Object(b.a)(e),k=Object(p.a)(e);if(!m.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},f.className),style:{...w.style,...f.style,...k.style}},Object(n.createElement)(h,null));const y=!!m.images.length,v=y?m.images[0]:null,S=r?"a":n.Fragment,C=Object(a.sprintf)(
15
  /* translators: %s is referring to the product name */
16
- Object(a.__)("Link to %s","woo-gutenberg-products-block"),m.name),x={href:m.permalink,...!y&&{"aria-label":C},onClick:()=>{E("product-view-link",{product:m})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},f.className),style:{...w.style,...f.style,...k.style}},Object(n.createElement)(S,r&&x,!!o&&Object(n.createElement)(O.default,{align:s,product:m}),Object(n.createElement)(_,{fallbackAlt:m.name,image:v,loaded:!j,showFullSize:"cropped"!==c})))},h=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),_=e=>{let{image:t,loaded:c,showFullSize:r,fallbackAlt:a}=e;const{thumbnail:s,src:l,srcset:i,sizes:u,alt:d}=t||{},b={alt:d||a,hidden:!c,src:s,...r&&{src:l,srcSet:i,sizes:u}};return Object(n.createElement)(n.Fragment,null,b.src&&Object(n.createElement)("img",o()({"data-testid":"product-image"},b)),!t&&Object(n.createElement)(h,null))};t.b=Object(m.withProductDataContext)(j)},function(e,t){},,,,,,,,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(1),s=c(40),l=c(359),i=c(7),u=c(9);const d={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},b={status:d.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},p={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:m,SET_IDLE:g,SET_DISABLED:O,SET_PROCESSING:j,SET_BEFORE_PROCESSING:h,SET_AFTER_PROCESSING:_,SET_PROCESSING_RESPONSE:E,SET_HAS_ERROR:w,SET_NO_ERROR:f,SET_QUANTITY:k,SET_REQUEST_PARAMS:y}=p,v=()=>({type:g}),S=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?w:f;return{type:t}},{SET_PRISTINE:C,SET_IDLE:x,SET_DISABLED:N,SET_PROCESSING:P,SET_BEFORE_PROCESSING:T,SET_AFTER_PROCESSING:I,SET_PROCESSING_RESPONSE:R,SET_HAS_ERROR:A,SET_NO_ERROR:B,SET_QUANTITY:L,SET_REQUEST_PARAMS:D}=p,{PRISTINE:F,IDLE:V,DISABLED:z,PROCESSING:M,BEFORE_PROCESSING:q,AFTER_PROCESSING:H}=d,G=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,{quantity:c,type:r,data:o}=arguments.length>1?arguments[1]:void 0;switch(r){case C:e=b;break;case x:e=t.status!==V?{...t,status:V}:t;break;case N:e=t.status!==z?{...t,status:z}:t;break;case L:e=c!==t.quantity?{...t,quantity:c}:t;break;case D:e={...t,requestParams:{...t.requestParams,...o}};break;case R:e={...t,processingResponse:o};break;case P:e=t.status!==M?{...t,status:M,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case T:e=t.status!==q?{...t,status:q,hasError:!1}:t;break;case I:e=t.status!==H?{...t,status:H}:t;break;case A:e=t.hasError?t:{...t,hasError:!0},e=t.status===M||t.status===q?{...e,status:V}:e;break;case B:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&r!==C&&e.status===F&&(e.status=V),e};var Q=c(98),Y=c(268);const U=e=>({onAddToCartAfterProcessingWithSuccess:Object(Y.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Y.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Y.a)("add_to_cart_before_processing",e)});var W=c(317),K=c(58);const $=Object(r.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),J=()=>Object(r.useContext)($),X=e=>{var t,c,o,n;let{children:p,product:g,showFormElements:w}=e;const[f,C]=Object(r.useReducer)(G,b),[x,N]=Object(r.useReducer)(Q.b,{}),P=Object(s.a)(x),{createErrorNotice:T}=Object(i.useDispatch)("core/notices"),{setValidationErrors:I}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),R=Object(r.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:U(N).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:U(N).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:U(N).onAddToCartBeforeProcessing}),[N]),A=Object(r.useMemo)(()=>({resetForm:()=>{C({type:m})},submitForm:()=>{C({type:h})},setQuantity:e=>{C((e=>({type:k,quantity:e}))(e))},setHasError:e=>{C(S(e))},setRequestParams:e=>{C((e=>({type:y,data:e}))(e))},setAfterProcessing:e=>{C({type:E,data:e}),C({type:_})}}),[]);Object(r.useEffect)(()=>{const e=f.status,t=!g.id||!Object(l.a)(g);e!==d.DISABLED||t?e!==d.DISABLED&&t&&C({type:O}):C(v())},[f.status,g,C]),Object(r.useEffect)(()=>{f.status===d.BEFORE_PROCESSING&&(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const c=Object(i.select)("core/notices").getNotices(),{removeNotice:r}=Object(i.dispatch)("core/notices"),o=c.filter(t=>t.status===e);o.forEach(e=>r(e.id,t))}("error","wc/add-to-cart"),Object(W.a)(P,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&T(t,{context:"wc/add-to-cart"}),c&&I(c)}),C(v())):C({type:j})}))},[f.status,I,T,C,P,null==g?void 0:g.id]),Object(r.useEffect)(()=>{if(f.status===d.AFTER_PROCESSING){const e={processingResponse:f.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:r}=e;(Object(K.b)(e)||Object(K.c)(e))&&c&&(t=!0,T(c,r?{context:r}:void 0))}),t};if(f.hasError)return void Object(W.b)(P,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var r;const t=(null===(r=e.processingResponse)||void 0===r?void 0:r.message)||Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block");T(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==g?void 0:g.id)||0)})}C(v())});Object(W.b)(P,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?C(S(!0)):C(v())})}},[f.status,f.hasError,f.processingResponse,A,T,P,null==g?void 0:g.id]);const B=Object(l.b)(g),L={product:g,productType:g.type||"simple",productIsPurchasable:Object(l.a)(g),productHasOptions:g.has_options||!1,supportsFormElements:B,showFormElements:w&&B,quantity:f.quantity||(null==g||null===(t=g.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==g||null===(c=g.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==g||null===(o=g.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==g||null===(n=g.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:f.requestParams,isIdle:f.status===d.IDLE,isDisabled:f.status===d.DISABLED,isProcessing:f.status===d.PROCESSING,isBeforeProcessing:f.status===d.BEFORE_PROCESSING,isAfterProcessing:f.status===d.AFTER_PROCESSING,hasError:f.hasError,eventRegistration:R,dispatchActions:A};return Object(r.createElement)($.Provider,{value:L},p)};var Z=c(14),ee=c.n(Z),te=c(15),ce=c(266),re=c(41),oe=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:o,hasError:n,isProcessing:s,requestParams:l}=J(),{showAllValidationErrors:d}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),b=Object(i.useSelect)(e=>e(u.VALIDATION_STORE_KEY).hasValidationErrors),{createErrorNotice:p,removeNotice:m}=Object(i.useDispatch)("core/notices"),{receiveCart:g}=Object(re.a)(),[O,j]=Object(r.useState)(!1),h=!n&&s,_=Object(r.useCallback)(()=>!b()||(d(),{type:"error"}),[b,d]);Object(r.useEffect)(()=>{const e=o.onAddToCartBeforeProcessing(_,0);return()=>{e()}},[o,_]);const E=Object(r.useCallback)(()=>{j(!0),m("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const r={id:t.id||0,quantity:c,...l};ee()({path:"/wc/store/v1/cart/add-item",method:"POST",data:r,cache:"no-store",parse:!1}).then(c=>{ee.a.setNonce(c.headers),c.json().then((function(r){c.ok?g(r):(r.body&&r.body.message?p(Object(te.decodeEntities)(r.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):p(Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(ce.b)({preserveCartData:!0}),e.setAfterProcessing(r),j(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&g(t.data.cart),e.setHasError(),e.setAfterProcessing(t),j(!1)}))})},[t,p,m,g,e,c,l]);return Object(r.useEffect)(()=>{h&&!O&&E()},[h,E,O]),null};const ne=e=>{let{children:t,product:c,showFormElements:o}=e;return Object(r.createElement)(X,{product:c,showFormElements:o},t,Object(r.createElement)(oe,null))};var ae=c(23),se=c(8),le=c(42),ie=(c(236),c(59)),ue=c(119),de=c(546),be=c(70),pe=c(168);const me=e=>{let{className:t,href:c,text:o,onClick:n}=e;return Object(r.createElement)(ie.a,{className:t,href:c,onClick:n,rel:"nofollow"},o)},ge=e=>{let{className:t,quantityInCart:c,isProcessing:o,isDisabled:n,isDone:s,onClick:l}=e;return Object(r.createElement)(ie.a,{className:t,disabled:n,showSpinner:o,onClick:l},s&&c>0?Object(a.sprintf)(
17
  /* translators: %s number of products in cart. */
18
- Object(a._n)("%d in cart","%d in cart",c,"woo-gutenberg-products-block"),c):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!s&&Object(r.createElement)(ue.a,{icon:de.a}))};var Oe=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=J(),{parentName:b}=Object(ae.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(be.a)(),{cartQuantity:m}=Object(pe.a)(o.id||0),[g,O]=Object(r.useState)(!1),j=o.add_to_cart||{url:"",text:""};return Object(r.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(r.createElement)(ge,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==o?void 0:o.id)||0)),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(me,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{p("product-view-link",{product:o,listName:b})}})},je=c(118),he=e=>{let{disabled:t,min:c,max:o,step:n=1,value:a,onChange:s}=e;const l=void 0!==o,i=Object(je.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(o/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&s(t)},300);return Object(r.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:o,step:n,hidden:1===o,disabled:t,onChange:e=>{s(e.target.value),i(e.target.value)}})},_e=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},Ee=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},we=(c(265),c(563)),fe=c(12),ke=c(67);const ye={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var ve=e=>{let{attributeName:t,options:c=[],value:o="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const d=t,{setValidationErrors:b,clearValidationError:p}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),{error:m}=Object(i.useSelect)(e=>({error:e(u.VALIDATION_STORE_KEY).getValidationError(d)||{}}));return Object(fe.useEffect)(()=>{o?p(d):b({[d]:{message:l,hidden:!0}})},[o,d,l,p,b]),Object(fe.useEffect)(()=>()=>{p(d)},[d,p]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(r.createElement)(we.a,{label:Object(te.decodeEntities)(t),value:o||"",options:[ye,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":(null==m?void 0:m.message)&&!(null!=m&&m.hidden)})}),Object(r.createElement)(ke.a,{propertyName:d,elementId:d}))},Se=c(33);const Ce=(e,t,c)=>{const r=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return r;const o=Object.keys(e);return r.filter(e=>o.every(r=>{const o=c[r]||"",n=t["id:"+e].attributes[r];return""===o||null===n||n===o}))};var xe=e=>{let{attributes:t,variationAttributes:c,setRequestParams:o}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(r.useState)(0),[u,d]=Object(r.useState)({}),[b,p]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>((e,t,c)=>{const r={},o=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return o.forEach(o=>{const a=e[o],s={...c,[o]:null},l=n?Ce(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[o]):null;r[o]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:r}=e;return null===t||t.includes(null)||t.includes(r)?{value:r,label:Object(te.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),r})(n,a,u),[u,n,a]);return Object(r.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Se.a)(e))return{};const t=Object.keys(e),c={};return 0===t.length||t.forEach(t=>{const r=e[t],o=r.terms.filter(e=>e.default);var n;o.length>0&&(c[r.name]=null===(n=o[0])||void 0===n?void 0:n.slug)}),c}(t);e&&d({...e}),p(!0)}},[u,t,b]),Object(r.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>Ce(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(r.useEffect)(()=>{o({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[o,l,u]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(r.createElement)(ve,{key:e,attributeName:e,options:m[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Ne=e=>{let{product:t,dispatchers:c}=e;const o=(e=>e?Object(se.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(t.attributes),n=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:c,attributes:r}=e;t["id:"+c]={id:c,attributes:r.reduce((e,t)=>{let{name:c,value:r}=t;return e[c]=r,e},{})}}),t})(t.variations);return 0===Object.keys(o).length||0===n.length?null:Object(r.createElement)(xe,{attributes:o,variationAttributes:n,setRequestParams:c.setRequestParams})},Pe=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Ne,{product:e,dispatchers:s}),Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},Te=()=>Object(r.createElement)(Oe,null),Ie=c(548),Re=()=>Object(r.createElement)(Ie.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Ae=()=>Object(r.createElement)(Re,null);const Be=()=>{const{showFormElements:e,productType:t}=J();return e?"variable"===t?Object(r.createElement)(Pe,null):"grouped"===t?Object(r.createElement)(Ae,null):"external"===t?Object(r.createElement)(Te,null):"simple"===t||"variation"===t?Object(r.createElement)(Ee,null):null:Object(r.createElement)(Oe,null)};t.a=Object(le.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:o}=Object(ae.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(se.isEmpty)(o)});return Object(r.createElement)(ne,{product:o,showFormElements:c},Object(r.createElement)("div",{className:a},Object(r.createElement)(Be,null)))})},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return b}));var r=c(0),o=c(4),n=c.n(o),a=c(80),s=c(26),l=c(23),i=c(99),u=c(82),d=c(42);const b=e=>{var t,c;const{className:o,textAlign:d}=e,{parentClassName:b}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=n()("wc-block-components-product-price",o,m.className,{[b+"__product-price"]:b}),j={...g.style,...m.style};if(!p.id)return Object(r.createElement)(a.a,{align:d,className:O});const h=p.prices,_=Object(s.getCurrencyFromPriceResponse)(h),E=h.price!==h.regular_price,w=n()({[b+"__product-price__value"]:b,[b+"__product-price__value--on-sale"]:E});return Object(r.createElement)(a.a,{align:d,className:O,priceStyle:j,regularPriceStyle:j,priceClassName:w,currency:_,price:h.price,minPrice:null==h||null===(t=h.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==h||null===(c=h.price_range)||void 0===c?void 0:c.max_amount,regularPrice:h.regular_price,regularPriceClassName:n()({[b+"__product-price__regular"]:b})})};t.default=Object(d.withProductDataContext)(b)},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return b}));var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(130),d=c(42);c(263);const b=e=>{const{parentClassName:t}=Object(s.useInnerBlockLayoutContext)(),{product:c}=Object(s.useProductDataContext)(),n=p(c),d=Object(l.a)(e),b=Object(i.a)(e),g=Object(u.a)(e);if(!n)return null;const O={width:n/5*100+"%"},j=Object(o.sprintf)(
19
  /* translators: %f is referring to the average rating value */
20
  Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),n),h=m(c),_={__html:Object(o.sprintf)(
21
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
22
- Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",h,"woo-gutenberg-products-block"),Object(o.sprintf)('<strong class="rating">%f</strong>',n),Object(o.sprintf)('<span class="rating">%d</span>',h))};return Object(r.createElement)("div",{className:a()(d.className,"wc-block-components-product-rating",{[t+"__product-rating"]:t}),style:{...d.style,...b.style,...g.style}},Object(r.createElement)("div",{className:a()("wc-block-components-product-rating__stars",t+"__product-rating__stars"),role:"img","aria-label":j},Object(r.createElement)("span",{style:O,dangerouslySetInnerHTML:_})))},p=e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0},m=e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0};t.default=Object(d.withProductDataContext)(b)},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return E}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(70),u=c(168),d=c(99),b=c(154),p=c(82),m=c(130),g=c(15),O=c(22),j=c(2),h=c(23),_=c(42);c(264);const E=e=>{const{className:t}=e,{parentClassName:c}=Object(h.useInnerBlockLayoutContext)(),{product:r}=Object(h.useProductDataContext)(),o=Object(d.a)(e),a=Object(b.a)(e),l=Object(p.a)(e),i=Object(m.a)(e);return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(n.createElement)(w,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(f,{colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}))},w=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:a,spacingStyles:d}=e;const{id:b,permalink:p,add_to_cart:m,has_options:h,is_purchasable:_,is_in_stock:E}=t,{dispatchStoreEvent:w}=Object(i.a)(),{cartQuantity:f,addingToCart:k,addToCart:y}=Object(u.a)(b,"woocommerce/single-product/"+(b||0)),v=Number.isFinite(f)&&f>0,S=!h&&_&&E,C=Object(g.decodeEntities)((null==m?void 0:m.description)||""),x=v?Object(l.sprintf)(
23
  /* translators: %s number of products in cart. */
24
- Object(l._n)("%d in cart","%d in cart",f,"woo-gutenberg-products-block"),f):Object(g.decodeEntities)((null==m?void 0:m.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),N=S?"button":"a",P={};return S?P.onClick=async()=>{await y(),w("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(j.getSetting)("productsSettings");e&&(window.location.href=O.d)}:(P.href=p,P.rel="nofollow",P.onClick=()=>{w("product-view-link",{product:t})}),Object(n.createElement)(N,o()({"aria-label":C,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:k,added:v}),style:{...c.style,...r.style,...a.style,...d.style},disabled:k},P),x)},f=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:o}=e;return Object(n.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...o.style},disabled:!0})};t.default=Object(_.withProductDataContext)(E)},,,,,,,,,,function(e){e.exports=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":1,"textdomain":"woo-gutenberg-products-block","name":"woocommerce/all-products","title":"All Products","category":"woocommerce","keywords":["WooCommerce"],"description":"Display products from your store in a grid layout.","supports":{"align":["wide","full"],"html":false,"multiple":false},"example":{"attributes":{"isPreview":true}},"attributes":{"columns":{"type":"number"},"rows":{"type":"number"},"alignButtons":{"type":"boolean"},"contentVisibility":{"type":"object"},"orderby":{"type":"string"},"layoutConfig":{"type":"array"},"isPreview":{"type":"boolean","default":false}}}')},,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(180);const o=["a","b","em","i","strong","p","br"],n=["target","href","rel","name","download"],a=(e,t)=>{const c=(null==t?void 0:t.tags)||o,a=(null==t?void 0:t.attr)||n;return Object(r.sanitize)(e,{ALLOWED_TAGS:c,ALLOWED_ATTR:a})}},,,function(e,t){},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(108),o=c(9),n=c(7),a=c(40);const s=e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:c,isLoading:s}=Object(r.a)({...t,query:e}),{value:l}=((e,t)=>{const{namespace:c,resourceName:r,resourceValues:s=[],query:l={}}=t;if(!c||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const i=Object(a.a)(l),u=Object(a.a)(s),{value:d,isLoading:b=!0}=Object(n.useSelect)(e=>{const t=e(o.COLLECTIONS_STORE_KEY),n=["x-wp-total",c,r,i,u];return{value:t.getCollectionHeader(...n),isLoading:t.hasFinishedResolution("getCollectionHeader",n)}},["x-wp-total",c,r,u,i]);return{value:d,isLoading:b}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(l,10),productsLoading:s}}},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return p}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(314),i=c(233),u=c(7),d=c(9);c(196);const b=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},p=e=>{let{className:t,context:c="default",additionalNotices:r=[]}=e;const a=Object(u.useSelect)(e=>e(d.PAYMENT_STORE_KEY).isExpressPaymentMethodActive()),{notices:p}=Object(u.useSelect)(e=>({notices:e("core/notices").getNotices(c)})),{removeNotice:m}=Object(u.useDispatch)("core/notices"),g=p.filter(e=>"snackbar"!==e.type).concat(r);if(!g.length)return null;const O=s()(t,"wc-block-components-notices");return a?null:Object(n.createElement)("div",{className:O},g.map(e=>Object(n.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",b(e)),onRemove:()=>{e.isDismissible&&m(e.id,c)}}),Object(i.a)(e.content))))}},,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"c",(function(){return a})),c.d(t,"b",(function(){return s})),c.d(t,"a",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:c=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!r)return;n||(n=document.body);const s=new r(e,{bubbles:c,cancelable:o,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:c,cancelable:r})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(95),o=(c(16),c(2));const n=e=>{const t=Object.keys(o.defaultAddressFields),c=Object(r.a)(t,{},e.country),n=Object.assign({},e);return c.forEach(t=>{let{key:c="",hidden:r=!1}=t;r&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(98);const o=(e,t)=>function(c){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=r.a.addEventCallback(e,c,o);return t(n),()=>{t(r.a.removeEventCallback(e,n.id))}}},,,,,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(13);const n=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));t.a=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";var r=c(61);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},linkTarget:{type:"string"},productId:{type:"number",default:0}};Object(r.b)()&&(o={...o,align:{type:"string"}}),t.a=o},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r={showProductLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:"full-size"},productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return n}));var r=c(58);const o=async(e,t,c)=>{const o=Object(r.a)(e,t),n=[];for(const e of o)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},n=async(e,t,c)=>{const o=[],n=Object(r.a)(e,t);for(const e of n)try{const t=await Promise.resolve(e.callback(c));if("object"!=typeof t||null===t)continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(r.b)(t)||Object(r.c)(t))return o.push(t),o;o.push(t)}catch(e){return console.error(e),o.push({type:"error"}),o}return o}},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},,,,,,,,,function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(121),s=c(22),l=c(23),i=c(99),u=c(82),d=c(42);c(354),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),d=Object(i.a)(e),b=Object(u.a)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const p=o.short_description?o.short_description:o.description;return p?Object(r.createElement)(a.a,{className:n()(t,d.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:p,maxLength:150,countType:s.o.wordCountType||"words",style:{...d.style,...b.style}}):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(42);c(355),t.default=Object(l.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=n.sku;return l?Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(o.__)("SKU:","woo-gutenberg-products-block")," ",Object(r.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(8),d=c(42);c(356),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",d.className,{[c+"__product-category-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Categories:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"category-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(8),d=c(42);c(357),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,d.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Tags:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"tag-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(42);c(358);t.default=Object(u.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),u=Object(l.a)(e),d=Object(i.a)(e);if(!n.id||!n.is_purchasable)return null;const b=!!n.is_in_stock,p=n.low_stock_remaining,m=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,u.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":b,"wc-block-components-product-stock-indicator--out-of-stock":!b,"wc-block-components-product-stock-indicator--low-stock":!!p,"wc-block-components-product-stock-indicator--available-on-backorder":!!m}),style:{...u.style,...d.style}},p?(e=>Object(o.sprintf)(
25
  /* translators: %d stock amount (number of items in stock for product) */
26
- Object(o.__)("%d left in stock","woo-gutenberg-products-block"),e))(p):((e,t)=>t?Object(o.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(o.__)("In Stock","woo-gutenberg-products-block"):Object(o.__)("Out of Stock","woo-gutenberg-products-block"))(b,m))})},,,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>e.is_purchasable||!1,o=e=>["simple","variable"].includes(e.type||"simple")},,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(1),o=c(22);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(r.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woo-gutenberg-products-block"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:Object(r.__)("Add to cart","woo-gutenberg-products-block"),description:Object(r.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,,,,,,function(e,t,c){e.exports=c(479)},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.r(t),c.d(t,"metadata",(function(){return ot})),c.d(t,"name",(function(){return Yt}));var r=c(0),o=c(10),n=c(119),a=c(538),s=c(61),l=c(1),i=c(4),u=c.n(i),d={category:"woocommerce-product-elements",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return t.isDescendentOfQueryLoop?null:Object(r.createElement)("div",{className:u()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},b=c(315),p=c(3),m=c(11),g=c(5),O=c(8),j=c(13);function h(e){let{level:t}=e;const c={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return c.hasOwnProperty(t)?Object(r.createElement)(j.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(j.Path,{d:c[t]})):null}class _ extends r.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(r.createElement)(h,{level:e}),title:Object(l.sprintf)(
27
  /* translators: %s: heading level e.g: "2", "3", "4" */
28
- Object(l.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:o,onChange:n}=this.props;return Object(r.createElement)(p.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(h,{level:o}),controls:Object(O.range)(t,c).map(e=>this.createLevelControl(e,o,n))})}}var E=_,w=c(194),f=c(97),k=c(151),y=c(23);c(393);var v=e=>t=>c=>{const o=Object(y.useProductDataContext)(),{attributes:n,setAttributes:a}=c,{productId:s}=n,[i,u]=Object(r.useState)(!s);return o.hasContext?Object(r.createElement)(t,c):Object(r.createElement)(r.Fragment,null,i?Object(r.createElement)(p.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(r.createElement)("div",null,e.description),Object(r.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(r.createElement)(f.a,{selected:s||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];a({productId:e[0]?e[0].id:0})}}),Object(r.createElement)(p.Button,{isSecondary:!0,disabled:!s,onClick:()=>{u(!1)}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,null,Object(r.createElement)(k.a,{onClick:()=>u(!0)},Object(l.__)("Switch product…","woo-gutenberg-products-block")))),Object(r.createElement)(t,c)))},S=c(539);const C=Object(l.__)("Product Title","woo-gutenberg-products-block"),x=Object(r.createElement)(n.a,{icon:S.a,className:"wc-block-editor-components-block-icon"}),N=Object(l.__)("Display the title of a product.","woo-gutenberg-products-block");c(394);const P=e=>{let{attributes:t,setAttributes:c}=e;const o=Object(g.useBlockProps)(),{headingLevel:n,showProductLink:a,align:i,linkTarget:u}=t;return Object(r.createElement)("div",o,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(E,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:n,onChange:e=>c({headingLevel:e})}),Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Link settings","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Make title a link","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showProductLink:!a})}),a&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(w.b,t)))};var T=Object(s.b)()?Object(m.compose)([v({icon:x,label:C,description:Object(l.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(P):P,I=c(127);const R={...d,apiVersion:2,title:C,description:N,icon:{src:x},attributes:b.a,edit:T,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},supports:{...d.supports,...Object(s.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(o.registerBlockType)("woocommerce/product-title",R);var A=c(12),B=c(210),L=c(540);const D=Object(l.__)("Product Price","woo-gutenberg-products-block"),F=Object(r.createElement)(n.a,{icon:L.a,className:"wc-block-editor-components-block-icon"}),V=Object(l.__)("Display the price of a product.","woo-gutenberg-products-block");var z=v({icon:F,label:D,description:Object(l.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(g.useBlockProps)(),a={...t,...o},l=Number.isFinite(o.queryId);return Object(A.useEffect)(()=>c({isDescendentOfQueryLoop:l}),[c,l]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(r.createElement)("div",n,Object(r.createElement)(B.default,a)))});let M={productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}};Object(s.b)()&&(M={...M,textAlign:{type:"string"}});var q=M;const H={...d,apiVersion:2,title:D,description:V,parent:["core/group"],ancestor:["@woocommerce/all-products","@woocommerce/single-product","core/post-template"],usesContext:["query","queryId","postId"],icon:{src:F},attributes:q,edit:z,supports:{...d.supports,...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-price"}}};Object(o.registerBlockType)("woocommerce/product-price",H);var G=c(541),Q=c(6),Y=c.n(Q),U=c(2),W=c(126),K=c(195);const $={html:!1,...Object(s.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var J=c(316);const X={apiVersion:2,name:"woocommerce/product-image",title:Object(l.__)("Product Image","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(n.a,{icon:G.a,className:"wc-block-editor-components-block-icon"})},keywords:["WooCommerce"],description:Object(l.__)("Display the main product image.","woo-gutenberg-products-block"),usesContext:["query","queryId","postId"],parent:["@woocommerce/all-products","@woocommerce/single-product","core/post-template"],textdomain:"woo-gutenberg-products-block",attributes:J.a,supports:$,edit:e=>{let{attributes:t,setAttributes:c,context:o}=e;const{showProductLink:n,imageSizing:a,showSaleBadge:s,saleBadgeAlign:i}=t,u=Object(g.useBlockProps)(),d=Number.isFinite(o.queryId);Object(r.useEffect)(()=>c({isDescendentOfQueryLoop:d}),[c,d]);const b=Object(U.getSettingWithCoercion)("is_block_theme_enabled",!1,W.a);return Object(r.useEffect)(()=>{b&&"full-size"!==t.imageSizing&&c({imageSizing:"full-size"})},[t.imageSizing,b,c]),Object(r.createElement)("div",u,Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(l.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:n,onChange:()=>c({showProductLink:!n})}),Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(l.__)("Display a “sale” badge if the product is on-sale.","woo-gutenberg-products-block"),checked:s,onChange:()=>c({showSaleBadge:!s})}),s&&Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,onChange:e=>c({saleBadgeAlign:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"left",label:Object(l.__)("Left","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"center",label:Object(l.__)("Center","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"right",label:Object(l.__)("Right","woo-gutenberg-products-block")})),!b&&Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(r.createInterpolateElement)(Object(l.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(r.createElement)("a",{href:Object(U.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:a,onChange:e=>c({imageSizing:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(l.__)("Full Size","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(l.__)("Cropped","woo-gutenberg-products-block")})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(K.b,Y()({},t,o))))}};Object(o.registerBlockType)("woocommerce/product-image",{...d,...X});var Z=c(211),ee=c(534);const te=Object(l.__)("Product Rating","woo-gutenberg-products-block"),ce=Object(r.createElement)(n.a,{icon:ee.a,className:"wc-block-editor-components-block-icon"}),re=Object(l.__)("Display the average rating of a product.","woo-gutenberg-products-block");var oe=v({icon:ce,label:te,description:Object(l.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(r.createElement)("div",c,Object(r.createElement)(Z.default,t))});const ne={apiVersion:2,title:te,description:re,icon:{src:ce},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-rating"}},edit:oe,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-rating",{...d,...ne});var ae=c(212),se=c(542);const le=Object(l.__)("Add to Cart Button","woo-gutenberg-products-block"),ie=Object(r.createElement)(n.a,{icon:se.a,className:"wc-block-editor-components-block-icon"}),ue={apiVersion:2,title:le,description:Object(l.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block"),parent:["core/group"],ancestor:["@woocommerce/all-products","@woocommerce/single-product","core/post-template"],usesContext:["query","queryId","postId"],icon:{src:ie},attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}},supports:{...Object(s.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button"}},edit:e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(g.useBlockProps)(),a=Number.isFinite(o.queryId);return Object(r.useEffect)(()=>c({isDescendentOfQueryLoop:a}),[c,a]),Object(r.createElement)("div",n,Object(r.createElement)(p.Disabled,null,Object(r.createElement)(ae.default,Y()({},t,o))))}};Object(o.registerBlockType)("woocommerce/product-button",{...d,...ue});var de=c(327),be=c(543);const pe=Object(l.__)("Product Summary","woo-gutenberg-products-block"),me=Object(r.createElement)(n.a,{icon:be.a,className:"wc-block-editor-components-block-icon"}),ge=Object(l.__)("Display a short description about a product.","woo-gutenberg-products-block");c(395);var Oe=v({icon:me,label:pe,description:Object(l.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(de.default,t))});const je={apiVersion:2,title:pe,description:ge,icon:{src:me},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:Oe,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-summary",{...d,...je});var he=c(141),_e=c(532);const Ee=Object(l.__)("On-Sale Badge","woo-gutenberg-products-block"),we=Object(r.createElement)(n.a,{icon:_e.a,className:"wc-block-editor-components-block-icon"}),fe=Object(l.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ke=v({icon:we,label:Ee,description:Object(l.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(he.default,t))});const ye={title:Ee,description:fe,icon:{src:we},apiVersion:2,supports:{html:!1,...Object(s.b)()&&{color:{gradients:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:ke,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-sale-badge",{...d,...ye});var ve=c(109),Se=c(328),Ce=Object(r.createElement)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const xe=Object(l.__)("Product SKU","woo-gutenberg-products-block"),Ne=Object(r.createElement)(n.a,{icon:Ce,className:"wc-block-editor-components-block-icon"}),Pe={title:xe,description:Object(l.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Ne},attributes:{productId:{type:"number",default:0}},edit:v({icon:Ne,label:xe,description:Object(l.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(ve.a,null),Object(r.createElement)(Se.default,t))})};Object(s.c)("woocommerce/product-sku",{...d,...Pe});var Te=c(329),Ie=c(544);const Re=Object(l.__)("Product Category List","woo-gutenberg-products-block"),Ae=Object(r.createElement)(n.a,{icon:Ie.a,className:"wc-block-editor-components-block-icon"}),Be=Object(l.__)("Display the list of categories that are assigned to a product.","woo-gutenberg-products-block");var Le=v({icon:Ae,label:Re,description:Object(l.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ve.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Te.default,t)))});const De={...d,apiVersion:2,title:Re,description:Be,icon:{src:Ae},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,link:!0,background:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-category-list"}},save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},edit:Le};Object(s.c)("woocommerce/product-category-list",De);var Fe=c(330),Ve=c(537);const ze=Object(l.__)("Product Tag List","woo-gutenberg-products-block"),Me=Object(r.createElement)(n.a,{icon:Ve.a,className:"wc-block-editor-components-block-icon"}),qe=Object(l.__)("Display the list of tags that are assigned to a product.","woo-gutenberg-products-block");var He=v({icon:Me,label:ze,description:Object(l.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ve.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Fe.default,t)))});const Ge={apiVersion:2,title:ze,description:qe,icon:{src:Me},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-tag-list"}},edit:He,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-tag-list",{...d,...Ge});var Qe=c(331),Ye=c(545);const Ue=Object(l.__)("Product Stock Indicator","woo-gutenberg-products-block"),We=Object(r.createElement)(n.a,{icon:Ye.a,className:"wc-block-editor-components-block-icon"}),Ke=Object(l.__)("Display product stock status.","woo-gutenberg-products-block");var $e=v({icon:We,label:Ue,description:Object(l.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ve.a,null),Object(r.createElement)(Qe.default,t))});const Je={apiVersion:2,title:Ue,description:Ke,icon:{src:We},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:$e,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-stock-indicator",{...d,...Je});var Xe=c(359),Ze=(c(236),c(209)),et=c(278);const tt=Object(l.__)("Add to Cart","woo-gutenberg-products-block"),ct=Object(r.createElement)(n.a,{icon:et.a,className:"wc-block-editor-components-block-icon"}),rt={title:tt,description:Object(l.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:ct},edit:v({icon:ct,label:tt,description:Object(l.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:o}=Object(y.useProductDataContext)(),{className:n,showFormElements:a}=t;return Object(r.createElement)("div",{className:u()(n,"wc-block-components-product-add-to-cart")},Object(r.createElement)(ve.a,{productId:o.id}),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout","woo-gutenberg-products-block")},Object(Xe.b)(o)?Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Display form elements","woo-gutenberg-products-block"),help:Object(l.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showFormElements:!a})}):Object(r.createElement)(p.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(l.__)("This product does not support the block based add to cart form. A link to the product page will be shown instead.","woo-gutenberg-products-block")))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Ze.a,t)))}),attributes:c(318).a};Object(s.c)("woocommerce/product-add-to-cart",{...d,...rt});var ot=c(222);const nt=(e,t)=>{const{className:c,contentVisibility:r}=t;return u()(e,c,{"has-image":r&&r.image,"has-title":r&&r.title,"has-rating":r&&r.rating,"has-price":r&&r.price,"has-button":r&&r.button})},{attributes:at}=ot;var st=[{attributes:Object.assign({},at,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(r.createElement)("div",Y()({className:nt("wc-block-all-products",t)},c),Object(r.createElement)(g.InnerBlocks.Content,null))}}],lt=c(24),it=c.n(lt),ut=c(7),dt=c(64),bt=c(509),pt=c(382),mt=c(22),gt=c(258);const Ot=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],jt=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?jt(e.innerBlocks):[]}]):[];var ht=c(29);c(401);var _t=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:n=3,onPageChange:a,totalPages:s}=e,{minIndex:i,maxIndex:d}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),n=Math.min(Math.ceil(t+(r-(t-o))),c-1);return{minIndex:Math.max(Math.floor(t-(r-(n-t))),2),maxIndex:n}})(n,t,s);const b=c&&Boolean(1!==i),p=c&&Boolean(d!==s),m=c&&Boolean(i&&i>3),g=c&&Boolean(d&&d<s-2);b&&3===i&&(i-=1),p&&d===s-2&&(d+=1);const O=[];if(i&&d)for(let e=i;e<=d;e++)O.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(ht.a,{screenReaderLabel:Object(l.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t-1),title:Object(l.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(ht.a,{label:"←",screenReaderLabel:Object(l.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>a(1),disabled:1===t},Object(r.createElement)(ht.a,{label:"1",screenReaderLabel:Object(l.sprintf)(
29
  /* translators: %d is the page number (1, 2, 3...). */
30
  Object(l.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(r.createElement)("button",{key:e,className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>a(e),disabled:t===e},Object(r.createElement)(ht.a,{label:e.toString(),screenReaderLabel:Object(l.sprintf)(
31
  /* translators: %d is the page number (1, 2, 3...). */
32
  Object(l.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),p&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===s,"wc-block-components-pagination__page--active":t===s}),onClick:()=>a(s),disabled:t===s},Object(r.createElement)(ht.a,{label:s.toString(),screenReaderLabel:Object(l.sprintf)(
33
  /* translators: %d is the page number (1, 2, 3...). */
34
- Object(l.__)("Page %d","woo-gutenberg-products-block"),s)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t+1),title:Object(l.__)("Next page","woo-gutenberg-products-block"),disabled:t>=s},Object(r.createElement)(ht.a,{label:"→",screenReaderLabel:Object(l.__)("Next page","woo-gutenberg-products-block")})))},Et=c(104),wt=c(53),ft=c(244),kt=c(70);c(402);const yt=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var vt=c(48),St=c(184),Ct=()=>{const{parentClassName:e}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(n.a,{className:e+"__no-products-image",icon:St.a,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(l.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(l.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},xt=c(536),Nt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:c+"__no-products"},Object(r.createElement)(n.a,{className:c+"__no-products-image",icon:xt.a,size:100}),Object(r.createElement)("strong",{className:c+"__no-products-title"},Object(l.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:c+"__no-products-description"},Object(l.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(l.__)("Reset Search","woo-gutenberg-products-block")))},Pt=c(123);c(400);var Tt=e=>{let{onChange:t,value:c}=e;return Object(r.createElement)(Pt.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(l.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(l.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(l.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(l.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(l.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(l.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(l.__)("Order products by","woo-gutenberg-products-block"),value:c})};const It=(e,t,c,o)=>{if(!c)return;const n=Object(bt.a)(e);return c.map((c,a)=>{let[s,l={}]=c,i=[];l.children&&l.children.length>0&&(i=It(e,t,l.children,o));const u=n[s];if(!u)return null;const d=t.id||0,b=["layout",s,a,o,d];return Object(r.createElement)(r.Suspense,{key:b.join("_"),fallback:Object(r.createElement)("div",{className:"wc-block-placeholder"})},Object(r.createElement)(u,Y()({},l,{children:i,product:t})))})};var Rt=Object(m.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:o}=e;const{layoutConfig:n}=c,{parentClassName:a,parentName:s}=Object(y.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=u()(a+"__product","wc-block-layout",{"is-loading":l});return Object(r.createElement)("li",{className:i,"aria-hidden":l},It(s,t,n,o))});c(399);const At=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},Bt=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(O.isEqual)(t,r)&&Number.isFinite(c)};var Lt,Dt=(Lt=e=>{let{attributes:t,currentPage:c,onPageChange:o,onSortChange:n,sortValue:a,scrollToTop:s}=e;const[i,d]=Object(wt.b)("attributes",[]),[b,p]=Object(wt.b)("stock_status",[]),[m,g]=Object(wt.b)("rating",[]),[j,h]=Object(wt.b)("min_price"),[_,E]=Object(wt.b)("max_price"),[w]=Object(wt.c)((e=>{let{sortValue:t,currentPage:c,attributes:r}=e;const{columns:o,rows:n}=r;return{...At(t),catalog_visibility:"catalog",per_page:o*n,page:c}})({attributes:t,sortValue:a,currentPage:c})),{products:f,totalProducts:k,productsLoading:v}=Object(ft.a)(w),{parentClassName:S,parentName:C}=Object(y.useInnerBlockLayoutContext)(),x=(e=>{const{order:t,orderby:c,page:r,per_page:o,...n}=e;return n||{}})(w),{dispatchStoreEvent:N}=Object(kt.a)(),P=Object(Et.a)({totalQuery:x,totalProducts:k},Bt);Object(r.useEffect)(()=>{N("product-list-render",{products:f,listName:C})},[f,C,N]),Object(r.useEffect)(()=>{Object(O.isEqual)(x,null==P?void 0:P.totalQuery)||(o(1),null!=P&&P.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(vt.speak)(Object(l.__)("No products found","woo-gutenberg-products-block")):Object(vt.speak)(Object(l.sprintf)(
35
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
36
- Object(l._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(k))},[null==P?void 0:P.totalQuery,k,o,x]);const{contentVisibility:T}=t,I=t.columns*t.rows,R=!Number.isFinite(k)&&Number.isFinite(null==P?void 0:P.totalProducts)&&Object(O.isEqual)(x,null==P?void 0:P.totalQuery)?Math.ceil(((null==P?void 0:P.totalProducts)||0)/I):Math.ceil(k/I),A=f.length?f:Array.from({length:I}),B=0!==f.length||v,L=i.length>0||b.length>0||m.length>0||Number.isFinite(j)||Number.isFinite(_);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return u()(S,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==T?void 0:T.orderBy)&&B&&Object(r.createElement)(Tt,{onChange:n,value:a}),!B&&L&&Object(r.createElement)(Nt,{resetCallback:()=>{d([]),p([]),g([]),h(null),E(null)}}),!B&&!L&&Object(r.createElement)(Ct,null),B&&Object(r.createElement)("ul",{className:u()(S+"__products",{"is-loading-products":v})},A.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(r.createElement)(Rt,{key:e.id||c,attributes:t,product:e})}))),R>1&&Object(r.createElement)(_t,{currentPage:c,onPageChange:e=>{s({focusableSelector:"a, button"}),o(e)},totalPages:R}))},e=>{const t=Object(r.useRef)(null);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(r.createElement)(Lt,Y()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const r=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(r.length){const e=r[0];yt(e),null==e||e.focus()}else yt(e)})(e,c):yt(e))})(t.current,e)}})))}),Ft=e=>{let{attributes:t}=e;const[c,o]=Object(r.useState)(1),[n,a]=Object(r.useState)(t.orderby);return Object(r.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(r.createElement)(Dt,{attributes:t,currentPage:c,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),o(1)},sortValue:n})},Vt=c(150),zt=c(251);class Mt extends A.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Vt.a:Object(r.createElement)(y.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(zt.a,{context:"wc/all-products"}),Object(r.createElement)(Ft,{attributes:e,urlParameterSuffix:t}))}}var qt=Mt;c(398);class Ht extends r.Component{constructor(){super(...arguments),it()(this,"state",{isEditing:!1,innerBlocks:[]}),it()(this,"blockMap",Object(bt.a)("woocommerce/all-products")),it()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),it()(this,"getTitle",()=>Object(l.__)("All Products","woo-gutenberg-products-block")),it()(this,"getIcon",()=>Object(r.createElement)(n.a,{icon:a.a})),it()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(l.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),it()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:o,alignButtons:n}=e;return Object(r.createElement)(g.InspectorControls,{key:"inspector"},Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(dt.a,{columns:c,rows:o,alignButtons:n,setAttributes:t,minColumns:Object(U.getSetting)("min_columns",1),maxColumns:Object(U.getSetting)("max_columns",6),minRows:Object(U.getSetting)("min_rows",1),maxRows:Object(U.getSetting)("max_rows",6)})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(r.createElement)(p.SelectControl,{label:Object(l.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(l.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(l.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(l.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(l.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(l.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(l.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),it()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit the layout of each product","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),it()(this,"renderEditMode",()=>{const e={template:this.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(this.blockMap)};return 0!==this.props.attributes.layoutConfig.length&&(e.renderAppender=!1),Object(r.createElement)(p.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(l.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(r.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(r.createElement)(p.Tip,null,Object(l.__)("Edit the blocks inside the example below to change the content displayed for all products within the product grid.","woo-gutenberg-products-block")),Object(r.createElement)(y.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(r.createElement)("ul",{className:"wc-block-grid__products"},Object(r.createElement)("li",{className:"wc-block-grid__product"},Object(r.createElement)(y.ProductDataContextProvider,{product:pt.a[0]},Object(r.createElement)(g.InnerBlocks,e)))))),Object(r.createElement)("div",{className:"wc-block-all-products__actions"},Object(r.createElement)(p.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:jt(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(l.__)("Done","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,{innerBlocks:c}=this.state;t(e.clientId,c,!1),this.togglePreview()}},Object(l.__)("Cancel","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__reset-button",icon:Object(r.createElement)(n.a,{icon:a.a}),label:Object(l.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];Ot.map(e=>{let[t,r]=e;return c.push(Object(o.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(l.__)("Reset Layout","woo-gutenberg-products-block")))))}),it()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,o=this.getTitle(),n=this.getIcon();return c?Object(r.createElement)(p.Disabled,null,Object(r.createElement)(qt,{attributes:e})):((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(l.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(o,n)}),it()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),o=this.getIcon();return 0===mt.o.productCount?((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(r.createElement)("p",null,Object(l.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:U.ADMIN_URL+"post-new.php?post_type=product"},Object(l.__)("Add new product","woo-gutenberg-products-block")+" ",Object(r.createElement)(n.a,{icon:gt.a})),Object(r.createElement)(p.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))))(c,o):Object(r.createElement)("div",{className:nt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Gt=Object(m.compose)(p.withSpokenMessages,Object(ut.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(ut.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Ht),Qt={columns:Object(U.getSetting)("default_columns",3),rows:Object(U.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Ot,isPreview:!1};const{name:Yt}=ot,Ut={icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},edit:Gt,save:function(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const o={"data-attributes":JSON.stringify(c)};return Object(r.createElement)("div",Y()({className:nt("wc-block-all-products",t)},o),Object(r.createElement)(g.InnerBlocks.Content,null))},deprecated:st,defaults:Qt};Object(o.registerBlockType)(Yt,Ut)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(36),o=c(0),n=c(22);c.p=n.l,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(28)]).then(c.bind(null,210)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(25)]).then(c.bind(null,567)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(38)]).then(c.bind(null,568)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(30)]).then(c.bind(null,211)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(21)]).then(c.bind(null,212)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(35)]).then(c.bind(null,327)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(31)]).then(c.bind(null,141)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(33).then(c.bind(null,328)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(24)]).then(c.bind(null,329)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(37)]).then(c.bind(null,330)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(34)]).then(c.bind(null,331)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(4),c.e(19)]).then(c.bind(null,569)))});const a=e=>Object(r.getRegisteredBlockComponents)(e)}]);
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],i=t[2],d=0,b=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);b.length;)b.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],r=!0,s=1;s<c.length;s++){var l=c[s];0!==o[l]&&(r=!1)}r&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var r={},o={6:0,1:0,2:0,3:0,4:0,21:0,24:0,28:0,30:0,31:0,33:0,34:0,35:0,37:0},n=[];function a(t){if(r[t])return r[t].exports;var c=r[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,a),c.l=!0,c.exports}a.e=function(e){var t=[],c=o[e];if(0!==c)if(c)t.push(c[2]);else{var r=new Promise((function(t,r){c=o[e]=[t,r]}));t.push(c[2]=r);var n,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(e){return a.p+""+({1:"product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00",2:"product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01",3:"product-button--product-image--product-rating--product-sale-badge--product-title",4:"product-add-to-cart--product-button--product-image--product-title",19:"product-add-to-cart",21:"product-button",24:"product-category-list",25:"product-image",28:"product-price",30:"product-rating",31:"product-sale-badge",33:"product-sku",34:"product-stock-indicator",35:"product-summary",37:"product-tag-list",38:"product-title"}[e]||e)+".js?ver="+{1:"3f52017722306fd43b44",2:"f5853b53dfe08fb0c154",3:"33d474ed5cfa2b677987",4:"dc3998856c2fac179adb",19:"a8c6b71283dd74f10d61",21:"45951281c26593ed33b2",24:"354311380a8611028a3a",25:"51326ebcea6208753f1e",28:"48524c74c78f57b14359",30:"e9f66368ad2720d6c1d2",31:"026b456a5451ee351d99",33:"7ec1f49ffd46d608c4bf",34:"9a2bc5fa9cc942c6a6cd",35:"fb237ae26e60e973f880",37:"0a4d7d8bde8b701d447a",38:"cf8cc68a1672d75993c3"}[e]}(e);var l=new Error;n=function(t){s.onerror=s.onload=null,clearTimeout(i);var c=o[e];if(0!==c){if(c){var r=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+r+": "+n+")",l.name="ChunkLoadError",l.type=r,l.request=n,c[1](l)}o[e]=void 0}};var i=setTimeout((function(){n({type:"timeout",target:s})}),12e4);s.onerror=s.onload=n,document.head.appendChild(s)}return Promise.all(t)},a.m=e,a.c=r,a.d=function(e,t,c){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(c,r,function(t){return e[t]}.bind(null,r));return c},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e};var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var u=l;return n.push([392,0]),c()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wp.components},,function(e,t){e.exports=window.wp.blockEditor},,function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.url},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a})),c.d(t,"c",(function(){return l})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var r=c(0),o=c(8),n=c(1);const a={clear:Object(n.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(n.__)("No items found.","woo-gutenberg-products-block"),
2
  /* Translators: %s search term */
3
  noResults:Object(n.__)("No results for %s","woo-gutenberg-products-block"),search:Object(n.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(n.sprintf)(
4
  /* translators: Number of items selected from list. */
5
+ Object(n._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(n.__)("Search results updated.","woo-gutenberg-products-block")},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=a(r[e.parent]);return[...t,e.name]},s=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}}),l=s(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||l.push(...s(c||[]))}),l},l=(e,t,c)=>{if(!t)return c?s(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?s(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(c).map((e,t)=>c.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},,function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return a})),c.d(t,"l",(function(){return s})),c.d(t,"n",(function(){return l})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return d})),c.d(t,"g",(function(){return b})),c.d(t,"k",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return _}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,b=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{})},,function(e,t){e.exports=window.wc.wcBlocksSharedContext},,function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"i",(function(){return b})),c.d(t,"f",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return j}));var r=c(16),o=c(14),n=c.n(o),a=c(8),s=c(2),l=c(21);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(r.addQueryArgs)("/wc/store/v1/products",{...a,...o})];return n&&t.length&&s.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:o});return Promise.all(s.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),d=()=>n()({path:"wc/store/v1/products/attributes"}),b=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),p=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(s.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/v1/products/categories/"+e}),O=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),j=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=a||r.Fragment,l&&i&&c!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,c))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));var r=c(1),o=c(15);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(o.decodeEntities)(e.message):Object(r.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(35);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t){e.exports=window.wp.escapeHtml},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(6),o=c.n(r),n=c(0),a=c(19);const s=e=>{let{countLabel:t,className:c,depth:r=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:d,search:b="",...p}=e;const m=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,j=p.name||"search-list-item-"+s,h=`${j}-${l.id}`;return Object(n.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(n.createElement)("input",o()({type:"checkbox",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(a.b)(l.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(a.d)(l.name,b))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(133),s=c(4),l=c.n(s);c(139);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**r.minorUnit;if(!Number.isFinite(p))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,o()({className:m,displayType:u},g,{value:p,onValueChange:O}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(25),n=c.n(o);function a(e){const t=Object(r.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var r=c(8),o=c(0),n=c(9),a=c(7),s=c(15),l=c(267),i=c(85),u=c(266);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},g={...m,email:""},O={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},j=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),h={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:n.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:O,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:n.EMPTY_EXTENSIONS},_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:c}=Object(i.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();p();const b=Object(a.useSelect)((e,c)=>{let{dispatch:r}=c;if(!u)return h;if(t)return{cartCoupons:s.coupons,cartItems:s.items,crossSellsProducts:s.cross_sells,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingData:g,billingAddress:g,shippingAddress:m,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:O}=r(n.CART_STORE_KEY),_=j(a.billingAddress),E=a.needsShipping?j(a.shippingAddress):_,w=a.fees.length>0?a.fees.map(e=>j(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,crossSellsProducts:a.crossSells,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingData:Object(l.a)(_),billingAddress:Object(l.a)(_),shippingAddress:Object(l.a)(E),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:O}},[u]);return d.current&&Object(r.isEqual)(d.current,b)||(d.current=b),d.current}},function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.hooks},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},,,,,,function(e,t){e.exports=window.wp.deprecated},function(e,t,c){"use strict";c.d(t,"a",(function(){return d})),c.d(t,"b",(function(){return b})),c.d(t,"c",(function(){return p}));var r=c(9),o=c(7),n=c(0),a=c(25),s=c.n(a),l=c(40),i=c(103),u=c(46);const d=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[r,o]=d(t),a=Object(l.a)(r),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[r,o]:[e,o]}},,,,,function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var r=c(10),o=c(21);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=()=>o.n>2,s=()=>o.n>1},function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"e",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"b",(function(){return l})),c.d(t,"c",(function(){return i}));var r=c(33);const o=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];let n,a;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(a||(a={}));const s=(e,t)=>Object(r.a)(e)&&"type"in e&&e.type===t,l=e=>s(e,n.ERROR),i=e=>s(e,n.FAIL)},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(138),s=c(4),l=c.n(s),i=c(96);c(161),t.a=e=>{let{className:t,showSpinner:c=!1,children:r,variant:s="contained",...u}=e;const d=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,o()({className:d},u),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},r))}},function(e,t){e.exports=window.wp.autop},,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(8),a=c(3);t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);s({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,d,b);s({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(r.createElement)(a.ToggleControl,{label:Object(o.__)("Align the last block to the bottom","woo-gutenberg-products-block"),help:l?Object(o.__)("Align the last block to the bottom.","woo-gutenberg-products-block"):Object(o.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:()=>s({alignButtons:!l})}))}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(7),n=c(9);c(187);const a=e=>{let{errorMessage:t="",propertyName:c="",elementId:a=""}=e;const{validationError:s,validationErrorId:l}=Object(o.useSelect)(e=>{const t=e(n.VALIDATION_STORE_KEY);return{validationError:t.getValidationError(c),validationErrorId:t.getValidationErrorId(a)}});if(!t||"string"!=typeof t){if(null==s||!s.message||null!=s&&s.hidden)return null;t=s.message}return Object(r.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(r.createElement)("p",{id:l},t))};t.b=a},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(45),o=c(0),n=c(41);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},,,function(e,t){e.exports=window.wp.dom},,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(38),a=c(4),s=c.n(a),l=c(26);c(160);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
+ Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:a,regularPrice:l,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:o,format:a="<price/>",maxPrice:l,minPrice:d,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}=e;const h=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=g&&b!==g;let E=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",p)});return _?E=Object(r.createElement)(u,{currency:o,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}):void 0!==d&&void 0!==l?E=Object(r.createElement)(i,{currency:o,maxPrice:l,minPrice:d,priceClassName:p,priceStyle:m}):b&&(E=Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",p),currency:o,value:b,style:m})),Object(r.createElement)("span",{className:h},Object(r.createInterpolateElement)(a,{price:E}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(33),o=c(114);const n=e=>{const t=Object(r.a)(e)?e:{},c=Object(o.a)(t.style),n=Object(r.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:n.fontSize,lineHeight:n.lineHeight,fontWeight:n.fontWeight,textTransform:n.textTransform,fontFamily:t.fontFamily}}}},,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(37),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:r,isLoading:l,onSelect:u,disabled:d,...b}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,o()({},b,{key:c.id,className:t,isSelected:r,item:c,onSelect:u,isSingle:!0,disabled:d})),r&&l&&Object(n.createElement)("div",{key:"loading",className:i()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(n.createElement)(s.Spinner,null)))}},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var r=c(0),o=c(7);const n=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(r.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(o.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(r.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(r.createElement)(n.Provider,{value:u},t)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,,,,function(e,t){e.exports=window.wp.wordcount},,,,function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(171),a=c(86);const s=Object(r.getSetting)("countryLocale",{}),l=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
8
  /* translators: %s Field label. */
9
+ Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,l(c)]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{})]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=c&&void 0!==i[c]?i[c]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var r=c(0);c(162),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(8),l=c(37),i=c(100),u=c(11),d=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Array.isArray(t)?Object(n.createElement)(e,this.props):Object(n.createElement)(e,o()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),b=c(190),p=c(24),m=c.n(p),g=c(25),O=c.n(g),j=c(27),h=c(29),_=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),m()(this,"state",{error:null,loading:!1,variations:{}}),m()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const r=this.getExpandedProduct();if(!r||c[r])return;const o=e.find(e=>e.id===r);o.variations&&0!==o.variations.length?(this.setState({loading:!0}),Object(j.g)(r).then(e=>{const t=e.map(e=>({...e,parent:r}));this.setState({variations:{...this.state.variations,[r]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(h.a)(e);this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:null})})}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:c,showVariations:r}=this.props;r&&(!O()(e.selected,c)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){var t;const{products:c}=this.props;return null===(t=c.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0])||void 0===t?void 0:t.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem)),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:c}=this.props,{error:r,loading:a,variations:s}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:r||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return m()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),E=c(34),w=c(4),f=c.n(w),k=c(84);c(140);const y={list:Object(a.__)("Products","woo-gutenberg-products-block"),noItems:Object(a.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(a.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(a.__)("Product search results updated.","woo-gutenberg-products-block")},v=e=>{let{expandedProduct:t,error:c,instanceId:r,isCompact:u,isLoading:d,onChange:b,onSearch:p,products:m,renderItem:g,selected:O,showVariations:j,variations:h,variationsLoading:_}=e;if(c)return Object(n.createElement)(E.a,{error:c});const w=[...m,...h&&h[t]?h[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:w,isCompact:u,isLoading:d,isSingle:!0,selected:w.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:b,renderItem:g||(j?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:b}=e,p=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=f()("woocommerce-search-product__item","woocommerce-search-list__item","depth-"+i,"has-count",{"is-searching":c.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":p>0});if(!t.breadcrumbs.length)return Object(n.createElement)(k.a,o()({},e,{className:f()(m,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{b(t)()},isLoading:d||_,countLabel:t.variations.length>0?Object(a.sprintf)(
10
  /* translators: %1$d is the number of variations of a product product. */
11
  Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
12
  /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
13
+ Object(a._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,"woo-gutenberg-products-block"),t.name,t.variations.length)}));const g=Object(s.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(n.createElement)(l.a,o()({},g,{className:m,name:"variations-"+r}))}:null),onSearch:p,messages:y,isHierarchical:!0})};v.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=d(Object(b.a)(_(Object(u.withInstanceId)(v))))},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var r=c(8);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(r.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:c,id:r,callback:n,priority:s}=arguments.length>1?arguments[1]:void 0;const l=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return l.set(r,{priority:s,callback:n}),{...e,[c]:l};case o.REMOVE_EVENT_CALLBACK:return l.delete(r),{...e,[c]:l}}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(58),n=c(33),a=c(114);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})}},function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(118),i=c(524),u=c(4),d=c.n(u),b=c(11),p=c(19),m=c(37),g=c(523),O=c(15);const j=e=>{let{id:t,label:c,popoverContents:r,remove:o,screenReaderLabel:i,className:u=""}=e;const[p,m]=Object(n.useState)(!1),h=Object(b.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const _=d()("woocommerce-tag",u,{"has-remove":!!o}),E="woocommerce-tag__label-"+h,w=Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},i),Object(n.createElement)("span",{"aria-hidden":"true"},c));return Object(n.createElement)("span",{className:_},r?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:E,onClick:()=>m(!0)},w):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:E},w),r&&p&&Object(n.createElement)(s.Popover,{onClose:()=>m(!1)},r),o&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(a.sprintf)(// Translators: %s label.
14
+ Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":E},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const _=e=>Object(n.createElement)(m.b,e),E=e=>{const{list:t,selected:c,renderItem:r,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const d=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:d,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(E,o()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:l,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":o.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...s}=e;const{messages:u,renderItem:d,selected:b,isSingle:p}=s,m=d||_;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(l.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(a.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(E,{list:t,selected:b,renderItem:m,onSelect:r,instanceId:o,isSingle:p,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:a,isSingle:l,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,_]=Object(n.useState)(""),E=Object(b.useInstanceId)(k),y=Object(n.useMemo)(()=>({...p.a,...u}),[u]),v=Object(n.useMemo)(()=>Object(p.c)(i,h,r),[i,h,r]);Object(n.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(n.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(n.useCallback)(e=>()=>{l&&m([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});m([...O.slice(0,t),...O.slice(t+1)])},[l,O,m]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?m(l?[e]:[...O,e]):S(e.id)()},[l,S,m,O]);return Object(n.createElement)("div",{className:d()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,o()({},e,{onRemove:S,messages:y})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:y.search,type:"search",value:h,onChange:e=>_(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,o()({},e,{search:h,filteredList:v,messages:y,onSelect:C,instanceId:E})))};Object(s.withSpokenMessages)(k)},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(12);function o(e,t){const c=Object(r.useRef)();return Object(r.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(15),s=c(4),l=c.n(s);c(159),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:b,...p}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",o()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:m,href:s,target:i},p,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:d}))}},function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(9),o=c(7),n=c(0),a=c(40),s=c(142);const l=e=>{const{namespace:t,resourceName:c,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(n.useRef)({results:[],isLoading:!0}),b=Object(a.a)(i),p=Object(a.a)(l),m=Object(s.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),n=[t,c,b,p],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,c,p,b,u]);return null!==g&&(d.current=g),d.current}},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(118),a=c(258),s=c(2),l=c(5),i=c(23);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(r.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(o.__)("Edit this product's details","woo-gutenberg-products-block"),Object(r.createElement)(n.a,{icon:a.a,size:16}))),Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(o.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(86),o=c(33);const n=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},,,,,,function(e,t,c){"use strict";var r=c(0),o=c(91),n=c(61);const a=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},s=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),l=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,i=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"&hellip;";const r=s(e),o=r.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(o,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const o=s(e),a=o.slice(0,t);if(c)return Object(n.autop)(l(a,r));const i=a.match(/([\s]+)/g),u=i?i.length:0,d=o.slice(0,t+u);return Object(n.autop)(l(d,r))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:d={}}=e;const b=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const r=Object(n.autop)(e),s=Object(o.count)(r,c);if(s<=t)return r;const l=a(r),d=Object(o.count)(l,c);return d<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(r.createElement)(r.RawHTML,{style:d,className:l},b)}},,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(28),s=c(11);c(165),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u=""}=e;const d="wc-block-components-sort-select__select-"+c;return Object(r.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(5);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(5),o=c(58),n=c(33),a=c(129),s=c(114);const l=e=>{if(!Object(o.b)()||!Object(a.a)())return{style:{}};const t=Object(n.a)(e)?e:{},c=Object(s.a)(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})}},,,,,,,function(e,t){},function(e,t){},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return m}));var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(23),i=c(154),u=c(99),d=c(82),b=c(132),p=c(42);c(260);const m=e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=Object(d.a)(e),j=Object(b.a)(e);if(!p.id||!p.on_sale)return null;const h="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,h,{[n+"__product-onsale"]:n},g.className,m.className),style:{...g.style,...m.style,...O.style,...j.style}},Object(r.createElement)(s.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))};t.default=Object(p.withProductDataContext)(m)},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(191),t.a=function(e){let{className:t="",...c}=e;const r=l()("wc-block-text-toolbar-button",t);return Object(n.createElement)(a.Button,o()({className:r},c))}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(58),n=c(33),a=c(114);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var r=c(0),o=c(7),n=c(9),a=c(15),s=c(41);const l=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},i=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:i}=Object(s.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(r.useState)(!1),m=Object(r.useRef)(l(c,e));return Object(r.useEffect)(()=>{const t=l(c,e);t!==m.current&&(m.current=t)},[c,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:i,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),t(e,c).then(()=>{d("add-to-cart")}).catch(e=>{u(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,,,,,,,,,,,,,function(e,t){},,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(21),s=c(27),l=c(117),i=c(29);t.a=e=>t=>{let{selected:c,...r}=t;const[u,d]=Object(n.useState)(!0),[b,p]=Object(n.useState)(null),[m,g]=Object(n.useState)([]),O=a.o.productCount>100,j=async e=>{const t=await Object(i.a)(e);p(t),d(!1)},h=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:h.current}).then(e=>{g(e),d(!1)}).catch(j)},[h]);const _=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),d(!1)}).catch(j)},400),E=Object(n.useCallback)(e=>{d(!0),_(e)},[d,_]);return Object(n.createElement)(e,o()({},r,{selected:c,error:b,products:m,isLoading:u,onSearch:O?E:null}))}},function(e,t){},,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return g}));var r=c(0),o=c(4),n=c.n(o),a=c(23),s=c(58),l=c(42),i=c(105),u=c(70),d=c(99),b=c(132),p=c(82);c(261);const m=e=>{let{children:t,headingLevel:c,elementType:o="h"+c,...n}=e;return Object(r.createElement)(o,n,t)},g=e=>{const{className:t,headingLevel:c=2,showProductLink:o=!0,linkTarget:l,align:g}=e,{parentClassName:O}=Object(a.useInnerBlockLayoutContext)(),{product:j}=Object(a.useProductDataContext)(),{dispatchStoreEvent:h}=Object(u.a)(),_=Object(d.a)(e),E=Object(b.a)(e),w=Object(p.a)(e);return j.id?Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:j.name,permalink:j.permalink,target:l,onClick:()=>{h("product-view-link",{product:j})}})):Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}})};t.b=Object(l.withProductDataContext)(g)},function(e,t,c){"use strict";c.d(t,"a",(function(){return j}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(23),d=c(82),b=c(154),p=c(132),m=c(42),g=c(70),O=c(141);c(262);const j=e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:m,isLoading:j}=Object(u.useProductDataContext)(),{dispatchStoreEvent:E}=Object(g.a)(),w=Object(d.a)(e),f=Object(b.a)(e),k=Object(p.a)(e);if(!m.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},f.className),style:{...w.style,...f.style,...k.style}},Object(n.createElement)(h,null));const y=!!m.images.length,v=y?m.images[0]:null,S=r?"a":n.Fragment,C=Object(a.sprintf)(
15
  /* translators: %s is referring to the product name */
16
+ Object(a.__)("Link to %s","woo-gutenberg-products-block"),m.name),x={href:m.permalink,...!y&&{"aria-label":C},onClick:()=>{E("product-view-link",{product:m})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},f.className),style:{...w.style,...f.style,...k.style}},Object(n.createElement)(S,r&&x,!!o&&Object(n.createElement)(O.default,{align:s,product:m}),Object(n.createElement)(_,{fallbackAlt:m.name,image:v,loaded:!j,showFullSize:"cropped"!==c})))},h=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),_=e=>{let{image:t,loaded:c,showFullSize:r,fallbackAlt:a}=e;const{thumbnail:s,src:l,srcset:i,sizes:u,alt:d}=t||{},b={alt:d||a,hidden:!c,src:s,...r&&{src:l,srcSet:i,sizes:u}};return Object(n.createElement)(n.Fragment,null,b.src&&Object(n.createElement)("img",o()({"data-testid":"product-image"},b)),!t&&Object(n.createElement)(h,null))};t.b=Object(m.withProductDataContext)(j)},function(e,t){},,,,,,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(1),s=c(40),l=c(359),i=c(7),u=c(9);const d={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},b={status:d.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},p={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:m,SET_IDLE:g,SET_DISABLED:O,SET_PROCESSING:j,SET_BEFORE_PROCESSING:h,SET_AFTER_PROCESSING:_,SET_PROCESSING_RESPONSE:E,SET_HAS_ERROR:w,SET_NO_ERROR:f,SET_QUANTITY:k,SET_REQUEST_PARAMS:y}=p,v=()=>({type:g}),S=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?w:f;return{type:t}},{SET_PRISTINE:C,SET_IDLE:x,SET_DISABLED:N,SET_PROCESSING:P,SET_BEFORE_PROCESSING:T,SET_AFTER_PROCESSING:I,SET_PROCESSING_RESPONSE:R,SET_HAS_ERROR:A,SET_NO_ERROR:B,SET_QUANTITY:L,SET_REQUEST_PARAMS:D}=p,{PRISTINE:F,IDLE:V,DISABLED:z,PROCESSING:M,BEFORE_PROCESSING:q,AFTER_PROCESSING:H}=d,G=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,{quantity:c,type:r,data:o}=arguments.length>1?arguments[1]:void 0;switch(r){case C:e=b;break;case x:e=t.status!==V?{...t,status:V}:t;break;case N:e=t.status!==z?{...t,status:z}:t;break;case L:e=c!==t.quantity?{...t,quantity:c}:t;break;case D:e={...t,requestParams:{...t.requestParams,...o}};break;case R:e={...t,processingResponse:o};break;case P:e=t.status!==M?{...t,status:M,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case T:e=t.status!==q?{...t,status:q,hasError:!1}:t;break;case I:e=t.status!==H?{...t,status:H}:t;break;case A:e=t.hasError?t:{...t,hasError:!0},e=t.status===M||t.status===q?{...e,status:V}:e;break;case B:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&r!==C&&e.status===F&&(e.status=V),e};var Q=c(98),Y=c(268);const U=e=>({onAddToCartAfterProcessingWithSuccess:Object(Y.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Y.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Y.a)("add_to_cart_before_processing",e)});var W=c(317),K=c(59);const $=Object(r.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),J=()=>Object(r.useContext)($),X=e=>{var t,c,o,n;let{children:p,product:g,showFormElements:w}=e;const[f,C]=Object(r.useReducer)(G,b),[x,N]=Object(r.useReducer)(Q.b,{}),P=Object(s.a)(x),{createErrorNotice:T}=Object(i.useDispatch)("core/notices"),{setValidationErrors:I}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),R=Object(r.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:U(N).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:U(N).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:U(N).onAddToCartBeforeProcessing}),[N]),A=Object(r.useMemo)(()=>({resetForm:()=>{C({type:m})},submitForm:()=>{C({type:h})},setQuantity:e=>{C((e=>({type:k,quantity:e}))(e))},setHasError:e=>{C(S(e))},setRequestParams:e=>{C((e=>({type:y,data:e}))(e))},setAfterProcessing:e=>{C({type:E,data:e}),C({type:_})}}),[]);Object(r.useEffect)(()=>{const e=f.status,t=!g.id||!Object(l.a)(g);e!==d.DISABLED||t?e!==d.DISABLED&&t&&C({type:O}):C(v())},[f.status,g,C]),Object(r.useEffect)(()=>{f.status===d.BEFORE_PROCESSING&&(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const c=Object(i.select)("core/notices").getNotices(),{removeNotice:r}=Object(i.dispatch)("core/notices"),o=c.filter(t=>t.status===e);o.forEach(e=>r(e.id,t))}("error","wc/add-to-cart"),Object(W.a)(P,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&T(t,{context:"wc/add-to-cart"}),c&&I(c)}),C(v())):C({type:j})}))},[f.status,I,T,C,P,null==g?void 0:g.id]),Object(r.useEffect)(()=>{if(f.status===d.AFTER_PROCESSING){const e={processingResponse:f.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:r}=e;(Object(K.b)(e)||Object(K.c)(e))&&c&&(t=!0,T(c,r?{context:r}:void 0))}),t};if(f.hasError)return void Object(W.b)(P,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var r;const t=(null===(r=e.processingResponse)||void 0===r?void 0:r.message)||Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block");T(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==g?void 0:g.id)||0)})}C(v())});Object(W.b)(P,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?C(S(!0)):C(v())})}},[f.status,f.hasError,f.processingResponse,A,T,P,null==g?void 0:g.id]);const B=Object(l.b)(g),L={product:g,productType:g.type||"simple",productIsPurchasable:Object(l.a)(g),productHasOptions:g.has_options||!1,supportsFormElements:B,showFormElements:w&&B,quantity:f.quantity||(null==g||null===(t=g.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==g||null===(c=g.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==g||null===(o=g.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==g||null===(n=g.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:f.requestParams,isIdle:f.status===d.IDLE,isDisabled:f.status===d.DISABLED,isProcessing:f.status===d.PROCESSING,isBeforeProcessing:f.status===d.BEFORE_PROCESSING,isAfterProcessing:f.status===d.AFTER_PROCESSING,hasError:f.hasError,eventRegistration:R,dispatchActions:A};return Object(r.createElement)($.Provider,{value:L},p)};var Z=c(14),ee=c.n(Z),te=c(15),ce=c(266),re=c(41),oe=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:o,hasError:n,isProcessing:s,requestParams:l}=J(),{showAllValidationErrors:d}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),b=Object(i.useSelect)(e=>e(u.VALIDATION_STORE_KEY).hasValidationErrors),{createErrorNotice:p,removeNotice:m}=Object(i.useDispatch)("core/notices"),{receiveCart:g}=Object(re.a)(),[O,j]=Object(r.useState)(!1),h=!n&&s,_=Object(r.useCallback)(()=>!b()||(d(),{type:"error"}),[b,d]);Object(r.useEffect)(()=>{const e=o.onAddToCartBeforeProcessing(_,0);return()=>{e()}},[o,_]);const E=Object(r.useCallback)(()=>{j(!0),m("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const r={id:t.id||0,quantity:c,...l};ee()({path:"/wc/store/v1/cart/add-item",method:"POST",data:r,cache:"no-store",parse:!1}).then(c=>{ee.a.setNonce(c.headers),c.json().then((function(r){c.ok?g(r):(r.body&&r.body.message?p(Object(te.decodeEntities)(r.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):p(Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(ce.b)({preserveCartData:!0}),e.setAfterProcessing(r),j(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&g(t.data.cart),e.setHasError(),e.setAfterProcessing(t),j(!1)}))})},[t,p,m,g,e,c,l]);return Object(r.useEffect)(()=>{h&&!O&&E()},[h,E,O]),null};const ne=e=>{let{children:t,product:c,showFormElements:o}=e;return Object(r.createElement)(X,{product:c,showFormElements:o},t,Object(r.createElement)(oe,null))};var ae=c(23),se=c(8),le=c(42),ie=(c(236),c(60)),ue=c(118),de=c(543),be=c(70),pe=c(166);const me=e=>{let{className:t,href:c,text:o,onClick:n}=e;return Object(r.createElement)(ie.a,{className:t,href:c,onClick:n,rel:"nofollow"},o)},ge=e=>{let{className:t,quantityInCart:c,isProcessing:o,isDisabled:n,isDone:s,onClick:l}=e;return Object(r.createElement)(ie.a,{className:t,disabled:n,showSpinner:o,onClick:l},s&&c>0?Object(a.sprintf)(
17
  /* translators: %s number of products in cart. */
18
+ Object(a._n)("%d in cart","%d in cart",c,"woo-gutenberg-products-block"),c):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!s&&Object(r.createElement)(ue.a,{icon:de.a}))};var Oe=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=J(),{parentName:b}=Object(ae.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(be.a)(),{cartQuantity:m}=Object(pe.a)(o.id||0),[g,O]=Object(r.useState)(!1),j=o.add_to_cart||{url:"",text:""};return Object(r.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(r.createElement)(ge,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==o?void 0:o.id)||0)),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(me,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{p("product-view-link",{product:o,listName:b})}})},je=c(117),he=e=>{let{disabled:t,min:c,max:o,step:n=1,value:a,onChange:s}=e;const l=void 0!==o,i=Object(je.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(o/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&s(t)},300);return Object(r.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:o,step:n,hidden:1===o,disabled:t,onChange:e=>{s(e.target.value),i(e.target.value)}})},_e=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},Ee=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},we=(c(265),c(560)),fe=c(12),ke=c(67);const ye={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var ve=e=>{let{attributeName:t,options:c=[],value:o="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const d=t,{setValidationErrors:b,clearValidationError:p}=Object(i.useDispatch)(u.VALIDATION_STORE_KEY),{error:m}=Object(i.useSelect)(e=>({error:e(u.VALIDATION_STORE_KEY).getValidationError(d)||{}}));return Object(fe.useEffect)(()=>{o?p(d):b({[d]:{message:l,hidden:!0}})},[o,d,l,p,b]),Object(fe.useEffect)(()=>()=>{p(d)},[d,p]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(r.createElement)(we.a,{label:Object(te.decodeEntities)(t),value:o||"",options:[ye,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":(null==m?void 0:m.message)&&!(null!=m&&m.hidden)})}),Object(r.createElement)(ke.a,{propertyName:d,elementId:d}))},Se=c(33);const Ce=(e,t,c)=>{const r=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return r;const o=Object.keys(e);return r.filter(e=>o.every(r=>{const o=c[r]||"",n=t["id:"+e].attributes[r];return""===o||null===n||n===o}))};var xe=e=>{let{attributes:t,variationAttributes:c,setRequestParams:o}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(r.useState)(0),[u,d]=Object(r.useState)({}),[b,p]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>((e,t,c)=>{const r={},o=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return o.forEach(o=>{const a=e[o],s={...c,[o]:null},l=n?Ce(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[o]):null;r[o]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:r}=e;return null===t||t.includes(null)||t.includes(r)?{value:r,label:Object(te.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),r})(n,a,u),[u,n,a]);return Object(r.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Se.a)(e))return{};const t=Object.keys(e),c={};return 0===t.length||t.forEach(t=>{const r=e[t],o=r.terms.filter(e=>e.default);var n;o.length>0&&(c[r.name]=null===(n=o[0])||void 0===n?void 0:n.slug)}),c}(t);e&&d({...e}),p(!0)}},[u,t,b]),Object(r.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>Ce(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(r.useEffect)(()=>{o({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[o,l,u]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(r.createElement)(ve,{key:e,attributeName:e,options:m[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Ne=e=>{let{product:t,dispatchers:c}=e;const o=(e=>e?Object(se.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(t.attributes),n=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:c,attributes:r}=e;t["id:"+c]={id:c,attributes:r.reduce((e,t)=>{let{name:c,value:r}=t;return e[c]=r,e},{})}}),t})(t.variations);return 0===Object.keys(o).length||0===n.length?null:Object(r.createElement)(xe,{attributes:o,variationAttributes:n,setRequestParams:c.setRequestParams})},Pe=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Ne,{product:e,dispatchers:s}),Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},Te=()=>Object(r.createElement)(Oe,null),Ie=c(545),Re=()=>Object(r.createElement)(Ie.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Ae=()=>Object(r.createElement)(Re,null);const Be=()=>{const{showFormElements:e,productType:t}=J();return e?"variable"===t?Object(r.createElement)(Pe,null):"grouped"===t?Object(r.createElement)(Ae,null):"external"===t?Object(r.createElement)(Te,null):"simple"===t||"variation"===t?Object(r.createElement)(Ee,null):null:Object(r.createElement)(Oe,null)};t.a=Object(le.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:o}=Object(ae.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(se.isEmpty)(o)});return Object(r.createElement)(ne,{product:o,showFormElements:c},Object(r.createElement)("div",{className:a},Object(r.createElement)(Be,null)))})},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return b}));var r=c(0),o=c(4),n=c.n(o),a=c(80),s=c(26),l=c(23),i=c(99),u=c(82),d=c(42);const b=e=>{var t,c;const{className:o,textAlign:d}=e,{parentClassName:b}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=n()("wc-block-components-product-price",o,m.className,{[b+"__product-price"]:b}),j={...g.style,...m.style};if(!p.id)return Object(r.createElement)(a.a,{align:d,className:O});const h=p.prices,_=Object(s.getCurrencyFromPriceResponse)(h),E=h.price!==h.regular_price,w=n()({[b+"__product-price__value"]:b,[b+"__product-price__value--on-sale"]:E});return Object(r.createElement)(a.a,{align:d,className:O,priceStyle:j,regularPriceStyle:j,priceClassName:w,currency:_,price:h.price,minPrice:null==h||null===(t=h.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==h||null===(c=h.price_range)||void 0===c?void 0:c.max_amount,regularPrice:h.regular_price,regularPriceClassName:n()({[b+"__product-price__regular"]:b})})};t.default=Object(d.withProductDataContext)(b)},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return b}));var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(132),d=c(42);c(263);const b=e=>{const{parentClassName:t}=Object(s.useInnerBlockLayoutContext)(),{product:c}=Object(s.useProductDataContext)(),n=p(c),d=Object(l.a)(e),b=Object(i.a)(e),g=Object(u.a)(e);if(!n)return null;const O={width:n/5*100+"%"},j=Object(o.sprintf)(
19
  /* translators: %f is referring to the average rating value */
20
  Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),n),h=m(c),_={__html:Object(o.sprintf)(
21
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
22
+ Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",h,"woo-gutenberg-products-block"),Object(o.sprintf)('<strong class="rating">%f</strong>',n),Object(o.sprintf)('<span class="rating">%d</span>',h))};return Object(r.createElement)("div",{className:a()(d.className,"wc-block-components-product-rating",{[t+"__product-rating"]:t}),style:{...d.style,...b.style,...g.style}},Object(r.createElement)("div",{className:a()("wc-block-components-product-rating__stars",t+"__product-rating__stars"),role:"img","aria-label":j},Object(r.createElement)("span",{style:O,dangerouslySetInnerHTML:_})))},p=e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0},m=e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0};t.default=Object(d.withProductDataContext)(b)},function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return E}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(70),u=c(166),d=c(99),b=c(154),p=c(82),m=c(132),g=c(15),O=c(21),j=c(2),h=c(23),_=c(42);c(264);const E=e=>{const{className:t}=e,{parentClassName:c}=Object(h.useInnerBlockLayoutContext)(),{product:r}=Object(h.useProductDataContext)(),o=Object(d.a)(e),a=Object(b.a)(e),l=Object(p.a)(e),i=Object(m.a)(e);return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(n.createElement)(w,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(f,{colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}))},w=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:a,spacingStyles:d}=e;const{id:b,permalink:p,add_to_cart:m,has_options:h,is_purchasable:_,is_in_stock:E}=t,{dispatchStoreEvent:w}=Object(i.a)(),{cartQuantity:f,addingToCart:k,addToCart:y}=Object(u.a)(b,"woocommerce/single-product/"+(b||0)),v=Number.isFinite(f)&&f>0,S=!h&&_&&E,C=Object(g.decodeEntities)((null==m?void 0:m.description)||""),x=v?Object(l.sprintf)(
23
  /* translators: %s number of products in cart. */
24
+ Object(l._n)("%d in cart","%d in cart",f,"woo-gutenberg-products-block"),f):Object(g.decodeEntities)((null==m?void 0:m.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),N=S?"button":"a",P={};return S?P.onClick=async()=>{await y(),w("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(j.getSetting)("productsSettings");e&&(window.location.href=O.d)}:(P.href=p,P.rel="nofollow",P.onClick=()=>{w("product-view-link",{product:t})}),Object(n.createElement)(N,o()({"aria-label":C,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:k,added:v}),style:{...c.style,...r.style,...a.style,...d.style},disabled:k},P),x)},f=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:o}=e;return Object(n.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...o.style},disabled:!0})};t.default=Object(_.withProductDataContext)(E)},,,,,,,,,,function(e){e.exports=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":1,"textdomain":"woo-gutenberg-products-block","name":"woocommerce/all-products","title":"All Products","category":"woocommerce","keywords":["WooCommerce"],"description":"Display products from your store in a grid layout.","supports":{"align":["wide","full"],"html":false,"multiple":false},"example":{"attributes":{"isPreview":true}},"attributes":{"columns":{"type":"number"},"rows":{"type":"number"},"alignButtons":{"type":"boolean"},"contentVisibility":{"type":"object"},"orderby":{"type":"string"},"layoutConfig":{"type":"array"},"isPreview":{"type":"boolean","default":false}}}')},,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(182);const o=["a","b","em","i","strong","p","br"],n=["target","href","rel","name","download"],a=(e,t)=>{const c=(null==t?void 0:t.tags)||o,a=(null==t?void 0:t.attr)||n;return Object(r.sanitize)(e,{ALLOWED_TAGS:c,ALLOWED_ATTR:a})}},,,function(e,t){},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(107),o=c(9),n=c(7),a=c(40);const s=e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:c,isLoading:s}=Object(r.a)({...t,query:e}),{value:l}=((e,t)=>{const{namespace:c,resourceName:r,resourceValues:s=[],query:l={}}=t;if(!c||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const i=Object(a.a)(l),u=Object(a.a)(s),{value:d,isLoading:b=!0}=Object(n.useSelect)(e=>{const t=e(o.COLLECTIONS_STORE_KEY),n=["x-wp-total",c,r,i,u];return{value:t.getCollectionHeader(...n),isLoading:t.hasFinishedResolution("getCollectionHeader",n)}},["x-wp-total",c,r,u,i]);return{value:d,isLoading:b}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(l,10),productsLoading:s}}},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return p}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(314),i=c(233),u=c(7),d=c(9);c(198);const b=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},p=e=>{let{className:t,context:c="default",additionalNotices:r=[]}=e;const a=Object(u.useSelect)(e=>e(d.PAYMENT_STORE_KEY).isExpressPaymentMethodActive()),{notices:p}=Object(u.useSelect)(e=>({notices:e("core/notices").getNotices(c)})),{removeNotice:m}=Object(u.useDispatch)("core/notices"),g=p.filter(e=>"snackbar"!==e.type).concat(r);if(!g.length)return null;const O=s()(t,"wc-block-components-notices");return a?null:Object(n.createElement)("div",{className:O},g.map(e=>Object(n.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",b(e)),onRemove:()=>{e.isDismissible&&m(e.id,c)}}),Object(i.a)(e.content))))}},,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"c",(function(){return a})),c.d(t,"b",(function(){return s})),c.d(t,"a",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:c=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!r)return;n||(n=document.body);const s=new r(e,{bubbles:c,cancelable:o,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:c,cancelable:r})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(95),o=(c(16),c(2));const n=e=>{const t=Object.keys(o.defaultAddressFields),c=Object(r.a)(t,{},e.country),n=Object.assign({},e);return c.forEach(t=>{let{key:c="",hidden:r=!1}=t;r&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(98);const o=(e,t)=>function(c){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=r.a.addEventCallback(e,c,o);return t(n),()=>{t(r.a.removeEventCallback(e,n.id))}}},,,,,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(13);const n=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));t.a=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";var r=c(58);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},linkTarget:{type:"string"},productId:{type:"number",default:0}};Object(r.b)()&&(o={...o,align:{type:"string"}}),t.a=o},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r={showProductLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:"full-size"},productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return n}));var r=c(59);const o=async(e,t,c)=>{const o=Object(r.a)(e,t),n=[];for(const e of o)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},n=async(e,t,c)=>{const o=[],n=Object(r.a)(e,t);for(const e of n)try{const t=await Promise.resolve(e.callback(c));if("object"!=typeof t||null===t)continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(r.b)(t)||Object(r.c)(t))return o.push(t),o;o.push(t)}catch(e){return console.error(e),o.push({type:"error"}),o}return o}},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},,,,,,,,,function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(120),s=c(21),l=c(23),i=c(99),u=c(82),d=c(42);c(354),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),d=Object(i.a)(e),b=Object(u.a)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const p=o.short_description?o.short_description:o.description;return p?Object(r.createElement)(a.a,{className:n()(t,d.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:p,maxLength:150,countType:s.o.wordCountType||"words",style:{...d.style,...b.style}}):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(42);c(355),t.default=Object(l.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=n.sku;return l?Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(o.__)("SKU:","woo-gutenberg-products-block")," ",Object(r.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(8),d=c(42);c(356),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",d.className,{[c+"__product-category-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Categories:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"category-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(8),d=c(42);c(357),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,d.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Tags:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"tag-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(23),l=c(99),i=c(82),u=c(42);c(358);t.default=Object(u.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),u=Object(l.a)(e),d=Object(i.a)(e);if(!n.id||!n.is_purchasable)return null;const b=!!n.is_in_stock,p=n.low_stock_remaining,m=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,u.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":b,"wc-block-components-product-stock-indicator--out-of-stock":!b,"wc-block-components-product-stock-indicator--low-stock":!!p,"wc-block-components-product-stock-indicator--available-on-backorder":!!m}),style:{...u.style,...d.style}},p?(e=>Object(o.sprintf)(
25
  /* translators: %d stock amount (number of items in stock for product) */
26
+ Object(o.__)("%d left in stock","woo-gutenberg-products-block"),e))(p):((e,t)=>t?Object(o.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(o.__)("In Stock","woo-gutenberg-products-block"):Object(o.__)("Out of Stock","woo-gutenberg-products-block"))(b,m))})},,,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>e.is_purchasable||!1,o=e=>["simple","variable"].includes(e.type||"simple")},,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(1),o=c(21);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(r.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woo-gutenberg-products-block"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:Object(r.__)("Add to cart","woo-gutenberg-products-block"),description:Object(r.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,,,,,,function(e,t,c){e.exports=c(478)},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.r(t),c.d(t,"metadata",(function(){return ot})),c.d(t,"name",(function(){return Yt}));var r=c(0),o=c(10),n=c(118),a=c(535),s=c(58),l=c(1),i=c(4),u=c.n(i),d={category:"woocommerce-product-elements",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},ancestor:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return t.isDescendentOfQueryLoop?null:Object(r.createElement)("div",{className:u()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},b=c(315),p=c(3),m=c(11),g=c(5),O=c(8),j=c(13);function h(e){let{level:t}=e;const c={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return c.hasOwnProperty(t)?Object(r.createElement)(j.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(j.Path,{d:c[t]})):null}class _ extends r.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(r.createElement)(h,{level:e}),title:Object(l.sprintf)(
27
  /* translators: %s: heading level e.g: "2", "3", "4" */
28
+ Object(l.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:o,onChange:n}=this.props;return Object(r.createElement)(p.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(h,{level:o}),controls:Object(O.range)(t,c).map(e=>this.createLevelControl(e,o,n))})}}var E=_,w=c(196),f=c(97),k=c(151),y=c(23);c(393);var v=e=>t=>c=>{const o=Object(y.useProductDataContext)(),{attributes:n,setAttributes:a}=c,{productId:s}=n,[i,u]=Object(r.useState)(!s);return o.hasContext?Object(r.createElement)(t,c):Object(r.createElement)(r.Fragment,null,i?Object(r.createElement)(p.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(r.createElement)("div",null,e.description),Object(r.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(r.createElement)(f.a,{selected:s||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];a({productId:e[0]?e[0].id:0})}}),Object(r.createElement)(p.Button,{isSecondary:!0,disabled:!s,onClick:()=>{u(!1)}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,null,Object(r.createElement)(k.a,{onClick:()=>u(!0)},Object(l.__)("Switch product…","woo-gutenberg-products-block")))),Object(r.createElement)(t,c)))},S=c(536);const C=Object(l.__)("Product Title","woo-gutenberg-products-block"),x=Object(r.createElement)(n.a,{icon:S.a,className:"wc-block-editor-components-block-icon"}),N=Object(l.__)("Display the title of a product.","woo-gutenberg-products-block");c(394);const P=e=>{let{attributes:t,setAttributes:c}=e;const o=Object(g.useBlockProps)(),{headingLevel:n,showProductLink:a,align:i,linkTarget:u}=t;return Object(r.createElement)("div",o,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(E,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:n,onChange:e=>c({headingLevel:e})}),Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Link settings","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Make title a link","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showProductLink:!a})}),a&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(w.b,t)))};var T=Object(s.b)()?Object(m.compose)([v({icon:x,label:C,description:Object(l.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(P):P,I=c(129);const R={...d,apiVersion:2,title:C,description:N,icon:{src:x},attributes:b.a,edit:T,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},supports:{...d.supports,...Object(s.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(o.registerBlockType)("woocommerce/product-title",R);var A=c(12),B=c(210),L=c(537);const D=Object(l.__)("Product Price","woo-gutenberg-products-block"),F=Object(r.createElement)(n.a,{icon:L.a,className:"wc-block-editor-components-block-icon"}),V=Object(l.__)("Display the price of a product.","woo-gutenberg-products-block");var z=v({icon:F,label:D,description:Object(l.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(g.useBlockProps)(),a={...t,...o},l=Number.isFinite(o.queryId);return Object(A.useEffect)(()=>c({isDescendentOfQueryLoop:l}),[c,l]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(r.createElement)("div",n,Object(r.createElement)(B.default,a)))});let M={productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}};Object(s.b)()&&(M={...M,textAlign:{type:"string"}});var q=M;const H={...d,apiVersion:2,title:D,description:V,parent:["core/group"],ancestor:["@woocommerce/all-products","@woocommerce/single-product","core/post-template"],usesContext:["query","queryId","postId"],icon:{src:F},attributes:q,edit:z,supports:{...d.supports,...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-price"}}};Object(o.registerBlockType)("woocommerce/product-price",H);var G=c(538),Q=c(6),Y=c.n(Q),U=c(2),W=c(128),K=c(197);const $={html:!1,...Object(s.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var J=c(316);const X={apiVersion:2,name:"woocommerce/product-image",title:Object(l.__)("Product Image","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(n.a,{icon:G.a,className:"wc-block-editor-components-block-icon"})},keywords:["WooCommerce"],description:Object(l.__)("Display the main product image.","woo-gutenberg-products-block"),usesContext:["query","queryId","postId"],parent:["@woocommerce/all-products","@woocommerce/single-product","core/post-template"],textdomain:"woo-gutenberg-products-block",attributes:J.a,supports:$,edit:e=>{let{attributes:t,setAttributes:c,context:o}=e;const{showProductLink:n,imageSizing:a,showSaleBadge:s,saleBadgeAlign:i}=t,u=Object(g.useBlockProps)(),d=Number.isFinite(o.queryId);Object(r.useEffect)(()=>c({isDescendentOfQueryLoop:d}),[c,d]);const b=Object(U.getSettingWithCoercion)("is_block_theme_enabled",!1,W.a);return Object(r.useEffect)(()=>{b&&"full-size"!==t.imageSizing&&c({imageSizing:"full-size"})},[t.imageSizing,b,c]),Object(r.createElement)("div",u,Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(l.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:n,onChange:()=>c({showProductLink:!n})}),Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(l.__)("Display a “sale” badge if the product is on-sale.","woo-gutenberg-products-block"),checked:s,onChange:()=>c({showSaleBadge:!s})}),s&&Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,onChange:e=>c({saleBadgeAlign:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"left",label:Object(l.__)("Left","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"center",label:Object(l.__)("Center","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"right",label:Object(l.__)("Right","woo-gutenberg-products-block")})),!b&&Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(r.createInterpolateElement)(Object(l.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(r.createElement)("a",{href:Object(U.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:a,onChange:e=>c({imageSizing:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(l.__)("Full Size","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(l.__)("Cropped","woo-gutenberg-products-block")})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(K.b,Y()({},t,o))))}};Object(o.registerBlockType)("woocommerce/product-image",{...d,...X});var Z=c(211),ee=c(531);const te=Object(l.__)("Product Rating","woo-gutenberg-products-block"),ce=Object(r.createElement)(n.a,{icon:ee.a,className:"wc-block-editor-components-block-icon"}),re=Object(l.__)("Display the average rating of a product.","woo-gutenberg-products-block");var oe=v({icon:ce,label:te,description:Object(l.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(r.createElement)("div",c,Object(r.createElement)(Z.default,t))});const ne={apiVersion:2,title:te,description:re,icon:{src:ce},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-rating"}},edit:oe,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-rating",{...d,...ne});var ae=c(212),se=c(539);const le=Object(l.__)("Add to Cart Button","woo-gutenberg-products-block"),ie=Object(r.createElement)(n.a,{icon:se.a,className:"wc-block-editor-components-block-icon"}),ue={apiVersion:2,title:le,description:Object(l.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block"),ancestor:["@woocommerce/all-products","@woocommerce/single-product","core/post-template"],usesContext:["query","queryId","postId"],icon:{src:ie},attributes:{productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}},supports:{...Object(s.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button"}},edit:e=>{let{attributes:t,setAttributes:c,context:o}=e;const n=Object(g.useBlockProps)(),a=Number.isFinite(o.queryId);return Object(r.useEffect)(()=>c({isDescendentOfQueryLoop:a}),[c,a]),Object(r.createElement)("div",n,Object(r.createElement)(p.Disabled,null,Object(r.createElement)(ae.default,Y()({},t,o))))}};Object(o.registerBlockType)("woocommerce/product-button",{...d,...ue});var de=c(327),be=c(540);const pe=Object(l.__)("Product Summary","woo-gutenberg-products-block"),me=Object(r.createElement)(n.a,{icon:be.a,className:"wc-block-editor-components-block-icon"}),ge=Object(l.__)("Display a short description about a product.","woo-gutenberg-products-block");c(395);var Oe=v({icon:me,label:pe,description:Object(l.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(de.default,t))});const je={apiVersion:2,title:pe,description:ge,icon:{src:me},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:Oe,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-summary",{...d,...je});var he=c(141),_e=c(529);const Ee=Object(l.__)("On-Sale Badge","woo-gutenberg-products-block"),we=Object(r.createElement)(n.a,{icon:_e.a,className:"wc-block-editor-components-block-icon"}),fe=Object(l.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ke=v({icon:we,label:Ee,description:Object(l.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(he.default,t))});const ye={title:Ee,description:fe,icon:{src:we},apiVersion:2,supports:{html:!1,...Object(s.b)()&&{color:{gradients:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0},...Object(I.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:ke,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-sale-badge",{...d,...ye});var ve=c(108),Se=c(328),Ce=Object(r.createElement)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const xe=Object(l.__)("Product SKU","woo-gutenberg-products-block"),Ne=Object(r.createElement)(n.a,{icon:Ce,className:"wc-block-editor-components-block-icon"}),Pe={title:xe,description:Object(l.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Ne},attributes:{productId:{type:"number",default:0}},edit:v({icon:Ne,label:xe,description:Object(l.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(ve.a,null),Object(r.createElement)(Se.default,t))})};Object(s.c)("woocommerce/product-sku",{...d,...Pe});var Te=c(329),Ie=c(541);const Re=Object(l.__)("Product Category List","woo-gutenberg-products-block"),Ae=Object(r.createElement)(n.a,{icon:Ie.a,className:"wc-block-editor-components-block-icon"}),Be=Object(l.__)("Display the list of categories that are assigned to a product.","woo-gutenberg-products-block");var Le=v({icon:Ae,label:Re,description:Object(l.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ve.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Te.default,t)))});const De={...d,apiVersion:2,title:Re,description:Be,icon:{src:Ae},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,link:!0,background:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-category-list"}},save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},edit:Le};Object(s.c)("woocommerce/product-category-list",De);var Fe=c(330),Ve=c(534);const ze=Object(l.__)("Product Tag List","woo-gutenberg-products-block"),Me=Object(r.createElement)(n.a,{icon:Ve.a,className:"wc-block-editor-components-block-icon"}),qe=Object(l.__)("Display the list of tags that are assigned to a product.","woo-gutenberg-products-block");var He=v({icon:Me,label:ze,description:Object(l.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ve.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Fe.default,t)))});const Ge={apiVersion:2,title:ze,description:qe,icon:{src:Me},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-tag-list"}},edit:He,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-tag-list",{...d,...Ge});var Qe=c(331),Ye=c(542);const Ue=Object(l.__)("Product Stock Indicator","woo-gutenberg-products-block"),We=Object(r.createElement)(n.a,{icon:Ye.a,className:"wc-block-editor-components-block-icon"}),Ke=Object(l.__)("Display product stock status.","woo-gutenberg-products-block");var $e=v({icon:We,label:Ue,description:Object(l.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ve.a,null),Object(r.createElement)(Qe.default,t))});const Je={apiVersion:2,title:Ue,description:Ke,icon:{src:We},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:$e,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-stock-indicator",{...d,...Je});var Xe=c(359),Ze=(c(236),c(209)),et=c(278);const tt=Object(l.__)("Add to Cart","woo-gutenberg-products-block"),ct=Object(r.createElement)(n.a,{icon:et.a,className:"wc-block-editor-components-block-icon"}),rt={title:tt,description:Object(l.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:ct},edit:v({icon:ct,label:tt,description:Object(l.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:o}=Object(y.useProductDataContext)(),{className:n,showFormElements:a}=t;return Object(r.createElement)("div",{className:u()(n,"wc-block-components-product-add-to-cart")},Object(r.createElement)(ve.a,{productId:o.id}),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout","woo-gutenberg-products-block")},Object(Xe.b)(o)?Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Display form elements","woo-gutenberg-products-block"),help:Object(l.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showFormElements:!a})}):Object(r.createElement)(p.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(l.__)("This product does not support the block based add to cart form. A link to the product page will be shown instead.","woo-gutenberg-products-block")))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Ze.a,t)))}),attributes:c(318).a};Object(s.c)("woocommerce/product-add-to-cart",{...d,...rt});var ot=c(222);const nt=(e,t)=>{const{className:c,contentVisibility:r}=t;return u()(e,c,{"has-image":r&&r.image,"has-title":r&&r.title,"has-rating":r&&r.rating,"has-price":r&&r.price,"has-button":r&&r.button})},{attributes:at}=ot;var st=[{attributes:Object.assign({},at,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(r.createElement)("div",Y()({className:nt("wc-block-all-products",t)},c),Object(r.createElement)(g.InnerBlocks.Content,null))}}],lt=c(24),it=c.n(lt),ut=c(7),dt=c(64),bt=c(509),pt=c(382),mt=c(21),gt=c(258);const Ot=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],jt=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?jt(e.innerBlocks):[]}]):[];var ht=c(28);c(401);var _t=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:n=3,onPageChange:a,totalPages:s}=e,{minIndex:i,maxIndex:d}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),n=Math.min(Math.ceil(t+(r-(t-o))),c-1);return{minIndex:Math.max(Math.floor(t-(r-(n-t))),2),maxIndex:n}})(n,t,s);const b=c&&Boolean(1!==i),p=c&&Boolean(d!==s),m=c&&Boolean(i&&i>3),g=c&&Boolean(d&&d<s-2);b&&3===i&&(i-=1),p&&d===s-2&&(d+=1);const O=[];if(i&&d)for(let e=i;e<=d;e++)O.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(ht.a,{screenReaderLabel:Object(l.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t-1),title:Object(l.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(ht.a,{label:"←",screenReaderLabel:Object(l.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>a(1),disabled:1===t},Object(r.createElement)(ht.a,{label:"1",screenReaderLabel:Object(l.sprintf)(
29
  /* translators: %d is the page number (1, 2, 3...). */
30
  Object(l.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(r.createElement)("button",{key:e,className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>a(e),disabled:t===e},Object(r.createElement)(ht.a,{label:e.toString(),screenReaderLabel:Object(l.sprintf)(
31
  /* translators: %d is the page number (1, 2, 3...). */
32
  Object(l.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),p&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===s,"wc-block-components-pagination__page--active":t===s}),onClick:()=>a(s),disabled:t===s},Object(r.createElement)(ht.a,{label:s.toString(),screenReaderLabel:Object(l.sprintf)(
33
  /* translators: %d is the page number (1, 2, 3...). */
34
+ Object(l.__)("Page %d","woo-gutenberg-products-block"),s)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t+1),title:Object(l.__)("Next page","woo-gutenberg-products-block"),disabled:t>=s},Object(r.createElement)(ht.a,{label:"→",screenReaderLabel:Object(l.__)("Next page","woo-gutenberg-products-block")})))},Et=c(103),wt=c(53),ft=c(244),kt=c(70);c(402);const yt=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var vt=c(44),St=c(186),Ct=()=>{const{parentClassName:e}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(n.a,{className:e+"__no-products-image",icon:St.a,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(l.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(l.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},xt=c(533),Nt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:c+"__no-products"},Object(r.createElement)(n.a,{className:c+"__no-products-image",icon:xt.a,size:100}),Object(r.createElement)("strong",{className:c+"__no-products-title"},Object(l.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:c+"__no-products-description"},Object(l.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(l.__)("Reset Search","woo-gutenberg-products-block")))},Pt=c(122);c(400);var Tt=e=>{let{onChange:t,value:c}=e;return Object(r.createElement)(Pt.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(l.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(l.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(l.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(l.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(l.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(l.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(l.__)("Order products by","woo-gutenberg-products-block"),value:c})};const It=(e,t,c,o)=>{if(!c)return;const n=Object(bt.a)(e);return c.map((c,a)=>{let[s,l={}]=c,i=[];l.children&&l.children.length>0&&(i=It(e,t,l.children,o));const u=n[s];if(!u)return null;const d=t.id||0,b=["layout",s,a,o,d];return Object(r.createElement)(r.Suspense,{key:b.join("_"),fallback:Object(r.createElement)("div",{className:"wc-block-placeholder"})},Object(r.createElement)(u,Y()({},l,{children:i,product:t})))})};var Rt=Object(m.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:o}=e;const{layoutConfig:n}=c,{parentClassName:a,parentName:s}=Object(y.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=u()(a+"__product","wc-block-layout",{"is-loading":l});return Object(r.createElement)("li",{className:i,"aria-hidden":l},It(s,t,n,o))});c(399);const At=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},Bt=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(O.isEqual)(t,r)&&Number.isFinite(c)};var Lt,Dt=(Lt=e=>{let{attributes:t,currentPage:c,onPageChange:o,onSortChange:n,sortValue:a,scrollToTop:s}=e;const[i,d]=Object(wt.b)("attributes",[]),[b,p]=Object(wt.b)("stock_status",[]),[m,g]=Object(wt.b)("rating",[]),[j,h]=Object(wt.b)("min_price"),[_,E]=Object(wt.b)("max_price"),[w]=Object(wt.c)((e=>{let{sortValue:t,currentPage:c,attributes:r}=e;const{columns:o,rows:n}=r;return{...At(t),catalog_visibility:"catalog",per_page:o*n,page:c}})({attributes:t,sortValue:a,currentPage:c})),{products:f,totalProducts:k,productsLoading:v}=Object(ft.a)(w),{parentClassName:S,parentName:C}=Object(y.useInnerBlockLayoutContext)(),x=(e=>{const{order:t,orderby:c,page:r,per_page:o,...n}=e;return n||{}})(w),{dispatchStoreEvent:N}=Object(kt.a)(),P=Object(Et.a)({totalQuery:x,totalProducts:k},Bt);Object(r.useEffect)(()=>{N("product-list-render",{products:f,listName:C})},[f,C,N]),Object(r.useEffect)(()=>{Object(O.isEqual)(x,null==P?void 0:P.totalQuery)||(o(1),null!=P&&P.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(vt.speak)(Object(l.__)("No products found","woo-gutenberg-products-block")):Object(vt.speak)(Object(l.sprintf)(
35
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
36
+ Object(l._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(k))},[null==P?void 0:P.totalQuery,k,o,x]);const{contentVisibility:T}=t,I=t.columns*t.rows,R=!Number.isFinite(k)&&Number.isFinite(null==P?void 0:P.totalProducts)&&Object(O.isEqual)(x,null==P?void 0:P.totalQuery)?Math.ceil(((null==P?void 0:P.totalProducts)||0)/I):Math.ceil(k/I),A=f.length?f:Array.from({length:I}),B=0!==f.length||v,L=i.length>0||b.length>0||m.length>0||Number.isFinite(j)||Number.isFinite(_);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return u()(S,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==T?void 0:T.orderBy)&&B&&Object(r.createElement)(Tt,{onChange:n,value:a}),!B&&L&&Object(r.createElement)(Nt,{resetCallback:()=>{d([]),p([]),g([]),h(null),E(null)}}),!B&&!L&&Object(r.createElement)(Ct,null),B&&Object(r.createElement)("ul",{className:u()(S+"__products",{"is-loading-products":v})},A.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(r.createElement)(Rt,{key:e.id||c,attributes:t,product:e})}))),R>1&&Object(r.createElement)(_t,{currentPage:c,onPageChange:e=>{s({focusableSelector:"a, button"}),o(e)},totalPages:R}))},e=>{const t=Object(r.useRef)(null);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(r.createElement)(Lt,Y()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const r=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(r.length){const e=r[0];yt(e),null==e||e.focus()}else yt(e)})(e,c):yt(e))})(t.current,e)}})))}),Ft=e=>{let{attributes:t}=e;const[c,o]=Object(r.useState)(1),[n,a]=Object(r.useState)(t.orderby);return Object(r.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(r.createElement)(Dt,{attributes:t,currentPage:c,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),o(1)},sortValue:n})},Vt=c(150),zt=c(251);class Mt extends A.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Vt.a:Object(r.createElement)(y.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(zt.a,{context:"wc/all-products"}),Object(r.createElement)(Ft,{attributes:e,urlParameterSuffix:t}))}}var qt=Mt;c(398);class Ht extends r.Component{constructor(){super(...arguments),it()(this,"state",{isEditing:!1,innerBlocks:[]}),it()(this,"blockMap",Object(bt.a)("woocommerce/all-products")),it()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),it()(this,"getTitle",()=>Object(l.__)("All Products","woo-gutenberg-products-block")),it()(this,"getIcon",()=>Object(r.createElement)(n.a,{icon:a.a})),it()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(l.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),it()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:o,alignButtons:n}=e;return Object(r.createElement)(g.InspectorControls,{key:"inspector"},Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(dt.a,{columns:c,rows:o,alignButtons:n,setAttributes:t,minColumns:Object(U.getSetting)("min_columns",1),maxColumns:Object(U.getSetting)("max_columns",6),minRows:Object(U.getSetting)("min_rows",1),maxRows:Object(U.getSetting)("max_rows",6)})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(r.createElement)(p.SelectControl,{label:Object(l.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(l.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(l.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(l.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(l.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(l.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(l.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),it()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit the layout of each product","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),it()(this,"renderEditMode",()=>{const e={template:this.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(this.blockMap)};return 0!==this.props.attributes.layoutConfig.length&&(e.renderAppender=!1),Object(r.createElement)(p.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(l.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(r.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(r.createElement)(p.Tip,null,Object(l.__)("Edit the blocks inside the example below to change the content displayed for all products within the product grid.","woo-gutenberg-products-block")),Object(r.createElement)(y.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(r.createElement)("ul",{className:"wc-block-grid__products"},Object(r.createElement)("li",{className:"wc-block-grid__product"},Object(r.createElement)(y.ProductDataContextProvider,{product:pt.a[0]},Object(r.createElement)(g.InnerBlocks,e)))))),Object(r.createElement)("div",{className:"wc-block-all-products__actions"},Object(r.createElement)(p.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:jt(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(l.__)("Done","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,{innerBlocks:c}=this.state;t(e.clientId,c,!1),this.togglePreview()}},Object(l.__)("Cancel","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__reset-button",icon:Object(r.createElement)(n.a,{icon:a.a}),label:Object(l.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];Ot.map(e=>{let[t,r]=e;return c.push(Object(o.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(l.__)("Reset Layout","woo-gutenberg-products-block")))))}),it()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,o=this.getTitle(),n=this.getIcon();return c?Object(r.createElement)(p.Disabled,null,Object(r.createElement)(qt,{attributes:e})):((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(l.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(o,n)}),it()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),o=this.getIcon();return 0===mt.o.productCount?((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(r.createElement)("p",null,Object(l.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:U.ADMIN_URL+"post-new.php?post_type=product"},Object(l.__)("Add new product","woo-gutenberg-products-block")+" ",Object(r.createElement)(n.a,{icon:gt.a})),Object(r.createElement)(p.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))))(c,o):Object(r.createElement)("div",{className:nt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Gt=Object(m.compose)(p.withSpokenMessages,Object(ut.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(ut.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Ht),Qt={columns:Object(U.getSetting)("default_columns",3),rows:Object(U.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Ot,isPreview:!1};const{name:Yt}=ot,Ut={icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},edit:Gt,save:function(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const o={"data-attributes":JSON.stringify(c)};return Object(r.createElement)("div",Y()({className:nt("wc-block-all-products",t)},o),Object(r.createElement)(g.InnerBlocks.Content,null))},deprecated:st,defaults:Qt};Object(o.registerBlockType)(Yt,Ut)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(36),o=c(0),n=c(21);c.p=n.l,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(28)]).then(c.bind(null,210)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(25)]).then(c.bind(null,564)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(38)]).then(c.bind(null,565)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(30)]).then(c.bind(null,211)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(21)]).then(c.bind(null,212)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(35)]).then(c.bind(null,327)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(31)]).then(c.bind(null,141)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(33).then(c.bind(null,328)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(24)]).then(c.bind(null,329)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(37)]).then(c.bind(null,330)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(34)]).then(c.bind(null,331)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(4),c.e(19)]).then(c.bind(null,566)))});const a=e=>Object(r.getRegisteredBlockComponents)(e)}]);
build/all-reviews.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '9f58845b59eed1f911e686a2d24c6554');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => 'e8351a156aae289a085b909b21012277');
build/all-reviews.js CHANGED
@@ -1,9 +1,9 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var o,a,i=t[0],s=t[1],l=t[2],u=0,b=[];u<i.length;u++)a=i[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o]);for(d&&d(t);b.length;)b.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],o=!0,i=1;i<r.length;i++){var s=r[i];0!==n[s]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={7:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=o,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var d=s;return c.push([383,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.blocks},11:function(e,t){e.exports=window.wp.compose},112:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var o=r(0),n=r(1),c=r(5),a=r(2),i=r(3);const s=(e,t,r)=>Object(o.createElement)(c.BlockControls,null,Object(o.createElement)(i.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),l=(e,t)=>{const r=Object(a.getSetting)("showAvatars",!0),c=Object(a.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!c&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.__experimentalToggleGroupControl,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,onChange:e=>t({imageType:e})},Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"reviewer",label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block")}),Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"product",label:Object(n.__)("Product","woo-gutenberg-products-block")})),"reviewer"===e.imageType&&!r&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(i.SelectControl,{label:Object(n.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:e=>t({orderby:e})}),Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))},12:function(e,t){e.exports=window.React},120:function(e,t){},123:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(29),i=r(11);r(167),t.a=Object(i.withInstanceId)(e=>{let{className:t,instanceId:r,label:n="",onChange:i,options:s,screenReaderLabel:l,value:d=""}=e;const u="wc-block-components-sort-select__select-"+r;return Object(o.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:n,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:u}}),Object(o.createElement)("select",{id:u,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:i,value:d},s&&s.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},129:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(22);const c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(o.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
2
  /* translators: An example person name used for the block previews. */
3
  reviewer:Object(o.__)("Alice","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
4
  /* translators: An example person name used for the block previews. */
5
- reviewer:Object(o.__)("Bob","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("This product is awesome, I love it!","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:null,verified:!1}]}}},13:function(e,t){e.exports=window.wp.primitives},14:function(e,t){e.exports=window.wp.apiFetch},15:function(e,t){e.exports=window.wp.htmlEntities},152:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},153:function(e,t,r){"use strict";var o=r(6),n=r.n(o),c=r(0),a=r(5),i=(r(166),r(57));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(i.a)(t)}),Object(i.b)(t)))}},158:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(8),a=r(3),i=r(5),s=r(12),l=r(2),d=r(75),u=r(29);r(193);var b=e=>{let{onClick:t,label:r=Object(n.__)("Load more","woo-gutenberg-products-block"),screenReaderLabel:c=Object(n.__)("Load more","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(o.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(o.createElement)(u.a,{label:r,screenReaderLabel:c})))},w=r(123);r(190);var p=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(w.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(n.__)("Order by","woo-gutenberg-products-block"),onChange:t,options:[{key:"most-recent",label:Object(n.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(n.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(n.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(n.__)("Order reviews by","woo-gutenberg-products-block"),value:c})},m=r(4),g=r.n(m),v=r(24),h=r.n(v),_=r(177),O=r.n(_);const j=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=O()(e,{suffix:r,limit:t});return o.html},f=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),k=(e,t,r,o)=>{const n=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=j(e,o.middle),o=f(o,t.clientHeight,r);return o.middle})(e,t,r);return j(e,n-o.length,o)},y={className:"read-more-content",ellipsis:"&hellip;",lessText:Object(n.__)("Read less","woo-gutenberg-products-block"),maxLines:3,moreText:Object(n.__)("Read more","woo-gutenberg-products-block")};class R extends s.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(s.createRef)(),this.reviewSummary=Object(s.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:k(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:n}=this.props,c=e?r:n;if(c)return Object(o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:n,isExpanded:c}=this.state;return t?!1===n?Object(o.createElement)("div",{className:e},Object(o.createElement)("div",{ref:this.reviewContent},t)):Object(o.createElement)("div",{className:e},(!c||null===n)&&Object(o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:r}}),(c||null===n)&&Object(o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},t),this.getButton()):null}}h()(R,"defaultProps",y);var E=R;r(192);var S=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:i,showReviewImage:s,showReviewRating:l,showReviewContent:d,showProductName:u}=t,{rating:b}=r,w=!Object.keys(r).length>0,p=Number.isFinite(b)&&l;return Object(o.createElement)("li",{className:g()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":w,"wc-block-components-review-list-item__item--has-image":s}),"aria-hidden":w},(u||a||i||s||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},s&&function(e,t,r){var c,a;return r||!e?Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(o.createElement)("img",{"aria-hidden":"true",alt:(null===(c=e.product_image)||void 0===c?void 0:c.alt)||"",src:(null===(a=e.product_image)||void 0===a?void 0:a.thumbnail)||""}):Object(o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&Object(o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(n.__)("Verified buyer","woo-gutenberg-products-block")},Object(n.__)("Verified buyer","woo-gutenberg-products-block")))}(r,c,w),(u||i||p||a)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},p&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},c=Object(n.sprintf)(
6
  /* translators: %f is referring to the average rating value */
7
  Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),a={__html:Object(n.sprintf)(
8
  /* translators: %s is referring to the average rating value */
9
- Object(n.__)("Rated %s out of 5","woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(r),u&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(r),i&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(r),a&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(r))),d&&function(e){return Object(o.createElement)(E,{maxLines:10,moreText:Object(n.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(n.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(r))};r(191);var C=e=>{let{attributes:t,reviews:r}=e;const n=Object(l.getSetting)("showAvatars",!0),c=Object(l.getSetting)("reviewRatingsEnabled",!0),a=(n||"product"===t.imageType)&&t.showReviewImage,i=c&&t.showReviewRating,s={...t,showReviewImage:a,showReviewRating:i};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:s}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:s,review:e})))},T=r(6),P=r.n(T),N=r(25),L=r.n(N),x=r(57),A=r(28);class M extends s.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:i,totalReviews:s}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===i.length&&!r)return Object(o.createElement)(c,{attributes:e});const u=Object(l.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&u&&Object(o.createElement)(p,{readOnly:!0,value:e.orderby}),Object(o.createElement)(C,{attributes:e,reviews:i}),e.showLoadMore&&s>i.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var I=(e=>{class t extends s.Component{constructor(){super(...arguments),h()(this,"isPreview",!!this.props.attributes.previewReviews),h()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),h()(this,"isMounted",!1),h()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),h()(this,"setError",async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(A.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)})}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!L()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:n,reviewsToDisplay:c}=this.props,a={order:r,orderby:o,per_page:c-e,offset:e};if(t){const e=Array.isArray(t)?t:JSON.parse(t);a.category_id=Array.isArray(e)?e.join(","):e}return n&&(a.product_id=n),a}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(x.c)(this.getArgs(e.length)).then(t=>{let{reviews:r,totalReviews:o}=t;return this.isMounted&&this.setState({reviews:e.filter(e=>Object.keys(e).length).concat(r),totalReviews:o,loading:!1,error:null}),{newReviews:r}}).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,P()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}h()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(M);t.a=e=>{let{attributes:t,icon:r,name:s,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:v,showReviewRating:h}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||h||p||m||v||w),f=Object(i.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:s},Object(n.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")):Object(o.createElement)("div",f,Object(o.createElement)(I,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},166:function(e,t){},167:function(e,t){},190:function(e,t){},191:function(e,t){},192:function(e,t){},193:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return i})),r.d(t,"n",(function(){return s})),r.d(t,"j",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return v})),r.d(t,"i",(function(){return h})),r.d(t,"b",(function(){return _}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,d=n.STORE_PAGES.checkout.id,u=n.STORE_PAGES.checkout.permalink,b=n.STORE_PAGES.privacy.permalink,w=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),p=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),m=n.STORE_PAGES.cart.permalink,g=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),v=Object(n.getSetting)("allowedCountries",{}),h=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var o=r(1),n=r(15);const c=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(n.decodeEntities)(e.message):Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},29:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:a,wrapperProps:i={}}=e;const s=null!=r,l=null!=n;return!s&&l?(t=a||"span",i={...i,className:c()(i.className,"screen-reader-text")},Object(o.createElement)(t,i,n)):(t=a||o.Fragment,s&&l&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))}},3:function(e,t){e.exports=window.wp.components},34:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(35);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):"api"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},35:function(e,t){e.exports=window.wp.escapeHtml},383:function(e,t,r){e.exports=r(501)},5:function(e,t){e.exports=window.wp.blockEditor},501:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(10),a=r(119),i=r(535),s=(r(166),r(5)),l=r(3),d=r(158),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),label:Object(n.__)("All Reviews","woo-gutenberg-products-block")},Object(n.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block")),b=r(112),w=r(152),p=r(153),m=r(129);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{icon:i.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...m.a,attributes:{...m.a.attributes,showProductName:!0}},attributes:{...w.a,showProductName:{type:"boolean",default:!0}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:e=>{let{instance:t}=e;return Object(c.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:e=>{let{attributes:t,setAttributes:r}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(l.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(b.b)(t,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(b.c)(t,r))),Object(o.createElement)(d.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},57:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(14),n=r.n(o),c=r(4),a=r.n(c),i=r(2);const s=e=>{if(Object(i.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map(e=>e.join("=")).join("&"),parse:!1}).then(e=>e.json().then(t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:i,showProductName:s,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":i,"has-product-name":s})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:i,showOrderby:s}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":i,"data-show-orderby":s};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},75:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(119),a=r(184),i=r(4),s=r.n(i),l=r(3),d=r(34);r(120),t.a=e=>{let{className:t,error:r,isLoading:i=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,i?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:u},Object(n.__)("Retry","woo-gutenberg-products-block"))))}},8:function(e,t){e.exports=window.lodash}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var o,a,i=t[0],s=t[1],l=t[2],u=0,b=[];u<i.length;u++)a=i[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o]);for(d&&d(t);b.length;)b.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],o=!0,i=1;i<r.length;i++){var s=r[i];0!==n[s]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={7:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=o,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var d=s;return c.push([383,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.blocks},11:function(e,t){e.exports=window.wp.compose},111:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var o=r(0),n=r(1),c=r(5),a=r(2),i=r(3);const s=(e,t,r)=>Object(o.createElement)(c.BlockControls,null,Object(o.createElement)(i.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),l=(e,t)=>{const r=Object(a.getSetting)("showAvatars",!0),c=Object(a.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!c&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.__experimentalToggleGroupControl,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,onChange:e=>t({imageType:e})},Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"reviewer",label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block")}),Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"product",label:Object(n.__)("Product","woo-gutenberg-products-block")})),"reviewer"===e.imageType&&!r&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(i.SelectControl,{label:Object(n.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:e=>t({orderby:e})}),Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))},119:function(e,t){},12:function(e,t){e.exports=window.React},122:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(28),i=r(11);r(165),t.a=Object(i.withInstanceId)(e=>{let{className:t,instanceId:r,label:n="",onChange:i,options:s,screenReaderLabel:l,value:d=""}=e;const u="wc-block-components-sort-select__select-"+r;return Object(o.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:n,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:u}}),Object(o.createElement)("select",{id:u,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:i,value:d},s&&s.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},13:function(e,t){e.exports=window.wp.primitives},131:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(21);const c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(o.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
2
  /* translators: An example person name used for the block previews. */
3
  reviewer:Object(o.__)("Alice","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
4
  /* translators: An example person name used for the block previews. */
5
+ reviewer:Object(o.__)("Bob","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("This product is awesome, I love it!","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:null,verified:!1}]}}},14:function(e,t){e.exports=window.wp.apiFetch},15:function(e,t){e.exports=window.wp.htmlEntities},152:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},153:function(e,t,r){"use strict";var o=r(6),n=r.n(o),c=r(0),a=r(5),i=(r(164),r(57));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(i.a)(t)}),Object(i.b)(t)))}},156:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(8),a=r(3),i=r(5),s=r(12),l=r(2),d=r(75),u=r(28);r(195);var b=e=>{let{onClick:t,label:r=Object(n.__)("Load more","woo-gutenberg-products-block"),screenReaderLabel:c=Object(n.__)("Load more","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(o.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(o.createElement)(u.a,{label:r,screenReaderLabel:c})))},w=r(122);r(192);var p=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(w.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(n.__)("Order by","woo-gutenberg-products-block"),onChange:t,options:[{key:"most-recent",label:Object(n.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(n.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(n.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(n.__)("Order reviews by","woo-gutenberg-products-block"),value:c})},m=r(4),g=r.n(m),v=r(24),h=r.n(v),_=r(179),O=r.n(_);const j=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=O()(e,{suffix:r,limit:t});return o.html},f=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),k=(e,t,r,o)=>{const n=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=j(e,o.middle),o=f(o,t.clientHeight,r);return o.middle})(e,t,r);return j(e,n-o.length,o)},y={className:"read-more-content",ellipsis:"&hellip;",lessText:Object(n.__)("Read less","woo-gutenberg-products-block"),maxLines:3,moreText:Object(n.__)("Read more","woo-gutenberg-products-block")};class R extends s.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(s.createRef)(),this.reviewSummary=Object(s.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:k(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:n}=this.props,c=e?r:n;if(c)return Object(o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:n,isExpanded:c}=this.state;return t?!1===n?Object(o.createElement)("div",{className:e},Object(o.createElement)("div",{ref:this.reviewContent},t)):Object(o.createElement)("div",{className:e},(!c||null===n)&&Object(o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:r}}),(c||null===n)&&Object(o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},t),this.getButton()):null}}h()(R,"defaultProps",y);var E=R;r(194);var S=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:i,showReviewImage:s,showReviewRating:l,showReviewContent:d,showProductName:u}=t,{rating:b}=r,w=!Object.keys(r).length>0,p=Number.isFinite(b)&&l;return Object(o.createElement)("li",{className:g()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":w,"wc-block-components-review-list-item__item--has-image":s}),"aria-hidden":w},(u||a||i||s||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},s&&function(e,t,r){var c,a;return r||!e?Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(o.createElement)("img",{"aria-hidden":"true",alt:(null===(c=e.product_image)||void 0===c?void 0:c.alt)||"",src:(null===(a=e.product_image)||void 0===a?void 0:a.thumbnail)||""}):Object(o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&Object(o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(n.__)("Verified buyer","woo-gutenberg-products-block")},Object(n.__)("Verified buyer","woo-gutenberg-products-block")))}(r,c,w),(u||i||p||a)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},p&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},c=Object(n.sprintf)(
6
  /* translators: %f is referring to the average rating value */
7
  Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),a={__html:Object(n.sprintf)(
8
  /* translators: %s is referring to the average rating value */
9
+ Object(n.__)("Rated %s out of 5","woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(r),u&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(r),i&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(r),a&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(r))),d&&function(e){return Object(o.createElement)(E,{maxLines:10,moreText:Object(n.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(n.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(r))};r(193);var C=e=>{let{attributes:t,reviews:r}=e;const n=Object(l.getSetting)("showAvatars",!0),c=Object(l.getSetting)("reviewRatingsEnabled",!0),a=(n||"product"===t.imageType)&&t.showReviewImage,i=c&&t.showReviewRating,s={...t,showReviewImage:a,showReviewRating:i};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:s}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:s,review:e})))},T=r(6),P=r.n(T),N=r(25),L=r.n(N),x=r(57),A=r(29);class M extends s.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:i,totalReviews:s}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===i.length&&!r)return Object(o.createElement)(c,{attributes:e});const u=Object(l.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&u&&Object(o.createElement)(p,{readOnly:!0,value:e.orderby}),Object(o.createElement)(C,{attributes:e,reviews:i}),e.showLoadMore&&s>i.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var I=(e=>{class t extends s.Component{constructor(){super(...arguments),h()(this,"isPreview",!!this.props.attributes.previewReviews),h()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),h()(this,"isMounted",!1),h()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),h()(this,"setError",async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(A.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)})}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!L()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:n,reviewsToDisplay:c}=this.props,a={order:r,orderby:o,per_page:c-e,offset:e};if(t){const e=Array.isArray(t)?t:JSON.parse(t);a.category_id=Array.isArray(e)?e.join(","):e}return n&&(a.product_id=n),a}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(x.c)(this.getArgs(e.length)).then(t=>{let{reviews:r,totalReviews:o}=t;return this.isMounted&&this.setState({reviews:e.filter(e=>Object.keys(e).length).concat(r),totalReviews:o,loading:!1,error:null}),{newReviews:r}}).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,P()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}h()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(M);t.a=e=>{let{attributes:t,icon:r,name:s,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:v,showReviewRating:h}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||h||p||m||v||w),f=Object(i.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:s},Object(n.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")):Object(o.createElement)("div",f,Object(o.createElement)(I,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},164:function(e,t){},165:function(e,t){},192:function(e,t){},193:function(e,t){},194:function(e,t){},195:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},21:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return i})),r.d(t,"n",(function(){return s})),r.d(t,"j",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return v})),r.d(t,"i",(function(){return h})),r.d(t,"b",(function(){return _}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,d=n.STORE_PAGES.checkout.id,u=n.STORE_PAGES.checkout.permalink,b=n.STORE_PAGES.privacy.permalink,w=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),p=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),m=n.STORE_PAGES.cart.permalink,g=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),v=Object(n.getSetting)("allowedCountries",{}),h=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},28:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:a,wrapperProps:i={}}=e;const s=null!=r,l=null!=n;return!s&&l?(t=a||"span",i={...i,className:c()(i.className,"screen-reader-text")},Object(o.createElement)(t,i,n)):(t=a||o.Fragment,s&&l&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))}},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var o=r(1),n=r(15);const c=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(n.decodeEntities)(e.message):Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},3:function(e,t){e.exports=window.wp.components},34:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(35);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):"api"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},35:function(e,t){e.exports=window.wp.escapeHtml},383:function(e,t,r){e.exports=r(501)},5:function(e,t){e.exports=window.wp.blockEditor},501:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(10),a=r(118),i=r(532),s=(r(164),r(5)),l=r(3),d=r(156),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),label:Object(n.__)("All Reviews","woo-gutenberg-products-block")},Object(n.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block")),b=r(111),w=r(152),p=r(153),m=r(131);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{icon:i.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...m.a,attributes:{...m.a.attributes,showProductName:!0}},attributes:{...w.a,showProductName:{type:"boolean",default:!0}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:e=>{let{instance:t}=e;return Object(c.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:e=>{let{attributes:t,setAttributes:r}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(l.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(b.b)(t,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(b.c)(t,r))),Object(o.createElement)(d.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},57:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(14),n=r.n(o),c=r(4),a=r.n(c),i=r(2);const s=e=>{if(Object(i.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map(e=>e.join("=")).join("&"),parse:!1}).then(e=>e.json().then(t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:i,showProductName:s,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":i,"has-product-name":s})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:i,showOrderby:s}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":i,"data-show-orderby":s};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},75:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(118),a=r(186),i=r(4),s=r.n(i),l=r(3),d=r(34);r(119),t.a=e=>{let{className:t,error:r,isLoading:i=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,i?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:u},Object(n.__)("Retry","woo-gutenberg-products-block"))))}},8:function(e,t){e.exports=window.lodash}});
build/attribute-filter-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '83174a60e3970a0381e6a61ea28ab383');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '1aa213a2228d69f424f02252a8ebf4c2');
build/attribute-filter-frontend.js CHANGED
@@ -1,14 +1,14 @@
1
- !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}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=243)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.data},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var s=typeof r;if("string"===s||"number"===s)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===s)if(r.toString===Object.prototype.toString)for(var c in r)n.call(r,c)&&r[c]&&e.push(c);else e.push(r.toString())}}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=window.lodash},function(e,t){e.exports=window.React},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t){e.exports=window.wc.blocksCheckout},function(e,t){e.exports=window.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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(16),o=n.n(r),s=n(0),i=n(7),c=n(1),a=n(44),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(c.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(c.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(c.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(s.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(s.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(s.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(s.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(s.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(s.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(s.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};n(33);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(s.createElement)(s.Fragment,null,Object(s.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:i,renderError:c,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof c?c({errorMessage:u}):Object(s.createElement)(l,{showErrorBlock:r,errorMessage:n?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},,function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wp.htmlEntities},function(e,t,n){"use strict";var r=n(0),o=n(5),s=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:i,wrapperProps:c={}}=e;const a=null!=n,l=null!=o;return!a&&l?(t=i||"span",c={...c,className:s()(c.className,"screen-reader-text")},Object(r.createElement)(t,c,o)):(t=i||r.Fragment,a&&l&&n!==o?Object(r.createElement)(t,c,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,c,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0);const o=Object(r.createContext)("page"),s=()=>Object(r.useContext)(o);o.Provider},function(e,t){e.exports=window.wp.a11y},,function(e,t,n){"use strict";(function(e){var r=n(0);n(37);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(65))},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(12),s=n.n(o);function i(e){const t=Object(r.useRef)(e);return s()(e,t.current)||(t.current=e),t.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f}));var r=n(3),o=n(4),s=n(0),i=n(12),c=n.n(i),a=n(27),l=n(61),u=n(23);const d=e=>{const t=Object(u.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(s.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const c=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(s.useCallback)(t=>{a(n,e,t)},[n,e,a])]},f=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,o]=d(t),i=Object(a.a)(r),p=Object(a.a)(e),f=Object(l.a)(p),b=Object(s.useRef)(!1);return Object(s.useEffect)(()=>{c()(f,p)||(o(Object.assign({},i,p)),b.current=!0)},[i,p,f,o]),b.current?[r,o]:[e,o]}},,,function(e,t){},,function(e,t,n){"use strict";var r=n(5),o=n.n(r),s=n(0);t.a=Object(s.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(s.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},,function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(11),o=n.n(r),s=n(0),i=n(15);const c=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:c=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),l=c(e,n),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:c={},errorBoundaryProps:a={}}=e;Object(s.render)(Object(s.createElement)(i.a,a,Object(s.createElement)(s.Suspense,{fallback:Object(s.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(s.createElement)(t,o()({},c,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(c.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:s}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:s}=e;const i=document.body.querySelectorAll(o);s&&s.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,s)),a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:s,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:s}=e;const i=s.querySelectorAll(o);a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},,function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(14),i=function({icon:e,className:t,...n}){const s=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:s},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(i,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===s.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(s.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},,,function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(5),i=n.n(s),c=n(6),a=n(20),l=n.n(a),u=n(10),d=n(45),p=n(90),f=n(1);function b(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const s=o.getBoundingClientRect();return new r.DOMRect(e.left+s.left,e.top+s.top,e.width,e.height)}let m=0;function h(e){const t=document.scrollingElement||document.body;e&&(m=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=m)}let g=0;function O(){return Object(o.useEffect)(()=>(0===g&&h(!0),++g,()=>{1===g&&h(!1),--g}),[]),null}var v=n(26);function j(e){const t=Object(o.useContext)(v.a),n=t.slots[e]||{},r=t.fills[e],s=Object(o.useMemo)(()=>r||[],[r]);return{...n,updateSlot:Object(o.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:s,registerFill:Object(o.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var w=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function y({name:e,children:t,registerFill:n,unregisterFill:r}){const s=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(w),[r,s]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(s(t(e)),n(()=>{s(t(e))})),[e]),r})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,i.current),()=>r(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,s&&s.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))},[e]),s&&s.node?(Object(c.isFunction)(t)&&(t=t(s.props.fillProps)),Object(o.createPortal)(t,s.node)):null}var E=e=>Object(o.createElement)(w.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(y,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class k extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,s=Object(c.map)(r(t,this),e=>{const t=Object(c.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(c.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(c.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(c.isFunction)(e)?e(s):s)}}var _=e=>Object(o.createElement)(w.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:s})=>Object(o.createElement)(k,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:s})));function S(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function x({name:e,children:t}){const n=j(e),r=Object(o.useRef)({rerender:S()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var T=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...s},i){const c=Object(o.useContext)(v.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(c.registerSlot(e,a,t),()=>{c.unregisterSlot(e,a)}),[c.registerSlot,c.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{c.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,a])},s))}));function C(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E,e),Object(o.createElement)(x,e))}n(12),o.Component;const L=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(T,Object(r.a)({},t,{ref:n})):Object(o.createElement)(_,t));function I(e){return"appear"===e?"top":"left"}function A(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:s}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const c=n?parseInt(n,10):0,a=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=s?parseInt(s,10):0;return{x:e.left+l,y:e.top+c,width:e.width-l-u,height:e.height-c-a,left:e.left+l,right:e.right-u,top:e.top+c,bottom:e.bottom-a}}function R(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function F(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function P(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const N=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:s,noArrow:c=!0,isAlternate:a,position:m="bottom right",range:h,focusOnMount:g="firstElement",anchorRef:v,shouldAnchorIncludePadding:w,anchorRect:y,getAnchorRect:E,expandOnMobile:k,animate:_=!0,onClickOutside:S,onFocusOutside:x,__unstableStickyBoundaryElement:T,__unstableSlotName:L="Popover",__unstableObserveElement:N,__unstableBoundaryParent:M,__unstableForcePosition:B,__unstableForceXAlignment:D,...V},W)=>{const H=Object(o.useRef)(null),q=Object(o.useRef)(null),z=Object(o.useRef)(),K=Object(u.useViewportMatch)("medium","<"),[U,$]=Object(o.useState)(),Q=j(L),Y=k&&K,[J,X]=Object(u.useResizeObserver)();c=Y||c,Object(o.useLayoutEffect)(()=>{if(Y)return P(z.current,"is-without-arrow",c),P(z.current,"is-alternate",a),R(z.current,"data-x-axis"),R(z.current,"data-y-axis"),F(z.current,"top"),F(z.current,"left"),F(q.current,"maxHeight"),void F(q.current,"maxWidth");const e=()=>{if(!z.current||!q.current)return;let e=function(e,t,n,r=!1,o,s){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return b(t,t.ownerDocument||e.current.ownerDocument,s)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,s);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,s);return o?e:A(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),c=b(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,s);return o?c:A(c,r)}if(!e.current)return;const{parentNode:i}=e.current,c=i.getBoundingClientRect();return o?c:A(c,i)}(H,y,E,v,w,z.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=z.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var s;M&&(r=null===(s=z.current.closest(".popover-slot"))||void 0===s?void 0:s.parentNode);const i=X.height?X:q.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:h,contentHeight:g,contentWidth:O}=function(e,t,n="top",r,o,s,i,c,a){const[l,u="center",d]=n.split(" "),p=function(e,t,n,r,o,s,i,c){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let f,b=n,m=null;if(!o&&!c)if("middle"===n&&u.contentHeight===a)b="middle";else if("top"===n&&d.contentHeight===a)b="top";else if("bottom"===n&&p.contentHeight===a)b="bottom";else{b=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===b?d.contentHeight:p.contentHeight;m=e!==a?e:null}return f="middle"===b?u.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:f,contentHeight:m}}(e,t,l,d,r,0,s,c);return{...function(e,t,n,r,o,s,i,c,a){const{width:l}=t;"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.isRTL)()&&(n="left"),"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===r?p=e.right:"middle"===s||a||(p=u);let b=e.right;"left"===r?b=e.left:"middle"===s||a||(b=u);const m={popoverLeft:p,contentWidth:p-l>0?l:p},h={popoverLeft:b,contentWidth:b+l>window.innerWidth?window.innerWidth-b:l};let g,O=n,v=null;if(!o&&!c)if("center"===n&&d.contentWidth===l)O="center";else if("left"===n&&m.contentWidth===l)O="left";else if("right"===n&&h.contentWidth===l)O="right";else{O=m.contentWidth>h.contentWidth?"left":"right";const e="left"===O?m.contentWidth:h.contentWidth;l>window.innerWidth&&(v=window.innerWidth),e!==l&&(O="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===O?d.popoverLeft:"left"===O?m.popoverLeft:h.popoverLeft,i){const e=i.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:O,popoverLeft:g,contentWidth:v}}(e,t,u,d,r,p.yAxis,i,c,a),...p}}(e,i,m,T,z.current,o,r,B,D);"number"==typeof l&&"number"==typeof u&&(F(z.current,"top",l+"px"),F(z.current,"left",u+"px")),P(z.current,"is-without-arrow",c||"center"===p&&"middle"===h),P(z.current,"is-alternate",a),R(z.current,"data-x-axis",p),R(z.current,"data-y-axis",h),F(q.current,"maxHeight","number"==typeof g?g+"px":""),F(q.current,"maxWidth","number"==typeof O?O+"px":""),$(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))};e();const{ownerDocument:t}=z.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const s=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",s),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(v);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),N&&(l=new n.MutationObserver(e),l.observe(N,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",s),n.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[Y,y,E,v,w,m,X,T,N,M]);const Z=(e,n)=>{if("focus-outside"===e&&x)x(n);else if("focus-outside"===e&&S){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),S(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),ne=Object(u.useMergeRefs)([z,ee,W]),re=Boolean(_&&U)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=I(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:U});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",s,re,{"is-expanded":Y,"is-without-arrow":c,"is-alternate":a})},V,{ref:ne},te,{tabIndex:"-1"}),Y&&Object(o.createElement)(O,null),Y&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(G,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:q,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,n)));return Q.ref&&(oe=Object(o.createElement)(C,{name:L},oe)),v||y?oe:Object(o.createElement)("span",{ref:H},oe)});N.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(L,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var M=N,B=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(c.isString)(e)&&(n=e),Object(c.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const D=Object(o.createElement)("div",{className:"event-catcher"}),V=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:n}),","),e),W=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),H=(e,t,n)=>{if(1!==o.Children.count(e))return;const r=o.Children.only(e);"function"==typeof r.props[t]&&r.props[t](n)};var q=function({children:e,position:t,text:n,shortcut:r}){const[s,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",m),i(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",m),i(!1)},b=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,m=b("mouseUp"),h=(t,n)=>r=>{if(H(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&s)return;d.cancel();const o=Object(c.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",m)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const O={onMouseEnter:h("onMouseEnter",!0),onMouseLeave:h("onMouseLeave"),onClick:h("onClick"),onFocus:h("onFocus"),onBlur:h("onBlur"),onMouseDown:b("mouseDown")},v=o.Children.only(e),{children:j,disabled:w}=v.props;return(w?V:W)({child:v,eventHandlers:O,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:s})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(M,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},r,Object(o.createElement)(B,{className:"components-tooltip__shortcut",shortcut:s}))))({grandchildren:j,isOver:a,position:t,text:n,shortcut:r})})},z=n(40),K=n(35);const U=["onMouseDown","onClick"];var G=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:s,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:b,icon:m,iconPosition:h="left",iconSize:g,showTooltip:O,tooltipPosition:v,shortcut:j,label:w,children:y,text:E,variant:k,__experimentalIsFocusable:_,describedBy:S,...x}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:s,...i}){let c=s;var a,u,d,p,f;return t&&(null!==(a=c)&&void 0!==a||(c="primary")),r&&(null!==(u=c)&&void 0!==u||(c="tertiary")),n&&(null!==(d=c)&&void 0!==d||(c="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=c)&&void 0!==p||(c="secondary")),o&&(null!==(f=c)&&void 0!==f||(c="link")),{...i,variant:c}}(e),T=i()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":a,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!m&&!!y,"has-icon":!!m}),C=b&&!_,L=void 0===n||C?"button":"a",I="a"===L?{href:n,target:s}:{type:"button",disabled:C,"aria-pressed":u};if(b&&_){I["aria-disabled"]=!0;for(const e of U)x[e]=e=>{e.stopPropagation(),e.preventDefault()}}const A=!C&&(O&&w||j||!!w&&(!y||Object(c.isArray)(y)&&!y.length)&&!1!==O),R=S?Object(c.uniqueId)():null,F=x["aria-describedby"]||R,P=Object(o.createElement)(L,Object(r.a)({},I,x,{className:T,"aria-label":x["aria-label"]||w,"aria-describedby":F,ref:t}),m&&"left"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),E&&Object(o.createElement)(o.Fragment,null,E),m&&"right"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),y);return A?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(q,{text:S||w,shortcut:j,position:v},P),S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S))):Object(o.createElement)(o.Fragment,null,P,S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S)))}))},function(e,t,n){"use strict";n.d(t,"n",(function(){return s})),n.d(t,"l",(function(){return i})),n.d(t,"k",(function(){return c})),n.d(t,"m",(function(){return a})),n.d(t,"i",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return m})),n.d(t,"a",(function(){return h})),n.d(t,"h",(function(){return g})),n.d(t,"b",(function(){return O}));var r,o=n(2);const s=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=s.pluginUrl+"images/",c=s.pluginUrl+"build/",a=s.buildPhase,l=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),f=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),h=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),O=Object(o.getSetting)("allowedStates",{})},function(e,t){e.exports=window.wp.dom},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(7);function o(e,t,n){var o=this,s=Object(r.useRef)(null),i=Object(r.useRef)(0),c=Object(r.useRef)(null),a=Object(r.useRef)([]),l=Object(r.useRef)(),u=Object(r.useRef)(),d=Object(r.useRef)(e),p=Object(r.useRef)(!0);d.current=e;var f=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,h="maxWait"in n,g=h?Math.max(+n.maxWait||0,t):null;return Object(r.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(r.useMemo)((function(){var e=function(e){var t=a.current,n=l.current;return a.current=l.current=null,i.current=e,u.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(c.current),c.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-s.current,r=e-i.current;return!s.current||n>=t||n<0||h&&r>=g},O=function(t){return c.current=null,m&&a.current?e(t):(a.current=l.current=null,u.current)},v=function(){var e=Date.now();if(r(e))return O(e);if(p.current){var o=e-s.current,c=e-i.current,a=t-o,l=h?Math.min(a,g-c):a;n(v,l)}},j=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var m=Date.now(),g=r(m);if(a.current=d,l.current=o,s.current=m,g){if(!c.current&&p.current)return i.current=s.current,n(v,t),b?e(s.current):u.current;if(h)return n(v,t),e(s.current)}return c.current||n(v,t),u.current};return j.cancel=function(){c.current&&(f?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,a.current=s.current=l.current=c.current=null},j.isPending=function(){return!!c.current},j.flush=function(){return c.current?O(Date.now()):u.current},j}),[b,h,t,g,m,f])}},function(e,t,n){"use strict";var r=n(0);n(71),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s}));var r=n(0);const o=Object(r.createContext)({}),s=()=>{const{wrapper:e}=Object(r.useContext)(o);return t=>{e&&e.current&&(e.current.hidden=!t)}}},,,function(e,t){e.exports=window.wp.keycodes},function(e,t,n){"use strict";n.d(t,"d",(function(){return c})),n.d(t,"h",(function(){return a})),n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return u})),n.d(t,"e",(function(){return d})),n.d(t,"f",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"g",(function(){return b}));var r=n(13),o=n(70),s=n(28),i=n(124);function c(){return Math.floor(Math.random()*Date.now())}const a=e=>e.replace("pa_",""),l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:s}=e,i=a(t),c=r.join(","),l=`${o.b}${i}`,u="in"===s?"or":"and";n[`${o.a}${i}`]=c,n[l]=u});const s=Object(r.removeQueryArgs)(e,...Object.keys(n));return Object(r.addQueryArgs)(s,n)},u=e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length},d=e=>{if(e){const t=Object(o.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]},p=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,o]=n;return e[r]===o&&t},!0)},f=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),b=e=>({className:Object(s.a)(null==e?void 0:e.className)?e.className:"",attributeId:parseInt(Object(s.a)(null==e?void 0:e.attributeId)?e.attributeId:"0",10),showCounts:"false"!==(null==e?void 0:e.showCounts),queryType:Object(s.a)(null==e?void 0:e.queryType)&&e.queryType||i.attributes.queryType.default,heading:Object(s.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(s.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||i.attributes.headingLevel.default,displayStyle:Object(s.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||i.attributes.displayStyle.default,showFilterButton:"true"===(null==e?void 0:e.showFilterButton),selectType:Object(s.a)(null==e?void 0:e.selectType)&&e.selectType||i.attributes.selectType.default,isPreview:!1})},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(3),o=n(4),s=n(0),i=n(27),c=n(73);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(s.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),f=Object(i.a)(a),b=Object(c.a)(),m=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),s=[t,n,p,f],i=o.getCollectionError(...s);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(i)}return{results:o.getCollection(...s),isLoading:!o.hasFinishedResolution("getCollection",s)}},[t,n,f,p,u]);return null!==m&&(d.current=m),d.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(7);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(22);n(134),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(s.a,{label:n.toString(),screenReaderLabel:Object(o.sprintf)(
2
  /* translators: %s number of products. */
3
- Object(o._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},,,function(e,t){var n,r,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=c(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new b(e,t)),1!==l.length||u||c(f)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return u}));var r=n(13),o=n(2),s=n(69);const i=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,s.a),c="query_type_",a="filter_";function l(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){i?window.location.href=e:window.history.replaceState({},"",e)}},function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(14);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=s},,,,function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(5),i=n.n(s),c=n(22);n(115),t.a=e=>{let{className:t,label:
4
  /* translators: Reset button text for filters. */
5
- n=Object(o.__)("Reset","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:a=Object(o.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:i()("wc-block-components-filter-reset-button",t),onClick:s},Object(r.createElement)(c.a,{label:n,screenReaderLabel:a}))}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(5),i=n.n(s),c=n(22);n(116),t.a=e=>{let{className:t,isLoading:n,disabled:s,label:
6
  /* translators: Submit button text for filters. */
7
- a=Object(o.__)("Apply","woo-gutenberg-products-block"),onClick:l,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:i()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:s,onClick:l},Object(r.createElement)(c.a,{label:a,screenReaderLabel:u}))}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(5),i=n.n(s),c=n(9);n(117),t.a=e=>{let{className:t,onChange:n,options:s=[],checked:a=[],isLoading:l=!1,isDisabled:u=!1,limit:d=10}=e;const[p,f]=Object(r.useState)(!1),b=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),m=Object(r.useMemo)(()=>{const e=s.length-d;return!p&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{f(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)(
8
  /* translators: %s is referring the remaining count of options */
9
  Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
10
  /* translators: %s number of options to reveal. */
11
- Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[s,d,p]),h=Object(r.useMemo)(()=>p&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{f(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[p]),g=Object(r.useMemo)(()=>{const e=s.length>d+5;return Object(r.createElement)(r.Fragment,null,s.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!p&&o>=d&&{hidden:!0},Object(r.createElement)(c.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:a.includes(t.value),onChange:()=>{n(t.value)}})),e&&o===d-1&&m)),e&&h)},[s,n,a,p,d,h,m,u]),O=i()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":l},t);return Object(r.createElement)("ul",{className:O},l?b:g)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(7),o=n(50);function s(e,t){return e===t}function i(e){return"function"==typeof e?function(){return e}:e}function c(e,t,n){var c=n&&n.equalityFn||s,a=function(e){var t=Object(r.useState)(i(e)),n=t[0],o=t[1];return[n,Object(r.useCallback)((function(e){return o(i(e))}),[])]}(e),l=a[0],u=a[1],d=Object(o.a)(Object(r.useCallback)((function(e){return u(e)}),[u]),t,n),p=Object(r.useRef)(e);return c(p.current,e)||(d(e),p.current=e),[l,d]}},function(e,t,n){"use strict";var r=n(0),o=n(6),s=n(5),i=n.n(s),c=n(1),a=n(24),l=n(90),u=n(43);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:s=n,onRemove:p=o.noop,isDismissible:f=!0,actions:b=[],politeness:m=d(t),__unstableHTML:h,onDismiss:g=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(a.speak)(n,t)},[n,t])}(s,m);const O=i()(e,"components-notice","is-"+t,{"is-dismissible":f});return h&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:O},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},b.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:s=!1,onClick:c,url:a},l)=>{let d=o;return"primary"===o||s||(d=a?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:c,className:i()("components-notice__action",e)},t)}))),f&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(c.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),g(),p()},showTooltip:!1}))}},,function(e,t){e.exports=window.wp.blocks},,,,,,,,function(e,t){e.exports=window.wp.blockEditor},,,function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s}));var r=n(6);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const s=e.filter(e=>e.attribute===n.taxonomy),i=s.length?s[0]:null;if(!(i&&i.slug&&Array.isArray(i.slug)&&i.slug.includes(o)))return;const c=i.slug.filter(e=>e!==o),a=e.filter(e=>e.attribute!==n.taxonomy);c.length>0&&(i.slug=c.sort(),a.push(i)),t(Object(r.sortBy)(a,"attribute"))},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const i=e.filter(e=>e.attribute!==n.taxonomy);return 0===o.length?t(i):(i.push({attribute:n.taxonomy,operator:s,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(i,"attribute"))),i}},,,function(e,t){},function(e,t){},function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}));var r=n(2);const o=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),s=e=>{if(e)return o.find(t=>t.id===e)},i=e=>{if(e)return o.find(t=>t.taxonomy===e)}},,,,,function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(28),o=n(18);const s=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n(0),o=n(97),s=n(6),i=n(27),c=n(18),a=n(30),l=n(60),u=n(23);const d=e=>{let{queryAttribute:t,queryPrices:n,queryStock:d,queryRating:p,queryState:f}=e,b=Object(u.a)();b+="-collection-data";const[m]=Object(a.a)(b),[h,g]=Object(a.b)("calculate_attribute_counts",[],b),[O,v]=Object(a.b)("calculate_price_range",null,b),[j,w]=Object(a.b)("calculate_stock_status_counts",null,b),[y,E]=Object(a.b)("calculate_rating_counts",null,b),k=Object(i.a)(t||{}),_=Object(i.a)(n),S=Object(i.a)(d),x=Object(i.a)(p);Object(r.useEffect)(()=>{"object"==typeof k&&Object.keys(k).length&&(h.find(e=>Object(c.b)(k,"taxonomy")&&e.taxonomy===k.taxonomy)||g([...h,k]))},[k,h,g]),Object(r.useEffect)(()=>{O!==_&&void 0!==_&&v(_)},[_,v,O]),Object(r.useEffect)(()=>{j!==S&&void 0!==S&&w(S)},[S,w,j]),Object(r.useEffect)(()=>{y!==x&&void 0!==x&&E(x)},[x,E,y]);const[T,C]=Object(r.useState)(!1),[L]=Object(o.a)(T,200);T||C(!0);const I=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(s.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(m),[m]);return Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...f,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...I},shouldSelect:L})}},,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(5),i=n.n(s);class c extends o.Component{constructor(){super(...arguments),this.onChange=this.onChange.bind(this),this.bindInput=this.bindInput.bind(this)}focus(){this.input.focus()}hasFocus(){return this.input===this.input.ownerDocument.activeElement}bindInput(e){this.input=e}onChange(e){this.props.onChange({value:e.target.value})}render(){const{value:e,isExpanded:t,instanceId:n,selectedSuggestionIndex:s,className:c,...a}=this.props,l=e?e.length+1:0;return Object(o.createElement)("input",Object(r.a)({ref:this.bindInput,id:"components-form-token-input-"+n,type:"text"},a,{value:e||"",onChange:this.onChange,size:l,className:i()(c,"components-form-token-field__input"),autoComplete:"off",role:"combobox","aria-expanded":t,"aria-autocomplete":"list","aria-owns":t?"components-form-token-suggestions-"+n:void 0,"aria-activedescendant":-1!==s?`components-form-token-suggestions-${n}-${s}`:void 0,"aria-describedby":"components-form-token-suggestions-howto-"+n}))}}t.a=c},function(e,t,n){"use strict";var r=n(0),o=n(6),s=n(150),i=n.n(s),c=n(5),a=n.n(c),l=n(10);class u extends r.Component{constructor(){super(...arguments),this.handleMouseDown=this.handleMouseDown.bind(this),this.bindList=this.bindList.bind(this)}componentDidUpdate(){this.props.selectedIndex>-1&&this.props.scrollIntoView&&this.list.children[this.props.selectedIndex]&&(this.scrollingIntoView=!0,i()(this.list.children[this.props.selectedIndex],this.list,{onlyScrollIfNeeded:!0}),this.props.setTimeout(()=>{this.scrollingIntoView=!1},100))}bindList(e){this.list=e}handleHover(e){return()=>{this.scrollingIntoView||this.props.onHover(e)}}handleClick(e){return()=>{this.props.onSelect(e)}}handleMouseDown(e){e.preventDefault()}computeSuggestionMatch(e){const t=this.props.displayTransform(this.props.match||"").toLocaleLowerCase();if(0===t.length)return null;const n=(e=this.props.displayTransform(e)).toLocaleLowerCase().indexOf(t);return{suggestionBeforeMatch:e.substring(0,n),suggestionMatch:e.substring(n,n+t.length),suggestionAfterMatch:e.substring(n+t.length)}}render(){return Object(r.createElement)("ul",{ref:this.bindList,className:"components-form-token-field__suggestions-list",id:"components-form-token-suggestions-"+this.props.instanceId,role:"listbox"},Object(o.map)(this.props.suggestions,(e,t)=>{const n=this.computeSuggestionMatch(e),o=a()("components-form-token-field__suggestion",{"is-selected":t===this.props.selectedIndex});return Object(r.createElement)("li",{id:`components-form-token-suggestions-${this.props.instanceId}-${t}`,role:"option",className:o,key:null!=e&&e.value?e.value:this.props.displayTransform(e),onMouseDown:this.handleMouseDown,onClick:this.handleClick(e),onMouseEnter:this.handleHover(e),"aria-selected":t===this.props.selectedIndex},n?Object(r.createElement)("span",{"aria-label":this.props.displayTransform(e)},n.suggestionBeforeMatch,Object(r.createElement)("strong",{className:"components-form-token-field__suggestion-match"},n.suggestionMatch),n.suggestionAfterMatch):this.props.displayTransform(e))}))}}u.defaultProps={match:"",onHover:()=>{},onSelect:()=>{},suggestions:Object.freeze([])},t.a=Object(l.withSafeTimeout)(u)},function(e,t,n){"use strict";e.exports=n(218)},,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(276),i=n(27),c=n(61),a=n(30),l=n(60),u=n(135),d=n(62),p=n(94),f=n(95),b=n(12),m=n.n(b),h=n(21),g=n(98),O=n(2),v=n(13),j=n(69),w=n(28),y=n(18),E=n(224),k=n(111),_=n(283),S=n(70),x=n(6),T=n(11),C=n.n(T),L=n(285),I=n(5),A=n.n(I);n(225);var R=e=>{let{className:t,style:n,suggestions:o,multiple:s=!0,saveTransform:i=(e=>e.trim().replace(/\s/g,"-")),messages:c={},validateInput:a=(e=>o.includes(e)),label:l="",...u}=e;return Object(r.createElement)("div",{className:A()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!s}),style:n},Object(r.createElement)(L.a,C()({label:l,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:a,saveTransform:i,maxLength:s?void 0:1,suggestions:o,messages:c},u)))},F=n(51),P=n(119),N=n(112);const M=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(r.createElement)(d.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(r.createElement)(d.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(r.createElement)(d.a,{name:"Red",count:2}),textLabel:"Red (2)"}],B={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(223);var D=n(59),V=n(96),W=e=>{let{isLoading:t=!1,options:n,checked:o,onChange:s}=e;return t?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("span",{className:"is-loading"})):Object(r.createElement)(V.a,{className:"wc-block-attribute-filter-list",options:n,checked:o,onChange:s,isLoading:t,isDisabled:t})},H=n(55);t.a=e=>{let{attributes:t,isEditor:n=!1}=e;const b=Object(O.getSettingWithCoercion)("has_filterable_products",!1,j.a),T=Object(O.getSettingWithCoercion)("is_rendering_php_template",!1,j.a),C=Object(O.getSettingWithCoercion)("page_url",window.location.href,w.a),[L,I]=Object(r.useState)(!1),V=t.isPreview&&!t.attributeId?B:Object(P.a)(t.attributeId),q=Object(r.useMemo)(()=>Object(D.e)(V),[V]),[z,K]=Object(r.useState)(q),[U,G]=Object(r.useState)(Object(D.d)()),[$,Q]=Object(r.useState)(t.isPreview&&!t.attributeId?M:[]),Y=Object(s.a)(t),[J]=Object(a.a)(),[X,Z]=Object(a.b)("attributes",[]),{results:ee,isLoading:te}=Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==V?void 0:V.id)||0],shouldSelect:t.attributeId>0}),ne="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:re,isLoading:oe}=Object(u.a)({queryAttribute:{taxonomy:(null==V?void 0:V.taxonomy)||"",queryType:t.queryType},queryState:{...J,attributes:ne?J.attributes:null}}),se=Object(r.useCallback)(e=>Object(y.b)(re,"attribute_counts")&&Array.isArray(re.attribute_counts)?re.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[re]);Object(r.useEffect)(()=>{if(te||oe)return;if(!Array.isArray(ee))return;const e=ee.map(e=>{const n=se(e.id);if(!(n||z.includes(e.slug)||(o=e.slug,null!=J&&J.attributes&&J.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==V?void 0:V.taxonomy)&&n.includes(o)}))))return null;var o;const s=n?n.count:0;return{formattedValue:Object(D.c)(e.slug),value:e.slug,name:Object(h.decodeEntities)(e.name),label:Object(r.createElement)(d.a,{name:Object(h.decodeEntities)(e.name),count:t.showCounts?s:null}),textLabel:t.showCounts?`${Object(h.decodeEntities)(e.name)} (${s})`:Object(h.decodeEntities)(e.name)}}).filter(e=>!!e);Q(e),G(Object(D.d)())},[null==V?void 0:V.taxonomy,ee,te,t.showCounts,oe,se,z,J.attributes]);const ie=Object(r.useCallback)(e=>Array.isArray(ee)?ee.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[ee]),ce=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==V||!V.taxonomy)return;const t=Object.keys(Object(v.getQueryArgs)(window.location.href)),n=Object(D.h)(V.taxonomy),r=t.reduce((e,t)=>t.includes(S.b+n)||t.includes(S.a+n)?Object(v.removeQueryArgs)(e,t):e,window.location.href),o=Object(D.b)(r,e);Object(S.c)(o)}else{const t=Object(D.b)(C,e),n=Object(v.getQueryArgs)(window.location.href),r=Object(v.getQueryArgs)(t);Object(D.f)(n,r)||Object(S.c)(t)}}),[C,null==V?void 0:V.taxonomy]),ae=e=>{const n=Object(N.b)(X,Z,V,ie(e),"or"===t.queryType?"in":"and");ce(n,0===e.length)},le=Object(r.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(K(e),!r&&t.showFilterButton||Object(N.b)(X,Z,V,ie(e),"or"===t.queryType?"in":"and"))}),[n,K,X,Z,V,ie,t.queryType,t.showFilterButton]),ue=Object(r.useMemo)(()=>Object(E.a)(X)?X.filter(e=>{let{attribute:t}=e;return t===(null==V?void 0:V.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[X,null==V?void 0:V.taxonomy]),de=Object(i.a)(ue),pe=Object(c.a)(de);Object(r.useEffect)(()=>{!pe||m()(pe,de)||m()(z,de)||le(de)},[z,de,pe,le]);const fe="single"!==t.selectType,be=Object(r.useCallback)(e=>{const t=z.includes(e);let n;fe?(n=z.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],le(n)},[z,fe,le]);Object(r.useEffect)(()=>{V&&!t.showFilterButton&&(Object(D.a)({currentCheckedFilters:z,hasSetFilterDefaultsFromUrl:L})?ce(X,!0):ce(X,!1))},[L,ce,X,V,z,t.showFilterButton]),Object(r.useEffect)(()=>{if(!L&&!te)return q.length>0?(I(!0),void le(q,!0)):void(T||I(!0))},[V,L,te,le,q,T]);const me=Object(H.b)();if(!b)return me(!1),null;if(!V)return n?Object(r.createElement)(g.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(o.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(me(!1),null);if(0===$.length&&!te&&n)return Object(r.createElement)(g.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(o.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const he="h"+t.headingLevel,ge=!t.isPreview&&te,Oe=!t.isPreview&&oe,ve=(ge||Oe)&&0===$.length;if(!ve&&0===$.length)return me(!1),null;const je=Object(r.createElement)(he,{className:"wc-block-attribute-filter__title"},t.heading),we=ve?Object(r.createElement)(F.a,null,je):je;return me(!0),Object(r.createElement)(r.Fragment,null,!n&&t.heading&&we,Object(r.createElement)("div",{className:A()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(R,{key:U,className:A()(Y.className,{"single-selection":!fe,"is-loading":ve}),style:{...Y.style,borderStyle:"none"},suggestions:$.filter(e=>!z.includes(e.value)).map(e=>e.formattedValue),disabled:ve,placeholder:Object(o.sprintf)(
12
  /* translators: %s attribute name. */
13
  Object(o.__)("Select %s","woo-gutenberg-products-block"),V.label),onChange:e=>{!fe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=$.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(x.difference)(e,z);if(1===t.length)return be(t[0]);const n=Object(x.difference)(z,e);1===n.length&&be(n[0])},value:z,displayTransform:e=>{const t=$.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:D.c,messages:{added:Object(o.sprintf)(
14
  /* translators: %s is the attribute label. */
@@ -18,8 +18,8 @@ Object(o.__)("%s filter removed.","woo-gutenberg-products-block"),V.label),remov
18
  /* translators: %s is the attribute label. */
19
  Object(o.__)("Remove %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase()),__experimentalInvalid:Object(o.sprintf)(
20
  /* translators: %s is the attribute label. */
21
- Object(o.__)("Invalid %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase())}}),fe&&Object(r.createElement)(k.a,{icon:_.a,size:30})):Object(r.createElement)(W,{options:$,checked:z,onChange:be,isLoading:ve,isDisabled:ve})),Object(r.createElement)("div",{className:"wc-block-attribute-filter__actions"},z.length>0&&!ve&&Object(r.createElement)(p.a,{onClick:()=>{K([]),G(Object(D.d)()),L&&ae([])},screenReaderLabel:Object(o.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(r.createElement)(f.a,{className:"wc-block-attribute-filter__button",isLoading:ve,disabled:ge||Oe||0===z.length,onClick:()=>ae(z)})))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n(100);var r=n(44);const o=()=>r.m>1},,,function(e,t,n){"use strict";var r=n(219);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=r.getWindow(t));var o=n.allowHorizontalScroll,s=n.onlyScrollIfNeeded,i=n.alignWithTop,c=n.alignWithLeft,a=n.offsetTop||0,l=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;o=void 0===o||o;var p=r.isWindow(t),f=r.offset(e),b=r.outerHeight(e),m=r.outerWidth(e),h=void 0,g=void 0,O=void 0,v=void 0,j=void 0,w=void 0,y=void 0,E=void 0,k=void 0,_=void 0;p?(y=t,_=r.height(y),k=r.width(y),E={left:r.scrollLeft(y),top:r.scrollTop(y)},j={left:f.left-E.left-l,top:f.top-E.top-a},w={left:f.left+m-(E.left+k)+d,top:f.top+b-(E.top+_)+u},v=E):(h=r.offset(t),g=t.clientHeight,O=t.clientWidth,v={left:t.scrollLeft,top:t.scrollTop},j={left:f.left-(h.left+(parseFloat(r.css(t,"borderLeftWidth"))||0))-l,top:f.top-(h.top+(parseFloat(r.css(t,"borderTopWidth"))||0))-a},w={left:f.left+m-(h.left+O+(parseFloat(r.css(t,"borderRightWidth"))||0))+d,top:f.top+b-(h.top+g+(parseFloat(r.css(t,"borderBottomWidth"))||0))+u}),j.top<0||w.top>0?!0===i?r.scrollTop(t,v.top+j.top):!1===i?r.scrollTop(t,v.top+w.top):j.top<0?r.scrollTop(t,v.top+j.top):r.scrollTop(t,v.top+w.top):s||((i=void 0===i||!!i)?r.scrollTop(t,v.top+j.top):r.scrollTop(t,v.top+w.top)),o&&(j.left<0||w.left>0?!0===c?r.scrollLeft(t,v.left+j.left):!1===c?r.scrollLeft(t,v.left+w.left):j.left<0?r.scrollLeft(t,v.left+j.left):r.scrollLeft(t,v.left+w.left):s||((c=void 0===c||!!c)?r.scrollLeft(t,v.left+j.left):r.scrollLeft(t,v.left+w.left)))}},function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};function s(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;"number"!=typeof(n=o.documentElement[r])&&(n=o.body[r])}return n}function i(e){return s(e)}function c(e){return s(e,!0)}function a(e){var t=function(e){var t,n=void 0,r=void 0,o=e.ownerDocument,s=o.body,i=o&&o.documentElement;return n=(t=e.getBoundingClientRect()).left,r=t.top,{left:n-=i.clientLeft||s.clientLeft||0,top:r-=i.clientTop||s.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=i(r),t.top+=c(r),t}var l=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),u=/^(top|right|bottom|left)$/,d="left",p=void 0;function f(e,t){for(var n=0;n<e.length;n++)t(e[n])}function b(e){return"border-box"===p(e,"boxSizing")}"undefined"!=typeof window&&(p=window.getComputedStyle?function(e,t,n){var r="",o=e.ownerDocument,s=n||o.defaultView.getComputedStyle(e,null);return s&&(r=s.getPropertyValue(t)||s[t]),r}:function(e,t){var n=e.currentStyle&&e.currentStyle[t];if(l.test(n)&&!u.test(t)){var r=e.style,o=r[d],s=e.runtimeStyle[d];e.runtimeStyle[d]=e.currentStyle[d],r[d]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[d]=o,e.runtimeStyle[d]=s}return""===n?"auto":n});var m=["margin","border","padding"];function h(e,t,n){var r={},o=e.style,s=void 0;for(s in t)t.hasOwnProperty(s)&&(r[s]=o[s],o[s]=t[s]);for(s in n.call(e),t)t.hasOwnProperty(s)&&(o[s]=r[s])}function g(e,t,n){var r=0,o=void 0,s=void 0,i=void 0;for(s=0;s<t.length;s++)if(o=t[s])for(i=0;i<n.length;i++){var c;c="border"===o?o+n[i]+"Width":o+n[i],r+=parseFloat(p(e,c))||0}return r}function O(e){return null!=e&&e==e.window}var v={};function j(e,t,n){if(O(e))return"width"===t?v.viewportWidth(e):v.viewportHeight(e);if(9===e.nodeType)return"width"===t?v.docWidth(e):v.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,s=(p(e),b(e)),i=0;(null==o||o<=0)&&(o=void 0,(null==(i=p(e,t))||Number(i)<0)&&(i=e.style[t]||0),i=parseFloat(i)||0),void 0===n&&(n=s?1:-1);var c=void 0!==o||s,a=o||i;if(-1===n)return c?a-g(e,["border","padding"],r):i;if(c){var l=2===n?-g(e,["border"],r):g(e,["margin"],r);return a+(1===n?0:l)}return i+g(e,m.slice(n),r)}f(["Width","Height"],(function(e){v["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],v["viewport"+e](n))},v["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,s=r.documentElement[n];return"CSS1Compat"===r.compatMode&&s||o&&o[n]||s}}));var w={position:"absolute",visibility:"hidden",display:"block"};function y(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=j.apply(void 0,n):h(e,w,(function(){t=j.apply(void 0,n)})),t}function E(e,t,n){var r=n;if("object"!==(void 0===t?"undefined":o(t)))return void 0!==r?("number"==typeof r&&(r+="px"),void(e.style[t]=r)):p(e,t);for(var s in t)t.hasOwnProperty(s)&&E(e,s,t[s])}f(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);v["outer"+t]=function(t,n){return t&&y(t,e,n?0:1)};var n="width"===e?["Left","Right"]:["Top","Bottom"];v[e]=function(t,r){return void 0===r?t&&y(t,e,-1):t?(p(t),b(t)&&(r+=g(t,["padding","border"],n)),E(t,e,r)):void 0}})),e.exports=r({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return a(e);!function(e,t){"static"===E(e,"position")&&(e.style.position="relative");var n=a(e),r={},o=void 0,s=void 0;for(s in t)t.hasOwnProperty(s)&&(o=parseFloat(E(e,s))||0,r[s]=o+t[s]-n[s]);E(e,r)}(e,t)},isWindow:O,each:f,css:E,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(O(e)){if(void 0===t)return i(e);window.scrollTo(t,c(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(O(e)){if(void 0===t)return c(e);window.scrollTo(i(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},v)},,,,function(e,t){},function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(18);const o=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,s=e=>Array.isArray(e)&&e.every(o),i=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),c=e=>Array.isArray(e)&&e.every(i)},function(e,t){},,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(244)},function(e,t,n){"use strict";n.r(t);var r=n(38),o=n(159),s=n(59);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:o.a,getProps:e=>({isEditor:!1,attributes:Object(s.g)(e.dataset)})})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(108),o=n(215),s=n(18),i=n(133);const c=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(s.a)(e)?e:{},n=Object(i.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},,,,,,function(e,t,n){"use strict";var r=n(0),o=n(14);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=s},function(e,t,n){"use strict";var r=n(0),o=n(14);const s=Object(r.createElement)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(o.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));t.a=s},,function(e,t,n){"use strict";var r=n(0),o=n(6),s=n(5),i=n.n(s),c=n(1),a=n(10),l=n(58),u=n(12),d=n.n(u),p=n(282),f=n(43),b=n(35);function m({value:e,status:t,title:n,displayTransform:s,isBorderless:l=!1,disabled:u=!1,onClickRemove:d=o.noop,onMouseEnter:h,onMouseLeave:g,messages:O,termPosition:v,termsCount:j}){const w=Object(a.useInstanceId)(m),y=i()("components-form-token-field__token",{"is-error":"error"===t,"is-success":"success"===t,"is-validating":"validating"===t,"is-borderless":l,"is-disabled":u}),E=s(e),k=Object(c.sprintf)(
22
  /* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
23
- Object(c.__)("%1$s (%2$s of %3$s)"),E,v,j);return Object(r.createElement)("span",{className:y,onMouseEnter:h,onMouseLeave:g,title:n},Object(r.createElement)("span",{className:"components-form-token-field__token-text",id:"components-form-token-field__token-text-"+w},Object(r.createElement)(b.a,{as:"span"},k),Object(r.createElement)("span",{"aria-hidden":"true"},E)),Object(r.createElement)(f.a,{className:"components-form-token-field__remove-token",icon:p.a,onClick:!u&&(()=>d({value:e})),label:O.remove,"aria-describedby":"components-form-token-field__token-text-"+w}))}var h=n(148),g=n(149),O=n(8),v=n(24),j=Object(a.createHigherOrderComponent)(e=>t=>Object(r.createElement)(e,Object(O.a)({},t,{speak:v.speak,debouncedSpeak:Object(a.useDebounce)(v.speak,500)})),"withSpokenMessages");const w={incompleteTokenValue:"",inputOffsetFromEnd:0,isActive:!1,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1};class y extends r.Component{constructor(){super(...arguments),this.state=w,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.deleteTokenBeforeInput=this.deleteTokenBeforeInput.bind(this),this.deleteTokenAfterInput=this.deleteTokenAfterInput.bind(this),this.addCurrentToken=this.addCurrentToken.bind(this),this.onContainerTouched=this.onContainerTouched.bind(this),this.renderToken=this.renderToken.bind(this),this.onTokenClickRemove=this.onTokenClickRemove.bind(this),this.onSuggestionHovered=this.onSuggestionHovered.bind(this),this.onSuggestionSelected=this.onSuggestionSelected.bind(this),this.onInputChange=this.onInputChange.bind(this),this.bindInput=this.bindInput.bind(this),this.bindTokensAndInput=this.bindTokensAndInput.bind(this),this.updateSuggestions=this.updateSuggestions.bind(this)}componentDidUpdate(e){this.state.isActive&&!this.input.hasFocus()&&this.input.focus();const{suggestions:t,value:n}=this.props,r=!d()(t,e.suggestions);(r||n!==e.value)&&this.updateSuggestions(r)}static getDerivedStateFromProps(e,t){return e.disabled&&t.isActive?{isActive:!1,incompleteTokenValue:""}:null}bindInput(e){this.input=e}bindTokensAndInput(e){this.tokensAndInput=e}onFocus(e){const{__experimentalExpandOnFocus:t}=this.props;this.input.hasFocus()||e.target===this.tokensAndInput?this.setState({isActive:!0,isExpanded:!!t||this.state.isExpanded}):this.setState({isActive:!1}),"function"==typeof this.props.onFocus&&this.props.onFocus(e)}onBlur(){this.inputHasValidValue()?this.setState({isActive:!1}):this.setState(w)}onKeyDown(e){let t=!1;switch(e.keyCode){case l.BACKSPACE:t=this.handleDeleteKey(this.deleteTokenBeforeInput);break;case l.ENTER:t=this.addCurrentToken();break;case l.LEFT:t=this.handleLeftArrowKey();break;case l.UP:t=this.handleUpArrowKey();break;case l.RIGHT:t=this.handleRightArrowKey();break;case l.DOWN:t=this.handleDownArrowKey();break;case l.DELETE:t=this.handleDeleteKey(this.deleteTokenAfterInput);break;case l.SPACE:this.props.tokenizeOnSpace&&(t=this.addCurrentToken());break;case l.ESCAPE:t=this.handleEscapeKey(e),e.stopPropagation()}t&&e.preventDefault()}onKeyPress(e){let t=!1;switch(e.charCode){case 44:t=this.handleCommaKey()}t&&e.preventDefault()}onContainerTouched(e){e.target===this.tokensAndInput&&this.state.isActive&&e.preventDefault()}onTokenClickRemove(e){this.deleteToken(e.value),this.input.focus()}onSuggestionHovered(e){const t=this.getMatchingSuggestions().indexOf(e);t>=0&&this.setState({selectedSuggestionIndex:t,selectedSuggestionScroll:!1})}onSuggestionSelected(e){this.addNewToken(e)}onInputChange(e){const t=e.value,n=this.props.tokenizeOnSpace?/[ ,\t]+/:/[,\t]+/,r=t.split(n),s=Object(o.last)(r)||"";r.length>1&&this.addNewTokens(r.slice(0,-1)),this.setState({incompleteTokenValue:s},this.updateSuggestions),this.props.onInputChange(s)}handleDeleteKey(e){let t=!1;return this.input.hasFocus()&&this.isInputEmpty()&&(e(),t=!0),t}handleLeftArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputBeforePreviousToken(),e=!0),e}handleRightArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputAfterNextToken(),e=!0),e}handleUpArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(0===e.selectedSuggestionIndex?this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length:e.selectedSuggestionIndex)-1,selectedSuggestionScroll:!0})),!0}handleDownArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(e.selectedSuggestionIndex+1)%this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length,selectedSuggestionScroll:!0})),!0}handleEscapeKey(e){return this.setState({incompleteTokenValue:e.target.value,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1}),!0}handleCommaKey(){return this.inputHasValidValue()&&this.addNewToken(this.state.incompleteTokenValue),!0}moveInputToIndex(e){this.setState((t,n)=>({inputOffsetFromEnd:n.value.length-Math.max(e,-1)-1}))}moveInputBeforePreviousToken(){this.setState((e,t)=>({inputOffsetFromEnd:Math.min(e.inputOffsetFromEnd+1,t.value.length)}))}moveInputAfterNextToken(){this.setState(e=>({inputOffsetFromEnd:Math.max(e.inputOffsetFromEnd-1,0)}))}deleteTokenBeforeInput(){const e=this.getIndexOfInput()-1;e>-1&&this.deleteToken(this.props.value[e])}deleteTokenAfterInput(){const e=this.getIndexOfInput();e<this.props.value.length&&(this.deleteToken(this.props.value[e]),this.moveInputToIndex(e))}addCurrentToken(){let e=!1;const t=this.getSelectedSuggestion();return t?(this.addNewToken(t),e=!0):this.inputHasValidValue()&&(this.addNewToken(this.state.incompleteTokenValue),e=!0),e}addNewTokens(e){const t=Object(o.uniq)(e.map(this.props.saveTransform).filter(Boolean).filter(e=>!this.valueContainsToken(e)));if(t.length>0){const e=Object(o.clone)(this.props.value);e.splice.apply(e,[this.getIndexOfInput(),0].concat(t)),this.props.onChange(e)}}addNewToken(e){const{__experimentalExpandOnFocus:t,__experimentalValidateInput:n}=this.props;n(e)?(this.addNewTokens([e]),this.props.speak(this.props.messages.added,"assertive"),this.setState({incompleteTokenValue:"",selectedSuggestionIndex:-1,selectedSuggestionScroll:!1,isExpanded:!t}),this.state.isActive&&this.input.focus()):this.props.speak(this.props.messages.__experimentalInvalid,"assertive")}deleteToken(e){const t=this.props.value.filter(t=>this.getTokenValue(t)!==this.getTokenValue(e));this.props.onChange(t),this.props.speak(this.props.messages.removed,"assertive")}getTokenValue(e){return"object"==typeof e?e.value:e}getMatchingSuggestions(e=this.state.incompleteTokenValue,t=this.props.suggestions,n=this.props.value,r=this.props.maxSuggestions,s=this.props.saveTransform){let i=s(e);const c=[],a=[];return 0===i.length?t=Object(o.difference)(t,n):(i=i.toLocaleLowerCase(),Object(o.each)(t,e=>{const t=e.toLocaleLowerCase().indexOf(i);-1===n.indexOf(e)&&(0===t?c.push(e):t>0&&a.push(e))}),t=c.concat(a)),Object(o.take)(t,r)}getSelectedSuggestion(){if(-1!==this.state.selectedSuggestionIndex)return this.getMatchingSuggestions()[this.state.selectedSuggestionIndex]}valueContainsToken(e){return Object(o.some)(this.props.value,t=>this.getTokenValue(e)===this.getTokenValue(t))}getIndexOfInput(){return this.props.value.length-this.state.inputOffsetFromEnd}isInputEmpty(){return 0===this.state.incompleteTokenValue.length}inputHasValidValue(){return this.props.saveTransform(this.state.incompleteTokenValue).length>0}updateSuggestions(e=!0){const{__experimentalExpandOnFocus:t}=this.props,{incompleteTokenValue:n}=this.state,r=n.trim().length>1,o=this.getMatchingSuggestions(n),s=o.length>0,i={isExpanded:t||r&&s};if(e&&(i.selectedSuggestionIndex=-1,i.selectedSuggestionScroll=!1),this.setState(i),r){const{debouncedSpeak:e}=this.props;e(s?Object(c.sprintf)(
24
  /* translators: %d: number of results. */
25
  Object(c._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",o.length),o.length):Object(c.__)("No results."),"assertive")}}renderTokensAndInput(){const e=Object(o.map)(this.props.value,this.renderToken);return e.splice(this.getIndexOfInput(),0,this.renderInput()),e}renderToken(e,t,n){const o=this.getTokenValue(e),s=e.status?e.status:void 0,i=t+1,c=n.length;return Object(r.createElement)(m,{key:"token-"+o,value:o,status:s,title:e.title,displayTransform:this.props.displayTransform,onClickRemove:this.onTokenClickRemove,isBorderless:e.isBorderless||this.props.isBorderless,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,disabled:"error"!==s&&this.props.disabled,messages:this.props.messages,termsCount:c,termPosition:i})}renderInput(){const{autoCapitalize:e,autoComplete:t,maxLength:n,placeholder:o,value:s,instanceId:i}=this.props;let c={instanceId:i,autoCapitalize:e,autoComplete:t,placeholder:0===s.length?o:"",ref:this.bindInput,key:"input",disabled:this.props.disabled,value:this.state.incompleteTokenValue,onBlur:this.onBlur,isExpanded:this.state.isExpanded,selectedSuggestionIndex:this.state.selectedSuggestionIndex};return n&&s.length>=n||(c={...c,onChange:this.onInputChange}),Object(r.createElement)(h.a,c)}render(){const{disabled:e,label:t=Object(c.__)("Add item"),instanceId:n,className:o,__experimentalShowHowTo:s}=this.props,{isExpanded:a}=this.state,l=i()(o,"components-form-token-field__input-container",{"is-active":this.state.isActive,"is-disabled":e});let u={className:"components-form-token-field",tabIndex:"-1"};const d=this.getMatchingSuggestions();return e||(u=Object.assign({},u,{onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onFocus:this.onFocus})),Object(r.createElement)("div",u,Object(r.createElement)("label",{htmlFor:"components-form-token-input-"+n,className:"components-form-token-field__label"},t),Object(r.createElement)("div",{ref:this.bindTokensAndInput,className:l,tabIndex:"-1",onMouseDown:this.onContainerTouched,onTouchStart:this.onContainerTouched},this.renderTokensAndInput(),a&&Object(r.createElement)(g.a,{instanceId:n,match:this.props.saveTransform(this.state.incompleteTokenValue),displayTransform:this.props.displayTransform,suggestions:d,selectedIndex:this.state.selectedSuggestionIndex,scrollIntoView:this.state.selectedSuggestionScroll,onHover:this.onSuggestionHovered,onSelect:this.onSuggestionSelected})),s&&Object(r.createElement)("p",{id:"components-form-token-suggestions-howto-"+n,className:"components-form-token-field__help"},this.props.tokenizeOnSpace?Object(c.__)("Separate with commas, spaces, or the Enter key."):Object(c.__)("Separate with commas or the Enter key.")))}}y.defaultProps={suggestions:Object.freeze([]),maxSuggestions:100,value:Object.freeze([]),displayTransform:o.identity,saveTransform:e=>e.trim(),onChange:()=>{},onInputChange:()=>{},isBorderless:!1,disabled:!1,tokenizeOnSpace:!1,messages:{added:Object(c.__)("Item added."),removed:Object(c.__)("Item removed."),remove:Object(c.__)("Remove item"),__experimentalInvalid:Object(c.__)("Invalid item")},__experimentalExpandOnFocus:!1,__experimentalValidateInput:()=>!0,__experimentalShowHowTo:!0},t.a=j(Object(a.withInstanceId)(y))}]);
1
+ !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}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=247)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var s=typeof r;if("string"===s||"number"===s)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===s)if(r.toString===Object.prototype.toString)for(var c in r)n.call(r,c)&&r[c]&&e.push(c);else e.push(r.toString())}}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=window.wp.data},,function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.React},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t){e.exports=window.wc.blocksCheckout},function(e,t){e.exports=window.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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(17),o=n.n(r),s=n(0),i=n(8),c=n(1),a=n(46),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(c.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(c.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(c.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(s.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(s.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(s.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(s.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(s.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(s.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(s.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};n(35);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(s.createElement)(s.Fragment,null,Object(s.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:i,renderError:c,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof c?c({errorMessage:u}):Object(s.createElement)(l,{showErrorBlock:r,errorMessage:n?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,n){"use strict";var r=n(0),o=n(4),s=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:i,wrapperProps:c={}}=e;const a=null!=n,l=null!=o;return!a&&l?(t=i||"span",c={...c,className:s()(c.className,"screen-reader-text")},Object(r.createElement)(t,c,o)):(t=i||r.Fragment,a&&l&&n!==o?Object(r.createElement)(t,c,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,c,n))}},,function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.a11y},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0);const o=Object(r.createContext)("page"),s=()=>Object(r.useContext)(o);o.Provider},,function(e,t,n){"use strict";(function(e){var r=n(0);n(39);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(66))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(13),s=n.n(o);function i(e){const t=Object(r.useRef)(e);return s()(e,t.current)||(t.current=e),t.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f}));var r=n(3),o=n(5),s=n(0),i=n(13),c=n.n(i),a=n(29),l=n(62),u=n(25);const d=e=>{const t=Object(u.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(s.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const c=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(s.useCallback)(t=>{a(n,e,t)},[n,e,a])]},f=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,o]=d(t),i=Object(a.a)(r),p=Object(a.a)(e),f=Object(l.a)(p),b=Object(s.useRef)(!1);return Object(s.useEffect)(()=>{c()(f,p)||(o(Object.assign({},i,p)),b.current=!0)},[i,p,f,o]),b.current?[r,o]:[e,o]}},,,function(e,t){},,function(e,t,n){"use strict";var r=n(4),o=n.n(r),s=n(0);t.a=Object(s.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(s.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},,function(e,t){e.exports=window.wp.warning},,function(e,t,n){"use strict";var r=n(9),o=n(0),s=n(15),i=function({icon:e,className:t,...n}){const s=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:s},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(i,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===s.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(s.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},,,function(e,t,n){"use strict";var r=n(9),o=n(0),s=n(4),i=n.n(s),c=n(7),a=n(22),l=n.n(a),u=n(11),d=n(47),p=n(92),f=n(1);function b(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const s=o.getBoundingClientRect();return new r.DOMRect(e.left+s.left,e.top+s.top,e.width,e.height)}let m=0;function h(e){const t=document.scrollingElement||document.body;e&&(m=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=m)}let g=0;function O(){return Object(o.useEffect)(()=>(0===g&&h(!0),++g,()=>{1===g&&h(!1),--g}),[]),null}var v=n(27);function j(e){const t=Object(o.useContext)(v.a),n=t.slots[e]||{},r=t.fills[e],s=Object(o.useMemo)(()=>r||[],[r]);return{...n,updateSlot:Object(o.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:s,registerFill:Object(o.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var w=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function y({name:e,children:t,registerFill:n,unregisterFill:r}){const s=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(w),[r,s]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(s(t(e)),n(()=>{s(t(e))})),[e]),r})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,i.current),()=>r(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,s&&s.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))},[e]),s&&s.node?(Object(c.isFunction)(t)&&(t=t(s.props.fillProps)),Object(o.createPortal)(t,s.node)):null}var E=e=>Object(o.createElement)(w.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(y,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class k extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,s=Object(c.map)(r(t,this),e=>{const t=Object(c.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(c.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(c.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(c.isFunction)(e)?e(s):s)}}var _=e=>Object(o.createElement)(w.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:s})=>Object(o.createElement)(k,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:s})));function S(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function x({name:e,children:t}){const n=j(e),r=Object(o.useRef)({rerender:S()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var T=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...s},i){const c=Object(o.useContext)(v.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(c.registerSlot(e,a,t),()=>{c.unregisterSlot(e,a)}),[c.registerSlot,c.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{c.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,a])},s))}));function C(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E,e),Object(o.createElement)(x,e))}n(13),o.Component;const L=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(T,Object(r.a)({},t,{ref:n})):Object(o.createElement)(_,t));function I(e){return"appear"===e?"top":"left"}function A(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:s}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const c=n?parseInt(n,10):0,a=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=s?parseInt(s,10):0;return{x:e.left+l,y:e.top+c,width:e.width-l-u,height:e.height-c-a,left:e.left+l,right:e.right-u,top:e.top+c,bottom:e.bottom-a}}function R(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function F(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function P(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const N=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:s,noArrow:c=!0,isAlternate:a,position:m="bottom right",range:h,focusOnMount:g="firstElement",anchorRef:v,shouldAnchorIncludePadding:w,anchorRect:y,getAnchorRect:E,expandOnMobile:k,animate:_=!0,onClickOutside:S,onFocusOutside:x,__unstableStickyBoundaryElement:T,__unstableSlotName:L="Popover",__unstableObserveElement:N,__unstableBoundaryParent:M,__unstableForcePosition:B,__unstableForceXAlignment:D,...V},W)=>{const H=Object(o.useRef)(null),q=Object(o.useRef)(null),z=Object(o.useRef)(),K=Object(u.useViewportMatch)("medium","<"),[U,$]=Object(o.useState)(),Q=j(L),Y=k&&K,[J,X]=Object(u.useResizeObserver)();c=Y||c,Object(o.useLayoutEffect)(()=>{if(Y)return P(z.current,"is-without-arrow",c),P(z.current,"is-alternate",a),R(z.current,"data-x-axis"),R(z.current,"data-y-axis"),F(z.current,"top"),F(z.current,"left"),F(q.current,"maxHeight"),void F(q.current,"maxWidth");const e=()=>{if(!z.current||!q.current)return;let e=function(e,t,n,r=!1,o,s){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return b(t,t.ownerDocument||e.current.ownerDocument,s)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,s);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,s);return o?e:A(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),c=b(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,s);return o?c:A(c,r)}if(!e.current)return;const{parentNode:i}=e.current,c=i.getBoundingClientRect();return o?c:A(c,i)}(H,y,E,v,w,z.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=z.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var s;M&&(r=null===(s=z.current.closest(".popover-slot"))||void 0===s?void 0:s.parentNode);const i=X.height?X:q.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:h,contentHeight:g,contentWidth:O}=function(e,t,n="top",r,o,s,i,c,a){const[l,u="center",d]=n.split(" "),p=function(e,t,n,r,o,s,i,c){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let f,b=n,m=null;if(!o&&!c)if("middle"===n&&u.contentHeight===a)b="middle";else if("top"===n&&d.contentHeight===a)b="top";else if("bottom"===n&&p.contentHeight===a)b="bottom";else{b=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===b?d.contentHeight:p.contentHeight;m=e!==a?e:null}return f="middle"===b?u.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:f,contentHeight:m}}(e,t,l,d,r,0,s,c);return{...function(e,t,n,r,o,s,i,c,a){const{width:l}=t;"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.isRTL)()&&(n="left"),"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===r?p=e.right:"middle"===s||a||(p=u);let b=e.right;"left"===r?b=e.left:"middle"===s||a||(b=u);const m={popoverLeft:p,contentWidth:p-l>0?l:p},h={popoverLeft:b,contentWidth:b+l>window.innerWidth?window.innerWidth-b:l};let g,O=n,v=null;if(!o&&!c)if("center"===n&&d.contentWidth===l)O="center";else if("left"===n&&m.contentWidth===l)O="left";else if("right"===n&&h.contentWidth===l)O="right";else{O=m.contentWidth>h.contentWidth?"left":"right";const e="left"===O?m.contentWidth:h.contentWidth;l>window.innerWidth&&(v=window.innerWidth),e!==l&&(O="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===O?d.popoverLeft:"left"===O?m.popoverLeft:h.popoverLeft,i){const e=i.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:O,popoverLeft:g,contentWidth:v}}(e,t,u,d,r,p.yAxis,i,c,a),...p}}(e,i,m,T,z.current,o,r,B,D);"number"==typeof l&&"number"==typeof u&&(F(z.current,"top",l+"px"),F(z.current,"left",u+"px")),P(z.current,"is-without-arrow",c||"center"===p&&"middle"===h),P(z.current,"is-alternate",a),R(z.current,"data-x-axis",p),R(z.current,"data-y-axis",h),F(q.current,"maxHeight","number"==typeof g?g+"px":""),F(q.current,"maxWidth","number"==typeof O?O+"px":""),$(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))};e();const{ownerDocument:t}=z.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const s=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",s),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(v);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),N&&(l=new n.MutationObserver(e),l.observe(N,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",s),n.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[Y,y,E,v,w,m,X,T,N,M]);const Z=(e,n)=>{if("focus-outside"===e&&x)x(n);else if("focus-outside"===e&&S){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),S(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),ne=Object(u.useMergeRefs)([z,ee,W]),re=Boolean(_&&U)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=I(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:U});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",s,re,{"is-expanded":Y,"is-without-arrow":c,"is-alternate":a})},V,{ref:ne},te,{tabIndex:"-1"}),Y&&Object(o.createElement)(O,null),Y&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(G,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:q,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,n)));return Q.ref&&(oe=Object(o.createElement)(C,{name:L},oe)),v||y?oe:Object(o.createElement)("span",{ref:H},oe)});N.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(L,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var M=N,B=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(c.isString)(e)&&(n=e),Object(c.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const D=Object(o.createElement)("div",{className:"event-catcher"}),V=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:n}),","),e),W=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),H=(e,t,n)=>{if(1!==o.Children.count(e))return;const r=o.Children.only(e);"function"==typeof r.props[t]&&r.props[t](n)};var q=function({children:e,position:t,text:n,shortcut:r}){const[s,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",m),i(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",m),i(!1)},b=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,m=b("mouseUp"),h=(t,n)=>r=>{if(H(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&s)return;d.cancel();const o=Object(c.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",m)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const O={onMouseEnter:h("onMouseEnter",!0),onMouseLeave:h("onMouseLeave"),onClick:h("onClick"),onFocus:h("onFocus"),onBlur:h("onBlur"),onMouseDown:b("mouseDown")},v=o.Children.only(e),{children:j,disabled:w}=v.props;return(w?V:W)({child:v,eventHandlers:O,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:s})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(M,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},r,Object(o.createElement)(B,{className:"components-tooltip__shortcut",shortcut:s}))))({grandchildren:j,isOver:a,position:t,text:n,shortcut:r})})},z=n(41),K=n(37);const U=["onMouseDown","onClick"];var G=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:s,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:b,icon:m,iconPosition:h="left",iconSize:g,showTooltip:O,tooltipPosition:v,shortcut:j,label:w,children:y,text:E,variant:k,__experimentalIsFocusable:_,describedBy:S,...x}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:s,...i}){let c=s;var a,u,d,p,f;return t&&(null!==(a=c)&&void 0!==a||(c="primary")),r&&(null!==(u=c)&&void 0!==u||(c="tertiary")),n&&(null!==(d=c)&&void 0!==d||(c="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=c)&&void 0!==p||(c="secondary")),o&&(null!==(f=c)&&void 0!==f||(c="link")),{...i,variant:c}}(e),T=i()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":a,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!m&&!!y,"has-icon":!!m}),C=b&&!_,L=void 0===n||C?"button":"a",I="a"===L?{href:n,target:s}:{type:"button",disabled:C,"aria-pressed":u};if(b&&_){I["aria-disabled"]=!0;for(const e of U)x[e]=e=>{e.stopPropagation(),e.preventDefault()}}const A=!C&&(O&&w||j||!!w&&(!y||Object(c.isArray)(y)&&!y.length)&&!1!==O),R=S?Object(c.uniqueId)():null,F=x["aria-describedby"]||R,P=Object(o.createElement)(L,Object(r.a)({},I,x,{className:T,"aria-label":x["aria-label"]||w,"aria-describedby":F,ref:t}),m&&"left"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),E&&Object(o.createElement)(o.Fragment,null,E),m&&"right"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),y);return A?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(q,{text:S||w,shortcut:j,position:v},P),S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S))):Object(o.createElement)(o.Fragment,null,P,S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S)))}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s}));var r=n(0);const o=Object(r.createContext)({}),s=()=>{const{wrapper:e}=Object(r.useContext)(o);return t=>{e&&e.current&&(e.current.hidden=!t)}}},function(e,t,n){"use strict";n.d(t,"n",(function(){return s})),n.d(t,"l",(function(){return i})),n.d(t,"k",(function(){return c})),n.d(t,"m",(function(){return a})),n.d(t,"i",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return m})),n.d(t,"a",(function(){return h})),n.d(t,"h",(function(){return g})),n.d(t,"b",(function(){return O}));var r,o=n(2);const s=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=s.pluginUrl+"images/",c=s.pluginUrl+"build/",a=s.buildPhase,l=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),f=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),h=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),O=Object(o.getSetting)("allowedStates",{})},function(e,t){e.exports=window.wp.dom},function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(12),o=n.n(r),s=n(0),i=n(16);const c=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:c=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),l=c(e,n),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:c={},errorBoundaryProps:a={}}=e;Object(s.render)(Object(s.createElement)(i.a,a,Object(s.createElement)(s.Suspense,{fallback:Object(s.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(s.createElement)(t,o()({},c,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(c.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:s}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:s}=e;const i=document.body.querySelectorAll(o);s&&s.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,s)),a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:s,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:s}=e;const i=s.querySelectorAll(o);a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(8);function o(e,t,n){var o=this,s=Object(r.useRef)(null),i=Object(r.useRef)(0),c=Object(r.useRef)(null),a=Object(r.useRef)([]),l=Object(r.useRef)(),u=Object(r.useRef)(),d=Object(r.useRef)(e),p=Object(r.useRef)(!0);d.current=e;var f=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,h="maxWait"in n,g=h?Math.max(+n.maxWait||0,t):null;return Object(r.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(r.useMemo)((function(){var e=function(e){var t=a.current,n=l.current;return a.current=l.current=null,i.current=e,u.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(c.current),c.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-s.current,r=e-i.current;return!s.current||n>=t||n<0||h&&r>=g},O=function(t){return c.current=null,m&&a.current?e(t):(a.current=l.current=null,u.current)},v=function(){var e=Date.now();if(r(e))return O(e);if(p.current){var o=e-s.current,c=e-i.current,a=t-o,l=h?Math.min(a,g-c):a;n(v,l)}},j=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var m=Date.now(),g=r(m);if(a.current=d,l.current=o,s.current=m,g){if(!c.current&&p.current)return i.current=s.current,n(v,t),b?e(s.current):u.current;if(h)return n(v,t),e(s.current)}return c.current||n(v,t),u.current};return j.cancel=function(){c.current&&(f?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,a.current=s.current=l.current=c.current=null},j.isPending=function(){return!!c.current},j.flush=function(){return c.current?O(Date.now()):u.current},j}),[b,h,t,g,m,f])}},,,,,,function(e,t){e.exports=window.wp.keycodes},function(e,t,n){"use strict";n.d(t,"d",(function(){return c})),n.d(t,"h",(function(){return a})),n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return u})),n.d(t,"e",(function(){return d})),n.d(t,"f",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"g",(function(){return b}));var r=n(14),o=n(71),s=n(30),i=n(125);function c(){return Math.floor(Math.random()*Date.now())}const a=e=>e.replace("pa_",""),l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:s}=e,i=a(t),c=r.join(","),l=`${o.b}${i}`,u="in"===s?"or":"and";n[`${o.a}${i}`]=c,n[l]=u});const s=Object(r.removeQueryArgs)(e,...Object.keys(n));return Object(r.addQueryArgs)(s,n)},u=e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length},d=e=>{if(e){const t=Object(o.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]},p=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,o]=n;return e[r]===o&&t},!0)},f=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),b=e=>({className:Object(s.a)(null==e?void 0:e.className)?e.className:"",attributeId:parseInt(Object(s.a)(null==e?void 0:e.attributeId)?e.attributeId:"0",10),showCounts:"false"!==(null==e?void 0:e.showCounts),queryType:Object(s.a)(null==e?void 0:e.queryType)&&e.queryType||i.attributes.queryType.default,heading:Object(s.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(s.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||i.attributes.headingLevel.default,displayStyle:Object(s.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||i.attributes.displayStyle.default,showFilterButton:"true"===(null==e?void 0:e.showFilterButton),selectType:Object(s.a)(null==e?void 0:e.selectType)&&e.selectType||i.attributes.selectType.default,isPreview:!1})},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(3),o=n(5),s=n(0),i=n(29),c=n(76);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(s.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),f=Object(i.a)(a),b=Object(c.a)(),m=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),s=[t,n,p,f],i=o.getCollectionError(...s);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(i)}return{results:o.getCollection(...s),isLoading:!o.hasFinishedResolution("getCollection",s)}},[t,n,f,p,u]);return null!==m&&(d.current=m),d.current}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(8);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(20);n(137),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(s.a,{label:n.toString(),screenReaderLabel:Object(o.sprintf)(
2
  /* translators: %s number of products. */
3
+ Object(o._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},,,function(e,t){var n,r,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=c(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new b(e,t)),1!==l.length||u||c(f)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";var r=n(0);n(101),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(20);n(102),t.a=e=>{let{className:t,label:
4
  /* translators: Reset button text for filters. */
5
+ n=Object(o.__)("Reset","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:a=Object(o.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:i()("wc-block-components-filter-reset-button",t),onClick:s},Object(r.createElement)(c.a,{label:n,screenReaderLabel:a}))}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(20);n(103),t.a=e=>{let{className:t,isLoading:n,disabled:s,label:
6
  /* translators: Submit button text for filters. */
7
+ a=Object(o.__)("Apply","woo-gutenberg-products-block"),onClick:l,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:i()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:s,onClick:l},Object(r.createElement)(c.a,{label:a,screenReaderLabel:u}))}},,function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return u}));var r=n(14),o=n(2),s=n(74);const i=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,s.a),c="query_type_",a="filter_";function l(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){i?window.location.href=e:window.history.replaceState({},"",e)}},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(15);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=s},,,,function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(10);n(118),t.a=e=>{let{className:t,onChange:n,options:s=[],checked:a=[],isLoading:l=!1,isDisabled:u=!1,limit:d=10}=e;const[p,f]=Object(r.useState)(!1),b=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),m=Object(r.useMemo)(()=>{const e=s.length-d;return!p&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{f(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)(
8
  /* translators: %s is referring the remaining count of options */
9
  Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
10
  /* translators: %s number of options to reveal. */
11
+ Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[s,d,p]),h=Object(r.useMemo)(()=>p&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{f(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[p]),g=Object(r.useMemo)(()=>{const e=s.length>d+5;return Object(r.createElement)(r.Fragment,null,s.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!p&&o>=d&&{hidden:!0},Object(r.createElement)(c.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:a.includes(t.value),onChange:()=>{n(t.value)}})),e&&o===d-1&&m)),e&&h)},[s,n,a,p,d,h,m,u]),O=i()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":l},t);return Object(r.createElement)("ul",{className:O},l?b:g)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(8),o=n(53);function s(e,t){return e===t}function i(e){return"function"==typeof e?function(){return e}:e}function c(e,t,n){var c=n&&n.equalityFn||s,a=function(e){var t=Object(r.useState)(i(e)),n=t[0],o=t[1];return[n,Object(r.useCallback)((function(e){return o(i(e))}),[])]}(e),l=a[0],u=a[1],d=Object(o.a)(Object(r.useCallback)((function(e){return u(e)}),[u]),t,n),p=Object(r.useRef)(e);return c(p.current,e)||(d(e),p.current=e),[l,d]}},function(e,t,n){"use strict";var r=n(0),o=n(7),s=n(4),i=n.n(s),c=n(1),a=n(24),l=n(92),u=n(44);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:s=n,onRemove:p=o.noop,isDismissible:f=!0,actions:b=[],politeness:m=d(t),__unstableHTML:h,onDismiss:g=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(a.speak)(n,t)},[n,t])}(s,m);const O=i()(e,"components-notice","is-"+t,{"is-dismissible":f});return h&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:O},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},b.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:s=!1,onClick:c,url:a},l)=>{let d=o;return"primary"===o||s||(d=a?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:c,className:i()("components-notice__action",e)},t)}))),f&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(c.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),g(),p()},showTooltip:!1}))}},,function(e,t){e.exports=window.wp.blocks},function(e,t){},function(e,t){},function(e,t){},,,,,,,,function(e,t){e.exports=window.wp.blockEditor},,,function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s}));var r=n(7);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const s=e.filter(e=>e.attribute===n.taxonomy),i=s.length?s[0]:null;if(!(i&&i.slug&&Array.isArray(i.slug)&&i.slug.includes(o)))return;const c=i.slug.filter(e=>e!==o),a=e.filter(e=>e.attribute!==n.taxonomy);c.length>0&&(i.slug=c.sort(),a.push(i)),t(Object(r.sortBy)(a,"attribute"))},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const i=e.filter(e=>e.attribute!==n.taxonomy);return 0===o.length?t(i):(i.push({attribute:n.taxonomy,operator:s,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(i,"attribute"))),i}},,,function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}));var r=n(2);const o=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),s=e=>{if(e)return o.find(t=>t.id===e)},i=e=>{if(e)return o.find(t=>t.taxonomy===e)}},,,,,function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(30),o=n(19);const s=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n(0),o=n(97),s=n(7),i=n(29),c=n(19),a=n(32),l=n(61),u=n(25);const d=e=>{let{queryAttribute:t,queryPrices:n,queryStock:d,queryRating:p,queryState:f}=e,b=Object(u.a)();b+="-collection-data";const[m]=Object(a.a)(b),[h,g]=Object(a.b)("calculate_attribute_counts",[],b),[O,v]=Object(a.b)("calculate_price_range",null,b),[j,w]=Object(a.b)("calculate_stock_status_counts",null,b),[y,E]=Object(a.b)("calculate_rating_counts",null,b),k=Object(i.a)(t||{}),_=Object(i.a)(n),S=Object(i.a)(d),x=Object(i.a)(p);Object(r.useEffect)(()=>{"object"==typeof k&&Object.keys(k).length&&(h.find(e=>Object(c.b)(k,"taxonomy")&&e.taxonomy===k.taxonomy)||g([...h,k]))},[k,h,g]),Object(r.useEffect)(()=>{O!==_&&void 0!==_&&v(_)},[_,v,O]),Object(r.useEffect)(()=>{j!==S&&void 0!==S&&w(S)},[S,w,j]),Object(r.useEffect)(()=>{y!==x&&void 0!==x&&E(x)},[x,E,y]);const[T,C]=Object(r.useState)(!1),[L]=Object(o.a)(T,200);T||C(!0);const I=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(s.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(m),[m]);return Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...f,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...I},shouldSelect:L})}},function(e,t){},,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(9),o=n(0),s=n(4),i=n.n(s);class c extends o.Component{constructor(){super(...arguments),this.onChange=this.onChange.bind(this),this.bindInput=this.bindInput.bind(this)}focus(){this.input.focus()}hasFocus(){return this.input===this.input.ownerDocument.activeElement}bindInput(e){this.input=e}onChange(e){this.props.onChange({value:e.target.value})}render(){const{value:e,isExpanded:t,instanceId:n,selectedSuggestionIndex:s,className:c,...a}=this.props,l=e?e.length+1:0;return Object(o.createElement)("input",Object(r.a)({ref:this.bindInput,id:"components-form-token-input-"+n,type:"text"},a,{value:e||"",onChange:this.onChange,size:l,className:i()(c,"components-form-token-field__input"),autoComplete:"off",role:"combobox","aria-expanded":t,"aria-autocomplete":"list","aria-owns":t?"components-form-token-suggestions-"+n:void 0,"aria-activedescendant":-1!==s?`components-form-token-suggestions-${n}-${s}`:void 0,"aria-describedby":"components-form-token-suggestions-howto-"+n}))}}t.a=c},function(e,t,n){"use strict";var r=n(0),o=n(7),s=n(152),i=n.n(s),c=n(4),a=n.n(c),l=n(11);class u extends r.Component{constructor(){super(...arguments),this.handleMouseDown=this.handleMouseDown.bind(this),this.bindList=this.bindList.bind(this)}componentDidUpdate(){this.props.selectedIndex>-1&&this.props.scrollIntoView&&this.list.children[this.props.selectedIndex]&&(this.scrollingIntoView=!0,i()(this.list.children[this.props.selectedIndex],this.list,{onlyScrollIfNeeded:!0}),this.props.setTimeout(()=>{this.scrollingIntoView=!1},100))}bindList(e){this.list=e}handleHover(e){return()=>{this.scrollingIntoView||this.props.onHover(e)}}handleClick(e){return()=>{this.props.onSelect(e)}}handleMouseDown(e){e.preventDefault()}computeSuggestionMatch(e){const t=this.props.displayTransform(this.props.match||"").toLocaleLowerCase();if(0===t.length)return null;const n=(e=this.props.displayTransform(e)).toLocaleLowerCase().indexOf(t);return{suggestionBeforeMatch:e.substring(0,n),suggestionMatch:e.substring(n,n+t.length),suggestionAfterMatch:e.substring(n+t.length)}}render(){return Object(r.createElement)("ul",{ref:this.bindList,className:"components-form-token-field__suggestions-list",id:"components-form-token-suggestions-"+this.props.instanceId,role:"listbox"},Object(o.map)(this.props.suggestions,(e,t)=>{const n=this.computeSuggestionMatch(e),o=a()("components-form-token-field__suggestion",{"is-selected":t===this.props.selectedIndex});return Object(r.createElement)("li",{id:`components-form-token-suggestions-${this.props.instanceId}-${t}`,role:"option",className:o,key:null!=e&&e.value?e.value:this.props.displayTransform(e),onMouseDown:this.handleMouseDown,onClick:this.handleClick(e),onMouseEnter:this.handleHover(e),"aria-selected":t===this.props.selectedIndex},n?Object(r.createElement)("span",{"aria-label":this.props.displayTransform(e)},n.suggestionBeforeMatch,Object(r.createElement)("strong",{className:"components-form-token-field__suggestion-match"},n.suggestionMatch),n.suggestionAfterMatch):this.props.displayTransform(e))}))}}u.defaultProps={match:"",onHover:()=>{},onSelect:()=>{},suggestions:Object.freeze([])},t.a=Object(l.withSafeTimeout)(u)},function(e,t,n){"use strict";e.exports=n(220)},,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(278),i=n(29),c=n(62),a=n(32),l=n(61),u=n(136),d=n(63),p=n(68),f=n(69),b=n(13),m=n.n(b),h=n(23),g=n(98),O=n(2),v=n(14),j=n(74),w=n(30),y=n(19),E=n(226),k=n(114),_=n(285),S=n(71),x=n(7),T=n(12),C=n.n(T),L=n(287),I=n(4),A=n.n(I);n(227);var R=e=>{let{className:t,style:n,suggestions:o,multiple:s=!0,saveTransform:i=(e=>e.trim().replace(/\s/g,"-")),messages:c={},validateInput:a=(e=>o.includes(e)),label:l="",...u}=e;return Object(r.createElement)("div",{className:A()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!s}),style:n},Object(r.createElement)(L.a,C()({label:l,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:a,saveTransform:i,maxLength:s?void 0:1,suggestions:o,messages:c},u)))},F=n(67),P=n(120),N=n(115);const M=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(r.createElement)(d.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(r.createElement)(d.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(r.createElement)(d.a,{name:"Red",count:2}),textLabel:"Red (2)"}],B={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(225);var D=n(60),V=n(96),W=e=>{let{isLoading:t=!1,options:n,checked:o,onChange:s}=e;return t?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("span",{className:"is-loading"})):Object(r.createElement)(V.a,{className:"wc-block-attribute-filter-list",options:n,checked:o,onChange:s,isLoading:t,isDisabled:t})},H=n(45);t.a=e=>{let{attributes:t,isEditor:n=!1}=e;const b=Object(O.getSettingWithCoercion)("has_filterable_products",!1,j.a),T=Object(O.getSettingWithCoercion)("is_rendering_php_template",!1,j.a),C=Object(O.getSettingWithCoercion)("page_url",window.location.href,w.a),[L,I]=Object(r.useState)(!1),V=t.isPreview&&!t.attributeId?B:Object(P.a)(t.attributeId),q=Object(r.useMemo)(()=>Object(D.e)(V),[V]),[z,K]=Object(r.useState)(q),[U,G]=Object(r.useState)(Object(D.d)()),[$,Q]=Object(r.useState)(t.isPreview&&!t.attributeId?M:[]),Y=Object(s.a)(t),[J]=Object(a.a)(),[X,Z]=Object(a.b)("attributes",[]),{results:ee,isLoading:te}=Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==V?void 0:V.id)||0],shouldSelect:t.attributeId>0}),ne="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:re,isLoading:oe}=Object(u.a)({queryAttribute:{taxonomy:(null==V?void 0:V.taxonomy)||"",queryType:t.queryType},queryState:{...J,attributes:ne?J.attributes:null}}),se=Object(r.useCallback)(e=>Object(y.b)(re,"attribute_counts")&&Array.isArray(re.attribute_counts)?re.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[re]);Object(r.useEffect)(()=>{if(te||oe)return;if(!Array.isArray(ee))return;const e=ee.map(e=>{const n=se(e.id);if(!(n||z.includes(e.slug)||(o=e.slug,null!=J&&J.attributes&&J.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==V?void 0:V.taxonomy)&&n.includes(o)}))))return null;var o;const s=n?n.count:0;return{formattedValue:Object(D.c)(e.slug),value:e.slug,name:Object(h.decodeEntities)(e.name),label:Object(r.createElement)(d.a,{name:Object(h.decodeEntities)(e.name),count:t.showCounts?s:null}),textLabel:t.showCounts?`${Object(h.decodeEntities)(e.name)} (${s})`:Object(h.decodeEntities)(e.name)}}).filter(e=>!!e);Q(e),G(Object(D.d)())},[null==V?void 0:V.taxonomy,ee,te,t.showCounts,oe,se,z,J.attributes]);const ie=Object(r.useCallback)(e=>Array.isArray(ee)?ee.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[ee]),ce=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==V||!V.taxonomy)return;const t=Object.keys(Object(v.getQueryArgs)(window.location.href)),n=Object(D.h)(V.taxonomy),r=t.reduce((e,t)=>t.includes(S.b+n)||t.includes(S.a+n)?Object(v.removeQueryArgs)(e,t):e,window.location.href),o=Object(D.b)(r,e);Object(S.c)(o)}else{const t=Object(D.b)(C,e),n=Object(v.getQueryArgs)(window.location.href),r=Object(v.getQueryArgs)(t);Object(D.f)(n,r)||Object(S.c)(t)}}),[C,null==V?void 0:V.taxonomy]),ae=e=>{const n=Object(N.b)(X,Z,V,ie(e),"or"===t.queryType?"in":"and");ce(n,0===e.length)},le=Object(r.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(K(e),!r&&t.showFilterButton||Object(N.b)(X,Z,V,ie(e),"or"===t.queryType?"in":"and"))}),[n,K,X,Z,V,ie,t.queryType,t.showFilterButton]),ue=Object(r.useMemo)(()=>Object(E.a)(X)?X.filter(e=>{let{attribute:t}=e;return t===(null==V?void 0:V.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[X,null==V?void 0:V.taxonomy]),de=Object(i.a)(ue),pe=Object(c.a)(de);Object(r.useEffect)(()=>{!pe||m()(pe,de)||m()(z,de)||le(de)},[z,de,pe,le]);const fe="single"!==t.selectType,be=Object(r.useCallback)(e=>{const t=z.includes(e);let n;fe?(n=z.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],le(n)},[z,fe,le]);Object(r.useEffect)(()=>{V&&!t.showFilterButton&&(Object(D.a)({currentCheckedFilters:z,hasSetFilterDefaultsFromUrl:L})?ce(X,!0):ce(X,!1))},[L,ce,X,V,z,t.showFilterButton]),Object(r.useEffect)(()=>{if(!L&&!te)return q.length>0?(I(!0),void le(q,!0)):void(T||I(!0))},[V,L,te,le,q,T]);const me=Object(H.b)();if(!b)return me(!1),null;if(!V)return n?Object(r.createElement)(g.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(o.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(me(!1),null);if(0===$.length&&!te&&n)return Object(r.createElement)(g.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(o.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const he="h"+t.headingLevel,ge=!t.isPreview&&te,Oe=!t.isPreview&&oe,ve=(ge||Oe)&&0===$.length;if(!ve&&0===$.length)return me(!1),null;const je=Object(r.createElement)(he,{className:"wc-block-attribute-filter__title"},t.heading),we=ve?Object(r.createElement)(F.a,null,je):je;return me(!0),Object(r.createElement)(r.Fragment,null,!n&&t.heading&&we,Object(r.createElement)("div",{className:A()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(R,{key:U,className:A()(Y.className,{"single-selection":!fe,"is-loading":ve}),style:{...Y.style,borderStyle:"none"},suggestions:$.filter(e=>!z.includes(e.value)).map(e=>e.formattedValue),disabled:ve,placeholder:Object(o.sprintf)(
12
  /* translators: %s attribute name. */
13
  Object(o.__)("Select %s","woo-gutenberg-products-block"),V.label),onChange:e=>{!fe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=$.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(x.difference)(e,z);if(1===t.length)return be(t[0]);const n=Object(x.difference)(z,e);1===n.length&&be(n[0])},value:z,displayTransform:e=>{const t=$.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:D.c,messages:{added:Object(o.sprintf)(
14
  /* translators: %s is the attribute label. */
18
  /* translators: %s is the attribute label. */
19
  Object(o.__)("Remove %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase()),__experimentalInvalid:Object(o.sprintf)(
20
  /* translators: %s is the attribute label. */
21
+ Object(o.__)("Invalid %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase())}}),fe&&Object(r.createElement)(k.a,{icon:_.a,size:30})):Object(r.createElement)(W,{options:$,checked:z,onChange:be,isLoading:ve,isDisabled:ve})),Object(r.createElement)("div",{className:"wc-block-attribute-filter__actions"},z.length>0&&!ve&&Object(r.createElement)(p.a,{onClick:()=>{K([]),G(Object(D.d)()),L&&ae([])},screenReaderLabel:Object(o.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(r.createElement)(f.a,{className:"wc-block-attribute-filter__button",isLoading:ve,disabled:ge||Oe||0===z.length,onClick:()=>ae(z)})))}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n(100);var r=n(46);const o=()=>r.m>1},,,function(e,t,n){"use strict";var r=n(221);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=r.getWindow(t));var o=n.allowHorizontalScroll,s=n.onlyScrollIfNeeded,i=n.alignWithTop,c=n.alignWithLeft,a=n.offsetTop||0,l=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;o=void 0===o||o;var p=r.isWindow(t),f=r.offset(e),b=r.outerHeight(e),m=r.outerWidth(e),h=void 0,g=void 0,O=void 0,v=void 0,j=void 0,w=void 0,y=void 0,E=void 0,k=void 0,_=void 0;p?(y=t,_=r.height(y),k=r.width(y),E={left:r.scrollLeft(y),top:r.scrollTop(y)},j={left:f.left-E.left-l,top:f.top-E.top-a},w={left:f.left+m-(E.left+k)+d,top:f.top+b-(E.top+_)+u},v=E):(h=r.offset(t),g=t.clientHeight,O=t.clientWidth,v={left:t.scrollLeft,top:t.scrollTop},j={left:f.left-(h.left+(parseFloat(r.css(t,"borderLeftWidth"))||0))-l,top:f.top-(h.top+(parseFloat(r.css(t,"borderTopWidth"))||0))-a},w={left:f.left+m-(h.left+O+(parseFloat(r.css(t,"borderRightWidth"))||0))+d,top:f.top+b-(h.top+g+(parseFloat(r.css(t,"borderBottomWidth"))||0))+u}),j.top<0||w.top>0?!0===i?r.scrollTop(t,v.top+j.top):!1===i?r.scrollTop(t,v.top+w.top):j.top<0?r.scrollTop(t,v.top+j.top):r.scrollTop(t,v.top+w.top):s||((i=void 0===i||!!i)?r.scrollTop(t,v.top+j.top):r.scrollTop(t,v.top+w.top)),o&&(j.left<0||w.left>0?!0===c?r.scrollLeft(t,v.left+j.left):!1===c?r.scrollLeft(t,v.left+w.left):j.left<0?r.scrollLeft(t,v.left+j.left):r.scrollLeft(t,v.left+w.left):s||((c=void 0===c||!!c)?r.scrollLeft(t,v.left+j.left):r.scrollLeft(t,v.left+w.left)))}},function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};function s(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;"number"!=typeof(n=o.documentElement[r])&&(n=o.body[r])}return n}function i(e){return s(e)}function c(e){return s(e,!0)}function a(e){var t=function(e){var t,n=void 0,r=void 0,o=e.ownerDocument,s=o.body,i=o&&o.documentElement;return n=(t=e.getBoundingClientRect()).left,r=t.top,{left:n-=i.clientLeft||s.clientLeft||0,top:r-=i.clientTop||s.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=i(r),t.top+=c(r),t}var l=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),u=/^(top|right|bottom|left)$/,d="left",p=void 0;function f(e,t){for(var n=0;n<e.length;n++)t(e[n])}function b(e){return"border-box"===p(e,"boxSizing")}"undefined"!=typeof window&&(p=window.getComputedStyle?function(e,t,n){var r="",o=e.ownerDocument,s=n||o.defaultView.getComputedStyle(e,null);return s&&(r=s.getPropertyValue(t)||s[t]),r}:function(e,t){var n=e.currentStyle&&e.currentStyle[t];if(l.test(n)&&!u.test(t)){var r=e.style,o=r[d],s=e.runtimeStyle[d];e.runtimeStyle[d]=e.currentStyle[d],r[d]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[d]=o,e.runtimeStyle[d]=s}return""===n?"auto":n});var m=["margin","border","padding"];function h(e,t,n){var r={},o=e.style,s=void 0;for(s in t)t.hasOwnProperty(s)&&(r[s]=o[s],o[s]=t[s]);for(s in n.call(e),t)t.hasOwnProperty(s)&&(o[s]=r[s])}function g(e,t,n){var r=0,o=void 0,s=void 0,i=void 0;for(s=0;s<t.length;s++)if(o=t[s])for(i=0;i<n.length;i++){var c;c="border"===o?o+n[i]+"Width":o+n[i],r+=parseFloat(p(e,c))||0}return r}function O(e){return null!=e&&e==e.window}var v={};function j(e,t,n){if(O(e))return"width"===t?v.viewportWidth(e):v.viewportHeight(e);if(9===e.nodeType)return"width"===t?v.docWidth(e):v.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,s=(p(e),b(e)),i=0;(null==o||o<=0)&&(o=void 0,(null==(i=p(e,t))||Number(i)<0)&&(i=e.style[t]||0),i=parseFloat(i)||0),void 0===n&&(n=s?1:-1);var c=void 0!==o||s,a=o||i;if(-1===n)return c?a-g(e,["border","padding"],r):i;if(c){var l=2===n?-g(e,["border"],r):g(e,["margin"],r);return a+(1===n?0:l)}return i+g(e,m.slice(n),r)}f(["Width","Height"],(function(e){v["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],v["viewport"+e](n))},v["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,s=r.documentElement[n];return"CSS1Compat"===r.compatMode&&s||o&&o[n]||s}}));var w={position:"absolute",visibility:"hidden",display:"block"};function y(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=j.apply(void 0,n):h(e,w,(function(){t=j.apply(void 0,n)})),t}function E(e,t,n){var r=n;if("object"!==(void 0===t?"undefined":o(t)))return void 0!==r?("number"==typeof r&&(r+="px"),void(e.style[t]=r)):p(e,t);for(var s in t)t.hasOwnProperty(s)&&E(e,s,t[s])}f(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);v["outer"+t]=function(t,n){return t&&y(t,e,n?0:1)};var n="width"===e?["Left","Right"]:["Top","Bottom"];v[e]=function(t,r){return void 0===r?t&&y(t,e,-1):t?(p(t),b(t)&&(r+=g(t,["padding","border"],n)),E(t,e,r)):void 0}})),e.exports=r({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return a(e);!function(e,t){"static"===E(e,"position")&&(e.style.position="relative");var n=a(e),r={},o=void 0,s=void 0;for(s in t)t.hasOwnProperty(s)&&(o=parseFloat(E(e,s))||0,r[s]=o+t[s]-n[s]);E(e,r)}(e,t)},isWindow:O,each:f,css:E,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(O(e)){if(void 0===t)return i(e);window.scrollTo(t,c(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(O(e)){if(void 0===t)return c(e);window.scrollTo(i(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},v)},,,,function(e,t){},function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(19);const o=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,s=e=>Array.isArray(e)&&e.every(o),i=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),c=e=>Array.isArray(e)&&e.every(i)},function(e,t){},,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(248)},function(e,t,n){"use strict";n.r(t);var r=n(48),o=n(161),s=n(60);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:o.a,getProps:e=>({isEditor:!1,attributes:Object(s.g)(e.dataset)})})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(111),o=n(217),s=n(19),i=n(135);const c=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(s.a)(e)?e:{},n=Object(i.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},,,,,,function(e,t,n){"use strict";var r=n(0),o=n(15);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=s},function(e,t,n){"use strict";var r=n(0),o=n(15);const s=Object(r.createElement)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(o.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));t.a=s},,function(e,t,n){"use strict";var r=n(0),o=n(7),s=n(4),i=n.n(s),c=n(1),a=n(11),l=n(59),u=n(13),d=n.n(u),p=n(284),f=n(44),b=n(37);function m({value:e,status:t,title:n,displayTransform:s,isBorderless:l=!1,disabled:u=!1,onClickRemove:d=o.noop,onMouseEnter:h,onMouseLeave:g,messages:O,termPosition:v,termsCount:j}){const w=Object(a.useInstanceId)(m),y=i()("components-form-token-field__token",{"is-error":"error"===t,"is-success":"success"===t,"is-validating":"validating"===t,"is-borderless":l,"is-disabled":u}),E=s(e),k=Object(c.sprintf)(
22
  /* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
23
+ Object(c.__)("%1$s (%2$s of %3$s)"),E,v,j);return Object(r.createElement)("span",{className:y,onMouseEnter:h,onMouseLeave:g,title:n},Object(r.createElement)("span",{className:"components-form-token-field__token-text",id:"components-form-token-field__token-text-"+w},Object(r.createElement)(b.a,{as:"span"},k),Object(r.createElement)("span",{"aria-hidden":"true"},E)),Object(r.createElement)(f.a,{className:"components-form-token-field__remove-token",icon:p.a,onClick:!u&&(()=>d({value:e})),label:O.remove,"aria-describedby":"components-form-token-field__token-text-"+w}))}var h=n(150),g=n(151),O=n(9),v=n(24),j=Object(a.createHigherOrderComponent)(e=>t=>Object(r.createElement)(e,Object(O.a)({},t,{speak:v.speak,debouncedSpeak:Object(a.useDebounce)(v.speak,500)})),"withSpokenMessages");const w={incompleteTokenValue:"",inputOffsetFromEnd:0,isActive:!1,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1};class y extends r.Component{constructor(){super(...arguments),this.state=w,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.deleteTokenBeforeInput=this.deleteTokenBeforeInput.bind(this),this.deleteTokenAfterInput=this.deleteTokenAfterInput.bind(this),this.addCurrentToken=this.addCurrentToken.bind(this),this.onContainerTouched=this.onContainerTouched.bind(this),this.renderToken=this.renderToken.bind(this),this.onTokenClickRemove=this.onTokenClickRemove.bind(this),this.onSuggestionHovered=this.onSuggestionHovered.bind(this),this.onSuggestionSelected=this.onSuggestionSelected.bind(this),this.onInputChange=this.onInputChange.bind(this),this.bindInput=this.bindInput.bind(this),this.bindTokensAndInput=this.bindTokensAndInput.bind(this),this.updateSuggestions=this.updateSuggestions.bind(this)}componentDidUpdate(e){this.state.isActive&&!this.input.hasFocus()&&this.input.focus();const{suggestions:t,value:n}=this.props,r=!d()(t,e.suggestions);(r||n!==e.value)&&this.updateSuggestions(r)}static getDerivedStateFromProps(e,t){return e.disabled&&t.isActive?{isActive:!1,incompleteTokenValue:""}:null}bindInput(e){this.input=e}bindTokensAndInput(e){this.tokensAndInput=e}onFocus(e){const{__experimentalExpandOnFocus:t}=this.props;this.input.hasFocus()||e.target===this.tokensAndInput?this.setState({isActive:!0,isExpanded:!!t||this.state.isExpanded}):this.setState({isActive:!1}),"function"==typeof this.props.onFocus&&this.props.onFocus(e)}onBlur(){this.inputHasValidValue()?this.setState({isActive:!1}):this.setState(w)}onKeyDown(e){let t=!1;switch(e.keyCode){case l.BACKSPACE:t=this.handleDeleteKey(this.deleteTokenBeforeInput);break;case l.ENTER:t=this.addCurrentToken();break;case l.LEFT:t=this.handleLeftArrowKey();break;case l.UP:t=this.handleUpArrowKey();break;case l.RIGHT:t=this.handleRightArrowKey();break;case l.DOWN:t=this.handleDownArrowKey();break;case l.DELETE:t=this.handleDeleteKey(this.deleteTokenAfterInput);break;case l.SPACE:this.props.tokenizeOnSpace&&(t=this.addCurrentToken());break;case l.ESCAPE:t=this.handleEscapeKey(e),e.stopPropagation()}t&&e.preventDefault()}onKeyPress(e){let t=!1;switch(e.charCode){case 44:t=this.handleCommaKey()}t&&e.preventDefault()}onContainerTouched(e){e.target===this.tokensAndInput&&this.state.isActive&&e.preventDefault()}onTokenClickRemove(e){this.deleteToken(e.value),this.input.focus()}onSuggestionHovered(e){const t=this.getMatchingSuggestions().indexOf(e);t>=0&&this.setState({selectedSuggestionIndex:t,selectedSuggestionScroll:!1})}onSuggestionSelected(e){this.addNewToken(e)}onInputChange(e){const t=e.value,n=this.props.tokenizeOnSpace?/[ ,\t]+/:/[,\t]+/,r=t.split(n),s=Object(o.last)(r)||"";r.length>1&&this.addNewTokens(r.slice(0,-1)),this.setState({incompleteTokenValue:s},this.updateSuggestions),this.props.onInputChange(s)}handleDeleteKey(e){let t=!1;return this.input.hasFocus()&&this.isInputEmpty()&&(e(),t=!0),t}handleLeftArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputBeforePreviousToken(),e=!0),e}handleRightArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputAfterNextToken(),e=!0),e}handleUpArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(0===e.selectedSuggestionIndex?this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length:e.selectedSuggestionIndex)-1,selectedSuggestionScroll:!0})),!0}handleDownArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(e.selectedSuggestionIndex+1)%this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length,selectedSuggestionScroll:!0})),!0}handleEscapeKey(e){return this.setState({incompleteTokenValue:e.target.value,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1}),!0}handleCommaKey(){return this.inputHasValidValue()&&this.addNewToken(this.state.incompleteTokenValue),!0}moveInputToIndex(e){this.setState((t,n)=>({inputOffsetFromEnd:n.value.length-Math.max(e,-1)-1}))}moveInputBeforePreviousToken(){this.setState((e,t)=>({inputOffsetFromEnd:Math.min(e.inputOffsetFromEnd+1,t.value.length)}))}moveInputAfterNextToken(){this.setState(e=>({inputOffsetFromEnd:Math.max(e.inputOffsetFromEnd-1,0)}))}deleteTokenBeforeInput(){const e=this.getIndexOfInput()-1;e>-1&&this.deleteToken(this.props.value[e])}deleteTokenAfterInput(){const e=this.getIndexOfInput();e<this.props.value.length&&(this.deleteToken(this.props.value[e]),this.moveInputToIndex(e))}addCurrentToken(){let e=!1;const t=this.getSelectedSuggestion();return t?(this.addNewToken(t),e=!0):this.inputHasValidValue()&&(this.addNewToken(this.state.incompleteTokenValue),e=!0),e}addNewTokens(e){const t=Object(o.uniq)(e.map(this.props.saveTransform).filter(Boolean).filter(e=>!this.valueContainsToken(e)));if(t.length>0){const e=Object(o.clone)(this.props.value);e.splice.apply(e,[this.getIndexOfInput(),0].concat(t)),this.props.onChange(e)}}addNewToken(e){const{__experimentalExpandOnFocus:t,__experimentalValidateInput:n}=this.props;n(e)?(this.addNewTokens([e]),this.props.speak(this.props.messages.added,"assertive"),this.setState({incompleteTokenValue:"",selectedSuggestionIndex:-1,selectedSuggestionScroll:!1,isExpanded:!t}),this.state.isActive&&this.input.focus()):this.props.speak(this.props.messages.__experimentalInvalid,"assertive")}deleteToken(e){const t=this.props.value.filter(t=>this.getTokenValue(t)!==this.getTokenValue(e));this.props.onChange(t),this.props.speak(this.props.messages.removed,"assertive")}getTokenValue(e){return"object"==typeof e?e.value:e}getMatchingSuggestions(e=this.state.incompleteTokenValue,t=this.props.suggestions,n=this.props.value,r=this.props.maxSuggestions,s=this.props.saveTransform){let i=s(e);const c=[],a=[];return 0===i.length?t=Object(o.difference)(t,n):(i=i.toLocaleLowerCase(),Object(o.each)(t,e=>{const t=e.toLocaleLowerCase().indexOf(i);-1===n.indexOf(e)&&(0===t?c.push(e):t>0&&a.push(e))}),t=c.concat(a)),Object(o.take)(t,r)}getSelectedSuggestion(){if(-1!==this.state.selectedSuggestionIndex)return this.getMatchingSuggestions()[this.state.selectedSuggestionIndex]}valueContainsToken(e){return Object(o.some)(this.props.value,t=>this.getTokenValue(e)===this.getTokenValue(t))}getIndexOfInput(){return this.props.value.length-this.state.inputOffsetFromEnd}isInputEmpty(){return 0===this.state.incompleteTokenValue.length}inputHasValidValue(){return this.props.saveTransform(this.state.incompleteTokenValue).length>0}updateSuggestions(e=!0){const{__experimentalExpandOnFocus:t}=this.props,{incompleteTokenValue:n}=this.state,r=n.trim().length>1,o=this.getMatchingSuggestions(n),s=o.length>0,i={isExpanded:t||r&&s};if(e&&(i.selectedSuggestionIndex=-1,i.selectedSuggestionScroll=!1),this.setState(i),r){const{debouncedSpeak:e}=this.props;e(s?Object(c.sprintf)(
24
  /* translators: %d: number of results. */
25
  Object(c._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",o.length),o.length):Object(c.__)("No results."),"assertive")}}renderTokensAndInput(){const e=Object(o.map)(this.props.value,this.renderToken);return e.splice(this.getIndexOfInput(),0,this.renderInput()),e}renderToken(e,t,n){const o=this.getTokenValue(e),s=e.status?e.status:void 0,i=t+1,c=n.length;return Object(r.createElement)(m,{key:"token-"+o,value:o,status:s,title:e.title,displayTransform:this.props.displayTransform,onClickRemove:this.onTokenClickRemove,isBorderless:e.isBorderless||this.props.isBorderless,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,disabled:"error"!==s&&this.props.disabled,messages:this.props.messages,termsCount:c,termPosition:i})}renderInput(){const{autoCapitalize:e,autoComplete:t,maxLength:n,placeholder:o,value:s,instanceId:i}=this.props;let c={instanceId:i,autoCapitalize:e,autoComplete:t,placeholder:0===s.length?o:"",ref:this.bindInput,key:"input",disabled:this.props.disabled,value:this.state.incompleteTokenValue,onBlur:this.onBlur,isExpanded:this.state.isExpanded,selectedSuggestionIndex:this.state.selectedSuggestionIndex};return n&&s.length>=n||(c={...c,onChange:this.onInputChange}),Object(r.createElement)(h.a,c)}render(){const{disabled:e,label:t=Object(c.__)("Add item"),instanceId:n,className:o,__experimentalShowHowTo:s}=this.props,{isExpanded:a}=this.state,l=i()(o,"components-form-token-field__input-container",{"is-active":this.state.isActive,"is-disabled":e});let u={className:"components-form-token-field",tabIndex:"-1"};const d=this.getMatchingSuggestions();return e||(u=Object.assign({},u,{onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onFocus:this.onFocus})),Object(r.createElement)("div",u,Object(r.createElement)("label",{htmlFor:"components-form-token-input-"+n,className:"components-form-token-field__label"},t),Object(r.createElement)("div",{ref:this.bindTokensAndInput,className:l,tabIndex:"-1",onMouseDown:this.onContainerTouched,onTouchStart:this.onContainerTouched},this.renderTokensAndInput(),a&&Object(r.createElement)(g.a,{instanceId:n,match:this.props.saveTransform(this.state.incompleteTokenValue),displayTransform:this.props.displayTransform,suggestions:d,selectedIndex:this.state.selectedSuggestionIndex,scrollIntoView:this.state.selectedSuggestionScroll,onHover:this.onSuggestionHovered,onSelect:this.onSuggestionSelected})),s&&Object(r.createElement)("p",{id:"components-form-token-suggestions-howto-"+n,className:"components-form-token-field__help"},this.props.tokenizeOnSpace?Object(c.__)("Separate with commas, spaces, or the Enter key."):Object(c.__)("Separate with commas or the Enter key.")))}}y.defaultProps={suggestions:Object.freeze([]),maxSuggestions:100,value:Object.freeze([]),displayTransform:o.identity,saveTransform:e=>e.trim(),onChange:()=>{},onInputChange:()=>{},isBorderless:!1,disabled:!1,tokenizeOnSpace:!1,messages:{added:Object(c.__)("Item added."),removed:Object(c.__)("Item removed."),remove:Object(c.__)("Remove item"),__experimentalInvalid:Object(c.__)("Invalid item")},__experimentalExpandOnFocus:!1,__experimentalValidateInput:()=>!0,__experimentalShowHowTo:!0},t.a=j(Object(a.withInstanceId)(y))}]);
build/attribute-filter-wrapper-frontend.js CHANGED
@@ -1,4 +1,4 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{112:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return a}));var r=n(6);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const a=e.filter(e=>e.attribute===n.taxonomy),o=a.length?a[0]:null;if(!(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(c)))return;const s=o.slug.filter(e=>e!==c),l=e.filter(e=>e.attribute!==n.taxonomy);s.length>0&&(o.slug=s.sort(),l.push(o)),t(Object(r.sortBy)(l,"attribute"))},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const o=e.filter(e=>e.attribute!==n.taxonomy);return 0===c.length?t(o):(o.push({attribute:n.taxonomy,operator:a,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(o,"attribute"))),o}},115:function(e,t){},116:function(e,t){},117:function(e,t){},119:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return o}));var r=n(2);const c=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),a=e=>{if(e)return c.find(t=>t.id===e)},o=e=>{if(e)return c.find(t=>t.taxonomy===e)}},124:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},133:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(28),c=n(18);const a=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},134:function(e,t){},135:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(0),c=n(97),a=n(6),o=n(27),s=n(18),l=n(30),u=n(60),i=n(23);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryRating:d,queryState:f}=e,m=Object(i.a)();m+="-collection-data";const[O]=Object(l.a)(m),[j,p]=Object(l.b)("calculate_attribute_counts",[],m),[g,y]=Object(l.b)("calculate_price_range",null,m),[h,v]=Object(l.b)("calculate_stock_status_counts",null,m),[w,_]=Object(l.b)("calculate_rating_counts",null,m),E=Object(o.a)(t||{}),k=Object(o.a)(n),S=Object(o.a)(b),x=Object(o.a)(d);Object(r.useEffect)(()=>{"object"==typeof E&&Object.keys(E).length&&(j.find(e=>Object(s.b)(E,"taxonomy")&&e.taxonomy===E.taxonomy)||p([...j,E]))},[E,j,p]),Object(r.useEffect)(()=>{g!==k&&void 0!==k&&y(k)},[k,y,g]),Object(r.useEffect)(()=>{h!==S&&void 0!==S&&v(S)},[S,v,h]),Object(r.useEffect)(()=>{w!==x&&void 0!==x&&_(x)},[x,_,w]);const[C,N]=Object(r.useState)(!1),[T]=Object(c.a)(C,200);C||N(!0);const L=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(a.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(O),[O]);return Object(u.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...f,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...L},shouldSelect:T})}},159:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(276),o=n(27),s=n(61),l=n(30),u=n(60),i=n(135),b=n(62),d=n(94),f=n(95),m=n(12),O=n.n(m),j=n(21),p=n(98),g=n(2),y=n(13),h=n(69),v=n(28),w=n(18),_=n(224),E=n(111),k=n(283),S=n(70),x=n(6),C=n(11),N=n.n(C),T=n(285),L=n(5),A=n.n(L);n(225);var R=e=>{let{className:t,style:n,suggestions:c,multiple:a=!0,saveTransform:o=(e=>e.trim().replace(/\s/g,"-")),messages:s={},validateInput:l=(e=>c.includes(e)),label:u="",...i}=e;return Object(r.createElement)("div",{className:A()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!a}),style:n},Object(r.createElement)(T.a,N()({label:u,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:l,saveTransform:o,maxLength:a?void 0:1,suggestions:c,messages:s},i)))},F=n(51),q=n(119),B=n(112);const I=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(r.createElement)(b.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(r.createElement)(b.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(r.createElement)(b.a,{name:"Red",count:2}),textLabel:"Red (2)"}],P={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(223);var Q=n(59),V=n(96),M=e=>{let{isLoading:t=!1,options:n,checked:c,onChange:a}=e;return t?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("span",{className:"is-loading"})):Object(r.createElement)(V.a,{className:"wc-block-attribute-filter-list",options:n,checked:c,onChange:a,isLoading:t,isDisabled:t})},D=n(55);t.a=e=>{let{attributes:t,isEditor:n=!1}=e;const m=Object(g.getSettingWithCoercion)("has_filterable_products",!1,h.a),C=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,h.a),N=Object(g.getSettingWithCoercion)("page_url",window.location.href,v.a),[T,L]=Object(r.useState)(!1),V=t.isPreview&&!t.attributeId?P:Object(q.a)(t.attributeId),Y=Object(r.useMemo)(()=>Object(Q.e)(V),[V]),[U,W]=Object(r.useState)(Y),[$,K]=Object(r.useState)(Object(Q.d)()),[J,G]=Object(r.useState)(t.isPreview&&!t.attributeId?I:[]),z=Object(a.a)(t),[H]=Object(l.a)(),[Z,X]=Object(l.b)("attributes",[]),{results:ee,isLoading:te}=Object(u.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==V?void 0:V.id)||0],shouldSelect:t.attributeId>0}),ne="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:re,isLoading:ce}=Object(i.a)({queryAttribute:{taxonomy:(null==V?void 0:V.taxonomy)||"",queryType:t.queryType},queryState:{...H,attributes:ne?H.attributes:null}}),ae=Object(r.useCallback)(e=>Object(w.b)(re,"attribute_counts")&&Array.isArray(re.attribute_counts)?re.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[re]);Object(r.useEffect)(()=>{if(te||ce)return;if(!Array.isArray(ee))return;const e=ee.map(e=>{const n=ae(e.id);if(!(n||U.includes(e.slug)||(c=e.slug,null!=H&&H.attributes&&H.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==V?void 0:V.taxonomy)&&n.includes(c)}))))return null;var c;const a=n?n.count:0;return{formattedValue:Object(Q.c)(e.slug),value:e.slug,name:Object(j.decodeEntities)(e.name),label:Object(r.createElement)(b.a,{name:Object(j.decodeEntities)(e.name),count:t.showCounts?a:null}),textLabel:t.showCounts?`${Object(j.decodeEntities)(e.name)} (${a})`:Object(j.decodeEntities)(e.name)}}).filter(e=>!!e);G(e),K(Object(Q.d)())},[null==V?void 0:V.taxonomy,ee,te,t.showCounts,ce,ae,U,H.attributes]);const oe=Object(r.useCallback)(e=>Array.isArray(ee)?ee.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[ee]),se=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==V||!V.taxonomy)return;const t=Object.keys(Object(y.getQueryArgs)(window.location.href)),n=Object(Q.h)(V.taxonomy),r=t.reduce((e,t)=>t.includes(S.b+n)||t.includes(S.a+n)?Object(y.removeQueryArgs)(e,t):e,window.location.href),c=Object(Q.b)(r,e);Object(S.c)(c)}else{const t=Object(Q.b)(N,e),n=Object(y.getQueryArgs)(window.location.href),r=Object(y.getQueryArgs)(t);Object(Q.f)(n,r)||Object(S.c)(t)}}),[N,null==V?void 0:V.taxonomy]),le=e=>{const n=Object(B.b)(Z,X,V,oe(e),"or"===t.queryType?"in":"and");se(n,0===e.length)},ue=Object(r.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(W(e),!r&&t.showFilterButton||Object(B.b)(Z,X,V,oe(e),"or"===t.queryType?"in":"and"))}),[n,W,Z,X,V,oe,t.queryType,t.showFilterButton]),ie=Object(r.useMemo)(()=>Object(_.a)(Z)?Z.filter(e=>{let{attribute:t}=e;return t===(null==V?void 0:V.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[Z,null==V?void 0:V.taxonomy]),be=Object(o.a)(ie),de=Object(s.a)(be);Object(r.useEffect)(()=>{!de||O()(de,be)||O()(U,be)||ue(be)},[U,be,de,ue]);const fe="single"!==t.selectType,me=Object(r.useCallback)(e=>{const t=U.includes(e);let n;fe?(n=U.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],ue(n)},[U,fe,ue]);Object(r.useEffect)(()=>{V&&!t.showFilterButton&&(Object(Q.a)({currentCheckedFilters:U,hasSetFilterDefaultsFromUrl:T})?se(Z,!0):se(Z,!1))},[T,se,Z,V,U,t.showFilterButton]),Object(r.useEffect)(()=>{if(!T&&!te)return Y.length>0?(L(!0),void ue(Y,!0)):void(C||L(!0))},[V,T,te,ue,Y,C]);const Oe=Object(D.b)();if(!m)return Oe(!1),null;if(!V)return n?Object(r.createElement)(p.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(c.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(Oe(!1),null);if(0===J.length&&!te&&n)return Object(r.createElement)(p.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(c.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const je="h"+t.headingLevel,pe=!t.isPreview&&te,ge=!t.isPreview&&ce,ye=(pe||ge)&&0===J.length;if(!ye&&0===J.length)return Oe(!1),null;const he=Object(r.createElement)(je,{className:"wc-block-attribute-filter__title"},t.heading),ve=ye?Object(r.createElement)(F.a,null,he):he;return Oe(!0),Object(r.createElement)(r.Fragment,null,!n&&t.heading&&ve,Object(r.createElement)("div",{className:A()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(R,{key:$,className:A()(z.className,{"single-selection":!fe,"is-loading":ye}),style:{...z.style,borderStyle:"none"},suggestions:J.filter(e=>!U.includes(e.value)).map(e=>e.formattedValue),disabled:ye,placeholder:Object(c.sprintf)(
2
  /* translators: %s attribute name. */
3
  Object(c.__)("Select %s","woo-gutenberg-products-block"),V.label),onChange:e=>{!fe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=J.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(x.difference)(e,U);if(1===t.length)return me(t[0]);const n=Object(x.difference)(U,e);1===n.length&&me(n[0])},value:U,displayTransform:e=>{const t=J.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:Q.c,messages:{added:Object(c.sprintf)(
4
  /* translators: %s is the attribute label. */
@@ -8,13 +8,13 @@ Object(c.__)("%s filter removed.","woo-gutenberg-products-block"),V.label),remov
8
  /* translators: %s is the attribute label. */
9
  Object(c.__)("Remove %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase()),__experimentalInvalid:Object(c.sprintf)(
10
  /* translators: %s is the attribute label. */
11
- Object(c.__)("Invalid %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase())}}),fe&&Object(r.createElement)(E.a,{icon:k.a,size:30})):Object(r.createElement)(M,{options:J,checked:U,onChange:me,isLoading:ye,isDisabled:ye})),Object(r.createElement)("div",{className:"wc-block-attribute-filter__actions"},U.length>0&&!ye&&Object(r.createElement)(d.a,{onClick:()=>{W([]),K(Object(Q.d)()),T&&le([])},screenReaderLabel:Object(c.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(r.createElement)(f.a,{className:"wc-block-attribute-filter__button",isLoading:ye,disabled:pe||ge||0===U.length,onClick:()=>le(U)})))}},18:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return r(e)&&t in e}},215:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n(100);var r=n(44);const c=()=>r.m>1},22:function(e,t,n){"use strict";var r=n(0),c=n(5),a=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:o,wrapperProps:s={}}=e;const l=null!=n,u=null!=c;return!l&&u?(t=o||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,c)):(t=o||r.Fragment,l&&u&&n!==c?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},c)):Object(r.createElement)(t,s,n))}},223:function(e,t){},224:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s}));var r=n(18);const c=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,a=e=>Array.isArray(e)&&e.every(c),o=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),s=e=>Array.isArray(e)&&e.every(o)},225:function(e,t){},23:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0);const c=Object(r.createContext)("page"),a=()=>Object(r.useContext)(c);c.Provider},27:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),c=n(12),a=n.n(c);function o(e){const t=Object(r.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},276:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(108),c=n(215),a=n(18),o=n(133);const s=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},n=Object(o.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},28:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},292:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(108),c=n(215),a=n(18),o=n(133);const s=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},n=Object(o.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:n})}},30:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return f}));var r=n(3),c=n(4),a=n(0),o=n(12),s=n.n(o),l=n(27),u=n(61),i=n(23);const b=e=>{const t=Object(i.a)();e=e||t;const n=Object(c.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:o}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(a.useCallback)(t=>{o(e,t)},[e,o])]},d=(e,t,n)=>{const o=Object(i.a)();n=n||o;const s=Object(c.useSelect)(c=>c(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:l}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(a.useCallback)(t=>{l(n,e,t)},[n,e,l])]},f=(e,t)=>{const n=Object(i.a)();t=t||n;const[r,c]=b(t),o=Object(l.a)(r),d=Object(l.a)(e),f=Object(u.a)(d),m=Object(a.useRef)(!1);return Object(a.useEffect)(()=>{s()(f,d)||(c(Object.assign({},o,d)),m.current=!0)},[o,d,f,c]),m.current?[r,c]:[e,c]}},457:function(e,t,n){"use strict";n.r(t);var r=n(0),c=n(292),a=n(28),o=n(159),s=n(59);t.default=e=>{const t=Object(c.a)(e);return Object(r.createElement)("div",{className:Object(a.a)(e.className)?e.className:"",style:{...t.style}},Object(r.createElement)(o.a,{isEditor:!1,attributes:Object(s.g)(e)}))}},51:function(e,t,n){"use strict";var r=n(0);n(71),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},59:function(e,t,n){"use strict";n.d(t,"d",(function(){return s})),n.d(t,"h",(function(){return l})),n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return i})),n.d(t,"e",(function(){return b})),n.d(t,"f",(function(){return d})),n.d(t,"c",(function(){return f})),n.d(t,"g",(function(){return m}));var r=n(13),c=n(70),a=n(28),o=n(124);function s(){return Math.floor(Math.random()*Date.now())}const l=e=>e.replace("pa_",""),u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:a}=e,o=l(t),s=r.join(","),u=`${c.b}${o}`,i="in"===a?"or":"and";n[`${c.a}${o}`]=s,n[u]=i});const a=Object(r.removeQueryArgs)(e,...Object.keys(n));return Object(r.addQueryArgs)(a,n)},i=e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length},b=e=>{if(e){const t=Object(c.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]},d=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,c]=n;return e[r]===c&&t},!0)},f=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),m=e=>({className:Object(a.a)(null==e?void 0:e.className)?e.className:"",attributeId:parseInt(Object(a.a)(null==e?void 0:e.attributeId)?e.attributeId:"0",10),showCounts:"false"!==(null==e?void 0:e.showCounts),queryType:Object(a.a)(null==e?void 0:e.queryType)&&e.queryType||o.attributes.queryType.default,heading:Object(a.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(a.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||o.attributes.headingLevel.default,displayStyle:Object(a.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||o.attributes.displayStyle.default,showFilterButton:"true"===(null==e?void 0:e.showFilterButton),selectType:Object(a.a)(null==e?void 0:e.selectType)&&e.selectType||o.attributes.selectType.default,isPreview:!1})},60:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(3),c=n(4),a=n(0),o=n(27),s=n(73);const l=e=>{const{namespace:t,resourceName:n,resourceValues:l=[],query:u={},shouldSelect:i=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(a.useRef)({results:[],isLoading:!0}),d=Object(o.a)(u),f=Object(o.a)(l),m=Object(s.a)(),O=Object(c.useSelect)(e=>{if(!i)return null;const c=e(r.COLLECTIONS_STORE_KEY),a=[t,n,d,f],o=c.getCollectionError(...a);if(o){if(!(o instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(o)}return{results:c.getCollection(...a),isLoading:!c.hasFinishedResolution("getCollection",a)}},[t,n,f,d,i]);return null!==O&&(b.current=O),b.current}},61:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(7);function c(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},62:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(22);n(134),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(a.a,{label:n.toString(),screenReaderLabel:Object(c.sprintf)(
12
  /* translators: %s number of products. */
13
- Object(c._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},69:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},70:function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"c",(function(){return i}));var r=n(13),c=n(2),a=n(69);const o=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,a.a),s="query_type_",l="filter_";function u(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function i(e){o?window.location.href=e:window.history.replaceState({},"",e)}},71:function(e,t){},73:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const c=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},94:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(5),o=n.n(a),s=n(22);n(115),t.a=e=>{let{className:t,label:
14
  /* translators: Reset button text for filters. */
15
- n=Object(c.__)("Reset","woo-gutenberg-products-block"),onClick:a,screenReaderLabel:l=Object(c.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:o()("wc-block-components-filter-reset-button",t),onClick:a},Object(r.createElement)(s.a,{label:n,screenReaderLabel:l}))}},95:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(5),o=n.n(a),s=n(22);n(116),t.a=e=>{let{className:t,isLoading:n,disabled:a,label:
16
  /* translators: Submit button text for filters. */
17
- l=Object(c.__)("Apply","woo-gutenberg-products-block"),onClick:u,screenReaderLabel:i=Object(c.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:o()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:a,onClick:u},Object(r.createElement)(s.a,{label:l,screenReaderLabel:i}))}},96:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(5),o=n.n(a),s=n(9);n(117),t.a=e=>{let{className:t,onChange:n,options:a=[],checked:l=[],isLoading:u=!1,isDisabled:i=!1,limit:b=10}=e;const[d,f]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),O=Object(r.useMemo)(()=>{const e=a.length-b;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{f(!0)},"aria-expanded":!1,"aria-label":Object(c.sprintf)(
18
  /* translators: %s is referring the remaining count of options */
19
  Object(c._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(c.sprintf)(
20
  /* translators: %s number of options to reveal. */
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{101:function(e,t){},102:function(e,t){},103:function(e,t){},115:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return a}));var r=n(7);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const a=e.filter(e=>e.attribute===n.taxonomy),o=a.length?a[0]:null;if(!(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(c)))return;const s=o.slug.filter(e=>e!==c),l=e.filter(e=>e.attribute!==n.taxonomy);s.length>0&&(o.slug=s.sort(),l.push(o)),t(Object(r.sortBy)(l,"attribute"))},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const o=e.filter(e=>e.attribute!==n.taxonomy);return 0===c.length?t(o):(o.push({attribute:n.taxonomy,operator:a,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(o,"attribute"))),o}},118:function(e,t){},120:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return o}));var r=n(2);const c=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),a=e=>{if(e)return c.find(t=>t.id===e)},o=e=>{if(e)return c.find(t=>t.taxonomy===e)}},125:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},135:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(30),c=n(19);const a=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},136:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(0),c=n(97),a=n(7),o=n(29),s=n(19),l=n(32),u=n(61),i=n(25);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryRating:d,queryState:f}=e,m=Object(i.a)();m+="-collection-data";const[O]=Object(l.a)(m),[j,p]=Object(l.b)("calculate_attribute_counts",[],m),[g,y]=Object(l.b)("calculate_price_range",null,m),[h,v]=Object(l.b)("calculate_stock_status_counts",null,m),[w,_]=Object(l.b)("calculate_rating_counts",null,m),E=Object(o.a)(t||{}),k=Object(o.a)(n),S=Object(o.a)(b),x=Object(o.a)(d);Object(r.useEffect)(()=>{"object"==typeof E&&Object.keys(E).length&&(j.find(e=>Object(s.b)(E,"taxonomy")&&e.taxonomy===E.taxonomy)||p([...j,E]))},[E,j,p]),Object(r.useEffect)(()=>{g!==k&&void 0!==k&&y(k)},[k,y,g]),Object(r.useEffect)(()=>{h!==S&&void 0!==S&&v(S)},[S,v,h]),Object(r.useEffect)(()=>{w!==x&&void 0!==x&&_(x)},[x,_,w]);const[C,N]=Object(r.useState)(!1),[T]=Object(c.a)(C,200);C||N(!0);const L=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(a.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(O),[O]);return Object(u.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...f,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...L},shouldSelect:T})}},137:function(e,t){},161:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(278),o=n(29),s=n(62),l=n(32),u=n(61),i=n(136),b=n(63),d=n(68),f=n(69),m=n(13),O=n.n(m),j=n(23),p=n(98),g=n(2),y=n(14),h=n(74),v=n(30),w=n(19),_=n(226),E=n(114),k=n(285),S=n(71),x=n(7),C=n(12),N=n.n(C),T=n(287),L=n(4),A=n.n(L);n(227);var R=e=>{let{className:t,style:n,suggestions:c,multiple:a=!0,saveTransform:o=(e=>e.trim().replace(/\s/g,"-")),messages:s={},validateInput:l=(e=>c.includes(e)),label:u="",...i}=e;return Object(r.createElement)("div",{className:A()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!a}),style:n},Object(r.createElement)(T.a,N()({label:u,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:l,saveTransform:o,maxLength:a?void 0:1,suggestions:c,messages:s},i)))},F=n(67),q=n(120),B=n(115);const I=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(r.createElement)(b.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(r.createElement)(b.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(r.createElement)(b.a,{name:"Red",count:2}),textLabel:"Red (2)"}],P={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(225);var Q=n(60),V=n(96),M=e=>{let{isLoading:t=!1,options:n,checked:c,onChange:a}=e;return t?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"is-loading"}),Object(r.createElement)("span",{className:"is-loading"})):Object(r.createElement)(V.a,{className:"wc-block-attribute-filter-list",options:n,checked:c,onChange:a,isLoading:t,isDisabled:t})},D=n(45);t.a=e=>{let{attributes:t,isEditor:n=!1}=e;const m=Object(g.getSettingWithCoercion)("has_filterable_products",!1,h.a),C=Object(g.getSettingWithCoercion)("is_rendering_php_template",!1,h.a),N=Object(g.getSettingWithCoercion)("page_url",window.location.href,v.a),[T,L]=Object(r.useState)(!1),V=t.isPreview&&!t.attributeId?P:Object(q.a)(t.attributeId),Y=Object(r.useMemo)(()=>Object(Q.e)(V),[V]),[U,W]=Object(r.useState)(Y),[$,K]=Object(r.useState)(Object(Q.d)()),[J,G]=Object(r.useState)(t.isPreview&&!t.attributeId?I:[]),z=Object(a.a)(t),[H]=Object(l.a)(),[Z,X]=Object(l.b)("attributes",[]),{results:ee,isLoading:te}=Object(u.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==V?void 0:V.id)||0],shouldSelect:t.attributeId>0}),ne="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:re,isLoading:ce}=Object(i.a)({queryAttribute:{taxonomy:(null==V?void 0:V.taxonomy)||"",queryType:t.queryType},queryState:{...H,attributes:ne?H.attributes:null}}),ae=Object(r.useCallback)(e=>Object(w.b)(re,"attribute_counts")&&Array.isArray(re.attribute_counts)?re.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[re]);Object(r.useEffect)(()=>{if(te||ce)return;if(!Array.isArray(ee))return;const e=ee.map(e=>{const n=ae(e.id);if(!(n||U.includes(e.slug)||(c=e.slug,null!=H&&H.attributes&&H.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==V?void 0:V.taxonomy)&&n.includes(c)}))))return null;var c;const a=n?n.count:0;return{formattedValue:Object(Q.c)(e.slug),value:e.slug,name:Object(j.decodeEntities)(e.name),label:Object(r.createElement)(b.a,{name:Object(j.decodeEntities)(e.name),count:t.showCounts?a:null}),textLabel:t.showCounts?`${Object(j.decodeEntities)(e.name)} (${a})`:Object(j.decodeEntities)(e.name)}}).filter(e=>!!e);G(e),K(Object(Q.d)())},[null==V?void 0:V.taxonomy,ee,te,t.showCounts,ce,ae,U,H.attributes]);const oe=Object(r.useCallback)(e=>Array.isArray(ee)?ee.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[ee]),se=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==V||!V.taxonomy)return;const t=Object.keys(Object(y.getQueryArgs)(window.location.href)),n=Object(Q.h)(V.taxonomy),r=t.reduce((e,t)=>t.includes(S.b+n)||t.includes(S.a+n)?Object(y.removeQueryArgs)(e,t):e,window.location.href),c=Object(Q.b)(r,e);Object(S.c)(c)}else{const t=Object(Q.b)(N,e),n=Object(y.getQueryArgs)(window.location.href),r=Object(y.getQueryArgs)(t);Object(Q.f)(n,r)||Object(S.c)(t)}}),[N,null==V?void 0:V.taxonomy]),le=e=>{const n=Object(B.b)(Z,X,V,oe(e),"or"===t.queryType?"in":"and");se(n,0===e.length)},ue=Object(r.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(W(e),!r&&t.showFilterButton||Object(B.b)(Z,X,V,oe(e),"or"===t.queryType?"in":"and"))}),[n,W,Z,X,V,oe,t.queryType,t.showFilterButton]),ie=Object(r.useMemo)(()=>Object(_.a)(Z)?Z.filter(e=>{let{attribute:t}=e;return t===(null==V?void 0:V.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[Z,null==V?void 0:V.taxonomy]),be=Object(o.a)(ie),de=Object(s.a)(be);Object(r.useEffect)(()=>{!de||O()(de,be)||O()(U,be)||ue(be)},[U,be,de,ue]);const fe="single"!==t.selectType,me=Object(r.useCallback)(e=>{const t=U.includes(e);let n;fe?(n=U.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],ue(n)},[U,fe,ue]);Object(r.useEffect)(()=>{V&&!t.showFilterButton&&(Object(Q.a)({currentCheckedFilters:U,hasSetFilterDefaultsFromUrl:T})?se(Z,!0):se(Z,!1))},[T,se,Z,V,U,t.showFilterButton]),Object(r.useEffect)(()=>{if(!T&&!te)return Y.length>0?(L(!0),void ue(Y,!0)):void(C||L(!0))},[V,T,te,ue,Y,C]);const Oe=Object(D.b)();if(!m)return Oe(!1),null;if(!V)return n?Object(r.createElement)(p.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(c.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(Oe(!1),null);if(0===J.length&&!te&&n)return Object(r.createElement)(p.a,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(c.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const je="h"+t.headingLevel,pe=!t.isPreview&&te,ge=!t.isPreview&&ce,ye=(pe||ge)&&0===J.length;if(!ye&&0===J.length)return Oe(!1),null;const he=Object(r.createElement)(je,{className:"wc-block-attribute-filter__title"},t.heading),ve=ye?Object(r.createElement)(F.a,null,he):he;return Oe(!0),Object(r.createElement)(r.Fragment,null,!n&&t.heading&&ve,Object(r.createElement)("div",{className:A()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(R,{key:$,className:A()(z.className,{"single-selection":!fe,"is-loading":ye}),style:{...z.style,borderStyle:"none"},suggestions:J.filter(e=>!U.includes(e.value)).map(e=>e.formattedValue),disabled:ye,placeholder:Object(c.sprintf)(
2
  /* translators: %s attribute name. */
3
  Object(c.__)("Select %s","woo-gutenberg-products-block"),V.label),onChange:e=>{!fe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=J.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(x.difference)(e,U);if(1===t.length)return me(t[0]);const n=Object(x.difference)(U,e);1===n.length&&me(n[0])},value:U,displayTransform:e=>{const t=J.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:Q.c,messages:{added:Object(c.sprintf)(
4
  /* translators: %s is the attribute label. */
8
  /* translators: %s is the attribute label. */
9
  Object(c.__)("Remove %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase()),__experimentalInvalid:Object(c.sprintf)(
10
  /* translators: %s is the attribute label. */
11
+ Object(c.__)("Invalid %s filter.","woo-gutenberg-products-block"),V.label.toLocaleLowerCase())}}),fe&&Object(r.createElement)(E.a,{icon:k.a,size:30})):Object(r.createElement)(M,{options:J,checked:U,onChange:me,isLoading:ye,isDisabled:ye})),Object(r.createElement)("div",{className:"wc-block-attribute-filter__actions"},U.length>0&&!ye&&Object(r.createElement)(d.a,{onClick:()=>{W([]),K(Object(Q.d)()),T&&le([])},screenReaderLabel:Object(c.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(r.createElement)(f.a,{className:"wc-block-attribute-filter__button",isLoading:ye,disabled:pe||ge||0===U.length,onClick:()=>le(U)})))}},19:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return r(e)&&t in e}},20:function(e,t,n){"use strict";var r=n(0),c=n(4),a=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:o,wrapperProps:s={}}=e;const l=null!=n,u=null!=c;return!l&&u?(t=o||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,c)):(t=o||r.Fragment,l&&u&&n!==c?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},c)):Object(r.createElement)(t,s,n))}},217:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n(100);var r=n(46);const c=()=>r.m>1},225:function(e,t){},226:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s}));var r=n(19);const c=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,a=e=>Array.isArray(e)&&e.every(c),o=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),s=e=>Array.isArray(e)&&e.every(o)},227:function(e,t){},25:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0);const c=Object(r.createContext)("page"),a=()=>Object(r.useContext)(c);c.Provider},278:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(111),c=n(217),a=n(19),o=n(135);const s=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},n=Object(o.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},29:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),c=n(13),a=n.n(c);function o(e){const t=Object(r.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},293:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(111),c=n(217),a=n(19),o=n(135);const s=e=>{if(!Object(c.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},n=Object(o.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:n})}},30:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},32:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return f}));var r=n(3),c=n(5),a=n(0),o=n(13),s=n.n(o),l=n(29),u=n(62),i=n(25);const b=e=>{const t=Object(i.a)();e=e||t;const n=Object(c.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:o}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(a.useCallback)(t=>{o(e,t)},[e,o])]},d=(e,t,n)=>{const o=Object(i.a)();n=n||o;const s=Object(c.useSelect)(c=>c(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:l}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(a.useCallback)(t=>{l(n,e,t)},[n,e,l])]},f=(e,t)=>{const n=Object(i.a)();t=t||n;const[r,c]=b(t),o=Object(l.a)(r),d=Object(l.a)(e),f=Object(u.a)(d),m=Object(a.useRef)(!1);return Object(a.useEffect)(()=>{s()(f,d)||(c(Object.assign({},o,d)),m.current=!0)},[o,d,f,c]),m.current?[r,c]:[e,c]}},459:function(e,t,n){"use strict";n.r(t);var r=n(0),c=n(293),a=n(30),o=n(161),s=n(60);t.default=e=>{const t=Object(c.a)(e);return Object(r.createElement)("div",{className:Object(a.a)(e.className)?e.className:"",style:{...t.style}},Object(r.createElement)(o.a,{isEditor:!1,attributes:Object(s.g)(e)}))}},60:function(e,t,n){"use strict";n.d(t,"d",(function(){return s})),n.d(t,"h",(function(){return l})),n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return i})),n.d(t,"e",(function(){return b})),n.d(t,"f",(function(){return d})),n.d(t,"c",(function(){return f})),n.d(t,"g",(function(){return m}));var r=n(14),c=n(71),a=n(30),o=n(125);function s(){return Math.floor(Math.random()*Date.now())}const l=e=>e.replace("pa_",""),u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:a}=e,o=l(t),s=r.join(","),u=`${c.b}${o}`,i="in"===a?"or":"and";n[`${c.a}${o}`]=s,n[u]=i});const a=Object(r.removeQueryArgs)(e,...Object.keys(n));return Object(r.addQueryArgs)(a,n)},i=e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length},b=e=>{if(e){const t=Object(c.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]},d=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,c]=n;return e[r]===c&&t},!0)},f=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),m=e=>({className:Object(a.a)(null==e?void 0:e.className)?e.className:"",attributeId:parseInt(Object(a.a)(null==e?void 0:e.attributeId)?e.attributeId:"0",10),showCounts:"false"!==(null==e?void 0:e.showCounts),queryType:Object(a.a)(null==e?void 0:e.queryType)&&e.queryType||o.attributes.queryType.default,heading:Object(a.a)(null==e?void 0:e.heading)?e.heading:"",headingLevel:Object(a.a)(null==e?void 0:e.headingLevel)&&parseInt(e.headingLevel,10)||o.attributes.headingLevel.default,displayStyle:Object(a.a)(null==e?void 0:e.displayStyle)&&e.displayStyle||o.attributes.displayStyle.default,showFilterButton:"true"===(null==e?void 0:e.showFilterButton),selectType:Object(a.a)(null==e?void 0:e.selectType)&&e.selectType||o.attributes.selectType.default,isPreview:!1})},61:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(3),c=n(5),a=n(0),o=n(29),s=n(76);const l=e=>{const{namespace:t,resourceName:n,resourceValues:l=[],query:u={},shouldSelect:i=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(a.useRef)({results:[],isLoading:!0}),d=Object(o.a)(u),f=Object(o.a)(l),m=Object(s.a)(),O=Object(c.useSelect)(e=>{if(!i)return null;const c=e(r.COLLECTIONS_STORE_KEY),a=[t,n,d,f],o=c.getCollectionError(...a);if(o){if(!(o instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(o)}return{results:c.getCollection(...a),isLoading:!c.hasFinishedResolution("getCollection",a)}},[t,n,f,d,i]);return null!==O&&(b.current=O),b.current}},62:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(8);function c(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},63:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(20);n(137),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(a.a,{label:n.toString(),screenReaderLabel:Object(c.sprintf)(
12
  /* translators: %s number of products. */
13
+ Object(c._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},67:function(e,t,n){"use strict";var r=n(0);n(101),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},68:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(4),o=n.n(a),s=n(20);n(102),t.a=e=>{let{className:t,label:
14
  /* translators: Reset button text for filters. */
15
+ n=Object(c.__)("Reset","woo-gutenberg-products-block"),onClick:a,screenReaderLabel:l=Object(c.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:o()("wc-block-components-filter-reset-button",t),onClick:a},Object(r.createElement)(s.a,{label:n,screenReaderLabel:l}))}},69:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(4),o=n.n(a),s=n(20);n(103),t.a=e=>{let{className:t,isLoading:n,disabled:a,label:
16
  /* translators: Submit button text for filters. */
17
+ l=Object(c.__)("Apply","woo-gutenberg-products-block"),onClick:u,screenReaderLabel:i=Object(c.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:o()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:a,onClick:u},Object(r.createElement)(s.a,{label:l,screenReaderLabel:i}))}},71:function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"c",(function(){return i}));var r=n(14),c=n(2),a=n(74);const o=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,a.a),s="query_type_",l="filter_";function u(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function i(e){o?window.location.href=e:window.history.replaceState({},"",e)}},74:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},76:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const c=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},96:function(e,t,n){"use strict";var r=n(0),c=n(1),a=n(4),o=n.n(a),s=n(10);n(118),t.a=e=>{let{className:t,onChange:n,options:a=[],checked:l=[],isLoading:u=!1,isDisabled:i=!1,limit:b=10}=e;const[d,f]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),O=Object(r.useMemo)(()=>{const e=a.length-b;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{f(!0)},"aria-expanded":!1,"aria-label":Object(c.sprintf)(
18
  /* translators: %s is referring the remaining count of options */
19
  Object(c._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(c.sprintf)(
20
  /* translators: %s number of options to reveal. */
build/attribute-filter.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => 'c5fca72ee5f727a73ed77c442d6c41e3');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '61163c7f78e6ae224aeb472f836b7d60');
build/attribute-filter.js CHANGED
@@ -1,19 +1,19 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var r,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&d.push(c[l][0]),c[l]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(u&&u(t);d.length;)d.shift()();return o.push.apply(o,i||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,a=1;a<n.length;a++){var s=n[a];0!==c[s]&&(r=!1)}r&&(o.splice(t--,1),e=l(l.s=n[0]))}return e}var r={},c={8:0,1:0},o=[];function l(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,l),n.l=!0,n.exports}l.m=e,l.c=r,l.d=function(e,t,n){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(l.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)l.d(n,r,function(t){return e[t]}.bind(null,r));return n},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return o.push([407,0]),n()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.blocks},100:function(e,t,n){"use strict";n.d(t,"a",(function(){return k}));var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(3),s=n(119),i=n(527),u=n(4),b=n.n(u),d=n(11),m=n(19),p=n(37),g=n(526),O=n(15);const f=e=>{let{id:t,label:n,popoverContents:r,remove:c,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(o.useState)(!1),j=Object(d.useInstanceId)(f);if(i=i||n,!n)return null;n=Object(O.decodeEntities)(n);const w=b()("woocommerce-tag",u,{"has-remove":!!c}),h="woocommerce-tag__label-"+j,_=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},n));return Object(o.createElement)("span",{className:w},r?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:h,onClick:()=>p(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:h},_),r&&m&&Object(o.createElement)(a.Popover,{onClose:()=>p(!1)},r),c&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:c(t),label:Object(l.sprintf)(// Translators: %s label.
2
- Object(l.__)("Remove %s","woo-gutenberg-products-block"),n),"aria-describedby":h},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var j=f;const w=e=>Object(o.createElement)(p.b,e),h=e=>{const{list:t,selected:n,renderItem:r,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==n.findIndex(e=>{let{id:n}=e;return n===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,r({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(h,c()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:n,selected:r,messages:c,onChange:s,onRemove:i}=e;if(t||n||!r)return null;const u=r.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,c.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":c.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,r.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(j,{label:e.name,id:e.id,remove:i})))):null)},y=e=>{let{filteredList:t,search:n,onSelect:r,instanceId:c,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||w;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},n?Object(l.sprintf)(u.noResults,n):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(h,{list:t,selected:d,renderItem:p,onSelect:r,instanceId:c,isSingle:m,search:n}))},k=e=>{const{className:t="",isCompact:n,isHierarchical:r,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:f}=e,[j,w]=Object(o.useState)(""),h=Object(d.useInstanceId)(k),v=Object(o.useMemo)(()=>({...m.a,...u}),[u]),E=Object(o.useMemo)(()=>Object(m.c)(i,j,r),[i,j,r]);Object(o.useEffect)(()=>{f&&f(v.updated)},[f,v]),Object(o.useEffect)(()=>{"function"==typeof g&&g(j)},[j,g]);const S=Object(o.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:n}=t;return n===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:n}=t;return n===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":n})},Object(o.createElement)(_,c()({},e,{onRemove:S,messages:v})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:v.search,type:"search",value:j,onChange:e=>w(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(y,c()({},e,{search:j,filteredList:E,messages:v,onSelect:C,instanceId:h})))};Object(a.withSpokenMessages)(k)},102:function(e,t,n){"use strict";var r=n(0),c=n(5),o=n(11),l=n(1);n(139),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:n,onChange:o,heading:a,instanceId:s}=e;const i="h"+n;return Object(r.createElement)(i,{className:t},Object(r.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(r.createElement)(c.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:o}))})},103:function(e,t,n){"use strict";var r=n(0);n(140),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},104:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(12);function c(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},107:function(e,t){e.exports=window.wp.warning},108:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(9),c=n(7),o=n(0),l=n(40),a=n(142);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:i={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(c.useSelect)(e=>{if(!u)return null;const c=e(r.COLLECTIONS_STORE_KEY),o=[t,n,d,m],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,n,m,d,u]);return null!==g&&(b.current=g),b.current}},11:function(e,t){e.exports=window.wp.compose},113:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(29);n(280),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(o.a,{label:n.toString(),screenReaderLabel:Object(c.sprintf)(
3
  /* translators: %s number of products. */
4
- Object(c._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},115:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(86),c=n(33);const o=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},12:function(e,t){e.exports=window.React},124:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),c=n(1),o=n(10),l=n(7),a=n(3),s=n(5);const i=e=>{let{clientId:t,setAttributes:n,filterType:i,attributes:u}=e;const{replaceBlock:b}=Object(l.useDispatch)("core/block-editor"),{heading:d,headingLevel:m}=u;if(Object(l.useSelect)(e=>{const{getBlockParentsByBlockName:n}=e("core/block-editor");return n(t,"woocommerce/filter-wrapper").length>0},[t])||!i)return null;const p=[Object(r.createElement)(a.Button,{key:"convert",onClick:()=>{const e=[Object(o.createBlock)("woocommerce/"+i,{...u,heading:""})];d&&""!==d&&e.unshift(Object(o.createBlock)("core/heading",{content:d,level:null!=m?m:2})),b(t,Object(o.createBlock)("woocommerce/filter-wrapper",{heading:d,filterType:i},[...e])),n({heading:"",lock:{remove:!0}})},variant:"primary"},Object(c.__)("Upgrade block","woo-gutenberg-products-block"))];return Object(r.createElement)(s.Warning,{actions:p},Object(c.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woo-gutenberg-products-block"))}},125:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const c=Object(r.createContext)({}),o=()=>{const{wrapper:e}=Object(r.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},126:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},13:function(e,t){e.exports=window.wp.primitives},139:function(e,t){},140:function(e,t){},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const c=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},148:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},15:function(e,t){e.exports=window.wp.htmlEntities},154:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(5),c=n(61),o=n(33),l=n(115);const a=e=>{if(!Object(c.b)())return{className:"",style:{}};const t=Object(o.a)(e)?e:{},n=Object(l.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},155:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(29);n(197),t.a=e=>{let{className:t,label:
5
  /* translators: Reset button text for filters. */
6
- n=Object(c.__)("Reset","woo-gutenberg-products-block"),onClick:o,screenReaderLabel:s=Object(c.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:l()("wc-block-components-filter-reset-button",t),onClick:o},Object(r.createElement)(a.a,{label:n,screenReaderLabel:s}))}},156:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(29);n(198),t.a=e=>{let{className:t,isLoading:n,disabled:o,label:
7
  /* translators: Submit button text for filters. */
8
- s=Object(c.__)("Apply","woo-gutenberg-products-block"),onClick:i,screenReaderLabel:u=Object(c.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:l()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:o,onClick:i},Object(r.createElement)(a.a,{label:s,screenReaderLabel:u}))}},157:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(18);n(199),t.a=e=>{let{className:t,onChange:n,options:o=[],checked:s=[],isLoading:i=!1,isDisabled:u=!1,limit:b=10}=e;const[d,m]=Object(r.useState)(!1),p=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),g=Object(r.useMemo)(()=>{const e=o.length-b;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{m(!0)},"aria-expanded":!1,"aria-label":Object(c.sprintf)(
9
  /* translators: %s is referring the remaining count of options */
10
  Object(c._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(c.sprintf)(
11
  /* translators: %s number of options to reveal. */
12
- Object(c._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[o,b,d]),O=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{m(!1)},"aria-expanded":!0,"aria-label":Object(c.__)("Show less options","woo-gutenberg-products-block")},Object(c.__)("Show less","woo-gutenberg-products-block"))),[d]),f=Object(r.useMemo)(()=>{const e=o.length>b+5;return Object(r.createElement)(r.Fragment,null,o.map((t,c)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&c>=b&&{hidden:!0},Object(r.createElement)(a.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:s.includes(t.value),onChange:()=>{n(t.value)}})),e&&c===b-1&&g)),e&&O)},[o,n,s,d,b,O,g,u]),j=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return Object(r.createElement)("ul",{className:j},i?p:f)}},16:function(e,t){e.exports=window.wp.url},18:function(e,t){e.exports=window.wc.blocksCheckout},181:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return o}));var r=n(8);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===n.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const a=l.slug.filter(e=>e!==c),s=e.filter(e=>e.attribute!==n.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(r.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const l=e.filter(e=>e.attribute!==n.taxonomy);return 0===c.length?t(l):(l.push({attribute:n.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(l,"attribute"))),l}},19:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return u}));var r=n(0),c=n(8),o=n(1);const l={clear:Object(o.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(o.__)("No items found.","woo-gutenberg-products-block"),
13
  /* Translators: %s search term */
14
  noResults:Object(o.__)("No results for %s","woo-gutenberg-products-block"),search:Object(o.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(o.sprintf)(
15
  /* translators: Number of items selected from list. */
16
- Object(o._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(o.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const n=Object(c.groupBy)(e,"parent"),r=Object(c.keyBy)(t,"id"),o=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(r[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=n[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(r[e.parent]),children:t&&t.length?a(t):[]}}),s=a(n[0]||[]);return Object.entries(n).forEach(e=>{let[t,n]=e;o.includes(t)||s.push(...a(n||[]))}),s},s=(e,t,n)=>{if(!t)return n?a(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),c=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return n?a(c,e):c},i=(e,t)=>{if(!t)return e;const n=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(n).map((e,t)=>n.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},197:function(e,t){},198:function(e,t){},199:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22:function(e,t,n){"use strict";n.d(t,"o",(function(){return o})),n.d(t,"m",(function(){return l})),n.d(t,"l",(function(){return a})),n.d(t,"n",(function(){return s})),n.d(t,"j",(function(){return i})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return b})),n.d(t,"g",(function(){return d})),n.d(t,"k",(function(){return m})),n.d(t,"c",(function(){return p})),n.d(t,"d",(function(){return g})),n.d(t,"h",(function(){return O})),n.d(t,"a",(function(){return f})),n.d(t,"i",(function(){return j})),n.d(t,"b",(function(){return w}));var r,c=n(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(r=c.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=c.STORE_PAGES.checkout.id,b=c.STORE_PAGES.checkout.permalink,d=c.STORE_PAGES.privacy.permalink,m=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),p=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id),g=c.STORE_PAGES.cart.permalink,O=(c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),Object(c.getSetting)("shippingCountries",{})),f=Object(c.getSetting)("allowedCountries",{}),j=Object(c.getSetting)("shippingStates",{}),w=Object(c.getSetting)("allowedStates",{})},223:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return l}));var r=n(2);const c=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},241:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return u}));var r=n(16),c=n(2),o=n(126);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",s="filter_";function i(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},25:function(e,t){e.exports=window.wp.isShallowEqual},279:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(0),c=n(259),o=n(8),l=n(40),a=n(33),s=n(53),i=n(108),u=n(44);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryRating:d,queryState:m}=e,p=Object(u.a)();p+="-collection-data";const[g]=Object(s.a)(p),[O,f]=Object(s.b)("calculate_attribute_counts",[],p),[j,w]=Object(s.b)("calculate_price_range",null,p),[h,_]=Object(s.b)("calculate_stock_status_counts",null,p),[y,k]=Object(s.b)("calculate_rating_counts",null,p),v=Object(l.a)(t||{}),E=Object(l.a)(n),S=Object(l.a)(b),C=Object(l.a)(d);Object(r.useEffect)(()=>{"object"==typeof v&&Object.keys(v).length&&(O.find(e=>Object(a.b)(v,"taxonomy")&&e.taxonomy===v.taxonomy)||f([...O,v]))},[v,O,f]),Object(r.useEffect)(()=>{j!==E&&void 0!==E&&w(E)},[E,w,j]),Object(r.useEffect)(()=>{h!==S&&void 0!==S&&_(S)},[S,_,h]),Object(r.useEffect)(()=>{y!==C&&void 0!==C&&k(C)},[C,k,y]);const[x,N]=Object(r.useState)(!1),[T]=Object(c.a)(x,200);x||N(!0);const A=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(o.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(g),[g]);return Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...m,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...A},shouldSelect:T})}},280:function(e,t){},29:function(e,t,n){"use strict";var r=n(0),c=n(4),o=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=n,i=null!=c;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,c)):(t=l||r.Fragment,s&&i&&n!==c?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},c)):Object(r.createElement)(t,a,n))}},3:function(e,t){e.exports=window.wp.components},33:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return r(e)&&t in e}},37:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(6),c=n.n(r),o=n(0),l=n(19);const a=e=>{let{countLabel:t,className:n,depth:r=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==s.count&&null!==s.count,g=[n,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,f=m.name||"search-list-item-"+a,j=`${f}-${s.id}`;return Object(o.createElement)("label",{htmlFor:j,className:g.join(" ")},u?Object(o.createElement)("input",c()({type:"radio",id:j,name:f,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(o.createElement)("input",c()({type:"checkbox",id:j,name:f,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},40:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),c=n(25),o=n.n(c);function l(e){const t=Object(r.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},407:function(e,t,n){e.exports=n(485)},408:function(e,t){},409:function(e,t){},410:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a}));var r=n(33);const c=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(l)},411:function(e,t){},44:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const c=Object(r.createContext)("page"),o=()=>Object(r.useContext)(c);c.Provider},48:function(e,t){e.exports=window.wp.a11y},485:function(e,t,n){"use strict";n.r(t);var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(10),s=n(5),i=n(61),u=n(119),b=n(533),d=n(4),m=n.n(d),p=n(258),g=n(100),O=n(8),f=n(2),j=n(102),w=n(3),h=n(154),_=n(40),y=n(104),k=n(53),v=n(108),E=n(279),S=n(113),C=n(155),x=n(156),N=n(25),T=n.n(N),A=n(15),B=n(314),P=n(16),R=n(126),L=n(86),F=n(33),I=n(410),q=n(550),G=n(241),M=n(565);n(411);var D=e=>{let{className:t,style:n,suggestions:r,multiple:l=!0,saveTransform:a=(e=>e.trim().replace(/\s/g,"-")),messages:s={},validateInput:i=(e=>r.includes(e)),label:u="",...b}=e;return Object(o.createElement)("div",{className:m()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!l}),style:n},Object(o.createElement)(M.a,c()({label:u,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:i,saveTransform:a,maxLength:l?void 0:1,suggestions:r,messages:s},b)))},Q=n(103),V=n(223),$=n(181);const U=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(o.createElement)(S.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(o.createElement)(S.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(o.createElement)(S.a,{name:"Red",count:2}),textLabel:"Red (2)"}],Y={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(409);var W=n(148);function K(){return Math.floor(Math.random()*Date.now())}const J=e=>e.replace("pa_",""),z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:c}=e,o=J(t),l=r.join(","),a=`${G.b}${o}`,s="in"===c?"or":"and";n[`${G.a}${o}`]=l,n[a]=s});const r=Object(P.removeQueryArgs)(e,...Object.keys(n));return Object(P.addQueryArgs)(r,n)},H=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,c]=n;return e[r]===c&&t},!0)},Z=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");var X=n(157),ee=e=>{let{isLoading:t=!1,options:n,checked:r,onChange:c}=e;return t?Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"is-loading"}),Object(o.createElement)("span",{className:"is-loading"})):Object(o.createElement)(X.a,{className:"wc-block-attribute-filter-list",options:n,checked:r,onChange:c,isLoading:t,isDisabled:t})},te=n(125),ne=e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(f.getSettingWithCoercion)("has_filterable_products",!1,R.a),c=Object(f.getSettingWithCoercion)("is_rendering_php_template",!1,R.a),a=Object(f.getSettingWithCoercion)("page_url",window.location.href,L.a),[s,i]=Object(o.useState)(!1),b=t.isPreview&&!t.attributeId?Y:Object(V.a)(t.attributeId),d=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(G.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(b),[b]),[p,g]=Object(o.useState)(d),[j,w]=Object(o.useState)(K()),[N,M]=Object(o.useState)(t.isPreview&&!t.attributeId?U:[]),W=Object(h.a)(t),[X]=Object(k.a)(),[ne,re]=Object(k.b)("attributes",[]),{results:ce,isLoading:oe}=Object(v.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==b?void 0:b.id)||0],shouldSelect:t.attributeId>0}),le="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:ae,isLoading:se}=Object(E.a)({queryAttribute:{taxonomy:(null==b?void 0:b.taxonomy)||"",queryType:t.queryType},queryState:{...X,attributes:le?X.attributes:null}}),ie=Object(o.useCallback)(e=>Object(F.b)(ae,"attribute_counts")&&Array.isArray(ae.attribute_counts)?ae.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[ae]);Object(o.useEffect)(()=>{if(oe||se)return;if(!Array.isArray(ce))return;const e=ce.map(e=>{const n=ie(e.id);if(!(n||p.includes(e.slug)||(r=e.slug,null!=X&&X.attributes&&X.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==b?void 0:b.taxonomy)&&n.includes(r)}))))return null;var r;const c=n?n.count:0;return{formattedValue:Z(e.slug),value:e.slug,name:Object(A.decodeEntities)(e.name),label:Object(o.createElement)(S.a,{name:Object(A.decodeEntities)(e.name),count:t.showCounts?c:null}),textLabel:t.showCounts?`${Object(A.decodeEntities)(e.name)} (${c})`:Object(A.decodeEntities)(e.name)}}).filter(e=>!!e);M(e),w(K())},[null==b?void 0:b.taxonomy,ce,oe,t.showCounts,se,ie,p,X.attributes]);const ue=Object(o.useCallback)(e=>Array.isArray(ce)?ce.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[ce]),be=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==b||!b.taxonomy)return;const t=Object.keys(Object(P.getQueryArgs)(window.location.href)),n=J(b.taxonomy),r=t.reduce((e,t)=>t.includes(G.b+n)||t.includes(G.a+n)?Object(P.removeQueryArgs)(e,t):e,window.location.href),c=z(r,e);Object(G.c)(c)}else{const t=z(a,e),n=Object(P.getQueryArgs)(window.location.href),r=Object(P.getQueryArgs)(t);H(n,r)||Object(G.c)(t)}}),[a,null==b?void 0:b.taxonomy]),de=e=>{const n=Object($.b)(ne,re,b,ue(e),"or"===t.queryType?"in":"and");be(n,0===e.length)},me=Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(g(e),!r&&t.showFilterButton||Object($.b)(ne,re,b,ue(e),"or"===t.queryType?"in":"and"))}),[n,g,ne,re,b,ue,t.queryType,t.showFilterButton]),pe=Object(o.useMemo)(()=>Object(I.a)(ne)?ne.filter(e=>{let{attribute:t}=e;return t===(null==b?void 0:b.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[ne,null==b?void 0:b.taxonomy]),ge=Object(_.a)(pe),Oe=Object(y.a)(ge);Object(o.useEffect)(()=>{!Oe||T()(Oe,ge)||T()(p,ge)||me(ge)},[p,ge,Oe,me]);const fe="single"!==t.selectType,je=Object(o.useCallback)(e=>{const t=p.includes(e);let n;fe?(n=p.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],me(n)},[p,fe,me]);Object(o.useEffect)(()=>{b&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:p,hasSetFilterDefaultsFromUrl:s})?be(ne,!0):be(ne,!1))},[s,be,ne,b,p,t.showFilterButton]),Object(o.useEffect)(()=>{if(!s&&!oe)return d.length>0?(i(!0),void me(d,!0)):void(c||i(!0))},[b,s,oe,me,d,c]);const we=Object(te.a)();if(!r)return we(!1),null;if(!b)return n?Object(o.createElement)(B.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(we(!1),null);if(0===N.length&&!oe&&n)return Object(o.createElement)(B.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const he="h"+t.headingLevel,_e=!t.isPreview&&oe,ye=!t.isPreview&&se,ke=(_e||ye)&&0===N.length;if(!ke&&0===N.length)return we(!1),null;const ve=Object(o.createElement)(he,{className:"wc-block-attribute-filter__title"},t.heading),Ee=ke?Object(o.createElement)(Q.a,null,ve):ve;return we(!0),Object(o.createElement)(o.Fragment,null,!n&&t.heading&&Ee,Object(o.createElement)("div",{className:m()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(D,{key:j,className:m()(W.className,{"single-selection":!fe,"is-loading":ke}),style:{...W.style,borderStyle:"none"},suggestions:N.filter(e=>!p.includes(e.value)).map(e=>e.formattedValue),disabled:ke,placeholder:Object(l.sprintf)(
17
  /* translators: %s attribute name. */
18
  Object(l.__)("Select %s","woo-gutenberg-products-block"),b.label),onChange:e=>{!fe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=N.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(O.difference)(e,p);if(1===t.length)return je(t[0]);const n=Object(O.difference)(p,e);1===n.length&&je(n[0])},value:p,displayTransform:e=>{const t=N.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:Z,messages:{added:Object(l.sprintf)(
19
  /* translators: %s is the attribute label. */
@@ -23,6 +23,6 @@ Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),b.label),remov
23
  /* translators: %s is the attribute label. */
24
  Object(l.__)("Remove %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase()),__experimentalInvalid:Object(l.sprintf)(
25
  /* translators: %s is the attribute label. */
26
- Object(l.__)("Invalid %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase())}}),fe&&Object(o.createElement)(u.a,{icon:q.a,size:30})):Object(o.createElement)(ee,{options:N,checked:p,onChange:je,isLoading:ke,isDisabled:ke})),Object(o.createElement)("div",{className:"wc-block-attribute-filter__actions"},p.length>0&&!ke&&Object(o.createElement)(C.a,{onClick:()=>{g([]),w(K()),s&&de([])},screenReaderLabel:Object(l.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(o.createElement)(x.a,{className:"wc-block-attribute-filter__button",isLoading:ke,disabled:_e||ye||0===p.length,onClick:()=>de(p)})))},re=(n(408),n(124));const ce=Object(f.getSetting)("attributes",[]);var oe=Object(w.withSpokenMessages)(e=>{let{attributes:t,setAttributes:n,debouncedSpeak:r,clientId:c}=e;const{attributeId:a,className:i,displayStyle:d,heading:h,headingLevel:_,isPreview:y,queryType:k,showCounts:v,showFilterButton:E,selectType:S}=t,[C,x]=Object(o.useState)(!a&&!y),N=Object(s.useBlockProps)(),T=e=>{if(!e||!e.length)return;const t=e[0].id;ce.find(e=>e.attribute_id===t.toString())&&a!==t&&n({attributeId:t})},A=e=>{let{isCompact:t}=e;const n={clear:Object(l.__)("Clear selected attribute","woo-gutenberg-products-block"),list:Object(l.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product attribute:","woo-gutenberg-products-block"),selected:e=>Object(l.sprintf)(
27
  /* translators: %d is the number of attributes selected. */
28
- Object(l._n)("%d attribute selected","%d attributes selected",e,"woo-gutenberg-products-block"),e),updated:Object(l.__)("Product attribute search results updated.","woo-gutenberg-products-block")},r=Object(O.sortBy)(ce.map(e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label})),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:r,selected:r.filter(e=>{let{id:t}=e;return t===a}),onChange:T,messages:n,isSingle:!0,isCompact:t})};return 0===Object.keys(ce).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")},Object(o.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(f.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(o.createElement)(u.a,{icon:p.a})),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))):Object(o.createElement)("div",N,Object(o.createElement)(s.BlockControls,null,Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>x(!C),isActive:C}]})),Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Include product count","woo-gutenberg-products-block"),checked:v,onChange:()=>n({showCounts:!v})}),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Allow selecting multiple options?","woo-gutenberg-products-block"),value:S||"multiple",onChange:e=>n({selectType:e}),className:"wc-block-attribute-filter__multiple-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"multiple",label:Object(l.__)("Multiple","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"single",label:Object(l.__)("Single","woo-gutenberg-products-block")})),"multiple"===S&&Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Filter Conditions","woo-gutenberg-products-block"),help:"and"===k?Object(l.__)("Choose to return filter results for all of the attributes selected.","woo-gutenberg-products-block"):Object(l.__)("Choose to return filter results for any of the attributes selected.","woo-gutenberg-products-block"),value:k,onChange:e=>n({queryType:e}),className:"wc-block-attribute-filter__conditions-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("All","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Any","woo-gutenberg-products-block")})),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:d,onChange:e=>n({displayStyle:e}),className:"wc-block-attribute-filter__display-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(l.__)("Dropdown","woo-gutenberg-products-block")})),Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Show 'Apply filters' button","woo-gutenberg-products-block"),help:E?Object(l.__)("Products will only update when the button is clicked.","woo-gutenberg-products-block"):Object(l.__)("Products will update as soon as attributes are selected.","woo-gutenberg-products-block"),checked:E,onChange:e=>n({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block"),initialOpen:!1},A({isCompact:!0}))),Object(o.createElement)(re.a,{clientId:c,attributes:t,setAttributes:n,filterType:"attribute-filter"}),C?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")},Object(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},A({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{x(!1),r(Object(l.__)("Now displaying a preview of the Filter Products by Attribute block.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:m()(i,"wc-block-attribute-filter")},h&&Object(o.createElement)(j.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:h,onChange:e=>n({heading:e})}),Object(o.createElement)(w.Disabled,null,Object(o.createElement)(ne,{attributes:t,isEditor:!0}))))});const le={heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")}};Object(a.registerBlockType)(W,{icon:{src:Object(o.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},supports:{...W.supports,...Object(i.b)()&&{__experimentalBorder:{radius:!1,color:!0,width:!1}}},attributes:{...W.attributes,...le},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:n}=e;return"woocommerce_layered_nav"===t&&!(null==n||!n.raw)},transform:e=>{var t,n,r,c;let{instance:o}=e;return Object(a.createBlock)("woocommerce/attribute-filter",{attributeId:0,showCounts:!0,queryType:(null==o||null===(t=o.raw)||void 0===t?void 0:t.query_type)||"or",heading:(null==o||null===(n=o.raw)||void 0===n?void 0:n.title)||Object(l.__)("Filter by attribute","woo-gutenberg-products-block"),headingLevel:3,displayStyle:(null==o||null===(r=o.raw)||void 0===r?void 0:r.display_type)||"list",showFilterButton:!1,selectType:(null==o||null===(c=o.raw)||void 0===c?void 0:c.select_type)||"multiple",isPreview:!1})}}]},edit:oe,save(e){let{attributes:t}=e;const{className:n,showCounts:r,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d,selectType:p}=t,g={"data-attribute-id":a,"data-show-counts":r,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(g["data-display-style"]=b),d&&(g["data-show-filter-button"]=d),"single"===p&&(g["data-select-type"]=p),Object(o.createElement)("div",c()({},s.useBlockProps.save({className:m()("is-loading",n)}),g),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},52:function(e,t){e.exports=window.wp.deprecated},53:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return m}));var r=n(9),c=n(7),o=n(0),l=n(25),a=n.n(l),s=n(40),i=n(104),u=n(44);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(c.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,n)=>{const l=Object(u.a)();n=n||l;const a=Object(c.useSelect)(c=>c(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(n,e,t)},[n,e,s])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,c]=b(t),l=Object(s.a)(r),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(m,d)||(c(Object.assign({},l,d)),p.current=!0)},[l,d,m,c]),p.current?[r,c]:[e,c]}},54:function(e,t){e.exports=window.wp.keycodes},61:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return a}));var r=n(10),c=n(22);const o=(e,t)=>{if(c.n>2)return Object(r.registerBlockType)(e,t)},l=()=>c.n>2,a=()=>c.n>1},7:function(e,t){e.exports=window.wp.data},73:function(e,t){e.exports=window.wp.dom},8:function(e,t){e.exports=window.lodash},86:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},9:function(e,t){e.exports=window.wc.wcBlocksData}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var r,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&d.push(c[l][0]),c[l]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(u&&u(t);d.length;)d.shift()();return o.push.apply(o,i||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,a=1;a<n.length;a++){var s=n[a];0!==c[s]&&(r=!1)}r&&(o.splice(t--,1),e=l(l.s=n[0]))}return e}var r={},c={8:0,1:0},o=[];function l(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,l),n.l=!0,n.exports}l.m=e,l.c=r,l.d=function(e,t,n){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(l.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)l.d(n,r,function(t){return e[t]}.bind(null,r));return n},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return o.push([407,0]),n()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.blocks},100:function(e,t,n){"use strict";n.d(t,"a",(function(){return k}));var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(3),s=n(118),i=n(524),u=n(4),b=n.n(u),d=n(11),m=n(19),p=n(37),g=n(523),O=n(15);const f=e=>{let{id:t,label:n,popoverContents:r,remove:c,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(o.useState)(!1),j=Object(d.useInstanceId)(f);if(i=i||n,!n)return null;n=Object(O.decodeEntities)(n);const w=b()("woocommerce-tag",u,{"has-remove":!!c}),h="woocommerce-tag__label-"+j,_=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},n));return Object(o.createElement)("span",{className:w},r?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:h,onClick:()=>p(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:h},_),r&&m&&Object(o.createElement)(a.Popover,{onClose:()=>p(!1)},r),c&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:c(t),label:Object(l.sprintf)(// Translators: %s label.
2
+ Object(l.__)("Remove %s","woo-gutenberg-products-block"),n),"aria-describedby":h},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var j=f;const w=e=>Object(o.createElement)(p.b,e),h=e=>{const{list:t,selected:n,renderItem:r,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==n.findIndex(e=>{let{id:n}=e;return n===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,r({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(h,c()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:n,selected:r,messages:c,onChange:s,onRemove:i}=e;if(t||n||!r)return null;const u=r.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,c.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":c.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,r.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(j,{label:e.name,id:e.id,remove:i})))):null)},y=e=>{let{filteredList:t,search:n,onSelect:r,instanceId:c,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||w;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},n?Object(l.sprintf)(u.noResults,n):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(h,{list:t,selected:d,renderItem:p,onSelect:r,instanceId:c,isSingle:m,search:n}))},k=e=>{const{className:t="",isCompact:n,isHierarchical:r,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:f}=e,[j,w]=Object(o.useState)(""),h=Object(d.useInstanceId)(k),v=Object(o.useMemo)(()=>({...m.a,...u}),[u]),E=Object(o.useMemo)(()=>Object(m.c)(i,j,r),[i,j,r]);Object(o.useEffect)(()=>{f&&f(v.updated)},[f,v]),Object(o.useEffect)(()=>{"function"==typeof g&&g(j)},[j,g]);const S=Object(o.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:n}=t;return n===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:n}=t;return n===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":n})},Object(o.createElement)(_,c()({},e,{onRemove:S,messages:v})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:v.search,type:"search",value:j,onChange:e=>w(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(y,c()({},e,{search:j,filteredList:E,messages:v,onSelect:C,instanceId:h})))};Object(a.withSpokenMessages)(k)},102:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const c=Object(r.createContext)({}),o=()=>{const{wrapper:e}=Object(r.useContext)(c);return t=>{e&&e.current&&(e.current.hidden=!t)}}},103:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(12);function c(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},106:function(e,t){e.exports=window.wp.warning},107:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(9),c=n(7),o=n(0),l=n(40),a=n(142);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:i={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(c.useSelect)(e=>{if(!u)return null;const c=e(r.COLLECTIONS_STORE_KEY),o=[t,n,d,m],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,n,m,d,u]);return null!==g&&(b.current=g),b.current}},11:function(e,t){e.exports=window.wp.compose},112:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(28);n(280),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(o.a,{label:n.toString(),screenReaderLabel:Object(c.sprintf)(
3
  /* translators: %s number of products. */
4
+ Object(c._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},114:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(86),c=n(33);const o=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},12:function(e,t){e.exports=window.React},123:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),c=n(1),o=n(10),l=n(7),a=n(3),s=n(5);const i=e=>{let{clientId:t,setAttributes:n,filterType:i,attributes:u}=e;const{replaceBlock:b}=Object(l.useDispatch)("core/block-editor"),{heading:d,headingLevel:m}=u;if(Object(l.useSelect)(e=>{const{getBlockParentsByBlockName:n}=e("core/block-editor");return n(t,"woocommerce/filter-wrapper").length>0},[t])||!i)return null;const p=[Object(r.createElement)(a.Button,{key:"convert",onClick:()=>{const e=[Object(o.createBlock)("woocommerce/"+i,{...u,heading:""})];d&&""!==d&&e.unshift(Object(o.createBlock)("core/heading",{content:d,level:null!=m?m:2})),b(t,Object(o.createBlock)("woocommerce/filter-wrapper",{heading:d,filterType:i},[...e])),n({heading:"",lock:{remove:!0}})},variant:"primary"},Object(c.__)("Upgrade block","woo-gutenberg-products-block"))];return Object(r.createElement)(s.Warning,{actions:p},Object(c.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woo-gutenberg-products-block"))}},124:function(e,t,n){"use strict";var r=n(0),c=n(5),o=n(11),l=n(1);n(167),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:n,onChange:o,heading:a,instanceId:s}=e;const i="h"+n;return Object(r.createElement)(i,{className:t},Object(r.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(r.createElement)(c.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:o}))})},125:function(e,t,n){"use strict";var r=n(0);n(168),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},126:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(28);n(169),t.a=e=>{let{className:t,label:
5
  /* translators: Reset button text for filters. */
6
+ n=Object(c.__)("Reset","woo-gutenberg-products-block"),onClick:o,screenReaderLabel:s=Object(c.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:l()("wc-block-components-filter-reset-button",t),onClick:o},Object(r.createElement)(a.a,{label:n,screenReaderLabel:s}))}},127:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(28);n(170),t.a=e=>{let{className:t,isLoading:n,disabled:o,label:
7
  /* translators: Submit button text for filters. */
8
+ s=Object(c.__)("Apply","woo-gutenberg-products-block"),onClick:i,screenReaderLabel:u=Object(c.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:l()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:o,onClick:i},Object(r.createElement)(a.a,{label:s,screenReaderLabel:u}))}},128:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},13:function(e,t){e.exports=window.wp.primitives},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const c=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},148:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},15:function(e,t){e.exports=window.wp.htmlEntities},154:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(5),c=n(58),o=n(33),l=n(114);const a=e=>{if(!Object(c.b)())return{className:"",style:{}};const t=Object(o.a)(e)?e:{},n=Object(l.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},155:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(18);n(199),t.a=e=>{let{className:t,onChange:n,options:o=[],checked:s=[],isLoading:i=!1,isDisabled:u=!1,limit:b=10}=e;const[d,m]=Object(r.useState)(!1),p=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),g=Object(r.useMemo)(()=>{const e=o.length-b;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{m(!0)},"aria-expanded":!1,"aria-label":Object(c.sprintf)(
9
  /* translators: %s is referring the remaining count of options */
10
  Object(c._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(c.sprintf)(
11
  /* translators: %s number of options to reveal. */
12
+ Object(c._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[o,b,d]),O=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{m(!1)},"aria-expanded":!0,"aria-label":Object(c.__)("Show less options","woo-gutenberg-products-block")},Object(c.__)("Show less","woo-gutenberg-products-block"))),[d]),f=Object(r.useMemo)(()=>{const e=o.length>b+5;return Object(r.createElement)(r.Fragment,null,o.map((t,c)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&c>=b&&{hidden:!0},Object(r.createElement)(a.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:s.includes(t.value),onChange:()=>{n(t.value)}})),e&&c===b-1&&g)),e&&O)},[o,n,s,d,b,O,g,u]),j=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return Object(r.createElement)("ul",{className:j},i?p:f)}},16:function(e,t){e.exports=window.wp.url},167:function(e,t){},168:function(e,t){},169:function(e,t){},170:function(e,t){},18:function(e,t){e.exports=window.wc.blocksCheckout},183:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return o}));var r=n(8);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===n.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const a=l.slug.filter(e=>e!==c),s=e.filter(e=>e.attribute!==n.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(r.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const l=e.filter(e=>e.attribute!==n.taxonomy);return 0===c.length?t(l):(l.push({attribute:n.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(l,"attribute"))),l}},19:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return u}));var r=n(0),c=n(8),o=n(1);const l={clear:Object(o.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(o.__)("No items found.","woo-gutenberg-products-block"),
13
  /* Translators: %s search term */
14
  noResults:Object(o.__)("No results for %s","woo-gutenberg-products-block"),search:Object(o.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(o.sprintf)(
15
  /* translators: Number of items selected from list. */
16
+ Object(o._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(o.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const n=Object(c.groupBy)(e,"parent"),r=Object(c.keyBy)(t,"id"),o=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(r[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=n[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(r[e.parent]),children:t&&t.length?a(t):[]}}),s=a(n[0]||[]);return Object.entries(n).forEach(e=>{let[t,n]=e;o.includes(t)||s.push(...a(n||[]))}),s},s=(e,t,n)=>{if(!t)return n?a(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),c=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return n?a(c,e):c},i=(e,t)=>{if(!t)return e;const n=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(n).map((e,t)=>n.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},199:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},21:function(e,t,n){"use strict";n.d(t,"o",(function(){return o})),n.d(t,"m",(function(){return l})),n.d(t,"l",(function(){return a})),n.d(t,"n",(function(){return s})),n.d(t,"j",(function(){return i})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return b})),n.d(t,"g",(function(){return d})),n.d(t,"k",(function(){return m})),n.d(t,"c",(function(){return p})),n.d(t,"d",(function(){return g})),n.d(t,"h",(function(){return O})),n.d(t,"a",(function(){return f})),n.d(t,"i",(function(){return j})),n.d(t,"b",(function(){return w}));var r,c=n(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(r=c.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=c.STORE_PAGES.checkout.id,b=c.STORE_PAGES.checkout.permalink,d=c.STORE_PAGES.privacy.permalink,m=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),p=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id),g=c.STORE_PAGES.cart.permalink,O=(c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),Object(c.getSetting)("shippingCountries",{})),f=Object(c.getSetting)("allowedCountries",{}),j=Object(c.getSetting)("shippingStates",{}),w=Object(c.getSetting)("allowedStates",{})},223:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return l}));var r=n(2);const c=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},241:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return u}));var r=n(16),c=n(2),o=n(128);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",s="filter_";function i(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},25:function(e,t){e.exports=window.wp.isShallowEqual},279:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(0),c=n(259),o=n(8),l=n(40),a=n(33),s=n(53),i=n(107),u=n(46);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryRating:d,queryState:m}=e,p=Object(u.a)();p+="-collection-data";const[g]=Object(s.a)(p),[O,f]=Object(s.b)("calculate_attribute_counts",[],p),[j,w]=Object(s.b)("calculate_price_range",null,p),[h,_]=Object(s.b)("calculate_stock_status_counts",null,p),[y,k]=Object(s.b)("calculate_rating_counts",null,p),v=Object(l.a)(t||{}),E=Object(l.a)(n),S=Object(l.a)(b),C=Object(l.a)(d);Object(r.useEffect)(()=>{"object"==typeof v&&Object.keys(v).length&&(O.find(e=>Object(a.b)(v,"taxonomy")&&e.taxonomy===v.taxonomy)||f([...O,v]))},[v,O,f]),Object(r.useEffect)(()=>{j!==E&&void 0!==E&&w(E)},[E,w,j]),Object(r.useEffect)(()=>{h!==S&&void 0!==S&&_(S)},[S,_,h]),Object(r.useEffect)(()=>{y!==C&&void 0!==C&&k(C)},[C,k,y]);const[x,N]=Object(r.useState)(!1),[T]=Object(c.a)(x,200);x||N(!0);const A=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(o.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(g),[g]);return Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...m,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...A},shouldSelect:T})}},28:function(e,t,n){"use strict";var r=n(0),c=n(4),o=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=n,i=null!=c;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,c)):(t=l||r.Fragment,s&&i&&n!==c?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},c)):Object(r.createElement)(t,a,n))}},280:function(e,t){},3:function(e,t){e.exports=window.wp.components},33:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return r(e)&&t in e}},37:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(6),c=n.n(r),o=n(0),l=n(19);const a=e=>{let{countLabel:t,className:n,depth:r=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==s.count&&null!==s.count,g=[n,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,f=m.name||"search-list-item-"+a,j=`${f}-${s.id}`;return Object(o.createElement)("label",{htmlFor:j,className:g.join(" ")},u?Object(o.createElement)("input",c()({type:"radio",id:j,name:f,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(o.createElement)("input",c()({type:"checkbox",id:j,name:f,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},40:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),c=n(25),o=n.n(c);function l(e){const t=Object(r.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},407:function(e,t,n){e.exports=n(484)},408:function(e,t){},409:function(e,t){},410:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a}));var r=n(33);const c=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(l)},411:function(e,t){},44:function(e,t){e.exports=window.wp.a11y},46:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const c=Object(r.createContext)("page"),o=()=>Object(r.useContext)(c);c.Provider},484:function(e,t,n){"use strict";n.r(t);var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(10),s=n(5),i=n(58),u=n(118),b=n(530),d=n(4),m=n.n(d),p=n(258),g=n(100),O=n(8),f=n(2),j=n(124),w=n(3),h=n(154),_=n(40),y=n(103),k=n(53),v=n(107),E=n(279),S=n(112),C=n(126),x=n(127),N=n(25),T=n.n(N),A=n(15),B=n(314),P=n(16),R=n(128),L=n(86),F=n(33),I=n(410),q=n(547),G=n(241),M=n(562);n(411);var D=e=>{let{className:t,style:n,suggestions:r,multiple:l=!0,saveTransform:a=(e=>e.trim().replace(/\s/g,"-")),messages:s={},validateInput:i=(e=>r.includes(e)),label:u="",...b}=e;return Object(o.createElement)("div",{className:m()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!l}),style:n},Object(o.createElement)(M.a,c()({label:u,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:i,saveTransform:a,maxLength:l?void 0:1,suggestions:r,messages:s},b)))},Q=n(125),V=n(223),$=n(183);const U=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(o.createElement)(S.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(o.createElement)(S.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(o.createElement)(S.a,{name:"Red",count:2}),textLabel:"Red (2)"}],Y={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(409);var W=n(148);function K(){return Math.floor(Math.random()*Date.now())}const J=e=>e.replace("pa_",""),z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:c}=e,o=J(t),l=r.join(","),a=`${G.b}${o}`,s="in"===c?"or":"and";n[`${G.a}${o}`]=l,n[a]=s});const r=Object(P.removeQueryArgs)(e,...Object.keys(n));return Object(P.addQueryArgs)(r,n)},H=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,c]=n;return e[r]===c&&t},!0)},Z=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");var X=n(155),ee=e=>{let{isLoading:t=!1,options:n,checked:r,onChange:c}=e;return t?Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"is-loading"}),Object(o.createElement)("span",{className:"is-loading"})):Object(o.createElement)(X.a,{className:"wc-block-attribute-filter-list",options:n,checked:r,onChange:c,isLoading:t,isDisabled:t})},te=n(102),ne=e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(f.getSettingWithCoercion)("has_filterable_products",!1,R.a),c=Object(f.getSettingWithCoercion)("is_rendering_php_template",!1,R.a),a=Object(f.getSettingWithCoercion)("page_url",window.location.href,L.a),[s,i]=Object(o.useState)(!1),b=t.isPreview&&!t.attributeId?Y:Object(V.a)(t.attributeId),d=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(G.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(b),[b]),[p,g]=Object(o.useState)(d),[j,w]=Object(o.useState)(K()),[N,M]=Object(o.useState)(t.isPreview&&!t.attributeId?U:[]),W=Object(h.a)(t),[X]=Object(k.a)(),[ne,re]=Object(k.b)("attributes",[]),{results:ce,isLoading:oe}=Object(v.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==b?void 0:b.id)||0],shouldSelect:t.attributeId>0}),le="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:ae,isLoading:se}=Object(E.a)({queryAttribute:{taxonomy:(null==b?void 0:b.taxonomy)||"",queryType:t.queryType},queryState:{...X,attributes:le?X.attributes:null}}),ie=Object(o.useCallback)(e=>Object(F.b)(ae,"attribute_counts")&&Array.isArray(ae.attribute_counts)?ae.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[ae]);Object(o.useEffect)(()=>{if(oe||se)return;if(!Array.isArray(ce))return;const e=ce.map(e=>{const n=ie(e.id);if(!(n||p.includes(e.slug)||(r=e.slug,null!=X&&X.attributes&&X.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==b?void 0:b.taxonomy)&&n.includes(r)}))))return null;var r;const c=n?n.count:0;return{formattedValue:Z(e.slug),value:e.slug,name:Object(A.decodeEntities)(e.name),label:Object(o.createElement)(S.a,{name:Object(A.decodeEntities)(e.name),count:t.showCounts?c:null}),textLabel:t.showCounts?`${Object(A.decodeEntities)(e.name)} (${c})`:Object(A.decodeEntities)(e.name)}}).filter(e=>!!e);M(e),w(K())},[null==b?void 0:b.taxonomy,ce,oe,t.showCounts,se,ie,p,X.attributes]);const ue=Object(o.useCallback)(e=>Array.isArray(ce)?ce.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[ce]),be=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==b||!b.taxonomy)return;const t=Object.keys(Object(P.getQueryArgs)(window.location.href)),n=J(b.taxonomy),r=t.reduce((e,t)=>t.includes(G.b+n)||t.includes(G.a+n)?Object(P.removeQueryArgs)(e,t):e,window.location.href),c=z(r,e);Object(G.c)(c)}else{const t=z(a,e),n=Object(P.getQueryArgs)(window.location.href),r=Object(P.getQueryArgs)(t);H(n,r)||Object(G.c)(t)}}),[a,null==b?void 0:b.taxonomy]),de=e=>{const n=Object($.b)(ne,re,b,ue(e),"or"===t.queryType?"in":"and");be(n,0===e.length)},me=Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(g(e),!r&&t.showFilterButton||Object($.b)(ne,re,b,ue(e),"or"===t.queryType?"in":"and"))}),[n,g,ne,re,b,ue,t.queryType,t.showFilterButton]),pe=Object(o.useMemo)(()=>Object(I.a)(ne)?ne.filter(e=>{let{attribute:t}=e;return t===(null==b?void 0:b.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[ne,null==b?void 0:b.taxonomy]),ge=Object(_.a)(pe),Oe=Object(y.a)(ge);Object(o.useEffect)(()=>{!Oe||T()(Oe,ge)||T()(p,ge)||me(ge)},[p,ge,Oe,me]);const fe="single"!==t.selectType,je=Object(o.useCallback)(e=>{const t=p.includes(e);let n;fe?(n=p.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],me(n)},[p,fe,me]);Object(o.useEffect)(()=>{b&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:p,hasSetFilterDefaultsFromUrl:s})?be(ne,!0):be(ne,!1))},[s,be,ne,b,p,t.showFilterButton]),Object(o.useEffect)(()=>{if(!s&&!oe)return d.length>0?(i(!0),void me(d,!0)):void(c||i(!0))},[b,s,oe,me,d,c]);const we=Object(te.a)();if(!r)return we(!1),null;if(!b)return n?Object(o.createElement)(B.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):(we(!1),null);if(0===N.length&&!oe&&n)return Object(o.createElement)(B.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const he="h"+t.headingLevel,_e=!t.isPreview&&oe,ye=!t.isPreview&&se,ke=(_e||ye)&&0===N.length;if(!ke&&0===N.length)return we(!1),null;const ve=Object(o.createElement)(he,{className:"wc-block-attribute-filter__title"},t.heading),Ee=ke?Object(o.createElement)(Q.a,null,ve):ve;return we(!0),Object(o.createElement)(o.Fragment,null,!n&&t.heading&&Ee,Object(o.createElement)("div",{className:m()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(D,{key:j,className:m()(W.className,{"single-selection":!fe,"is-loading":ke}),style:{...W.style,borderStyle:"none"},suggestions:N.filter(e=>!p.includes(e.value)).map(e=>e.formattedValue),disabled:ke,placeholder:Object(l.sprintf)(
17
  /* translators: %s attribute name. */
18
  Object(l.__)("Select %s","woo-gutenberg-products-block"),b.label),onChange:e=>{!fe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=N.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(O.difference)(e,p);if(1===t.length)return je(t[0]);const n=Object(O.difference)(p,e);1===n.length&&je(n[0])},value:p,displayTransform:e=>{const t=N.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:Z,messages:{added:Object(l.sprintf)(
19
  /* translators: %s is the attribute label. */
23
  /* translators: %s is the attribute label. */
24
  Object(l.__)("Remove %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase()),__experimentalInvalid:Object(l.sprintf)(
25
  /* translators: %s is the attribute label. */
26
+ Object(l.__)("Invalid %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase())}}),fe&&Object(o.createElement)(u.a,{icon:q.a,size:30})):Object(o.createElement)(ee,{options:N,checked:p,onChange:je,isLoading:ke,isDisabled:ke})),Object(o.createElement)("div",{className:"wc-block-attribute-filter__actions"},p.length>0&&!ke&&Object(o.createElement)(C.a,{onClick:()=>{g([]),w(K()),s&&de([])},screenReaderLabel:Object(l.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(o.createElement)(x.a,{className:"wc-block-attribute-filter__button",isLoading:ke,disabled:_e||ye||0===p.length,onClick:()=>de(p)})))},re=(n(408),n(123));const ce=Object(f.getSetting)("attributes",[]);var oe=Object(w.withSpokenMessages)(e=>{let{attributes:t,setAttributes:n,debouncedSpeak:r,clientId:c}=e;const{attributeId:a,className:i,displayStyle:d,heading:h,headingLevel:_,isPreview:y,queryType:k,showCounts:v,showFilterButton:E,selectType:S}=t,[C,x]=Object(o.useState)(!a&&!y),N=Object(s.useBlockProps)(),T=e=>{if(!e||!e.length)return;const t=e[0].id;ce.find(e=>e.attribute_id===t.toString())&&a!==t&&n({attributeId:t})},A=e=>{let{isCompact:t}=e;const n={clear:Object(l.__)("Clear selected attribute","woo-gutenberg-products-block"),list:Object(l.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product attribute:","woo-gutenberg-products-block"),selected:e=>Object(l.sprintf)(
27
  /* translators: %d is the number of attributes selected. */
28
+ Object(l._n)("%d attribute selected","%d attributes selected",e,"woo-gutenberg-products-block"),e),updated:Object(l.__)("Product attribute search results updated.","woo-gutenberg-products-block")},r=Object(O.sortBy)(ce.map(e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label})),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:r,selected:r.filter(e=>{let{id:t}=e;return t===a}),onChange:T,messages:n,isSingle:!0,isCompact:t})};return 0===Object.keys(ce).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")},Object(o.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(f.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(o.createElement)(u.a,{icon:p.a})),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))):Object(o.createElement)("div",N,Object(o.createElement)(s.BlockControls,null,Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>x(!C),isActive:C}]})),Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Include product count","woo-gutenberg-products-block"),checked:v,onChange:()=>n({showCounts:!v})}),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Allow selecting multiple options?","woo-gutenberg-products-block"),value:S||"multiple",onChange:e=>n({selectType:e}),className:"wc-block-attribute-filter__multiple-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"multiple",label:Object(l.__)("Multiple","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"single",label:Object(l.__)("Single","woo-gutenberg-products-block")})),"multiple"===S&&Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Filter Conditions","woo-gutenberg-products-block"),help:"and"===k?Object(l.__)("Choose to return filter results for all of the attributes selected.","woo-gutenberg-products-block"):Object(l.__)("Choose to return filter results for any of the attributes selected.","woo-gutenberg-products-block"),value:k,onChange:e=>n({queryType:e}),className:"wc-block-attribute-filter__conditions-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("All","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Any","woo-gutenberg-products-block")})),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:d,onChange:e=>n({displayStyle:e}),className:"wc-block-attribute-filter__display-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(l.__)("Dropdown","woo-gutenberg-products-block")})),Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Show 'Apply filters' button","woo-gutenberg-products-block"),help:E?Object(l.__)("Products will only update when the button is clicked.","woo-gutenberg-products-block"):Object(l.__)("Products will update as soon as attributes are selected.","woo-gutenberg-products-block"),checked:E,onChange:e=>n({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block"),initialOpen:!1},A({isCompact:!0}))),Object(o.createElement)(re.a,{clientId:c,attributes:t,setAttributes:n,filterType:"attribute-filter"}),C?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")},Object(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},A({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{x(!1),r(Object(l.__)("Now displaying a preview of the Filter Products by Attribute block.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:m()(i,"wc-block-attribute-filter")},h&&Object(o.createElement)(j.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:h,onChange:e=>n({heading:e})}),Object(o.createElement)(w.Disabled,null,Object(o.createElement)(ne,{attributes:t,isEditor:!0}))))});const le={heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")}};Object(a.registerBlockType)(W,{icon:{src:Object(o.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},supports:{...W.supports,...Object(i.b)()&&{__experimentalBorder:{radius:!1,color:!0,width:!1}}},attributes:{...W.attributes,...le},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:n}=e;return"woocommerce_layered_nav"===t&&!(null==n||!n.raw)},transform:e=>{var t,n,r,c;let{instance:o}=e;return Object(a.createBlock)("woocommerce/attribute-filter",{attributeId:0,showCounts:!0,queryType:(null==o||null===(t=o.raw)||void 0===t?void 0:t.query_type)||"or",heading:(null==o||null===(n=o.raw)||void 0===n?void 0:n.title)||Object(l.__)("Filter by attribute","woo-gutenberg-products-block"),headingLevel:3,displayStyle:(null==o||null===(r=o.raw)||void 0===r?void 0:r.display_type)||"list",showFilterButton:!1,selectType:(null==o||null===(c=o.raw)||void 0===c?void 0:c.select_type)||"multiple",isPreview:!1})}}]},edit:oe,save(e){let{attributes:t}=e;const{className:n,showCounts:r,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d,selectType:p}=t,g={"data-attribute-id":a,"data-show-counts":r,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(g["data-display-style"]=b),d&&(g["data-show-filter-button"]=d),"single"===p&&(g["data-select-type"]=p),Object(o.createElement)("div",c()({},s.useBlockProps.save({className:m()("is-loading",n)}),g),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},52:function(e,t){e.exports=window.wp.deprecated},53:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return m}));var r=n(9),c=n(7),o=n(0),l=n(25),a=n.n(l),s=n(40),i=n(103),u=n(46);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(c.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,n)=>{const l=Object(u.a)();n=n||l;const a=Object(c.useSelect)(c=>c(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(n,e,t)},[n,e,s])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,c]=b(t),l=Object(s.a)(r),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(m,d)||(c(Object.assign({},l,d)),p.current=!0)},[l,d,m,c]),p.current?[r,c]:[e,c]}},54:function(e,t){e.exports=window.wp.keycodes},58:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return a}));var r=n(10),c=n(21);const o=(e,t)=>{if(c.n>2)return Object(r.registerBlockType)(e,t)},l=()=>c.n>2,a=()=>c.n>1},7:function(e,t){e.exports=window.wp.data},73:function(e,t){e.exports=window.wp.dom},8:function(e,t){e.exports=window.lodash},86:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},9:function(e,t){e.exports=window.wc.wcBlocksData}});
build/cart-blocks/cart-accepted-payment-methods-frontend.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{27:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var s=a(0),n=a(12),c=a.n(n);function o(e){const t=Object(s.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},310:function(e,t){},313:function(e,t,a){"use strict";a.d(t,"b",(function(){return l})),a.d(t,"a",(function(){return r}));var s=a(27),n=a(17),c=a(4),o=a(3);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:a,availablePaymentMethods:i,availableExpressPaymentMethods:l}=Object(c.useSelect)(e=>{const t=e(o.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}}),r=Object.values(i).map(e=>{let{name:t}=e;return t}),d=Object.values(l).map(e=>{let{name:t}=e;return t}),m=Object(n.getPaymentMethods)(),p=Object(n.getExpressPaymentMethods)(),u=Object.keys(m).reduce((e,t)=>(r.includes(t)&&(e[t]=m[t]),e),{}),y=Object.keys(p).reduce((e,t)=>(d.includes(t)&&(e[t]=p[t]),e),{}),h=Object(s.a)(u),b=Object(s.a)(y);return{paymentMethods:e?b:h,isInitialized:e?a:t}},l=()=>i(!1),r=()=>i(!0)},315:function(e,t,a){"use strict";var s=a(11),n=a.n(s),c=a(0),o=a(5),i=a.n(o);const l=e=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+e;var r=e=>{let{id:t,src:a=null,alt:s=""}=e;return a?Object(c.createElement)("img",{className:l(t),src:a,alt:s}):null},d=a(44);const m=[{id:"alipay",alt:"Alipay",src:d.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:d.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:d.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:d.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:d.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:d.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:d.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:d.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:d.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:d.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:d.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:d.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:d.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:d.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:d.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:d.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:d.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:d.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:d.l+"payment-methods/wechat.svg"}];var p=a(28);a(310),t.a=e=>{let{icons:t=[],align:a="center",className:s}=e;const o=(e=>{const t={};return e.forEach(e=>{let a={};"string"==typeof e&&(a={id:e,alt:e,src:null}),"object"==typeof e&&(a={id:e.id||"",alt:e.alt||"",src:e.src||null}),a.id&&Object(p.a)(a.id)&&!t[a.id]&&(t[a.id]=a)}),Object.values(t)})(t);if(0===o.length)return null;const l=i()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===a,"wc-block-components-payment-method-icons--align-right":"right"===a},s);return Object(c.createElement)("div",{className:l},o.map(e=>{const t={...e,...(a=e.id,m.find(e=>e.id===a)||{})};var a;return Object(c.createElement)(r,n()({key:"payment-method-icon-"+e.id},t))}))}},412:function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));const s=e=>Object.values(e).reduce((e,t)=>(null!==t.icons&&(e=e.concat(t.icons)),e),[])},485:function(e,t,a){"use strict";a.r(t);var s=a(0),n=a(315),c=a(313),o=a(412);t.default=e=>{let{className:t}=e;const{paymentMethods:a}=Object(c.b)();return Object(s.createElement)(n.a,{className:t,icons:Object(o.a)(a)})}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{29:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var s=a(0),n=a(13),c=a.n(n);function o(e){const t=Object(s.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},312:function(e,t){},315:function(e,t,a){"use strict";a.d(t,"b",(function(){return l})),a.d(t,"a",(function(){return r}));var s=a(29),n=a(18),c=a(5),o=a(3);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:a,availablePaymentMethods:i,availableExpressPaymentMethods:l}=Object(c.useSelect)(e=>{const t=e(o.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}}),r=Object.values(i).map(e=>{let{name:t}=e;return t}),d=Object.values(l).map(e=>{let{name:t}=e;return t}),m=Object(n.getPaymentMethods)(),p=Object(n.getExpressPaymentMethods)(),u=Object.keys(m).reduce((e,t)=>(r.includes(t)&&(e[t]=m[t]),e),{}),y=Object.keys(p).reduce((e,t)=>(d.includes(t)&&(e[t]=p[t]),e),{}),h=Object(s.a)(u),b=Object(s.a)(y);return{paymentMethods:e?b:h,isInitialized:e?a:t}},l=()=>i(!1),r=()=>i(!0)},317:function(e,t,a){"use strict";var s=a(12),n=a.n(s),c=a(0),o=a(4),i=a.n(o);const l=e=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+e;var r=e=>{let{id:t,src:a=null,alt:s=""}=e;return a?Object(c.createElement)("img",{className:l(t),src:a,alt:s}):null},d=a(46);const m=[{id:"alipay",alt:"Alipay",src:d.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:d.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:d.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:d.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:d.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:d.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:d.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:d.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:d.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:d.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:d.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:d.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:d.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:d.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:d.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:d.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:d.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:d.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:d.l+"payment-methods/wechat.svg"}];var p=a(30);a(312),t.a=e=>{let{icons:t=[],align:a="center",className:s}=e;const o=(e=>{const t={};return e.forEach(e=>{let a={};"string"==typeof e&&(a={id:e,alt:e,src:null}),"object"==typeof e&&(a={id:e.id||"",alt:e.alt||"",src:e.src||null}),a.id&&Object(p.a)(a.id)&&!t[a.id]&&(t[a.id]=a)}),Object.values(t)})(t);if(0===o.length)return null;const l=i()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===a,"wc-block-components-payment-method-icons--align-right":"right"===a},s);return Object(c.createElement)("div",{className:l},o.map(e=>{const t={...e,...(a=e.id,m.find(e=>e.id===a)||{})};var a;return Object(c.createElement)(r,n()({key:"payment-method-icon-"+e.id},t))}))}},414:function(e,t,a){"use strict";a.d(t,"a",(function(){return s}));const s=e=>Object.values(e).reduce((e,t)=>(null!==t.icons&&(e=e.concat(t.icons)),e),[])},488:function(e,t,a){"use strict";a.r(t);var s=a(0),n=a(317),c=a(315),o=a(414);t.default=e=>{let{className:t}=e;const{paymentMethods:a}=Object(c.b)();return Object(s.createElement)(n.a,{className:t,icons:Object(o.a)(a)})}}}]);
build/cart-blocks/cart-cross-sells-frontend.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[18],{449:function(c,e,s){"use strict";s.r(e);var t=s(0),l=s(36);e.default=c=>{let{children:e,className:s=""}=c;const{crossSellsProducts:n,cartIsLoading:a}=Object(l.a)();return a||n.length<1?null:Object(t.createElement)("div",{className:s},e)}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[18],{451:function(c,e,s){"use strict";s.r(e);var t=s(0),l=s(38);e.default=c=>{let{children:e,className:s=""}=c;const{crossSellsProducts:n,cartIsLoading:a}=Object(l.a)();return a||n.length<1?null:Object(t.createElement)("div",{className:s},e)}}}]);
build/cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js CHANGED
@@ -1,3 +1,3 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{156:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var s=r(4);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;const r=Object(s.select)("core/notices").getNotices(e);return r.some(e=>e.type===t)},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const r=Object(s.select)("core/notices").getNotices(),{removeNotice:c}=Object(s.dispatch)("core/notices"),o=r.filter(t=>t.status===e);o.forEach(e=>c(e.id,t))}},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var s=r(0),c=r(12),o=r.n(c);function a(e){const t=Object(s.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},290:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var s=r(0),c=r(4),o=r(3);r(291);const a=e=>{let{errorMessage:t="",propertyName:r="",elementId:a=""}=e;const{validationError:n,validationErrorId:i}=Object(c.useSelect)(e=>{const t=e(o.VALIDATION_STORE_KEY);return{validationError:t.getValidationError(r),validationErrorId:t.getValidationErrorId(a)}});if(!t||"string"!=typeof t){if(null==n||!n.message||null!=n&&n.hidden)return null;t=n.message}return Object(s.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(s.createElement)("p",{id:i},t))};t.b=a},291:function(e,t){},294:function(e,t,r){"use strict";var s=r(11),c=r.n(s),o=r(0),a=r(43),n=r(5),i=r.n(n),u=r(145);r(295),t.a=e=>{let{className:t,showSpinner:r=!1,children:s,variant:n="contained",...l}=e;const d=i()("wc-block-components-button",t,n,{"wc-block-components-button--loading":r});return Object(o.createElement)(a.a,c()({className:d},l),r&&Object(o.createElement)(u.a,null),Object(o.createElement)("span",{className:"wc-block-components-button__text"},s))}},295:function(e,t){},319:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var s=r(0),c=r(4),o=r(3),a=r(21),n=r(36);const i=(e,t)=>{const r=e.find(e=>{let{id:r}=e;return r===t});return r?r.quantity:0},u=e=>{const{addItemToCart:t}=Object(c.useDispatch)(o.CART_STORE_KEY),{cartItems:r,cartIsLoading:u}=Object(n.a)(),{createErrorNotice:l,removeNotice:d}=Object(c.useDispatch)("core/notices"),[b,E]=Object(s.useState)(!1),m=Object(s.useRef)(i(r,e));return Object(s.useEffect)(()=>{const t=i(r,e);t!==m.current&&(m.current=t)},[r,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:u,addToCart:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return E(!0),t(e,r).then(()=>{d("add-to-cart")}).catch(e=>{l(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{E(!1)})}}}},380:function(e,t,r){"use strict";var s=r(0),c=r(5),o=r.n(c),a=r(1),n=r(27);const i=e=>e.is_purchasable||!1;var u=r(4),l=r(3);const d={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},b={status:d.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},E={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:m,SET_IDLE:p,SET_DISABLED:O,SET_PROCESSING:_,SET_BEFORE_PROCESSING:h,SET_AFTER_PROCESSING:j,SET_PROCESSING_RESPONSE:S,SET_HAS_ERROR:g,SET_NO_ERROR:f,SET_QUANTITY:v,SET_REQUEST_PARAMS:R}=E,T=()=>({type:p}),P=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?g:f;return{type:t}},{SET_PRISTINE:I,SET_IDLE:A,SET_DISABLED:N,SET_PROCESSING:y,SET_BEFORE_PROCESSING:C,SET_AFTER_PROCESSING:k,SET_PROCESSING_RESPONSE:w,SET_HAS_ERROR:D,SET_NO_ERROR:F,SET_QUANTITY:q,SET_REQUEST_PARAMS:x}=E,{PRISTINE:B,IDLE:G,DISABLED:L,PROCESSING:Q,BEFORE_PROCESSING:V,AFTER_PROCESSING:M}=d,W=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,{quantity:r,type:s,data:c}=arguments.length>1?arguments[1]:void 0;switch(s){case I:e=b;break;case A:e=t.status!==G?{...t,status:G}:t;break;case N:e=t.status!==L?{...t,status:L}:t;break;case q:e=r!==t.quantity?{...t,quantity:r}:t;break;case x:e={...t,requestParams:{...t.requestParams,...c}};break;case w:e={...t,processingResponse:c};break;case y:e=t.status!==Q?{...t,status:Q,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case C:e=t.status!==V?{...t,status:V,hasError:!1}:t;break;case k:e=t.status!==M?{...t,status:M}:t;break;case D:e=t.hasError?t:{...t,hasError:!0},e=t.status===Q||t.status===V?{...e,status:G}:e;break;case F:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&s!==I&&e.status===B&&(e.status=G),e};var H=r(103),Y=r(229);const K=e=>({onAddToCartAfterProcessingWithSuccess:Object(Y.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Y.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Y.a)("add_to_cart_before_processing",e)});var U=r(232),J=r(42),z=r(156);const X=Object(s.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),Z=()=>Object(s.useContext)(X),$=e=>{var t,r,c,o;let{children:E,product:p,showFormElements:g}=e;const[f,I]=Object(s.useReducer)(W,b),[A,N]=Object(s.useReducer)(H.b,{}),y=Object(n.a)(A),{createErrorNotice:C}=Object(u.useDispatch)("core/notices"),{setValidationErrors:k}=Object(u.useDispatch)(l.VALIDATION_STORE_KEY),w=Object(s.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:K(N).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:K(N).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:K(N).onAddToCartBeforeProcessing}),[N]),D=Object(s.useMemo)(()=>({resetForm:()=>{I({type:m})},submitForm:()=>{I({type:h})},setQuantity:e=>{I((e=>({type:v,quantity:e}))(e))},setHasError:e=>{I(P(e))},setRequestParams:e=>{I((e=>({type:R,data:e}))(e))},setAfterProcessing:e=>{I({type:S,data:e}),I({type:j})}}),[]);Object(s.useEffect)(()=>{const e=f.status,t=!p.id||!i(p);e!==d.DISABLED||t?e!==d.DISABLED&&t&&I({type:O}):I(T())},[f.status,p,I]),Object(s.useEffect)(()=>{f.status===d.BEFORE_PROCESSING&&(Object(z.b)("error","wc/add-to-cart"),Object(U.a)(y,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;t&&C(t,{context:"wc/add-to-cart"}),r&&k(r)}),I(T())):I({type:_})}))},[f.status,k,C,I,y,null==p?void 0:p.id]),Object(s.useEffect)(()=>{if(f.status===d.AFTER_PROCESSING){const e={processingResponse:f.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:r,messageContext:s}=e;(Object(J.b)(e)||Object(J.c)(e))&&r&&(t=!0,C(r,s?{context:s}:void 0))}),t};if(f.hasError)return void Object(U.b)(y,"add_to_cart_after_processing_with_error",e).then(r=>{if(!t(r)){var s;const t=(null===(s=e.processingResponse)||void 0===s?void 0:s.message)||Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block");C(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==p?void 0:p.id)||0)})}I(T())});Object(U.b)(y,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?I(P(!0)):I(T())})}},[f.status,f.hasError,f.processingResponse,D,C,y,null==p?void 0:p.id]);const F=(e=>["simple","variable"].includes(e.type||"simple"))(p),q={product:p,productType:p.type||"simple",productIsPurchasable:i(p),productHasOptions:p.has_options||!1,supportsFormElements:F,showFormElements:g&&F,quantity:f.quantity||(null==p||null===(t=p.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==p||null===(r=p.add_to_cart)||void 0===r?void 0:r.minimum)||1,maxQuantity:(null==p||null===(c=p.add_to_cart)||void 0===c?void 0:c.maximum)||99,multipleOf:(null==p||null===(o=p.add_to_cart)||void 0===o?void 0:o.multiple_of)||1,requestParams:f.requestParams,isIdle:f.status===d.IDLE,isDisabled:f.status===d.DISABLED,isProcessing:f.status===d.PROCESSING,isBeforeProcessing:f.status===d.BEFORE_PROCESSING,isAfterProcessing:f.status===d.AFTER_PROCESSING,hasError:f.hasError,eventRegistration:w,dispatchActions:D};return Object(s.createElement)(X.Provider,{value:q},E)};var ee=r(31),te=r.n(ee),re=r(21),se=r(89),ce=r(36),oe=()=>{const{dispatchActions:e,product:t,quantity:r,eventRegistration:c,hasError:o,isProcessing:n,requestParams:i}=Z(),{showAllValidationErrors:d}=Object(u.useDispatch)(l.VALIDATION_STORE_KEY),b=Object(u.useSelect)(e=>e(l.VALIDATION_STORE_KEY).hasValidationErrors),{createErrorNotice:E,removeNotice:m}=Object(u.useDispatch)("core/notices"),{receiveCart:p}=Object(ce.a)(),[O,_]=Object(s.useState)(!1),h=!o&&n,j=Object(s.useCallback)(()=>!b()||(d(),{type:"error"}),[b,d]);Object(s.useEffect)(()=>{const e=c.onAddToCartBeforeProcessing(j,0);return()=>{e()}},[c,j]);const S=Object(s.useCallback)(()=>{_(!0),m("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const s={id:t.id||0,quantity:r,...i};te()({path:"/wc/store/v1/cart/add-item",method:"POST",data:s,cache:"no-store",parse:!1}).then(r=>{te.a.setNonce(r.headers),r.json().then((function(s){r.ok?p(s):(s.body&&s.body.message?E(Object(re.decodeEntities)(s.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):E(Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(se.c)({preserveCartData:!0}),e.setAfterProcessing(s),_(!1)}))}).catch(t=>{t.json().then((function(t){var r;null!==(r=t.data)&&void 0!==r&&r.cart&&p(t.data.cart),e.setHasError(),e.setAfterProcessing(t),_(!1)}))})},[t,E,m,p,e,r,i]);return Object(s.useEffect)(()=>{h&&!O&&S()},[h,S,O]),null};const ae=e=>{let{children:t,product:r,showFormElements:c}=e;return Object(s.createElement)($,{product:r,showFormElements:c},t,Object(s.createElement)(oe,null))};var ne=r(47),ie=r(6),ue=r(132),le=(r(394),r(294)),de=r(111),be=r(395),Ee=r(66),me=r(319);const pe=e=>{let{className:t,href:r,text:c,onClick:o}=e;return Object(s.createElement)(le.a,{className:t,href:r,onClick:o,rel:"nofollow"},c)},Oe=e=>{let{className:t,quantityInCart:r,isProcessing:c,isDisabled:o,isDone:n,onClick:i}=e;return Object(s.createElement)(le.a,{className:t,disabled:o,showSpinner:c,onClick:i},n&&r>0?Object(a.sprintf)(
2
  /* translators: %s number of products in cart. */
3
- Object(a._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!n&&Object(s.createElement)(de.a,{icon:be.a}))};var _e=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:r,product:c,productType:o,isDisabled:n,isProcessing:i,eventRegistration:u,hasError:l,dispatchActions:d}=Z(),{parentName:b}=Object(ne.useInnerBlockLayoutContext)(),{dispatchStoreEvent:E}=Object(Ee.a)(),{cartQuantity:m}=Object(me.a)(c.id||0),[p,O]=Object(s.useState)(!1),_=c.add_to_cart||{url:"",text:""};return Object(s.useEffect)(()=>{const e=u.onAddToCartAfterProcessingWithSuccess(()=>(l||O(!0),!0),0);return()=>{e()}},[u,l]),(e||!r&&"simple"===o)&&t?Object(s.createElement)(Oe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:n,isProcessing:i,isDone:p,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==c?void 0:c.id)||0)),E("cart-add-item",{product:c,listName:b})}}):Object(s.createElement)(pe,{className:"wc-block-components-product-add-to-cart-button",href:_.url,text:_.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{E("product-view-link",{product:c,listName:b})}})},he=r(50),je=e=>{let{disabled:t,min:r,max:c,step:o=1,value:a,onChange:n}=e;const i=void 0!==c,u=Object(he.a)(e=>{let t=e;i&&(t=Math.min(t,Math.floor(c/o)*o)),t=Math.max(t,Math.ceil(r/o)*o),t=Math.floor(t/o)*o,t!==e&&n(t)},300);return Object(s.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:r,max:c,step:o,hidden:1===c,disabled:t,onChange:e=>{n(e.target.value),u(e.target.value)}})},Se=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},ge=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:c,multipleOf:o,dispatchActions:n,isDisabled:i}=Z();return e.id&&!e.is_purchasable?Object(s.createElement)(Se,null):e.id&&!e.is_in_stock?Object(s.createElement)(Se,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(je,{value:t,min:r,max:c,step:o,disabled:i,onChange:n.setQuantity}),Object(s.createElement)(_e,null))},fe=(r(396),r(465)),ve=r(7),Re=r(290);const Te={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var Pe=e=>{let{attributeName:t,options:r=[],value:c="",onChange:n=(()=>{}),errorMessage:i=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const d=t,{setValidationErrors:b,clearValidationError:E}=Object(u.useDispatch)(l.VALIDATION_STORE_KEY),{error:m}=Object(u.useSelect)(e=>({error:e(l.VALIDATION_STORE_KEY).getValidationError(d)||{}}));return Object(ve.useEffect)(()=>{c?E(d):b({[d]:{message:i,hidden:!0}})},[c,d,i,E,b]),Object(ve.useEffect)(()=>()=>{E(d)},[d,E]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(s.createElement)(fe.a,{label:Object(re.decodeEntities)(t),value:c||"",options:[Te,...r],onChange:n,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":(null==m?void 0:m.message)&&!(null!=m&&m.hidden)})}),Object(s.createElement)(Re.a,{propertyName:d,elementId:d}))},Ie=r(18);const Ae=(e,t,r)=>{const s=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(r).every(e=>""===e))return s;const c=Object.keys(e);return s.filter(e=>c.every(s=>{const c=r[s]||"",o=t["id:"+e].attributes[s];return""===c||null===o||o===c}))};var Ne=e=>{let{attributes:t,variationAttributes:r,setRequestParams:c}=e;const o=Object(n.a)(t),a=Object(n.a)(r),[i,u]=Object(s.useState)(0),[l,d]=Object(s.useState)({}),[b,E]=Object(s.useState)(!1),m=Object(s.useMemo)(()=>((e,t,r)=>{const s={},c=Object.keys(e),o=Object.values(r).filter(Boolean).length>0;return c.forEach(c=>{const a=e[c],n={...r,[c]:null},i=o?Ae(e,t,n):null,u=null!==i?i.map(e=>t["id:"+e].attributes[c]):null;s[c]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:r,slug:s}=e;return null===t||t.includes(null)||t.includes(s)?{value:s,label:Object(re.decodeEntities)(r)}:null}).filter(Boolean)}(a.terms,u)}),s})(o,a,l),[l,o,a]);return Object(s.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Ie.a)(e))return{};const t=Object.keys(e),r={};return 0===t.length||t.forEach(t=>{const s=e[t],c=s.terms.filter(e=>e.default);var o;c.length>0&&(r[s.name]=null===(o=c[0])||void 0===o?void 0:o.slug)}),r}(t);e&&d({...e}),E(!0)}},[l,t,b]),Object(s.useEffect)(()=>{Object.values(l).filter(e=>""!==e).length===Object.keys(o).length?u(((e,t,r)=>Ae(e,t,r)[0]||0)(o,a,l)):i>0&&u(0)},[l,i,o,a]),Object(s.useEffect)(()=>{c({id:i,variation:Object.keys(l).map(e=>({attribute:e,value:l[e]}))})},[c,i,l]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(o).map(e=>Object(s.createElement)(Pe,{key:e,attributeName:e,options:m[e],value:l[e],onChange:t=>{d({...l,[e]:t})}})))},ye=e=>{let{product:t,dispatchers:r}=e;const c=(e=>e?Object(ie.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(t.attributes),o=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:r,attributes:s}=e;t["id:"+r]={id:r,attributes:s.reduce((e,t)=>{let{name:r,value:s}=t;return e[r]=s,e},{})}}),t})(t.variations);return 0===Object.keys(c).length||0===o.length?null:Object(s.createElement)(Ne,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},Ce=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:c,multipleOf:o,dispatchActions:n,isDisabled:i}=Z();return e.id&&!e.is_purchasable?Object(s.createElement)(Se,null):e.id&&!e.is_in_stock?Object(s.createElement)(Se,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(ye,{product:e,dispatchers:n}),Object(s.createElement)(je,{value:t,min:r,max:c,step:o,disabled:i,onChange:n.setQuantity}),Object(s.createElement)(_e,null))},ke=()=>Object(s.createElement)(_e,null),we=r(370),De=()=>Object(s.createElement)(we.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Fe=()=>Object(s.createElement)(De,null);const qe=()=>{const{showFormElements:e,productType:t}=Z();return e?"variable"===t?Object(s.createElement)(Ce,null):"grouped"===t?Object(s.createElement)(Fe,null):"external"===t?Object(s.createElement)(ke,null):"simple"===t||"variation"===t?Object(s.createElement)(ge,null):null:Object(s.createElement)(_e,null)};t.a=Object(ue.withProductDataContext)(e=>{let{className:t,showFormElements:r}=e;const{product:c}=Object(ne.useProductDataContext)(),a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(ie.isEmpty)(c)});return Object(s.createElement)(ae,{product:c,showFormElements:r},Object(s.createElement)("div",{className:a},Object(s.createElement)(qe,null)))})},394:function(e,t){},396:function(e,t){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{158:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var s=r(5);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;const r=Object(s.select)("core/notices").getNotices(e);return r.some(e=>e.type===t)},o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const r=Object(s.select)("core/notices").getNotices(),{removeNotice:c}=Object(s.dispatch)("core/notices"),o=r.filter(t=>t.status===e);o.forEach(e=>c(e.id,t))}},29:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var s=r(0),c=r(13),o=r.n(c);function a(e){const t=Object(s.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},292:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var s=r(0),c=r(5),o=r(3);r(294);const a=e=>{let{errorMessage:t="",propertyName:r="",elementId:a=""}=e;const{validationError:n,validationErrorId:i}=Object(c.useSelect)(e=>{const t=e(o.VALIDATION_STORE_KEY);return{validationError:t.getValidationError(r),validationErrorId:t.getValidationErrorId(a)}});if(!t||"string"!=typeof t){if(null==n||!n.message||null!=n&&n.hidden)return null;t=n.message}return Object(s.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(s.createElement)("p",{id:i},t))};t.b=a},294:function(e,t){},296:function(e,t,r){"use strict";var s=r(12),c=r.n(s),o=r(0),a=r(44),n=r(4),i=r.n(n),u=r(147);r(297),t.a=e=>{let{className:t,showSpinner:r=!1,children:s,variant:n="contained",...l}=e;const d=i()("wc-block-components-button",t,n,{"wc-block-components-button--loading":r});return Object(o.createElement)(a.a,c()({className:d},l),r&&Object(o.createElement)(u.a,null),Object(o.createElement)("span",{className:"wc-block-components-button__text"},s))}},297:function(e,t){},321:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var s=r(0),c=r(5),o=r(3),a=r(23),n=r(38);const i=(e,t)=>{const r=e.find(e=>{let{id:r}=e;return r===t});return r?r.quantity:0},u=e=>{const{addItemToCart:t}=Object(c.useDispatch)(o.CART_STORE_KEY),{cartItems:r,cartIsLoading:u}=Object(n.a)(),{createErrorNotice:l,removeNotice:d}=Object(c.useDispatch)("core/notices"),[b,E]=Object(s.useState)(!1),m=Object(s.useRef)(i(r,e));return Object(s.useEffect)(()=>{const t=i(r,e);t!==m.current&&(m.current=t)},[r,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:u,addToCart:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return E(!0),t(e,r).then(()=>{d("add-to-cart")}).catch(e=>{l(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{E(!1)})}}}},382:function(e,t,r){"use strict";var s=r(0),c=r(4),o=r.n(c),a=r(1),n=r(29);const i=e=>e.is_purchasable||!1;var u=r(5),l=r(3);const d={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},b={status:d.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},E={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:m,SET_IDLE:p,SET_DISABLED:O,SET_PROCESSING:_,SET_BEFORE_PROCESSING:h,SET_AFTER_PROCESSING:j,SET_PROCESSING_RESPONSE:S,SET_HAS_ERROR:g,SET_NO_ERROR:f,SET_QUANTITY:v,SET_REQUEST_PARAMS:R}=E,T=()=>({type:p}),P=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?g:f;return{type:t}},{SET_PRISTINE:I,SET_IDLE:A,SET_DISABLED:N,SET_PROCESSING:y,SET_BEFORE_PROCESSING:C,SET_AFTER_PROCESSING:k,SET_PROCESSING_RESPONSE:w,SET_HAS_ERROR:D,SET_NO_ERROR:F,SET_QUANTITY:q,SET_REQUEST_PARAMS:x}=E,{PRISTINE:B,IDLE:G,DISABLED:L,PROCESSING:Q,BEFORE_PROCESSING:V,AFTER_PROCESSING:M}=d,W=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,{quantity:r,type:s,data:c}=arguments.length>1?arguments[1]:void 0;switch(s){case I:e=b;break;case A:e=t.status!==G?{...t,status:G}:t;break;case N:e=t.status!==L?{...t,status:L}:t;break;case q:e=r!==t.quantity?{...t,quantity:r}:t;break;case x:e={...t,requestParams:{...t.requestParams,...c}};break;case w:e={...t,processingResponse:c};break;case y:e=t.status!==Q?{...t,status:Q,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case C:e=t.status!==V?{...t,status:V,hasError:!1}:t;break;case k:e=t.status!==M?{...t,status:M}:t;break;case D:e=t.hasError?t:{...t,hasError:!0},e=t.status===Q||t.status===V?{...e,status:G}:e;break;case F:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&s!==I&&e.status===B&&(e.status=G),e};var H=r(106),Y=r(233);const K=e=>({onAddToCartAfterProcessingWithSuccess:Object(Y.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Y.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Y.a)("add_to_cart_before_processing",e)});var U=r(236),J=r(43),z=r(158);const X=Object(s.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),Z=()=>Object(s.useContext)(X),$=e=>{var t,r,c,o;let{children:E,product:p,showFormElements:g}=e;const[f,I]=Object(s.useReducer)(W,b),[A,N]=Object(s.useReducer)(H.b,{}),y=Object(n.a)(A),{createErrorNotice:C}=Object(u.useDispatch)("core/notices"),{setValidationErrors:k}=Object(u.useDispatch)(l.VALIDATION_STORE_KEY),w=Object(s.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:K(N).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:K(N).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:K(N).onAddToCartBeforeProcessing}),[N]),D=Object(s.useMemo)(()=>({resetForm:()=>{I({type:m})},submitForm:()=>{I({type:h})},setQuantity:e=>{I((e=>({type:v,quantity:e}))(e))},setHasError:e=>{I(P(e))},setRequestParams:e=>{I((e=>({type:R,data:e}))(e))},setAfterProcessing:e=>{I({type:S,data:e}),I({type:j})}}),[]);Object(s.useEffect)(()=>{const e=f.status,t=!p.id||!i(p);e!==d.DISABLED||t?e!==d.DISABLED&&t&&I({type:O}):I(T())},[f.status,p,I]),Object(s.useEffect)(()=>{f.status===d.BEFORE_PROCESSING&&(Object(z.b)("error","wc/add-to-cart"),Object(U.a)(y,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;t&&C(t,{context:"wc/add-to-cart"}),r&&k(r)}),I(T())):I({type:_})}))},[f.status,k,C,I,y,null==p?void 0:p.id]),Object(s.useEffect)(()=>{if(f.status===d.AFTER_PROCESSING){const e={processingResponse:f.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:r,messageContext:s}=e;(Object(J.b)(e)||Object(J.c)(e))&&r&&(t=!0,C(r,s?{context:s}:void 0))}),t};if(f.hasError)return void Object(U.b)(y,"add_to_cart_after_processing_with_error",e).then(r=>{if(!t(r)){var s;const t=(null===(s=e.processingResponse)||void 0===s?void 0:s.message)||Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block");C(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==p?void 0:p.id)||0)})}I(T())});Object(U.b)(y,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?I(P(!0)):I(T())})}},[f.status,f.hasError,f.processingResponse,D,C,y,null==p?void 0:p.id]);const F=(e=>["simple","variable"].includes(e.type||"simple"))(p),q={product:p,productType:p.type||"simple",productIsPurchasable:i(p),productHasOptions:p.has_options||!1,supportsFormElements:F,showFormElements:g&&F,quantity:f.quantity||(null==p||null===(t=p.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==p||null===(r=p.add_to_cart)||void 0===r?void 0:r.minimum)||1,maxQuantity:(null==p||null===(c=p.add_to_cart)||void 0===c?void 0:c.maximum)||99,multipleOf:(null==p||null===(o=p.add_to_cart)||void 0===o?void 0:o.multiple_of)||1,requestParams:f.requestParams,isIdle:f.status===d.IDLE,isDisabled:f.status===d.DISABLED,isProcessing:f.status===d.PROCESSING,isBeforeProcessing:f.status===d.BEFORE_PROCESSING,isAfterProcessing:f.status===d.AFTER_PROCESSING,hasError:f.hasError,eventRegistration:w,dispatchActions:D};return Object(s.createElement)(X.Provider,{value:q},E)};var ee=r(33),te=r.n(ee),re=r(23),se=r(91),ce=r(38),oe=()=>{const{dispatchActions:e,product:t,quantity:r,eventRegistration:c,hasError:o,isProcessing:n,requestParams:i}=Z(),{showAllValidationErrors:d}=Object(u.useDispatch)(l.VALIDATION_STORE_KEY),b=Object(u.useSelect)(e=>e(l.VALIDATION_STORE_KEY).hasValidationErrors),{createErrorNotice:E,removeNotice:m}=Object(u.useDispatch)("core/notices"),{receiveCart:p}=Object(ce.a)(),[O,_]=Object(s.useState)(!1),h=!o&&n,j=Object(s.useCallback)(()=>!b()||(d(),{type:"error"}),[b,d]);Object(s.useEffect)(()=>{const e=c.onAddToCartBeforeProcessing(j,0);return()=>{e()}},[c,j]);const S=Object(s.useCallback)(()=>{_(!0),m("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const s={id:t.id||0,quantity:r,...i};te()({path:"/wc/store/v1/cart/add-item",method:"POST",data:s,cache:"no-store",parse:!1}).then(r=>{te.a.setNonce(r.headers),r.json().then((function(s){r.ok?p(s):(s.body&&s.body.message?E(Object(re.decodeEntities)(s.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):E(Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(se.c)({preserveCartData:!0}),e.setAfterProcessing(s),_(!1)}))}).catch(t=>{t.json().then((function(t){var r;null!==(r=t.data)&&void 0!==r&&r.cart&&p(t.data.cart),e.setHasError(),e.setAfterProcessing(t),_(!1)}))})},[t,E,m,p,e,r,i]);return Object(s.useEffect)(()=>{h&&!O&&S()},[h,S,O]),null};const ae=e=>{let{children:t,product:r,showFormElements:c}=e;return Object(s.createElement)($,{product:r,showFormElements:c},t,Object(s.createElement)(oe,null))};var ne=r(50),ie=r(7),ue=r(134),le=(r(396),r(296)),de=r(114),be=r(397),Ee=r(70),me=r(321);const pe=e=>{let{className:t,href:r,text:c,onClick:o}=e;return Object(s.createElement)(le.a,{className:t,href:r,onClick:o,rel:"nofollow"},c)},Oe=e=>{let{className:t,quantityInCart:r,isProcessing:c,isDisabled:o,isDone:n,onClick:i}=e;return Object(s.createElement)(le.a,{className:t,disabled:o,showSpinner:c,onClick:i},n&&r>0?Object(a.sprintf)(
2
  /* translators: %s number of products in cart. */
3
+ Object(a._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!n&&Object(s.createElement)(de.a,{icon:be.a}))};var _e=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:r,product:c,productType:o,isDisabled:n,isProcessing:i,eventRegistration:u,hasError:l,dispatchActions:d}=Z(),{parentName:b}=Object(ne.useInnerBlockLayoutContext)(),{dispatchStoreEvent:E}=Object(Ee.a)(),{cartQuantity:m}=Object(me.a)(c.id||0),[p,O]=Object(s.useState)(!1),_=c.add_to_cart||{url:"",text:""};return Object(s.useEffect)(()=>{const e=u.onAddToCartAfterProcessingWithSuccess(()=>(l||O(!0),!0),0);return()=>{e()}},[u,l]),(e||!r&&"simple"===o)&&t?Object(s.createElement)(Oe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:n,isProcessing:i,isDone:p,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==c?void 0:c.id)||0)),E("cart-add-item",{product:c,listName:b})}}):Object(s.createElement)(pe,{className:"wc-block-components-product-add-to-cart-button",href:_.url,text:_.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{E("product-view-link",{product:c,listName:b})}})},he=r(53),je=e=>{let{disabled:t,min:r,max:c,step:o=1,value:a,onChange:n}=e;const i=void 0!==c,u=Object(he.a)(e=>{let t=e;i&&(t=Math.min(t,Math.floor(c/o)*o)),t=Math.max(t,Math.ceil(r/o)*o),t=Math.floor(t/o)*o,t!==e&&n(t)},300);return Object(s.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:r,max:c,step:o,hidden:1===c,disabled:t,onChange:e=>{n(e.target.value),u(e.target.value)}})},Se=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},ge=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:c,multipleOf:o,dispatchActions:n,isDisabled:i}=Z();return e.id&&!e.is_purchasable?Object(s.createElement)(Se,null):e.id&&!e.is_in_stock?Object(s.createElement)(Se,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(je,{value:t,min:r,max:c,step:o,disabled:i,onChange:n.setQuantity}),Object(s.createElement)(_e,null))},fe=(r(398),r(468)),ve=r(8),Re=r(292);const Te={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var Pe=e=>{let{attributeName:t,options:r=[],value:c="",onChange:n=(()=>{}),errorMessage:i=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const d=t,{setValidationErrors:b,clearValidationError:E}=Object(u.useDispatch)(l.VALIDATION_STORE_KEY),{error:m}=Object(u.useSelect)(e=>({error:e(l.VALIDATION_STORE_KEY).getValidationError(d)||{}}));return Object(ve.useEffect)(()=>{c?E(d):b({[d]:{message:i,hidden:!0}})},[c,d,i,E,b]),Object(ve.useEffect)(()=>()=>{E(d)},[d,E]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(s.createElement)(fe.a,{label:Object(re.decodeEntities)(t),value:c||"",options:[Te,...r],onChange:n,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":(null==m?void 0:m.message)&&!(null!=m&&m.hidden)})}),Object(s.createElement)(Re.a,{propertyName:d,elementId:d}))},Ie=r(19);const Ae=(e,t,r)=>{const s=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(r).every(e=>""===e))return s;const c=Object.keys(e);return s.filter(e=>c.every(s=>{const c=r[s]||"",o=t["id:"+e].attributes[s];return""===c||null===o||o===c}))};var Ne=e=>{let{attributes:t,variationAttributes:r,setRequestParams:c}=e;const o=Object(n.a)(t),a=Object(n.a)(r),[i,u]=Object(s.useState)(0),[l,d]=Object(s.useState)({}),[b,E]=Object(s.useState)(!1),m=Object(s.useMemo)(()=>((e,t,r)=>{const s={},c=Object.keys(e),o=Object.values(r).filter(Boolean).length>0;return c.forEach(c=>{const a=e[c],n={...r,[c]:null},i=o?Ae(e,t,n):null,u=null!==i?i.map(e=>t["id:"+e].attributes[c]):null;s[c]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:r,slug:s}=e;return null===t||t.includes(null)||t.includes(s)?{value:s,label:Object(re.decodeEntities)(r)}:null}).filter(Boolean)}(a.terms,u)}),s})(o,a,l),[l,o,a]);return Object(s.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Ie.a)(e))return{};const t=Object.keys(e),r={};return 0===t.length||t.forEach(t=>{const s=e[t],c=s.terms.filter(e=>e.default);var o;c.length>0&&(r[s.name]=null===(o=c[0])||void 0===o?void 0:o.slug)}),r}(t);e&&d({...e}),E(!0)}},[l,t,b]),Object(s.useEffect)(()=>{Object.values(l).filter(e=>""!==e).length===Object.keys(o).length?u(((e,t,r)=>Ae(e,t,r)[0]||0)(o,a,l)):i>0&&u(0)},[l,i,o,a]),Object(s.useEffect)(()=>{c({id:i,variation:Object.keys(l).map(e=>({attribute:e,value:l[e]}))})},[c,i,l]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(o).map(e=>Object(s.createElement)(Pe,{key:e,attributeName:e,options:m[e],value:l[e],onChange:t=>{d({...l,[e]:t})}})))},ye=e=>{let{product:t,dispatchers:r}=e;const c=(e=>e?Object(ie.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(t.attributes),o=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:r,attributes:s}=e;t["id:"+r]={id:r,attributes:s.reduce((e,t)=>{let{name:r,value:s}=t;return e[r]=s,e},{})}}),t})(t.variations);return 0===Object.keys(c).length||0===o.length?null:Object(s.createElement)(Ne,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},Ce=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:c,multipleOf:o,dispatchActions:n,isDisabled:i}=Z();return e.id&&!e.is_purchasable?Object(s.createElement)(Se,null):e.id&&!e.is_in_stock?Object(s.createElement)(Se,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(ye,{product:e,dispatchers:n}),Object(s.createElement)(je,{value:t,min:r,max:c,step:o,disabled:i,onChange:n.setQuantity}),Object(s.createElement)(_e,null))},ke=()=>Object(s.createElement)(_e,null),we=r(372),De=()=>Object(s.createElement)(we.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Fe=()=>Object(s.createElement)(De,null);const qe=()=>{const{showFormElements:e,productType:t}=Z();return e?"variable"===t?Object(s.createElement)(Ce,null):"grouped"===t?Object(s.createElement)(Fe,null):"external"===t?Object(s.createElement)(ke,null):"simple"===t||"variation"===t?Object(s.createElement)(ge,null):null:Object(s.createElement)(_e,null)};t.a=Object(ue.withProductDataContext)(e=>{let{className:t,showFormElements:r}=e;const{product:c}=Object(ne.useProductDataContext)(),a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(ie.isEmpty)(c)});return Object(s.createElement)(ae,{product:c,showFormElements:r},Object(s.createElement)("div",{className:a},Object(s.createElement)(qe,null)))})},396:function(e,t){},398:function(e,t){}}]);
build/cart-blocks/cart-cross-sells-products-frontend.js CHANGED
@@ -1,11 +1,11 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[19],{111:function(e,t,c){"use strict";var r=c(0);t.a=function(e){let{icon:t,size:c=24,...n}=e;return Object(r.cloneElement)(t,{width:c,height:c,...n})}},114:function(e,t,c){"use strict";var r=c(11),n=c.n(r),a=c(0),l=c(147),s=c(5),o=c.n(s);c(213);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const m="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(m))return null;const b=m/10**r.minorUnit;if(!Number.isFinite(b))return null;const p=o()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),O={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},j=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(a.createElement)(l.a,n()({className:p,displayType:u},O,{value:b,onValueChange:j}))}},133:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(28),n=c(18);const a=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(n.a)(e)?e:{}},213:function(e,t){},215:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c(100);var r=c(44);const n=()=>r.m>1},22:function(e,t,c){"use strict";var r=c(0),n=c(5),a=c.n(n);t.a=e=>{let t,{label:c,screenReaderLabel:n,wrapperElement:l,wrapperProps:s={}}=e;const o=null!=c,i=null!=n;return!o&&i?(t=l||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,n)):(t=l||r.Fragment,o&&i&&c!==n?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},n)):Object(r.createElement)(t,s,c))}},274:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(18),n=c(133);const a=e=>{const t=Object(r.a)(e)?e:{},c=Object(n.a)(t.style),a=Object(r.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:a.fontSize,lineHeight:a.lineHeight,fontWeight:a.fontWeight,textTransform:a.textTransform,fontFamily:t.fontFamily}}}},276:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(108),n=c(215),a=c(18),l=c(133);const s=e=>{if(!Object(n.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=Object(l.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},292:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(108),n=c(215),a=c(18),l=c(133);const s=e=>{if(!Object(n.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=Object(l.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})}},305:function(e,t,c){"use strict";var r=c(0),n=c(1),a=c(114),l=c(5),s=c.n(l),o=c(39);c(306);const i=e=>{let{currency:t,maxPrice:c,minPrice:l,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(n.sprintf)(
2
  /* translators: %1$s min price, %2$s max price */
3
- Object(n.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(o.formatPrice)(l),Object(o.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(a.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:l,style:u})," — ",Object(r.createElement)(a.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:l,regularPrice:o,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(n.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(a.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:l},e),value:o}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(n.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(a.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:n,format:l="<price/>",maxPrice:o,minPrice:d,price:m,priceClassName:b,priceStyle:p,regularPrice:O,regularPriceClassName:j,regularPriceStyle:g}=e;const y=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=O&&m!==O;let f=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",b)});return _?f=Object(r.createElement)(u,{currency:n,price:m,priceClassName:b,priceStyle:p,regularPrice:O,regularPriceClassName:j,regularPriceStyle:g}):void 0!==d&&void 0!==o?f=Object(r.createElement)(i,{currency:n,maxPrice:o,minPrice:d,priceClassName:b,priceStyle:p}):m&&(f=Object(r.createElement)(a.a,{className:s()("wc-block-components-product-price__value",b),currency:n,value:m,style:p})),Object(r.createElement)("span",{className:y},Object(r.createInterpolateElement)(l,{price:f}))}},306:function(e,t){},307:function(e,t,c){"use strict";var r=c(11),n=c.n(r),a=c(0),l=c(21),s=c(5),o=c.n(s);c(308),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:m,...b}=e;const p=o()("wc-block-components-product-name",t);if(c){const e=b;return Object(a.createElement)("span",n()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(r)}}))}return Object(a.createElement)("a",n()({className:p,href:s,target:i},b,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(r)},style:d}))}},308:function(e,t){},317:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return p}));var r=c(0),n=c(1),a=c(5),l=c.n(a),s=c(22),o=c(47),i=c(276),u=c(292),d=c(274),m=c(324),b=c(132);c(318);const p=e=>{const{className:t,align:c}=e,{parentClassName:a}=Object(o.useInnerBlockLayoutContext)(),{product:b}=Object(o.useProductDataContext)(),p=Object(i.a)(e),O=Object(u.a)(e),j=Object(d.a)(e),g=Object(m.a)(e);if(!b.id||!b.on_sale)return null;const y="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:l()("wc-block-components-product-sale-badge",t,y,{[a+"__product-onsale"]:a},O.className,p.className),style:{...O.style,...p.style,...j.style,...g.style}},Object(r.createElement)(s.a,{label:Object(n.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(n.__)("Product on sale","woo-gutenberg-products-block")}))};t.default=Object(b.withProductDataContext)(p)},318:function(e,t){},324:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(108),n=c(215),a=c(18),l=c(133);const s=e=>{if(!Object(n.a)()||"function"!=typeof r.__experimentalGetSpacingClassesAndStyles)return{style:{}};const t=Object(a.a)(e)?e:{},c=Object(l.a)(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})}},336:function(e,t,c){"use strict";c.d(t,"a",(function(){return g}));var r=c(11),n=c.n(r),a=c(0),l=c(1),s=c(5),o=c.n(s),i=c(2),u=c(47),d=c(274),m=c(276),b=c(324),p=c(132),O=c(66),j=c(317);c(337);const g=e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:n,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:p,isLoading:g}=Object(u.useProductDataContext)(),{dispatchStoreEvent:f}=Object(O.a)(),k=Object(d.a)(e),N=Object(m.a)(e),E=Object(b.a)(e);if(!p.id)return Object(a.createElement)("div",{className:o()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},N.className),style:{...k.style,...N.style,...E.style}},Object(a.createElement)(y,null));const w=!!p.images.length,v=w?p.images[0]:null,h=r?"a":a.Fragment,S=Object(l.sprintf)(
4
  /* translators: %s is referring to the product name */
5
- Object(l.__)("Link to %s","woo-gutenberg-products-block"),p.name),C={href:p.permalink,...!w&&{"aria-label":S},onClick:()=>{f("product-view-link",{product:p})}};return Object(a.createElement)("div",{className:o()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},N.className),style:{...k.style,...N.style,...E.style}},Object(a.createElement)(h,r&&C,!!n&&Object(a.createElement)(j.default,{align:s,product:p}),Object(a.createElement)(_,{fallbackAlt:p.name,image:v,loaded:!g,showFullSize:"cropped"!==c})))},y=()=>Object(a.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),_=e=>{let{image:t,loaded:c,showFullSize:r,fallbackAlt:l}=e;const{thumbnail:s,src:o,srcset:i,sizes:u,alt:d}=t||{},m={alt:d||l,hidden:!c,src:s,...r&&{src:o,srcSet:i,sizes:u}};return Object(a.createElement)(a.Fragment,null,m.src&&Object(a.createElement)("img",n()({"data-testid":"product-image"},m)),!t&&Object(a.createElement)(y,null))};t.b=Object(p.withProductDataContext)(g)},337:function(e,t){},338:function(e,t,c){"use strict";c.d(t,"a",(function(){return O}));var r=c(0),n=c(5),a=c.n(n),l=c(47),s=c(215),o=c(132),i=c(307),u=c(66),d=c(292),m=c(324),b=c(274);c(339);const p=e=>{let{children:t,headingLevel:c,elementType:n="h"+c,...a}=e;return Object(r.createElement)(n,a,t)},O=e=>{const{className:t,headingLevel:c=2,showProductLink:n=!0,linkTarget:o,align:O}=e,{parentClassName:j}=Object(l.useInnerBlockLayoutContext)(),{product:g}=Object(l.useProductDataContext)(),{dispatchStoreEvent:y}=Object(u.a)(),_=Object(d.a)(e),f=Object(m.a)(e),k=Object(b.a)(e);return g.id?Object(r.createElement)(p,{headingLevel:c,className:a()(t,_.className,"wc-block-components-product-title",{[j+"__product-title"]:j,["wc-block-components-product-title--align-"+O]:O&&Object(s.a)()}),style:Object(s.a)()?{...f.style,...k.style,..._.style}:{}},Object(r.createElement)(i.a,{disabled:!n,name:g.name,permalink:g.permalink,target:o,onClick:()=>{y("product-view-link",{product:g})}})):Object(r.createElement)(p,{headingLevel:c,className:a()(t,_.className,"wc-block-components-product-title",{[j+"__product-title"]:j,["wc-block-components-product-title--align-"+O]:O&&Object(s.a)()}),style:Object(s.a)()?{...f.style,...k.style,..._.style}:{}})};t.b=Object(o.withProductDataContext)(O)},339:function(e,t){},340:function(e,t){},341:function(e,t){},359:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return m}));var r=c(0),n=c(5),a=c.n(n),l=c(305),s=c(39),o=c(47),i=c(292),u=c(274),d=c(132);const m=e=>{var t,c;const{className:n,textAlign:d}=e,{parentClassName:m}=Object(o.useInnerBlockLayoutContext)(),{product:b}=Object(o.useProductDataContext)(),p=Object(i.a)(e),O=Object(u.a)(e),j=a()("wc-block-components-product-price",n,p.className,{[m+"__product-price"]:m}),g={...O.style,...p.style};if(!b.id)return Object(r.createElement)(l.a,{align:d,className:j});const y=b.prices,_=Object(s.getCurrencyFromPriceResponse)(y),f=y.price!==y.regular_price,k=a()({[m+"__product-price__value"]:m,[m+"__product-price__value--on-sale"]:f});return Object(r.createElement)(l.a,{align:d,className:j,priceStyle:g,regularPriceStyle:g,priceClassName:k,currency:_,price:y.price,minPrice:null==y||null===(t=y.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==y||null===(c=y.price_range)||void 0===c?void 0:c.max_amount,regularPrice:y.regular_price,regularPriceClassName:a()({[m+"__product-price__regular"]:m})})};t.default=Object(d.withProductDataContext)(m)},360:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return m}));var r=c(0),n=c(1),a=c(5),l=c.n(a),s=c(47),o=c(292),i=c(274),u=c(324),d=c(132);c(340);const m=e=>{const{parentClassName:t}=Object(s.useInnerBlockLayoutContext)(),{product:c}=Object(s.useProductDataContext)(),a=b(c),d=Object(o.a)(e),m=Object(i.a)(e),O=Object(u.a)(e);if(!a)return null;const j={width:a/5*100+"%"},g=Object(n.sprintf)(
6
  /* translators: %f is referring to the average rating value */
7
  Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),a),y=p(c),_={__html:Object(n.sprintf)(
8
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
9
- Object(n._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",y,"woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',a),Object(n.sprintf)('<span class="rating">%d</span>',y))};return Object(r.createElement)("div",{className:l()(d.className,"wc-block-components-product-rating",{[t+"__product-rating"]:t}),style:{...d.style,...m.style,...O.style}},Object(r.createElement)("div",{className:l()("wc-block-components-product-rating__stars",t+"__product-rating__stars"),role:"img","aria-label":g},Object(r.createElement)("span",{style:j,dangerouslySetInnerHTML:_})))},b=e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0},p=e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0};t.default=Object(d.withProductDataContext)(m)},361:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return f}));var r=c(11),n=c.n(r),a=c(0),l=c(5),s=c.n(l),o=c(1),i=c(66),u=c(319),d=c(292),m=c(276),b=c(274),p=c(324),O=c(21),j=c(44),g=c(2),y=c(47),_=c(132);c(341);const f=e=>{const{className:t}=e,{parentClassName:c}=Object(y.useInnerBlockLayoutContext)(),{product:r}=Object(y.useProductDataContext)(),n=Object(d.a)(e),l=Object(m.a)(e),o=Object(b.a)(e),i=Object(p.a)(e);return Object(a.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(a.createElement)(k,{product:r,colorStyles:n,borderStyles:l,typographyStyles:o,spacingStyles:i}):Object(a.createElement)(N,{colorStyles:n,borderStyles:l,typographyStyles:o,spacingStyles:i}))},k=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:l,spacingStyles:d}=e;const{id:m,permalink:b,add_to_cart:p,has_options:y,is_purchasable:_,is_in_stock:f}=t,{dispatchStoreEvent:k}=Object(i.a)(),{cartQuantity:N,addingToCart:E,addToCart:w}=Object(u.a)(m,"woocommerce/single-product/"+(m||0)),v=Number.isFinite(N)&&N>0,h=!y&&_&&f,S=Object(O.decodeEntities)((null==p?void 0:p.description)||""),C=v?Object(o.sprintf)(
10
  /* translators: %s number of products in cart. */
11
- Object(o._n)("%d in cart","%d in cart",N,"woo-gutenberg-products-block"),N):Object(O.decodeEntities)((null==p?void 0:p.text)||Object(o.__)("Add to cart","woo-gutenberg-products-block")),P=h?"button":"a",x={};return h?x.onClick=async()=>{await w(),k("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(g.getSetting)("productsSettings");e&&(window.location.href=j.c)}:(x.href=b,x.rel="nofollow",x.onClick=()=>{k("product-view-link",{product:t})}),Object(a.createElement)(P,n()({"aria-label":S,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:E,added:v}),style:{...c.style,...r.style,...l.style,...d.style},disabled:E},x),C)},N=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:n}=e;return Object(a.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...n.style},disabled:!0})};t.default=Object(_.withProductDataContext)(f)},470:function(e,t,c){"use strict";c.r(t);var r=c(0),n=c(36),a=c(47),l=c(336),s=c(338),o=c(360),i=c(317),u=c(359),d=c(361),m=c(380),b=e=>{let{product:t}=e;return Object(r.createElement)("div",{className:"cross-sells-product"},Object(r.createElement)(a.InnerBlockLayoutContextProvider,{parentName:"woocommerce/cart-cross-sells-block",parentClassName:"wp-block-cart-cross-sells-product"},Object(r.createElement)(a.ProductDataContextProvider,{isLoading:!1,product:t},Object(r.createElement)("div",null,Object(r.createElement)(l.a,{className:"",showSaleBadge:!1}),Object(r.createElement)(s.a,{align:"",headingLevel:2,showProductLink:!0}),Object(r.createElement)(o.Block,null),Object(r.createElement)(i.Block,null),Object(r.createElement)(u.Block,null)),t.is_in_stock?Object(r.createElement)(m.a,null):Object(r.createElement)(d.Block,null))))},p=e=>{let{products:t,columns:c}=e;const n=t.map((e,t)=>t>=c?null:Object(r.createElement)(b,{isLoading:!1,product:e,key:e.id}));return Object(r.createElement)("div",null,n)},O=c(162);t.default=e=>{let{className:t,columns:c}=e;const{crossSellsProducts:a}=Object(n.a)();return void 0===c&&(c=O.attributes.columns.default),Object(r.createElement)(p,{className:t,columns:c,products:a})}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[19],{114:function(e,t,c){"use strict";var r=c(0);t.a=function(e){let{icon:t,size:c=24,...n}=e;return Object(r.cloneElement)(t,{width:c,height:c,...n})}},117:function(e,t,c){"use strict";var r=c(12),n=c.n(r),a=c(0),l=c(149),s=c(4),o=c.n(s);c(215);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const m="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(m))return null;const b=m/10**r.minorUnit;if(!Number.isFinite(b))return null;const p=o()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),O={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},j=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(a.createElement)(l.a,n()({className:p,displayType:u},O,{value:b,onValueChange:j}))}},135:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(30),n=c(19);const a=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(n.a)(e)?e:{}},20:function(e,t,c){"use strict";var r=c(0),n=c(4),a=c.n(n);t.a=e=>{let t,{label:c,screenReaderLabel:n,wrapperElement:l,wrapperProps:s={}}=e;const o=null!=c,i=null!=n;return!o&&i?(t=l||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,n)):(t=l||r.Fragment,o&&i&&c!==n?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},n)):Object(r.createElement)(t,s,c))}},215:function(e,t){},217:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c(100);var r=c(46);const n=()=>r.m>1},276:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(19),n=c(135);const a=e=>{const t=Object(r.a)(e)?e:{},c=Object(n.a)(t.style),a=Object(r.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:a.fontSize,lineHeight:a.lineHeight,fontWeight:a.fontWeight,textTransform:a.textTransform,fontFamily:t.fontFamily}}}},278:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(111),n=c(217),a=c(19),l=c(135);const s=e=>{if(!Object(n.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=Object(l.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},293:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(111),n=c(217),a=c(19),l=c(135);const s=e=>{if(!Object(n.a)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=Object(l.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})}},307:function(e,t,c){"use strict";var r=c(0),n=c(1),a=c(117),l=c(4),s=c.n(l),o=c(40);c(308);const i=e=>{let{currency:t,maxPrice:c,minPrice:l,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(n.sprintf)(
2
  /* translators: %1$s min price, %2$s max price */
3
+ Object(n.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(o.formatPrice)(l),Object(o.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(a.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:l,style:u})," — ",Object(r.createElement)(a.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:l,regularPrice:o,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(n.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(a.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:l},e),value:o}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(n.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(a.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:n,format:l="<price/>",maxPrice:o,minPrice:d,price:m,priceClassName:b,priceStyle:p,regularPrice:O,regularPriceClassName:j,regularPriceStyle:g}=e;const y=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=O&&m!==O;let f=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",b)});return _?f=Object(r.createElement)(u,{currency:n,price:m,priceClassName:b,priceStyle:p,regularPrice:O,regularPriceClassName:j,regularPriceStyle:g}):void 0!==d&&void 0!==o?f=Object(r.createElement)(i,{currency:n,maxPrice:o,minPrice:d,priceClassName:b,priceStyle:p}):m&&(f=Object(r.createElement)(a.a,{className:s()("wc-block-components-product-price__value",b),currency:n,value:m,style:p})),Object(r.createElement)("span",{className:y},Object(r.createInterpolateElement)(l,{price:f}))}},308:function(e,t){},309:function(e,t,c){"use strict";var r=c(12),n=c.n(r),a=c(0),l=c(23),s=c(4),o=c.n(s);c(310),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:m,...b}=e;const p=o()("wc-block-components-product-name",t);if(c){const e=b;return Object(a.createElement)("span",n()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(r)}}))}return Object(a.createElement)("a",n()({className:p,href:s,target:i},b,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(r)},style:d}))}},310:function(e,t){},319:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return p}));var r=c(0),n=c(1),a=c(4),l=c.n(a),s=c(20),o=c(50),i=c(278),u=c(293),d=c(276),m=c(326),b=c(134);c(320);const p=e=>{const{className:t,align:c}=e,{parentClassName:a}=Object(o.useInnerBlockLayoutContext)(),{product:b}=Object(o.useProductDataContext)(),p=Object(i.a)(e),O=Object(u.a)(e),j=Object(d.a)(e),g=Object(m.a)(e);if(!b.id||!b.on_sale)return null;const y="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:l()("wc-block-components-product-sale-badge",t,y,{[a+"__product-onsale"]:a},O.className,p.className),style:{...O.style,...p.style,...j.style,...g.style}},Object(r.createElement)(s.a,{label:Object(n.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(n.__)("Product on sale","woo-gutenberg-products-block")}))};t.default=Object(b.withProductDataContext)(p)},320:function(e,t){},326:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(111),n=c(217),a=c(19),l=c(135);const s=e=>{if(!Object(n.a)()||"function"!=typeof r.__experimentalGetSpacingClassesAndStyles)return{style:{}};const t=Object(a.a)(e)?e:{},c=Object(l.a)(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})}},338:function(e,t,c){"use strict";c.d(t,"a",(function(){return g}));var r=c(12),n=c.n(r),a=c(0),l=c(1),s=c(4),o=c.n(s),i=c(2),u=c(50),d=c(276),m=c(278),b=c(326),p=c(134),O=c(70),j=c(319);c(339);const g=e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:n,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:p,isLoading:g}=Object(u.useProductDataContext)(),{dispatchStoreEvent:f}=Object(O.a)(),k=Object(d.a)(e),N=Object(m.a)(e),E=Object(b.a)(e);if(!p.id)return Object(a.createElement)("div",{className:o()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},N.className),style:{...k.style,...N.style,...E.style}},Object(a.createElement)(y,null));const w=!!p.images.length,v=w?p.images[0]:null,h=r?"a":a.Fragment,S=Object(l.sprintf)(
4
  /* translators: %s is referring to the product name */
5
+ Object(l.__)("Link to %s","woo-gutenberg-products-block"),p.name),C={href:p.permalink,...!w&&{"aria-label":S},onClick:()=>{f("product-view-link",{product:p})}};return Object(a.createElement)("div",{className:o()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},N.className),style:{...k.style,...N.style,...E.style}},Object(a.createElement)(h,r&&C,!!n&&Object(a.createElement)(j.default,{align:s,product:p}),Object(a.createElement)(_,{fallbackAlt:p.name,image:v,loaded:!g,showFullSize:"cropped"!==c})))},y=()=>Object(a.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),_=e=>{let{image:t,loaded:c,showFullSize:r,fallbackAlt:l}=e;const{thumbnail:s,src:o,srcset:i,sizes:u,alt:d}=t||{},m={alt:d||l,hidden:!c,src:s,...r&&{src:o,srcSet:i,sizes:u}};return Object(a.createElement)(a.Fragment,null,m.src&&Object(a.createElement)("img",n()({"data-testid":"product-image"},m)),!t&&Object(a.createElement)(y,null))};t.b=Object(p.withProductDataContext)(g)},339:function(e,t){},340:function(e,t,c){"use strict";c.d(t,"a",(function(){return O}));var r=c(0),n=c(4),a=c.n(n),l=c(50),s=c(217),o=c(134),i=c(309),u=c(70),d=c(293),m=c(326),b=c(276);c(341);const p=e=>{let{children:t,headingLevel:c,elementType:n="h"+c,...a}=e;return Object(r.createElement)(n,a,t)},O=e=>{const{className:t,headingLevel:c=2,showProductLink:n=!0,linkTarget:o,align:O}=e,{parentClassName:j}=Object(l.useInnerBlockLayoutContext)(),{product:g}=Object(l.useProductDataContext)(),{dispatchStoreEvent:y}=Object(u.a)(),_=Object(d.a)(e),f=Object(m.a)(e),k=Object(b.a)(e);return g.id?Object(r.createElement)(p,{headingLevel:c,className:a()(t,_.className,"wc-block-components-product-title",{[j+"__product-title"]:j,["wc-block-components-product-title--align-"+O]:O&&Object(s.a)()}),style:Object(s.a)()?{...f.style,...k.style,..._.style}:{}},Object(r.createElement)(i.a,{disabled:!n,name:g.name,permalink:g.permalink,target:o,onClick:()=>{y("product-view-link",{product:g})}})):Object(r.createElement)(p,{headingLevel:c,className:a()(t,_.className,"wc-block-components-product-title",{[j+"__product-title"]:j,["wc-block-components-product-title--align-"+O]:O&&Object(s.a)()}),style:Object(s.a)()?{...f.style,...k.style,..._.style}:{}})};t.b=Object(o.withProductDataContext)(O)},341:function(e,t){},342:function(e,t){},343:function(e,t){},361:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return m}));var r=c(0),n=c(4),a=c.n(n),l=c(307),s=c(40),o=c(50),i=c(293),u=c(276),d=c(134);const m=e=>{var t,c;const{className:n,textAlign:d}=e,{parentClassName:m}=Object(o.useInnerBlockLayoutContext)(),{product:b}=Object(o.useProductDataContext)(),p=Object(i.a)(e),O=Object(u.a)(e),j=a()("wc-block-components-product-price",n,p.className,{[m+"__product-price"]:m}),g={...O.style,...p.style};if(!b.id)return Object(r.createElement)(l.a,{align:d,className:j});const y=b.prices,_=Object(s.getCurrencyFromPriceResponse)(y),f=y.price!==y.regular_price,k=a()({[m+"__product-price__value"]:m,[m+"__product-price__value--on-sale"]:f});return Object(r.createElement)(l.a,{align:d,className:j,priceStyle:g,regularPriceStyle:g,priceClassName:k,currency:_,price:y.price,minPrice:null==y||null===(t=y.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==y||null===(c=y.price_range)||void 0===c?void 0:c.max_amount,regularPrice:y.regular_price,regularPriceClassName:a()({[m+"__product-price__regular"]:m})})};t.default=Object(d.withProductDataContext)(m)},362:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return m}));var r=c(0),n=c(1),a=c(4),l=c.n(a),s=c(50),o=c(293),i=c(276),u=c(326),d=c(134);c(342);const m=e=>{const{parentClassName:t}=Object(s.useInnerBlockLayoutContext)(),{product:c}=Object(s.useProductDataContext)(),a=b(c),d=Object(o.a)(e),m=Object(i.a)(e),O=Object(u.a)(e);if(!a)return null;const j={width:a/5*100+"%"},g=Object(n.sprintf)(
6
  /* translators: %f is referring to the average rating value */
7
  Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),a),y=p(c),_={__html:Object(n.sprintf)(
8
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
9
+ Object(n._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",y,"woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',a),Object(n.sprintf)('<span class="rating">%d</span>',y))};return Object(r.createElement)("div",{className:l()(d.className,"wc-block-components-product-rating",{[t+"__product-rating"]:t}),style:{...d.style,...m.style,...O.style}},Object(r.createElement)("div",{className:l()("wc-block-components-product-rating__stars",t+"__product-rating__stars"),role:"img","aria-label":g},Object(r.createElement)("span",{style:j,dangerouslySetInnerHTML:_})))},b=e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0},p=e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0};t.default=Object(d.withProductDataContext)(m)},363:function(e,t,c){"use strict";c.r(t),c.d(t,"Block",(function(){return f}));var r=c(12),n=c.n(r),a=c(0),l=c(4),s=c.n(l),o=c(1),i=c(70),u=c(321),d=c(293),m=c(278),b=c(276),p=c(326),O=c(23),j=c(46),g=c(2),y=c(50),_=c(134);c(343);const f=e=>{const{className:t}=e,{parentClassName:c}=Object(y.useInnerBlockLayoutContext)(),{product:r}=Object(y.useProductDataContext)(),n=Object(d.a)(e),l=Object(m.a)(e),o=Object(b.a)(e),i=Object(p.a)(e);return Object(a.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(a.createElement)(k,{product:r,colorStyles:n,borderStyles:l,typographyStyles:o,spacingStyles:i}):Object(a.createElement)(N,{colorStyles:n,borderStyles:l,typographyStyles:o,spacingStyles:i}))},k=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:l,spacingStyles:d}=e;const{id:m,permalink:b,add_to_cart:p,has_options:y,is_purchasable:_,is_in_stock:f}=t,{dispatchStoreEvent:k}=Object(i.a)(),{cartQuantity:N,addingToCart:E,addToCart:w}=Object(u.a)(m,"woocommerce/single-product/"+(m||0)),v=Number.isFinite(N)&&N>0,h=!y&&_&&f,S=Object(O.decodeEntities)((null==p?void 0:p.description)||""),C=v?Object(o.sprintf)(
10
  /* translators: %s number of products in cart. */
11
+ Object(o._n)("%d in cart","%d in cart",N,"woo-gutenberg-products-block"),N):Object(O.decodeEntities)((null==p?void 0:p.text)||Object(o.__)("Add to cart","woo-gutenberg-products-block")),P=h?"button":"a",x={};return h?x.onClick=async()=>{await w(),k("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(g.getSetting)("productsSettings");e&&(window.location.href=j.c)}:(x.href=b,x.rel="nofollow",x.onClick=()=>{k("product-view-link",{product:t})}),Object(a.createElement)(P,n()({"aria-label":S,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:E,added:v}),style:{...c.style,...r.style,...l.style,...d.style},disabled:E},x),C)},N=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:n}=e;return Object(a.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...n.style},disabled:!0})};t.default=Object(_.withProductDataContext)(f)},473:function(e,t,c){"use strict";c.r(t);var r=c(0),n=c(38),a=c(50),l=c(338),s=c(340),o=c(362),i=c(319),u=c(361),d=c(363),m=c(382),b=e=>{let{product:t}=e;return Object(r.createElement)("div",{className:"cross-sells-product"},Object(r.createElement)(a.InnerBlockLayoutContextProvider,{parentName:"woocommerce/cart-cross-sells-block",parentClassName:"wp-block-cart-cross-sells-product"},Object(r.createElement)(a.ProductDataContextProvider,{isLoading:!1,product:t},Object(r.createElement)("div",null,Object(r.createElement)(l.a,{className:"",showSaleBadge:!1}),Object(r.createElement)(s.a,{align:"",headingLevel:2,showProductLink:!0}),Object(r.createElement)(o.Block,null),Object(r.createElement)(i.Block,null),Object(r.createElement)(u.Block,null)),t.is_in_stock?Object(r.createElement)(m.a,null):Object(r.createElement)(d.Block,null))))},p=e=>{let{products:t,columns:c}=e;const n=t.map((e,t)=>t>=c?null:Object(r.createElement)(b,{isLoading:!1,product:e,key:e.id}));return Object(r.createElement)("div",null,n)},O=c(165);t.default=e=>{let{className:t,columns:c}=e;const{crossSellsProducts:a}=Object(n.a)();return void 0===c&&(c=O.attributes.columns.default),Object(r.createElement)(p,{className:t,columns:c,products:a})}}}]);
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js CHANGED
@@ -1,5 +1,5 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{27:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var o=n(0),s=n(12),a=n.n(s);function c(e){const t=Object(o.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},290:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var o=n(0),s=n(4),a=n(3);n(291);const c=e=>{let{errorMessage:t="",propertyName:n="",elementId:c=""}=e;const{validationError:r,validationErrorId:i}=Object(s.useSelect)(e=>{const t=e(a.VALIDATION_STORE_KEY);return{validationError:t.getValidationError(n),validationErrorId:t.getValidationErrorId(c)}});if(!t||"string"!=typeof t){if(null==r||!r.message||null!=r&&r.hidden)return null;t=r.message}return Object(o.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(o.createElement)("p",{id:i},t))};t.b=c},291:function(e,t){},309:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var o=n(1),s=n(4),a=n(3),c=n(21),r=n(36);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:n}=Object(r.a)(),{createErrorNotice:i}=Object(s.useDispatch)("core/notices"),{createNotice:l}=Object(s.useDispatch)("core/notices"),{setValidationErrors:p}=Object(s.useDispatch)(a.VALIDATION_STORE_KEY),{applyCoupon:u,removeCoupon:d,isApplyingCoupon:m,isRemovingCoupon:h}=Object(s.useSelect)((e,t)=>{let{dispatch:n}=t;const o=e(a.CART_STORE_KEY),s=n(a.CART_STORE_KEY);return{applyCoupon:s.applyCoupon,removeCoupon:s.removeCoupon,isApplyingCoupon:o.isApplyingCoupon(),isRemovingCoupon:o.isRemovingCoupon(),receiveApplyingCoupon:s.receiveApplyingCoupon}},[i,l]),b=t=>{u(t).then(n=>{!0===n&&l("info",Object(o.sprintf)(
2
  /* translators: %s coupon code. */
3
  Object(o.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{p({coupon:{message:Object(c.decodeEntities)(e.message),hidden:!1}}),receiveApplyingCoupon("")})},g=t=>{d(t).then(n=>{!0===n&&l("info",Object(o.sprintf)(
4
  /* translators: %s coupon code. */
5
- Object(o.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{i(t.message,{id:"coupon-form",context:e}),receiveApplyingCoupon("")})};return{appliedCoupons:t,isLoading:n,applyCoupon:b,removeCoupon:g,isApplyingCoupon:m,isRemovingCoupon:h}}},310:function(e,t){},313:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return l}));var o=n(27),s=n(17),a=n(4),c=n(3);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:n,availablePaymentMethods:r,availableExpressPaymentMethods:i}=Object(a.useSelect)(e=>{const t=e(c.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}}),l=Object.values(r).map(e=>{let{name:t}=e;return t}),p=Object.values(i).map(e=>{let{name:t}=e;return t}),u=Object(s.getPaymentMethods)(),d=Object(s.getExpressPaymentMethods)(),m=Object.keys(u).reduce((e,t)=>(l.includes(t)&&(e[t]=u[t]),e),{}),h=Object.keys(d).reduce((e,t)=>(p.includes(t)&&(e[t]=d[t]),e),{}),b=Object(o.a)(m),g=Object(o.a)(h);return{paymentMethods:e?g:b,isInitialized:e?n:t}},i=()=>r(!1),l=()=>r(!0)},315:function(e,t,n){"use strict";var o=n(11),s=n.n(o),a=n(0),c=n(5),r=n.n(c);const i=e=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+e;var l=e=>{let{id:t,src:n=null,alt:o=""}=e;return n?Object(a.createElement)("img",{className:i(t),src:n,alt:o}):null},p=n(44);const u=[{id:"alipay",alt:"Alipay",src:p.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:p.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:p.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:p.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:p.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:p.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:p.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:p.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:p.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:p.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:p.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:p.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:p.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:p.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:p.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:p.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:p.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:p.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:p.l+"payment-methods/wechat.svg"}];var d=n(28);n(310),t.a=e=>{let{icons:t=[],align:n="center",className:o}=e;const c=(e=>{const t={};return e.forEach(e=>{let n={};"string"==typeof e&&(n={id:e,alt:e,src:null}),"object"==typeof e&&(n={id:e.id||"",alt:e.alt||"",src:e.src||null}),n.id&&Object(d.a)(n.id)&&!t[n.id]&&(t[n.id]=n)}),Object.values(t)})(t);if(0===c.length)return null;const i=r()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===n,"wc-block-components-payment-method-icons--align-right":"right"===n},o);return Object(a.createElement)("div",{className:i},c.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(a.createElement)(l,s()({key:"payment-method-icon-"+e.id},t))}))}},349:function(e,t){},350:function(e,t,n){"use strict";var o=n(16),s=n.n(o),a=n(0),c=n(1),r=n(7),i=n(2),l=n(137),p=n(64);class u extends r.Component{constructor(){super(...arguments),s()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:n}=this.props;if(e){let e=Object(c.__)("We are experiencing difficulties with this payment method. Please contact us for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(c.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const o=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(a.createElement)(l.a,{additionalNotices:o,context:p.noticeContexts.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},375:function(e,t){},376:function(e,t,n){"use strict";var o=n(0),s=n(1),a=n(313),c=n(430),r=n(34),i=n(20),l=n.n(i),p=n(4),u=n(350),d=n(105);t.a=()=>{const{isEditor:e}=Object(r.a)(),{activePaymentMethod:t,paymentMethodData:n}=Object(p.useSelect)(e=>{const t=e(d.a);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData()}}),{__internalSetActivePaymentMethod:i,__internalSetPaymentStatus:m,__internalSetExpressPaymentError:h}=Object(p.useDispatch)(d.a),{paymentMethods:b}=Object(a.a)(),g=Object(c.a)(),v=Object(o.useRef)(t),y=Object(o.useRef)(n),O=Object(o.useCallback)(e=>()=>{v.current=t,y.current=n,m({isStarted:!0}),i(e)},[t,n,i,m]),E=Object(o.useCallback)(()=>{m({isPristine:!0}),i(v.current,y.current)},[i,m]),j=Object(o.useCallback)(e=>{m({hasError:!0},e),h(e),i(v.current,y.current)},[i,m,h]),f=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";l()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?j(e):h("")}),[h,j]),S=Object.entries(b),P=S.length>0?S.map(t=>{let[n,s]=t;const a=e?s.edit:s.content;return Object(o.isValidElement)(a)?Object(o.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(o.cloneElement)(a,{...g,onClick:O(n),onClose:E,onError:j,setExpressPaymentError:f})):null}):Object(o.createElement)("li",{key:"noneRegistered"},Object(s.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(o.createElement)(u.a,{isEditor:e},Object(o.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},P))}},408:function(e,t,n){"use strict";var o=n(0),s=n(14);const a=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(s.Path,{fillRule:"evenodd",d:"M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z",clipRule:"evenodd"}));t.a=a},430:function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var o=n(1),s=n(39),a=n(0),c=n(5),r=n.n(c),i=n(14),l=Object(a.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(a.createElement)("path",{d:"M0 0h24v24H0z"}),Object(a.createElement)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),Object(a.createElement)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"}))),p=Object(a.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(i.Path,{fillRule:"evenodd",d:"M18.646 9H20V8l-1-.5L12 4 5 7.5 4 8v1h14.646zm-3-1.5L12 5.677 8.354 7.5h7.292zm-7.897 9.44v-6.5h-1.5v6.5h1.5zm5-6.5v6.5h-1.5v-6.5h1.5zm5 0v6.5h-1.5v-6.5h1.5zm2.252 8.81c0 .414-.334.75-.748.75H4.752a.75.75 0 010-1.5h14.5a.75.75 0 01.749.75z",clipRule:"evenodd"})),u=Object(a.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(i.Path,{d:"M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z"})),d=n(408),m=n(111),h=n(28),b=n(18);n(349);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const o=!!t,s=Object(a.useCallback)(e=>o&&Object(h.a)(e)&&Object(b.b)(g,e),[o]),c=r()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return Object(a.createElement)("span",{className:c},s(t)?Object(a.createElement)(m.a,{icon:g[t]}):t,n)},y=n(315),O=n(2),E=n(20),j=n.n(E),f=n(146),S=n(4),P=n(3),C=n(290),_=n(36),k=n(309),w=n(42),M=n(86),R=n(121),x=n(87),I=n(88);const A=(e,t)=>{const n=[],s=(t,n)=>{const o=n+"_tax",s=Object(b.b)(e,n)&&Object(h.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:s,valueWithTax:s+(Object(b.b)(e,o)&&Object(h.a)(e[o])?parseInt(e[o],10):0)}};return n.push(s(Object(o.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(s(Object(o.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(s(Object(o.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(o.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(s(Object(o.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var T=n(118);const z=()=>{const{onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutAfterProcessingWithSuccess:n,onCheckoutAfterProcessingWithError:c,onSubmit:r}=Object(M.b)(),{isCalculating:i,isComplete:l,isIdle:p,isProcessing:u,customerId:d}=Object(S.useSelect)(e=>{const t=e(P.CHECKOUT_STORE_KEY);return{isComplete:t.isComplete(),isIdle:t.isIdle(),isProcessing:t.isProcessing(),customerId:t.getCustomerId(),isCalculating:t.isCalculating()}}),{currentStatus:m,activePaymentMethod:h,shouldSavePayment:b}=Object(S.useSelect)(e=>{const t=e(P.PAYMENT_STORE_KEY);return{currentStatus:t.getCurrentStatus(),activePaymentMethod:t.getActivePaymentMethod(),shouldSavePayment:t.getShouldSavePaymentMethod()}}),{__internalSetExpressPaymentError:g}=Object(S.useDispatch)(P.PAYMENT_STORE_KEY),{onPaymentProcessing:E}=Object(R.b)(),{shippingErrorStatus:z,shippingErrorTypes:V,onShippingRateSuccess:D,onShippingRateFail:N,onShippingRateSelectSuccess:B,onShippingRateSelectFail:L}=Object(x.b)(),{shippingRates:Y,isLoadingRates:H,selectedRates:W,isSelectingRate:F,selectShippingRate:K,needsShipping:G}=Object(T.a)(),{billingAddress:U,shippingAddress:J,setShippingAddress:q}=Object(I.b)(),{cartItems:Q,cartFees:X,cartTotals:Z,extensions:$}=Object(_.a)(),{appliedCoupons:ee}=Object(k.a)(),te=Object(a.useRef)(A(Z,G)),ne=Object(a.useRef)({label:Object(o.__)("Total","woo-gutenberg-products-block"),value:parseInt(Z.total_price,10)});Object(a.useEffect)(()=>{te.current=A(Z,G),ne.current={label:Object(o.__)("Total","woo-gutenberg-products-block"),value:parseInt(Z.total_price,10)}},[Z,G]);const oe=Object(a.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";j()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),g(e)}),[g]);return{activePaymentMethod:h,billing:{appliedCoupons:ee,billingAddress:U,billingData:U,cartTotal:ne.current,cartTotalItems:te.current,currency:Object(s.getCurrencyFromPriceResponse)(Z),customerId:d,displayPricesIncludingTax:Object(O.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:Q,cartFees:X,extensions:$},checkoutStatus:{isCalculating:i,isComplete:l,isIdle:p,isProcessing:u},components:{LoadingMask:f.a,PaymentMethodIcons:y.a,PaymentMethodLabel:v,ValidationInputError:C.a},emitResponse:{noticeContexts:w.d,responseTypes:w.e},eventRegistration:{onCheckoutAfterProcessingWithError:c,onCheckoutAfterProcessingWithSuccess:n,onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onPaymentProcessing:E,onShippingRateFail:N,onShippingRateSelectFail:L,onShippingRateSelectSuccess:B,onShippingRateSuccess:D},onSubmit:r,paymentStatus:m,setExpressPaymentError:oe,shippingData:{isSelectingRate:F,needsShipping:G,selectedRates:W,setSelectedRates:K,setShippingAddress:q,shippingAddress:J,shippingRates:Y,shippingRatesLoading:H},shippingStatus:{shippingErrorStatus:z,shippingErrorTypes:V},shouldSavePayment:b}}},64:function(e,t,n){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{29:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var o=n(0),s=n(13),a=n.n(s);function c(e){const t=Object(o.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},292:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var o=n(0),s=n(5),a=n(3);n(294);const c=e=>{let{errorMessage:t="",propertyName:n="",elementId:c=""}=e;const{validationError:r,validationErrorId:i}=Object(s.useSelect)(e=>{const t=e(a.VALIDATION_STORE_KEY);return{validationError:t.getValidationError(n),validationErrorId:t.getValidationErrorId(c)}});if(!t||"string"!=typeof t){if(null==r||!r.message||null!=r&&r.hidden)return null;t=r.message}return Object(o.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(o.createElement)("p",{id:i},t))};t.b=c},294:function(e,t){},311:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var o=n(1),s=n(5),a=n(3),c=n(23),r=n(38);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:n}=Object(r.a)(),{createErrorNotice:i}=Object(s.useDispatch)("core/notices"),{createNotice:l}=Object(s.useDispatch)("core/notices"),{setValidationErrors:p}=Object(s.useDispatch)(a.VALIDATION_STORE_KEY),{applyCoupon:u,removeCoupon:d,isApplyingCoupon:m,isRemovingCoupon:h}=Object(s.useSelect)((e,t)=>{let{dispatch:n}=t;const o=e(a.CART_STORE_KEY),s=n(a.CART_STORE_KEY);return{applyCoupon:s.applyCoupon,removeCoupon:s.removeCoupon,isApplyingCoupon:o.isApplyingCoupon(),isRemovingCoupon:o.isRemovingCoupon(),receiveApplyingCoupon:s.receiveApplyingCoupon}},[i,l]),b=t=>{u(t).then(n=>{!0===n&&l("info",Object(o.sprintf)(
2
  /* translators: %s coupon code. */
3
  Object(o.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{p({coupon:{message:Object(c.decodeEntities)(e.message),hidden:!1}}),receiveApplyingCoupon("")})},g=t=>{d(t).then(n=>{!0===n&&l("info",Object(o.sprintf)(
4
  /* translators: %s coupon code. */
5
+ Object(o.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{i(t.message,{id:"coupon-form",context:e}),receiveApplyingCoupon("")})};return{appliedCoupons:t,isLoading:n,applyCoupon:b,removeCoupon:g,isApplyingCoupon:m,isRemovingCoupon:h}}},312:function(e,t){},315:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return l}));var o=n(29),s=n(18),a=n(5),c=n(3);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:n,availablePaymentMethods:r,availableExpressPaymentMethods:i}=Object(a.useSelect)(e=>{const t=e(c.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}}),l=Object.values(r).map(e=>{let{name:t}=e;return t}),p=Object.values(i).map(e=>{let{name:t}=e;return t}),u=Object(s.getPaymentMethods)(),d=Object(s.getExpressPaymentMethods)(),m=Object.keys(u).reduce((e,t)=>(l.includes(t)&&(e[t]=u[t]),e),{}),h=Object.keys(d).reduce((e,t)=>(p.includes(t)&&(e[t]=d[t]),e),{}),b=Object(o.a)(m),g=Object(o.a)(h);return{paymentMethods:e?g:b,isInitialized:e?n:t}},i=()=>r(!1),l=()=>r(!0)},317:function(e,t,n){"use strict";var o=n(12),s=n.n(o),a=n(0),c=n(4),r=n.n(c);const i=e=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+e;var l=e=>{let{id:t,src:n=null,alt:o=""}=e;return n?Object(a.createElement)("img",{className:i(t),src:n,alt:o}):null},p=n(46);const u=[{id:"alipay",alt:"Alipay",src:p.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:p.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:p.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:p.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:p.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:p.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:p.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:p.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:p.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:p.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:p.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:p.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:p.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:p.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:p.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:p.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:p.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:p.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:p.l+"payment-methods/wechat.svg"}];var d=n(30);n(312),t.a=e=>{let{icons:t=[],align:n="center",className:o}=e;const c=(e=>{const t={};return e.forEach(e=>{let n={};"string"==typeof e&&(n={id:e,alt:e,src:null}),"object"==typeof e&&(n={id:e.id||"",alt:e.alt||"",src:e.src||null}),n.id&&Object(d.a)(n.id)&&!t[n.id]&&(t[n.id]=n)}),Object.values(t)})(t);if(0===c.length)return null;const i=r()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===n,"wc-block-components-payment-method-icons--align-right":"right"===n},o);return Object(a.createElement)("div",{className:i},c.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(a.createElement)(l,s()({key:"payment-method-icon-"+e.id},t))}))}},351:function(e,t){},352:function(e,t,n){"use strict";var o=n(17),s=n.n(o),a=n(0),c=n(1),r=n(8),i=n(2),l=n(139),p=n(65);class u extends r.Component{constructor(){super(...arguments),s()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:n}=this.props;if(e){let e=Object(c.__)("We are experiencing difficulties with this payment method. Please contact us for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(c.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const o=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(a.createElement)(l.a,{additionalNotices:o,context:p.noticeContexts.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},377:function(e,t){},378:function(e,t,n){"use strict";var o=n(0),s=n(1),a=n(315),c=n(432),r=n(36),i=n(22),l=n.n(i),p=n(5),u=n(352),d=n(108);t.a=()=>{const{isEditor:e}=Object(r.a)(),{activePaymentMethod:t,paymentMethodData:n}=Object(p.useSelect)(e=>{const t=e(d.a);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData()}}),{__internalSetActivePaymentMethod:i,__internalSetPaymentStatus:m,__internalSetExpressPaymentError:h}=Object(p.useDispatch)(d.a),{paymentMethods:b}=Object(a.a)(),g=Object(c.a)(),v=Object(o.useRef)(t),y=Object(o.useRef)(n),O=Object(o.useCallback)(e=>()=>{v.current=t,y.current=n,m({isStarted:!0}),i(e)},[t,n,i,m]),E=Object(o.useCallback)(()=>{m({isPristine:!0}),i(v.current,y.current)},[i,m]),j=Object(o.useCallback)(e=>{m({hasError:!0},e),h(e),i(v.current,y.current)},[i,m,h]),f=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";l()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?j(e):h("")}),[h,j]),S=Object.entries(b),P=S.length>0?S.map(t=>{let[n,s]=t;const a=e?s.edit:s.content;return Object(o.isValidElement)(a)?Object(o.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(o.cloneElement)(a,{...g,onClick:O(n),onClose:E,onError:j,setExpressPaymentError:f})):null}):Object(o.createElement)("li",{key:"noneRegistered"},Object(s.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(o.createElement)(u.a,{isEditor:e},Object(o.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},P))}},410:function(e,t,n){"use strict";var o=n(0),s=n(15);const a=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(s.Path,{fillRule:"evenodd",d:"M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z",clipRule:"evenodd"}));t.a=a},432:function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var o=n(1),s=n(40),a=n(0),c=n(4),r=n.n(c),i=n(15),l=Object(a.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(a.createElement)("path",{d:"M0 0h24v24H0z"}),Object(a.createElement)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),Object(a.createElement)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"}))),p=Object(a.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(i.Path,{fillRule:"evenodd",d:"M18.646 9H20V8l-1-.5L12 4 5 7.5 4 8v1h14.646zm-3-1.5L12 5.677 8.354 7.5h7.292zm-7.897 9.44v-6.5h-1.5v6.5h1.5zm5-6.5v6.5h-1.5v-6.5h1.5zm5 0v6.5h-1.5v-6.5h1.5zm2.252 8.81c0 .414-.334.75-.748.75H4.752a.75.75 0 010-1.5h14.5a.75.75 0 01.749.75z",clipRule:"evenodd"})),u=Object(a.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(a.createElement)(i.Path,{d:"M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z"})),d=n(410),m=n(114),h=n(30),b=n(19);n(351);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const o=!!t,s=Object(a.useCallback)(e=>o&&Object(h.a)(e)&&Object(b.b)(g,e),[o]),c=r()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return Object(a.createElement)("span",{className:c},s(t)?Object(a.createElement)(m.a,{icon:g[t]}):t,n)},y=n(317),O=n(2),E=n(22),j=n.n(E),f=n(148),S=n(5),P=n(3),C=n(292),_=n(38),k=n(311),w=n(43),M=n(88),R=n(122),x=n(89),I=n(90);const A=(e,t)=>{const n=[],s=(t,n)=>{const o=n+"_tax",s=Object(b.b)(e,n)&&Object(h.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:s,valueWithTax:s+(Object(b.b)(e,o)&&Object(h.a)(e[o])?parseInt(e[o],10):0)}};return n.push(s(Object(o.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(s(Object(o.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(s(Object(o.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(o.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(s(Object(o.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var T=n(119);const z=()=>{const{onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutAfterProcessingWithSuccess:n,onCheckoutAfterProcessingWithError:c,onSubmit:r}=Object(M.b)(),{isCalculating:i,isComplete:l,isIdle:p,isProcessing:u,customerId:d}=Object(S.useSelect)(e=>{const t=e(P.CHECKOUT_STORE_KEY);return{isComplete:t.isComplete(),isIdle:t.isIdle(),isProcessing:t.isProcessing(),customerId:t.getCustomerId(),isCalculating:t.isCalculating()}}),{currentStatus:m,activePaymentMethod:h,shouldSavePayment:b}=Object(S.useSelect)(e=>{const t=e(P.PAYMENT_STORE_KEY);return{currentStatus:t.getCurrentStatus(),activePaymentMethod:t.getActivePaymentMethod(),shouldSavePayment:t.getShouldSavePaymentMethod()}}),{__internalSetExpressPaymentError:g}=Object(S.useDispatch)(P.PAYMENT_STORE_KEY),{onPaymentProcessing:E}=Object(R.b)(),{shippingErrorStatus:z,shippingErrorTypes:V,onSh