@anker-in/headless-ui 1.1.28 → 1.1.30

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 (143) hide show
  1. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.d.ts +6 -0
  2. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +2 -0
  3. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js.map +7 -0
  4. package/dist/cjs/biz-components/BrandCardLink/index.d.ts +1 -0
  5. package/dist/cjs/biz-components/BrandCardLink/index.js +2 -0
  6. package/dist/cjs/biz-components/BrandCardLink/index.js.map +7 -0
  7. package/dist/cjs/biz-components/BrandCardLink/types.d.ts +19 -0
  8. package/dist/cjs/biz-components/BrandCardLink/types.js +2 -0
  9. package/dist/cjs/biz-components/BrandCardLink/types.js.map +7 -0
  10. package/dist/cjs/biz-components/Evaluate/index.js +1 -1
  11. package/dist/cjs/biz-components/Evaluate/index.js.map +2 -2
  12. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  13. package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
  14. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +25 -0
  15. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +2 -0
  16. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js.map +7 -0
  17. package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.d.ts +7 -0
  18. package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.js +2 -0
  19. package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.js.map +7 -0
  20. package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.d.ts +9 -0
  21. package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +2 -0
  22. package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js.map +7 -0
  23. package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.d.ts +9 -0
  24. package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js +2 -0
  25. package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js.map +7 -0
  26. package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.d.ts +7 -0
  27. package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js +2 -0
  28. package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js.map +7 -0
  29. package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.d.ts +15 -0
  30. package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js +2 -0
  31. package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js.map +7 -0
  32. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.d.ts +2 -0
  33. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js +1 -1
  34. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
  35. package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.d.ts +20 -0
  36. package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js +2 -0
  37. package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js.map +7 -0
  38. package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.d.ts +9 -0
  39. package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +2 -0
  40. package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js.map +7 -0
  41. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.d.ts +18 -0
  42. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +2 -0
  43. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js.map +7 -0
  44. package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.d.ts +9 -0
  45. package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js +2 -0
  46. package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js.map +7 -0
  47. package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
  48. package/dist/cjs/biz-components/HeaderNavigation/index.js.map +3 -3
  49. package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +2 -1
  50. package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
  51. package/dist/cjs/biz-components/HeaderNavigation/types.js.map +2 -2
  52. package/dist/cjs/biz-components/HeaderNavigation/withCategory.d.ts +1 -0
  53. package/dist/cjs/biz-components/HeaderNavigation/withCategory.js +1 -1
  54. package/dist/cjs/biz-components/HeaderNavigation/withCategory.js.map +3 -3
  55. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
  56. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +3 -3
  57. package/dist/cjs/biz-components/HeroBanner/types.d.ts +4 -0
  58. package/dist/cjs/biz-components/HeroBanner/types.js +1 -1
  59. package/dist/cjs/biz-components/HeroBanner/types.js.map +1 -1
  60. package/dist/cjs/biz-components/ImageTextFeature/types.d.ts +1 -0
  61. package/dist/cjs/biz-components/ImageTextFeature/types.js +1 -1
  62. package/dist/cjs/biz-components/ImageTextFeature/types.js.map +1 -1
  63. package/dist/cjs/biz-components/SearchPage/index.js +1 -1
  64. package/dist/cjs/biz-components/SearchPage/index.js.map +2 -2
  65. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +4 -4
  66. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  67. package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
  68. package/dist/cjs/biz-components/Tabs/Tabs.js.map +3 -3
  69. package/dist/cjs/biz-components/Tabs/types.d.ts +9 -0
  70. package/dist/cjs/biz-components/Tabs/types.js +1 -1
  71. package/dist/cjs/biz-components/Tabs/types.js.map +1 -1
  72. package/dist/cjs/biz-components/index.d.ts +2 -0
  73. package/dist/cjs/biz-components/index.js +1 -1
  74. package/dist/cjs/biz-components/index.js.map +3 -3
  75. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.d.ts +6 -0
  76. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +2 -0
  77. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js.map +7 -0
  78. package/dist/esm/biz-components/BrandCardLink/index.d.ts +1 -0
  79. package/dist/esm/biz-components/BrandCardLink/index.js +2 -0
  80. package/dist/esm/biz-components/BrandCardLink/index.js.map +7 -0
  81. package/dist/esm/biz-components/BrandCardLink/types.d.ts +19 -0
  82. package/dist/esm/biz-components/BrandCardLink/types.js +1 -0
  83. package/dist/esm/biz-components/BrandCardLink/types.js.map +7 -0
  84. package/dist/esm/biz-components/Evaluate/index.js +1 -1
  85. package/dist/esm/biz-components/Evaluate/index.js.map +2 -2
  86. package/dist/esm/biz-components/Graphic/index.js +1 -1
  87. package/dist/esm/biz-components/Graphic/index.js.map +2 -2
  88. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +25 -0
  89. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +2 -0
  90. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js.map +7 -0
  91. package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.d.ts +7 -0
  92. package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.js +2 -0
  93. package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.js.map +7 -0
  94. package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.d.ts +9 -0
  95. package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +2 -0
  96. package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js.map +7 -0
  97. package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.d.ts +9 -0
  98. package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js +2 -0
  99. package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js.map +7 -0
  100. package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.d.ts +7 -0
  101. package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js +2 -0
  102. package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js.map +7 -0
  103. package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.d.ts +15 -0
  104. package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js +2 -0
  105. package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js.map +7 -0
  106. package/dist/esm/biz-components/HeaderNavigation/NavProvider.d.ts +2 -0
  107. package/dist/esm/biz-components/HeaderNavigation/NavProvider.js +1 -1
  108. package/dist/esm/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
  109. package/dist/esm/biz-components/HeaderNavigation/ResourceItem.d.ts +20 -0
  110. package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js +2 -0
  111. package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js.map +7 -0
  112. package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.d.ts +9 -0
  113. package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +2 -0
  114. package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js.map +7 -0
  115. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.d.ts +18 -0
  116. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +2 -0
  117. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js.map +7 -0
  118. package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.d.ts +9 -0
  119. package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js +2 -0
  120. package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js.map +7 -0
  121. package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
  122. package/dist/esm/biz-components/HeaderNavigation/index.js.map +3 -3
  123. package/dist/esm/biz-components/HeaderNavigation/types.d.ts +2 -1
  124. package/dist/esm/biz-components/HeaderNavigation/types.js +1 -1
  125. package/dist/esm/biz-components/HeaderNavigation/types.js.map +2 -2
  126. package/dist/esm/biz-components/HeaderNavigation/withCategory.d.ts +1 -0
  127. package/dist/esm/biz-components/HeaderNavigation/withCategory.js +1 -1
  128. package/dist/esm/biz-components/HeaderNavigation/withCategory.js.map +3 -3
  129. package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
  130. package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +3 -3
  131. package/dist/esm/biz-components/HeroBanner/types.d.ts +4 -0
  132. package/dist/esm/biz-components/ImageTextFeature/types.d.ts +1 -0
  133. package/dist/esm/biz-components/SearchPage/index.js +1 -1
  134. package/dist/esm/biz-components/SearchPage/index.js.map +2 -2
  135. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +5 -5
  136. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  137. package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
  138. package/dist/esm/biz-components/Tabs/Tabs.js.map +3 -3
  139. package/dist/esm/biz-components/Tabs/types.d.ts +9 -0
  140. package/dist/esm/biz-components/index.d.ts +2 -0
  141. package/dist/esm/biz-components/index.js +1 -1
  142. package/dist/esm/biz-components/index.js.map +2 -2
  143. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ "use strict";var p=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var m=(e,a)=>{for(var o in a)p(e,o,{get:a[o],enumerable:!0})},M=(e,a,o,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of b(a))!d.call(e,l)&&l!==o&&p(e,l,{get:()=>a[l],enumerable:!(r=n(a,l))||r.enumerable});return e};var c=e=>M(p({},"__esModule",{value:!0}),e);var u={};m(u,{MobileSupportMenu:()=>f});module.exports=c(u);var t=require("react/jsx-runtime"),k=require("react"),i=require("./MobileMenuComponents.js");const f=({supportsMetadata:e})=>(0,t.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:e?.map(a=>(0,t.jsx)(i.MenuItem,{href:a.url,label:a.label,onClick:()=>{}},a.id))});
2
+ //# sourceMappingURL=MobileSupportMenu.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/biz-components/HeaderNavigation/MobileSupportMenu.tsx"],
4
+ "sourcesContent": ["import React from 'react'\nimport { MenuItem } from './MobileMenuComponents.js'\n\n/**\n * \u79FB\u52A8\u7AEFsupport\u83DC\u5355\n * @param supportsMetadata support\u83DC\u5355\u5143\u6570\u636E\n */\nexport const MobileSupportMenu = ({ supportsMetadata }: { supportsMetadata: any }) => {\n return (\n <div className=\"tablet:px-8 laptop:px-16 p-4\">\n {supportsMetadata?.map((supportItem: any) => (\n <MenuItem key={supportItem.id} href={supportItem.url} label={supportItem.label} onClick={() => {}} />\n ))}\n </div>\n )\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAWQ,IAAAI,EAAA,6BAXRC,EAAkB,iBAClBC,EAAyB,qCAMlB,MAAMJ,EAAoB,CAAC,CAAE,iBAAAK,CAAiB,OAEjD,OAAC,OAAI,UAAU,+BACZ,SAAAA,GAAkB,IAAKC,MACtB,OAAC,YAA8B,KAAMA,EAAY,IAAK,MAAOA,EAAY,MAAO,QAAS,IAAM,CAAC,GAAjFA,EAAY,EAAwE,CACpG,EACH",
6
+ "names": ["MobileSupportMenu_exports", "__export", "MobileSupportMenu", "__toCommonJS", "import_jsx_runtime", "import_react", "import_MobileMenuComponents", "supportsMetadata", "supportItem"]
7
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 多列下拉
3
+ * @param categoriesItem 分类项
4
+ */
5
+ export declare const MulticolDropdown: ({ multicolMetadata }: {
6
+ multicolMetadata: any;
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
+ /**
9
+ * 多列下拉项
10
+ * @param item 多列下拉项
11
+ */
12
+ export declare const MulticolItem: ({ item, allPicture }: {
13
+ item: any;
14
+ allPicture?: boolean;
15
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var b=(l,o)=>{for(var a in o)d(l,a,{get:o[a],enumerable:!0})},u=(l,o,a,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of m(o))!c.call(l,r)&&r!==a&&d(l,r,{get:()=>o[r],enumerable:!(n=p(o,r))||n.enumerable});return l};var f=l=>u(d({},"__esModule",{value:!0}),l);var v={};b(v,{MulticolDropdown:()=>h,MulticolItem:()=>x});module.exports=f(v);var e=require("react/jsx-runtime"),i=require("react"),t=require("../../components/index.js"),s=require("../../helpers/utils.js");const h=({multicolMetadata:l})=>{const o=(0,i.useRef)(null);return(0,e.jsx)("div",{ref:o,children:(0,e.jsx)(t.Container,{childClassName:"bg-white",className:"h-full",children:(0,e.jsx)("div",{className:"flex gap-4 py-4",children:l?.map((a,n)=>(0,e.jsx)("div",{className:"w-1/4",children:(0,e.jsx)(x,{item:a})},`multicolItem-${a?.label}-${n}`))})})})},x=({item:l,allPicture:o})=>(0,e.jsxs)(e.Fragment,{children:[l?.columns&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.Text,{html:l.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col",children:l.columns?.map(a=>(0,e.jsxs)("div",{className:"flex items-center gap-1 py-2",children:[(0,e.jsx)(t.Link,{href:`${a.url}?ref=navMenu`,asChild:!a.url,className:"text-sm font-bold leading-[1.4] no-underline",children:a.label}),a?.badge&&(0,e.jsx)(t.Text,{as:"p",html:a?.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]"})]},a.label))})]}),l?.imageUrl&&(0,e.jsx)("div",{className:(0,s.cn)("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":o}),children:(0,e.jsxs)(t.Link,{href:`${l.url}?ref=navMenu`,asChild:!l.url,children:[(0,e.jsx)(t.Picture,{source:l.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[(0,e.jsx)(t.Text,{html:l.title,className:(0,s.cn)("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":l?.theme==="dark"})}),l.subtitle&&(0,e.jsx)(t.Text,{html:l.subtitle,className:(0,s.cn)("text-sm font-bold leading-[1.4] text-white",{"text-black":l?.theme==="dark"})}),l?.primary?.label&&(0,e.jsx)(t.Button,{as:"a",href:l?.primary?.url,variant:"link",size:"lg",className:(0,s.cn)("mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":l?.theme==="dark"}),children:l?.primary?.label||"more"})]})]})})]});
2
+ //# sourceMappingURL=MulticolDropdown.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/biz-components/HeaderNavigation/MulticolDropdown.tsx"],
4
+ "sourcesContent": ["import React, { useRef } from 'react'\nimport { Container, Text, Link, Picture, Button } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\n\n/**\n * \u591A\u5217\u4E0B\u62C9\n * @param categoriesItem \u5206\u7C7B\u9879\n */\nexport const MulticolDropdown = ({ multicolMetadata }: { multicolMetadata: any }) => {\n const multicolDropdownRef = useRef<HTMLDivElement>(null)\n\n return (\n <div ref={multicolDropdownRef}>\n <Container childClassName=\"bg-white\" className=\"h-full\">\n <div className=\"flex gap-4 py-4\">\n {multicolMetadata?.map((item: any, index: number) => (\n <div key={`multicolItem-${item?.label}-${index}`} className=\"w-1/4\">\n <MulticolItem item={item} />\n </div>\n ))}\n </div>\n </Container>\n </div>\n )\n}\n\n/**\n * \u591A\u5217\u4E0B\u62C9\u9879\n * @param item \u591A\u5217\u4E0B\u62C9\u9879\n */\nexport const MulticolItem = ({ item, allPicture }: { item: any; allPicture?: boolean }) => {\n return (\n <>\n {item?.columns && (\n <>\n <Text html={item.label} as=\"div\" className=\"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]\" />\n <div className=\"mt-2 flex flex-col\">\n {item.columns?.map((columnItem: any) => (\n <div key={columnItem.label} className=\"flex items-center gap-1 py-2\">\n <Link\n href={`${columnItem.url}?ref=navMenu`}\n asChild={!columnItem.url}\n className=\"text-sm font-bold leading-[1.4] no-underline\"\n >\n {columnItem.label}\n </Link>\n {columnItem?.badge && (\n <Text\n as=\"p\"\n html={columnItem?.badge || 'badge'}\n 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 />\n )}\n </div>\n ))}\n </div>\n </>\n )}\n {item?.imageUrl && (\n <div\n className={cn(\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',\n {\n ['tablet:max-w-none laptop:max-w-none']: allPicture,\n }\n )}\n >\n <Link href={`${item.url}?ref=navMenu`} asChild={!item.url}>\n <Picture\n source={item.imageUrl}\n width={404}\n height={280}\n className=\"size-full\"\n imgClassName=\"object-cover h-full hover:scale-105 transition-all duration-300\"\n />\n <div className=\"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline\">\n <Text\n html={item.title}\n className={cn('lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white', {\n 'text-black': item?.theme === 'dark',\n })}\n />\n {item.subtitle && (\n <Text\n html={item.subtitle}\n className={cn('text-sm font-bold leading-[1.4] text-white', {\n 'text-black': item?.theme === 'dark',\n })}\n />\n )}\n {item?.primary?.label && (\n <Button\n as=\"a\"\n href={item?.primary?.url}\n variant=\"link\"\n size=\"lg\"\n className={cn('mr-auto !p-0 text-sm font-bold leading-[1.4] text-white', {\n 'text-black': item?.theme === 'dark',\n })}\n >\n {item?.primary?.label || 'more'}\n </Button>\n )}\n </div>\n </Link>\n </div>\n )}\n </>\n )\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,iBAAAC,IAAA,eAAAC,EAAAJ,GAiBc,IAAAK,EAAA,6BAjBdC,EAA8B,iBAC9BC,EAAuD,qCACvDC,EAAmB,kCAMZ,MAAMN,EAAmB,CAAC,CAAE,iBAAAO,CAAiB,IAAiC,CACnF,MAAMC,KAAsB,UAAuB,IAAI,EAEvD,SACE,OAAC,OAAI,IAAKA,EACR,mBAAC,aAAU,eAAe,WAAW,UAAU,SAC7C,mBAAC,OAAI,UAAU,kBACZ,SAAAD,GAAkB,IAAI,CAACE,EAAWC,OACjC,OAAC,OAAiD,UAAU,QAC1D,mBAACT,EAAA,CAAa,KAAMQ,EAAM,GADlB,gBAAgBA,GAAM,KAAK,IAAIC,CAAK,EAE9C,CACD,EACH,EACF,EACF,CAEJ,EAMaT,EAAe,CAAC,CAAE,KAAAQ,EAAM,WAAAE,CAAW,OAE5C,oBACG,UAAAF,GAAM,YACL,oBACE,oBAAC,QAAK,KAAMA,EAAK,MAAO,GAAG,MAAM,UAAU,sDAAsD,KACjG,OAAC,OAAI,UAAU,qBACZ,SAAAA,EAAK,SAAS,IAAKG,MAClB,QAAC,OAA2B,UAAU,+BACpC,oBAAC,QACC,KAAM,GAAGA,EAAW,GAAG,eACvB,QAAS,CAACA,EAAW,IACrB,UAAU,+CAET,SAAAA,EAAW,MACd,EACCA,GAAY,UACX,OAAC,QACC,GAAG,IACH,KAAMA,GAAY,OAAS,QAC3B,UAAU,6HACZ,IAbMA,EAAW,KAerB,CACD,EACH,GACF,EAEDH,GAAM,aACL,OAAC,OACC,aAAW,MACT,oKACA,CACG,sCAAwCE,CAC3C,CACF,EAEA,oBAAC,QAAK,KAAM,GAAGF,EAAK,GAAG,eAAgB,QAAS,CAACA,EAAK,IACpD,oBAAC,WACC,OAAQA,EAAK,SACb,MAAO,IACP,OAAQ,IACR,UAAU,YACV,aAAa,kEACf,KACA,QAAC,OAAI,UAAU,uEACb,oBAAC,QACC,KAAMA,EAAK,MACX,aAAW,MAAG,iEAAkE,CAC9E,aAAcA,GAAM,QAAU,MAChC,CAAC,EACH,EACCA,EAAK,aACJ,OAAC,QACC,KAAMA,EAAK,SACX,aAAW,MAAG,6CAA8C,CAC1D,aAAcA,GAAM,QAAU,MAChC,CAAC,EACH,EAEDA,GAAM,SAAS,UACd,OAAC,UACC,GAAG,IACH,KAAMA,GAAM,SAAS,IACrB,QAAQ,OACR,KAAK,KACL,aAAW,MAAG,0DAA2D,CACvE,aAAcA,GAAM,QAAU,MAChC,CAAC,EAEA,SAAAA,GAAM,SAAS,OAAS,OAC3B,GAEJ,GACF,EACF,GAEJ",
6
+ "names": ["MulticolDropdown_exports", "__export", "MulticolDropdown", "MulticolItem", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "multicolMetadata", "multicolDropdownRef", "item", "index", "allPicture", "columnItem"]
7
+ }
@@ -25,6 +25,8 @@ interface NavContextType {
25
25
  setCurrentSeriesMetadata?: (_metadata: any) => void;
26
26
  subSubCategory?: any;
27
27
  setSubSubCategory?: (_category: any) => void;
28
+ currentResourceMetadata?: any;
29
+ setCurrentResourceMetadata?: (_metadata: any) => void;
28
30
  onSeriesProductClick?: (_seriesProduct: any, _position: number, _seriesLabel?: string) => void;
29
31
  onSidebarNavClick?: (_series: any, _index: number, _subSubindex?: number) => void;
30
32
  }
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var E=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},T=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _(e))!l.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(a=p(e,o))||a.enumerable});return t};var M=t=>T(s({},"__esModule",{value:!0}),t);var x={};E(x,{NavContext:()=>u,default:()=>m,useNavContext:()=>N});module.exports=M(x);var C=require("react/jsx-runtime"),r=require("react"),c=require("./types.js");const y={isMobile:!1,payloadData:{},buildProps:{products:[],categories:{}},currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{},currentSeriesMetadata:{},setCurrentSeriesMetadata:()=>{},onSeriesProductClick:(t,e,n)=>{},onSidebarNavClick:t=>{},cartCount:0},u=(0,r.createContext)(y),N=()=>{if(!(0,r.useContext)(u))throw new Error("useNavContext must be used in <NavProvider>");return(0,r.useContext)(u)},b=(t,e)=>{switch(e.type){case"SET_CURRENT_MENU":return{...t,currentMenu:e.value};case"SET_CURRENT_SERIES_METADATA":return{...t,currentSeriesMetadata:e.value};case"SET_SUB_SUB_CATEGORY":return{...t,subSubCategory:e.value}}},R=({children:t,...e})=>{const[n,a]=(0,r.useReducer)(b,{...y,currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{}}),o=(0,r.useCallback)(i=>a({type:"SET_CURRENT_MENU",value:i}),[a]),d=(0,r.useCallback)(i=>a({type:"SET_CURRENT_SERIES_METADATA",value:i}),[a]),v=(0,r.useCallback)(i=>a({type:"SET_SUB_SUB_CATEGORY",value:i}),[a]),S=(0,r.useMemo)(()=>({...n,setCurrentMenu:o,setCurrentSeriesMetadata:d,setSubSubCategory:v}),[o,d,v,n]);return(0,C.jsx)(u.Provider,{value:{...S,...e},children:t})};var m=R;
1
+ "use strict";var i=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},M=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of R(e))!T.call(t,o)&&o!==n&&i(t,o,{get:()=>e[o],enumerable:!(a=S(e,o))||a.enumerable});return t};var l=t=>M(i({},"__esModule",{value:!0}),t);var m={};p(m,{NavContext:()=>s,default:()=>U,useNavContext:()=>N});module.exports=l(m);var y=require("react/jsx-runtime"),r=require("react"),c=require("./types.js");const v={isMobile:!1,payloadData:{},buildProps:{products:[],categories:{}},currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{},currentSeriesMetadata:{},setCurrentSeriesMetadata:()=>{},currentResourceMetadata:{},setCurrentResourceMetadata:()=>{},onSeriesProductClick:(t,e,n)=>{},onSidebarNavClick:t=>{},cartCount:0},s=(0,r.createContext)(v),N=()=>{if(!(0,r.useContext)(s))throw new Error("useNavContext must be used in <NavProvider>");return(0,r.useContext)(s)},b=(t,e)=>{switch(e.type){case"SET_CURRENT_MENU":return{...t,currentMenu:e.value};case"SET_CURRENT_SERIES_METADATA":return{...t,currentSeriesMetadata:e.value};case"SET_SUB_SUB_CATEGORY":return{...t,subSubCategory:e.value};case"SET_CURRENT_RESOURCE_METADATA":return{...t,currentResourceMetadata:e.value}}},A=({children:t,...e})=>{const[n,a]=(0,r.useReducer)(b,{...v,currentMenu:c.HeaderNavigationMenu.Primary,setCurrentMenu:()=>{}}),o=(0,r.useCallback)(u=>a({type:"SET_CURRENT_MENU",value:u}),[a]),d=(0,r.useCallback)(u=>a({type:"SET_CURRENT_SERIES_METADATA",value:u}),[a]),C=(0,r.useCallback)(u=>a({type:"SET_SUB_SUB_CATEGORY",value:u}),[a]),_=(0,r.useCallback)(u=>a({type:"SET_CURRENT_RESOURCE_METADATA",value:u}),[a]),E=(0,r.useMemo)(()=>({...n,setCurrentMenu:o,setCurrentSeriesMetadata:d,setSubSubCategory:C,setCurrentResourceMetadata:_}),[o,d,C,_,n]);return(0,y.jsx)(s.Provider,{value:{...E,...e},children:t})};var U=A;
2
2
  //# sourceMappingURL=NavProvider.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/HeaderNavigation/NavProvider.tsx"],
