WooCommerce Gutenberg Products Block - Version 6.9.0

Version Description

  • 2022-01-31 =

Enhancements

  • Add support for the global style for the Featured Category block. (5542)

Bug Fixes

  • Enable Mini Cart template-parts only for experimental builds. (5606)
  • Show express payment button in full width if only one express payment method is available. (5601)
  • Wrapped cart item product contents in inner div. (5240)
  • Fix alignment issue with the "create account" section on the checkout block in the editor (5633)

blocker

  • Revert "Allow LegacyTemplate block to be reinserted, only on WooCommerce block templates.". (5643)
Download this release

Release Info

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

Code changes from version 6.8.0 to 6.9.0

Files changed (174) hide show
  1. assets/js/atomic/blocks/product-elements/title/editor.scss +1 -1
  2. assets/js/atomic/utils/render-parent-block.tsx +79 -60
  3. assets/js/base/components/block-error-boundary/block-error.tsx +4 -3
  4. assets/js/base/components/block-error-boundary/index.tsx +2 -0
  5. assets/js/base/components/block-error-boundary/types.ts +8 -3
  6. assets/js/base/components/read-more/index.tsx +23 -0
  7. assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx +5 -8
  8. assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts +1 -4
  9. assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js +6 -11
  10. assets/js/blocks/cart-checkout/cart/cart-line-items-table/cart-line-item-row.tsx +89 -86
  11. assets/js/blocks/cart-checkout/mini-cart-contents/editor.scss +33 -24
  12. assets/js/blocks/cart-checkout/mini-cart-contents/index.tsx +1 -1
  13. assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/allowed-blocks.ts +43 -0
  14. assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx +2 -35
  15. assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx +1 -1
  16. assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx +15 -1
  17. assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx +23 -2
  18. assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx +2 -0
  19. assets/js/blocks/cart-checkout/mini-cart/style.scss +56 -48
  20. assets/js/blocks/cart-checkout/mini-cart/test/block.js +3 -3
  21. assets/js/blocks/cart-checkout/payment-methods/express-payment/style.scss +5 -0
  22. assets/js/blocks/cart-checkout/payment-methods/test/payment-methods.js +3 -3
  23. assets/js/blocks/{cart-checkout/checkout → checkout}/attributes.ts +8 -32
  24. assets/js/blocks/checkout/block.json +46 -0
  25. assets/js/blocks/{cart-checkout/checkout → checkout}/block.tsx +0 -0
  26. assets/js/blocks/{cart-checkout/checkout → checkout}/checkout-order-error/constants.js +0 -0
  27. assets/js/blocks/{cart-checkout/checkout → checkout}/checkout-order-error/index.js +0 -0
  28. assets/js/blocks/{cart-checkout/checkout → checkout}/checkout-order-error/style.scss +0 -0
  29. assets/js/blocks/{cart-checkout/checkout → checkout}/context.ts +0 -0
  30. assets/js/blocks/{cart-checkout/checkout → checkout}/edit.tsx +4 -1
  31. assets/js/blocks/{cart-checkout/checkout → checkout}/empty-cart/index.js +0 -0
  32. assets/js/blocks/{cart-checkout/checkout → checkout}/empty-cart/style.scss +0 -0
  33. assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/additional-fields.tsx +1 -1
  34. assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/attributes.ts +0 -0
  35. assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/editor.scss +0 -0
  36. assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/form-step-block.tsx +0 -0
  37. assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/form-step-heading.tsx +0 -0
  38. assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/index.tsx +0 -0
  39. assets/js/blocks/{cart-checkout/checkout → checkout}/frontend.tsx +0 -0
  40. assets/js/blocks/{cart-checkout/checkout → checkout}/index.tsx +12 -17
  41. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/attributes.tsx +0 -0
  42. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/block.json +0 -0
  43. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/block.tsx +0 -0
  44. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/edit.tsx +0 -0
  45. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/frontend.tsx +0 -0
  46. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/index.tsx +0 -0
  47. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/style.scss +0 -0
  48. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/attributes.tsx +0 -0
  49. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/block.json +0 -0
  50. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/block.tsx +0 -0
  51. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/edit.tsx +0 -0
  52. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/frontend.tsx +0 -0
  53. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/index.tsx +0 -0
  54. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/attributes.tsx +0 -0
  55. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/block.json +0 -0
  56. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/block.tsx +0 -0
  57. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/edit.tsx +0 -0
  58. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/frontend.tsx +0 -0
  59. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/index.tsx +0 -0
  60. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/login-prompt.js +0 -0
  61. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/block.json +0 -0
  62. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/block.tsx +1 -1
  63. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/edit.tsx +0 -0
  64. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/editor.scss +0 -0
  65. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/index.tsx +0 -0
  66. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/block.json +0 -0
  67. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/edit.tsx +4 -1
  68. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/frontend.tsx +0 -0
  69. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/index.tsx +0 -0
  70. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/style.scss +0 -0
  71. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/block.json +0 -0
  72. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/block.tsx +0 -0
  73. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/edit.tsx +0 -0
  74. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/editor.scss +0 -0
  75. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/index.tsx +0 -0
  76. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/attributes.tsx +0 -0
  77. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/block.json +0 -0
  78. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/block.tsx +0 -0
  79. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/edit.tsx +0 -0
  80. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/index.tsx +0 -0
  81. assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/test/block.js +494 -0
  82. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/attributes.tsx +0 -0
  83. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/block.json +0 -0
  84. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/block.tsx +1 -1
  85. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/edit.tsx +0 -0
  86. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/frontend.tsx +0 -0
  87. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/index.tsx +0 -0
  88. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/attributes.tsx +0 -0
  89. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/block.json +0 -0
  90. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/block.tsx +0 -0
  91. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/edit.tsx +0 -0
  92. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/frontend.tsx +0 -0
  93. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/index.tsx +0 -0
  94. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/attributes.tsx +0 -0
  95. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/block.json +0 -0
  96. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/block.tsx +0 -0
  97. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/edit.tsx +0 -0
  98. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/frontend.tsx +0 -0
  99. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/index.tsx +0 -0
  100. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/index.js +0 -0
  101. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/style.scss +0 -0
  102. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/style.scss +0 -0
  103. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/block.json +0 -0
  104. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/constants.js +0 -0
  105. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/edit.tsx +0 -0
  106. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/editor.scss +4 -0
  107. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/frontend.tsx +0 -0
  108. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/index.tsx +0 -0
  109. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/style.scss +0 -0
  110. assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js +109 -0
  111. assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/frontend.js +91 -0
  112. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/block.json +0 -0
  113. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/edit.tsx +4 -1
  114. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/frontend.tsx +0 -0
  115. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/index.tsx +0 -0
  116. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/style.scss +0 -0
  117. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/index.tsx +0 -0
  118. assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/register-components.ts +0 -0
  119. assets/js/blocks/{cart-checkout/checkout → checkout}/order-notes/index.js +0 -0
  120. assets/js/blocks/{cart-checkout/checkout → checkout}/order-notes/style.scss +0 -0
  121. assets/js/blocks/checkout/order-notes/test/index.js +117 -0
  122. assets/js/blocks/{cart-checkout/checkout → checkout}/phone-number/index.tsx +0 -0
  123. assets/js/blocks/checkout/phone-number/test/index.js +37 -0
  124. assets/js/blocks/{cart-checkout/checkout → checkout}/styles/editor.scss +0 -0
  125. assets/js/blocks/{cart-checkout/checkout → checkout}/styles/style.scss +0 -0
  126. assets/js/blocks/{cart-checkout/checkout → checkout}/types.ts +0 -0
  127. assets/js/blocks/{cart-checkout/checkout → checkout}/utils.ts +0 -0
  128. assets/js/blocks/featured-category/block.js +17 -41
  129. assets/js/blocks/featured-category/edit.tsx +23 -0
  130. assets/js/blocks/featured-category/editor.scss +2 -0
  131. assets/js/blocks/featured-category/index.js +14 -5
  132. assets/js/blocks/featured-category/style.scss +14 -2
  133. assets/js/blocks/legacy-template/constants.ts +1 -6
  134. assets/js/blocks/legacy-template/index.tsx +43 -83
  135. assets/js/blocks/legacy-template/test/utils.ts +0 -30
  136. assets/js/blocks/legacy-template/types.ts +0 -4
  137. assets/js/blocks/legacy-template/utils.ts +0 -24
  138. assets/js/editor-components/toggle-button-control/index.js +1 -2
  139. assets/js/hooks/style-attributes.ts +17 -0
  140. build/active-filters-frontend.asset.php +1 -1
  141. build/active-filters-frontend.js +2 -2
  142. build/active-filters.asset.php +1 -1
  143. build/active-filters.js +3 -3
  144. build/all-products-frontend.asset.php +1 -1
  145. build/all-products-frontend.js +6 -6
  146. build/all-products.asset.php +1 -1
  147. build/all-products.js +11 -11
  148. build/all-reviews.asset.php +1 -1
  149. build/all-reviews.js +3 -3
  150. build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---8f355022.js +1 -1
  151. build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b.js +1 -1
  152. build/atomic-block-components/add-to-cart--atomic-block-components/button.js +1 -1
  153. build/atomic-block-components/add-to-cart.js +2 -2
  154. build/atomic-block-components/button.js +2 -2
  155. build/atomic-block-components/category-list.js +1 -1
  156. build/atomic-block-components/image.js +2 -2
  157. build/atomic-block-components/price.js +1 -1
  158. build/atomic-block-components/rating.js +2 -2
  159. build/atomic-block-components/sale-badge.js +1 -1
  160. build/atomic-block-components/sku.js +1 -1
  161. build/atomic-block-components/stock-indicator--atomic-block-components/summary--atomic-block-components/title.js +1 -1
  162. build/atomic-block-components/stock-indicator.js +2 -2
  163. build/atomic-block-components/summary.js +1 -1
  164. build/atomic-block-components/tag-list.js +1 -1
  165. build/atomic-block-components/title.js +1 -1
  166. build/attribute-filter-frontend.asset.php +1 -1
  167. build/attribute-filter-frontend.js +5 -5
  168. build/attribute-filter.asset.php +1 -1
  169. build/attribute-filter.js +10 -10
  170. build/cart-blocks/express-payment-frontend.js +1 -1
  171. build/cart-blocks/line-items-frontend.js +3 -3
  172. build/cart-blocks/order-summary-frontend.js +4 -4
  173. build/cart-frontend.asset.php +1 -1
  174. build/cart-frontend.js +0 -1
assets/js/atomic/blocks/product-elements/title/editor.scss CHANGED
@@ -1,4 +1,4 @@
1
- .editor-styles-wrapper a.wc-block-components-product-name {
2
  color: inherit;
3
  }
4
 
1
+ .editor-styles-wrapper .wc-block-components-product-title a.wc-block-components-product-name {
2
  color: inherit;
3
  }
4
 
assets/js/atomic/utils/render-parent-block.tsx CHANGED
@@ -2,6 +2,7 @@
2
  * External dependencies
3
  */
4
  import { renderFrontend } from '@woocommerce/base-utils';
 
5
  import {
6
  Fragment,
7
  Suspense,
@@ -13,6 +14,7 @@ import {
13
  getRegisteredBlocks,
14
  hasInnerBlocks,
15
  } from '@woocommerce/blocks-checkout';
 
16
 
17
  /**
18
  * This file contains logic used on the frontend to convert DOM elements (saved by the block editor) to React
@@ -53,7 +55,7 @@ const renderForcedBlocks = (
53
  block: string,
54
  blockMap: Record< string, React.ReactNode >,
55
  // Current children from the parent (siblings of the forced block)
56
- blockChildren: HTMLCollection | null,
57
  // Wrapper for inner components.
58
  blockWrapper?: React.ElementType
59
  ) => {
@@ -63,9 +65,9 @@ const renderForcedBlocks = (
63
 
64
  const currentBlocks = blockChildren
65
  ? ( Array.from( blockChildren )
66
- .map( ( element: Element ) =>
67
- element instanceof HTMLElement
68
- ? element?.dataset.blockName || null
69
  : null
70
  )
71
  .filter( Boolean ) as string[] )
@@ -80,7 +82,7 @@ const renderForcedBlocks = (
80
  const InnerBlockComponentWrapper = blockWrapper ? blockWrapper : Fragment;
81
 
82
  return (
83
- <InnerBlockComponentWrapper>
84
  { forcedBlocks.map(
85
  (
86
  { blockName, component },
@@ -90,16 +92,36 @@ const renderForcedBlocks = (
90
  ? component
91
  : getBlockComponentFromMap( blockName, blockMap );
92
  return ForcedComponent ? (
93
- <ForcedComponent
94
- key={ `${ blockName }_forced_${ index }` }
95
- />
 
 
 
 
 
 
 
96
  ) : null;
97
  }
98
  ) }
99
- </InnerBlockComponentWrapper>
100
  );
101
  };
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  /**
104
  * Recursively replace block markup in the DOM with React Components.
105
  */
@@ -114,30 +136,19 @@ const renderInnerBlocks = ( {
114
  children,
115
  // Current depth of the children. Used to ensure keys are unique.
116
  depth = 1,
117
- }: {
118
- // Block (parent) being rendered. Used for inner block component mapping.
119
- block: string;
120
- // Map of block names to block components for children.
121
- blockMap: Record< string, React.ReactNode >;
122
- // Wrapper for inner components.
123
- blockWrapper?: React.ElementType;
124
- // Elements from the DOM being converted to components.
125
- children: HTMLCollection | NodeList;
126
- // Depth within the DOM hierarchy.
127
- depth?: number;
128
- } ): ( JSX.Element | null )[] | null => {
129
  if ( ! children || children.length === 0 ) {
130
  return null;
131
  }
132
- return Array.from( children ).map( ( element: Element, index: number ) => {
133
  /**
134
  * This will grab the blockName from the data- attributes stored in block markup. Without a blockName, we cannot
135
  * convert the HTMLElement to a React component.
136
  */
137
  const { blockName = '', ...componentProps } = {
138
  key: `${ block }_${ depth }_${ index }`,
139
- ...( element instanceof HTMLElement ? element.dataset : {} ),
140
- className: element.className || '',
141
  };
142
 
143
  const InnerBlockComponent = getBlockComponentFromMap(
@@ -153,7 +164,9 @@ const renderInnerBlocks = ( {
153
  */
154
  if ( ! InnerBlockComponent ) {
155
  const parsedElement = parse(
156
- element?.outerHTML || element?.textContent || ''
 
 
157
  );
158
 
159
  // Returns text nodes without manipulation.
@@ -166,11 +179,11 @@ const renderInnerBlocks = ( {
166
  return null;
167
  }
168
 
169
- const renderedChildren = element.childNodes.length
170
  ? renderInnerBlocks( {
171
  block,
172
  blockMap,
173
- children: element.childNodes,
174
  depth: depth + 1,
175
  blockWrapper,
176
  } )
@@ -195,39 +208,45 @@ const renderInnerBlocks = ( {
195
  key={ `${ block }_${ depth }_${ index }_suspense` }
196
  fallback={ <div className="wc-block-placeholder" /> }
197
  >
198
- <InnerBlockComponentWrapper>
199
- <InnerBlockComponent { ...componentProps }>
200
- {
201
- /**
202
- * Within this Inner Block Component we also need to recursively render it's children. This
203
- * is done here with a depth+1. The same block map and parent is used, but we pass new
204
- * children from this element.
205
- */
206
- renderInnerBlocks( {
207
- block,
208
- blockMap,
209
- children: element.children,
210
- depth: depth + 1,
211
- blockWrapper,
212
- } )
213
- }
214
- {
215
- /**
216
- * In addition to the inner blocks, we may also need to render FORCED blocks which have not
217
- * yet been added to the inner block template. We do this by comparing the current children
218
- * to the list of registered forced blocks.
219
- *
220
- * @see registerCheckoutBlock
221
- */
222
- renderForcedBlocks(
223
- blockName,
224
- blockMap,
225
- element.children,
226
- blockWrapper
227
- )
228
- }
229
- </InnerBlockComponent>
230
- </InnerBlockComponentWrapper>
 
 
 
 
 
 
231
  </Suspense>
232
  );
233
  } );
2
  * External dependencies
3
  */
4
  import { renderFrontend } from '@woocommerce/base-utils';
5
+ import { CURRENT_USER_IS_ADMIN } from '@woocommerce/settings';
6
  import {
7
  Fragment,
8
  Suspense,
14
  getRegisteredBlocks,
15
  hasInnerBlocks,
16
  } from '@woocommerce/blocks-checkout';
17
+ import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
18
 
19
  /**
20
  * This file contains logic used on the frontend to convert DOM elements (saved by the block editor) to React
55
  block: string,
56
  blockMap: Record< string, React.ReactNode >,
57
  // Current children from the parent (siblings of the forced block)
58
+ blockChildren: NodeListOf< ChildNode > | null,
59
  // Wrapper for inner components.
60
  blockWrapper?: React.ElementType
61
  ) => {
65
 
66
  const currentBlocks = blockChildren
67
  ? ( Array.from( blockChildren )
68
+ .map( ( node: Node ) =>
69
+ node instanceof HTMLElement
70
+ ? node?.dataset.blockName || null
71
  : null
72
  )
73
  .filter( Boolean ) as string[] )
82
  const InnerBlockComponentWrapper = blockWrapper ? blockWrapper : Fragment;
83
 
84
  return (
85
+ <>
86
  { forcedBlocks.map(
87
  (
88
  { blockName, component },
92
  ? component
93
  : getBlockComponentFromMap( blockName, blockMap );
94
  return ForcedComponent ? (
95
+ <BlockErrorBoundary
96
+ text={ `Unexpected error in: ${ blockName }` }
97
+ showErrorBlock={ CURRENT_USER_IS_ADMIN as boolean }
98
+ >
99
+ <InnerBlockComponentWrapper>
100
+ <ForcedComponent
101
+ key={ `${ blockName }_forced_${ index }` }
102
+ />
103
+ </InnerBlockComponentWrapper>
104
+ </BlockErrorBoundary>
105
  ) : null;
106
  }
107
  ) }
108
+ </>
109
  );
110
  };
111
 
112
+ interface renderInnerBlocksProps {
113
+ // Block (parent) being rendered. Used for inner block component mapping.
114
+ block: string;
115
+ // Map of block names to block components for children.
116
+ blockMap: Record< string, React.ReactNode >;
117
+ // Wrapper for inner components.
118
+ blockWrapper?: React.ElementType | undefined;
119
+ // Elements from the DOM being converted to components.
120
+ children: HTMLCollection | NodeList;
121
+ // Depth within the DOM hierarchy.
122
+ depth?: number;
123
+ }
124
+
125
  /**
126
  * Recursively replace block markup in the DOM with React Components.
127
  */
136
  children,
137
  // Current depth of the children. Used to ensure keys are unique.
138
  depth = 1,
139
+ }: renderInnerBlocksProps ): ( JSX.Element | null )[] | null => {
 
 
 
 
 
 
 
 
 
 
 
140
  if ( ! children || children.length === 0 ) {
141
  return null;
142
  }
143
+ return Array.from( children ).map( ( node: Node, index: number ) => {
144
  /**
145
  * This will grab the blockName from the data- attributes stored in block markup. Without a blockName, we cannot
146
  * convert the HTMLElement to a React component.
147
  */
148
  const { blockName = '', ...componentProps } = {
149
  key: `${ block }_${ depth }_${ index }`,
150
+ ...( node instanceof HTMLElement ? node.dataset : {} ),
151
+ className: node instanceof Element ? node?.className : '',
152
  };
153
 
154
  const InnerBlockComponent = getBlockComponentFromMap(
164
  */
165
  if ( ! InnerBlockComponent ) {
166
  const parsedElement = parse(
167
+ ( node instanceof Element && node?.outerHTML ) ||
168
+ node?.textContent ||
169
+ ''
170
  );
171
 
172
  // Returns text nodes without manipulation.
179
  return null;
180
  }
181
 
182
+ const renderedChildren = node.childNodes.length
183
  ? renderInnerBlocks( {
184
  block,
185
  blockMap,
186
+ children: node.childNodes,
187
  depth: depth + 1,
188
  blockWrapper,
189
  } )
208
  key={ `${ block }_${ depth }_${ index }_suspense` }
209
  fallback={ <div className="wc-block-placeholder" /> }
210
  >
211
+ { /* Prevent third party components from breaking the entire checkout */ }
212
+ <BlockErrorBoundary
213
+ text={ `Unexpected error in: ${ blockName }` }
214
+ showErrorBlock={ CURRENT_USER_IS_ADMIN as boolean }
215
+ >
216
+ <InnerBlockComponentWrapper>
217
+ <InnerBlockComponent { ...componentProps }>
218
+ {
219
+ /**
220
+ * Within this Inner Block Component we also need to recursively render it's children. This
221
+ * is done here with a depth+1. The same block map and parent is used, but we pass new
222
+ * children from this element.
223
+ */
224
+ renderInnerBlocks( {
225
+ block,
226
+ blockMap,
227
+ children: node.childNodes,
228
+ depth: depth + 1,
229
+ blockWrapper,
230
+ } )
231
+ }
232
+ {
233
+ /**
234
+ * In addition to the inner blocks, we may also need to render FORCED blocks which have not
235
+ * yet been added to the inner block template. We do this by comparing the current children
236
+ * to the list of registered forced blocks.
237
+ *
238
+ * @see registerCheckoutBlock
239
+ */
240
+ renderForcedBlocks(
241
+ blockName,
242
+ blockMap,
243
+ node.childNodes,
244
+ blockWrapper
245
+ )
246
+ }
247
+ </InnerBlockComponent>
248
+ </InnerBlockComponentWrapper>
249
+ </BlockErrorBoundary>
250
  </Suspense>
251
  );
252
  } );
assets/js/base/components/block-error-boundary/block-error.tsx CHANGED
@@ -18,8 +18,9 @@ const BlockError = ( {
18
  errorMessage,
19
  errorMessagePrefix = __( 'Error:', 'woo-gutenberg-products-block' ),
20
  button,
21
- }: BlockErrorProps ): JSX.Element => {
22
- return (
 
23
  <div className="wc-block-error wc-block-components-error">
24
  { imageUrl && (
25
  <img
@@ -52,7 +53,7 @@ const BlockError = ( {
52
  ) }
53
  </div>
54
  </div>
55
- );
56
  };
57
 
58
  export default BlockError;
18
  errorMessage,
19
  errorMessagePrefix = __( 'Error:', 'woo-gutenberg-products-block' ),
20
  button,
21
+ showErrorBlock = true,
22
+ }: BlockErrorProps ): React.ReactNode => {
23
+ return showErrorBlock ? (
24
  <div className="wc-block-error wc-block-components-error">
25
  { imageUrl && (
26
  <img
53
  ) }
54
  </div>
55
  </div>
56
+ ) : null;
57
  };
58
 
59
  export default BlockError;
assets/js/base/components/block-error-boundary/index.tsx CHANGED
@@ -42,6 +42,7 @@ class BlockErrorBoundary extends Component< BlockErrorBoundaryProps > {
42
  header,
43
  imageUrl,
44
  showErrorMessage = true,
 
45
  text,
46
  errorMessagePrefix,
47
  renderError,
@@ -55,6 +56,7 @@ class BlockErrorBoundary extends Component< BlockErrorBoundaryProps > {
55
  }
56
  return (
57
  <BlockError
 
58
  errorMessage={ showErrorMessage ? errorMessage : null }
59
  header={ header }
60
  imageUrl={ imageUrl }
42
  header,
43
  imageUrl,
44
  showErrorMessage = true,
45
+ showErrorBlock = true,
46
  text,
47
  errorMessagePrefix,
48
  renderError,
56
  }
57
  return (
58
  <BlockError
59
+ showErrorBlock={ showErrorBlock }
60
  errorMessage={ showErrorMessage ? errorMessage : null }
61
  header={ header }
62
  imageUrl={ imageUrl }
assets/js/base/components/block-error-boundary/types.ts CHANGED
@@ -24,7 +24,11 @@ interface BlockErrorBase {
24
  /**
25
  * Button cta.
26
  */
27
- button: React.ReactNode;
 
 
 
 
28
  }
29
 
30
  export interface BlockErrorProps extends BlockErrorBase {
@@ -34,7 +38,7 @@ export interface BlockErrorProps extends BlockErrorBase {
34
  errorMessage: React.ReactNode;
35
  }
36
 
37
- type RenderErrorProps = {
38
  errorMessage: React.ReactNode;
39
  };
40
 
@@ -42,7 +46,8 @@ export interface BlockErrorBoundaryProps extends BlockErrorBase {
42
  /**
43
  * Override the default error with a function that takes the error message and returns a React component
44
  */
45
- renderError: ( props: RenderErrorProps ) => React.ReactNode;
 
46
  }
47
 
48
  export interface DerivedStateReturn {
24
  /**
25
  * Button cta.
26
  */
27
+ button?: React.ReactNode;
28
+ /**
29
+ * Controls wether to show the error block or fail silently
30
+ */
31
+ showErrorBlock?: boolean;
32
  }
33
 
34
  export interface BlockErrorProps extends BlockErrorBase {
38
  errorMessage: React.ReactNode;
39
  }
40
 
41
+ export type RenderErrorProps = {
42
  errorMessage: React.ReactNode;
43
  };
44
 
46
  /**
47
  * Override the default error with a function that takes the error message and returns a React component
48
  */
49
+ renderError?: ( props: RenderErrorProps ) => React.ReactNode;
50
+ showErrorMessage?: boolean;
51
  }
52
 
53
  export interface DerivedStateReturn {
assets/js/base/components/read-more/index.tsx CHANGED
@@ -111,6 +111,29 @@ class ReadMore extends Component< ReadMoreProps, ReadMoreState > {
111
  }
112
 
113
  componentDidMount(): void {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  if ( this.props.children ) {
115
  const { maxLines, ellipsis } = this.props;
116
 
111
  }
112
 
113
  componentDidMount(): void {
114
+ this.setSummary();
115
+ }
116
+
117
+ componentDidUpdate( prevProps: ReadMoreProps ): void {
118
+ if (
119
+ prevProps.maxLines !== this.props.maxLines ||
120
+ prevProps.children !== this.props.children
121
+ ) {
122
+ /**
123
+ * if maxLines or content changed we need to reset the state to
124
+ * initial values so that summary can be calculated again
125
+ */
126
+ this.setState(
127
+ {
128
+ clampEnabled: null,
129
+ summary: '.',
130
+ },
131
+ this.setSummary
132
+ );
133
+ }
134
+ }
135
+
136
+ setSummary(): void {
137
  if ( this.props.children ) {
138
  const { maxLines, ellipsis } = this.props;
139
 
assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx CHANGED
@@ -148,12 +148,9 @@ export const CheckoutStateProvider = ( {
148
  const paymentResult = getPaymentResultFromCheckoutResponse(
149
  response
150
  );
151
-
152
- if ( paymentResult.redirectUrl ) {
153
- dispatch(
154
- actions.setRedirectUrl( paymentResult.redirectUrl )
155
- );
156
- }
157
  dispatch( actions.setProcessingResponse( paymentResult ) );
158
  dispatch( actions.setAfterProcessing() );
159
  },
@@ -302,6 +299,7 @@ export const CheckoutStateProvider = ( {
302
  // the last observer response always "wins" for success.
303
  successResponse = response;
304
  }
 
305
  if (
306
  isErrorResponse( response ) ||
307
  isFailResponse( response )
@@ -331,8 +329,7 @@ export const CheckoutStateProvider = ( {
331
  dispatch( actions.setHasError( true ) );
332
  }
333
  } else {
334
- // nothing hooked in had any response type so let's just
335
- // consider successful
336
  dispatch( actions.setComplete() );
337
  }
338
  } );
148
  const paymentResult = getPaymentResultFromCheckoutResponse(
149
  response
150
  );
151
+ dispatch(
152
+ actions.setRedirectUrl( paymentResult?.redirectUrl || '' )
153
+ );
 
 
 
154
  dispatch( actions.setProcessingResponse( paymentResult ) );
155
  dispatch( actions.setAfterProcessing() );
156
  },
299
  // the last observer response always "wins" for success.
300
  successResponse = response;
301
  }
302
+
303
  if (
304
  isErrorResponse( response ) ||
305
  isFailResponse( response )
329
  dispatch( actions.setHasError( true ) );
330
  }
331
  } else {
332
+ // nothing hooked in had any response type so let's just consider successful.
 
333
  dispatch( actions.setComplete() );
334
  }
335
  } );
assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts CHANGED
@@ -57,11 +57,8 @@ export const reducer = (
57
  ? {
58
  ...state,
59
  status: STATUS.COMPLETE,
60
- // @todo Investigate why redirectURL could be non-truthy and whether this would cause a bug if multiple gateways were used for payment e.g. 1st set the redirect URL but failed, and then the 2nd did not provide a redirect URL and succeeded.
61
  redirectUrl:
62
- data !== undefined &&
63
- typeof data.redirectUrl === 'string' &&
64
- data.redirectUrl
65
  ? data.redirectUrl
66
  : state.redirectUrl,
67
  }
57
  ? {
58
  ...state,
59
  status: STATUS.COMPLETE,
 
60
  redirectUrl:
61
+ typeof data?.redirectUrl === 'string'
 
 
62
  ? data.redirectUrl
63
  : state.redirectUrl,
64
  }
assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js CHANGED
@@ -1,13 +1,8 @@
1
  /**
2
  * External dependencies
3
  */
4
- import {
5
- render,
6
- screen,
7
- fireEvent,
8
- waitFor,
9
- act,
10
- } from '@testing-library/react';
11
  import { previewCart } from '@woocommerce/resource-previews';
12
  import { dispatch } from '@wordpress/data';
13
  import { CART_STORE_KEY as storeKey } from '@woocommerce/block-data';
@@ -186,7 +181,7 @@ describe( 'Testing Payment Method Data Context Provider', () => {
186
 
187
  act( () => {
188
  // Express payment method clicked.
189
- fireEvent.click(
190
  screen.getByText( 'express-payment express payment method' )
191
  );
192
  } );
@@ -200,7 +195,7 @@ describe( 'Testing Payment Method Data Context Provider', () => {
200
 
201
  act( () => {
202
  // Express payment method closed.
203
- fireEvent.click(
204
  screen.getByText(
205
  'express-payment express payment method close'
206
  )
@@ -285,7 +280,7 @@ describe( 'Testing Payment Method Data Context Provider with saved cards turned
285
 
286
  act( () => {
287
  // Express payment method clicked.
288
- fireEvent.click(
289
  screen.getByText( 'express-payment express payment method' )
290
  );
291
  } );
@@ -301,7 +296,7 @@ describe( 'Testing Payment Method Data Context Provider with saved cards turned
301
 
302
  act( () => {
303
  // Express payment method closed.
304
- fireEvent.click(
305
  screen.getByText(
306
  'express-payment express payment method close'
307
  )
1
  /**
2
  * External dependencies
3
  */
4
+ import { render, screen, waitFor, act } from '@testing-library/react';
5
+ import userEvent from '@testing-library/user-event';
 
 
 
 
 
6
  import { previewCart } from '@woocommerce/resource-previews';
7
  import { dispatch } from '@wordpress/data';
8
  import { CART_STORE_KEY as storeKey } from '@woocommerce/block-data';
181
 
182
  act( () => {
183
  // Express payment method clicked.
184
+ userEvent.click(
185
  screen.getByText( 'express-payment express payment method' )
186
  );
187
  } );
195
 
196
  act( () => {
197
  // Express payment method closed.
198
+ userEvent.click(
199
  screen.getByText(
200
  'express-payment express payment method close'
201
  )
280
 
281
  act( () => {
282
  // Express payment method clicked.
283
+ userEvent.click(
284
  screen.getByText( 'express-payment express payment method' )
285
  );
286
  } );
296
 
297
  act( () => {
298
  // Express payment method closed.
299
+ userEvent.click(
300
  screen.getByText(
301
  'express-payment express payment method close'
302
  )
assets/js/blocks/cart-checkout/cart/cart-line-items-table/cart-line-item-row.tsx CHANGED
@@ -235,102 +235,105 @@ const CartLineItemRow = forwardRef< HTMLTableRowElement, CartLineItemRowProps >(
235
  ) }
236
  </td>
237
  <td className="wc-block-cart-item__product">
238
- <ProductName
239
- disabled={
240
- isPendingDelete || isProductHiddenFromCatalog
241
- }
242
- name={ name }
243
- permalink={ permalink }
244
- />
245
- { showBackorderBadge ? (
246
- <ProductBackorderBadge />
247
- ) : (
248
- !! lowStockRemaining && (
249
- <ProductLowStockBadge
250
- lowStockRemaining={ lowStockRemaining }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  />
252
- )
253
- ) }
254
 
255
- <div className="wc-block-cart-item__prices">
256
- <ProductPrice
257
  currency={ priceCurrency }
258
- regularPrice={ getAmountFromRawPrice(
259
- regularAmountSingle,
260
- priceCurrency
261
- ) }
262
- price={ getAmountFromRawPrice(
263
- purchaseAmountSingle,
264
  priceCurrency
265
  ) }
266
- format={ subtotalPriceFormat }
267
  />
268
- </div>
269
-
270
- <ProductSaleBadge
271
- currency={ priceCurrency }
272
- saleAmount={ getAmountFromRawPrice(
273
- saleAmountSingle,
274
- priceCurrency
275
- ) }
276
- format={ saleBadgePriceFormat }
277
- />
278
 
279
- <ProductMetadata
280
- shortDescription={ shortDescription }
281
- fullDescription={ fullDescription }
282
- itemData={ itemData }
283
- variation={ variation }
284
- />
285
 
286
- <div className="wc-block-cart-item__quantity">
287
- { ! soldIndividually && !! quantityLimits.editable && (
288
- <QuantitySelector
289
- disabled={ isPendingDelete }
290
- quantity={ quantity }
291
- minimum={ quantityLimits.minimum }
292
- maximum={ quantityLimits.maximum }
293
- step={ quantityLimits.multiple_of }
294
- onChange={ ( newQuantity ) => {
295
- setItemQuantity( newQuantity );
296
- dispatchStoreEvent(
297
- 'cart-set-item-quantity',
298
- {
299
- product: lineItem,
300
- quantity: newQuantity,
301
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  );
303
  } }
304
- itemName={ name }
305
- />
306
- ) }
307
- <button
308
- className="wc-block-cart-item__remove-link"
309
- onClick={ () => {
310
- onRemove();
311
- removeItem();
312
- dispatchStoreEvent( 'cart-remove-item', {
313
- product: lineItem,
314
- quantity,
315
- } );
316
- speak(
317
- sprintf(
318
- /* translators: %s refers to the item name in the cart. */
319
- __(
320
- '%s has been removed from your cart.',
321
- 'woo-gutenberg-products-block'
322
- ),
323
- name
324
- )
325
- );
326
- } }
327
- disabled={ isPendingDelete }
328
- >
329
- { __(
330
- 'Remove item',
331
- 'woo-gutenberg-products-block'
332
- ) }
333
- </button>
334
  </div>
335
  </td>
336
  <td className="wc-block-cart-item__total">
235
  ) }
236
  </td>
237
  <td className="wc-block-cart-item__product">
238
+ <div className="wc-block-cart-item__wrap">
239
+ <ProductName
240
+ disabled={
241
+ isPendingDelete || isProductHiddenFromCatalog
242
+ }
243
+ name={ name }
244
+ permalink={ permalink }
245
+ />
246
+ { showBackorderBadge ? (
247
+ <ProductBackorderBadge />
248
+ ) : (
249
+ !! lowStockRemaining && (
250
+ <ProductLowStockBadge
251
+ lowStockRemaining={ lowStockRemaining }
252
+ />
253
+ )
254
+ ) }
255
+
256
+ <div className="wc-block-cart-item__prices">
257
+ <ProductPrice
258
+ currency={ priceCurrency }
259
+ regularPrice={ getAmountFromRawPrice(
260
+ regularAmountSingle,
261
+ priceCurrency
262
+ ) }
263
+ price={ getAmountFromRawPrice(
264
+ purchaseAmountSingle,
265
+ priceCurrency
266
+ ) }
267
+ format={ subtotalPriceFormat }
268
  />
269
+ </div>
 
270
 
271
+ <ProductSaleBadge
 
272
  currency={ priceCurrency }
273
+ saleAmount={ getAmountFromRawPrice(
274
+ saleAmountSingle,
 
 
 
 
275
  priceCurrency
276
  ) }
277
+ format={ saleBadgePriceFormat }
278
  />
 
 
 
 
 
 
 
 
 
 
279
 
280
+ <ProductMetadata
281
+ shortDescription={ shortDescription }
282
+ fullDescription={ fullDescription }
283
+ itemData={ itemData }
284
+ variation={ variation }
285
+ />
286
 
287
+ <div className="wc-block-cart-item__quantity">
288
+ { ! soldIndividually &&
289
+ !! quantityLimits.editable && (
290
+ <QuantitySelector
291
+ disabled={ isPendingDelete }
292
+ quantity={ quantity }
293
+ minimum={ quantityLimits.minimum }
294
+ maximum={ quantityLimits.maximum }
295
+ step={ quantityLimits.multiple_of }
296
+ onChange={ ( newQuantity ) => {
297
+ setItemQuantity( newQuantity );
298
+ dispatchStoreEvent(
299
+ 'cart-set-item-quantity',
300
+ {
301
+ product: lineItem,
302
+ quantity: newQuantity,
303
+ }
304
+ );
305
+ } }
306
+ itemName={ name }
307
+ />
308
+ ) }
309
+ <button
310
+ className="wc-block-cart-item__remove-link"
311
+ onClick={ () => {
312
+ onRemove();
313
+ removeItem();
314
+ dispatchStoreEvent( 'cart-remove-item', {
315
+ product: lineItem,
316
+ quantity,
317
+ } );
318
+ speak(
319
+ sprintf(
320
+ /* translators: %s refers to the item name in the cart. */
321
+ __(
322
+ '%s has been removed from your cart.',
323
+ 'woo-gutenberg-products-block'
324
+ ),
325
+ name
326
+ )
327
  );
328
  } }
329
+ disabled={ isPendingDelete }
330
+ >
331
+ { __(
332
+ 'Remove item',
333
+ 'woo-gutenberg-products-block'
334
+ ) }
335
+ </button>
336
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  </div>
338
  </td>
339
  <td className="wc-block-cart-item__total">
assets/js/blocks/cart-checkout/mini-cart-contents/editor.scss CHANGED
@@ -1,35 +1,44 @@
1
- .wp-block-woocommerce-mini-cart-contents {
2
  max-width: 480px;
3
  /* We need to override the margin top here to simulate the layout of
4
  the mini cart contents on the front end. */
5
  margin: 0 auto !important;
6
- }
7
-
8
- .wp-block-woocommerce-filled-mini-cart-contents-block > .block-editor-inner-blocks > .block-editor-block-list__layout {
9
- display: flex;
10
- flex-direction: column;
11
- min-height: 100vh;
12
- }
13
-
14
- .wp-block-woocommerce-mini-cart-items-block {
15
- display: grid;
16
- flex-grow: 1;
17
- margin-bottom: $gap;
18
- padding: 0 $gap;
19
 
20
- > .block-editor-inner-blocks > .block-editor-block-list__layout {
21
  display: flex;
22
  flex-direction: column;
23
- height: 100%;
24
  }
25
- }
26
 
27
- .wp-block-woocommerce-mini-cart-products-table-block {
28
- margin-bottom: auto;
29
- margin-top: $gap;
30
- }
 
 
 
 
 
 
 
 
31
 
32
- .editor-styles-wrapper h2.wc-block-mini-cart__title {
33
- @include font-size(larger);
34
- margin: $gap-largest $gap 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
1
+ .editor-styles-wrapper .wp-block-woocommerce-mini-cart-contents {
2
  max-width: 480px;
3
  /* We need to override the margin top here to simulate the layout of
4
  the mini cart contents on the front end. */
5
  margin: 0 auto !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ .wp-block-woocommerce-filled-mini-cart-contents-block > .block-editor-inner-blocks > .block-editor-block-list__layout {
8
  display: flex;
9
  flex-direction: column;
10
+ min-height: 100vh;
11
  }
 
12
 
13
+ .wp-block-woocommerce-mini-cart-items-block {
14
+ display: grid;
15
+ flex-grow: 1;
16
+ margin-bottom: $gap;
17
+ padding: 0 $gap;
18
+
19
+ > .block-editor-inner-blocks > .block-editor-block-list__layout {
20
+ display: flex;
21
+ flex-direction: column;
22
+ height: 100%;
23
+ }
24
+ }
25
 
26
+ .wp-block-woocommerce-mini-cart-products-table-block {
27
+ margin-bottom: auto;
28
+ margin-top: $gap;
29
+ }
30
+
31
+ h2.wc-block-mini-cart__title {
32
+ @include font-size(larger);
33
+ margin: $gap-largest $gap 0;
34
+ }
35
+
36
+ table.wc-block-cart-items {
37
+ color: inherit;
38
+ }
39
+
40
+ .block-editor-button-block-appender {
41
+ box-shadow: inset 0 0 0 1px;
42
+ color: inherit;
43
+ }
44
  }
assets/js/blocks/cart-checkout/mini-cart-contents/index.tsx CHANGED
@@ -36,7 +36,7 @@ const settings = {
36
  reusable: false,
37
  inserter: false,
38
  color: {
39
- text: false,
40
  },
41
  },
42
  attributes: {
36
  reusable: false,
37
  inserter: false,
38
  color: {
39
+ link: true,
40
  },
41
  },
42
  attributes: {
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/allowed-blocks.ts ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { getBlockTypes } from '@wordpress/blocks';
5
+
6
+ const EXCLUDED_BLOCKS: readonly string[] = [
7
+ 'woocommerce/mini-cart',
8
+ 'woocommerce/checkout',
9
+ 'woocommerce/cart',
10
+ 'woocommerce/single-product',
11
+ 'woocommerce/cart-totals-block',
12
+ 'woocommerce/checkout-fields-block',
13
+ 'core/post-template',
14
+ 'core/comment-template',
15
+ 'core/query-pagination',
16
+ 'core/comments-query-loop',
17
+ 'core/post-comments-form',
18
+ 'core/post-comments-link',
19
+ 'core/post-comments-count',
20
+ 'core/comments-pagination',
21
+ 'core/post-navigation-link',
22
+ ];
23
+
24
+ export const getMiniCartAllowedBlocks = (): string[] =>
25
+ getBlockTypes()
26
+ .filter( ( block ) => {
27
+ if ( EXCLUDED_BLOCKS.includes( block.name ) ) {
28
+ return false;
29
+ }
30
+
31
+ // Exclude child blocks of EXCLUDED_BLOCKS.
32
+ if (
33
+ block.parent &&
34
+ block.parent.filter( ( value ) =>
35
+ EXCLUDED_BLOCKS.includes( value )
36
+ ).length > 0
37
+ ) {
38
+ return false;
39
+ }
40
+
41
+ return true;
42
+ } )
43
+ .map( ( { name } ) => name );
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx CHANGED
@@ -3,48 +3,15 @@
3
  */
4
  import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
5
  import { useEditorContext } from '@woocommerce/base-context';
6
- import { getBlockTypes } from '@wordpress/blocks';
7
 
8
  /**
9
  * Internal dependencies
10
  */
11
-
12
- const EXCLUDED_BLOCKS: readonly string[] = [
13
- 'woocommerce/mini-cart',
14
- 'woocommerce/single-product',
15
- 'core/post-template',
16
- 'core/comment-template',
17
- 'core/query-pagination',
18
- 'core/comments-query-loop',
19
- 'core/post-comments-form',
20
- 'core/post-comments-link',
21
- 'core/post-comments-count',
22
- 'core/comments-pagination',
23
- 'core/post-navigation-link',
24
- ];
25
 
26
  export const Edit = (): JSX.Element => {
27
  const blockProps = useBlockProps();
28
  const { currentView } = useEditorContext();
29
- const allowedBlocks = getBlockTypes()
30
- .filter( ( block ) => {
31
- if ( EXCLUDED_BLOCKS.includes( block.name ) ) {
32
- return false;
33
- }
34
-
35
- // Exclude child blocks of EXCLUDED_BLOCKS.
36
- if (
37
- block.parent &&
38
- block.parent.filter( ( value ) =>
39
- EXCLUDED_BLOCKS.includes( value )
40
- ).length > 0
41
- ) {
42
- return false;
43
- }
44
-
45
- return true;
46
- } )
47
- .map( ( { name } ) => name );
48
 
49
  return (
50
  <div
@@ -54,7 +21,7 @@ export const Edit = (): JSX.Element => {
54
  }
55
  >
56
  <InnerBlocks
57
- allowedBlocks={ allowedBlocks }
58
  renderAppender={ InnerBlocks.ButtonBlockAppender }
59
  />
60
  </div>
3
  */
4
  import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
5
  import { useEditorContext } from '@woocommerce/base-context';
 
6
 
7
  /**
8
  * Internal dependencies
9
  */
10
+ import { getMiniCartAllowedBlocks } from '../allowed-blocks';
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  export const Edit = (): JSX.Element => {
13
  const blockProps = useBlockProps();
14
  const { currentView } = useEditorContext();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  return (
17
  <div
21
  }
22
  >
23
  <InnerBlocks
24
+ allowedBlocks={ getMiniCartAllowedBlocks() }
25
  renderAppender={ InnerBlocks.ButtonBlockAppender }
26
  />
27
  </div>
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx CHANGED
@@ -14,7 +14,7 @@ import { useForcedLayout, getAllowedBlocks } from '../../../shared';
14
 
15
  export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {
16
  const blockProps = useBlockProps();
17
- const allowedBlocks = getAllowedBlocks( innerBlockAreas.EMPTY_MINI_CART );
18
  const { currentView } = useEditorContext();
19
 
20
  const defaultTemplate = ( [
14
 
15
  export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {
16
  const blockProps = useBlockProps();
17
+ const allowedBlocks = getAllowedBlocks( innerBlockAreas.FILLED_MINI_CART );
18
  const { currentView } = useEditorContext();
19
 
20
  const defaultTemplate = ( [
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx CHANGED
@@ -24,7 +24,12 @@ const PaymentMethodIconsElement = (): JSX.Element => {
24
  );
25
  };
26
 
27
- const Block = (): JSX.Element => {
 
 
 
 
 
28
  const { cartTotals } = useStoreCart();
29
  const subTotal = getSetting( 'displayCartPricesIncludingTax', false )
30
  ? parseInt( cartTotals.total_items, 10 ) +
@@ -47,6 +52,10 @@ const Block = (): JSX.Element => {
47
  <Button
48
  className="wc-block-mini-cart__footer-cart"
49
  href={ CART_URL }
 
 
 
 
50
  >
51
  { __( 'View my cart', 'woo-gutenberg-products-block' ) }
52
  </Button>
@@ -55,6 +64,11 @@ const Block = (): JSX.Element => {
55
  <Button
56
  className="wc-block-mini-cart__footer-checkout"
57
  href={ CHECKOUT_URL }
 
 
 
 
 
58
  >
59
  { __(
60
  'Go to checkout',
24
  );
25
  };
26
 
27
+ interface Props {
28
+ color?: string;
29
+ backgroundColor?: string;
30
+ }
31
+
32
+ const Block = ( { color, backgroundColor }: Props ): JSX.Element => {
33
  const { cartTotals } = useStoreCart();
34
  const subTotal = getSetting( 'displayCartPricesIncludingTax', false )
35
  ? parseInt( cartTotals.total_items, 10 ) +
52
  <Button
53
  className="wc-block-mini-cart__footer-cart"
54
  href={ CART_URL }
55
+ style={ {
56
+ color,
57
+ borderColor: color,
58
+ } }
59
  >
60
  { __( 'View my cart', 'woo-gutenberg-products-block' ) }
61
  </Button>
64
  <Button
65
  className="wc-block-mini-cart__footer-checkout"
66
  href={ CHECKOUT_URL }
67
+ style={ {
68
+ color: backgroundColor,
69
+ borderColor: color,
70
+ backgroundColor: color,
71
+ } }
72
  >
73
  { __(
74
  'Go to checkout',
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx CHANGED
@@ -3,19 +3,40 @@
3
  */
4
  import { useBlockProps } from '@wordpress/block-editor';
5
  import Noninteractive from '@woocommerce/base-components/noninteractive';
 
6
 
7
  /**
8
  * Internal dependencies
9
  */
10
  import Block from './block';
 
 
11
 
12
- export const Edit = (): JSX.Element => {
13
  const blockProps = useBlockProps();
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  return (
16
  <div { ...blockProps }>
17
  <Noninteractive>
18
- <Block />
19
  </Noninteractive>
20
  </div>
21
  );
3
  */
4
  import { useBlockProps } from '@wordpress/block-editor';
5
  import Noninteractive from '@woocommerce/base-components/noninteractive';
6
+ import { useSelect } from '@wordpress/data';
7
 
8
  /**
9
  * Internal dependencies
10
  */
11
  import Block from './block';
12
+ import { blockName as miniCartContentsBlockName } from '../../attributes';
13
+ import { useColorProps } from '../../../../../hooks/style-attributes';
14
 
15
+ export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => {
16
  const blockProps = useBlockProps();
17
 
18
+ const parentAttributes = useSelect( ( select ) => {
19
+ const { getBlockAttributes, getBlockParentsByBlockName } = select(
20
+ 'core/block-editor'
21
+ );
22
+ const parentBlockIds = getBlockParentsByBlockName(
23
+ clientId,
24
+ miniCartContentsBlockName
25
+ );
26
+
27
+ if ( parentBlockIds.length !== 1 ) {
28
+ return {};
29
+ }
30
+
31
+ return getBlockAttributes( parentBlockIds[ 0 ] );
32
+ } );
33
+
34
+ const parentColorProps = useColorProps( parentAttributes );
35
+
36
  return (
37
  <div { ...blockProps }>
38
  <Noninteractive>
39
+ <Block { ...parentColorProps.style } />
40
  </Noninteractive>
41
  </div>
42
  );
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx CHANGED
@@ -7,6 +7,7 @@ import type { TemplateArray } from '@wordpress/blocks';
7
  /**
8
  * Internal dependencies
9
  */
 
10
 
11
  export const Edit = (): JSX.Element => {
12
  const blockProps = useBlockProps();
@@ -21,6 +22,7 @@ export const Edit = (): JSX.Element => {
21
  template={ defaultTemplate }
22
  renderAppender={ InnerBlocks.ButtonBlockAppender }
23
  templateLock={ false }
 
24
  />
25
  </div>
26
  );
7
  /**
8
  * Internal dependencies
9
  */
10
+ import { getMiniCartAllowedBlocks } from '../allowed-blocks';
11
 
12
  export const Edit = (): JSX.Element => {
13
  const blockProps = useBlockProps();
22
  template={ defaultTemplate }
23
  renderAppender={ InnerBlocks.ButtonBlockAppender }
24
  templateLock={ false }
25
+ allowedBlocks={ getMiniCartAllowedBlocks() }
26
  />
27
  </div>
28
  );
assets/js/blocks/cart-checkout/mini-cart/style.scss CHANGED
@@ -62,24 +62,13 @@
62
  position: absolute;
63
  top: $gap-largest;
64
  right: $gap;
65
- }
66
 
67
- .wc-block-mini-cart__items {
68
- display: flex;
69
- flex-direction: column;
70
- flex-grow: 1;
71
- overflow-y: hidden;
72
- padding: 0 $gap;
73
- }
74
-
75
- .wc-block-mini-cart__products-table {
76
- margin-bottom: auto;
77
- margin-right: -$gap;
78
- overflow-y: auto;
79
- padding-right: $gap;
80
 
81
- .wc-block-cart-items__row:last-child::after {
82
- content: none;
83
  }
84
  }
85
  }
@@ -100,50 +89,69 @@ h2.wc-block-mini-cart__title {
100
  margin: $gap-largest $gap 0;
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  .wc-block-mini-cart__footer {
104
  border-top: 1px solid $gray-300;
105
  padding: $gap-large $gap;
106
- }
107
 
108
- .wc-block-components-totals-item.wc-block-mini-cart__footer-subtotal {
109
- font-weight: 600;
110
- margin-bottom: $gap;
111
 
112
- .wc-block-components-totals-item__description {
113
- display: none;
114
- font-size: 0.75em;
115
- font-weight: 400;
116
 
117
- @media only screen and (min-width: 480px) {
118
- display: unset;
 
119
  }
120
  }
121
- }
122
 
123
- .wc-block-mini-cart__footer-actions {
124
- display: flex;
125
- gap: $gap;
126
-
127
- .wc-block-mini-cart__footer-cart.wc-block-components-button {
128
- background-color: transparent;
129
- border: 1px solid $gray-900;
130
- color: $gray-900;
131
- display: none;
132
- flex-grow: 1;
133
- font-weight: 600;
 
 
 
 
 
134
 
135
- @media only screen and (min-width: 480px) {
136
- display: inline-flex;
 
 
137
  }
138
  }
139
 
140
- .wc-block-mini-cart__footer-checkout {
141
- border: 1px solid $gray-900;
142
- flex-grow: 1;
143
- font-weight: 600;
144
  }
145
  }
146
-
147
- .wc-block-mini-cart__footer .wc-block-components-payment-method-icons {
148
- margin-top: $gap;
149
- }
62
  position: absolute;
63
  top: $gap-largest;
64
  right: $gap;
 
65
 
66
+ button {
67
+ color: inherit;
68
+ }
 
 
 
 
 
 
 
 
 
 
69
 
70
+ svg {
71
+ fill: currentColor;
72
  }
73
  }
74
  }
89
  margin: $gap-largest $gap 0;
90
  }
91
 
92
+ .wc-block-mini-cart__items {
93
+ display: flex;
94
+ flex-direction: column;
95
+ flex-grow: 1;
96
+ overflow-y: hidden;
97
+ padding: 0 $gap;
98
+
99
+ .wc-block-mini-cart__products-table {
100
+ margin-bottom: auto;
101
+ margin-right: -$gap;
102
+ overflow-y: auto;
103
+ padding-right: $gap;
104
+
105
+ .wc-block-cart-items__row:last-child::after {
106
+ content: none;
107
+ }
108
+ }
109
+ }
110
+
111
  .wc-block-mini-cart__footer {
112
  border-top: 1px solid $gray-300;
113
  padding: $gap-large $gap;
 
114
 
115
+ .wc-block-components-totals-item.wc-block-mini-cart__footer-subtotal {
116
+ font-weight: 600;
117
+ margin-bottom: $gap;
118
 
119
+ .wc-block-components-totals-item__description {
120
+ display: none;
121
+ font-size: 0.75em;
122
+ font-weight: 400;
123
 
124
+ @media only screen and (min-width: 480px) {
125
+ display: unset;
126
+ }
127
  }
128
  }
 
129
 
130
+ .wc-block-mini-cart__footer-actions {
131
+ display: flex;
132
+ gap: $gap;
133
+
134
+ .wc-block-mini-cart__footer-cart.wc-block-components-button {
135
+ background-color: transparent;
136
+ border: 1px solid $gray-900;
137
+ color: $gray-900;
138
+ display: none;
139
+ flex-grow: 1;
140
+ font-weight: 600;
141
+
142
+ @media only screen and (min-width: 480px) {
143
+ display: inline-flex;
144
+ }
145
+ }
146
 
147
+ .wc-block-mini-cart__footer-checkout {
148
+ border: 1px solid $gray-900;
149
+ flex-grow: 1;
150
+ font-weight: 600;
151
  }
152
  }
153
 
154
+ .wc-block-components-payment-method-icons {
155
+ margin-top: $gap;
 
 
156
  }
157
  }
 
 
 
 
assets/js/blocks/cart-checkout/mini-cart/test/block.js CHANGED
@@ -5,7 +5,6 @@ import {
5
  act,
6
  render,
7
  screen,
8
- fireEvent,
9
  waitFor,
10
  waitForElementToBeRemoved,
11
  } from '@testing-library/react';
@@ -14,6 +13,7 @@ import { dispatch } from '@wordpress/data';
14
  import { CART_STORE_KEY as storeKey } from '@woocommerce/block-data';
15
  import { SlotFillProvider } from '@woocommerce/blocks-checkout';
16
  import { default as fetchMock } from 'jest-fetch-mock';
 
17
 
18
  /**
19
  * Internal dependencies
@@ -68,7 +68,7 @@ describe( 'Testing Mini Cart', () => {
68
  render( <MiniCartBlock /> );
69
  await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
70
  act( () => {
71
- fireEvent.click( screen.getByLabelText( /items/i ) );
72
  } );
73
 
74
  expect( fetchMock ).toHaveBeenCalledTimes( 1 );
@@ -82,7 +82,7 @@ describe( 'Testing Mini Cart', () => {
82
 
83
  await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
84
  act( () => {
85
- fireEvent.click( screen.getByLabelText( /items/i ) );
86
  } );
87
 
88
  expect( fetchMock ).toHaveBeenCalledTimes( 1 );
5
  act,
6
  render,
7
  screen,
 
8
  waitFor,
9
  waitForElementToBeRemoved,
10
  } from '@testing-library/react';
13
  import { CART_STORE_KEY as storeKey } from '@woocommerce/block-data';
14
  import { SlotFillProvider } from '@woocommerce/blocks-checkout';
15
  import { default as fetchMock } from 'jest-fetch-mock';
16
+ import userEvent from '@testing-library/user-event';
17
 
18
  /**
19
  * Internal dependencies
68
  render( <MiniCartBlock /> );
69
  await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
70
  act( () => {
71
+ userEvent.click( screen.getByLabelText( /items/i ) );
72
  } );
73
 
74
  expect( fetchMock ).toHaveBeenCalledTimes( 1 );
82
 
83
  await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
84
  act( () => {
85
+ userEvent.click( screen.getByLabelText( /items/i ) );
86
  } );
87
 
88
  expect( fetchMock ).toHaveBeenCalledTimes( 1 );
assets/js/blocks/cart-checkout/payment-methods/express-payment/style.scss CHANGED
@@ -91,6 +91,11 @@ $border-radius: 5px;
91
  width: 50%;
92
  }
93
 
 
 
 
 
 
94
  > li:nth-child(even) {
95
  padding-left: $gap-smaller;
96
  }
91
  width: 50%;
92
  }
93
 
94
+ > li:only-child {
95
+ display: block;
96
+ width: 100%;
97
+ }
98
+
99
  > li:nth-child(even) {
100
  padding-left: $gap-smaller;
101
  }
assets/js/blocks/cart-checkout/payment-methods/test/payment-methods.js CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * External dependencies
3
  */
4
- import { render, screen, fireEvent, waitFor } from '@testing-library/react';
5
  import { previewCart } from '@woocommerce/resource-previews';
6
  import { dispatch } from '@wordpress/data';
7
  import { CART_STORE_KEY as storeKey } from '@woocommerce/block-data';
@@ -14,7 +14,7 @@ import {
14
  PaymentMethodDataProvider,
15
  usePaymentMethodDataContext,
16
  } from '@woocommerce/base-context';
17
-
18
  /**
19
  * Internal dependencies
20
  */
@@ -142,7 +142,7 @@ describe( 'PaymentMethods', () => {
142
  expect( savedToken ).toBeNull();
143
  } );
144
 
145
- fireEvent.click( screen.getByText( 'Select new payment' ) );
146
 
147
  await waitFor( () => {
148
  const activePaymentMethod = screen.queryByText(
1
  /**
2
  * External dependencies
3
  */
4
+ import { render, screen, waitFor } from '@testing-library/react';
5
  import { previewCart } from '@woocommerce/resource-previews';
6
  import { dispatch } from '@wordpress/data';
7
  import { CART_STORE_KEY as storeKey } from '@woocommerce/block-data';
14
  PaymentMethodDataProvider,
15
  usePaymentMethodDataContext,
16
  } from '@woocommerce/base-context';
17
+ import userEvent from '@testing-library/user-event';
18
  /**
19
  * Internal dependencies
20
  */
142
  expect( savedToken ).toBeNull();
143
  } );
144
 
145
+ userEvent.click( screen.getByText( 'Select new payment' ) );
146
 
147
  await waitFor( () => {
148
  const activePaymentMethod = screen.queryByText(
assets/js/blocks/{cart-checkout/checkout → checkout}/attributes.ts RENAMED
@@ -5,40 +5,20 @@ import { getSetting } from '@woocommerce/settings';
5
 
6
  export const blockName = 'woocommerce/checkout';
7
  export const blockAttributes = {
8
- isPreview: {
9
- type: 'boolean',
10
- default: false,
11
- save: false,
12
- },
13
  hasDarkControls: {
14
  type: 'boolean',
15
  default: getSetting( 'hasDarkEditorStyleSupport', false ),
16
  },
17
- showCompanyField: {
18
- type: 'boolean',
19
- default: false,
20
- },
21
- requireCompanyField: {
22
- type: 'boolean',
23
- default: false,
24
- },
25
- allowCreateAccount: {
26
- type: 'boolean',
27
- default: false,
28
- },
29
- showApartmentField: {
30
- type: 'boolean',
31
- default: true,
32
- },
33
- showPhoneField: {
34
- type: 'boolean',
35
- default: true,
36
- },
37
- requirePhoneField: {
38
  type: 'boolean',
39
- default: false,
40
  },
41
- // Deprecated - here for v1 migration support
 
 
 
 
 
42
  showOrderNotes: {
43
  type: 'boolean',
44
  default: true,
@@ -55,8 +35,4 @@ export const blockAttributes = {
55
  type: 'number',
56
  default: 0,
57
  },
58
- showRateAfterTaxName: {
59
- type: 'boolean',
60
- default: getSetting( 'displayCartPricesIncludingTax', false ),
61
- },
62
  };
5
 
6
  export const blockName = 'woocommerce/checkout';
7
  export const blockAttributes = {
 
 
 
 
 
8
  hasDarkControls: {
9
  type: 'boolean',
10
  default: getSetting( 'hasDarkEditorStyleSupport', false ),
11
  },
12
+ showRateAfterTaxName: {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  type: 'boolean',
14
+ default: getSetting( 'displayCartPricesIncludingTax', false ),
15
  },
16
+ };
17
+
18
+ /**
19
+ * @deprecated here for v1 migration support
20
+ */
21
+ export const deprecatedAttributes = {
22
  showOrderNotes: {
23
  type: 'boolean',
24
  default: true,
35
  type: 'number',
36
  default: 0,
37
  },
 
 
 
 
38
  };
assets/js/blocks/checkout/block.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "woocommerce/checkout",
3
+ "version": "1.0.0",
4
+ "title": "Checkout",
5
+ "description": "Display a checkout form so your customers can submit orders.",
6
+ "category": "woocommerce",
7
+ "keywords": [ "WooCommerce" ],
8
+ "supports": {
9
+ "align": [ "wide" ],
10
+ "html": false,
11
+ "multiple": false
12
+ },
13
+ "attributes": {
14
+ "isPreview": {
15
+ "type": "boolean",
16
+ "default": false,
17
+ "save": false
18
+ },
19
+ "showCompanyField": {
20
+ "type": "boolean",
21
+ "default": false
22
+ },
23
+ "requireCompanyField": {
24
+ "type": "boolean",
25
+ "default": false
26
+ },
27
+ "allowCreateAccount": {
28
+ "type": "boolean",
29
+ "default": false
30
+ },
31
+ "showApartmentField": {
32
+ "type": "boolean",
33
+ "default": true
34
+ },
35
+ "showPhoneField": {
36
+ "type": "boolean",
37
+ "default": true
38
+ },
39
+ "requirePhoneField": {
40
+ "type": "boolean",
41
+ "default": false
42
+ }
43
+ },
44
+ "textdomain": "woo-gutenberg-products-block",
45
+ "apiVersion": 2
46
+ }
assets/js/blocks/{cart-checkout/checkout → checkout}/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/checkout-order-error/constants.js RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/checkout-order-error/index.js RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/checkout-order-error/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/context.ts RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/edit.tsx RENAMED
@@ -35,7 +35,10 @@ import type { TemplateArray } from '@wordpress/blocks';
35
  * Internal dependencies
36
  */
37
  import './styles/editor.scss';
38
- import { addClassToBody, useBlockPropsWithLocking } from '../shared';
 
 
 
39
  import { CheckoutBlockContext, CheckoutBlockControlsContext } from './context';
40
  import type { Attributes } from './types';
41
 
35
  * Internal dependencies
36
  */
37
  import './styles/editor.scss';
38
+ import {
39
+ addClassToBody,
40
+ useBlockPropsWithLocking,
41
+ } from '../cart-checkout/shared';
42
  import { CheckoutBlockContext, CheckoutBlockControlsContext } from './context';
43
  import type { Attributes } from './types';
44
 
assets/js/blocks/{cart-checkout/checkout → checkout}/empty-cart/index.js RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/empty-cart/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/additional-fields.tsx RENAMED
@@ -7,7 +7,7 @@ import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
7
  * Internal dependencies
8
  */
9
  import './editor.scss';
10
- import { useForcedLayout, getAllowedBlocks } from '../../shared';
11
 
12
  export const AdditionalFields = ( {
13
  block,
7
  * Internal dependencies
8
  */
9
  import './editor.scss';
10
+ import { useForcedLayout, getAllowedBlocks } from '../../cart-checkout/shared';
11
 
12
  export const AdditionalFields = ( {
13
  block,
assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/attributes.ts RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/editor.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/form-step-block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/form-step-heading.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/form-step/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/index.tsx RENAMED
@@ -1,7 +1,6 @@
1
  /**
2
  * External dependencies
3
  */
4
- import { __ } from '@wordpress/i18n';
5
  import classnames from 'classnames';
6
  import { Icon, fields } from '@woocommerce/icons';
7
  import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
@@ -11,11 +10,11 @@ import { BlockInstance, createBlock } from '@wordpress/blocks';
11
  * Internal dependencies
12
  */
13
  import { Edit, Save } from './edit';
14
- import { blockName, blockAttributes } from './attributes';
15
  import './inner-blocks';
 
16
 
17
  const settings = {
18
- title: __( 'Checkout', 'woo-gutenberg-products-block' ),
19
  icon: {
20
  src: (
21
  <Icon
@@ -24,25 +23,21 @@ const settings = {
24
  />
25
  ),
26
  },
27
- category: 'woocommerce',
28
- keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
29
- description: __(
30
- 'Display a checkout form so your customers can submit orders.',
31
- 'woo-gutenberg-products-block'
32
- ),
33
- supports: {
34
- align: [ 'wide' ],
35
- html: false,
36
- multiple: false,
37
  },
38
- attributes: blockAttributes,
39
- apiVersion: 2,
40
  edit: Edit,
41
  save: Save,
42
  // Migrates v1 to v2 checkout.
43
  deprecated: [
44
  {
45
- attributes: blockAttributes,
 
 
 
 
46
  save( { attributes }: { attributes: { className: string } } ) {
47
  return (
48
  <div
@@ -143,4 +138,4 @@ const settings = {
143
  ],
144
  };
145
 
146
- registerFeaturePluginBlockType( blockName, settings );
1
  /**
2
  * External dependencies
3
  */
 
4
  import classnames from 'classnames';
5
  import { Icon, fields } from '@woocommerce/icons';
6
  import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
10
  * Internal dependencies
11
  */
12
  import { Edit, Save } from './edit';
13
+ import { blockAttributes, deprecatedAttributes } from './attributes';
14
  import './inner-blocks';
15
+ import metadata from './block.json';
16
 
17
  const settings = {
 
18
  icon: {
19
  src: (
20
  <Icon
23
  />
24
  ),
25
  },
26
+ attributes: {
27
+ ...metadata.attributes,
28
+ ...blockAttributes,
29
+ ...deprecatedAttributes,
 
 
 
 
 
 
30
  },
 
 
31
  edit: Edit,
32
  save: Save,
33
  // Migrates v1 to v2 checkout.
34
  deprecated: [
35
  {
36
+ attributes: {
37
+ ...metadata.attributes,
38
+ ...blockAttributes,
39
+ ...deprecatedAttributes,
40
+ },
41
  save( { attributes }: { attributes: { className: string } } ) {
42
  return (
43
  <div
138
  ],
139
  };
140
 
141
+ registerFeaturePluginBlockType( metadata, settings );
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/attributes.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-actions-block/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/attributes.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-billing-address-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/attributes.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-contact-information-block/login-prompt.js RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/block.tsx RENAMED
@@ -6,7 +6,7 @@ import { useStoreCart } from '@woocommerce/base-context/hooks';
6
  /**
7
  * Internal dependencies
8
  */
9
- import { CheckoutExpressPayment } from '../../../payment-methods';
10
 
11
  const Block = ( { className }: { className?: string } ): JSX.Element | null => {
12
  const { cartNeedsPayment } = useStoreCart();
6
  /**
7
  * Internal dependencies
8
  */
9
+ import { CheckoutExpressPayment } from '../../../cart-checkout/payment-methods';
10
 
11
  const Block = ( { className }: { className?: string } ): JSX.Element | null => {
12
  const { cartNeedsPayment } = useStoreCart();
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/editor.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-express-payment-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/edit.tsx RENAMED
@@ -11,7 +11,10 @@ import type { TemplateArray } from '@wordpress/blocks';
11
  * Internal dependencies
12
  */
13
  import { useCheckoutBlockControlsContext } from '../../context';
14
- import { useForcedLayout, getAllowedBlocks } from '../../../shared';
 
 
 
15
  import './style.scss';
16
 
17
  export const Edit = ( {
11
  * Internal dependencies
12
  */
13
  import { useCheckoutBlockControlsContext } from '../../context';
14
+ import {
15
+ useForcedLayout,
16
+ getAllowedBlocks,
17
+ } from '../../../cart-checkout/shared';
18
  import './style.scss';
19
 
20
  export const Edit = ( {
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-fields-block/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/editor.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-note-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/attributes.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-order-summary-block/index.tsx RENAMED
File without changes
assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/test/block.js ADDED
@@ -0,0 +1,494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ render,
6
+ findByText,
7
+ screen,
8
+ queryByText,
9
+ } from '@testing-library/react';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { previewCart as mockPreviewCart } from '../../../../../previews/cart';
15
+ import Block from '../block';
16
+ import {
17
+ textContentMatcher,
18
+ textContentMatcherAcrossSiblings,
19
+ } from '../../../../../../../tests/utils/find-by-text';
20
+ const baseContextHooks = jest.requireMock( '@woocommerce/base-context/hooks' );
21
+ const baseContext = jest.requireMock( '@woocommerce/base-context' );
22
+ const woocommerceSettings = jest.requireMock( '@woocommerce/settings' );
23
+
24
+ const defaultUseStoreCartValue = {
25
+ cartItems: mockPreviewCart.items,
26
+ cartTotals: mockPreviewCart.totals,
27
+ cartCoupons: mockPreviewCart.coupons,
28
+ cartFees: mockPreviewCart.fees,
29
+ needsShipping: mockPreviewCart.needs_shipping,
30
+ shippingRates: mockPreviewCart.shipping_rates,
31
+ shippingAddress: mockPreviewCart.shipping_address,
32
+ billingAddress: mockPreviewCart.billing_address,
33
+ cartHasCalculatedShipping: mockPreviewCart.has_calculated_shipping,
34
+ };
35
+
36
+ jest.mock( '@woocommerce/base-context/hooks', () => ( {
37
+ ...jest.requireActual( '@woocommerce/base-context/hooks' ),
38
+
39
+ /*
40
+ We need to redefine this here despite the defaultUseStoreCartValue above
41
+ because jest doesn't like to set up mocks with out of scope variables
42
+ */
43
+ useStoreCart: jest.fn().mockReturnValue( {
44
+ cartItems: mockPreviewCart.items,
45
+ cartTotals: mockPreviewCart.totals,
46
+ cartCoupons: mockPreviewCart.coupons,
47
+ cartFees: mockPreviewCart.fees,
48
+ needsShipping: mockPreviewCart.needs_shipping,
49
+ shippingRates: mockPreviewCart.shipping_rates,
50
+ shippingAddress: mockPreviewCart.shipping_address,
51
+ billingAddress: mockPreviewCart.billing_address,
52
+ cartHasCalculatedShipping: mockPreviewCart.has_calculated_shipping,
53
+ } ),
54
+ } ) );
55
+
56
+ jest.mock( '@woocommerce/base-context', () => ( {
57
+ ...jest.requireActual( '@woocommerce/base-context' ),
58
+ useContainerWidthContext: jest.fn().mockReturnValue( {
59
+ hasContainerWidth: true,
60
+ isLarge: true,
61
+ } ),
62
+ useShippingDataContext: jest.fn().mockReturnValue( {
63
+ needsShipping: true,
64
+ shippingRates: [
65
+ {
66
+ package_id: 0,
67
+ name: 'Shipping method',
68
+ destination: {
69
+ address_1: '',
70
+ address_2: '',
71
+ city: '',
72
+ state: '',
73
+ postcode: '',
74
+ country: '',
75
+ },
76
+ items: [
77
+ {
78
+ key: 'fb0c0a746719a7596f296344b80cb2b6',
79
+ name: 'Hoodie - Blue, Yes',
80
+ quantity: 1,
81
+ },
82
+ {
83
+ key: '1f0e3dad99908345f7439f8ffabdffc4',
84
+ name: 'Beanie',
85
+ quantity: 1,
86
+ },
87
+ ],
88
+ shipping_rates: [
89
+ {
90
+ rate_id: 'flat_rate:1',
91
+ name: 'Flat rate',
92
+ description: '',
93
+ delivery_time: '',
94
+ price: '500',
95
+ taxes: '0',
96
+ instance_id: 1,
97
+ method_id: 'flat_rate',
98
+ meta_data: [
99
+ {
100
+ key: 'Items',
101
+ value:
102
+ 'Hoodie - Blue, Yes &times; 1, Beanie &times; 1',
103
+ },
104
+ ],
105
+ selected: false,
106
+ currency_code: 'USD',
107
+ currency_symbol: '$',
108
+ currency_minor_unit: 2,
109
+ currency_decimal_separator: '.',
110
+ currency_thousand_separator: ',',
111
+ currency_prefix: '$',
112
+ currency_suffix: '',
113
+ },
114
+ {
115
+ rate_id: 'local_pickup:2',
116
+ name: 'Local pickup',
117
+ description: '',
118
+ delivery_time: '',
119
+ price: '0',
120
+ taxes: '0',
121
+ instance_id: 2,
122
+ method_id: 'local_pickup',
123
+ meta_data: [
124
+ {
125
+ key: 'Items',
126
+ value:
127
+ 'Hoodie - Blue, Yes &times; 1, Beanie &times; 1',
128
+ },
129
+ ],
130
+ selected: false,
131
+ currency_code: 'USD',
132
+ currency_symbol: '$',
133
+ currency_minor_unit: 2,
134
+ currency_decimal_separator: '.',
135
+ currency_thousand_separator: ',',
136
+ currency_prefix: '$',
137
+ currency_suffix: '',
138
+ },
139
+ {
140
+ rate_id: 'free_shipping:5',
141
+ name: 'Free shipping',
142
+ description: '',
143
+ delivery_time: '',
144
+ price: '0',
145
+ taxes: '0',
146
+ instance_id: 5,
147
+ method_id: 'free_shipping',
148
+ meta_data: [
149
+ {
150
+ key: 'Items',
151
+ value:
152
+ 'Hoodie - Blue, Yes &times; 1, Beanie &times; 1',
153
+ },
154
+ ],
155
+ selected: true,
156
+ currency_code: 'USD',
157
+ currency_symbol: '$',
158
+ currency_minor_unit: 2,
159
+ currency_decimal_separator: '.',
160
+ currency_thousand_separator: ',',
161
+ currency_prefix: '$',
162
+ currency_suffix: '',
163
+ },
164
+ ],
165
+ },
166
+ ],
167
+ } ),
168
+ } ) );
169
+
170
+ jest.mock( '@woocommerce/settings', () => {
171
+ const originalModule = jest.requireActual( '@woocommerce/settings' );
172
+
173
+ return {
174
+ ...originalModule,
175
+ getSetting: jest.fn().mockImplementation( ( setting, ...rest ) => {
176
+ if ( setting === 'couponsEnabled' ) {
177
+ return true;
178
+ }
179
+ return originalModule.getSetting( setting, ...rest );
180
+ } ),
181
+ };
182
+ } );
183
+
184
+ const setUseStoreCartReturnValue = ( value = defaultUseStoreCartValue ) => {
185
+ baseContextHooks.useStoreCart.mockReturnValue( value );
186
+ };
187
+
188
+ const setGetSettingImplementation = ( implementation ) => {
189
+ woocommerceSettings.getSetting.mockImplementation( implementation );
190
+ };
191
+
192
+ const setUseShippingDataContextReturnValue = ( value ) => {
193
+ baseContext.useShippingDataContext.mockReturnValue( value );
194
+ };
195
+
196
+ describe( 'Checkout Order Summary', () => {
197
+ beforeEach( () => setUseStoreCartReturnValue() );
198
+
199
+ it( 'Renders the standard preview items in the sidebar', async () => {
200
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
201
+ expect(
202
+ await findByText( container, 'Warm hat for winter' )
203
+ ).toBeInTheDocument();
204
+ expect(
205
+ await findByText( container, 'Lightweight baseball cap' )
206
+ ).toBeInTheDocument();
207
+
208
+ // Checking if variable product is rendered.
209
+ expect(
210
+ await screen.findByText( textContentMatcher( 'Color: Yellow' ) )
211
+ ).toBeInTheDocument();
212
+ expect(
213
+ await screen.findByText( textContentMatcher( 'Size: Small' ) )
214
+ ).toBeInTheDocument();
215
+ } );
216
+
217
+ it( 'Renders the items subtotal correctly', async () => {
218
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
219
+
220
+ expect(
221
+ await findByText(
222
+ container,
223
+ textContentMatcherAcrossSiblings( 'Subtotal $40.00' )
224
+ )
225
+ ).toBeInTheDocument();
226
+ } );
227
+
228
+ // The cart_totals value of useStoreCart is what drives this
229
+ it( 'If discounted items are in the cart the discount subtotal is shown correctly', async () => {
230
+ setUseStoreCartReturnValue( {
231
+ ...defaultUseStoreCartValue,
232
+ cartTotals: {
233
+ ...mockPreviewCart.totals,
234
+ total_discount: 1000,
235
+ total_price: 3800,
236
+ },
237
+ } );
238
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
239
+ expect(
240
+ await findByText(
241
+ container,
242
+ textContentMatcherAcrossSiblings( 'Discount -$10.00' )
243
+ )
244
+ ).toBeInTheDocument();
245
+ } );
246
+
247
+ it( 'If coupons are in the cart they are shown correctly', async () => {
248
+ setUseStoreCartReturnValue( {
249
+ ...defaultUseStoreCartValue,
250
+ cartTotals: {
251
+ ...mockPreviewCart.totals,
252
+ total_discount: 1000,
253
+ total_price: 3800,
254
+ },
255
+ cartCoupons: [
256
+ {
257
+ code: '10off',
258
+ discount_type: 'fixed_cart',
259
+ totals: {
260
+ total_discount: '1000',
261
+ total_discount_tax: '0',
262
+ currency_code: 'USD',
263
+ currency_symbol: '$',
264
+ currency_minor_unit: 2,
265
+ currency_decimal_separator: '.',
266
+ currency_thousand_separator: ',',
267
+ currency_prefix: '$',
268
+ currency_suffix: '',
269
+ },
270
+ label: '10off',
271
+ },
272
+ ],
273
+ } );
274
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
275
+ expect(
276
+ await findByText( container, 'Coupon: 10off' )
277
+ ).toBeInTheDocument();
278
+ } );
279
+
280
+ it( 'Shows fees if the cart_fees are set', async () => {
281
+ setUseStoreCartReturnValue( {
282
+ ...defaultUseStoreCartValue,
283
+ cartFees: [
284
+ {
285
+ totals: {
286
+ currency_code: 'USD',
287
+ currency_decimal_separator: '.',
288
+ currency_minor_unit: 2,
289
+ currency_prefix: '$',
290
+ currency_suffix: '',
291
+ currency_symbol: '$',
292
+ currency_thousand_separator: ',',
293
+ total: 1000,
294
+ total_tax: '0',
295
+ },
296
+ },
297
+ ],
298
+ } );
299
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
300
+ expect(
301
+ await findByText(
302
+ container,
303
+ textContentMatcherAcrossSiblings( 'Fee $10.00' )
304
+ )
305
+ ).toBeInTheDocument();
306
+ } );
307
+
308
+ it( 'Shows the coupon entry form when coupons are enabled', async () => {
309
+ setUseStoreCartReturnValue();
310
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
311
+ expect(
312
+ await findByText( container, 'Coupon code' )
313
+ ).toBeInTheDocument();
314
+ } );
315
+
316
+ it( 'Does not show the coupon entry if coupons are not enabled', () => {
317
+ setUseStoreCartReturnValue();
318
+ setGetSettingImplementation( ( setting, ...rest ) => {
319
+ if ( setting === 'couponsEnabled' ) {
320
+ return false;
321
+ }
322
+ const originalModule = jest.requireActual(
323
+ '@woocommerce/settings'
324
+ );
325
+ return originalModule.getSetting( setting, ...rest );
326
+ } );
327
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
328
+ expect(
329
+ queryByText( container, 'Coupon code' )
330
+ ).not.toBeInTheDocument();
331
+ } );
332
+
333
+ it( 'Does not show the shipping section if needsShipping is false on the cart', () => {
334
+ setUseStoreCartReturnValue( {
335
+ ...defaultUseStoreCartValue,
336
+ needsShipping: false,
337
+ } );
338
+ setUseShippingDataContextReturnValue( { needsShipping: false } );
339
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
340
+ expect( queryByText( container, 'Shipping' ) ).not.toBeInTheDocument();
341
+ } );
342
+
343
+ it( 'Does not show the taxes section if displayCartPricesIncludingTax is true', () => {
344
+ setUseStoreCartReturnValue( {
345
+ ...defaultUseStoreCartValue,
346
+ cartTotals: {
347
+ ...mockPreviewCart.totals,
348
+ total_tax: '1000',
349
+ tax_lines: [ { name: 'Tax', price: '1000', rate: '5%' } ],
350
+ },
351
+ } );
352
+ setUseShippingDataContextReturnValue( { needsShipping: false } );
353
+ setGetSettingImplementation( ( setting, ...rest ) => {
354
+ if ( setting === 'displayCartPricesIncludingTax' ) {
355
+ return true;
356
+ }
357
+ if ( setting === 'taxesEnabled' ) {
358
+ return true;
359
+ }
360
+ const originalModule = jest.requireActual(
361
+ '@woocommerce/settings'
362
+ );
363
+ return originalModule.getSetting( setting, ...rest );
364
+ } );
365
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
366
+
367
+ expect(
368
+ queryByText( container, 'Tax $10.00' )
369
+ ).not.toBeInTheDocument();
370
+ } );
371
+
372
+ it( 'Shows the taxes section if displayCartPricesIncludingTax is false and a tax total is set', async () => {
373
+ setUseStoreCartReturnValue( {
374
+ ...defaultUseStoreCartValue,
375
+ cartTotals: {
376
+ ...mockPreviewCart.totals,
377
+ total_tax: '1000',
378
+ tax_lines: [ { name: 'Tax', price: '1000', rate: '5%' } ],
379
+ },
380
+ } );
381
+ setUseShippingDataContextReturnValue( { needsShipping: false } );
382
+ setGetSettingImplementation( ( setting, ...rest ) => {
383
+ if ( setting === 'displayCartPricesIncludingTax' ) {
384
+ return false;
385
+ }
386
+ if ( setting === 'taxesEnabled' ) {
387
+ return true;
388
+ }
389
+ const originalModule = jest.requireActual(
390
+ '@woocommerce/settings'
391
+ );
392
+ return originalModule.getSetting( setting, ...rest );
393
+ } );
394
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
395
+ expect(
396
+ await findByText(
397
+ container,
398
+ textContentMatcherAcrossSiblings( 'Taxes $10.00' )
399
+ )
400
+ ).toBeInTheDocument();
401
+ } );
402
+
403
+ it( 'Shows the grand total correctly', async () => {
404
+ setUseStoreCartReturnValue( {
405
+ ...defaultUseStoreCartValue,
406
+ cartTotals: {
407
+ ...mockPreviewCart.totals,
408
+ },
409
+ } );
410
+ setUseShippingDataContextReturnValue( { needsShipping: false } );
411
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
412
+ expect(
413
+ await findByText(
414
+ container,
415
+ textContentMatcherAcrossSiblings( 'Total $48.00' )
416
+ )
417
+ ).toBeInTheDocument();
418
+ } );
419
+
420
+ it( 'Correctly shows the shipping section if the cart requires shipping', async () => {
421
+ setUseStoreCartReturnValue( {
422
+ ...defaultUseStoreCartValue,
423
+ cartTotals: {
424
+ ...defaultUseStoreCartValue.cartTotals,
425
+ total_shipping: '4000',
426
+ },
427
+ } );
428
+ setUseShippingDataContextReturnValue( {
429
+ needsShipping: true,
430
+ shippingRates: [
431
+ {
432
+ package_id: 0,
433
+ name: 'Shipping method',
434
+ destination: {
435
+ address_1: '',
436
+ address_2: '',
437
+ city: '',
438
+ state: '',
439
+ postcode: '',
440
+ country: '',
441
+ },
442
+ items: [
443
+ {
444
+ key: 'fb0c0a746719a7596f296344b80cb2b6',
445
+ name: 'Hoodie - Blue, Yes',
446
+ quantity: 1,
447
+ },
448
+ {
449
+ key: '1f0e3dad99908345f7439f8ffabdffc4',
450
+ name: 'Beanie',
451
+ quantity: 1,
452
+ },
453
+ ],
454
+ shipping_rates: [
455
+ {
456
+ rate_id: 'free_shipping:5',
457
+ name: 'Free shipping',
458
+ description: '',
459
+ delivery_time: '',
460
+ price: '4000',
461
+ taxes: '0',
462
+ instance_id: 5,
463
+ method_id: 'free_shipping',
464
+ meta_data: [
465
+ {
466
+ key: 'Items',
467
+ value:
468
+ 'Hoodie - Blue, Yes &times; 1, Beanie &times; 1',
469
+ },
470
+ ],
471
+ selected: true,
472
+ currency_code: 'USD',
473
+ currency_symbol: '$',
474
+ currency_minor_unit: 2,
475
+ currency_decimal_separator: '.',
476
+ currency_thousand_separator: ',',
477
+ currency_prefix: '$',
478
+ currency_suffix: '',
479
+ },
480
+ ],
481
+ },
482
+ ],
483
+ } );
484
+ const { container } = render( <Block showRateAfterTaxName={ true } /> );
485
+ expect(
486
+ await findByText(
487
+ container,
488
+ textContentMatcherAcrossSiblings(
489
+ 'Shipping $40.00 via Free shipping'
490
+ )
491
+ )
492
+ ).toBeInTheDocument();
493
+ } );
494
+ } );
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/attributes.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/block.tsx RENAMED
@@ -5,7 +5,7 @@
5
  /**
6
  * Internal dependencies
7
  */
8
- import { PaymentMethods } from '../../../payment-methods';
9
 
10
  const Block = (): JSX.Element | null => {
11
  return <PaymentMethods />;
5
  /**
6
  * Internal dependencies
7
  */
8
+ import { PaymentMethods } from '../../../cart-checkout/payment-methods';
9
 
10
  const Block = (): JSX.Element | null => {
11
  return <PaymentMethods />;
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-payment-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/attributes.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-address-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/attributes.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/block.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/index.js RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-shipping-methods-block/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/constants.js RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/edit.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/editor.scss RENAMED
@@ -14,6 +14,10 @@
14
 
15
  .wc-block-components-checkbox {
16
  margin-top: 0;
 
 
 
 
17
  }
18
 
19
  .wc-block-checkout__terms_notice .components-notice__action {
14
 
15
  .wc-block-components-checkbox {
16
  margin-top: 0;
17
+
18
+ &.wc-block-checkout__create-account {
19
+ margin-top: 1em;
20
+ }
21
  }
22
 
23
  .wc-block-checkout__terms_notice .components-notice__action {
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-terms-block/style.scss RENAMED
File without changes
assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, findByRole, queryByText } from '@testing-library/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Edit } from '../edit';
10
+ const blockSettingsMock = jest.requireMock( '@woocommerce/block-settings' );
11
+
12
+ jest.mock( '@wordpress/block-editor', () => ( {
13
+ ...jest.requireActual( '@wordpress/block-editor' ),
14
+ useBlockProps: jest.fn(),
15
+ } ) );
16
+
17
+ jest.mock( '@woocommerce/block-settings', () => ( {
18
+ ...jest.requireActual( '@woocommerce/block-settings' ),
19
+ PRIVACY_URL: '/privacy-policy',
20
+ TERMS_URL: '/terms-and-conditions',
21
+ } ) );
22
+
23
+ describe( 'Edit', () => {
24
+ it( 'Renders a checkbox if the checkbox attribute is true', async () => {
25
+ const { container } = render(
26
+ <Edit
27
+ attributes={ {
28
+ text: 'I agree to the terms and conditions',
29
+ checkbox: true,
30
+ } }
31
+ setAttributes={ () => void 0 }
32
+ />
33
+ );
34
+
35
+ expect( await findByRole( container, 'checkbox' ) ).toBeTruthy();
36
+ } );
37
+
38
+ it( 'Renders a notice if either the terms and conditions or privacy url attribute are unset', async () => {
39
+ blockSettingsMock.PRIVACY_URL = '';
40
+ blockSettingsMock.TERMS_URL = '';
41
+ const { container } = render(
42
+ <Edit
43
+ attributes={ {
44
+ text: 'I agree to the terms and conditions',
45
+ checkbox: true,
46
+ } }
47
+ setAttributes={ () => void 0 }
48
+ />
49
+ );
50
+
51
+ expect(
52
+ queryByText( container, 'Setup a Terms and Conditions page' )
53
+ ).toBeInTheDocument();
54
+
55
+ expect(
56
+ queryByText( container, 'Setup a Privacy Policy page' )
57
+ ).toBeInTheDocument();
58
+
59
+ expect(
60
+ queryByText(
61
+ container,
62
+ "You don't seem to have a Terms and Conditions and/or a Privacy Policy pages setup."
63
+ )
64
+ ).toBeInTheDocument();
65
+ } );
66
+
67
+ it( 'Reminds users to set a URL for their terms and conditions if they are not in the terms textbox', () => {
68
+ blockSettingsMock.TERMS_URL = '/terms';
69
+ blockSettingsMock.PRIVACY_URL = '/privacy';
70
+ const { container } = render(
71
+ <Edit
72
+ attributes={ {
73
+ text: 'I agree to the terms and conditions',
74
+ checkbox: true,
75
+ } }
76
+ setAttributes={ () => void 0 }
77
+ />
78
+ );
79
+
80
+ expect(
81
+ queryByText(
82
+ container,
83
+ 'Ensure you add links to your policy pages in this section.'
84
+ )
85
+ ).toBeInTheDocument();
86
+ } );
87
+
88
+ it( 'Shows no notices if the terms and privacy urls are set up and in the textbox', () => {
89
+ blockSettingsMock.TERMS_URL = '/terms';
90
+ blockSettingsMock.PRIVACY_URL = '/privacy';
91
+ const { container } = render(
92
+ <Edit
93
+ attributes={ {
94
+ text:
95
+ 'I agree to the <a href="/terms">terms</a> and <a href="/privacy">privacy</a>',
96
+ checkbox: true,
97
+ } }
98
+ setAttributes={ () => void 0 }
99
+ />
100
+ );
101
+
102
+ expect(
103
+ queryByText(
104
+ container,
105
+ 'Ensure you add links to your policy pages in this section'
106
+ )
107
+ ).not.toBeInTheDocument();
108
+ } );
109
+ } );
assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/frontend.js ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ render,
6
+ findByLabelText,
7
+ queryByLabelText,
8
+ } from '@testing-library/react';
9
+ import userEvent from '@testing-library/user-event';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import FrontendBlock from '../frontend';
15
+
16
+ describe( 'FrontendBlock', () => {
17
+ let validationData = {
18
+ hasValidationErrors: false,
19
+ getValidationError: jest.fn(),
20
+ clearValidationError: jest.fn(),
21
+ hideValidationError: jest.fn(),
22
+ setValidationErrors: jest.fn(),
23
+ };
24
+ beforeEach( () => {
25
+ validationData = {
26
+ hasValidationErrors: false,
27
+ getValidationError: jest.fn(),
28
+ clearValidationError: jest.fn(),
29
+ hideValidationError: jest.fn(),
30
+ setValidationErrors: jest.fn(),
31
+ };
32
+ } );
33
+
34
+ it( 'Renders a checkbox if the checkbox prop is true', async () => {
35
+ const { container } = render(
36
+ <FrontendBlock
37
+ checkbox={ true }
38
+ text={ 'I agree to the terms and conditions' }
39
+ validation={ validationData }
40
+ />
41
+ );
42
+
43
+ const checkbox = await findByLabelText(
44
+ container,
45
+ 'I agree to the terms and conditions'
46
+ );
47
+
48
+ expect( checkbox ).toBeInTheDocument();
49
+ } );
50
+
51
+ it( 'Does not render a checkbox if the checkbox prop is false', async () => {
52
+ const { container } = render(
53
+ <FrontendBlock
54
+ checkbox={ false }
55
+ text={ 'I agree to the terms and conditions' }
56
+ validation={ validationData }
57
+ />
58
+ );
59
+
60
+ const checkbox = queryByLabelText(
61
+ container,
62
+ 'I agree to the terms and conditions'
63
+ );
64
+
65
+ expect( checkbox ).not.toBeInTheDocument();
66
+ } );
67
+
68
+ it( 'Clears any validation errors when the checkbox is checked', async () => {
69
+ validationData.getValidationError.mockImplementation( () => {
70
+ return {
71
+ message: 'Please read and accept the terms and conditions.',
72
+ hidden: false,
73
+ };
74
+ } );
75
+ const { container } = render(
76
+ <FrontendBlock
77
+ checkbox={ true }
78
+ text={ 'I agree to the terms and conditions' }
79
+ validation={ validationData }
80
+ />
81
+ );
82
+ const checkbox = await findByLabelText(
83
+ container,
84
+ 'I agree to the terms and conditions'
85
+ );
86
+ userEvent.click( checkbox );
87
+ expect( validationData.clearValidationError ).toHaveBeenLastCalledWith(
88
+ expect.stringMatching( /terms-and-conditions-\d/ )
89
+ );
90
+ } );
91
+ } );
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/block.json RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/edit.tsx RENAMED
@@ -11,7 +11,10 @@ import type { TemplateArray } from '@wordpress/blocks';
11
  * Internal dependencies
12
  */
13
  import './style.scss';
14
- import { useForcedLayout, getAllowedBlocks } from '../../../shared';
 
 
 
15
  import { useCheckoutBlockContext } from '../../context';
16
 
17
  export const Edit = ( {
11
  * Internal dependencies
12
  */
13
  import './style.scss';
14
+ import {
15
+ useForcedLayout,
16
+ getAllowedBlocks,
17
+ } from '../../../cart-checkout/shared';
18
  import { useCheckoutBlockContext } from '../../context';
19
 
20
  export const Edit = ( {
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/frontend.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/checkout-totals-block/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/index.tsx RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/inner-blocks/register-components.ts RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/order-notes/index.js RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/order-notes/style.scss RENAMED
File without changes
assets/js/blocks/checkout/order-notes/test/index.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+
5
+ import {
6
+ render,
7
+ findByLabelText,
8
+ fireEvent,
9
+ findByPlaceholderText,
10
+ queryByPlaceholderText,
11
+ } from '@testing-library/react';
12
+ import userEvent from '@testing-library/user-event';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import OrderNotes from '../index';
18
+
19
+ describe( 'Checkout order notes', () => {
20
+ it( 'Shows a textarea when the checkbox to add order notes is toggled', async () => {
21
+ const { container } = render(
22
+ <OrderNotes
23
+ disabled={ false }
24
+ onChange={ () => null }
25
+ value={ '' }
26
+ placeholder={ 'Enter a note' }
27
+ />
28
+ );
29
+ const checkbox = await findByLabelText(
30
+ container,
31
+ 'Add a note to your order'
32
+ );
33
+
34
+ await userEvent.click( checkbox );
35
+ const textarea = await findByPlaceholderText(
36
+ container,
37
+ 'Enter a note'
38
+ );
39
+ expect( textarea ).toBeTruthy();
40
+ } );
41
+
42
+ it( 'Does not allow the textarea to be shown if disabled', async () => {
43
+ const { container } = render(
44
+ <OrderNotes
45
+ disabled={ true }
46
+ onChange={ () => null }
47
+ value={ '' }
48
+ placeholder={ 'Enter a note' }
49
+ />
50
+ );
51
+ const checkbox = await findByLabelText(
52
+ container,
53
+ 'Add a note to your order'
54
+ );
55
+
56
+ await userEvent.click( checkbox );
57
+ const textarea = queryByPlaceholderText( container, 'Enter a note' );
58
+ expect( textarea ).toBeNull();
59
+ } );
60
+
61
+ it( 'Retains the order note when toggling the textarea on and off', async () => {
62
+ const onChange = jest.fn();
63
+ const { container, rerender } = render(
64
+ <OrderNotes
65
+ disabled={ false }
66
+ onChange={ onChange }
67
+ value={ '' }
68
+ placeholder={ 'Enter a note' }
69
+ />
70
+ );
71
+
72
+ const checkbox = await findByLabelText(
73
+ container,
74
+ 'Add a note to your order'
75
+ );
76
+
77
+ await userEvent.click( checkbox );
78
+
79
+ // The onChange handler should not have been called because the value is the same as what was stored
80
+ expect( onChange ).not.toHaveBeenCalled();
81
+
82
+ const textarea = await findByPlaceholderText(
83
+ container,
84
+ 'Enter a note'
85
+ );
86
+ fireEvent.change( textarea, { target: { value: 'Test message' } } );
87
+ expect( onChange ).toHaveBeenLastCalledWith( 'Test message' );
88
+
89
+ // Rerender here with the new value to simulate the onChange updating the value
90
+ rerender(
91
+ <OrderNotes
92
+ disabled={ false }
93
+ onChange={ onChange }
94
+ value={ 'Test message' }
95
+ placeholder={ 'Enter a note' }
96
+ />
97
+ );
98
+
99
+ // Toggle off.
100
+ await userEvent.click( checkbox );
101
+ expect( onChange ).toHaveBeenLastCalledWith( '' );
102
+
103
+ // Rerender here with an empty value to simulate the onChange updating the value
104
+ rerender(
105
+ <OrderNotes
106
+ disabled={ false }
107
+ onChange={ onChange }
108
+ value={ '' }
109
+ placeholder={ 'Enter a note' }
110
+ />
111
+ );
112
+
113
+ // Toggle back on.
114
+ await userEvent.click( checkbox );
115
+ expect( onChange ).toHaveBeenLastCalledWith( 'Test message' );
116
+ } );
117
+ } );
assets/js/blocks/{cart-checkout/checkout → checkout}/phone-number/index.tsx RENAMED
File without changes
assets/js/blocks/checkout/phone-number/test/index.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+
5
+ import { render, findByLabelText } from '@testing-library/react';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import PhoneNumber from '../index';
11
+
12
+ describe( 'Phone number', () => {
13
+ it( 'Renders an input field with type tel', async () => {
14
+ const { container } = render(
15
+ <PhoneNumber
16
+ id={ 'shipping-phone' }
17
+ isRequired={ true }
18
+ onChange={ () => null }
19
+ value={ '' }
20
+ />
21
+ );
22
+ const input = await findByLabelText( container, 'Phone' );
23
+ expect( input.getAttribute( 'type' ) ).toEqual( 'tel' );
24
+ } );
25
+ it( 'Renders (optional) in the label if the field is not marked as required', async () => {
26
+ const { container } = render(
27
+ <PhoneNumber
28
+ id={ 'shipping-phone' }
29
+ isRequired={ false }
30
+ onChange={ () => null }
31
+ value={ '' }
32
+ />
33
+ );
34
+ const input = await findByLabelText( container, 'Phone (optional)' );
35
+ expect( input ).toBeTruthy();
36
+ } );
37
+ } );
assets/js/blocks/{cart-checkout/checkout → checkout}/styles/editor.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/styles/style.scss RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/types.ts RENAMED
File without changes
assets/js/blocks/{cart-checkout/checkout → checkout}/utils.ts RENAMED
File without changes
assets/js/blocks/featured-category/block.js CHANGED
@@ -8,8 +8,6 @@ import {
8
  InnerBlocks,
9
  InspectorControls,
10
  MediaReplaceFlow,
11
- PanelColorSettings,
12
- withColors,
13
  RichText,
14
  } from '@wordpress/block-editor';
15
  import {
@@ -56,8 +54,6 @@ import { withCategory } from '../../hocs';
56
  * @param {function(any):any} props.getCategory Function for getting category details.
57
  * @param {boolean} props.isLoading Whether loading or not.
58
  * @param {Object} props.category The product category object.
59
- * @param {Object} props.overlayColor Overlay color object for content.
60
- * @param {function(any):any} props.setOverlayColor Setter for overlay color.
61
  * @param {function(any):any} props.debouncedSpeak Function for delayed speak.
62
  * @param {function():void} props.triggerUrlUpdate Function to update Shop now button Url.
63
  */
@@ -69,8 +65,6 @@ const FeaturedCategory = ( {
69
  getCategory,
70
  isLoading,
71
  category,
72
- overlayColor,
73
- setOverlayColor,
74
  debouncedSpeak,
75
  triggerUrlUpdate = () => void null,
76
  } ) => {
@@ -148,21 +142,14 @@ const FeaturedCategory = ( {
148
  }
149
  />
150
  </PanelBody>
151
- <PanelColorSettings
152
- title={ __( 'Overlay', 'woo-gutenberg-products-block' ) }
153
- colorSettings={ [
154
- {
155
- value: overlayColor.color,
156
- onChange: setOverlayColor,
157
- label: __(
158
- 'Overlay Color',
159
  'woo-gutenberg-products-block'
160
- ),
161
- },
162
- ] }
163
- >
164
- { !! url && (
165
- <>
166
  <RangeControl
167
  label={ __(
168
  'Background Opacity',
@@ -189,9 +176,9 @@ const FeaturedCategory = ( {
189
  }
190
  />
191
  ) }
192
- </>
193
- ) }
194
- </PanelColorSettings>
195
  </InspectorControls>
196
  );
197
  };
@@ -287,14 +274,8 @@ const FeaturedCategory = ( {
287
  };
288
 
289
  const renderCategory = () => {
290
- const {
291
- className,
292
- contentAlign,
293
- dimRatio,
294
- focalPoint,
295
- height,
296
- showDesc,
297
- } = attributes;
298
  const classes = classnames(
299
  'wc-block-featured-category',
300
  {
@@ -304,14 +285,10 @@ const FeaturedCategory = ( {
304
  'has-background-dim': dimRatio !== 0,
305
  },
306
  dimRatioToClass( dimRatio ),
307
- contentAlign !== 'center' && `has-${ contentAlign }-content`,
308
- className
309
  );
310
  const mediaSrc = attributes.mediaSrc || getCategoryImageSrc( category );
311
  const style = !! category ? getBackgroundImageStyles( mediaSrc ) : {};
312
- if ( overlayColor.color ) {
313
- style.backgroundColor = overlayColor.color;
314
- }
315
  if ( focalPoint ) {
316
  const bgPosX = focalPoint.x * 100;
317
  const bgPosY = focalPoint.y * 100;
@@ -325,7 +302,10 @@ const FeaturedCategory = ( {
325
  return (
326
  <ResizableBox
327
  className={ classes }
328
- size={ { height } }
 
 
 
329
  minHeight={ getSetting( 'min_height', 500 ) }
330
  enable={ { bottom: true } }
331
  onResizeStop={ onResizeStop }
@@ -416,9 +396,6 @@ FeaturedCategory.propTypes = {
416
  description: PropTypes.node,
417
  permalink: PropTypes.string,
418
  } ),
419
- // from withColors
420
- overlayColor: PropTypes.object,
421
- setOverlayColor: PropTypes.func.isRequired,
422
  // from withSpokenMessages
423
  debouncedSpeak: PropTypes.func.isRequired,
424
  triggerUrlUpdate: PropTypes.func,
@@ -426,7 +403,6 @@ FeaturedCategory.propTypes = {
426
 
427
  export default compose( [
428
  withCategory,
429
- withColors( { overlayColor: 'background-color' } ),
430
  withSpokenMessages,
431
  withSelect( ( select, { clientId }, { dispatch } ) => {
432
  const Block = select( 'core/block-editor' ).getBlock( clientId );
8
  InnerBlocks,
9
  InspectorControls,
10
  MediaReplaceFlow,
 
 
11
  RichText,
12
  } from '@wordpress/block-editor';
13
  import {
54
  * @param {function(any):any} props.getCategory Function for getting category details.
55
  * @param {boolean} props.isLoading Whether loading or not.
56
  * @param {Object} props.category The product category object.
 
 
57
  * @param {function(any):any} props.debouncedSpeak Function for delayed speak.
58
  * @param {function():void} props.triggerUrlUpdate Function to update Shop now button Url.
59
  */
65
  getCategory,
66
  isLoading,
67
  category,
 
 
68
  debouncedSpeak,
69
  triggerUrlUpdate = () => void null,
70
  } ) => {
142
  }
143
  />
144
  </PanelBody>
145
+ { !! url && (
146
+ <>
147
+ <PanelBody
148
+ title={ __(
149
+ 'Overlay',
 
 
 
150
  'woo-gutenberg-products-block'
151
+ ) }
152
+ >
 
 
 
 
153
  <RangeControl
154
  label={ __(
155
  'Background Opacity',
176
  }
177
  />
178
  ) }
179
+ </PanelBody>
180
+ </>
181
+ ) }
182
  </InspectorControls>
183
  );
184
  };
274
  };
275
 
276
  const renderCategory = () => {
277
+ const { contentAlign, dimRatio, focalPoint, showDesc } = attributes;
278
+
 
 
 
 
 
 
279
  const classes = classnames(
280
  'wc-block-featured-category',
281
  {
285
  'has-background-dim': dimRatio !== 0,
286
  },
287
  dimRatioToClass( dimRatio ),
288
+ contentAlign !== 'center' && `has-${ contentAlign }-content`
 
289
  );
290
  const mediaSrc = attributes.mediaSrc || getCategoryImageSrc( category );
291
  const style = !! category ? getBackgroundImageStyles( mediaSrc ) : {};
 
 
 
292
  if ( focalPoint ) {
293
  const bgPosX = focalPoint.x * 100;
294
  const bgPosY = focalPoint.y * 100;
302
  return (
303
  <ResizableBox
304
  className={ classes }
305
+ size={ {
306
+ height: '',
307
+ width: '',
308
+ } }
309
  minHeight={ getSetting( 'min_height', 500 ) }
310
  enable={ { bottom: true } }
311
  onResizeStop={ onResizeStop }
396
  description: PropTypes.node,
397
  permalink: PropTypes.string,
398
  } ),
 
 
 
399
  // from withSpokenMessages
400
  debouncedSpeak: PropTypes.func.isRequired,
401
  triggerUrlUpdate: PropTypes.func,
403
 
404
  export default compose( [
405
  withCategory,
 
406
  withSpokenMessages,
407
  withSelect( ( select, { clientId }, { dispatch } ) => {
408
  const Block = select( 'core/block-editor' ).getBlock( clientId );
assets/js/blocks/featured-category/edit.tsx ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { useBlockProps } from '@wordpress/block-editor';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import Block from './block';
10
+
11
+ export const Edit = ( props: unknown ): JSX.Element => {
12
+ const blockProps = useBlockProps();
13
+
14
+ // The useBlockProps function returns the style with the `color`.
15
+ // We need to remove it to avoid the block to be styled with the color.
16
+ const { color, ...styles } = blockProps.style;
17
+
18
+ return (
19
+ <div { ...blockProps } style={ styles }>
20
+ <Block { ...props } />
21
+ </div>
22
+ );
23
+ };
assets/js/blocks/featured-category/editor.scss CHANGED
@@ -1,4 +1,6 @@
1
  .wc-block-featured-category {
 
 
2
  .components-resizable-box__handle {
3
  z-index: 10;
4
  }
1
  .wc-block-featured-category {
2
+ background-color: inherit;
3
+
4
  .components-resizable-box__handle {
5
  z-index: 10;
6
  }
assets/js/blocks/featured-category/index.js CHANGED
@@ -6,19 +6,21 @@ import { InnerBlocks } from '@wordpress/block-editor';
6
  import { registerBlockType } from '@wordpress/blocks';
7
  import { getSetting } from '@woocommerce/settings';
8
  import { Icon, folderStarred } from '@woocommerce/icons';
 
9
 
10
  /**
11
  * Internal dependencies
12
  */
13
  import './style.scss';
14
  import './editor.scss';
15
- import Block from './block';
16
  import { example } from './example';
 
17
 
18
  /**
19
  * Register and run the "Featured Category" block.
20
  */
21
  registerBlockType( 'woocommerce/featured-category', {
 
22
  title: __( 'Featured Category', 'woo-gutenberg-products-block' ),
23
  icon: {
24
  src: (
@@ -37,6 +39,15 @@ registerBlockType( 'woocommerce/featured-category', {
37
  supports: {
38
  align: [ 'wide', 'full' ],
39
  html: false,
 
 
 
 
 
 
 
 
 
40
  },
41
  example,
42
  attributes: {
@@ -146,14 +157,12 @@ registerBlockType( 'woocommerce/featured-category', {
146
  *
147
  * @param {Object} props Props to pass to block.
148
  */
149
- edit( props ) {
150
- return <Block { ...props } />;
151
- },
152
 
153
  /**
154
  * Block content is rendered in PHP, not via save function.
155
  */
156
- save() {
157
  return <InnerBlocks.Content />;
158
  },
159
  } );
6
  import { registerBlockType } from '@wordpress/blocks';
7
  import { getSetting } from '@woocommerce/settings';
8
  import { Icon, folderStarred } from '@woocommerce/icons';
9
+ import { isFeaturePluginBuild } from '@woocommerce/block-settings';
10
 
11
  /**
12
  * Internal dependencies
13
  */
14
  import './style.scss';
15
  import './editor.scss';
 
16
  import { example } from './example';
17
+ import { Edit } from './edit';
18
 
19
  /**
20
  * Register and run the "Featured Category" block.
21
  */
22
  registerBlockType( 'woocommerce/featured-category', {
23
+ apiVersion: 2,
24
  title: __( 'Featured Category', 'woo-gutenberg-products-block' ),
25
  icon: {
26
  src: (
39
  supports: {
40
  align: [ 'wide', 'full' ],
41
  html: false,
42
+ color: true,
43
+ ...( isFeaturePluginBuild() && {
44
+ __experimentalBorder: {
45
+ color: true,
46
+ radius: true,
47
+ width: true,
48
+ __experimentalSkipSerialization: false,
49
+ },
50
+ } ),
51
  },
52
  example,
53
  attributes: {
157
  *
158
  * @param {Object} props Props to pass to block.
159
  */
160
+ edit: Edit,
 
 
161
 
162
  /**
163
  * Block content is rendered in PHP, not via save function.
164
  */
165
+ save: () => {
166
  return <InnerBlocks.Content />;
167
  },
168
  } );
assets/js/blocks/featured-category/style.scss CHANGED
@@ -1,10 +1,16 @@
 
 
 
 
 
 
 
1
  .wc-block-featured-category {
2
  position: relative;
3
- background-color: $gray-900;
4
  background-size: cover;
5
  background-position: center center;
6
  width: 100%;
7
- margin: 0 0 1.5em 0;
8
  display: flex;
9
  justify-content: center;
10
  align-items: center;
@@ -63,6 +69,7 @@
63
  .wc-block-featured-category__description,
64
  .wc-block-featured-category__price,
65
  .wc-block-featured-category__link {
 
66
  width: 100%;
67
  padding: 0 48px 16px 48px;
68
  z-index: 1;
@@ -71,12 +78,17 @@
71
  .wc-block-featured-category__title {
72
  margin-top: 0;
73
 
 
 
 
 
74
  &::before {
75
  display: none;
76
  }
77
  }
78
 
79
  .wc-block-featured-category__description {
 
80
  p {
81
  margin: 0;
82
  }
1
+ .wp-block-woocommerce-featured-category {
2
+ background-color: $gray-900;
3
+ border-color: transparent;
4
+ color: #fff;
5
+ overflow: hidden;
6
+ }
7
+
8
  .wc-block-featured-category {
9
  position: relative;
 
10
  background-size: cover;
11
  background-position: center center;
12
  width: 100%;
13
+ margin: 0 0 0 0;
14
  display: flex;
15
  justify-content: center;
16
  align-items: center;
69
  .wc-block-featured-category__description,
70
  .wc-block-featured-category__price,
71
  .wc-block-featured-category__link {
72
+ color: inherit;
73
  width: 100%;
74
  padding: 0 48px 16px 48px;
75
  z-index: 1;
78
  .wc-block-featured-category__title {
79
  margin-top: 0;
80
 
81
+ div {
82
+ color: inherit;
83
+ }
84
+
85
  &::before {
86
  display: none;
87
  }
88
  }
89
 
90
  .wc-block-featured-category__description {
91
+ color: inherit;
92
  p {
93
  margin: 0;
94
  }
assets/js/blocks/legacy-template/constants.ts CHANGED
@@ -3,12 +3,7 @@
3
  */
4
  import { __ } from '@wordpress/i18n';
5
 
6
- /**
7
- * Internal dependencies
8
- */
9
- import { TemplateAttributes } from './types';
10
-
11
- export const TEMPLATES: Record< string, TemplateAttributes > = {
12
  'single-product': {
13
  title: __(
14
  'WooCommerce Single Product Block',
3
  */
4
  import { __ } from '@wordpress/i18n';
5
 
6
+ export const TEMPLATES: Record< string, Record< string, string > > = {
 
 
 
 
 
7
  'single-product': {
8
  title: __(
9
  'WooCommerce Single Product Block',
assets/js/blocks/legacy-template/index.tsx CHANGED
@@ -1,7 +1,6 @@
1
  /**
2
  * External dependencies
3
  */
4
- import { select, subscribe } from '@wordpress/data';
5
  import { registerBlockType } from '@wordpress/blocks';
6
  import { WC_BLOCKS_IMAGE_URL } from '@woocommerce/block-settings';
7
  import { useBlockProps } from '@wordpress/block-editor';
@@ -14,25 +13,24 @@ import { box, Icon } from '@wordpress/icons';
14
  */
15
  import './editor.scss';
16
  import { TEMPLATES } from './constants';
17
- import { getMatchingTemplateData } from './utils';
18
 
19
  interface Props {
20
  attributes: {
21
  template: string;
22
- title: string;
23
- placeholder: string;
24
  };
25
  }
26
 
27
  const Edit = ( { attributes }: Props ) => {
28
  const blockProps = useBlockProps();
29
- const { title, placeholder } = attributes;
30
-
 
 
31
  return (
32
  <div { ...blockProps }>
33
  <Placeholder
34
  icon={ box }
35
- label={ title }
36
  className="wp-block-woocommerce-legacy-template__placeholder"
37
  >
38
  <div className="wp-block-woocommerce-legacy-template__placeholder-copy">
@@ -55,15 +53,15 @@ const Edit = ( { attributes }: Props ) => {
55
  'This is an editor placeholder for the %s. On your store this will be replaced by the template and display with your product image(s), title, price, etc. You can move this placeholder around and add further blocks around it to extend the template.',
56
  'woo-gutenberg-products-block'
57
  ),
58
- title
59
  ) }
60
  </p>
61
  </div>
62
  <div className="wp-block-woocommerce-legacy-template__placeholder-wireframe">
63
  <img
64
  className="wp-block-woocommerce-legacy-template__placeholder-image"
65
- src={ `${ WC_BLOCKS_IMAGE_URL }template-placeholders/${ placeholder }.svg` }
66
- alt={ title }
67
  />
68
  </div>
69
  </Placeholder>
@@ -71,77 +69,39 @@ const Edit = ( { attributes }: Props ) => {
71
  );
72
  };
73
 
74
- let templateId: string | undefined;
75
-
76
- const unsubscribe = subscribe( () => {
77
- const store = select( 'core/edit-site' );
78
-
79
- if ( ! store ) {
80
- // The store will only exist in the Site Editor so we need to unsubscribe and early return for Posts / Pages.
81
- unsubscribe();
82
- return;
83
- }
84
-
85
- templateId = store?.getEditedPostId();
86
-
87
- if ( templateId ) {
88
- unsubscribe();
89
- const currentTemplateSlug = templateId?.split( '//' )[ 1 ];
90
- const templateData = getMatchingTemplateData(
91
- TEMPLATES,
92
- currentTemplateSlug
93
- );
94
- // We only want this block to be available for use in specified WooCommerce templates.
95
- const eligibleForInserter = templateData !== null;
96
- const title = templateData?.title ?? currentTemplateSlug;
97
- const placeholder = templateData?.placeholder ?? 'fallback';
98
-
99
- registerBlockType( 'woocommerce/legacy-template', {
100
- title,
101
- icon: (
102
- <Icon
103
- icon={ box }
104
- className="wc-block-editor-components-block-icon"
105
- />
106
- ),
107
- category: 'woocommerce',
108
- apiVersion: 2,
109
- keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
110
- description: __(
111
- 'Renders legacy WooCommerce PHP templates.',
112
- 'woo-gutenberg-products-block'
113
- ),
114
- supports: {
115
- align: [ 'wide', 'full' ],
116
- html: false,
117
- multiple: false,
118
- reusable: false,
119
- inserter: eligibleForInserter,
120
- },
121
- example: {
122
- attributes: {
123
- isPreview: true,
124
- },
125
- },
126
- attributes: {
127
- /**
128
- * Template attribute is used to determine which core PHP template gets rendered.
129
- */
130
- template: {
131
- type: 'string',
132
- default: currentTemplateSlug,
133
- },
134
- title: {
135
- type: 'string',
136
- default: title,
137
- },
138
- placeholder: {
139
- type: 'string',
140
- default: placeholder,
141
- },
142
- },
143
- edit: Edit,
144
- save: () => null,
145
- } );
146
- }
147
  } );
1
  /**
2
  * External dependencies
3
  */
 
4
  import { registerBlockType } from '@wordpress/blocks';
5
  import { WC_BLOCKS_IMAGE_URL } from '@woocommerce/block-settings';
6
  import { useBlockProps } from '@wordpress/block-editor';
13
  */
14
  import './editor.scss';
15
  import { TEMPLATES } from './constants';
 
16
 
17
  interface Props {
18
  attributes: {
19
  template: string;
 
 
20
  };
21
  }
22
 
23
  const Edit = ( { attributes }: Props ) => {
24
  const blockProps = useBlockProps();
25
+ const templateTitle =
26
+ TEMPLATES[ attributes.template ]?.title ?? attributes.template;
27
+ const templatePlaceholder =
28
+ TEMPLATES[ attributes.template ]?.placeholder ?? 'fallback';
29
  return (
30
  <div { ...blockProps }>
31
  <Placeholder
32
  icon={ box }
33
+ label={ templateTitle }
34
  className="wp-block-woocommerce-legacy-template__placeholder"
35
  >
36
  <div className="wp-block-woocommerce-legacy-template__placeholder-copy">
53
  'This is an editor placeholder for the %s. On your store this will be replaced by the template and display with your product image(s), title, price, etc. You can move this placeholder around and add further blocks around it to extend the template.',
54
  'woo-gutenberg-products-block'
55
  ),
56
+ templateTitle
57
  ) }
58
  </p>
59
  </div>
60
  <div className="wp-block-woocommerce-legacy-template__placeholder-wireframe">
61
  <img
62
  className="wp-block-woocommerce-legacy-template__placeholder-image"
63
+ src={ `${ WC_BLOCKS_IMAGE_URL }template-placeholders/${ templatePlaceholder }.svg` }
64
+ alt={ templateTitle }
65
  />
66
  </div>
67
  </Placeholder>
69
  );
70
  };
71
 
72
+ registerBlockType( 'woocommerce/legacy-template', {
73
+ title: __( 'WooCommerce Legacy Template', 'woo-gutenberg-products-block' ),
74
+ icon: (
75
+ <Icon icon={ box } className="wc-block-editor-components-block-icon" />
76
+ ),
77
+ category: 'woocommerce',
78
+ apiVersion: 2,
79
+ keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
80
+ description: __(
81
+ 'Renders legacy WooCommerce PHP templates.',
82
+ 'woo-gutenberg-products-block'
83
+ ),
84
+ supports: {
85
+ align: [ 'wide', 'full' ],
86
+ html: false,
87
+ multiple: false,
88
+ reusable: false,
89
+ inserter: false,
90
+ },
91
+ example: {
92
+ attributes: {
93
+ isPreview: true,
94
+ },
95
+ },
96
+ attributes: {
97
+ /**
98
+ * Template attribute is used to determine which core PHP template gets rendered.
99
+ */
100
+ template: {
101
+ type: 'string',
102
+ default: 'any',
103
+ },
104
+ },
105
+ edit: Edit,
106
+ save: () => null,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  } );
assets/js/blocks/legacy-template/test/utils.ts DELETED
@@ -1,30 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { getMatchingTemplateData } from '../utils';
5
- import { TEMPLATES } from '../constants';
6
-
7
- describe( 'getMatchingTemplateData', () => {
8
- it( 'should return template data if a correct match has been found', () => {
9
- expect(
10
- getMatchingTemplateData(
11
- TEMPLATES,
12
- 'taxonomy-product_cat-winter-collection'
13
- )
14
- ).toBe( TEMPLATES[ 'taxonomy-product_cat' ] );
15
-
16
- expect( getMatchingTemplateData( TEMPLATES, 'single-product' ) ).toBe(
17
- TEMPLATES[ 'single-product' ]
18
- );
19
-
20
- expect(
21
- getMatchingTemplateData( TEMPLATES, 'taxonomy-product_tag' )
22
- ).toBe( TEMPLATES[ 'taxonomy-product_tag' ] );
23
- } );
24
-
25
- it( 'should return null if given template slug does not match any of the expected options', () => {
26
- expect(
27
- getMatchingTemplateData( TEMPLATES, 'slug-does-not-match' )
28
- ).toBe( null );
29
- } );
30
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/blocks/legacy-template/types.ts DELETED
@@ -1,4 +0,0 @@
1
- export type TemplateAttributes = {
2
- title: string;
3
- placeholder: string;
4
- };
 
 
 
 
assets/js/blocks/legacy-template/utils.ts DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { TemplateAttributes } from './types';
5
-
6
- export function beginsWith( needle: string, haystack: string ): boolean {
7
- return haystack.substr( 0, needle.length ) === needle;
8
- }
9
-
10
- export function getMatchingTemplateData(
11
- templates: Record< string, TemplateAttributes >,
12
- slug: string
13
- ): TemplateAttributes | null {
14
- const templateSlugs = Object.keys( templates );
15
- const matchingSlugs = templateSlugs.filter( ( templateSlug ) =>
16
- slug.startsWith( templateSlug )
17
- );
18
-
19
- if ( matchingSlugs.length === 0 ) {
20
- return null;
21
- }
22
-
23
- return templates[ matchingSlugs[ 0 ] ];
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/editor-components/toggle-button-control/index.js CHANGED
@@ -1,7 +1,6 @@
1
  /**
2
  * External dependencies
3
  */
4
- import { isFunction } from 'lodash';
5
  import classnames from 'classnames';
6
  import { BaseControl, ButtonGroup, Button } from '@wordpress/components';
7
  import { Component } from '@wordpress/element';
@@ -40,7 +39,7 @@ class ToggleButtonControl extends Component {
40
  let helpLabel;
41
 
42
  if ( help ) {
43
- helpLabel = isFunction( help ) ? help( checked ) : help;
44
  }
45
 
46
  return (
1
  /**
2
  * External dependencies
3
  */
 
4
  import classnames from 'classnames';
5
  import { BaseControl, ButtonGroup, Button } from '@wordpress/components';
6
  import { Component } from '@wordpress/element';
39
  let helpLabel;
40
 
41
  if ( help ) {
42
+ helpLabel = typeof help === 'function' ? help( checked ) : help;
43
  }
44
 
45
  return (
assets/js/hooks/style-attributes.ts CHANGED
@@ -5,6 +5,7 @@
5
  import {
6
  __experimentalUseColorProps,
7
  __experimentalGetSpacingClassesAndStyles,
 
8
  } from '@wordpress/block-editor';
9
 
10
  /**
@@ -80,3 +81,19 @@ export const useColorProps = ( attributes: unknown ): WithStyle & WithClass => {
80
 
81
  return __experimentalUseColorProps( { ...attributesObject, style } );
82
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  import {
6
  __experimentalUseColorProps,
7
  __experimentalGetSpacingClassesAndStyles,
8
+ __experimentalUseBorderProps,
9
  } from '@wordpress/block-editor';
10
 
11
  /**
81
 
82
  return __experimentalUseColorProps( { ...attributesObject, style } );
83
  };
84
+
85
+ export const useBorderProps = (
86
+ attributes: unknown
87
+ ): WithStyle & WithClass => {
88
+ if ( ! isFeaturePluginBuild() ) {
89
+ return {
90
+ className: '',
91
+ style: {},
92
+ };
93
+ }
94
+
95
+ const attributesObject = isObject( attributes ) ? attributes : {};
96
+ const style = parseStyle( attributesObject.style );
97
+
98
+ return __experimentalUseBorderProps( { ...attributesObject, style } );
99
+ };
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'), 'version' => 'df25a2ebd227f813cec2ea6dcd08a337');
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'), 'version' => '265c2f723bda637cb220082df4f95667');
build/active-filters-frontend.js CHANGED
@@ -1,4 +1,4 @@
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=188)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10: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.default=e.exports,e.exports.__esModule=!0,r.apply(this,arguments)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},104: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.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)}},105:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(5);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},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),l=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(s.slug=a.sort(),l.push(s)),t(Object(n.sortBy)(l,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},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";const s=e.filter(e=>e.attribute!==r.taxonomy);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")))}},11:function(e,t){e.exports=window.wp.isShallowEqual},112:function(e,t){},15: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.default=e.exports,e.exports.__esModule=!0},16:function(e,t,r){"use strict";var n=r(15),c=r.n(n),o=r(0),s=r(3),a=r(1),l=r(65),i=e=>{let{imageUrl:t=l.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:i}=e;return 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),i&&Object(o.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},i)))};r(37);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,text:n,errorMessagePrefix:c,renderError:s,button:a}=this.props,{errorMessage:l,hasError:u}=this.state;return u?"function"==typeof s?s({errorMessage:l}):Object(o.createElement)(i,{errorMessage:r?l:null,header:e,imageUrl:t,text:n,errorMessagePrefix:c,button:a}):this.props.children}}t.a=u},165:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(0),s=r(24);const a=Object(o.createElement)(e=>{let{className:t,size:r,...n}=e;return Object(o.createElement)(s.SVG,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},n),Object(o.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=a},168:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(0),s=r(4),a=r.n(s),l=r(1),i=r(98),u=r(165);r(112);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:l="small",children:i=null,...u}=e;const b=n,p=a()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+l),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),i)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:m="",...f}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
  Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
4
  /* translators: %s text of the chip to remove. */
@@ -10,4 +10,4 @@ Object(o.__)("From %s","woo-gutenberg-products-block"),Object(p.formatPrice)(e))
10
  /* translators: %s max price */
11
  Object(o.__)("Up to %s","woo-gutenberg-products-block"),Object(p.formatPrice)(t)),f=e=>{let{type:t,name:r,prefix:n,removeCallback:s=(()=>{}),showLabel:a=!0,displayStyle:l}=e;const i=n?Object(c.createElement)(c.Fragment,null,n," ",r):r,b=Object(o.sprintf)(
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
- Object(o.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(c.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},a&&Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===l?Object(c.createElement)(d.a,{element:"span",text:i,onRemove:s,radius:"large",ariaLabel:b}):Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(c.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},Object(c.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),Object(c.createElement)("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),Object(c.createElement)("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),Object(c.createElement)(u.a,{screenReaderLabel:b}))))};var g=r(64),O=r(19),j=r(105),_=e=>{let{attributeObject:t={},slugs:r=[],operator:n="in",displayStyle:a}=e;const{results:l,isLoading:i}=Object(g.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[u,b]=Object(s.b)("attributes",[]);if(i)return null;const p=t.label;return Object(c.createElement)("li",null,Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-type"},p,":"),Object(c.createElement)("ul",null,r.map((e,r)=>{const s=l.find(t=>t.slug===e);if(!s)return null;let i="";return r>0&&"and"===n&&(i=Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(o.__)("and","woo-gutenberg-products-block"))),f({type:p,name:Object(O.decodeEntities)(s.name||e),prefix:i,removeCallback:()=>{Object(j.a)(u,b,t,e)},showLabel:!1,displayStyle:a})})))};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const[n,l]=Object(s.b)("attributes",[]),[p,d]=Object(s.b)("stock_status",[]),[g,O]=Object(s.b)("min_price"),[j,y]=Object(s.b)("max_price"),w=Object(a.getSetting)("stockStatusOptions",[]),E=Object(c.useMemo)(()=>{if(p.length>0)return p.map(e=>f({type:Object(o.__)("Stock Status","woo-gutenberg-products-block"),name:w[e],removeCallback:()=>{const t=p.filter(t=>t!==e);d(t)},displayStyle:t.displayStyle}))},[w,p,d,t.displayStyle]),h=Object(c.useMemo)(()=>Number.isFinite(g)||Number.isFinite(j)?f({type:Object(o.__)("Price","woo-gutenberg-products-block"),name:m(g,j),removeCallback:()=>{O(void 0),y(void 0)},displayStyle:t.displayStyle}):null,[g,j,t.displayStyle,O,y]),v=Object(c.useMemo)(()=>n.map(e=>{const r=Object(b.b)(e.attribute);return Object(c.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]);if(!(n.length>0||p.length>0||Number.isFinite(g)||Number.isFinite(j)||r))return null;const k="h"+t.headingLevel,S=i()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(c.createElement)(c.Fragment,null,!r&&t.heading&&Object(c.createElement)(k,{className:"wc-block-active-filters__title"},t.heading),Object(c.createElement)("div",{className:"wc-block-active-filters"},Object(c.createElement)("ul",{className:S},r?Object(c.createElement)(c.Fragment,null,f({type:Object(o.__)("Size","woo-gutenberg-products-block"),name:Object(o.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),f({type:Object(o.__)("Color","woo-gutenberg-products-block"),name:Object(o.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(c.createElement)(c.Fragment,null,h,E,v)),Object(c.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{O(void 0),y(void 0),l([]),d([])}},Object(c.createElement)(u.a,{label:Object(o.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Clear All Filters","woo-gutenberg-products-block")}))))},getProps:e=>({attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3},isEditor:!1})})},21: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 l=null!=r,i=null!=c;return!l&&i?(t=s||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,c)):(t=s||n.Fragment,l&&i&&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))}},24:function(e,t){e.exports=window.wp.primitives},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},3:function(e,t){e.exports=window.React},37:function(e,t){},39: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(6),c=r(9),o=r(0),s=r(11),a=r.n(s),l=r(17),i=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:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{l(r,e,t)},[r,e,l])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),s=Object(l.a)(n),p=Object(l.a)(e),d=Object(i.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(c(Object.assign({},s,p)),m.current=!0)},[s,p,d,c]),m.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 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";var n=r(43);function c(){}function o(){}o.resetWarningCache=c,e.exports=function(){function e(e,t,r,c,o,s){if(s!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:c};return r.PropTypes=r,r}},43:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},5:function(e,t){e.exports=window.lodash},53:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(10),c=r.n(n),o=r(0),s=r(16);const a=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const l=n(e,r),i=a(e,r),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:l={}}=e;Object(o.render)(Object(o.createElement)(s.a,l,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:l,attributes:u,errorBoundaryProps:i})})},i=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)),l({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);l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},54: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})},[])}},6:function(e,t){e.exports=window.wc.wcBlocksData},62:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(3);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}},64:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(6),c=r(9),o=r(0),s=r(17),a=r(54);const l=e=>{const{namespace:t,resourceName:r,resourceValues:l=[],query:i={},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)(i),d=Object(s.a)(l),m=Object(a.a)(),f=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],s=c.getCollectionError(...o);return s&&m(s),{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==f&&(b.current=f),b.current}},65: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 l})),r.d(t,"i",(function(){return i})),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 m})),r.d(t,"g",(function(){return f})),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/",l=o.buildPhase,i=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),m=c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(c.getSetting)("shippingCountries",{}),g=Object(c.getSetting)("allowedCountries",{}),O=Object(c.getSetting)("shippingStates",{}),j=Object(c.getSetting)("allowedStates",{})},8:function(e,t,r){e.exports=r(42)()},9:function(e,t){e.exports=window.wp.data},98:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{srcElement:t,size:r=24,...c}=e;return Object(n.isValidElement)(t)?Object(n.cloneElement)(t,{width:r,height:r,...c}):null}}});
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=188)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10: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.default=e.exports,e.exports.__esModule=!0,r.apply(this,arguments)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},104: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.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)}},105:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(5);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},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),l=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(s.slug=a.sort(),l.push(s)),t(Object(n.sortBy)(l,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},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";const s=e.filter(e=>e.attribute!==r.taxonomy);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")))}},11:function(e,t){e.exports=window.wp.isShallowEqual},112:function(e,t){},13:function(e,t,r){"use strict";var n=r(16),c=r.n(n),o=r(0),s=r(3),a=r(1),l=r(65),i=e=>{let{imageUrl:t=l.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:i,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),i&&Object(o.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},i))):null};r(37);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:l}=this.props,{errorMessage:u,hasError:b}=this.state;return b?"function"==typeof a?a({errorMessage:u}):Object(o.createElement)(i,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:c,errorMessagePrefix:s,button:l}):this.props.children}}t.a=u},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.default=e.exports,e.exports.__esModule=!0},165:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(0),s=r(24);const a=Object(o.createElement)(e=>{let{className:t,size:r,...n}=e;return Object(o.createElement)(s.SVG,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},n),Object(o.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=a},168:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(0),s=r(4),a=r.n(s),l=r(1),i=r(98),u=r(165);r(112);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:l="small",children:i=null,...u}=e;const b=n,p=a()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+l),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),i)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:m="",...f}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
  Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
4
  /* translators: %s text of the chip to remove. */
10
  /* translators: %s max price */
11
  Object(o.__)("Up to %s","woo-gutenberg-products-block"),Object(p.formatPrice)(t)),f=e=>{let{type:t,name:r,prefix:n,removeCallback:s=(()=>{}),showLabel:a=!0,displayStyle:l}=e;const i=n?Object(c.createElement)(c.Fragment,null,n," ",r):r,b=Object(o.sprintf)(
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
+ Object(o.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(c.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},a&&Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===l?Object(c.createElement)(d.a,{element:"span",text:i,onRemove:s,radius:"large",ariaLabel:b}):Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(c.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},Object(c.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),Object(c.createElement)("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),Object(c.createElement)("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),Object(c.createElement)(u.a,{screenReaderLabel:b}))))};var g=r(64),O=r(19),j=r(105),_=e=>{let{attributeObject:t={},slugs:r=[],operator:n="in",displayStyle:a}=e;const{results:l,isLoading:i}=Object(g.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[u,b]=Object(s.b)("attributes",[]);if(i)return null;const p=t.label;return Object(c.createElement)("li",null,Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-type"},p,":"),Object(c.createElement)("ul",null,r.map((e,r)=>{const s=l.find(t=>t.slug===e);if(!s)return null;let i="";return r>0&&"and"===n&&(i=Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(o.__)("and","woo-gutenberg-products-block"))),f({type:p,name:Object(O.decodeEntities)(s.name||e),prefix:i,removeCallback:()=>{Object(j.a)(u,b,t,e)},showLabel:!1,displayStyle:a})})))};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const[n,l]=Object(s.b)("attributes",[]),[p,d]=Object(s.b)("stock_status",[]),[g,O]=Object(s.b)("min_price"),[j,y]=Object(s.b)("max_price"),w=Object(a.getSetting)("stockStatusOptions",[]),E=Object(c.useMemo)(()=>{if(p.length>0)return p.map(e=>f({type:Object(o.__)("Stock Status","woo-gutenberg-products-block"),name:w[e],removeCallback:()=>{const t=p.filter(t=>t!==e);d(t)},displayStyle:t.displayStyle}))},[w,p,d,t.displayStyle]),h=Object(c.useMemo)(()=>Number.isFinite(g)||Number.isFinite(j)?f({type:Object(o.__)("Price","woo-gutenberg-products-block"),name:m(g,j),removeCallback:()=>{O(void 0),y(void 0)},displayStyle:t.displayStyle}):null,[g,j,t.displayStyle,O,y]),v=Object(c.useMemo)(()=>n.map(e=>{const r=Object(b.b)(e.attribute);return Object(c.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]);if(!(n.length>0||p.length>0||Number.isFinite(g)||Number.isFinite(j)||r))return null;const k="h"+t.headingLevel,S=i()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(c.createElement)(c.Fragment,null,!r&&t.heading&&Object(c.createElement)(k,{className:"wc-block-active-filters__title"},t.heading),Object(c.createElement)("div",{className:"wc-block-active-filters"},Object(c.createElement)("ul",{className:S},r?Object(c.createElement)(c.Fragment,null,f({type:Object(o.__)("Size","woo-gutenberg-products-block"),name:Object(o.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),f({type:Object(o.__)("Color","woo-gutenberg-products-block"),name:Object(o.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(c.createElement)(c.Fragment,null,h,E,v)),Object(c.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{O(void 0),y(void 0),l([]),d([])}},Object(c.createElement)(u.a,{label:Object(o.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Clear All Filters","woo-gutenberg-products-block")}))))},getProps:e=>({attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3},isEditor:!1})})},21: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 l=null!=r,i=null!=c;return!l&&i?(t=s||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,c)):(t=s||n.Fragment,l&&i&&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))}},24:function(e,t){e.exports=window.wp.primitives},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},3:function(e,t){e.exports=window.React},37:function(e,t){},39: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(6),c=r(9),o=r(0),s=r(11),a=r.n(s),l=r(17),i=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:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{l(r,e,t)},[r,e,l])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),s=Object(l.a)(n),p=Object(l.a)(e),d=Object(i.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(c(Object.assign({},s,p)),m.current=!0)},[s,p,d,c]),m.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 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";var n=r(43);function c(){}function o(){}o.resetWarningCache=c,e.exports=function(){function e(e,t,r,c,o,s){if(s!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:c};return r.PropTypes=r,r}},43:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},5:function(e,t){e.exports=window.lodash},53:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(10),c=r.n(n),o=r(0),s=r(13);const a=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const l=n(e,r),i=a(e,r),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:l={}}=e;Object(o.render)(Object(o.createElement)(s.a,l,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:l,attributes:u,errorBoundaryProps:i})})},i=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)),l({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);l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},54: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})},[])}},6:function(e,t){e.exports=window.wc.wcBlocksData},62:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(3);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}},64:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(6),c=r(9),o=r(0),s=r(17),a=r(54);const l=e=>{const{namespace:t,resourceName:r,resourceValues:l=[],query:i={},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)(i),d=Object(s.a)(l),m=Object(a.a)(),f=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],s=c.getCollectionError(...o);return s&&m(s),{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==f&&(b.current=f),b.current}},65: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 l})),r.d(t,"i",(function(){return i})),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 m})),r.d(t,"g",(function(){return f})),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/",l=o.buildPhase,i=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),m=c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(c.getSetting)("shippingCountries",{}),g=Object(c.getSetting)("allowedCountries",{}),O=Object(c.getSetting)("shippingStates",{}),j=Object(c.getSetting)("allowedStates",{})},8:function(e,t,r){e.exports=r(42)()},9:function(e,t){e.exports=window.wp.data},98:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{srcElement:t,size:r=24,...c}=e;return Object(n.isValidElement)(t)?Object(n.cloneElement)(t,{width:r,height:r,...c}):null}}});
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'), 'version' => '9fdde02f04329baf3176e79fd1bc8c70');
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'), 'version' => 'ac4e8fac02a65dca34fdd8d2348316b2');
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,o,a=t[0],s=t[1],i=t[2],b=0,p=[];b<a.length;b++)o=a[b],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&p.push(r[o][0]),r[o]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);p.length;)p.shift()();return l.push.apply(l,i||[]),c()}function c(){for(var e,t=0;t<l.length;t++){for(var c=l[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==r[s]&&(n=!1)}n&&(l.splice(t--,1),e=o(o.s=c[0]))}return e}var n={},r={6:0},l=[];function o(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,o),c.l=!0,c.exports}o.m=e,o.c=n,o.d=function(e,t,c){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},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 c=Object.create(null);if(o.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(c,n,function(t){return e[t]}.bind(null,n));return c},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="";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 l.push([382,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},107:function(e,t,c){"use strict";var n=c(0),r=(c(10),c(7)),l=c(9),o=c(1);c(145),t.a=Object(l.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:l,heading:a,instanceId:s}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(o.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(r.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:l}))})},109:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(8);function r(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},115:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(16),r=c(13),l=c(0),o=c(39),a=c(94);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],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 b=Object(l.useRef)({results:[],isLoading:!0}),p=Object(o.a)(i),m=Object(o.a)(s),d=Object(a.a)(),h=Object(r.useSelect)(e=>{if(!u)return null;const r=e(n.COLLECTIONS_STORE_KEY),l=[t,c,p,m],o=r.getCollectionError(...l);return o&&d(o),{results:r.getCollection(...l),isLoading:!r.hasFinishedResolution("getCollection",l)}},[t,c,m,p,u]);return null!==h&&(b.current=h),b.current}},12:function(e,t){e.exports=window.wp.blocks},13:function(e,t){e.exports=window.wp.data},14:function(e,t){e.exports=window.wp.htmlEntities},145:function(e,t){},146:function(e,t){},16:function(e,t){e.exports=window.wc.wcBlocksData},177:function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return o}));var n=c(2);const r=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const c=(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 c.id&&e.push(c),e},[]),l=e=>{if(e)return r.find(t=>t.id===e)},o=e=>{if(e)return r.find(t=>t.taxonomy===e)}},178:function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return l}));var n=c(6);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const l=e.filter(e=>e.attribute===c.taxonomy),o=l.length?l[0]:null;if(!(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(r)))return;const a=o.slug.filter(e=>e!==r),s=e.filter(e=>e.attribute!==c.taxonomy);a.length>0&&(o.slug=a.sort(),s.push(o)),t(Object(n.sortBy)(s,"attribute"))},l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const o=e.filter(e=>e.attribute!==c.taxonomy);0===r.length?t(o):(o.push({attribute:c.taxonomy,operator:l,slug:r.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(o,"attribute")))}},18:function(e,t){e.exports=window.wp.primitives},187:function(e,t,c){"use strict";var n=c(5),r=c.n(n),l=c(0),o=c(4),a=c.n(o),s=c(1),i=c(43),u=c(211);c(146);var b=e=>{let{text:t,screenReaderText:c="",element:n="li",className:o="",radius:s="small",children:i=null,...u}=e;const b=n,p=a()(o,"wc-block-components-chip","wc-block-components-chip--radius-"+s),m=Boolean(c&&c!==t);return Object(l.createElement)(b,r()({className:p},u),Object(l.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(l.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:n=!1,onRemove:o=(()=>{}),removeOnAnyClick:p=!1,text:m,screenReaderText:d="",...h}=e;const O=p?"span":"button";if(!t){const e=d&&"string"==typeof d?d:m;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
4
  /* translators: %s text of the chip to remove. */
5
- Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const g={"aria-label":t,disabled:n,onClick:o,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||o()}},j=p?g:{},v=p?{"aria-hidden":!0}:g;return Object(l.createElement)(b,r()({},h,j,{className:a()(c,"is-removable"),element:p?"button":h.element,screenReaderText:d,text:m}),Object(l.createElement)(O,r()({className:"wc-block-components-chip__remove"},v),Object(l.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",srcElement:u.a,size:16})))}},2:function(e,t){e.exports=window.wc.wcSettings},211:function(e,t,c){"use strict";var n=c(5),r=c.n(n),l=c(0),o=c(18);const a=Object(l.createElement)(e=>{let{className:t,size:c,...n}=e;return Object(l.createElement)(o.SVG,r()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:c,height:c},n),Object(l.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=a},26:function(e,t){e.exports=window.wp.isShallowEqual},3:function(e,t){e.exports=window.wp.components},30:function(e,t,c){"use strict";var n=c(0),r=c(4),l=c.n(r);t.a=e=>{let t,{label:c,screenReaderLabel:r,wrapperElement:o,wrapperProps:a={}}=e;const s=null!=c,i=null!=r;return!s&&i?(t=o||"span",a={...a,className:l()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,r)):(t=o||n.Fragment,s&&i&&c!==r?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},r)):Object(n.createElement)(t,a,c))}},35:function(e,t){e.exports=window.wc.priceFormat},382:function(e,t,c){e.exports=c(448)},383:function(e,t){},39:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0),r=c(26),l=c.n(r);function o(e){const t=Object(n.useRef)(e);return l()(e,t.current)||(t.current=e),t.current}},43:function(e,t,c){"use strict";var n=c(0);t.a=function(e){let{srcElement:t,size:c=24,...r}=e;return Object(n.isValidElement)(t)?Object(n.cloneElement)(t,{width:c,height:c,...r}):null}},448:function(e,t,c){"use strict";c.r(t);var n=c(5),r=c.n(n),l=c(0),o=c(1),a=c(12),s=c(43),i=c(18),u=Object(l.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(l.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(l.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"})),b=c(4),p=c.n(b),m=c(7),d=c(3),h=c(90),O=c(107),g=c(55),j=c(73),v=c(2),f=(c(10),c(30)),w=(c(383),c(177)),_=c(35),y=c(187);const E=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(o.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
  Object(o.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(_.formatPrice)(e),Object(_.formatPrice)(t)):Number.isFinite(e)?Object(o.sprintf)(
8
  /* translators: %s min price */
@@ -12,6 +12,6 @@ Object(o.__)("Up to %s","woo-gutenberg-products-block"),Object(_.formatPrice)(t)
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
  Object(o.__)("Remove %s filter","woo-gutenberg-products-block"),c);return Object(l.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+c},a&&Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?Object(l.createElement)(y.a,{element:"span",text:i,onRemove:r,radius:"large",ariaLabel:u}):Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(l.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:r},Object(l.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(l.createElement)("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),Object(l.createElement)("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),Object(l.createElement)("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),Object(l.createElement)(f.a,{screenReaderLabel:u}))))};var x=c(115),S=c(14),C=c(178),N=e=>{let{attributeObject:t={},slugs:c=[],operator:n="in",displayStyle:r}=e;const{results:a,isLoading:s}=Object(x.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[i,u]=Object(j.b)("attributes",[]);if(s)return null;const b=t.label;return Object(l.createElement)("li",null,Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-type"},b,":"),Object(l.createElement)("ul",null,c.map((e,c)=>{const s=a.find(t=>t.slug===e);if(!s)return null;let p="";return c>0&&"and"===n&&(p=Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(o.__)("and","woo-gutenberg-products-block"))),k({type:b,name:Object(S.decodeEntities)(s.name||e),prefix:p,removeCallback:()=>{Object(C.a)(i,u,t,e)},showLabel:!1,displayStyle:r})})))},L=e=>{let{attributes:t,isEditor:c=!1}=e;const[n,r]=Object(j.b)("attributes",[]),[a,s]=Object(j.b)("stock_status",[]),[i,u]=Object(j.b)("min_price"),[b,m]=Object(j.b)("max_price"),d=Object(v.getSetting)("stockStatusOptions",[]),h=Object(l.useMemo)(()=>{if(a.length>0)return a.map(e=>k({type:Object(o.__)("Stock Status","woo-gutenberg-products-block"),name:d[e],removeCallback:()=>{const t=a.filter(t=>t!==e);s(t)},displayStyle:t.displayStyle}))},[d,a,s,t.displayStyle]),O=Object(l.useMemo)(()=>Number.isFinite(i)||Number.isFinite(b)?k({type:Object(o.__)("Price","woo-gutenberg-products-block"),name:E(i,b),removeCallback:()=>{u(void 0),m(void 0)},displayStyle:t.displayStyle}):null,[i,b,t.displayStyle,u,m]),g=Object(l.useMemo)(()=>n.map(e=>{const c=Object(w.b)(e.attribute);return Object(l.createElement)(N,{attributeObject:c,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]);if(!(n.length>0||a.length>0||Number.isFinite(i)||Number.isFinite(b)||c))return null;const _="h"+t.headingLevel,y=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(l.createElement)(l.Fragment,null,!c&&t.heading&&Object(l.createElement)(_,{className:"wc-block-active-filters__title"},t.heading),Object(l.createElement)("div",{className:"wc-block-active-filters"},Object(l.createElement)("ul",{className:y},c?Object(l.createElement)(l.Fragment,null,k({type:Object(o.__)("Size","woo-gutenberg-products-block"),name:Object(o.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),k({type:Object(o.__)("Color","woo-gutenberg-products-block"),name:Object(o.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(l.createElement)(l.Fragment,null,O,h,g)),Object(l.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{u(void 0),m(void 0),r([]),s([])}},Object(l.createElement)(f.a,{label:Object(o.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=Object(d.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c}=e;const{className:n,displayStyle:r,heading:a,headingLevel:s}=t,i=Object(m.useBlockProps)({className:n});return Object(l.createElement)("div",i,Object(l.createElement)(m.InspectorControls,{key:"inspector"},Object(l.createElement)(d.PanelBody,{title:Object(o.__)("Block Settings","woo-gutenberg-products-block")},Object(l.createElement)(g.a,{label:Object(o.__)("Display Style","woo-gutenberg-products-block"),value:r,options:[{label:Object(o.__)("List","woo-gutenberg-products-block"),value:"list"},{
14
  /* translators: "Chips" is a tag-like display style for chosen attributes. */
15
- label:Object(o.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:e=>c({displayStyle:e})}),Object(l.createElement)("p",null,Object(o.__)("Heading Level","woo-gutenberg-products-block")),Object(l.createElement)(h.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:s,onChange:e=>c({headingLevel:e})}))),Object(l.createElement)(O.a,{className:"wc-block-active-filters__title",headingLevel:s,heading:a,onChange:e=>c({heading:e})}),Object(l.createElement)(d.Disabled,null,Object(l.createElement)(L,{attributes:t,isEditor:!0})))});Object(a.registerBlockType)("woocommerce/active-filters",{apiVersion:2,title:Object(o.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(l.createElement)(s.a,{srcElement:u,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(o.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(o.__)("Show the currently active product filters. Works in combination with the All Products and filters blocks.","woo-gutenberg-products-block"),supports:{html:!1,multiple:!1,color:{text:!0,background:!1}},example:{attributes:{}},attributes:{displayStyle:{type:"string",default:"list"},heading:{type:"string",default:Object(o.__)("Active filters","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3}},edit:V,save(e){let{attributes:t}=e;const{className:c,displayStyle:n,heading:o,headingLevel:a}=t,s={"data-display-style":n,"data-heading":o,"data-heading-level":a};return Object(l.createElement)("div",r()({},m.useBlockProps.save({className:p()("is-loading",c)}),s),Object(l.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},48:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0);const r=Object(n.createContext)("page"),l=()=>Object(n.useContext)(r);r.Provider},55:function(e,t,c){"use strict";var n=c(5),r=c.n(n),l=c(0),o=c(6),a=c(4),s=c.n(a),i=c(3),u=c(9);c(84);class b extends l.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:n,help:a,options:u,value:b}=this.props,p="inspector-toggle-button-control-"+c;let m;return a&&(m=Object(o.isFunction)(a)?a(t):a),Object(l.createElement)(i.BaseControl,{id:p,help:m,className:s()("components-toggle-button-control",n)},Object(l.createElement)("label",{id:p+"__label",htmlFor:p,className:"components-toggle-button-control__label"},e),Object(l.createElement)(i.ButtonGroup,{"aria-labelledby":p+"__label"},u.map((t,c)=>{const n={};return b===t.value?(n.isPrimary=!0,n["aria-pressed"]=!0):(n.isSecondary=!0,n["aria-pressed"]=!1),Object(l.createElement)(i.Button,r()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},n),t.label)})))}}t.a=Object(u.withInstanceId)(b)},6:function(e,t){e.exports=window.lodash},7:function(e,t){e.exports=window.wp.blockEditor},73:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return p})),c.d(t,"c",(function(){return m}));var n=c(16),r=c(13),l=c(0),o=c(26),a=c.n(o),s=c(39),i=c(109),u=c(48);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(r.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:o}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(l.useCallback)(t=>{o(e,t)},[e,o])]},p=(e,t,c)=>{const o=Object(u.a)();c=c||o;const a=Object(r.useSelect)(r=>r(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(l.useCallback)(t=>{s(c,e,t)},[c,e,s])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,r]=b(t),o=Object(s.a)(n),p=Object(s.a)(e),m=Object(i.a)(p),d=Object(l.useRef)(!1);return Object(l.useEffect)(()=>{a()(m,p)||(r(Object.assign({},o,p)),d.current=!0)},[o,p,m,r]),d.current?[n,r]:[e,r]}},8:function(e,t){e.exports=window.React},84:function(e,t){},9:function(e,t){e.exports=window.wp.compose},90:function(e,t,c){"use strict";var n=c(0),r=c(6),l=c(1),o=c(3);function a(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(n.createElement)(o.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(o.Path,{d:c[t]})):null}class s extends n.Component{createLevelControl(e,t,c){const r=e===t;return{icon:Object(n.createElement)(a,{level:e}),title:Object(l.sprintf)(
16
  /* translators: %s: heading level e.g: "2", "3", "4" */
17
  Object(l.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:l,onChange:s}=this.props;return Object(n.createElement)(o.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(a,{level:l}),controls:Object(r.range)(t,c).map(e=>this.createLevelControl(e,l,s))})}}t.a=s},94:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const r=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,o,a=t[0],s=t[1],i=t[2],b=0,p=[];b<a.length;b++)o=a[b],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&p.push(r[o][0]),r[o]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);p.length;)p.shift()();return l.push.apply(l,i||[]),c()}function c(){for(var e,t=0;t<l.length;t++){for(var c=l[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==r[s]&&(n=!1)}n&&(l.splice(t--,1),e=o(o.s=c[0]))}return e}var n={},r={6:0},l=[];function o(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,o),c.l=!0,c.exports}o.m=e,o.c=n,o.d=function(e,t,c){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},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 c=Object.create(null);if(o.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(c,n,function(t){return e[t]}.bind(null,n));return c},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="";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 l.push([383,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},107:function(e,t,c){"use strict";var n=c(0),r=(c(10),c(7)),l=c(9),o=c(1);c(145),t.a=Object(l.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:l,heading:a,instanceId:s}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(o.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(r.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:l}))})},109:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(8);function r(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},115:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(16),r=c(13),l=c(0),o=c(39),a=c(94);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],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 b=Object(l.useRef)({results:[],isLoading:!0}),p=Object(o.a)(i),m=Object(o.a)(s),d=Object(a.a)(),h=Object(r.useSelect)(e=>{if(!u)return null;const r=e(n.COLLECTIONS_STORE_KEY),l=[t,c,p,m],o=r.getCollectionError(...l);return o&&d(o),{results:r.getCollection(...l),isLoading:!r.hasFinishedResolution("getCollection",l)}},[t,c,m,p,u]);return null!==h&&(b.current=h),b.current}},12:function(e,t){e.exports=window.wp.blocks},13:function(e,t){e.exports=window.wp.data},14:function(e,t){e.exports=window.wp.htmlEntities},145:function(e,t){},146:function(e,t){},16:function(e,t){e.exports=window.wc.wcBlocksData},177:function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return o}));var n=c(2);const r=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const c=(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 c.id&&e.push(c),e},[]),l=e=>{if(e)return r.find(t=>t.id===e)},o=e=>{if(e)return r.find(t=>t.taxonomy===e)}},178:function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return l}));var n=c(6);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const l=e.filter(e=>e.attribute===c.taxonomy),o=l.length?l[0]:null;if(!(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(r)))return;const a=o.slug.filter(e=>e!==r),s=e.filter(e=>e.attribute!==c.taxonomy);a.length>0&&(o.slug=a.sort(),s.push(o)),t(Object(n.sortBy)(s,"attribute"))},l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const o=e.filter(e=>e.attribute!==c.taxonomy);0===r.length?t(o):(o.push({attribute:c.taxonomy,operator:l,slug:r.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(o,"attribute")))}},18:function(e,t){e.exports=window.wp.primitives},187:function(e,t,c){"use strict";var n=c(5),r=c.n(n),l=c(0),o=c(4),a=c.n(o),s=c(1),i=c(43),u=c(212);c(146);var b=e=>{let{text:t,screenReaderText:c="",element:n="li",className:o="",radius:s="small",children:i=null,...u}=e;const b=n,p=a()(o,"wc-block-components-chip","wc-block-components-chip--radius-"+s),m=Boolean(c&&c!==t);return Object(l.createElement)(b,r()({className:p},u),Object(l.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(l.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:n=!1,onRemove:o=(()=>{}),removeOnAnyClick:p=!1,text:m,screenReaderText:d="",...h}=e;const O=p?"span":"button";if(!t){const e=d&&"string"==typeof d?d:m;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
4
  /* translators: %s text of the chip to remove. */
5
+ Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const g={"aria-label":t,disabled:n,onClick:o,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||o()}},j=p?g:{},v=p?{"aria-hidden":!0}:g;return Object(l.createElement)(b,r()({},h,j,{className:a()(c,"is-removable"),element:p?"button":h.element,screenReaderText:d,text:m}),Object(l.createElement)(O,r()({className:"wc-block-components-chip__remove"},v),Object(l.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",srcElement:u.a,size:16})))}},2:function(e,t){e.exports=window.wc.wcSettings},212:function(e,t,c){"use strict";var n=c(5),r=c.n(n),l=c(0),o=c(18);const a=Object(l.createElement)(e=>{let{className:t,size:c,...n}=e;return Object(l.createElement)(o.SVG,r()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:c,height:c},n),Object(l.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=a},26:function(e,t){e.exports=window.wp.isShallowEqual},3:function(e,t){e.exports=window.wp.components},30:function(e,t,c){"use strict";var n=c(0),r=c(4),l=c.n(r);t.a=e=>{let t,{label:c,screenReaderLabel:r,wrapperElement:o,wrapperProps:a={}}=e;const s=null!=c,i=null!=r;return!s&&i?(t=o||"span",a={...a,className:l()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,r)):(t=o||n.Fragment,s&&i&&c!==r?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},r)):Object(n.createElement)(t,a,c))}},35:function(e,t){e.exports=window.wc.priceFormat},383:function(e,t,c){e.exports=c(449)},384:function(e,t){},39:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0),r=c(26),l=c.n(r);function o(e){const t=Object(n.useRef)(e);return l()(e,t.current)||(t.current=e),t.current}},43:function(e,t,c){"use strict";var n=c(0);t.a=function(e){let{srcElement:t,size:c=24,...r}=e;return Object(n.isValidElement)(t)?Object(n.cloneElement)(t,{width:c,height:c,...r}):null}},449:function(e,t,c){"use strict";c.r(t);var n=c(5),r=c.n(n),l=c(0),o=c(1),a=c(12),s=c(43),i=c(18),u=Object(l.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(l.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(l.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"})),b=c(4),p=c.n(b),m=c(7),d=c(3),h=c(90),O=c(107),g=c(55),j=c(73),v=c(2),f=(c(10),c(30)),w=(c(384),c(177)),_=c(35),y=c(187);const E=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(o.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
  Object(o.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(_.formatPrice)(e),Object(_.formatPrice)(t)):Number.isFinite(e)?Object(o.sprintf)(
8
  /* translators: %s min price */
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
  Object(o.__)("Remove %s filter","woo-gutenberg-products-block"),c);return Object(l.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+c},a&&Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?Object(l.createElement)(y.a,{element:"span",text:i,onRemove:r,radius:"large",ariaLabel:u}):Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(l.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:r},Object(l.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(l.createElement)("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),Object(l.createElement)("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),Object(l.createElement)("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),Object(l.createElement)(f.a,{screenReaderLabel:u}))))};var x=c(115),S=c(14),C=c(178),N=e=>{let{attributeObject:t={},slugs:c=[],operator:n="in",displayStyle:r}=e;const{results:a,isLoading:s}=Object(x.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[i,u]=Object(j.b)("attributes",[]);if(s)return null;const b=t.label;return Object(l.createElement)("li",null,Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-type"},b,":"),Object(l.createElement)("ul",null,c.map((e,c)=>{const s=a.find(t=>t.slug===e);if(!s)return null;let p="";return c>0&&"and"===n&&(p=Object(l.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(o.__)("and","woo-gutenberg-products-block"))),k({type:b,name:Object(S.decodeEntities)(s.name||e),prefix:p,removeCallback:()=>{Object(C.a)(i,u,t,e)},showLabel:!1,displayStyle:r})})))},L=e=>{let{attributes:t,isEditor:c=!1}=e;const[n,r]=Object(j.b)("attributes",[]),[a,s]=Object(j.b)("stock_status",[]),[i,u]=Object(j.b)("min_price"),[b,m]=Object(j.b)("max_price"),d=Object(v.getSetting)("stockStatusOptions",[]),h=Object(l.useMemo)(()=>{if(a.length>0)return a.map(e=>k({type:Object(o.__)("Stock Status","woo-gutenberg-products-block"),name:d[e],removeCallback:()=>{const t=a.filter(t=>t!==e);s(t)},displayStyle:t.displayStyle}))},[d,a,s,t.displayStyle]),O=Object(l.useMemo)(()=>Number.isFinite(i)||Number.isFinite(b)?k({type:Object(o.__)("Price","woo-gutenberg-products-block"),name:E(i,b),removeCallback:()=>{u(void 0),m(void 0)},displayStyle:t.displayStyle}):null,[i,b,t.displayStyle,u,m]),g=Object(l.useMemo)(()=>n.map(e=>{const c=Object(w.b)(e.attribute);return Object(l.createElement)(N,{attributeObject:c,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]);if(!(n.length>0||a.length>0||Number.isFinite(i)||Number.isFinite(b)||c))return null;const _="h"+t.headingLevel,y=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(l.createElement)(l.Fragment,null,!c&&t.heading&&Object(l.createElement)(_,{className:"wc-block-active-filters__title"},t.heading),Object(l.createElement)("div",{className:"wc-block-active-filters"},Object(l.createElement)("ul",{className:y},c?Object(l.createElement)(l.Fragment,null,k({type:Object(o.__)("Size","woo-gutenberg-products-block"),name:Object(o.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),k({type:Object(o.__)("Color","woo-gutenberg-products-block"),name:Object(o.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(l.createElement)(l.Fragment,null,O,h,g)),Object(l.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{u(void 0),m(void 0),r([]),s([])}},Object(l.createElement)(f.a,{label:Object(o.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=Object(d.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c}=e;const{className:n,displayStyle:r,heading:a,headingLevel:s}=t,i=Object(m.useBlockProps)({className:n});return Object(l.createElement)("div",i,Object(l.createElement)(m.InspectorControls,{key:"inspector"},Object(l.createElement)(d.PanelBody,{title:Object(o.__)("Block Settings","woo-gutenberg-products-block")},Object(l.createElement)(g.a,{label:Object(o.__)("Display Style","woo-gutenberg-products-block"),value:r,options:[{label:Object(o.__)("List","woo-gutenberg-products-block"),value:"list"},{
14
  /* translators: "Chips" is a tag-like display style for chosen attributes. */
15
+ label:Object(o.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:e=>c({displayStyle:e})}),Object(l.createElement)("p",null,Object(o.__)("Heading Level","woo-gutenberg-products-block")),Object(l.createElement)(h.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:s,onChange:e=>c({headingLevel:e})}))),Object(l.createElement)(O.a,{className:"wc-block-active-filters__title",headingLevel:s,heading:a,onChange:e=>c({heading:e})}),Object(l.createElement)(d.Disabled,null,Object(l.createElement)(L,{attributes:t,isEditor:!0})))});Object(a.registerBlockType)("woocommerce/active-filters",{apiVersion:2,title:Object(o.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(l.createElement)(s.a,{srcElement:u,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(o.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(o.__)("Show the currently active product filters. Works in combination with the All Products and filters blocks.","woo-gutenberg-products-block"),supports:{html:!1,multiple:!1,color:{text:!0,background:!1}},example:{attributes:{}},attributes:{displayStyle:{type:"string",default:"list"},heading:{type:"string",default:Object(o.__)("Active filters","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3}},edit:V,save(e){let{attributes:t}=e;const{className:c,displayStyle:n,heading:o,headingLevel:a}=t,s={"data-display-style":n,"data-heading":o,"data-heading-level":a};return Object(l.createElement)("div",r()({},m.useBlockProps.save({className:p()("is-loading",c)}),s),Object(l.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},48:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0);const r=Object(n.createContext)("page"),l=()=>Object(n.useContext)(r);r.Provider},55:function(e,t,c){"use strict";var n=c(5),r=c.n(n),l=c(0),o=c(4),a=c.n(o),s=c(3),i=c(9);c(84);class u extends l.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:n,help:o,options:i,value:u}=this.props,b="inspector-toggle-button-control-"+c;let p;return o&&(p="function"==typeof o?o(t):o),Object(l.createElement)(s.BaseControl,{id:b,help:p,className:a()("components-toggle-button-control",n)},Object(l.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},e),Object(l.createElement)(s.ButtonGroup,{"aria-labelledby":b+"__label"},i.map((t,c)=>{const n={};return u===t.value?(n.isPrimary=!0,n["aria-pressed"]=!0):(n.isSecondary=!0,n["aria-pressed"]=!1),Object(l.createElement)(s.Button,r()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},n),t.label)})))}}t.a=Object(i.withInstanceId)(u)},6:function(e,t){e.exports=window.lodash},7:function(e,t){e.exports=window.wp.blockEditor},73:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return p})),c.d(t,"c",(function(){return m}));var n=c(16),r=c(13),l=c(0),o=c(26),a=c.n(o),s=c(39),i=c(109),u=c(48);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(r.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:o}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(l.useCallback)(t=>{o(e,t)},[e,o])]},p=(e,t,c)=>{const o=Object(u.a)();c=c||o;const a=Object(r.useSelect)(r=>r(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(l.useCallback)(t=>{s(c,e,t)},[c,e,s])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,r]=b(t),o=Object(s.a)(n),p=Object(s.a)(e),m=Object(i.a)(p),d=Object(l.useRef)(!1);return Object(l.useEffect)(()=>{a()(m,p)||(r(Object.assign({},o,p)),d.current=!0)},[o,p,m,r]),d.current?[n,r]:[e,r]}},8:function(e,t){e.exports=window.React},84:function(e,t){},9:function(e,t){e.exports=window.wp.compose},90:function(e,t,c){"use strict";var n=c(0),r=c(6),l=c(1),o=c(3);function a(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(n.createElement)(o.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(o.Path,{d:c[t]})):null}class s extends n.Component{createLevelControl(e,t,c){const r=e===t;return{icon:Object(n.createElement)(a,{level:e}),title:Object(l.sprintf)(
16
  /* translators: %s: heading level e.g: "2", "3", "4" */
17
  Object(l.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:l,onChange:s}=this.props;return Object(n.createElement)(o.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(a,{level:l}),controls:Object(r.range)(t,c).map(e=>this.createLevelControl(e,l,s))})}}t.a=s},94:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const r=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}}});
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' => 'ac6a936bf1b5a81728568cbf8f5acf74');
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' => '89611f03bc284a4c5819fccf2418669e');
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],s=0,l=[];s<c.length;s++)o=c[s],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&l.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(a&&a(t);l.length;)l.shift()()}var n={},r={6: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,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(e){return o.p+""+({0:"vendors--atomic-block-components/add-to-cart--cart-blocks/order-summary--checkout-blocks/billing-ad--c5eb4dcd",1:"vendors--atomic-block-components/price--cart-blocks/line-items--cart-blocks/order-summary--checkout--8a3571de",7:"atomic-block-components/add-to-cart",8:"atomic-block-components/button",9:"atomic-block-components/category-list",10:"atomic-block-components/image",11:"atomic-block-components/price",12:"atomic-block-components/rating",13:"atomic-block-components/sale-badge",14:"atomic-block-components/sku",15:"atomic-block-components/stock-indicator",16:"atomic-block-components/summary",17:"atomic-block-components/tag-list",18:"atomic-block-components/title",49:"vendors--atomic-block-components/add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"9f3f7160cea9fec6b729",1:"44e8b4583ef14d0d1fdc",7:"ee5feb020130d6d54f2f",8:"8422937830a5bcfcf69f",9:"1f06fe341fd8f54234c7",10:"74c8be03232e12b30df4",11:"48d5274d5fb14e493def",12:"46e4dc4d3ef4a90e2519",13:"85bf4bdec9cccca4d188",14:"72dec6d824d90bf826ee",15:"b4f088842ec47e5f7541",16:"527832cf95951e3b83f1",17:"7d00ba6a20aee45636d8",18:"57ed80fcace38dd7c8c0",49:"7fb4a4043fde41ff7bfe"}[e]}(e);var a=new Error;i=function(t){s.onerror=s.onload=null,clearTimeout(l);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;a.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",a.name="ChunkLoadError",a.type=o,a.request=c,n[1](a)}r[e]=void 0}};var l=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}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 s=0;s<c.length;s++)t(c[s]);var a=i;o(o.s=175)}([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.React},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 s in r)n.call(r,s)&&r[s]&&e.push(s);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.wc.wcBlocksData},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(42)()},function(e,t){e.exports=window.wp.data},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.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wp.compose},,function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(15),o=n.n(r),c=n(0),i=n(3),s=n(1),a=n(65),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(s.__)("Error:","woo-gutenberg-products-block"),button:l}=e;return 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),l&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l)))};n(37);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,text:r,errorMessagePrefix:o,renderError:i,button:s}=this.props,{errorMessage:a,hasError:u}=this.state;return u?"function"==typeof i?i({errorMessage:a}):Object(c.createElement)(l,{errorMessage:n?a:null,header:e,imageUrl:t,text:r,errorMessagePrefix:o,button:s}):this.props.children}}t.a=u},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(11),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 c}));var r=n(0);n(9);const o=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(r.useContext)(o)},function(e,t){e.exports=window.wp.htmlEntities},,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:s={}}=e;const a=null!=n,l=null!=o;return!a&&l?(t=i||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=i||r.Fragment,a&&l&&n!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return w}));var r=n(5),o=n(0),c=n(6),i=n(9),s=n(19),a=n(70),l=n(109),u=n(18),d=n(67);const p=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{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(d.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(d.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",p),document.body.addEventListener("wc-blocks_removed_from_cart",p),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",p),document.body.removeEventListener("wc-blocks_removed_from_cart",p)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},f={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},g={...f,email:""},h={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:""},E=e=>Object(a.a)(Object.entries(e).map(e=>{let[t,n]=e;return[t,Object(s.decodeEntities)(n)]})),O={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:f,shippingRates:c.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:n}=Object(u.a)(),s=null==n?void 0:n.previewCart,{shouldSelect:a}=e,d=Object(o.useRef)();m();const p=Object(i.useSelect)((e,n)=>{let{dispatch:r}=n;if(!a)return O;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:f,extensions:c.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),u=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),b=o.isCustomerDataUpdating(),{receiveCart:m}=r(c.CART_STORE_KEY),h=E(i.billingAddress),w=i.needsShipping?E(i.shippingAddress):h,j=i.fees.length>0?i.fees.map(e=>E(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,cartFees:j,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:u,billingAddress:Object(l.a)(h),shippingAddress:Object(l.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,shippingRatesLoading:b,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:m}},[a]);return d.current&&Object(r.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.primitives},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(45);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){e.exports=window.wp.apiFetch},,,function(e,t){e.exports=window.wp.deprecated},,,,function(e,t){e.exports=window.wp.url},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"d",(function(){return o})),n.d(t,"c",(function(){return c})),n.d(t,"e",(function(){return i})),n.d(t,"a",(function(){return s}));const r=e=>"number"==typeof e,o=e=>"string"==typeof e,c=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function i(e,t){return c(e)&&t in e}const s=e=>"boolean"==typeof e},,function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(48),o=n(0),c=n(22);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){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return b}));var r=n(6),o=n(9),c=n(0),i=n(11),s=n.n(i),a=n(17),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(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const s=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[s,Object(c.useCallback)(t=>{a(n,e,t)},[n,e,a])]},b=(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),b=Object(l.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{s()(b,p)||(o(Object.assign({},i,p)),m.current=!0)},[i,p,b,o]),m.current?[r,o]:[e,o]}},function(e,t){e.exports=window.wc.priceFormat},,function(e,t,n){"use strict";var r=n(43);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,c,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";var r=n(7),o=n(0),c=n(24),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(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){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(35);const i=Object(r.getSetting)("countryLocale",{}),s=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.b)(e.priority)&&(t.index=e.priority),Object(c.d)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},a=Object.entries(i).map(e=>{let[t,n]=e;return[t,Object.entries(n).map(e=>{let[t,n]=e;return[t,s(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!==a[n]?a[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(10),o=n.n(r),c=n(0),i=n(16);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),l=s(e,n),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:s={},errorBoundaryProps:a={}}=e;Object(c.render)(Object(c.createElement)(i.a,a,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},s,{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(s.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)),a({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);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(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(7),o=n(0),c=n(4),i=n.n(c),s=n(5),a=n(30),l=n.n(a),u=n(12),d=n(60),p=n(90),b=n(1);function m(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 j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function y({name:e,children:t,registerFill:n,unregisterFill:r}){const c=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(j),[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(s.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var v=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(y,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(s.map)(r(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(c):c)}}var x=e=>Object(o.createElement)(j.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 C({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 S=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...c},i){const s=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,a])},c))}));function N(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(v,e),Object(o.createElement)(C,e))}n(11),o.Component;const P=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(S,Object(r.a)({},t,{ref:n})):Object(o.createElement)(x,t));function R(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const s=n?parseInt(n,10):0,a=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+l,y:e.top+s,width:e.width-l-u,height:e.height-s-a,left:e.left+l,right:e.right-u,top:e.top+s,bottom:e.bottom-a}}function L(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function A(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function B(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const M=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:c,noArrow:s=!0,isAlternate:a,position:f="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:y,getAnchorRect:v,expandOnMobile:_,animate:x=!0,onClickOutside:k,onFocusOutside:C,__unstableStickyBoundaryElement:S,__unstableSlotName:P="Popover",__unstableObserveElement:M,__unstableBoundaryParent:F,__unstableForcePosition:I,__unstableForceXAlignment:D,...V},W)=>{const z=Object(o.useRef)(null),H=Object(o.useRef)(null),U=Object(o.useRef)(),Y=Object(u.useViewportMatch)("medium","<"),[q,Q]=Object(o.useState)(),K=w(P),X=_&&Y,[J,Z]=Object(u.useResizeObserver)();s=X||s,Object(o.useLayoutEffect)(()=>{if(X)return B(U.current,"is-without-arrow",s),B(U.current,"is-alternate",a),L(U.current,"data-x-axis"),L(U.current,"data-y-axis"),A(U.current,"top"),A(U.current,"left"),A(H.current,"maxHeight"),void A(H.current,"maxWidth");const e=()=>{if(!U.current||!H.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 m(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 m(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,c);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=m(r.getBoundingClientRect(),r.ownerDocument,c);return o?e:T(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),s=m(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,c);return o?s:T(s,r)}if(!e.current)return;const{parentNode:i}=e.current,s=i.getBoundingClientRect();return o?s:T(s,i)}(z,y,v,O,j,U.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=U.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=U.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=Z.height?Z:H.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:g,contentHeight:h,contentWidth:E}=function(e,t,n="top",r,o,c,i,s,a){const[l,u="center",d]=n.split(" "),p=function(e,t,n,r,o,c,i,s){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 b,m=n,f=null;if(!o&&!s)if("middle"===n&&u.contentHeight===a)m="middle";else if("top"===n&&d.contentHeight===a)m="top";else if("bottom"===n&&p.contentHeight===a)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;f=e!==a?e:null}return b="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:b,contentHeight:f}}(e,t,l,d,r,0,c,s);return{...function(e,t,n,r,o,c,i,s,a){const{width:l}=t;"left"===n&&Object(b.isRTL)()?n="right":"right"===n&&Object(b.isRTL)()&&(n="left"),"left"===r&&Object(b.isRTL)()?r="right":"right"===r&&Object(b.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"===c||a||(p=u);let m=e.right;"left"===r?m=e.left:"middle"===c||a||(m=u);const f={popoverLeft:p,contentWidth:p-l>0?l:p},g={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let h,E=n,O=null;if(!o&&!s)if("center"===n&&d.contentWidth===l)E="center";else if("left"===n&&f.contentWidth===l)E="left";else if("right"===n&&g.contentWidth===l)E="right";else{E=f.contentWidth>g.contentWidth?"left":"right";const e="left"===E?f.contentWidth:g.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(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-l),Object(b.isRTL)()||(h=Math.max(h,0))}return{xAxis:E,popoverLeft:h,contentWidth:O}}(e,t,u,d,r,p.yAxis,i,s,a),...p}}(e,i,f,S,U.current,o,r,I,D);"number"==typeof l&&"number"==typeof u&&(A(U.current,"top",l+"px"),A(U.current,"left",u+"px")),B(U.current,"is-without-arrow",s||"center"===p&&"middle"===g),B(U.current,"is-alternate",a),L(U.current,"data-x-axis",p),L(U.current,"data-y-axis",g),A(H.current,"maxHeight","number"==typeof h?h+"px":""),A(H.current,"maxWidth","number"==typeof E?E+"px":""),Q(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=U.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 l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),M&&(l=new n.MutationObserver(e),l.observe(M,{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)),l&&l.disconnect()}},[X,y,v,O,j,f,Z,S,M,F]);const $=(e,n)=>{if("focus-outside"===e&&C)C(n);else if("focus-outside"===e&&k){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),k(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:$,onClose:$}),ne=Object(u.useMergeRefs)([U,ee,W]),re=Boolean(x&&q)&&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:q});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",c,re,{"is-expanded":X,"is-without-arrow":s,"is-alternate":a})},V,{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)(G,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:H,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,n)));return K.ref&&(oe=Object(o.createElement)(N,{name:P},oe)),O||y?oe:Object(o.createElement)("span",{ref:z},oe)});M.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(P,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=M,I=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(s.isString)(e)&&(n=e),Object(s.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}),z=(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 H=function({children:e,position:t,text:n,shortcut:r}){const[c,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{z(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},b=t=>{z(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},m=e=>"mouseUp"===e?b:"mouseDown"===e?p:void 0,f=m("mouseUp"),g=(t,n)=>r=>{if(z(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&c)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):l(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:m("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?V:W)({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)(I,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:a,position:t,text:n,shortcut:r})})},U=n(46),Y=n(47);const q=["onMouseDown","onClick"];var G=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:c,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:b,disabled:m,icon:f,iconPosition:g="left",iconSize:h,showTooltip:E,tooltipPosition:O,shortcut:w,label:j,children:y,text:v,variant:_,__experimentalIsFocusable:x,describedBy:k,...C}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:c,...i}){let s=c;var a,u,d,p,b;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),r&&(null!==(u=s)&&void 0!==u||(s="tertiary")),n&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(b=s)&&void 0!==b||(s="link")),{...i,variant:s}}(e),S=i()("components-button",b,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!y,"has-icon":!!f}),N=m&&!x,P=void 0===n||N?"button":"a",R="a"===P?{href:n,target:c}:{type:"button",disabled:N,"aria-pressed":u};if(m&&x){R["aria-disabled"]=!0;for(const e of q)C[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!N&&(E&&j||w||!!j&&(!y||Object(s.isArray)(y)&&!y.length)&&!1!==E),L=k?Object(s.uniqueId)():null,A=C["aria-describedby"]||L,B=Object(o.createElement)(P,Object(r.a)({},R,C,{className:S,"aria-label":C["aria-label"]||j,"aria-describedby":A,ref:t}),f&&"left"===g&&Object(o.createElement)(U.a,{icon:f,size:h}),v&&Object(o.createElement)(o.Fragment,null,v),f&&"right"===g&&Object(o.createElement)(U.a,{icon:f,size:h}),y);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(H,{text:k||j,shortcut:w,position:O},B),k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k))):Object(o.createElement)(o.Fragment,null,B,k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k)))}))},,,,function(e,t){e.exports=window.wp.dom},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);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";n.d(t,"a",(function(){return a}));var r=n(6),o=n(9),c=n(0),i=n(17),s=n(54);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(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),b=Object(i.a)(a),m=Object(s.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),c=[t,n,p,b],i=o.getCollectionError(...c);return i&&m(i),{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,n,b,p,u]);return null!==f&&(d.current=f),d.current}},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 s})),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 b})),n.d(t,"e",(function(){return m})),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/",s=c.pluginUrl+"build/",a=c.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),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=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){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 s(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 a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&b())}function b(){if(!u){var e=s(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 m(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];l.push(new m(e,t)),1!==l.length||u||s(b)},m.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 o})),n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return s}));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 s=new r(e,{bubbles:n,cancelable:o,detail:i});c.dispatchEvent(s)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=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";n.d(t,"a",(function(){return r}));const r=e=>e.reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{})},function(e,t,n){"use strict";var r=n(10),o=n.n(r),c=n(0);n(101);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){},,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"b",(function(){return f})),n.d(t,"a",(function(){return g}));var r=n(0),o=(n(8),n(9)),c=n(38),i=n(18),s=n(10),a=n.n(s),l=n(4),u=n.n(l),d=n(116);n(74);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""};var b=e=>{let{className:t,notices:n,removeNotice:o}=e;const c=n.filter(e=>"snackbar"!==e.type);if(!c.length)return null;const i=u()(t,"wc-block-components-notices");return Object(r.createElement)("div",{className:i},c.map(e=>Object(r.createElement)(d.a,a()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",p(e)),onRemove:()=>{e.isDismissible&&o(e.id)}}),e.content)))};const m=Object(r.createContext)({notices:[],createNotice:(e,t,n)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),f=()=>Object(r.useContext)(m),g=e=>{let{children:t,className:n="",createNoticeContainer:s=!0,context:a="wc/core"}=e;const{createNotice:l,removeNotice:u}=Object(o.useDispatch)("core/notices"),[d,p]=Object(r.useState)(!1),{dispatchStoreEvent:f}=Object(c.a)(),{isEditor:g}=Object(i.a)(),h=Object(r.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};l(e,t,{...n,context:n.context||a}),f("store-notice-create",{status:e,content:t,options:n})}),[l,f,a]),E=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;u(e,t)}),[u,a]),{notices:O}=Object(o.useSelect)(e=>({notices:e("core/notices").getNotices(a)}),[a]),w={notices:O,createNotice:h,removeNotice:E,context:a,setIsSuppressed:p},j=d?null:Object(r.createElement)(b,{className:n,notices:w.notices,removeNotice:w.removeNotice,isEditor:g});return Object(r.createElement)(m.Provider,{value:w},s&&j,t)}},,,function(e,t,n){"use strict";var r=n(0),o=n(24);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";var r=n(0);t.a=function(e){let{srcElement:t,size:n=24,...o}=e;return Object(r.isValidElement)(t)?Object(r.cloneElement)(t,{width:n,height:n,...o}):null}},,,function(e,t){},,function(e,t,n){"use strict";var r=n(0),o=(n(8),n(4)),c=n.n(o),i=n(21),s=n(12);n(115),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:n,label:o,onChange:s,options:a,screenReaderLabel:l,readOnly:u,value:d}=e;const p="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:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:p}}),Object(r.createElement)("select",{id:p,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,readOnly:u,value:d},a.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,,,function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return s})),n.d(t,"a",(function(){return a}));var r=n(2),o=n(50),c=n(34);const i=e=>{let{country:t="",state:n="",city:r="",postcode:o=""}=e;return{country:t.trim(),state:n.trim(),city:r.trim(),postcode:o?o.replace(" ","").toUpperCase():""}},s=e=>{let{email:t=""}=e;return Object(c.isEmail)(t)?t.trim():""},a=e=>{const t=Object.keys(r.defaultAddressFields),n=Object(o.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){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},function(e,t){},function(e,t,n){"use strict";var r=n(0),o=n(5),c=n(4),i=n.n(c),s=n(1),a=n(23),l=n(90),u=n(56);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:b=!0,actions:m=[],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(a.speak)(n,t)},[n,t])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":b});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"},m.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:c=!1,onClick:s,url:a},l)=>{let d=o;return"primary"===o||c||(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:s,className:i()("components-notice__action",e)},t)}))),b&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(s.__)("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";n.d(t,"a",(function(){return i}));var r=n(14),o=n(0),c=n(65);n.p=c.k,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([n.e(1),n.e(11)]).then(n.bind(null,364)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>n.e(10).then(n.bind(null,397)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>n.e(18).then(n.bind(null,398)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>n.e(12).then(n.bind(null,365)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>n.e(8).then(n.bind(null,366)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>n.e(16).then(n.bind(null,367)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>n.e(13).then(n.bind(null,288)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>n.e(14).then(n.bind(null,368)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>n.e(9).then(n.bind(null,369)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>n.e(17).then(n.bind(null,370)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>n.e(15).then(n.bind(null,371)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([n.e(0),n.e(49),n.e(7)]).then(n.bind(null,384)))});const i=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.blocks},,,,,,,,,,,,function(e,t,n){e.exports=n(200)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(87),c=n(53),i=n(3),s=(n(8),n(1)),a=n(5),l=n(4),u=n.n(l),d=n(21);n(178);const p=e=>{let{currentPage:t,displayFirstAndLastPages:n,displayNextAndPreviousArrows:o,pagesToDisplay:c,onPageChange:i,totalPages:a}=e,{minIndex:l,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,a);const b=n&&Boolean(1!==l),m=n&&Boolean(p!==a),f=n&&Boolean(l>3),g=n&&Boolean(p<a-2);b&&3===l&&(l-=1),m&&p===a-2&&(p+=1);const h=[];if(l&&p)for(let e=l;e<=p;e++)h.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(d.a,{screenReaderLabel:Object(s.__)("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:()=>i(t-1),title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(d.a,{label:"←",screenReaderLabel:Object(s.__)("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:()=>i(1),disabled:1===t},Object(r.createElement)(d.a,{label:1,screenReaderLabel:Object(s.sprintf)(
4
  /* translators: %d is the page number (1, 2, 3...). */
5
- Object(s.__)("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(s.__)("…","woo-gutenberg-products-block")),h.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?null:()=>i(e),disabled:t===e},Object(r.createElement)(d.a,{label:e,screenReaderLabel:Object(s.sprintf)(
6
  /* translators: %d is the page number (1, 2, 3...). */
7
- Object(s.__)("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(s.__)("…","woo-gutenberg-products-block")),m&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===a,"wc-block-components-pagination__page--active":t===a}),onClick:()=>i(a),disabled:t===a},Object(r.createElement)(d.a,{label:a,screenReaderLabel:Object(s.sprintf)(
8
  /* translators: %d is the page number (1, 2, 3...). */
9
- Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t+1),title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(r.createElement)(d.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))};p.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var b=p,m=n(62),f=n(39),g=n(64),h=n(6),E=n(9),O=n(17);var w=n(38),j=n(71),y=n(49),v=n(23),_=n(98),x=n(24),k=Object(r.createElement)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})),C=()=>{const{parentClassName:e}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(_.a,{className:e+"__no-products-image",alt:"",srcElement:k,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(s.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(s.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},S=Object(r.createElement)(x.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.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})),N=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:n}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:n+"__no-products"},Object(r.createElement)(_.a,{className:n+"__no-products-image",alt:"",srcElement:S,size:100}),Object(r.createElement)("strong",{className:n+"__no-products-title"},Object(s.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:n+"__no-products-description"},Object(s.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(s.__)("Reset Search","woo-gutenberg-products-block")))},P=n(103);n(177);var R=e=>{let{onChange:t,readOnly:n,value:o}=e;return Object(r.createElement)(P.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",name:"orderby",onChange:t,options:[{key:"menu_order",label:Object(s.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(s.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(s.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(s.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(s.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(s.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(s.__)("Order products by","woo-gutenberg-products-block"),value:o})},T=n(12),L=n(10),A=n.n(L),B=n(125);const M=(e,t,n,o)=>{if(!n)return;const c=Object(B.a)(e);return n.map((n,i)=>{let[s,a={}]=n,l=[];a.children&&a.children.length>0&&(l=M(e,t,a.children,o));const u=c[s];if(!u)return null;const d=t.id||0,p=["layout",s,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,A()({},a,{children:l,product:t})))})};var F=Object(T.withInstanceId)(e=>{let{product:t,attributes:n,instanceId:o}=e;const{layoutConfig:c}=n,{parentClassName:i,parentName:s}=Object(y.useInnerBlockLayoutContext)(),a=0===Object.keys(t).length,l=u()(i+"__product","wc-block-layout",{"is-loading":a});return Object(r.createElement)("li",{className:l,"aria-hidden":a},M(s,t,c,o))});n(176);const I=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 D=Object(j.a)(e=>{let{attributes:t,currentPage:n,onPageChange:o,onSortChange:c,sortValue:i,scrollToTop:l}=e;const[d,p]=Object(f.b)("attributes",[]),[j,_]=Object(f.b)("stock_status",[]),[x,k]=Object(f.b)("min_price"),[S,P]=Object(f.b)("max_price"),[T]=Object(f.c)((e=>{let{sortValue:t,currentPage:n,attributes:r}=e;const{columns:o,rows:c}=r;return{...(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"}}})(t),catalog_visibility:"catalog",per_page:o*c,page:n}})({attributes:t,sortValue:i,currentPage:n})),{products:L,totalProducts:A,productsLoading:B}=(e=>{const t={namespace:"/wc/store",resourceName:"products"},{results:n,isLoading:r}=Object(g.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:n,resourceName:r,resourceValues:o=[],query:c={}}=t;if(!n||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const i=Object(O.a)(c),s=Object(O.a)(o),{value:a,isLoading:l=!0}=Object(E.useSelect)(e=>{const t=e(h.COLLECTIONS_STORE_KEY),o=["x-wp-total",n,r,i,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",n,r,s,i]);return{value:a,isLoading:l}})(0,{...t,query:e});return{products:n,totalProducts:parseInt(o,10),productsLoading:r}})(T),{parentClassName:M,parentName:D}=Object(y.useInnerBlockLayoutContext)(),V=(e=>{const{order:t,orderby:n,page:r,per_page:o,...c}=e;return c||{}})(T),{dispatchStoreEvent:W}=Object(w.a)(),z=Object(m.a)({totalQuery:V,totalProducts:A},I);Object(r.useEffect)(()=>{W("product-list-render",{products:L,listName:D})},[L,D,W]),Object(r.useEffect)(()=>{Object(a.isEqual)(V,null==z?void 0:z.totalQuery)||(o(1),null!=z&&z.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(v.speak)(Object(s.__)("No products found","woo-gutenberg-products-block")):Object(v.speak)(Object(s.sprintf)(
10
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
11
- Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(A))},[null==z?void 0:z.totalQuery,A,o,V]);const{contentVisibility:H}=t,U=t.columns*t.rows,Y=!Number.isFinite(A)&&Number.isFinite(null==z?void 0:z.totalProducts)&&Object(a.isEqual)(V,null==z?void 0:z.totalQuery)?Math.ceil(z.totalProducts/U):Math.ceil(A/U),q=L.length?L:Array.from({length:U}),G=0!==L.length||B,Q=d.length>0||j.length>0||Number.isFinite(x)||Number.isFinite(S);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:n,alignButtons:r,align:o}=t,c=void 0!==o?"align"+o:"";return u()(M,c,"has-"+e+"-columns",{"has-multiple-rows":n>1,"has-aligned-buttons":r})})()},H.orderBy&&G&&Object(r.createElement)(R,{onChange:c,value:i}),!G&&Q&&Object(r.createElement)(N,{resetCallback:()=>{p([]),_([]),k(null),P(null)}}),!G&&!Q&&Object(r.createElement)(C,null),G&&Object(r.createElement)("ul",{className:M+"__products"},q.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)(F,{key:e.id||n,attributes:t,product:e})}))),Y>1&&Object(r.createElement)(b,{currentPage:n,onPageChange:e=>{l({focusableSelector:"a, button"}),o(e)},totalPages:Y}))}),V=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)(D,{attributes:t,currentPage:n,onPageChange:e=>{o(e)},onSortChange:e=>{const t=e.target.value;i(t),o(1)},sortValue:c})};const W=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"}));class z extends i.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?W:Object(r.createElement)(y.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(V,{attributes:e,urlParameterSuffix:t}))}}var H=z;Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(r.createElement)(o.a,{context:"wc/all-products"},Object(r.createElement)(H,e)),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})}]);
1
+ !function(e){function t(t){for(var n,o,c=t[0],i=t[1],s=0,l=[];s<c.length;s++)o=c[s],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&l.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(a&&a(t);l.length;)l.shift()()}var n={},r={6: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,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(e){return o.p+""+({0:"vendors--atomic-block-components/add-to-cart--cart-blocks/order-summary--checkout-blocks/billing-ad--c5eb4dcd",1:"vendors--atomic-block-components/price--cart-blocks/line-items--cart-blocks/order-summary--checkout--8a3571de",7:"atomic-block-components/add-to-cart",8:"atomic-block-components/button",9:"atomic-block-components/category-list",10:"atomic-block-components/image",11:"atomic-block-components/price",12:"atomic-block-components/rating",13:"atomic-block-components/sale-badge",14:"atomic-block-components/sku",15:"atomic-block-components/stock-indicator",16:"atomic-block-components/summary",17:"atomic-block-components/tag-list",18:"atomic-block-components/title",49:"vendors--atomic-block-components/add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"9f3f7160cea9fec6b729",1:"44e8b4583ef14d0d1fdc",7:"ee5feb020130d6d54f2f",8:"8422937830a5bcfcf69f",9:"1f06fe341fd8f54234c7",10:"74c8be03232e12b30df4",11:"1b7308b900784c24ba62",12:"46e4dc4d3ef4a90e2519",13:"85bf4bdec9cccca4d188",14:"72dec6d824d90bf826ee",15:"3de4a997f6cb406bd20f",16:"13006ea9de35abe57566",17:"7d00ba6a20aee45636d8",18:"6082a5f049fe4b54cd45",49:"7fb4a4043fde41ff7bfe"}[e]}(e);var a=new Error;i=function(t){s.onerror=s.onload=null,clearTimeout(l);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;a.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",a.name="ChunkLoadError",a.type=o,a.request=c,n[1](a)}r[e]=void 0}};var l=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}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 s=0;s<c.length;s++)t(c[s]);var a=i;o(o.s=175)}([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.React},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 s in r)n.call(r,s)&&r[s]&&e.push(s);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.wc.wcBlocksData},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(42)()},function(e,t){e.exports=window.wp.data},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.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wp.compose},function(e,t,n){"use strict";var r=n(16),o=n.n(r),c=n(0),i=n(3),s=n(1),a=n(65),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(s.__)("Error:","woo-gutenberg-products-block"),button:l,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),l&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};n(37);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:s,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:u}):Object(c.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=window.wc.wcBlocksRegistry},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(11),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 c}));var r=n(0);n(9);const o=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(r.useContext)(o)},function(e,t){e.exports=window.wp.htmlEntities},,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:s={}}=e;const a=null!=n,l=null!=o;return!a&&l?(t=i||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=i||r.Fragment,a&&l&&n!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return w}));var r=n(5),o=n(0),c=n(6),i=n(9),s=n(19),a=n(70),l=n(109),u=n(18),d=n(67);const p=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{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(d.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(d.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",p),document.body.addEventListener("wc-blocks_removed_from_cart",p),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",p),document.body.removeEventListener("wc-blocks_removed_from_cart",p)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},f={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},h={...f,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:""},E=e=>Object(a.a)(Object.entries(e).map(e=>{let[t,n]=e;return[t,Object(s.decodeEntities)(n)]})),O={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:f,shippingRates:c.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:n}=Object(u.a)(),s=null==n?void 0:n.previewCart,{shouldSelect:a}=e,d=Object(o.useRef)();m();const p=Object(i.useSelect)((e,n)=>{let{dispatch:r}=n;if(!a)return O;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:f,extensions:c.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),u=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),b=o.isCustomerDataUpdating(),{receiveCart:m}=r(c.CART_STORE_KEY),g=E(i.billingAddress),w=i.needsShipping?E(i.shippingAddress):g,j=i.fees.length>0?i.fees.map(e=>E(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,cartFees:j,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:u,billingAddress:Object(l.a)(g),shippingAddress:Object(l.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,shippingRatesLoading:b,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:m}},[a]);return d.current&&Object(r.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.primitives},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(45);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){e.exports=window.wp.apiFetch},,,function(e,t){e.exports=window.wp.deprecated},,,,function(e,t){e.exports=window.wp.url},function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"d",(function(){return o})),n.d(t,"c",(function(){return c})),n.d(t,"e",(function(){return i})),n.d(t,"a",(function(){return s}));const r=e=>"number"==typeof e,o=e=>"string"==typeof e,c=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function i(e,t){return c(e)&&t in e}const s=e=>"boolean"==typeof e},,function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(48),o=n(0),c=n(22);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){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return b}));var r=n(6),o=n(9),c=n(0),i=n(11),s=n.n(i),a=n(17),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(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const s=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[s,Object(c.useCallback)(t=>{a(n,e,t)},[n,e,a])]},b=(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),b=Object(l.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{s()(b,p)||(o(Object.assign({},i,p)),m.current=!0)},[i,p,b,o]),m.current?[r,o]:[e,o]}},function(e,t){e.exports=window.wc.priceFormat},,function(e,t,n){"use strict";var r=n(43);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,c,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";var r=n(7),o=n(0),c=n(24),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(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){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(35);const i=Object(r.getSetting)("countryLocale",{}),s=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.b)(e.priority)&&(t.index=e.priority),Object(c.d)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},a=Object.entries(i).map(e=>{let[t,n]=e;return[t,Object.entries(n).map(e=>{let[t,n]=e;return[t,s(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!==a[n]?a[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(10),o=n.n(r),c=n(0),i=n(13);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),l=s(e,n),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:s={},errorBoundaryProps:a={}}=e;Object(c.render)(Object(c.createElement)(i.a,a,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},s,{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(s.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)),a({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);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(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(7),o=n(0),c=n(4),i=n.n(c),s=n(5),a=n(30),l=n.n(a),u=n(12),d=n(60),p=n(90),b=n(1);function m(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 h(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 g=0;function E(){return Object(o.useEffect)(()=>(0===g&&h(!0),++g,()=>{1===g&&h(!1),--g}),[]),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 j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function y({name:e,children:t,registerFill:n,unregisterFill:r}){const c=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(j),[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(s.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var v=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(y,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(s.map)(r(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(c):c)}}var k=e=>Object(o.createElement)(j.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:c})=>Object(o.createElement)(_,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:c})));function x(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function C({name:e,children:t}){const n=w(e),r=Object(o.useRef)({rerender:x()});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 S=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...c},i){const s=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,a])},c))}));function N(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(v,e),Object(o.createElement)(C,e))}n(11),o.Component;const P=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(S,Object(r.a)({},t,{ref:n})):Object(o.createElement)(k,t));function R(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const s=n?parseInt(n,10):0,a=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+l,y:e.top+s,width:e.width-l-u,height:e.height-s-a,left:e.left+l,right:e.right-u,top:e.top+s,bottom:e.bottom-a}}function L(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function B(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function A(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const M=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:c,noArrow:s=!0,isAlternate:a,position:f="bottom right",range:h,focusOnMount:g="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:y,getAnchorRect:v,expandOnMobile:_,animate:k=!0,onClickOutside:x,onFocusOutside:C,__unstableStickyBoundaryElement:S,__unstableSlotName:P="Popover",__unstableObserveElement:M,__unstableBoundaryParent:F,__unstableForcePosition:I,__unstableForceXAlignment:D,...V},W)=>{const z=Object(o.useRef)(null),H=Object(o.useRef)(null),U=Object(o.useRef)(),Y=Object(u.useViewportMatch)("medium","<"),[q,Q]=Object(o.useState)(),K=w(P),X=_&&Y,[J,Z]=Object(u.useResizeObserver)();s=X||s,Object(o.useLayoutEffect)(()=>{if(X)return A(U.current,"is-without-arrow",s),A(U.current,"is-alternate",a),L(U.current,"data-x-axis"),L(U.current,"data-y-axis"),B(U.current,"top"),B(U.current,"left"),B(H.current,"maxHeight"),void B(H.current,"maxWidth");const e=()=>{if(!U.current||!H.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 m(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 m(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,c);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=m(r.getBoundingClientRect(),r.ownerDocument,c);return o?e:T(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),s=m(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,c);return o?s:T(s,r)}if(!e.current)return;const{parentNode:i}=e.current,s=i.getBoundingClientRect();return o?s:T(s,i)}(z,y,v,O,j,U.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=U.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=U.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=Z.height?Z:H.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:h,contentHeight:g,contentWidth:E}=function(e,t,n="top",r,o,c,i,s,a){const[l,u="center",d]=n.split(" "),p=function(e,t,n,r,o,c,i,s){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 b,m=n,f=null;if(!o&&!s)if("middle"===n&&u.contentHeight===a)m="middle";else if("top"===n&&d.contentHeight===a)m="top";else if("bottom"===n&&p.contentHeight===a)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;f=e!==a?e:null}return b="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:b,contentHeight:f}}(e,t,l,d,r,0,c,s);return{...function(e,t,n,r,o,c,i,s,a){const{width:l}=t;"left"===n&&Object(b.isRTL)()?n="right":"right"===n&&Object(b.isRTL)()&&(n="left"),"left"===r&&Object(b.isRTL)()?r="right":"right"===r&&Object(b.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"===c||a||(p=u);let m=e.right;"left"===r?m=e.left:"middle"===c||a||(m=u);const f={popoverLeft:p,contentWidth:p-l>0?l:p},h={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let g,E=n,O=null;if(!o&&!s)if("center"===n&&d.contentWidth===l)E="center";else if("left"===n&&f.contentWidth===l)E="left";else if("right"===n&&h.contentWidth===l)E="right";else{E=f.contentWidth>h.contentWidth?"left":"right";const e="left"===E?f.contentWidth:h.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===E?d.popoverLeft:"left"===E?f.popoverLeft:h.popoverLeft,i){const e=i.getBoundingClientRect();g=Math.min(g,e.right-l),Object(b.isRTL)()||(g=Math.max(g,0))}return{xAxis:E,popoverLeft:g,contentWidth:O}}(e,t,u,d,r,p.yAxis,i,s,a),...p}}(e,i,f,S,U.current,o,r,I,D);"number"==typeof l&&"number"==typeof u&&(B(U.current,"top",l+"px"),B(U.current,"left",u+"px")),A(U.current,"is-without-arrow",s||"center"===p&&"middle"===h),A(U.current,"is-alternate",a),L(U.current,"data-x-axis",p),L(U.current,"data-y-axis",h),B(H.current,"maxHeight","number"==typeof g?g+"px":""),B(H.current,"maxWidth","number"==typeof E?E+"px":""),Q(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))};e();const{ownerDocument:t}=U.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 l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),M&&(l=new n.MutationObserver(e),l.observe(M,{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)),l&&l.disconnect()}},[X,y,v,O,j,f,Z,S,M,F]);const $=(e,n)=>{if("focus-outside"===e&&C)C(n);else if("focus-outside"===e&&x){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),x(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:$,onClose:$}),ne=Object(u.useMergeRefs)([U,ee,W]),re=Boolean(k&&q)&&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:q});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",c,re,{"is-expanded":X,"is-without-arrow":s,"is-alternate":a})},V,{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)(G,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:H,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,n)));return K.ref&&(oe=Object(o.createElement)(N,{name:P},oe)),O||y?oe:Object(o.createElement)("span",{ref:z},oe)});M.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(P,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=M,I=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(s.isString)(e)&&(n=e),Object(s.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}),z=(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 H=function({children:e,position:t,text:n,shortcut:r}){const[c,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{z(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},b=t=>{z(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},m=e=>"mouseUp"===e?b:"mouseDown"===e?p:void 0,f=m("mouseUp"),h=(t,n)=>r=>{if(z(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&c)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",f)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:h("onMouseEnter",!0),onMouseLeave:h("onMouseLeave"),onClick:h("onClick"),onFocus:h("onFocus"),onBlur:h("onBlur"),onMouseDown:m("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?V:W)({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)(I,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:a,position:t,text:n,shortcut:r})})},U=n(46),Y=n(47);const q=["onMouseDown","onClick"];var G=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:c,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:b,disabled:m,icon:f,iconPosition:h="left",iconSize:g,showTooltip:E,tooltipPosition:O,shortcut:w,label:j,children:y,text:v,variant:_,__experimentalIsFocusable:k,describedBy:x,...C}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:c,...i}){let s=c;var a,u,d,p,b;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),r&&(null!==(u=s)&&void 0!==u||(s="tertiary")),n&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(b=s)&&void 0!==b||(s="link")),{...i,variant:s}}(e),S=i()("components-button",b,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!y,"has-icon":!!f}),N=m&&!k,P=void 0===n||N?"button":"a",R="a"===P?{href:n,target:c}:{type:"button",disabled:N,"aria-pressed":u};if(m&&k){R["aria-disabled"]=!0;for(const e of q)C[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!N&&(E&&j||w||!!j&&(!y||Object(s.isArray)(y)&&!y.length)&&!1!==E),L=x?Object(s.uniqueId)():null,B=C["aria-describedby"]||L,A=Object(o.createElement)(P,Object(r.a)({},R,C,{className:S,"aria-label":C["aria-label"]||j,"aria-describedby":B,ref:t}),f&&"left"===h&&Object(o.createElement)(U.a,{icon:f,size:g}),v&&Object(o.createElement)(o.Fragment,null,v),f&&"right"===h&&Object(o.createElement)(U.a,{icon:f,size:g}),y);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(H,{text:x||j,shortcut:w,position:O},A),x&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},x))):Object(o.createElement)(o.Fragment,null,A,x&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},x)))}))},,,,function(e,t){e.exports=window.wp.dom},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);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";n.d(t,"a",(function(){return a}));var r=n(6),o=n(9),c=n(0),i=n(17),s=n(54);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(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),b=Object(i.a)(a),m=Object(s.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),c=[t,n,p,b],i=o.getCollectionError(...c);return i&&m(i),{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,n,b,p,u]);return null!==f&&(d.current=f),d.current}},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 s})),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 b})),n.d(t,"e",(function(){return m})),n.d(t,"g",(function(){return f})),n.d(t,"a",(function(){return h})),n.d(t,"h",(function(){return g})),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/",s=c.pluginUrl+"build/",a=c.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),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),h=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},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 s(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 a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&b())}function b(){if(!u){var e=s(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 m(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];l.push(new m(e,t)),1!==l.length||u||s(b)},m.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 o})),n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return s}));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 s=new r(e,{bubbles:n,cancelable:o,detail:i});c.dispatchEvent(s)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=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";n.d(t,"a",(function(){return r}));const r=e=>e.reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{})},function(e,t,n){"use strict";var r=n(10),o=n.n(r),c=n(0);n(101);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){},,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"b",(function(){return f})),n.d(t,"a",(function(){return h}));var r=n(0),o=(n(8),n(9)),c=n(38),i=n(18),s=n(10),a=n.n(s),l=n(4),u=n.n(l),d=n(116);n(74);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""};var b=e=>{let{className:t,notices:n,removeNotice:o}=e;const c=n.filter(e=>"snackbar"!==e.type);if(!c.length)return null;const i=u()(t,"wc-block-components-notices");return Object(r.createElement)("div",{className:i},c.map(e=>Object(r.createElement)(d.a,a()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",p(e)),onRemove:()=>{e.isDismissible&&o(e.id)}}),e.content)))};const m=Object(r.createContext)({notices:[],createNotice:(e,t,n)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),f=()=>Object(r.useContext)(m),h=e=>{let{children:t,className:n="",createNoticeContainer:s=!0,context:a="wc/core"}=e;const{createNotice:l,removeNotice:u}=Object(o.useDispatch)("core/notices"),[d,p]=Object(r.useState)(!1),{dispatchStoreEvent:f}=Object(c.a)(),{isEditor:h}=Object(i.a)(),g=Object(r.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};l(e,t,{...n,context:n.context||a}),f("store-notice-create",{status:e,content:t,options:n})}),[l,f,a]),E=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;u(e,t)}),[u,a]),{notices:O}=Object(o.useSelect)(e=>({notices:e("core/notices").getNotices(a)}),[a]),w={notices:O,createNotice:g,removeNotice:E,context:a,setIsSuppressed:p},j=d?null:Object(r.createElement)(b,{className:n,notices:w.notices,removeNotice:w.removeNotice,isEditor:h});return Object(r.createElement)(m.Provider,{value:w},s&&j,t)}},,,function(e,t,n){"use strict";var r=n(0),o=n(24);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";var r=n(0);t.a=function(e){let{srcElement:t,size:n=24,...o}=e;return Object(r.isValidElement)(t)?Object(r.cloneElement)(t,{width:n,height:n,...o}):null}},,,function(e,t){},,function(e,t,n){"use strict";var r=n(0),o=(n(8),n(4)),c=n.n(o),i=n(21),s=n(12);n(115),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:n,label:o,onChange:s,options:a,screenReaderLabel:l,readOnly:u,value:d}=e;const p="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:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:p}}),Object(r.createElement)("select",{id:p,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,readOnly:u,value:d},a.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,,,function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return s})),n.d(t,"a",(function(){return a}));var r=n(2),o=n(50),c=n(34);const i=e=>{let{country:t="",state:n="",city:r="",postcode:o=""}=e;return{country:t.trim(),state:n.trim(),city:r.trim(),postcode:o?o.replace(" ","").toUpperCase():""}},s=e=>{let{email:t=""}=e;return Object(c.isEmail)(t)?t.trim():""},a=e=>{const t=Object.keys(r.defaultAddressFields),n=Object(o.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){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},function(e,t){},function(e,t,n){"use strict";var r=n(0),o=n(5),c=n(4),i=n.n(c),s=n(1),a=n(23),l=n(90),u=n(56);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:b=!0,actions:m=[],politeness:f=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])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":b});return h&&(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"},m.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:c=!1,onClick:s,url:a},l)=>{let d=o;return"primary"===o||c||(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:s,className:i()("components-notice__action",e)},t)}))),b&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(s.__)("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,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(15),o=n(0),c=n(65);n.p=c.k,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([n.e(1),n.e(11)]).then(n.bind(null,364)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>n.e(10).then(n.bind(null,397)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>n.e(18).then(n.bind(null,398)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>n.e(12).then(n.bind(null,365)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>n.e(8).then(n.bind(null,366)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>n.e(16).then(n.bind(null,367)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>n.e(13).then(n.bind(null,288)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>n.e(14).then(n.bind(null,368)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>n.e(9).then(n.bind(null,369)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>n.e(17).then(n.bind(null,370)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>n.e(15).then(n.bind(null,371)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([n.e(0),n.e(49),n.e(7)]).then(n.bind(null,384)))});const i=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.blocks},,,,,,,,,,,,function(e,t,n){e.exports=n(200)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(87),c=n(53),i=n(3),s=(n(8),n(1)),a=n(5),l=n(4),u=n.n(l),d=n(21);n(178);const p=e=>{let{currentPage:t,displayFirstAndLastPages:n,displayNextAndPreviousArrows:o,pagesToDisplay:c,onPageChange:i,totalPages:a}=e,{minIndex:l,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,a);const b=n&&Boolean(1!==l),m=n&&Boolean(p!==a),f=n&&Boolean(l>3),h=n&&Boolean(p<a-2);b&&3===l&&(l-=1),m&&p===a-2&&(p+=1);const g=[];if(l&&p)for(let e=l;e<=p;e++)g.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(d.a,{screenReaderLabel:Object(s.__)("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:()=>i(t-1),title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(d.a,{label:"←",screenReaderLabel:Object(s.__)("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:()=>i(1),disabled:1===t},Object(r.createElement)(d.a,{label:1,screenReaderLabel:Object(s.sprintf)(
4
  /* translators: %d is the page number (1, 2, 3...). */
5
+ Object(s.__)("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(s.__)("…","woo-gutenberg-products-block")),g.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?null:()=>i(e),disabled:t===e},Object(r.createElement)(d.a,{label:e,screenReaderLabel:Object(s.sprintf)(
6
  /* translators: %d is the page number (1, 2, 3...). */
7
+ Object(s.__)("Page %d","woo-gutenberg-products-block"),e)}))),h&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),m&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===a,"wc-block-components-pagination__page--active":t===a}),onClick:()=>i(a),disabled:t===a},Object(r.createElement)(d.a,{label:a,screenReaderLabel:Object(s.sprintf)(
8
  /* translators: %d is the page number (1, 2, 3...). */
9
+ Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t+1),title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(r.createElement)(d.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))};p.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var b=p,m=n(62),f=n(39),h=n(64),g=n(6),E=n(9),O=n(17);var w=n(38),j=n(71),y=n(49),v=n(23),_=n(98),k=n(24),x=Object(r.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})),C=()=>{const{parentClassName:e}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(_.a,{className:e+"__no-products-image",alt:"",srcElement:x,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(s.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(s.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},S=Object(r.createElement)(k.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.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})),N=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:n}=Object(y.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:n+"__no-products"},Object(r.createElement)(_.a,{className:n+"__no-products-image",alt:"",srcElement:S,size:100}),Object(r.createElement)("strong",{className:n+"__no-products-title"},Object(s.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:n+"__no-products-description"},Object(s.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(s.__)("Reset Search","woo-gutenberg-products-block")))},P=n(103);n(177);var R=e=>{let{onChange:t,readOnly:n,value:o}=e;return Object(r.createElement)(P.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",name:"orderby",onChange:t,options:[{key:"menu_order",label:Object(s.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(s.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(s.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(s.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(s.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(s.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(s.__)("Order products by","woo-gutenberg-products-block"),value:o})},T=n(12),L=n(10),B=n.n(L),A=n(125);const M=(e,t,n,o)=>{if(!n)return;const c=Object(A.a)(e);return n.map((n,i)=>{let[s,a={}]=n,l=[];a.children&&a.children.length>0&&(l=M(e,t,a.children,o));const u=c[s];if(!u)return null;const d=t.id||0,p=["layout",s,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,B()({},a,{children:l,product:t})))})};var F=Object(T.withInstanceId)(e=>{let{product:t,attributes:n,instanceId:o}=e;const{layoutConfig:c}=n,{parentClassName:i,parentName:s}=Object(y.useInnerBlockLayoutContext)(),a=0===Object.keys(t).length,l=u()(i+"__product","wc-block-layout",{"is-loading":a});return Object(r.createElement)("li",{className:l,"aria-hidden":a},M(s,t,c,o))});n(176);const I=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 D=Object(j.a)(e=>{let{attributes:t,currentPage:n,onPageChange:o,onSortChange:c,sortValue:i,scrollToTop:l}=e;const[d,p]=Object(f.b)("attributes",[]),[j,_]=Object(f.b)("stock_status",[]),[k,x]=Object(f.b)("min_price"),[S,P]=Object(f.b)("max_price"),[T]=Object(f.c)((e=>{let{sortValue:t,currentPage:n,attributes:r}=e;const{columns:o,rows:c}=r;return{...(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"}}})(t),catalog_visibility:"catalog",per_page:o*c,page:n}})({attributes:t,sortValue:i,currentPage:n})),{products:L,totalProducts:B,productsLoading:A}=(e=>{const t={namespace:"/wc/store",resourceName:"products"},{results:n,isLoading:r}=Object(h.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:n,resourceName:r,resourceValues:o=[],query:c={}}=t;if(!n||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const i=Object(O.a)(c),s=Object(O.a)(o),{value:a,isLoading:l=!0}=Object(E.useSelect)(e=>{const t=e(g.COLLECTIONS_STORE_KEY),o=["x-wp-total",n,r,i,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",n,r,s,i]);return{value:a,isLoading:l}})(0,{...t,query:e});return{products:n,totalProducts:parseInt(o,10),productsLoading:r}})(T),{parentClassName:M,parentName:D}=Object(y.useInnerBlockLayoutContext)(),V=(e=>{const{order:t,orderby:n,page:r,per_page:o,...c}=e;return c||{}})(T),{dispatchStoreEvent:W}=Object(w.a)(),z=Object(m.a)({totalQuery:V,totalProducts:B},I);Object(r.useEffect)(()=>{W("product-list-render",{products:L,listName:D})},[L,D,W]),Object(r.useEffect)(()=>{Object(a.isEqual)(V,null==z?void 0:z.totalQuery)||(o(1),null!=z&&z.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(v.speak)(Object(s.__)("No products found","woo-gutenberg-products-block")):Object(v.speak)(Object(s.sprintf)(
10
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
11
+ Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(B))},[null==z?void 0:z.totalQuery,B,o,V]);const{contentVisibility:H}=t,U=t.columns*t.rows,Y=!Number.isFinite(B)&&Number.isFinite(null==z?void 0:z.totalProducts)&&Object(a.isEqual)(V,null==z?void 0:z.totalQuery)?Math.ceil(z.totalProducts/U):Math.ceil(B/U),q=L.length?L:Array.from({length:U}),G=0!==L.length||A,Q=d.length>0||j.length>0||Number.isFinite(k)||Number.isFinite(S);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:n,alignButtons:r,align:o}=t,c=void 0!==o?"align"+o:"";return u()(M,c,"has-"+e+"-columns",{"has-multiple-rows":n>1,"has-aligned-buttons":r})})()},H.orderBy&&G&&Object(r.createElement)(R,{onChange:c,value:i}),!G&&Q&&Object(r.createElement)(N,{resetCallback:()=>{p([]),_([]),x(null),P(null)}}),!G&&!Q&&Object(r.createElement)(C,null),G&&Object(r.createElement)("ul",{className:M+"__products"},q.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)(F,{key:e.id||n,attributes:t,product:e})}))),Y>1&&Object(r.createElement)(b,{currentPage:n,onPageChange:e=>{l({focusableSelector:"a, button"}),o(e)},totalPages:Y}))}),V=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)(D,{attributes:t,currentPage:n,onPageChange:e=>{o(e)},onSortChange:e=>{const t=e.target.value;i(t),o(1)},sortValue:c})};const W=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"}));class z extends i.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?W:Object(r.createElement)(y.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(V,{attributes:e,urlParameterSuffix:t}))}}var H=z;Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(r.createElement)(o.a,{context:"wc/all-products"},Object(r.createElement)(H,e)),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})}]);
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' => 'ed1e2f826ee5e12308a6847c617fa53b');
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' => '2fa02865ac46a64f5becfa2ff4c391c9');
build/all-products.js CHANGED
@@ -1,11 +1,11 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var o,a,s=t[0],l=t[1],i=t[2],b=0,d=[];b<s.length;b++)a=s[b],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&d.push(r[a][0]),r[a]=0;for(o in l)Object.prototype.hasOwnProperty.call(l,o)&&(e[o]=l[o]);for(u&&u(t);d.length;)d.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],o=!0,s=1;s<c.length;s++){var l=c[s];0!==r[l]&&(o=!1)}o&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var o={},r={7:0,1:0,2:0,3:0,4:0,5:0,10:0,11:0,13:0,14:0,15:0,16:0,17:0,18:0},n=[];function a(t){if(o[t])return o[t].exports;var c=o[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=r[e];if(0!==c)if(c)t.push(c[2]);else{var o=new Promise((function(t,o){c=r[e]=[t,o]}));t.push(c[2]=o);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:"atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---8f355022",2:"atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b",3:"atomic-block-components/stock-indicator--atomic-block-components/summary--atomic-block-components/title",4:"atomic-block-components/add-to-cart--atomic-block-components/button",5:"atomic-block-components/sale-badge",9:"atomic-block-components/add-to-cart",10:"atomic-block-components/button",11:"atomic-block-components/category-list",12:"atomic-block-components/image",13:"atomic-block-components/price",14:"atomic-block-components/rating",15:"atomic-block-components/sku",16:"atomic-block-components/stock-indicator",17:"atomic-block-components/summary",18:"atomic-block-components/tag-list",19:"atomic-block-components/title"}[e]||e)+".js?ver="+{1:"f50e847d1ee621be60aa",2:"41f5c036459bcad44a7d",3:"5237971cb311f02de6cb",4:"d2dd37558d14f3d7266d",5:"456da5ad7931015df375",9:"67c959d8fb701b720b0a",10:"3ea49eb9eaed51ed672d",11:"d6e38aa04ac0aaa7b451",12:"f9b09372c56e1ee55df0",13:"fb8b6e9b4354d94e9a2e",14:"9d4c32fcf70f153c5781",15:"be02edf8d29542f0b7c6",16:"f1b33ab4dbf4f6cff131",17:"03cbae0c226b3072d661",18:"b6375f8334cf0aa02bf4",19:"244f2823473b15acc568"}[e]}(e);var l=new Error;n=function(t){s.onerror=s.onload=null,clearTimeout(i);var c=r[e];if(0!==c){if(c){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+o+": "+n+")",l.name="ChunkLoadError",l.type=o,l.request=n,c[1](l)}r[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=o,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 o in e)a.d(c,o,function(t){return e[t]}.bind(null,o));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([355,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.lodash},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.compose},,function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wc.wcBlocksData},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 o=c(0),r=c(6),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(r.groupBy)(e,"parent"),o=Object(r.keyBy)(t,"id"),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=n(o[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=c[e.id];return delete c[e.id],{...e,breadcrumbs:n(o[e.parent]),children:t&&t.length?a(t):[]}}),s=a(c[0]||[]);return delete c[0],Object(r.forEach)(c,e=>{s.push(...a(e||[]))}),s},l=(e,t,c)=>{if(!t)return c?s(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),r=e.map(e=>!!o.test(e.name)&&e).filter(Boolean);return c?s(r,e):r},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(o.createElement)(o.Fragment,{key:c},Object(o.createElement)("strong",null,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){e.exports=window.wp.primitives},,,,,,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 b})),c.d(t,"g",(function(){return d})),c.d(t,"k",(function(){return m})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return h})),c.d(t,"i",(function(){return j})),c.d(t,"b",(function(){return E}));var o,r=c(2);const n=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(o=r.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,u=r.STORE_PAGES.checkout.id,b=r.STORE_PAGES.checkout.permalink,d=r.STORE_PAGES.privacy.permalink,m=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),p=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),g=r.STORE_PAGES.cart.permalink,O=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),h=Object(r.getSetting)("allowedCountries",{}),j=Object(r.getSetting)("shippingStates",{}),E=Object(r.getSetting)("allowedStates",{})},,function(e,t){e.exports=window.wp.isShallowEqual},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 b})),c.d(t,"i",(function(){return d})),c.d(t,"f",(function(){return m})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return h}));var o=c(15),r=c(11),n=c.n(r),a=c(6),s=c(2),l=c(24);const i=e=>{let{selected:t=[],search:c="",queryArgs:r={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:r={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(o.addQueryArgs)("/wc/store/products",{...a,...r})];return n&&t.length&&s.push(Object(o.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:r});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/products/"+e}),b=()=>n()({path:"wc/store/products/attributes"}),d=e=>n()({path:`wc/store/products/attributes/${e}/terms`}),m=e=>{let{selected:t=[],search:c}=e;const r=(e=>{let{selected:t=[],search:c}=e;const r=Object(s.getSetting)("limitTags",!1),n=[Object(o.addQueryArgs)("wc/store/products/tags",{per_page:r?100:0,orderby:r?"count":"name",order:r?"desc":"asc",search:c})];return r&&t.length&&n.push(Object(o.addQueryArgs)("wc/store/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(r.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},p=e=>n()({path:Object(o.addQueryArgs)("wc/store/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/products/categories/"+e}),O=e=>n()({path:Object(o.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})}),h=(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 r})),c.d(t,"b",(function(){return n}));var o=c(1);const r=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"}},n=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?void 0:e.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,c){"use strict";var o=c(0),r=c(4),n=c.n(r);t.a=e=>{let t,{label:c,screenReaderLabel:r,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=r;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,r)):(t=a||o.Fragment,l&&i&&c!==r?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},c),Object(o.createElement)("span",{className:"screen-reader-text"},r)):Object(o.createElement)(t,s,c))}},function(e,t){e.exports=window.wp.escapeHtml},function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(31);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(o.createElement)("span",null,Object(r.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(o.createElement)("span",null,Object(r.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(r.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var o=c(5),r=c.n(o),n=c(0),a=c(17);const s=e=>{let{countLabel:t,className:c,depth:o=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+o),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,h=m.name||"search-list-item-"+s,j=`${h}-${l.id}`;return Object(n.createElement)("label",{htmlFor:j,className:g.join(" ")},u?Object(n.createElement)("input",r()({type:"radio",id:j,name:h,value:l.value,onChange:b(l),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(n.createElement)("input",r()({type:"checkbox",id:j,name:h,value:l.value,onChange:b(l),checked:i,className:"woocommerce-search-list__item-input"},m)),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,d))),!!p&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},,function(e,t){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var o=c(6),r=c(0),n=c(16),a=c(13),s=c(14),l=c(151),i=c(251),u=c(49),b=c(250);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},m=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(r.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(b.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(b.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++})(),m),[])},g={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},O={...g,email:""},h={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(l.a)(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),E={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:g,shippingRates:n.EMPTY_SHIPPING_RATES,shippingRatesLoading:!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(u.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:l}=e,b=Object(r.useRef)();p();const d=Object(a.useSelect)((e,c)=>{let{dispatch:o}=c;if(!l)return E;if(t)return{cartCoupons:s.coupons,cartItems:s.items,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,billingAddress:O,shippingAddress:g,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const r=e(n.CART_STORE_KEY),a=r.getCartData(),u=r.getCartErrors(),b=r.getCartTotals(),d=!r.hasFinishedResolution("getCartData"),m=r.isCustomerDataUpdating(),{receiveCart:p}=o(n.CART_STORE_KEY),h=j(a.billingAddress),_=a.needsShipping?j(a.shippingAddress):h,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,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:b,cartIsLoading:d,cartErrors:u,billingAddress:Object(i.a)(h),shippingAddress:Object(i.a)(_),extensions:a.extensions,shippingRates:a.shippingRates,shippingRatesLoading:m,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:p}},[l]);return b.current&&Object(o.isEqual)(b.current,d)||(b.current=d),b.current}},,function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var o=c(0),r=c(26),n=c.n(r);function a(e){const t=Object(o.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(134),s=c(4),l=c.n(s);c(140);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:o,onValueChange:s,displayType:u="text",...b}=e;const d="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(d))return null;const m=d/10**o.minorUnit;if(!Number.isFinite(m))return null;const p=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...b,...i(o),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**o.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,r()({className:p,displayType:u},g,{value:m,onValueChange:O}))}},,function(e,t,c){"use strict";var o=c(0);t.a=function(e){let{srcElement:t,size:c=24,...r}=e;return Object(o.isValidElement)(t)?Object(o.cloneElement)(t,{width:c,height:c,...r}):null}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"c",(function(){return b}));var o=c(64);let r,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(r||(r={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const a=(e,t)=>Object(o.b)(e)&&"type"in e&&e.type===t,s=e=>a(e,r.SUCCESS),l=e=>a(e,r.ERROR),i=e=>a(e,r.FAIL),u=e=>!Object(o.b)(e)||void 0===e.retry||!0===e.retry,b=()=>({responseTypes:r,noticeContexts:n,shouldRetry:u,isSuccessResponse:s,isErrorResponse:l,isFailResponse:i})},,function(e,t){e.exports=window.wp.a11y},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(0),r=c(130);const n=()=>{const{notices:e,createNotice:t,removeNotice:c,setIsSuppressed:n}=Object(r.b)(),a=Object(o.useRef)(e);Object(o.useEffect)(()=>{a.current=e},[e]);const s=Object(o.useMemo)(()=>({hasNoticesOfType:e=>a.current.some(t=>t.type===e),removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a.current.forEach(t=>{null!==e&&t.status!==e||c(t.id)})},removeNotice:c}),[c]),l=Object(o.useMemo)(()=>({addDefaultNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("default",e,{...c})},addErrorNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("error",e,{...c})},addWarningNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("warning",e,{...c})},addInfoNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("info",e,{...c})},addSuccessNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("success",e,{...c})}}),[t]);return{notices:e,...s,...l,setIsSuppressed:n}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(0);const r=Object(o.createContext)("page"),n=()=>Object(o.useContext)(r);r.Provider},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var o=c(0),r=c(13);const n=Object(o.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(o.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(r.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(o.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(o.createElement)(n.Provider,{value:u},t)}},,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(6),s=c(4),l=c.n(s),i=c(3),u=c(9);c(84);class b extends n.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:o,help:s,options:u,value:b}=this.props,d="inspector-toggle-button-control-"+c;let m;return s&&(m=Object(a.isFunction)(s)?s(t):s),Object(n.createElement)(i.BaseControl,{id:d,help:m,className:l()("components-toggle-button-control",o)},Object(n.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},e),Object(n.createElement)(i.ButtonGroup,{"aria-labelledby":d+"__label"},u.map((t,c)=>{const o={};return b===t.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!0,o["aria-pressed"]=!1),Object(n.createElement)(i.Button,r()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},o),t.label)})))}}t.a=Object(u.withInstanceId)(b)},,,,function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(6),a=(c(10),c(3));t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:b=1,maxRows:d=6}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(a.RangeControl,{label:Object(r.__)("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(o.createElement)(a.RangeControl,{label:Object(r.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,b,d);s({rows:Number.isNaN(t)?"":t})},min:b,max:d}),Object(o.createElement)(a.ToggleControl,{label:Object(r.__)("Align Last Block","woo-gutenberg-products-block"),help:l?Object(r.__)("The last inner block will be aligned vertically.","woo-gutenberg-products-block"):Object(r.__)("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 o=c(61),r=c(0),n=c(36);const a=()=>{const e=Object(n.a)(),t=Object(r.useRef)(e);return Object(r.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(r.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t){e.exports=window.wp.hooks},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"c",(function(){return r})),c.d(t,"b",(function(){return n})),c.d(t,"d",(function(){return a}));const o=e=>"number"==typeof e,r=e=>"string"==typeof e,n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function a(e,t){return n(e)&&t in e}},,function(e,t){e.exports=window.wp.deprecated},,,,function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"a",(function(){return s})),c.d(t,"b",(function(){return l}));var o=c(12),r=c(24);const n=(e,t)=>{if(r.n>2)return Object(o.registerBlockType)(e,t)},a=(e,t)=>{if(r.n>1)return Object(o.registerBlockType)(e,t)},s=()=>r.n>2,l=()=>r.n>1},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return m}));var o=c(16),r=c(13),n=c(0),a=c(26),s=c.n(a),l=c(39),i=c(109),u=c(48);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(r.useSelect)(t=>t(o.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(r.useDispatch)(o.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},d=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(r.useSelect)(r=>r(o.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(r.useDispatch)(o.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[o,r]=b(t),a=Object(l.a)(o),d=Object(l.a)(e),m=Object(i.a)(d),p=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(m,d)||(r(Object.assign({},a,d)),p.current=!0)},[a,d,m,r]),p.current?[o,r]:[e,r]}},,,function(e,t){e.exports=window.wp.autop},,,,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(139),s=c(4),l=c.n(s),i=c(100);c(160),t.a=e=>{let{className:t,showSpinner:c=!1,children:o,...s}=e;const u=l()("wc-block-components-button",t,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,r()({className:u},s),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},o))}},,function(e,t){e.exports=window.wp.dom},,function(e,t){},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var o=c(5),r=c.n(o),n=c(0),a=c(1),s=c(3),l=c(484),i=c(486),u=c(4),b=c.n(u),d=c(9),m=c(17),p=c(33),g=c(485),O=c(14);const h=e=>{let{id:t,label:c,popoverContents:o,remove:r,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(n.useState)(!1),j=Object(d.useInstanceId)(h);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const E=b()("woocommerce-tag",u,{"has-remove":!!r}),_="woocommerce-tag__label-"+j,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:E},o?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:_,onClick:()=>p(!0)},w):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:_},w),o&&m&&Object(n.createElement)(s.Popover,{onClose:()=>p(!1)},o),r&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:r(t),label:Object(a.sprintf)(// Translators: %s label.
6
  Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":_},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var j=h;const E=e=>Object(n.createElement)(p.b,e),_=e=>{const{list:t,selected:c,renderItem:o,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const b=-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,o({item:t,isSelected:b,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(_,r()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:o,messages:r,onChange:l,onRemove:i}=e;if(t||c||!o)return null;const u=o.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,r.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":r.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,o.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(j,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:o,instanceId:r,...s}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=s,p=b||E;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)(_,{list:t,selected:d,renderItem:p,onSelect:o,instanceId:r,isSingle:m,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:o,isLoading:a,isSingle:l,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:h}=e,[j,E]=Object(n.useState)(""),_=Object(d.useInstanceId)(k),v=Object(n.useMemo)(()=>({...m.a,...u}),[u]),y=Object(n.useMemo)(()=>Object(m.c)(i,j,o),[i,j,o]);Object(n.useEffect)(()=>{h&&h(v.updated)},[h,v]),Object(n.useEffect)(()=>{"function"==typeof g&&g(j)},[j,g]);const S=Object(n.useCallback)(e=>()=>{l&&p([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});p([...O.slice(0,t),...O.slice(t+1)])},[l,O,p]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?p(l?[e]:[...O,e]):S(e.id)()},[l,S,p,O]);return Object(n.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,r()({},e,{onRemove:S,messages:v})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:v.search,type:"search",value:j,onChange:e=>E(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,r()({},e,{search:j,filteredList:y,messages:v,onSelect:C,instanceId:_})))};Object(s.withSpokenMessages)(k)},,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(33),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:o,isLoading:l,onSelect:u,disabled:b,...d}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,r()({},d,{key:c.id,className:t,isSelected:o,item:c,onSelect:u,isSingle:!0,disabled:b})),o&&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";var o=c(0),r=c(6),n=c(1),a=c(3);function s(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(o.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)(a.Path,{d:c[t]})):null}class l extends o.Component{createLevelControl(e,t,c){const r=e===t;return{icon:Object(o.createElement)(s,{level:e}),title:Object(n.sprintf)(
7
  /* translators: %s: heading level e.g: "2", "3", "4" */
8
- Object(n.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:n,onChange:l}=this.props;return Object(o.createElement)(a.ToolbarGroup,{isCollapsed:e,icon:Object(o.createElement)(s,{level:n}),controls:Object(r.range)(t,c).map(e=>this.createLevelControl(e,n,l))})}}t.a=l},,function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(43),a=c(122),s=c(2),l=c(7),i=c(29);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(o.createElement)(l.InspectorControls,null,Object(o.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(o.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(o.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(r.__)("Edit this product's details","woo-gutenberg-products-block"),Object(o.createElement)(n.a,{srcElement:a.a,size:16}))),Object(o.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(r.__)("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 r}));var o=c(0);const r=()=>{const[,e]=Object(o.useState)();return Object(o.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,function(e,t,c){"use strict";var o=c(2),r=c(1),n=c(64);const a=Object(o.getSetting)("countryLocale",{}),s=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(r.sprintf)(
9
  /* translators: %s Field label. */
10
  Object(r.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(n.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(a).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,s(c)]}).reduce((e,t)=>{let[c,o]=t;return e[c]=o,e},{})]}).reduce((e,t)=>{let[c,o]=t;return e[c]=o,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=c&&void 0!==l[c]?l[c]:{};return e.map(e=>({key:e,...o.defaultAddressFields[e]||{},...r[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var o=c(0);c(161),t.a=()=>Object(o.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t){e.exports=window.wp.wordcount},function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(1),s=c(6),l=(c(10),c(33)),i=c(87),u=c(9),b=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Object(n.createElement)(e,r()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),d=c(193),m=c(25),p=c.n(m),g=c(26),O=c.n(g),h=c(27),j=c(28),E=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),p()(this,"state",{error:null,loading:!1,variations:{}}),p()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const o=this.getExpandedProduct();if(!o||c[o])return;const r=e.find(e=>e.id===o);r.variations&&0!==r.variations.length?(this.setState({loading:!0}),Object(h.g)(o).then(e=>{const t=e.map(e=>({...e,parent:o}));this.setState({variations:{...this.state.variations,[o]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(j.a)(e);this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[o]: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:o}=this.props;o&&(!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){const{products:t}=this.props;return t.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0].id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let o=t&&t.length?t[0]:null;return o?this.prevSelectedItem=o:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(o=this.prevSelectedItem)),!e&&o?this.isProductId(o)?o:this.findParentProduct(o):null}render(){const{error:t,isLoading:c}=this.props,{error:o,loading:a,variations:s}=this.state;return Object(n.createElement)(e,r()({},this.props,{error:o||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return p()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),_=c(32),w=c(4),f=c.n(w),k=c(89);c(142);const v={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")},y=e=>{let{expandedProduct:t,error:c,instanceId:o,isCompact:u,isLoading:b,onChange:d,onSearch:m,products:p,renderItem:g,selected:O,showVariations:h,variations:j,variationsLoading:E}=e;if(c)return Object(n.createElement)(_.a,{error:c});const w=[...p,...j&&j[t]?j[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:w,isCompact:u,isLoading:b,isSingle:!0,selected:w.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:d,renderItem:g||(h?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:d}=e,m=t.variations&&Array.isArray(t.variations)?t.variations.length:0,p=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":m>0});if(!t.breadcrumbs.length)return Object(n.createElement)(k.a,r()({},e,{className:f()(p,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{d(t)()},isLoading:b||E,countLabel:t.variations.length>0?Object(a.sprintf)(
11
  /* translators: %1$d is the number of variations of a product product. */
@@ -13,24 +13,24 @@ Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.leng
13
  /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
14
  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,r()({},g,{className:p,name:"variations-"+o}))}:null),onSearch:m,messages:v,isHierarchical:!0})};y.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=b(Object(d.a)(E(Object(u.withInstanceId)(y))))},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=n},,function(e,t,c){"use strict";var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(30),s=c(9);c(144),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:r,onChange:s,options:l,screenReaderLabel:i,readOnly:u,value:b}=e;const d="wc-block-components-sort-select__select-"+c;return Object(o.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:r,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(o.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,readOnly:u,value:b},l.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(41),a=c(4),s=c.n(a),l=c(35);c(158);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},Object(r.sprintf)(
15
  /* translators: %1$s min price, %2$s max price */
16
- Object(r.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(o.createElement)("span",{"aria-hidden":!0},Object(o.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(o.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:b}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Previous price:","woo-gutenberg-products-block")),Object(o.createElement)(n.a,{currency:t,renderText:e=>Object(o.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(o.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Discounted price:","woo-gutenberg-products-block")),Object(o.createElement)(n.a,{currency:t,renderText:e=>Object(o.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:b}))};t.a=e=>{let{align:t,className:c,currency:r,format:a="<price/>",maxPrice:l,minPrice:b,price:d,priceClassName:m,priceStyle:p,regularPrice:g,regularPriceClassName:O,regularPriceStyle:h}=e;const j=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 E=g&&d!==g;let _=Object(o.createElement)("span",{className:s()("wc-block-components-product-price__value",m)});return E?_=Object(o.createElement)(u,{currency:r,price:d,priceClassName:m,priceStyle:p,regularPrice:g,regularPriceClassName:O,regularPriceStyle:h}):void 0!==b&&void 0!==l?_=Object(o.createElement)(i,{currency:r,maxPrice:l,minPrice:b,priceClassName:m,priceStyle:p}):d&&(_=Object(o.createElement)(n.a,{className:s()("wc-block-components-product-price__value",m),currency:r,value:d,style:p})),Object(o.createElement)("span",{className:j},Object(o.createInterpolateElement)(a,{price:_}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var o=c(6);let r;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(r||(r={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(o.uniqueId)(),type:r.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:r.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:o,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 r.ADD_EVENT_CALLBACK:return l.set(o,{priority:s,callback:n}),{...e,[c]:l};case r.REMOVE_EVENT_CALLBACK:return l.delete(o),{...e,[c]:l}}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(8);function r(e,t){const c=Object(o.useRef)();return Object(o.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,,,function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"c",(function(){return i})),c.d(t,"a",(function(){return u}));var o=c(7),r=c(70),n=c(64),a=c(194);const s=e=>Object(n.c)(e)?JSON.parse(e)||{}:Object(n.b)(e)?e:{},l=e=>{if(!Object(r.b)()||!Object(a.a)())return{style:{}};const t=Object(n.b)(e)?e:{},c=s(t.style);return Object(o.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},i=e=>{const t=Object(n.b)(e)?e:{},c=s(t.style),o=Object(n.b)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize||o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,textTransform:o.textTransform,fontFamily:t.fontFamily}}},u=e=>{if(!Object(r.b)())return{className:"",style:{}};const t=Object(n.b)(e)?e:{},c=s(t.style);return Object(o.__experimentalUseColorProps)({...t,style:c})}},function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var o=c(0),r=c(6),n=c(26),a=c.n(n);const s=Object(o.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),l=()=>Object(o.useContext)(s),i=e=>{let{children:t}=e;const[c,n]=Object(o.useState)({}),l=Object(o.useCallback)(e=>c[e],[c]),i=Object(o.useCallback)(e=>{const t=c[e];return!t||t.hidden?"":"validate-error-"+e},[c]),u=Object(o.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:c,...o}=t;return o})},[]),b=Object(o.useCallback)(()=>{n({})},[]),d=Object(o.useCallback)(e=>{e&&n(t=>(e=Object(r.pickBy)(e,(e,c)=>!("string"!=typeof e.message||t.hasOwnProperty(c)&&a()(t[c],e))),0===Object.values(e).length?t:{...t,...e}))},[]),m=Object(o.useCallback)((e,t)=>{n(c=>{if(!c.hasOwnProperty(e))return c;const o={...c[e],...t};return a()(c[e],o)?c:{...c,[e]:o}})},[]),p={getValidationError:l,setValidationErrors:d,clearValidationError:u,clearAllValidationErrors:b,hideValidationError:Object(o.useCallback)(e=>{m(e,{hidden:!0})},[m]),showValidationError:Object(o.useCallback)(e=>{m(e,{hidden:!1})},[m]),showAllValidationErrors:Object(o.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(c=>{e[c].hidden&&(t[c]={...e[c],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:i};return Object(o.createElement)(s.Provider,{value:p},t)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var o=c(16),r=c(13),n=c(0),a=c(39),s=c(94);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 b=Object(n.useRef)({results:[],isLoading:!0}),d=Object(a.a)(i),m=Object(a.a)(l),p=Object(s.a)(),g=Object(r.useSelect)(e=>{if(!u)return null;const r=e(o.COLLECTIONS_STORE_KEY),n=[t,c,d,m],a=r.getCollectionError(...n);return a&&p(a),{results:r.getCollection(...n),isLoading:!r.hasFinishedResolution("getCollection",n)}},[t,c,m,d,u]);return null!==g&&(b.current=g),b.current}},,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("mask",{id:"external-mask",width:"24",height:"24",x:"0",y:"0",maskUnits:"userSpaceOnUse"},Object(o.createElement)("path",{fill:"#fff",d:"M6.3431 6.3431v1.994l7.8984.0072-8.6055 8.6054 1.4142 1.4143 8.6055-8.6055.0071 7.8984h1.994V6.3431H6.3431z"})),Object(o.createElement)("g",{mask:"url(#external-mask)"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"})));t.a=n},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(0);const r=Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(o.createElement)("title",null,"Grid Block Preview"),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.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 o=c(5),r=c.n(o),n=c(0),a=c(14),s=c(4),l=c.n(s);c(157),t.a=e=>{let{className:t="",disabled:c=!1,name:o,permalink:s="",rel:i,style:u,onClick:b,...d}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=d;return Object(n.createElement)("span",r()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(o)}}))}return Object(n.createElement)("a",r()({className:m,href:s,rel:i},d,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(o)},style:u}))}},function(e,t,c){"use strict";c.d(t,"b",(function(){return g})),c.d(t,"a",(function(){return O}));var o=c(0),r=(c(10),c(13)),n=c(60),a=c(49),s=c(5),l=c.n(s),i=c(4),u=c.n(i),b=c(487);c(159);const d=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""};var m=e=>{let{className:t,notices:c,removeNotice:r}=e;const n=c.filter(e=>"snackbar"!==e.type);if(!n.length)return null;const a=u()(t,"wc-block-components-notices");return Object(o.createElement)("div",{className:a},n.map(e=>Object(o.createElement)(b.a,l()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&r(e.id)}}),e.content)))};const p=Object(o.createContext)({notices:[],createNotice:(e,t,c)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),g=()=>Object(o.useContext)(p),O=e=>{let{children:t,className:c="",createNoticeContainer:s=!0,context:l="wc/core"}=e;const{createNotice:i,removeNotice:u}=Object(r.useDispatch)("core/notices"),[b,d]=Object(o.useState)(!1),{dispatchStoreEvent:g}=Object(n.a)(),{isEditor:O}=Object(a.b)(),h=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i(e,t,{...c,context:c.context||l}),g("store-notice-create",{status:e,content:t,options:c})}),[i,g,l]),j=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;u(e,t)}),[u,l]),{notices:E}=Object(r.useSelect)(e=>({notices:e("core/notices").getNotices(l)}),[l]),_={notices:E,createNotice:h,removeNotice:j,context:l,setIsSuppressed:d},w=b?null:Object(o.createElement)(m,{className:c,notices:_.notices,removeNotice:_.removeNotice,isEditor:O});return Object(o.createElement)(p.Provider,{value:_},s&&w,t)}},function(e,t,c){"use strict";var o=c(0),r=c(101),n=c(76);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 o=s(e),r=o.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(r,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const r=s(e),a=r.slice(0,t);if(c)return Object(n.autop)(l(a,o));const i=a.match(/([\s]+)/g),u=i?i.length:0,b=r.slice(0,t+u);return Object(n.autop)(l(b,o))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:b={}}=e;const d=Object(o.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 o=Object(n.autop)(e),s=Object(r.count)(o,c);if(s<=t)return o;const l=a(o),b=Object(r.count)(l,c);return b<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(o.createElement)(o.RawHTML,{style:b,className:l},d)}},,,,,,,,,function(e,t){},,function(e,t){},,function(e,t){},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));const o=e=>e.reduce((e,t)=>{let[c,o]=t;return e[c]=o,e},{})},,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(24),s=c(27),l=c(118),i=c(28);t.a=e=>t=>{let{selected:c,...o}=t;const[u,b]=Object(n.useState)(!0),[d,m]=Object(n.useState)(null),[p,g]=Object(n.useState)([]),O=a.o.productCount>100,h=async e=>{const t=await Object(i.a)(e);m(t),b(!1)},j=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:j.current}).then(e=>{g(e),b(!1)}).catch(h)},[j]);const E=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),b(!1)}).catch(h)},400),_=Object(n.useCallback)(e=>{b(!0),E(e)},[b,E]);return Object(n.createElement)(e,r()({},o,{selected:c,error:d,products:p,isLoading:u,onSearch:O?_:null}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(7);const r=()=>"function"==typeof o.__experimentalGetSpacingClassesAndStyles},function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(1)),n=c(4),a=c.n(n),s=c(30),l=c(29),i=c(54);c(301),t.default=Object(i.withProductDataContext)(e=>{let{className:t,align:c}=e;const{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:i}=Object(l.useProductDataContext)();if(!i.id||!i.on_sale)return null;const u="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(o.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,u,{[n+"__product-onsale"]:n})},Object(o.createElement)(s.a,{label:Object(r.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(r.__)("Product on sale","woo-gutenberg-products-block")}))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(0),r=(c(10),c(114));c(162);const n=e=>{let{errorMessage:t="",propertyName:c="",elementId:n=""}=e;const{getValidationError:a,getValidationErrorId:s}=Object(r.b)();if(!t||"string"!=typeof t){const e=a(c)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(o.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(o.createElement)("p",{id:s(n)},t))}},,,,,,,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z"}));t.a=n},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.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){},function(e,t,c){"use strict";var o=c(70);let r={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(o.b)()&&(r={...r,align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}}),t.a=r},function(e,t,c){"use strict";var o=c(0),r=c(4),n=c.n(r),a=c(29),s=c(70),l=c(54),i=c(129),u=c(60),b=(c(300),c(113));const d=e=>{let{children:t,headingLevel:c,elementType:r="h"+c,...n}=e;return Object(o.createElement)(r,n,t)};t.a=Object(l.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:r=!0,align:l}=e,{parentClassName:m}=Object(a.useInnerBlockLayoutContext)(),{product:p}=Object(a.useProductDataContext)(),{dispatchStoreEvent:g}=Object(u.a)(),O=Object(b.a)(e),h=Object(b.b)(e),j=Object(b.c)(e);return p.id?Object(o.createElement)(d,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...h.style,...j.style,...O.style}:{}},Object(o.createElement)(i.a,{disabled:!r,name:p.name,permalink:p.permalink,rel:r?"nofollow":"",onClick:()=>{g("product-view-link",{product:p})}})):Object(o.createElement)(d,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...h.style,...j.style,...O.style}:{}})})},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));const o=window.CustomEvent||null,r=(e,t)=>{let{bubbles:c=!1,cancelable:r=!1,element:n,detail:a={}}=t;if(!o)return;n||(n=document.body);const s=new o(e,{bubbles:c,cancelable:r,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{r("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{r(t,{bubbles:c,cancelable:o})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"c",(function(){return s})),c.d(t,"a",(function(){return l}));var o=c(2),r=c(99),n=c(15);const a=e=>{let{country:t="",state:c="",city:o="",postcode:r=""}=e;return{country:t.trim(),state:c.trim(),city:o.trim(),postcode:r?r.replace(" ","").toUpperCase():""}},s=e=>{let{email:t=""}=e;return Object(n.isEmail)(t)?t.trim():""},l=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:o=!1}=t;o&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";t.a={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}}},function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=(c(10),c(1)),s=c(4),l=c.n(s),i=c(2),u=c(29),b=c(54),d=c(60),m=c(195);c(302);const p=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),g=e=>{let{image:t,onLoad:c,loaded:o,showFullSize:a,fallbackAlt:s}=e;const{thumbnail:l,src:i,srcset:u,sizes:b,alt:d}=t||{},m={alt:d||s,onLoad:c,hidden:!o,src:l,...a&&{src:i,srcSet:u,sizes:b}};return Object(n.createElement)(n.Fragment,null,m.src&&Object(n.createElement)("img",r()({"data-testid":"product-image"},m)),!o&&Object(n.createElement)(p,null))};t.a=Object(b.withProductDataContext)(e=>{let{className:t,imageSizing:c="full-size",showProductLink:o=!0,showSaleBadge:r,saleBadgeAlign:s="right"}=e;const{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:b}=Object(u.useProductDataContext)(),[O,h]=Object(n.useState)(!1),{dispatchStoreEvent:j}=Object(d.a)();if(!b.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",{[i+"__product-image"]:i})},Object(n.createElement)(p,null));const E=!!b.images.length,_=E?b.images[0]:null,w=o?"a":n.Fragment,f=Object(a.sprintf)(
17
  /* translators: %s is referring to the product name */
18
- Object(a.__)("Link to %s","woo-gutenberg-products-block"),b.name),k={href:b.permalink,rel:"nofollow",...!E&&{"aria-label":f},onClick:()=>{j("product-view-link",{product:b})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i})},Object(n.createElement)(w,o&&k,!!r&&Object(n.createElement)(m.default,{align:s,product:b}),Object(n.createElement)(g,{fallbackAlt:b.name,image:_,onLoad:()=>h(!0),loaded:O,showFullSize:"cropped"!==c})))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(108);const r=(e,t)=>function(c){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=o.a.addEventCallback(e,c,r);return t(n),()=>{t(o.a.removeEventCallback(e,n.id))}}},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},function(e,t,c){"use strict";var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(1),s=c(39),l=c(477);const i={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},u={status:i.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},b={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:d,SET_IDLE:m,SET_DISABLED:p,SET_PROCESSING:g,SET_BEFORE_PROCESSING:O,SET_AFTER_PROCESSING:h,SET_PROCESSING_RESPONSE:j,SET_HAS_ERROR:E,SET_NO_ERROR:_,SET_QUANTITY:w,SET_REQUEST_PARAMS:f}=b,k=()=>({type:m}),v=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?E:_;return{type:t}},{SET_PRISTINE:y,SET_IDLE:S,SET_DISABLED:C,SET_PROCESSING:x,SET_BEFORE_PROCESSING:N,SET_AFTER_PROCESSING:P,SET_PROCESSING_RESPONSE:T,SET_HAS_ERROR:R,SET_NO_ERROR:I,SET_QUANTITY:A,SET_REQUEST_PARAMS:B}=b,{PRISTINE:L,IDLE:V,DISABLED:z,PROCESSING:D,BEFORE_PROCESSING:F,AFTER_PROCESSING:M}=i,H=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,{quantity:c,type:o,data:r}=arguments.length>1?arguments[1]:void 0;switch(o){case y:e=u;break;case S:e=t.status!==V?{...t,status:V}:t;break;case C:e=t.status!==z?{...t,status:z}:t;break;case A:e=c!==t.quantity?{...t,quantity:c}:t;break;case B:e={...t,requestParams:{...t.requestParams,...r}};break;case T:e={...t,processingResponse:r};break;case x:e=t.status!==D?{...t,status:D,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case N:e=t.status!==F?{...t,status:F,hasError:!1}:t;break;case P:e=t.status!==M?{...t,status:M}:t;break;case R:e=t.hasError?t:{...t,hasError:!0},e=t.status===D||t.status===F?{...e,status:V}:e;break;case I:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&o!==y&&e.status===L&&(e.status=V),e};var G=c(108),q=c(254);const Q=e=>({onAddToCartAfterProcessingWithSuccess:Object(q.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(q.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(q.a)("add_to_cart_before_processing",e)});var Y=c(257),U=c(114),$=c(47),W=c(44);const K=Object(o.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(o.useContext)(K),X=e=>{var t,c,r,n;let{children:b,product:m,showFormElements:E}=e;const[_,y]=Object(o.useReducer)(H,u),[S,C]=Object(o.useReducer)(G.b,{}),x=Object(s.a)(S),{addErrorNotice:N,removeNotices:P}=Object($.a)(),{setValidationErrors:T}=Object(U.b)(),{isSuccessResponse:R,isErrorResponse:I,isFailResponse:A}=Object(W.c)(),B=Object(o.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:Q(C).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Q(C).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Q(C).onAddToCartBeforeProcessing}),[C]),L=Object(o.useMemo)(()=>({resetForm:()=>{y({type:d})},submitForm:()=>{y({type:O})},setQuantity:e=>{y((e=>({type:w,quantity:e}))(e))},setHasError:e=>{y(v(e))},setRequestParams:e=>{y((e=>({type:f,data:e}))(e))},setAfterProcessing:e=>{y({type:j,data:e}),y({type:h})}}),[]);Object(o.useEffect)(()=>{const e=_.status,t=!m.id||!Object(l.a)(m);e!==i.DISABLED||t?e!==i.DISABLED&&t&&y({type:p}):y(k())},[_.status,m,y]),Object(o.useEffect)(()=>{_.status===i.BEFORE_PROCESSING&&(P("error"),Object(Y.a)(x,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&N(t),c&&T(c)}),y(k())):y({type:g})}))},[_.status,T,N,P,y,x]),Object(o.useEffect)(()=>{if(_.status===i.AFTER_PROCESSING){const e={processingResponse:_.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:o}=e;(I(e)||A(e))&&c&&(t=!0,N(c,o?{context:o}:void 0))}),t};if(_.hasError)return void Object(Y.b)(x,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var o;const t=(null===(o=e.processingResponse)||void 0===o?void 0:o.message)||Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");N(t,{id:"add-to-cart"})}y(k())});Object(Y.b)(x,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?y(v(!0)):y(k())})}},[_.status,_.hasError,_.processingResponse,L,N,I,A,R,x]);const V=Object(l.b)(m),z={product:m,productType:m.type||"simple",productIsPurchasable:Object(l.a)(m),productHasOptions:m.has_options||!1,supportsFormElements:V,showFormElements:E&&V,quantity:_.quantity||(null==m||null===(t=m.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==m||null===(c=m.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==m||null===(r=m.add_to_cart)||void 0===r?void 0:r.maximum)||99,multipleOf:(null==m||null===(n=m.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:_.requestParams,isIdle:_.status===i.IDLE,isDisabled:_.status===i.DISABLED,isProcessing:_.status===i.PROCESSING,isBeforeProcessing:_.status===i.BEFORE_PROCESSING,isAfterProcessing:_.status===i.AFTER_PROCESSING,hasError:_.hasError,eventRegistration:B,dispatchActions:L};return Object(o.createElement)(K.Provider,{value:z},b)};var Z=c(11),ee=c.n(Z),te=c(14),ce=c(36),oe=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:r,hasError:n,isProcessing:s,requestParams:l}=J(),{hasValidationErrors:i,showAllValidationErrors:u}=Object(U.b)(),{addErrorNotice:b,removeNotice:d}=Object($.a)(),{receiveCart:m}=Object(ce.a)(),[p,g]=Object(o.useState)(!1),O=!n&&s,h=Object(o.useCallback)(()=>!i||(u(),{type:"error"}),[i,u]);Object(o.useEffect)(()=>{const e=r.onAddToCartBeforeProcessing(h,0);return()=>{e()}},[r,h]);const j=Object(o.useCallback)(()=>{g(!0),d("add-to-cart");const o={id:t.id||0,quantity:c,...l};ee()({path:"/wc/store/cart/add-item",method:"POST",data:o,cache:"no-store",parse:!1}).then(t=>{ee.a.setNonce(t.headers),t.json().then((function(c){t.ok?m(c):(c.body&&c.body.message?b(Object(te.decodeEntities)(c.body.message),{id:"add-to-cart"}):b(Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),e.setHasError()),e.setAfterProcessing(c),g(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&m(t.data.cart),e.setHasError(),e.setAfterProcessing(t),g(!1)}))})},[t,b,d,m,e,c,l]);return Object(o.useEffect)(()=>{O&&!p&&j()},[O,j,p]),null};const re=e=>{let{children:t,product:c,showFormElements:r}=e;return Object(o.createElement)(U.a,null,Object(o.createElement)(X,{product:c,showFormElements:r},t,Object(o.createElement)(oe,null)))};var ne=c(29),ae=c(6),se=c(54),le=(c(247),c(80)),ie=c(43),ue=c(311),be=c(60),de=c(359);const me=e=>{let{className:t,href:c,text:r,onClick:n}=e;return Object(o.createElement)(le.a,{className:t,href:c,onClick:n,rel:"nofollow"},r)},pe=e=>{let{className:t,quantityInCart:c,isProcessing:r,isDisabled:n,isDone:s,onClick:l}=e;return Object(o.createElement)(le.a,{className:t,disabled:n,showSpinner:r,onClick:l},s&&c>0?Object(a.sprintf)(
19
  /* translators: %s number of products in cart. */
20
- 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(o.createElement)(ie.a,{srcElement:ue.a,alt:Object(a.__)("Done","woo-gutenberg-products-block")}))};var ge=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:r,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:b}=J(),{parentName:d}=Object(ne.useInnerBlockLayoutContext)(),{dispatchStoreEvent:m}=Object(be.a)(),{cartQuantity:p}=Object(de.a)(r.id||0),[g,O]=Object(o.useState)(!1),h=r.add_to_cart||{url:"",text:""};return Object(o.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(o.createElement)(pe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:p,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{b.submitForm(),m("cart-add-item",{product:r,listName:d})}}):Object(o.createElement)(me,{className:"wc-block-components-product-add-to-cart-button",href:h.url,text:h.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{m("product-view-link",{product:r,listName:d})}})},Oe=c(118),he=e=>{let{disabled:t,min:c,max:r,step:n=1,value:a,onChange:s}=e;const l=void 0!==r,i=Object(Oe.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(r/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&s(t)},300);return Object(o.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:r,step:n,hidden:1===r,disabled:t,onChange:e=>{s(e.target.value),i(e.target.value)}})},je=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},Ee=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:r,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(o.createElement)(je,null):e.id&&!e.is_in_stock?Object(o.createElement)(je,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(he,{value:t,min:c,max:r,step:n,disabled:l,onChange:s.setQuantity}),Object(o.createElement)(ge,null))},_e=(c(310),c(498)),we=c(8),fe=c(196);const ke={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var ve=e=>{let{attributeName:t,options:c=[],value:r="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const{getValidationError:i,setValidationErrors:u,clearValidationError:b}=Object(U.b)(),d=t,m=i(d)||{};return Object(we.useEffect)(()=>{r?b(d):u({[d]:{message:l,hidden:!0}})},[r,d,l,b,u]),Object(we.useEffect)(()=>()=>{b(d)},[d,b]),Object(o.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(o.createElement)(_e.a,{label:Object(te.decodeEntities)(t),value:r||"",options:[ke,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":m.message&&!m.hidden})}),Object(o.createElement)(fe.a,{propertyName:d,elementId:d}))},ye=c(64);const Se=(e,t,c)=>{const o=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return o;const r=Object.keys(e);return o.filter(e=>r.every(o=>{const r=c[o]||"",n=t["id:"+e].attributes[o];return""===r||null===n||n===r}))};var Ce=e=>{let{attributes:t,variationAttributes:c,setRequestParams:r}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(o.useState)(0),[u,b]=Object(o.useState)({}),[d,m]=Object(o.useState)(!1),p=Object(o.useMemo)(()=>((e,t,c)=>{const o={},r=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return r.forEach(r=>{const a=e[r],s={...c,[r]:null},l=n?Se(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[r]):null;o[r]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:o}=e;return null===t||t.includes(null)||t.includes(o)?{value:o,label:Object(te.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),o})(n,a,u),[u,n,a]);return Object(o.useEffect)(()=>{if(!d){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(ye.b)(e))return{};const t=Object.keys(e),c={};return 0===t.length||t.forEach(t=>{const o=e[t],r=o.terms.filter(e=>e.default);var n;r.length>0&&(c[o.name]=null===(n=r[0])||void 0===n?void 0:n.slug)}),c}(t);e&&b({...e}),m(!0)}},[u,t,d]),Object(o.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>Se(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(o.useEffect)(()=>{r({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[r,l,u]),Object(o.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(o.createElement)(ve,{key:e,attributeName:e,options:p[e],value:u[e],onChange:t=>{b({...u,[e]:t})}})))},xe=e=>{let{product:t,dispatchers:c}=e;const r=(e=>e?Object(ae.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:o}=e;t["id:"+c]={id:c,attributes:o.reduce((e,t)=>{let{name:c,value:o}=t;return e[c]=o,e},{})}}),t})(t.variations);return 0===Object.keys(r).length||0===n.length?null:Object(o.createElement)(Ce,{attributes:r,variationAttributes:n,setRequestParams:c.setRequestParams})},Ne=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:r,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(o.createElement)(je,null):e.id&&!e.is_in_stock?Object(o.createElement)(je,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(xe,{product:e,dispatchers:s}),Object(o.createElement)(he,{value:t,min:c,max:r,step:n,disabled:l,onChange:s.setQuantity}),Object(o.createElement)(ge,null))},Pe=()=>Object(o.createElement)(ge,null),Te=c(489),Re=()=>Object(o.createElement)(Te.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Ie=()=>Object(o.createElement)(Re,null);const Ae=()=>{const{showFormElements:e,productType:t}=J();return e?"variable"===t?Object(o.createElement)(Ne,null):"grouped"===t?Object(o.createElement)(Ie,null):"external"===t?Object(o.createElement)(Pe,null):"simple"===t||"variation"===t?Object(o.createElement)(Ee,null):null:Object(o.createElement)(ge,null)};t.a=Object(se.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:r}=Object(ne.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(ae.isEmpty)(r)});return Object(o.createElement)(re,{product:r,showFormElements:c},Object(o.createElement)("div",{className:a},Object(o.createElement)(Ae,null)))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));const o=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var r=c(44);const n=async(e,t,c)=>{const r=o(e,t),n=[];for(const e of r)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},a=async(e,t,c)=>{const n=[],a=o(e,t);for(const e of a)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.a)(t)||Object(r.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},,,,,function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(106),s=c(35),l=c(29),i=c(7),u=c(70),b=c(54);t.default=Object(b.withProductDataContext)(e=>{var t,c;let{className:r,align:b,fontSize:d,customFontSize:m,saleFontSize:p,customSaleFontSize:g,color:O,customColor:h,saleColor:j,customSaleColor:E}=e;const{parentClassName:_}=Object(l.useInnerBlockLayoutContext)(),{product:w}=Object(l.useProductDataContext)(),f=n()(r,{[_+"__product-price"]:_});if(!w.id)return Object(o.createElement)(a.a,{align:b,className:f});const k=Object(i.getColorClassName)("color",O),v=Object(i.getFontSizeClass)(d),y=Object(i.getColorClassName)("color",j),S=Object(i.getFontSizeClass)(p),C=n()({"has-text-color":O||h,"has-font-size":d||m,[k]:k,[v]:v}),x=n()({"has-text-color":j||E,"has-font-size":p||g,[y]:y,[S]:S}),N={color:h,fontSize:m},P={color:E,fontSize:g},T=w.prices,R=Object(s.getCurrencyFromPriceResponse)(T),I=T.price!==T.regular_price,A=I?n()({[_+"__product-price__value"]:_,[x]:Object(u.b)()}):n()({[_+"__product-price__value"]:_,[C]:Object(u.b)()}),B=I?P:N;return Object(o.createElement)(a.a,{align:b,className:f,currency:R,price:T.price,priceClassName:A,priceStyle:Object(u.b)()?B:{},minPrice:null==T||null===(t=T.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==T||null===(c=T.price_range)||void 0===c?void 0:c.max_amount,regularPrice:T.regular_price,regularPriceClassName:n()({[_+"__product-price__regular"]:_,[C]:Object(u.b)()}),regularPriceStyle:Object(u.b)()?N:{}})})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(1)),n=c(4),a=c.n(n),s=c(29),l=c(54);c(303);t.default=Object(l.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(n);if(!l)return null;const i={width:l/5*100+"%"},u=Object(r.sprintf)(
21
  /* translators: %f is referring to the average rating value */
22
  Object(r.__)("Rated %f out of 5","woo-gutenberg-products-block"),l),b=(e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(n),d={__html:Object(r.sprintf)(
23
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
24
- Object(r._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",b,"woo-gutenberg-products-block"),Object(r.sprintf)('<strong class="rating">%f</strong>',l),Object(r.sprintf)('<span class="rating">%d</span>',b))};return Object(o.createElement)("div",{className:a()(t,"wc-block-components-product-rating",{[c+"__product-rating"]:c})},Object(o.createElement)("div",{className:a()("wc-block-components-product-rating__stars",c+"__product-rating__stars"),role:"img","aria-label":u},Object(o.createElement)("span",{style:i,dangerouslySetInnerHTML:d})))})},function(e,t,c){"use strict";c.r(t);var o=c(5),r=c.n(o),n=c(0),a=(c(10),c(4)),s=c.n(a),l=c(1),i=c(60),u=c(359),b=c(14),d=c(29),m=c(54);c(304);const p=e=>{let{product:t}=e;const{id:c,permalink:o,add_to_cart:a,has_options:d,is_purchasable:m,is_in_stock:p}=t,{dispatchStoreEvent:g}=Object(i.a)(),{cartQuantity:O,addingToCart:h,addToCart:j}=Object(u.a)(c),E=Number.isFinite(O)&&O>0,_=!d&&m&&p,w=Object(b.decodeEntities)((null==a?void 0:a.description)||""),f=E?Object(l.sprintf)(
25
  /* translators: %s number of products in cart. */
26
- Object(l._n)("%d in cart","%d in cart",O,"woo-gutenberg-products-block"),O):Object(b.decodeEntities)((null==a?void 0:a.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),k=_?"button":"a",v={};return _?v.onClick=()=>{j(),g("cart-add-item",{product:t})}:(v.href=o,v.rel="nofollow",v.onClick=()=>{g("product-view-link",{product:t})}),Object(n.createElement)(k,r()({"aria-label":w,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:h,added:E}),disabled:h},v),f)},g=()=>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"),disabled:!0});t.default=Object(m.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(d.useInnerBlockLayoutContext)(),{product:o}=Object(d.useProductDataContext)();return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},o.id?Object(n.createElement)(p,{product:o}):Object(n.createElement)(g,null))})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(131),s=c(24),l=c(29),i=c(54),u=(c(305),c(113));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:r}=Object(l.useProductDataContext)(),i=Object(u.a)(e),b=Object(u.c)(e);if(!r)return Object(o.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const d=r.short_description?r.short_description:r.description;return d?Object(o.createElement)(a.a,{className:n()(t,i.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:d,maxLength:150,countType:s.o.wordCountType||"words",style:{...i.style,...b.style}}):null})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=(c(10),c(4)),a=c.n(n),s=c(29),l=c(54);c(306),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(o.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(r.__)("SKU:","woo-gutenberg-products-block")," ",Object(o.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=c(4),a=c.n(n),s=c(29),l=c(6),i=c(54);c(307),t.default=Object(i.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)();return Object(l.isEmpty)(n.categories)?null:Object(o.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",{[c+"__product-category-list"]:c})},Object(r.__)("Categories:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:r}=e;return Object(o.createElement)("li",{key:"category-list-item-"+r},Object(o.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=(c(10),c(4)),a=c.n(n),s=c(29),l=c(6),i=c(54);c(308),t.default=Object(i.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)();return Object(l.isEmpty)(n.tags)?null:Object(o.createElement)("div",{className:a()(t,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c})},Object(r.__)("Tags:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:r}=e;return Object(o.createElement)("li",{key:"tag-list-item-"+r},Object(o.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=(c(10),c(4)),a=c.n(n),s=c(29),l=c(54),i=(c(309),c(113));t.default=Object(l.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=Object(i.a)(e),u=Object(i.c)(e);if(!n.id||!n.is_purchasable)return null;const b=!!n.is_in_stock,d=n.low_stock_remaining,m=n.is_on_backorder;return Object(o.createElement)("div",{className:a()(t,l.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":!!d,"wc-block-components-product-stock-indicator--available-on-backorder":!!m}),style:{...l.style,...u.style}},d?(e=>Object(r.sprintf)(
27
  /* translators: %d stock amount (number of items in stock for product) */
28
- Object(r.__)("%d left in stock","woo-gutenberg-products-block"),e))(d):((e,t)=>t?Object(r.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(r.__)("In Stock","woo-gutenberg-products-block"):Object(r.__)("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){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=n},,,,,,,,,,,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"}));t.a=n},,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58s1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41s-.23-1.06-.59-1.42zM13 20.01L4 11V4h7v-.01l9 9-7 7.02z"}),Object(o.createElement)("circle",{cx:"6.5",cy:"6.5",r:"1.5"}),Object(o.createElement)("path",{d:"M8.9 12.55c0 .57.23 1.07.6 1.45l3.5 3.5 3.5-3.5c.37-.37.6-.89.6-1.45 0-1.13-.92-2.05-2.05-2.05-.57 0-1.08.23-1.45.6l-.6.6-.6-.59c-.37-.38-.89-.61-1.45-.61-1.13 0-2.05.92-2.05 2.05z"}));t.a=n},,,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}));t.a=n},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(1),r=c(24);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(o.__)("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:r.m+"previews/pennant.jpg",thumbnail:r.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,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(o.__)("Add to cart","woo-gutenberg-products-block"),description:Object(o.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}));t.a=n},,,,,,,function(e,t,c){e.exports=c(439)},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var o=c(0),r=c(13),n=c(16),a=c(14),s=c(36),l=c(47);const i=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},u=e=>{const{addItemToCart:t}=Object(r.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:u}=Object(s.a)(),{addErrorNotice:b,removeNotice:d}=Object(l.a)(),[m,p]=Object(o.useState)(!1),g=Object(o.useRef)(i(c,e));return Object(o.useEffect)(()=>{const t=i(c,e);t!==g.current&&(g.current=t)},[c,e]),{cartQuantity:Number.isFinite(g.current)?g.current:0,addingToCart:m,cartIsLoading:u,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=>{b(Object(a.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})}).finally(()=>{p(!1)})}}}},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{stroke:"currentColor",strokeWidth:"1.5",d:"M2 .75h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H2c-.69 0-1.25-.56-1.25-1.25V2C.75 1.31 1.31.75 2 .75z"}),Object(o.createElement)("path",{fill:"currentColor",d:"M12 6H4V4.75h8zM12 9H4V7.75h8zM10 12H4v-1.25h6z"})));t.a=n},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,"blockSettings",(function(){return zt}));var o=c(5),r=c.n(o),n=c(0),a=c(1),s=c(7),l=c(12),i=c(43),u=c(18),b=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"})),d=c(70),m=c(4),p=c.n(m),g={category:"woocommerce-product-elements",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(n.createElement)(i.a,{srcElement:b,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:Object(d.a)()?void 0:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",{className:p()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},O=c(248),h=c(3),j=c(9),E=c(90),_=c(249),w=c(102);c(357);var f=function(e){let{className:t="",...c}=e;const o=p()("wc-block-text-toolbar-button",t);return Object(n.createElement)(h.Button,r()({className:o},c))},k=c(29);c(356);var v=e=>t=>c=>{const o=Object(k.useProductDataContext)(),{attributes:r,setAttributes:l}=c,{productId:i}=r,[u,b]=Object(n.useState)(!i);return o.hasContext?Object(n.createElement)(t,c):Object(n.createElement)(n.Fragment,null,u?Object(n.createElement)(h.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(n.createElement)("div",null,e.description),Object(n.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(n.createElement)(w.a,{selected:i||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];l({productId:e[0]?e[0].id:0})}}),Object(n.createElement)(h.Button,{isSecondary:!0,disabled:!i,onClick:()=>{b(!1)}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.ToolbarGroup,null,Object(n.createElement)(f,{onClick:()=>b(!0)},Object(a.__)("Switch product…","woo-gutenberg-products-block")))),Object(n.createElement)(t,c)))},y=Object(n.createElement)(u.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 3H7a2 2 0 00-2 2v16l7-3 7 3V5a2 2 0 00-2-2z"}));const S=Object(a.__)("Product Title","woo-gutenberg-products-block"),C=Object(n.createElement)(i.a,{srcElement:y,className:"wc-block-editor-components-block-icon"}),x=Object(a.__)("Display the title of a product.","woo-gutenberg-products-block");c(358);const N=e=>{let{attributes:t,setAttributes:c}=e;const o=Object(s.useBlockProps)(),{headingLevel:r,showProductLink:l,align:i}=t;return Object(n.createElement)("div",o,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(E.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:r,onChange:e=>c({headingLevel:e})}),Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}))),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(_.a,t)))};var P=Object(d.b)()?Object(j.compose)([v({icon:C,label:S,description:Object(a.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(N):N,T=c(194);const R={...g,apiVersion:2,title:S,description:x,icon:{src:C},attributes:O.a,edit:P,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},supports:{...g.supports,...Object(d.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(l.registerBlockType)("woocommerce/product-title",R);var I=c(262),A=c(208);const B=Object(a.__)("Product Price","woo-gutenberg-products-block"),L=Object(n.createElement)(i.a,{srcElement:A.a,className:"wc-block-editor-components-block-icon"}),V=Object(a.__)("Display the price of a product.","woo-gutenberg-products-block"),z=e=>{let{fontSize:t,setFontSize:c,color:o,setColor:r,colorLabel:l}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.FontSizePicker,{value:t.size,onChange:c}),Object(n.createElement)(h.BaseControl,{label:l},Object(n.createElement)(s.ColorPalette,{value:o.color,onChange:r,label:Object(a.__)("Color","woo-gutenberg-products-block")})))},D=e=>{let{fontSize:t,saleFontSize:c,setFontSize:o,setSaleFontSize:r,color:l,saleColor:i,setColor:u,setSaleColor:b,attributes:m,setAttributes:p}=e;const{align:g}=m;return Object(n.createElement)(n.Fragment,null,Object(d.b)()&&Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(s.AlignmentToolbar,{value:g,onChange:e=>{p({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(d.b)()&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Price","woo-gutenberg-products-block")},Object(n.createElement)(z,{color:l,setColor:u,fontSize:t,setFontSize:o,colorLabel:Object(a.__)("Color","woo-gutenberg-products-block")})),Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Sale price","woo-gutenberg-products-block")},Object(n.createElement)(z,{color:i,setColor:b,fontSize:c,setFontSize:r,colorLabel:Object(a.__)("Color","woo-gutenberg-products-block")})))),Object(n.createElement)(I.default,m))};var F=Object(d.b)()?Object(j.compose)([Object(s.withFontSizes)("fontSize"),Object(s.withFontSizes)("saleFontSize"),Object(s.withFontSizes)("originalFontSize"),Object(s.withColors)("color",{textColor:"color"}),Object(s.withColors)("saleColor",{textColor:"saleColor"}),Object(s.withColors)("originalColor",{textColor:"originalColor"}),v({icon:L,label:B,description:Object(a.__)("Choose a product to display its price.","woo-gutenberg-products-block")})])(D):D;let M={productId:{type:"number",default:0}};Object(d.b)()&&(M={...M,align:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"},saleFontSize:{type:"string"},customSaleFontSize:{type:"number"},color:{type:"string"},saleColor:{type:"string"},customColor:{type:"string"},customSaleColor:{type:"string"}});const H={title:B,description:V,icon:{src:L},attributes:M,edit:F};Object(l.registerBlockType)("woocommerce/product-price",{...g,...H});var G=c(252),q=c(55),Q=c(2),Y=c(253),U=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}));const $=Object(a.__)("Product Image","woo-gutenberg-products-block"),W=Object(n.createElement)(i.a,{srcElement:U,className:"wc-block-editor-components-block-icon"}),K=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var J=v({icon:W,label:$,description:Object(a.__)("Choose a product to display its image.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{showProductLink:o,imageSizing:r,showSaleBadge:l,saleBadgeAlign:i}=t;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:o,onChange:()=>c({showProductLink:!o})}),Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(a.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:l,onChange:()=>c({showSaleBadge:!l})}),l&&Object(n.createElement)(q.a,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,options:[{label:Object(a.__)("Left","woo-gutenberg-products-block"),value:"left"},{label:Object(a.__)("Center","woo-gutenberg-products-block"),value:"center"},{label:Object(a.__)("Right","woo-gutenberg-products-block"),value:"right"}],onChange:e=>c({saleBadgeAlign:e})}),Object(n.createElement)(q.a,{label:Object(a.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(n.createInterpolateElement)(Object(a.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(Q.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:r,options:[{label:Object(a.__)("Full Size","woo-gutenberg-products-block"),value:"full-size"},{label:Object(a.__)("Cropped","woo-gutenberg-products-block"),value:"cropped"}],onChange:e=>c({imageSizing:e})}))),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(Y.a,t)))});const X={title:$,description:K,icon:{src:W},attributes:G.a,edit:J};Object(l.registerBlockType)("woocommerce/product-image",{...g,...X});var Z=c(263),ee=c(342);const te=Object(a.__)("Product Rating","woo-gutenberg-products-block"),ce=Object(n.createElement)(i.a,{srcElement:ee.a,className:"wc-block-editor-components-block-icon"}),oe={title:te,description:Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block"),icon:{src:ce},attributes:{productId:{type:"number",default:0}},edit:v({icon:ce,label:te,description:Object(a.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(Z.default,t)})};Object(l.registerBlockType)("woocommerce/product-rating",{...g,...oe});var re=c(264),ne=c(209);const ae=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),se=Object(n.createElement)(i.a,{srcElement:ne.a,className:"wc-block-editor-components-block-icon"}),le={title:ae,description:Object(a.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block"),icon:{src:se},attributes:{productId:{type:"number",default:0}},edit:v({icon:se,label:ae,description:Object(a.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(h.Disabled,null,Object(n.createElement)(re.default,t))})};Object(l.registerBlockType)("woocommerce/product-button",{...g,...le});var ie=c(265),ue=c(360);const be=Object(a.__)("Product Summary","woo-gutenberg-products-block"),de=Object(n.createElement)(i.a,{srcElement:ue.a,className:"wc-block-editor-components-block-icon"}),me=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(361);var pe=v({icon:de,label:be,description:Object(a.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(ie.default,t))});const ge={apiVersion:2,title:be,description:me,icon:{src:de},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:pe,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-summary",{...g,...ge});var Oe=c(195),he=c(334);const je=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),Ee=Object(n.createElement)(i.a,{srcElement:he.a,className:"wc-block-editor-components-block-icon"}),_e={title:je,description:Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block"),icon:{src:Ee},supports:{html:!1},attributes:{productId:{type:"number",default:0}},edit:v({icon:Ee,label:je,description:Object(a.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(Oe.default,t)})};Object(l.registerBlockType)("woocommerce/product-sale-badge",{...g,..._e});var we=c(93),fe=c(266),ke=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const ve=Object(a.__)("Product SKU","woo-gutenberg-products-block"),ye=Object(n.createElement)(i.a,{srcElement:ke,className:"wc-block-editor-components-block-icon"}),Se={title:ve,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:ye},attributes:{productId:{type:"number",default:0}},edit:v({icon:ye,label:ve,description:Object(a.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(we.a,null),Object(n.createElement)(fe.default,t))})};Object(d.c)("woocommerce/product-sku",{...g,...Se});var Ce=c(267),xe=c(327);const Ne=Object(a.__)("Product Category List","woo-gutenberg-products-block"),Pe=Object(n.createElement)(i.a,{srcElement:xe.a,className:"wc-block-editor-components-block-icon"}),Te=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Re=v({icon:Pe,label:Ne,description:Object(a.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(we.a,null),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(Ce.default,t)))});const Ie={...g,title:Ne,description:Te,icon:{src:Pe},attributes:{productId:{type:"number",default:0}},edit:Re};Object(d.c)("woocommerce/product-category-list",Ie);var Ae=c(268);const Be=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),Le=Object(n.createElement)(i.a,{srcElement:he.a,className:"wc-block-editor-components-block-icon"}),Ve={title:Be,description:Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block"),icon:{src:Le},attributes:{productId:{type:"number",default:0}},edit:v({icon:Le,label:Be,description:Object(a.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(we.a,null),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(Ae.default,t)))})};Object(d.c)("woocommerce/product-tag-list",{...g,...Ve});var ze=c(269),De=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("g",{fillRule:"evenodd"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{fillRule:"nonzero",d:"M20.5 5.2l-1.4-1.7C19 3.3 18.5 3 18 3H6c-.5 0-.9.2-1.2.5L3.5 5.3A2 2 0 003 6.5V19c0 1.1.9 2 2 2h14a2 2 0 002-2V6.5c0-.5-.2-1-.5-1.3zM6.2 5h11.6l.8 1H5.4l.8-1zM5 19V8h14v11H5z"})));const Fe=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Me=Object(n.createElement)(i.a,{srcElement:De,className:"wc-block-editor-components-block-icon"}),He=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Ge=v({icon:Me,label:Fe,description:Object(a.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(we.a,null),Object(n.createElement)(ze.default,t))});const qe={apiVersion:2,title:Fe,description:He,icon:{src:Me},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:Ge,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-stock-indicator",{...g,...qe});var Qe=c(477),Ye=(c(247),c(256));const Ue=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),$e=Object(n.createElement)(i.a,{srcElement:ne.a,className:"wc-block-editor-components-block-icon"}),We={title:Ue,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:$e},edit:v({icon:$e,label:Ue,description:Object(a.__)("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(k.useProductDataContext)(),{className:r,showFormElements:l}=t;return Object(n.createElement)("div",{className:p()(r,"wc-block-components-product-add-to-cart")},Object(n.createElement)(we.a,{productId:o.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(Qe.b)(o)?Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Display form elements","woo-gutenberg-products-block"),help:Object(a.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showFormElements:!l})}):Object(n.createElement)(h.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(a.__)("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(n.createElement)(h.Disabled,null,Object(n.createElement)(Ye.a,t)))}),attributes:c(255).a};Object(d.c)("woocommerce/product-add-to-cart",{...g,...We});var Ke=c(25),Je=c.n(Ke),Xe=c(13),Ze=(c(10),c(59)),et=c(468),tt=c(343),ct=c(24);const ot=(e,t)=>{const{className:c,contentVisibility:o}=t;return p()(e,c,{"has-image":o&&o.image,"has-title":o&&o.title,"has-rating":o&&o.rating,"has-price":o&&o.price,"has-button":o&&o.button})};var rt=c(122);const nt=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],at=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?at(e.innerBlocks):[]}]):[];var st=c(8),lt=c(6),it=c(30);c(367);const ut=e=>{let{currentPage:t,displayFirstAndLastPages:c,displayNextAndPreviousArrows:o,pagesToDisplay:r,onPageChange:s,totalPages:l}=e,{minIndex:i,maxIndex:u}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const o=e-1,r=Math.max(Math.floor(t-o/2),2),n=Math.min(Math.ceil(t+(o-(t-r))),c-1);return{minIndex:Math.max(Math.floor(t-(o-(n-t))),2),maxIndex:n}})(r,t,l);const b=c&&Boolean(1!==i),d=c&&Boolean(u!==l),m=c&&Boolean(i>3),g=c&&Boolean(u<l-2);b&&3===i&&(i-=1),d&&u===l-2&&(u+=1);const O=[];if(i&&u)for(let e=i;e<=u;e++)O.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(it.a,{screenReaderLabel:Object(a.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t-1),title:Object(a.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(it.a,{label:"←",screenReaderLabel:Object(a.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(n.createElement)("button",{className:p()("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:()=>s(1),disabled:1===t},Object(n.createElement)(it.a,{label:1,screenReaderLabel:Object(a.sprintf)(
29
  /* translators: %d is the page number (1, 2, 3...). */
30
  Object(a.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(n.createElement)("button",{key:e,className:p()("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?null:()=>s(e),disabled:t===e},Object(n.createElement)(it.a,{label:e,screenReaderLabel:Object(a.sprintf)(
31
  /* translators: %d is the page number (1, 2, 3...). */
32
  Object(a.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),d&&Object(n.createElement)("button",{className:p()("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:()=>s(l),disabled:t===l},Object(n.createElement)(it.a,{label:l,screenReaderLabel:Object(a.sprintf)(
33
  /* translators: %d is the page number (1, 2, 3...). */
34
- Object(a.__)("Page %d","woo-gutenberg-products-block"),l)})),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t+1),title:Object(a.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(n.createElement)(it.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))};ut.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var bt=ut,dt=c(109),mt=c(73),pt=c(115),gt=c(16),Ot=c(39);var ht=c(60);c(368);const jt=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var Et=c(46),_t=c(103),wt=()=>{const{parentClassName:e}=Object(k.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(i.a,{className:e+"__no-products-image",alt:"",srcElement:_t.a,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(a.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(a.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},ft=c(348),kt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(k.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:c+"__no-products"},Object(n.createElement)(i.a,{className:c+"__no-products-image",alt:"",srcElement:ft.a,size:100}),Object(n.createElement)("strong",{className:c+"__no-products-title"},Object(a.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:c+"__no-products-description"},Object(a.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(a.__)("Reset Search","woo-gutenberg-products-block")))},vt=c(105);c(366);var yt=e=>{let{onChange:t,readOnly:c,value:o}=e;return Object(n.createElement)(vt.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",name:"orderby",onChange:t,options:[{key:"menu_order",label:Object(a.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(a.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(a.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(a.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(a.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(a.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:c,screenReaderLabel:Object(a.__)("Order products by","woo-gutenberg-products-block"),value:o})};const St=(e,t,c,o)=>{if(!c)return;const a=Object(et.a)(e);return c.map((c,s)=>{let[l,i={}]=c,u=[];i.children&&i.children.length>0&&(u=St(e,t,i.children,o));const b=a[l];if(!b)return null;const d=t.id||0,m=["layout",l,s,o,d];return Object(n.createElement)(n.Suspense,{key:m.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(b,r()({},i,{children:u,product:t})))})};var Ct=Object(j.withInstanceId)(e=>{let{product:t,attributes:c,instanceId:o}=e;const{layoutConfig:r}=c,{parentClassName:a,parentName:s}=Object(k.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=p()(a+"__product","wc-block-layout",{"is-loading":l});return Object(n.createElement)("li",{className:i,"aria-hidden":l},St(s,t,r,o))});c(365);const xt=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(lt.isEqual)(t,o)&&Number.isFinite(c)};var Nt,Pt=(Nt=e=>{let{attributes:t,currentPage:c,onPageChange:o,onSortChange:r,sortValue:s,scrollToTop:l}=e;const[i,u]=Object(mt.b)("attributes",[]),[b,d]=Object(mt.b)("stock_status",[]),[m,g]=Object(mt.b)("min_price"),[O,h]=Object(mt.b)("max_price"),[j]=Object(mt.c)((e=>{let{sortValue:t,currentPage:c,attributes:o}=e;const{columns:r,rows:n}=o;return{...(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"}}})(t),catalog_visibility:"catalog",per_page:r*n,page:c}})({attributes:t,sortValue:s,currentPage:c})),{products:E,totalProducts:_,productsLoading:w}=(e=>{const t={namespace:"/wc/store",resourceName:"products"},{results:c,isLoading:o}=Object(pt.a)({...t,query:e}),{value:r}=((e,t)=>{const{namespace:c,resourceName:o,resourceValues:r=[],query:n={}}=t;if(!c||!o)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const a=Object(Ot.a)(n),s=Object(Ot.a)(r),{value:l,isLoading:i=!0}=Object(Xe.useSelect)(e=>{const t=e(gt.COLLECTIONS_STORE_KEY),r=["x-wp-total",c,o,a,s];return{value:t.getCollectionHeader(...r),isLoading:t.hasFinishedResolution("getCollectionHeader",r)}},["x-wp-total",c,o,s,a]);return{value:l,isLoading:i}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(r,10),productsLoading:o}})(j),{parentClassName:f,parentName:v}=Object(k.useInnerBlockLayoutContext)(),y=(e=>{const{order:t,orderby:c,page:o,per_page:r,...n}=e;return n||{}})(j),{dispatchStoreEvent:S}=Object(ht.a)(),C=Object(dt.a)({totalQuery:y,totalProducts:_},xt);Object(n.useEffect)(()=>{S("product-list-render",{products:E,listName:v})},[E,v,S]),Object(n.useEffect)(()=>{Object(lt.isEqual)(y,null==C?void 0:C.totalQuery)||(o(1),null!=C&&C.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(Et.speak)(Object(a.__)("No products found","woo-gutenberg-products-block")):Object(Et.speak)(Object(a.sprintf)(
35
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
36
- Object(a._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(_))},[null==C?void 0:C.totalQuery,_,o,y]);const{contentVisibility:x}=t,N=t.columns*t.rows,P=!Number.isFinite(_)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(lt.isEqual)(y,null==C?void 0:C.totalQuery)?Math.ceil(C.totalProducts/N):Math.ceil(_/N),T=E.length?E:Array.from({length:N}),R=0!==E.length||w,I=i.length>0||b.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:o,align:r}=t,n=void 0!==r?"align"+r:"";return p()(f,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":o})})()},x.orderBy&&R&&Object(n.createElement)(yt,{onChange:r,value:s}),!R&&I&&Object(n.createElement)(kt,{resetCallback:()=>{u([]),d([]),g(null),h(null)}}),!R&&!I&&Object(n.createElement)(wt,null),R&&Object(n.createElement)("ul",{className:f+"__products"},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(Ct,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(bt,{currentPage:c,onPageChange:e=>{l({focusableSelector:"a, button"}),o(e)},totalPages:P}))},e=>{const t=Object(n.useRef)(null);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(n.createElement)(Nt,r()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const o=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(o.length){const e=o[0];jt(e),null==e||e.focus()}else jt(e)})(e,c):jt(e))})(t.current,e)}})))}),Tt=e=>{let{attributes:t}=e;const[c,o]=Object(n.useState)(1),[r,a]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(n.createElement)(Pt,{attributes:t,currentPage:c,onPageChange:e=>{o(e)},onSortChange:e=>{const t=e.target.value;a(t),o(1)},sortValue:r})},Rt=c(128);class It extends st.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Rt.a:Object(n.createElement)(k.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(Tt,{attributes:e,urlParameterSuffix:t}))}}var At=It;c(364);class Bt extends n.Component{constructor(){super(...arguments),Je()(this,"state",{isEditing:!1,innerBlocks:[]}),Je()(this,"blockMap",Object(et.a)("woocommerce/all-products")),Je()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),Je()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),Je()(this,"getIcon",()=>Object(n.createElement)(i.a,{srcElement:b})),Je()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(a.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),Je()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:o,alignButtons:r}=e;return Object(n.createElement)(s.InspectorControls,{key:"inspector"},Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(Ze.a,{columns:c,rows:o,alignButtons:r,setAttributes:t,minColumns:Object(Q.getSetting)("min_columns",1),maxColumns:Object(Q.getSetting)("max_columns",6),minRows:Object(Q.getSetting)("min_rows",1),maxRows:Object(Q.getSetting)("max_rows",6)})),Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(n.createElement)(h.SelectControl,{label:Object(a.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(a.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(a.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(a.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(a.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(a.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(a.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),Je()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.ToolbarGroup,{controls:[{icon:"edit",title:Object(a.__)("Edit inner product layout","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),Je()(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(n.createElement)(h.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(a.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(n.createElement)(h.Tip,null,Object(a.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(n.createElement)(k.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(n.createElement)("ul",{className:"wc-block-grid__products"},Object(n.createElement)("li",{className:"wc-block-grid__product"},Object(n.createElement)(k.ProductDataContextProvider,{product:tt.a[0]},Object(n.createElement)(s.InnerBlocks,e)))))),Object(n.createElement)("div",{className:"wc-block-all-products__actions"},Object(n.createElement)(h.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:at(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(a.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(h.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(a.__)("Cancel","woo-gutenberg-products-block")),Object(n.createElement)(h.Button,{className:"wc-block-all-products__reset-button",icon:Object(n.createElement)(i.a,{srcElement:b}),label:Object(a.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];nt.map(e=>{let[t,o]=e;return c.push(Object(l.createBlock)(t,o)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(a.__)("Reset Layout","woo-gutenberg-products-block")))))}),Je()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,o=this.getTitle(),r=this.getIcon();return c?Object(n.createElement)(h.Disabled,null,Object(n.createElement)(At,{attributes:e})):((e,t)=>Object(n.createElement)(h.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(a.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(o,r)}),Je()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),o=this.getIcon();return 0===ct.o.productCount?((e,t)=>Object(n.createElement)(h.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(n.createElement)("p",null,Object(a.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(n.createElement)(h.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:Q.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{srcElement:rt.a})),Object(n.createElement)(h.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(a.__)("Learn more","woo-gutenberg-products-block"))))(c,o):Object(n.createElement)("div",{className:ot("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Lt=Object(j.compose)(h.withSpokenMessages,Object(Xe.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:o}=e("core/block-editor");return{block:o(c)}}),Object(Xe.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Bt);const Vt={columns:Object(Q.getSetting)("default_columns",3),rows:Object(Q.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:nt,isPreview:!1},zt={title:Object(a.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(n.createElement)(i.a,{srcElement:b,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Display products from your store in a grid layout.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1,multiple:!1},example:{attributes:{isPreview:!0}},attributes:{columns:{type:"number"},rows:{type:"number"},alignButtons:{type:"boolean"},contentVisibility:{type:"object"},orderby:{type:"string"},layoutConfig:{type:"array"},isPreview:{type:"boolean",default:!1}},defaults:Vt,edit:e=>Object(n.createElement)(Lt,e),save(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(n.createElement)("div",r()({className:ot("wc-block-all-products",t)},o),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...zt,deprecated:[{attributes:Object.assign({},zt.attributes,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(n.createElement)("div",r()({className:ot("wc-block-all-products",t)},c),Object(n.createElement)(s.InnerBlocks.Content,null))}}]})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var o=c(38),r=c(0),n=c(24);c.p=n.l,Object(o.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(r.lazy)(()=>Promise.all([c.e(0),c.e(13)]).then(c.bind(null,262)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(5),c.e(12)]).then(c.bind(null,501)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(19)]).then(c.bind(null,502)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(r.lazy)(()=>c.e(14).then(c.bind(null,263)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(r.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(4),c.e(10)]).then(c.bind(null,264)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(3),c.e(17)]).then(c.bind(null,265)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(r.lazy)(()=>c.e(5).then(c.bind(null,195)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(r.lazy)(()=>c.e(15).then(c.bind(null,266)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(r.lazy)(()=>c.e(11).then(c.bind(null,267)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(r.lazy)(()=>c.e(18).then(c.bind(null,268)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(3),c.e(16)]).then(c.bind(null,269)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(r.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(4),c.e(9)]).then(c.bind(null,503)))});const a=e=>Object(o.getRegisteredBlockComponents)(e)},,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return r}));const o=e=>e.is_purchasable||!1,r=e=>["simple","variable"].includes(e.type||"simple")}]);
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var o,a,s=t[0],l=t[1],i=t[2],b=0,d=[];b<s.length;b++)a=s[b],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&d.push(r[a][0]),r[a]=0;for(o in l)Object.prototype.hasOwnProperty.call(l,o)&&(e[o]=l[o]);for(u&&u(t);d.length;)d.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],o=!0,s=1;s<c.length;s++){var l=c[s];0!==r[l]&&(o=!1)}o&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var o={},r={7:0,1:0,2:0,3:0,4:0,5:0,10:0,11:0,13:0,14:0,15:0,16:0,17:0,18:0},n=[];function a(t){if(o[t])return o[t].exports;var c=o[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=r[e];if(0!==c)if(c)t.push(c[2]);else{var o=new Promise((function(t,o){c=r[e]=[t,o]}));t.push(c[2]=o);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:"atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---8f355022",2:"atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b",3:"atomic-block-components/stock-indicator--atomic-block-components/summary--atomic-block-components/title",4:"atomic-block-components/add-to-cart--atomic-block-components/button",5:"atomic-block-components/sale-badge",9:"atomic-block-components/add-to-cart",10:"atomic-block-components/button",11:"atomic-block-components/category-list",12:"atomic-block-components/image",13:"atomic-block-components/price",14:"atomic-block-components/rating",15:"atomic-block-components/sku",16:"atomic-block-components/stock-indicator",17:"atomic-block-components/summary",18:"atomic-block-components/tag-list",19:"atomic-block-components/title"}[e]||e)+".js?ver="+{1:"a65364bc2aef96839601",2:"7ca2ec295c30d42f2d9b",3:"76461ee360049ed00215",4:"7de190fbe2df8ec8f501",5:"7d69f97596f26ac9df7b",9:"854480dd085ee6157644",10:"8ecf14e43ca010db9f1f",11:"341c2a01f126719d8a32",12:"8a2caac2e28944911fb8",13:"061fd4397f806ccbd4e5",14:"f893cd7327cfbe0f21ee",15:"30e9fcdc69c79ea4d159",16:"3a64488e8c2d0c984e84",17:"5bbe046a46d2362f145c",18:"b98414d5f33bdd0e8f1c",19:"7041eba2f6edef3011e4"}[e]}(e);var l=new Error;n=function(t){s.onerror=s.onload=null,clearTimeout(i);var c=r[e];if(0!==c){if(c){var o=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+o+": "+n+")",l.name="ChunkLoadError",l.type=o,l.request=n,c[1](l)}r[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=o,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 o in e)a.d(c,o,function(t){return e[t]}.bind(null,o));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([356,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.lodash},function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.compose},,function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wc.wcBlocksData},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 o=c(0),r=c(6),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(r.groupBy)(e,"parent"),o=Object(r.keyBy)(t,"id"),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=n(o[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=c[e.id];return delete c[e.id],{...e,breadcrumbs:n(o[e.parent]),children:t&&t.length?a(t):[]}}),s=a(c[0]||[]);return delete c[0],Object(r.forEach)(c,e=>{s.push(...a(e||[]))}),s},l=(e,t,c)=>{if(!t)return c?s(e):e;const o=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),r=e.map(e=>!!o.test(e.name)&&e).filter(Boolean);return c?s(r,e):r},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(o.createElement)(o.Fragment,{key:c},Object(o.createElement)("strong",null,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){e.exports=window.wp.primitives},,,,,,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 b})),c.d(t,"g",(function(){return d})),c.d(t,"k",(function(){return m})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return h})),c.d(t,"i",(function(){return j})),c.d(t,"b",(function(){return E}));var o,r=c(2);const n=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(o=r.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,u=r.STORE_PAGES.checkout.id,b=r.STORE_PAGES.checkout.permalink,d=r.STORE_PAGES.privacy.permalink,m=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),p=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),g=r.STORE_PAGES.cart.permalink,O=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),h=Object(r.getSetting)("allowedCountries",{}),j=Object(r.getSetting)("shippingStates",{}),E=Object(r.getSetting)("allowedStates",{})},,function(e,t){e.exports=window.wp.isShallowEqual},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 b})),c.d(t,"i",(function(){return d})),c.d(t,"f",(function(){return m})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return h}));var o=c(15),r=c(11),n=c.n(r),a=c(6),s=c(2),l=c(24);const i=e=>{let{selected:t=[],search:c="",queryArgs:r={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:r={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(o.addQueryArgs)("/wc/store/products",{...a,...r})];return n&&t.length&&s.push(Object(o.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:r});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/products/"+e}),b=()=>n()({path:"wc/store/products/attributes"}),d=e=>n()({path:`wc/store/products/attributes/${e}/terms`}),m=e=>{let{selected:t=[],search:c}=e;const r=(e=>{let{selected:t=[],search:c}=e;const r=Object(s.getSetting)("limitTags",!1),n=[Object(o.addQueryArgs)("wc/store/products/tags",{per_page:r?100:0,orderby:r?"count":"name",order:r?"desc":"asc",search:c})];return r&&t.length&&n.push(Object(o.addQueryArgs)("wc/store/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(r.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},p=e=>n()({path:Object(o.addQueryArgs)("wc/store/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/products/categories/"+e}),O=e=>n()({path:Object(o.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})}),h=(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 r})),c.d(t,"b",(function(){return n}));var o=c(1);const r=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"}},n=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?void 0:e.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,c){"use strict";var o=c(0),r=c(4),n=c.n(r);t.a=e=>{let t,{label:c,screenReaderLabel:r,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=r;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,r)):(t=a||o.Fragment,l&&i&&c!==r?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},c),Object(o.createElement)("span",{className:"screen-reader-text"},r)):Object(o.createElement)(t,s,c))}},function(e,t){e.exports=window.wp.escapeHtml},function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(31);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(o.createElement)("span",null,Object(r.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(o.createElement)("span",null,Object(r.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(r.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var o=c(5),r=c.n(o),n=c(0),a=c(17);const s=e=>{let{countLabel:t,className:c,depth:o=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+o),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,h=m.name||"search-list-item-"+s,j=`${h}-${l.id}`;return Object(n.createElement)("label",{htmlFor:j,className:g.join(" ")},u?Object(n.createElement)("input",r()({type:"radio",id:j,name:h,value:l.value,onChange:b(l),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(n.createElement)("input",r()({type:"checkbox",id:j,name:h,value:l.value,onChange:b(l),checked:i,className:"woocommerce-search-list__item-input"},m)),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,d))),!!p&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},,function(e,t){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var o=c(6),r=c(0),n=c(16),a=c(13),s=c(14),l=c(151),i=c(252),u=c(49),b=c(251);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},m=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(r.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(b.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(b.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++})(),m),[])},g={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},O={...g,email:""},h={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(l.a)(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),E={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:g,shippingRates:n.EMPTY_SHIPPING_RATES,shippingRatesLoading:!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(u.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:l}=e,b=Object(r.useRef)();p();const d=Object(a.useSelect)((e,c)=>{let{dispatch:o}=c;if(!l)return E;if(t)return{cartCoupons:s.coupons,cartItems:s.items,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,billingAddress:O,shippingAddress:g,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const r=e(n.CART_STORE_KEY),a=r.getCartData(),u=r.getCartErrors(),b=r.getCartTotals(),d=!r.hasFinishedResolution("getCartData"),m=r.isCustomerDataUpdating(),{receiveCart:p}=o(n.CART_STORE_KEY),h=j(a.billingAddress),_=a.needsShipping?j(a.shippingAddress):h,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,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:b,cartIsLoading:d,cartErrors:u,billingAddress:Object(i.a)(h),shippingAddress:Object(i.a)(_),extensions:a.extensions,shippingRates:a.shippingRates,shippingRatesLoading:m,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:p}},[l]);return b.current&&Object(o.isEqual)(b.current,d)||(b.current=d),b.current}},,function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var o=c(0),r=c(26),n=c.n(r);function a(e){const t=Object(o.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(134),s=c(4),l=c.n(s);c(140);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:o,onValueChange:s,displayType:u="text",...b}=e;const d="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(d))return null;const m=d/10**o.minorUnit;if(!Number.isFinite(m))return null;const p=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...b,...i(o),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**o.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,r()({className:p,displayType:u},g,{value:m,onValueChange:O}))}},,function(e,t,c){"use strict";var o=c(0);t.a=function(e){let{srcElement:t,size:c=24,...r}=e;return Object(o.isValidElement)(t)?Object(o.cloneElement)(t,{width:c,height:c,...r}):null}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"c",(function(){return b}));var o=c(62);let r,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(r||(r={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const a=(e,t)=>Object(o.b)(e)&&"type"in e&&e.type===t,s=e=>a(e,r.SUCCESS),l=e=>a(e,r.ERROR),i=e=>a(e,r.FAIL),u=e=>!Object(o.b)(e)||void 0===e.retry||!0===e.retry,b=()=>({responseTypes:r,noticeContexts:n,shouldRetry:u,isSuccessResponse:s,isErrorResponse:l,isFailResponse:i})},,function(e,t){e.exports=window.wp.a11y},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(0),r=c(130);const n=()=>{const{notices:e,createNotice:t,removeNotice:c,setIsSuppressed:n}=Object(r.b)(),a=Object(o.useRef)(e);Object(o.useEffect)(()=>{a.current=e},[e]);const s=Object(o.useMemo)(()=>({hasNoticesOfType:e=>a.current.some(t=>t.type===e),removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a.current.forEach(t=>{null!==e&&t.status!==e||c(t.id)})},removeNotice:c}),[c]),l=Object(o.useMemo)(()=>({addDefaultNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("default",e,{...c})},addErrorNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("error",e,{...c})},addWarningNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("warning",e,{...c})},addInfoNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("info",e,{...c})},addSuccessNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("success",e,{...c})}}),[t]);return{notices:e,...s,...l,setIsSuppressed:n}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(0);const r=Object(o.createContext)("page"),n=()=>Object(o.useContext)(r);r.Provider},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var o=c(0),r=c(13);const n=Object(o.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(o.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(r.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(o.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(o.createElement)(n.Provider,{value:u},t)}},,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(4),s=c.n(a),l=c(3),i=c(9);c(84);class u extends n.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:o,help:a,options:i,value:u}=this.props,b="inspector-toggle-button-control-"+c;let d;return a&&(d="function"==typeof a?a(t):a),Object(n.createElement)(l.BaseControl,{id:b,help:d,className:s()("components-toggle-button-control",o)},Object(n.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},e),Object(n.createElement)(l.ButtonGroup,{"aria-labelledby":b+"__label"},i.map((t,c)=>{const o={};return u===t.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!0,o["aria-pressed"]=!1),Object(n.createElement)(l.Button,r()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},o),t.label)})))}}t.a=Object(i.withInstanceId)(u)},,,,function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(6),a=(c(10),c(3));t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:b=1,maxRows:d=6}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(a.RangeControl,{label:Object(r.__)("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(o.createElement)(a.RangeControl,{label:Object(r.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,b,d);s({rows:Number.isNaN(t)?"":t})},min:b,max:d}),Object(o.createElement)(a.ToggleControl,{label:Object(r.__)("Align Last Block","woo-gutenberg-products-block"),help:l?Object(r.__)("The last inner block will be aligned vertically.","woo-gutenberg-products-block"):Object(r.__)("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 o=c(61),r=c(0),n=c(36);const a=()=>{const e=Object(n.a)(),t=Object(r.useRef)(e);return Object(r.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(r.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t){e.exports=window.wp.hooks},function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"c",(function(){return r})),c.d(t,"b",(function(){return n})),c.d(t,"d",(function(){return a}));const o=e=>"number"==typeof e,r=e=>"string"==typeof e,n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function a(e,t){return n(e)&&t in e}},,,function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"a",(function(){return s})),c.d(t,"b",(function(){return l}));var o=c(12),r=c(24);const n=(e,t)=>{if(r.n>2)return Object(o.registerBlockType)(e,t)},a=(e,t)=>{if(r.n>1)return Object(o.registerBlockType)(e,t)},s=()=>r.n>2,l=()=>r.n>1},,function(e,t){e.exports=window.wp.deprecated},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return m}));var o=c(16),r=c(13),n=c(0),a=c(26),s=c.n(a),l=c(39),i=c(109),u=c(48);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(r.useSelect)(t=>t(o.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(r.useDispatch)(o.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},d=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(r.useSelect)(r=>r(o.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(r.useDispatch)(o.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[o,r]=b(t),a=Object(l.a)(o),d=Object(l.a)(e),m=Object(i.a)(d),p=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(m,d)||(r(Object.assign({},a,d)),p.current=!0)},[a,d,m,r]),p.current?[o,r]:[e,r]}},,,function(e,t){e.exports=window.wp.autop},,,,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(139),s=c(4),l=c.n(s),i=c(100);c(160),t.a=e=>{let{className:t,showSpinner:c=!1,children:o,...s}=e;const u=l()("wc-block-components-button",t,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,r()({className:u},s),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},o))}},,function(e,t){e.exports=window.wp.dom},,function(e,t){},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var o=c(5),r=c.n(o),n=c(0),a=c(1),s=c(3),l=c(485),i=c(487),u=c(4),b=c.n(u),d=c(9),m=c(17),p=c(33),g=c(486),O=c(14);const h=e=>{let{id:t,label:c,popoverContents:o,remove:r,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(n.useState)(!1),j=Object(d.useInstanceId)(h);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const E=b()("woocommerce-tag",u,{"has-remove":!!r}),_="woocommerce-tag__label-"+j,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:E},o?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:_,onClick:()=>p(!0)},w):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:_},w),o&&m&&Object(n.createElement)(s.Popover,{onClose:()=>p(!1)},o),r&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:r(t),label:Object(a.sprintf)(// Translators: %s label.
6
  Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":_},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var j=h;const E=e=>Object(n.createElement)(p.b,e),_=e=>{const{list:t,selected:c,renderItem:o,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const b=-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,o({item:t,isSelected:b,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(_,r()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:o,messages:r,onChange:l,onRemove:i}=e;if(t||c||!o)return null;const u=o.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,r.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":r.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,o.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(j,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:o,instanceId:r,...s}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=s,p=b||E;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)(_,{list:t,selected:d,renderItem:p,onSelect:o,instanceId:r,isSingle:m,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:o,isLoading:a,isSingle:l,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:h}=e,[j,E]=Object(n.useState)(""),_=Object(d.useInstanceId)(k),v=Object(n.useMemo)(()=>({...m.a,...u}),[u]),y=Object(n.useMemo)(()=>Object(m.c)(i,j,o),[i,j,o]);Object(n.useEffect)(()=>{h&&h(v.updated)},[h,v]),Object(n.useEffect)(()=>{"function"==typeof g&&g(j)},[j,g]);const S=Object(n.useCallback)(e=>()=>{l&&p([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});p([...O.slice(0,t),...O.slice(t+1)])},[l,O,p]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?p(l?[e]:[...O,e]):S(e.id)()},[l,S,p,O]);return Object(n.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,r()({},e,{onRemove:S,messages:v})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:v.search,type:"search",value:j,onChange:e=>E(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,r()({},e,{search:j,filteredList:y,messages:v,onSelect:C,instanceId:_})))};Object(s.withSpokenMessages)(k)},,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(33),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:o,isLoading:l,onSelect:u,disabled:b,...d}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,r()({},d,{key:c.id,className:t,isSelected:o,item:c,onSelect:u,isSingle:!0,disabled:b})),o&&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";var o=c(0),r=c(6),n=c(1),a=c(3);function s(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(o.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)(a.Path,{d:c[t]})):null}class l extends o.Component{createLevelControl(e,t,c){const r=e===t;return{icon:Object(o.createElement)(s,{level:e}),title:Object(n.sprintf)(
7
  /* translators: %s: heading level e.g: "2", "3", "4" */
8
+ Object(n.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:n,onChange:l}=this.props;return Object(o.createElement)(a.ToolbarGroup,{isCollapsed:e,icon:Object(o.createElement)(s,{level:n}),controls:Object(r.range)(t,c).map(e=>this.createLevelControl(e,n,l))})}}t.a=l},,function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(43),a=c(122),s=c(2),l=c(7),i=c(29);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(o.createElement)(l.InspectorControls,null,Object(o.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(o.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(o.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(r.__)("Edit this product's details","woo-gutenberg-products-block"),Object(o.createElement)(n.a,{srcElement:a.a,size:16}))),Object(o.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(r.__)("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 r}));var o=c(0);const r=()=>{const[,e]=Object(o.useState)();return Object(o.useCallback)(t=>{e(()=>{throw t})},[])}},,,,,function(e,t,c){"use strict";var o=c(2),r=c(1),n=c(62);const a=Object(o.getSetting)("countryLocale",{}),s=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(r.sprintf)(
9
  /* translators: %s Field label. */
10
  Object(r.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(n.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(a).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,s(c)]}).reduce((e,t)=>{let[c,o]=t;return e[c]=o,e},{})]}).reduce((e,t)=>{let[c,o]=t;return e[c]=o,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=c&&void 0!==l[c]?l[c]:{};return e.map(e=>({key:e,...o.defaultAddressFields[e]||{},...r[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var o=c(0);c(161),t.a=()=>Object(o.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t){e.exports=window.wp.wordcount},function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(1),s=c(6),l=(c(10),c(33)),i=c(87),u=c(9),b=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Object(n.createElement)(e,r()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),d=c(193),m=c(25),p=c.n(m),g=c(26),O=c.n(g),h=c(27),j=c(28),E=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),p()(this,"state",{error:null,loading:!1,variations:{}}),p()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const o=this.getExpandedProduct();if(!o||c[o])return;const r=e.find(e=>e.id===o);r.variations&&0!==r.variations.length?(this.setState({loading:!0}),Object(h.g)(o).then(e=>{const t=e.map(e=>({...e,parent:o}));this.setState({variations:{...this.state.variations,[o]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(j.a)(e);this.setState({variations:{...this.state.variations,[o]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[o]: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:o}=this.props;o&&(!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){const{products:t}=this.props;return t.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0].id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let o=t&&t.length?t[0]:null;return o?this.prevSelectedItem=o:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(o=this.prevSelectedItem)),!e&&o?this.isProductId(o)?o:this.findParentProduct(o):null}render(){const{error:t,isLoading:c}=this.props,{error:o,loading:a,variations:s}=this.state;return Object(n.createElement)(e,r()({},this.props,{error:o||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return p()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),_=c(32),w=c(4),f=c.n(w),k=c(89);c(142);const v={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")},y=e=>{let{expandedProduct:t,error:c,instanceId:o,isCompact:u,isLoading:b,onChange:d,onSearch:m,products:p,renderItem:g,selected:O,showVariations:h,variations:j,variationsLoading:E}=e;if(c)return Object(n.createElement)(_.a,{error:c});const w=[...p,...j&&j[t]?j[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:w,isCompact:u,isLoading:b,isSingle:!0,selected:w.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:d,renderItem:g||(h?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:d}=e,m=t.variations&&Array.isArray(t.variations)?t.variations.length:0,p=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":m>0});if(!t.breadcrumbs.length)return Object(n.createElement)(k.a,r()({},e,{className:f()(p,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{d(t)()},isLoading:b||E,countLabel:t.variations.length>0?Object(a.sprintf)(
11
  /* translators: %1$d is the number of variations of a product product. */
13
  /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
14
  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,r()({},g,{className:p,name:"variations-"+o}))}:null),onSearch:m,messages:v,isHierarchical:!0})};y.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=b(Object(d.a)(E(Object(u.withInstanceId)(y))))},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=n},,function(e,t,c){"use strict";var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(30),s=c(9);c(144),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:r,onChange:s,options:l,screenReaderLabel:i,readOnly:u,value:b}=e;const d="wc-block-components-sort-select__select-"+c;return Object(o.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:r,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(o.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,readOnly:u,value:b},l.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},function(e,t,c){"use strict";var o=c(0),r=c(1),n=c(41),a=c(4),s=c.n(a),l=c(35);c(158);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},Object(r.sprintf)(
15
  /* translators: %1$s min price, %2$s max price */
16
+ Object(r.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(o.createElement)("span",{"aria-hidden":!0},Object(o.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(o.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:b}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Previous price:","woo-gutenberg-products-block")),Object(o.createElement)(n.a,{currency:t,renderText:e=>Object(o.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(o.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Discounted price:","woo-gutenberg-products-block")),Object(o.createElement)(n.a,{currency:t,renderText:e=>Object(o.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:b}))};t.a=e=>{let{align:t,className:c,currency:r,format:a="<price/>",maxPrice:l,minPrice:b,price:d,priceClassName:m,priceStyle:p,regularPrice:g,regularPriceClassName:O,regularPriceStyle:h}=e;const j=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 E=g&&d!==g;let _=Object(o.createElement)("span",{className:s()("wc-block-components-product-price__value",m)});return E?_=Object(o.createElement)(u,{currency:r,price:d,priceClassName:m,priceStyle:p,regularPrice:g,regularPriceClassName:O,regularPriceStyle:h}):void 0!==b&&void 0!==l?_=Object(o.createElement)(i,{currency:r,maxPrice:l,minPrice:b,priceClassName:m,priceStyle:p}):d&&(_=Object(o.createElement)(n.a,{className:s()("wc-block-components-product-price__value",m),currency:r,value:d,style:p})),Object(o.createElement)("span",{className:j},Object(o.createInterpolateElement)(a,{price:_}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var o=c(6);let r;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(r||(r={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(o.uniqueId)(),type:r.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:r.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:o,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 r.ADD_EVENT_CALLBACK:return l.set(o,{priority:s,callback:n}),{...e,[c]:l};case r.REMOVE_EVENT_CALLBACK:return l.delete(o),{...e,[c]:l}}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(8);function r(e,t){const c=Object(o.useRef)();return Object(o.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,,,function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"c",(function(){return i})),c.d(t,"a",(function(){return u}));var o=c(7),r=c(65),n=c(62),a=c(194);const s=e=>Object(n.c)(e)?JSON.parse(e)||{}:Object(n.b)(e)?e:{},l=e=>{if(!Object(r.b)()||!Object(a.a)())return{style:{}};const t=Object(n.b)(e)?e:{},c=s(t.style);return Object(o.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},i=e=>{const t=Object(n.b)(e)?e:{},c=s(t.style),o=Object(n.b)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize||o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,textTransform:o.textTransform,fontFamily:t.fontFamily}}},u=e=>{if(!Object(r.b)())return{className:"",style:{}};const t=Object(n.b)(e)?e:{},c=s(t.style);return Object(o.__experimentalUseColorProps)({...t,style:c})}},function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var o=c(0),r=c(6),n=c(26),a=c.n(n);const s=Object(o.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),l=()=>Object(o.useContext)(s),i=e=>{let{children:t}=e;const[c,n]=Object(o.useState)({}),l=Object(o.useCallback)(e=>c[e],[c]),i=Object(o.useCallback)(e=>{const t=c[e];return!t||t.hidden?"":"validate-error-"+e},[c]),u=Object(o.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:c,...o}=t;return o})},[]),b=Object(o.useCallback)(()=>{n({})},[]),d=Object(o.useCallback)(e=>{e&&n(t=>(e=Object(r.pickBy)(e,(e,c)=>!("string"!=typeof e.message||t.hasOwnProperty(c)&&a()(t[c],e))),0===Object.values(e).length?t:{...t,...e}))},[]),m=Object(o.useCallback)((e,t)=>{n(c=>{if(!c.hasOwnProperty(e))return c;const o={...c[e],...t};return a()(c[e],o)?c:{...c,[e]:o}})},[]),p={getValidationError:l,setValidationErrors:d,clearValidationError:u,clearAllValidationErrors:b,hideValidationError:Object(o.useCallback)(e=>{m(e,{hidden:!0})},[m]),showValidationError:Object(o.useCallback)(e=>{m(e,{hidden:!1})},[m]),showAllValidationErrors:Object(o.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(c=>{e[c].hidden&&(t[c]={...e[c],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:i};return Object(o.createElement)(s.Provider,{value:p},t)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var o=c(16),r=c(13),n=c(0),a=c(39),s=c(94);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 b=Object(n.useRef)({results:[],isLoading:!0}),d=Object(a.a)(i),m=Object(a.a)(l),p=Object(s.a)(),g=Object(r.useSelect)(e=>{if(!u)return null;const r=e(o.COLLECTIONS_STORE_KEY),n=[t,c,d,m],a=r.getCollectionError(...n);return a&&p(a),{results:r.getCollection(...n),isLoading:!r.hasFinishedResolution("getCollection",n)}},[t,c,m,d,u]);return null!==g&&(b.current=g),b.current}},,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("mask",{id:"external-mask",width:"24",height:"24",x:"0",y:"0",maskUnits:"userSpaceOnUse"},Object(o.createElement)("path",{fill:"#fff",d:"M6.3431 6.3431v1.994l7.8984.0072-8.6055 8.6054 1.4142 1.4143 8.6055-8.6055.0071 7.8984h1.994V6.3431H6.3431z"})),Object(o.createElement)("g",{mask:"url(#external-mask)"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"})));t.a=n},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(0);const r=Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(o.createElement)("title",null,"Grid Block Preview"),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(o.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(o.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 o=c(5),r=c.n(o),n=c(0),a=c(14),s=c(4),l=c.n(s);c(157),t.a=e=>{let{className:t="",disabled:c=!1,name:o,permalink:s="",rel:i,style:u,onClick:b,...d}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=d;return Object(n.createElement)("span",r()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(o)}}))}return Object(n.createElement)("a",r()({className:m,href:s,rel:i},d,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(o)},style:u}))}},function(e,t,c){"use strict";c.d(t,"b",(function(){return g})),c.d(t,"a",(function(){return O}));var o=c(0),r=(c(10),c(13)),n=c(60),a=c(49),s=c(5),l=c.n(s),i=c(4),u=c.n(i),b=c(488);c(159);const d=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""};var m=e=>{let{className:t,notices:c,removeNotice:r}=e;const n=c.filter(e=>"snackbar"!==e.type);if(!n.length)return null;const a=u()(t,"wc-block-components-notices");return Object(o.createElement)("div",{className:a},n.map(e=>Object(o.createElement)(b.a,l()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&r(e.id)}}),e.content)))};const p=Object(o.createContext)({notices:[],createNotice:(e,t,c)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),g=()=>Object(o.useContext)(p),O=e=>{let{children:t,className:c="",createNoticeContainer:s=!0,context:l="wc/core"}=e;const{createNotice:i,removeNotice:u}=Object(r.useDispatch)("core/notices"),[b,d]=Object(o.useState)(!1),{dispatchStoreEvent:g}=Object(n.a)(),{isEditor:O}=Object(a.b)(),h=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i(e,t,{...c,context:c.context||l}),g("store-notice-create",{status:e,content:t,options:c})}),[i,g,l]),j=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;u(e,t)}),[u,l]),{notices:E}=Object(r.useSelect)(e=>({notices:e("core/notices").getNotices(l)}),[l]),_={notices:E,createNotice:h,removeNotice:j,context:l,setIsSuppressed:d},w=b?null:Object(o.createElement)(m,{className:c,notices:_.notices,removeNotice:_.removeNotice,isEditor:O});return Object(o.createElement)(p.Provider,{value:_},s&&w,t)}},function(e,t,c){"use strict";var o=c(0),r=c(101),n=c(76);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 o=s(e),r=o.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(r,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const r=s(e),a=r.slice(0,t);if(c)return Object(n.autop)(l(a,o));const i=a.match(/([\s]+)/g),u=i?i.length:0,b=r.slice(0,t+u);return Object(n.autop)(l(b,o))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:b={}}=e;const d=Object(o.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 o=Object(n.autop)(e),s=Object(r.count)(o,c);if(s<=t)return o;const l=a(o),b=Object(r.count)(l,c);return b<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(o.createElement)(o.RawHTML,{style:b,className:l},d)}},,,,,,,,,function(e,t){},,function(e,t){},,function(e,t){},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));const o=e=>e.reduce((e,t)=>{let[c,o]=t;return e[c]=o,e},{})},,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=c(24),s=c(27),l=c(118),i=c(28);t.a=e=>t=>{let{selected:c,...o}=t;const[u,b]=Object(n.useState)(!0),[d,m]=Object(n.useState)(null),[p,g]=Object(n.useState)([]),O=a.o.productCount>100,h=async e=>{const t=await Object(i.a)(e);m(t),b(!1)},j=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:j.current}).then(e=>{g(e),b(!1)}).catch(h)},[j]);const E=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),b(!1)}).catch(h)},400),_=Object(n.useCallback)(e=>{b(!0),E(e)},[b,E]);return Object(n.createElement)(e,r()({},o,{selected:c,error:d,products:p,isLoading:u,onSearch:O?_:null}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(7);const r=()=>"function"==typeof o.__experimentalGetSpacingClassesAndStyles},function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(1)),n=c(4),a=c.n(n),s=c(30),l=c(29),i=c(54);c(302),t.default=Object(i.withProductDataContext)(e=>{let{className:t,align:c}=e;const{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:i}=Object(l.useProductDataContext)();if(!i.id||!i.on_sale)return null;const u="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(o.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,u,{[n+"__product-onsale"]:n})},Object(o.createElement)(s.a,{label:Object(r.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(r.__)("Product on sale","woo-gutenberg-products-block")}))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(0),r=(c(10),c(114));c(162);const n=e=>{let{errorMessage:t="",propertyName:c="",elementId:n=""}=e;const{getValidationError:a,getValidationErrorId:s}=Object(r.b)();if(!t||"string"!=typeof t){const e=a(c)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(o.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(o.createElement)("p",{id:s(n)},t))}},,,,,,,,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z"}));t.a=n},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.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){},function(e,t,c){"use strict";var o=c(65);let r={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(o.b)()&&(r={...r,align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}}),t.a=r},function(e,t,c){"use strict";var o=c(0),r=c(4),n=c.n(r),a=c(29),s=c(65),l=c(54),i=c(129),u=c(60),b=(c(301),c(113));const d=e=>{let{children:t,headingLevel:c,elementType:r="h"+c,...n}=e;return Object(o.createElement)(r,n,t)};t.a=Object(l.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:r=!0,align:l}=e,{parentClassName:m}=Object(a.useInnerBlockLayoutContext)(),{product:p}=Object(a.useProductDataContext)(),{dispatchStoreEvent:g}=Object(u.a)(),O=Object(b.a)(e),h=Object(b.b)(e),j=Object(b.c)(e);return p.id?Object(o.createElement)(d,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...h.style,...j.style,...O.style}:{}},Object(o.createElement)(i.a,{disabled:!r,name:p.name,permalink:p.permalink,rel:r?"nofollow":"",onClick:()=>{g("product-view-link",{product:p})}})):Object(o.createElement)(d,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...h.style,...j.style,...O.style}:{}})})},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));const o=window.CustomEvent||null,r=(e,t)=>{let{bubbles:c=!1,cancelable:r=!1,element:n,detail:a={}}=t;if(!o)return;n||(n=document.body);const s=new o(e,{bubbles:c,cancelable:r,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{r("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{r(t,{bubbles:c,cancelable:o})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"c",(function(){return s})),c.d(t,"a",(function(){return l}));var o=c(2),r=c(99),n=c(15);const a=e=>{let{country:t="",state:c="",city:o="",postcode:r=""}=e;return{country:t.trim(),state:c.trim(),city:o.trim(),postcode:r?r.replace(" ","").toUpperCase():""}},s=e=>{let{email:t=""}=e;return Object(n.isEmail)(t)?t.trim():""},l=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:o=!1}=t;o&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";t.a={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}}},function(e,t,c){"use strict";var o=c(5),r=c.n(o),n=c(0),a=(c(10),c(1)),s=c(4),l=c.n(s),i=c(2),u=c(29),b=c(54),d=c(60),m=c(195);c(303);const p=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),g=e=>{let{image:t,onLoad:c,loaded:o,showFullSize:a,fallbackAlt:s}=e;const{thumbnail:l,src:i,srcset:u,sizes:b,alt:d}=t||{},m={alt:d||s,onLoad:c,hidden:!o,src:l,...a&&{src:i,srcSet:u,sizes:b}};return Object(n.createElement)(n.Fragment,null,m.src&&Object(n.createElement)("img",r()({"data-testid":"product-image"},m)),!o&&Object(n.createElement)(p,null))};t.a=Object(b.withProductDataContext)(e=>{let{className:t,imageSizing:c="full-size",showProductLink:o=!0,showSaleBadge:r,saleBadgeAlign:s="right"}=e;const{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:b}=Object(u.useProductDataContext)(),[O,h]=Object(n.useState)(!1),{dispatchStoreEvent:j}=Object(d.a)();if(!b.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",{[i+"__product-image"]:i})},Object(n.createElement)(p,null));const E=!!b.images.length,_=E?b.images[0]:null,w=o?"a":n.Fragment,f=Object(a.sprintf)(
17
  /* translators: %s is referring to the product name */
18
+ Object(a.__)("Link to %s","woo-gutenberg-products-block"),b.name),k={href:b.permalink,rel:"nofollow",...!E&&{"aria-label":f},onClick:()=>{j("product-view-link",{product:b})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i})},Object(n.createElement)(w,o&&k,!!r&&Object(n.createElement)(m.default,{align:s,product:b}),Object(n.createElement)(g,{fallbackAlt:b.name,image:_,onLoad:()=>h(!0),loaded:O,showFullSize:"cropped"!==c})))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var o=c(108);const r=(e,t)=>function(c){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=o.a.addEventCallback(e,c,r);return t(n),()=>{t(o.a.removeEventCallback(e,n.id))}}},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},function(e,t,c){"use strict";var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(1),s=c(39),l=c(478);const i={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},u={status:i.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},b={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:d,SET_IDLE:m,SET_DISABLED:p,SET_PROCESSING:g,SET_BEFORE_PROCESSING:O,SET_AFTER_PROCESSING:h,SET_PROCESSING_RESPONSE:j,SET_HAS_ERROR:E,SET_NO_ERROR:_,SET_QUANTITY:w,SET_REQUEST_PARAMS:f}=b,k=()=>({type:m}),v=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?E:_;return{type:t}},{SET_PRISTINE:y,SET_IDLE:S,SET_DISABLED:C,SET_PROCESSING:x,SET_BEFORE_PROCESSING:N,SET_AFTER_PROCESSING:P,SET_PROCESSING_RESPONSE:T,SET_HAS_ERROR:R,SET_NO_ERROR:I,SET_QUANTITY:A,SET_REQUEST_PARAMS:B}=b,{PRISTINE:L,IDLE:V,DISABLED:z,PROCESSING:D,BEFORE_PROCESSING:F,AFTER_PROCESSING:M}=i,H=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,{quantity:c,type:o,data:r}=arguments.length>1?arguments[1]:void 0;switch(o){case y:e=u;break;case S:e=t.status!==V?{...t,status:V}:t;break;case C:e=t.status!==z?{...t,status:z}:t;break;case A:e=c!==t.quantity?{...t,quantity:c}:t;break;case B:e={...t,requestParams:{...t.requestParams,...r}};break;case T:e={...t,processingResponse:r};break;case x:e=t.status!==D?{...t,status:D,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case N:e=t.status!==F?{...t,status:F,hasError:!1}:t;break;case P:e=t.status!==M?{...t,status:M}:t;break;case R:e=t.hasError?t:{...t,hasError:!0},e=t.status===D||t.status===F?{...e,status:V}:e;break;case I:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&o!==y&&e.status===L&&(e.status=V),e};var G=c(108),q=c(255);const Q=e=>({onAddToCartAfterProcessingWithSuccess:Object(q.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(q.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(q.a)("add_to_cart_before_processing",e)});var Y=c(258),U=c(114),$=c(47),W=c(44);const K=Object(o.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(o.useContext)(K),X=e=>{var t,c,r,n;let{children:b,product:m,showFormElements:E}=e;const[_,y]=Object(o.useReducer)(H,u),[S,C]=Object(o.useReducer)(G.b,{}),x=Object(s.a)(S),{addErrorNotice:N,removeNotices:P}=Object($.a)(),{setValidationErrors:T}=Object(U.b)(),{isSuccessResponse:R,isErrorResponse:I,isFailResponse:A}=Object(W.c)(),B=Object(o.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:Q(C).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Q(C).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Q(C).onAddToCartBeforeProcessing}),[C]),L=Object(o.useMemo)(()=>({resetForm:()=>{y({type:d})},submitForm:()=>{y({type:O})},setQuantity:e=>{y((e=>({type:w,quantity:e}))(e))},setHasError:e=>{y(v(e))},setRequestParams:e=>{y((e=>({type:f,data:e}))(e))},setAfterProcessing:e=>{y({type:j,data:e}),y({type:h})}}),[]);Object(o.useEffect)(()=>{const e=_.status,t=!m.id||!Object(l.a)(m);e!==i.DISABLED||t?e!==i.DISABLED&&t&&y({type:p}):y(k())},[_.status,m,y]),Object(o.useEffect)(()=>{_.status===i.BEFORE_PROCESSING&&(P("error"),Object(Y.a)(x,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&N(t),c&&T(c)}),y(k())):y({type:g})}))},[_.status,T,N,P,y,x]),Object(o.useEffect)(()=>{if(_.status===i.AFTER_PROCESSING){const e={processingResponse:_.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:o}=e;(I(e)||A(e))&&c&&(t=!0,N(c,o?{context:o}:void 0))}),t};if(_.hasError)return void Object(Y.b)(x,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var o;const t=(null===(o=e.processingResponse)||void 0===o?void 0:o.message)||Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");N(t,{id:"add-to-cart"})}y(k())});Object(Y.b)(x,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?y(v(!0)):y(k())})}},[_.status,_.hasError,_.processingResponse,L,N,I,A,R,x]);const V=Object(l.b)(m),z={product:m,productType:m.type||"simple",productIsPurchasable:Object(l.a)(m),productHasOptions:m.has_options||!1,supportsFormElements:V,showFormElements:E&&V,quantity:_.quantity||(null==m||null===(t=m.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==m||null===(c=m.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==m||null===(r=m.add_to_cart)||void 0===r?void 0:r.maximum)||99,multipleOf:(null==m||null===(n=m.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:_.requestParams,isIdle:_.status===i.IDLE,isDisabled:_.status===i.DISABLED,isProcessing:_.status===i.PROCESSING,isBeforeProcessing:_.status===i.BEFORE_PROCESSING,isAfterProcessing:_.status===i.AFTER_PROCESSING,hasError:_.hasError,eventRegistration:B,dispatchActions:L};return Object(o.createElement)(K.Provider,{value:z},b)};var Z=c(11),ee=c.n(Z),te=c(14),ce=c(36),oe=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:r,hasError:n,isProcessing:s,requestParams:l}=J(),{hasValidationErrors:i,showAllValidationErrors:u}=Object(U.b)(),{addErrorNotice:b,removeNotice:d}=Object($.a)(),{receiveCart:m}=Object(ce.a)(),[p,g]=Object(o.useState)(!1),O=!n&&s,h=Object(o.useCallback)(()=>!i||(u(),{type:"error"}),[i,u]);Object(o.useEffect)(()=>{const e=r.onAddToCartBeforeProcessing(h,0);return()=>{e()}},[r,h]);const j=Object(o.useCallback)(()=>{g(!0),d("add-to-cart");const o={id:t.id||0,quantity:c,...l};ee()({path:"/wc/store/cart/add-item",method:"POST",data:o,cache:"no-store",parse:!1}).then(t=>{ee.a.setNonce(t.headers),t.json().then((function(c){t.ok?m(c):(c.body&&c.body.message?b(Object(te.decodeEntities)(c.body.message),{id:"add-to-cart"}):b(Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),e.setHasError()),e.setAfterProcessing(c),g(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&m(t.data.cart),e.setHasError(),e.setAfterProcessing(t),g(!1)}))})},[t,b,d,m,e,c,l]);return Object(o.useEffect)(()=>{O&&!p&&j()},[O,j,p]),null};const re=e=>{let{children:t,product:c,showFormElements:r}=e;return Object(o.createElement)(U.a,null,Object(o.createElement)(X,{product:c,showFormElements:r},t,Object(o.createElement)(oe,null)))};var ne=c(29),ae=c(6),se=c(54),le=(c(248),c(80)),ie=c(43),ue=c(312),be=c(60),de=c(360);const me=e=>{let{className:t,href:c,text:r,onClick:n}=e;return Object(o.createElement)(le.a,{className:t,href:c,onClick:n,rel:"nofollow"},r)},pe=e=>{let{className:t,quantityInCart:c,isProcessing:r,isDisabled:n,isDone:s,onClick:l}=e;return Object(o.createElement)(le.a,{className:t,disabled:n,showSpinner:r,onClick:l},s&&c>0?Object(a.sprintf)(
19
  /* translators: %s number of products in cart. */
20
+ 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(o.createElement)(ie.a,{srcElement:ue.a,alt:Object(a.__)("Done","woo-gutenberg-products-block")}))};var ge=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:r,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:b}=J(),{parentName:d}=Object(ne.useInnerBlockLayoutContext)(),{dispatchStoreEvent:m}=Object(be.a)(),{cartQuantity:p}=Object(de.a)(r.id||0),[g,O]=Object(o.useState)(!1),h=r.add_to_cart||{url:"",text:""};return Object(o.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(o.createElement)(pe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:p,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{b.submitForm(),m("cart-add-item",{product:r,listName:d})}}):Object(o.createElement)(me,{className:"wc-block-components-product-add-to-cart-button",href:h.url,text:h.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{m("product-view-link",{product:r,listName:d})}})},Oe=c(118),he=e=>{let{disabled:t,min:c,max:r,step:n=1,value:a,onChange:s}=e;const l=void 0!==r,i=Object(Oe.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(r/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&s(t)},300);return Object(o.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:r,step:n,hidden:1===r,disabled:t,onChange:e=>{s(e.target.value),i(e.target.value)}})},je=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},Ee=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:r,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(o.createElement)(je,null):e.id&&!e.is_in_stock?Object(o.createElement)(je,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(he,{value:t,min:c,max:r,step:n,disabled:l,onChange:s.setQuantity}),Object(o.createElement)(ge,null))},_e=(c(311),c(499)),we=c(8),fe=c(196);const ke={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var ve=e=>{let{attributeName:t,options:c=[],value:r="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const{getValidationError:i,setValidationErrors:u,clearValidationError:b}=Object(U.b)(),d=t,m=i(d)||{};return Object(we.useEffect)(()=>{r?b(d):u({[d]:{message:l,hidden:!0}})},[r,d,l,b,u]),Object(we.useEffect)(()=>()=>{b(d)},[d,b]),Object(o.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(o.createElement)(_e.a,{label:Object(te.decodeEntities)(t),value:r||"",options:[ke,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":m.message&&!m.hidden})}),Object(o.createElement)(fe.a,{propertyName:d,elementId:d}))},ye=c(62);const Se=(e,t,c)=>{const o=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return o;const r=Object.keys(e);return o.filter(e=>r.every(o=>{const r=c[o]||"",n=t["id:"+e].attributes[o];return""===r||null===n||n===r}))};var Ce=e=>{let{attributes:t,variationAttributes:c,setRequestParams:r}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(o.useState)(0),[u,b]=Object(o.useState)({}),[d,m]=Object(o.useState)(!1),p=Object(o.useMemo)(()=>((e,t,c)=>{const o={},r=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return r.forEach(r=>{const a=e[r],s={...c,[r]:null},l=n?Se(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[r]):null;o[r]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:o}=e;return null===t||t.includes(null)||t.includes(o)?{value:o,label:Object(te.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),o})(n,a,u),[u,n,a]);return Object(o.useEffect)(()=>{if(!d){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(ye.b)(e))return{};const t=Object.keys(e),c={};return 0===t.length||t.forEach(t=>{const o=e[t],r=o.terms.filter(e=>e.default);var n;r.length>0&&(c[o.name]=null===(n=r[0])||void 0===n?void 0:n.slug)}),c}(t);e&&b({...e}),m(!0)}},[u,t,d]),Object(o.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>Se(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(o.useEffect)(()=>{r({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[r,l,u]),Object(o.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(o.createElement)(ve,{key:e,attributeName:e,options:p[e],value:u[e],onChange:t=>{b({...u,[e]:t})}})))},xe=e=>{let{product:t,dispatchers:c}=e;const r=(e=>e?Object(ae.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:o}=e;t["id:"+c]={id:c,attributes:o.reduce((e,t)=>{let{name:c,value:o}=t;return e[c]=o,e},{})}}),t})(t.variations);return 0===Object.keys(r).length||0===n.length?null:Object(o.createElement)(Ce,{attributes:r,variationAttributes:n,setRequestParams:c.setRequestParams})},Ne=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:r,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(o.createElement)(je,null):e.id&&!e.is_in_stock?Object(o.createElement)(je,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(xe,{product:e,dispatchers:s}),Object(o.createElement)(he,{value:t,min:c,max:r,step:n,disabled:l,onChange:s.setQuantity}),Object(o.createElement)(ge,null))},Pe=()=>Object(o.createElement)(ge,null),Te=c(490),Re=()=>Object(o.createElement)(Te.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Ie=()=>Object(o.createElement)(Re,null);const Ae=()=>{const{showFormElements:e,productType:t}=J();return e?"variable"===t?Object(o.createElement)(Ne,null):"grouped"===t?Object(o.createElement)(Ie,null):"external"===t?Object(o.createElement)(Pe,null):"simple"===t||"variation"===t?Object(o.createElement)(Ee,null):null:Object(o.createElement)(ge,null)};t.a=Object(se.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:r}=Object(ne.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(ae.isEmpty)(r)});return Object(o.createElement)(re,{product:r,showFormElements:c},Object(o.createElement)("div",{className:a},Object(o.createElement)(Ae,null)))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));const o=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var r=c(44);const n=async(e,t,c)=>{const r=o(e,t),n=[];for(const e of r)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},a=async(e,t,c)=>{const n=[],a=o(e,t);for(const e of a)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.a)(t)||Object(r.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},,,,,function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(106),s=c(35),l=c(29),i=c(7),u=c(65),b=c(54);t.default=Object(b.withProductDataContext)(e=>{var t,c;let{className:r,align:b,fontSize:d,customFontSize:m,saleFontSize:p,customSaleFontSize:g,color:O,customColor:h,saleColor:j,customSaleColor:E}=e;const{parentClassName:_}=Object(l.useInnerBlockLayoutContext)(),{product:w}=Object(l.useProductDataContext)(),f=n()(r,{[_+"__product-price"]:_});if(!w.id)return Object(o.createElement)(a.a,{align:b,className:f});const k=Object(i.getColorClassName)("color",O),v=Object(i.getFontSizeClass)(d),y=Object(i.getColorClassName)("color",j),S=Object(i.getFontSizeClass)(p),C=n()({"has-text-color":O||h,"has-font-size":d||m,[k]:k,[v]:v}),x=n()({"has-text-color":j||E,"has-font-size":p||g,[y]:y,[S]:S}),N={color:h,fontSize:m},P={color:E,fontSize:g},T=w.prices,R=Object(s.getCurrencyFromPriceResponse)(T),I=T.price!==T.regular_price,A=I?n()({[_+"__product-price__value"]:_,[x]:Object(u.b)()}):n()({[_+"__product-price__value"]:_,[C]:Object(u.b)()}),B=I?P:N;return Object(o.createElement)(a.a,{align:b,className:f,currency:R,price:T.price,priceClassName:A,priceStyle:Object(u.b)()?B:{},minPrice:null==T||null===(t=T.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==T||null===(c=T.price_range)||void 0===c?void 0:c.max_amount,regularPrice:T.regular_price,regularPriceClassName:n()({[_+"__product-price__regular"]:_,[C]:Object(u.b)()}),regularPriceStyle:Object(u.b)()?N:{}})})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(1)),n=c(4),a=c.n(n),s=c(29),l=c(54);c(304);t.default=Object(l.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(n);if(!l)return null;const i={width:l/5*100+"%"},u=Object(r.sprintf)(
21
  /* translators: %f is referring to the average rating value */
22
  Object(r.__)("Rated %f out of 5","woo-gutenberg-products-block"),l),b=(e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(n),d={__html:Object(r.sprintf)(
23
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
24
+ Object(r._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",b,"woo-gutenberg-products-block"),Object(r.sprintf)('<strong class="rating">%f</strong>',l),Object(r.sprintf)('<span class="rating">%d</span>',b))};return Object(o.createElement)("div",{className:a()(t,"wc-block-components-product-rating",{[c+"__product-rating"]:c})},Object(o.createElement)("div",{className:a()("wc-block-components-product-rating__stars",c+"__product-rating__stars"),role:"img","aria-label":u},Object(o.createElement)("span",{style:i,dangerouslySetInnerHTML:d})))})},function(e,t,c){"use strict";c.r(t);var o=c(5),r=c.n(o),n=c(0),a=(c(10),c(4)),s=c.n(a),l=c(1),i=c(60),u=c(360),b=c(14),d=c(29),m=c(54);c(305);const p=e=>{let{product:t}=e;const{id:c,permalink:o,add_to_cart:a,has_options:d,is_purchasable:m,is_in_stock:p}=t,{dispatchStoreEvent:g}=Object(i.a)(),{cartQuantity:O,addingToCart:h,addToCart:j}=Object(u.a)(c),E=Number.isFinite(O)&&O>0,_=!d&&m&&p,w=Object(b.decodeEntities)((null==a?void 0:a.description)||""),f=E?Object(l.sprintf)(
25
  /* translators: %s number of products in cart. */
26
+ Object(l._n)("%d in cart","%d in cart",O,"woo-gutenberg-products-block"),O):Object(b.decodeEntities)((null==a?void 0:a.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),k=_?"button":"a",v={};return _?v.onClick=()=>{j(),g("cart-add-item",{product:t})}:(v.href=o,v.rel="nofollow",v.onClick=()=>{g("product-view-link",{product:t})}),Object(n.createElement)(k,r()({"aria-label":w,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:h,added:E}),disabled:h},v),f)},g=()=>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"),disabled:!0});t.default=Object(m.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(d.useInnerBlockLayoutContext)(),{product:o}=Object(d.useProductDataContext)();return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},o.id?Object(n.createElement)(p,{product:o}):Object(n.createElement)(g,null))})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=(c(10),c(4)),n=c.n(r),a=c(131),s=c(24),l=c(29),i=c(54),u=(c(306),c(113));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:r}=Object(l.useProductDataContext)(),i=Object(u.a)(e),b=Object(u.c)(e);if(!r)return Object(o.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const d=r.short_description?r.short_description:r.description;return d?Object(o.createElement)(a.a,{className:n()(t,i.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:d,maxLength:150,countType:s.o.wordCountType||"words",style:{...i.style,...b.style}}):null})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=(c(10),c(4)),a=c.n(n),s=c(29),l=c(54);c(307),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(o.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(r.__)("SKU:","woo-gutenberg-products-block")," ",Object(o.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=c(4),a=c.n(n),s=c(29),l=c(6),i=c(54);c(308),t.default=Object(i.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)();return Object(l.isEmpty)(n.categories)?null:Object(o.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",{[c+"__product-category-list"]:c})},Object(r.__)("Categories:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:r}=e;return Object(o.createElement)("li",{key:"category-list-item-"+r},Object(o.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=(c(10),c(4)),a=c.n(n),s=c(29),l=c(6),i=c(54);c(309),t.default=Object(i.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)();return Object(l.isEmpty)(n.tags)?null:Object(o.createElement)("div",{className:a()(t,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c})},Object(r.__)("Tags:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:r}=e;return Object(o.createElement)("li",{key:"tag-list-item-"+r},Object(o.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var o=c(0),r=c(1),n=(c(10),c(4)),a=c.n(n),s=c(29),l=c(54),i=(c(310),c(113));t.default=Object(l.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=Object(i.a)(e),u=Object(i.c)(e);if(!n.id||!n.is_purchasable)return null;const b=!!n.is_in_stock,d=n.low_stock_remaining,m=n.is_on_backorder;return Object(o.createElement)("div",{className:a()(t,l.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":!!d,"wc-block-components-product-stock-indicator--available-on-backorder":!!m}),style:{...l.style,...u.style}},d?(e=>Object(r.sprintf)(
27
  /* translators: %d stock amount (number of items in stock for product) */
28
+ Object(r.__)("%d left in stock","woo-gutenberg-products-block"),e))(d):((e,t)=>t?Object(r.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(r.__)("In Stock","woo-gutenberg-products-block"):Object(r.__)("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){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=n},,,,,,,,,,,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"}));t.a=n},,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58s1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41s-.23-1.06-.59-1.42zM13 20.01L4 11V4h7v-.01l9 9-7 7.02z"}),Object(o.createElement)("circle",{cx:"6.5",cy:"6.5",r:"1.5"}),Object(o.createElement)("path",{d:"M8.9 12.55c0 .57.23 1.07.6 1.45l3.5 3.5 3.5-3.5c.37-.37.6-.89.6-1.45 0-1.13-.92-2.05-2.05-2.05-.57 0-1.08.23-1.45.6l-.6.6-.6-.59c-.37-.38-.89-.61-1.45-.61-1.13 0-2.05.92-2.05 2.05z"}));t.a=n},,,,,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}));t.a=n},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var o=c(1),r=c(24);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(o.__)("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:r.m+"previews/pennant.jpg",thumbnail:r.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,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(o.__)("Add to cart","woo-gutenberg-products-block"),description:Object(o.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}));t.a=n},,,,,,,function(e,t,c){e.exports=c(440)},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var o=c(0),r=c(13),n=c(16),a=c(14),s=c(36),l=c(47);const i=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},u=e=>{const{addItemToCart:t}=Object(r.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:u}=Object(s.a)(),{addErrorNotice:b,removeNotice:d}=Object(l.a)(),[m,p]=Object(o.useState)(!1),g=Object(o.useRef)(i(c,e));return Object(o.useEffect)(()=>{const t=i(c,e);t!==g.current&&(g.current=t)},[c,e]),{cartQuantity:Number.isFinite(g.current)?g.current:0,addingToCart:m,cartIsLoading:u,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=>{b(Object(a.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})}).finally(()=>{p(!1)})}}}},function(e,t,c){"use strict";var o=c(0),r=c(18);const n=Object(o.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{stroke:"currentColor",strokeWidth:"1.5",d:"M2 .75h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H2c-.69 0-1.25-.56-1.25-1.25V2C.75 1.31 1.31.75 2 .75z"}),Object(o.createElement)("path",{fill:"currentColor",d:"M12 6H4V4.75h8zM12 9H4V7.75h8zM10 12H4v-1.25h6z"})));t.a=n},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,"blockSettings",(function(){return zt}));var o=c(5),r=c.n(o),n=c(0),a=c(1),s=c(7),l=c(12),i=c(43),u=c(18),b=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"})),d=c(65),m=c(4),p=c.n(m),g={category:"woocommerce-product-elements",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(n.createElement)(i.a,{srcElement:b,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:Object(d.a)()?void 0:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",{className:p()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},O=c(249),h=c(3),j=c(9),E=c(90),_=c(250),w=c(102);c(358);var f=function(e){let{className:t="",...c}=e;const o=p()("wc-block-text-toolbar-button",t);return Object(n.createElement)(h.Button,r()({className:o},c))},k=c(29);c(357);var v=e=>t=>c=>{const o=Object(k.useProductDataContext)(),{attributes:r,setAttributes:l}=c,{productId:i}=r,[u,b]=Object(n.useState)(!i);return o.hasContext?Object(n.createElement)(t,c):Object(n.createElement)(n.Fragment,null,u?Object(n.createElement)(h.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(n.createElement)("div",null,e.description),Object(n.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(n.createElement)(w.a,{selected:i||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];l({productId:e[0]?e[0].id:0})}}),Object(n.createElement)(h.Button,{isSecondary:!0,disabled:!i,onClick:()=>{b(!1)}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.ToolbarGroup,null,Object(n.createElement)(f,{onClick:()=>b(!0)},Object(a.__)("Switch product…","woo-gutenberg-products-block")))),Object(n.createElement)(t,c)))},y=Object(n.createElement)(u.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 3H7a2 2 0 00-2 2v16l7-3 7 3V5a2 2 0 00-2-2z"}));const S=Object(a.__)("Product Title","woo-gutenberg-products-block"),C=Object(n.createElement)(i.a,{srcElement:y,className:"wc-block-editor-components-block-icon"}),x=Object(a.__)("Display the title of a product.","woo-gutenberg-products-block");c(359);const N=e=>{let{attributes:t,setAttributes:c}=e;const o=Object(s.useBlockProps)(),{headingLevel:r,showProductLink:l,align:i}=t;return Object(n.createElement)("div",o,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(E.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:r,onChange:e=>c({headingLevel:e})}),Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}))),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(_.a,t)))};var P=Object(d.b)()?Object(j.compose)([v({icon:C,label:S,description:Object(a.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(N):N,T=c(194);const R={...g,apiVersion:2,title:S,description:x,icon:{src:C},attributes:O.a,edit:P,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},supports:{...g.supports,...Object(d.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(l.registerBlockType)("woocommerce/product-title",R);var I=c(263),A=c(209);const B=Object(a.__)("Product Price","woo-gutenberg-products-block"),L=Object(n.createElement)(i.a,{srcElement:A.a,className:"wc-block-editor-components-block-icon"}),V=Object(a.__)("Display the price of a product.","woo-gutenberg-products-block"),z=e=>{let{fontSize:t,setFontSize:c,color:o,setColor:r,colorLabel:l}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.FontSizePicker,{value:t.size,onChange:c}),Object(n.createElement)(h.BaseControl,{label:l},Object(n.createElement)(s.ColorPalette,{value:o.color,onChange:r,label:Object(a.__)("Color","woo-gutenberg-products-block")})))},D=e=>{let{fontSize:t,saleFontSize:c,setFontSize:o,setSaleFontSize:r,color:l,saleColor:i,setColor:u,setSaleColor:b,attributes:m,setAttributes:p}=e;const{align:g}=m;return Object(n.createElement)(n.Fragment,null,Object(d.b)()&&Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(s.AlignmentToolbar,{value:g,onChange:e=>{p({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(d.b)()&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Price","woo-gutenberg-products-block")},Object(n.createElement)(z,{color:l,setColor:u,fontSize:t,setFontSize:o,colorLabel:Object(a.__)("Color","woo-gutenberg-products-block")})),Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Sale price","woo-gutenberg-products-block")},Object(n.createElement)(z,{color:i,setColor:b,fontSize:c,setFontSize:r,colorLabel:Object(a.__)("Color","woo-gutenberg-products-block")})))),Object(n.createElement)(I.default,m))};var F=Object(d.b)()?Object(j.compose)([Object(s.withFontSizes)("fontSize"),Object(s.withFontSizes)("saleFontSize"),Object(s.withFontSizes)("originalFontSize"),Object(s.withColors)("color",{textColor:"color"}),Object(s.withColors)("saleColor",{textColor:"saleColor"}),Object(s.withColors)("originalColor",{textColor:"originalColor"}),v({icon:L,label:B,description:Object(a.__)("Choose a product to display its price.","woo-gutenberg-products-block")})])(D):D;let M={productId:{type:"number",default:0}};Object(d.b)()&&(M={...M,align:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"},saleFontSize:{type:"string"},customSaleFontSize:{type:"number"},color:{type:"string"},saleColor:{type:"string"},customColor:{type:"string"},customSaleColor:{type:"string"}});const H={title:B,description:V,icon:{src:L},attributes:M,edit:F};Object(l.registerBlockType)("woocommerce/product-price",{...g,...H});var G=c(253),q=c(55),Q=c(2),Y=c(254),U=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}));const $=Object(a.__)("Product Image","woo-gutenberg-products-block"),W=Object(n.createElement)(i.a,{srcElement:U,className:"wc-block-editor-components-block-icon"}),K=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var J=v({icon:W,label:$,description:Object(a.__)("Choose a product to display its image.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{showProductLink:o,imageSizing:r,showSaleBadge:l,saleBadgeAlign:i}=t;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:o,onChange:()=>c({showProductLink:!o})}),Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(a.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:l,onChange:()=>c({showSaleBadge:!l})}),l&&Object(n.createElement)(q.a,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,options:[{label:Object(a.__)("Left","woo-gutenberg-products-block"),value:"left"},{label:Object(a.__)("Center","woo-gutenberg-products-block"),value:"center"},{label:Object(a.__)("Right","woo-gutenberg-products-block"),value:"right"}],onChange:e=>c({saleBadgeAlign:e})}),Object(n.createElement)(q.a,{label:Object(a.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(n.createInterpolateElement)(Object(a.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(Q.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:r,options:[{label:Object(a.__)("Full Size","woo-gutenberg-products-block"),value:"full-size"},{label:Object(a.__)("Cropped","woo-gutenberg-products-block"),value:"cropped"}],onChange:e=>c({imageSizing:e})}))),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(Y.a,t)))});const X={title:$,description:K,icon:{src:W},attributes:G.a,edit:J};Object(l.registerBlockType)("woocommerce/product-image",{...g,...X});var Z=c(264),ee=c(343);const te=Object(a.__)("Product Rating","woo-gutenberg-products-block"),ce=Object(n.createElement)(i.a,{srcElement:ee.a,className:"wc-block-editor-components-block-icon"}),oe={title:te,description:Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block"),icon:{src:ce},attributes:{productId:{type:"number",default:0}},edit:v({icon:ce,label:te,description:Object(a.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(Z.default,t)})};Object(l.registerBlockType)("woocommerce/product-rating",{...g,...oe});var re=c(265),ne=c(210);const ae=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),se=Object(n.createElement)(i.a,{srcElement:ne.a,className:"wc-block-editor-components-block-icon"}),le={title:ae,description:Object(a.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block"),icon:{src:se},attributes:{productId:{type:"number",default:0}},edit:v({icon:se,label:ae,description:Object(a.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(h.Disabled,null,Object(n.createElement)(re.default,t))})};Object(l.registerBlockType)("woocommerce/product-button",{...g,...le});var ie=c(266),ue=c(361);const be=Object(a.__)("Product Summary","woo-gutenberg-products-block"),de=Object(n.createElement)(i.a,{srcElement:ue.a,className:"wc-block-editor-components-block-icon"}),me=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(362);var pe=v({icon:de,label:be,description:Object(a.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(ie.default,t))});const ge={apiVersion:2,title:be,description:me,icon:{src:de},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:pe,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-summary",{...g,...ge});var Oe=c(195),he=c(335);const je=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),Ee=Object(n.createElement)(i.a,{srcElement:he.a,className:"wc-block-editor-components-block-icon"}),_e={title:je,description:Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block"),icon:{src:Ee},supports:{html:!1},attributes:{productId:{type:"number",default:0}},edit:v({icon:Ee,label:je,description:Object(a.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(Oe.default,t)})};Object(l.registerBlockType)("woocommerce/product-sale-badge",{...g,..._e});var we=c(93),fe=c(267),ke=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const ve=Object(a.__)("Product SKU","woo-gutenberg-products-block"),ye=Object(n.createElement)(i.a,{srcElement:ke,className:"wc-block-editor-components-block-icon"}),Se={title:ve,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:ye},attributes:{productId:{type:"number",default:0}},edit:v({icon:ye,label:ve,description:Object(a.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(we.a,null),Object(n.createElement)(fe.default,t))})};Object(d.c)("woocommerce/product-sku",{...g,...Se});var Ce=c(268),xe=c(328);const Ne=Object(a.__)("Product Category List","woo-gutenberg-products-block"),Pe=Object(n.createElement)(i.a,{srcElement:xe.a,className:"wc-block-editor-components-block-icon"}),Te=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Re=v({icon:Pe,label:Ne,description:Object(a.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(we.a,null),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(Ce.default,t)))});const Ie={...g,title:Ne,description:Te,icon:{src:Pe},attributes:{productId:{type:"number",default:0}},edit:Re};Object(d.c)("woocommerce/product-category-list",Ie);var Ae=c(269);const Be=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),Le=Object(n.createElement)(i.a,{srcElement:he.a,className:"wc-block-editor-components-block-icon"}),Ve={title:Be,description:Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block"),icon:{src:Le},attributes:{productId:{type:"number",default:0}},edit:v({icon:Le,label:Be,description:Object(a.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(we.a,null),Object(n.createElement)(h.Disabled,null,Object(n.createElement)(Ae.default,t)))})};Object(d.c)("woocommerce/product-tag-list",{...g,...Ve});var ze=c(270),De=Object(n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("g",{fillRule:"evenodd"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{fillRule:"nonzero",d:"M20.5 5.2l-1.4-1.7C19 3.3 18.5 3 18 3H6c-.5 0-.9.2-1.2.5L3.5 5.3A2 2 0 003 6.5V19c0 1.1.9 2 2 2h14a2 2 0 002-2V6.5c0-.5-.2-1-.5-1.3zM6.2 5h11.6l.8 1H5.4l.8-1zM5 19V8h14v11H5z"})));const Fe=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Me=Object(n.createElement)(i.a,{srcElement:De,className:"wc-block-editor-components-block-icon"}),He=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Ge=v({icon:Me,label:Fe,description:Object(a.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(we.a,null),Object(n.createElement)(ze.default,t))});const qe={apiVersion:2,title:Fe,description:He,icon:{src:Me},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:Ge,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-stock-indicator",{...g,...qe});var Qe=c(478),Ye=(c(248),c(257));const Ue=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),$e=Object(n.createElement)(i.a,{srcElement:ne.a,className:"wc-block-editor-components-block-icon"}),We={title:Ue,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:$e},edit:v({icon:$e,label:Ue,description:Object(a.__)("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(k.useProductDataContext)(),{className:r,showFormElements:l}=t;return Object(n.createElement)("div",{className:p()(r,"wc-block-components-product-add-to-cart")},Object(n.createElement)(we.a,{productId:o.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(Qe.b)(o)?Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Display form elements","woo-gutenberg-products-block"),help:Object(a.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showFormElements:!l})}):Object(n.createElement)(h.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(a.__)("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(n.createElement)(h.Disabled,null,Object(n.createElement)(Ye.a,t)))}),attributes:c(256).a};Object(d.c)("woocommerce/product-add-to-cart",{...g,...We});var Ke=c(25),Je=c.n(Ke),Xe=c(13),Ze=(c(10),c(59)),et=c(469),tt=c(344),ct=c(24);const ot=(e,t)=>{const{className:c,contentVisibility:o}=t;return p()(e,c,{"has-image":o&&o.image,"has-title":o&&o.title,"has-rating":o&&o.rating,"has-price":o&&o.price,"has-button":o&&o.button})};var rt=c(122);const nt=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],at=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?at(e.innerBlocks):[]}]):[];var st=c(8),lt=c(6),it=c(30);c(368);const ut=e=>{let{currentPage:t,displayFirstAndLastPages:c,displayNextAndPreviousArrows:o,pagesToDisplay:r,onPageChange:s,totalPages:l}=e,{minIndex:i,maxIndex:u}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const o=e-1,r=Math.max(Math.floor(t-o/2),2),n=Math.min(Math.ceil(t+(o-(t-r))),c-1);return{minIndex:Math.max(Math.floor(t-(o-(n-t))),2),maxIndex:n}})(r,t,l);const b=c&&Boolean(1!==i),d=c&&Boolean(u!==l),m=c&&Boolean(i>3),g=c&&Boolean(u<l-2);b&&3===i&&(i-=1),d&&u===l-2&&(u+=1);const O=[];if(i&&u)for(let e=i;e<=u;e++)O.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(it.a,{screenReaderLabel:Object(a.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t-1),title:Object(a.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(it.a,{label:"←",screenReaderLabel:Object(a.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(n.createElement)("button",{className:p()("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:()=>s(1),disabled:1===t},Object(n.createElement)(it.a,{label:1,screenReaderLabel:Object(a.sprintf)(
29
  /* translators: %d is the page number (1, 2, 3...). */
30
  Object(a.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(n.createElement)("button",{key:e,className:p()("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?null:()=>s(e),disabled:t===e},Object(n.createElement)(it.a,{label:e,screenReaderLabel:Object(a.sprintf)(
31
  /* translators: %d is the page number (1, 2, 3...). */
32
  Object(a.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),d&&Object(n.createElement)("button",{className:p()("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:()=>s(l),disabled:t===l},Object(n.createElement)(it.a,{label:l,screenReaderLabel:Object(a.sprintf)(
33
  /* translators: %d is the page number (1, 2, 3...). */
34
+ Object(a.__)("Page %d","woo-gutenberg-products-block"),l)})),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t+1),title:Object(a.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(n.createElement)(it.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))};ut.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var bt=ut,dt=c(109),mt=c(73),pt=c(115),gt=c(16),Ot=c(39);var ht=c(60);c(369);const jt=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var Et=c(46),_t=c(103),wt=()=>{const{parentClassName:e}=Object(k.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(i.a,{className:e+"__no-products-image",alt:"",srcElement:_t.a,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(a.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(a.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},ft=c(349),kt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(k.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:c+"__no-products"},Object(n.createElement)(i.a,{className:c+"__no-products-image",alt:"",srcElement:ft.a,size:100}),Object(n.createElement)("strong",{className:c+"__no-products-title"},Object(a.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:c+"__no-products-description"},Object(a.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(a.__)("Reset Search","woo-gutenberg-products-block")))},vt=c(105);c(367);var yt=e=>{let{onChange:t,readOnly:c,value:o}=e;return Object(n.createElement)(vt.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",name:"orderby",onChange:t,options:[{key:"menu_order",label:Object(a.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(a.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(a.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(a.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(a.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(a.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:c,screenReaderLabel:Object(a.__)("Order products by","woo-gutenberg-products-block"),value:o})};const St=(e,t,c,o)=>{if(!c)return;const a=Object(et.a)(e);return c.map((c,s)=>{let[l,i={}]=c,u=[];i.children&&i.children.length>0&&(u=St(e,t,i.children,o));const b=a[l];if(!b)return null;const d=t.id||0,m=["layout",l,s,o,d];return Object(n.createElement)(n.Suspense,{key:m.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(b,r()({},i,{children:u,product:t})))})};var Ct=Object(j.withInstanceId)(e=>{let{product:t,attributes:c,instanceId:o}=e;const{layoutConfig:r}=c,{parentClassName:a,parentName:s}=Object(k.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=p()(a+"__product","wc-block-layout",{"is-loading":l});return Object(n.createElement)("li",{className:i,"aria-hidden":l},St(s,t,r,o))});c(366);const xt=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(lt.isEqual)(t,o)&&Number.isFinite(c)};var Nt,Pt=(Nt=e=>{let{attributes:t,currentPage:c,onPageChange:o,onSortChange:r,sortValue:s,scrollToTop:l}=e;const[i,u]=Object(mt.b)("attributes",[]),[b,d]=Object(mt.b)("stock_status",[]),[m,g]=Object(mt.b)("min_price"),[O,h]=Object(mt.b)("max_price"),[j]=Object(mt.c)((e=>{let{sortValue:t,currentPage:c,attributes:o}=e;const{columns:r,rows:n}=o;return{...(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"}}})(t),catalog_visibility:"catalog",per_page:r*n,page:c}})({attributes:t,sortValue:s,currentPage:c})),{products:E,totalProducts:_,productsLoading:w}=(e=>{const t={namespace:"/wc/store",resourceName:"products"},{results:c,isLoading:o}=Object(pt.a)({...t,query:e}),{value:r}=((e,t)=>{const{namespace:c,resourceName:o,resourceValues:r=[],query:n={}}=t;if(!c||!o)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const a=Object(Ot.a)(n),s=Object(Ot.a)(r),{value:l,isLoading:i=!0}=Object(Xe.useSelect)(e=>{const t=e(gt.COLLECTIONS_STORE_KEY),r=["x-wp-total",c,o,a,s];return{value:t.getCollectionHeader(...r),isLoading:t.hasFinishedResolution("getCollectionHeader",r)}},["x-wp-total",c,o,s,a]);return{value:l,isLoading:i}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(r,10),productsLoading:o}})(j),{parentClassName:f,parentName:v}=Object(k.useInnerBlockLayoutContext)(),y=(e=>{const{order:t,orderby:c,page:o,per_page:r,...n}=e;return n||{}})(j),{dispatchStoreEvent:S}=Object(ht.a)(),C=Object(dt.a)({totalQuery:y,totalProducts:_},xt);Object(n.useEffect)(()=>{S("product-list-render",{products:E,listName:v})},[E,v,S]),Object(n.useEffect)(()=>{Object(lt.isEqual)(y,null==C?void 0:C.totalQuery)||(o(1),null!=C&&C.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(Et.speak)(Object(a.__)("No products found","woo-gutenberg-products-block")):Object(Et.speak)(Object(a.sprintf)(
35
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
36
+ Object(a._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(_))},[null==C?void 0:C.totalQuery,_,o,y]);const{contentVisibility:x}=t,N=t.columns*t.rows,P=!Number.isFinite(_)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(lt.isEqual)(y,null==C?void 0:C.totalQuery)?Math.ceil(C.totalProducts/N):Math.ceil(_/N),T=E.length?E:Array.from({length:N}),R=0!==E.length||w,I=i.length>0||b.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:o,align:r}=t,n=void 0!==r?"align"+r:"";return p()(f,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":o})})()},x.orderBy&&R&&Object(n.createElement)(yt,{onChange:r,value:s}),!R&&I&&Object(n.createElement)(kt,{resetCallback:()=>{u([]),d([]),g(null),h(null)}}),!R&&!I&&Object(n.createElement)(wt,null),R&&Object(n.createElement)("ul",{className:f+"__products"},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(Ct,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(bt,{currentPage:c,onPageChange:e=>{l({focusableSelector:"a, button"}),o(e)},totalPages:P}))},e=>{const t=Object(n.useRef)(null);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(n.createElement)(Nt,r()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const o=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(o.length){const e=o[0];jt(e),null==e||e.focus()}else jt(e)})(e,c):jt(e))})(t.current,e)}})))}),Tt=e=>{let{attributes:t}=e;const[c,o]=Object(n.useState)(1),[r,a]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(n.createElement)(Pt,{attributes:t,currentPage:c,onPageChange:e=>{o(e)},onSortChange:e=>{const t=e.target.value;a(t),o(1)},sortValue:r})},Rt=c(128);class It extends st.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Rt.a:Object(n.createElement)(k.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(Tt,{attributes:e,urlParameterSuffix:t}))}}var At=It;c(365);class Bt extends n.Component{constructor(){super(...arguments),Je()(this,"state",{isEditing:!1,innerBlocks:[]}),Je()(this,"blockMap",Object(et.a)("woocommerce/all-products")),Je()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),Je()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),Je()(this,"getIcon",()=>Object(n.createElement)(i.a,{srcElement:b})),Je()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(a.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),Je()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:o,alignButtons:r}=e;return Object(n.createElement)(s.InspectorControls,{key:"inspector"},Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(Ze.a,{columns:c,rows:o,alignButtons:r,setAttributes:t,minColumns:Object(Q.getSetting)("min_columns",1),maxColumns:Object(Q.getSetting)("max_columns",6),minRows:Object(Q.getSetting)("min_rows",1),maxRows:Object(Q.getSetting)("max_rows",6)})),Object(n.createElement)(h.PanelBody,{title:Object(a.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(n.createElement)(h.ToggleControl,{label:Object(a.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(n.createElement)(h.SelectControl,{label:Object(a.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(a.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(a.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(a.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(a.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(a.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(a.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),Je()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.ToolbarGroup,{controls:[{icon:"edit",title:Object(a.__)("Edit inner product layout","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),Je()(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(n.createElement)(h.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(a.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(n.createElement)(h.Tip,null,Object(a.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(n.createElement)(k.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(n.createElement)("ul",{className:"wc-block-grid__products"},Object(n.createElement)("li",{className:"wc-block-grid__product"},Object(n.createElement)(k.ProductDataContextProvider,{product:tt.a[0]},Object(n.createElement)(s.InnerBlocks,e)))))),Object(n.createElement)("div",{className:"wc-block-all-products__actions"},Object(n.createElement)(h.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:at(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(a.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(h.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(a.__)("Cancel","woo-gutenberg-products-block")),Object(n.createElement)(h.Button,{className:"wc-block-all-products__reset-button",icon:Object(n.createElement)(i.a,{srcElement:b}),label:Object(a.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];nt.map(e=>{let[t,o]=e;return c.push(Object(l.createBlock)(t,o)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(a.__)("Reset Layout","woo-gutenberg-products-block")))))}),Je()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,o=this.getTitle(),r=this.getIcon();return c?Object(n.createElement)(h.Disabled,null,Object(n.createElement)(At,{attributes:e})):((e,t)=>Object(n.createElement)(h.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(a.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(o,r)}),Je()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),o=this.getIcon();return 0===ct.o.productCount?((e,t)=>Object(n.createElement)(h.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(n.createElement)("p",null,Object(a.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(n.createElement)(h.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:Q.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{srcElement:rt.a})),Object(n.createElement)(h.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(a.__)("Learn more","woo-gutenberg-products-block"))))(c,o):Object(n.createElement)("div",{className:ot("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Lt=Object(j.compose)(h.withSpokenMessages,Object(Xe.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:o}=e("core/block-editor");return{block:o(c)}}),Object(Xe.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Bt);const Vt={columns:Object(Q.getSetting)("default_columns",3),rows:Object(Q.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:nt,isPreview:!1},zt={title:Object(a.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(n.createElement)(i.a,{srcElement:b,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Display products from your store in a grid layout.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1,multiple:!1},example:{attributes:{isPreview:!0}},attributes:{columns:{type:"number"},rows:{type:"number"},alignButtons:{type:"boolean"},contentVisibility:{type:"object"},orderby:{type:"string"},layoutConfig:{type:"array"},isPreview:{type:"boolean",default:!1}},defaults:Vt,edit:e=>Object(n.createElement)(Lt,e),save(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(n.createElement)("div",r()({className:ot("wc-block-all-products",t)},o),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...zt,deprecated:[{attributes:Object.assign({},zt.attributes,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(n.createElement)("div",r()({className:ot("wc-block-all-products",t)},c),Object(n.createElement)(s.InnerBlocks.Content,null))}}]})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var o=c(38),r=c(0),n=c(24);c.p=n.l,Object(o.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(r.lazy)(()=>Promise.all([c.e(0),c.e(13)]).then(c.bind(null,263)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(5),c.e(12)]).then(c.bind(null,502)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(19)]).then(c.bind(null,503)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(r.lazy)(()=>c.e(14).then(c.bind(null,264)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(r.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(4),c.e(10)]).then(c.bind(null,265)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(3),c.e(17)]).then(c.bind(null,266)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(r.lazy)(()=>c.e(5).then(c.bind(null,195)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(r.lazy)(()=>c.e(15).then(c.bind(null,267)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(r.lazy)(()=>c.e(11).then(c.bind(null,268)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(r.lazy)(()=>c.e(18).then(c.bind(null,269)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(r.lazy)(()=>Promise.all([c.e(1),c.e(3),c.e(16)]).then(c.bind(null,270)))}),Object(o.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(r.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(4),c.e(9)]).then(c.bind(null,504)))});const a=e=>Object(o.getRegisteredBlockComponents)(e)},,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return r}));const o=e=>e.is_purchasable||!1,r=e=>["simple","variable"].includes(e.type||"simple")}]);
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-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '62f29d808552d29f8dddb76f857db8fd');
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-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '32f1246764dc732b6746866302fb668f');
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,s=t[0],i=t[1],l=t[2],u=0,b=[];u<s.length;u++)a=s[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[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,s=1;s<r.length;s++){var i=r[s];0!==n[i]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={8: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 s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=s.push.bind(s);s.push=t,s=s.slice();for(var l=0;l<s.length;l++)t(s[l]);var d=i;return c.push([344,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},103:function(e,t,r){"use strict";var o=r(0),n=r(18);const c=Object(o.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},104:function(e,t){},105:function(e,t,r){"use strict";var o=r(0),n=(r(10),r(4)),c=r.n(n),a=r(30),s=r(9);r(144),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:n,onChange:s,options:i,screenReaderLabel:l,readOnly:d,value:u}=e;const b="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:b}}),Object(o.createElement)("select",{id:b,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,readOnly:d,value:u},i.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},11:function(e,t){e.exports=window.wp.apiFetch},111:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(24);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}]}}},12:function(e,t){e.exports=window.wp.blocks},132: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}}},133:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(7),s=(r(143),r(53));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(s.a)(t)}),Object(s.b)(t)))}},136:function(e,t,r){"use strict";var o=r(0),n=r(1),c=(r(10),r(6)),a=r(3),s=r(7),i=r(8),l=r(2),d=r(71),u=r(30);r(169);const b=e=>{let{onClick:t,label:r,screenReaderLabel:n}=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:n})))};b.defaultProps={label:Object(n.__)("Load more","woo-gutenberg-products-block")};var w=b,p=r(105);r(166);var m=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(p.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})},g=r(4),h=r.n(g),v=r(25),O=r.n(v),_=r(153),j=r.n(_);const f=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=j()(e,{suffix:r,limit:t});return o.html},k=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),y=(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=f(e,o.middle),o=k(o,t.clientHeight,r);return o.middle})(e,t,r);return f(e,n-o.length,o)},E={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 i.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(i.createRef)(),this.reviewSummary=Object(i.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){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:y(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}}O()(R,"defaultProps",E);var C=R;r(168);var S=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:s,showReviewImage:i,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:h()("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":i}),"aria-hidden":w},(u||a||s||i||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},i&&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||s||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),s&&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)(C,{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(167);var P=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,s=c&&t.showReviewRating,i={...t,showReviewImage:a,showReviewRating:s};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:i}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:i,review:e})))},N=r(5),T=r.n(N),L=r(26),x=r.n(L),M=r(53),A=r(28);class I extends i.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:s,totalReviews:i}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===s.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)(m,{readOnly:!0,value:e.orderby}),Object(o.createElement)(P,{attributes:e,reviews:s}),e.showLoadMore&&i>s.length&&Object(o.createElement)(w,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var D=(e=>{class t extends i.Component{constructor(){super(...arguments),O()(this,"isPreview",!!this.props.attributes.previewReviews),O()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),O()(this,"isMounted",!1),O()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),O()(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||!x()(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};return t&&t.length&&(a.category_id=Array.isArray(t)?t.join(","):t),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(M.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,T()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}O()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(I);t.a=e=>{let{attributes:t,icon:r,name:i,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:h,showReviewRating:v}=t,{order:O,orderby:_}=Object(M.d)(t.orderby),j=!(g||v||p||m||h||w),f=Object(s.useBlockProps)({className:Object(M.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:i},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)(D,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:_,order:O,productId:u,reviewsToDisplay:b}))}},143:function(e,t){},144:function(e,t){},166:function(e,t){},167:function(e,t){},168:function(e,t){},169:function(e,t){},18:function(e,t){e.exports=window.wp.primitives},2:function(e,t){e.exports=window.wc.wcSettings},24: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 s})),r.d(t,"n",(function(){return i})),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 h})),r.d(t,"i",(function(){return v})),r.d(t,"b",(function(){return O}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",s=c.pluginUrl+"build/",i=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",{})),h=Object(n.getSetting)("allowedCountries",{}),v=Object(n.getSetting)("shippingStates",{}),O=Object(n.getSetting)("allowedStates",{})},26:function(e,t){e.exports=window.wp.isShallowEqual},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));var o=r(1);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"}},c=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?void 0: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},30: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:s={}}=e;const i=null!=r,l=null!=n;return!i&&l?(t=a||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,n)):(t=a||o.Fragment,i&&l&&r!==n?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,s,r))}},31:function(e,t){e.exports=window.wp.escapeHtml},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(31);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 unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},344:function(e,t,r){e.exports=r(453)},43:function(e,t,r){"use strict";var o=r(0);t.a=function(e){let{srcElement:t,size:r=24,...n}=e;return Object(o.isValidElement)(t)?Object(o.cloneElement)(t,{width:r,height:r,...n}):null}},453:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(12),a=r(43),s=r(18),i=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M15 4v7H5.17l-.59.59-.58.58V4h11m1-2H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm5 4h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1z"})),l=(r(143),r(7)),d=r(3),u=(r(10),r(136)),b=()=>Object(o.createElement)(d.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{srcElement:i,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")),w=r(95),p=r(132),m=r(133),g=r(111);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{srcElement:i,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:{...g.a,attributes:{...g.a.attributes,showProductName:!0}},attributes:{...p.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)(l.InspectorControls,{key:"inspector"},Object(o.createElement)(d.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(d.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(w.b)(t,r)),Object(o.createElement)(d.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(w.c)(t,r))),Object(o.createElement)(u.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:i,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:b}))},save:m.a})},53:function(e,t,r){"use strict";r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(11),n=r.n(o),c=r(4),a=r.n(c),s=r(2);const i=e=>{if(Object(s.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/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:s,showProductName:i,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":s,"has-product-name":i})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:s,showOrderby:i}=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":s,"data-show-orderby":i};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},55:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(6),s=r(4),i=r.n(s),l=r(3),d=r(9);r(84);class u extends c.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:r,className:o,help:s,options:d,value:u}=this.props,b="inspector-toggle-button-control-"+r;let w;return s&&(w=Object(a.isFunction)(s)?s(t):s),Object(c.createElement)(l.BaseControl,{id:b,help:w,className:i()("components-toggle-button-control",o)},Object(c.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},e),Object(c.createElement)(l.ButtonGroup,{"aria-labelledby":b+"__label"},d.map((t,r)=>{const o={};return u===t.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!0,o["aria-pressed"]=!1),Object(c.createElement)(l.Button,n()({key:`${t.label}-${t.value}-${r}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},o),t.label)})))}}t.a=Object(d.withInstanceId)(u)},6:function(e,t){e.exports=window.lodash},7:function(e,t){e.exports=window.wp.blockEditor},71:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(43),a=r(103),s=r(4),i=r.n(s),l=r(3),d=r(32);r(104),t.a=e=>{let{className:t,error:r,isLoading:s=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{srcElement:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:i()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,s?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.React},84:function(e,t){},9:function(e,t){e.exports=window.wp.compose},95:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return u}));var o=r(0),n=r(1),c=r(3),a=r(7),s=r(2),i=r(55);const l=(e,t,r)=>Object(o.createElement)(a.BlockControls,null,Object(o.createElement)(c.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),d=(e,t)=>{const r=Object(s.getSetting)("showAvatars",!0),a=Object(s.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!a&&Object(o.createElement)(c.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(s.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(c.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.a,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(n.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:e=>t({imageType:e})}),"reviewer"===e.imageType&&!r&&Object(o.createElement)(c.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(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},u=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(c.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)(c.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)(c.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(c.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))}});
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,s=t[0],i=t[1],l=t[2],u=0,b=[];u<s.length;u++)a=s[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[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,s=1;s<r.length;s++){var i=r[s];0!==n[i]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={8: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 s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=s.push.bind(s);s.push=t,s=s.slice();for(var l=0;l<s.length;l++)t(s[l]);var d=i;return c.push([345,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},103:function(e,t,r){"use strict";var o=r(0),n=r(18);const c=Object(o.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},104:function(e,t){},105:function(e,t,r){"use strict";var o=r(0),n=(r(10),r(4)),c=r.n(n),a=r(30),s=r(9);r(144),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:n,onChange:s,options:i,screenReaderLabel:l,readOnly:d,value:u}=e;const b="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:b}}),Object(o.createElement)("select",{id:b,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,readOnly:d,value:u},i.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},11:function(e,t){e.exports=window.wp.apiFetch},111:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(24);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}]}}},12:function(e,t){e.exports=window.wp.blocks},132: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}}},133:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(7),s=(r(143),r(53));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(s.a)(t)}),Object(s.b)(t)))}},136:function(e,t,r){"use strict";var o=r(0),n=r(1),c=(r(10),r(6)),a=r(3),s=r(7),i=r(8),l=r(2),d=r(71),u=r(30);r(169);const b=e=>{let{onClick:t,label:r,screenReaderLabel:n}=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:n})))};b.defaultProps={label:Object(n.__)("Load more","woo-gutenberg-products-block")};var w=b,m=r(105);r(166);var p=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(m.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})},g=r(4),h=r.n(g),v=r(25),O=r.n(v),_=r(153),j=r.n(_);const f=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=j()(e,{suffix:r,limit:t});return o.html},k=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),y=(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=f(e,o.middle),o=k(o,t.clientHeight,r);return o.middle})(e,t,r);return f(e,n-o.length,o)},E={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 i.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(i.createRef)(),this.reviewSummary=Object(i.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:y(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}}O()(R,"defaultProps",E);var S=R;r(168);var C=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:s,showReviewImage:i,showReviewRating:l,showReviewContent:d,showProductName:u}=t,{rating:b}=r,w=!Object.keys(r).length>0,m=Number.isFinite(b)&&l;return Object(o.createElement)("li",{className:h()("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":i}),"aria-hidden":w},(u||a||s||i||m)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},i&&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||s||m||a)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},m&&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),s&&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)(S,{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(167);var P=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,s=c&&t.showReviewRating,i={...t,showReviewImage:a,showReviewRating:s};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(C,{attributes:i}):r.map((e,t)=>Object(o.createElement)(C,{key:e.id||t,attributes:i,review:e})))},N=r(5),T=r.n(N),L=r(26),x=r.n(L),M=r(53),A=r(28);class I extends i.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:s,totalReviews:i}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===s.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)(P,{attributes:e,reviews:s}),e.showLoadMore&&i>s.length&&Object(o.createElement)(w,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var D=(e=>{class t extends i.Component{constructor(){super(...arguments),O()(this,"isPreview",!!this.props.attributes.previewReviews),O()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),O()(this,"isMounted",!1),O()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),O()(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||!x()(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};return t&&t.length&&(a.category_id=Array.isArray(t)?t.join(","):t),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(M.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,T()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}O()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(I);t.a=e=>{let{attributes:t,icon:r,name:i,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:m,showReviewerName:p,showReviewContent:g,showReviewImage:h,showReviewRating:v}=t,{order:O,orderby:_}=Object(M.d)(t.orderby),j=!(g||v||m||p||h||w),f=Object(s.useBlockProps)({className:Object(M.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:i},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)(D,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:_,order:O,productId:u,reviewsToDisplay:b}))}},143:function(e,t){},144:function(e,t){},166:function(e,t){},167:function(e,t){},168:function(e,t){},169:function(e,t){},18:function(e,t){e.exports=window.wp.primitives},2:function(e,t){e.exports=window.wc.wcSettings},24: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 s})),r.d(t,"n",(function(){return i})),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 m})),r.d(t,"d",(function(){return p})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return h})),r.d(t,"i",(function(){return v})),r.d(t,"b",(function(){return O}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",s=c.pluginUrl+"build/",i=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),m=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),p=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",{})),h=Object(n.getSetting)("allowedCountries",{}),v=Object(n.getSetting)("shippingStates",{}),O=Object(n.getSetting)("allowedStates",{})},26:function(e,t){e.exports=window.wp.isShallowEqual},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));var o=r(1);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"}},c=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?void 0: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},30: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:s={}}=e;const i=null!=r,l=null!=n;return!i&&l?(t=a||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,n)):(t=a||o.Fragment,i&&l&&r!==n?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,s,r))}},31:function(e,t){e.exports=window.wp.escapeHtml},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(31);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 unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},345:function(e,t,r){e.exports=r(454)},43:function(e,t,r){"use strict";var o=r(0);t.a=function(e){let{srcElement:t,size:r=24,...n}=e;return Object(o.isValidElement)(t)?Object(o.cloneElement)(t,{width:r,height:r,...n}):null}},454:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(12),a=r(43),s=r(18),i=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M15 4v7H5.17l-.59.59-.58.58V4h11m1-2H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm5 4h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1z"})),l=(r(143),r(7)),d=r(3),u=(r(10),r(136)),b=()=>Object(o.createElement)(d.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{srcElement:i,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")),w=r(95),m=r(132),p=r(133),g=r(111);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{srcElement:i,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:{...g.a,attributes:{...g.a.attributes,showProductName:!0}},attributes:{...m.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)(l.InspectorControls,{key:"inspector"},Object(o.createElement)(d.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(d.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(w.b)(t,r)),Object(o.createElement)(d.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(w.c)(t,r))),Object(o.createElement)(u.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:i,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:b}))},save:p.a})},53:function(e,t,r){"use strict";r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(11),n=r.n(o),c=r(4),a=r.n(c),s=r(2);const i=e=>{if(Object(s.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/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:s,showProductName:i,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":s,"has-product-name":i})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:s,showOrderby:i}=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":s,"data-show-orderby":i};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},55:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(4),s=r.n(a),i=r(3),l=r(9);r(84);class d extends c.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:r,className:o,help:a,options:l,value:d}=this.props,u="inspector-toggle-button-control-"+r;let b;return a&&(b="function"==typeof a?a(t):a),Object(c.createElement)(i.BaseControl,{id:u,help:b,className:s()("components-toggle-button-control",o)},Object(c.createElement)("label",{id:u+"__label",htmlFor:u,className:"components-toggle-button-control__label"},e),Object(c.createElement)(i.ButtonGroup,{"aria-labelledby":u+"__label"},l.map((t,r)=>{const o={};return d===t.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!0,o["aria-pressed"]=!1),Object(c.createElement)(i.Button,n()({key:`${t.label}-${t.value}-${r}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},o),t.label)})))}}t.a=Object(l.withInstanceId)(d)},6:function(e,t){e.exports=window.lodash},7:function(e,t){e.exports=window.wp.blockEditor},71:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(43),a=r(103),s=r(4),i=r.n(s),l=r(3),d=r(32);r(104),t.a=e=>{let{className:t,error:r,isLoading:s=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{srcElement:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:i()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,s?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.React},84:function(e,t){},9:function(e,t){e.exports=window.wp.compose},95:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return u}));var o=r(0),n=r(1),c=r(3),a=r(7),s=r(2),i=r(55);const l=(e,t,r)=>Object(o.createElement)(a.BlockControls,null,Object(o.createElement)(c.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),d=(e,t)=>{const r=Object(s.getSetting)("showAvatars",!0),a=Object(s.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!a&&Object(o.createElement)(c.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(s.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(c.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.a,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(n.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:e=>t({imageType:e})}),"reviewer"===e.imageType&&!r&&Object(o.createElement)(c.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(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},u=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(c.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)(c.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)(c.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(c.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))}});
build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---8f355022.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[1],{64:function(n,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"c",(function(){return u})),c.d(t,"b",(function(){return r})),c.d(t,"d",(function(){return e}));const o=n=>"number"==typeof n,u=n=>"string"==typeof n,r=n=>!(n=>null===n)(n)&&n instanceof Object&&n.constructor===Object;function e(n,t){return r(n)&&t in n}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[1],{62:function(n,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"c",(function(){return u})),c.d(t,"b",(function(){return r})),c.d(t,"d",(function(){return e}));const o=n=>"number"==typeof n,u=n=>"string"==typeof n,r=n=>!(n=>null===n)(n)&&n instanceof Object&&n.constructor===Object;function e(n,t){return r(n)&&t in n}}}]);
build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b.js CHANGED
@@ -1,3 +1,3 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{151:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>e.reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})},250:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return i}));const n=window.CustomEvent||null,c=(e,t)=>{let{bubbles:r=!1,cancelable:c=!1,element:s,detail:o={}}=t;if(!n)return;s||(s=document.body);const i=new n(e,{bubbles:r,cancelable:c,detail:o});s.dispatchEvent(i)};let s;const o=()=>{s&&clearTimeout(s),s=setTimeout(()=>{c("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},i=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const s=()=>{c(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,s),()=>jQuery(document).off(e,s)}},251:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return i})),r.d(t,"a",(function(){return a}));var n=r(2),c=r(99),s=r(15);const o=e=>{let{country:t="",state:r="",city:n="",postcode:c=""}=e;return{country:t.trim(),state:r.trim(),city:n.trim(),postcode:c?c.replace(" ","").toUpperCase():""}},i=e=>{let{email:t=""}=e;return Object(s.isEmail)(t)?t.trim():""},a=e=>{const t=Object.keys(n.defaultAddressFields),r=Object(c.a)(t,{},e.country),s=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(s[r]="")}),s}},36:function(e,t,r){"use strict";r.d(t,"a",(function(){return w}));var n=r(6),c=r(0),s=r(16),o=r(13),i=r(14),a=r(151),d=r(251),u=r(49),l=r(250);const p=e=>{const t=e.detail;t&&t.preserveCartData||Object(o.dispatch)(s.CART_STORE_KEY).invalidateResolutionForStore()},_=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},b=()=>{Object(c.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(l.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(l.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",p),document.body.addEventListener("wc-blocks_removed_from_cart",p),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",p),document.body.removeEventListener("wc-blocks_removed_from_cart",p)}}window.wcBlocksStoreCartListeners.count++})(),_),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},E={...m,email:""},h={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:s.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},g=e=>Object(a.a)(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(i.decodeEntities)(r)]})),f={cartCoupons:s.EMPTY_CART_COUPONS,cartItems:s.EMPTY_CART_ITEMS,cartFees:s.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:E,shippingAddress:m,shippingRates:s.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:s.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:s.EMPTY_EXTENSIONS},w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(u.b)(),i=null==r?void 0:r.previewCart,{shouldSelect:a}=e,l=Object(c.useRef)();b();const p=Object(o.useSelect)((e,r)=>{let{dispatch:n}=r;if(!a)return f;if(t)return{cartCoupons:i.coupons,cartItems:i.items,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:i.totals,cartIsLoading:!1,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:E,shippingAddress:m,extensions:s.EMPTY_EXTENSIONS,shippingRates:i.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:i.has_calculated_shipping,paymentRequirements:i.paymentRequirements,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:()=>{}};const c=e(s.CART_STORE_KEY),o=c.getCartData(),u=c.getCartErrors(),l=c.getCartTotals(),p=!c.hasFinishedResolution("getCartData"),_=c.isCustomerDataUpdating(),{receiveCart:b}=n(s.CART_STORE_KEY),h=g(o.billingAddress),w=o.needsShipping?g(o.shippingAddress):h,C=o.fees.length>0?o.fees.map(e=>g(e)):s.EMPTY_CART_FEES;return{cartCoupons:o.coupons.length>0?o.coupons.map(e=>({...e,label:e.code})):s.EMPTY_CART_COUPONS,cartItems:o.items,cartFees:C,cartItemsCount:o.itemsCount,cartItemsWeight:o.itemsWeight,cartNeedsPayment:o.needsPayment,cartNeedsShipping:o.needsShipping,cartItemErrors:o.errors,cartTotals:l,cartIsLoading:p,cartErrors:u,billingAddress:Object(d.a)(h),shippingAddress:Object(d.a)(w),extensions:o.extensions,shippingRates:o.shippingRates,shippingRatesLoading:_,cartHasCalculatedShipping:o.hasCalculatedShipping,paymentRequirements:o.paymentRequirements,receiveCart:b}},[a]);return l.current&&Object(n.isEqual)(l.current,p)||(l.current=p),l.current}},49:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return i}));var n=r(0),c=r(13);const s=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),o=()=>Object(n.useContext)(s),i=e=>{let{children:t,currentPostId:r=0,currentView:o="",previewData:i={}}=e;const a=Object(c.useSelect)(e=>r||e("core/editor").getCurrentPostId(),[r]),d=Object(n.useCallback)(e=>e in i?i[e]:{},[i]),u={isEditor:!0,currentPostId:a,currentView:o,previewData:i,getPreviewData:d};return Object(n.createElement)(s.Provider,{value:u},t)}},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(61),c=r(0),s=r(36);const o=()=>{const e=Object(s.a)(),t=Object(c.useRef)(e);return Object(c.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(c.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(c.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},99:function(e,t,r){"use strict";var n=r(2),c=r(1),s=r(64);const o=Object(n.getSetting)("countryLocale",{}),i=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(c.sprintf)(
2
  /* translators: %s Field label. */
3
  Object(c.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(s.a)(e.priority)&&(t.index=e.priority),Object(s.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},a=Object.entries(o).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,i(r)]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{});t.a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const c=r&&void 0!==a[r]?a[r]:{};return e.map(e=>({key:e,...n.defaultAddressFields[e]||{},...c[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{151:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>e.reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})},251:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return i}));const n=window.CustomEvent||null,c=(e,t)=>{let{bubbles:r=!1,cancelable:c=!1,element:s,detail:o={}}=t;if(!n)return;s||(s=document.body);const i=new n(e,{bubbles:r,cancelable:c,detail:o});s.dispatchEvent(i)};let s;const o=()=>{s&&clearTimeout(s),s=setTimeout(()=>{c("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},i=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const s=()=>{c(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,s),()=>jQuery(document).off(e,s)}},252:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return i})),r.d(t,"a",(function(){return a}));var n=r(2),c=r(99),s=r(15);const o=e=>{let{country:t="",state:r="",city:n="",postcode:c=""}=e;return{country:t.trim(),state:r.trim(),city:n.trim(),postcode:c?c.replace(" ","").toUpperCase():""}},i=e=>{let{email:t=""}=e;return Object(s.isEmail)(t)?t.trim():""},a=e=>{const t=Object.keys(n.defaultAddressFields),r=Object(c.a)(t,{},e.country),s=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(s[r]="")}),s}},36:function(e,t,r){"use strict";r.d(t,"a",(function(){return w}));var n=r(6),c=r(0),s=r(16),o=r(13),i=r(14),a=r(151),d=r(252),u=r(49),l=r(251);const p=e=>{const t=e.detail;t&&t.preserveCartData||Object(o.dispatch)(s.CART_STORE_KEY).invalidateResolutionForStore()},_=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},b=()=>{Object(c.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(l.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(l.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",p),document.body.addEventListener("wc-blocks_removed_from_cart",p),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",p),document.body.removeEventListener("wc-blocks_removed_from_cart",p)}}window.wcBlocksStoreCartListeners.count++})(),_),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},E={...m,email:""},h={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:s.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},g=e=>Object(a.a)(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(i.decodeEntities)(r)]})),f={cartCoupons:s.EMPTY_CART_COUPONS,cartItems:s.EMPTY_CART_ITEMS,cartFees:s.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:E,shippingAddress:m,shippingRates:s.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:s.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:s.EMPTY_EXTENSIONS},w=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(u.b)(),i=null==r?void 0:r.previewCart,{shouldSelect:a}=e,l=Object(c.useRef)();b();const p=Object(o.useSelect)((e,r)=>{let{dispatch:n}=r;if(!a)return f;if(t)return{cartCoupons:i.coupons,cartItems:i.items,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:i.totals,cartIsLoading:!1,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:E,shippingAddress:m,extensions:s.EMPTY_EXTENSIONS,shippingRates:i.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:i.has_calculated_shipping,paymentRequirements:i.paymentRequirements,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:()=>{}};const c=e(s.CART_STORE_KEY),o=c.getCartData(),u=c.getCartErrors(),l=c.getCartTotals(),p=!c.hasFinishedResolution("getCartData"),_=c.isCustomerDataUpdating(),{receiveCart:b}=n(s.CART_STORE_KEY),h=g(o.billingAddress),w=o.needsShipping?g(o.shippingAddress):h,C=o.fees.length>0?o.fees.map(e=>g(e)):s.EMPTY_CART_FEES;return{cartCoupons:o.coupons.length>0?o.coupons.map(e=>({...e,label:e.code})):s.EMPTY_CART_COUPONS,cartItems:o.items,cartFees:C,cartItemsCount:o.itemsCount,cartItemsWeight:o.itemsWeight,cartNeedsPayment:o.needsPayment,cartNeedsShipping:o.needsShipping,cartItemErrors:o.errors,cartTotals:l,cartIsLoading:p,cartErrors:u,billingAddress:Object(d.a)(h),shippingAddress:Object(d.a)(w),extensions:o.extensions,shippingRates:o.shippingRates,shippingRatesLoading:_,cartHasCalculatedShipping:o.hasCalculatedShipping,paymentRequirements:o.paymentRequirements,receiveCart:b}},[a]);return l.current&&Object(n.isEqual)(l.current,p)||(l.current=p),l.current}},49:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return i}));var n=r(0),c=r(13);const s=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),o=()=>Object(n.useContext)(s),i=e=>{let{children:t,currentPostId:r=0,currentView:o="",previewData:i={}}=e;const a=Object(c.useSelect)(e=>r||e("core/editor").getCurrentPostId(),[r]),d=Object(n.useCallback)(e=>e in i?i[e]:{},[i]),u={isEditor:!0,currentPostId:a,currentView:o,previewData:i,getPreviewData:d};return Object(n.createElement)(s.Provider,{value:u},t)}},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(61),c=r(0),s=r(36);const o=()=>{const e=Object(s.a)(),t=Object(c.useRef)(e);return Object(c.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(c.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(c.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},99:function(e,t,r){"use strict";var n=r(2),c=r(1),s=r(62);const o=Object(n.getSetting)("countryLocale",{}),i=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(c.sprintf)(
2
  /* translators: %s Field label. */
3
  Object(c.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(s.a)(e.priority)&&(t.index=e.priority),Object(s.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},a=Object.entries(o).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,i(r)]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{});t.a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const c=r&&void 0!==a[r]?a[r]:{};return e.map(e=>({key:e,...n.defaultAddressFields[e]||{},...c[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}}}]);
build/atomic-block-components/add-to-cart--atomic-block-components/button.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{130:function(e,t,c){"use strict";c.d(t,"b",(function(){return v})),c.d(t,"a",(function(){return N}));var o=c(0),n=(c(10),c(13)),s=c(60),r=c(49),i=c(5),a=c.n(i),u=c(4),l=c.n(u),d=c(487);c(159);const m=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""};var b=e=>{let{className:t,notices:c,removeNotice:n}=e;const s=c.filter(e=>"snackbar"!==e.type);if(!s.length)return null;const r=l()(t,"wc-block-components-notices");return Object(o.createElement)("div",{className:r},s.map(e=>Object(o.createElement)(d.a,a()({key:"store-notice-"+e.id},e,{className:l()("wc-block-components-notices__notice",m(e)),onRemove:()=>{e.isDismissible&&n(e.id)}}),e.content)))};const f=Object(o.createContext)({notices:[],createNotice:(e,t,c)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),v=()=>Object(o.useContext)(f),N=e=>{let{children:t,className:c="",createNoticeContainer:i=!0,context:a="wc/core"}=e;const{createNotice:u,removeNotice:l}=Object(n.useDispatch)("core/notices"),[d,m]=Object(o.useState)(!1),{dispatchStoreEvent:v}=Object(s.a)(),{isEditor:N}=Object(r.b)(),O=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(e,t,{...c,context:c.context||a}),v("store-notice-create",{status:e,content:t,options:c})}),[u,v,a]),j=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;l(e,t)}),[l,a]),{notices:p}=Object(n.useSelect)(e=>({notices:e("core/notices").getNotices(a)}),[a]),h={notices:p,createNotice:O,removeNotice:j,context:a,setIsSuppressed:m},g=d?null:Object(o.createElement)(b,{className:c,notices:h.notices,removeNotice:h.removeNotice,isEditor:N});return Object(o.createElement)(f.Provider,{value:h},i&&g,t)}},159:function(e,t){},359:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var o=c(0),n=c(13),s=c(16),r=c(14),i=c(36),a=c(47);const u=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},l=e=>{const{addItemToCart:t}=Object(n.useDispatch)(s.CART_STORE_KEY),{cartItems:c,cartIsLoading:l}=Object(i.a)(),{addErrorNotice:d,removeNotice:m}=Object(a.a)(),[b,f]=Object(o.useState)(!1),v=Object(o.useRef)(u(c,e));return Object(o.useEffect)(()=>{const t=u(c,e);t!==v.current&&(v.current=t)},[c,e]),{cartQuantity:Number.isFinite(v.current)?v.current:0,addingToCart:b,cartIsLoading:l,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return f(!0),t(e,c).then(()=>{m("add-to-cart")}).catch(e=>{d(Object(r.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})}).finally(()=>{f(!1)})}}}},47:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var o=c(0),n=c(130);const s=()=>{const{notices:e,createNotice:t,removeNotice:c,setIsSuppressed:s}=Object(n.b)(),r=Object(o.useRef)(e);Object(o.useEffect)(()=>{r.current=e},[e]);const i=Object(o.useMemo)(()=>({hasNoticesOfType:e=>r.current.some(t=>t.type===e),removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;r.current.forEach(t=>{null!==e&&t.status!==e||c(t.id)})},removeNotice:c}),[c]),a=Object(o.useMemo)(()=>({addDefaultNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("default",e,{...c})},addErrorNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("error",e,{...c})},addWarningNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("warning",e,{...c})},addInfoNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("info",e,{...c})},addSuccessNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("success",e,{...c})}}),[t]);return{notices:e,...i,...a,setIsSuppressed:s}}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{130:function(e,t,c){"use strict";c.d(t,"b",(function(){return v})),c.d(t,"a",(function(){return N}));var o=c(0),n=(c(10),c(13)),s=c(60),r=c(49),i=c(5),a=c.n(i),u=c(4),l=c.n(u),d=c(488);c(159);const m=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""};var b=e=>{let{className:t,notices:c,removeNotice:n}=e;const s=c.filter(e=>"snackbar"!==e.type);if(!s.length)return null;const r=l()(t,"wc-block-components-notices");return Object(o.createElement)("div",{className:r},s.map(e=>Object(o.createElement)(d.a,a()({key:"store-notice-"+e.id},e,{className:l()("wc-block-components-notices__notice",m(e)),onRemove:()=>{e.isDismissible&&n(e.id)}}),e.content)))};const f=Object(o.createContext)({notices:[],createNotice:(e,t,c)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),v=()=>Object(o.useContext)(f),N=e=>{let{children:t,className:c="",createNoticeContainer:i=!0,context:a="wc/core"}=e;const{createNotice:u,removeNotice:l}=Object(n.useDispatch)("core/notices"),[d,m]=Object(o.useState)(!1),{dispatchStoreEvent:v}=Object(s.a)(),{isEditor:N}=Object(r.b)(),O=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u(e,t,{...c,context:c.context||a}),v("store-notice-create",{status:e,content:t,options:c})}),[u,v,a]),j=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;l(e,t)}),[l,a]),{notices:p}=Object(n.useSelect)(e=>({notices:e("core/notices").getNotices(a)}),[a]),h={notices:p,createNotice:O,removeNotice:j,context:a,setIsSuppressed:m},g=d?null:Object(o.createElement)(b,{className:c,notices:h.notices,removeNotice:h.removeNotice,isEditor:N});return Object(o.createElement)(f.Provider,{value:h},i&&g,t)}},159:function(e,t){},360:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var o=c(0),n=c(13),s=c(16),r=c(14),i=c(36),a=c(47);const u=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},l=e=>{const{addItemToCart:t}=Object(n.useDispatch)(s.CART_STORE_KEY),{cartItems:c,cartIsLoading:l}=Object(i.a)(),{addErrorNotice:d,removeNotice:m}=Object(a.a)(),[b,f]=Object(o.useState)(!1),v=Object(o.useRef)(u(c,e));return Object(o.useEffect)(()=>{const t=u(c,e);t!==v.current&&(v.current=t)},[c,e]),{cartQuantity:Number.isFinite(v.current)?v.current:0,addingToCart:b,cartIsLoading:l,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return f(!0),t(e,c).then(()=>{m("add-to-cart")}).catch(e=>{d(Object(r.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})}).finally(()=>{f(!1)})}}}},47:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var o=c(0),n=c(130);const s=()=>{const{notices:e,createNotice:t,removeNotice:c,setIsSuppressed:s}=Object(n.b)(),r=Object(o.useRef)(e);Object(o.useEffect)(()=>{r.current=e},[e]);const i=Object(o.useMemo)(()=>({hasNoticesOfType:e=>r.current.some(t=>t.type===e),removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;r.current.forEach(t=>{null!==e&&t.status!==e||c(t.id)})},removeNotice:c}),[c]),a=Object(o.useMemo)(()=>({addDefaultNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("default",e,{...c})},addErrorNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("error",e,{...c})},addWarningNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("warning",e,{...c})},addInfoNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("info",e,{...c})},addSuccessNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("success",e,{...c})}}),[t]);return{notices:e,...i,...a,setIsSuppressed:s}}}}]);
build/atomic-block-components/add-to-cart.js CHANGED
@@ -1,3 +1,3 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[9],{100:function(e,t,r){"use strict";var s=r(0);r(161),t.a=()=>Object(s.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},108:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return o}));var s=r(6);let a;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(a||(a={}));const n={addEventCallback:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(s.uniqueId)(),type:a.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:(e,t)=>({id:t,type:a.REMOVE_EVENT_CALLBACK,eventType:e})},c={},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,{type:t,eventType:r,id:s,callback:n,priority:o}=arguments.length>1?arguments[1]:void 0;const i=e.hasOwnProperty(r)?new Map(e[r]):new Map;switch(t){case a.ADD_EVENT_CALLBACK:return i.set(s,{priority:o,callback:n}),{...e,[r]:i};case a.REMOVE_EVENT_CALLBACK:return i.delete(s),{...e,[r]:i}}}},114:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return l}));var s=r(0),a=r(6),n=r(26),c=r.n(n);const o=Object(s.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),i=()=>Object(s.useContext)(o),l=e=>{let{children:t}=e;const[r,n]=Object(s.useState)({}),i=Object(s.useCallback)(e=>r[e],[r]),l=Object(s.useCallback)(e=>{const t=r[e];return!t||t.hidden?"":"validate-error-"+e},[r]),u=Object(s.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:r,...s}=t;return s})},[]),d=Object(s.useCallback)(()=>{n({})},[]),b=Object(s.useCallback)(e=>{e&&n(t=>(e=Object(a.pickBy)(e,(e,r)=>!("string"!=typeof e.message||t.hasOwnProperty(r)&&c()(t[r],e))),0===Object.values(e).length?t:{...t,...e}))},[]),E=Object(s.useCallback)((e,t)=>{n(r=>{if(!r.hasOwnProperty(e))return r;const s={...r[e],...t};return c()(r[e],s)?r:{...r,[e]:s}})},[]),p={getValidationError:i,setValidationErrors:b,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(s.useCallback)(e=>{E(e,{hidden:!0})},[E]),showValidationError:Object(s.useCallback)(e=>{E(e,{hidden:!1})},[E]),showAllValidationErrors:Object(s.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(r=>{e[r].hidden&&(t[r]={...e[r],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(r).length>0,getValidationErrorId:l};return Object(s.createElement)(o.Provider,{value:p},t)}},160:function(e,t){},161:function(e,t){},162:function(e,t){},196:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var s=r(0),a=(r(10),r(114));r(162);const n=e=>{let{errorMessage:t="",propertyName:r="",elementId:n=""}=e;const{getValidationError:c,getValidationErrorId:o}=Object(a.b)();if(!t||"string"!=typeof t){const e=c(r)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(s.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(s.createElement)("p",{id:o(n)},t))}},247:function(e,t){},254:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var s=r(108);const a=(e,t)=>function(r){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=s.a.addEventCallback(e,r,a);return t(n),()=>{t(s.a.removeEventCallback(e,n.id))}}},255:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},256:function(e,t,r){"use strict";var s=r(0),a=(r(10),r(4)),n=r.n(a),c=r(1),o=r(39),i=r(477);const l={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},u={status:l.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},d={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:b,SET_IDLE:E,SET_DISABLED:p,SET_PROCESSING:m,SET_BEFORE_PROCESSING:O,SET_AFTER_PROCESSING:_,SET_PROCESSING_RESPONSE:h,SET_HAS_ERROR:j,SET_NO_ERROR:f,SET_QUANTITY:S,SET_REQUEST_PARAMS:g}=d,v=()=>({type:E}),y=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?j:f;return{type:t}},{SET_PRISTINE:R,SET_IDLE:P,SET_DISABLED:C,SET_PROCESSING:A,SET_BEFORE_PROCESSING:k,SET_AFTER_PROCESSING:T,SET_PROCESSING_RESPONSE:w,SET_HAS_ERROR:N,SET_NO_ERROR:I,SET_QUANTITY:D,SET_REQUEST_PARAMS:F}=d,{PRISTINE:V,IDLE:B,DISABLED:L,PROCESSING:q,BEFORE_PROCESSING:x,AFTER_PROCESSING:G}=l,M=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,{quantity:r,type:s,data:a}=arguments.length>1?arguments[1]:void 0;switch(s){case R:e=u;break;case P:e=t.status!==B?{...t,status:B}:t;break;case C:e=t.status!==L?{...t,status:L}:t;break;case D:e=r!==t.quantity?{...t,quantity:r}:t;break;case F:e={...t,requestParams:{...t.requestParams,...a}};break;case w:e={...t,processingResponse:a};break;case A:e=t.status!==q?{...t,status:q,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case k:e=t.status!==x?{...t,status:x,hasError:!1}:t;break;case T:e=t.status!==G?{...t,status:G}:t;break;case N:e=t.hasError?t:{...t,hasError:!0},e=t.status===q||t.status===x?{...e,status:B}:e;break;case I:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&s!==R&&e.status===V&&(e.status=B),e};var Q=r(108),H=r(254);const W=e=>({onAddToCartAfterProcessingWithSuccess:Object(H.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(H.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(H.a)("add_to_cart_before_processing",e)});var U=r(257),K=r(114),Y=r(47),z=r(44);const J=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=>{}}}),X=()=>Object(s.useContext)(J),Z=e=>{var t,r,a,n;let{children:d,product:E,showFormElements:j}=e;const[f,R]=Object(s.useReducer)(M,u),[P,C]=Object(s.useReducer)(Q.b,{}),A=Object(o.a)(P),{addErrorNotice:k,removeNotices:T}=Object(Y.a)(),{setValidationErrors:w}=Object(K.b)(),{isSuccessResponse:N,isErrorResponse:I,isFailResponse:D}=Object(z.c)(),F=Object(s.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:W(C).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:W(C).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:W(C).onAddToCartBeforeProcessing}),[C]),V=Object(s.useMemo)(()=>({resetForm:()=>{R({type:b})},submitForm:()=>{R({type:O})},setQuantity:e=>{R((e=>({type:S,quantity:e}))(e))},setHasError:e=>{R(y(e))},setRequestParams:e=>{R((e=>({type:g,data:e}))(e))},setAfterProcessing:e=>{R({type:h,data:e}),R({type:_})}}),[]);Object(s.useEffect)(()=>{const e=f.status,t=!E.id||!Object(i.a)(E);e!==l.DISABLED||t?e!==l.DISABLED&&t&&R({type:p}):R(v())},[f.status,E,R]),Object(s.useEffect)(()=>{f.status===l.BEFORE_PROCESSING&&(T("error"),Object(U.a)(A,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;t&&k(t),r&&w(r)}),R(v())):R({type:m})}))},[f.status,w,k,T,R,A]),Object(s.useEffect)(()=>{if(f.status===l.AFTER_PROCESSING){const e={processingResponse:f.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:r,messageContext:s}=e;(I(e)||D(e))&&r&&(t=!0,k(r,s?{context:s}:void 0))}),t};if(f.hasError)return void Object(U.b)(A,"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(c.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");k(t,{id:"add-to-cart"})}R(v())});Object(U.b)(A,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?R(y(!0)):R(v())})}},[f.status,f.hasError,f.processingResponse,V,k,I,D,N,A]);const B=Object(i.b)(E),L={product:E,productType:E.type||"simple",productIsPurchasable:Object(i.a)(E),productHasOptions:E.has_options||!1,supportsFormElements:B,showFormElements:j&&B,quantity:f.quantity||(null==E||null===(t=E.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==E||null===(r=E.add_to_cart)||void 0===r?void 0:r.minimum)||1,maxQuantity:(null==E||null===(a=E.add_to_cart)||void 0===a?void 0:a.maximum)||99,multipleOf:(null==E||null===(n=E.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:f.requestParams,isIdle:f.status===l.IDLE,isDisabled:f.status===l.DISABLED,isProcessing:f.status===l.PROCESSING,isBeforeProcessing:f.status===l.BEFORE_PROCESSING,isAfterProcessing:f.status===l.AFTER_PROCESSING,hasError:f.hasError,eventRegistration:F,dispatchActions:V};return Object(s.createElement)(J.Provider,{value:L},d)};var $=r(11),ee=r.n($),te=r(14),re=r(36),se=()=>{const{dispatchActions:e,product:t,quantity:r,eventRegistration:a,hasError:n,isProcessing:o,requestParams:i}=X(),{hasValidationErrors:l,showAllValidationErrors:u}=Object(K.b)(),{addErrorNotice:d,removeNotice:b}=Object(Y.a)(),{receiveCart:E}=Object(re.a)(),[p,m]=Object(s.useState)(!1),O=!n&&o,_=Object(s.useCallback)(()=>!l||(u(),{type:"error"}),[l,u]);Object(s.useEffect)(()=>{const e=a.onAddToCartBeforeProcessing(_,0);return()=>{e()}},[a,_]);const h=Object(s.useCallback)(()=>{m(!0),b("add-to-cart");const s={id:t.id||0,quantity:r,...i};ee()({path:"/wc/store/cart/add-item",method:"POST",data:s,cache:"no-store",parse:!1}).then(t=>{ee.a.setNonce(t.headers),t.json().then((function(r){t.ok?E(r):(r.body&&r.body.message?d(Object(te.decodeEntities)(r.body.message),{id:"add-to-cart"}):d(Object(c.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),e.setHasError()),e.setAfterProcessing(r),m(!1)}))}).catch(t=>{t.json().then((function(t){var r;null!==(r=t.data)&&void 0!==r&&r.cart&&E(t.data.cart),e.setHasError(),e.setAfterProcessing(t),m(!1)}))})},[t,d,b,E,e,r,i]);return Object(s.useEffect)(()=>{O&&!p&&h()},[O,h,p]),null};const ae=e=>{let{children:t,product:r,showFormElements:a}=e;return Object(s.createElement)(K.a,null,Object(s.createElement)(Z,{product:r,showFormElements:a},t,Object(s.createElement)(se,null)))};var ne=r(29),ce=r(6),oe=r(54),ie=(r(247),r(80)),le=r(43),ue=r(311),de=r(60),be=r(359);const Ee=e=>{let{className:t,href:r,text:a,onClick:n}=e;return Object(s.createElement)(ie.a,{className:t,href:r,onClick:n,rel:"nofollow"},a)},pe=e=>{let{className:t,quantityInCart:r,isProcessing:a,isDisabled:n,isDone:o,onClick:i}=e;return Object(s.createElement)(ie.a,{className:t,disabled:n,showSpinner:a,onClick:i},o&&r>0?Object(c.sprintf)(
2
  /* translators: %s number of products in cart. */
3
- Object(c._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(c.__)("Add to cart","woo-gutenberg-products-block"),!!o&&Object(s.createElement)(le.a,{srcElement:ue.a,alt:Object(c.__)("Done","woo-gutenberg-products-block")}))};var me=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:r,product:a,productType:n,isDisabled:o,isProcessing:i,eventRegistration:l,hasError:u,dispatchActions:d}=X(),{parentName:b}=Object(ne.useInnerBlockLayoutContext)(),{dispatchStoreEvent:E}=Object(de.a)(),{cartQuantity:p}=Object(be.a)(a.id||0),[m,O]=Object(s.useState)(!1),_=a.add_to_cart||{url:"",text:""};return Object(s.useEffect)(()=>{const e=l.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[l,u]),(e||!r&&"simple"===n)&&t?Object(s.createElement)(pe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:p,isDisabled:o,isProcessing:i,isDone:m,onClick:()=>{d.submitForm(),E("cart-add-item",{product:a,listName:b})}}):Object(s.createElement)(Ee,{className:"wc-block-components-product-add-to-cart-button",href:_.url,text:_.text||Object(c.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{E("product-view-link",{product:a,listName:b})}})},Oe=r(118),_e=e=>{let{disabled:t,min:r,max:a,step:n=1,value:c,onChange:o}=e;const i=void 0!==a,l=Object(Oe.a)(e=>{let t=e;i&&(t=Math.min(t,Math.floor(a/n)*n)),t=Math.max(t,Math.ceil(r/n)*n),t=Math.floor(t/n)*n,t!==e&&o(t)},300);return Object(s.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:c,min:r,max:a,step:n,hidden:1===a,disabled:t,onChange:e=>{o(e.target.value),l(e.target.value)}})},he=e=>{let{reason:t=Object(c.__)("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)},je=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:a,multipleOf:n,dispatchActions:o,isDisabled:i}=X();return e.id&&!e.is_purchasable?Object(s.createElement)(he,null):e.id&&!e.is_in_stock?Object(s.createElement)(he,{reason:Object(c.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(_e,{value:t,min:r,max:a,step:n,disabled:i,onChange:o.setQuantity}),Object(s.createElement)(me,null))},fe=(r(310),r(498)),Se=r(8),ge=r(196);const ve={value:"",label:Object(c.__)("Select an option","woo-gutenberg-products-block")};var ye=e=>{let{attributeName:t,options:r=[],value:a="",onChange:o=(()=>{}),errorMessage:i=Object(c.__)("Please select a value.","woo-gutenberg-products-block")}=e;const{getValidationError:l,setValidationErrors:u,clearValidationError:d}=Object(K.b)(),b=t,E=l(b)||{};return Object(Se.useEffect)(()=>{a?d(b):u({[b]:{message:i,hidden:!0}})},[a,b,i,d,u]),Object(Se.useEffect)(()=>()=>{d(b)},[b,d]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(s.createElement)(fe.a,{label:Object(te.decodeEntities)(t),value:a||"",options:[ve,...r],onChange:o,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":E.message&&!E.hidden})}),Object(s.createElement)(ge.a,{propertyName:b,elementId:b}))},Re=r(64);const Pe=(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 a=Object.keys(e);return s.filter(e=>a.every(s=>{const a=r[s]||"",n=t["id:"+e].attributes[s];return""===a||null===n||n===a}))};var Ce=e=>{let{attributes:t,variationAttributes:r,setRequestParams:a}=e;const n=Object(o.a)(t),c=Object(o.a)(r),[i,l]=Object(s.useState)(0),[u,d]=Object(s.useState)({}),[b,E]=Object(s.useState)(!1),p=Object(s.useMemo)(()=>((e,t,r)=>{const s={},a=Object.keys(e),n=Object.values(r).filter(Boolean).length>0;return a.forEach(a=>{const c=e[a],o={...r,[a]:null},i=n?Pe(e,t,o):null,l=null!==i?i.map(e=>t["id:"+e].attributes[a]):null;s[a]=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(te.decodeEntities)(r)}:null}).filter(Boolean)}(c.terms,l)}),s})(n,c,u),[u,n,c]);return Object(s.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Re.b)(e))return{};const t=Object.keys(e),r={};return 0===t.length||t.forEach(t=>{const s=e[t],a=s.terms.filter(e=>e.default);var n;a.length>0&&(r[s.name]=null===(n=a[0])||void 0===n?void 0:n.slug)}),r}(t);e&&d({...e}),E(!0)}},[u,t,b]),Object(s.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?l(((e,t,r)=>Pe(e,t,r)[0]||0)(n,c,u)):i>0&&l(0)},[u,i,n,c]),Object(s.useEffect)(()=>{a({id:i,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[a,i,u]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(s.createElement)(ye,{key:e,attributeName:e,options:p[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Ae=e=>{let{product:t,dispatchers:r}=e;const a=(e=>e?Object(ce.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: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(a).length||0===n.length?null:Object(s.createElement)(Ce,{attributes:a,variationAttributes:n,setRequestParams:r.setRequestParams})},ke=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:a,multipleOf:n,dispatchActions:o,isDisabled:i}=X();return e.id&&!e.is_purchasable?Object(s.createElement)(he,null):e.id&&!e.is_in_stock?Object(s.createElement)(he,{reason:Object(c.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(Ae,{product:e,dispatchers:o}),Object(s.createElement)(_e,{value:t,min:r,max:a,step:n,disabled:i,onChange:o.setQuantity}),Object(s.createElement)(me,null))},Te=()=>Object(s.createElement)(me,null),we=r(489),Ne=()=>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."),Ie=()=>Object(s.createElement)(Ne,null);const De=()=>{const{showFormElements:e,productType:t}=X();return e?"variable"===t?Object(s.createElement)(ke,null):"grouped"===t?Object(s.createElement)(Ie,null):"external"===t?Object(s.createElement)(Te,null):"simple"===t||"variation"===t?Object(s.createElement)(je,null):null:Object(s.createElement)(me,null)};t.a=Object(oe.withProductDataContext)(e=>{let{className:t,showFormElements:r}=e;const{product:a}=Object(ne.useProductDataContext)(),c=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(ce.isEmpty)(a)});return Object(s.createElement)(ae,{product:a,showFormElements:r},Object(s.createElement)("div",{className:c},Object(s.createElement)(De,null)))})},257:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const s=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var a=r(44);const n=async(e,t,r)=>{const a=s(e,t),n=[];for(const e of a)try{const t=await Promise.resolve(e.callback(r));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},c=async(e,t,r)=>{const n=[],c=s(e,t);for(const e of c)try{const t=await Promise.resolve(e.callback(r));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(a.a)(t)||Object(a.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},310:function(e,t){},311:function(e,t,r){"use strict";var s=r(0),a=r(18);const n=Object(s.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(s.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(s.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=n},39:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var s=r(0),a=r(26),n=r.n(a);function c(e){const t=Object(s.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},44:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var s=r(64);let a,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(a||(a={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const c=(e,t)=>Object(s.b)(e)&&"type"in e&&e.type===t,o=e=>c(e,a.SUCCESS),i=e=>c(e,a.ERROR),l=e=>c(e,a.FAIL),u=e=>!Object(s.b)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:a,noticeContexts:n,shouldRetry:u,isSuccessResponse:o,isErrorResponse:i,isFailResponse:l})},477:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return a}));const s=e=>e.is_purchasable||!1,a=e=>["simple","variable"].includes(e.type||"simple")},503:function(e,t,r){"use strict";r.r(t);var s=r(54),a=r(256),n=r(255);t.default=Object(s.withFilteredAttributes)(n.a)(a.a)},80:function(e,t,r){"use strict";var s=r(5),a=r.n(s),n=r(0),c=r(139),o=r(4),i=r.n(o),l=r(100);r(160),t.a=e=>{let{className:t,showSpinner:r=!1,children:s,...o}=e;const u=i()("wc-block-components-button",t,{"wc-block-components-button--loading":r});return Object(n.createElement)(c.a,a()({className:u},o),r&&Object(n.createElement)(l.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},s))}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[9],{100:function(e,t,r){"use strict";var s=r(0);r(161),t.a=()=>Object(s.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},108:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return o}));var s=r(6);let a;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(a||(a={}));const n={addEventCallback:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(s.uniqueId)(),type:a.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:(e,t)=>({id:t,type:a.REMOVE_EVENT_CALLBACK,eventType:e})},c={},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,{type:t,eventType:r,id:s,callback:n,priority:o}=arguments.length>1?arguments[1]:void 0;const i=e.hasOwnProperty(r)?new Map(e[r]):new Map;switch(t){case a.ADD_EVENT_CALLBACK:return i.set(s,{priority:o,callback:n}),{...e,[r]:i};case a.REMOVE_EVENT_CALLBACK:return i.delete(s),{...e,[r]:i}}}},114:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return l}));var s=r(0),a=r(6),n=r(26),c=r.n(n);const o=Object(s.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),i=()=>Object(s.useContext)(o),l=e=>{let{children:t}=e;const[r,n]=Object(s.useState)({}),i=Object(s.useCallback)(e=>r[e],[r]),l=Object(s.useCallback)(e=>{const t=r[e];return!t||t.hidden?"":"validate-error-"+e},[r]),u=Object(s.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:r,...s}=t;return s})},[]),d=Object(s.useCallback)(()=>{n({})},[]),b=Object(s.useCallback)(e=>{e&&n(t=>(e=Object(a.pickBy)(e,(e,r)=>!("string"!=typeof e.message||t.hasOwnProperty(r)&&c()(t[r],e))),0===Object.values(e).length?t:{...t,...e}))},[]),E=Object(s.useCallback)((e,t)=>{n(r=>{if(!r.hasOwnProperty(e))return r;const s={...r[e],...t};return c()(r[e],s)?r:{...r,[e]:s}})},[]),p={getValidationError:i,setValidationErrors:b,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(s.useCallback)(e=>{E(e,{hidden:!0})},[E]),showValidationError:Object(s.useCallback)(e=>{E(e,{hidden:!1})},[E]),showAllValidationErrors:Object(s.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(r=>{e[r].hidden&&(t[r]={...e[r],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(r).length>0,getValidationErrorId:l};return Object(s.createElement)(o.Provider,{value:p},t)}},160:function(e,t){},161:function(e,t){},162:function(e,t){},196:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var s=r(0),a=(r(10),r(114));r(162);const n=e=>{let{errorMessage:t="",propertyName:r="",elementId:n=""}=e;const{getValidationError:c,getValidationErrorId:o}=Object(a.b)();if(!t||"string"!=typeof t){const e=c(r)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(s.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(s.createElement)("p",{id:o(n)},t))}},248:function(e,t){},255:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var s=r(108);const a=(e,t)=>function(r){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=s.a.addEventCallback(e,r,a);return t(n),()=>{t(s.a.removeEventCallback(e,n.id))}}},256:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},257:function(e,t,r){"use strict";var s=r(0),a=(r(10),r(4)),n=r.n(a),c=r(1),o=r(39),i=r(478);const l={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},u={status:l.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},d={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:b,SET_IDLE:E,SET_DISABLED:p,SET_PROCESSING:m,SET_BEFORE_PROCESSING:O,SET_AFTER_PROCESSING:_,SET_PROCESSING_RESPONSE:h,SET_HAS_ERROR:j,SET_NO_ERROR:f,SET_QUANTITY:S,SET_REQUEST_PARAMS:g}=d,v=()=>({type:E}),y=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?j:f;return{type:t}},{SET_PRISTINE:R,SET_IDLE:P,SET_DISABLED:C,SET_PROCESSING:A,SET_BEFORE_PROCESSING:k,SET_AFTER_PROCESSING:T,SET_PROCESSING_RESPONSE:w,SET_HAS_ERROR:N,SET_NO_ERROR:I,SET_QUANTITY:D,SET_REQUEST_PARAMS:F}=d,{PRISTINE:V,IDLE:B,DISABLED:L,PROCESSING:q,BEFORE_PROCESSING:x,AFTER_PROCESSING:G}=l,M=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,{quantity:r,type:s,data:a}=arguments.length>1?arguments[1]:void 0;switch(s){case R:e=u;break;case P:e=t.status!==B?{...t,status:B}:t;break;case C:e=t.status!==L?{...t,status:L}:t;break;case D:e=r!==t.quantity?{...t,quantity:r}:t;break;case F:e={...t,requestParams:{...t.requestParams,...a}};break;case w:e={...t,processingResponse:a};break;case A:e=t.status!==q?{...t,status:q,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case k:e=t.status!==x?{...t,status:x,hasError:!1}:t;break;case T:e=t.status!==G?{...t,status:G}:t;break;case N:e=t.hasError?t:{...t,hasError:!0},e=t.status===q||t.status===x?{...e,status:B}:e;break;case I:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&s!==R&&e.status===V&&(e.status=B),e};var Q=r(108),H=r(255);const W=e=>({onAddToCartAfterProcessingWithSuccess:Object(H.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(H.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(H.a)("add_to_cart_before_processing",e)});var U=r(258),K=r(114),Y=r(47),z=r(44);const J=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=>{}}}),X=()=>Object(s.useContext)(J),Z=e=>{var t,r,a,n;let{children:d,product:E,showFormElements:j}=e;const[f,R]=Object(s.useReducer)(M,u),[P,C]=Object(s.useReducer)(Q.b,{}),A=Object(o.a)(P),{addErrorNotice:k,removeNotices:T}=Object(Y.a)(),{setValidationErrors:w}=Object(K.b)(),{isSuccessResponse:N,isErrorResponse:I,isFailResponse:D}=Object(z.c)(),F=Object(s.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:W(C).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:W(C).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:W(C).onAddToCartBeforeProcessing}),[C]),V=Object(s.useMemo)(()=>({resetForm:()=>{R({type:b})},submitForm:()=>{R({type:O})},setQuantity:e=>{R((e=>({type:S,quantity:e}))(e))},setHasError:e=>{R(y(e))},setRequestParams:e=>{R((e=>({type:g,data:e}))(e))},setAfterProcessing:e=>{R({type:h,data:e}),R({type:_})}}),[]);Object(s.useEffect)(()=>{const e=f.status,t=!E.id||!Object(i.a)(E);e!==l.DISABLED||t?e!==l.DISABLED&&t&&R({type:p}):R(v())},[f.status,E,R]),Object(s.useEffect)(()=>{f.status===l.BEFORE_PROCESSING&&(T("error"),Object(U.a)(A,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;t&&k(t),r&&w(r)}),R(v())):R({type:m})}))},[f.status,w,k,T,R,A]),Object(s.useEffect)(()=>{if(f.status===l.AFTER_PROCESSING){const e={processingResponse:f.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:r,messageContext:s}=e;(I(e)||D(e))&&r&&(t=!0,k(r,s?{context:s}:void 0))}),t};if(f.hasError)return void Object(U.b)(A,"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(c.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");k(t,{id:"add-to-cart"})}R(v())});Object(U.b)(A,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?R(y(!0)):R(v())})}},[f.status,f.hasError,f.processingResponse,V,k,I,D,N,A]);const B=Object(i.b)(E),L={product:E,productType:E.type||"simple",productIsPurchasable:Object(i.a)(E),productHasOptions:E.has_options||!1,supportsFormElements:B,showFormElements:j&&B,quantity:f.quantity||(null==E||null===(t=E.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==E||null===(r=E.add_to_cart)||void 0===r?void 0:r.minimum)||1,maxQuantity:(null==E||null===(a=E.add_to_cart)||void 0===a?void 0:a.maximum)||99,multipleOf:(null==E||null===(n=E.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:f.requestParams,isIdle:f.status===l.IDLE,isDisabled:f.status===l.DISABLED,isProcessing:f.status===l.PROCESSING,isBeforeProcessing:f.status===l.BEFORE_PROCESSING,isAfterProcessing:f.status===l.AFTER_PROCESSING,hasError:f.hasError,eventRegistration:F,dispatchActions:V};return Object(s.createElement)(J.Provider,{value:L},d)};var $=r(11),ee=r.n($),te=r(14),re=r(36),se=()=>{const{dispatchActions:e,product:t,quantity:r,eventRegistration:a,hasError:n,isProcessing:o,requestParams:i}=X(),{hasValidationErrors:l,showAllValidationErrors:u}=Object(K.b)(),{addErrorNotice:d,removeNotice:b}=Object(Y.a)(),{receiveCart:E}=Object(re.a)(),[p,m]=Object(s.useState)(!1),O=!n&&o,_=Object(s.useCallback)(()=>!l||(u(),{type:"error"}),[l,u]);Object(s.useEffect)(()=>{const e=a.onAddToCartBeforeProcessing(_,0);return()=>{e()}},[a,_]);const h=Object(s.useCallback)(()=>{m(!0),b("add-to-cart");const s={id:t.id||0,quantity:r,...i};ee()({path:"/wc/store/cart/add-item",method:"POST",data:s,cache:"no-store",parse:!1}).then(t=>{ee.a.setNonce(t.headers),t.json().then((function(r){t.ok?E(r):(r.body&&r.body.message?d(Object(te.decodeEntities)(r.body.message),{id:"add-to-cart"}):d(Object(c.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),e.setHasError()),e.setAfterProcessing(r),m(!1)}))}).catch(t=>{t.json().then((function(t){var r;null!==(r=t.data)&&void 0!==r&&r.cart&&E(t.data.cart),e.setHasError(),e.setAfterProcessing(t),m(!1)}))})},[t,d,b,E,e,r,i]);return Object(s.useEffect)(()=>{O&&!p&&h()},[O,h,p]),null};const ae=e=>{let{children:t,product:r,showFormElements:a}=e;return Object(s.createElement)(K.a,null,Object(s.createElement)(Z,{product:r,showFormElements:a},t,Object(s.createElement)(se,null)))};var ne=r(29),ce=r(6),oe=r(54),ie=(r(248),r(80)),le=r(43),ue=r(312),de=r(60),be=r(360);const Ee=e=>{let{className:t,href:r,text:a,onClick:n}=e;return Object(s.createElement)(ie.a,{className:t,href:r,onClick:n,rel:"nofollow"},a)},pe=e=>{let{className:t,quantityInCart:r,isProcessing:a,isDisabled:n,isDone:o,onClick:i}=e;return Object(s.createElement)(ie.a,{className:t,disabled:n,showSpinner:a,onClick:i},o&&r>0?Object(c.sprintf)(
2
  /* translators: %s number of products in cart. */
3
+ Object(c._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(c.__)("Add to cart","woo-gutenberg-products-block"),!!o&&Object(s.createElement)(le.a,{srcElement:ue.a,alt:Object(c.__)("Done","woo-gutenberg-products-block")}))};var me=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:r,product:a,productType:n,isDisabled:o,isProcessing:i,eventRegistration:l,hasError:u,dispatchActions:d}=X(),{parentName:b}=Object(ne.useInnerBlockLayoutContext)(),{dispatchStoreEvent:E}=Object(de.a)(),{cartQuantity:p}=Object(be.a)(a.id||0),[m,O]=Object(s.useState)(!1),_=a.add_to_cart||{url:"",text:""};return Object(s.useEffect)(()=>{const e=l.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[l,u]),(e||!r&&"simple"===n)&&t?Object(s.createElement)(pe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:p,isDisabled:o,isProcessing:i,isDone:m,onClick:()=>{d.submitForm(),E("cart-add-item",{product:a,listName:b})}}):Object(s.createElement)(Ee,{className:"wc-block-components-product-add-to-cart-button",href:_.url,text:_.text||Object(c.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{E("product-view-link",{product:a,listName:b})}})},Oe=r(118),_e=e=>{let{disabled:t,min:r,max:a,step:n=1,value:c,onChange:o}=e;const i=void 0!==a,l=Object(Oe.a)(e=>{let t=e;i&&(t=Math.min(t,Math.floor(a/n)*n)),t=Math.max(t,Math.ceil(r/n)*n),t=Math.floor(t/n)*n,t!==e&&o(t)},300);return Object(s.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:c,min:r,max:a,step:n,hidden:1===a,disabled:t,onChange:e=>{o(e.target.value),l(e.target.value)}})},he=e=>{let{reason:t=Object(c.__)("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)},je=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:a,multipleOf:n,dispatchActions:o,isDisabled:i}=X();return e.id&&!e.is_purchasable?Object(s.createElement)(he,null):e.id&&!e.is_in_stock?Object(s.createElement)(he,{reason:Object(c.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(_e,{value:t,min:r,max:a,step:n,disabled:i,onChange:o.setQuantity}),Object(s.createElement)(me,null))},fe=(r(311),r(499)),Se=r(8),ge=r(196);const ve={value:"",label:Object(c.__)("Select an option","woo-gutenberg-products-block")};var ye=e=>{let{attributeName:t,options:r=[],value:a="",onChange:o=(()=>{}),errorMessage:i=Object(c.__)("Please select a value.","woo-gutenberg-products-block")}=e;const{getValidationError:l,setValidationErrors:u,clearValidationError:d}=Object(K.b)(),b=t,E=l(b)||{};return Object(Se.useEffect)(()=>{a?d(b):u({[b]:{message:i,hidden:!0}})},[a,b,i,d,u]),Object(Se.useEffect)(()=>()=>{d(b)},[b,d]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(s.createElement)(fe.a,{label:Object(te.decodeEntities)(t),value:a||"",options:[ve,...r],onChange:o,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":E.message&&!E.hidden})}),Object(s.createElement)(ge.a,{propertyName:b,elementId:b}))},Re=r(62);const Pe=(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 a=Object.keys(e);return s.filter(e=>a.every(s=>{const a=r[s]||"",n=t["id:"+e].attributes[s];return""===a||null===n||n===a}))};var Ce=e=>{let{attributes:t,variationAttributes:r,setRequestParams:a}=e;const n=Object(o.a)(t),c=Object(o.a)(r),[i,l]=Object(s.useState)(0),[u,d]=Object(s.useState)({}),[b,E]=Object(s.useState)(!1),p=Object(s.useMemo)(()=>((e,t,r)=>{const s={},a=Object.keys(e),n=Object.values(r).filter(Boolean).length>0;return a.forEach(a=>{const c=e[a],o={...r,[a]:null},i=n?Pe(e,t,o):null,l=null!==i?i.map(e=>t["id:"+e].attributes[a]):null;s[a]=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(te.decodeEntities)(r)}:null}).filter(Boolean)}(c.terms,l)}),s})(n,c,u),[u,n,c]);return Object(s.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Re.b)(e))return{};const t=Object.keys(e),r={};return 0===t.length||t.forEach(t=>{const s=e[t],a=s.terms.filter(e=>e.default);var n;a.length>0&&(r[s.name]=null===(n=a[0])||void 0===n?void 0:n.slug)}),r}(t);e&&d({...e}),E(!0)}},[u,t,b]),Object(s.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?l(((e,t,r)=>Pe(e,t,r)[0]||0)(n,c,u)):i>0&&l(0)},[u,i,n,c]),Object(s.useEffect)(()=>{a({id:i,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[a,i,u]),Object(s.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(s.createElement)(ye,{key:e,attributeName:e,options:p[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Ae=e=>{let{product:t,dispatchers:r}=e;const a=(e=>e?Object(ce.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: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(a).length||0===n.length?null:Object(s.createElement)(Ce,{attributes:a,variationAttributes:n,setRequestParams:r.setRequestParams})},ke=()=>{const{product:e,quantity:t,minQuantity:r,maxQuantity:a,multipleOf:n,dispatchActions:o,isDisabled:i}=X();return e.id&&!e.is_purchasable?Object(s.createElement)(he,null):e.id&&!e.is_in_stock?Object(s.createElement)(he,{reason:Object(c.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(s.createElement)(s.Fragment,null,Object(s.createElement)(Ae,{product:e,dispatchers:o}),Object(s.createElement)(_e,{value:t,min:r,max:a,step:n,disabled:i,onChange:o.setQuantity}),Object(s.createElement)(me,null))},Te=()=>Object(s.createElement)(me,null),we=r(490),Ne=()=>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."),Ie=()=>Object(s.createElement)(Ne,null);const De=()=>{const{showFormElements:e,productType:t}=X();return e?"variable"===t?Object(s.createElement)(ke,null):"grouped"===t?Object(s.createElement)(Ie,null):"external"===t?Object(s.createElement)(Te,null):"simple"===t||"variation"===t?Object(s.createElement)(je,null):null:Object(s.createElement)(me,null)};t.a=Object(oe.withProductDataContext)(e=>{let{className:t,showFormElements:r}=e;const{product:a}=Object(ne.useProductDataContext)(),c=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(ce.isEmpty)(a)});return Object(s.createElement)(ae,{product:a,showFormElements:r},Object(s.createElement)("div",{className:c},Object(s.createElement)(De,null)))})},258:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const s=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var a=r(44);const n=async(e,t,r)=>{const a=s(e,t),n=[];for(const e of a)try{const t=await Promise.resolve(e.callback(r));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},c=async(e,t,r)=>{const n=[],c=s(e,t);for(const e of c)try{const t=await Promise.resolve(e.callback(r));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(a.a)(t)||Object(a.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},311:function(e,t){},312:function(e,t,r){"use strict";var s=r(0),a=r(18);const n=Object(s.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(s.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(s.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=n},39:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var s=r(0),a=r(26),n=r.n(a);function c(e){const t=Object(s.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},44:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var s=r(62);let a,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(a||(a={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const c=(e,t)=>Object(s.b)(e)&&"type"in e&&e.type===t,o=e=>c(e,a.SUCCESS),i=e=>c(e,a.ERROR),l=e=>c(e,a.FAIL),u=e=>!Object(s.b)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:a,noticeContexts:n,shouldRetry:u,isSuccessResponse:o,isErrorResponse:i,isFailResponse:l})},478:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return a}));const s=e=>e.is_purchasable||!1,a=e=>["simple","variable"].includes(e.type||"simple")},504:function(e,t,r){"use strict";r.r(t);var s=r(54),a=r(257),n=r(256);t.default=Object(s.withFilteredAttributes)(n.a)(a.a)},80:function(e,t,r){"use strict";var s=r(5),a=r.n(s),n=r(0),c=r(139),o=r(4),i=r.n(o),l=r(100);r(160),t.a=e=>{let{className:t,showSpinner:r=!1,children:s,...o}=e;const u=i()("wc-block-components-button",t,{"wc-block-components-button--loading":r});return Object(n.createElement)(c.a,a()({className:u},o),r&&Object(n.createElement)(l.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},s))}}}]);
build/atomic-block-components/button.js CHANGED
@@ -1,3 +1,3 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[10],{264:function(t,o,c){"use strict";c.r(o);var e=c(5),n=c.n(e),a=c(0),d=(c(10),c(4)),r=c.n(d),l=c(1),b=c(60),u=c(359),i=c(14),s=c(29),p=c(54);c(304);const _=t=>{let{product:o}=t;const{id:c,permalink:e,add_to_cart:d,has_options:s,is_purchasable:p,is_in_stock:_}=o,{dispatchStoreEvent:k}=Object(b.a)(),{cartQuantity:w,addingToCart:m,addToCart:j}=Object(u.a)(c),O=Number.isFinite(w)&&w>0,C=!s&&p&&_,E=Object(i.decodeEntities)((null==d?void 0:d.description)||""),h=O?Object(l.sprintf)(
2
  /* translators: %s number of products in cart. */
3
- Object(l._n)("%d in cart","%d in cart",w,"woo-gutenberg-products-block"),w):Object(i.decodeEntities)((null==d?void 0:d.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),f=C?"button":"a",g={};return C?g.onClick=()=>{j(),k("cart-add-item",{product:o})}:(g.href=e,g.rel="nofollow",g.onClick=()=>{k("product-view-link",{product:o})}),Object(a.createElement)(f,n()({"aria-label":E,className:r()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:m,added:O}),disabled:m},g),h)},k=()=>Object(a.createElement)("button",{className:r()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder"),disabled:!0});o.default=Object(p.withProductDataContext)(t=>{let{className:o}=t;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:e}=Object(s.useProductDataContext)();return Object(a.createElement)("div",{className:r()(o,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},e.id?Object(a.createElement)(_,{product:e}):Object(a.createElement)(k,null))})},304:function(t,o){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[10],{265:function(t,o,c){"use strict";c.r(o);var e=c(5),n=c.n(e),a=c(0),d=(c(10),c(4)),r=c.n(d),l=c(1),b=c(60),u=c(360),i=c(14),s=c(29),p=c(54);c(305);const _=t=>{let{product:o}=t;const{id:c,permalink:e,add_to_cart:d,has_options:s,is_purchasable:p,is_in_stock:_}=o,{dispatchStoreEvent:k}=Object(b.a)(),{cartQuantity:w,addingToCart:m,addToCart:j}=Object(u.a)(c),O=Number.isFinite(w)&&w>0,C=!s&&p&&_,E=Object(i.decodeEntities)((null==d?void 0:d.description)||""),h=O?Object(l.sprintf)(
2
  /* translators: %s number of products in cart. */
3
+ Object(l._n)("%d in cart","%d in cart",w,"woo-gutenberg-products-block"),w):Object(i.decodeEntities)((null==d?void 0:d.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),f=C?"button":"a",g={};return C?g.onClick=()=>{j(),k("cart-add-item",{product:o})}:(g.href=e,g.rel="nofollow",g.onClick=()=>{k("product-view-link",{product:o})}),Object(a.createElement)(f,n()({"aria-label":E,className:r()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:m,added:O}),disabled:m},g),h)},k=()=>Object(a.createElement)("button",{className:r()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder"),disabled:!0});o.default=Object(p.withProductDataContext)(t=>{let{className:o}=t;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:e}=Object(s.useProductDataContext)();return Object(a.createElement)("div",{className:r()(o,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},e.id?Object(a.createElement)(_,{product:e}):Object(a.createElement)(k,null))})},305:function(t,o){}}]);
build/atomic-block-components/category-list.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{267:function(e,t,c){"use strict";c.r(t);var o=c(0),a=c(1),n=c(4),l=c.n(n),r=c(29),s=c(6),u=c(54);c(307),t.default=Object(u.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(r.useInnerBlockLayoutContext)(),{product:n}=Object(r.useProductDataContext)();return Object(s.isEmpty)(n.categories)?null:Object(o.createElement)("div",{className:l()(t,"wc-block-components-product-category-list",{[c+"__product-category-list"]:c})},Object(a.__)("Categories:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:a}=e;return Object(o.createElement)("li",{key:"category-list-item-"+a},Object(o.createElement)("a",{href:c},t))})))})},307:function(e,t){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{268:function(e,t,c){"use strict";c.r(t);var o=c(0),a=c(1),n=c(4),l=c.n(n),r=c(29),s=c(6),u=c(54);c(308),t.default=Object(u.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(r.useInnerBlockLayoutContext)(),{product:n}=Object(r.useProductDataContext)();return Object(s.isEmpty)(n.categories)?null:Object(o.createElement)("div",{className:l()(t,"wc-block-components-product-category-list",{[c+"__product-category-list"]:c})},Object(a.__)("Categories:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:a}=e;return Object(o.createElement)("li",{key:"category-list-item-"+a},Object(o.createElement)("a",{href:c},t))})))})},308:function(e,t){}}]);
build/atomic-block-components/image.js CHANGED
@@ -1,3 +1,3 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{252:function(e,t,a){"use strict";t.a={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}}},253:function(e,t,a){"use strict";var c=a(5),l=a.n(c),n=a(0),o=(a(10),a(1)),r=a(4),i=a.n(r),s=a(2),u=a(29),d=a(54),m=a(60),b=a(195);a(302);const g=()=>Object(n.createElement)("img",{src:s.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),p=e=>{let{image:t,onLoad:a,loaded:c,showFullSize:o,fallbackAlt:r}=e;const{thumbnail:i,src:s,srcset:u,sizes:d,alt:m}=t||{},b={alt:m||r,onLoad:a,hidden:!c,src:i,...o&&{src:s,srcSet:u,sizes:d}};return Object(n.createElement)(n.Fragment,null,b.src&&Object(n.createElement)("img",l()({"data-testid":"product-image"},b)),!c&&Object(n.createElement)(g,null))};t.a=Object(d.withProductDataContext)(e=>{let{className:t,imageSizing:a="full-size",showProductLink:c=!0,showSaleBadge:l,saleBadgeAlign:r="right"}=e;const{parentClassName:s}=Object(u.useInnerBlockLayoutContext)(),{product:d}=Object(u.useProductDataContext)(),[w,h]=Object(n.useState)(!1),{dispatchStoreEvent:f}=Object(m.a)();if(!d.id)return Object(n.createElement)("div",{className:i()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",{[s+"__product-image"]:s})},Object(n.createElement)(g,null));const O=!!d.images.length,j=O?d.images[0]:null,k=c?"a":n.Fragment,E=Object(o.sprintf)(
2
  /* translators: %s is referring to the product name */
3
- Object(o.__)("Link to %s","woo-gutenberg-products-block"),d.name),S={href:d.permalink,rel:"nofollow",...!O&&{"aria-label":E},onClick:()=>{f("product-view-link",{product:d})}};return Object(n.createElement)("div",{className:i()(t,"wc-block-components-product-image",{[s+"__product-image"]:s})},Object(n.createElement)(k,c&&S,!!l&&Object(n.createElement)(b.default,{align:r,product:d}),Object(n.createElement)(p,{fallbackAlt:d.name,image:j,onLoad:()=>h(!0),loaded:w,showFullSize:"cropped"!==a})))})},302:function(e,t){},501:function(e,t,a){"use strict";a.r(t);var c=a(54),l=a(253),n=a(252);t.default=Object(c.withFilteredAttributes)(n.a)(l.a)}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{253:function(e,t,a){"use strict";t.a={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}}},254:function(e,t,a){"use strict";var c=a(5),l=a.n(c),n=a(0),o=(a(10),a(1)),r=a(4),i=a.n(r),s=a(2),u=a(29),d=a(54),m=a(60),b=a(195);a(303);const g=()=>Object(n.createElement)("img",{src:s.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),p=e=>{let{image:t,onLoad:a,loaded:c,showFullSize:o,fallbackAlt:r}=e;const{thumbnail:i,src:s,srcset:u,sizes:d,alt:m}=t||{},b={alt:m||r,onLoad:a,hidden:!c,src:i,...o&&{src:s,srcSet:u,sizes:d}};return Object(n.createElement)(n.Fragment,null,b.src&&Object(n.createElement)("img",l()({"data-testid":"product-image"},b)),!c&&Object(n.createElement)(g,null))};t.a=Object(d.withProductDataContext)(e=>{let{className:t,imageSizing:a="full-size",showProductLink:c=!0,showSaleBadge:l,saleBadgeAlign:r="right"}=e;const{parentClassName:s}=Object(u.useInnerBlockLayoutContext)(),{product:d}=Object(u.useProductDataContext)(),[w,h]=Object(n.useState)(!1),{dispatchStoreEvent:f}=Object(m.a)();if(!d.id)return Object(n.createElement)("div",{className:i()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",{[s+"__product-image"]:s})},Object(n.createElement)(g,null));const O=!!d.images.length,j=O?d.images[0]:null,k=c?"a":n.Fragment,E=Object(o.sprintf)(
2
  /* translators: %s is referring to the product name */
3
+ Object(o.__)("Link to %s","woo-gutenberg-products-block"),d.name),S={href:d.permalink,rel:"nofollow",...!O&&{"aria-label":E},onClick:()=>{f("product-view-link",{product:d})}};return Object(n.createElement)("div",{className:i()(t,"wc-block-components-product-image",{[s+"__product-image"]:s})},Object(n.createElement)(k,c&&S,!!l&&Object(n.createElement)(b.default,{align:r,product:d}),Object(n.createElement)(p,{fallbackAlt:d.name,image:j,onLoad:()=>h(!0),loaded:w,showFullSize:"cropped"!==a})))})},303:function(e,t){},502:function(e,t,a){"use strict";a.r(t);var c=a(54),l=a(254),n=a(253);t.default=Object(c.withFilteredAttributes)(n.a)(l.a)}}]);
build/atomic-block-components/price.js CHANGED
@@ -1,3 +1,3 @@
1
  (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{106:function(e,c,r){"use strict";var t=r(0),a=r(1),n=r(41),l=r(4),o=r.n(l),i=r(35);r(158);const s=e=>{let{currency:c,maxPrice:r,minPrice:l,priceClassName:s,priceStyle:u={}}=e;return Object(t.createElement)(t.Fragment,null,Object(t.createElement)("span",{className:"screen-reader-text"},Object(a.sprintf)(
2
  /* translators: %1$s min price, %2$s max price */
3
- Object(a.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(i.formatPrice)(l),Object(i.formatPrice)(r))),Object(t.createElement)("span",{"aria-hidden":!0},Object(t.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:c,value:l,style:u})," — ",Object(t.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:c,value:r,style:u})))},u=e=>{let{currency:c,regularPriceClassName:r,regularPriceStyle:l,regularPrice:i,priceClassName:s,priceStyle:u,price:m}=e;return Object(t.createElement)(t.Fragment,null,Object(t.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Previous price:","woo-gutenberg-products-block")),Object(t.createElement)(n.a,{currency:c,renderText:e=>Object(t.createElement)("del",{className:o()("wc-block-components-product-price__regular",r),style:l},e),value:i}),Object(t.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Discounted price:","woo-gutenberg-products-block")),Object(t.createElement)(n.a,{currency:c,renderText:e=>Object(t.createElement)("ins",{className:o()("wc-block-components-product-price__value","is-discounted",s),style:u},e),value:m}))};c.a=e=>{let{align:c,className:r,currency:a,format:l="<price/>",maxPrice:i,minPrice:m,price:p,priceClassName:b,priceStyle:d,regularPrice:g,regularPriceClassName:j,regularPriceStyle:O}=e;const _=o()(r,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+c]:c});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const y=g&&p!==g;let N=Object(t.createElement)("span",{className:o()("wc-block-components-product-price__value",b)});return y?N=Object(t.createElement)(u,{currency:a,price:p,priceClassName:b,priceStyle:d,regularPrice:g,regularPriceClassName:j,regularPriceStyle:O}):void 0!==m&&void 0!==i?N=Object(t.createElement)(s,{currency:a,maxPrice:i,minPrice:m,priceClassName:b,priceStyle:d}):p&&(N=Object(t.createElement)(n.a,{className:o()("wc-block-components-product-price__value",b),currency:a,value:p,style:d})),Object(t.createElement)("span",{className:_},Object(t.createInterpolateElement)(l,{price:N}))}},140:function(e,c){},158:function(e,c){},262:function(e,c,r){"use strict";r.r(c);var t=r(0),a=(r(10),r(4)),n=r.n(a),l=r(106),o=r(35),i=r(29),s=r(7),u=r(70),m=r(54);c.default=Object(m.withProductDataContext)(e=>{var c,r;let{className:a,align:m,fontSize:p,customFontSize:b,saleFontSize:d,customSaleFontSize:g,color:j,customColor:O,saleColor:_,customSaleColor:y}=e;const{parentClassName:N}=Object(i.useInnerBlockLayoutContext)(),{product:v}=Object(i.useProductDataContext)(),f=n()(a,{[N+"__product-price"]:N});if(!v.id)return Object(t.createElement)(l.a,{align:m,className:f});const P=Object(s.getColorClassName)("color",j),C=Object(s.getFontSizeClass)(p),S=Object(s.getColorClassName)("color",_),w=Object(s.getFontSizeClass)(d),x=n()({"has-text-color":j||O,"has-font-size":p||b,[P]:P,[C]:C}),E=n()({"has-text-color":_||y,"has-font-size":d||g,[S]:S,[w]:w}),k={color:O,fontSize:b},h={color:y,fontSize:g},z=v.prices,F=Object(o.getCurrencyFromPriceResponse)(z),D=z.price!==z.regular_price,T=D?n()({[N+"__product-price__value"]:N,[E]:Object(u.b)()}):n()({[N+"__product-price__value"]:N,[x]:Object(u.b)()}),B=D?h:k;return Object(t.createElement)(l.a,{align:m,className:f,currency:F,price:z.price,priceClassName:T,priceStyle:Object(u.b)()?B:{},minPrice:null==z||null===(c=z.price_range)||void 0===c?void 0:c.min_amount,maxPrice:null==z||null===(r=z.price_range)||void 0===r?void 0:r.max_amount,regularPrice:z.regular_price,regularPriceClassName:n()({[N+"__product-price__regular"]:N,[x]:Object(u.b)()}),regularPriceStyle:Object(u.b)()?k:{}})})},41:function(e,c,r){"use strict";var t=r(5),a=r.n(t),n=r(0),l=r(134),o=r(4),i=r.n(o);r(140);const s=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});c.a=e=>{let{className:c,value:r,currency:t,onValueChange:o,displayType:u="text",...m}=e;const p="string"==typeof r?parseInt(r,10):r;if(!Number.isFinite(p))return null;const b=p/10**t.minorUnit;if(!Number.isFinite(b))return null;const d=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",c),g={...m,...s(t),value:void 0,currency:void 0,onValueChange:void 0},j=o?e=>{const c=+e.value*10**t.minorUnit;o(c)}:()=>{};return Object(n.createElement)(l.a,a()({className:d,displayType:u},g,{value:b,onValueChange:j}))}}}]);
1
  (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{106:function(e,c,r){"use strict";var t=r(0),a=r(1),n=r(41),l=r(4),o=r.n(l),i=r(35);r(158);const s=e=>{let{currency:c,maxPrice:r,minPrice:l,priceClassName:s,priceStyle:u={}}=e;return Object(t.createElement)(t.Fragment,null,Object(t.createElement)("span",{className:"screen-reader-text"},Object(a.sprintf)(
2
  /* translators: %1$s min price, %2$s max price */
3
+ Object(a.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(i.formatPrice)(l),Object(i.formatPrice)(r))),Object(t.createElement)("span",{"aria-hidden":!0},Object(t.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:c,value:l,style:u})," — ",Object(t.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:c,value:r,style:u})))},u=e=>{let{currency:c,regularPriceClassName:r,regularPriceStyle:l,regularPrice:i,priceClassName:s,priceStyle:u,price:m}=e;return Object(t.createElement)(t.Fragment,null,Object(t.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Previous price:","woo-gutenberg-products-block")),Object(t.createElement)(n.a,{currency:c,renderText:e=>Object(t.createElement)("del",{className:o()("wc-block-components-product-price__regular",r),style:l},e),value:i}),Object(t.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Discounted price:","woo-gutenberg-products-block")),Object(t.createElement)(n.a,{currency:c,renderText:e=>Object(t.createElement)("ins",{className:o()("wc-block-components-product-price__value","is-discounted",s),style:u},e),value:m}))};c.a=e=>{let{align:c,className:r,currency:a,format:l="<price/>",maxPrice:i,minPrice:m,price:p,priceClassName:b,priceStyle:d,regularPrice:g,regularPriceClassName:j,regularPriceStyle:O}=e;const _=o()(r,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+c]:c});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const y=g&&p!==g;let N=Object(t.createElement)("span",{className:o()("wc-block-components-product-price__value",b)});return y?N=Object(t.createElement)(u,{currency:a,price:p,priceClassName:b,priceStyle:d,regularPrice:g,regularPriceClassName:j,regularPriceStyle:O}):void 0!==m&&void 0!==i?N=Object(t.createElement)(s,{currency:a,maxPrice:i,minPrice:m,priceClassName:b,priceStyle:d}):p&&(N=Object(t.createElement)(n.a,{className:o()("wc-block-components-product-price__value",b),currency:a,value:p,style:d})),Object(t.createElement)("span",{className:_},Object(t.createInterpolateElement)(l,{price:N}))}},140:function(e,c){},158:function(e,c){},263:function(e,c,r){"use strict";r.r(c);var t=r(0),a=(r(10),r(4)),n=r.n(a),l=r(106),o=r(35),i=r(29),s=r(7),u=r(65),m=r(54);c.default=Object(m.withProductDataContext)(e=>{var c,r;let{className:a,align:m,fontSize:p,customFontSize:b,saleFontSize:d,customSaleFontSize:g,color:j,customColor:O,saleColor:_,customSaleColor:y}=e;const{parentClassName:N}=Object(i.useInnerBlockLayoutContext)(),{product:v}=Object(i.useProductDataContext)(),f=n()(a,{[N+"__product-price"]:N});if(!v.id)return Object(t.createElement)(l.a,{align:m,className:f});const P=Object(s.getColorClassName)("color",j),C=Object(s.getFontSizeClass)(p),S=Object(s.getColorClassName)("color",_),w=Object(s.getFontSizeClass)(d),x=n()({"has-text-color":j||O,"has-font-size":p||b,[P]:P,[C]:C}),E=n()({"has-text-color":_||y,"has-font-size":d||g,[S]:S,[w]:w}),k={color:O,fontSize:b},h={color:y,fontSize:g},z=v.prices,F=Object(o.getCurrencyFromPriceResponse)(z),D=z.price!==z.regular_price,T=D?n()({[N+"__product-price__value"]:N,[E]:Object(u.b)()}):n()({[N+"__product-price__value"]:N,[x]:Object(u.b)()}),B=D?h:k;return Object(t.createElement)(l.a,{align:m,className:f,currency:F,price:z.price,priceClassName:T,priceStyle:Object(u.b)()?B:{},minPrice:null==z||null===(c=z.price_range)||void 0===c?void 0:c.min_amount,maxPrice:null==z||null===(r=z.price_range)||void 0===r?void 0:r.max_amount,regularPrice:z.regular_price,regularPriceClassName:n()({[N+"__product-price__regular"]:N,[x]:Object(u.b)()}),regularPriceStyle:Object(u.b)()?k:{}})})},41:function(e,c,r){"use strict";var t=r(5),a=r.n(t),n=r(0),l=r(134),o=r(4),i=r.n(o);r(140);const s=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});c.a=e=>{let{className:c,value:r,currency:t,onValueChange:o,displayType:u="text",...m}=e;const p="string"==typeof r?parseInt(r,10):r;if(!Number.isFinite(p))return null;const b=p/10**t.minorUnit;if(!Number.isFinite(b))return null;const d=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",c),g={...m,...s(t),value:void 0,currency:void 0,onValueChange:void 0},j=o?e=>{const c=+e.value*10**t.minorUnit;o(c)}:()=>{};return Object(n.createElement)(l.a,a()({className:d,displayType:u},g,{value:b,onValueChange:j}))}}}]);
build/atomic-block-components/rating.js CHANGED
@@ -1,5 +1,5 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[14],{263:function(t,e,n){"use strict";n.r(e);var s=n(0),r=(n(10),n(1)),c=n(4),o=n.n(c),a=n(29),u=n(54);n(303);e.default=Object(u.withProductDataContext)(t=>{let{className:e}=t;const{parentClassName:n}=Object(a.useInnerBlockLayoutContext)(),{product:c}=Object(a.useProductDataContext)(),u=(t=>{const e=parseFloat(t.average_rating);return Number.isFinite(e)&&e>0?e:0})(c);if(!u)return null;const i={width:u/5*100+"%"},l=Object(r.sprintf)(
2
  /* translators: %f is referring to the average rating value */
3
  Object(r.__)("Rated %f out of 5","woo-gutenberg-products-block"),u),b=(t=>{const e=parseInt(t.review_count,10);return Number.isFinite(e)&&e>0?e:0})(c),p={__html:Object(r.sprintf)(
4
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
5
- Object(r._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",b,"woo-gutenberg-products-block"),Object(r.sprintf)('<strong class="rating">%f</strong>',u),Object(r.sprintf)('<span class="rating">%d</span>',b))};return Object(s.createElement)("div",{className:o()(e,"wc-block-components-product-rating",{[n+"__product-rating"]:n})},Object(s.createElement)("div",{className:o()("wc-block-components-product-rating__stars",n+"__product-rating__stars"),role:"img","aria-label":l},Object(s.createElement)("span",{style:i,dangerouslySetInnerHTML:p})))})},303:function(t,e){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[14],{264:function(t,e,n){"use strict";n.r(e);var s=n(0),r=(n(10),n(1)),c=n(4),o=n.n(c),a=n(29),u=n(54);n(304);e.default=Object(u.withProductDataContext)(t=>{let{className:e}=t;const{parentClassName:n}=Object(a.useInnerBlockLayoutContext)(),{product:c}=Object(a.useProductDataContext)(),u=(t=>{const e=parseFloat(t.average_rating);return Number.isFinite(e)&&e>0?e:0})(c);if(!u)return null;const i={width:u/5*100+"%"},l=Object(r.sprintf)(
2
  /* translators: %f is referring to the average rating value */
3
  Object(r.__)("Rated %f out of 5","woo-gutenberg-products-block"),u),b=(t=>{const e=parseInt(t.review_count,10);return Number.isFinite(e)&&e>0?e:0})(c),p={__html:Object(r.sprintf)(
4
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
5
+ Object(r._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",b,"woo-gutenberg-products-block"),Object(r.sprintf)('<strong class="rating">%f</strong>',u),Object(r.sprintf)('<span class="rating">%d</span>',b))};return Object(s.createElement)("div",{className:o()(e,"wc-block-components-product-rating",{[n+"__product-rating"]:n})},Object(s.createElement)("div",{className:o()("wc-block-components-product-rating__stars",n+"__product-rating__stars"),role:"img","aria-label":l},Object(s.createElement)("span",{style:i,dangerouslySetInnerHTML:p})))})},304:function(t,e){}}]);
build/atomic-block-components/sale-badge.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{195:function(e,t,c){"use strict";c.r(t);var a=c(0),n=(c(10),c(1)),r=c(4),l=c.n(r),s=c(30),o=c(29),u=c(54);c(301),t.default=Object(u.withProductDataContext)(e=>{let{className:t,align:c}=e;const{parentClassName:r}=Object(o.useInnerBlockLayoutContext)(),{product:u}=Object(o.useProductDataContext)();if(!u.id||!u.on_sale)return null;const b="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(a.createElement)("div",{className:l()("wc-block-components-product-sale-badge",t,b,{[r+"__product-onsale"]:r})},Object(a.createElement)(s.a,{label:Object(n.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(n.__)("Product on sale","woo-gutenberg-products-block")}))})},30:function(e,t,c){"use strict";var a=c(0),n=c(4),r=c.n(n);t.a=e=>{let t,{label:c,screenReaderLabel:n,wrapperElement:l,wrapperProps:s={}}=e;const o=null!=c,u=null!=n;return!o&&u?(t=l||"span",s={...s,className:r()(s.className,"screen-reader-text")},Object(a.createElement)(t,s,n)):(t=l||a.Fragment,o&&u&&c!==n?Object(a.createElement)(t,s,Object(a.createElement)("span",{"aria-hidden":"true"},c),Object(a.createElement)("span",{className:"screen-reader-text"},n)):Object(a.createElement)(t,s,c))}},301:function(e,t){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{195:function(e,t,c){"use strict";c.r(t);var a=c(0),n=(c(10),c(1)),r=c(4),l=c.n(r),s=c(30),o=c(29),u=c(54);c(302),t.default=Object(u.withProductDataContext)(e=>{let{className:t,align:c}=e;const{parentClassName:r}=Object(o.useInnerBlockLayoutContext)(),{product:u}=Object(o.useProductDataContext)();if(!u.id||!u.on_sale)return null;const b="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(a.createElement)("div",{className:l()("wc-block-components-product-sale-badge",t,b,{[r+"__product-onsale"]:r})},Object(a.createElement)(s.a,{label:Object(n.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(n.__)("Product on sale","woo-gutenberg-products-block")}))})},30:function(e,t,c){"use strict";var a=c(0),n=c(4),r=c.n(n);t.a=e=>{let t,{label:c,screenReaderLabel:n,wrapperElement:l,wrapperProps:s={}}=e;const o=null!=c,u=null!=n;return!o&&u?(t=l||"span",s={...s,className:r()(s.className,"screen-reader-text")},Object(a.createElement)(t,s,n)):(t=l||a.Fragment,o&&u&&c!==n?Object(a.createElement)(t,s,Object(a.createElement)("span",{"aria-hidden":"true"},c),Object(a.createElement)("span",{className:"screen-reader-text"},n)):Object(a.createElement)(t,s,c))}},302:function(e,t){}}]);
build/atomic-block-components/sku.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{266:function(t,e,c){"use strict";c.r(e);var o=c(0),n=c(1),s=(c(10),c(4)),u=c.n(s),a=c(29),r=c(54);c(306),e.default=Object(r.withProductDataContext)(t=>{let{className:e}=t;const{parentClassName:c}=Object(a.useInnerBlockLayoutContext)(),{product:s}=Object(a.useProductDataContext)(),r=s.sku;return r?Object(o.createElement)("div",{className:u()(e,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(n.__)("SKU:","woo-gutenberg-products-block")," ",Object(o.createElement)("strong",null,r)):null})},306:function(t,e){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{267:function(t,e,c){"use strict";c.r(e);var o=c(0),n=c(1),s=(c(10),c(4)),u=c.n(s),a=c(29),r=c(54);c(307),e.default=Object(r.withProductDataContext)(t=>{let{className:e}=t;const{parentClassName:c}=Object(a.useInnerBlockLayoutContext)(),{product:s}=Object(a.useProductDataContext)(),r=s.sku;return r?Object(o.createElement)("div",{className:u()(e,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(n.__)("SKU:","woo-gutenberg-products-block")," ",Object(o.createElement)("strong",null,r)):null})},307:function(t,e){}}]);
build/atomic-block-components/stock-indicator--atomic-block-components/summary--atomic-block-components/title.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{113:function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return l})),n.d(e,"a",(function(){return b}));var s=n(7),c=n(70),r=n(64),o=n(194);const i=t=>Object(r.c)(t)?JSON.parse(t)||{}:Object(r.b)(t)?t:{},a=t=>{if(!Object(c.b)()||!Object(o.a)())return{style:{}};const e=Object(r.b)(t)?t:{},n=i(e.style);return Object(s.__experimentalGetSpacingClassesAndStyles)({...e,style:n})},l=t=>{const e=Object(r.b)(t)?t:{},n=i(e.style),s=Object(r.b)(n.typography)?n.typography:{};return{style:{fontSize:e.fontSize||s.fontSize,lineHeight:s.lineHeight,fontWeight:s.fontWeight,textTransform:s.textTransform,fontFamily:e.fontFamily}}},b=t=>{if(!Object(c.b)())return{className:"",style:{}};const e=Object(r.b)(t)?t:{},n=i(e.style);return Object(s.__experimentalUseColorProps)({...e,style:n})}},194:function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var s=n(7);const c=()=>"function"==typeof s.__experimentalGetSpacingClassesAndStyles}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{113:function(t,e,n){"use strict";n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return l})),n.d(e,"a",(function(){return b}));var s=n(7),c=n(65),r=n(62),o=n(194);const i=t=>Object(r.c)(t)?JSON.parse(t)||{}:Object(r.b)(t)?t:{},a=t=>{if(!Object(c.b)()||!Object(o.a)())return{style:{}};const e=Object(r.b)(t)?t:{},n=i(e.style);return Object(s.__experimentalGetSpacingClassesAndStyles)({...e,style:n})},l=t=>{const e=Object(r.b)(t)?t:{},n=i(e.style),s=Object(r.b)(n.typography)?n.typography:{};return{style:{fontSize:e.fontSize||s.fontSize,lineHeight:s.lineHeight,fontWeight:s.fontWeight,textTransform:s.textTransform,fontFamily:e.fontFamily}}},b=t=>{if(!Object(c.b)())return{className:"",style:{}};const e=Object(r.b)(t)?t:{},n=i(e.style);return Object(s.__experimentalUseColorProps)({...e,style:n})}},194:function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var s=n(7);const c=()=>"function"==typeof s.__experimentalGetSpacingClassesAndStyles}}]);
build/atomic-block-components/stock-indicator.js CHANGED
@@ -1,3 +1,3 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{269:function(o,c,t){"use strict";t.r(c);var e=t(0),n=t(1),s=(t(10),t(4)),r=t.n(s),a=t(29),b=t(54),i=(t(309),t(113));c.default=Object(b.withProductDataContext)(o=>{const{className:c}=o,{parentClassName:t}=Object(a.useInnerBlockLayoutContext)(),{product:s}=Object(a.useProductDataContext)(),b=Object(i.a)(o),k=Object(i.c)(o);if(!s.id||!s.is_purchasable)return null;const l=!!s.is_in_stock,u=s.low_stock_remaining,d=s.is_on_backorder;return Object(e.createElement)("div",{className:r()(c,b.className,"wc-block-components-product-stock-indicator",{[t+"__stock-indicator"]:t,"wc-block-components-product-stock-indicator--in-stock":l,"wc-block-components-product-stock-indicator--out-of-stock":!l,"wc-block-components-product-stock-indicator--low-stock":!!u,"wc-block-components-product-stock-indicator--available-on-backorder":!!d}),style:{...b.style,...k.style}},u?(o=>Object(n.sprintf)(
2
  /* translators: %d stock amount (number of items in stock for product) */
3
- Object(n.__)("%d left in stock","woo-gutenberg-products-block"),o))(u):((o,c)=>c?Object(n.__)("Available on backorder","woo-gutenberg-products-block"):o?Object(n.__)("In Stock","woo-gutenberg-products-block"):Object(n.__)("Out of Stock","woo-gutenberg-products-block"))(l,d))})},309:function(o,c){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{270:function(o,c,t){"use strict";t.r(c);var e=t(0),n=t(1),s=(t(10),t(4)),r=t.n(s),a=t(29),b=t(54),i=(t(310),t(113));c.default=Object(b.withProductDataContext)(o=>{const{className:c}=o,{parentClassName:t}=Object(a.useInnerBlockLayoutContext)(),{product:s}=Object(a.useProductDataContext)(),b=Object(i.a)(o),k=Object(i.c)(o);if(!s.id||!s.is_purchasable)return null;const l=!!s.is_in_stock,u=s.low_stock_remaining,d=s.is_on_backorder;return Object(e.createElement)("div",{className:r()(c,b.className,"wc-block-components-product-stock-indicator",{[t+"__stock-indicator"]:t,"wc-block-components-product-stock-indicator--in-stock":l,"wc-block-components-product-stock-indicator--out-of-stock":!l,"wc-block-components-product-stock-indicator--low-stock":!!u,"wc-block-components-product-stock-indicator--available-on-backorder":!!d}),style:{...b.style,...k.style}},u?(o=>Object(n.sprintf)(
2
  /* translators: %d stock amount (number of items in stock for product) */
3
+ Object(n.__)("%d left in stock","woo-gutenberg-products-block"),o))(u):((o,c)=>c?Object(n.__)("Available on backorder","woo-gutenberg-products-block"):o?Object(n.__)("In Stock","woo-gutenberg-products-block"):Object(n.__)("Out of Stock","woo-gutenberg-products-block"))(l,d))})},310:function(o,c){}}]);
build/atomic-block-components/summary.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{131:function(t,e,c){"use strict";var n=c(0),o=c(101),s=c(76);const r=t=>{const e=t.indexOf("</p>");return-1===e?t:t.substr(0,e+4)},a=t=>t.replace(/<\/?[a-z][^>]*?>/gi,""),u=(t,e)=>t.replace(/[\s|\.\,]+$/i,"")+e,l=function(t,e){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"&hellip;";const n=a(t),o=n.split(" ").splice(0,e).join(" ");return Object(s.autop)(u(o,c))},i=function(t,e){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const o=a(t),r=o.slice(0,e);if(c)return Object(s.autop)(u(r,n));const l=r.match(/([\s]+)/g),i=l?l.length:0,p=o.slice(0,e+i);return Object(s.autop)(u(p,n))};e.a=t=>{let{source:e,maxLength:c=15,countType:a="words",className:u="",style:p={}}=t;const d=Object(n.useMemo)(()=>function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const n=Object(s.autop)(t),a=Object(o.count)(n,c);if(a<=e)return n;const u=r(n),p=Object(o.count)(u,c);return p<=e?u:"words"===c?l(u,e):i(u,e,"characters_including_spaces"===c)}(e,c,a),[e,c,a]);return Object(n.createElement)(n.RawHTML,{style:p,className:u},d)}},265:function(t,e,c){"use strict";c.r(e);var n=c(0),o=(c(10),c(4)),s=c.n(o),r=c(131),a=c(24),u=c(29),l=c(54),i=(c(305),c(113));e.default=Object(l.withProductDataContext)(t=>{const{className:e}=t,{parentClassName:c}=Object(u.useInnerBlockLayoutContext)(),{product:o}=Object(u.useProductDataContext)(),l=Object(i.a)(t),p=Object(i.c)(t);if(!o)return Object(n.createElement)("div",{className:s()(e,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const d=o.short_description?o.short_description:o.description;return d?Object(n.createElement)(r.a,{className:s()(e,l.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:d,maxLength:150,countType:a.o.wordCountType||"words",style:{...l.style,...p.style}}):null})},305:function(t,e){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{131:function(t,e,c){"use strict";var n=c(0),o=c(101),s=c(76);const r=t=>{const e=t.indexOf("</p>");return-1===e?t:t.substr(0,e+4)},a=t=>t.replace(/<\/?[a-z][^>]*?>/gi,""),u=(t,e)=>t.replace(/[\s|\.\,]+$/i,"")+e,l=function(t,e){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"&hellip;";const n=a(t),o=n.split(" ").splice(0,e).join(" ");return Object(s.autop)(u(o,c))},i=function(t,e){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const o=a(t),r=o.slice(0,e);if(c)return Object(s.autop)(u(r,n));const l=r.match(/([\s]+)/g),i=l?l.length:0,p=o.slice(0,e+i);return Object(s.autop)(u(p,n))};e.a=t=>{let{source:e,maxLength:c=15,countType:a="words",className:u="",style:p={}}=t;const d=Object(n.useMemo)(()=>function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const n=Object(s.autop)(t),a=Object(o.count)(n,c);if(a<=e)return n;const u=r(n),p=Object(o.count)(u,c);return p<=e?u:"words"===c?l(u,e):i(u,e,"characters_including_spaces"===c)}(e,c,a),[e,c,a]);return Object(n.createElement)(n.RawHTML,{style:p,className:u},d)}},266:function(t,e,c){"use strict";c.r(e);var n=c(0),o=(c(10),c(4)),s=c.n(o),r=c(131),a=c(24),u=c(29),l=c(54),i=(c(306),c(113));e.default=Object(l.withProductDataContext)(t=>{const{className:e}=t,{parentClassName:c}=Object(u.useInnerBlockLayoutContext)(),{product:o}=Object(u.useProductDataContext)(),l=Object(i.a)(t),p=Object(i.c)(t);if(!o)return Object(n.createElement)("div",{className:s()(e,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const d=o.short_description?o.short_description:o.description;return d?Object(n.createElement)(r.a,{className:s()(e,l.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:d,maxLength:150,countType:a.o.wordCountType||"words",style:{...l.style,...p.style}}):null})},306:function(t,e){}}]);
build/atomic-block-components/tag-list.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[18],{268:function(t,e,c){"use strict";c.r(e);var a=c(0),n=c(1),l=(c(10),c(4)),s=c.n(l),o=c(29),u=c(6),r=c(54);c(308),e.default=Object(r.withProductDataContext)(t=>{let{className:e}=t;const{parentClassName:c}=Object(o.useInnerBlockLayoutContext)(),{product:l}=Object(o.useProductDataContext)();return Object(u.isEmpty)(l.tags)?null:Object(a.createElement)("div",{className:s()(e,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c})},Object(n.__)("Tags:","woo-gutenberg-products-block")," ",Object(a.createElement)("ul",null,Object.values(l.tags).map(t=>{let{name:e,link:c,slug:n}=t;return Object(a.createElement)("li",{key:"tag-list-item-"+n},Object(a.createElement)("a",{href:c},e))})))})},308:function(t,e){}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[18],{269:function(t,e,c){"use strict";c.r(e);var a=c(0),n=c(1),l=(c(10),c(4)),s=c.n(l),o=c(29),u=c(6),r=c(54);c(309),e.default=Object(r.withProductDataContext)(t=>{let{className:e}=t;const{parentClassName:c}=Object(o.useInnerBlockLayoutContext)(),{product:l}=Object(o.useProductDataContext)();return Object(u.isEmpty)(l.tags)?null:Object(a.createElement)("div",{className:s()(e,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c})},Object(n.__)("Tags:","woo-gutenberg-products-block")," ",Object(a.createElement)("ul",null,Object.values(l.tags).map(t=>{let{name:e,link:c,slug:n}=t;return Object(a.createElement)("li",{key:"tag-list-item-"+n},Object(a.createElement)("a",{href:c},e))})))})},309:function(t,e){}}]);
build/atomic-block-components/title.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[19],{129:function(e,t,c){"use strict";var n=c(5),l=c.n(n),o=c(0),a=c(14),s=c(4),r=c.n(s);c(157),t.a=e=>{let{className:t="",disabled:c=!1,name:n,permalink:s="",rel:i,style:u,onClick:b,...d}=e;const p=r()("wc-block-components-product-name",t);if(c){const e=d;return Object(o.createElement)("span",l()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(n)}}))}return Object(o.createElement)("a",l()({className:p,href:s,rel:i},d,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(n)},style:u}))}},157:function(e,t){},248:function(e,t,c){"use strict";var n=c(70);let l={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(n.b)()&&(l={...l,align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}}),t.a=l},249:function(e,t,c){"use strict";var n=c(0),l=c(4),o=c.n(l),a=c(29),s=c(70),r=c(54),i=c(129),u=c(60),b=(c(300),c(113));const d=e=>{let{children:t,headingLevel:c,elementType:l="h"+c,...o}=e;return Object(n.createElement)(l,o,t)};t.a=Object(r.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:l=!0,align:r}=e,{parentClassName:p}=Object(a.useInnerBlockLayoutContext)(),{product:m}=Object(a.useProductDataContext)(),{dispatchStoreEvent:y}=Object(u.a)(),j=Object(b.a)(e),O=Object(b.b)(e),k=Object(b.c)(e);return m.id?Object(n.createElement)(d,{headingLevel:c,className:o()(t,j.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+r]:r&&Object(s.b)()}),style:Object(s.b)()?{...O.style,...k.style,...j.style}:{}},Object(n.createElement)(i.a,{disabled:!l,name:m.name,permalink:m.permalink,rel:l?"nofollow":"",onClick:()=>{y("product-view-link",{product:m})}})):Object(n.createElement)(d,{headingLevel:c,className:o()(t,j.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+r]:r&&Object(s.b)()}),style:Object(s.b)()?{...O.style,...k.style,...j.style}:{}})})},300:function(e,t){},502:function(e,t,c){"use strict";c.r(t);var n=c(54),l=c(249),o=c(248);t.default=Object(n.withFilteredAttributes)(o.a)(l.a)}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[19],{129:function(e,t,c){"use strict";var n=c(5),l=c.n(n),o=c(0),a=c(14),s=c(4),r=c.n(s);c(157),t.a=e=>{let{className:t="",disabled:c=!1,name:n,permalink:s="",rel:i,style:u,onClick:b,...d}=e;const p=r()("wc-block-components-product-name",t);if(c){const e=d;return Object(o.createElement)("span",l()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(n)}}))}return Object(o.createElement)("a",l()({className:p,href:s,rel:i},d,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(n)},style:u}))}},157:function(e,t){},249:function(e,t,c){"use strict";var n=c(65);let l={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(n.b)()&&(l={...l,align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}}),t.a=l},250:function(e,t,c){"use strict";var n=c(0),l=c(4),o=c.n(l),a=c(29),s=c(65),r=c(54),i=c(129),u=c(60),b=(c(301),c(113));const d=e=>{let{children:t,headingLevel:c,elementType:l="h"+c,...o}=e;return Object(n.createElement)(l,o,t)};t.a=Object(r.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:l=!0,align:r}=e,{parentClassName:p}=Object(a.useInnerBlockLayoutContext)(),{product:m}=Object(a.useProductDataContext)(),{dispatchStoreEvent:y}=Object(u.a)(),j=Object(b.a)(e),O=Object(b.b)(e),k=Object(b.c)(e);return m.id?Object(n.createElement)(d,{headingLevel:c,className:o()(t,j.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+r]:r&&Object(s.b)()}),style:Object(s.b)()?{...O.style,...k.style,...j.style}:{}},Object(n.createElement)(i.a,{disabled:!l,name:m.name,permalink:m.permalink,rel:l?"nofollow":"",onClick:()=>{y("product-view-link",{product:m})}})):Object(n.createElement)(d,{headingLevel:c,className:o()(t,j.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+r]:r&&Object(s.b)()}),style:Object(s.b)()?{...O.style,...k.style,...j.style}:{}})})},301:function(e,t){},503:function(e,t,c){"use strict";c.r(t);var n=c(54),l=c(250),o=c(249);t.default=Object(n.withFilteredAttributes)(o.a)(l.a)}}]);
build/attribute-filter-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '5841fbf7cdb14aec8d00aa521dfa5ac1');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '8b7b47cab520f377241aa64f77bcf85b');
build/attribute-filter-frontend.js CHANGED
@@ -1,4 +1,4 @@
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=182)}([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.React},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)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.wc.wcBlocksData},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(42)()},function(e,t){e.exports=window.wp.data},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.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.isShallowEqual},,,,function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(15),o=n.n(r),i=n(0),a=n(3),c=n(1),s=n(65),u=e=>{let{imageUrl:t=s.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:a=Object(c.__)("Error:","woo-gutenberg-products-block"),button:u}=e;return Object(i.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(i.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(i.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(i.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(i.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(i.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},a?a+" ":"",o),u&&Object(i.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},u)))};n(37);class l extends a.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(i.createElement)(i.Fragment,null,Object(i.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,text:r,errorMessagePrefix:o,renderError:a,button:c}=this.props,{errorMessage:s,hasError:l}=this.state;return l?"function"==typeof a?a({errorMessage:s}):Object(i.createElement)(u,{errorMessage:n?s:null,header:e,imageUrl:t,text:r,errorMessagePrefix:o,button:c}):this.props.children}}t.a=l},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0),o=n(11),i=n.n(o);function a(e){const t=Object(r.useRef)(e);return i()(e,t.current)||(t.current=e),t.current}},,function(e,t){e.exports=window.wp.htmlEntities},,function(e,t,n){"use strict";var r=n(0),o=n(4),i=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:a,wrapperProps:c={}}=e;const s=null!=n,u=null!=o;return!s&&u?(t=a||"span",c={...c,className:i()(c.className,"screen-reader-text")},Object(r.createElement)(t,c,o)):(t=a||r.Fragment,s&&u&&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.a11y},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0);const o=Object(r.createContext)("page"),i=()=>Object(r.useContext)(o);o.Provider},,,,,,,,,,,,function(e,t){},,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(6),o=n(9),i=n(0),a=n(11),c=n.n(a),s=n(17),u=n(62),l=n(25);const d=e=>{const t=Object(l.a)();e=e||t;const n=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[n,Object(i.useCallback)(t=>{a(e,t)},[e,a])]},p=(e,t,n)=>{const a=Object(l.a)();n=n||a;const c=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(i.useCallback)(t=>{s(n,e,t)},[n,e,s])]},f=(e,t)=>{const n=Object(l.a)();t=t||n;const[r,o]=d(t),a=Object(s.a)(r),p=Object(s.a)(e),f=Object(u.a)(p),m=Object(i.useRef)(!1);return Object(i.useEffect)(()=>{c()(f,p)||(o(Object.assign({},a,p)),m.current=!0)},[a,p,f,o]),m.current?[r,o]:[e,o]}},,,function(e,t,n){"use strict";var r=n(43);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);function o(e,t,n){var o=this,i=Object(r.useRef)(null),a=Object(r.useRef)(0),c=Object(r.useRef)(null),s=Object(r.useRef)([]),u=Object(r.useRef)(),l=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 m=!!(n=n||{}).leading,b=!("trailing"in n)||!!n.trailing,g="maxWait"in n,h=g?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=s.current,n=u.current;return s.current=u.current=null,a.current=e,l.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-i.current,r=e-a.current;return!i.current||n>=t||n<0||g&&r>=h},v=function(t){return c.current=null,b&&s.current?e(t):(s.current=u.current=null,l.current)},y=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-i.current,c=e-a.current,s=t-o,u=g?Math.min(s,h-c):s;n(y,u)}},O=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var b=Date.now(),h=r(b);if(s.current=d,u.current=o,i.current=b,h){if(!c.current&&p.current)return a.current=i.current,n(y,t),m?e(i.current):l.current;if(g)return n(y,t),e(i.current)}return c.current||n(y,t),l.current};return O.cancel=function(){c.current&&(f?cancelAnimationFrame(c.current):clearTimeout(c.current)),a.current=0,s.current=i.current=u.current=c.current=null},O.isPending=function(){return!!c.current},O.flush=function(){return c.current?v(Date.now()):l.current},O}),[m,g,t,h,b,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(10),o=n.n(r),i=n(0),a=n(16);const c=[".wp-block-woocommerce-cart"],s=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:c=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const s=r(e,n),u=c(e,n),l={...e.dataset,...s.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:c={},errorBoundaryProps:s={}}=e;Object(i.render)(Object(i.createElement)(a.a,s,Object(i.createElement)(i.Suspense,{fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(i.createElement)(t,o()({},c,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:s,attributes:l,errorBoundaryProps:u})})},u=e=>{const t=document.body.querySelectorAll(c.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:i}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:i}=e;const a=document.body.querySelectorAll(o);i&&i.length>0&&Array.prototype.filter.call(a,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,i)),s({Block:t,containers:a,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:i,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:i}=e;const a=i.querySelectorAll(o);s({Block:t,containers:a,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper: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(1),i=n(21);n(117),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,Number.isFinite(n)&&Object(r.createElement)(i.a,{label:n,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,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);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";n.d(t,"a",(function(){return s}));var r=n(6),o=n(9),i=n(0),a=n(17),c=n(54);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:u={},shouldSelect:l=!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(i.useRef)({results:[],isLoading:!0}),p=Object(a.a)(u),f=Object(a.a)(s),m=Object(c.a)(),b=Object(o.useSelect)(e=>{if(!l)return null;const o=e(r.COLLECTIONS_STORE_KEY),i=[t,n,p,f],a=o.getCollectionError(...i);return a&&m(a),{results:o.getCollection(...i),isLoading:!o.hasFinishedResolution("getCollection",i)}},[t,n,f,p,l]);return null!==b&&(d.current=b),d.current}},function(e,t,n){"use strict";n.d(t,"n",(function(){return i})),n.d(t,"l",(function(){return a})),n.d(t,"k",(function(){return c})),n.d(t,"m",(function(){return s})),n.d(t,"i",(function(){return u})),n.d(t,"d",(function(){return l})),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 m})),n.d(t,"g",(function(){return b})),n.d(t,"a",(function(){return g})),n.d(t,"h",(function(){return h})),n.d(t,"b",(function(){return v}));var r,o=n(2);const i=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=i.pluginUrl+"images/",c=i.pluginUrl+"build/",s=i.buildPhase,u=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,l=(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),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),b=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),v=Object(o.getSetting)("allowedStates",{})},,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(1),i=(n(8),n(4)),a=n.n(i),c=n(21);n(102);const s=e=>{let{className:t,disabled:n,label:
4
  /* translators: Submit button text for filters. */
@@ -6,11 +6,11 @@ i=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:
6
  /* translators: %s is referring the remaining count of options */
7
  Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
8
  /* translators: %s number of options to reveal. */
9
- Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[i,l,d]),b=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{p(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[d]),g=Object(r.useMemo)(()=>{const e=i.length>l+5;return Object(r.createElement)(r.Fragment,null,i.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&o>=l&&{hidden:!0},Object(r.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{n(e.target.value)},checked:c.includes(t.value),disabled:u}),Object(r.createElement)("label",{htmlFor:t.value},t.label)),e&&o===l-1&&m)),e&&b)},[i,n,c,d,l,b,m,u]),h=a()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":s},t);return Object(r.createElement)("ul",{className:h},s?f:g)}},,,,,,function(e,t){},,,,,function(e,t){},function(e,t){},,,,,,,,function(e,t,n){"use strict";e.exports=n(185)},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n(94),i=n(5),a=n(17),c=n(39),s=n(64),u=n(25);const l=e=>{let{queryAttribute:t,queryPrices:n,queryStock:l,queryState:d}=e,p=Object(u.a)();p+="-collection-data";const[f]=Object(c.a)(p),[m,b]=Object(c.b)("calculate_attribute_counts",[],p),[g,h]=Object(c.b)("calculate_price_range",null,p),[v,y]=Object(c.b)("calculate_stock_status_counts",null,p),O=Object(a.a)(t||{}),w=Object(a.a)(n),j=Object(a.a)(l);Object(r.useEffect)(()=>{"object"==typeof O&&Object.keys(O).length&&(m.find(e=>e.taxonomy===O.taxonomy)||b([...m,O]))},[O,m,b]),Object(r.useEffect)(()=>{g!==w&&void 0!==w&&h(w)},[w,h,g]),Object(r.useEffect)(()=>{v!==j&&void 0!==j&&y(j)},[j,y,v]);const[E,I]=Object(r.useState)(!1),[_]=Object(o.a)(E,200);E||I(!0);const S=Object(r.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(i.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(f),[f]);return Object(s.a)({namespace:"/wc/store",resourceName:"products/collection-data",query:{...d,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...S},shouldSelect:_})}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(10),o=n.n(r),i=n(0),a=n(24);const c=Object(i.createElement)(e=>{let{className:t,size:n,...r}=e;return Object(i.createElement)(a.SVG,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),Object(i.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=c},,,function(e,t,n){"use strict";var r=n(10),o=n.n(r),i=n(0),a=n(4),c=n.n(a),s=n(1),u=n(98),l=n(165);n(112);var d=e=>{let{text:t,screenReaderText:n="",element:r="li",className:a="",radius:s="small",children:u=null,...l}=e;const d=r,p=c()(a,"wc-block-components-chip","wc-block-components-chip--radius-"+s),f=Boolean(n&&n!==t);return Object(i.createElement)(d,o()({className:p},l),Object(i.createElement)("span",{"aria-hidden":f,className:"wc-block-components-chip__text"},t),f&&Object(i.createElement)("span",{className:"screen-reader-text"},n),u)};t.a=e=>{let{ariaLabel:t="",className:n="",disabled:r=!1,onRemove:a=(()=>{}),removeOnAnyClick:p=!1,text:f,screenReaderText:m="",...b}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:f;t="string"!=typeof e?
10
  /* translators: Remove chip. */
11
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
12
  /* translators: %s text of the chip to remove. */
13
- Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const h={"aria-label":t,disabled:r,onClick:a,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||a()}},v=p?h:{},y=p?{"aria-hidden":!0}:h;return Object(i.createElement)(d,o()({},b,v,{className:c()(n,"is-removable"),element:p?"button":b.element,screenReaderText:m,text:f}),Object(i.createElement)(g,o()({className:"wc-block-components-chip__remove"},y),Object(i.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",srcElement:l.a,size:16})))}},,,,,,,,,,,,,,function(e,t,n){e.exports=n(201)},function(e,t){},function(e,t){},function(e,t,n){"use strict";var r=60103,o=60106,i=60107,a=60108,c=60114,s=60109,u=60110,l=60112,d=60113,p=60120,f=60115,m=60116,b=60121,g=60122,h=60117,v=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var O=Symbol.for;r=O("react.element"),o=O("react.portal"),i=O("react.fragment"),a=O("react.strict_mode"),c=O("react.profiler"),s=O("react.provider"),u=O("react.context"),l=O("react.forward_ref"),d=O("react.suspense"),p=O("react.suspense_list"),f=O("react.memo"),m=O("react.lazy"),b=O("react.block"),g=O("react.server.block"),h=O("react.fundamental"),v=O("react.debug_trace_mode"),y=O("react.legacy_hidden")}function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case i:case c:case a:case d:case p:return e;default:switch(e=e&&e.$$typeof){case u:case l:case m:case f:case s:return e;default:return t}}case o:return t}}}var j=s,E=r,I=l,_=i,S=m,k=f,x=o,C=c,P=a,R=d;t.ContextConsumer=u,t.ContextProvider=j,t.Element=E,t.ForwardRef=I,t.Fragment=_,t.Lazy=S,t.Memo=k,t.Portal=x,t.Profiler=C,t.StrictMode=P,t.Suspense=R,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return w(e)===u},t.isContextProvider=function(e){return w(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===l},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===m},t.isMemo=function(e){return w(e)===f},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===c},t.isStrictMode=function(e){return w(e)===a},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===v||e===a||e===d||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===s||e.$$typeof===u||e.$$typeof===l||e.$$typeof===h||e.$$typeof===b||e[0]===g)},t.typeOf=w},,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(53),o=n(0),i=n(1),a=n(23),c=n(17),s=n(62),u=n(39),l=n(64),d=n(133),p=n(106),f=n(8),m=n.n(f),b=n(4),g=n.n(b);function h(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var v=n(7);function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var w=n(3);function j(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function E(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function I(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return E(n.overflowY,t)||E(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function _(e,t,n,r,o,i,a,c){return i<e&&a>t||i>e&&a<t?0:i<=e&&c<=n||a>=t&&c>=n?i-e-r:a>t&&c<n||i<e&&c>n?a-t+o:0}n(126);var S=function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.create,Object.create;var k=0;function x(e){return"function"==typeof e?e:C}function C(){}function P(e,t){e&&function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,a=t.boundary,c=t.skipOverflowHiddenElements,s="function"==typeof a?a:function(e){return e!==a};if(!j(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,l=[],d=e;j(d)&&s(d);){if((d=d.parentElement)===u){l.push(d);break}null!=d&&d===document.body&&I(d)&&!I(document.documentElement)||null!=d&&I(d,c)&&l.push(d)}for(var p=n.visualViewport?n.visualViewport.width:innerWidth,f=n.visualViewport?n.visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,b=window.scrollY||pageYOffset,g=e.getBoundingClientRect(),h=g.height,v=g.width,y=g.top,O=g.right,w=g.bottom,E=g.left,S="start"===o||"nearest"===o?y:"end"===o?w:y+h/2,k="center"===i?E+v/2:"end"===i?O:E,x=[],C=0;C<l.length;C++){var P=l[C],R=P.getBoundingClientRect(),T=R.height,M=R.width,A=R.top,D=R.right,N=R.bottom,H=R.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=A&&w<=N&&E>=H&&O<=D)return x;var B=getComputedStyle(P),L=parseInt(B.borderLeftWidth,10),V=parseInt(B.borderTopWidth,10),F=parseInt(B.borderRightWidth,10),K=parseInt(B.borderBottomWidth,10),q=0,U=0,$="offsetWidth"in P?P.offsetWidth-P.clientWidth-L-F:0,W="offsetHeight"in P?P.offsetHeight-P.clientHeight-V-K:0;if(u===P)q="start"===o?S:"end"===o?S-f:"nearest"===o?_(b,b+f,f,V,K,b+S,b+S+h,h):S-f/2,U="start"===i?k:"center"===i?k-p/2:"end"===i?k-p:_(m,m+p,p,L,F,m+k,m+k+v,v),q=Math.max(0,q+b),U=Math.max(0,U+m);else{q="start"===o?S-A-V:"end"===o?S-N+K+W:"nearest"===o?_(A,N,T,V,K+W,S,S+h,h):S-(A+T/2)+W/2,U="start"===i?k-H-L:"center"===i?k-(H+M/2)+$/2:"end"===i?k-D+F+$:_(H,D,M,L,F+$,k,k+v,v);var G=P.scrollLeft,Y=P.scrollTop;S+=Y-(q=Math.max(0,Math.min(Y+q,P.scrollHeight-T+W))),k+=G-(U=Math.max(0,Math.min(G+U,P.scrollWidth-M+$)))}x.push({el:P,top:q,left:U})}return x}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r}))}function R(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function T(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];r(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return o.cancel=r,o}function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function A(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function D(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function N(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var H=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function B(e){void 0===e&&(e={});var t={};return H.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function L(e,t){return void 0!==e[t]}function V(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function F(e,t,n,r,o){if(void 0===o&&(o=!0),0===n)return-1;var i=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:i+1);var a=t+e;a<0?a=o?i:0:a>i&&(a=o?0:i);var c=K(e,a,n,r,o);return-1===c?t>=n?-1:t:c}function K(e,t,n,r,o){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var a=t+1;a<n;a++)if(!r(a).hasAttribute("disabled"))return a}else for(var c=t-1;c>=0;c--)if(!r(c).hasAttribute("disabled"))return c;return o?e>0?K(1,0,n,r,!1):K(-1,n-1,n,r,!1):-1}function q(e,t,n,r){return void 0===r&&(r=!0),t.some((function(t){return t&&(R(t,e,n)||r&&R(t,n.document.activeElement,n))}))}var U=T((function(e){W(e).textContent=""}),500);function $(e,t){var n=W(t);e&&(n.textContent=e,U(t))}function W(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var G=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),Y=["refKey","ref"],z=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Q=["onKeyDown","onBlur","onChange","onInput","onChangeText"],X=["refKey","ref"],J=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Z=function(){var e=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).id=n.props.id||"downshift-"+String(k++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==r})),e()}),t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=B(t),n.internalSetState(Object(v.a)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=B(t),n.internalSetState(Object(v.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},a="function"==typeof e;return!a&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(v.a)({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var c=a?e(t):e;c=n.props.stateReducer(t,c),r=c.hasOwnProperty("selectedItem");var s={},u={};return r&&c.selectedItem!==t.selectedItem&&(o=c.selectedItem),c.type=c.type||0,Object.keys(c).forEach((function(e){t[e]!==c[e]&&(i[e]=c[e]),"type"!==e&&(u[e]=c[e],L(n.props,e)||(s[e]=c[e]))})),a&&c.hasOwnProperty("inputValue")&&n.props.onInputValueChange(c.inputValue,Object(v.a)({},n.getStateAndHelpers(),c)),s}),(function(){x(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,c=o.ref,s=h(o,Y),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=a,n.getRootProps.suppressRefError=l;var d=n.getState().isOpen;return Object(v.a)(((r={})[a]=A(c,n.rootRef),r.role="combobox",r["aria-expanded"]=d,r["aria-haspopup"]="listbox",r["aria-owns"]=d?n.menuId:null,r["aria-labelledby"]=n.labelId,r),s)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=F(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=F(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(Object(v.a)({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=Object(v.a)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=Object(v.a)({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(1,0,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(-1,r-1,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick;t.onPress;var o=t.onKeyDown,i=t.onKeyUp,a=t.onBlur,c=h(t,z),s=n.getState().isOpen,u={onClick:M(r,n.buttonHandleClick),onKeyDown:M(o,n.buttonHandleKeyDown),onKeyUp:M(i,n.buttonHandleKeyUp),onBlur:M(a,n.buttonHandleBlur)},l=c.disabled?{}:u;return Object(v.a)({type:"button",role:"button","aria-label":s?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l,c)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=V(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(y(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return Object(v.a)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,a=t.onInput;t.onChangeText;var c,s=h(t,Q),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return s.disabled||((c={}).onChange=M(i,a,n.inputHandleChange),c.onKeyDown=M(r,n.inputHandleKeyDown),c.onBlur=M(o,n.inputHandleBlur),u=c),Object(v.a)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},u,s)},n.inputHandleKeyDown=function(e){var t=V(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(y(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,c=o.ref,s=h(o,X),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;return n.getMenuProps.called=!0,n.getMenuProps.refKey=a,n.getMenuProps.suppressRefError=l,Object(v.a)(((r={})[a]=A(c,n.menuRef),r.role="listbox",r["aria-labelledby"]=s&&s["aria-label"]?null:n.labelId,r.id=n.menuId,r),s)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,a=r.onClick;r.onPress;var c=r.index,s=r.item,u=void 0===s?void 0:s,l=h(r,J);void 0===c?(n.items.push(u),c=n.items.indexOf(u)):n.items[c]=u;var d=a,p=((t={onMouseMove:M(o,(function(){c!==n.getState().highlightedIndex&&(n.setHighlightedIndex(c,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:M(i,(function(e){e.preventDefault()}))}).onClick=M(d,(function(){n.selectItemAtIndex(c,{type:9})})),t),f=l.disabled?{onMouseDown:p.onMouseDown}:p;return Object(v.a)({id:n.getItemId(c),role:"option","aria-selected":n.getState().highlightedIndex===c},f,l)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.selectedItem;return Object(v.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.isOpen;return Object(v.a)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),x(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=T((function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(v.a)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,$(o,n.props.environment.document)}),200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,a=void 0===i?o:i,c=r.defaultIsOpen,s=r.initialIsOpen,u=void 0===s?c:s,l=r.initialInputValue,d=void 0===l?"":l,p=r.initialSelectedItem,f=void 0===p?null:p,m=n.getState({highlightedIndex:a,isOpen:u,inputValue:d,selectedItem:f});return null!=m.selectedItem&&void 0===n.props.initialInputValue&&(m.inputValue=n.props.itemToString(m.selectedItem)),n.state=m,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,O(t,n);var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},o.getState=function(e){return void 0===e&&(e=this.state),t=e,n=this.props,Object.keys(t).reduce((function(e,r){return e[r]=L(n,r)?n[r]:t[r],e}),{});var t,n},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this,r=this.getItemCount(),o=this.getState().highlightedIndex;if(r>0){var i=F(e,o,r,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(i,t)}},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,a=this.id,c=this.getRootProps,s=this.getToggleButtonProps,u=this.getLabelProps,l=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,m=this.closeMenu,b=this.toggleMenu,g=this.selectItem,h=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,O=this.clearSelection,w=this.clearItems;return{getRootProps:c,getToggleButtonProps:s,getLabelProps:u,getMenuProps:l,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:m,toggleMenu:b,selectItem:g,selectItemAtIndex:h,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:O,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:a,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!q(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},r=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},i=function(t){var n=q(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},a=this.props.environment;a.addEventListener("mousedown",t),a.addEventListener("mouseup",n),a.addEventListener("touchstart",r),a.addEventListener("touchmove",o),a.addEventListener("touchend",i),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),a.removeEventListener("mousedown",t),a.removeEventListener("mouseup",n),a.removeEventListener("touchstart",r),a.removeEventListener("touchmove",o),a.removeEventListener("touchend",i)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){L(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=N(this.props.children,C);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=N(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.type}(t)?Object(w.cloneElement)(t,this.getRootProps(function(e){return e.props}(t))):void 0:null},r}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:D,itemToString:function(e){return null==e?"":String(e)},onStateChange:C,onInputValueChange:C,onUserAction:C,onChange:C,onSelect:C,onOuterClick:C,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:P},e.stateChangeTypes=G,e}();T((function(e,t){$(e(),t)}),200),"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?w.useLayoutEffect:w.useEffect;var ee={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:P,circularNavigation:!1,environment:"undefined"==typeof window?{}:window};m.a.array.isRequired,m.a.func,m.a.func,m.a.func,m.a.bool,m.a.number,m.a.number,m.a.number,m.a.bool,m.a.bool,m.a.bool,m.a.any,m.a.any,m.a.any,m.a.string,m.a.string,m.a.string,m.a.func,m.a.string,m.a.func,m.a.func,m.a.func,m.a.func,m.a.func,m.a.shape({addEventListener:m.a.func,removeEventListener:m.a.func,document:m.a.shape({getElementById:m.a.func,activeElement:m.a.any,body:m.a.any})}),S(S({},ee),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.":"":"No results are available.":""}}),m.a.array.isRequired,m.a.func,m.a.func,m.a.func,m.a.bool,m.a.number,m.a.number,m.a.number,m.a.bool,m.a.bool,m.a.bool,m.a.any,m.a.any,m.a.any,m.a.string,m.a.string,m.a.string,m.a.string,m.a.string,m.a.string,m.a.func,m.a.string,m.a.string,m.a.func,m.a.func,m.a.func,m.a.func,m.a.func,m.a.func,m.a.shape({addEventListener:m.a.func,removeEventListener:m.a.func,document:m.a.shape({getElementById:m.a.func,activeElement:m.a.any,body:m.a.any})}),Object(v.a)({},ee,{getA11yStatusMessage:D,circularNavigation:!0}),m.a.array,m.a.array,m.a.array,m.a.func,m.a.func,m.a.func,m.a.number,m.a.number,m.a.number,m.a.func,m.a.func,m.a.string,m.a.string,m.a.shape({addEventListener:m.a.func,removeEventListener:m.a.func,document:m.a.shape({getElementById:m.a.func,activeElement:m.a.any,body:m.a.any})});var te=e=>{let{checked:t,getInputProps:n,inputRef:r,isDisabled:i,onFocus:a,onRemoveItem:c,placeholder:s,tabIndex:u,value:l}=e;return Object(o.createElement)("input",n({ref:r,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:i,onFocus:a,onKeyDown(e){"Backspace"===e.key&&!l&&t.length>0&&c(t[t.length-1])},placeholder:s,tabIndex:u}))},ne=e=>{let{children:t,onClick:n}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:n},t)},re=e=>{let{checked:t,getItemProps:n,getMenuProps:r,highlightedIndex:a,options:c}=e;return Object(o.createElement)("ul",r({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),c.map((e,r)=>{const c=t.includes(e.value);return Object(o.createElement)("li",n({key:e.value,className:g()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":c,"is-highlighted":a===r}),index:r,item:e.value,"aria-label":c?Object(i.sprintf)(
14
  /* translators: %s is referring to the filter option being removed. */
15
  Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},oe=n(168),ie=e=>{let{onRemoveItem:t,option:n}=e;return Object(o.createElement)(oe.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(n.value)},ariaLabel:Object(i.sprintf)(
16
  /* translators: %s is referring to the filter option being removed. */
@@ -20,10 +20,10 @@ Object(i.__)("Replace current %s filter","woo-gutenberg-products-block"),r.name)
20
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
21
  Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),r.name)},Object(o.createElement)(ae.a,{srcElement:ce.a,size:16})))};n(184);var ue=e=>{let{attributeLabel:t="",className:n,checked:r=[],inputLabel:a="",isDisabled:c=!1,isLoading:s=!1,multiple:u=!1,onChange:l=(()=>{}),options:d=[]}=e;const p=Object(o.useRef)(null),f=g()(n,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":c,"is-loading":s}),m=Object(o.useCallback)((e,t)=>{switch(t.type){case Z.stateChangeTypes.keyDownEnter:case Z.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:u,inputValue:""};case Z.stateChangeTypes.blurInput:case Z.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[u]);return Object(o.createElement)(Z,{onChange:l,selectedItem:null,stateReducer:m},e=>{let{getInputProps:n,getItemProps:s,getLabelProps:m,getMenuProps:b,highlightedIndex:h,inputValue:v,isOpen:y,openMenu:O}=e;return Object(o.createElement)("div",{className:g()(f,{"is-multiple":u,"is-single":!u,"has-checked":r.length>0,"is-open":y})},Object(o.createElement)("label",m({className:"screen-reader-text"}),a),Object(o.createElement)(ne,{isOpen:y,onClick:()=>p.current.focus()},r.map(e=>{const t=d.find(t=>t.value===e),n=e=>{l(e),p.current.focus()};return u?Object(o.createElement)(ie,{key:e,onRemoveItem:n,option:t}):Object(o.createElement)(se,{key:e,onClick:()=>p.current.focus(),onRemoveItem:n,option:t})}),Object(o.createElement)(te,{checked:r,getInputProps:n,inputRef:p,isDisabled:c,onFocus:O,onRemoveItem:e=>{l(e),p.current.focus()},placeholder:r.length>0&&u?null:Object(i.sprintf)(
22
  /* translators: %s attribute name. */
23
- Object(i.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&r.length>0?"-1":"0",value:v})),y&&!c&&Object(o.createElement)(re,{checked:r,getItemProps:s,getMenuProps:b,highlightedIndex:h,options:d.filter(e=>!v||e.value.startsWith(v))}))})},le=n(55),de=n(72),pe=n(11),fe=n.n(pe),me=n(19),be=n(95),ge=n(104),he=n(105);const ve=[{value:"preview-1",name:"Blue",label:Object(o.createElement)(le.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(o.createElement)(le.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(o.createElement)(le.a,{name:"Red",count:2})}],ye={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(183);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:e=>{let{attributes:t,isEditor:n=!1}=e;const r=t.isPreview&&!t.attributeId?ye:Object(ge.a)(t.attributeId),[f,m]=Object(o.useState)([]),[b,g]=Object(o.useState)(t.isPreview&&!t.attributeId?ve:[]),[h]=Object(u.a)(),[v,y]=Object(u.b)("attributes",[]),{results:O,isLoading:w}=Object(l.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[(null==r?void 0:r.id)||0],shouldSelect:t.attributeId>0}),j="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:E,isLoading:I}=Object(d.a)({queryAttribute:{taxonomy:null==r?void 0:r.taxonomy,queryType:t.queryType},queryState:{...h,attributes:j?h.attributes:null}}),_=Object(o.useCallback)(e=>E.attribute_counts?E.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[E]);Object(o.useEffect)(()=>{if(w||I)return;const e=O.map(e=>{const n=_(e.id);if(!(n||f.includes(e.slug)||(i=e.slug,null!=h&&h.attributes&&h.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===r.taxonomy&&n.includes(i)}))))return null;var i;const a=n?n.count:0;return{value:e.slug,name:Object(me.decodeEntities)(e.name),label:Object(o.createElement)(le.a,{name:Object(me.decodeEntities)(e.name),count:t.showCounts?a:null})}}).filter(Boolean);g(e)},[null==r?void 0:r.taxonomy,O,w,t.showCounts,I,_,f,h.attributes]);const S=Object(o.useCallback)(e=>O.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]),[O]),k=Object(o.useCallback)(e=>{n||Object(he.b)(v,y,r,S(e),"or"===t.queryType?"in":"and")},[n,v,y,r,S,t.queryType]),x=Object(o.useMemo)(()=>v.filter(e=>{let{attribute:t}=e;return t===(null==r?void 0:r.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[v,null==r?void 0:r.taxonomy]),C=Object(c.a)(x),P=Object(s.a)(C);Object(o.useEffect)(()=>{fe()(P,C)||fe()(f,C)||(m(C),t.showFilterButton||k(C))},[f,C,P,k,t.showFilterButton]);const R="dropdown"!==t.displayStyle||"or"===t.queryType,T=Object(o.useCallback)(e=>{const n=e=>{const{name:t}=b.find(t=>t.value===e);return t},r=e=>{let{filterAdded:t,filterRemoved:r}=e;const o=t?n(t):null,c=r?n(r):null;o&&c?Object(a.speak)(Object(i.sprintf)(
24
  /* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
25
  Object(i.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,c)):o?Object(a.speak)(Object(i.sprintf)(
26
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
27
  Object(i.__)("%s filter added.","woo-gutenberg-products-block"),o)):c&&Object(a.speak)(Object(i.sprintf)(
28
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
29
- Object(i.__)("%s filter removed.","woo-gutenberg-products-block"),c))},o=f.includes(e);let c;R?(c=f.filter(t=>t!==e),o?r({filterRemoved:e}):(c.push(e),c.sort(),r({filterAdded:e}))):(c=o?[]:[e],r({filterAdded:o?null:e,filterRemoved:1===f.length?f[0]:null})),m(c),t.showFilterButton||k(c)},[f,b,R,k,t.showFilterButton]);if(!r)return n?Object(o.createElement)(be.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===b.length&&!w)return n?Object(o.createElement)(be.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const M="h"+t.headingLevel,A=!t.isPreview&&w,D=!t.isPreview&&I;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&b.length>0&&Object(o.createElement)(M,{className:"wc-block-attribute-filter__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(o.createElement)(ue,{attributeLabel:r.label,checked:f,className:"wc-block-attribute-filter-dropdown",inputLabel:t.heading,isLoading:A,multiple:R,onChange:T,options:b}):Object(o.createElement)(p.a,{className:"wc-block-attribute-filter-list",options:b,checked:f,onChange:T,isLoading:A,isDisabled:D}),t.showFilterButton&&Object(o.createElement)(de.a,{className:"wc-block-attribute-filter__button",disabled:A||D,onClick:()=>k(f)})))},getProps:e=>({isEditor:!1,attributes:{attributeId:parseInt(e.dataset.attributeId||0,10),showCounts:"true"===e.dataset.showCounts,queryType:e.dataset.queryType,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3,displayStyle:e.dataset.displayStyle,showFilterButton:"true"===e.dataset.showFilterButton}})})}]);
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=182)}([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.React},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)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.wc.wcBlocksData},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(42)()},function(e,t){e.exports=window.wp.data},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.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.isShallowEqual},,function(e,t,n){"use strict";var r=n(16),o=n.n(r),i=n(0),a=n(3),c=n(1),s=n(65),u=e=>{let{imageUrl:t=s.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:a=Object(c.__)("Error:","woo-gutenberg-products-block"),button:u,showErrorBlock:l=!0}=e;return l?Object(i.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(i.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(i.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(i.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(i.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(i.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},a?a+" ":"",o),u&&Object(i.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},u))):null};n(37);class l extends a.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(i.createElement)(i.Fragment,null,Object(i.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:a,renderError:c,button:s}=this.props,{errorMessage:l,hasError:d}=this.state;return d?"function"==typeof c?c({errorMessage:l}):Object(i.createElement)(u,{showErrorBlock:r,errorMessage:n?l:null,header:e,imageUrl:t,text:o,errorMessagePrefix:a,button:s}):this.props.children}}t.a=l},,,function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0),o=n(11),i=n.n(o);function a(e){const t=Object(r.useRef)(e);return i()(e,t.current)||(t.current=e),t.current}},,function(e,t){e.exports=window.wp.htmlEntities},,function(e,t,n){"use strict";var r=n(0),o=n(4),i=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:a,wrapperProps:c={}}=e;const s=null!=n,u=null!=o;return!s&&u?(t=a||"span",c={...c,className:i()(c.className,"screen-reader-text")},Object(r.createElement)(t,c,o)):(t=a||r.Fragment,s&&u&&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.a11y},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0);const o=Object(r.createContext)("page"),i=()=>Object(r.useContext)(o);o.Provider},,,,,,,,,,,,function(e,t){},,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(6),o=n(9),i=n(0),a=n(11),c=n.n(a),s=n(17),u=n(62),l=n(25);const d=e=>{const t=Object(l.a)();e=e||t;const n=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[n,Object(i.useCallback)(t=>{a(e,t)},[e,a])]},p=(e,t,n)=>{const a=Object(l.a)();n=n||a;const c=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(i.useCallback)(t=>{s(n,e,t)},[n,e,s])]},f=(e,t)=>{const n=Object(l.a)();t=t||n;const[r,o]=d(t),a=Object(s.a)(r),p=Object(s.a)(e),f=Object(u.a)(p),m=Object(i.useRef)(!1);return Object(i.useEffect)(()=>{c()(f,p)||(o(Object.assign({},a,p)),m.current=!0)},[a,p,f,o]),m.current?[r,o]:[e,o]}},,,function(e,t,n){"use strict";var r=n(43);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);function o(e,t,n){var o=this,i=Object(r.useRef)(null),a=Object(r.useRef)(0),c=Object(r.useRef)(null),s=Object(r.useRef)([]),u=Object(r.useRef)(),l=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 m=!!(n=n||{}).leading,b=!("trailing"in n)||!!n.trailing,g="maxWait"in n,h=g?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=s.current,n=u.current;return s.current=u.current=null,a.current=e,l.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-i.current,r=e-a.current;return!i.current||n>=t||n<0||g&&r>=h},v=function(t){return c.current=null,b&&s.current?e(t):(s.current=u.current=null,l.current)},y=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-i.current,c=e-a.current,s=t-o,u=g?Math.min(s,h-c):s;n(y,u)}},O=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var b=Date.now(),h=r(b);if(s.current=d,u.current=o,i.current=b,h){if(!c.current&&p.current)return a.current=i.current,n(y,t),m?e(i.current):l.current;if(g)return n(y,t),e(i.current)}return c.current||n(y,t),l.current};return O.cancel=function(){c.current&&(f?cancelAnimationFrame(c.current):clearTimeout(c.current)),a.current=0,s.current=i.current=u.current=c.current=null},O.isPending=function(){return!!c.current},O.flush=function(){return c.current?v(Date.now()):l.current},O}),[m,g,t,h,b,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(10),o=n.n(r),i=n(0),a=n(13);const c=[".wp-block-woocommerce-cart"],s=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:c=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const s=r(e,n),u=c(e,n),l={...e.dataset,...s.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:c={},errorBoundaryProps:s={}}=e;Object(i.render)(Object(i.createElement)(a.a,s,Object(i.createElement)(i.Suspense,{fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(i.createElement)(t,o()({},c,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:s,attributes:l,errorBoundaryProps:u})})},u=e=>{const t=document.body.querySelectorAll(c.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:i}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:i}=e;const a=document.body.querySelectorAll(o);i&&i.length>0&&Array.prototype.filter.call(a,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,i)),s({Block:t,containers:a,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:i,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:i}=e;const a=i.querySelectorAll(o);s({Block:t,containers:a,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper: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(1),i=n(21);n(117),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,Number.isFinite(n)&&Object(r.createElement)(i.a,{label:n,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,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);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";n.d(t,"a",(function(){return s}));var r=n(6),o=n(9),i=n(0),a=n(17),c=n(54);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:u={},shouldSelect:l=!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(i.useRef)({results:[],isLoading:!0}),p=Object(a.a)(u),f=Object(a.a)(s),m=Object(c.a)(),b=Object(o.useSelect)(e=>{if(!l)return null;const o=e(r.COLLECTIONS_STORE_KEY),i=[t,n,p,f],a=o.getCollectionError(...i);return a&&m(a),{results:o.getCollection(...i),isLoading:!o.hasFinishedResolution("getCollection",i)}},[t,n,f,p,l]);return null!==b&&(d.current=b),d.current}},function(e,t,n){"use strict";n.d(t,"n",(function(){return i})),n.d(t,"l",(function(){return a})),n.d(t,"k",(function(){return c})),n.d(t,"m",(function(){return s})),n.d(t,"i",(function(){return u})),n.d(t,"d",(function(){return l})),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 m})),n.d(t,"g",(function(){return b})),n.d(t,"a",(function(){return g})),n.d(t,"h",(function(){return h})),n.d(t,"b",(function(){return v}));var r,o=n(2);const i=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=i.pluginUrl+"images/",c=i.pluginUrl+"build/",s=i.buildPhase,u=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,l=(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),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),b=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),v=Object(o.getSetting)("allowedStates",{})},,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(1),i=(n(8),n(4)),a=n.n(i),c=n(21);n(102);const s=e=>{let{className:t,disabled:n,label:
4
  /* translators: Submit button text for filters. */
6
  /* translators: %s is referring the remaining count of options */
7
  Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
8
  /* translators: %s number of options to reveal. */
9
+ Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[i,l,d]),b=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{p(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[d]),g=Object(r.useMemo)(()=>{const e=i.length>l+5;return Object(r.createElement)(r.Fragment,null,i.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&o>=l&&{hidden:!0},Object(r.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{n(e.target.value)},checked:c.includes(t.value),disabled:u}),Object(r.createElement)("label",{htmlFor:t.value},t.label)),e&&o===l-1&&m)),e&&b)},[i,n,c,d,l,b,m,u]),h=a()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":s},t);return Object(r.createElement)("ul",{className:h},s?f:g)}},,,,,,function(e,t){},,,,,function(e,t){},function(e,t){},,,,,,,,function(e,t,n){"use strict";e.exports=n(185)},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n(94),i=n(5),a=n(17),c=n(39),s=n(64),u=n(25);const l=e=>{let{queryAttribute:t,queryPrices:n,queryStock:l,queryState:d}=e,p=Object(u.a)();p+="-collection-data";const[f]=Object(c.a)(p),[m,b]=Object(c.b)("calculate_attribute_counts",[],p),[g,h]=Object(c.b)("calculate_price_range",null,p),[v,y]=Object(c.b)("calculate_stock_status_counts",null,p),O=Object(a.a)(t||{}),w=Object(a.a)(n),j=Object(a.a)(l);Object(r.useEffect)(()=>{"object"==typeof O&&Object.keys(O).length&&(m.find(e=>e.taxonomy===O.taxonomy)||b([...m,O]))},[O,m,b]),Object(r.useEffect)(()=>{g!==w&&void 0!==w&&h(w)},[w,h,g]),Object(r.useEffect)(()=>{v!==j&&void 0!==j&&y(j)},[j,y,v]);const[E,I]=Object(r.useState)(!1),[_]=Object(o.a)(E,200);E||I(!0);const k=Object(r.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(i.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(f),[f]);return Object(s.a)({namespace:"/wc/store",resourceName:"products/collection-data",query:{...d,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...k},shouldSelect:_})}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(10),o=n.n(r),i=n(0),a=n(24);const c=Object(i.createElement)(e=>{let{className:t,size:n,...r}=e;return Object(i.createElement)(a.SVG,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),Object(i.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=c},,,function(e,t,n){"use strict";var r=n(10),o=n.n(r),i=n(0),a=n(4),c=n.n(a),s=n(1),u=n(98),l=n(165);n(112);var d=e=>{let{text:t,screenReaderText:n="",element:r="li",className:a="",radius:s="small",children:u=null,...l}=e;const d=r,p=c()(a,"wc-block-components-chip","wc-block-components-chip--radius-"+s),f=Boolean(n&&n!==t);return Object(i.createElement)(d,o()({className:p},l),Object(i.createElement)("span",{"aria-hidden":f,className:"wc-block-components-chip__text"},t),f&&Object(i.createElement)("span",{className:"screen-reader-text"},n),u)};t.a=e=>{let{ariaLabel:t="",className:n="",disabled:r=!1,onRemove:a=(()=>{}),removeOnAnyClick:p=!1,text:f,screenReaderText:m="",...b}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:f;t="string"!=typeof e?
10
  /* translators: Remove chip. */
11
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
12
  /* translators: %s text of the chip to remove. */
13
+ Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const h={"aria-label":t,disabled:r,onClick:a,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||a()}},v=p?h:{},y=p?{"aria-hidden":!0}:h;return Object(i.createElement)(d,o()({},b,v,{className:c()(n,"is-removable"),element:p?"button":b.element,screenReaderText:m,text:f}),Object(i.createElement)(g,o()({className:"wc-block-components-chip__remove"},y),Object(i.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",srcElement:l.a,size:16})))}},,,,,,,,,,,,,,function(e,t,n){e.exports=n(201)},function(e,t){},function(e,t){},function(e,t,n){"use strict";var r=60103,o=60106,i=60107,a=60108,c=60114,s=60109,u=60110,l=60112,d=60113,p=60120,f=60115,m=60116,b=60121,g=60122,h=60117,v=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var O=Symbol.for;r=O("react.element"),o=O("react.portal"),i=O("react.fragment"),a=O("react.strict_mode"),c=O("react.profiler"),s=O("react.provider"),u=O("react.context"),l=O("react.forward_ref"),d=O("react.suspense"),p=O("react.suspense_list"),f=O("react.memo"),m=O("react.lazy"),b=O("react.block"),g=O("react.server.block"),h=O("react.fundamental"),v=O("react.debug_trace_mode"),y=O("react.legacy_hidden")}function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case i:case c:case a:case d:case p:return e;default:switch(e=e&&e.$$typeof){case u:case l:case m:case f:case s:return e;default:return t}}case o:return t}}}var j=s,E=r,I=l,_=i,k=m,S=f,x=o,C=c,P=a,R=d;t.ContextConsumer=u,t.ContextProvider=j,t.Element=E,t.ForwardRef=I,t.Fragment=_,t.Lazy=k,t.Memo=S,t.Portal=x,t.Profiler=C,t.StrictMode=P,t.Suspense=R,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return w(e)===u},t.isContextProvider=function(e){return w(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===l},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===m},t.isMemo=function(e){return w(e)===f},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===c},t.isStrictMode=function(e){return w(e)===a},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===c||e===v||e===a||e===d||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===s||e.$$typeof===u||e.$$typeof===l||e.$$typeof===h||e.$$typeof===b||e[0]===g)},t.typeOf=w},,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(53),o=n(0),i=n(1),a=n(23),c=n(17),s=n(62),u=n(39),l=n(64),d=n(133),p=n(106),f=n(8),m=n.n(f),b=n(4),g=n.n(b);function h(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var v=n(7);function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var w=n(3);function j(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function E(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function I(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return E(n.overflowY,t)||E(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function _(e,t,n,r,o,i,a,c){return i<e&&a>t||i>e&&a<t?0:i<=e&&c<=n||a>=t&&c>=n?i-e-r:a>t&&c<n||i<e&&c>n?a-t+o:0}n(126);var k=function(){return(k=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.create,Object.create;var S=0;function x(e){return"function"==typeof e?e:C}function C(){}function P(e,t){e&&function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,a=t.boundary,c=t.skipOverflowHiddenElements,s="function"==typeof a?a:function(e){return e!==a};if(!j(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,l=[],d=e;j(d)&&s(d);){if((d=d.parentElement)===u){l.push(d);break}null!=d&&d===document.body&&I(d)&&!I(document.documentElement)||null!=d&&I(d,c)&&l.push(d)}for(var p=n.visualViewport?n.visualViewport.width:innerWidth,f=n.visualViewport?n.visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,b=window.scrollY||pageYOffset,g=e.getBoundingClientRect(),h=g.height,v=g.width,y=g.top,O=g.right,w=g.bottom,E=g.left,k="start"===o||"nearest"===o?y:"end"===o?w:y+h/2,S="center"===i?E+v/2:"end"===i?O:E,x=[],C=0;C<l.length;C++){var P=l[C],R=P.getBoundingClientRect(),T=R.height,M=R.width,A=R.top,D=R.right,N=R.bottom,H=R.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=A&&w<=N&&E>=H&&O<=D)return x;var B=getComputedStyle(P),L=parseInt(B.borderLeftWidth,10),V=parseInt(B.borderTopWidth,10),F=parseInt(B.borderRightWidth,10),K=parseInt(B.borderBottomWidth,10),q=0,U=0,$="offsetWidth"in P?P.offsetWidth-P.clientWidth-L-F:0,W="offsetHeight"in P?P.offsetHeight-P.clientHeight-V-K:0;if(u===P)q="start"===o?k:"end"===o?k-f:"nearest"===o?_(b,b+f,f,V,K,b+k,b+k+h,h):k-f/2,U="start"===i?S:"center"===i?S-p/2:"end"===i?S-p:_(m,m+p,p,L,F,m+S,m+S+v,v),q=Math.max(0,q+b),U=Math.max(0,U+m);else{q="start"===o?k-A-V:"end"===o?k-N+K+W:"nearest"===o?_(A,N,T,V,K+W,k,k+h,h):k-(A+T/2)+W/2,U="start"===i?S-H-L:"center"===i?S-(H+M/2)+$/2:"end"===i?S-D+F+$:_(H,D,M,L,F+$,S,S+v,v);var G=P.scrollLeft,Y=P.scrollTop;k+=Y-(q=Math.max(0,Math.min(Y+q,P.scrollHeight-T+W))),S+=G-(U=Math.max(0,Math.min(G+U,P.scrollWidth-M+$)))}x.push({el:P,top:q,left:U})}return x}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r}))}function R(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function T(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];r(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return o.cancel=r,o}function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function A(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function D(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function N(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var H=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function B(e){void 0===e&&(e={});var t={};return H.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function L(e,t){return void 0!==e[t]}function V(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function F(e,t,n,r,o){if(void 0===o&&(o=!0),0===n)return-1;var i=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:i+1);var a=t+e;a<0?a=o?i:0:a>i&&(a=o?0:i);var c=K(e,a,n,r,o);return-1===c?t>=n?-1:t:c}function K(e,t,n,r,o){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var a=t+1;a<n;a++)if(!r(a).hasAttribute("disabled"))return a}else for(var c=t-1;c>=0;c--)if(!r(c).hasAttribute("disabled"))return c;return o?e>0?K(1,0,n,r,!1):K(-1,n-1,n,r,!1):-1}function q(e,t,n,r){return void 0===r&&(r=!0),t.some((function(t){return t&&(R(t,e,n)||r&&R(t,n.document.activeElement,n))}))}var U=T((function(e){W(e).textContent=""}),500);function $(e,t){var n=W(t);e&&(n.textContent=e,U(t))}function W(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var G=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),Y=["refKey","ref"],z=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Q=["onKeyDown","onBlur","onChange","onInput","onChangeText"],X=["refKey","ref"],J=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Z=function(){var e=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).id=n.props.id||"downshift-"+String(S++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==r})),e()}),t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=B(t),n.internalSetState(Object(v.a)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=B(t),n.internalSetState(Object(v.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},a="function"==typeof e;return!a&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(v.a)({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var c=a?e(t):e;c=n.props.stateReducer(t,c),r=c.hasOwnProperty("selectedItem");var s={},u={};return r&&c.selectedItem!==t.selectedItem&&(o=c.selectedItem),c.type=c.type||0,Object.keys(c).forEach((function(e){t[e]!==c[e]&&(i[e]=c[e]),"type"!==e&&(u[e]=c[e],L(n.props,e)||(s[e]=c[e]))})),a&&c.hasOwnProperty("inputValue")&&n.props.onInputValueChange(c.inputValue,Object(v.a)({},n.getStateAndHelpers(),c)),s}),(function(){x(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,c=o.ref,s=h(o,Y),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=a,n.getRootProps.suppressRefError=l;var d=n.getState().isOpen;return Object(v.a)(((r={})[a]=A(c,n.rootRef),r.role="combobox",r["aria-expanded"]=d,r["aria-haspopup"]="listbox",r["aria-owns"]=d?n.menuId:null,r["aria-labelledby"]=n.labelId,r),s)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=F(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=F(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(Object(v.a)({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=Object(v.a)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=Object(v.a)({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(1,0,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(-1,r-1,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick;t.onPress;var o=t.onKeyDown,i=t.onKeyUp,a=t.onBlur,c=h(t,z),s=n.getState().isOpen,u={onClick:M(r,n.buttonHandleClick),onKeyDown:M(o,n.buttonHandleKeyDown),onKeyUp:M(i,n.buttonHandleKeyUp),onBlur:M(a,n.buttonHandleBlur)},l=c.disabled?{}:u;return Object(v.a)({type:"button",role:"button","aria-label":s?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l,c)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=V(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(y(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return Object(v.a)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,a=t.onInput;t.onChangeText;var c,s=h(t,Q),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return s.disabled||((c={}).onChange=M(i,a,n.inputHandleChange),c.onKeyDown=M(r,n.inputHandleKeyDown),c.onBlur=M(o,n.inputHandleBlur),u=c),Object(v.a)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},u,s)},n.inputHandleKeyDown=function(e){var t=V(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(y(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,a=void 0===i?"ref":i,c=o.ref,s=h(o,X),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;return n.getMenuProps.called=!0,n.getMenuProps.refKey=a,n.getMenuProps.suppressRefError=l,Object(v.a)(((r={})[a]=A(c,n.menuRef),r.role="listbox",r["aria-labelledby"]=s&&s["aria-label"]?null:n.labelId,r.id=n.menuId,r),s)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,a=r.onClick;r.onPress;var c=r.index,s=r.item,u=void 0===s?void 0:s,l=h(r,J);void 0===c?(n.items.push(u),c=n.items.indexOf(u)):n.items[c]=u;var d=a,p=((t={onMouseMove:M(o,(function(){c!==n.getState().highlightedIndex&&(n.setHighlightedIndex(c,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:M(i,(function(e){e.preventDefault()}))}).onClick=M(d,(function(){n.selectItemAtIndex(c,{type:9})})),t),f=l.disabled?{onMouseDown:p.onMouseDown}:p;return Object(v.a)({id:n.getItemId(c),role:"option","aria-selected":n.getState().highlightedIndex===c},f,l)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.selectedItem;return Object(v.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.isOpen;return Object(v.a)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),x(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=T((function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(v.a)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,$(o,n.props.environment.document)}),200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,a=void 0===i?o:i,c=r.defaultIsOpen,s=r.initialIsOpen,u=void 0===s?c:s,l=r.initialInputValue,d=void 0===l?"":l,p=r.initialSelectedItem,f=void 0===p?null:p,m=n.getState({highlightedIndex:a,isOpen:u,inputValue:d,selectedItem:f});return null!=m.selectedItem&&void 0===n.props.initialInputValue&&(m.inputValue=n.props.itemToString(m.selectedItem)),n.state=m,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,O(t,n);var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},o.getState=function(e){return void 0===e&&(e=this.state),t=e,n=this.props,Object.keys(t).reduce((function(e,r){return e[r]=L(n,r)?n[r]:t[r],e}),{});var t,n},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this,r=this.getItemCount(),o=this.getState().highlightedIndex;if(r>0){var i=F(e,o,r,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(i,t)}},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,a=this.id,c=this.getRootProps,s=this.getToggleButtonProps,u=this.getLabelProps,l=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,m=this.closeMenu,b=this.toggleMenu,g=this.selectItem,h=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,O=this.clearSelection,w=this.clearItems;return{getRootProps:c,getToggleButtonProps:s,getLabelProps:u,getMenuProps:l,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:m,toggleMenu:b,selectItem:g,selectItemAtIndex:h,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:O,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:a,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!q(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},r=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},i=function(t){var n=q(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},a=this.props.environment;a.addEventListener("mousedown",t),a.addEventListener("mouseup",n),a.addEventListener("touchstart",r),a.addEventListener("touchmove",o),a.addEventListener("touchend",i),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),a.removeEventListener("mousedown",t),a.removeEventListener("mouseup",n),a.removeEventListener("touchstart",r),a.removeEventListener("touchmove",o),a.removeEventListener("touchend",i)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){L(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=N(this.props.children,C);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=N(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.type}(t)?Object(w.cloneElement)(t,this.getRootProps(function(e){return e.props}(t))):void 0:null},r}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:D,itemToString:function(e){return null==e?"":String(e)},onStateChange:C,onInputValueChange:C,onUserAction:C,onChange:C,onSelect:C,onOuterClick:C,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:P},e.stateChangeTypes=G,e}();T((function(e,t){$(e(),t)}),200),"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?w.useLayoutEffect:w.useEffect;var ee={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:P,circularNavigation:!1,environment:"undefined"==typeof window?{}:window};m.a.array.isRequired,m.a.func,m.a.func,m.a.func,m.a.bool,m.a.number,m.a.number,m.a.number,m.a.bool,m.a.bool,m.a.bool,m.a.any,m.a.any,m.a.any,m.a.string,m.a.string,m.a.string,m.a.func,m.a.string,m.a.func,m.a.func,m.a.func,m.a.func,m.a.func,m.a.shape({addEventListener:m.a.func,removeEventListener:m.a.func,document:m.a.shape({getElementById:m.a.func,activeElement:m.a.any,body:m.a.any})}),k(k({},ee),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.":"":"No results are available.":""}}),m.a.array.isRequired,m.a.func,m.a.func,m.a.func,m.a.bool,m.a.number,m.a.number,m.a.number,m.a.bool,m.a.bool,m.a.bool,m.a.any,m.a.any,m.a.any,m.a.string,m.a.string,m.a.string,m.a.string,m.a.string,m.a.string,m.a.func,m.a.string,m.a.string,m.a.func,m.a.func,m.a.func,m.a.func,m.a.func,m.a.func,m.a.shape({addEventListener:m.a.func,removeEventListener:m.a.func,document:m.a.shape({getElementById:m.a.func,activeElement:m.a.any,body:m.a.any})}),Object(v.a)({},ee,{getA11yStatusMessage:D,circularNavigation:!0}),m.a.array,m.a.array,m.a.array,m.a.func,m.a.func,m.a.func,m.a.number,m.a.number,m.a.number,m.a.func,m.a.func,m.a.string,m.a.string,m.a.shape({addEventListener:m.a.func,removeEventListener:m.a.func,document:m.a.shape({getElementById:m.a.func,activeElement:m.a.any,body:m.a.any})});var te=e=>{let{checked:t,getInputProps:n,inputRef:r,isDisabled:i,onFocus:a,onRemoveItem:c,placeholder:s,tabIndex:u,value:l}=e;return Object(o.createElement)("input",n({ref:r,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:i,onFocus:a,onKeyDown(e){"Backspace"===e.key&&!l&&t.length>0&&c(t[t.length-1])},placeholder:s,tabIndex:u}))},ne=e=>{let{children:t,onClick:n}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:n},t)},re=e=>{let{checked:t,getItemProps:n,getMenuProps:r,highlightedIndex:a,options:c}=e;return Object(o.createElement)("ul",r({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),c.map((e,r)=>{const c=t.includes(e.value);return Object(o.createElement)("li",n({key:e.value,className:g()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":c,"is-highlighted":a===r}),index:r,item:e.value,"aria-label":c?Object(i.sprintf)(
14
  /* translators: %s is referring to the filter option being removed. */
15
  Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},oe=n(168),ie=e=>{let{onRemoveItem:t,option:n}=e;return Object(o.createElement)(oe.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(n.value)},ariaLabel:Object(i.sprintf)(
16
  /* translators: %s is referring to the filter option being removed. */
20
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
21
  Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),r.name)},Object(o.createElement)(ae.a,{srcElement:ce.a,size:16})))};n(184);var ue=e=>{let{attributeLabel:t="",className:n,checked:r=[],inputLabel:a="",isDisabled:c=!1,isLoading:s=!1,multiple:u=!1,onChange:l=(()=>{}),options:d=[]}=e;const p=Object(o.useRef)(null),f=g()(n,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":c,"is-loading":s}),m=Object(o.useCallback)((e,t)=>{switch(t.type){case Z.stateChangeTypes.keyDownEnter:case Z.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:u,inputValue:""};case Z.stateChangeTypes.blurInput:case Z.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[u]);return Object(o.createElement)(Z,{onChange:l,selectedItem:null,stateReducer:m},e=>{let{getInputProps:n,getItemProps:s,getLabelProps:m,getMenuProps:b,highlightedIndex:h,inputValue:v,isOpen:y,openMenu:O}=e;return Object(o.createElement)("div",{className:g()(f,{"is-multiple":u,"is-single":!u,"has-checked":r.length>0,"is-open":y})},Object(o.createElement)("label",m({className:"screen-reader-text"}),a),Object(o.createElement)(ne,{isOpen:y,onClick:()=>p.current.focus()},r.map(e=>{const t=d.find(t=>t.value===e),n=e=>{l(e),p.current.focus()};return u?Object(o.createElement)(ie,{key:e,onRemoveItem:n,option:t}):Object(o.createElement)(se,{key:e,onClick:()=>p.current.focus(),onRemoveItem:n,option:t})}),Object(o.createElement)(te,{checked:r,getInputProps:n,inputRef:p,isDisabled:c,onFocus:O,onRemoveItem:e=>{l(e),p.current.focus()},placeholder:r.length>0&&u?null:Object(i.sprintf)(
22
  /* translators: %s attribute name. */
23
+ Object(i.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&r.length>0?"-1":"0",value:v})),y&&!c&&Object(o.createElement)(re,{checked:r,getItemProps:s,getMenuProps:b,highlightedIndex:h,options:d.filter(e=>!v||e.value.startsWith(v))}))})},le=n(55),de=n(72),pe=n(11),fe=n.n(pe),me=n(19),be=n(95),ge=n(104),he=n(105);const ve=[{value:"preview-1",name:"Blue",label:Object(o.createElement)(le.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(o.createElement)(le.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(o.createElement)(le.a,{name:"Red",count:2})}],ye={id:0,name:"preview",taxonomy:"preview",label:"Preview"};n(183);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:e=>{let{attributes:t,isEditor:n=!1}=e;const r=t.isPreview&&!t.attributeId?ye:Object(ge.a)(t.attributeId),[f,m]=Object(o.useState)([]),[b,g]=Object(o.useState)(t.isPreview&&!t.attributeId?ve:[]),[h]=Object(u.a)(),[v,y]=Object(u.b)("attributes",[]),{results:O,isLoading:w}=Object(l.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[(null==r?void 0:r.id)||0],shouldSelect:t.attributeId>0}),j="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:E,isLoading:I}=Object(d.a)({queryAttribute:{taxonomy:null==r?void 0:r.taxonomy,queryType:t.queryType},queryState:{...h,attributes:j?h.attributes:null}}),_=Object(o.useCallback)(e=>E.attribute_counts?E.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[E]);Object(o.useEffect)(()=>{if(w||I)return;const e=O.map(e=>{const n=_(e.id);if(!(n||f.includes(e.slug)||(i=e.slug,null!=h&&h.attributes&&h.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===r.taxonomy&&n.includes(i)}))))return null;var i;const a=n?n.count:0;return{value:e.slug,name:Object(me.decodeEntities)(e.name),label:Object(o.createElement)(le.a,{name:Object(me.decodeEntities)(e.name),count:t.showCounts?a:null})}}).filter(Boolean);g(e)},[null==r?void 0:r.taxonomy,O,w,t.showCounts,I,_,f,h.attributes]);const k=Object(o.useCallback)(e=>O.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]),[O]),S=Object(o.useCallback)(e=>{n||Object(he.b)(v,y,r,k(e),"or"===t.queryType?"in":"and")},[n,v,y,r,k,t.queryType]),x=Object(o.useMemo)(()=>v.filter(e=>{let{attribute:t}=e;return t===(null==r?void 0:r.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[v,null==r?void 0:r.taxonomy]),C=Object(c.a)(x),P=Object(s.a)(C);Object(o.useEffect)(()=>{fe()(P,C)||fe()(f,C)||(m(C),t.showFilterButton||S(C))},[f,C,P,S,t.showFilterButton]);const R="dropdown"!==t.displayStyle||"or"===t.queryType,T=Object(o.useCallback)(e=>{const n=e=>{const{name:t}=b.find(t=>t.value===e);return t},r=e=>{let{filterAdded:t,filterRemoved:r}=e;const o=t?n(t):null,c=r?n(r):null;o&&c?Object(a.speak)(Object(i.sprintf)(
24
  /* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
25
  Object(i.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,c)):o?Object(a.speak)(Object(i.sprintf)(
26
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
27
  Object(i.__)("%s filter added.","woo-gutenberg-products-block"),o)):c&&Object(a.speak)(Object(i.sprintf)(
28
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
29
+ Object(i.__)("%s filter removed.","woo-gutenberg-products-block"),c))},o=f.includes(e);let c;R?(c=f.filter(t=>t!==e),o?r({filterRemoved:e}):(c.push(e),c.sort(),r({filterAdded:e}))):(c=o?[]:[e],r({filterAdded:o?null:e,filterRemoved:1===f.length?f[0]:null})),m(c),t.showFilterButton||S(c)},[f,b,R,S,t.showFilterButton]);if(!r)return n?Object(o.createElement)(be.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===b.length&&!w)return n?Object(o.createElement)(be.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const M="h"+t.headingLevel,A=!t.isPreview&&w,D=!t.isPreview&&I;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&b.length>0&&Object(o.createElement)(M,{className:"wc-block-attribute-filter__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(o.createElement)(ue,{attributeLabel:r.label,checked:f,className:"wc-block-attribute-filter-dropdown",inputLabel:t.heading,isLoading:A,multiple:R,onChange:T,options:b}):Object(o.createElement)(p.a,{className:"wc-block-attribute-filter-list",options:b,checked:f,onChange:T,isLoading:A,isDisabled:D}),t.showFilterButton&&Object(o.createElement)(de.a,{className:"wc-block-attribute-filter__button",disabled:A||D,onClick:()=>S(f)})))},getProps:e=>({isEditor:!1,attributes:{attributeId:parseInt(e.dataset.attributeId||0,10),showCounts:"true"===e.dataset.showCounts,queryType:e.dataset.queryType,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3,displayStyle:e.dataset.displayStyle,showFilterButton:"true"===e.dataset.showFilterButton}})})}]);
build/attribute-filter.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', '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'), 'version' => '8066f6a75764536689d28c186d23689b');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', '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'), 'version' => '05ad855e65ab79108c12c9a177bca4cb');
build/attribute-filter.js CHANGED
@@ -1,40 +1,40 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var n,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&d.push(o[l][0]),o[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return r.push.apply(r,i||[]),c()}function c(){for(var e,t=0;t<r.length;t++){for(var c=r[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==o[s]&&(n=!1)}n&&(r.splice(t--,1),e=l(l.s=c[0]))}return e}var n={},o={20:0},r=[];function l(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,l),c.l=!0,c.exports}l.m=e,l.c=n,l.d=function(e,t,c){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},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 c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(c,n,function(t){return e[t]}.bind(null,n));return c},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 r.push([373,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},107:function(e,t,c){"use strict";var n=c(0),o=(c(10),c(7)),r=c(9),l=c(1);c(145),t.a=Object(r.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:r,heading:a,instanceId:s}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(o.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:r}))})},109:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(8);function o(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},115:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(16),o=c(13),r=c(0),l=c(39),a=c(94);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],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 b=Object(r.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),r=[t,c,d,m],l=o.getCollectionError(...r);return l&&p(l),{results:o.getCollection(...r),isLoading:!o.hasFinishedResolution("getCollection",r)}},[t,c,m,d,u]);return null!==g&&(b.current=g),b.current}},12:function(e,t){e.exports=window.wp.blocks},122:function(e,t,c){"use strict";var n=c(0),o=c(18);const r=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("mask",{id:"external-mask",width:"24",height:"24",x:"0",y:"0",maskUnits:"userSpaceOnUse"},Object(n.createElement)("path",{fill:"#fff",d:"M6.3431 6.3431v1.994l7.8984.0072-8.6055 8.6054 1.4142 1.4143 8.6055-8.6055.0071 7.8984h1.994V6.3431H6.3431z"})),Object(n.createElement)("g",{mask:"url(#external-mask)"},Object(n.createElement)("path",{d:"M0 0h24v24H0z"})));t.a=r},13:function(e,t){e.exports=window.wp.data},135:function(e,t,c){"use strict";var n=c(0),o=c(1),r=(c(10),c(4)),l=c.n(r),a=c(30);c(171);const s=e=>{let{className:t,disabled:c,label:
2
  /* translators: Submit button text for filters. */
3
  r=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(n.createElement)("button",{type:"submit",className:l()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:c,onClick:s},Object(n.createElement)(a.a,{label:r,screenReaderLabel:i}))};s.defaultProps={disabled:!1},t.a=s},14:function(e,t){e.exports=window.wp.htmlEntities},145:function(e,t){},146:function(e,t){},16:function(e,t){e.exports=window.wc.wcBlocksData},17:function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"c",(function(){return s})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var n=c(0),o=c(6),r=c(1);const l={clear:Object(r.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(r.__)("No items found.","woo-gutenberg-products-block"),
4
  /* Translators: %s search term */
5
  noResults:Object(r.__)("No results for %s","woo-gutenberg-products-block"),search:Object(r.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(r.sprintf)(
6
  /* translators: Number of items selected from list. */
7
- Object(r._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(r.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),n=Object(o.keyBy)(t,"id"),r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=r(n[e.parent]);return[...t,e.name]},l=e=>e.map(e=>{const t=c[e.id];return delete c[e.id],{...e,breadcrumbs:r(n[e.parent]),children:t&&t.length?l(t):[]}}),a=l(c[0]||[]);return delete c[0],Object(o.forEach)(c,e=>{a.push(...l(e||[]))}),a},s=(e,t,c)=>{if(!t)return c?a(e):e;const n=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!n.test(e.name)&&e).filter(Boolean);return c?a(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(n.createElement)(n.Fragment,{key:c},Object(n.createElement)("strong",null,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()},171:function(e,t){},177:function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return l}));var n=c(2);const o=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const c=(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 c.id&&e.push(c),e},[]),r=e=>{if(e)return o.find(t=>t.id===e)},l=e=>{if(e)return o.find(t=>t.taxonomy===e)}},178:function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return r}));var n=c(6);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const r=e.filter(e=>e.attribute===c.taxonomy),l=r.length?r[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(o)))return;const a=l.slug.filter(e=>e!==o),s=e.filter(e=>e.attribute!==c.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(n.sortBy)(s,"attribute"))},r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const l=e.filter(e=>e.attribute!==c.taxonomy);0===o.length?t(l):(l.push({attribute:c.taxonomy,operator:r,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute")))}},179:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(4),l=c.n(r);c(212),t.a=e=>{let{className:t,onChange:c=(()=>{}),options:r=[],checked:a=[],isLoading:s=!1,isDisabled:i=!1,limit:u=10}=e;const[b,d]=Object(n.useState)(!1),m=Object(n.useMemo)(()=>[...Array(5)].map((e,t)=>Object(n.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),p=Object(n.useMemo)(()=>{const e=r.length-u;return!b&&Object(n.createElement)("li",{key:"show-more",className:"show-more"},Object(n.createElement)("button",{onClick:()=>{d(!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)))},[r,u,b]),g=Object(n.useMemo)(()=>b&&Object(n.createElement)("li",{key:"show-less",className:"show-less"},Object(n.createElement)("button",{onClick:()=>{d(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[b]),O=Object(n.useMemo)(()=>{const e=r.length>u+5;return Object(n.createElement)(n.Fragment,null,r.map((t,o)=>Object(n.createElement)(n.Fragment,{key:t.value},Object(n.createElement)("li",e&&!b&&o>=u&&{hidden:!0},Object(n.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{c(e.target.value)},checked:a.includes(t.value),disabled:i}),Object(n.createElement)("label",{htmlFor:t.value},t.label)),e&&o===u-1&&p)),e&&g)},[r,c,a,b,u,g,p,i]),h=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":s},t);return Object(n.createElement)("ul",{className:h},s?m:O)}},18:function(e,t){e.exports=window.wp.primitives},187:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(4),a=c.n(l),s=c(1),i=c(43),u=c(211);c(146);var b=e=>{let{text:t,screenReaderText:c="",element:n="li",className:l="",radius:s="small",children:i=null,...u}=e;const b=n,d=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+s),m=Boolean(c&&c!==t);return Object(r.createElement)(b,o()({className:d},u),Object(r.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(r.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:d=!1,text:m,screenReaderText:p="",...g}=e;const O=d?"span":"button";if(!t){const e=p&&"string"==typeof p?p:m;t="string"!=typeof e?
12
  /* translators: Remove chip. */
13
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
14
  /* translators: %s text of the chip to remove. */
15
- Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const h={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=d?h:{},w=d?{"aria-hidden":!0}:h;return Object(r.createElement)(b,o()({},g,j,{className:a()(c,"is-removable"),element:d?"button":g.element,screenReaderText:p,text:m}),Object(r.createElement)(O,o()({className:"wc-block-components-chip__remove"},w),Object(r.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",srcElement:u.a,size:16})))}},2:function(e,t){e.exports=window.wc.wcSettings},210:function(e,t){},211:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(18);const a=Object(r.createElement)(e=>{let{className:t,size:c,...n}=e;return Object(r.createElement)(l.SVG,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:c,height:c},n),Object(r.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=a},212:function(e,t){},26:function(e,t){e.exports=window.wp.isShallowEqual},270:function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var n=c(0),o=c(246),r=c(6),l=c(39),a=c(73),s=c(115),i=c(48);const u=e=>{let{queryAttribute:t,queryPrices:c,queryStock:u,queryState:b}=e,d=Object(i.a)();d+="-collection-data";const[m]=Object(a.a)(d),[p,g]=Object(a.b)("calculate_attribute_counts",[],d),[O,h]=Object(a.b)("calculate_price_range",null,d),[j,w]=Object(a.b)("calculate_stock_status_counts",null,d),_=Object(l.a)(t||{}),f=Object(l.a)(c),v=Object(l.a)(u);Object(n.useEffect)(()=>{"object"==typeof _&&Object.keys(_).length&&(p.find(e=>e.taxonomy===_.taxonomy)||g([...p,_]))},[_,p,g]),Object(n.useEffect)(()=>{O!==f&&void 0!==f&&h(f)},[f,h,O]),Object(n.useEffect)(()=>{j!==v&&void 0!==v&&w(v)},[v,w,j]);const[k,E]=Object(n.useState)(!1),[y]=Object(o.a)(k,200);k||E(!0);const C=Object(n.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(r.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:c}=e;return{taxonomy:t,query_type:c}}),["taxonomy","query_type"])),t})(m),[m]);return Object(s.a)({namespace:"/wc/store",resourceName:"products/collection-data",query:{...b,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...C},shouldSelect:y})}},3:function(e,t){e.exports=window.wp.components},30:function(e,t,c){"use strict";var n=c(0),o=c(4),r=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=c,i=null!=o;return!s&&i?(t=l||"span",a={...a,className:r()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,o)):(t=l||n.Fragment,s&&i&&c!==o?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,a,c))}},33:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var n=c(5),o=c.n(n),r=c(0),l=c(17);const a=e=>{let{countLabel:t,className:c,depth:n=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=[c,"woocommerce-search-list__item"];g.push("depth-"+n),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,h=m.name||"search-list-item-"+a,j=`${h}-${s.id}`;return Object(r.createElement)("label",{htmlFor:j,className:g.join(" ")},u?Object(r.createElement)("input",o()({type:"radio",id:j,name:h,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(r.createElement)("input",o()({type:"checkbox",id:j,name:h,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(r.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(r.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(r.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(r.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},373:function(e,t,c){e.exports=c(443)},374:function(e,t,c){"use strict";var n=c(0),o=c(18);const r=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M19 15v4H5v-4h14m1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zM7 18.5c-.82 0-1.5-.67-1.5-1.5s.68-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM19 5v4H5V5h14m1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zM7 8.5c-.82 0-1.5-.67-1.5-1.5S6.18 5.5 7 5.5s1.5.68 1.5 1.5S7.83 8.5 7 8.5z"}));t.a=r},375:function(e,t){},376:function(e,t){},377:function(e,t){},39:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0),o=c(26),r=c.n(o);function l(e){const t=Object(n.useRef)(e);return r()(e,t.current)||(t.current=e),t.current}},43:function(e,t,c){"use strict";var n=c(0);t.a=function(e){let{srcElement:t,size:c=24,...o}=e;return Object(n.isValidElement)(t)?Object(n.cloneElement)(t,{width:c,height:c,...o}):null}},443:function(e,t,c){"use strict";c.r(t);var n=c(5),o=c.n(n),r=c(0),l=c(1),a=c(12),s=c(43),i=c(374),u=c(4),b=c.n(u),d=c(7),m=c(3),p=c(122),g=c(87),O=c(6),h=c(2),j=c(90),w=c(107),_=c(55),f=c(46),v=c(39),k=c(109),E=c(73),y=c(115),C=c(270),x=c(179),S=(c(10),c(156)),N=e=>{let{checked:t,getInputProps:c,inputRef:n,isDisabled:o,onFocus:l,onRemoveItem:a,placeholder:s,tabIndex:i,value:u}=e;return Object(r.createElement)("input",c({ref:n,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:o,onFocus:l,onKeyDown(e){"Backspace"===e.key&&!u&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:i}))},I=e=>{let{children:t,onClick:c}=e;return Object(r.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:c},t)},P=e=>{let{checked:t,getItemProps:c,getMenuProps:n,highlightedIndex:o,options:a}=e;return Object(r.createElement)("ul",n({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),a.map((e,n)=>{const a=t.includes(e.value);return Object(r.createElement)("li",c({key:e.value,className:b()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":a,"is-highlighted":o===n}),index:n,item:e.value,"aria-label":a?Object(l.sprintf)(
16
  /* translators: %s is referring to the filter option being removed. */
17
  Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},R=c(187),L=e=>{let{onRemoveItem:t,option:c}=e;return Object(r.createElement)(R.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(c.value)},ariaLabel:Object(l.sprintf)(
18
  /* translators: %s is referring to the filter option being removed. */
19
- Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name),text:c.label,radius:"large"})},B=c(211),T=e=>{let{onClick:t,onRemoveItem:c,option:n}=e;const o=Object(r.useRef)(null);return Object(r.useEffect)(()=>{o.current.focus()},[o]),Object(r.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(r.createElement)("button",{ref:o,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(n.value)},"aria-label":Object(l.sprintf)(
20
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
21
  Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),n.name)},n.label),Object(r.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{c(n.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c(n.value)},"aria-label":Object(l.sprintf)(
22
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
23
- Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name)},Object(r.createElement)(s.a,{srcElement:B.a,size:16})))};c(377);var F=e=>{let{attributeLabel:t="",className:c,checked:n=[],inputLabel:o="",isDisabled:a=!1,isLoading:s=!1,multiple:i=!1,onChange:u=(()=>{}),options:d=[]}=e;const m=Object(r.useRef)(null),p=b()(c,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":a,"is-loading":s}),g=Object(r.useCallback)((e,t)=>{switch(t.type){case S.a.stateChangeTypes.keyDownEnter:case S.a.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:i,inputValue:""};case S.a.stateChangeTypes.blurInput:case S.a.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[i]);return Object(r.createElement)(S.a,{onChange:u,selectedItem:null,stateReducer:g},e=>{let{getInputProps:c,getItemProps:s,getLabelProps:g,getMenuProps:O,highlightedIndex:h,inputValue:j,isOpen:w,openMenu:_}=e;return Object(r.createElement)("div",{className:b()(p,{"is-multiple":i,"is-single":!i,"has-checked":n.length>0,"is-open":w})},Object(r.createElement)("label",g({className:"screen-reader-text"}),o),Object(r.createElement)(I,{isOpen:w,onClick:()=>m.current.focus()},n.map(e=>{const t=d.find(t=>t.value===e),c=e=>{u(e),m.current.focus()};return i?Object(r.createElement)(L,{key:e,onRemoveItem:c,option:t}):Object(r.createElement)(T,{key:e,onClick:()=>m.current.focus(),onRemoveItem:c,option:t})}),Object(r.createElement)(N,{checked:n,getInputProps:c,inputRef:m,isDisabled:a,onFocus:_,onRemoveItem:e=>{u(e),m.current.focus()},placeholder:n.length>0&&i?null:Object(l.sprintf)(
24
  /* translators: %s attribute name. */
25
- Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!i&&n.length>0?"-1":"0",value:j})),w&&!a&&Object(r.createElement)(P,{checked:n,getItemProps:s,getMenuProps:O,highlightedIndex:h,options:d.filter(e=>!j||e.value.startsWith(j))}))})},M=c(96),V=c(135),A=c(26),H=c.n(A),z=c(14),q=c(177),D=c(178);const G=[{value:"preview-1",name:"Blue",label:Object(r.createElement)(M.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(r.createElement)(M.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(r.createElement)(M.a,{name:"Red",count:2})}],Y={id:0,name:"preview",taxonomy:"preview",label:"Preview"};c(376);var $=e=>{let{attributes:t,isEditor:c=!1}=e;const n=t.isPreview&&!t.attributeId?Y:Object(q.a)(t.attributeId),[o,a]=Object(r.useState)([]),[s,i]=Object(r.useState)(t.isPreview&&!t.attributeId?G:[]),[u]=Object(E.a)(),[b,d]=Object(E.b)("attributes",[]),{results:p,isLoading:g}=Object(y.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[(null==n?void 0:n.id)||0],shouldSelect:t.attributeId>0}),O="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:h,isLoading:j}=Object(C.a)({queryAttribute:{taxonomy:null==n?void 0:n.taxonomy,queryType:t.queryType},queryState:{...u,attributes:O?u.attributes:null}}),w=Object(r.useCallback)(e=>h.attribute_counts?h.attribute_counts.find(t=>{let{term:c}=t;return c===e}):null,[h]);Object(r.useEffect)(()=>{if(g||j)return;const e=p.map(e=>{const c=w(e.id);if(!(c||o.includes(e.slug)||(l=e.slug,null!=u&&u.attributes&&u.attributes.some(e=>{let{attribute:t,slug:c=[]}=e;return t===n.taxonomy&&c.includes(l)}))))return null;var l;const a=c?c.count:0;return{value:e.slug,name:Object(z.decodeEntities)(e.name),label:Object(r.createElement)(M.a,{name:Object(z.decodeEntities)(e.name),count:t.showCounts?a:null})}}).filter(Boolean);i(e)},[null==n?void 0:n.taxonomy,p,g,t.showCounts,j,w,o,u.attributes]);const _=Object(r.useCallback)(e=>p.reduce((t,c)=>(e.includes(c.slug)&&t.push(c),t),[]),[p]),S=Object(r.useCallback)(e=>{c||Object(D.b)(b,d,n,_(e),"or"===t.queryType?"in":"and")},[c,b,d,n,_,t.queryType]),N=Object(r.useMemo)(()=>b.filter(e=>{let{attribute:t}=e;return t===(null==n?void 0:n.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[b,null==n?void 0:n.taxonomy]),I=Object(v.a)(N),P=Object(k.a)(I);Object(r.useEffect)(()=>{H()(P,I)||H()(o,I)||(a(I),t.showFilterButton||S(I))},[o,I,P,S,t.showFilterButton]);const R="dropdown"!==t.displayStyle||"or"===t.queryType,L=Object(r.useCallback)(e=>{const c=e=>{const{name:t}=s.find(t=>t.value===e);return t},n=e=>{let{filterAdded:t,filterRemoved:n}=e;const o=t?c(t):null,r=n?c(n):null;o&&r?Object(f.speak)(Object(l.sprintf)(
26
  /* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
27
  Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,r)):o?Object(f.speak)(Object(l.sprintf)(
28
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
29
  Object(l.__)("%s filter added.","woo-gutenberg-products-block"),o)):r&&Object(f.speak)(Object(l.sprintf)(
30
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
31
- Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),r))},r=o.includes(e);let i;R?(i=o.filter(t=>t!==e),r?n({filterRemoved:e}):(i.push(e),i.sort(),n({filterAdded:e}))):(i=r?[]:[e],n({filterAdded:r?null:e,filterRemoved:1===o.length?o[0]:null})),a(i),t.showFilterButton||S(i)},[o,s,R,S,t.showFilterButton]);if(!n)return c?Object(r.createElement)(m.Notice,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===s.length&&!g)return c?Object(r.createElement)(m.Notice,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(l.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const B="h"+t.headingLevel,T=!t.isPreview&&g,A=!t.isPreview&&j;return Object(r.createElement)(r.Fragment,null,!c&&t.heading&&s.length>0&&Object(r.createElement)(B,{className:"wc-block-attribute-filter__title"},t.heading),Object(r.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(r.createElement)(F,{attributeLabel:n.label,checked:o,className:"wc-block-attribute-filter-dropdown",inputLabel:t.heading,isLoading:T,multiple:R,onChange:L,options:s}):Object(r.createElement)(x.a,{className:"wc-block-attribute-filter-list",options:s,checked:o,onChange:L,isLoading:T,isDisabled:A}),t.showFilterButton&&Object(r.createElement)(V.a,{className:"wc-block-attribute-filter__button",disabled:T||A,onClick:()=>S(o)})))};c(375);const K=Object(h.getSetting)("attributes",[]);var Q=Object(m.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c,debouncedSpeak:n}=e;const{attributeId:o,className:a,displayStyle:u,heading:f,headingLevel:v,isPreview:k,queryType:E,showCounts:y,showFilterButton:C}=t,[x,S]=Object(r.useState)(!o&&!k),N=e=>{if(!e||!e.length)return;const t=e[0].id,n=K.find(e=>e.attribute_id===t.toString());if(!n||o===t)return;const r=n.attribute_label;c({attributeId:t,heading:Object(l.sprintf)(
32
  /* translators: %s attribute name. */
33
  Object(l.__)("Filter by %s","woo-gutenberg-products-block"),r)})},I=e=>{let{isCompact:t}=e;const c={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)(
34
  /* translators: %d is the number of attributes selected. */
35
- 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")},n=Object(O.sortBy)(Object(O.toArray)(Object(O.mapValues)(K,e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label}))),"name");return Object(r.createElement)(g.a,{className:"woocommerce-product-attributes",list:n,selected:n.filter(e=>{let{id:t}=e;return t===o}),onChange:N,messages:c,isSingle:!0,isCompact:t})};return 0===Object.keys(K).length?Object(r.createElement)(m.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(s.a,{srcElement:i.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(r.createElement)(m.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(h.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(r.createElement)(s.a,{srcElement:p.a})),Object(r.createElement)(m.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(r.createElement)(r.Fragment,null,Object(r.createElement)(d.BlockControls,null,Object(r.createElement)(m.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>S(!x),isActive:x}]})),Object(r.createElement)(d.InspectorControls,{key:"inspector"},Object(r.createElement)(m.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(m.ToggleControl,{label:Object(l.__)("Product count","woo-gutenberg-products-block"),help:y?Object(l.__)("Product count is visible.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:y,onChange:()=>c({showCounts:!y})}),Object(r.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(r.createElement)(j.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:v,onChange:e=>c({headingLevel:e})})),Object(r.createElement)(m.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(r.createElement)(_.a,{label:Object(l.__)("Query Type","woo-gutenberg-products-block"),help:"and"===E?Object(l.__)("Products that have all of the selected attributes will be shown.","woo-gutenberg-products-block"):Object(l.__)("Products that have any of the selected attributes will be shown.","woo-gutenberg-products-block"),value:E,options:[{label:Object(l.__)("And","woo-gutenberg-products-block"),value:"and"},{label:Object(l.__)("Or","woo-gutenberg-products-block"),value:"or"}],onChange:e=>c({queryType:e})}),Object(r.createElement)(_.a,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:u,options:[{label:Object(l.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(l.__)("Dropdown","woo-gutenberg-products-block"),value:"dropdown"}],onChange:e=>c({displayStyle:e})}),Object(r.createElement)(m.ToggleControl,{label:Object(l.__)("Filter button","woo-gutenberg-products-block"),help:C?Object(l.__)("Products will only update when the button is pressed.","woo-gutenberg-products-block"):Object(l.__)("Products will update as options are selected.","woo-gutenberg-products-block"),checked:C,onChange:e=>c({showFilterButton:e})})),Object(r.createElement)(m.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),initialOpen:!1},I({isCompact:!0}))),x?Object(r.createElement)(m.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(s.a,{srcElement:i.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("div",{className:"wc-block-attribute-filter__selection"},I({isCompact:!1}),Object(r.createElement)(m.Button,{isPrimary:!0,onClick:()=>{S(!1),n(Object(l.__)("Showing Filter Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)("div",{className:b()(a,"wc-block-attribute-filter")},Object(r.createElement)(w.a,{className:"wc-block-attribute-filter__title",headingLevel:v,heading:f,onChange:e=>c({heading:e})}),Object(r.createElement)(m.Disabled,null,Object(r.createElement)($,{attributes:t,isEditor:!0}))))});Object(a.registerBlockType)("woocommerce/attribute-filter",{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(s.a,{srcElement:i.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(l.__)("Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","woo-gutenberg-products-block"),supports:{html:!1},example:{attributes:{isPreview:!0}},attributes:{attributeId:{type:"number",default:0},showCounts:{type:"boolean",default:!0},queryType:{type:"string",default:"or"},heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3},displayStyle:{type:"string",default:"list"},showFilterButton:{type:"boolean",default:!1},isPreview:{type:"boolean",default:!1}},edit:Q,save(e){let{attributes:t}=e;const{className:c,showCounts:n,queryType:l,attributeId:a,heading:s,headingLevel:i,displayStyle:u,showFilterButton:d}=t,m={"data-attribute-id":a,"data-show-counts":n,"data-query-type":l,"data-heading":s,"data-heading-level":i};return"list"!==u&&(m["data-display-style"]=u),d&&(m["data-show-filter-button"]=d),Object(r.createElement)("div",o()({className:b()("is-loading",c)},m),Object(r.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},46:function(e,t){e.exports=window.wp.a11y},48:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const o=Object(n.createContext)("page"),r=()=>Object(n.useContext)(o);o.Provider},55:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(6),a=c(4),s=c.n(a),i=c(3),u=c(9);c(84);class b extends r.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:n,help:a,options:u,value:b}=this.props,d="inspector-toggle-button-control-"+c;let m;return a&&(m=Object(l.isFunction)(a)?a(t):a),Object(r.createElement)(i.BaseControl,{id:d,help:m,className:s()("components-toggle-button-control",n)},Object(r.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},e),Object(r.createElement)(i.ButtonGroup,{"aria-labelledby":d+"__label"},u.map((t,c)=>{const n={};return b===t.value?(n.isPrimary=!0,n["aria-pressed"]=!0):(n.isSecondary=!0,n["aria-pressed"]=!1),Object(r.createElement)(i.Button,o()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},n),t.label)})))}}t.a=Object(u.withInstanceId)(b)},6:function(e,t){e.exports=window.lodash},7:function(e,t){e.exports=window.wp.blockEditor},73:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return m}));var n=c(16),o=c(13),r=c(0),l=c(26),a=c.n(l),s=c(39),i=c(109),u=c(48);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(r.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,c)=>{const l=Object(u.a)();c=c||l;const a=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(r.useCallback)(t=>{s(c,e,t)},[c,e,s])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,o]=b(t),l=Object(s.a)(n),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(r.useRef)(!1);return Object(r.useEffect)(()=>{a()(m,d)||(o(Object.assign({},l,d)),p.current=!0)},[l,d,m,o]),p.current?[n,o]:[e,o]}},8:function(e,t){e.exports=window.React},84:function(e,t){},87:function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var n=c(5),o=c.n(n),r=c(0),l=c(1),a=c(3),s=c(484),i=c(486),u=c(4),b=c.n(u),d=c(9),m=c(17),p=c(33),g=c(485),O=c(14);const h=e=>{let{id:t,label:c,popoverContents:n,remove:o,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(r.useState)(!1),j=Object(d.useInstanceId)(h);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const w=b()("woocommerce-tag",u,{"has-remove":!!o}),_="woocommerce-tag__label-"+j,f=Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},i),Object(r.createElement)("span",{"aria-hidden":"true"},c));return Object(r.createElement)("span",{className:w},n?Object(r.createElement)(a.Button,{className:"woocommerce-tag__text",id:_,onClick:()=>p(!0)},f):Object(r.createElement)("span",{className:"woocommerce-tag__text",id:_},f),n&&m&&Object(r.createElement)(a.Popover,{onClose:()=>p(!1)},n),o&&Object(r.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(l.sprintf)(// Translators: %s label.
36
  Object(l.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":_},Object(r.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var j=h;const w=e=>Object(r.createElement)(p.b,e),_=e=>{const{list:t,selected:c,renderItem:n,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(r.createElement)(r.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(r.createElement)(r.Fragment,{key:t.id},Object(r.createElement)("li",null,n({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(r.createElement)(_,o()({},e,{list:t.children,depth:l+1})))})):null},f=e=>{let{isLoading:t,isSingle:c,selected:n,messages:o,onChange:s,onRemove:i}=e;if(t||c||!n)return null;const u=n.length;return Object(r.createElement)("div",{className:"woocommerce-search-list__selected"},Object(r.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(r.createElement)("strong",null,o.selected(u)),u>0?Object(r.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":o.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(r.createElement)("ul",null,n.map((e,t)=>Object(r.createElement)("li",{key:t},Object(r.createElement)(j,{label:e.name,id:e.id,remove:i})))):null)},v=e=>{let{filteredList:t,search:c,onSelect:n,instanceId:o,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||w;return 0===t.length?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(r.createElement)(s.a,{icon:i.a})),Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(r.createElement)("ul",{className:"woocommerce-search-list__list"},Object(r.createElement)(_,{list:t,selected:d,renderItem:p,onSelect:n,instanceId:o,isSingle:m,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:n,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:h}=e,[j,w]=Object(r.useState)(""),_=Object(d.useInstanceId)(k),E=Object(r.useMemo)(()=>({...m.a,...u}),[u]),y=Object(r.useMemo)(()=>Object(m.c)(i,j,n),[i,j,n]);Object(r.useEffect)(()=>{h&&h(E.updated)},[h,E]),Object(r.useEffect)(()=>{"function"==typeof g&&g(j)},[j,g]);const C=Object(r.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),x=Object(r.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?p(s?[e]:[...O,e]):C(e.id)()},[s,C,p,O]);return Object(r.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(r.createElement)(f,o()({},e,{onRemove:C,messages:E})),Object(r.createElement)("div",{className:"woocommerce-search-list__search"},Object(r.createElement)(a.TextControl,{label:E.search,type:"search",value:j,onChange:e=>w(e)})),l?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(r.createElement)(a.Spinner,null)):Object(r.createElement)(v,o()({},e,{search:j,filteredList:y,messages:E,onSelect:x,instanceId:_})))};Object(a.withSpokenMessages)(k)},9:function(e,t){e.exports=window.wp.compose},90:function(e,t,c){"use strict";var n=c(0),o=c(6),r=c(1),l=c(3);function a(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(n.createElement)(l.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(l.Path,{d:c[t]})):null}class s extends n.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(n.createElement)(a,{level:e}),title:Object(r.sprintf)(
37
  /* translators: %s: heading level e.g: "2", "3", "4" */
38
- Object(r.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:r,onChange:s}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(a,{level:r}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,r,s))})}}t.a=s},94:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},96:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(30);c(210),t.a=e=>{let{name:t,count:c}=e;return Object(n.createElement)(n.Fragment,null,t,Number.isFinite(c)&&Object(n.createElement)(r.a,{label:c,screenReaderLabel:Object(o.sprintf)(
39
  /* translators: %s number of products. */
40
  Object(o._n)("%s product","%s products",c,"woo-gutenberg-products-block"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var n,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&d.push(o[l][0]),o[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return r.push.apply(r,i||[]),c()}function c(){for(var e,t=0;t<r.length;t++){for(var c=r[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==o[s]&&(n=!1)}n&&(r.splice(t--,1),e=l(l.s=c[0]))}return e}var n={},o={20:0},r=[];function l(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,l),c.l=!0,c.exports}l.m=e,l.c=n,l.d=function(e,t,c){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},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 c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(c,n,function(t){return e[t]}.bind(null,n));return c},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 r.push([374,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},107:function(e,t,c){"use strict";var n=c(0),o=(c(10),c(7)),r=c(9),l=c(1);c(145),t.a=Object(r.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:r,heading:a,instanceId:s}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(o.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:r}))})},109:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(8);function o(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},115:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(16),o=c(13),r=c(0),l=c(39),a=c(94);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],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 b=Object(r.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),r=[t,c,d,m],l=o.getCollectionError(...r);return l&&p(l),{results:o.getCollection(...r),isLoading:!o.hasFinishedResolution("getCollection",r)}},[t,c,m,d,u]);return null!==g&&(b.current=g),b.current}},12:function(e,t){e.exports=window.wp.blocks},122:function(e,t,c){"use strict";var n=c(0),o=c(18);const r=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("mask",{id:"external-mask",width:"24",height:"24",x:"0",y:"0",maskUnits:"userSpaceOnUse"},Object(n.createElement)("path",{fill:"#fff",d:"M6.3431 6.3431v1.994l7.8984.0072-8.6055 8.6054 1.4142 1.4143 8.6055-8.6055.0071 7.8984h1.994V6.3431H6.3431z"})),Object(n.createElement)("g",{mask:"url(#external-mask)"},Object(n.createElement)("path",{d:"M0 0h24v24H0z"})));t.a=r},13:function(e,t){e.exports=window.wp.data},135:function(e,t,c){"use strict";var n=c(0),o=c(1),r=(c(10),c(4)),l=c.n(r),a=c(30);c(171);const s=e=>{let{className:t,disabled:c,label:
2
  /* translators: Submit button text for filters. */
3
  r=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(n.createElement)("button",{type:"submit",className:l()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:c,onClick:s},Object(n.createElement)(a.a,{label:r,screenReaderLabel:i}))};s.defaultProps={disabled:!1},t.a=s},14:function(e,t){e.exports=window.wp.htmlEntities},145:function(e,t){},146:function(e,t){},16:function(e,t){e.exports=window.wc.wcBlocksData},17:function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"c",(function(){return s})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var n=c(0),o=c(6),r=c(1);const l={clear:Object(r.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(r.__)("No items found.","woo-gutenberg-products-block"),
4
  /* Translators: %s search term */
5
  noResults:Object(r.__)("No results for %s","woo-gutenberg-products-block"),search:Object(r.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(r.sprintf)(
6
  /* translators: Number of items selected from list. */
7
+ Object(r._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(r.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),n=Object(o.keyBy)(t,"id"),r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=r(n[e.parent]);return[...t,e.name]},l=e=>e.map(e=>{const t=c[e.id];return delete c[e.id],{...e,breadcrumbs:r(n[e.parent]),children:t&&t.length?l(t):[]}}),a=l(c[0]||[]);return delete c[0],Object(o.forEach)(c,e=>{a.push(...l(e||[]))}),a},s=(e,t,c)=>{if(!t)return c?a(e):e;const n=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!n.test(e.name)&&e).filter(Boolean);return c?a(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(n.createElement)(n.Fragment,{key:c},Object(n.createElement)("strong",null,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()},171:function(e,t){},177:function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return l}));var n=c(2);const o=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const c=(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 c.id&&e.push(c),e},[]),r=e=>{if(e)return o.find(t=>t.id===e)},l=e=>{if(e)return o.find(t=>t.taxonomy===e)}},178:function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return r}));var n=c(6);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const r=e.filter(e=>e.attribute===c.taxonomy),l=r.length?r[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(o)))return;const a=l.slug.filter(e=>e!==o),s=e.filter(e=>e.attribute!==c.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(n.sortBy)(s,"attribute"))},r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const l=e.filter(e=>e.attribute!==c.taxonomy);0===o.length?t(l):(l.push({attribute:c.taxonomy,operator:r,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute")))}},179:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(4),l=c.n(r);c(213),t.a=e=>{let{className:t,onChange:c=(()=>{}),options:r=[],checked:a=[],isLoading:s=!1,isDisabled:i=!1,limit:u=10}=e;const[b,d]=Object(n.useState)(!1),m=Object(n.useMemo)(()=>[...Array(5)].map((e,t)=>Object(n.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),p=Object(n.useMemo)(()=>{const e=r.length-u;return!b&&Object(n.createElement)("li",{key:"show-more",className:"show-more"},Object(n.createElement)("button",{onClick:()=>{d(!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)))},[r,u,b]),g=Object(n.useMemo)(()=>b&&Object(n.createElement)("li",{key:"show-less",className:"show-less"},Object(n.createElement)("button",{onClick:()=>{d(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[b]),O=Object(n.useMemo)(()=>{const e=r.length>u+5;return Object(n.createElement)(n.Fragment,null,r.map((t,o)=>Object(n.createElement)(n.Fragment,{key:t.value},Object(n.createElement)("li",e&&!b&&o>=u&&{hidden:!0},Object(n.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{c(e.target.value)},checked:a.includes(t.value),disabled:i}),Object(n.createElement)("label",{htmlFor:t.value},t.label)),e&&o===u-1&&p)),e&&g)},[r,c,a,b,u,g,p,i]),h=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":s},t);return Object(n.createElement)("ul",{className:h},s?m:O)}},18:function(e,t){e.exports=window.wp.primitives},187:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(4),a=c.n(l),s=c(1),i=c(43),u=c(212);c(146);var b=e=>{let{text:t,screenReaderText:c="",element:n="li",className:l="",radius:s="small",children:i=null,...u}=e;const b=n,d=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+s),m=Boolean(c&&c!==t);return Object(r.createElement)(b,o()({className:d},u),Object(r.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(r.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:d=!1,text:m,screenReaderText:p="",...g}=e;const O=d?"span":"button";if(!t){const e=p&&"string"==typeof p?p:m;t="string"!=typeof e?
12
  /* translators: Remove chip. */
13
  Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
14
  /* translators: %s text of the chip to remove. */
15
+ Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const h={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=d?h:{},w=d?{"aria-hidden":!0}:h;return Object(r.createElement)(b,o()({},g,j,{className:a()(c,"is-removable"),element:d?"button":g.element,screenReaderText:p,text:m}),Object(r.createElement)(O,o()({className:"wc-block-components-chip__remove"},w),Object(r.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",srcElement:u.a,size:16})))}},2:function(e,t){e.exports=window.wc.wcSettings},211:function(e,t){},212:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(18);const a=Object(r.createElement)(e=>{let{className:t,size:c,...n}=e;return Object(r.createElement)(l.SVG,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:c,height:c},n),Object(r.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},null);t.a=a},213:function(e,t){},26:function(e,t){e.exports=window.wp.isShallowEqual},271:function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var n=c(0),o=c(247),r=c(6),l=c(39),a=c(73),s=c(115),i=c(48);const u=e=>{let{queryAttribute:t,queryPrices:c,queryStock:u,queryState:b}=e,d=Object(i.a)();d+="-collection-data";const[m]=Object(a.a)(d),[p,g]=Object(a.b)("calculate_attribute_counts",[],d),[O,h]=Object(a.b)("calculate_price_range",null,d),[j,w]=Object(a.b)("calculate_stock_status_counts",null,d),_=Object(l.a)(t||{}),f=Object(l.a)(c),v=Object(l.a)(u);Object(n.useEffect)(()=>{"object"==typeof _&&Object.keys(_).length&&(p.find(e=>e.taxonomy===_.taxonomy)||g([...p,_]))},[_,p,g]),Object(n.useEffect)(()=>{O!==f&&void 0!==f&&h(f)},[f,h,O]),Object(n.useEffect)(()=>{j!==v&&void 0!==v&&w(v)},[v,w,j]);const[k,E]=Object(n.useState)(!1),[y]=Object(o.a)(k,200);k||E(!0);const C=Object(n.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(r.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:c}=e;return{taxonomy:t,query_type:c}}),["taxonomy","query_type"])),t})(m),[m]);return Object(s.a)({namespace:"/wc/store",resourceName:"products/collection-data",query:{...b,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...C},shouldSelect:y})}},3:function(e,t){e.exports=window.wp.components},30:function(e,t,c){"use strict";var n=c(0),o=c(4),r=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=c,i=null!=o;return!s&&i?(t=l||"span",a={...a,className:r()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,o)):(t=l||n.Fragment,s&&i&&c!==o?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,a,c))}},33:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var n=c(5),o=c.n(n),r=c(0),l=c(17);const a=e=>{let{countLabel:t,className:c,depth:n=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=[c,"woocommerce-search-list__item"];g.push("depth-"+n),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,h=m.name||"search-list-item-"+a,j=`${h}-${s.id}`;return Object(r.createElement)("label",{htmlFor:j,className:g.join(" ")},u?Object(r.createElement)("input",o()({type:"radio",id:j,name:h,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(r.createElement)("input",o()({type:"checkbox",id:j,name:h,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(r.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(r.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(r.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(r.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},374:function(e,t,c){e.exports=c(444)},375:function(e,t,c){"use strict";var n=c(0),o=c(18);const r=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M19 15v4H5v-4h14m1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zM7 18.5c-.82 0-1.5-.67-1.5-1.5s.68-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM19 5v4H5V5h14m1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zM7 8.5c-.82 0-1.5-.67-1.5-1.5S6.18 5.5 7 5.5s1.5.68 1.5 1.5S7.83 8.5 7 8.5z"}));t.a=r},376:function(e,t){},377:function(e,t){},378:function(e,t){},39:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0),o=c(26),r=c.n(o);function l(e){const t=Object(n.useRef)(e);return r()(e,t.current)||(t.current=e),t.current}},43:function(e,t,c){"use strict";var n=c(0);t.a=function(e){let{srcElement:t,size:c=24,...o}=e;return Object(n.isValidElement)(t)?Object(n.cloneElement)(t,{width:c,height:c,...o}):null}},444:function(e,t,c){"use strict";c.r(t);var n=c(5),o=c.n(n),r=c(0),l=c(1),a=c(12),s=c(43),i=c(375),u=c(4),b=c.n(u),d=c(7),m=c(3),p=c(122),g=c(87),O=c(6),h=c(2),j=c(90),w=c(107),_=c(55),f=c(46),v=c(39),k=c(109),E=c(73),y=c(115),C=c(271),x=c(179),S=(c(10),c(156)),N=e=>{let{checked:t,getInputProps:c,inputRef:n,isDisabled:o,onFocus:l,onRemoveItem:a,placeholder:s,tabIndex:i,value:u}=e;return Object(r.createElement)("input",c({ref:n,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:o,onFocus:l,onKeyDown(e){"Backspace"===e.key&&!u&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:i}))},I=e=>{let{children:t,onClick:c}=e;return Object(r.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:c},t)},P=e=>{let{checked:t,getItemProps:c,getMenuProps:n,highlightedIndex:o,options:a}=e;return Object(r.createElement)("ul",n({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),a.map((e,n)=>{const a=t.includes(e.value);return Object(r.createElement)("li",c({key:e.value,className:b()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":a,"is-highlighted":o===n}),index:n,item:e.value,"aria-label":a?Object(l.sprintf)(
16
  /* translators: %s is referring to the filter option being removed. */
17
  Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},R=c(187),L=e=>{let{onRemoveItem:t,option:c}=e;return Object(r.createElement)(R.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(c.value)},ariaLabel:Object(l.sprintf)(
18
  /* translators: %s is referring to the filter option being removed. */
19
+ Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name),text:c.label,radius:"large"})},B=c(212),T=e=>{let{onClick:t,onRemoveItem:c,option:n}=e;const o=Object(r.useRef)(null);return Object(r.useEffect)(()=>{o.current.focus()},[o]),Object(r.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(r.createElement)("button",{ref:o,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(n.value)},"aria-label":Object(l.sprintf)(
20
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
21
  Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),n.name)},n.label),Object(r.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{c(n.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c(n.value)},"aria-label":Object(l.sprintf)(
22
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
23
+ Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name)},Object(r.createElement)(s.a,{srcElement:B.a,size:16})))};c(378);var F=e=>{let{attributeLabel:t="",className:c,checked:n=[],inputLabel:o="",isDisabled:a=!1,isLoading:s=!1,multiple:i=!1,onChange:u=(()=>{}),options:d=[]}=e;const m=Object(r.useRef)(null),p=b()(c,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":a,"is-loading":s}),g=Object(r.useCallback)((e,t)=>{switch(t.type){case S.a.stateChangeTypes.keyDownEnter:case S.a.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:i,inputValue:""};case S.a.stateChangeTypes.blurInput:case S.a.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[i]);return Object(r.createElement)(S.a,{onChange:u,selectedItem:null,stateReducer:g},e=>{let{getInputProps:c,getItemProps:s,getLabelProps:g,getMenuProps:O,highlightedIndex:h,inputValue:j,isOpen:w,openMenu:_}=e;return Object(r.createElement)("div",{className:b()(p,{"is-multiple":i,"is-single":!i,"has-checked":n.length>0,"is-open":w})},Object(r.createElement)("label",g({className:"screen-reader-text"}),o),Object(r.createElement)(I,{isOpen:w,onClick:()=>m.current.focus()},n.map(e=>{const t=d.find(t=>t.value===e),c=e=>{u(e),m.current.focus()};return i?Object(r.createElement)(L,{key:e,onRemoveItem:c,option:t}):Object(r.createElement)(T,{key:e,onClick:()=>m.current.focus(),onRemoveItem:c,option:t})}),Object(r.createElement)(N,{checked:n,getInputProps:c,inputRef:m,isDisabled:a,onFocus:_,onRemoveItem:e=>{u(e),m.current.focus()},placeholder:n.length>0&&i?null:Object(l.sprintf)(
24
  /* translators: %s attribute name. */
25
+ Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!i&&n.length>0?"-1":"0",value:j})),w&&!a&&Object(r.createElement)(P,{checked:n,getItemProps:s,getMenuProps:O,highlightedIndex:h,options:d.filter(e=>!j||e.value.startsWith(j))}))})},M=c(96),V=c(135),A=c(26),H=c.n(A),z=c(14),q=c(177),D=c(178);const G=[{value:"preview-1",name:"Blue",label:Object(r.createElement)(M.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(r.createElement)(M.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(r.createElement)(M.a,{name:"Red",count:2})}],Y={id:0,name:"preview",taxonomy:"preview",label:"Preview"};c(377);var $=e=>{let{attributes:t,isEditor:c=!1}=e;const n=t.isPreview&&!t.attributeId?Y:Object(q.a)(t.attributeId),[o,a]=Object(r.useState)([]),[s,i]=Object(r.useState)(t.isPreview&&!t.attributeId?G:[]),[u]=Object(E.a)(),[b,d]=Object(E.b)("attributes",[]),{results:p,isLoading:g}=Object(y.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[(null==n?void 0:n.id)||0],shouldSelect:t.attributeId>0}),O="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:h,isLoading:j}=Object(C.a)({queryAttribute:{taxonomy:null==n?void 0:n.taxonomy,queryType:t.queryType},queryState:{...u,attributes:O?u.attributes:null}}),w=Object(r.useCallback)(e=>h.attribute_counts?h.attribute_counts.find(t=>{let{term:c}=t;return c===e}):null,[h]);Object(r.useEffect)(()=>{if(g||j)return;const e=p.map(e=>{const c=w(e.id);if(!(c||o.includes(e.slug)||(l=e.slug,null!=u&&u.attributes&&u.attributes.some(e=>{let{attribute:t,slug:c=[]}=e;return t===n.taxonomy&&c.includes(l)}))))return null;var l;const a=c?c.count:0;return{value:e.slug,name:Object(z.decodeEntities)(e.name),label:Object(r.createElement)(M.a,{name:Object(z.decodeEntities)(e.name),count:t.showCounts?a:null})}}).filter(Boolean);i(e)},[null==n?void 0:n.taxonomy,p,g,t.showCounts,j,w,o,u.attributes]);const _=Object(r.useCallback)(e=>p.reduce((t,c)=>(e.includes(c.slug)&&t.push(c),t),[]),[p]),S=Object(r.useCallback)(e=>{c||Object(D.b)(b,d,n,_(e),"or"===t.queryType?"in":"and")},[c,b,d,n,_,t.queryType]),N=Object(r.useMemo)(()=>b.filter(e=>{let{attribute:t}=e;return t===(null==n?void 0:n.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[b,null==n?void 0:n.taxonomy]),I=Object(v.a)(N),P=Object(k.a)(I);Object(r.useEffect)(()=>{H()(P,I)||H()(o,I)||(a(I),t.showFilterButton||S(I))},[o,I,P,S,t.showFilterButton]);const R="dropdown"!==t.displayStyle||"or"===t.queryType,L=Object(r.useCallback)(e=>{const c=e=>{const{name:t}=s.find(t=>t.value===e);return t},n=e=>{let{filterAdded:t,filterRemoved:n}=e;const o=t?c(t):null,r=n?c(n):null;o&&r?Object(f.speak)(Object(l.sprintf)(
26
  /* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
27
  Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,r)):o?Object(f.speak)(Object(l.sprintf)(
28
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
29
  Object(l.__)("%s filter added.","woo-gutenberg-products-block"),o)):r&&Object(f.speak)(Object(l.sprintf)(
30
  /* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
31
+ Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),r))},r=o.includes(e);let i;R?(i=o.filter(t=>t!==e),r?n({filterRemoved:e}):(i.push(e),i.sort(),n({filterAdded:e}))):(i=r?[]:[e],n({filterAdded:r?null:e,filterRemoved:1===o.length?o[0]:null})),a(i),t.showFilterButton||S(i)},[o,s,R,S,t.showFilterButton]);if(!n)return c?Object(r.createElement)(m.Notice,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===s.length&&!g)return c?Object(r.createElement)(m.Notice,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(l.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const B="h"+t.headingLevel,T=!t.isPreview&&g,A=!t.isPreview&&j;return Object(r.createElement)(r.Fragment,null,!c&&t.heading&&s.length>0&&Object(r.createElement)(B,{className:"wc-block-attribute-filter__title"},t.heading),Object(r.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(r.createElement)(F,{attributeLabel:n.label,checked:o,className:"wc-block-attribute-filter-dropdown",inputLabel:t.heading,isLoading:T,multiple:R,onChange:L,options:s}):Object(r.createElement)(x.a,{className:"wc-block-attribute-filter-list",options:s,checked:o,onChange:L,isLoading:T,isDisabled:A}),t.showFilterButton&&Object(r.createElement)(V.a,{className:"wc-block-attribute-filter__button",disabled:T||A,onClick:()=>S(o)})))};c(376);const K=Object(h.getSetting)("attributes",[]);var Q=Object(m.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c,debouncedSpeak:n}=e;const{attributeId:o,className:a,displayStyle:u,heading:f,headingLevel:v,isPreview:k,queryType:E,showCounts:y,showFilterButton:C}=t,[x,S]=Object(r.useState)(!o&&!k),N=e=>{if(!e||!e.length)return;const t=e[0].id,n=K.find(e=>e.attribute_id===t.toString());if(!n||o===t)return;const r=n.attribute_label;c({attributeId:t,heading:Object(l.sprintf)(
32
  /* translators: %s attribute name. */
33
  Object(l.__)("Filter by %s","woo-gutenberg-products-block"),r)})},I=e=>{let{isCompact:t}=e;const c={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)(
34
  /* translators: %d is the number of attributes selected. */
35
+ 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")},n=Object(O.sortBy)(Object(O.toArray)(Object(O.mapValues)(K,e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label}))),"name");return Object(r.createElement)(g.a,{className:"woocommerce-product-attributes",list:n,selected:n.filter(e=>{let{id:t}=e;return t===o}),onChange:N,messages:c,isSingle:!0,isCompact:t})};return 0===Object.keys(K).length?Object(r.createElement)(m.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(s.a,{srcElement:i.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(r.createElement)(m.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(h.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(r.createElement)(s.a,{srcElement:p.a})),Object(r.createElement)(m.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(r.createElement)(r.Fragment,null,Object(r.createElement)(d.BlockControls,null,Object(r.createElement)(m.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>S(!x),isActive:x}]})),Object(r.createElement)(d.InspectorControls,{key:"inspector"},Object(r.createElement)(m.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(m.ToggleControl,{label:Object(l.__)("Product count","woo-gutenberg-products-block"),help:y?Object(l.__)("Product count is visible.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:y,onChange:()=>c({showCounts:!y})}),Object(r.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(r.createElement)(j.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:v,onChange:e=>c({headingLevel:e})})),Object(r.createElement)(m.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(r.createElement)(_.a,{label:Object(l.__)("Query Type","woo-gutenberg-products-block"),help:"and"===E?Object(l.__)("Products that have all of the selected attributes will be shown.","woo-gutenberg-products-block"):Object(l.__)("Products that have any of the selected attributes will be shown.","woo-gutenberg-products-block"),value:E,options:[{label:Object(l.__)("And","woo-gutenberg-products-block"),value:"and"},{label:Object(l.__)("Or","woo-gutenberg-products-block"),value:"or"}],onChange:e=>c({queryType:e})}),Object(r.createElement)(_.a,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:u,options:[{label:Object(l.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(l.__)("Dropdown","woo-gutenberg-products-block"),value:"dropdown"}],onChange:e=>c({displayStyle:e})}),Object(r.createElement)(m.ToggleControl,{label:Object(l.__)("Filter button","woo-gutenberg-products-block"),help:C?Object(l.__)("Products will only update when the button is pressed.","woo-gutenberg-products-block"):Object(l.__)("Products will update as options are selected.","woo-gutenberg-products-block"),checked:C,onChange:e=>c({showFilterButton:e})})),Object(r.createElement)(m.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),initialOpen:!1},I({isCompact:!0}))),x?Object(r.createElement)(m.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(s.a,{srcElement:i.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("div",{className:"wc-block-attribute-filter__selection"},I({isCompact:!1}),Object(r.createElement)(m.Button,{isPrimary:!0,onClick:()=>{S(!1),n(Object(l.__)("Showing Filter Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)("div",{className:b()(a,"wc-block-attribute-filter")},Object(r.createElement)(w.a,{className:"wc-block-attribute-filter__title",headingLevel:v,heading:f,onChange:e=>c({heading:e})}),Object(r.createElement)(m.Disabled,null,Object(r.createElement)($,{attributes:t,isEditor:!0}))))});Object(a.registerBlockType)("woocommerce/attribute-filter",{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(s.a,{srcElement:i.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(l.__)("Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","woo-gutenberg-products-block"),supports:{html:!1},example:{attributes:{isPreview:!0}},attributes:{attributeId:{type:"number",default:0},showCounts:{type:"boolean",default:!0},queryType:{type:"string",default:"or"},heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3},displayStyle:{type:"string",default:"list"},showFilterButton:{type:"boolean",default:!1},isPreview:{type:"boolean",default:!1}},edit:Q,save(e){let{attributes:t}=e;const{className:c,showCounts:n,queryType:l,attributeId:a,heading:s,headingLevel:i,displayStyle:u,showFilterButton:d}=t,m={"data-attribute-id":a,"data-show-counts":n,"data-query-type":l,"data-heading":s,"data-heading-level":i};return"list"!==u&&(m["data-display-style"]=u),d&&(m["data-show-filter-button"]=d),Object(r.createElement)("div",o()({className:b()("is-loading",c)},m),Object(r.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},46:function(e,t){e.exports=window.wp.a11y},48:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const o=Object(n.createContext)("page"),r=()=>Object(n.useContext)(o);o.Provider},55:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(4),a=c.n(l),s=c(3),i=c(9);c(84);class u extends r.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:n,help:l,options:i,value:u}=this.props,b="inspector-toggle-button-control-"+c;let d;return l&&(d="function"==typeof l?l(t):l),Object(r.createElement)(s.BaseControl,{id:b,help:d,className:a()("components-toggle-button-control",n)},Object(r.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},e),Object(r.createElement)(s.ButtonGroup,{"aria-labelledby":b+"__label"},i.map((t,c)=>{const n={};return u===t.value?(n.isPrimary=!0,n["aria-pressed"]=!0):(n.isSecondary=!0,n["aria-pressed"]=!1),Object(r.createElement)(s.Button,o()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},n),t.label)})))}}t.a=Object(i.withInstanceId)(u)},6:function(e,t){e.exports=window.lodash},7:function(e,t){e.exports=window.wp.blockEditor},73:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return m}));var n=c(16),o=c(13),r=c(0),l=c(26),a=c.n(l),s=c(39),i=c(109),u=c(48);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(r.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,c)=>{const l=Object(u.a)();c=c||l;const a=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(r.useCallback)(t=>{s(c,e,t)},[c,e,s])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,o]=b(t),l=Object(s.a)(n),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(r.useRef)(!1);return Object(r.useEffect)(()=>{a()(m,d)||(o(Object.assign({},l,d)),p.current=!0)},[l,d,m,o]),p.current?[n,o]:[e,o]}},8:function(e,t){e.exports=window.React},84:function(e,t){},87:function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var n=c(5),o=c.n(n),r=c(0),l=c(1),a=c(3),s=c(485),i=c(487),u=c(4),b=c.n(u),d=c(9),m=c(17),p=c(33),g=c(486),O=c(14);const h=e=>{let{id:t,label:c,popoverContents:n,remove:o,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(r.useState)(!1),j=Object(d.useInstanceId)(h);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const w=b()("woocommerce-tag",u,{"has-remove":!!o}),_="woocommerce-tag__label-"+j,f=Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},i),Object(r.createElement)("span",{"aria-hidden":"true"},c));return Object(r.createElement)("span",{className:w},n?Object(r.createElement)(a.Button,{className:"woocommerce-tag__text",id:_,onClick:()=>p(!0)},f):Object(r.createElement)("span",{className:"woocommerce-tag__text",id:_},f),n&&m&&Object(r.createElement)(a.Popover,{onClose:()=>p(!1)},n),o&&Object(r.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(l.sprintf)(// Translators: %s label.
36
  Object(l.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":_},Object(r.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var j=h;const w=e=>Object(r.createElement)(p.b,e),_=e=>{const{list:t,selected:c,renderItem:n,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(r.createElement)(r.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(r.createElement)(r.Fragment,{key:t.id},Object(r.createElement)("li",null,n({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(r.createElement)(_,o()({},e,{list:t.children,depth:l+1})))})):null},f=e=>{let{isLoading:t,isSingle:c,selected:n,messages:o,onChange:s,onRemove:i}=e;if(t||c||!n)return null;const u=n.length;return Object(r.createElement)("div",{className:"woocommerce-search-list__selected"},Object(r.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(r.createElement)("strong",null,o.selected(u)),u>0?Object(r.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":o.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(r.createElement)("ul",null,n.map((e,t)=>Object(r.createElement)("li",{key:t},Object(r.createElement)(j,{label:e.name,id:e.id,remove:i})))):null)},v=e=>{let{filteredList:t,search:c,onSelect:n,instanceId:o,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||w;return 0===t.length?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(r.createElement)(s.a,{icon:i.a})),Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(r.createElement)("ul",{className:"woocommerce-search-list__list"},Object(r.createElement)(_,{list:t,selected:d,renderItem:p,onSelect:n,instanceId:o,isSingle:m,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:n,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:h}=e,[j,w]=Object(r.useState)(""),_=Object(d.useInstanceId)(k),E=Object(r.useMemo)(()=>({...m.a,...u}),[u]),y=Object(r.useMemo)(()=>Object(m.c)(i,j,n),[i,j,n]);Object(r.useEffect)(()=>{h&&h(E.updated)},[h,E]),Object(r.useEffect)(()=>{"function"==typeof g&&g(j)},[j,g]);const C=Object(r.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),x=Object(r.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?p(s?[e]:[...O,e]):C(e.id)()},[s,C,p,O]);return Object(r.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(r.createElement)(f,o()({},e,{onRemove:C,messages:E})),Object(r.createElement)("div",{className:"woocommerce-search-list__search"},Object(r.createElement)(a.TextControl,{label:E.search,type:"search",value:j,onChange:e=>w(e)})),l?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(r.createElement)(a.Spinner,null)):Object(r.createElement)(v,o()({},e,{search:j,filteredList:y,messages:E,onSelect:x,instanceId:_})))};Object(a.withSpokenMessages)(k)},9:function(e,t){e.exports=window.wp.compose},90:function(e,t,c){"use strict";var n=c(0),o=c(6),r=c(1),l=c(3);function a(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(n.createElement)(l.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(l.Path,{d:c[t]})):null}class s extends n.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(n.createElement)(a,{level:e}),title:Object(r.sprintf)(
37
  /* translators: %s: heading level e.g: "2", "3", "4" */
38
+ Object(r.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:r,onChange:s}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(a,{level:r}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,r,s))})}}t.a=s},94:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},96:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(30);c(211),t.a=e=>{let{name:t,count:c}=e;return Object(n.createElement)(n.Fragment,null,t,Number.isFinite(c)&&Object(n.createElement)(r.a,{label:c,screenReaderLabel:Object(o.sprintf)(
39
  /* translators: %s number of products. */
40
  Object(o._n)("%s product","%s products",c,"woo-gutenberg-products-block"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}}});
build/cart-blocks/express-payment-frontend.js CHANGED
@@ -2,4 +2,4 @@
2
  /* translators: %s coupon code. */
3
  Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{m({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),b("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&d(Object(c.sprintf)(
4
  /* translators: %s coupon code. */
5
- Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),b("")})},isApplyingCoupon:i,isRemovingCoupon:l}},[n,d])}}},245:function(e,t,n){"use strict";var c=n(10),s=n.n(c),o=n(0),r=n(4),a=n.n(r);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:c=""}=e;return n?Object(o.createElement)("img",{className:i(t),src:n,alt:c}):null},p=n(65);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(35);n(240),t.a=e=>{let{icons:t=[],align:n="center",className:c}=e;const r=(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.d)(n.id)&&!t[n.id]&&(t[n.id]=n)}),Object.values(t)})(t);if(0===r.length)return null;const i=a()("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},c);return Object(o.createElement)("div",{className:i},r.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(o.createElement)(l,s()({key:"payment-method-icon-"+e.id},t))}))}},257:function(e,t){},258:function(e,t,n){"use strict";var c=n(15),s=n.n(c),o=n(0),r=n(1),a=n(3),i=(n(8),n(2)),l=n(92);class p extends a.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(r.__)("This site is experiencing difficulties with this payment method. Please contact the owner of the site for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(r.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const c=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(o.createElement)(l.StoreNoticesContainer,{notices:c})}return this.props.children}}p.defaultProps={isEditor:!1},t.a=p},282:function(e,t){},283:function(e,t,n){"use strict";var c=n(0),s=n(1),o=n(308),r=n(239),a=n(18),i=n(205),l=n(30),p=n.n(l),u=n(258);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(o.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(c.useRef)(l),v=Object(c.useRef)(d),j=Object(c.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),O=Object(c.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),y=Object(c.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(c.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";p()("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?y(e):n("")}),[n,y]),f=Object.entries(h),k=f.length>0?f.map(t=>{let[n,s]=t;const o=e?s.edit:s.content;return Object(c.isValidElement)(o)?Object(c.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(c.cloneElement)(o,{...b,onClick:j(n),onClose:O,onError:y,setExpressPaymentError:E})):null}):Object(c.createElement)("li",{key:"noneRegistered"},Object(s.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(c.createElement)(u.a,{isEditor:e},Object(c.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},k))}},303:function(e,t,n){"use strict";var c=n(0),s=n(24);const o=Object(c.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{fill:"currentColor",d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"}));t.a=o},308:function(e,t,n){"use strict";n.d(t,"a",(function(){return R}));var c=n(1),s=n(40),o=n(0),r=n(4),a=n.n(r),i=n(24),l=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M4 10h3v7H4zM10.5 10h3v7h-3zM2 19h20v3H2zM17 10h3v7h-3zM12 1L2 6v2h20V6z"})),p=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z"})),u=n(303),d=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"}),Object(o.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(o.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"}))),m=n(98),b=n(35);n(257);const h={bank:l,bill:p,card:u.a,checkPayment:d};var g=e=>{let{icon:t="",text:n=""}=e;const c=!!t,s=Object(o.useCallback)(e=>c&&Object(b.d)(e)&&Object(b.e)(h,e),[c]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":c});return Object(o.createElement)("span",{className:r},s(t)?Object(o.createElement)(m.a,{srcElement:h[t]}):t,n)},v=n(245),j=n(2),O=n(30),y=n.n(O),E=n(129),f=n(236),k=n(22),w=n(241),S=n(29),C=n(31),P=n(205),_=n(44),x=n(33);const M=(e,t)=>{const n=[],s=(t,n)=>{const c=n+"_tax",s=Object(b.e)(e,n)&&Object(b.d)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:s,valueWithTax:s+(Object(b.e)(e,c)&&Object(b.d)(e[c])?parseInt(e[c],10):0)}};return n.push(s(Object(c.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(s(Object(c.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(s(Object(c.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(c.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(s(Object(c.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n},R=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(C.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:O,shouldSavePayment:R}=Object(P.b)(),{shippingErrorStatus:I,shippingErrorTypes:z,shippingRates:V,shippingRatesLoading:N,selectedRates:T,setSelectedRates:A,isSelectingRate:H,onShippingRateSuccess:B,onShippingRateFail:D,onShippingRateSelectSuccess:L,onShippingRateSelectFail:F,needsShipping:W}=Object(_.b)(),{billingData:G,shippingAddress:J,setShippingAddress:U}=Object(x.b)(),{cartItems:Y,cartFees:K,cartTotals:X,extensions:q}=Object(k.a)(),{appliedCoupons:Q}=Object(w.a)(),{noticeContexts:Z,responseTypes:$}=Object(S.c)(),ee=Object(o.useRef)(M(X,W)),te=Object(o.useRef)({label:Object(c.__)("Total","woo-gutenberg-products-block"),value:parseInt(X.total_price,10)});Object(o.useEffect)(()=>{ee.current=M(X,W),te.current={label:Object(c.__)("Total","woo-gutenberg-products-block"),value:parseInt(X.total_price,10)}},[X,W]);const ne=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";y()("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"}),O(e)}),[O]);return{activePaymentMethod:b,billing:{appliedCoupons:Q,billingData:G,cartTotal:te.current,cartTotalItems:ee.current,currency:Object(s.getCurrencyFromPriceResponse)(X),customerId:d,displayPricesIncludingTax:Object(j.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:Y,cartFees:K,extensions:q},checkoutStatus:{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r},components:{LoadingMask:E.a,PaymentMethodIcons:v.a,PaymentMethodLabel:g,ValidationInputError:f.a},emitResponse:{noticeContexts:Z,responseTypes:$},eventRegistration:{onCheckoutAfterProcessingWithError:p,onCheckoutAfterProcessingWithSuccess:l,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onPaymentProcessing:h,onShippingRateFail:D,onShippingRateSelectFail:F,onShippingRateSelectSuccess:L,onShippingRateSuccess:B},onSubmit:u,paymentStatus:m,setExpressPaymentError:ne,shippingData:{isSelectingRate:H,needsShipping:W,selectedRates:T,setSelectedRates:A,setShippingAddress:U,shippingAddress:J,shippingRates:V,shippingRatesLoading:N},shippingStatus:{shippingErrorStatus:I,shippingErrorTypes:z},shouldSavePayment:R}}},400:function(e,t,n){"use strict";n.r(t);var c=n(0),s=n(22),o=n(4),r=n.n(o),a=n(1),i=n(239),l=n(29),p=n(31),u=n(205),d=n(87),m=n(129),b=n(283);n(282);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.c)(),{isCalculating:s,isProcessing:o,isAfterProcessing:r,isBeforeProcessing:h,isComplete:g,hasError:v}=Object(p.b)(),{currentStatus:j}=Object(u.b)();if(!t||t&&0===Object.keys(e).length)return null;const O=o||r||h||g&&!v;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(m.a,{isLoading:s||O||j.isDoingExpressPayment},Object(c.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},Object(c.createElement)("div",{className:"wc-block-components-express-payment__content"},Object(c.createElement)(d.a,{context:n.EXPRESS_PAYMENTS},Object(c.createElement)(b.a,null))))),Object(c.createElement)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart"},Object(a.__)("Or","woo-gutenberg-products-block")))};t.default=e=>{let{className:t}=e;const{cartNeedsPayment:n}=Object(s.a)();return n?Object(c.createElement)("div",{className:r()("wc-block-cart__payment-options",t)},Object(c.createElement)(h,null)):null}},92:function(e,t,n){},98:function(e,t,n){"use strict";var c=n(0);t.a=function(e){let{srcElement:t,size:n=24,...s}=e;return Object(c.isValidElement)(t)?Object(c.cloneElement)(t,{width:n,height:n,...s}):null}}}]);
2
  /* translators: %s coupon code. */
3
  Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{m({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),b("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&d(Object(c.sprintf)(
4
  /* translators: %s coupon code. */
5
+ Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),b("")})},isApplyingCoupon:i,isRemovingCoupon:l}},[n,d])}}},245:function(e,t,n){"use strict";var c=n(10),s=n.n(c),o=n(0),r=n(4),a=n.n(r);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:c=""}=e;return n?Object(o.createElement)("img",{className:i(t),src:n,alt:c}):null},p=n(65);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(35);n(240),t.a=e=>{let{icons:t=[],align:n="center",className:c}=e;const r=(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.d)(n.id)&&!t[n.id]&&(t[n.id]=n)}),Object.values(t)})(t);if(0===r.length)return null;const i=a()("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},c);return Object(o.createElement)("div",{className:i},r.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(o.createElement)(l,s()({key:"payment-method-icon-"+e.id},t))}))}},257:function(e,t){},258:function(e,t,n){"use strict";var c=n(16),s=n.n(c),o=n(0),r=n(1),a=n(3),i=(n(8),n(2)),l=n(92);class p extends a.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(r.__)("This site is experiencing difficulties with this payment method. Please contact the owner of the site for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(r.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const c=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(o.createElement)(l.StoreNoticesContainer,{notices:c})}return this.props.children}}p.defaultProps={isEditor:!1},t.a=p},282:function(e,t){},283:function(e,t,n){"use strict";var c=n(0),s=n(1),o=n(308),r=n(239),a=n(18),i=n(205),l=n(30),p=n.n(l),u=n(258);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(o.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(c.useRef)(l),v=Object(c.useRef)(d),j=Object(c.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),O=Object(c.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),y=Object(c.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(c.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";p()("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?y(e):n("")}),[n,y]),f=Object.entries(h),k=f.length>0?f.map(t=>{let[n,s]=t;const o=e?s.edit:s.content;return Object(c.isValidElement)(o)?Object(c.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(c.cloneElement)(o,{...b,onClick:j(n),onClose:O,onError:y,setExpressPaymentError:E})):null}):Object(c.createElement)("li",{key:"noneRegistered"},Object(s.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(c.createElement)(u.a,{isEditor:e},Object(c.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},k))}},303:function(e,t,n){"use strict";var c=n(0),s=n(24);const o=Object(c.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{fill:"currentColor",d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"}));t.a=o},308:function(e,t,n){"use strict";n.d(t,"a",(function(){return R}));var c=n(1),s=n(40),o=n(0),r=n(4),a=n.n(r),i=n(24),l=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M4 10h3v7H4zM10.5 10h3v7h-3zM2 19h20v3H2zM17 10h3v7h-3zM12 1L2 6v2h20V6z"})),p=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(o.createElement)("path",{d:"M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z"})),u=n(303),d=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"}),Object(o.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(o.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"}))),m=n(98),b=n(35);n(257);const h={bank:l,bill:p,card:u.a,checkPayment:d};var g=e=>{let{icon:t="",text:n=""}=e;const c=!!t,s=Object(o.useCallback)(e=>c&&Object(b.d)(e)&&Object(b.e)(h,e),[c]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":c});return Object(o.createElement)("span",{className:r},s(t)?Object(o.createElement)(m.a,{srcElement:h[t]}):t,n)},v=n(245),j=n(2),O=n(30),y=n.n(O),E=n(129),f=n(236),k=n(22),w=n(241),S=n(29),C=n(31),P=n(205),_=n(44),x=n(33);const M=(e,t)=>{const n=[],s=(t,n)=>{const c=n+"_tax",s=Object(b.e)(e,n)&&Object(b.d)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:s,valueWithTax:s+(Object(b.e)(e,c)&&Object(b.d)(e[c])?parseInt(e[c],10):0)}};return n.push(s(Object(c.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(s(Object(c.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(s(Object(c.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(c.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(s(Object(c.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n},R=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(C.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:O,shouldSavePayment:R}=Object(P.b)(),{shippingErrorStatus:I,shippingErrorTypes:z,shippingRates:V,shippingRatesLoading:N,selectedRates:T,setSelectedRates:A,isSelectingRate:H,onShippingRateSuccess:B,onShippingRateFail:D,onShippingRateSelectSuccess:L,onShippingRateSelectFail:F,needsShipping:W}=Object(_.b)(),{billingData:G,shippingAddress:J,setShippingAddress:U}=Object(x.b)(),{cartItems:Y,cartFees:K,cartTotals:X,extensions:q}=Object(k.a)(),{appliedCoupons:Q}=Object(w.a)(),{noticeContexts:Z,responseTypes:$}=Object(S.c)(),ee=Object(o.useRef)(M(X,W)),te=Object(o.useRef)({label:Object(c.__)("Total","woo-gutenberg-products-block"),value:parseInt(X.total_price,10)});Object(o.useEffect)(()=>{ee.current=M(X,W),te.current={label:Object(c.__)("Total","woo-gutenberg-products-block"),value:parseInt(X.total_price,10)}},[X,W]);const ne=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";y()("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"}),O(e)}),[O]);return{activePaymentMethod:b,billing:{appliedCoupons:Q,billingData:G,cartTotal:te.current,cartTotalItems:ee.current,currency:Object(s.getCurrencyFromPriceResponse)(X),customerId:d,displayPricesIncludingTax:Object(j.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:Y,cartFees:K,extensions:q},checkoutStatus:{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r},components:{LoadingMask:E.a,PaymentMethodIcons:v.a,PaymentMethodLabel:g,ValidationInputError:f.a},emitResponse:{noticeContexts:Z,responseTypes:$},eventRegistration:{onCheckoutAfterProcessingWithError:p,onCheckoutAfterProcessingWithSuccess:l,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onPaymentProcessing:h,onShippingRateFail:D,onShippingRateSelectFail:F,onShippingRateSelectSuccess:L,onShippingRateSuccess:B},onSubmit:u,paymentStatus:m,setExpressPaymentError:ne,shippingData:{isSelectingRate:H,needsShipping:W,selectedRates:T,setSelectedRates:A,setShippingAddress:U,shippingAddress:J,shippingRates:V,shippingRatesLoading:N},shippingStatus:{shippingErrorStatus:I,shippingErrorTypes:z},shouldSavePayment:R}}},400:function(e,t,n){"use strict";n.r(t);var c=n(0),s=n(22),o=n(4),r=n.n(o),a=n(1),i=n(239),l=n(29),p=n(31),u=n(205),d=n(87),m=n(129),b=n(283);n(282);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.c)(),{isCalculating:s,isProcessing:o,isAfterProcessing:r,isBeforeProcessing:h,isComplete:g,hasError:v}=Object(p.b)(),{currentStatus:j}=Object(u.b)();if(!t||t&&0===Object.keys(e).length)return null;const O=o||r||h||g&&!v;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(m.a,{isLoading:s||O||j.isDoingExpressPayment},Object(c.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},Object(c.createElement)("div",{className:"wc-block-components-express-payment__content"},Object(c.createElement)(d.a,{context:n.EXPRESS_PAYMENTS},Object(c.createElement)(b.a,null))))),Object(c.createElement)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart"},Object(a.__)("Or","woo-gutenberg-products-block")))};t.default=e=>{let{className:t}=e;const{cartNeedsPayment:n}=Object(s.a)();return n?Object(c.createElement)("div",{className:r()("wc-block-cart__payment-options",t)},Object(c.createElement)(h,null)):null}},92:function(e,t,n){},98:function(e,t,n){"use strict";var c=n(0);t.a=function(e){let{srcElement:t,size:n=24,...s}=e;return Object(c.isValidElement)(t)?Object(c.cloneElement)(t,{width:n,height:n,...s}):null}}}]);
build/cart-blocks/line-items-frontend.js CHANGED
@@ -8,8 +8,8 @@ Object(o.__)("Quantity of %s in your cart.","woo-gutenberg-products-block"),p)})
8
  /* translators: %s refers to the item name in the cart. */
9
  Object(o.__)("Quantity reduced to %s.","woo-gutenberg-products-block"),e)),f(e)}},"-"),Object(r.createElement)("button",{"aria-label":Object(o.__)("Increase quantity","woo-gutenberg-products-block"),disabled:d||!y,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=c+b;m(e),Object(i.speak)(Object(o.sprintf)(
10
  /* translators: %s refers to the item name in the cart. */
11
- Object(o.__)("Quantity increased to %s.","woo-gutenberg-products-block"),e)),f(e)}},"+"))},b=c(247),p=c(249),d=c(9),O=c(6),j=c(94),_=c(62),y=c(67),f=c(35),g=c(31);var k=c(38),E=c(299),v=c(300),w=c(301),N=c(96),h=c(244),C=e=>{let{currency:t,saleAmount:c,format:a="<price/>"}=e;if(!c||c<=0)return null;a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const n=Object(o.sprintf)(
12
  /* translators: %s will be replaced by the discount amount */
13
- Object(o.__)("Save %s","woo-gutenberg-products-block"),a);return Object(r.createElement)(h.a,{className:"wc-block-components-sale-badge"},Object(r.createInterpolateElement)(n,{price:Object(r.createElement)(N.a,{currency:t,value:c})}))},x=c(310),I=c(40),P=c(13),S=c(298),q=c(2);const D=(e,t)=>e.convertPrecision(t.minorUnit).getAmount(),A=e=>Object(P.mustContain)(e,"<price/>");var R=Object(r.forwardRef)((e,t)=>{let{lineItem:c,onRemove:n=(()=>{}),tabIndex:s=null}=e;const{name:u="",catalog_visibility:N="visible",short_description:h="",description:R="",low_stock_remaining:T=null,show_backorder_badge:F=!1,quantity_limits:L={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:M=!1,permalink:U="",images:Q=[],variation:V=[],item_data:$=[],prices:H={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",price:"0",regular_price:"0",sale_price:"0",price_range:null,raw_prices:{precision:6,price:"0",regular_price:"0",sale_price:"0"}},totals:B={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",line_subtotal:"0",line_subtotal_tax:"0"},extensions:K}=c,{quantity:W,setItemQuantity:J,removeItem:Y,isPendingDelete:z}=(e=>{const t={key:"",quantity:1};(e=>Object(f.c)(e)&&Object(f.e)(e,"key")&&Object(f.e)(e,"quantity")&&Object(f.d)(e.key)&&Object(f.b)(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:c="",quantity:n=1}=t,{cartErrors:l}=Object(a.a)(),{dispatchActions:o}=Object(g.b)(),[i,s]=Object(r.useState)(n),[u]=Object(j.a)(i,400),m=Object(_.a)(u),{removeItemFromCart:b,changeCartItemQuantity:p}=Object(d.useDispatch)(O.CART_STORE_KEY);Object(r.useEffect)(()=>s(n),[n]);const k=Object(d.useSelect)(e=>{if(!c)return{quantity:!1,delete:!1};const t=e(O.CART_STORE_KEY);return{quantity:t.isItemPendingQuantity(c),delete:t.isItemPendingDelete(c)}},[c]),E=Object(r.useCallback)(()=>c?b(c).then(()=>(Object(y.c)(),!0)):Promise.resolve(!1),[c,b]);return Object(r.useEffect)(()=>{c&&Object(f.b)(m)&&Number.isFinite(m)&&m!==u&&p(c,u)},[c,p,u,m]),Object(r.useEffect)(()=>(k.delete?o.incrementCalculating():o.decrementCalculating(),()=>{k.delete&&o.decrementCalculating()}),[o,k.delete]),Object(r.useEffect)(()=>(k.quantity||u!==i?o.incrementCalculating():o.decrementCalculating(),()=>{(k.quantity||u!==i)&&o.decrementCalculating()}),[o,k.quantity,u,i]),{isPendingDelete:k.delete,quantity:i,setItemQuantity:s,removeItem:E,cartItemQuantityErrors:l}})(c),{dispatchStoreEvent:G}=Object(k.a)(),{receiveCart:X,...Z}=Object(a.a)(),ee=Object(r.useMemo)(()=>({context:"cart",cartItem:c,cart:Z}),[c,Z]),te=Object(I.getCurrencyFromPriceResponse)(H),ce=Object(P.__experimentalApplyCheckoutFilter)({filterName:"itemName",defaultValue:u,extensions:K,arg:ee}),re=Object(S.a)({amount:parseInt(H.raw_prices.regular_price,10),precision:H.raw_prices.precision}),ae=Object(S.a)({amount:parseInt(H.raw_prices.price,10),precision:H.raw_prices.precision}),ne=re.subtract(ae),le=ne.multiply(W),oe=Object(I.getCurrencyFromPriceResponse)(B);let ie=parseInt(B.line_subtotal,10);Object(q.getSetting)("displayCartPricesIncludingTax",!1)&&(ie+=parseInt(B.line_subtotal_tax,10));const se=Object(S.a)({amount:ie,precision:oe.minorUnit}),ue=Q.length?Q[0]:{},me="hidden"===N||"search"===N,be=Object(P.__experimentalApplyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:K,arg:ee}),pe=Object(P.__experimentalApplyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:K,arg:ee,validation:A}),de=Object(P.__experimentalApplyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:K,arg:ee,validation:A}),Oe=Object(P.__experimentalApplyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:K,arg:ee,validation:A});return Object(r.createElement)("tr",{className:l()("wc-block-cart-items__row",be,{"is-disabled":z}),ref:t,tabIndex:s},Object(r.createElement)("td",{className:"wc-block-cart-item__image","aria-hidden":!Object(f.e)(ue,"alt")||!ue.alt},me?Object(r.createElement)(E.a,{image:ue,fallbackAlt:ce}):Object(r.createElement)("a",{href:U,tabIndex:-1},Object(r.createElement)(E.a,{image:ue,fallbackAlt:ce}))),Object(r.createElement)("td",{className:"wc-block-cart-item__product"},Object(r.createElement)(p.a,{disabled:z||me,name:ce,permalink:U}),F?Object(r.createElement)(v.a,null):!!T&&Object(r.createElement)(w.a,{lowStockRemaining:T}),Object(r.createElement)("div",{className:"wc-block-cart-item__prices"},Object(r.createElement)(b.a,{currency:te,regularPrice:D(re,te),price:D(ae,te),format:de})),Object(r.createElement)(C,{currency:te,saleAmount:D(ne,te),format:Oe}),Object(r.createElement)(x.a,{shortDescription:h,fullDescription:R,itemData:$,variation:V}),Object(r.createElement)("div",{className:"wc-block-cart-item__quantity"},!M&&!!L.editable&&Object(r.createElement)(m,{disabled:z,quantity:W,minimum:L.minimum,maximum:L.maximum,step:L.multiple_of,onChange:e=>{J(e),G("cart-set-item-quantity",{product:c,quantity:e})},itemName:ce}),Object(r.createElement)("button",{className:"wc-block-cart-item__remove-link",onClick:()=>{n(),Y(),G("cart-remove-item",{product:c,quantity:W}),Object(i.speak)(Object(o.sprintf)(
14
  /* translators: %s refers to the item name in the cart. */
15
- Object(o.__)("%s has been removed from your cart.","woo-gutenberg-products-block"),ce))},disabled:z},Object(o.__)("Remove item","woo-gutenberg-products-block")))),Object(r.createElement)("td",{className:"wc-block-cart-item__total"},Object(r.createElement)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper"},Object(r.createElement)(b.a,{currency:oe,format:pe,price:se.getAmount()}),W>1&&Object(r.createElement)(C,{currency:te,saleAmount:D(le,te),format:Oe}))))});const T=[...Array(3)].map((_x,e)=>Object(r.createElement)(R,{lineItem:{},key:e})),F=e=>{const t={};return e.forEach(e=>{let{key:c}=e;t[c]=Object(r.createRef)()}),t};var L=e=>{let{lineItems:t=[],isLoading:c=!1,className:a}=e;const n=Object(r.useRef)(null),i=Object(r.useRef)(F(t));Object(r.useEffect)(()=>{i.current=F(t)},[t]);const s=e=>()=>{null!=i&&i.current&&e&&i.current[e].current instanceof HTMLElement?i.current[e].current.focus():n.current instanceof HTMLElement&&n.current.focus()},u=c?T:t.map((e,c)=>{const a=t.length>c+1?t[c+1].key:null;return Object(r.createElement)(R,{key:e.key,lineItem:e,onRemove:s(a),ref:i.current[e.key],tabIndex:-1})});return Object(r.createElement)("table",{className:l()("wc-block-cart-items",a),ref:n,tabIndex:-1},Object(r.createElement)("thead",null,Object(r.createElement)("tr",{className:"wc-block-cart-items__header"},Object(r.createElement)("th",{className:"wc-block-cart-items__header-image"},Object(r.createElement)("span",null,Object(o.__)("Product","woo-gutenberg-products-block"))),Object(r.createElement)("th",{className:"wc-block-cart-items__header-product"},Object(r.createElement)("span",null,Object(o.__)("Details","woo-gutenberg-products-block"))),Object(r.createElement)("th",{className:"wc-block-cart-items__header-total"},Object(r.createElement)("span",null,Object(o.__)("Total","woo-gutenberg-products-block"))))),Object(r.createElement)("tbody",null,u))};t.default=e=>{let{className:t}=e;const{cartItems:c,cartIsLoading:n}=Object(a.a)();return Object(r.createElement)(L,{className:t,lineItems:c,isLoading:n})}},94:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(3),a=c(52);function n(e,t){return e===t}function l(e){return"function"==typeof e?function(){return e}:e}function o(e,t,c){var o=c&&c.equalityFn||n,i=function(e){var t=Object(r.useState)(l(e)),c=t[0],a=t[1];return[c,Object(r.useCallback)((function(e){return a(l(e))}),[])]}(e),s=i[0],u=i[1],m=Object(a.a)(Object(r.useCallback)((function(e){return u(e)}),[u]),t,c),b=Object(r.useRef)(e);return o(b.current,e)||(m(e),b.current=e),[s,m]}},96:function(e,t,c){"use strict";var r=c(10),a=c.n(r),n=c(0),l=c(131),o=c(4),i=c.n(o);c(159);const s=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:o,displayType:u="text",...m}=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 d=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),O={...m,...s(r),value:void 0,currency:void 0,onValueChange:void 0},j=o?e=>{const t=+e.value*10**r.minorUnit;o(t)}:()=>{};return Object(n.createElement)(l.a,a()({className:d,displayType:u},O,{value:p,onValueChange:j}))}}}]);
8
  /* translators: %s refers to the item name in the cart. */
9
  Object(o.__)("Quantity reduced to %s.","woo-gutenberg-products-block"),e)),f(e)}},"-"),Object(r.createElement)("button",{"aria-label":Object(o.__)("Increase quantity","woo-gutenberg-products-block"),disabled:d||!y,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=c+b;m(e),Object(i.speak)(Object(o.sprintf)(
10
  /* translators: %s refers to the item name in the cart. */
11
+ Object(o.__)("Quantity increased to %s.","woo-gutenberg-products-block"),e)),f(e)}},"+"))},b=c(247),p=c(249),d=c(9),O=c(6),j=c(94),_=c(62),y=c(67),f=c(35),g=c(31);var k=c(38),E=c(299),w=c(300),v=c(301),N=c(96),h=c(244),C=e=>{let{currency:t,saleAmount:c,format:a="<price/>"}=e;if(!c||c<=0)return null;a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const n=Object(o.sprintf)(
12
  /* translators: %s will be replaced by the discount amount */
13
+ Object(o.__)("Save %s","woo-gutenberg-products-block"),a);return Object(r.createElement)(h.a,{className:"wc-block-components-sale-badge"},Object(r.createInterpolateElement)(n,{price:Object(r.createElement)(N.a,{currency:t,value:c})}))},x=c(310),I=c(40),P=c(14),S=c(298),q=c(2);const D=(e,t)=>e.convertPrecision(t.minorUnit).getAmount(),A=e=>Object(P.mustContain)(e,"<price/>");var R=Object(r.forwardRef)((e,t)=>{let{lineItem:c,onRemove:n=(()=>{}),tabIndex:s=null}=e;const{name:u="",catalog_visibility:N="visible",short_description:h="",description:R="",low_stock_remaining:T=null,show_backorder_badge:F=!1,quantity_limits:L={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:M=!1,permalink:U="",images:Q=[],variation:V=[],item_data:$=[],prices:H={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",price:"0",regular_price:"0",sale_price:"0",price_range:null,raw_prices:{precision:6,price:"0",regular_price:"0",sale_price:"0"}},totals:B={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",line_subtotal:"0",line_subtotal_tax:"0"},extensions:K}=c,{quantity:W,setItemQuantity:J,removeItem:Y,isPendingDelete:z}=(e=>{const t={key:"",quantity:1};(e=>Object(f.c)(e)&&Object(f.e)(e,"key")&&Object(f.e)(e,"quantity")&&Object(f.d)(e.key)&&Object(f.b)(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:c="",quantity:n=1}=t,{cartErrors:l}=Object(a.a)(),{dispatchActions:o}=Object(g.b)(),[i,s]=Object(r.useState)(n),[u]=Object(j.a)(i,400),m=Object(_.a)(u),{removeItemFromCart:b,changeCartItemQuantity:p}=Object(d.useDispatch)(O.CART_STORE_KEY);Object(r.useEffect)(()=>s(n),[n]);const k=Object(d.useSelect)(e=>{if(!c)return{quantity:!1,delete:!1};const t=e(O.CART_STORE_KEY);return{quantity:t.isItemPendingQuantity(c),delete:t.isItemPendingDelete(c)}},[c]),E=Object(r.useCallback)(()=>c?b(c).then(()=>(Object(y.c)(),!0)):Promise.resolve(!1),[c,b]);return Object(r.useEffect)(()=>{c&&Object(f.b)(m)&&Number.isFinite(m)&&m!==u&&p(c,u)},[c,p,u,m]),Object(r.useEffect)(()=>(k.delete?o.incrementCalculating():o.decrementCalculating(),()=>{k.delete&&o.decrementCalculating()}),[o,k.delete]),Object(r.useEffect)(()=>(k.quantity||u!==i?o.incrementCalculating():o.decrementCalculating(),()=>{(k.quantity||u!==i)&&o.decrementCalculating()}),[o,k.quantity,u,i]),{isPendingDelete:k.delete,quantity:i,setItemQuantity:s,removeItem:E,cartItemQuantityErrors:l}})(c),{dispatchStoreEvent:G}=Object(k.a)(),{receiveCart:X,...Z}=Object(a.a)(),ee=Object(r.useMemo)(()=>({context:"cart",cartItem:c,cart:Z}),[c,Z]),te=Object(I.getCurrencyFromPriceResponse)(H),ce=Object(P.__experimentalApplyCheckoutFilter)({filterName:"itemName",defaultValue:u,extensions:K,arg:ee}),re=Object(S.a)({amount:parseInt(H.raw_prices.regular_price,10),precision:H.raw_prices.precision}),ae=Object(S.a)({amount:parseInt(H.raw_prices.price,10),precision:H.raw_prices.precision}),ne=re.subtract(ae),le=ne.multiply(W),oe=Object(I.getCurrencyFromPriceResponse)(B);let ie=parseInt(B.line_subtotal,10);Object(q.getSetting)("displayCartPricesIncludingTax",!1)&&(ie+=parseInt(B.line_subtotal_tax,10));const se=Object(S.a)({amount:ie,precision:oe.minorUnit}),ue=Q.length?Q[0]:{},me="hidden"===N||"search"===N,be=Object(P.__experimentalApplyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:K,arg:ee}),pe=Object(P.__experimentalApplyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:K,arg:ee,validation:A}),de=Object(P.__experimentalApplyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:K,arg:ee,validation:A}),Oe=Object(P.__experimentalApplyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:K,arg:ee,validation:A});return Object(r.createElement)("tr",{className:l()("wc-block-cart-items__row",be,{"is-disabled":z}),ref:t,tabIndex:s},Object(r.createElement)("td",{className:"wc-block-cart-item__image","aria-hidden":!Object(f.e)(ue,"alt")||!ue.alt},me?Object(r.createElement)(E.a,{image:ue,fallbackAlt:ce}):Object(r.createElement)("a",{href:U,tabIndex:-1},Object(r.createElement)(E.a,{image:ue,fallbackAlt:ce}))),Object(r.createElement)("td",{className:"wc-block-cart-item__product"},Object(r.createElement)("div",{className:"wc-block-cart-item__wrap"},Object(r.createElement)(p.a,{disabled:z||me,name:ce,permalink:U}),F?Object(r.createElement)(w.a,null):!!T&&Object(r.createElement)(v.a,{lowStockRemaining:T}),Object(r.createElement)("div",{className:"wc-block-cart-item__prices"},Object(r.createElement)(b.a,{currency:te,regularPrice:D(re,te),price:D(ae,te),format:de})),Object(r.createElement)(C,{currency:te,saleAmount:D(ne,te),format:Oe}),Object(r.createElement)(x.a,{shortDescription:h,fullDescription:R,itemData:$,variation:V}),Object(r.createElement)("div",{className:"wc-block-cart-item__quantity"},!M&&!!L.editable&&Object(r.createElement)(m,{disabled:z,quantity:W,minimum:L.minimum,maximum:L.maximum,step:L.multiple_of,onChange:e=>{J(e),G("cart-set-item-quantity",{product:c,quantity:e})},itemName:ce}),Object(r.createElement)("button",{className:"wc-block-cart-item__remove-link",onClick:()=>{n(),Y(),G("cart-remove-item",{product:c,quantity:W}),Object(i.speak)(Object(o.sprintf)(
14
  /* translators: %s refers to the item name in the cart. */
15
+ Object(o.__)("%s has been removed from your cart.","woo-gutenberg-products-block"),ce))},disabled:z},Object(o.__)("Remove item","woo-gutenberg-products-block"))))),Object(r.createElement)("td",{className:"wc-block-cart-item__total"},Object(r.createElement)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper"},Object(r.createElement)(b.a,{currency:oe,format:pe,price:se.getAmount()}),W>1&&Object(r.createElement)(C,{currency:te,saleAmount:D(le,te),format:Oe}))))});const T=[...Array(3)].map((_x,e)=>Object(r.createElement)(R,{lineItem:{},key:e})),F=e=>{const t={};return e.forEach(e=>{let{key:c}=e;t[c]=Object(r.createRef)()}),t};var L=e=>{let{lineItems:t=[],isLoading:c=!1,className:a}=e;const n=Object(r.useRef)(null),i=Object(r.useRef)(F(t));Object(r.useEffect)(()=>{i.current=F(t)},[t]);const s=e=>()=>{null!=i&&i.current&&e&&i.current[e].current instanceof HTMLElement?i.current[e].current.focus():n.current instanceof HTMLElement&&n.current.focus()},u=c?T:t.map((e,c)=>{const a=t.length>c+1?t[c+1].key:null;return Object(r.createElement)(R,{key:e.key,lineItem:e,onRemove:s(a),ref:i.current[e.key],tabIndex:-1})});return Object(r.createElement)("table",{className:l()("wc-block-cart-items",a),ref:n,tabIndex:-1},Object(r.createElement)("thead",null,Object(r.createElement)("tr",{className:"wc-block-cart-items__header"},Object(r.createElement)("th",{className:"wc-block-cart-items__header-image"},Object(r.createElement)("span",null,Object(o.__)("Product","woo-gutenberg-products-block"))),Object(r.createElement)("th",{className:"wc-block-cart-items__header-product"},Object(r.createElement)("span",null,Object(o.__)("Details","woo-gutenberg-products-block"))),Object(r.createElement)("th",{className:"wc-block-cart-items__header-total"},Object(r.createElement)("span",null,Object(o.__)("Total","woo-gutenberg-products-block"))))),Object(r.createElement)("tbody",null,u))};t.default=e=>{let{className:t}=e;const{cartItems:c,cartIsLoading:n}=Object(a.a)();return Object(r.createElement)(L,{className:t,lineItems:c,isLoading:n})}},94:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(3),a=c(52);function n(e,t){return e===t}function l(e){return"function"==typeof e?function(){return e}:e}function o(e,t,c){var o=c&&c.equalityFn||n,i=function(e){var t=Object(r.useState)(l(e)),c=t[0],a=t[1];return[c,Object(r.useCallback)((function(e){return a(l(e))}),[])]}(e),s=i[0],u=i[1],m=Object(a.a)(Object(r.useCallback)((function(e){return u(e)}),[u]),t,c),b=Object(r.useRef)(e);return o(b.current,e)||(m(e),b.current=e),[s,m]}},96:function(e,t,c){"use strict";var r=c(10),a=c.n(r),n=c(0),l=c(131),o=c(4),i=c.n(o);c(159);const s=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:o,displayType:u="text",...m}=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 d=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),O={...m,...s(r),value:void 0,currency:void 0,onValueChange:void 0},j=o?e=>{const t=+e.value*10**r.minorUnit;o(t)}:()=>{};return Object(n.createElement)(l.a,a()({className:d,displayType:u},O,{value:p,onValueChange:j}))}}}]);
build/cart-blocks/order-summary-frontend.js CHANGED
@@ -6,7 +6,7 @@ Object(l.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-lab
6
  /* translators: %s coupon code. */
7
  Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{d({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),m("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&b(Object(c.sprintf)(
8
  /* translators: %s coupon code. */
9
- Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),m("")})},isApplyingCoupon:l,isRemovingCoupon:i}},[n,b])}}},252:function(e,t){},253:function(e,t){},254:function(e,t){},255:function(e,t){},256:function(e,t){},265:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(23),r=n(129),s=n(13),l=n(302),i=n(22),p=n(18),u=n(4),b=n.n(u),d=n(19),m=n(21),g=n(11),O=n.n(g),j=n(99),h=n(38);const E=e=>{var t;return null===(t=e.find(e=>e.selected))||void 0===t?void 0:t.rate_id};var f=n(237),_=n(223),k=n(40),v=n(96),w=n(2);const y=e=>{const t=Object(w.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:Object(d.decodeEntities)(e.name),value:e.rate_id,description:Object(c.createElement)(c.Fragment,null,Number.isFinite(t)&&Object(c.createElement)(v.a,{currency:Object(k.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,Object(d.decodeEntities)(e.delivery_time))}};var C=e=>{let{className:t,noResultsMessage:n,onSelectRate:a,rates:o,renderOption:r=y,selected:s}=e;if(0===o.length)return n;if(o.length>1)return Object(c.createElement)(f.a,{className:t,onChange:e=>{a(e)},selected:s,options:o.map(r)});const{label:l,secondaryLabel:i,description:p,secondaryDescription:u}=r(o[0]);return Object(c.createElement)(_.a,{label:l,secondaryLabel:i,description:p,secondaryDescription:u})};n(256);var N=e=>{let{packageId:t,className:n,noResultsMessage:o,renderOption:r,packageData:l,collapsible:i=!1,collapse:p=!1,showItems:u=!1}=e;const{selectShippingRate:g,selectedShippingRate:f}=((e,t)=>{const{dispatchCheckoutEvent:n}=Object(h.a)(),{selectShippingRate:a,isSelectingRate:o}=Object(j.a)(),[r,s]=Object(c.useState)(()=>E(t)),l=Object(c.useRef)(t);return Object(c.useEffect)(()=>{O()(l.current,t)||(l.current=t,s(E(t)))},[t]),{selectShippingRate:Object(c.useCallback)(t=>{s(t),a(t,e),n("set-selected-shipping-rate",{shippingRateId:t})},[e,a,n]),selectedShippingRate:r,isSelectingRate:o}})(t,l.shipping_rates),_=Object(c.createElement)(c.Fragment,null,(u||i)&&Object(c.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title"},l.name),u&&Object(c.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(l.items).map(e=>{const t=Object(d.decodeEntities)(e.name),n=e.quantity;return Object(c.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},Object(c.createElement)(m.a,{label:n>1?`${t} × ${n}`:""+t,screenReaderLabel:Object(a.sprintf)(
10
  /* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
11
  Object(a._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),k=Object(c.createElement)(C,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:g,selected:f,renderOption:r});return i?Object(c.createElement)(s.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:_},k):Object(c.createElement)("div",{className:b()("wc-block-components-shipping-rates-control__package",n)},_,k)};const S=e=>{let{packages:t,collapse:n,showItems:a,collapsible:o,noResultsMessage:r,renderOption:s}=e;return t.length?Object(c.createElement)(c.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(c.createElement)(N,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:a,noResultsMessage:r,renderOption:s})})):null};t.a=e=>{let{shippingRates:t,shippingRatesLoading:n,className:u,collapsible:b=!1,noResultsMessage:d,renderOption:m}=e;Object(c.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),c=Object(l.b)(t);1===e?Object(o.speak)(Object(a.sprintf)(
12
  /* translators: %d number of shipping options found. */
@@ -14,10 +14,10 @@ Object(a._n)("%d shipping option was found.","%d shipping options were found.",c
14
  /* translators: %d number of shipping packages packages. */
15
  Object(a._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",e,"woo-gutenberg-products-block"),e)+" "+Object(a.sprintf)(
16
  /* translators: %d number of shipping options available. */
17
- Object(a._n)("%d shipping option was found","%d shipping options were found",c,"woo-gutenberg-products-block"),c))},[n,t]);const{extensions:g,receiveCart:O,...j}=Object(i.a)(),h={className:u,collapsible:b,noResultsMessage:d,renderOption:m,extensions:g,cart:j,components:{ShippingRatesControlPackage:N}},{isEditor:E}=Object(p.a)();return Object(c.createElement)(r.a,{isLoading:n,screenReaderLabel:Object(a.__)("Loading shipping rates…","woo-gutenberg-products-block"),showSpinner:!0},E?Object(c.createElement)(S,{packages:t,noResultsMessage:d,renderOption:m}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ExperimentalOrderShippingPackages.Slot,h),Object(c.createElement)(s.ExperimentalOrderShippingPackages,null,Object(c.createElement)(S,{packages:t,noResultsMessage:d,renderOption:m}))))}},278:function(e,t){},279:function(e,t){},280:function(e,t){},281:function(e,t){},284:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(1),s=n(3),l=n(4),i=n.n(l),p=n(160),u=n(236),b=n(12),d=n(35),m=n(21);n(229);var g=Object(s.forwardRef)((e,t)=>{let{className:n,id:c,type:r="text",ariaLabel:s,ariaDescribedBy:l,label:p,screenReaderLabel:u,disabled:b,help:d,autoCapitalize:g="off",autoComplete:O="off",value:j="",onChange:h,required:E=!1,onBlur:f=(()=>{}),feedback:_,...k}=e;const[v,w]=Object(o.useState)(!1);return Object(o.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":v||j})},Object(o.createElement)("input",a()({type:r,id:c,value:j,ref:t,autoCapitalize:g,autoComplete:O,onChange:e=>{h(e.target.value)},onFocus:()=>w(!0),onBlur:e=>{f(e.target.value),w(!1)},"aria-label":s||p,disabled:b,"aria-describedby":d&&!l?c+"__help":l,required:E},k)),Object(o.createElement)(m.a,{label:p,screenReaderLabel:u||p,wrapperElement:"label",wrapperProps:{htmlFor:c},htmlFor:c}),!!d&&Object(o.createElement)("p",{id:c+"__help",className:"wc-block-components-text-input__help"},d),_)});t.a=Object(b.withInstanceId)(e=>{let{className:t,instanceId:n,id:c,ariaDescribedBy:l,errorId:b,focusOnMount:m=!1,onChange:O,showError:j=!0,errorMessage:h="",value:E="",...f}=e;const[_,k]=Object(s.useState)(!0),v=Object(s.useRef)(null),{getValidationError:w,hideValidationError:y,setValidationErrors:C,clearValidationError:N,getValidationErrorId:S}=Object(p.b)(),R=void 0!==c?c:"textinput-"+n,x=void 0!==b?b:R,I=Object(s.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=v.current||null;if(!t)return;t.value=t.value.trim();const n=t.checkValidity();n?N(x):C({[x]:{message:t.validationMessage||Object(r.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,x,C]);Object(s.useEffect)(()=>{var e;_&&m&&(null===(e=v.current)||void 0===e||e.focus()),k(!1)},[m,_,k]),Object(s.useEffect)(()=>{var e,t;(null===(e=v.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==v.current&&I(!0)},[E,I]),Object(s.useEffect)(()=>()=>{N(x)},[N,x]);const L=w(x)||{};Object(d.d)(h)&&""!==h&&(L.message=h);const M=L.message&&!L.hidden,T=j&&M&&S(x)?S(x):l;return Object(o.createElement)(g,a()({className:i()(t,{"has-error":M}),"aria-invalid":!0===M,id:R,onBlur:()=>{I(!1)},feedback:j&&Object(o.createElement)(u.a,{errorMessage:h,propertyName:x}),ref:v,onChange:e=>{y(x),O(e)},ariaDescribedBy:T,value:E},f))})},302:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return a}));const c=e=>e.length,a=e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0)},307:function(e,t,n){"use strict";var c=n(0),a=n(284),o=n(10),r=n.n(o),s=n(65),l=n(1),i=n(19),p=n(4),u=n.n(p),b=n(12),d=n(387),m=n(160),g=n(236),O=n(35);n(254);var j=Object(b.withInstanceId)(e=>{let{id:t,className:n,label:a,onChange:o,options:r,value:s,required:i=!1,errorMessage:p=Object(l.__)("Please select a value.","woo-gutenberg-products-block"),errorId:b,instanceId:j="0",autoComplete:h="off"}=e;const{getValidationError:E,setValidationErrors:f,clearValidationError:_}=Object(m.b)(),k=Object(c.useRef)(null),v=t||"control-"+j,w=b||v,y=E(w)||{message:"",hidden:!1};return Object(c.useEffect)(()=>(!i||s?_(w):f({[w]:{message:p,hidden:!0}}),()=>{_(w)}),[_,s,w,p,i,f]),Object(c.createElement)("div",{id:v,className:u()("wc-block-components-combobox",n,{"is-active":s,"has-error":y.message&&!y.hidden}),ref:k},Object(c.createElement)(d.a,{className:"wc-block-components-combobox-control",label:a,onChange:o,onFilterValueChange:e=>{if(e.length){const t=Object(O.c)(k.current)?k.current.ownerDocument.activeElement:void 0;if(t&&Object(O.c)(k.current)&&k.current.contains(t))return;const n=e.toLocaleUpperCase(),c=r.find(e=>e.label.toLocaleUpperCase().startsWith(n)||e.value.toLocaleUpperCase()===n);c&&o(c.value)}},options:r,value:s||"",allowReset:!1,autoComplete:h,"aria-invalid":y.message&&!y.hidden}),Object(c.createElement)(g.a,{propertyName:w}))});n(253);var h=e=>{let{className:t,countries:n,id:a,label:o,onChange:r,value:s="",autoComplete:p="off",required:b=!1,errorId:d,errorMessage:m=Object(l.__)("Please select a country.","woo-gutenberg-products-block")}=e;const g=Object(c.useMemo)(()=>Object.entries(n).map(e=>{let[t,n]=e;return{value:t,label:Object(i.decodeEntities)(n)}}),[n]);return Object(c.createElement)("div",{className:u()(t,"wc-block-components-country-input")},Object(c.createElement)(j,{id:a,label:o,onChange:r,options:g,value:s,errorId:d,errorMessage:m,required:b,autoComplete:p}),"off"!==p&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:p,value:s,onChange:e=>{const t=e.target.value.toLocaleUpperCase(),n=g.find(e=>2!==t.length&&e.label.toLocaleUpperCase()===t||2===t.length&&e.value.toLocaleUpperCase()===t);r(n?n.value:"")},style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1}))},E=e=>Object(c.createElement)(h,r()({countries:s.g},e)),f=e=>Object(c.createElement)(h,r()({countries:s.a},e));n(255);const _=(e,t)=>{const n=t.find(t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase());return n?n.value:""};var k=e=>{let{className:t,id:n,states:o,country:r,label:s,onChange:p,autoComplete:b="off",value:d="",required:m=!1}=e;const g=o[r],O=Object(c.useMemo)(()=>g?Object.keys(g).map(e=>({value:e,label:Object(i.decodeEntities)(g[e])})):[],[g]),h=Object(c.useCallback)(e=>{p(O.length>0?_(e,O):e)},[p,O]),E=Object(c.useRef)(d);return Object(c.useEffect)(()=>{E.current!==d&&(E.current=d)},[d]),Object(c.useEffect)(()=>{if(O.length>0&&E.current){const e=_(E.current,O);e!==E.current&&h(e)}},[O,h]),O.length>0?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(j,{className:u()(t,"wc-block-components-state-input"),id:n,label:s,onChange:h,options:O,value:d,errorMessage:Object(l.__)("Please select a state.","woo-gutenberg-products-block"),required:m,autoComplete:b}),"off"!==b&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:b,value:d,onChange:e=>h(e.target.value),style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1})):Object(c.createElement)(a.a,{className:t,id:n,label:s,onChange:h,autoComplete:b,value:d,required:m})},v=e=>Object(c.createElement)(k,r()({states:s.h},e)),w=e=>Object(c.createElement)(k,r()({states:s.b},e)),y=n(17),C=n(2),N=n(50);t.a=Object(b.withInstanceId)(e=>{let{id:t="",fields:n=Object.keys(C.defaultAddressFields),fieldConfig:o={},instanceId:r,onChange:s,type:i="shipping",values:p}=e;const{getValidationError:u,setValidationErrors:b,clearValidationError:d}=Object(m.b)(),g=Object(y.a)(n),O=u("shipping-missing-country")||{},j=Object(c.useMemo)(()=>Object(N.a)(g,o,p.country),[g,o,p.country]);return Object(c.useEffect)(()=>{j.forEach(e=>{e.hidden&&p[e.key]&&s({...p,[e.key]:""})})},[j,s,p]),Object(c.useEffect)(()=>{"shipping"===i&&((e,t,n,c)=>{c||e.country||!(e.city||e.state||e.postcode)||t({"shipping-missing-country":{message:Object(l.__)("Please select a country to calculate rates.","woo-gutenberg-products-block"),hidden:!1}}),c&&e.country&&n("shipping-missing-country")})(p,b,d,!!O.message&&!O.hidden)},[p,O.message,O.hidden,b,d,i]),t=t||r,Object(c.createElement)("div",{id:t,className:"wc-block-components-address-form"},j.map(e=>{if(e.hidden)return null;if("country"===e.key){const n="shipping"===i?E:f;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,label:e.required?e.label:e.optionalLabel,value:p.country,autoComplete:e.autocomplete,onChange:e=>s({...p,country:e,state:""}),errorId:"shipping"===i?"shipping-missing-country":null,errorMessage:e.errorMessage,required:e.required})}if("state"===e.key){const n="shipping"===i?v:w;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,country:p.country,label:e.required?e.label:e.optionalLabel,value:p.state,autoComplete:e.autocomplete,onChange:e=>s({...p,state:e}),errorMessage:e.errorMessage,required:e.required})}return Object(c.createElement)(a.a,{key:e.key,id:`${t}-${e.key}`,className:"wc-block-components-address-form__"+e.key,label:e.required?e.label:e.optionalLabel,value:p[e.key],autoCapitalize:e.autocapitalize,autoComplete:e.autocomplete,onChange:t=>s({...p,[e.key]:t}),errorMessage:e.errorMessage,required:e.required})}))})},338:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(129),r=n(168),s=n(13),l=n(2);n(278);const i={context:"summary"};t.a=e=>{let{cartCoupons:t=[],currency:n,isRemovingCoupon:p,removeCoupon:u,values:b}=e;const{total_discount:d,total_discount_tax:m}=b,g=parseInt(d,10);if(!g&&0===t.length)return null;const O=parseInt(m,10),j=Object(l.getSetting)("displayCartPricesIncludingTax",!1)?g+O:g,h=Object(s.__experimentalApplyCheckoutFilter)({arg:i,filterName:"coupons",defaultValue:t});return Object(c.createElement)(s.TotalsItem,{className:"wc-block-components-totals-discount",currency:n,description:0!==h.length&&Object(c.createElement)(o.a,{screenReaderLabel:Object(a.__)("Removing coupon…","woo-gutenberg-products-block"),isLoading:p,showSpinner:!1},Object(c.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},h.map(e=>Object(c.createElement)(r.a,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:Object(a.sprintf)(
18
  /* translators: %s Coupon code. */
19
  Object(a.__)("Coupon: %s","woo-gutenberg-products-block"),e.label),disabled:p,onRemove:()=>{u(e.code)},radius:"large",ariaLabel:Object(a.sprintf)(
20
  /* translators: %s is a coupon code. */
21
- Object(a.__)('Remove coupon "%s"',"woo-gutenberg-products-block"),e.label)})))),label:j?Object(a.__)("Discount","woo-gutenberg-products-block"):Object(a.__)("Coupons","woo-gutenberg-products-block"),value:j?-1*j:"-"})}},339:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(228),r=n(284),s=n(21),l=n(129),i=n(12),p=n(160),u=n(236),b=n(13);n(279),t.a=Object(i.withInstanceId)(e=>{let{instanceId:t,isLoading:n=!1,initialOpen:i=!1,onSubmit:d=(()=>{})}=e;const[m,g]=Object(c.useState)(""),O=Object(c.useRef)(!1),{getValidationError:j,getValidationErrorId:h}=Object(p.b)(),E=j("coupon");Object(c.useEffect)(()=>{O.current!==n&&(n||!m||E||g(""),O.current=n)},[n,m,E]);const f="wc-block-components-totals-coupon__input-"+t;return Object(c.createElement)(b.Panel,{className:"wc-block-components-totals-coupon",hasBorder:!1,initialOpen:i,title:Object(c.createElement)(s.a,{label:Object(a.__)("Coupon code","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Apply a coupon code","woo-gutenberg-products-block"),htmlFor:f})},Object(c.createElement)(l.a,{screenReaderLabel:Object(a.__)("Applying coupon…","woo-gutenberg-products-block"),isLoading:n,showSpinner:!1},Object(c.createElement)("div",{className:"wc-block-components-totals-coupon__content"},Object(c.createElement)("form",{className:"wc-block-components-totals-coupon__form"},Object(c.createElement)(r.a,{id:f,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:Object(a.__)("Enter code","woo-gutenberg-products-block"),value:m,ariaDescribedBy:h(f),onChange:e=>{g(e)},focusOnMount:!0,showError:!1}),Object(c.createElement)(o.a,{className:"wc-block-components-totals-coupon__button",disabled:n||!m,showSpinner:n,onClick:e=>{e.preventDefault(),d(m)},type:"submit"},Object(a.__)("Apply","woo-gutenberg-products-block"))),Object(c.createElement)(u.a,{propertyName:"coupon",elementId:f}))))})},343:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(96),r=n(13),s=n(22),l=n(2);n(281),t.a=e=>{let{currency:t,values:n}=e;const i=Object(l.getSetting)("taxesEnabled",!0)&&Object(l.getSetting)("displayCartPricesIncludingTax",!1),{total_price:p,total_tax:u}=n,{receiveCart:b,...d}=Object(s.a)(),m=Object(r.__experimentalApplyCheckoutFilter)({filterName:"totalLabel",defaultValue:Object(a.__)("Total","woo-gutenberg-products-block"),extensions:d.extensions,arg:{cart:d}}),g=parseInt(u,10);return Object(c.createElement)(r.TotalsItem,{className:"wc-block-components-totals-footer-item",currency:t,label:m,value:parseInt(p,10),description:i&&0!==g&&Object(c.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},Object(c.createInterpolateElement)(Object(a.__)("Including <TaxAmount/> in taxes","woo-gutenberg-products-block"),{TaxAmount:Object(c.createElement)(o.a,{className:"wc-block-components-totals-footer-item-tax-value",currency:t,value:g})}))})}},359:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(4),s=n.n(r),l=n(1),i=n(22),p=n(13),u=n(2),b=n(19);const d=e=>{let{selectedShippingRates:t}=e;return Object(o.createElement)("div",{className:"wc-block-components-totals-item__description wc-block-components-totals-shipping__via"},Object(l.__)("via","woo-gutenberg-products-block")," ",Object(b.decodeEntities)(t.join(", ")))};var m=n(116),g=n(265),O=e=>{let{hasRates:t,shippingRates:n,shippingRatesLoading:c}=e;const a=t?Object(l.__)("Shipping options","woo-gutenberg-products-block"):Object(l.__)("Choose a shipping option","woo-gutenberg-products-block");return Object(o.createElement)("fieldset",{className:"wc-block-components-totals-shipping__fieldset"},Object(o.createElement)("legend",{className:"screen-reader-text"},a),Object(o.createElement)(g.a,{className:"wc-block-components-totals-shipping__options",collapsible:!0,noResultsMessage:Object(o.createElement)(m.a,{isDismissible:!1,className:s()("wc-block-components-shipping-rates-control__no-results-notice","woocommerce-error")},Object(l.__)("No shipping options were found.","woo-gutenberg-products-block")),shippingRates:n,shippingRatesLoading:c}))},j=n(44),h=n(228),E=n(11),f=n.n(E),_=n(160),k=(n(252),n(307)),v=e=>{let{address:t,onUpdate:n,addressFields:c}=e;const[a,r]=Object(o.useState)(t),{hasValidationErrors:s,showAllValidationErrors:i}=Object(_.b)();return Object(o.createElement)("form",{className:"wc-block-components-shipping-calculator-address"},Object(o.createElement)(k.a,{fields:c,onChange:r,values:a}),Object(o.createElement)(h.a,{className:"wc-block-components-shipping-calculator-address__button",disabled:f()(a,t),onClick:e=>{if(e.preventDefault(),i(),!s)return n(a)},type:"submit"},Object(l.__)("Update","woo-gutenberg-products-block")))},w=e=>{let{onUpdate:t=(()=>{}),addressFields:n=["country","state","city","postcode"]}=e;const{shippingAddress:c,setShippingAddress:a}=Object(j.b)();return Object(o.createElement)("div",{className:"wc-block-components-shipping-calculator"},Object(o.createElement)(v,{address:c,addressFields:n,onUpdate:e=>{a(e),t(e)}}))},y=e=>{let{address:t}=e;if(0===Object.values(t).length)return null;const n=Object(u.getSetting)("shippingCountries",{}),c=Object(u.getSetting)("shippingStates",{}),a="string"==typeof n[t.country]?Object(b.decodeEntities)(n[t.country]):"",r="object"==typeof c[t.country]&&"string"==typeof c[t.country][t.state]?Object(b.decodeEntities)(c[t.country][t.state]):t.state,s=[];s.push(t.postcode.toUpperCase()),s.push(t.city),s.push(r),s.push(a);const i=s.filter(Boolean).join(", ");return i?Object(o.createElement)("span",{className:"wc-block-components-shipping-address"},Object(l.sprintf)(
22
  /* translators: %s location. */
23
- Object(l.__)("Shipping to %s","woo-gutenberg-products-block"),i)+" "):null};n(280);const C=e=>{let{label:t=Object(l.__)("Calculate","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}=e;return Object(o.createElement)("button",{className:"wc-block-components-totals-shipping__change-address-button",onClick:()=>{c(!n)},"aria-expanded":n},t)},N=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c,shippingAddress:a}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,{address:a}),t&&Object(o.createElement)(C,{label:Object(l.__)("(change address)","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}))},S=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c,isCheckout:a=!1}=e;return t?Object(o.createElement)(C,{isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}):Object(o.createElement)("em",null,a?Object(l.__)("No shipping options available","woo-gutenberg-products-block"):Object(l.__)("Calculated during checkout","woo-gutenberg-products-block"))};t.a=e=>{let{currency:t,values:n,showCalculator:c=!0,showRateSelector:r=!0,isCheckout:b=!1,className:m}=e;const[g,j]=Object(o.useState)(!1),{shippingAddress:h,cartHasCalculatedShipping:E,shippingRates:f,shippingRatesLoading:_}=Object(i.a)(),k=Object(u.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(n.total_shipping,10)+parseInt(n.total_shipping_tax,10):parseInt(n.total_shipping,10),v=f.some(e=>e.shipping_rates.length)||k,y={isShippingCalculatorOpen:g,setIsShippingCalculatorOpen:j},C=f.flatMap(e=>e.shipping_rates.filter(e=>e.selected).flatMap(e=>e.name));return Object(o.createElement)("div",{className:s()("wc-block-components-totals-shipping",m)},Object(o.createElement)(p.TotalsItem,{label:Object(l.__)("Shipping","woo-gutenberg-products-block"),value:v&&E?k:Object(o.createElement)(S,a()({showCalculator:c,isCheckout:b},y)),description:v&&E?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(d,{selectedShippingRates:C}),Object(o.createElement)(N,a()({shippingAddress:h,showCalculator:c},y))):null,currency:t}),c&&g&&Object(o.createElement)(w,{onUpdate:()=>{j(!1)}}),r&&E&&Object(o.createElement)(O,{hasRates:v,shippingRates:f,shippingRatesLoading:_}))}},392:function(e,t,n){"use strict";n.r(t);var c=n(110),a=n(0),o=n(1),r=n(338),s=n(339),l=n(359),i=n(343),p=n(13),u=n(40),b=n(22),d=n(241),m=n(2),g=n(225),O={isShippingCalculatorEnabled:{type:"boolean",default:Object(m.getSetting)("isShippingCalculatorEnabled",!0)},showRateAfterTaxName:{type:"boolean",default:Object(m.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{move:!0,remove:!0}}};t.default=Object(c.withFilteredAttributes)(O)(e=>{let{className:t,showRateAfterTaxName:n=!1,isShippingCalculatorEnabled:c=!0}=e;const{cartFees:O,cartTotals:j,cartNeedsShipping:h}=Object(b.a)(),{applyCoupon:E,removeCoupon:f,isApplyingCoupon:_,isRemovingCoupon:k,appliedCoupons:v}=Object(d.a)(),w=Object(u.getCurrencyFromPriceResponse)(j),{extensions:y,receiveCart:C,...N}=Object(b.a)(),S={extensions:y,cart:N},R={extensions:y,cart:N};return Object(a.createElement)("div",{className:t},Object(a.createElement)(g.a,{headingLevel:"2",className:"wc-block-cart__totals-title"},Object(o.__)("Cart totals","woo-gutenberg-products-block")),Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(p.Subtotal,{currency:w,values:j}),Object(a.createElement)(p.TotalsFees,{currency:w,cartFees:O}),Object(a.createElement)(r.a,{cartCoupons:v,currency:w,isRemovingCoupon:k,removeCoupon:f,values:j})),Object(m.getSetting)("couponsEnabled",!0)&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(s.a,{onSubmit:E,isLoading:_})),Object(a.createElement)(p.ExperimentalDiscountsMeta.Slot,R),h&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(l.a,{showCalculator:c,showRateSelector:!0,values:j,currency:w})),!Object(m.getSetting)("displayCartPricesIncludingTax",!1)&&parseInt(j.total_tax,10)>0&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(p.TotalsTaxes,{showRateAfterTaxName:n,currency:w,values:j})),Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(i.a,{currency:w,values:j})),Object(a.createElement)(p.ExperimentalOrderMeta.Slot,S))})},96:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(131),s=n(4),l=n.n(s);n(159);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:n,currency:c,onValueChange:s,displayType:p="text",...u}=e;const b="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(b))return null;const d=b/10**c.minorUnit;if(!Number.isFinite(d))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...u,...i(c),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**c.minorUnit;s(t)}:()=>{};return Object(o.createElement)(r.a,a()({className:m,displayType:p},g,{value:d,onValueChange:O}))}},98:function(e,t,n){"use strict";var c=n(0);t.a=function(e){let{srcElement:t,size:n=24,...a}=e;return Object(c.isValidElement)(t)?Object(c.cloneElement)(t,{width:n,height:n,...a}):null}}}]);
6
  /* translators: %s coupon code. */
7
  Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{d({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),m("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&b(Object(c.sprintf)(
8
  /* translators: %s coupon code. */
9
+ Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),m("")})},isApplyingCoupon:l,isRemovingCoupon:i}},[n,b])}}},252:function(e,t){},253:function(e,t){},254:function(e,t){},255:function(e,t){},256:function(e,t){},265:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(23),r=n(129),s=n(14),l=n(302),i=n(22),p=n(18),u=n(4),b=n.n(u),d=n(19),m=n(21),g=n(11),O=n.n(g),j=n(99),h=n(38);const E=e=>{var t;return null===(t=e.find(e=>e.selected))||void 0===t?void 0:t.rate_id};var f=n(237),_=n(223),k=n(40),v=n(96),w=n(2);const y=e=>{const t=Object(w.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:Object(d.decodeEntities)(e.name),value:e.rate_id,description:Object(c.createElement)(c.Fragment,null,Number.isFinite(t)&&Object(c.createElement)(v.a,{currency:Object(k.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,Object(d.decodeEntities)(e.delivery_time))}};var C=e=>{let{className:t,noResultsMessage:n,onSelectRate:a,rates:o,renderOption:r=y,selected:s}=e;if(0===o.length)return n;if(o.length>1)return Object(c.createElement)(f.a,{className:t,onChange:e=>{a(e)},selected:s,options:o.map(r)});const{label:l,secondaryLabel:i,description:p,secondaryDescription:u}=r(o[0]);return Object(c.createElement)(_.a,{label:l,secondaryLabel:i,description:p,secondaryDescription:u})};n(256);var N=e=>{let{packageId:t,className:n,noResultsMessage:o,renderOption:r,packageData:l,collapsible:i=!1,collapse:p=!1,showItems:u=!1}=e;const{selectShippingRate:g,selectedShippingRate:f}=((e,t)=>{const{dispatchCheckoutEvent:n}=Object(h.a)(),{selectShippingRate:a,isSelectingRate:o}=Object(j.a)(),[r,s]=Object(c.useState)(()=>E(t)),l=Object(c.useRef)(t);return Object(c.useEffect)(()=>{O()(l.current,t)||(l.current=t,s(E(t)))},[t]),{selectShippingRate:Object(c.useCallback)(t=>{s(t),a(t,e),n("set-selected-shipping-rate",{shippingRateId:t})},[e,a,n]),selectedShippingRate:r,isSelectingRate:o}})(t,l.shipping_rates),_=Object(c.createElement)(c.Fragment,null,(u||i)&&Object(c.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title"},l.name),u&&Object(c.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(l.items).map(e=>{const t=Object(d.decodeEntities)(e.name),n=e.quantity;return Object(c.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},Object(c.createElement)(m.a,{label:n>1?`${t} × ${n}`:""+t,screenReaderLabel:Object(a.sprintf)(
10
  /* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
11
  Object(a._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),k=Object(c.createElement)(C,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:g,selected:f,renderOption:r});return i?Object(c.createElement)(s.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:_},k):Object(c.createElement)("div",{className:b()("wc-block-components-shipping-rates-control__package",n)},_,k)};const S=e=>{let{packages:t,collapse:n,showItems:a,collapsible:o,noResultsMessage:r,renderOption:s}=e;return t.length?Object(c.createElement)(c.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(c.createElement)(N,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:a,noResultsMessage:r,renderOption:s})})):null};t.a=e=>{let{shippingRates:t,shippingRatesLoading:n,className:u,collapsible:b=!1,noResultsMessage:d,renderOption:m}=e;Object(c.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),c=Object(l.b)(t);1===e?Object(o.speak)(Object(a.sprintf)(
12
  /* translators: %d number of shipping options found. */
14
  /* translators: %d number of shipping packages packages. */
15
  Object(a._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",e,"woo-gutenberg-products-block"),e)+" "+Object(a.sprintf)(
16
  /* translators: %d number of shipping options available. */
17
+ Object(a._n)("%d shipping option was found","%d shipping options were found",c,"woo-gutenberg-products-block"),c))},[n,t]);const{extensions:g,receiveCart:O,...j}=Object(i.a)(),h={className:u,collapsible:b,noResultsMessage:d,renderOption:m,extensions:g,cart:j,components:{ShippingRatesControlPackage:N}},{isEditor:E}=Object(p.a)();return Object(c.createElement)(r.a,{isLoading:n,screenReaderLabel:Object(a.__)("Loading shipping rates…","woo-gutenberg-products-block"),showSpinner:!0},E?Object(c.createElement)(S,{packages:t,noResultsMessage:d,renderOption:m}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ExperimentalOrderShippingPackages.Slot,h),Object(c.createElement)(s.ExperimentalOrderShippingPackages,null,Object(c.createElement)(S,{packages:t,noResultsMessage:d,renderOption:m}))))}},278:function(e,t){},279:function(e,t){},280:function(e,t){},281:function(e,t){},284:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(1),s=n(3),l=n(4),i=n.n(l),p=n(160),u=n(236),b=n(12),d=n(35),m=n(21);n(229);var g=Object(s.forwardRef)((e,t)=>{let{className:n,id:c,type:r="text",ariaLabel:s,ariaDescribedBy:l,label:p,screenReaderLabel:u,disabled:b,help:d,autoCapitalize:g="off",autoComplete:O="off",value:j="",onChange:h,required:E=!1,onBlur:f=(()=>{}),feedback:_,...k}=e;const[v,w]=Object(o.useState)(!1);return Object(o.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":v||j})},Object(o.createElement)("input",a()({type:r,id:c,value:j,ref:t,autoCapitalize:g,autoComplete:O,onChange:e=>{h(e.target.value)},onFocus:()=>w(!0),onBlur:e=>{f(e.target.value),w(!1)},"aria-label":s||p,disabled:b,"aria-describedby":d&&!l?c+"__help":l,required:E},k)),Object(o.createElement)(m.a,{label:p,screenReaderLabel:u||p,wrapperElement:"label",wrapperProps:{htmlFor:c},htmlFor:c}),!!d&&Object(o.createElement)("p",{id:c+"__help",className:"wc-block-components-text-input__help"},d),_)});t.a=Object(b.withInstanceId)(e=>{let{className:t,instanceId:n,id:c,ariaDescribedBy:l,errorId:b,focusOnMount:m=!1,onChange:O,showError:j=!0,errorMessage:h="",value:E="",...f}=e;const[_,k]=Object(s.useState)(!0),v=Object(s.useRef)(null),{getValidationError:w,hideValidationError:y,setValidationErrors:C,clearValidationError:N,getValidationErrorId:S}=Object(p.b)(),R=void 0!==c?c:"textinput-"+n,x=void 0!==b?b:R,I=Object(s.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=v.current||null;if(!t)return;t.value=t.value.trim();const n=t.checkValidity();n?N(x):C({[x]:{message:t.validationMessage||Object(r.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,x,C]);Object(s.useEffect)(()=>{var e;_&&m&&(null===(e=v.current)||void 0===e||e.focus()),k(!1)},[m,_,k]),Object(s.useEffect)(()=>{var e,t;(null===(e=v.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==v.current&&I(!0)},[E,I]),Object(s.useEffect)(()=>()=>{N(x)},[N,x]);const L=w(x)||{};Object(d.d)(h)&&""!==h&&(L.message=h);const M=L.message&&!L.hidden,T=j&&M&&S(x)?S(x):l;return Object(o.createElement)(g,a()({className:i()(t,{"has-error":M}),"aria-invalid":!0===M,id:R,onBlur:()=>{I(!1)},feedback:j&&Object(o.createElement)(u.a,{errorMessage:h,propertyName:x}),ref:v,onChange:e=>{y(x),O(e)},ariaDescribedBy:T,value:E},f))})},302:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return a}));const c=e=>e.length,a=e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0)},307:function(e,t,n){"use strict";var c=n(0),a=n(284),o=n(10),r=n.n(o),s=n(65),l=n(1),i=n(19),p=n(4),u=n.n(p),b=n(12),d=n(387),m=n(160),g=n(236),O=n(35);n(254);var j=Object(b.withInstanceId)(e=>{let{id:t,className:n,label:a,onChange:o,options:r,value:s,required:i=!1,errorMessage:p=Object(l.__)("Please select a value.","woo-gutenberg-products-block"),errorId:b,instanceId:j="0",autoComplete:h="off"}=e;const{getValidationError:E,setValidationErrors:f,clearValidationError:_}=Object(m.b)(),k=Object(c.useRef)(null),v=t||"control-"+j,w=b||v,y=E(w)||{message:"",hidden:!1};return Object(c.useEffect)(()=>(!i||s?_(w):f({[w]:{message:p,hidden:!0}}),()=>{_(w)}),[_,s,w,p,i,f]),Object(c.createElement)("div",{id:v,className:u()("wc-block-components-combobox",n,{"is-active":s,"has-error":y.message&&!y.hidden}),ref:k},Object(c.createElement)(d.a,{className:"wc-block-components-combobox-control",label:a,onChange:o,onFilterValueChange:e=>{if(e.length){const t=Object(O.c)(k.current)?k.current.ownerDocument.activeElement:void 0;if(t&&Object(O.c)(k.current)&&k.current.contains(t))return;const n=e.toLocaleUpperCase(),c=r.find(e=>e.label.toLocaleUpperCase().startsWith(n)||e.value.toLocaleUpperCase()===n);c&&o(c.value)}},options:r,value:s||"",allowReset:!1,autoComplete:h,"aria-invalid":y.message&&!y.hidden}),Object(c.createElement)(g.a,{propertyName:w}))});n(253);var h=e=>{let{className:t,countries:n,id:a,label:o,onChange:r,value:s="",autoComplete:p="off",required:b=!1,errorId:d,errorMessage:m=Object(l.__)("Please select a country.","woo-gutenberg-products-block")}=e;const g=Object(c.useMemo)(()=>Object.entries(n).map(e=>{let[t,n]=e;return{value:t,label:Object(i.decodeEntities)(n)}}),[n]);return Object(c.createElement)("div",{className:u()(t,"wc-block-components-country-input")},Object(c.createElement)(j,{id:a,label:o,onChange:r,options:g,value:s,errorId:d,errorMessage:m,required:b,autoComplete:p}),"off"!==p&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:p,value:s,onChange:e=>{const t=e.target.value.toLocaleUpperCase(),n=g.find(e=>2!==t.length&&e.label.toLocaleUpperCase()===t||2===t.length&&e.value.toLocaleUpperCase()===t);r(n?n.value:"")},style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1}))},E=e=>Object(c.createElement)(h,r()({countries:s.g},e)),f=e=>Object(c.createElement)(h,r()({countries:s.a},e));n(255);const _=(e,t)=>{const n=t.find(t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase());return n?n.value:""};var k=e=>{let{className:t,id:n,states:o,country:r,label:s,onChange:p,autoComplete:b="off",value:d="",required:m=!1}=e;const g=o[r],O=Object(c.useMemo)(()=>g?Object.keys(g).map(e=>({value:e,label:Object(i.decodeEntities)(g[e])})):[],[g]),h=Object(c.useCallback)(e=>{p(O.length>0?_(e,O):e)},[p,O]),E=Object(c.useRef)(d);return Object(c.useEffect)(()=>{E.current!==d&&(E.current=d)},[d]),Object(c.useEffect)(()=>{if(O.length>0&&E.current){const e=_(E.current,O);e!==E.current&&h(e)}},[O,h]),O.length>0?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(j,{className:u()(t,"wc-block-components-state-input"),id:n,label:s,onChange:h,options:O,value:d,errorMessage:Object(l.__)("Please select a state.","woo-gutenberg-products-block"),required:m,autoComplete:b}),"off"!==b&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:b,value:d,onChange:e=>h(e.target.value),style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1})):Object(c.createElement)(a.a,{className:t,id:n,label:s,onChange:h,autoComplete:b,value:d,required:m})},v=e=>Object(c.createElement)(k,r()({states:s.h},e)),w=e=>Object(c.createElement)(k,r()({states:s.b},e)),y=n(17),C=n(2),N=n(50);t.a=Object(b.withInstanceId)(e=>{let{id:t="",fields:n=Object.keys(C.defaultAddressFields),fieldConfig:o={},instanceId:r,onChange:s,type:i="shipping",values:p}=e;const{getValidationError:u,setValidationErrors:b,clearValidationError:d}=Object(m.b)(),g=Object(y.a)(n),O=u("shipping-missing-country")||{},j=Object(c.useMemo)(()=>Object(N.a)(g,o,p.country),[g,o,p.country]);return Object(c.useEffect)(()=>{j.forEach(e=>{e.hidden&&p[e.key]&&s({...p,[e.key]:""})})},[j,s,p]),Object(c.useEffect)(()=>{"shipping"===i&&((e,t,n,c)=>{c||e.country||!(e.city||e.state||e.postcode)||t({"shipping-missing-country":{message:Object(l.__)("Please select a country to calculate rates.","woo-gutenberg-products-block"),hidden:!1}}),c&&e.country&&n("shipping-missing-country")})(p,b,d,!!O.message&&!O.hidden)},[p,O.message,O.hidden,b,d,i]),t=t||r,Object(c.createElement)("div",{id:t,className:"wc-block-components-address-form"},j.map(e=>{if(e.hidden)return null;if("country"===e.key){const n="shipping"===i?E:f;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,label:e.required?e.label:e.optionalLabel,value:p.country,autoComplete:e.autocomplete,onChange:e=>s({...p,country:e,state:""}),errorId:"shipping"===i?"shipping-missing-country":null,errorMessage:e.errorMessage,required:e.required})}if("state"===e.key){const n="shipping"===i?v:w;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,country:p.country,label:e.required?e.label:e.optionalLabel,value:p.state,autoComplete:e.autocomplete,onChange:e=>s({...p,state:e}),errorMessage:e.errorMessage,required:e.required})}return Object(c.createElement)(a.a,{key:e.key,id:`${t}-${e.key}`,className:"wc-block-components-address-form__"+e.key,label:e.required?e.label:e.optionalLabel,value:p[e.key],autoCapitalize:e.autocapitalize,autoComplete:e.autocomplete,onChange:t=>s({...p,[e.key]:t}),errorMessage:e.errorMessage,required:e.required})}))})},338:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(129),r=n(168),s=n(14),l=n(2);n(278);const i={context:"summary"};t.a=e=>{let{cartCoupons:t=[],currency:n,isRemovingCoupon:p,removeCoupon:u,values:b}=e;const{total_discount:d,total_discount_tax:m}=b,g=parseInt(d,10);if(!g&&0===t.length)return null;const O=parseInt(m,10),j=Object(l.getSetting)("displayCartPricesIncludingTax",!1)?g+O:g,h=Object(s.__experimentalApplyCheckoutFilter)({arg:i,filterName:"coupons",defaultValue:t});return Object(c.createElement)(s.TotalsItem,{className:"wc-block-components-totals-discount",currency:n,description:0!==h.length&&Object(c.createElement)(o.a,{screenReaderLabel:Object(a.__)("Removing coupon…","woo-gutenberg-products-block"),isLoading:p,showSpinner:!1},Object(c.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},h.map(e=>Object(c.createElement)(r.a,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:Object(a.sprintf)(
18
  /* translators: %s Coupon code. */
19
  Object(a.__)("Coupon: %s","woo-gutenberg-products-block"),e.label),disabled:p,onRemove:()=>{u(e.code)},radius:"large",ariaLabel:Object(a.sprintf)(
20
  /* translators: %s is a coupon code. */
21
+ Object(a.__)('Remove coupon "%s"',"woo-gutenberg-products-block"),e.label)})))),label:j?Object(a.__)("Discount","woo-gutenberg-products-block"):Object(a.__)("Coupons","woo-gutenberg-products-block"),value:j?-1*j:"-"})}},339:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(228),r=n(284),s=n(21),l=n(129),i=n(12),p=n(160),u=n(236),b=n(14);n(279),t.a=Object(i.withInstanceId)(e=>{let{instanceId:t,isLoading:n=!1,initialOpen:i=!1,onSubmit:d=(()=>{})}=e;const[m,g]=Object(c.useState)(""),O=Object(c.useRef)(!1),{getValidationError:j,getValidationErrorId:h}=Object(p.b)(),E=j("coupon");Object(c.useEffect)(()=>{O.current!==n&&(n||!m||E||g(""),O.current=n)},[n,m,E]);const f="wc-block-components-totals-coupon__input-"+t;return Object(c.createElement)(b.Panel,{className:"wc-block-components-totals-coupon",hasBorder:!1,initialOpen:i,title:Object(c.createElement)(s.a,{label:Object(a.__)("Coupon code","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Apply a coupon code","woo-gutenberg-products-block"),htmlFor:f})},Object(c.createElement)(l.a,{screenReaderLabel:Object(a.__)("Applying coupon…","woo-gutenberg-products-block"),isLoading:n,showSpinner:!1},Object(c.createElement)("div",{className:"wc-block-components-totals-coupon__content"},Object(c.createElement)("form",{className:"wc-block-components-totals-coupon__form"},Object(c.createElement)(r.a,{id:f,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:Object(a.__)("Enter code","woo-gutenberg-products-block"),value:m,ariaDescribedBy:h(f),onChange:e=>{g(e)},focusOnMount:!0,showError:!1}),Object(c.createElement)(o.a,{className:"wc-block-components-totals-coupon__button",disabled:n||!m,showSpinner:n,onClick:e=>{e.preventDefault(),d(m)},type:"submit"},Object(a.__)("Apply","woo-gutenberg-products-block"))),Object(c.createElement)(u.a,{propertyName:"coupon",elementId:f}))))})},343:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(96),r=n(14),s=n(22),l=n(2);n(281),t.a=e=>{let{currency:t,values:n}=e;const i=Object(l.getSetting)("taxesEnabled",!0)&&Object(l.getSetting)("displayCartPricesIncludingTax",!1),{total_price:p,total_tax:u}=n,{receiveCart:b,...d}=Object(s.a)(),m=Object(r.__experimentalApplyCheckoutFilter)({filterName:"totalLabel",defaultValue:Object(a.__)("Total","woo-gutenberg-products-block"),extensions:d.extensions,arg:{cart:d}}),g=parseInt(u,10);return Object(c.createElement)(r.TotalsItem,{className:"wc-block-components-totals-footer-item",currency:t,label:m,value:parseInt(p,10),description:i&&0!==g&&Object(c.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},Object(c.createInterpolateElement)(Object(a.__)("Including <TaxAmount/> in taxes","woo-gutenberg-products-block"),{TaxAmount:Object(c.createElement)(o.a,{className:"wc-block-components-totals-footer-item-tax-value",currency:t,value:g})}))})}},359:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(4),s=n.n(r),l=n(1),i=n(22),p=n(14),u=n(2),b=n(19);const d=e=>{let{selectedShippingRates:t}=e;return Object(o.createElement)("div",{className:"wc-block-components-totals-item__description wc-block-components-totals-shipping__via"},Object(l.__)("via","woo-gutenberg-products-block")," ",Object(b.decodeEntities)(t.join(", ")))};var m=n(116),g=n(265),O=e=>{let{hasRates:t,shippingRates:n,shippingRatesLoading:c}=e;const a=t?Object(l.__)("Shipping options","woo-gutenberg-products-block"):Object(l.__)("Choose a shipping option","woo-gutenberg-products-block");return Object(o.createElement)("fieldset",{className:"wc-block-components-totals-shipping__fieldset"},Object(o.createElement)("legend",{className:"screen-reader-text"},a),Object(o.createElement)(g.a,{className:"wc-block-components-totals-shipping__options",collapsible:!0,noResultsMessage:Object(o.createElement)(m.a,{isDismissible:!1,className:s()("wc-block-components-shipping-rates-control__no-results-notice","woocommerce-error")},Object(l.__)("No shipping options were found.","woo-gutenberg-products-block")),shippingRates:n,shippingRatesLoading:c}))},j=n(44),h=n(228),E=n(11),f=n.n(E),_=n(160),k=(n(252),n(307)),v=e=>{let{address:t,onUpdate:n,addressFields:c}=e;const[a,r]=Object(o.useState)(t),{hasValidationErrors:s,showAllValidationErrors:i}=Object(_.b)();return Object(o.createElement)("form",{className:"wc-block-components-shipping-calculator-address"},Object(o.createElement)(k.a,{fields:c,onChange:r,values:a}),Object(o.createElement)(h.a,{className:"wc-block-components-shipping-calculator-address__button",disabled:f()(a,t),onClick:e=>{if(e.preventDefault(),i(),!s)return n(a)},type:"submit"},Object(l.__)("Update","woo-gutenberg-products-block")))},w=e=>{let{onUpdate:t=(()=>{}),addressFields:n=["country","state","city","postcode"]}=e;const{shippingAddress:c,setShippingAddress:a}=Object(j.b)();return Object(o.createElement)("div",{className:"wc-block-components-shipping-calculator"},Object(o.createElement)(v,{address:c,addressFields:n,onUpdate:e=>{a(e),t(e)}}))},y=e=>{let{address:t}=e;if(0===Object.values(t).length)return null;const n=Object(u.getSetting)("shippingCountries",{}),c=Object(u.getSetting)("shippingStates",{}),a="string"==typeof n[t.country]?Object(b.decodeEntities)(n[t.country]):"",r="object"==typeof c[t.country]&&"string"==typeof c[t.country][t.state]?Object(b.decodeEntities)(c[t.country][t.state]):t.state,s=[];s.push(t.postcode.toUpperCase()),s.push(t.city),s.push(r),s.push(a);const i=s.filter(Boolean).join(", ");return i?Object(o.createElement)("span",{className:"wc-block-components-shipping-address"},Object(l.sprintf)(
22
  /* translators: %s location. */
23
+ Object(l.__)("Shipping to %s","woo-gutenberg-products-block"),i)+" "):null};n(280);const C=e=>{let{label:t=Object(l.__)("Calculate","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}=e;return Object(o.createElement)("button",{className:"wc-block-components-totals-shipping__change-address-button",onClick:()=>{c(!n)},"aria-expanded":n},t)},N=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c,shippingAddress:a}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,{address:a}),t&&Object(o.createElement)(C,{label:Object(l.__)("(change address)","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}))},S=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c,isCheckout:a=!1}=e;return t?Object(o.createElement)(C,{isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}):Object(o.createElement)("em",null,a?Object(l.__)("No shipping options available","woo-gutenberg-products-block"):Object(l.__)("Calculated during checkout","woo-gutenberg-products-block"))};t.a=e=>{let{currency:t,values:n,showCalculator:c=!0,showRateSelector:r=!0,isCheckout:b=!1,className:m}=e;const[g,j]=Object(o.useState)(!1),{shippingAddress:h,cartHasCalculatedShipping:E,shippingRates:f,shippingRatesLoading:_}=Object(i.a)(),k=Object(u.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(n.total_shipping,10)+parseInt(n.total_shipping_tax,10):parseInt(n.total_shipping,10),v=f.some(e=>e.shipping_rates.length)||k,y={isShippingCalculatorOpen:g,setIsShippingCalculatorOpen:j},C=f.flatMap(e=>e.shipping_rates.filter(e=>e.selected).flatMap(e=>e.name));return Object(o.createElement)("div",{className:s()("wc-block-components-totals-shipping",m)},Object(o.createElement)(p.TotalsItem,{label:Object(l.__)("Shipping","woo-gutenberg-products-block"),value:v&&E?k:Object(o.createElement)(S,a()({showCalculator:c,isCheckout:b},y)),description:v&&E?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(d,{selectedShippingRates:C}),Object(o.createElement)(N,a()({shippingAddress:h,showCalculator:c},y))):null,currency:t}),c&&g&&Object(o.createElement)(w,{onUpdate:()=>{j(!1)}}),r&&E&&Object(o.createElement)(O,{hasRates:v,shippingRates:f,shippingRatesLoading:_}))}},392:function(e,t,n){"use strict";n.r(t);var c=n(110),a=n(0),o=n(1),r=n(338),s=n(339),l=n(359),i=n(343),p=n(14),u=n(40),b=n(22),d=n(241),m=n(2),g=n(225),O={isShippingCalculatorEnabled:{type:"boolean",default:Object(m.getSetting)("isShippingCalculatorEnabled",!0)},showRateAfterTaxName:{type:"boolean",default:Object(m.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{move:!0,remove:!0}}};t.default=Object(c.withFilteredAttributes)(O)(e=>{let{className:t,showRateAfterTaxName:n=!1,isShippingCalculatorEnabled:c=!0}=e;const{cartFees:O,cartTotals:j,cartNeedsShipping:h}=Object(b.a)(),{applyCoupon:E,removeCoupon:f,isApplyingCoupon:_,isRemovingCoupon:k,appliedCoupons:v}=Object(d.a)(),w=Object(u.getCurrencyFromPriceResponse)(j),{extensions:y,receiveCart:C,...N}=Object(b.a)(),S={extensions:y,cart:N},R={extensions:y,cart:N};return Object(a.createElement)("div",{className:t},Object(a.createElement)(g.a,{headingLevel:"2",className:"wc-block-cart__totals-title"},Object(o.__)("Cart totals","woo-gutenberg-products-block")),Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(p.Subtotal,{currency:w,values:j}),Object(a.createElement)(p.TotalsFees,{currency:w,cartFees:O}),Object(a.createElement)(r.a,{cartCoupons:v,currency:w,isRemovingCoupon:k,removeCoupon:f,values:j})),Object(m.getSetting)("couponsEnabled",!0)&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(s.a,{onSubmit:E,isLoading:_})),Object(a.createElement)(p.ExperimentalDiscountsMeta.Slot,R),h&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(l.a,{showCalculator:c,showRateSelector:!0,values:j,currency:w})),!Object(m.getSetting)("displayCartPricesIncludingTax",!1)&&parseInt(j.total_tax,10)>0&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(p.TotalsTaxes,{showRateAfterTaxName:n,currency:w,values:j})),Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(i.a,{currency:w,values:j})),Object(a.createElement)(p.ExperimentalOrderMeta.Slot,S))})},96:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(131),s=n(4),l=n.n(s);n(159);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:n,currency:c,onValueChange:s,displayType:p="text",...u}=e;const b="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(b))return null;const d=b/10**c.minorUnit;if(!Number.isFinite(d))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...u,...i(c),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**c.minorUnit;s(t)}:()=>{};return Object(o.createElement)(r.a,a()({className:m,displayType:p},g,{value:d,onValueChange:O}))}},98:function(e,t,n){"use strict";var c=n(0);t.a=function(e){let{srcElement:t,size:n=24,...a}=e;return Object(c.isValidElement)(t)?Object(c.cloneElement)(t,{width:n,height:n,...a}):null}}}]);
build/cart-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'db5f8c457a957ed375302a6f967e78c4');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '9b9fac8491af583ccbd06d7cd731e0c7');
build/cart-frontend.js CHANGED
@@ -1,6 +1,6 @@
1
- !function(e){function t(t){for(var r,o,i=t[0],a=t[1],s=0,l=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);for(c&&c(t);l.length;)l.shift()()}var r={},n={20:0};function o(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,o),n.l=!0,n.exports}o.e=function(e){var t=[],r=n[e];if(0!==r)if(r)t.push(r[2]);else{var i=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[2]=i);var a,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(e){return o.p+""+({0:"vendors--atomic-block-components/add-to-cart--cart-blocks/order-summary--checkout-blocks/billing-ad--c5eb4dcd",1:"vendors--atomic-block-components/price--cart-blocks/line-items--cart-blocks/order-summary--checkout--8a3571de",2:"vendors--cart-blocks/order-summary--checkout-blocks/billing-address--checkout-blocks/order-summary---eb4d2cec",4:"vendors--cart-blocks/line-items--checkout-blocks/order-summary",21:"cart-blocks/accepted-payment-methods",22:"cart-blocks/checkout-button",23:"cart-blocks/empty-cart",24:"cart-blocks/express-payment",25:"cart-blocks/filled-cart",26:"cart-blocks/items",27:"cart-blocks/line-items",28:"cart-blocks/order-summary",29:"cart-blocks/totals"}[e]||e)+"-frontend.js?ver="+{0:"9f3f7160cea9fec6b729",1:"44e8b4583ef14d0d1fdc",2:"544e3b79f11e4e97eed8",4:"cd989cc8989e1e7f173e",21:"52c5e2e09ec74c18c7d8",22:"13a7f59edd591478027b",23:"5efe12d308899af46926",24:"6db52daf1ed2f22f81ec",25:"9037b21544c3401c2fc0",26:"3ea1fafa20cfb2ccda85",27:"a6622a250933c0e6e5d5",28:"dd080dbd438f49c8a0dd",29:"2ecb18aad18e1960818e"}[e]}(e);var c=new Error;a=function(t){s.onerror=s.onload=null,clearTimeout(l);var r=n[e];if(0!==r){if(r){var o=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+o+": "+i+")",c.name="ChunkLoadError",c.type=o,c.request=i,r[1](c)}n[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:s})}),12e4);s.onerror=s.onload=a,document.head.appendChild(s)}return Promise.all(t)},o.m=e,o.c=r,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},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 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 c=a;o(o.s=190)}([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.React},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var a=o.apply(null,n);a&&e.push(a)}}else if("object"===i)if(n.toString===Object.prototype.toString)for(var s in n)r.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t,r){"use strict";function n(){return(n=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}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},function(e,t,r){e.exports=r(42)()},function(e,t){e.exports=window.wp.data},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.default=e.exports,e.exports.__esModule=!0,r.apply(this,arguments)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wc.blocksCheckout},function(e,t){e.exports=window.wc.wcBlocksRegistry},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.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";var n=r(15),o=r.n(n),i=r(0),a=r(3),s=r(1),c=r(65),l=e=>{let{imageUrl:t=c.l+"/block-error.svg",header:r=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:a=Object(s.__)("Error:","woo-gutenberg-products-block"),button:l}=e;return Object(i.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(i.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(i.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(i.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(i.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(i.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},a?a+" ":"",o),l&&Object(i.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l)))};r(37);class u extends a.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(i.createElement)(i.Fragment,null,Object(i.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,text:n,errorMessagePrefix:o,renderError:a,button:s}=this.props,{errorMessage:c,hasError:u}=this.state;return u?"function"==typeof a?a({errorMessage:c}):Object(i.createElement)(l,{errorMessage:r?c:null,header:e,imageUrl:t,text:n,errorMessagePrefix:o,button:s}):this.props.children}}t.a=u},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),o=r(11),i=r.n(o);function a(e){const t=Object(n.useRef)(e);return i()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0);r(9);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),i=()=>Object(n.useContext)(o)},function(e,t){e.exports=window.wp.htmlEntities},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return v}));var n=r(5),o=r(0),i=r(6),a=r(9),s=r(19),c=r(70),l=r(109),u=r(18),d=r(67);const p=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(i.CART_STORE_KEY).invalidateResolutionForStore()},f=()=>{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(d.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(d.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",p),document.body.addEventListener("wc-blocks_removed_from_cart",p),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",p),document.body.removeEventListener("wc-blocks_removed_from_cart",p)}}window.wcBlocksStoreCartListeners.count++})(),f),[])},h={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},b={...h,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:i.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},y=e=>Object(c.a)(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(s.decodeEntities)(r)]})),E={cartCoupons:i.EMPTY_CART_COUPONS,cartItems:i.EMPTY_CART_ITEMS,cartFees:i.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:i.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:i.EMPTY_CART_ERRORS,billingAddress:b,shippingAddress:h,shippingRates:i.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:i.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:i.EMPTY_EXTENSIONS},v=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(u.a)(),s=null==r?void 0:r.previewCart,{shouldSelect:c}=e,d=Object(o.useRef)();m();const p=Object(a.useSelect)((e,r)=>{let{dispatch:n}=r;if(!c)return E;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:i.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:i.EMPTY_CART_ERRORS,billingAddress:b,shippingAddress:h,extensions:i.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(i.CART_STORE_KEY),a=o.getCartData(),u=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),f=o.isCustomerDataUpdating(),{receiveCart:m}=n(i.CART_STORE_KEY),g=y(a.billingAddress),v=a.needsShipping?y(a.shippingAddress):g,O=a.fees.length>0?a.fees.map(e=>y(e)):i.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):i.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:O,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:p,cartErrors:u,billingAddress:Object(l.a)(g),shippingAddress:Object(l.a)(v),extensions:a.extensions,shippingRates:a.shippingRates,shippingRatesLoading:f,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:m}},[c]);return d.current&&Object(n.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.primitives},,function(e,t,r){"use strict";(function(e){var n=r(0);r(45);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(66))},function(e,t){e.exports=window.wp.apiFetch},,function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var n=r(35);let o,i;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(o||(o={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(i||(i={}));const a=(e,t)=>Object(n.c)(e)&&"type"in e&&e.type===t,s=e=>a(e,o.SUCCESS),c=e=>a(e,o.ERROR),l=e=>a(e,o.FAIL),u=e=>!Object(n.c)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:i,shouldRetry:u,isSuccessResponse:s,isErrorResponse:c,isFailResponse:l})},function(e,t){e.exports=window.wp.deprecated},function(e,t,r){"use strict";r.d(t,"b",(function(){return T})),r.d(t,"a",(function(){return P}));var n=r(0),o=r(1),i=r(62),a=r(30),s=r.n(a),c=r(35);let l;!function(e){e.SET_IDLE="set_idle",e.SET_PRISTINE="set_pristine",e.SET_REDIRECT_URL="set_redirect_url",e.SET_COMPLETE="set_checkout_complete",e.SET_BEFORE_PROCESSING="set_before_processing",e.SET_AFTER_PROCESSING="set_after_processing",e.SET_PROCESSING_RESPONSE="set_processing_response",e.SET_PROCESSING="set_checkout_is_processing",e.SET_HAS_ERROR="set_checkout_has_error",e.SET_NO_ERROR="set_checkout_no_error",e.SET_CUSTOMER_ID="set_checkout_customer_id",e.SET_ORDER_ID="set_checkout_order_id",e.SET_ORDER_NOTES="set_checkout_order_notes",e.INCREMENT_CALCULATING="increment_calculating",e.DECREMENT_CALCULATING="decrement_calculating",e.SET_SHOULD_CREATE_ACCOUNT="set_should_create_account",e.SET_EXTENSION_DATA="set_extension_data"}(l||(l={}));const u=()=>({type:l.SET_IDLE}),d=e=>({type:l.SET_REDIRECT_URL,redirectUrl:e}),p=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:l.SET_COMPLETE,data:e}},f=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:e?l.SET_HAS_ERROR:l.SET_NO_ERROR}};var m=r(2);let h;!function(e){e.PRISTINE="pristine",e.IDLE="idle",e.PROCESSING="processing",e.COMPLETE="complete",e.BEFORE_PROCESSING="before_processing",e.AFTER_PROCESSING="after_processing"}(h||(h={}));const b={order_id:0,customer_id:0,...Object(m.getSetting)("checkoutData",{})||{}},g={redirectUrl:"",status:h.PRISTINE,hasError:!1,calculatingCount:0,orderId:b.order_id,orderNotes:"",customerId:b.customer_id,shouldCreateAccount:!1,processingResponse:null,extensionData:{}},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,{redirectUrl:t,type:r,customerId:n,orderId:o,orderNotes:i,extensionData:a,shouldCreateAccount:s,data:c}=arguments.length>1?arguments[1]:void 0,u=e;switch(r){case l.SET_PRISTINE:u=g;break;case l.SET_IDLE:u=e.status!==h.IDLE?{...e,status:h.IDLE}:e;break;case l.SET_REDIRECT_URL:u=void 0!==t&&t!==e.redirectUrl?{...e,redirectUrl:t}:e;break;case l.SET_PROCESSING_RESPONSE:u={...e,processingResponse:c};break;case l.SET_COMPLETE:u=e.status!==h.COMPLETE?{...e,status:h.COMPLETE,redirectUrl:void 0!==c&&"string"==typeof c.redirectUrl&&c.redirectUrl?c.redirectUrl:e.redirectUrl}:e;break;case l.SET_PROCESSING:u=e.status!==h.PROCESSING?{...e,status:h.PROCESSING,hasError:!1}:e,u=!1===u.hasError?u:{...u,hasError:!1};break;case l.SET_BEFORE_PROCESSING:u=e.status!==h.BEFORE_PROCESSING?{...e,status:h.BEFORE_PROCESSING,hasError:!1}:e;break;case l.SET_AFTER_PROCESSING:u=e.status!==h.AFTER_PROCESSING?{...e,status:h.AFTER_PROCESSING}:e;break;case l.SET_HAS_ERROR:u=e.hasError?e:{...e,hasError:!0},u=e.status===h.PROCESSING||e.status===h.BEFORE_PROCESSING?{...u,status:h.IDLE}:u;break;case l.SET_NO_ERROR:u=e.hasError?{...e,hasError:!1}:e;break;case l.INCREMENT_CALCULATING:u={...e,calculatingCount:e.calculatingCount+1};break;case l.DECREMENT_CALCULATING:u={...e,calculatingCount:Math.max(0,e.calculatingCount-1)};break;case l.SET_CUSTOMER_ID:u=void 0!==n?{...e,customerId:n}:e;break;case l.SET_ORDER_ID:u=void 0!==o?{...e,orderId:o}:e;break;case l.SET_SHOULD_CREATE_ACCOUNT:void 0!==s&&s!==e.shouldCreateAccount&&(u={...e,shouldCreateAccount:s});break;case l.SET_ORDER_NOTES:void 0!==i&&e.orderNotes!==i&&(u={...e,orderNotes:i});break;case l.SET_EXTENSION_DATA:void 0!==a&&e.extensionData!==a&&(u={...e,extensionData:a})}return u!==e&&r!==l.SET_PRISTINE&&u.status===h.PRISTINE&&(u.status=h.IDLE),u};var E=r(19),v=r(89),O=r(169);var S=r(170),_=r(160),j=r(32),w=r(38),k=r(9),C=r(29);const R=Object(n.createContext)({dispatchActions:{resetCheckout:()=>{},setRedirectUrl:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},incrementCalculating:()=>{},decrementCalculating:()=>{},setCustomerId:e=>{},setOrderId:e=>{},setOrderNotes:e=>{},setExtensionData:e=>{}},onSubmit:()=>{},isComplete:!1,isIdle:!1,isCalculating:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,redirectUrl:"",orderId:0,orderNotes:"",customerId:0,onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},hasOrder:!1,isCart:!1,shouldCreateAccount:!1,setShouldCreateAccount:e=>{},extensionData:{}}),T=()=>Object(n.useContext)(R),P=e=>{let{children:t,redirectUrl:r,isCart:a=!1}=e;g.redirectUrl=r;const[m,b]=Object(n.useReducer)(y,g),{setValidationErrors:T}=Object(_.b)(),{addErrorNotice:P,removeNotices:x}=Object(j.a)(),{dispatchCheckoutEvent:A}=Object(w.a)(),N=m.calculatingCount>0,{isSuccessResponse:M,isErrorResponse:I,isFailResponse:D,shouldRetry:L}=Object(C.c)(),{checkoutNotices:F,paymentNotices:V,expressPaymentNotices:B}=(()=>{const{noticeContexts:e}=Object(C.c)();return{checkoutNotices:Object(k.useSelect)(e=>e("core/notices").getNotices("wc/checkout"),[]),expressPaymentNotices:Object(k.useSelect)(t=>t("core/notices").getNotices(e.EXPRESS_PAYMENTS),[e.EXPRESS_PAYMENTS]),paymentNotices:Object(k.useSelect)(t=>t("core/notices").getNotices(e.PAYMENTS),[e.PAYMENTS])}})(),[U,H]=Object(n.useReducer)(v.b,{}),G=Object(n.useRef)(U),{onCheckoutAfterProcessingWithSuccess:z,onCheckoutAfterProcessingWithError:W,onCheckoutValidationBeforeProcessing:q}=(e=>Object(n.useMemo)(()=>({onCheckoutAfterProcessingWithSuccess:Object(O.a)("checkout_after_processing_with_success",e),onCheckoutAfterProcessingWithError:Object(O.a)("checkout_after_processing_with_error",e),onCheckoutValidationBeforeProcessing:Object(O.a)("checkout_validation_before_processing",e)}),[e]))(H);Object(n.useEffect)(()=>{G.current=U},[U]);const Y=Object(n.useMemo)(()=>function(){return s()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidationBeforeProcessing",plugin:"WooCommerce Blocks"}),q(...arguments)},[q]),X=Object(n.useMemo)(()=>({resetCheckout:()=>{b({type:l.SET_PRISTINE})},setRedirectUrl:e=>{b(d(e))},setHasError:e=>{b(f(e))},incrementCalculating:()=>{b({type:l.INCREMENT_CALCULATING})},decrementCalculating:()=>{b({type:l.DECREMENT_CALCULATING})},setCustomerId:e=>{var t;b((t=e,{type:l.SET_CUSTOMER_ID,customerId:t}))},setOrderId:e=>{b((e=>({type:l.SET_ORDER_ID,orderId:e}))(e))},setOrderNotes:e=>{b((e=>({type:l.SET_ORDER_NOTES,orderNotes:e}))(e))},setExtensionData:e=>{b((e=>({type:l.SET_EXTENSION_DATA,extensionData:e}))(e))},setAfterProcessing:e=>{const t=(e=>{const t={message:"",paymentStatus:"",redirectUrl:"",paymentDetails:{}};return"payment_result"in e&&(t.paymentStatus=e.payment_result.payment_status,t.redirectUrl=e.payment_result.redirect_url,e.payment_result.hasOwnProperty("payment_details")&&Array.isArray(e.payment_result.payment_details)&&e.payment_result.payment_details.forEach(e=>{let{key:r,value:n}=e;t.paymentDetails[r]=Object(E.decodeEntities)(n)})),"message"in e&&(t.message=Object(E.decodeEntities)(e.message)),!t.message&&"data"in e&&"status"in e.data&&e.data.status>299&&(t.message=Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")),t})(e);var r;t.redirectUrl&&b(d(t.redirectUrl)),b((r=t,{type:l.SET_PROCESSING_RESPONSE,data:r})),b({type:l.SET_AFTER_PROCESSING})}}),[]);Object(n.useEffect)(()=>{m.status===h.BEFORE_PROCESSING&&(x("error"),Object(S.a)(G.current,"checkout_validation_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;P(t),T(r)}),b(u()),b(f())):b({type:l.SET_PROCESSING})}))},[m.status,T,P,x,b]);const $=Object(i.a)(m.status),K=Object(i.a)(m.hasError);Object(n.useEffect)(()=>{if((m.status!==$||m.hasError!==K)&&m.status===h.AFTER_PROCESSING){const e={redirectUrl:m.redirectUrl,orderId:m.orderId,customerId:m.customerId,orderNotes:m.orderNotes,processingResponse:m.processingResponse};m.hasError?Object(S.b)(G.current,"checkout_after_processing_with_error",e).then(t=>{const r=(e=>{let t=null;return e.forEach(e=>{if((I(e)||D(e))&&e.message){const r=e.messageContext?{context:e.messageContext}:void 0;t=e,P(e.message,r)}}),t})(t);if(null!==r)L(r)?b(u()):b(p(r));else{if(!(F.some(e=>"error"===e.status)||B.some(e=>"error"===e.status)||V.some(e=>"error"===e.status))){var n;const t=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");P(t,{id:"checkout"})}b(u())}}):Object(S.b)(G.current,"checkout_after_processing_with_success",e).then(e=>{let t=null,r=null;if(e.forEach(e=>{M(e)&&(t=e),(I(e)||D(e))&&(r=e)}),t&&!r)b(p(t));else if(Object(c.c)(r)){if(r.message){const e=r.messageContext?{context:r.messageContext}:void 0;P(r.message,e)}L(r)?b(f(!0)):b(p(r))}else b(p())})}},[m.status,m.hasError,m.redirectUrl,m.orderId,m.customerId,m.orderNotes,m.processingResponse,$,K,X,P,I,D,M,L,F,B,V]);const J={onSubmit:Object(n.useCallback)(()=>{A("submit"),b({type:l.SET_BEFORE_PROCESSING})},[A]),isComplete:m.status===h.COMPLETE,isIdle:m.status===h.IDLE,isCalculating:N,isProcessing:m.status===h.PROCESSING,isBeforeProcessing:m.status===h.BEFORE_PROCESSING,isAfterProcessing:m.status===h.AFTER_PROCESSING,hasError:m.hasError,redirectUrl:m.redirectUrl,onCheckoutBeforeProcessing:Y,onCheckoutValidationBeforeProcessing:q,onCheckoutAfterProcessingWithSuccess:z,onCheckoutAfterProcessingWithError:W,dispatchActions:X,isCart:a,orderId:m.orderId,hasOrder:!!m.orderId,customerId:m.customerId,orderNotes:m.orderNotes,shouldCreateAccount:m.shouldCreateAccount,setShouldCreateAccount:e=>{return b((t=e,{type:l.SET_SHOULD_CREATE_ACCOUNT,shouldCreateAccount:t}));var t},extensionData:m.extensionData};return Object(n.createElement)(R.Provider,{value:J},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(87);const i=()=>{const{notices:e,createNotice:t,removeNotice:r,setIsSuppressed:i}=Object(o.b)(),a=Object(n.useRef)(e);Object(n.useEffect)(()=>{a.current=e},[e]);const s=Object(n.useMemo)(()=>({hasNoticesOfType:e=>a.current.some(t=>t.type===e),removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a.current.forEach(t=>{null!==e&&t.status!==e||r(t.id)})},removeNotice:r}),[r]),c=Object(n.useMemo)(()=>({addDefaultNotice:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("default",e,{...r})},addErrorNotice:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("error",e,{...r})},addWarningNotice:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("warning",e,{...r})},addInfoNotice:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("info",e,{...r})},addSuccessNotice:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("success",e,{...r})}}),[t]);return{notices:e,...s,...c,setIsSuppressed:i}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return g})),r.d(t,"a",(function(){return y}));var n=r(0),o=r(2),i=r(9),a=r(6),s=r(52),c=r(11),l=r.n(c),u=r(109),d=r(88),p=r(22),f=r(32);const m=(e,t)=>!(!function(e){return"email"in e}(t)||Object(u.c)(t)===Object(u.c)(e))||!!t.country&&!l()(Object(u.b)(e),Object(u.b)(t));var h=r(31);const b=Object(n.createContext)({billingData:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",email:"",phone:""},shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},setBillingData:()=>null,setShippingAddress:()=>null,shippingAsBilling:!0,setShippingAsBilling:()=>null}),g=()=>Object(n.useContext)(b),y=e=>{let{children:t}=e;const{billingData:r,shippingAddress:c,setBillingData:l,setShippingAddress:u}=(()=>{const{updateCustomerData:e}=Object(i.useDispatch)(a.CART_STORE_KEY),{addErrorNotice:t,removeNotice:r}=Object(f.a)(),{billingAddress:o,shippingAddress:c,cartIsLoading:l}=Object(p.a)(),[u,h]=Object(n.useState)(!1),[b,g]=Object(n.useState)({billingData:o,shippingAddress:c}),y=Object(n.useRef)(b);Object(n.useEffect)(()=>{if(u||l)return;const e={billingData:o,shippingAddress:c};y.current=e,g(e),h(!0)},[l,u,o,c]);const E=Object(n.useCallback)(e=>{g(t=>({...t,billingData:{...t.billingData,...e}}))},[]),v=Object(n.useCallback)(e=>{g(t=>({...t,shippingAddress:{...t.shippingAddress,...e}}))},[]),O=Object(s.a)(()=>{const n={};m(y.current.billingData,b.billingData)&&(n.billing_address=b.billingData),m(y.current.shippingAddress,b.shippingAddress)&&(n.shipping_address=b.shippingAddress),0!==Object.keys(n).length&&(y.current=b,e(n).then(()=>{r("checkout")}).catch(e=>{t(Object(d.b)(e),{id:"checkout"})}))},1e3);return Object(n.useEffect)(()=>{u&&O()},[u,b,O]),{billingData:b.billingData,shippingAddress:b.shippingAddress,setBillingData:E,setShippingAddress:v}})(),{cartNeedsShipping:g}=Object(p.a)(),{customerId:y}=Object(h.b)(),[E,v]=Object(n.useState)(()=>{return g&&(!y||(e=c,t=r,Object.keys(o.defaultAddressFields).every(r=>e[r]===t[r])));var e,t}),O={billingData:r,shippingAddress:c,setBillingData:l,setShippingAddress:u,shippingAsBilling:E,setShippingAsBilling:v};return Object(n.createElement)(b.Provider,{value:O},t)}},function(e,t){e.exports=window.wp.url},function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"d",(function(){return o})),r.d(t,"c",(function(){return i})),r.d(t,"e",(function(){return a})),r.d(t,"a",(function(){return s}));const n=e=>"number"==typeof e,o=e=>"string"==typeof e,i=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function a(e,t){return i(e)&&t in e}const s=e=>"boolean"==typeof e},,function(e,t){},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(48),o=r(0),i=r(22);const a=()=>{const e=Object(i.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(n.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},,function(e,t){e.exports=window.wc.priceFormat},,function(e,t,r){"use strict";var n=r(43);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,i,a){if(a!==n){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";r.d(t,"b",(function(){return j})),r.d(t,"a",(function(){return w}));var n=r(0),o=r(11),i=r.n(o),a=r(70);const s=e=>Object(a.a)(e.map(e=>{var t;let{package_id:r,shipping_rates:n}=e;return[r,null===(t=n.find(e=>e.selected))||void 0===t?void 0:t.rate_id]})),c={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},l={INVALID_COUNTRY:"woocommerce_rest_cart_shipping_rates_invalid_country",MISSING_COUNTRY:"woocommerce_rest_cart_shipping_rates_missing_country",INVALID_STATE:"woocommerce_rest_cart_shipping_rates_invalid_state"},u={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:()=>null,shippingErrorTypes:c,shippingRates:[],shippingRatesLoading:!1,selectedRates:[],setSelectedRates:()=>null,shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},setShippingAddress:()=>null,onShippingRateSuccess:()=>null,onShippingRateFail:()=>null,onShippingRateSelectSuccess:()=>null,onShippingRateSelectFail:()=>null,needsShipping:!1},d=(e,t)=>{let{type:r}=t;return Object.values(c).includes(r)?r:e};var p=r(89),f=r(169);const m=e=>({onSuccess:Object(f.a)("shipping_rates_success",e),onFail:Object(f.a)("shipping_rates_fail",e),onSelectSuccess:Object(f.a)("shipping_rate_select_success",e),onSelectFail:Object(f.a)("shipping_rate_select_fail",e)});var h=r(170),b=r(31),g=r(33),y=r(22),E=r(99);const{NONE:v,INVALID_ADDRESS:O,UNKNOWN:S}=c,_=Object(n.createContext)(u),j=()=>Object(n.useContext)(_),w=e=>{let{children:t}=e;const{dispatchActions:r}=Object(b.b)(),{shippingAddress:o,setShippingAddress:a}=Object(g.b)(),{cartNeedsShipping:u,cartHasCalculatedShipping:f,shippingRates:j,shippingRatesLoading:w,cartErrors:k}=Object(y.a)(),{selectShippingRate:C,isSelectingRate:R}=Object(E.a)(),[T,P]=Object(n.useReducer)(d,v),[x,A]=Object(n.useReducer)(p.b,{}),N=Object(n.useRef)(x),M=Object(n.useMemo)(()=>({onShippingRateSuccess:m(A).onSuccess,onShippingRateFail:m(A).onFail,onShippingRateSelectSuccess:m(A).onSelectSuccess,onShippingRateSelectFail:m(A).onSelectFail}),[A]);Object(n.useEffect)(()=>{N.current=x},[x]);const I=Object(n.useRef)(()=>s(j));Object(n.useEffect)(()=>{const e=s(j);i()(I.current,e)||(I.current=e)},[j]),Object(n.useEffect)(()=>{w?r.incrementCalculating():r.decrementCalculating()},[w,r]),Object(n.useEffect)(()=>{R?r.incrementCalculating():r.decrementCalculating()},[R,r]),Object(n.useEffect)(()=>{k.length>0&&k.some(e=>!(!e.code||!Object.values(l).includes(e.code)))?P({type:O}):P({type:v})},[k]);const D=Object(n.useMemo)(()=>({isPristine:T===v,isValid:T===v,hasInvalidAddress:T===O,hasError:T===S||T===O}),[T]);Object(n.useEffect)(()=>{w||0!==j.length&&!D.hasError||Object(h.a)(N.current,"shipping_rates_fail",{hasInvalidAddress:D.hasInvalidAddress,hasError:D.hasError})},[j,w,D.hasError,D.hasInvalidAddress]),Object(n.useEffect)(()=>{!w&&j.length>0&&!D.hasError&&Object(h.a)(N.current,"shipping_rates_success",j)},[j,w,D.hasError]),Object(n.useEffect)(()=>{R||(D.hasError?Object(h.a)(N.current,"shipping_rate_select_fail",{hasError:D.hasError,hasInvalidAddress:D.hasInvalidAddress}):Object(h.a)(N.current,"shipping_rate_select_success",I.current))},[R,D.hasError,D.ha