@anker-in/headless-ui 1.1.9-alpha.1765446497658 → 1.1.9-alpha.1765794787092

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/cjs/biz-components/AiuiProvider/index.d.ts +1 -1
  2. package/dist/cjs/biz-components/AiuiProvider/index.js.map +1 -1
  3. package/dist/cjs/biz-components/CollectionShelves/CollectionShelvesItem.d.ts +4 -0
  4. package/dist/cjs/biz-components/CollectionShelves/CollectionShelvesItem.js +2 -0
  5. package/dist/cjs/biz-components/CollectionShelves/CollectionShelvesItem.js.map +7 -0
  6. package/dist/cjs/biz-components/CollectionShelves/index.d.ts +7 -0
  7. package/dist/cjs/biz-components/CollectionShelves/index.js +2 -0
  8. package/dist/cjs/biz-components/CollectionShelves/index.js.map +7 -0
  9. package/dist/cjs/biz-components/CollectionsBanner/index.d.ts +7 -0
  10. package/dist/cjs/biz-components/CollectionsBanner/index.js +2 -0
  11. package/dist/cjs/biz-components/CollectionsBanner/index.js.map +7 -0
  12. package/dist/cjs/biz-components/CollectionsBanner/types.d.ts +43 -0
  13. package/dist/cjs/biz-components/CollectionsBanner/types.js +2 -0
  14. package/dist/cjs/biz-components/CollectionsBanner/types.js.map +7 -0
  15. package/dist/cjs/biz-components/CollectionsFilters/FilterCardWrap.d.ts +19 -0
  16. package/dist/cjs/biz-components/CollectionsFilters/FilterCardWrap.js +2 -0
  17. package/dist/cjs/biz-components/CollectionsFilters/FilterCardWrap.js.map +7 -0
  18. package/dist/cjs/biz-components/CollectionsFilters/FilterCardWrapItem.d.ts +10 -0
  19. package/dist/cjs/biz-components/CollectionsFilters/FilterCardWrapItem.js +2 -0
  20. package/dist/cjs/biz-components/CollectionsFilters/FilterCardWrapItem.js.map +7 -0
  21. package/dist/cjs/biz-components/CollectionsFilters/FilterHeader.d.ts +13 -0
  22. package/dist/cjs/biz-components/CollectionsFilters/FilterHeader.js +2 -0
  23. package/dist/cjs/biz-components/CollectionsFilters/FilterHeader.js.map +7 -0
  24. package/dist/cjs/biz-components/CollectionsFilters/FilterList.d.ts +14 -0
  25. package/dist/cjs/biz-components/CollectionsFilters/FilterList.js +2 -0
  26. package/dist/cjs/biz-components/CollectionsFilters/FilterList.js.map +7 -0
  27. package/dist/cjs/biz-components/CollectionsFilters/component/AnimatedUL.d.ts +5 -0
  28. package/dist/cjs/biz-components/CollectionsFilters/component/AnimatedUL.js +2 -0
  29. package/dist/cjs/biz-components/CollectionsFilters/component/AnimatedUL.js.map +7 -0
  30. package/dist/cjs/biz-components/CollectionsFilters/component/TabFilter.d.ts +12 -0
  31. package/dist/cjs/biz-components/CollectionsFilters/component/TabFilter.js +2 -0
  32. package/dist/cjs/biz-components/CollectionsFilters/component/TabFilter.js.map +7 -0
  33. package/dist/cjs/biz-components/CollectionsFilters/component/filtersFun.d.ts +12 -0
  34. package/dist/cjs/biz-components/CollectionsFilters/component/filtersFun.js +2 -0
  35. package/dist/cjs/biz-components/CollectionsFilters/component/filtersFun.js.map +7 -0
  36. package/dist/cjs/biz-components/CollectionsFilters/component/helper.d.ts +81 -0
  37. package/dist/cjs/biz-components/CollectionsFilters/component/helper.js +2 -0
  38. package/dist/cjs/biz-components/CollectionsFilters/component/helper.js.map +7 -0
  39. package/dist/cjs/biz-components/CollectionsFilters/component/price.d.ts +25 -0
  40. package/dist/cjs/biz-components/CollectionsFilters/component/price.js +2 -0
  41. package/dist/cjs/biz-components/CollectionsFilters/component/price.js.map +7 -0
  42. package/dist/cjs/biz-components/CollectionsFilters/component/priceProps.d.ts +215 -0
  43. package/dist/cjs/biz-components/CollectionsFilters/component/priceProps.js +2 -0
  44. package/dist/cjs/biz-components/CollectionsFilters/component/priceProps.js.map +7 -0
  45. package/dist/cjs/biz-components/CollectionsFilters/index.d.ts +24 -0
  46. package/dist/cjs/biz-components/CollectionsFilters/index.js +2 -0
  47. package/dist/cjs/biz-components/CollectionsFilters/index.js.map +7 -0
  48. package/dist/cjs/biz-components/HeaderNavigation/index.d.ts +2 -5
  49. package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
  50. package/dist/cjs/biz-components/HeaderNavigation/index.js.map +3 -3
  51. package/dist/cjs/biz-components/NavigationSearch/index.js +2 -2
  52. package/dist/cjs/biz-components/NavigationSearch/index.js.map +2 -2
  53. package/dist/cjs/biz-components/Paginator/index.d.ts +7 -0
  54. package/dist/cjs/biz-components/Paginator/index.js +7 -0
  55. package/dist/cjs/biz-components/Paginator/index.js.map +7 -0
  56. package/dist/cjs/biz-components/TextMarquee/index.d.ts +10 -0
  57. package/dist/cjs/biz-components/TextMarquee/index.js +2 -0
  58. package/dist/cjs/biz-components/TextMarquee/index.js.map +7 -0
  59. package/dist/cjs/biz-components/TextModal/index.js +1 -1
  60. package/dist/cjs/biz-components/TextModal/index.js.map +3 -3
  61. package/dist/cjs/biz-components/Title/types.js +1 -1
  62. package/dist/cjs/biz-components/Title/types.js.map +1 -1
  63. package/dist/cjs/biz-components/VideoModal/index.js +1 -1
  64. package/dist/cjs/biz-components/VideoModal/index.js.map +2 -2
  65. package/dist/cjs/biz-components/index.d.ts +9 -0
  66. package/dist/cjs/biz-components/index.js +1 -1
  67. package/dist/cjs/biz-components/index.js.map +3 -3
  68. package/dist/cjs/components/breadcrumb.d.ts +12 -0
  69. package/dist/cjs/components/breadcrumb.js +2 -0
  70. package/dist/cjs/components/breadcrumb.js.map +7 -0
  71. package/dist/cjs/components/index.d.ts +1 -0
  72. package/dist/cjs/components/index.js +1 -1
  73. package/dist/cjs/components/index.js.map +3 -3
  74. package/dist/cjs/helpers/utils.d.ts +1 -0
  75. package/dist/cjs/helpers/utils.js +1 -1
  76. package/dist/cjs/helpers/utils.js.map +3 -3
  77. package/dist/cjs/hooks/useRollout.d.ts +2 -2
  78. package/dist/cjs/hooks/useRollout.js +1 -1
  79. package/dist/cjs/hooks/useRollout.js.map +2 -2
  80. package/dist/esm/biz-components/AiuiProvider/index.d.ts +1 -1
  81. package/dist/esm/biz-components/AiuiProvider/index.js.map +1 -1
  82. package/dist/esm/biz-components/CollectionShelves/CollectionShelvesItem.d.ts +4 -0
  83. package/dist/esm/biz-components/CollectionShelves/CollectionShelvesItem.js +2 -0
  84. package/dist/esm/biz-components/CollectionShelves/CollectionShelvesItem.js.map +7 -0
  85. package/dist/esm/biz-components/CollectionShelves/index.d.ts +7 -0
  86. package/dist/esm/biz-components/CollectionShelves/index.js +2 -0
  87. package/dist/esm/biz-components/CollectionShelves/index.js.map +7 -0
  88. package/dist/esm/biz-components/CollectionsBanner/index.d.ts +7 -0
  89. package/dist/esm/biz-components/CollectionsBanner/index.js +2 -0
  90. package/dist/esm/biz-components/CollectionsBanner/index.js.map +7 -0
  91. package/dist/esm/biz-components/CollectionsBanner/types.d.ts +43 -0
  92. package/dist/esm/biz-components/CollectionsBanner/types.js +1 -0
  93. package/dist/esm/biz-components/CollectionsBanner/types.js.map +7 -0
  94. package/dist/esm/biz-components/CollectionsFilters/FilterCardWrap.d.ts +19 -0
  95. package/dist/esm/biz-components/CollectionsFilters/FilterCardWrap.js +2 -0
  96. package/dist/esm/biz-components/CollectionsFilters/FilterCardWrap.js.map +7 -0
  97. package/dist/esm/biz-components/CollectionsFilters/FilterCardWrapItem.d.ts +10 -0
  98. package/dist/esm/biz-components/CollectionsFilters/FilterCardWrapItem.js +2 -0
  99. package/dist/esm/biz-components/CollectionsFilters/FilterCardWrapItem.js.map +7 -0
  100. package/dist/esm/biz-components/CollectionsFilters/FilterHeader.d.ts +13 -0
  101. package/dist/esm/biz-components/CollectionsFilters/FilterHeader.js +2 -0
  102. package/dist/esm/biz-components/CollectionsFilters/FilterHeader.js.map +7 -0
  103. package/dist/esm/biz-components/CollectionsFilters/FilterList.d.ts +14 -0
  104. package/dist/esm/biz-components/CollectionsFilters/FilterList.js +2 -0
  105. package/dist/esm/biz-components/CollectionsFilters/FilterList.js.map +7 -0
  106. package/dist/esm/biz-components/CollectionsFilters/component/AnimatedUL.d.ts +5 -0
  107. package/dist/esm/biz-components/CollectionsFilters/component/AnimatedUL.js +2 -0
  108. package/dist/esm/biz-components/CollectionsFilters/component/AnimatedUL.js.map +7 -0
  109. package/dist/esm/biz-components/CollectionsFilters/component/TabFilter.d.ts +12 -0
  110. package/dist/esm/biz-components/CollectionsFilters/component/TabFilter.js +2 -0
  111. package/dist/esm/biz-components/CollectionsFilters/component/TabFilter.js.map +7 -0
  112. package/dist/esm/biz-components/CollectionsFilters/component/filtersFun.d.ts +12 -0
  113. package/dist/esm/biz-components/CollectionsFilters/component/filtersFun.js +2 -0
  114. package/dist/esm/biz-components/CollectionsFilters/component/filtersFun.js.map +7 -0
  115. package/dist/esm/biz-components/CollectionsFilters/component/helper.d.ts +81 -0
  116. package/dist/esm/biz-components/CollectionsFilters/component/helper.js +2 -0
  117. package/dist/esm/biz-components/CollectionsFilters/component/helper.js.map +7 -0
  118. package/dist/esm/biz-components/CollectionsFilters/component/price.d.ts +25 -0
  119. package/dist/esm/biz-components/CollectionsFilters/component/price.js +2 -0
  120. package/dist/esm/biz-components/CollectionsFilters/component/price.js.map +7 -0
  121. package/dist/esm/biz-components/CollectionsFilters/component/priceProps.d.ts +215 -0
  122. package/dist/esm/biz-components/CollectionsFilters/component/priceProps.js +2 -0
  123. package/dist/esm/biz-components/CollectionsFilters/component/priceProps.js.map +7 -0
  124. package/dist/esm/biz-components/CollectionsFilters/index.d.ts +24 -0
  125. package/dist/esm/biz-components/CollectionsFilters/index.js +2 -0
  126. package/dist/esm/biz-components/CollectionsFilters/index.js.map +7 -0
  127. package/dist/esm/biz-components/HeaderNavigation/index.d.ts +2 -5
  128. package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
  129. package/dist/esm/biz-components/HeaderNavigation/index.js.map +3 -3
  130. package/dist/esm/biz-components/NavigationSearch/index.js +2 -2
  131. package/dist/esm/biz-components/NavigationSearch/index.js.map +2 -2
  132. package/dist/esm/biz-components/Paginator/index.d.ts +7 -0
  133. package/dist/esm/biz-components/Paginator/index.js +7 -0
  134. package/dist/esm/biz-components/Paginator/index.js.map +7 -0
  135. package/dist/esm/biz-components/TextMarquee/index.d.ts +10 -0
  136. package/dist/esm/biz-components/TextMarquee/index.js +2 -0
  137. package/dist/esm/biz-components/TextMarquee/index.js.map +7 -0
  138. package/dist/esm/biz-components/TextModal/index.js +1 -1
  139. package/dist/esm/biz-components/TextModal/index.js.map +2 -2
  140. package/dist/esm/biz-components/VideoModal/index.js +1 -1
  141. package/dist/esm/biz-components/VideoModal/index.js.map +2 -2
  142. package/dist/esm/biz-components/index.d.ts +9 -0
  143. package/dist/esm/biz-components/index.js +1 -1
  144. package/dist/esm/biz-components/index.js.map +2 -2
  145. package/dist/esm/components/breadcrumb.d.ts +12 -0
  146. package/dist/esm/components/breadcrumb.js +2 -0
  147. package/dist/esm/components/breadcrumb.js.map +7 -0
  148. package/dist/esm/components/index.d.ts +1 -0
  149. package/dist/esm/components/index.js +1 -1
  150. package/dist/esm/components/index.js.map +2 -2
  151. package/dist/esm/helpers/utils.d.ts +1 -0
  152. package/dist/esm/helpers/utils.js +1 -1
  153. package/dist/esm/helpers/utils.js.map +3 -3
  154. package/dist/esm/hooks/useRollout.d.ts +2 -2
  155. package/dist/esm/hooks/useRollout.js +1 -1
  156. package/dist/esm/hooks/useRollout.js.map +3 -3
  157. package/package.json +1 -1
  158. package/style.css +23 -0