4
- "sourcesContent": ["import React, { createContext, useCallback, useContext, useMemo, useReducer } from 'react'\nimport type { Product } from '../../cpn-components/CpnProductCard/types.js'\nimport { HeaderNavigationMenu } from './types.js'\nimport type { UserProfile } from './types.js'\n\ninterface NavContextType {\n buildProps: {\n products?: Product[] // \u4EA7\u54C1\u6570\u636E\n categories?: Record<string, any> // \u5206\u7C7B\u6570\u636E\n }\n cartCount: number\n event?: {\n search?: () => void\n cart?: () => void\n profile?: () => void\n livestream?: () => void\n join?: () => void\n login?: () => void\n }\n profile?: UserProfile // \u7528\u6237\u4FE1\u606F\n isMobile?: boolean\n payloadData: any\n currentMenu?: HeaderNavigationMenu // \u5F53\u524D\u83DC\u5355\n setCurrentMenu?: (_menu: HeaderNavigationMenu) => void // \u8BBE\u7F6E\u5F53\u524D\u83DC\u5355\n currentSeriesMetadata?: any // \u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n setCurrentSeriesMetadata?: (_metadata: any) => void // \u8BBE\u7F6E\u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n subSubCategory?: any // \u5B50\u5B50\u5206\u7C7B\n setSubSubCategory?: (_category: any) => void // \u8BBE\u7F6E\u5B50\u5B50\u5206\u7C7B\n onSeriesProductClick?: (_seriesProduct: any, _position: number, _seriesLabel?: string) => void // \u8BBE\u7F6E\u7CFB\u5217\u4EA7\u54C1\u70B9\u51FB\n onSidebarNavClick?: (_series: any, _index: number, _subSubindex?: number) => void // \u8BBE\u7F6E\u4FA7\u8FB9\u680F\u5BFC\u822A\u70B9\u51FB\n}\n\nconst initialState: NavContextType = {\n isMobile: false,\n payloadData: {},\n buildProps: {\n products: [],\n categories: {},\n },\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n currentSeriesMetadata: {},\n setCurrentSeriesMetadata: () => {},\n onSeriesProductClick: (_seriesProduct: any, _position: number, _seriesLabel?: string) => {},\n onSidebarNavClick: (_series: any) => {},\n cartCount: 0,\n}\n\ntype Action =\n | {\n type: 'SET_CURRENT_MENU'\n value: HeaderNavigationMenu\n }\n | {\n type: 'SET_CURRENT_SERIES_METADATA'\n value: any\n }\n | {\n type: 'SET_SUB_SUB_CATEGORY'\n value: any\n }\nexport const NavContext = createContext<NavContextType>(initialState)\n\nexport const useNavContext = () => {\n const context = useContext(NavContext)\n if (!context) {\n throw new Error('useNavContext must be used in <NavProvider>')\n }\n return useContext(NavContext)\n}\n\nconst reducer = (state: NavContextType, action: Action) => {\n switch (action.type) {\n case 'SET_CURRENT_MENU': {\n return {\n ...state,\n currentMenu: action.value,\n }\n }\n case 'SET_CURRENT_SERIES_METADATA': {\n return {\n ...state,\n currentSeriesMetadata: action.value,\n }\n }\n case 'SET_SUB_SUB_CATEGORY': {\n return {\n ...state,\n subSubCategory: action.value,\n }\n }\n }\n}\n\nconst NavProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & NavContextType) => {\n const [state, dispatch] = useReducer(reducer, {\n ...initialState,\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n })\n\n const setCurrentMenu = useCallback(\n (value: HeaderNavigationMenu) => {\n return dispatch({ type: 'SET_CURRENT_MENU', value })\n },\n [dispatch]\n )\n\n const setCurrentSeriesMetadata = useCallback(\n (value: any) => {\n return dispatch({ type: 'SET_CURRENT_SERIES_METADATA', value })\n },\n [dispatch]\n )\n\n const setSubSubCategory = useCallback(\n (value: any) => {\n return dispatch({ type: 'SET_SUB_SUB_CATEGORY', value })\n },\n [dispatch]\n )\n\n const value = useMemo(\n () => ({\n ...state,\n setCurrentMenu,\n setCurrentSeriesMetadata,\n setSubSubCategory,\n }),\n [setCurrentMenu, setCurrentSeriesMetadata, setSubSubCategory, state]\n )\n\n return <NavContext.Provider value={{ ...value, ...rest }}>{children}</NavContext.Provider>\n}\n\nexport default NavProvider\n"],
5
- "mappings": "yaAAA,IA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vBF,GACQF,EAAS,CAAE,KAAM,uBAAwB,MAAAE,CAAM,CAAC,EAEzD,CAACF,CAAQ,CACX,EAEME,KAAQ,WACZ,KAAO,CACL,GAAGP,EACH,eAAAM,EACA,yBAAAE,EACA,kBAAAC,CACF,GACA,CAACH,EAAgBE,EAA0BC,EAAmBT,CAAK,CACrE,EAEA,SAAO,OAACb,EAAW,SAAX,CAAoB,MAAO,CAAE,GAAGoB,EAAO,GAAGH,CAAK,EAAI,SAAAD,EAAS,CACtE,EAEA,IAAOf,EAAQc",
6
- "names": ["NavProvider_exports", "__export", "NavContext", "NavProvider_default", "useNavContext", "__toCommonJS", "import_jsx_runtime", "import_react", "import_types", "initialState", "_seriesProduct", "_position", "_seriesLabel", "_series", "reducer", "state", "action", "NavProvider", "children", "rest", "dispatch", "setCurrentMenu", "value", "setCurrentSeriesMetadata", "setSubSubCategory"]
4
+ "sourcesContent": ["import React, { createContext, useCallback, useContext, useMemo, useReducer } from 'react'\nimport type { Product } from '../../cpn-components/CpnProductCard/types.js'\nimport { HeaderNavigationMenu } from './types.js'\nimport type { UserProfile } from './types.js'\n\ninterface NavContextType {\n buildProps: {\n products?: Product[] // \u4EA7\u54C1\u6570\u636E\n categories?: Record<string, any> // \u5206\u7C7B\u6570\u636E\n }\n cartCount: number\n event?: {\n search?: () => void\n cart?: () => void\n profile?: () => void\n livestream?: () => void\n join?: () => void\n login?: () => void\n }\n profile?: UserProfile // \u7528\u6237\u4FE1\u606F\n isMobile?: boolean\n payloadData: any\n currentMenu?: HeaderNavigationMenu // \u5F53\u524D\u83DC\u5355\n setCurrentMenu?: (_menu: HeaderNavigationMenu) => void // \u8BBE\u7F6E\u5F53\u524D\u83DC\u5355\n currentSeriesMetadata?: any // \u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n setCurrentSeriesMetadata?: (_metadata: any) => void // \u8BBE\u7F6E\u5F53\u524D\u7CFB\u5217\u5143\u6570\u636E\n subSubCategory?: any // \u5B50\u5B50\u5206\u7C7B\n setSubSubCategory?: (_category: any) => void // \u8BBE\u7F6E\u5B50\u5B50\u5206\u7C7B\n currentResourceMetadata?: any // \u5F53\u524D\u8D44\u6E90\u4F4D\u5143\u6570\u636E\n setCurrentResourceMetadata?: (_metadata: any) => void // \u8BBE\u7F6E\u5F53\u524D\u8D44\u6E90\u4F4D\u5143\u6570\u636E\n onSeriesProductClick?: (_seriesProduct: any, _position: number, _seriesLabel?: string) => void // \u8BBE\u7F6E\u7CFB\u5217\u4EA7\u54C1\u70B9\u51FB\n onSidebarNavClick?: (_series: any, _index: number, _subSubindex?: number) => void // \u8BBE\u7F6E\u4FA7\u8FB9\u680F\u5BFC\u822A\u70B9\u51FB\n}\n\nconst initialState: NavContextType = {\n isMobile: false,\n payloadData: {},\n buildProps: {\n products: [],\n categories: {},\n },\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n currentSeriesMetadata: {},\n setCurrentSeriesMetadata: () => {},\n currentResourceMetadata: {},\n setCurrentResourceMetadata: () => {},\n onSeriesProductClick: (_seriesProduct: any, _position: number, _seriesLabel?: string) => {},\n onSidebarNavClick: (_series: any) => {},\n cartCount: 0,\n}\n\ntype Action =\n | {\n type: 'SET_CURRENT_MENU'\n value: HeaderNavigationMenu\n }\n | {\n type: 'SET_CURRENT_SERIES_METADATA'\n value: any\n }\n | {\n type: 'SET_SUB_SUB_CATEGORY'\n value: any\n }\n | {\n type: 'SET_CURRENT_RESOURCE_METADATA'\n value: any\n }\nexport const NavContext = createContext<NavContextType>(initialState)\n\nexport const useNavContext = () => {\n const context = useContext(NavContext)\n if (!context) {\n throw new Error('useNavContext must be used in <NavProvider>')\n }\n return useContext(NavContext)\n}\n\nconst reducer = (state: NavContextType, action: Action) => {\n switch (action.type) {\n case 'SET_CURRENT_MENU': {\n return {\n ...state,\n currentMenu: action.value,\n }\n }\n case 'SET_CURRENT_SERIES_METADATA': {\n return {\n ...state,\n currentSeriesMetadata: action.value,\n }\n }\n case 'SET_SUB_SUB_CATEGORY': {\n return {\n ...state,\n subSubCategory: action.value,\n }\n }\n case 'SET_CURRENT_RESOURCE_METADATA': {\n return {\n ...state,\n currentResourceMetadata: action.value,\n }\n }\n }\n}\n\nconst NavProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & NavContextType) => {\n const [state, dispatch] = useReducer(reducer, {\n ...initialState,\n currentMenu: HeaderNavigationMenu.Primary,\n setCurrentMenu: () => {},\n })\n\n const setCurrentMenu = useCallback(\n (value: HeaderNavigationMenu) => {\n return dispatch({ type: 'SET_CURRENT_MENU', value })\n },\n [dispatch]\n )\n\n const setCurrentSeriesMetadata = useCallback(\n (value: any) => {\n return dispatch({ type: 'SET_CURRENT_SERIES_METADATA', value })\n },\n [dispatch]\n )\n\n const setSubSubCategory = useCallback(\n (value: any) => {\n return dispatch({ type: 'SET_SUB_SUB_CATEGORY', value })\n },\n [dispatch]\n )\n\n const setCurrentResourceMetadata = useCallback(\n (value: any) => {\n return dispatch({ type: 'SET_CURRENT_RESOURCE_METADATA', value })\n },\n [dispatch]\n )\n\n const value = useMemo(\n () => ({\n ...state,\n setCurrentMenu,\n setCurrentSeriesMetadata,\n setSubSubCategory,\n setCurrentResourceMetadata,\n }),\n [setCurrentMenu, setCurrentSeriesMetadata, setSubSubCategory, setCurrentResourceMetadata, state]\n )\n\n return <NavContext.Provider value={{ ...value, ...rest }}>{children}</NavContext.Provider>\n}\n\nexport default NavProvider\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,YAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAL,GA+JS,IAAAM,EAAA,6BA/JTC,EAAmF,iBAEnFC,EAAqC,sBAgCrC,MAAMC,EAA+B,CACnC,SAAU,GACV,YAAa,CAAC,EACd,WAAY,CACV,SAAU,CAAC,EACX,WAAY,CAAC,CACf,EACA,YAAa,uBAAqB,QAClC,eAAgB,IAAM,CAAC,EACvB,sBAAuB,CAAC,EACxB,yBAA0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,GAAGP,EACH,eAAAM,EACA,yBAAAE,EACA,kBAAAC,EACA,2BAAAC,CACF,GACA,CAACJ,EAAgBE,EAA0BC,EAAmBC,EAA4BV,CAAK,CACjG,EAEA,SAAO,OAACb,EAAW,SAAX,CAAoB,MAAO,CAAE,GAAGoB,EAAO,GAAGH,CAAK,EAAI,SAAAD,EAAS,CACtE,EAEA,IAAOf,EAAQc",
6
+ "names": ["NavProvider_exports", "__export", "NavContext", "NavProvider_default", "useNavContext", "__toCommonJS", "import_jsx_runtime", "import_react", "import_types", "initialState", "_seriesProduct", "_position", "_seriesLabel", "_series", "reducer", "state", "action", "NavProvider", "children", "rest", "dispatch", "setCurrentMenu", "value", "setCurrentSeriesMetadata", "setSubSubCategory", "setCurrentResourceMetadata"]
7
7
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 资源位项组件 - 桌面端
3
+ */
4
+ export declare const ResourceItem: ({ resource }: {
5
+ resource: any;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ /**
8
+ * 资源位子分类标题组件 - 移动端
9
+ */
10
+ export declare const ResourceSubSubCategoryItemComp: ({ matchResourcesMetadata, onSubSubCategoryItemClick, expanded, }: {
11
+ matchResourcesMetadata: any;
12
+ onSubSubCategoryItemClick?: () => void;
13
+ expanded?: boolean;
14
+ }) => import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ * 资源位子分类内容组件 - 移动端
17
+ */
18
+ export declare const ResourceSubSubCategoryContentComp: ({ matchResourcesMetadata }: {
19
+ matchResourcesMetadata: any;
20
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use strict";var d=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var c=(t,a)=>{for(var i in a)d(t,i,{get:a[i],enumerable:!0})},x=(t,a,i,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of m(a))!h.call(t,n)&&n!==i&&d(t,n,{get:()=>a[n],enumerable:!(s=r(a,n))||s.enumerable});return t};var v=t=>x(d({},"__esModule",{value:!0}),t);var g={};c(g,{ResourceItem:()=>p,ResourceSubSubCategoryContentComp:()=>f,ResourceSubSubCategoryItemComp:()=>b});module.exports=v(g);var e=require("react/jsx-runtime"),l=require("../../components/index.js"),o=require("../../helpers/utils.js");const p=({resource:t})=>(0,e.jsx)("div",{className:"laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-none desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",children:(0,e.jsx)(l.Link,{href:t?.href,className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"relative h-full overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(l.Picture,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(l.Text,{as:"p",html:t?.title,className:(0,o.cn)("text-xl font-bold leading-[1.2]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})}),t?.desc&&(0,e.jsx)(l.Text,{html:t?.desc,className:(0,o.cn)("text-sm font-bold leading-[1.4]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})})]})]})})}),b=({matchResourcesMetadata:t,onSubSubCategoryItemClick:a,expanded:i})=>{const s=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(l.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),a&&(0,e.jsx)("svg",{className:(0,o.cn)("size-5",{"rotate-180":i}),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M6 9L12 15L18 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return a?(0,e.jsx)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:a,"aria-expanded":i,children:s}):(0,e.jsx)("div",{className:"flex items-center justify-between py-4",children:s})},f=({matchResourcesMetadata:t})=>(0,e.jsx)("div",{className:"tablet:grid tablet:grid-cols-2 flex grid-cols-1 flex-col gap-4",children:!!t?.resources?.length&&t?.resources?.map((a,i)=>(0,e.jsx)(l.Link,{href:a?.href,className:"no-underline hover:text-current",children:(0,e.jsx)("div",{className:"laptop:h-[280px] tablet:max-w-none relative h-[240px] max-w-[358px]",children:(0,e.jsxs)("div",{className:"relative h-full overflow-hidden",children:[(0,e.jsx)(l.Picture,{source:a.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(l.Text,{html:a?.title,as:"p",className:(0,o.cn)("text-xl font-bold leading-[1.2]",{"text-white":a?.theme!=="dark","text-black":a?.theme==="dark"})}),a?.desc&&(0,e.jsx)(l.Text,{html:a?.desc,className:(0,o.cn)("text-sm font-bold leading-[1.4]",{"text-white":a?.theme!=="dark","text-black":a?.theme==="dark"})})]})]})})},`resourceItem-${i}`))});
2
+ //# sourceMappingURL=ResourceItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/biz-components/HeaderNavigation/ResourceItem.tsx"],
4
+ "sourcesContent": ["import { Picture, Text, Link } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\n\n/**\n * \u8D44\u6E90\u4F4D\u9879\u7EC4\u4EF6 - \u684C\u9762\u7AEF\n */\nexport const ResourceItem = ({ resource }: { resource: any }) => {\n return (\n <div className=\"laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-none desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden\">\n <Link href={resource?.href} className=\"no-underline hover:text-current\">\n <div className=\"relative h-full overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Picture\n source={resource.imageUrl}\n width={404}\n height={280}\n className=\"size-full\"\n imgClassName=\"object-cover h-full hover:scale-105 transition-all duration-300\"\n />\n <div className=\"absolute inset-x-0 bottom-0 p-4\">\n <Text\n as=\"p\"\n html={resource?.title}\n className={cn('text-xl font-bold leading-[1.2]', {\n 'text-white': resource?.theme !== 'dark',\n 'text-black': resource?.theme === 'dark',\n })}\n />\n {resource?.desc && (\n <Text\n html={resource?.desc}\n className={cn('text-sm font-bold leading-[1.4]', {\n 'text-white': resource?.theme !== 'dark',\n 'text-black': resource?.theme === 'dark',\n })}\n />\n )}\n </div>\n </div>\n </Link>\n </div>\n )\n}\n\n/**\n * \u8D44\u6E90\u4F4D\u5B50\u5206\u7C7B\u6807\u9898\u7EC4\u4EF6 - \u79FB\u52A8\u7AEF\n */\nexport const ResourceSubSubCategoryItemComp = ({\n matchResourcesMetadata,\n onSubSubCategoryItemClick,\n expanded,\n}: {\n matchResourcesMetadata: any\n onSubSubCategoryItemClick?: () => void\n expanded?: boolean\n}) => {\n const content = (\n <>\n {matchResourcesMetadata?.label && (\n <Text html={matchResourcesMetadata?.label} className=\"text-sm font-bold leading-[1.4]\" />\n )}\n {onSubSubCategoryItemClick && (\n <svg\n className={cn('size-5', {\n ['rotate-180']: expanded,\n })}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M6 9L12 15L18 9\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )}\n </>\n )\n\n return onSubSubCategoryItemClick ? (\n <button\n className=\"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left\"\n onClick={onSubSubCategoryItemClick}\n aria-expanded={expanded}\n >\n {content}\n </button>\n ) : (\n <div className=\"flex items-center justify-between py-4\">{content}</div>\n )\n}\n\n/**\n * \u8D44\u6E90\u4F4D\u5B50\u5206\u7C7B\u5185\u5BB9\u7EC4\u4EF6 - \u79FB\u52A8\u7AEF\n */\nexport const ResourceSubSubCategoryContentComp = ({ matchResourcesMetadata }: { matchResourcesMetadata: any }) => {\n return (\n <div className=\"tablet:grid tablet:grid-cols-2 flex grid-cols-1 flex-col gap-4\">\n {!!matchResourcesMetadata?.resources?.length &&\n matchResourcesMetadata?.resources?.map((resourceItem: any, rIndex: number) => (\n <Link key={`resourceItem-${rIndex}`} href={resourceItem?.href} className=\"no-underline hover:text-current\">\n <div className=\"laptop:h-[280px] tablet:max-w-none relative h-[240px] max-w-[358px]\">\n <div className=\"relative h-full overflow-hidden\">\n <Picture\n source={resourceItem.imageUrl}\n width={404}\n height={280}\n className=\"size-full\"\n imgClassName=\"object-cover h-full hover:scale-105 transition-all duration-300\"\n />\n <div className=\"absolute inset-x-0 bottom-0 p-4\">\n <Text\n html={resourceItem?.title}\n as=\"p\"\n className={cn('text-xl font-bold leading-[1.2]', {\n 'text-white': resourceItem?.theme !== 'dark',\n 'text-black': resourceItem?.theme === 'dark',\n })}\n />\n {resourceItem?.desc && (\n <Text\n html={resourceItem?.desc}\n className={cn('text-sm font-bold leading-[1.4]', {\n 'text-white': resourceItem?.theme !== 'dark',\n 'text-black': resourceItem?.theme === 'dark',\n })}\n />\n )}\n </div>\n </div>\n </div>\n </Link>\n ))}\n </div>\n )\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,sCAAAC,EAAA,mCAAAC,IAAA,eAAAC,EAAAL,GAWU,IAAAM,EAAA,6BAXVC,EAAoC,qCACpCC,EAAmB,kCAKZ,MAAMN,EAAe,CAAC,CAAE,SAAAO,CAAS,OAEpC,OAAC,OAAI,UAAU,4IACb,mBAAC,QAAK,KAAMA,GAAU,KAAM,UAAU,kCACpC,oBAAC,OAAI,UAAU,kHACb,oBAAC,WACC,OAAQA,EAAS,SACjB,MAAO,IACP,OAAQ,IACR,UAAU,Y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,kCAAmC,CAC/C,aAAcA,GAAc,QAAU,OACtC,aAAcA,GAAc,QAAU,MACxC,CAAC,EACH,EACCA,GAAc,SACb,OAAC,QACC,KAAMA,GAAc,KACpB,aAAW,MAAG,kCAAmC,CAC/C,aAAcA,GAAc,QAAU,OACtC,aAAcA,GAAc,QAAU,MACxC,CAAC,EACH,GAEJ,GACF,EACF,GA9BS,gBAAgBC,CAAM,EA+BjC,CACD,EACL",
6
+ "names": ["ResourceItem_exports", "__export", "ResourceItem", "ResourceSubSubCategoryContentComp", "ResourceSubSubCategoryItemComp", "__toCommonJS", "import_jsx_runtime", "import_components", "import_utils", "resource", "matchResourcesMetadata", "onSubSubCategoryItemClick", "expanded", "content", "resourceItem", "rIndex"]
7
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * 资源位侧边栏下拉
4
+ * @param categoriesItem 分类项
5
+ */
6
+ export declare const ResourceSidebarDropdown: React.MemoExoticComponent<({ resourceCategoriesMetadata, resourcesMetadata }: {
7
+ resourceCategoriesMetadata: any;
8
+ resourcesMetadata: any;
9
+ }) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,2 @@
1
+ "use strict";var F=Object.create;var m=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var O=(e,s)=>{for(var u in s)m(e,u,{get:s[u],enumerable:!0})},S=(e,s,u,d)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of D(s))!L.call(e,c)&&c!==u&&m(e,c,{get:()=>s[c],enumerable:!(d=$(s,c))||d.enumerable});return e};var z=(e,s,u)=>(u=e!=null?F(E(e)):{},S(s||!e||!e.__esModule?m(u,"default",{value:e,enumerable:!0}):u,e)),B=e=>S(m({},"__esModule",{value:!0}),e);var I={};O(I,{ResourceSidebarDropdown:()=>k});module.exports=B(I);var n=require("react/jsx-runtime"),i=z(require("react")),p=require("../../components/index.js"),f=require("../../helpers/utils.js"),h=require("./icons/index.js"),w=require("./NavProvider.js"),N=require("./ResourceItem.js");const k=i.default.memo(({resourceCategoriesMetadata:e,resourcesMetadata:s})=>{const{onSidebarNavClick:u}=(0,w.useNavContext)(),[d,c]=(0,i.useState)([]),[y,g]=(0,i.useState)(-1),C=(0,i.useRef)(null),x=(0,i.useCallback)(()=>{const o=e?.subcategories;if(!o?.length)return;const a=o.findIndex(l=>!!l?.subSubCategories),t=o.findIndex(l=>!l?.subSubCategories),r=o.map((l,b)=>({index:b,open:a===b||t===b}));c(r)},[e]);(0,i.useEffect)(()=>{x()},[x]);const v=(0,i.useMemo)(()=>{const o=e?.subcategories?.[d?.find(t=>t.open)?.index||0],a=s?.find(t=>t?.label?.toLowerCase()===o?.label?.toLowerCase())||{};if(o?.subSubCategories){const t=o?.subSubCategories?.[y];return s?.find(l=>l?.label?.toLowerCase()===t?.label?.toLowerCase())||{}}else return a},[e,d,y,s]),R=(0,i.useCallback)((o,a)=>{a?.subSubCategories?.length>0?g(0):g(-1),c(t=>t.map((r,l)=>({...r,open:l===o?!r.open:!1})))},[]),A=(o,a)=>{c(t=>t.map(r=>r.index===o?{...r,open:!0}:{...r,open:!1})),g(a)};return(0,n.jsxs)(p.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,n.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:C,children:[(0,n.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e?.subcategories?.map((o,a)=>{const t=Array.isArray(o?.subSubCategories)&&o?.subSubCategories?.length>0,r=d?.find(l=>l.index===a)?.open;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{className:(0,f.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!t&&r}),onClick:()=>{R(a,o),u?.(o,a)},"aria-expanded":t?r:void 0,"aria-haspopup":t?"true":void 0,children:[(0,n.jsx)(p.Text,{html:o.label,className:"p-4 text-sm font-bold leading-[1.4]"}),t&&(0,n.jsx)(h.DownArrow,{"aria-hidden":"true",className:(0,f.cn)("size-4",{"rotate-180":r})})]}),r&&(0,n.jsx)("div",{className:"flex flex-col",role:"menu",children:o.subSubCategories?.map((l,b)=>(0,n.jsx)("button",{onClick:()=>{A(a,b),u?.(l,b)},className:(0,f.cn)("w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":y===b}),role:"menuitem","aria-label":l.label,children:(0,n.jsx)(p.Text,{html:l.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${a}-${b}`))})]},`subcategoryItem-${a}`)})}),e&&(0,n.jsx)("div",{className:"flex",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[e?.primary&&(0,n.jsx)(p.Button,{as:"a",href:`${e?.primary?.url}?ref=${e?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:e?.primary?.label}),e?.secondary&&(0,n.jsx)(p.Button,{as:"a",href:e?.secondary?.url,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:e?.secondary?.label})]})})]}),(0,n.jsx)("div",{className:"desktop:h-[509px] flex-1 overflow-y-auto py-4",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,n.jsx)("div",{className:"grid grid-cols-3 gap-4 ",children:Array.isArray(v?.resources)?v.resources.map((o,a)=>(0,n.jsx)(N.ResourceItem,{resource:o},`resourceItem-${a}`)):null})})]})});k.displayName="ResourceSidebarDropdown";
2
+ //# sourceMappingURL=ResourceSidebarDropdown.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/biz-components/HeaderNavigation/ResourceSidebarDropdown.tsx"],
4
+ "sourcesContent": ["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { Button, Container, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport { DownArrow } from './icons/index.js'\nimport { useNavContext } from './NavProvider.js'\nimport { ResourceItem } from './ResourceItem.js'\n\n/**\n * \u8D44\u6E90\u4F4D\u4FA7\u8FB9\u680F\u4E0B\u62C9\n * @param categoriesItem \u5206\u7C7B\u9879\n */\nexport const ResourceSidebarDropdown = React.memo(\n ({ resourceCategoriesMetadata, resourcesMetadata }: { resourceCategoriesMetadata: any; resourcesMetadata: any }) => {\n const { onSidebarNavClick } = useNavContext()\n const [expandedSubcategory, setExpandedSubcategory] = useState<{ index: number; open: boolean }[]>([])\n const [activeSubSubcategoryIndex, setActiveSubSubcategoryIndex] = useState(-1)\n const resourceDropdownRef = useRef<HTMLDivElement>(null)\n\n const initExpandedSubcategory = useCallback(() => {\n const subcategories = resourceCategoriesMetadata?.subcategories\n if (!subcategories?.length) return\n\n const withSubSubCategoriesIndex = subcategories.findIndex((item: any) => !!item?.subSubCategories)\n const withoutSubSubCategoriesIndex = subcategories.findIndex((item: any) => !item?.subSubCategories)\n\n // \u521B\u5EFA\u5C55\u5F00\u72B6\u6001\u6570\u7EC4\n const expandedStates = subcategories.map((_: any, index: number) => ({\n index,\n open: withSubSubCategoriesIndex === index || withoutSubSubCategoriesIndex === index,\n }))\n\n setExpandedSubcategory(expandedStates)\n }, [resourceCategoriesMetadata])\n\n useEffect(() => {\n initExpandedSubcategory()\n }, [initExpandedSubcategory])\n\n // \u901A\u8FC7categoriesMetadata\u7684subSubCategories\u7684label\u4E0Eresources\u7684label\u5339\u914D\n const matchResourcesMetadata = useMemo(() => {\n const subCategory =\n resourceCategoriesMetadata?.subcategories?.[expandedSubcategory?.find(item => item.open)?.index || 0]\n const currentResourcesMetadata =\n resourcesMetadata?.find((item: any) => item?.label?.toLowerCase() === subCategory?.label?.toLowerCase()) || {}\n\n if (subCategory?.subSubCategories) {\n const activeSubSubcategory = subCategory?.subSubCategories?.[activeSubSubcategoryIndex]\n const currentActiveResourcesMetadata =\n resourcesMetadata?.find(\n (item: any) => item?.label?.toLowerCase() === activeSubSubcategory?.label?.toLowerCase()\n ) || {}\n return currentActiveResourcesMetadata\n } else {\n return currentResourcesMetadata\n }\n }, [resourceCategoriesMetadata, expandedSubcategory, activeSubSubcategoryIndex, resourcesMetadata])\n\n const handleSubcategoryOpen = useCallback((index: number, subcategoryItem: any) => {\n subcategoryItem?.subSubCategories?.length > 0 ? setActiveSubSubcategoryIndex(0) : setActiveSubSubcategoryIndex(-1)\n\n setExpandedSubcategory(prev => prev.map((item, i) => ({ ...item, open: i === index ? !item.open : false })))\n }, [])\n\n const handleSubSubcategoryOpen = (index: number, subSubindex: number) => {\n setExpandedSubcategory(prev =>\n prev.map(item => (item.index === index ? { ...item, open: true } : { ...item, open: false }))\n )\n setActiveSubSubcategoryIndex(subSubindex)\n }\n\n return (\n <Container childClassName=\"lg-desktop:gap-12 flex bg-white gap-8\">\n <div\n className=\"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4\"\n style={{\n userSelect: 'none',\n }}\n ref={resourceDropdownRef}\n >\n <div\n className=\"desktop:h-[416px] flex flex-col overflow-y-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {resourceCategoriesMetadata?.subcategories?.map((subItem: any, index: number) => {\n const hasSubSubCategory =\n Array.isArray(subItem?.subSubCategories) && subItem?.subSubCategories?.length > 0\n const isExpanded = expandedSubcategory?.find(item => item.index === index)?.open\n return (\n <div key={`subcategoryItem-${index}`}>\n <button\n className={cn(\n 'flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left',\n {\n 'bg-[#F5F5F7]': !hasSubSubCategory && isExpanded,\n }\n )}\n onClick={() => {\n handleSubcategoryOpen(index, subItem)\n onSidebarNavClick?.(subItem, index)\n }}\n aria-expanded={hasSubSubCategory ? isExpanded : undefined}\n aria-haspopup={hasSubSubCategory ? 'true' : undefined}\n >\n <Text html={subItem.label} className=\"p-4 text-sm font-bold leading-[1.4]\" />\n {hasSubSubCategory && (\n <DownArrow\n aria-hidden=\"true\"\n className={cn('size-4', {\n ['rotate-180']: isExpanded,\n })}\n />\n )}\n </button>\n {isExpanded && (\n <div className=\"flex flex-col\" role=\"menu\">\n {subItem.subSubCategories?.map((subSubItem: any, subSubindex: number) => (\n <button\n onClick={() => {\n handleSubSubcategoryOpen(index, subSubindex)\n onSidebarNavClick?.(subSubItem, subSubindex)\n }}\n key={`subSubItem-${index}-${subSubindex}`}\n className={cn(\n 'w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left hover:bg-[#F5F5F7]',\n {\n 'bg-[#F5F5F7]': activeSubSubcategoryIndex === subSubindex,\n }\n )}\n role=\"menuitem\"\n aria-label={subSubItem.label}\n >\n <Text html={subSubItem.label} className=\"text-sm font-bold leading-[1.4] text-[#4A4C56]\" />\n </button>\n ))}\n </div>\n )}\n </div>\n )\n })}\n </div>\n {resourceCategoriesMetadata && (\n <div className=\"flex\">\n <div className=\"flex flex-col gap-4\">\n {resourceCategoriesMetadata?.primary && (\n <Button\n as=\"a\"\n href={`${resourceCategoriesMetadata?.primary?.url}?ref=${resourceCategoriesMetadata?.primary?.label}_shopall`}\n variant=\"primary\"\n size=\"lg\"\n className=\"lg-desktop:text-base text-sm\"\n >\n {resourceCategoriesMetadata?.primary?.label}\n </Button>\n )}\n {resourceCategoriesMetadata?.secondary && (\n <Button\n as=\"a\"\n href={resourceCategoriesMetadata?.secondary?.url}\n variant=\"link\"\n size=\"lg\"\n className=\"lg-desktop:text-base justify-start !p-0 text-sm\"\n >\n {resourceCategoriesMetadata?.secondary?.label}\n </Button>\n )}\n </div>\n </div>\n )}\n </div>\n <div\n className=\"desktop:h-[509px] flex-1 overflow-y-auto py-4\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n <div className=\"grid grid-cols-3 gap-4 \">\n {Array.isArray(matchResourcesMetadata?.resources)\n ? matchResourcesMetadata.resources.map((resourceItem: any, resourceIndex: number) => (\n <ResourceItem key={`resourceItem-${resourceIndex}`} resource={resourceItem} />\n ))\n : null}\n </div>\n </div>\n </Container>\n )\n }\n)\n\nResourceSidebarDropdown.displayName = 'ResourceSidebarDropdown'\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GA4FkB,IAAAI,EAAA,6BA5FlBC,EAAyE,oBACzEC,EAAwC,qCACxCC,EAAmB,kCACnBC,EAA0B,4BAC1BC,EAA8B,4BAC9BC,EAA6B,6BAMtB,MAAMR,EAA0B,EAAAS,QAAM,KAC3C,CAAC,CAAE,2BAAAC,EAA4B,kBAAAC,CAAkB,IAAmE,CAClH,KAAM,CAAE,kBAAAC,CAAkB,KAAI,iBAAc,EACtC,CAACC,EAAqBC,CAAsB,KAAI,YAA6C,CAAC,CAAC,EAC/F,CAACC,EAA2BC,CAA4B,KAAI,YAAS,EAAE,EACvEC,KAAsB,UAAuB,IAAI,EAEjDC,KAA0B,eAAY,IAAM,CAChD,MAAMC,EAAgBT,GAA4B,cAClD,GAAI,CAACS,GAAe,OAAQ,OAE5B,MAAMC,EAA4BD,EAAc,UAAWE,GAAc,CAAC,CAACA,GAAM,gBAAgB,EAC3FC,EAA+BH,EAAc,UAAWE,GAAc,CAACA,GAAM,gBAAgB,EAG7FE,EAAiBJ,EAAc,IAAI,CAACK,EAAQC,KAAmB,CACnE,MAAAA,EACA,KAAML,IAA8BK,GAASH,IAAiCG,CAChF,EAAE,EAEFX,EAAuBS,CAAc,CACvC,EAAG,CAACb,CAA0B,CAAC,KAE/B,aAAU,IAAM,CACdQ,EAAwB,CAC1B,EAAG,CAACA,CAAuB,CAAC,EAG5B,MAAMQ,KAAyB,WAAQ,IAAM,CAC3C,MAAMC,EACJjB,GAA4B,gBAAgBG,GAAqB,KAAKQ,GAAQA,EAAK,IAAI,GAAG,OAAS,CAAC,EAChGO,EACJjB,GAAmB,KAAMU,GAAcA,GAAM,OAAO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A,EAAuB,UAAU,IAAI,CAACc,EAAmBC,OACvD,OAAC,gBAAmD,SAAUD,GAA3C,gBAAgBC,CAAa,EAA4B,CAC7E,EACD,KACN,EACF,GACF,CAEJ,CACF,EAEAzC,EAAwB,YAAc",
6
+ "names": ["ResourceSidebarDropdown_exports", "__export", "ResourceSidebarDropdown", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_icons", "import_NavProvider", "import_ResourceItem", "React", "resourceCategoriesMetadata", "resourcesMetadata", "onSidebarNavClick", "expandedSubcategory", "setExpandedSubcategory", "activeSubSubcategoryIndex", "setActiveSubSubcategoryIndex", "resourceDropdownRef", "initExpandedSubcategory", "subcategories", "withSubSubCategoriesIndex", "item", "withoutSubSubCategoriesIndex", "expandedStates", "_", "index", "matchResourcesMetadata", "subCategory", "currentResourcesMetadata", "activeSubSubcategory", "handleSubcategoryOpen", "subcategoryItem", "prev", "i", "handleSubSubcategoryOpen", "subSubindex", "subItem", "hasSubSubCategory", "isExpanded", "subSubItem", "resourceItem", "resourceIndex"]
7
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ /**
3
+ * 侧边栏下拉
4
+ * @param categoriesItem 分类项
5
+ */
6
+ export declare const SidebarDropdown: React.MemoExoticComponent<({ sidebarCategoriesMetadata, seriesMetadata }: {
7
+ sidebarCategoriesMetadata: any;
8
+ seriesMetadata: any;
9
+ }) => import("react/jsx-runtime").JSX.Element>;
10
+ /**
11
+ * 系列产品项组件
12
+ */
13
+ export declare const SeriesProductItem: ({ product, isCollection, position, seriesLabel, }: {
14
+ product: any;
15
+ isCollection?: boolean;
16
+ position?: number;
17
+ seriesLabel?: string;
18
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ "use strict";var $=Object.create;var N=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var j=(t,i)=>{for(var m in i)N(t,m,{get:i[m],enumerable:!0})},w=(t,i,m,x)=>{if(i&&typeof i=="object"||typeof i=="function")for(let p of A(i))!_.call(t,p)&&p!==m&&N(t,p,{get:()=>i[p],enumerable:!(x=P(i,p))||x.enumerable});return t};var B=(t,i,m)=>(m=t!=null?$(z(t)):{},w(i||!t||!t.__esModule?N(m,"default",{value:t,enumerable:!0}):m,t)),E=t=>w(N({},"__esModule",{value:!0}),t);var O={};j(O,{SeriesProductItem:()=>D,SidebarDropdown:()=>F});module.exports=E(O);var e=require("react/jsx-runtime"),d=B(require("react")),n=require("../../components/index.js"),f=require("../../helpers/utils.js"),C=require("./icons/index.js"),S=require("./NavProvider.js");const F=d.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:i})=>{const{buildProps:m,onSidebarNavClick:x}=(0,S.useNavContext)(),[p,y]=(0,d.useState)([]),[u,b]=(0,d.useState)(-1),v=(0,d.useRef)(null),h=(0,d.useCallback)(()=>{const l=t?.subcategories;if(!l?.length)return;const o=l.findIndex(c=>!!c?.subSubCategories),s=l.findIndex(c=>!c?.subSubCategories),r=l.map((c,g)=>({index:g,open:o===g||s===g}));y(r)},[t]);(0,d.useEffect)(()=>{h()},[h]);const a=(0,d.useMemo)(()=>{const l=t?.subcategories?.[p?.find(s=>s.open)?.index||0],o=i?.find(s=>s?.label?.toLowerCase()===l?.label?.toLowerCase())||{};if(l?.collections){const s=m?.categories?.[l?.collections]||{};return{label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,guide:o?.guide,series:[{products:s?.products}]}}else if(l?.subSubCategories){const s=l?.subSubCategories?.[u],r=i?.find(c=>c?.label?.toLowerCase()===s?.label?.toLowerCase())||{};if(s?.collections){const c=m?.categories?.[s?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,guide:r?.guide,series:[{products:c?.products}]}}else return r}else return o},[t,p,u,i,m]),k=(0,d.useCallback)((l,o)=>{o?.subSubCategories?.length>0?b(0):b(-1),y(s=>s.map((r,c)=>({...r,open:c===l?!r.open:!1})))},[]),L=(l,o)=>{y(s=>s.map(r=>r.index===l?{...r,open:!0}:{...r,open:!1})),b(o)};return(0,e.jsxs)(n.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,e.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:v,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((l,o)=>{const s=Array.isArray(l?.subSubCategories)&&l?.subSubCategories?.length>0,r=p?.find(c=>c.index===o)?.open;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{className:(0,f.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!s&&r}),onClick:()=>{k(o,l),x?.(l,o)},"aria-expanded":s?r:void 0,"aria-haspopup":s?"true":void 0,children:[(0,e.jsx)(n.Text,{html:l.label,className:"p-4 text-sm font-bold leading-[1.4]"}),s&&(0,e.jsx)(C.DownArrow,{"aria-hidden":"true",className:(0,f.cn)("size-4",{"rotate-180":r})})]}),r&&(0,e.jsx)("div",{className:"flex flex-col",role:"menu",children:l.subSubCategories?.map((c,g)=>(0,e.jsx)("button",{onClick:()=>{L(o,g),x?.(c,g)},className:(0,f.cn)("w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":u===g}),role:"menuitem","aria-label":c.label,children:(0,e.jsx)(n.Text,{html:c.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${o}-${g}`))})]},`subcategoryItem-${o}`)})}),t&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[t?.primary&&(0,e.jsx)(n.Button,{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&&(0,e.jsx)(n.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",iconClassName:"size-4",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:t?.secondary?.label})]})})]}),(0,e.jsxs)("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(a).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(n.Text,{html:a?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),a?.primary&&!a?.primary?.hide&&(0,e.jsx)(n.Button,{as:"a",href:`${a?.primary?.url}?ref=${a?.label}_viewmore`,variant:"link",size:"lg",iconClassName:"size-4",className:"lg-desktop:text-base justify-start !p-0 text-sm font-bold leading-[1.2] no-underline",children:a?.primary?.label})]}),(0,e.jsx)(n.Link,{href:a?.guide?.url,className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:a?.guide?.label})]}),(0,e.jsx)("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a?.series?.map((l,o)=>(0,e.jsxs)("div",{children:[l.label&&(0,e.jsx)(n.Text,{html:l.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[!!a?.banner&&(0,e.jsx)(n.Link,{asChild:!a?.banner?.href,href:a?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(n.Picture,{source:a?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(n.Heading,{size:2,html:a?.banner?.title||"Buy in Guide",className:(0,f.cn)("font-bold text-white",{"text-black":a?.banner?.theme==="dark"})}),(0,e.jsx)(n.Text,{html:a?.banner?.desc||"20.000mAh",className:(0,f.cn)("text-sm font-bold text-white",{"text-black":a?.banner?.theme==="dark"})})]})]})}),l.products?.map((s,r)=>(0,e.jsx)(D,{seriesLabel:a?.label,product:s,isCollection:a?.isCollection},`seriesProductItem-${r}`))]})]},`seriesItem-${o}`))})]})]})});F.displayName="SidebarDropdown";const D=({product:t,isCollection:i,position:m,seriesLabel:x})=>{const{buildProps:p,onSeriesProductClick:y}=(0,S.useNavContext)();let u=i?t:p?.products?.find(a=>a.handle===t.handle);const b=u?.variants?.find(a=>a.sku===t.sku)||u?.variants?.[0],v=(0,d.useMemo)(()=>`/products/${u?.handle}?variant=${(0,f.atobID)(b?.id)}`,[u?.handle,b?.id]),h=(0,d.useMemo)(()=>u?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,2),[u?.tags]);return b?.availableForSale?(0,e.jsx)(n.Link,{href:v,onClick:a=>{a.preventDefault(),window.open(v,"_self"),y?.(u,m||0,x)},className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)("img",{src:`${b?.image?.url||t?.images?.[0]?.url}`,loading:"lazy",alt:u?.title||t?.name,width:90,height:90,className:"size-[96px] object-contain"})}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"flex gap-1",children:Array.isArray(h)&&h?.map((a,k)=>(0,e.jsx)(n.Text,{as:"p",html:a,className:"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-xs font-bold !leading-[22px]"},k))}),(0,e.jsx)(n.Text,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:u?.title||t?.name}),t?.desc&&(0,e.jsx)(n.Text,{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};
2
+ //# sourceMappingURL=SidebarDropdown.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/biz-components/HeaderNavigation/SidebarDropdown.tsx"],
4
+ "sourcesContent": ["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { Button, Container, Text, Link, Heading, Picture } from '../../components/index.js'\nimport { cn, atobID } from '../../helpers/utils.js'\nimport { DownArrow } from './icons/index.js'\nimport { useNavContext } from './NavProvider.js'\nimport type { Product, ProductVariant } from '../../cpn-components/CpnProductCard/types.js'\n\n/**\n * \u4FA7\u8FB9\u680F\u4E0B\u62C9\n * @param categoriesItem \u5206\u7C7B\u9879\n */\nexport const SidebarDropdown = React.memo(\n ({ sidebarCategoriesMetadata, seriesMetadata }: { sidebarCategoriesMetadata: any; seriesMetadata: any }) => {\n const { buildProps, onSidebarNavClick } = useNavContext()\n const [expandedSubcategory, setExpandedSubcategory] = useState<{ index: number; open: boolean }[]>([])\n const [activeSubSubcategoryIndex, setActiveSubSubcategoryIndex] = useState(-1)\n const sidebarDropdownRef = useRef<HTMLDivElement>(null)\n\n const initExpandedSubcategory = useCallback(() => {\n const subcategories = sidebarCategoriesMetadata?.subcategories\n if (!subcategories?.length) return\n\n const withSubSubCategoriesIndex = subcategories.findIndex((item: any) => !!item?.subSubCategories)\n const withoutSubSubCategoriesIndex = subcategories.findIndex((item: any) => !item?.subSubCategories)\n\n // \u521B\u5EFA\u5C55\u5F00\u72B6\u6001\u6570\u7EC4\n const expandedStates = subcategories.map((_: any, index: number) => ({\n index,\n open: withSubSubCategoriesIndex === index || withoutSubSubCategoriesIndex === index,\n }))\n\n setExpandedSubcategory(expandedStates)\n }, [sidebarCategoriesMetadata])\n\n useEffect(() => {\n initExpandedSubcategory()\n }, [initExpandedSubcategory])\n\n // \u901A\u8FC7categoriesMetadata\u7684subSubCategories\u7684label\u4E0Eseries\u7684label\u5339\u914D\n const matchSeriesMetadata = useMemo(() => {\n const subCategory =\n sidebarCategoriesMetadata?.subcategories?.[expandedSubcategory?.find(item => item.open)?.index || 0]\n const currentSeriesMetadata =\n seriesMetadata?.find((item: any) => item?.label?.toLowerCase() === subCategory?.label?.toLowerCase()) || {}\n if (subCategory?.collections) {\n const category = buildProps?.categories?.[subCategory?.collections] || {}\n return {\n label: currentSeriesMetadata?.label,\n isCollection: true,\n banner: currentSeriesMetadata?.banner,\n primary: currentSeriesMetadata?.primary,\n guide: currentSeriesMetadata?.guide,\n series: [\n {\n products: category?.products,\n },\n ],\n }\n } else {\n if (subCategory?.subSubCategories) {\n const activeSubSubcategory = subCategory?.subSubCategories?.[activeSubSubcategoryIndex]\n const currentActiveSeriesMetadata =\n seriesMetadata?.find(\n (item: any) => item?.label?.toLowerCase() === activeSubSubcategory?.label?.toLowerCase()\n ) || {}\n if (activeSubSubcategory?.collections) {\n const category = buildProps?.categories?.[activeSubSubcategory?.collections] || {}\n return {\n label: currentActiveSeriesMetadata?.label,\n isCollection: true,\n banner: currentActiveSeriesMetadata?.banner,\n primary: currentActiveSeriesMetadata?.primary,\n guide: currentActiveSeriesMetadata?.guide,\n series: [\n {\n products: category?.products,\n },\n ],\n }\n } else {\n return currentActiveSeriesMetadata\n }\n } else {\n return currentSeriesMetadata\n }\n }\n }, [sidebarCategoriesMetadata, expandedSubcategory, activeSubSubcategoryIndex, seriesMetadata, buildProps])\n\n const handleSubcategoryOpen = useCallback((index: number, subcategoryItem: any) => {\n subcategoryItem?.subSubCategories?.length > 0 ? setActiveSubSubcategoryIndex(0) : setActiveSubSubcategoryIndex(-1)\n\n setExpandedSubcategory(prev => prev.map((item, i) => ({ ...item, open: i === index ? !item.open : false })))\n }, [])\n\n const handleSubSubcategoryOpen = (index: number, subSubindex: number) => {\n setExpandedSubcategory(prev =>\n prev.map(item => (item.index === index ? { ...item, open: true } : { ...item, open: false }))\n )\n setActiveSubSubcategoryIndex(subSubindex)\n }\n\n return (\n <Container childClassName=\"lg-desktop:gap-12 flex bg-white gap-8\">\n <div\n className=\"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4\"\n style={{\n userSelect: 'none',\n }}\n ref={sidebarDropdownRef}\n >\n <div\n className=\"desktop:h-[416px] flex flex-col overflow-y-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {sidebarCategoriesMetadata?.subcategories?.map((subItem: any, index: number) => {\n const hasSubSubCategory =\n Array.isArray(subItem?.subSubCategories) && subItem?.subSubCategories?.length > 0\n const isExpanded = expandedSubcategory?.find(item => item.index === index)?.open\n return (\n <div key={`subcategoryItem-${index}`}>\n <button\n className={cn(\n 'flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left',\n {\n 'bg-[#F5F5F7]': !hasSubSubCategory && isExpanded,\n }\n )}\n onClick={() => {\n handleSubcategoryOpen(index, subItem)\n onSidebarNavClick?.(subItem, index)\n }}\n aria-expanded={hasSubSubCategory ? isExpanded : undefined}\n aria-haspopup={hasSubSubCategory ? 'true' : undefined}\n >\n <Text html={subItem.label} className=\"p-4 text-sm font-bold leading-[1.4]\" />\n {hasSubSubCategory && (\n <DownArrow\n aria-hidden=\"true\"\n className={cn('size-4', {\n ['rotate-180']: isExpanded,\n })}\n />\n )}\n </button>\n {isExpanded && (\n <div className=\"flex flex-col\" role=\"menu\">\n {subItem.subSubCategories?.map((subSubItem: any, subSubindex: number) => (\n <button\n onClick={() => {\n handleSubSubcategoryOpen(index, subSubindex)\n onSidebarNavClick?.(subSubItem, subSubindex)\n }}\n key={`subSubItem-${index}-${subSubindex}`}\n className={cn(\n 'w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left hover:bg-[#F5F5F7]',\n {\n 'bg-[#F5F5F7]': activeSubSubcategoryIndex === subSubindex,\n }\n )}\n role=\"menuitem\"\n aria-label={subSubItem.label}\n >\n <Text html={subSubItem.label} className=\"text-sm font-bold leading-[1.4] text-[#4A4C56]\" />\n </button>\n ))}\n </div>\n )}\n </div>\n )\n })}\n </div>\n {sidebarCategoriesMetadata && (\n <div className=\"flex\">\n <div className=\"flex flex-col gap-4\">\n {sidebarCategoriesMetadata?.primary && (\n <Button\n as=\"a\"\n href={`${sidebarCategoriesMetadata?.primary?.url}?ref=${sidebarCategoriesMetadata?.primary?.label}_shopall`}\n variant=\"primary\"\n size=\"lg\"\n className=\"lg-desktop:text-base text-sm\"\n >\n {sidebarCategoriesMetadata?.primary?.label}\n </Button>\n )}\n {sidebarCategoriesMetadata?.secondary && (\n <Button\n as=\"a\"\n href={sidebarCategoriesMetadata?.secondary?.url}\n variant=\"link\"\n size=\"lg\"\n iconClassName=\"size-4\"\n className=\"lg-desktop:text-base justify-start !p-0 text-sm\"\n >\n {sidebarCategoriesMetadata?.secondary?.label}\n </Button>\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"flex-1 py-4\">\n {Reflect.ownKeys(matchSeriesMetadata).length > 0 && (\n <div className=\"mb-4 flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <Text\n html={matchSeriesMetadata?.label}\n className=\"lg-desktop:text-2xl text-xl font-bold leading-[1.4]\"\n />\n {matchSeriesMetadata?.primary && !matchSeriesMetadata?.primary?.hide && (\n <Button\n as=\"a\"\n href={`${matchSeriesMetadata?.primary?.url}?ref=${matchSeriesMetadata?.label}_viewmore`}\n variant=\"link\"\n size=\"lg\"\n iconClassName=\"size-4\"\n className=\"lg-desktop:text-base justify-start !p-0 text-sm font-bold leading-[1.2] no-underline\"\n >\n {matchSeriesMetadata?.primary?.label}\n </Button>\n )}\n </div>\n <Link\n href={matchSeriesMetadata?.guide?.url}\n className=\"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]\"\n >\n {matchSeriesMetadata?.guide?.label}\n </Link>\n </div>\n )}\n <div\n className=\"flex h-[426px] flex-col gap-4 overflow-y-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {matchSeriesMetadata?.series?.map((seriesItem: any, seriesIndex: number) => (\n <div key={`seriesItem-${seriesIndex}`}>\n {seriesItem.label && (\n <Text\n html={seriesItem.label}\n as=\"p\"\n className=\"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]\"\n />\n )}\n <div className=\"grid grid-cols-3 gap-4\">\n {!!matchSeriesMetadata?.banner && (\n <Link asChild={!matchSeriesMetadata?.banner?.href} href={matchSeriesMetadata?.banner?.href}>\n <div className=\"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Picture\n source={matchSeriesMetadata?.banner?.imageUrl}\n className=\"laptop:h-[120px] h-[114px]\"\n imgClassName=\"object-cover h-full\"\n />\n <div className=\"absolute inset-x-0 bottom-0 p-4\">\n <Heading\n size={2}\n html={matchSeriesMetadata?.banner?.title || 'Buy in Guide'}\n className={cn('font-bold text-white', {\n 'text-black': matchSeriesMetadata?.banner?.theme === 'dark',\n })}\n />\n <Text\n html={matchSeriesMetadata?.banner?.desc || '20.000mAh'}\n className={cn('text-sm font-bold text-white', {\n 'text-black': matchSeriesMetadata?.banner?.theme === 'dark',\n })}\n />\n </div>\n </div>\n </Link>\n )}\n {seriesItem.products?.map((product: any, index: number) => (\n <SeriesProductItem\n seriesLabel={matchSeriesMetadata?.label}\n key={`seriesProductItem-${index}`}\n product={product}\n isCollection={matchSeriesMetadata?.isCollection}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n </Container>\n )\n }\n)\n\nSidebarDropdown.displayName = 'SidebarDropdown'\n\n/**\n * \u7CFB\u5217\u4EA7\u54C1\u9879\u7EC4\u4EF6\n */\nexport const SeriesProductItem = ({\n product,\n isCollection,\n position,\n seriesLabel,\n}: {\n product: any\n isCollection?: boolean\n position?: number\n seriesLabel?: string\n}) => {\n const { buildProps, onSeriesProductClick } = useNavContext()\n let productData = isCollection\n ? product\n : buildProps?.products?.find((item: Product) => item.handle === product.handle)\n const variant =\n productData?.variants?.find((item: ProductVariant) => item.sku === product.sku) || productData?.variants?.[0]\n\n const listingLink = useMemo(() => {\n return `/products/${productData?.handle}?variant=${atobID(variant?.id as string)}`\n }, [productData?.handle, variant?.id])\n\n const tags = useMemo(() => {\n return productData?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [productData?.tags])\n\n if (!variant?.availableForSale) return null\n\n return (\n <Link\n href={listingLink}\n onClick={e => {\n e.preventDefault()\n window.open(listingLink, '_self')\n onSeriesProductClick?.(productData, position || 0, seriesLabel)\n }}\n className=\"no-underline hover:text-current\"\n >\n <div className=\"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500\">\n <div className=\"shrink-0\">\n <img\n src={`${variant?.image?.url || product?.images?.[0]?.url}`}\n loading=\"lazy\"\n alt={productData?.title || product?.name}\n width={90}\n height={90}\n className=\"size-[96px] object-contain\"\n />\n </div>\n <div className=\"relative\">\n <div className=\"flex gap-1\">\n {Array.isArray(tags) &&\n tags?.map((tag: string, index: number) => (\n <Text\n key={index}\n as=\"p\"\n html={tag}\n className=\"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-xs font-bold !leading-[22px]\"\n />\n ))}\n </div>\n <Text\n className=\"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]\"\n html={productData?.title || product?.name}\n />\n {product?.desc && (\n <Text\n as=\"p\"\n html={product?.desc}\n className=\"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]\"\n />\n )}\n </div>\n </div>\n </Link>\n )\n}\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAA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U,6GACb,oBAAC,OAAI,UAAU,WACb,mBAAC,OACC,IAAK,GAAGG,GAAS,OAAO,KAAON,GAAS,SAAS,CAAC,GAAG,GAAG,GACxD,QAAQ,OACR,IAAKK,GAAa,OAASL,GAAS,KACpC,MAAO,GACP,OAAQ,GACR,UAAU,6BACZ,EACF,KACA,QAAC,OAAI,UAAU,WACb,oBAAC,OAAI,UAAU,aACZ,eAAM,QAAQQ,CAAI,GACjBA,GAAM,IAAI,CAACE,EAAa7B,OACtB,OAAC,QAEC,GAAG,IACH,KAAM6B,EACN,UAAU,qJAHL7B,CAIP,CACD,EACL,KACA,OAAC,QACC,UAAU,iGACV,KAAMwB,GAAa,OAASL,GAAS,KACvC,EACCA,GAAS,SACR,OAAC,QACC,GAAG,IACH,KAAMA,GAAS,KACf,UAAU,sFACZ,GAEJ,GACF,EACF,EAhDqC,IAkDzC",
6
+ "names": ["SidebarDropdown_exports", "__export", "SeriesProductItem", "SidebarDropdown", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_icons", "import_NavProvider", "React", "sidebarCategoriesMetadata", "seriesMetadata", "buildProps", "onSidebarNavClick", "expandedSubcategory", "setExpandedSubcategory", "activeSubSubcategoryIndex", "setActiveSubSubcategoryIndex", "sidebarDropdownRef", "initExpandedSubcategory", "subcategories", "withSubSubCategoriesIndex", "item", "withoutSubSubCategoriesIndex", "expandedStates", "_", "index", "matchSeriesMetadata", "subCategory", "currentSeriesMetadata", "category", "activeSubSubcategory", "currentActiveSeriesMetadata", "handleSubcategoryOpen", "subcategoryItem", "prev", "i", "handleSubSubcategoryOpen", "subSubindex", "subItem", "hasSubSubCategory", "isExpanded", "subSubItem", "seriesItem", "seriesIndex", "product", "isCollection", "position", "seriesLabel", "onSeriesProductClick", "productData", "variant", "listingLink", "tags", "e", "tag"]
7
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * supports下拉
3
+ * @param categoriesItem 分类项
4
+ * @param currentNavItemRef 当前导航项
5
+ */
6
+ export declare const SupportsDropdown: ({ supportsMetadata, currentNavItemRef, }: {
7
+ supportsMetadata: any;
8
+ currentNavItemRef: HTMLDivElement;
9
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use strict";var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},w=(t,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of h(e))!m.call(t,s)&&s!==n&&a(t,s,{get:()=>e[s],enumerable:!(l=f(e,s))||l.enumerable});return t};var D=t=>w(a({},"__esModule",{value:!0}),t);var b={};v(b,{SupportsDropdown:()=>R});module.exports=D(b);var r=require("react/jsx-runtime"),i=require("react"),c=require("../../components/index.js"),p=require("es-toolkit");const R=({supportsMetadata:t,currentNavItemRef:e})=>{const n=(0,i.useRef)(null),[l,s]=(0,i.useState)(null),[u,g]=(0,i.useState)(0);(0,i.useEffect)(()=>{if(n?.current){const o=n?.current?.getBoundingClientRect();g(o.height)}},[n]);const d=(0,p.debounce)(()=>{if(e){const o=e.getBoundingClientRect();s(o)}},500);return(0,i.useEffect)(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[d]),(0,i.useEffect)(()=>{if(e){const o=e.getBoundingClientRect();s(o)}},[e]),(0,r.jsx)("div",{className:"absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${l?.right}px)`,height:u},children:(0,r.jsx)("div",{ref:n,className:"p-4",children:t?.map(o=>(0,r.jsx)("div",{className:"py-2",children:(0,r.jsx)(c.Link,{href:o.url,className:"text-sm font-bold leading-[1.4] no-underline",children:o.label})},o.id))})})};
2
+ //# sourceMappingURL=SupportsDropdown.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/biz-components/HeaderNavigation/SupportsDropdown.tsx"],
4
+ "sourcesContent": ["import React, { useEffect, useRef, useState } from 'react'\nimport { Link } from '../../components/index.js'\nimport { debounce } from 'es-toolkit'\n\n/**\n * supports\u4E0B\u62C9\n * @param categoriesItem \u5206\u7C7B\u9879\n * @param currentNavItemRef \u5F53\u524D\u5BFC\u822A\u9879\n */\nexport const SupportsDropdown = ({\n supportsMetadata,\n currentNavItemRef,\n}: {\n supportsMetadata: any\n currentNavItemRef: HTMLDivElement\n}) => {\n const supportsDropdownRef = useRef<HTMLDivElement>(null)\n const [navItemReact, setNavItemReact] = useState<DOMRect | null>(null)\n const [supportsDropdownHeight, setSupportsDropdownHeight] = useState(0)\n\n useEffect(() => {\n if (supportsDropdownRef?.current) {\n const rect = supportsDropdownRef?.current?.getBoundingClientRect()\n setSupportsDropdownHeight(rect.height)\n }\n }, [supportsDropdownRef])\n\n const debouncedHandleResize = debounce(() => {\n if (currentNavItemRef) {\n const rect = currentNavItemRef.getBoundingClientRect()\n setNavItemReact(rect)\n }\n }, 500)\n\n useEffect(() => {\n debouncedHandleResize()\n window.addEventListener('resize', debouncedHandleResize)\n return () => {\n window.removeEventListener('resize', debouncedHandleResize)\n }\n }, [debouncedHandleResize])\n\n useEffect(() => {\n if (currentNavItemRef) {\n const rect = currentNavItemRef.getBoundingClientRect()\n setNavItemReact(rect)\n }\n }, [currentNavItemRef])\n\n return (\n <div\n className=\"absolute top-0 h-full overflow-hidden bg-white transition-all duration-500\"\n style={{ right: `calc(100% - ${navItemReact?.right}px)`, height: supportsDropdownHeight }}\n >\n <div ref={supportsDropdownRef} className=\"p-4\">\n {supportsMetadata?.map((supportItem: any) => (\n <div key={supportItem.id} className=\"py-2\">\n <Link href={supportItem.url} className=\"text-sm font-bold leading-[1.4] no-underline\">\n {supportItem.label}\n </Link>\n </div>\n ))}\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAyDY,IAAAI,EAAA,6BAzDZC,EAAmD,iBACnDC,EAAqB,qCACrBC,EAAyB,sBAOlB,MAAML,EAAmB,CAAC,CAC/B,iBAAAM,EACA,kBAAAC,CACF,IAGM,CACJ,MAAMC,KAAsB,UAAuB,IAAI,EACjD,CAACC,EAAcC,CAAe,KAAI,YAAyB,IAAI,EAC/D,CAACC,EAAwBC,CAAyB,KAAI,YAAS,CAAC,KAEtE,aAAU,IAAM,CACd,GAAIJ,GAAqB,QAAS,CAChC,MAAMK,EAAOL,GAAqB,SAAS,sBAAsB,EACjEI,EAA0BC,EAAK,MAAM,CACvC,CACF,EAAG,CAACL,CAAmB,CAAC,EAExB,MAAMM,KAAwB,YAAS,IAAM,CAC3C,GAAIP,EAAmB,CACrB,MAAMM,EAAON,EAAkB,sBAAsB,EACrDG,EAAgBG,CAAI,CACtB,CACF,EAAG,GAAG,EAEN,sBAAU,KACRC,EAAsB,EACtB,OAAO,iBAAiB,SAAUA,CAAqB,EAChD,IAAM,CACX,OAAO,oBAAoB,SAAUA,CAAqB,CAC5D,GACC,CAACA,CAAqB,CAAC,KAE1B,aAAU,IAAM,CACd,GAAIP,EAAmB,CACrB,MAAMM,EAAON,EAAkB,sBAAsB,EACrDG,EAAgBG,CAAI,CACtB,CACF,EAAG,CAACN,CAAiB,CAAC,KAGpB,OAAC,OACC,UAAU,6EACV,MAAO,CAAE,MAAO,eAAeE,GAAc,KAAK,MAAO,OAAQE,CAAuB,EAExF,mBAAC,OAAI,IAAKH,EAAqB,UAAU,MACtC,SAAAF,GAAkB,IAAKS,MACtB,OAAC,OAAyB,UAAU,OAClC,mBAAC,QAAK,KAAMA,EAAY,IAAK,UAAU,+CACpC,SAAAA,EAAY,MACf,GAHQA,EAAY,EAItB,CACD,EACH,EACF,CAEJ",
6
+ "names": ["SupportsDropdown_exports", "__export", "SupportsDropdown", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_es_toolkit", "supportsMetadata", "currentNavItemRef", "supportsDropdownRef", "navItemReact", "setNavItemReact", "supportsDropdownHeight", "setSupportsDropdownHeight", "rect", "debouncedHandleResize", "supportItem"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var ye=Object.create;var U=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Ne=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty;var we=(t,n)=>{for(var r in n)U(t,r,{get:n[r],enumerable:!0})},ee=(t,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of xe(n))!ke.call(t,d)&&d!==r&&U(t,d,{get:()=>n[d],enumerable:!(i=he(n,d))||i.enumerable});return t};var G=(t,n,r)=>(r=t!=null?ye(Ne(t)):{},ee(n||!t||!t.__esModule?U(r,"default",{value:t,enumerable:!0}):r,t)),Ce=t=>ee(U({},"__esModule",{value:!0}),t);var Be={};we(Be,{default:()=>Te});module.exports=Ce(Be);var e=require("react/jsx-runtime"),a=G(require("react")),l=require("../../components/index.js"),ue=require("../../shared/Styles.js"),N=require("../../helpers/utils.js"),A=G(require("./NavProvider.js")),v=require("./types.js"),pe=require("es-toolkit"),me=G(require("jump.js")),J=require("@gsap/react"),V=require("gsap"),$=require("./withCategory.js"),H=require("./icons/index.js"),be=G(require("../NavigationSearch/index.js"));const te=(0,a.forwardRef)((t,n)=>{const{data:{header:r}={},buildProps:i,event:d,profile:m,theme:b="light",isTop:u=!1,searchResult:x,onSearch:y,isSearching:o,keywords:M,onPrimaryNavClick:S,onSeriesProductClick:p,onSidebarNavClick:k,headerId:g,cartCount:h,menuData:c}=t,[f,D]=(0,a.useState)(!1),[P,E]=(0,a.useState)(!1),w=(0,a.useRef)(null),T=(0,a.useRef)(null),F=()=>{const C=document?.querySelector("body")?.offsetWidth||0;E(C<=1440)};(0,a.useEffect)(()=>(F(),window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F)}),[]),(0,a.useImperativeHandle)(n,()=>T.current),(0,a.useEffect)(()=>{T.current&&u&&(0,me.default)(T.current,{duration:0,offset:T.current?.getBoundingClientRect()?.bottom||0})},[u]),(0,a.useEffect)(()=>{d&&(d.search=()=>D(!0))},[d]),(0,J.useGSAP)(()=>{w?.current&&f&&V.gsap.fromTo(w.current,{height:0},{height:"auto",duration:.3})},[f]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=f?"hidden":"auto"},[f]);const R=(0,a.useMemo)(()=>r?.bar?.actions?.find(C=>C?.blockType===v.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[r]);return(0,e.jsx)(A.default,{buildProps:i,profile:m,isMobile:P,event:d,payloadData:r,onSidebarNavClick:k,onSeriesProductClick:p,cartCount:h,children:(0,e.jsx)("header",{id:g||"header","data-ui-component-id":"HeaderNavigation",className:"relative z-[100] bg-white",ref:T,children:(0,e.jsxs)("div",{className:(0,N.cn)("hover:bg-white hover:text-black",b==="light"?"text-black":"text-white",{}),children:[(0,e.jsx)(ae,{data:r,className:"desktop:block hidden !bg-white",theme:b,onPrimaryNavClick:S}),(0,e.jsx)(oe,{menuData:c,data:r,className:"desktop:hidden block !bg-white",onPrimaryNavClick:S}),f&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${T?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:w,className:(0,N.cn)("overflow-y-auto",{}),children:(0,e.jsx)(be.default,{data:R,keywords:M,isSearching:o,searchResult:x,onSearch:C=>{y?.(C)},onClose:()=>{y?.(),D(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>D(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:C=>{(C.key==="Enter"||C.key===" "||C.key==="Escape")&&(C.preventDefault(),D(!1))}})]})]})})})}),ae=(0,a.forwardRef)((t,n)=>{const{data:r,onNavItemClick:i,className:d,theme:m,onPrimaryNavClick:b}=t,{event:u,profile:x}=(0,A.useNavContext)(),[y,o]=(0,a.useState)(!1),M=(0,a.useMemo)(()=>(0,$.WithGroupCategory)(r?.categories?.filter(s=>s?.pcShow)),[r]),[S,p]=(0,a.useState)(null),[k,g]=(0,a.useState)([]),h=(0,a.useRef)(null),[c,f]=(0,a.useState)(!1),D=(0,a.useRef)(null),P=(0,a.useRef)(null),E=(0,a.useRef)(M.map(s=>Array(s?.length||0).fill(null)));(0,a.useEffect)(()=>{M?.length&&g(M?.map((s,L)=>s?.map((z,B)=>({groupIndex:L,index:B,open:!1}))))},[M]);const w=(0,a.useMemo)(()=>{let s=null;for(const L of k){for(const z of L)if(z.open){s=z;break}if(s)break}return s},[k]);(0,a.useEffect)(()=>{document.documentElement.style.overflow=w?.open||c?"hidden":"auto"},[w?.open,c]);const T=(s,L,z)=>{f(!1);const B=M[L][z];if(B?.components?.[0]?.blockType===v.HeaderNavigationBlockType.Links)B?.components?.[0]?.url&&window.open(B?.components?.[0]?.url);else{const I=M?.flat()||[],j=I?.findIndex(Y=>Y?.id===M[L][z]?.id);s.stopPropagation(),i?.(),b?.(I[j],j),p(B),g(Y=>Y.map(ge=>ge.map(W=>W.groupIndex===L&&W.index===z?{...W,open:!W.open}:{...W,open:!1})))}},F=(s,L,z)=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),T(s,L,z)):s.key==="Escape"&&w?.groupIndex===L&&w?.index===z&&(s.preventDefault(),R())},R=()=>{g(s=>s.map(L=>L.map(z=>({...z,open:!1}))))},C=(0,a.useMemo)(()=>{if(S)return S?.components?.[0]?.blockType},[S]),q=(0,$.WithSidebar)(ne,S),_=(0,$.WithMulticol)(Se,S),fe=(0,$.WithSupports)(De,{categoriesItem:S,currentNavItemRef:E.current?.[w?.groupIndex||0]?.[w?.index||0]}),ve=(0,a.useMemo)(()=>{switch(C){case v.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(q,{});case v.HeaderNavigationBlockType.Supports:return(0,e.jsx)(fe,{});case v.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(_,{});default:return null}},[C,S]),Q=(0,a.useMemo)(()=>r?.bar?.actions?.filter(s=>s?.pcShow),[r]),O=(0,a.useMemo)(()=>Q?.find(s=>s?.blockType===v.HeaderNavigationActionBlockType.Profile),[Q]),X=(0,a.useCallback)(()=>{f(s=>!s)},[]);return(0,a.useEffect)(()=>{if(h?.current){const s=h.current;return s.addEventListener("click",X),()=>{s.removeEventListener("click",X)}}},[X]),(0,J.useGSAP)(()=>{w?.open&&V.gsap.fromTo(P?.current,{height:0},{height:"auto"})},[w?.open]),(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[96px]",d),children:[(0,e.jsxs)("div",{ref:D,onClick:R,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(ce,{}),(0,e.jsx)(Z,{ref:h,actions:Q,activeStatus:c})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:M?.map((s,L)=>(0,e.jsx)("div",{className:"flex gap-3",children:s?.map((z,B)=>{const I=w?.groupIndex===L&&w?.index===B;return(0,e.jsx)("div",{ref:j=>{E.current[L][B]=j},className:"group cursor-pointer",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:j=>T(j,L,B),onKeyDown:j=>F(j,L,B),"aria-expanded":I,"aria-haspopup":"true","aria-label":z.text,children:[(0,e.jsx)(l.Text,{html:z.text,className:"text-sm font-bold leading-[1.4]"}),z?.components?.length>0&&z?.components?.[0]?.blockType!==v.HeaderNavigationBlockType.Links&&(0,e.jsx)(H.DownArrow,{className:(0,N.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":w?.groupIndex===L&&w?.index===B,"opacity-100":y&&w?.groupIndex===L&&w?.index===B})})]}),(0,e.jsx)("div",{className:(0,N.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":I},m==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},z.id)})},`groupCategory-${L}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(w?.open&&S),className:(0,N.cn)("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:!(w?.open&&S)}),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{height:`calc(100dvh - ${D?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:P,className:(0,N.cn)("relative z-50",{"overflow-hidden":C!==v.HeaderNavigationBlockType.Supports}),children:ve}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:R,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),R())}})]}),c&&(0,e.jsxs)("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:[(0,e.jsx)("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${h?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:x?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:x?.nick_name||O?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),(0,e.jsx)("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:O?.profiles?.map(s=>(0,e.jsx)(K,{className:"py-2",label:s?.title,href:s?.url},s.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(H.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(l.Text,{html:O?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:O?.benefits?.map(s=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:s.benefitIcon?.url,className:"size-4",alt:s.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:s.benefit,className:"text-sm font-bold leading-[1.4]"})]},s.id))}),(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,e.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>u?.join?.(),children:(0,e.jsx)(l.Text,{html:O?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>u?.login?.(),children:(0,e.jsx)(l.Text,{html:O?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>f(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),f(!1))}})]})]})}),ne=a.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{buildProps:r,onSidebarNavClick:i}=(0,A.useNavContext)(),[d,m]=(0,a.useState)([]),[b,u]=(0,a.useState)(-1),x=(0,a.useRef)(null),y=(0,a.useCallback)(()=>{const p=t?.subcategories;if(!p?.length)return;const k=p.findIndex(c=>!!c?.subSubCategories),g=p.findIndex(c=>!c?.subSubCategories),h=p.map((c,f)=>({index:f,open:k===f||g===f}));m(h)},[t]);(0,a.useEffect)(()=>{y()},[y]);const o=(0,a.useMemo)(()=>{const p=t?.subcategories?.[d?.find(g=>g.open)?.index||0],k=n?.find(g=>g?.label?.toLowerCase()===p?.label?.toLowerCase())||{};if(p?.collections){const g=r?.categories?.[p?.collections]||{};return{label:k?.label,isCollection:!0,banner:k?.banner,primary:k?.primary,series:[{products:g?.products}]}}else if(p?.subSubCategories){const g=p?.subSubCategories?.[b],h=n?.find(c=>c?.label?.toLowerCase()===g?.label?.toLowerCase())||{};if(g?.collections){const c=r?.categories?.[g?.collections]||{};return{label:h?.label,isCollection:!0,banner:h?.banner,primary:h?.primary,series:[{products:c?.products}]}}else return h}else return k},[t,d,b,n,r]),M=(0,a.useCallback)((p,k)=>{k?.subSubCategories?.length>0?u(0):u(-1),m(g=>g.map((h,c)=>({...h,open:c===p?!h.open:!1})))},[]),S=(p,k)=>{m(g=>g.map(h=>h.index===p?{...h,open:!0}:{...h,open:!1})),u(k)};return(0,e.jsxs)(l.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,e.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:x,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((p,k)=>{const g=Array.isArray(p?.subSubCategories)&&p?.subSubCategories?.length>0,h=d?.find(c=>c.index===k)?.open;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{className:(0,N.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!g&&h}),onClick:()=>{M(k,p),i?.(p,k)},"aria-expanded":g?h:void 0,"aria-haspopup":g?"true":void 0,children:[(0,e.jsx)(l.Text,{html:p.label,className:"p-4 text-sm font-bold leading-[1.4]"}),g&&(0,e.jsx)(H.DownArrow,{"aria-hidden":"true",className:(0,N.cn)("size-4",{"rotate-180":h})})]}),h&&(0,e.jsx)("div",{className:"flex flex-col",role:"menu",children:p.subSubCategories?.map((c,f)=>(0,e.jsx)("button",{onClick:()=>{S(k,f),i?.(c,f)},className:(0,N.cn)("w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":b===f}),role:"menuitem","aria-label":c.label,children:(0,e.jsx)(l.Text,{html:c.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${k}-${f}`))})]},`subcategoryItem-${k}`)})}),t&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[t?.primary&&(0,e.jsx)(l.Button,{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&&(0,e.jsx)(l.Button,{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})]})})]}),(0,e.jsxs)("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(o).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(l.Text,{html:o?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),o?.primary&&!o?.primary?.hide&&(0,e.jsx)(l.Button,{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})]}),(0,e.jsx)(l.Link,{href:o?.guide?.url,className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:o?.guide?.label})]}),(0,e.jsx)("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:o?.series?.map((p,k)=>(0,e.jsxs)("div",{children:[p.label&&(0,e.jsx)(l.Text,{html:p.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[!!o?.banner&&(0,e.jsx)(l.Link,{asChild:!o?.banner?.href,href:o?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(l.Picture,{source:o?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(l.Heading,{size:2,html:o?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),(0,e.jsx)(l.Text,{html:o?.banner?.desc||"20.000mAh",className:"text-sm font-bold text-white"})]})]})}),p.products?.map((g,h)=>(0,e.jsx)(le,{seriesLabel:o?.label,product:g,isCollection:o?.isCollection},`seriesProductItem-${h}`))]})]},`seriesItem-${k}`))})]})]})}),Se=({multicolMetadata:t})=>{const n=(0,a.useRef)(null);return(0,e.jsx)("div",{ref:n,children:(0,e.jsx)(l.Container,{childClassName:"bg-white",className:"h-full",children:(0,e.jsx)("div",{className:"flex gap-4 py-4",children:t?.map((r,i)=>(0,e.jsx)("div",{className:"w-1/4",children:(0,e.jsx)(re,{item:r})},`multicolItem-${r?.label}-${i}`))})})})},De=({supportsMetadata:t,currentNavItemRef:n})=>{const r=(0,a.useRef)(null),[i,d]=(0,a.useState)(null),[m,b]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(r?.current){const x=r?.current?.getBoundingClientRect();b(x.height)}},[r]);const u=(0,pe.debounce)(()=>{if(n){const x=n.getBoundingClientRect();d(x)}},500);return(0,a.useEffect)(()=>(u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}),[u]),(0,a.useEffect)(()=>{if(n){const x=n.getBoundingClientRect();d(x)}},[n]),(0,e.jsx)("div",{className:"absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${i?.right}px)`,height:m},children:(0,e.jsx)("div",{ref:r,className:"p-4",children:t?.map(x=>(0,e.jsx)("div",{className:"py-2",children:(0,e.jsx)(l.Link,{href:x.url,className:"text-sm font-bold leading-[1.4] no-underline",children:x.label})},x.id))})})},le=({product:t,isCollection:n,position:r,seriesLabel:i})=>{const{buildProps:d,onSeriesProductClick:m}=(0,A.useNavContext)();let b=n?t:d?.products?.find(o=>o.handle===t.handle);const u=b?.variants?.find(o=>o.sku===t.sku)||b?.variants?.[0],x=(0,a.useMemo)(()=>`/products/${b?.handle}?variant=${(0,N.atobID)(u?.id)}`,[b?.handle,u?.id]),y=(0,a.useMemo)(()=>b?.tags?.filter?.(o=>o?.startsWith?.("CLtag"))?.map?.(o=>o?.replace?.("CLtag:",""))?.slice?.(0,2),[b?.tags]);return u?.availableForSale?(0,e.jsx)(l.Link,{href:x,onClick:o=>{o.preventDefault(),window.open(x,"_self"),m?.(b,r||0,i)},className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)("img",{src:`${u?.image?.url||t?.images?.[0]?.url}`,loading:"lazy",alt:b?.title||t?.name,width:90,height:90,className:"size-[96px] object-contain"})}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"flex gap-1",children:Array.isArray(y)&&y?.map((o,M)=>(0,e.jsx)(l.Text,{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-xs font-bold !leading-[22px]"},M))}),(0,e.jsx)(l.Text,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:b?.title||t?.name}),t?.desc&&(0,e.jsx)(l.Text,{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},re=({item:t,allPicture:n})=>(0,e.jsxs)(e.Fragment,{children:[t?.columns&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:t.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col",children:t.columns?.map(r=>(0,e.jsxs)("div",{className:"flex items-center gap-1 py-2",children:[(0,e.jsx)(l.Link,{href:`${r.url}?ref=navMenu`,asChild:!r.url,className:"text-sm font-bold leading-[1.4] no-underline",children:r.label}),r?.badge&&(0,e.jsx)(l.Text,{as:"p",html:r?.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]"})]},r.label))})]}),t?.imageUrl&&(0,e.jsx)("div",{className:(0,N.cn)("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":n}),children:(0,e.jsxs)(l.Link,{href:`${t.url}?ref=navMenu`,asChild:!t.url,children:[(0,e.jsx)(l.Picture,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[(0,e.jsx)(l.Text,{html:t.title,className:(0,N.cn)("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":t?.theme==="dark"})}),t.subtitle&&(0,e.jsx)(l.Text,{html:t.subtitle,className:(0,N.cn)("text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"})}),t?.primary?.label&&(0,e.jsx)(l.Button,{as:"a",href:t?.primary?.url,variant:"link",size:"lg",className:(0,N.cn)("mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"}),children:t?.primary?.label||"more"})]})]})})]}),oe=(0,a.forwardRef)(({data:t,menuData:n,className:r,onPrimaryNavClick:i},d)=>{const m=(0,a.useMemo)(()=>(0,$.WithGroupCategory)(t?.categories?.filter(C=>C?.mobileShow)),[t]),{currentMenu:b,setCurrentMenu:u,subSubCategory:x}=(0,A.useNavContext)(),[y,o]=(0,a.useState)(!1),[M,S]=(0,a.useState)(0),[p,k]=(0,a.useState)(null),g=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(g?.current&&y){const C=g?.current?.getBoundingClientRect();S(window?.innerHeight-(C?.bottom||0))}},[y]),(0,J.useGSAP)(()=>{V.gsap.fromTo(g.current,{height:0},{height:M,duration:.3})},[M]),(0,a.useEffect)(()=>{document.documentElement.style.overflow=y?"hidden":"auto"},[y]);const h=(0,a.useMemo)(()=>p?.components?.[0]?.blockType,[p]),c=(0,$.WithSupports)(Pe,{categoriesItem:p}),f=(0,$.WithSidebar)(Le,p),D=(0,$.WithMulticol)(Ee,p),P=(0,a.useMemo)(()=>{switch(h){case v.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(f,{});case v.HeaderNavigationBlockType.Supports:return(0,e.jsx)(c,{});case v.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(D,{});default:return null}},[h,p,c]),E=(0,a.useCallback)(()=>{o(!1),S(0),u&&u(v.HeaderNavigationMenu.Primary)},[o,S,u]),w=(0,a.useMemo)(()=>t?.bar?.actions?.filter(C=>C?.mobileShow&&C?.blockType!==v.HeaderNavigationActionBlockType.Profile),[t]),T=(0,a.useMemo)(()=>t?.bar?.actions?.find(C=>C?.mobileShow&&C?.blockType===v.HeaderNavigationActionBlockType.Profile)||{},[t]),F=(0,a.useMemo)(()=>{switch(b){case v.HeaderNavigationMenu.Primary:return(0,e.jsx)(He,{actions:w,menuOpen:y,onMenuOpenClose:()=>{o(!1),S(0)},onMenuOpenClick:()=>o(!0)});case v.HeaderNavigationMenu.Secondary:return(0,e.jsx)(de,{title:p?.text,onMenuOpenClose:E,onMenuBackClick:()=>u?.(v.HeaderNavigationMenu.Primary)});case v.HeaderNavigationMenu.Third:return(0,e.jsx)(de,{title:x?.label,onMenuOpenClose:E,onMenuBackClick:()=>u?.(v.HeaderNavigationMenu.Secondary)});default:return null}},[y,b,u,p,w,x,E]),R=(0,a.useCallback)((C,q)=>{const _=Array.isArray(m)?Array.isArray(m[C])?m[C][q]:{}:{};k(_),_?.components?.[0]?.blockType===v.HeaderNavigationBlockType.Links?_?.components?.[0]?.url&&window.open(_?.components?.[0]?.url):u?.(v.HeaderNavigationMenu.Secondary)},[m,u]);return(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[52px]",r),children:[F,y&&(0,e.jsxs)("nav",{ref:g,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:M},role:"navigation","aria-label":"Mobile navigation menu",children:[b===v.HeaderNavigationMenu.Primary&&n?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:n})}):null,b===v.HeaderNavigationMenu.Primary?(0,e.jsx)(Me,{categories:m,onPrimaryMenuClick:R,onPrimaryNavClick:i,profileAction:T}):P]})]})}),Me=({categories:t,onPrimaryMenuClick:n,profileAction:r,onPrimaryNavClick:i})=>(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((d,m)=>(0,e.jsxs)("div",{className:"",children:[(0,e.jsx)("div",{className:(0,N.cn)("my-2 h-px w-full bg-[#E5E5E7]")}),d?.map((b,u)=>(0,e.jsx)(K,{label:b.text,onClick:()=>{const y=(t?.flat()||[])?.findIndex(o=>o?.id===t[m][u]?.id);n(m,u),i?.(b,y)},icon:b.components?.[0]?.icon},b.id))]},`groupCategory-${m}`))}),(0,e.jsx)(ze,{profileAction:r})]}),Le=({sidebarCategoriesMetadata:t,seriesMetadata:n})=>{const{currentMenu:r,setCurrentMenu:i,subSubCategory:d,setSubSubCategory:m,setCurrentSeriesMetadata:b,currentSeriesMetadata:u,buildProps:x,onSidebarNavClick:y}=(0,A.useNavContext)(),[o,M]=(0,a.useState)([]),[S,p]=(0,a.useState)([]);(0,a.useEffect)(()=>{t?.subcategories?.length&&M(t?.subcategories?.map((c,f)=>({index:f,open:!1})))},[t]),(0,a.useEffect)(()=>{d?.subSubCategories?.length&&p(d?.subSubCategories?.map((c,f)=>({index:f,open:f===0})))},[d]);const k=(0,a.useCallback)((c,f)=>{i&&i(v.HeaderNavigationMenu.Third),m?.(c);const D=n?.find(P=>f!==void 0?c?.subSubCategories?.[f]?.label?.toLowerCase()===P.label?.toLowerCase():c?.label?.toLowerCase()===P.label?.toLowerCase())||{};if(c?.collections){const P=x?.categories?.[c?.collections]||{};b?.({label:D?.label,isCollection:!0,banner:D?.banner,primary:D?.primary,series:[{products:P?.products}]})}else b?.(D)},[n,i,m,b,x?.categories]),g=(0,a.useMemo)(()=>n?.find(c=>!!c?.guide)?.guide,[n]);return(0,a.useMemo)(()=>{switch(r){case v.HeaderNavigationMenu.Secondary:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4",children:[(0,e.jsx)("div",{children:t?.subcategories?.map((c,f)=>(0,e.jsx)("div",{children:(0,e.jsx)(K,{label:c?.label,active:o.find(D=>D.index===f)?.open,onClick:()=>{k(c),y?.(c,f)}})},`${c.label}-${f}`))}),(0,e.jsxs)("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&(0,e.jsx)(l.Button,{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&&(0,e.jsx)(l.Button,{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 v.HeaderNavigationMenu.Third:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:[d?.subSubCategories?d?.subSubCategories?.map((c,f)=>{const D=n?.find(E=>E.label.toLowerCase()===c?.label?.toLowerCase())||{};let P={};if(c?.collections){const E=x?.categories?.[c?.collections]||{};P={label:D?.label,isCollection:!0,banner:D?.banner,primary:D?.primary,series:[{products:E?.products}]}}else P=D;return(0,e.jsxs)("div",{children:[Reflect.ownKeys(c).length>0&&(0,e.jsx)(se,{matchSeriesMetadata:P,onSubSubCategoryItemClick:()=>{y?.(c,f),p(E=>E.map((w,T)=>({...w,open:T===f?!w.open:w.open})))},expanded:!!S?.find(E=>E.index===f)?.open}),S?.find(E=>E.index===f)?.open&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ie,{matchSeriesMetadata:P}),P?.primary&&(0,e.jsx)("div",{className:"my-4 text-center",children:(0,e.jsx)(l.Button,{as:"a",href:P?.primary?.url,className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:P?.primary?.label})})]})]},`${c.label}-${f}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(u).length>0&&(0,e.jsx)(se,{matchSeriesMetadata:u}),(0,e.jsx)(ie,{matchSeriesMetadata:u}),u?.primary&&(0,e.jsx)("div",{className:"my-4 text-center ",children:(0,e.jsx)(l.Button,{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&&(0,e.jsx)(l.Link,{href:g?.url,children:(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(l.Text,{html:g?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]});default:return null}},[r,t,n,o,S,d,u,x?.categories,g,k,y])},se=({matchSeriesMetadata:t,onSubSubCategoryItemClick:n,expanded:r})=>{const i=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(l.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),n&&(0,e.jsx)(H.DownArrow,{"aria-hidden":"true",className:(0,N.cn)("size-5",{"rotate-180":r})})]});return n?(0,e.jsx)("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:n,"aria-expanded":r,children:i}):(0,e.jsx)("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:i})},ie=({matchSeriesMetadata:t})=>(0,e.jsx)("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((n,r)=>(0,e.jsxs)("div",{children:[n.label&&(0,e.jsx)(l.Text,{html:n.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),(0,e.jsxs)("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&&(0,e.jsx)(l.Link,{asChild:!t?.banner?.href,href:t?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(l.Picture,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(l.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,N.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(l.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,N.cn)("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),n.products?.map((i,d)=>(0,e.jsx)(le,{position:d,product:i,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${r}-${d}`))]})]},`seriesItem-${r}`))}),Pe=({supportsMetadata:t})=>(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map(n=>(0,e.jsx)(K,{href:n.url,label:n.label,onClick:()=>{}},n.id))}),Ee=({multicolMetadata:t})=>{const n=(0,a.useMemo)(()=>!t?.some(r=>!!r.columns),[t]);return(0,e.jsx)("div",{className:(0,N.cn)("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":n}),children:t?.map((r,i)=>(0,e.jsx)("div",{children:(0,e.jsx)(re,{item:r,allPicture:n})},`multicolItem-${r?.label}-${i}`))})},ze=({profileAction:t})=>{const[n,r]=(0,a.useState)(!1),{profile:i,event:d}=(0,A.useNavContext)();return(0,e.jsxs)("div",{className:(0,N.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":n}),children:[(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>r(!n),"aria-expanded":n,"aria-label":i?.nick_name||t?.welcome,children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(H.User,{"aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:i?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!i?.email&&(0,e.jsx)(H.DownArrow,{"aria-hidden":"true",className:(0,N.cn)("laptop:size-4 size-5",{"rotate-180":n})})]}),i?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:t?.profiles?.map(m=>(0,e.jsx)(K,{label:m?.title,href:m?.url},m.id))}),n&&!i?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(l.Text,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(m=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:m.benefitIcon?.url,className:"size-4",alt:m.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:m.benefit,className:"text-sm font-bold leading-[1.4]"})]},m.id))})]}),!i?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>d?.join?.(),children:(0,e.jsx)(l.Text,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>d?.login?.(),children:(0,e.jsx)(l.Text,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},He=({menuOpen:t,onMenuOpenClose:n,onMenuOpenClick:r,actions:i})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(ce,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(Z,{actions:i}),t?(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Close menu","aria-expanded":"true",children:(0,e.jsx)(H.Close,{className:"size-5","aria-hidden":"true"})}):(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:(0,e.jsx)(H.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),ce=()=>{const{payloadData:t,isMobile:n}=(0,A.useNavContext)();return(0,e.jsx)("a",{href:"/",className:"hover:text-brand-0 [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:n?t?.bar?.mobileLogo:t?.bar?.desktopLogo}})},Z=(0,a.forwardRef)(({actions:t,activeStatus:n=!1},r)=>{const{event:i,cartCount:d}=(0,A.useNavContext)(),[m,b]=(0,a.useState)(null),u=y=>{switch(y){case v.HeaderNavigationActionBlockType.Search:return"Search";case v.HeaderNavigationActionBlockType.Cart:return`Shopping cart${d>0?` (${d} items)`:""}`;case v.HeaderNavigationActionBlockType.Profile:return"User profile";case v.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},x=(0,a.useCallback)((y,o)=>{switch(b(o),y?.blockType){case v.HeaderNavigationActionBlockType.Search:i?.search?.();break;case v.HeaderNavigationActionBlockType.Cart:i?.cart?.();break;case v.HeaderNavigationActionBlockType.Profile:i?.profile?.();break;case v.HeaderNavigationActionBlockType.Livestream:i?.livestream?.();break;default:return()=>{}}},[i]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((y,o)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0",ref:y.blockType===v.HeaderNavigationActionBlockType.Profile?r:null,onClick:()=>x(y,o),"aria-label":u(y.blockType),"aria-pressed":n&&m===o,children:[(0,e.jsx)(l.Text,{html:y.icon,className:(0,N.cn)("size-5",{"text-brand-0":n&&m===o}),"aria-hidden":"true"}),y.blockType===v.HeaderNavigationActionBlockType.Cart&&d>0&&(0,e.jsx)("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:(0,e.jsx)(l.Text,{html:d?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},y.id))})}),de=({title:t,onMenuOpenClose:n,onMenuBackClick:r})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Back to previous menu",children:(0,e.jsx)(H.LeftArrow,{className:"size-5","aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Close menu",children:(0,e.jsx)(H.Close,{className:"size-5","aria-hidden":"true"})})]}),K=({label:t,href:n,onClick:r,active:i,icon:d,className:m})=>{const b=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(l.Text,{html:t,className:(0,N.cn)("text-sm font-bold leading-[1.4]",{underline:d})}),d&&(0,e.jsx)(l.Text,{html:d,"aria-hidden":"true"})]}),(0,e.jsx)(H.RightArrow,{className:(0,N.cn)("laptop:size-4 size-5",{"rotate-90":i}),"aria-hidden":"true"})]});return n?(0,e.jsx)(l.Link,{href:n,className:(0,N.cn)("flex cursor-pointer items-center justify-between py-4 no-underline",m),children:b}):(0,e.jsx)("button",{className:(0,N.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",m),onClick:r,"aria-expanded":i,children:b})};oe.displayName="MobileNavigation",Z.displayName="Actions",te.displayName="HeaderNavigation",ae.displayName="DesktopNavigation",ne.displayName="SidebarDropdown";var Te=(0,ue.withLayout)(te);
1
+ "use strict";"use client";var ke=Object.create;var U=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Se=(n,r)=>{for(var i in r)U(n,i,{get:r[i],enumerable:!0})},te=(n,r,i,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let d of xe(r))!Me.call(n,d)&&d!==i&&U(n,d,{get:()=>r[d],enumerable:!(s=Ce(r,d))||s.enumerable});return n};var Z=(n,r,i)=>(i=n!=null?ke(we(n)):{},te(r||!n||!n.__esModule?U(i,"default",{value:n,enumerable:!0}):i,n)),Pe=n=>te(U({},"__esModule",{value:!0}),n);var Le={};Se(Le,{default:()=>He});module.exports=Pe(Le);var e=require("react/jsx-runtime"),t=require("react"),l=require("../../components/index.js"),le=require("../../shared/Styles.js"),S=require("../../helpers/utils.js"),z=Z(require("./NavProvider.js")),o=require("./types.js"),se=Z(require("jump.js")),G=require("@gsap/react"),J=require("gsap"),N=require("./withCategory.js"),x=require("./icons/index.js"),ce=Z(require("../NavigationSearch/index.js")),ue=require("./ResourceSidebarDropdown.js"),me=require("./MobileResourceSidebarMenu.js"),de=require("./SidebarDropdown.js"),pe=require("./MulticolDropdown.js"),fe=require("./SupportsDropdown.js"),be=require("./MobileSidebarMenu.js"),ve=require("./MobileSupportMenu.js"),ge=require("./MobileMulticolMenu.js"),q=require("./MobileMenuComponents.js");const ae=(0,t.forwardRef)((n,r)=>{const{data:{header:i}={},buildProps:s,event:d,profile:c,theme:h="light",isTop:f=!1,searchResult:E,onSearch:u,isSearching:g,keywords:k,onPrimaryNavClick:b,onSeriesProductClick:w,onSidebarNavClick:O,headerId:T,cartCount:H,menuData:L}=n,[P,B]=(0,t.useState)(!1),[j,W]=(0,t.useState)(!1),m=(0,t.useRef)(null),D=(0,t.useRef)(null),A=()=>{const y=document?.querySelector("body")?.offsetWidth||0;W(y<=1440)};(0,t.useEffect)(()=>(A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}),[]),(0,t.useImperativeHandle)(r,()=>D.current),(0,t.useEffect)(()=>{D.current&&f&&(0,se.default)(D.current,{duration:0,offset:D.current?.getBoundingClientRect()?.bottom||0})},[f]),(0,t.useEffect)(()=>{d&&(d.search=()=>B(!0))},[d]),(0,G.useGSAP)(()=>{m?.current&&P&&J.gsap.fromTo(m.current,{height:0},{height:"auto",duration:.3})},[P]),(0,t.useEffect)(()=>{document.documentElement.style.overflow=P?"hidden":"auto"},[P]);const R=(0,t.useMemo)(()=>i?.bar?.actions?.find(y=>y?.blockType===o.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]);return(0,e.jsx)(z.default,{buildProps:s,profile:c,isMobile:j,event:d,payloadData:i,onSidebarNavClick:O,onSeriesProductClick:w,cartCount:H,children:(0,e.jsx)("header",{id:T||"header","data-ui-component-id":"HeaderNavigation",className:"relative z-[100] bg-white",ref:D,children:(0,e.jsxs)("div",{className:(0,S.cn)("hover:bg-white hover:text-black",h==="light"?"text-black":"text-white",{}),children:[(0,e.jsx)(ne,{data:i,className:"desktop:block hidden !bg-white",theme:h,onPrimaryNavClick:b}),(0,e.jsx)(oe,{menuData:L,data:i,className:"desktop:hidden block !bg-white",onPrimaryNavClick:b}),P&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${D?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:m,className:(0,S.cn)("overflow-y-auto",{}),children:(0,e.jsx)(ce.default,{data:R,keywords:k,isSearching:g,searchResult:E,onSearch:y=>{u?.(y)},onClose:()=>{u?.(),B(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>B(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:y=>{(y.key==="Enter"||y.key===" "||y.key==="Escape")&&(y.preventDefault(),B(!1))}})]})]})})})}),ne=(0,t.forwardRef)((n,r)=>{const{data:i,onNavItemClick:s,className:d,theme:c,onPrimaryNavClick:h}=n,{event:f,profile:E}=(0,z.useNavContext)(),[u,g]=(0,t.useState)(!1),k=(0,t.useMemo)(()=>(0,N.WithGroupCategory)(i?.categories?.filter(a=>a?.pcShow)),[i]),[b,w]=(0,t.useState)(null),[O,T]=(0,t.useState)([]),H=(0,t.useRef)(null),[L,P]=(0,t.useState)(!1),B=(0,t.useRef)(null),j=(0,t.useRef)(null),W=(0,t.useRef)(k.map(a=>Array(a?.length||0).fill(null)));(0,t.useEffect)(()=>{k?.length&&T(k?.map((a,p)=>a?.map((v,M)=>({groupIndex:p,index:M,open:!1}))))},[k]);const m=(0,t.useMemo)(()=>{let a=null;for(const p of O){for(const v of p)if(v.open){a=v;break}if(a)break}return a},[O]);(0,t.useEffect)(()=>{document.documentElement.style.overflow=m?.open||L?"hidden":"auto"},[m?.open,L]);const D=(a,p,v)=>{P(!1);const M=k[p][v];if(M?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links)M?.components?.[0]?.url&&window.open(M?.components?.[0]?.url);else{const K=k?.flat()||[],I=K?.findIndex(Y=>Y?.id===k[p][v]?.id);a.stopPropagation(),s?.(),h?.(K[I],I),w(M),T(Y=>Y.map(Ne=>Ne.map(F=>F.groupIndex===p&&F.index===v?{...F,open:!F.open}:{...F,open:!1})))}},A=(a,p,v)=>{a.key==="Enter"||a.key===" "?(a.preventDefault(),D(a,p,v)):a.key==="Escape"&&m?.groupIndex===p&&m?.index===v&&(a.preventDefault(),R())},R=()=>{T(a=>a.map(p=>p.map(v=>({...v,open:!1}))))},y=(0,t.useMemo)(()=>{if(b)return b?.components?.[0]?.blockType},[b]),C=(0,N.WithSidebar)(de.SidebarDropdown,b),Q=(0,N.WithResource)(ue.ResourceSidebarDropdown,b),_=(0,N.WithMulticol)(pe.MulticolDropdown,b),he=(0,N.WithSupports)(fe.SupportsDropdown,{categoriesItem:b,currentNavItemRef:W.current?.[m?.groupIndex||0]?.[m?.index||0]}),ye=(0,t.useMemo)(()=>{switch(y){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(C,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(Q,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(he,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(_,{});default:return null}},[y,b]),V=(0,t.useMemo)(()=>i?.bar?.actions?.filter(a=>a?.pcShow),[i]),$=(0,t.useMemo)(()=>V?.find(a=>a?.blockType===o.HeaderNavigationActionBlockType.Profile),[V]),X=(0,t.useCallback)(()=>{P(a=>!a)},[]);return(0,t.useEffect)(()=>{if(H?.current){const a=H.current;return a.addEventListener("click",X),()=>{a.removeEventListener("click",X)}}},[X]),(0,G.useGSAP)(()=>{m?.open&&J.gsap.fromTo(j?.current,{height:0},{height:"auto"})},[m?.open]),(0,e.jsxs)(l.Container,{className:(0,S.cn)("relative h-[96px]",d),children:[(0,e.jsxs)("div",{ref:B,onClick:R,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(re,{}),(0,e.jsx)(ee,{ref:H,actions:V,activeStatus:L})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:k?.map((a,p)=>(0,e.jsx)("div",{className:"flex gap-3",children:a?.map((v,M)=>{const K=m?.groupIndex===p&&m?.index===M;return(0,e.jsx)("div",{ref:I=>{W.current[p][M]=I},className:"group cursor-pointer",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:I=>D(I,p,M),onKeyDown:I=>A(I,p,M),"aria-expanded":K,"aria-haspopup":"true","aria-label":v.text,children:[(0,e.jsx)(l.Text,{html:v.text,className:"text-sm font-bold leading-[1.4]"}),v?.components?.length>0&&v?.components?.[0]?.blockType!==o.HeaderNavigationBlockType.Links&&(0,e.jsx)(x.DownArrow,{className:(0,S.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":m?.groupIndex===p&&m?.index===M,"opacity-100":u&&m?.groupIndex===p&&m?.index===M})})]}),(0,e.jsx)("div",{className:(0,S.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":K},c==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},v.id)})},`groupCategory-${p}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(m?.open&&b),className:(0,S.cn)("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:!(m?.open&&b)}),onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{height:`calc(100dvh - ${B?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:j,className:(0,S.cn)("relative z-50",{"overflow-hidden":y!==o.HeaderNavigationBlockType.Supports}),children:ye}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:R,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),R())}})]}),L&&(0,e.jsxs)("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:[(0,e.jsx)("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${H?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:E?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:E?.nick_name||$?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),(0,e.jsx)("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:$?.profiles?.map(a=>(0,e.jsx)(q.MenuItem,{className:"py-2",label:a?.title,href:a?.url},a.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(x.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(l.Text,{html:$?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:$?.benefits?.map(a=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:a.benefitIcon?.url,className:"size-4",alt:a.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:a.benefit,className:"text-sm font-bold leading-[1.4]"})]},a.id))}),(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-2",children:[(0,e.jsx)(l.Button,{variant:"secondary",size:"lg",onClick:()=>f?.join?.(),children:(0,e.jsx)(l.Text,{html:$?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{variant:"primary",size:"lg",onClick:()=>f?.login?.(),children:(0,e.jsx)(l.Text,{html:$?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>P(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),P(!1))}})]})]})}),oe=(0,t.forwardRef)(({data:n,menuData:r,className:i,onPrimaryNavClick:s},d)=>{const c=(0,t.useMemo)(()=>(0,N.WithGroupCategory)(n?.categories?.filter(C=>C?.mobileShow)),[n]),{currentMenu:h,setCurrentMenu:f,subSubCategory:E}=(0,z.useNavContext)(),[u,g]=(0,t.useState)(!1),[k,b]=(0,t.useState)(0),[w,O]=(0,t.useState)(null),T=(0,t.useRef)(null);(0,t.useEffect)(()=>{if(T?.current&&u){const C=T?.current?.getBoundingClientRect();b(window?.innerHeight-(C?.bottom||0))}},[u]),(0,G.useGSAP)(()=>{J.gsap.fromTo(T.current,{height:0},{height:k,duration:.3})},[k]),(0,t.useEffect)(()=>{document.documentElement.style.overflow=u?"hidden":"auto"},[u]);const H=(0,t.useMemo)(()=>w?.components?.[0]?.blockType,[w]),L=(0,N.WithSupports)(ve.MobileSupportMenu,{categoriesItem:w}),P=(0,N.WithSidebar)(be.MobileSidebarMenu,w),B=(0,N.WithResource)(me.MobileResourceSidebarMenu,w),j=(0,N.WithMulticol)(ge.MobileMulticolMenu,w),W=(0,t.useMemo)(()=>{switch(H){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(P,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(B,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(L,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(j,{});default:return null}},[H,w,L]),m=(0,t.useCallback)(()=>{g(!1),b(0),f&&f(o.HeaderNavigationMenu.Primary)},[g,b,f]),D=(0,t.useMemo)(()=>n?.bar?.actions?.filter(C=>C?.mobileShow&&C?.blockType!==o.HeaderNavigationActionBlockType.Profile),[n]),A=(0,t.useMemo)(()=>n?.bar?.actions?.find(C=>C?.mobileShow&&C?.blockType===o.HeaderNavigationActionBlockType.Profile)||{},[n]),R=(0,t.useMemo)(()=>{switch(h){case o.HeaderNavigationMenu.Primary:return(0,e.jsx)(Te,{actions:D,menuOpen:u,onMenuOpenClose:()=>{g(!1),b(0)},onMenuOpenClick:()=>g(!0)});case o.HeaderNavigationMenu.Secondary:return(0,e.jsx)(ie,{title:w?.text,onMenuOpenClose:m,onMenuBackClick:()=>f?.(o.HeaderNavigationMenu.Primary)});case o.HeaderNavigationMenu.Third:return(0,e.jsx)(ie,{title:E?.label,onMenuOpenClose:m,onMenuBackClick:()=>f?.(o.HeaderNavigationMenu.Secondary)});default:return null}},[u,h,f,w,D,E,m]),y=(0,t.useCallback)((C,Q)=>{const _=Array.isArray(c)?Array.isArray(c[C])?c[C][Q]:{}:{};O(_),_?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links?_?.components?.[0]?.url&&window.open(_?.components?.[0]?.url):f?.(o.HeaderNavigationMenu.Secondary)},[c,f]);return(0,e.jsxs)(l.Container,{className:(0,S.cn)("relative h-[52px]",i),children:[R,u&&(0,e.jsxs)("nav",{ref:T,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:k},role:"navigation","aria-label":"Mobile navigation menu",children:[h===o.HeaderNavigationMenu.Primary&&r?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:r})}):null,h===o.HeaderNavigationMenu.Primary?(0,e.jsx)(De,{categories:c,onPrimaryMenuClick:y,onPrimaryNavClick:s,profileAction:A}):W]})]})}),De=({categories:n,onPrimaryMenuClick:r,profileAction:i,onPrimaryNavClick:s})=>(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:n?.map((d,c)=>(0,e.jsxs)("div",{className:"",children:[(0,e.jsx)("div",{className:(0,S.cn)("my-2 h-px w-full bg-[#E5E5E7]")}),d?.map((h,f)=>(0,e.jsx)(q.MenuItem,{label:h.text,onClick:()=>{const u=(n?.flat()||[])?.findIndex(g=>g?.id===n[c][f]?.id);r(c,f),s?.(h,u)},icon:h.components?.[0]?.icon},h.id))]},`groupCategory-${c}`))}),(0,e.jsx)(Ee,{profileAction:i})]}),Ee=({profileAction:n})=>{const[r,i]=(0,t.useState)(!1),{profile:s,event:d}=(0,z.useNavContext)();return(0,e.jsxs)("div",{className:(0,S.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":r}),children:[(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>i(!r),"aria-expanded":r,"aria-label":s?.nick_name||n?.welcome,children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(x.User,{"aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:s?.nick_name||n?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!s?.email&&(0,e.jsx)(x.DownArrow,{"aria-hidden":"true",className:(0,S.cn)("laptop:size-4 size-5",{"rotate-180":r})})]}),s?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:n?.profiles?.map(c=>(0,e.jsx)(q.MenuItem,{label:c?.title,href:c?.url},c.id))}),r&&!s?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(l.Text,{html:n?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:n?.benefits?.map(c=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:c.benefitIcon?.url,className:"size-4",alt:c.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:c.benefit,className:"text-sm font-bold leading-[1.4]"})]},c.id))})]}),!s?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>d?.join?.(),children:(0,e.jsx)(l.Text,{html:n?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>d?.login?.(),children:(0,e.jsx)(l.Text,{html:n?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Te=({menuOpen:n,onMenuOpenClose:r,onMenuOpenClick:i,actions:s})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(re,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(ee,{actions:s}),n?(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Close menu","aria-expanded":"true",children:(0,e.jsx)(x.Close,{className:"size-5","aria-hidden":"true"})}):(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:(0,e.jsx)(x.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),re=()=>{const{payloadData:n,isMobile:r}=(0,z.useNavContext)();return(0,e.jsx)("a",{href:"/",className:"hover:text-brand-0 [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:r?n?.bar?.mobileLogo:n?.bar?.desktopLogo}})},ee=(0,t.forwardRef)(({actions:n,activeStatus:r=!1},i)=>{const{event:s,cartCount:d}=(0,z.useNavContext)(),[c,h]=(0,t.useState)(null),f=u=>{switch(u){case o.HeaderNavigationActionBlockType.Search:return"Search";case o.HeaderNavigationActionBlockType.Cart:return`Shopping cart${d>0?` (${d} items)`:""}`;case o.HeaderNavigationActionBlockType.Profile:return"User profile";case o.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},E=(0,t.useCallback)((u,g)=>{switch(h(g),u?.blockType){case o.HeaderNavigationActionBlockType.Search:s?.search?.();break;case o.HeaderNavigationActionBlockType.Cart:s?.cart?.();break;case o.HeaderNavigationActionBlockType.Profile:s?.profile?.();break;case o.HeaderNavigationActionBlockType.Livestream:s?.livestream?.();break;default:return()=>{}}},[s]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(n)&&n?.map((u,g)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0",ref:u.blockType===o.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>E(u,g),"aria-label":f(u.blockType),"aria-pressed":r&&c===g,children:[(0,e.jsx)(l.Text,{html:u.icon,className:(0,S.cn)("size-5",{"text-brand-0":r&&c===g}),"aria-hidden":"true"}),u.blockType===o.HeaderNavigationActionBlockType.Cart&&d>0&&(0,e.jsx)("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:(0,e.jsx)(l.Text,{html:d?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},u.id))})}),ie=({title:n,onMenuOpenClose:r,onMenuBackClick:i})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Back to previous menu",children:(0,e.jsx)(x.LeftArrow,{className:"size-5","aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:n,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Close menu",children:(0,e.jsx)(x.Close,{className:"size-5","aria-hidden":"true"})})]});oe.displayName="MobileNavigation",ee.displayName="Actions",ae.displayName="HeaderNavigation",ne.displayName="DesktopNavigation";var He=(0,le.withLayout)(ae);
2
2
  //# sourceMappingURL=index.js.map