@@ -0,0 +1,215 @@
1
+ export declare enum RuleType {
2
+ AUTO_FREE_GIFT = 1,// 自动赠品
3
+ BUNDLE = 2,// 组合
4
+ VOLUME_DISCOUNT = 3,// 量价折扣
5
+ ORDER_DISCOUNT = 4,// 订单折扣
6
+ PRICE_DISCOUNT = 5
7
+ }
8
+ export type FunctionMemberPriceResult = {
9
+ hasMemberPrice: boolean;
10
+ useCoupon: boolean;
11
+ originalPrice: number;
12
+ originalPriceWithCurrency: string;
13
+ salePrice: number;
14
+ salePriceWithCurrency: string;
15
+ salePriceWithoutCoupon: number;
16
+ salePriceWithoutCouponWithCurrency: string;
17
+ savePrice: number;
18
+ savePriceWithCurrency: string;
19
+ savePriceWithoutCoupon: number;
20
+ savePriceWithoutCouponWithCurrency: string;
21
+ };
22
+ export declare enum ProductionsCombination {
23
+ SAME_PRODUCT = 0,// 相同产品
24
+ SAME_VARIANT = 1,// 相同变体
25
+ MIX_MATCH = 2
26
+ }
27
+ export declare enum DiscountOptions {
28
+ MINIMUM_QUANTITY = 1,
29
+ FIXED_QUANTITY = 2,
30
+ TIERED_QUANTITY = 3
31
+ }
32
+ export declare enum DISCOUNT_TYPE {
33
+ PERCENTAGE = 1,// 百分比
34
+ FIXED_AMOUNT = 2,// 固定金额
35
+ FIXED_PRICE = 3
36
+ }
37
+ export declare enum ROUND_SELECTED {
38
+ ROUND_HIGHEST = 1,// 向上取整
39
+ ROUND_LOWEST = 2,// 向下取整
40
+ ROUND_NEAREST = 3
41
+ }
42
+ export declare enum DISCOUNT_BASE_TYPE {
43
+ CURRENT_PRICE = 1,// 折后价
44
+ COMPARE_AT_PRICE = 2
45
+ }
46
+ export type TieredDiscount = {
47
+ quantity: number;
48
+ discount: number;
49
+ discount_type: DISCOUNT_TYPE;
50
+ };
51
+ type VariantItem = {
52
+ variant_id: string;
53
+ sku: string;
54
+ handle: string;
55
+ };
56
+ export type RuleCondition = {
57
+ with_special_url_params: string[];
58
+ without_special_url_params: string[];
59
+ with_user_tags: string[];
60
+ without_user_tags: string[];
61
+ };
62
+ export type DiscountConfig = {
63
+ discount_type: DISCOUNT_TYPE;
64
+ discount_value: number;
65
+ price_ending_conf: {
66
+ apply_price_ending: boolean;
67
+ conf_one_decimal_place: boolean;
68
+ conf_two_decimal_place: false;
69
+ one_decimal_place: number;
70
+ two_decimal_place: number;
71
+ round_selected: ROUND_SELECTED;
72
+ };
73
+ };
74
+ export type FunctionDiscountConfig = {
75
+ rule_id: number;
76
+ rule_type: RuleType;
77
+ discount_labels: {
78
+ cart_checkout_label: string;
79
+ product_label: string;
80
+ sold_out_label: string;
81
+ };
82
+ discount_combinations: {
83
+ other_order_discounts: boolean;
84
+ other_product_discounts: boolean;
85
+ shipping_discounts: boolean;
86
+ };
87
+ rule_conditions: RuleCondition[];
88
+ };
89
+ export type VolumeConfig = {
90
+ result_detail: {
91
+ productions_combination: ProductionsCombination;
92
+ discount_options: DiscountOptions;
93
+ discount_exclude_customed_price: boolean;
94
+ tiered_discounts: TieredDiscount[];
95
+ main_product: {
96
+ variant_list: VariantItem[];
97
+ all_store_variant: boolean;
98
+ };
99
+ };
100
+ } & FunctionDiscountConfig;
101
+ export type FunctionMemberPriceConfig = {
102
+ result_detail: {
103
+ member_discounts: {
104
+ main_products: {
105
+ variants: {
106
+ variant_id: string;
107
+ sku: string;
108
+ handle: string;
109
+ discount_value: number;
110
+ }[];
111
+ skip_variants: {
112
+ variant_id: string;
113
+ sku: string;
114
+ handle: string;
115
+ discount_value: number;
116
+ }[];
117
+ dynamic_conf: {
118
+ in_collections?: string[];
119
+ not_in_collections?: string[];
120
+ in_products?: string[];
121
+ not_in_products?: string[];
122
+ SKU: {
123
+ in?: string[];
124
+ not_in?: string[];
125
+ start_with?: string;
126
+ notstart_with?: string;
127
+ end_with?: string;
128
+ unend_with?: string;
129
+ contain?: string;
130
+ uncontain?: string;
131
+ };
132
+ };
133
+ all_store_variant: boolean;
134
+ };
135
+ discount_conf: DiscountConfig;
136
+ }[];
137
+ limit_discount_max: number;
138
+ };
139
+ } & FunctionDiscountConfig;
140
+ export type PriceDiscountConfig = FunctionDiscountConfig & {
141
+ result_detail: {
142
+ main_product: {
143
+ variant_list: {
144
+ variant_id: string;
145
+ sku: string;
146
+ handle: string;
147
+ }[];
148
+ all_store_variant: boolean;
149
+ };
150
+ price_conf: {
151
+ discount_type: DISCOUNT_TYPE;
152
+ discount_base: DISCOUNT_BASE_TYPE;
153
+ discount_amount: number;
154
+ price_ending_conf: {
155
+ apply_price_ending: false;
156
+ one_decimal_place: number;
157
+ two_decimal_place: number;
158
+ round_selected: ROUND_SELECTED;
159
+ };
160
+ };
161
+ };
162
+ };
163
+ export type ProductImage = {
164
+ url: string;
165
+ alt?: string;
166
+ };
167
+ export type ProductOption = {
168
+ __typename?: 'MultipleChoiceOption';
169
+ id: string;
170
+ displayName: string;
171
+ values: ProductOptionValues[];
172
+ };
173
+ export type ProductOptionValues = {
174
+ label: string;
175
+ hexColors?: string[];
176
+ };
177
+ export type ProductVariant = {
178
+ id: string | number;
179
+ options: ProductOption[];
180
+ availableForSale?: boolean;
181
+ quantityAvailable: number;
182
+ metafields?: Record<string, any>;
183
+ [key: string]: any;
184
+ };
185
+ export type ProductPrice = {
186
+ value: number;
187
+ currencyCode?: 'USD' | 'EUR' | 'ARS' | string;
188
+ retailPrice?: number;
189
+ salePrice?: number;
190
+ listPrice?: number;
191
+ extendedSalePrice?: number;
192
+ extendedListPrice?: number;
193
+ };
194
+ export type Product = any & {
195
+ id: string;
196
+ name: string;
197
+ description: string;
198
+ descriptionHtml?: string;
199
+ productType?: string;
200
+ sku?: string;
201
+ slug?: string;
202
+ handle?: string;
203
+ path?: string;
204
+ images: ProductImage[];
205
+ variants: ProductVariant[];
206
+ price: ProductPrice;
207
+ listPrice?: number;
208
+ options: ProductOption[];
209
+ preRender?: string;
210
+ seo?: any;
211
+ metafields?: {
212
+ [key: string]: any;
213
+ };
214
+ };
215
+ export {};
@@ -0,0 +1,2 @@
1
+ var i=(n=>(n[n.AUTO_FREE_GIFT=1]="AUTO_FREE_GIFT",n[n.BUNDLE=2]="BUNDLE",n[n.VOLUME_DISCOUNT=3]="VOLUME_DISCOUNT",n[n.ORDER_DISCOUNT=4]="ORDER_DISCOUNT",n[n.PRICE_DISCOUNT=5]="PRICE_DISCOUNT",n))(i||{}),r=(t=>(t[t.SAME_PRODUCT=0]="SAME_PRODUCT",t[t.SAME_VARIANT=1]="SAME_VARIANT",t[t.MIX_MATCH=2]="MIX_MATCH",t))(r||{}),o=(t=>(t[t.MINIMUM_QUANTITY=1]="MINIMUM_QUANTITY",t[t.FIXED_QUANTITY=2]="FIXED_QUANTITY",t[t.TIERED_QUANTITY=3]="TIERED_QUANTITY",t))(o||{}),s=(t=>(t[t.PERCENTAGE=1]="PERCENTAGE",t[t.FIXED_AMOUNT=2]="FIXED_AMOUNT",t[t.FIXED_PRICE=3]="FIXED_PRICE",t))(s||{}),a=(t=>(t[t.ROUND_HIGHEST=1]="ROUND_HIGHEST",t[t.ROUND_LOWEST=2]="ROUND_LOWEST",t[t.ROUND_NEAREST=3]="ROUND_NEAREST",t))(a||{}),u=(e=>(e[e.CURRENT_PRICE=1]="CURRENT_PRICE",e[e.COMPARE_AT_PRICE=2]="COMPARE_AT_PRICE",e))(u||{});export{u as DISCOUNT_BASE_TYPE,s as DISCOUNT_TYPE,o as DiscountOptions,r as ProductionsCombination,a as ROUND_SELECTED,i as RuleType};
2
+ //# sourceMappingURL=priceProps.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/biz-components/CollectionsFilters/component/priceProps.ts"],
4
+ "sourcesContent": ["export enum RuleType {\n AUTO_FREE_GIFT = 1, // \u81EA\u52A8\u8D60\u54C1\n BUNDLE = 2, // \u7EC4\u5408\n VOLUME_DISCOUNT = 3, // \u91CF\u4EF7\u6298\u6263\n ORDER_DISCOUNT = 4, // \u8BA2\u5355\u6298\u6263\n PRICE_DISCOUNT = 5, // \u4EF7\u683C\u6298\u6263\n}\n\nexport type FunctionMemberPriceResult = {\n // \u662F\u5426\u5305\u542B\u4F1A\u5458\u4EF7\n hasMemberPrice: boolean\n // \u662F\u5426\u53EF\u4EE5\u53E0\u52A0\u5238\n useCoupon: boolean\n // \u539F\u4EF7\n originalPrice: number\n // \u539F\u4EF7\u5E26\u8D27\u5E01\u7B26\u53F7\n originalPriceWithCurrency: string\n // \u6298\u540E\u4EF7\n salePrice: number\n // \u6298\u540E\u4EF7\u5E26\u8D27\u5E01\u7B26\u53F7\n salePriceWithCurrency: string\n // \u4E0D\u4F7F\u7528\u5238\u7684\u6298\u540E\u4EF7\n salePriceWithoutCoupon: number\n // \u4E0D\u4F7F\u7528\u5238\u7684\u6298\u540E\u4EF7\u5E26\u8D27\u5E01\u7B26\u53F7\n salePriceWithoutCouponWithCurrency: string\n // \u5305\u542B\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePrice: number\n // \u5305\u542B\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\u5E26\u8D27\u5E01\u7B26\u53F7\n savePriceWithCurrency: string\n // \u4E0D\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePriceWithoutCoupon: number\n // \u4E0D\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\u5E26\u8D27\u5E01\u7B26\u53F7\n savePriceWithoutCouponWithCurrency: string\n}\n\nexport enum ProductionsCombination {\n SAME_PRODUCT, // \u76F8\u540C\u4EA7\u54C1\n SAME_VARIANT, // \u76F8\u540C\u53D8\u4F53\n MIX_MATCH, // \u7EC4\u5408\n}\n\nexport enum DiscountOptions {\n MINIMUM_QUANTITY = 1,\n FIXED_QUANTITY,\n TIERED_QUANTITY,\n}\n\nexport enum DISCOUNT_TYPE {\n PERCENTAGE = 1, // \u767E\u5206\u6BD4\n FIXED_AMOUNT, // \u56FA\u5B9A\u91D1\u989D\n FIXED_PRICE, // \u56FA\u5B9A\u4EF7\u683C\n}\n\nexport enum ROUND_SELECTED {\n ROUND_HIGHEST = 1, // \u5411\u4E0A\u53D6\u6574\n ROUND_LOWEST, // \u5411\u4E0B\u53D6\u6574\n ROUND_NEAREST, // \u56DB\u820D\u4E94\u5165\n}\n\nexport enum DISCOUNT_BASE_TYPE {\n CURRENT_PRICE = 1, // \u6298\u540E\u4EF7\n COMPARE_AT_PRICE = 2, // \u5404\u6E20\u9053\u62C9\u9F50\u7684\u539F\u4EF7\n}\n\nexport type TieredDiscount = {\n quantity: number //\u6570\u91CF\n discount: number //\u6298\u6263\n discount_type: DISCOUNT_TYPE\n}\n\n// \u5B9A\u4E49\u53D8\u4F53\u9879\u7C7B\u578B\ntype VariantItem = {\n variant_id: string // \u53D8\u4F53ID\n sku: string // \u5E93\u5B58\u5355\u4F4D\n handle: string // \u5904\u7406\u6807\u8BC6\n}\n\n// \u5B9A\u4E49\u89C4\u5219\u6761\u4EF6\u7C7B\u578B\nexport type RuleCondition = {\n with_special_url_params: string[] // \u5305\u542B\u7279\u6B8AURL\u53C2\u6570\n without_special_url_params: string[] // \u4E0D\u5305\u542B\u7279\u6B8AURL\u53C2\u6570\n with_user_tags: string[] // \u5305\u542B\u7528\u6237\u6807\u7B7E\n without_user_tags: string[] // \u4E0D\u5305\u542B\u7528\u6237\u6807\u7B7E\n}\n\n// \u4EF7\u683C\u8BA1\u7B97\u914D\u7F6E\uFF0C\u5C0F\u6570\u4F4D\u53D6\u820D\u89C4\u5219\nexport type DiscountConfig = {\n discount_type: DISCOUNT_TYPE\n discount_value: number\n price_ending_conf: {\n apply_price_ending: boolean\n conf_one_decimal_place: boolean\n conf_two_decimal_place: false\n one_decimal_place: number\n two_decimal_place: number\n round_selected: ROUND_SELECTED\n }\n}\n\n// function \u6298\u6263\u7C7B\u578B\u914D\u7F6E\u7684\u57FA\u7840\u7C7B\u578B\nexport type FunctionDiscountConfig = {\n // \u89C4\u5219ID\n rule_id: number\n // \u89C4\u5219\u7C7B\u578B\n rule_type: RuleType\n // \u6298\u6263\u6807\u7B7E\n discount_labels: {\n // \u8D2D\u7269\u8F66\u7ED3\u8D26\u6807\u7B7E\n cart_checkout_label: string\n // \u4EA7\u54C1\u6807\u7B7E\n product_label: string\n // \u552E\u7F44\u6807\u7B7E\n sold_out_label: string\n }\n // \u6298\u6263\u53EF\u7EC4\u5408\u89C4\u5219\n discount_combinations: {\n // \u662F\u5426\u4E0E\u5176\u4ED6\u8BA2\u5355\u6298\u6263\u7EC4\u5408\n other_order_discounts: boolean\n // \u662F\u5426\u4E0E\u5176\u4ED6\u4EA7\u54C1\u6298\u6263\u7EC4\u5408\n other_product_discounts: boolean\n // \u662F\u5426\u4E0E\u5176\u4ED6\u8FD0\u8D39\u6298\u6263\u7EC4\u5408\n shipping_discounts: boolean\n }\n // \u89C4\u5219\u6761\u4EF6\n rule_conditions: RuleCondition[]\n}\n\n// \u9636\u68AF\u6298\u6263\u7C7B\u578B\u914D\u7F6E\uFF08\u5C0Fb\uFF09\nexport type VolumeConfig = {\n // \u89C4\u5219\u7ED3\u679C\n result_detail: {\n //\u4EA7\u54C1\u53E0\u52A0\u8BA1\u6570\u89C4\u5219\n productions_combination: ProductionsCombination\n //\u6298\u6263\u5E94\u7528\u65B9\u5F0F\n discount_options: DiscountOptions\n //\u4E0D\u5305\u542B\u5B9A\u5236\u5316\u4EF7\u683C\n discount_exclude_customed_price: boolean //false.\u6298\u6263\u4E0D\u6392\u9664\u5B9A\u5236\u5316\u4EF7\u683C true.\u6298\u6263\u6392\u9664\u5B9A\u5236\u5316\u4EF7\u683C\n //\u6298\u6263\u9636\u68AF\u5217\u8868\uFF08\u5012\u5E8F\uFF0C\u4ECE\u5927\u5230\u5C0F\uFF09\n tiered_discounts: TieredDiscount[]\n main_product: {\n variant_list: VariantItem[] // \u53D8\u4F53\u5217\u8868\n all_store_variant: boolean // \u6240\u6709\u5546\u5E97\u53D8\u4F53\n }\n }\n} & FunctionDiscountConfig\n\nexport type FunctionMemberPriceConfig = {\n // \u89C4\u5219\u7ED3\u679C\n result_detail: {\n member_discounts: {\n main_products: {\n // \u6307\u5B9A\u751F\u6548\u7684 variant\n variants: {\n variant_id: string\n sku: string\n handle: string\n discount_value: number\n }[]\n // \u4E0D\u751F\u6548\u7684 variant\n skip_variants: {\n variant_id: string\n sku: string\n handle: string\n discount_value: number\n }[]\n // \u751F\u6548\u7684 variant \u7684\u52A8\u6001\u914D\u7F6E\u89C4\u5219\n dynamic_conf: {\n // \u5728\u6307\u5B9A collection \u4E2D\n in_collections?: string[]\n // \u4E0D\u5728\u6307\u5B9A collection \u4E2D\n not_in_collections?: string[]\n // \u5728\u6307\u5B9A\u4EA7\u54C1\u4E2D\n in_products?: string[]\n // \u4E0D\u5728\u6307\u5B9A\u4EA7\u54C1\u4E2D\n not_in_products?: string[]\n // SKU\u540D\u79F0\u89C4\u5219\n SKU: {\n // \u5FC5\u987B\u5728\u6307\u5B9ASKU\u8303\u56F4\u5185\n in?: string[]\n // \u5FC5\u987B\u4E0D\u5728\u6307\u5B9ASKU\u8303\u56F4\u5185\n not_in?: string[]\n // \u5FC5\u987B\u4EE5\u6307\u5B9A\u5B57\u7B26\u4E32\u5F00\u5934\n start_with?: string\n // \u5FC5\u987B\u4E0D\u4EE5\u6307\u5B9A\u5B57\u7B26\u4E32\u5F00\u5934\n notstart_with?: string\n // \u5FC5\u987B\u4EE5\u6307\u5B9A\u5B57\u7B26\u4E32\u7ED3\u675F\n end_with?: string\n // \u5FC5\u987B\u4E0D\u4EE5\u6307\u5B9A\u5B57\u7B26\u4E32\u7ED3\u675F\n unend_with?: string\n // \u5FC5\u987B\u5305\u542B\u6307\u5B9A\u5B57\u7B26\u4E32\n contain?: string\n // \u5FC5\u987B\u4E0D\u5305\u542B\u6307\u5B9A\u5B57\u7B26\u4E32\n uncontain?: string\n }\n }\n all_store_variant: boolean\n }\n discount_conf: DiscountConfig\n }[]\n limit_discount_max: number\n }\n} & FunctionDiscountConfig\n\n// \u76F4\u964D\u6298\u6263\nexport type PriceDiscountConfig = FunctionDiscountConfig & {\n result_detail: {\n main_product: {\n variant_list: {\n variant_id: string\n sku: string\n handle: string\n }[]\n all_store_variant: boolean\n }\n price_conf: {\n discount_type: DISCOUNT_TYPE\n discount_base: DISCOUNT_BASE_TYPE\n discount_amount: number\n price_ending_conf: {\n apply_price_ending: false\n one_decimal_place: number\n two_decimal_place: number\n round_selected: ROUND_SELECTED\n }\n }\n }\n}\n\nexport type ProductImage = {\n url: string\n alt?: string\n}\n\nexport type ProductOption = {\n __typename?: 'MultipleChoiceOption'\n id: string\n displayName: string\n values: ProductOptionValues[]\n}\n\nexport type ProductOptionValues = {\n label: string\n hexColors?: string[]\n}\n\nexport type ProductVariant = {\n id: string | number\n options: ProductOption[]\n availableForSale?: boolean\n quantityAvailable: number\n metafields?: Record<string, any>\n [key: string]: any\n}\n\nexport type ProductPrice = {\n value: number\n currencyCode?: 'USD' | 'EUR' | 'ARS' | string\n retailPrice?: number\n salePrice?: number\n listPrice?: number\n extendedSalePrice?: number\n extendedListPrice?: number\n}\n\nexport type Product = any & {\n id: string\n name: string\n description: string\n descriptionHtml?: string\n productType?: string\n sku?: string\n slug?: string\n handle?: string\n path?: string\n images: ProductImage[]\n variants: ProductVariant[]\n price: ProductPrice\n listPrice?: number\n options: ProductOption[]\n preRender?: string\n seo?: any\n metafields?: { [key: string]: any }\n}\n"],
5
+ "mappings": "AAAO,IAAKA,OACVA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,OAAS,GAAT,SACAA,IAAA,gBAAkB,GAAlB,kBACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,eAAiB,GAAjB,iBALUA,OAAA,IAmCAC,OACVA,IAAA,+BACAA,IAAA,+BACAA,IAAA,yBAHUA,OAAA,IAMAC,OACVA,IAAA,iBAAmB,GAAnB,mBACAA,IAAA,mCACAA,IAAA,qCAHUA,OAAA,IAMAC,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,+BACAA,IAAA,6BAHUA,OAAA,IAMAC,OACVA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,+BACAA,IAAA,iCAHUA,OAAA,IAMAC,OACVA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,iBAAmB,GAAnB,mBAFUA,OAAA",
6
+ "names": ["RuleType", "ProductionsCombination", "DiscountOptions", "DISCOUNT_TYPE", "ROUND_SELECTED", "DISCOUNT_BASE_TYPE"]
7
+ }
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ type CollectionsFiltersProps = {
3
+ metafields: any;
4
+ result: any;
5
+ allResult: any;
6
+ pageSize?: number;
7
+ filterPrice: any;
8
+ isLoading?: boolean;
9
+ refreshStarRating?: () => void;
10
+ loadMore?: React.ReactNode;
11
+ noResultNode?: React.ReactNode;
12
+ data?: any;
13
+ onNextPage?: (v: string) => void;
14
+ onPrevPage?: (v: string) => void;
15
+ onFilteredChange?: (filtered: any) => void;
16
+ onSortAndReverseChange?: (sortKey: string, reverse: boolean) => void;
17
+ onPrimaryChange?: (item: any, sku: string) => void;
18
+ onSecondaryChange?: (item: any, sku: string) => void;
19
+ };
20
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<CollectionsFiltersProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps> & {
21
+ className?: string | undefined;
22
+ data?: Record<string, any> | undefined;
23
+ } & import("react").RefAttributes<any>>;
24
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import{jsx as l,jsxs as h}from"react/jsx-runtime";import $ from"./FilterList.js";import j from"./FilterHeader.js";import ee from"./FilterCardWrap.js";import{withLayout as te}from"../../shared/Styles.js";import oe from"./component/TabFilter.js";import{useState as o,useMemo as c,useEffect as O,useRef as w}from"react";import{handleSortKeyAndReverse as re,handleFilters as I,handleFilterOptions as ne,getComponentData as se}from"./component/filtersFun.js";function ae(L){const{data:i,result:n={},allResult:y={},loadMore:K=null,noResultNode:_=null,metafields:s={},filterPrice:v={},isLoading:b=!1,refreshStarRating:k,onFilteredChange:C,onSortAndReverseChange:M,onPrimaryChange:A,onSecondaryChange:V,onNextPage:z,onPrevPage:T}=L,{shop_filters_pair:a}=s,{data:F}=se(s,"FilterProduct"),[d,W]=o(!1),[E,P]=o(!1),[H,q]=o([]),[r,x]=o({}),[u,B]=o(0),[p,f]=o(1),[G,J]=o(!1),[Q,U]=o(!1),X=w(null),m=w(!1);c(()=>{const e=a?.filter_txt?.sortList,[t,Z]=re(e,u);M?.(t,Z)},[a?.filter_txt?.sortList,r,u]);const Y=e=>!e?.metafields?.seoSetting?.noindex,R=c(()=>y?.products?.filter(Y)?.length||0,[y?.products]),g=c(()=>ne(n,v,a,F),[v,n?.filters,a?.filter_txt?.offers?.name,a?.filter_txt?.offers?.onsale]),S=c(()=>g?.length?g?.map?.(e=>({...e,options:e?.options?.map?.(t=>({...t,checked:r?.[e?.value]?.indexOf?.(t?.value)>-1}))})):[],[r,g]),N=e=>{x?.({}),e&&f(1),C?.(I({}))},D=e=>{x(e),f(1),C?.(I(e))};return O(()=>{const t=(r?.offers||[])?.includes?.("onsale");J(t)},[r]),O(()=>{!m.current&&n?.products?.length&&(m.current=!0),m.current&&U(!0)},[n?.products]),h("div",{className:"box-border size-full",children:[l("div",{className:"laptop:mb-12 mb-6",children:l(oe,{tabs:i?.tabItems,filtered:r,filtersPair:S,filtersData:F,metafields:s,onTabClick:e=>D(e)})}),l(j,{total:R||0,metafields:s,closeFilter:d,sortKeyIndx:u,shopifyData:i,onSortChange:B,onCloseFilter:W,onClearFiltered:()=>N(),onMobileOpenDrawer:P}),h("div",{className:"tablet:flex desktop:gap-x-16 tablet:gap-x-8 flex-1 overflow-hidden",children:[!d&&l($,{shopifyData:i,filtered:r,openOptions:H,closeFilter:d,filtersPair:S,mobileDrawerVisible:E,onFilteredChange:D,onClearFiltered:()=>N(!1),onOpenOptions:q,onCloseDrawer:P}),h("div",{className:"relative flex-1 overflow-y-auto",children:[l(ee,{page:p,result:n,shopifyData:i,total:R,isSale:G,ref:X,metafields:s,closeFilter:d,noResultNode:Q&&!b?_:null,refreshStarRating:k,onNextPage:e=>{f(p+1),z?.(e)},onPrevPage:e=>{f(p-1),T?.(e)},onPrimaryChange:(e,t)=>A?.(e,t),onSecondaryChange:(e,t)=>V?.(e,t)}),b&&K||null]})]})]})}var me=te(ae);export{me as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/biz-components/CollectionsFilters/index.tsx"],
4
+ "sourcesContent": ["import FilterList from './FilterList.js'\nimport FilterHeader from './FilterHeader.js'\nimport FilterCardWrap from './FilterCardWrap.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport TabFilter from './component/TabFilter.js'\nimport { useState, useMemo, useEffect, useRef } from 'react'\nimport {\n handleSortKeyAndReverse,\n handleFilters,\n handleFilterOptions,\n getComponentData,\n} from './component/filtersFun.js'\n\ntype CollectionsFiltersProps = {\n metafields: any\n result: any\n allResult: any\n pageSize?: number\n filterPrice: any\n isLoading?: boolean\n refreshStarRating?: () => void\n loadMore?: React.ReactNode\n noResultNode?: React.ReactNode\n data?: any\n onNextPage?: (v: string) => void\n onPrevPage?: (v: string) => void\n onFilteredChange?: (filtered: any) => void\n onSortAndReverseChange?: (sortKey: string, reverse: boolean) => void\n onPrimaryChange?: (item: any, sku: string) => void\n onSecondaryChange?: (item: any, sku: string) => void\n}\nfunction CollectionsFilters(props: CollectionsFiltersProps) {\n const {\n data,\n result = {},\n allResult = {},\n loadMore = null,\n noResultNode = null,\n metafields = {},\n filterPrice = {},\n isLoading = false,\n refreshStarRating,\n onFilteredChange,\n onSortAndReverseChange,\n onPrimaryChange,\n onSecondaryChange,\n onNextPage,\n onPrevPage,\n } = props\n\n const { shop_filters_pair } = metafields\n\n const { data: filterProductData } = getComponentData(metafields, 'FilterProduct')\n\n const [closeFilter, setCloseFilter] = useState<boolean>(false)\n const [mobileDrawerVisible, setMobileDrawerVisible] = useState<boolean>(false) // \u79FB\u52A8\u7AEF\u7B5B\u9009\u9009\u9879\u5C55\u793A\u72B6\u6001\n const [openOptions, setOpenOptions] = useState<any[]>([]) // \u5C55\u5F00\u7684\u7B5B\u9009\u9879\n const [filtered, setFiltered] = useState<any>({}) // \u9009\u62E9\u7684\u7B5B\u9009\u9009\u9879\n const [sortKeyIndx, setSortKeyIndx] = useState<number>(0) // \u6392\u5E8F\u65B9\u5F0F\n const [currentPage, setCurrentPage] = useState<number>(1)\n const [isSale, setIsSale] = useState<boolean>(false)\n const [isRefresh, setIsRefresh] = useState<boolean>(false)\n\n const filterCardWrapRef = useRef<any>(null)\n const initRefresh = useRef<boolean>(false)\n\n // \u5904\u7406\u6392\u5E8F\u6570\u636E\n useMemo(() => {\n const sortList = shop_filters_pair?.filter_txt?.sortList\n const [sortKey, reverse] = handleSortKeyAndReverse(sortList, sortKeyIndx)\n onSortAndReverseChange?.(sortKey, reverse)\n }, [shop_filters_pair?.filter_txt?.sortList, filtered, sortKeyIndx])\n\n const hasNoIndex = (product: { metafields: { seoSetting: { noindex: any } } }) => {\n return !product?.metafields?.seoSetting?.noindex\n }\n const totalCount = useMemo(() => {\n return allResult?.products?.filter(hasNoIndex)?.length || 0\n }, [allResult?.products])\n\n // \u5904\u7406\u7B5B\u9009\u9879\u6570\u636E\n const filtersOptions = useMemo(() => {\n return handleFilterOptions(result, filterPrice, shop_filters_pair, filterProductData)\n }, [\n filterPrice,\n result?.filters,\n shop_filters_pair?.filter_txt?.offers?.name,\n shop_filters_pair?.filter_txt?.offers?.onsale,\n ])\n\n const filtersPair = useMemo(() => {\n if (!filtersOptions?.length) return []\n return filtersOptions?.map?.((filter: any) => {\n return {\n ...filter,\n options: filter?.options?.map?.((opt: any) => {\n return {\n ...opt,\n checked: filtered?.[filter?.value]?.indexOf?.(opt?.value) > -1,\n }\n }),\n }\n })\n }, [filtered, filtersOptions])\n\n const clearFiltered = (flag?: boolean) => {\n setFiltered?.({})\n if (flag) {\n setCurrentPage(1)\n }\n onFilteredChange?.(handleFilters({}))\n }\n\n const filterChange = (v: any) => {\n setFiltered(v)\n setCurrentPage(1)\n onFilteredChange?.(handleFilters(v))\n }\n\n useEffect(() => {\n const offers = filtered?.offers || []\n const isShowSale = offers?.includes?.('onsale')\n setIsSale(isShowSale)\n }, [filtered])\n\n useEffect(() => {\n if (!initRefresh.current && result?.products?.length) {\n initRefresh.current = true\n }\n if (initRefresh.current) {\n setIsRefresh(true)\n }\n }, [result?.products])\n\n return (\n <div className=\"box-border size-full\">\n {/* \u5934\u90E8 */}\n <div className=\"laptop:mb-12 mb-6\">\n <TabFilter\n tabs={data?.tabItems}\n filtered={filtered}\n filtersPair={filtersPair}\n filtersData={filterProductData}\n metafields={metafields}\n onTabClick={v => filterChange(v)}\n />\n </div>\n <FilterHeader\n total={totalCount || 0}\n metafields={metafields}\n closeFilter={closeFilter}\n sortKeyIndx={sortKeyIndx}\n shopifyData={data}\n onSortChange={setSortKeyIndx}\n onCloseFilter={setCloseFilter}\n onClearFiltered={() => clearFiltered()}\n onMobileOpenDrawer={setMobileDrawerVisible}\n />\n {/* PC\u7B5B\u9009\u9009\u9879 */}\n <div className=\"tablet:flex desktop:gap-x-16 tablet:gap-x-8 flex-1 overflow-hidden\">\n {!closeFilter && (\n <FilterList\n shopifyData={data}\n filtered={filtered}\n openOptions={openOptions}\n closeFilter={closeFilter}\n filtersPair={filtersPair}\n mobileDrawerVisible={mobileDrawerVisible}\n onFilteredChange={filterChange}\n onClearFiltered={() => clearFiltered(false)}\n onOpenOptions={setOpenOptions}\n onCloseDrawer={setMobileDrawerVisible}\n />\n )}\n <div className=\"relative flex-1 overflow-y-auto\">\n <FilterCardWrap\n page={currentPage}\n result={result}\n shopifyData={data}\n total={totalCount}\n isSale={isSale}\n ref={filterCardWrapRef}\n metafields={metafields}\n closeFilter={closeFilter}\n noResultNode={isRefresh && !isLoading ? noResultNode : null}\n refreshStarRating={refreshStarRating}\n onNextPage={v => {\n setCurrentPage(currentPage + 1)\n onNextPage?.(v)\n }}\n onPrevPage={v => {\n setCurrentPage(currentPage - 1)\n onPrevPage?.(v)\n }}\n onPrimaryChange={(e, data) => onPrimaryChange?.(e, data)}\n onSecondaryChange={(e, data) => onSecondaryChange?.(e, data)}\n />\n {isLoading ? loadMore || null : null}\n </div>\n </div>\n </div>\n )\n}\n\nexport default withLayout(CollectionsFilters)\n"],
5
+ "mappings": "AA0IQ,cAAAA,EAoCA,QAAAC,MApCA,oBA1IR,OAAOC,MAAgB,kBACvB,OAAOC,MAAkB,oBACzB,OAAOC,OAAoB,sBAC3B,OAAS,cAAAC,OAAkB,yBAC3B,OAAOC,OAAe,2BACtB,OAAS,YAAAC,EAAU,WAAAC,EAAS,aAAAC,EAAW,UAAAC,MAAc,QACrD,OACE,2BAAAC,GACA,iBAAAC,EACA,uBAAAC,GACA,oBAAAC,OACK,4BAoBP,SAASC,GAAmBC,EAAgC,CAC1D,KAAM,CACJ,KAAAC,EACA,OAAAC,EAAS,CAAC,EACV,UAAAC,EAAY,CAAC,EACb,SAAAC,EAAW,KACX,aAAAC,EAAe,KACf,WAAAC,EAAa,CAAC,EACd,YAAAC,EAAc,CAAC,EACf,UAAAC,EAAY,GACZ,kBAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,WAAAC,CACF,EAAIf,EAEE,CAAE,kBAAAgB,CAAkB,EAAIV,EAExB,CAAE,KAAMW,CAAkB,EAAInB,GAAiBQ,EAAY,eAAe,EAE1E,CAACY,EAAaC,CAAc,EAAI5B,EAAkB,EAAK,EACvD,CAAC6B,EAAqBC,CAAsB,EAAI9B,EAAkB,EAAK,EACvE,CAAC+B,EAAaC,CAAc,EAAIhC,EAAgB,CAAC,CAAC,EAClD,CAACiC,EAAUC,CAAW,EAAIlC,EAAc,CAAC,CAAC,EAC1C,CAACmC,EAAaC,CAAc,EAAIpC,EAAiB,CAAC,EAClD,CAACqC,EAAaC,CAAc,EAAItC,EAAiB,CAAC,EAClD,CAACuC,EAAQC,CAAS,EAAIxC,EAAkB,EAAK,EAC7C,CAACyC,EAAWC,CAAY,EAAI1C,EAAkB,EAAK,EAEnD2C,EAAoBxC,EAAY,IAAI,EACpCyC,EAAczC,EAAgB,EAAK,EAGzCF,EAAQ,IAAM,CACZ,MAAM4C,EAAWpB,GAAmB,YAAY,SAC1C,CAACqB,EAASC,CAAO,EAAI3C,GAAwByC,EAAUV,CAAW,EACxEf,IAAyB0B,EAASC,CAAO,CAC3C,EAAG,CAACtB,GAAmB,YAAY,SAAUQ,EAAUE,CAAW,CAAC,EAEnE,MAAMa,EAAcC,GACX,CAACA,GAAS,YAAY,YAAY,QAErCC,EAAajD,EAAQ,IAClBW,GAAW,UAAU,OAAOoC,CAAU,GAAG,QAAU,EACzD,CAACpC,GAAW,QAAQ,CAAC,EAGlBuC,EAAiBlD,EAAQ,IACtBK,GAAoBK,EAAQK,EAAaS,EAAmBC,CAAiB,EACnF,CACDV,EACAL,GAAQ,QACRc,GAAmB,YAAY,QAAQ,KACvCA,GAAmB,YAAY,QAAQ,MACzC,CAAC,EAEK2B,EAAcnD,EAAQ,IACrBkD,GAAgB,OACdA,GAAgB,MAAOE,IACrB,CACL,GAAGA,EACH,QAASA,GAAQ,SAAS,MAAOC,IACxB,CACL,GAAGA,EACH,QAASrB,IAAWoB,GAAQ,KAAK,GAAG,UAAUC,GAAK,KAAK,EAAI,EAC9D,EACD,CACH,EACD,EAXmC,CAAC,EAYpC,CAACrB,EAAUkB,CAAc,CAAC,EAEvBI,EAAiBC,GAAmB,CACxCtB,IAAc,CAAC,CAAC,EACZsB,GACFlB,EAAe,CAAC,EAElBnB,IAAmBd,EAAc,CAAC,CAAC,CAAC,CACtC,EAEMoD,EAAgBC,GAAW,CAC/BxB,EAAYwB,CAAC,EACbpB,EAAe,CAAC,EAChBnB,IAAmBd,EAAcqD,CAAC,CAAC,CACrC,EAEA,OAAAxD,EAAU,IAAM,CAEd,MAAMyD,GADS1B,GAAU,QAAU,CAAC,IACT,WAAW,QAAQ,EAC9CO,EAAUmB,CAAU,CACtB,EAAG,CAAC1B,CAAQ,CAAC,EAEb/B,EAAU,IAAM,CACV,CAAC0C,EAAY,SAAWjC,GAAQ,UAAU,SAC5CiC,EAAY,QAAU,IAEpBA,EAAY,SACdF,EAAa,EAAI,CAErB,EAAG,CAAC/B,GAAQ,QAAQ,CAAC,EAGnBjB,EAAC,OAAI,UAAU,uBAEb,UAAAD,EAAC,OAAI,UAAU,oBACb,SAAAA,EAACM,GAAA,CACC,KAAMW,GAAM,SACZ,SAAUuB,EACV,YAAamB,EACb,YAAa1B,EACb,WAAYX,EACZ,WAAY2C,GAAKD,EAAaC,CAAC,EACjC,EACF,EACAjE,EAACG,EAAA,CACC,MAAOsD,GAAc,EACrB,WAAYnC,EACZ,YAAaY,EACb,YAAaQ,EACb,YAAazB,EACb,aAAc0B,EACd,cAAeR,EACf,gBAAiB,IAAM2B,EAAc,EACrC,mBAAoBzB,EACtB,EAEApC,EAAC,OAAI,UAAU,qEACZ,WAACiC,GACAlC,EAACE,EAAA,CACC,YAAae,EACb,SAAUuB,EACV,YAAaF,EACb,YAAaJ,EACb,YAAayB,EACb,oBAAqBvB,EACrB,iBAAkB4B,EAClB,gBAAiB,IAAMF,EAAc,EAAK,EAC1C,cAAevB,EACf,cAAeF,EACjB,EAEFpC,EAAC,OAAI,UAAU,kCACb,UAAAD,EAACI,GAAA,CACC,KAAMwC,EACN,OAAQ1B,EACR,YAAaD,EACb,MAAOwC,EACP,OAAQX,EACR,IAAKI,EACL,WAAY5B,EACZ,YAAaY,EACb,aAAcc,GAAa,CAACxB,EAAYH,EAAe,KACvD,kBAAmBI,EACnB,WAAYwC,GAAK,CACfpB,EAAeD,EAAc,CAAC,EAC9Bd,IAAamC,CAAC,CAChB,EACA,WAAYA,GAAK,CACfpB,EAAeD,EAAc,CAAC,EAC9Bb,IAAakC,CAAC,CAChB,EACA,gBAAiB,CAAC,EAAGhD,IAASW,IAAkB,EAAGX,CAAI,EACvD,kBAAmB,CAAC,EAAGA,IAASY,IAAoB,EAAGZ,CAAI,EAC7D,EACCO,GAAYJ,GAAY,MAC3B,GACF,GACF,CAEJ,CAEA,IAAO+C,GAAQ9D,GAAWU,EAAkB",
6
+ "names": ["jsx", "jsxs", "FilterList", "FilterHeader", "FilterCardWrap", "withLayout", "TabFilter", "useState", "useMemo", "useEffect", "useRef", "handleSortKeyAndReverse", "handleFilters", "handleFilterOptions", "getComponentData", "CollectionsFilters", "props", "data", "result", "allResult", "loadMore", "noResultNode", "metafields", "filterPrice", "isLoading", "refreshStarRating", "onFilteredChange", "onSortAndReverseChange", "onPrimaryChange", "onSecondaryChange", "onNextPage", "onPrevPage", "shop_filters_pair", "filterProductData", "closeFilter", "setCloseFilter", "mobileDrawerVisible", "setMobileDrawerVisible", "openOptions", "setOpenOptions", "filtered", "setFiltered", "sortKeyIndx", "setSortKeyIndx", "currentPage", "setCurrentPage", "isSale", "setIsSale", "isRefresh", "setIsRefresh", "filterCardWrapRef", "initRefresh", "sortList", "sortKey", "reverse", "hasNoIndex", "product", "totalCount", "filtersOptions", "filtersPair", "filter", "opt", "clearFiltered", "flag", "filterChange", "v", "isShowSale", "CollectionsFilters_default"]
7
+ }
@@ -1,7 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { HeaderNavigationProps } from './types.js';
3
- declare const _default: React.ForwardRefExoticComponent<Omit<Omit<HeaderNavigationProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps> & {
4
- className?: string | undefined;
5
- data?: Record<string, any> | undefined;
6
- }, "ref"> & React.RefAttributes<any>>;
7
- export default _default;
3
+ declare const HeaderNavigation: React.ForwardRefExoticComponent<HeaderNavigationProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default HeaderNavigation;
@@ -1,2 +1,2 @@
1
- "use client";import{Fragment as X,jsx as e,jsxs as n}from"react/jsx-runtime";import we,{forwardRef as ee,useCallback as K,useEffect as H,useImperativeHandle as Ce,useMemo as M,useRef as F,useState as D}from"react";import{Picture as Q,Text as y,Button as T,Container as te,Link as O,Heading as ce}from"../../components/index.js";import{withLayout as Se}from"../../shared/Styles.js";import{cn as N,atobID as Le}from"../../helpers/utils.js";import Me,{useNavContext as I}from"./NavProvider.js";import{HeaderNavigationMenu as $,HeaderNavigationBlockType as W,HeaderNavigationActionBlockType as _}from"./types.js";import"react-responsive";import{debounce as De}from"es-toolkit";import Pe from"jump.js";import{useGSAP as se}from"@gsap/react";import{gsap as ie}from"gsap";import{WithSidebar as de,WithSupports as ue,WithMulticol as me,WithGroupCategory as pe}from"./withCategory.js";import{Menu as ze,Close as be,User as Ee,RightArrow as He,LeftArrow as Be,DownArrow as ae,Polygon as Te}from"./icons/index.js";import $e from"../NavigationSearch/index.js";const Re=ee((t,a)=>{const{data:{headerNavigation:l}={},buildProps:c,event:r,profile:b,theme:d="light",isTop:u=!1,searchResult:i,onSearch:k,isSearching:s,keywords:w,onPrimaryNavClick:x,onSeriesProductClick:f,onSidebarNavClick:v,headerId:g,cartCount:m}=t,o=F(null),[p,C]=D(!1),[S,z]=D(!1),[L,U]=D(!1),[J,P]=D(!1),R=F(null),A=()=>{const G=document?.querySelector("body")?.offsetWidth||0;P(G<=1440)};H(()=>(A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}),[]),Ce(a,()=>R.current),H(()=>{R.current&&u&&Pe(R.current,{duration:0,offset:R.current?.getBoundingClientRect()?.bottom||0})},[u]),H(()=>{r&&(r.search=()=>C(!0))},[r]),se(()=>{o?.current&&p&&ie.fromTo(o.current,{height:0},{height:"auto",duration:.3})},[p]),H(()=>{document.documentElement.style.overflow=p?"hidden":"auto"},[p]);const ne=M(()=>l?.headerBar?.actions?.find(G=>G?.blockType===_.Search)?.searchBar?.[0]||{},[l]);return e(Me,{buildProps:c,profile:b,isMobile:J,event:r,payloadData:l,onSidebarNavClick:v,onSeriesProductClick:f,cartCount:m,children:e("header",{id:g||"header","data-ui-component-id":"HeaderNavigation",className:"relative z-[100] bg-white",ref:R,children:n("div",{className:N("hover:bg-white hover:text-black",d==="light"?"text-black":"text-white",{}),onClick:()=>U(!0),children:[e(Ae,{data:l,className:"desktop:block hidden !bg-white",theme:d,onNavItemClick:()=>U(!0),onPrimaryNavClick:x}),e(Oe,{data:l,className:"desktop:hidden block !bg-white",onPrimaryNavClick:x}),p&&n("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${R?.current?.getBoundingClientRect()?.top}px)`},children:[e("div",{ref:o,className:N("overflow-y-auto",{}),children:e($e,{data:ne,keywords:w,isSearching:s,searchResult:i,onSearch:G=>{k?.(G)},onClose:()=>{k?.(),C(!1)}})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>C(!1)})]})]})})})}),Ae=ee((t,a)=>{const{data:l,onNavItemClick:c,className:r,theme:b,onPrimaryNavClick:d}=t,{event:u,profile:i}=I(),[k,s]=D(!1),w=M(()=>pe(l?.categories?.filter(h=>h?.pcShow)),[l]),[x,f]=D(null),[v,g]=D([]),m=F(null),[o,p]=D(!1),C=F(null),S=F(null),z=F(w.map(h=>Array(h?.length||0).fill(null)));H(()=>{w?.length&&g(w?.map((h,E)=>h?.map((B,j)=>({groupIndex:E,index:j,open:!1}))))},[w]);const L=M(()=>{let h=null;for(const E of v){for(const B of E)if(B.open){h=B;break}if(h)break}return h},[v]);H(()=>{document.documentElement.style.overflow=L?.open||o?"hidden":"auto"},[L?.open,o]);const U=(h,E,B)=>{if(p(!1),x?.components?.[0]?.blockType===W.Links)x?.components?.[0]?.url&&window.open(x?.components?.[0]?.url);else{const j=w?.flat()||[],q=j?.findIndex(re=>re?.id===w[E][B]?.id);h.stopPropagation(),c?.(),d?.(j[q],q),f(w[E][B]),g(re=>re.map(ke=>ke.map(Y=>Y.groupIndex===E&&Y.index===B?{...Y,open:!Y.open}:{...Y,open:!1})))}},J=()=>{g(h=>h.map(E=>E.map(B=>({...B,open:!1}))))},P=M(()=>{if(x)return x?.components?.[0]?.blockType},[x]),R=de(je,x),A=me(Fe,x),ne=ue(_e,{categoriesItem:x,currentNavItemRef:z.current?.[L?.groupIndex||0]?.[L?.index||0]}),G=M(()=>{switch(P){case W.Sidebar:return e(R,{});case W.Supports:return e(ne,{});case W.Multicol:return e(A,{});default:return null}},[P,x]),le=M(()=>l?.headerBar?.actions?.filter(h=>h?.pcShow),[l]),V=M(()=>le?.find(h=>h?.blockType===_.Profile),[le]),oe=K(()=>{p(h=>!h)},[]);return H(()=>{if(m?.current){const h=m.current;return h.addEventListener("click",oe),()=>{h.removeEventListener("click",oe)}}},[oe]),se(()=>{L?.open&&ie.fromTo(S?.current,{height:0},{height:"auto"})},[L?.open]),n(te,{className:N("relative h-[96px]",r),children:[n("div",{ref:C,onClick:J,className:"flex h-full flex-col justify-end gap-4",children:[n("div",{className:"flex items-center justify-between",children:[e(ye,{}),e(xe,{ref:m,actions:le,activeStatus:o})]}),e("div",{className:"flex justify-between",children:w?.map((h,E)=>e("div",{className:"flex gap-3",children:h?.map((B,j)=>e("div",{ref:q=>{z.current[E][j]=q},className:"group cursor-pointer",children:n("div",{className:"relative",children:[n("div",{className:"flex items-center gap-1 pb-4",onClick:q=>U(q,E,j),children:[e(y,{html:B.text,className:"text-sm font-bold leading-[1.4]"}),e(ae,{className:N("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":L?.groupIndex===E&&L?.index===j,"opacity-100":k&&L?.groupIndex===E&&L?.index===j})})]}),e("div",{className:N("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":L?.groupIndex===E&&L?.index===j},b==="dark"?"bg-white":"bg-[#080A0F]")})]})},B.id))},`groupCategory-${E}`))})]}),n("div",{className:N("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(L?.open&&x)}),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{height:`calc(100dvh - ${C?.current?.getBoundingClientRect()?.bottom}px)`},children:[e("div",{ref:S,className:N("relative z-50",{"overflow-hidden":P!==W.Supports}),children:G}),e("div",{className:"flex-1 bg-transparent",onClick:J})]}),o&&n("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",children:[e("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${m?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:i?.email?n(X,{children:[e(y,{html:i?.nick_name||V?.welcome,className:"text-sm font-bold"}),e("div",{className:"mt-2 h-px bg-[#D9D9D9]"}),e("div",{className:"mt-2",children:V?.profiles?.map(h=>e(Z,{className:"py-2",label:h?.title,href:h?.url},h.id))})]}):n(X,{children:[e(Te,{className:"absolute -top-2 right-[46px] z-30 text-white"}),e(y,{html:V?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:V?.benefits?.map(h=>n("div",{className:"flex items-center gap-[6px]",children:[e(Q,{source:h.benefitIcon?.url,className:"size-4",alt:h.benefit,width:16,height:16}),e(y,{html:h.benefit,className:"text-sm font-bold leading-[1.4]"})]},h.id))}),n("div",{className:"mt-4 flex items-center gap-2",children:[e(T,{variant:"secondary",size:"lg",onClick:()=>u?.join?.(),children:e(y,{html:V?.primaryButton||"Join Now",className:"font-bold"})}),e(T,{variant:"primary",size:"lg",onClick:()=>u?.login?.(),children:e(y,{html:V?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>p(!1)})]})]})}),je=we.memo(({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{buildProps:l,onSidebarNavClick:c}=I(),[r,b]=D([]),[d,u]=D(-1),i=F(null),k=K(()=>{const f=t?.subcategories;if(!f?.length)return;const v=f.findIndex(o=>!!o?.subSubCategories),g=f.findIndex(o=>!o?.subSubCategories),m=f.map((o,p)=>({index:p,open:v===p||g===p}));b(m)},[t]);H(()=>{k()},[k]);const s=M(()=>{const f=t?.subcategories?.[r?.find(g=>g.open)?.index||0],v=a?.find(g=>g?.label?.toLowerCase()===f?.label?.toLowerCase())||{};if(f?.collections){const g=l?.categories?.[f?.collections]||{};return{label:v?.label,isCollection:!0,banner:v?.banner,primary:v?.primary,series:[{products:g?.products}]}}else if(f?.subSubCategories){const g=f?.subSubCategories?.[d],m=a?.find(o=>o?.label?.toLowerCase()===g?.label?.toLowerCase())||{};if(g?.collections){const o=l?.categories?.[g?.collections]||{};return{label:m?.label,isCollection:!0,banner:m?.banner,primary:m?.primary,series:[{products:o?.products}]}}else return m}else return v},[t,r,d,a]),w=K((f,v)=>{if(v?.subSubCategories?.length>0?u(0):u(-1),v?.subSubCategories?.length>0)b(g=>g.map(m=>m.index===f?{...m,open:!0}:{...m,open:!1}));else{const m=t?.subcategories?.findIndex(o=>!!o?.subSubCategories);b(o=>o.map(p=>({...p,open:p.index===f||p.index===m})))}},[t,k]),x=(f,v)=>{b(g=>g.map(m=>m.index===f?{...m,open:!0}:{...m,open:!1})),u(v)};return n(te,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[n("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:i,children:[e("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((f,v)=>{const g=Array.isArray(f?.subSubCategories)&&f?.subSubCategories?.length>0;return n("div",{children:[n("div",{className:N("flex cursor-pointer items-center justify-between",{"bg-[#F5F5F7]":!g&&r?.find(m=>m.index===v)?.open}),onClick:()=>{w(v,f),c?.(f,v)},children:[e(y,{html:f.label,className:"p-4 text-sm font-bold leading-[1.4]"}),g&&e(ae,{className:N("size-4",{"rotate-180":r?.find(m=>m.index===v)?.open})})]}),r?.find(m=>m.index===v)?.open&&e("div",{className:"flex flex-col",children:f.subSubCategories?.map((m,o)=>e(y,{html:m.label,onClick:()=>{x(v,o),c?.(m,o)},className:N("cursor-pointer px-6 py-4 text-sm font-bold leading-[1.4] text-[#6D6D6F] hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":d===o})},`subSubItem-${v}-${o}`))})]},`subcategoryItem-${v}`)})}),t&&e("div",{className:"flex",children:n("div",{className:"flex flex-col gap-4",children:[t?.primary&&e(T,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:t?.primary?.label}),t?.secondary&&e(T,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:t?.secondary?.label})]})})]}),n("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(s).length>0&&n("div",{className:"mb-4 flex items-center justify-between",children:[n("div",{className:"flex items-center gap-2",children:[e(y,{html:s?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),s?.primary&&!s?.primary?.hide&&e(T,{as:"a",href:`${s?.primary?.url}?ref=${s?.label}_viewmore`,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm font-bold leading-[1.2] no-underline",children:s?.primary?.label})]}),e(O,{href:s?.guide?.url,className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:s?.guide?.label})]}),e("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s?.series?.map((f,v)=>n("div",{children:[f.label&&e(y,{html:f.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),n("div",{className:"grid grid-cols-3 gap-4",children:[!!s?.banner&&e(O,{asChild:!s?.banner?.href,href:s?.banner?.href,children:n("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(Q,{source:s?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),n("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(ce,{size:2,html:s?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),e(y,{html:s?.banner?.desc||"20.000mAh",className:"text-sm font-bold text-white"})]})]})}),f.products?.map((g,m)=>e(fe,{seriesLabel:s?.label,product:g,isCollection:s?.isCollection},`seriesProductItem-${m}`))]})]},`seriesItem-${v}`))})]})]})}),Fe=({multicolMetadata:t})=>{const a=F(null);return e("div",{ref:a,children:e(te,{childClassName:"bg-white",className:"h-full",children:e("div",{className:"flex gap-4 py-4",children:t?.map((l,c)=>e("div",{className:"w-1/4",children:e(ve,{item:l})},`multicolItem-${l?.label}-${c}`))})})})},_e=({supportsMetadata:t,currentNavItemRef:a})=>{const l=F(null),[c,r]=D(null),[b,d]=D(0);H(()=>{if(l?.current){const i=l?.current?.getBoundingClientRect();d(i.height)}},[l]);const u=De(()=>{if(a){const i=a.getBoundingClientRect();r(i)}},500);return H(()=>(u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}),[u]),H(()=>{if(a){const i=a.getBoundingClientRect();r(i)}},[a]),e("div",{className:"absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${c?.right}px)`,height:b},children:e("div",{ref:l,className:"p-4",children:t?.map(i=>e("div",{className:"py-2",children:e(O,{href:i.url,className:"text-sm font-bold leading-[1.4] no-underline",children:i.label})},i.id))})})},fe=({product:t,isCollection:a,position:l,seriesLabel:c})=>{const{buildProps:r,onSeriesProductClick:b}=I();let d=a?t:r?.products?.find(s=>s.handle===t.handle);const u=d?.variants?.find(s=>s.sku===t.sku)||d?.variants?.[0],i=M(()=>`/products/${d?.handle}?variant=${Le(u?.id)}`,[d?.handle,u?.id]),k=M(()=>d?.tags?.filter?.(s=>s?.startsWith?.("CLtag"))?.map?.(s=>s?.replace?.("CLtag:",""))?.slice?.(0,2),[d?.tags]);return u?.availableForSale?e(O,{href:i,onClick:s=>{s.preventDefault(),window.open(i),b?.(d,l||0,c)},className:"no-underline hover:text-current",children:n("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110",children:[e("div",{className:"shrink-0",children:e(Q,{source:`${u?.image?.url||t?.images?.[0]?.url}}`,width:90,height:90,className:"size-[96px]",imgClassName:"object-contain h-full"})}),n("div",{className:"relative",children:[e("div",{className:"flex gap-1",children:Array.isArray(k)&&k?.map(s=>e(y,{as:"p",html:s,className:"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"}))}),e(y,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:d?.title||t?.name}),t?.desc&&e(y,{as:"p",html:t?.desc,className:"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]})}):null},ve=({item:t,allPicture:a})=>n(X,{children:[t?.columns&&n(X,{children:[e(y,{html:t.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),e("div",{className:"mt-2 flex flex-col",children:t.columns?.map(l=>n("div",{className:"flex items-center gap-1 py-2",children:[e(O,{href:`${l.url}?ref=navMenu`,asChild:!l.url,className:"text-sm font-bold leading-[1.4] no-underline",children:l.label}),l?.badge&&e(y,{as:"p",html:l?.badge||"badge",className:"text-brand-0 h-[24px] rounded-full border-[1.6px] border-[var(--brand-color-0)] px-[6px] text-sm font-bold !leading-[22px]"})]},l.label))})]}),t?.imageUrl&&e("div",{className:N("laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",{"tablet:max-w-none laptop:max-w-none":a}),children:n(O,{href:`${t.url}?ref=navMenu`,asChild:!t.url,children:[e(Q,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),n("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[e(y,{html:t.title,className:N("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":t?.theme==="dark"})}),t.subtitle&&e(y,{html:t.subtitle,className:N("text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"})}),t?.primary?.label&&e(T,{as:"a",href:t?.primary?.url,variant:"link",size:"lg",className:N("mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"}),children:t?.primary?.label||"more"})]})]})})]}),Oe=ee(({data:t,className:a,onPrimaryNavClick:l},c)=>{const r=M(()=>pe(t?.categories?.filter(P=>P?.mobileShow)),[t]),{currentMenu:b,setCurrentMenu:d,subSubCategory:u}=I(),[i,k]=D(!1),[s,w]=D(0),[x,f]=D(null),v=F(null);H(()=>{if(v?.current&&i){const P=v?.current?.getBoundingClientRect();w(window?.innerHeight-(P?.bottom||0))}},[i]),se(()=>{ie.fromTo(v.current,{height:0},{height:s,duration:.3})},[s]),H(()=>{document.documentElement.style.overflow=i?"hidden":"auto"},[i]);const g=M(()=>x?.components?.[0]?.blockType,[x]),m=ue(Ue,{categoriesItem:x}),o=de(We,x),p=me(Ge,x),C=M(()=>{switch(g){case W.Sidebar:return e(o,{});case W.Supports:return e(m,{});case W.Multicol:return e(p,{});default:return null}},[g,x,m]),S=K(()=>{k(!1),w(0),d&&d($.Primary)},[k,w,d]),z=M(()=>t?.headerBar?.actions?.filter(P=>P?.mobileShow&&P?.blockType!==_.Profile),[t]),L=M(()=>t?.headerBar?.actions?.find(P=>P?.mobileShow&&P?.blockType===_.Profile)||{},[t]),U=M(()=>{switch(b){case $.Primary:return e(Je,{actions:z,menuOpen:i,onMenuOpenClose:()=>{k(!1),w(0)},onMenuOpenClick:()=>k(!0)});case $.Secondary:return e(Ne,{title:x?.text,onMenuOpenClose:S,onMenuBackClick:()=>d?.($.Primary)});case $.Third:return e(Ne,{title:u?.label,onMenuOpenClose:S,onMenuBackClick:()=>d?.($.Secondary)});default:return null}},[i,b,d,x,z,u,S]),J=K((P,R)=>{const A=Array.isArray(r)?Array.isArray(r[P])?r[P][R]:{}:{};f(A),A?.components?.[0]?.blockType===W.Links?A?.components?.[0]?.url&&window.open(A?.components?.[0]?.url):d?.($.Secondary)},[r,d]);return n(te,{className:N("relative h-[52px]",a),children:[U,i&&e("div",{ref:v,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:s},children:b===$.Primary?e(Ie,{categories:r,onPrimaryMenuClick:J,onPrimaryNavClick:l,profileAction:L}):C})]})}),Ie=({categories:t,onPrimaryMenuClick:a,profileAction:l,onPrimaryNavClick:c})=>{const{onSidebarNavClick:r}=I();return n("div",{className:"flex h-full flex-col justify-between",children:[e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((b,d)=>n("div",{className:"",children:[b?.map((u,i)=>e(Z,{label:u.text,onClick:()=>{const s=(t?.flat()||[])?.findIndex(w=>w?.id===t[d][i]?.id);a(d,i),c?.(u,s)},icon:u.components?.[0]?.icon},u.id)),e("div",{className:N("my-2 h-px w-full bg-[#E5E5E7]",{hidden:d===t.length-1})})]},`groupCategory-${d}`))}),e(Ke,{profileAction:l})]})},We=({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{currentMenu:l,setCurrentMenu:c,subSubCategory:r,setSubSubCategory:b,setCurrentSeriesMetadata:d,currentSeriesMetadata:u,buildProps:i,onSidebarNavClick:k}=I(),[s,w]=D([]),[x,f]=D([]);H(()=>{t?.subcategories?.length&&w(t?.subcategories?.map((o,p)=>({index:p,open:!1})))},[t]),H(()=>{r?.subSubCategories?.length&&f(r?.subSubCategories?.map((o,p)=>({index:p,open:p===0})))},[r]);const v=K((o,p)=>{c&&c($.Third),b?.(o);const C=a?.find(S=>p!==void 0?o?.subSubCategories?.[p]?.label?.toLowerCase()===S.label?.toLowerCase():o?.label?.toLowerCase()===S.label?.toLowerCase())||{};if(o?.collections){const S=i?.categories?.[o?.collections]||{};d?.({label:C?.label,isCollection:!0,banner:C?.banner,primary:C?.primary,series:[{products:S?.products}]})}else d?.(C)},[a,t,c,b,d]),g=M(()=>a?.find(o=>!!o?.guide)?.guide,[a,t]);return M(()=>{switch(l){case $.Secondary:return n("div",{className:"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4",children:[e("div",{children:t?.subcategories?.map((o,p)=>e("div",{children:e(Z,{label:o?.label,active:s.find(C=>C.index===p)?.open,onClick:()=>{v(o),k?.(o,p)}})},`${o.label}-${p}`))}),n("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&e(T,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:t?.primary?.label}),t?.secondary&&e(T,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:t?.secondary?.label})]})]});case $.Third:return n("div",{className:"tablet:px-8 laptop:px-16 p-4",children:[r?.subSubCategories?r?.subSubCategories?.map((o,p)=>{const C=a?.find(z=>z.label.toLowerCase()===o?.label?.toLowerCase())||{};let S={};if(o?.collections){const z=i?.categories?.[o?.collections]||{};S={label:C?.label,isCollection:!0,banner:C?.banner,primary:C?.primary,series:[{products:z?.products}]}}else S=C;return n("div",{children:[Reflect.ownKeys(o).length>0&&e(ge,{matchSeriesMetadata:S,onSubSubCategoryItemClick:()=>{k?.(o,p),f(z=>z.map((L,U)=>({...L,open:U===p?!L.open:L.open})))},expanded:!!x?.find(z=>z.index===p)?.open}),x?.find(z=>z.index===p)?.open&&n(X,{children:[e(he,{matchSeriesMetadata:S}),S?.primary&&e("div",{className:"my-4 text-center",children:e(T,{as:"a",href:S?.primary?.url,className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:S?.primary?.label})})]})]},`${o.label}-${p}`)}):n(X,{children:[Reflect.ownKeys(u).length>0&&e(ge,{matchSeriesMetadata:u}),e(he,{matchSeriesMetadata:u}),u?.primary&&e("div",{className:"my-4 text-center ",children:e(T,{as:"a",href:`${u?.primary?.url}?ref=${u?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:u?.primary?.label})})]}),g&&e(O,{href:g?.url,children:e("div",{className:"mt-4",children:e(y,{html:g?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]});default:return null}},[l,t,c,a,s,x,b,r,d,u])},ge=({matchSeriesMetadata:t,onSubSubCategoryItemClick:a,expanded:l})=>n("div",{className:"tablet:pt-0 flex items-center justify-between py-4",onClick:a,children:[t?.label&&e(y,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),a&&e(ae,{className:N("size-5",{"rotate-180":l})})]}),he=({matchSeriesMetadata:t})=>e("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((a,l)=>n("div",{children:[a.label&&e(y,{html:a.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),n("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&e(O,{asChild:!t?.banner?.href,href:t?.banner?.href,children:n("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(Q,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),n("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(ce,{size:2,html:t?.banner?.title||"Buy in Guide",className:N("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),e(y,{html:t?.banner?.desc||"20.000mAh",className:N("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),a.products?.map((c,r)=>e(fe,{position:r,product:c,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${l}-${r}`))]})]},`seriesItem-${l}`))}),Ue=({supportsMetadata:t})=>e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map(a=>e(Z,{href:a.url,label:a.label,onClick:()=>{}},a.id))}),Ge=({multicolMetadata:t})=>{const a=M(()=>!t?.some(l=>!!l.columns),[t]);return e("div",{className:N("tablet:py-4 tablet:px-8 laptop:px-16 tablet:gap-6 flex flex-col gap-4 p-4",{"tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4":a}),children:t?.map((l,c)=>e("div",{children:e(ve,{item:l,allPicture:a})},`multicolItem-${l?.label}-${c}`))})},Ke=({profileAction:t})=>{const[a,l]=D(!1),{profile:c,event:r}=I();return n("div",{className:N("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":a}),children:[n("div",{className:"flex items-center justify-between",onClick:()=>l(!a),children:[n("div",{className:"flex items-center gap-[14px]",children:[e("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:e(Ee,{})}),e(y,{html:c?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&e(ae,{className:N("laptop:size-4 size-5",{"rotate-180":a})})]}),c?.email&&e("div",{className:"mt-4",children:t?.profiles?.map(b=>e(Z,{label:b?.title,href:b?.url},b.id))}),a&&!c?.email&&n("div",{className:"mt-4",children:[e(y,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(b=>n("div",{className:"flex items-center gap-[6px]",children:[e(Q,{source:b.benefitIcon?.url,className:"size-4",alt:b.benefit,width:16,height:16}),e(y,{html:b.benefit,className:"text-sm font-bold leading-[1.4]"})]},b.id))})]}),!c?.email&&n("div",{className:"mt-4 flex items-center gap-3",children:[e(T,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>r?.join?.(),children:e(y,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),e(T,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>r?.login?.(),children:e(y,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Je=({menuOpen:t,onMenuOpenClose:a,onMenuOpenClick:l,actions:c})=>n("div",{className:"flex h-full items-center justify-between gap-4",children:[e(ye,{}),n("div",{className:"desktop:gap-6 flex items-center gap-4",children:[e(xe,{actions:c}),t?e(be,{className:"size-5",onClick:()=>a()}):e(ze,{className:"size-5",onClick:()=>l()})]})]}),ye=()=>{const{payloadData:t,isMobile:a}=I();return e("div",{className:"hover:text-brand-0 cursor-pointer [&>svg]:w-full",onClick:()=>{window.location.href="/"},dangerouslySetInnerHTML:{__html:a?t?.headerBar?.mobileLogo:t?.headerBar?.desktopLogo}})},xe=ee(({actions:t,activeStatus:a=!1},l)=>{const{event:c,cartCount:r}=I(),[b,d]=D(null),u=K((i,k)=>{switch(d(k),i?.blockType){case _.Search:c?.search?.();break;case _.Cart:c?.cart?.();break;case _.Profile:c?.profile?.();break;case _.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return e("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((i,k)=>n("div",{className:"relative",ref:i.blockType===_.Profile?l:null,onClick:()=>u(i,k),children:[e(y,{html:i.icon,className:N("size-5 cursor-pointer",{"text-brand-0":a&&b===k})}),i.blockType===_.Cart&&r>0&&e("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]",children:e(y,{html:r?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},i.id))})}),Ne=({title:t,onMenuOpenClose:a,onMenuBackClick:l})=>n("div",{className:"flex h-full items-center gap-3",children:[e(Be,{className:"size-5",onClick:()=>l()}),e(y,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),e(be,{className:"size-5",onClick:()=>a()})]}),Z=({label:t,href:a,onClick:l,active:c,icon:r,className:b})=>e("div",{className:N("flex cursor-pointer items-center justify-between py-4",b),onClick:l,children:n(O,{href:a,asChild:!a,className:"flex w-full items-center justify-between no-underline",children:[n("div",{className:"flex items-center gap-4",children:[e(y,{html:t,className:N("text-sm font-bold leading-[1.4]",{underline:r})}),r&&e(y,{html:r})]}),e(He,{className:N("laptop:size-4 size-5",{"rotate-90":c})})]})});var ut=Se(Re);export{ut as default};
1
+ "use client";import{Fragment as K,jsx as e,jsxs as l}from"react/jsx-runtime";import Ce,{forwardRef as ee,useCallback as G,useEffect as H,useImperativeHandle as Se,useMemo as M,useRef as j,useState as B}from"react";import{Picture as q,Text as x,Button as $,Container as te,Link as O,Heading as se}from"../../components/index.js";import"../../shared/Styles.js";import{cn as w,atobID as De}from"../../helpers/utils.js";import Le,{useNavContext as W}from"./NavProvider.js";import{HeaderNavigationMenu as R,HeaderNavigationBlockType as I,HeaderNavigationActionBlockType as T}from"./types.js";import{debounce as Me}from"es-toolkit";import Pe from"jump.js";import{useGSAP as re}from"@gsap/react";import{gsap as oe}from"gsap";import{WithSidebar as ie,WithSupports as ce,WithMulticol as de,WithGroupCategory as ue}from"./withCategory.js";import{Menu as Ee,Close as pe,User as Be,RightArrow as ze,LeftArrow as He,DownArrow as ae,Polygon as Te}from"./icons/index.js";import $e from"../NavigationSearch/index.js";const Re=ee((t,a)=>{const{data:{headerNavigation:n}={},buildProps:c,event:i,profile:p,theme:d="light",isTop:b=!1,searchResult:f,onSearch:y,isSearching:o,keywords:D,onPrimaryNavClick:N,onSeriesProductClick:v,onSidebarNavClick:h,headerId:m,cartCount:g}=t,[r,u]=B(!1),[P,S]=B(!1),L=j(null),C=j(null),A=()=>{const k=document?.querySelector("body")?.offsetWidth||0;S(k<=1440)};H(()=>(A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}),[]),Se(a,()=>C.current),H(()=>{C.current&&b&&Pe(C.current,{duration:0,offset:C.current?.getBoundingClientRect()?.bottom||0})},[b]),H(()=>{i&&(i.search=()=>u(!0))},[i]),re(()=>{L?.current&&r&&oe.fromTo(L.current,{height:0},{height:"auto",duration:.3})},[r]),H(()=>{document.documentElement.style.overflow=r?"hidden":"auto"},[r]);const Q=M(()=>n?.headerBar?.actions?.find(k=>k?.blockType===T.Search)?.searchBar?.[0]||{},[n]);return e(Le,{buildProps:c,profile:p,isMobile:P,event:i,payloadData:n,onSidebarNavClick:h,onSeriesProductClick:v,cartCount:g,children:e("header",{id:m||"header","data-ui-component-id":"HeaderNavigation",className:"relative z-[100] bg-white",ref:C,children:l("div",{className:w("hover:bg-white hover:text-black",d==="light"?"text-black":"text-white",{}),children:[e(Ae,{data:n,className:"desktop:block hidden !bg-white",theme:d,onPrimaryNavClick:N}),e(Oe,{data:n,className:"desktop:hidden block !bg-white",onPrimaryNavClick:N}),r&&l("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${C?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[e("div",{ref:L,className:w("overflow-y-auto",{}),children:e($e,{data:Q,keywords:D,isSearching:o,searchResult:f,onSearch:k=>{y?.(k)},onClose:()=>{y?.(),u(!1)}})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>u(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:k=>{(k.key==="Enter"||k.key===" "||k.key==="Escape")&&(k.preventDefault(),u(!1))}})]})]})})})}),Ae=ee((t,a)=>{const{data:n,onNavItemClick:c,className:i,theme:p,onPrimaryNavClick:d}=t,{event:b,profile:f}=W(),[y,o]=B(!1),D=M(()=>ue(n?.categories?.filter(s=>s?.pcShow)),[n]),[N,v]=B(null),[h,m]=B([]),g=j(null),[r,u]=B(!1),P=j(null),S=j(null),L=j(D.map(s=>Array(s?.length||0).fill(null)));H(()=>{D?.length&&m(D?.map((s,E)=>s?.map((z,F)=>({groupIndex:E,index:F,open:!1}))))},[D]);const C=M(()=>{let s=null;for(const E of h){for(const z of E)if(z.open){s=z;break}if(s)break}return s},[h]);H(()=>{document.documentElement.style.overflow=C?.open||r?"hidden":"auto"},[C?.open,r]);const A=(s,E,z)=>{if(u(!1),N?.components?.[0]?.blockType===I.Links)N?.components?.[0]?.url&&window.open(N?.components?.[0]?.url);else{const F=D?.flat()||[],U=F?.findIndex(_=>_?.id===D[E][z]?.id);s.stopPropagation(),c?.(),d?.(F[U],U),v(D[E][z]),m(_=>_.map(we=>we.map(Y=>Y.groupIndex===E&&Y.index===z?{...Y,open:!Y.open}:{...Y,open:!1})))}},Q=(s,E,z)=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),A(s,E,z)):s.key==="Escape"&&C?.groupIndex===E&&C?.index===z&&(s.preventDefault(),k())},k=()=>{m(s=>s.map(E=>E.map(z=>({...z,open:!1}))))},X=M(()=>{if(N)return N?.components?.[0]?.blockType},[N]),J=ie(je,N),xe=de(Fe,N),Ne=ce(_e,{categoriesItem:N,currentNavItemRef:L.current?.[C?.groupIndex||0]?.[C?.index||0]}),ke=M(()=>{switch(X){case I.Sidebar:return e(J,{});case I.Supports:return e(Ne,{});case I.Multicol:return e(xe,{});default:return null}},[X,N]),ne=M(()=>n?.headerBar?.actions?.filter(s=>s?.pcShow),[n]),V=M(()=>ne?.find(s=>s?.blockType===T.Profile),[ne]),le=G(()=>{u(s=>!s)},[]);return H(()=>{if(g?.current){const s=g.current;return s.addEventListener("click",le),()=>{s.removeEventListener("click",le)}}},[le]),re(()=>{C?.open&&oe.fromTo(S?.current,{height:0},{height:"auto"})},[C?.open]),l(te,{className:w("relative h-[96px]",i),children:[l("div",{ref:P,onClick:k,className:"flex h-full flex-col justify-end gap-4",children:[l("div",{className:"flex items-center justify-between",children:[e(ge,{}),e(he,{ref:g,actions:ne,activeStatus:r})]}),e("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:D?.map((s,E)=>e("div",{className:"flex gap-3",children:s?.map((z,F)=>{const U=C?.groupIndex===E&&C?.index===F;return e("div",{ref:_=>{L.current[E][F]=_},className:"group cursor-pointer",children:l("div",{className:"relative",children:[l("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:_=>A(_,E,F),onKeyDown:_=>Q(_,E,F),"aria-expanded":U,"aria-haspopup":"true","aria-label":z.text,children:[e(x,{html:z.text,className:"text-sm font-bold leading-[1.4]"}),e(ae,{"aria-hidden":"true",className:w("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":U,"opacity-100":y&&U})})]}),e("div",{className:w("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":U},p==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},z.id)})},`groupCategory-${E}`))})]}),l("div",{role:"menu","aria-hidden":!(C?.open&&N),className:w("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(C?.open&&N)}),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{height:`calc(100dvh - ${P?.current?.getBoundingClientRect()?.bottom}px)`},children:[e("div",{ref:S,className:w("relative z-50",{"overflow-hidden":X!==I.Supports}),children:ke}),e("div",{className:"flex-1 bg-transparent",onClick:k,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),k())}})]}),r&&l("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[e("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${g?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:f?.email?l(K,{children:[e(x,{html:f?.nick_name||V?.welcome,className:"text-sm font-bold"}),e("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),e("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:V?.profiles?.map(s=>e(Z,{className:"py-2",label:s?.title,href:s?.url},s.id))})]}):l(K,{children:[e(Te,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),e(x,{html:V?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:V?.benefits?.map(s=>l("div",{className:"flex items-center gap-[6px]",children:[e(q,{source:s.benefitIcon?.url,className:"size-4",alt:s.benefit,width:16,height:16}),e(x,{html:s.benefit,className:"text-sm font-bold leading-[1.4]"})]},s.id))}),l("div",{className:"mt-4 flex items-center gap-2",children:[e($,{variant:"secondary",size:"lg",onClick:()=>b?.join?.(),children:e(x,{html:V?.primaryButton||"Join Now",className:"font-bold"})}),e($,{variant:"primary",size:"lg",onClick:()=>b?.login?.(),children:e(x,{html:V?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>u(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),u(!1))}})]})]})}),je=Ce.memo(({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{buildProps:n,onSidebarNavClick:c}=W(),[i,p]=B([]),[d,b]=B(-1),f=j(null),y=G(()=>{const v=t?.subcategories;if(!v?.length)return;const h=v.findIndex(r=>!!r?.subSubCategories),m=v.findIndex(r=>!r?.subSubCategories),g=v.map((r,u)=>({index:u,open:h===u||m===u}));p(g)},[t]);H(()=>{y()},[y]);const o=M(()=>{const v=t?.subcategories?.[i?.find(m=>m.open)?.index||0],h=a?.find(m=>m?.label?.toLowerCase()===v?.label?.toLowerCase())||{};if(v?.collections){const m=n?.categories?.[v?.collections]||{};return{label:h?.label,isCollection:!0,banner:h?.banner,primary:h?.primary,series:[{products:m?.products}]}}else if(v?.subSubCategories){const m=v?.subSubCategories?.[d],g=a?.find(r=>r?.label?.toLowerCase()===m?.label?.toLowerCase())||{};if(m?.collections){const r=n?.categories?.[m?.collections]||{};return{label:g?.label,isCollection:!0,banner:g?.banner,primary:g?.primary,series:[{products:r?.products}]}}else return g}else return h},[t,i,d,a,n]),D=G((v,h)=>{if(h?.subSubCategories?.length>0?b(0):b(-1),h?.subSubCategories?.length>0)p(m=>m.map(g=>g.index===v?{...g,open:!0}:{...g,open:!1}));else{const g=t?.subcategories?.findIndex(r=>!!r?.subSubCategories);p(r=>r.map(u=>({...u,open:u.index===v||u.index===g})))}},[t]),N=(v,h)=>{p(m=>m.map(g=>g.index===v?{...g,open:!0}:{...g,open:!1})),b(h)};return l(te,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[l("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:f,children:[e("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((v,h)=>{const m=Array.isArray(v?.subSubCategories)&&v?.subSubCategories?.length>0,g=i?.find(r=>r.index===h)?.open;return l("div",{children:[l("button",{className:w("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!m&&g}),onClick:()=>{D(h,v),c?.(v,h)},"aria-expanded":m?g:void 0,"aria-haspopup":m?"true":void 0,children:[e(x,{html:v.label,className:"p-4 text-sm font-bold leading-[1.4]"}),m&&e(ae,{"aria-hidden":"true",className:w("size-4",{"rotate-180":g})})]}),g&&e("div",{className:"flex flex-col",role:"menu",children:v.subSubCategories?.map((r,u)=>e("button",{onClick:()=>{N(h,u),c?.(r,u)},className:w("w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left",{"bg-[#F5F5F7]":d===u}),role:"menuitem","aria-label":r.label,children:e(x,{html:r.label,className:"text-sm font-bold leading-[1.4] text-[#6D6D6F] hover:bg-[#F5F5F7]"})},`subSubItem-${h}-${u}`))})]},`subcategoryItem-${h}`)})}),t&&e("div",{className:"flex",children:l("div",{className:"flex flex-col gap-4",children:[t?.primary&&e($,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:t?.primary?.label}),t?.secondary&&e($,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:t?.secondary?.label})]})})]}),l("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(o).length>0&&l("div",{className:"mb-4 flex items-center justify-between",children:[l("div",{className:"flex items-center gap-2",children:[e(x,{html:o?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),o?.primary&&!o?.primary?.hide&&e($,{as:"a",href:`${o?.primary?.url}?ref=${o?.label}_viewmore`,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm font-bold leading-[1.2] no-underline",children:o?.primary?.label})]}),e(O,{href:o?.guide?.url,className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:o?.guide?.label})]}),e("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:o?.series?.map((v,h)=>l("div",{children:[v.label&&e(x,{html:v.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),l("div",{className:"grid grid-cols-3 gap-4",children:[!!o?.banner&&e(O,{asChild:!o?.banner?.href,href:o?.banner?.href,children:l("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(q,{source:o?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),l("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(se,{size:2,html:o?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),e(x,{html:o?.banner?.desc||"20.000mAh",className:"text-sm font-bold text-white"})]})]})}),v.products?.map((m,g)=>e(me,{seriesLabel:o?.label,product:m,isCollection:o?.isCollection},`seriesProductItem-${g}`))]})]},`seriesItem-${h}`))})]})]})}),Fe=({multicolMetadata:t})=>{const a=j(null);return e("div",{ref:a,children:e(te,{childClassName:"bg-white",className:"h-full",children:e("div",{className:"flex gap-4 py-4",children:t?.map((n,c)=>e("div",{className:"w-1/4",children:e(be,{item:n})},`multicolItem-${n?.label}-${c}`))})})})},_e=({supportsMetadata:t,currentNavItemRef:a})=>{const n=j(null),[c,i]=B(null),[p,d]=B(0);H(()=>{if(n?.current){const f=n?.current?.getBoundingClientRect();d(f.height)}},[n]);const b=Me(()=>{if(a){const f=a.getBoundingClientRect();i(f)}},500);return H(()=>(b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}),[b]),H(()=>{if(a){const f=a.getBoundingClientRect();i(f)}},[a]),e("div",{className:"absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${c?.right}px)`,height:p},children:e("div",{ref:n,className:"p-4",children:t?.map(f=>e("div",{className:"py-2",children:e(O,{href:f.url,className:"text-sm font-bold leading-[1.4] no-underline",children:f.label})},f.id))})})},me=({product:t,isCollection:a,position:n,seriesLabel:c})=>{const{buildProps:i,onSeriesProductClick:p}=W();let d=a?t:i?.products?.find(o=>o.handle===t.handle);const b=d?.variants?.find(o=>o.sku===t.sku)||d?.variants?.[0],f=M(()=>`/products/${d?.handle}?variant=${De(b?.id)}`,[d?.handle,b?.id]),y=M(()=>d?.tags?.filter?.(o=>o?.startsWith?.("CLtag"))?.map?.(o=>o?.replace?.("CLtag:",""))?.slice?.(0,2),[d?.tags]);return b?.availableForSale?e(O,{href:f,onClick:o=>{o.preventDefault(),window.open(f,"_self"),p?.(d,n||0,c)},className:"no-underline hover:text-current",children:l("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110",children:[e("div",{className:"shrink-0",children:e(q,{source:`${b?.image?.url||t?.images?.[0]?.url}}`,width:90,height:90,className:"size-[96px]",imgClassName:"object-contain h-full"})}),l("div",{className:"relative",children:[e("div",{className:"flex gap-1",children:Array.isArray(y)&&y?.map(o=>e(x,{as:"p",html:o,className:"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"}))}),e(x,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:d?.title||t?.name}),t?.desc&&e(x,{as:"p",html:t?.desc,className:"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]})}):null},be=({item:t,allPicture:a})=>l(K,{children:[t?.columns&&l(K,{children:[e(x,{html:t.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),e("div",{className:"mt-2 flex flex-col",children:t.columns?.map(n=>l("div",{className:"flex items-center gap-1 py-2",children:[e(O,{href:`${n.url}?ref=navMenu`,asChild:!n.url,className:"text-sm font-bold leading-[1.4] no-underline",children:n.label}),n?.badge&&e(x,{as:"p",html:n?.badge||"badge",className:"text-brand-0 h-[24px] rounded-full border-[1.6px] border-[var(--brand-color-0)] px-[6px] text-sm font-bold !leading-[22px]"})]},n.label))})]}),t?.imageUrl&&e("div",{className:w("laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",{"tablet:max-w-none laptop:max-w-none":a}),children:l(O,{href:`${t.url}?ref=navMenu`,asChild:!t.url,children:[e(q,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),l("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[e(x,{html:t.title,className:w("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":t?.theme==="dark"})}),t.subtitle&&e(x,{html:t.subtitle,className:w("text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"})}),t?.primary?.label&&e($,{as:"a",href:t?.primary?.url,variant:"link",size:"lg",className:w("mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"}),children:t?.primary?.label||"more"})]})]})})]}),Oe=ee(({data:t,className:a,onPrimaryNavClick:n},c)=>{const i=M(()=>ue(t?.categories?.filter(k=>k?.mobileShow)),[t]),{currentMenu:p,setCurrentMenu:d,subSubCategory:b}=W(),[f,y]=B(!1),[o,D]=B(0),[N,v]=B(null),h=j(null);H(()=>{if(h?.current&&f){const k=h?.current?.getBoundingClientRect();D(window?.innerHeight-(k?.bottom||0))}},[f]),re(()=>{oe.fromTo(h.current,{height:0},{height:o,duration:.3})},[o]),H(()=>{document.documentElement.style.overflow=f?"hidden":"auto"},[f]);const m=M(()=>N?.components?.[0]?.blockType,[N]),g=ce(Ke,{categoriesItem:N}),r=ie(We,N),u=de(Ue,N),P=M(()=>{switch(m){case I.Sidebar:return e(r,{});case I.Supports:return e(g,{});case I.Multicol:return e(u,{});default:return null}},[m,N,g]),S=G(()=>{y(!1),D(0),d&&d(R.Primary)},[y,D,d]),L=M(()=>t?.headerBar?.actions?.filter(k=>k?.mobileShow&&k?.blockType!==T.Profile),[t]),C=M(()=>t?.headerBar?.actions?.find(k=>k?.mobileShow&&k?.blockType===T.Profile)||{},[t]),A=M(()=>{switch(p){case R.Primary:return e(Je,{actions:L,menuOpen:f,onMenuOpenClose:()=>{y(!1),D(0)},onMenuOpenClick:()=>y(!0)});case R.Secondary:return e(ye,{title:N?.text,onMenuOpenClose:S,onMenuBackClick:()=>d?.(R.Primary)});case R.Third:return e(ye,{title:b?.label,onMenuOpenClose:S,onMenuBackClick:()=>d?.(R.Secondary)});default:return null}},[f,p,d,N,L,b,S]),Q=G((k,X)=>{const J=Array.isArray(i)?Array.isArray(i[k])?i[k][X]:{}:{};v(J),J?.components?.[0]?.blockType===I.Links?J?.components?.[0]?.url&&window.open(J?.components?.[0]?.url):d?.(R.Secondary)},[i,d]);return l(te,{className:w("relative h-[52px]",a),children:[A,f&&e("nav",{ref:h,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:o},role:"navigation","aria-label":"Mobile navigation menu",children:p===R.Primary?e(Ie,{categories:i,onPrimaryMenuClick:Q,onPrimaryNavClick:n,profileAction:C}):P})]})}),Ie=({categories:t,onPrimaryMenuClick:a,profileAction:n,onPrimaryNavClick:c})=>l("div",{className:"flex h-full flex-col justify-between",children:[e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((i,p)=>l("div",{className:"",children:[i?.map((d,b)=>e(Z,{label:d.text,onClick:()=>{const y=(t?.flat()||[])?.findIndex(o=>o?.id===t[p][b]?.id);a(p,b),c?.(d,y)},icon:d.components?.[0]?.icon},d.id)),e("div",{className:w("my-2 h-px w-full bg-[#E5E5E7]",{hidden:p===t.length-1})})]},`groupCategory-${p}`))}),e(Ge,{profileAction:n})]}),We=({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{currentMenu:n,setCurrentMenu:c,subSubCategory:i,setSubSubCategory:p,setCurrentSeriesMetadata:d,currentSeriesMetadata:b,buildProps:f,onSidebarNavClick:y}=W(),[o,D]=B([]),[N,v]=B([]);H(()=>{t?.subcategories?.length&&D(t?.subcategories?.map((r,u)=>({index:u,open:!1})))},[t]),H(()=>{i?.subSubCategories?.length&&v(i?.subSubCategories?.map((r,u)=>({index:u,open:u===0})))},[i]);const h=G((r,u)=>{c&&c(R.Third),p?.(r);const P=a?.find(S=>u!==void 0?r?.subSubCategories?.[u]?.label?.toLowerCase()===S.label?.toLowerCase():r?.label?.toLowerCase()===S.label?.toLowerCase())||{};if(r?.collections){const S=f?.categories?.[r?.collections]||{};d?.({label:P?.label,isCollection:!0,banner:P?.banner,primary:P?.primary,series:[{products:S?.products}]})}else d?.(P)},[a,c,p,d,f?.categories]),m=M(()=>a?.find(r=>!!r?.guide)?.guide,[a]);return M(()=>{switch(n){case R.Secondary:return l("div",{className:"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4",children:[e("div",{children:t?.subcategories?.map((r,u)=>e("div",{children:e(Z,{label:r?.label,active:o.find(P=>P.index===u)?.open,onClick:()=>{h(r),y?.(r,u)}})},`${r.label}-${u}`))}),l("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&e($,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:t?.primary?.label}),t?.secondary&&e($,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:t?.secondary?.label})]})]});case R.Third:return l("div",{className:"tablet:px-8 laptop:px-16 p-4",children:[i?.subSubCategories?i?.subSubCategories?.map((r,u)=>{const P=a?.find(L=>L.label.toLowerCase()===r?.label?.toLowerCase())||{};let S={};if(r?.collections){const L=f?.categories?.[r?.collections]||{};S={label:P?.label,isCollection:!0,banner:P?.banner,primary:P?.primary,series:[{products:L?.products}]}}else S=P;return l("div",{children:[Reflect.ownKeys(r).length>0&&e(fe,{matchSeriesMetadata:S,onSubSubCategoryItemClick:()=>{y?.(r,u),v(L=>L.map((C,A)=>({...C,open:A===u?!C.open:C.open})))},expanded:!!N?.find(L=>L.index===u)?.open}),N?.find(L=>L.index===u)?.open&&l(K,{children:[e(ve,{matchSeriesMetadata:S}),S?.primary&&e("div",{className:"my-4 text-center",children:e($,{as:"a",href:S?.primary?.url,className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:S?.primary?.label})})]})]},`${r.label}-${u}`)}):l(K,{children:[Reflect.ownKeys(b).length>0&&e(fe,{matchSeriesMetadata:b}),e(ve,{matchSeriesMetadata:b}),b?.primary&&e("div",{className:"my-4 text-center ",children:e($,{as:"a",href:`${b?.primary?.url}?ref=${b?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:b?.primary?.label})})]}),m&&e(O,{href:m?.url,children:e("div",{className:"mt-4",children:e(x,{html:m?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]});default:return null}},[n,t,a,o,N,i,b,f?.categories,m,h,y])},fe=({matchSeriesMetadata:t,onSubSubCategoryItemClick:a,expanded:n})=>{const c=l(K,{children:[t?.label&&e(x,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),a&&e(ae,{"aria-hidden":"true",className:w("size-5",{"rotate-180":n})})]});return a?e("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:a,"aria-expanded":n,children:c}):e("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:c})},ve=({matchSeriesMetadata:t})=>e("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((a,n)=>l("div",{children:[a.label&&e(x,{html:a.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),l("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&e(O,{asChild:!t?.banner?.href,href:t?.banner?.href,children:l("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(q,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),l("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(se,{size:2,html:t?.banner?.title||"Buy in Guide",className:w("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),e(x,{html:t?.banner?.desc||"20.000mAh",className:w("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),a.products?.map((c,i)=>e(me,{position:i,product:c,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${n}-${i}`))]})]},`seriesItem-${n}`))}),Ke=({supportsMetadata:t})=>e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map(a=>e(Z,{href:a.url,label:a.label,onClick:()=>{}},a.id))}),Ue=({multicolMetadata:t})=>{const a=M(()=>!t?.some(n=>!!n.columns),[t]);return e("div",{className:w("tablet:py-4 tablet:px-8 laptop:px-16 tablet:gap-6 flex flex-col gap-4 p-4",{"tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4":a}),children:t?.map((n,c)=>e("div",{children:e(be,{item:n,allPicture:a})},`multicolItem-${n?.label}-${c}`))})},Ge=({profileAction:t})=>{const[a,n]=B(!1),{profile:c,event:i}=W();return l("div",{className:w("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":a}),children:[l("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>n(!a),"aria-expanded":a,"aria-label":c?.nick_name||t?.welcome,children:[l("div",{className:"flex items-center gap-[14px]",children:[e("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:e(Be,{"aria-hidden":"true"})}),e(x,{html:c?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&e(ae,{"aria-hidden":"true",className:w("laptop:size-4 size-5",{"rotate-180":a})})]}),c?.email&&e("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:t?.profiles?.map(p=>e(Z,{label:p?.title,href:p?.url},p.id))}),a&&!c?.email&&l("div",{className:"mt-4",children:[e(x,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(p=>l("div",{className:"flex items-center gap-[6px]",children:[e(q,{source:p.benefitIcon?.url,className:"size-4",alt:p.benefit,width:16,height:16}),e(x,{html:p.benefit,className:"text-sm font-bold leading-[1.4]"})]},p.id))})]}),!c?.email&&l("div",{className:"mt-4 flex items-center gap-3",children:[e($,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>i?.join?.(),children:e(x,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),e($,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>i?.login?.(),children:e(x,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Je=({menuOpen:t,onMenuOpenClose:a,onMenuOpenClick:n,actions:c})=>l("div",{className:"flex h-full items-center justify-between gap-4",children:[e(ge,{}),l("div",{className:"desktop:gap-6 flex items-center gap-4",children:[e(he,{actions:c}),t?e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>a(),"aria-label":"Close menu","aria-expanded":"true",children:e(pe,{className:"size-5","aria-hidden":"true"})}):e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:e(Ee,{className:"size-5","aria-hidden":"true"})})]})]}),ge=()=>{const{payloadData:t,isMobile:a}=W();return e("a",{href:"/",className:"hover:text-brand-0 [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:a?t?.headerBar?.mobileLogo:t?.headerBar?.desktopLogo}})},he=ee(({actions:t,activeStatus:a=!1},n)=>{const{event:c,cartCount:i}=W(),[p,d]=B(null),b=y=>{switch(y){case T.Search:return"Search";case T.Cart:return`Shopping cart${i>0?` (${i} items)`:""}`;case T.Profile:return"User profile";case T.Livestream:return"Livestream";default:return"Action"}},f=G((y,o)=>{switch(d(o),y?.blockType){case T.Search:c?.search?.();break;case T.Cart:c?.cart?.();break;case T.Profile:c?.profile?.();break;case T.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return e("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((y,o)=>l("button",{className:"relative cursor-pointer border-0 bg-transparent p-0",ref:y.blockType===T.Profile?n:null,onClick:()=>f(y,o),"aria-label":b(y.blockType),"aria-pressed":a&&p===o,children:[e(x,{html:y.icon,className:w("size-5",{"text-brand-0":a&&p===o}),"aria-hidden":"true"}),y.blockType===T.Cart&&i>0&&e("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:e(x,{html:i?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},y.id))})}),ye=({title:t,onMenuOpenClose:a,onMenuBackClick:n})=>l("div",{className:"flex h-full items-center gap-3",children:[e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Back to previous menu",children:e(He,{className:"size-5","aria-hidden":"true"})}),e(x,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>a(),"aria-label":"Close menu",children:e(pe,{className:"size-5","aria-hidden":"true"})})]}),Z=({label:t,href:a,onClick:n,active:c,icon:i,className:p})=>{const d=l(K,{children:[l("div",{className:"flex items-center gap-4",children:[e(x,{html:t,className:w("text-sm font-bold leading-[1.4]",{underline:i})}),i&&e(x,{html:i,"aria-hidden":"true"})]}),e(ze,{className:w("laptop:size-4 size-5",{"rotate-90":c}),"aria-hidden":"true"})]});return a?e(O,{href:a,className:w("flex cursor-pointer items-center justify-between py-4 no-underline",p),children:d}):e("button",{className:w("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",p),onClick:n,"aria-expanded":c,children:d})};var it=Re;export{it as default};
2
2
  //# sourceMappingURL=index.js.map