@anker-in/headless-ui 1.1.17-alpha.1765938765782 → 1.1.17-alpha.1765940527615
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.
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js.map +3 -3
- package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/types.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +2 -2
- package/dist/cjs/components/brand-strip.js +1 -1
- package/dist/cjs/components/brand-strip.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js.map +3 -3
- package/dist/esm/biz-components/HeaderNavigation/types.d.ts +2 -0
- package/dist/esm/biz-components/HeaderNavigation/types.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/types.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +2 -2
- package/dist/esm/components/brand-strip.js +1 -1
- package/dist/esm/components/brand-strip.js.map +2 -2
- package/package.json +1 -1
- package/style.css +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeaderNavigation/types.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Product } from '../../cpn-components/CpnProductCard/types.js'\n\nexport interface HeaderNavigationProps {\n data: any\n onPrimaryNavClick?: (_category: any, _position: number) => void\n onSidebarNavClick?: (_series: any, _index: number) => void\n onSeriesProductClick?: (_product: any, _position: number) => void\n searchResult?: any\n onSearch?: (_value?: string) => void\n isSearching?: boolean\n keywords?: {\n search_term: string\n search_date: string\n shopify_domain: string\n counts: number\n }[]\n headerId?: string\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 buildProps: {\n products?: Product[]\n categories?: Record<string, any>\n }\n profile?: UserProfile // \u7528\u6237\u4FE1\u606F\n theme?: string\n isTop?: boolean // \u662F\u5426\u5728\u9876\u90E8\n}\n\nexport interface MobilePrimaryNavigationData {\n actions: any\n menuOpen?: boolean\n onMenuOpenClick: () => void\n onMenuOpenClose: () => void\n}\n\nexport interface MobileSecondaryNavigationData {\n title?: string\n onMenuOpenClose: () => void\n onMenuBackClick: () => void\n}\n\nexport enum HeaderNavigationMenu {\n Primary = 'primary',\n Secondary = 'secondary',\n Third = 'third',\n}\n\nexport enum HeaderNavigationBlockType {\n Sidebar = 'ipc-navigation-sidebar',\n Supports = 'ipc-navigation-supports',\n Multicol = 'ipc-navigation-multicol',\n Links = 'ipc-navigation-links',\n}\n\nexport enum HeaderNavigationActionBlockType {\n Search = 'ipc-navigation-action-search',\n Cart = 'ipc-navigation-action-cart',\n Profile = 'ipc-navigation-action-profile',\n Livestream = 'ipc-navigation-action-livestream',\n}\n\nexport interface MobileNavigationProps {\n data: any\n className?: string\n onPrimaryNavClick?: (_category: any, _position: number) => void\n}\n\nexport interface DesktopNavigationProps {\n data: any\n onNavItemClick?: () => void\n className?: string\n theme?: string\n onPrimaryNavClick?: (_category: any, _position: number) => void\n onSidebarNavClick?: (_series: any, _index: number, _subSubindex?: number) => void\n}\n\ntype Country = {\n id?: number\n name?: string\n code?: string\n}\n\nexport type UserProfile = {\n user_id: string\n email: string\n nick_name?: string\n full_name?: string\n first_name?: string\n last_name?: string\n dob?: string\n gender?: string\n phone_number?: string\n phone_account?: string\n country?: Country\n is_subscribe?: boolean\n avatar?: string\n can_change_password?: boolean\n invitation_code?: string\n phone_carrier?: string\n dob_programmed?: boolean\n activated?: boolean\n registed_at?: number\n activated_at?: number\n token?: string\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,8BAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAL,
|
|
4
|
+
"sourcesContent": ["import type { Product } from '../../cpn-components/CpnProductCard/types.js'\n\nexport interface HeaderNavigationProps {\n data: any\n menuData: any\n onPrimaryNavClick?: (_category: any, _position: number) => void\n onSidebarNavClick?: (_series: any, _index: number) => void\n onSeriesProductClick?: (_product: any, _position: number) => void\n searchResult?: any\n onSearch?: (_value?: string) => void\n isSearching?: boolean\n keywords?: {\n search_term: string\n search_date: string\n shopify_domain: string\n counts: number\n }[]\n headerId?: string\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 buildProps: {\n products?: Product[]\n categories?: Record<string, any>\n }\n profile?: UserProfile // \u7528\u6237\u4FE1\u606F\n theme?: string\n isTop?: boolean // \u662F\u5426\u5728\u9876\u90E8\n}\n\nexport interface MobilePrimaryNavigationData {\n actions: any\n menuOpen?: boolean\n onMenuOpenClick: () => void\n onMenuOpenClose: () => void\n}\n\nexport interface MobileSecondaryNavigationData {\n title?: string\n onMenuOpenClose: () => void\n onMenuBackClick: () => void\n}\n\nexport enum HeaderNavigationMenu {\n Primary = 'primary',\n Secondary = 'secondary',\n Third = 'third',\n}\n\nexport enum HeaderNavigationBlockType {\n Sidebar = 'ipc-navigation-sidebar',\n Supports = 'ipc-navigation-supports',\n Multicol = 'ipc-navigation-multicol',\n Links = 'ipc-navigation-links',\n}\n\nexport enum HeaderNavigationActionBlockType {\n Search = 'ipc-navigation-action-search',\n Cart = 'ipc-navigation-action-cart',\n Profile = 'ipc-navigation-action-profile',\n Livestream = 'ipc-navigation-action-livestream',\n}\n\nexport interface MobileNavigationProps {\n data: any\n menuData: any\n className?: string\n onPrimaryNavClick?: (_category: any, _position: number) => void\n}\n\nexport interface DesktopNavigationProps {\n data: any\n onNavItemClick?: () => void\n className?: string\n theme?: string\n onPrimaryNavClick?: (_category: any, _position: number) => void\n onSidebarNavClick?: (_series: any, _index: number, _subSubindex?: number) => void\n}\n\ntype Country = {\n id?: number\n name?: string\n code?: string\n}\n\nexport type UserProfile = {\n user_id: string\n email: string\n nick_name?: string\n full_name?: string\n first_name?: string\n last_name?: string\n dob?: string\n gender?: string\n phone_number?: string\n phone_account?: string\n country?: Country\n is_subscribe?: boolean\n avatar?: string\n can_change_password?: boolean\n invitation_code?: string\n phone_carrier?: string\n dob_programmed?: boolean\n activated?: boolean\n registed_at?: number\n activated_at?: number\n token?: string\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qCAAAE,EAAA,8BAAAC,EAAA,yBAAAC,IAAA,eAAAC,EAAAL,GAiDO,IAAKI,OACVA,EAAA,QAAU,UACVA,EAAA,UAAY,YACZA,EAAA,MAAQ,QAHEA,OAAA,IAMAD,OACVA,EAAA,QAAU,yBACVA,EAAA,SAAW,0BACXA,EAAA,SAAW,0BACXA,EAAA,MAAQ,uBAJEA,OAAA,IAOAD,OACVA,EAAA,OAAS,+BACTA,EAAA,KAAO,6BACPA,EAAA,QAAU,gCACVA,EAAA,WAAa,mCAJHA,OAAA",
|
|
6
6
|
"names": ["types_exports", "__export", "HeaderNavigationActionBlockType", "HeaderNavigationBlockType", "HeaderNavigationMenu", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var b=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var H=(o,n)=>{for(var i in n)b(o,i,{get:n[i],enumerable:!0})},L=(o,n,i,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of T(n))!E.call(o,l)&&l!==i&&b(o,l,{get:()=>n[l],enumerable:!(c=C(n,l))||c.enumerable});return o};var M=o=>L(b({},"__esModule",{value:!0}),o);var I={};H(I,{default:()=>P});module.exports=M(I);var r=require("react/jsx-runtime"),p=require("../../../../../helpers/index.js"),t=require("react"),w=require("./useScrollSpy.js"),g=require("es-toolkit");const z=({tabs:o,onSpyNavItemClick:n,className:i,renderRating:c})=>{const[l,S]=(0,t.useState)(0),u=(0,t.useMemo)(()=>c?[...o,{label:"Reviews",id:"ipc-review",href:""}]:o,[o,c]),y=(0,t.useMemo)(()=>u.map(e=>e.id),[u]),d=(0,g.debounce)(()=>{const e=document.querySelector("#purchase-bar");e&&S(e.getBoundingClientRect().height)},500);(0,t.useEffect)(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[d]);const a=(0,w.useScrollSpy)(y,l),f=(0,t.useRef)(null),m=(0,t.useRef)(new Map),x=(0,t.useCallback)(e=>{n?.(e)},[n]);(0,t.useEffect)(()=>{if(!a||!f.current)return;const e=m.current.get(a);if(!e)return;const s=f.current,h=e.getBoundingClientRect(),v=s.getBoundingClientRect(),k=h.left+h.width/2-v.left,R=v.width/2,B=k-R;s.scrollTo({left:s.scrollLeft+B,behavior:"smooth"})},[a]);const N=(0,t.useCallback)((e,s)=>{s?m.current.set(e,s):m.current.delete(e)},[]);return(0,r.jsx)("div",{ref:f,style:{scrollbarWidth:"none",msOverflowStyle:"none"},className:(0,p.cn)("overflow-x-auto",i),children:(0,r.jsx)("div",{className:"tablet:gap-8 flex gap-6",children:u?.map(e=>(0,r.jsx)("button",{ref:s=>N(e.id,s),children:e.id==="ipc-review"?(0,r.jsxs)("span",{className:"relative block shrink-0 whitespace-nowrap py-[10px]",children:[c,(0,r.jsx)("span",{className:(0,p.cn)("laptop-md:block bg-brand-0 absolute bottom-0 left-0 hidden h-[2px] w-0 transition-all duration-300 ease-in-out",{"w-full":a===e.id})})]}):(0,r.jsxs)("span",{className:(0,p.cn)("laptop-md:text-[#1d1d1f] relative block shrink-0 whitespace-nowrap py-[10px] text-sm font-bold text-[#949494]",{"text-[#1d1d1f]":a===e.id}),onClick:()=>x(e),children:[e.label,(0,r.jsx)("span",{className:(0,p.cn)("laptop-md:block bg-brand-0 absolute bottom-0 left-0 hidden h-[2px] w-0 transition-all duration-300 ease-in-out",{"w-full":a===e.id})})]})},e.id))})})};var P=z;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { cn } from '../../../../../helpers/index.js'\nimport { useCallback, useRef, useMemo, useEffect, useState } from 'react'\nimport type { ScrollSpyNavItem, ScrollSpyNavProps } from './types.js'\nimport { useScrollSpy } from './useScrollSpy.js'\nimport { debounce } from 'es-toolkit'\n\nconst ScrollSpyNav = ({ tabs, onSpyNavItemClick, className, renderRating }: ScrollSpyNavProps) => {\n // \u4F7F\u7528 useScrollSpy hook \u81EA\u52A8\u76D1\u542C\u6EDA\u52A8\n const [purchaseBarHeight, setPurchaseBarHeight] = useState(0)\n const combinedTabs = useMemo(() => {\n if (renderRating) {\n return [...tabs, { label: 'Reviews', id: 'ipc-review', href: '' }]\n }\n return tabs\n }, [tabs, renderRating])\n\n const sectionIds = useMemo(() => {\n return combinedTabs.map(tab => tab.id)\n }, [combinedTabs])\n\n const debouncedHandleResize = debounce(() => {\n const purchaseBar = document.querySelector('#purchase-bar')\n if (purchaseBar) {\n setPurchaseBarHeight(purchaseBar.getBoundingClientRect().height)\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 const activeId = useScrollSpy(sectionIds, purchaseBarHeight)\n\n // \u79FB\u52A8\u7AEF\uFF1A\u6A2A\u5411\u6EDA\u52A8\u5BB9\u5668\u548C tab \u6309\u94AE\u7684 refs\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n const tabRefs = useRef<Map<string, HTMLButtonElement>>(new Map())\n\n const onTabClick = useCallback(\n (tab: ScrollSpyNavItem) => {\n onSpyNavItemClick?.(tab)\n },\n [onSpyNavItemClick]\n )\n\n // \u79FB\u52A8\u7AEF\uFF1A\u5F53 activeTab \u6539\u53D8\u65F6\uFF0C\u81EA\u52A8\u6EDA\u52A8\u5230\u4E2D\u5FC3\u4F4D\u7F6E\n useEffect(() => {\n if (!activeId || !scrollContainerRef.current) return\n\n const activeTabElement = tabRefs.current.get(activeId)\n if (!activeTabElement) return\n\n const container = scrollContainerRef.current\n const tabRect = activeTabElement.getBoundingClientRect()\n const containerRect = container.getBoundingClientRect()\n\n // \u8BA1\u7B97\u9700\u8981\u6EDA\u52A8\u7684\u8DDD\u79BB\uFF0C\u4F7F tab \u4F4D\u4E8E\u5BB9\u5668\u4E2D\u5FC3\n const tabCenter = tabRect.left + tabRect.width / 2 - containerRect.left\n const containerCenter = containerRect.width / 2\n const scrollOffset = tabCenter - containerCenter\n\n container.scrollTo({\n left: container.scrollLeft + scrollOffset,\n behavior: 'smooth',\n })\n }, [activeId])\n\n // \u8BBE\u7F6E tab ref\n const setTabRef = useCallback((tabId: string, element: HTMLButtonElement | null) => {\n if (element) {\n tabRefs.current.set(tabId, element)\n } else {\n tabRefs.current.delete(tabId)\n }\n }, [])\n\n return (\n <div\n ref={scrollContainerRef}\n style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}\n className={cn('overflow-x-auto', className)}\n >\n <div className=\"tablet:gap-8 flex gap-6\">\n {combinedTabs?.map(tab => (\n <button key={tab.id} ref={el => setTabRef(tab.id, el)}>\n {tab.id === 'ipc-review' ? (\n <
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAyFc,IAAAI,EAAA,6BAzFdC,EAAmB,2CACnBC,EAAkE,iBAElEC,EAA6B,6BAC7BC,EAAyB,sBAEzB,MAAMC,EAAe,CAAC,CAAE,KAAAC,EAAM,kBAAAC,EAAmB,UAAAC,EAAW,aAAAC,CAAa,IAAyB,CAEhG,KAAM,CAACC,EAAmBC,CAAoB,KAAI,YAAS,CAAC,EACtDC,KAAe,WAAQ,IACvBH,EACK,CAAC,GAAGH,EAAM,CAAE,MAAO,UAAW,GAAI,aAAc,KAAM,EAAG,CAAC,EAE5DA,EACN,CAACA,EAAMG,CAAY,CAAC,EAEjBI,KAAa,WAAQ,IAClBD,EAAa,IAAIE,GAAOA,EAAI,EAAE,EACpC,CAACF,CAAY,CAAC,EAEXG,KAAwB,YAAS,IAAM,CAC3C,MAAMC,EAAc,SAAS,cAAc,eAAe,EACtDA,GACFL,EAAqBK,EAAY,sBAAsB,EAAE,MAAM,CAEnE,EAAG,GAAG,KAEN,aAAU,KACRD,EAAsB,EACtB,OAAO,iBAAiB,SAAUA,CAAqB,EAChD,IAAM,CACX,OAAO,oBAAoB,SAAUA,CAAqB,CAC5D,GACC,CAACA,CAAqB,CAAC,EAE1B,MAAME,KAAW,gBAAaJ,EAAYH,CAAiB,EAGrDQ,KAAqB,UAAuB,IAAI,EAChDC,KAAU,UAAuC,IAAI,GAAK,EAE1DC,KAAa,eAChBN,GAA0B,CACzBP,IAAoBO,CAAG,CACzB,EACA,CAACP,CAAiB,CACpB,KAGA,aAAU,IAAM,CACd,GAAI,CAACU,GAAY,CAACC,EAAmB,QAAS,OAE9C,MAAMG,EAAmBF,EAAQ,QAAQ,IAAIF,CAAQ,EACrD,GAAI,CAACI,EAAkB,OAEvB,MAAMC,EAAYJ,EAAmB,QAC/BK,EAAUF,EAAiB,sBAAsB,EACjDG,EAAgBF,EAAU,sBAAsB,EAGhDG,EAAYF,EAAQ,KAAOA,EAAQ,MAAQ,EAAIC,EAAc,KAC7DE,EAAkBF,EAAc,MAAQ,EACxCG,EAAeF,EAAYC,EAEjCJ,EAAU,SAAS,CACjB,KAAMA,EAAU,WAAaK,EAC7B,SAAU,QACZ,CAAC,CACH,EAAG,CAACV,CAAQ,CAAC,EAGb,MAAMW,KAAY,eAAY,CAACC,EAAeC,IAAsC,CAC9EA,EACFX,EAAQ,QAAQ,IAAIU,EAAOC,CAAO,EAElCX,EAAQ,QAAQ,OAAOU,CAAK,CAEhC,EAAG,CAAC,CAAC,EAEL,SACE,OAAC,OACC,IAAKX,EACL,MAAO,CAAE,eAAgB,OAAQ,gBAAiB,MAAO,EACzD,aAAW,MAAG,kBAAmBV,CAAS,EAE1C,mBAAC,OAAI,UAAU,0BACZ,SAAAI,GAAc,IAAIE,MACjB,OAAC,UAAoB,IAAKiB,GAAMH,EAAUd,EAAI,GAAIiB,CAAE,EACjD,SAAAjB,EAAI,KAAO,gBACV,QAAC,
|
|
4
|
+
"sourcesContent": ["import { cn } from '../../../../../helpers/index.js'\nimport { useCallback, useRef, useMemo, useEffect, useState } from 'react'\nimport type { ScrollSpyNavItem, ScrollSpyNavProps } from './types.js'\nimport { useScrollSpy } from './useScrollSpy.js'\nimport { debounce } from 'es-toolkit'\n\nconst ScrollSpyNav = ({ tabs, onSpyNavItemClick, className, renderRating }: ScrollSpyNavProps) => {\n // \u4F7F\u7528 useScrollSpy hook \u81EA\u52A8\u76D1\u542C\u6EDA\u52A8\n const [purchaseBarHeight, setPurchaseBarHeight] = useState(0)\n const combinedTabs = useMemo(() => {\n if (renderRating) {\n return [...tabs, { label: 'Reviews', id: 'ipc-review', href: '' }]\n }\n return tabs\n }, [tabs, renderRating])\n\n const sectionIds = useMemo(() => {\n return combinedTabs.map(tab => tab.id)\n }, [combinedTabs])\n\n const debouncedHandleResize = debounce(() => {\n const purchaseBar = document.querySelector('#purchase-bar')\n if (purchaseBar) {\n setPurchaseBarHeight(purchaseBar.getBoundingClientRect().height)\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 const activeId = useScrollSpy(sectionIds, purchaseBarHeight)\n\n // \u79FB\u52A8\u7AEF\uFF1A\u6A2A\u5411\u6EDA\u52A8\u5BB9\u5668\u548C tab \u6309\u94AE\u7684 refs\n const scrollContainerRef = useRef<HTMLDivElement>(null)\n const tabRefs = useRef<Map<string, HTMLButtonElement>>(new Map())\n\n const onTabClick = useCallback(\n (tab: ScrollSpyNavItem) => {\n onSpyNavItemClick?.(tab)\n },\n [onSpyNavItemClick]\n )\n\n // \u79FB\u52A8\u7AEF\uFF1A\u5F53 activeTab \u6539\u53D8\u65F6\uFF0C\u81EA\u52A8\u6EDA\u52A8\u5230\u4E2D\u5FC3\u4F4D\u7F6E\n useEffect(() => {\n if (!activeId || !scrollContainerRef.current) return\n\n const activeTabElement = tabRefs.current.get(activeId)\n if (!activeTabElement) return\n\n const container = scrollContainerRef.current\n const tabRect = activeTabElement.getBoundingClientRect()\n const containerRect = container.getBoundingClientRect()\n\n // \u8BA1\u7B97\u9700\u8981\u6EDA\u52A8\u7684\u8DDD\u79BB\uFF0C\u4F7F tab \u4F4D\u4E8E\u5BB9\u5668\u4E2D\u5FC3\n const tabCenter = tabRect.left + tabRect.width / 2 - containerRect.left\n const containerCenter = containerRect.width / 2\n const scrollOffset = tabCenter - containerCenter\n\n container.scrollTo({\n left: container.scrollLeft + scrollOffset,\n behavior: 'smooth',\n })\n }, [activeId])\n\n // \u8BBE\u7F6E tab ref\n const setTabRef = useCallback((tabId: string, element: HTMLButtonElement | null) => {\n if (element) {\n tabRefs.current.set(tabId, element)\n } else {\n tabRefs.current.delete(tabId)\n }\n }, [])\n\n return (\n <div\n ref={scrollContainerRef}\n style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}\n className={cn('overflow-x-auto', className)}\n >\n <div className=\"tablet:gap-8 flex gap-6\">\n {combinedTabs?.map(tab => (\n <button key={tab.id} ref={el => setTabRef(tab.id, el)}>\n {tab.id === 'ipc-review' ? (\n <span className=\"relative block shrink-0 whitespace-nowrap py-[10px]\">\n {renderRating}\n <span\n className={cn(\n 'laptop-md:block bg-brand-0 absolute bottom-0 left-0 hidden h-[2px] w-0 transition-all duration-300 ease-in-out',\n {\n 'w-full': activeId === tab.id,\n }\n )}\n />\n </span>\n ) : (\n <span\n className={cn(\n 'laptop-md:text-[#1d1d1f] relative block shrink-0 whitespace-nowrap py-[10px] text-sm font-bold text-[#949494]',\n {\n 'text-[#1d1d1f]': activeId === tab.id,\n }\n )}\n onClick={() => onTabClick(tab)}\n >\n {tab.label}\n <span\n className={cn(\n 'laptop-md:block bg-brand-0 absolute bottom-0 left-0 hidden h-[2px] w-0 transition-all duration-300 ease-in-out',\n {\n 'w-full': activeId === tab.id,\n }\n )}\n />\n </span>\n )}\n </button>\n ))}\n </div>\n </div>\n )\n}\n\nexport default ScrollSpyNav\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAyFc,IAAAI,EAAA,6BAzFdC,EAAmB,2CACnBC,EAAkE,iBAElEC,EAA6B,6BAC7BC,EAAyB,sBAEzB,MAAMC,EAAe,CAAC,CAAE,KAAAC,EAAM,kBAAAC,EAAmB,UAAAC,EAAW,aAAAC,CAAa,IAAyB,CAEhG,KAAM,CAACC,EAAmBC,CAAoB,KAAI,YAAS,CAAC,EACtDC,KAAe,WAAQ,IACvBH,EACK,CAAC,GAAGH,EAAM,CAAE,MAAO,UAAW,GAAI,aAAc,KAAM,EAAG,CAAC,EAE5DA,EACN,CAACA,EAAMG,CAAY,CAAC,EAEjBI,KAAa,WAAQ,IAClBD,EAAa,IAAIE,GAAOA,EAAI,EAAE,EACpC,CAACF,CAAY,CAAC,EAEXG,KAAwB,YAAS,IAAM,CAC3C,MAAMC,EAAc,SAAS,cAAc,eAAe,EACtDA,GACFL,EAAqBK,EAAY,sBAAsB,EAAE,MAAM,CAEnE,EAAG,GAAG,KAEN,aAAU,KACRD,EAAsB,EACtB,OAAO,iBAAiB,SAAUA,CAAqB,EAChD,IAAM,CACX,OAAO,oBAAoB,SAAUA,CAAqB,CAC5D,GACC,CAACA,CAAqB,CAAC,EAE1B,MAAME,KAAW,gBAAaJ,EAAYH,CAAiB,EAGrDQ,KAAqB,UAAuB,IAAI,EAChDC,KAAU,UAAuC,IAAI,GAAK,EAE1DC,KAAa,eAChBN,GAA0B,CACzBP,IAAoBO,CAAG,CACzB,EACA,CAACP,CAAiB,CACpB,KAGA,aAAU,IAAM,CACd,GAAI,CAACU,GAAY,CAACC,EAAmB,QAAS,OAE9C,MAAMG,EAAmBF,EAAQ,QAAQ,IAAIF,CAAQ,EACrD,GAAI,CAACI,EAAkB,OAEvB,MAAMC,EAAYJ,EAAmB,QAC/BK,EAAUF,EAAiB,sBAAsB,EACjDG,EAAgBF,EAAU,sBAAsB,EAGhDG,EAAYF,EAAQ,KAAOA,EAAQ,MAAQ,EAAIC,EAAc,KAC7DE,EAAkBF,EAAc,MAAQ,EACxCG,EAAeF,EAAYC,EAEjCJ,EAAU,SAAS,CACjB,KAAMA,EAAU,WAAaK,EAC7B,SAAU,QACZ,CAAC,CACH,EAAG,CAACV,CAAQ,CAAC,EAGb,MAAMW,KAAY,eAAY,CAACC,EAAeC,IAAsC,CAC9EA,EACFX,EAAQ,QAAQ,IAAIU,EAAOC,CAAO,EAElCX,EAAQ,QAAQ,OAAOU,CAAK,CAEhC,EAAG,CAAC,CAAC,EAEL,SACE,OAAC,OACC,IAAKX,EACL,MAAO,CAAE,eAAgB,OAAQ,gBAAiB,MAAO,EACzD,aAAW,MAAG,kBAAmBV,CAAS,EAE1C,mBAAC,OAAI,UAAU,0BACZ,SAAAI,GAAc,IAAIE,MACjB,OAAC,UAAoB,IAAKiB,GAAMH,EAAUd,EAAI,GAAIiB,CAAE,EACjD,SAAAjB,EAAI,KAAO,gBACV,QAAC,QAAK,UAAU,sDACb,UAAAL,KACD,OAAC,QACC,aAAW,MACT,iHACA,CACE,SAAUQ,IAAaH,EAAI,EAC7B,CACF,EACF,GACF,KAEA,QAAC,QACC,aAAW,MACT,gHACA,CACE,iBAAkBG,IAAaH,EAAI,EACrC,CACF,EACA,QAAS,IAAMM,EAAWN,CAAG,EAE5B,UAAAA,EAAI,SACL,OAAC,QACC,aAAW,MACT,iHACA,CACE,SAAUG,IAAaH,EAAI,EAC7B,CACF,EACF,GACF,GAhCSA,EAAI,EAkCjB,CACD,EACH,EACF,CAEJ,EAEA,IAAOhB,EAAQO",
|
|
6
6
|
"names": ["ScrollSpyNav_exports", "__export", "ScrollSpyNav_default", "__toCommonJS", "import_jsx_runtime", "import_helpers", "import_react", "import_useScrollSpy", "import_es_toolkit", "ScrollSpyNav", "tabs", "onSpyNavItemClick", "className", "renderRating", "purchaseBarHeight", "setPurchaseBarHeight", "combinedTabs", "sectionIds", "tab", "debouncedHandleResize", "purchaseBar", "activeId", "scrollContainerRef", "tabRefs", "onTabClick", "activeTabElement", "container", "tabRect", "containerRect", "tabCenter", "containerCenter", "scrollOffset", "setTabRef", "tabId", "element", "el"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var f=Object.create;var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var b=(t,r)=>{for(var e in r)s(t,e,{get:r[e],enumerable:!0})},o=(t,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of g(r))!u.call(t,n)&&n!==e&&s(t,n,{get:()=>r[n],enumerable:!(i=d(r,n))||i.enumerable});return t};var y=(t,r,e)=>(e=t!=null?f(c(t)):{},o(r||!t||!t.__esModule?s(e,"default",{value:t,enumerable:!0}):e,t)),h=t=>o(s({},"__esModule",{value:!0}),t);var _={};b(_,{default:()=>S});module.exports=h(_);var l=require("react/jsx-runtime"),N=require("react"),p=y(require("./link.js")),a=require("../helpers/utils.js"),m=require("./container.js");const k=({data:t,className:r,itemClassName:e})=>(0,l.jsx)("div",{className:(0,a.cn)("w-full bg-[#f5f7fb]",r),children:(0,l.jsxs)(m.Container,{children:[t?.title?(0,l.jsx)("p",{className:"mb-2 text-sm font-bold text-[#767880]",dangerouslySetInnerHTML:{__html:t?.title||""}}):null,(0,l.jsx)("ul",{className:"flex gap-2",role:"list",children:t?.leftIcon?.map?.((i,n)=>(0,l.jsx)("li",{children:(0,l.jsx)(p.default,{href:i.link,asChild:!i.link,className:"desktop:block hidden h-full",children:(0,l.jsx)("div",{dangerouslySetInnerHTML:{__html:i.logo||""},className:(0,a.cn)("brand-strip-item box-border flex h-fit items-center justify-center bg-[#F5F6F7] px-4 py-2 [&_svg]:h-full [&_svg]:w-auto [&_svg_path]:[fill:#080A0F]",e)})})},n))})]})});var S=k;
|
|
2
2
|
//# sourceMappingURL=brand-strip.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/brand-strip.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react'\nimport Link from './link.js'\nimport { cn } from '../helpers/utils.js'\nimport { Container } from './container.js'\n\ntype BrandStripItem = {\n /** \u54C1\u724C\u540D\u79F0\uFF0C\u7528\u4E8E\u9ED8\u8BA4\u5C55\u793A\u548C\u8F85\u52A9\u6587\u672C */\n name: string\n /** \u54C1\u724C Logo \u7684\u56FE\u7247\u5730\u5740\uFF0C\u9ED8\u8BA4\u662F\u5185\u7F6E\u7684\u6587\u5B57 Logo */\n logo?: string\n /** \u81EA\u5B9A\u4E49 alt \u6587\u6848 */\n alt?: string\n /** \u8DF3\u8F6C\u94FE\u63A5\uFF0C\u53EF\u9009 */\n link?: string\n}\n\ntype BrandStripProps = {\n data: any\n /** \u5916\u5C42\u5BB9\u5668 class */\n className?: string\n /** \u6BCF\u4E2A\u5361\u7247\u7684 class */\n itemClassName?: string\n}\n\n/**\n * BrandStrip - \u54C1\u724C\u5FBD\u6807\u5C55\u793A\u6761\n *\n * @description \u5C55\u793A\u54C1\u724C Logo \u5217\u8868\u7684\u7EC4\u4EF6\uFF0C\u652F\u6301\u81EA\u5B9A\u4E49\u6807\u9898\u3001Logo \u548C\u8DF3\u8F6C\u94FE\u63A5\n */\nconst BrandStrip: React.FC<BrandStripProps> = ({ data, className, itemClassName }) => {\n return (\n <div className={cn('w-full bg-[#f5f7fb]', className)}>\n <Container
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgCM,IAAAI,EAAA,6BAhCNC,EAAkB,iBAClBC,EAAiB,wBACjBC,EAAmB,+BACnBC,EAA0B,0BA0B1B,MAAMC,EAAwC,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAW,cAAAC,CAAc,OAE5E,OAAC,OAAI,aAAW,MAAG,sBAAuBD,CAAS,EACjD,oBAAC,
|
|
4
|
+
"sourcesContent": ["import React from 'react'\nimport Link from './link.js'\nimport { cn } from '../helpers/utils.js'\nimport { Container } from './container.js'\n\ntype BrandStripItem = {\n /** \u54C1\u724C\u540D\u79F0\uFF0C\u7528\u4E8E\u9ED8\u8BA4\u5C55\u793A\u548C\u8F85\u52A9\u6587\u672C */\n name: string\n /** \u54C1\u724C Logo \u7684\u56FE\u7247\u5730\u5740\uFF0C\u9ED8\u8BA4\u662F\u5185\u7F6E\u7684\u6587\u5B57 Logo */\n logo?: string\n /** \u81EA\u5B9A\u4E49 alt \u6587\u6848 */\n alt?: string\n /** \u8DF3\u8F6C\u94FE\u63A5\uFF0C\u53EF\u9009 */\n link?: string\n}\n\ntype BrandStripProps = {\n data: any\n /** \u5916\u5C42\u5BB9\u5668 class */\n className?: string\n /** \u6BCF\u4E2A\u5361\u7247\u7684 class */\n itemClassName?: string\n}\n\n/**\n * BrandStrip - \u54C1\u724C\u5FBD\u6807\u5C55\u793A\u6761\n *\n * @description \u5C55\u793A\u54C1\u724C Logo \u5217\u8868\u7684\u7EC4\u4EF6\uFF0C\u652F\u6301\u81EA\u5B9A\u4E49\u6807\u9898\u3001Logo \u548C\u8DF3\u8F6C\u94FE\u63A5\n */\nconst BrandStrip: React.FC<BrandStripProps> = ({ data, className, itemClassName }) => {\n return (\n <div className={cn('w-full bg-[#f5f7fb]', className)}>\n <Container>\n {data?.title ? (\n <p\n className=\"mb-2 text-sm font-bold text-[#767880]\"\n dangerouslySetInnerHTML={{ __html: data?.title || '' }}\n />\n ) : null}\n <ul className=\"flex gap-2\" role=\"list\">\n {data?.leftIcon?.map?.((item: any, index: number) => {\n return (\n <li key={index}>\n <Link href={item.link} asChild={!item.link} className=\"desktop:block hidden h-full\">\n <div\n dangerouslySetInnerHTML={{ __html: item.logo || '' }}\n className={cn(\n 'brand-strip-item box-border flex h-fit items-center justify-center bg-[#F5F6F7] px-4 py-2 [&_svg]:h-full [&_svg]:w-auto [&_svg_path]:[fill:#080A0F]',\n itemClassName\n )}\n />\n </Link>\n </li>\n )\n })}\n </ul>\n </Container>\n </div>\n )\n}\n\nexport type { BrandStripProps, BrandStripItem }\nexport default BrandStrip\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgCM,IAAAI,EAAA,6BAhCNC,EAAkB,iBAClBC,EAAiB,wBACjBC,EAAmB,+BACnBC,EAA0B,0BA0B1B,MAAMC,EAAwC,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAW,cAAAC,CAAc,OAE5E,OAAC,OAAI,aAAW,MAAG,sBAAuBD,CAAS,EACjD,oBAAC,aACE,UAAAD,GAAM,SACL,OAAC,KACC,UAAU,wCACV,wBAAyB,CAAE,OAAQA,GAAM,OAAS,EAAG,EACvD,EACE,QACJ,OAAC,MAAG,UAAU,aAAa,KAAK,OAC7B,SAAAA,GAAM,UAAU,MAAM,CAACG,EAAWC,OAE/B,OAAC,MACC,mBAAC,EAAAC,QAAA,CAAK,KAAMF,EAAK,KAAM,QAAS,CAACA,EAAK,KAAM,UAAU,8BACpD,mBAAC,OACC,wBAAyB,CAAE,OAAQA,EAAK,MAAQ,EAAG,EACnD,aAAW,MACT,sJACAD,CACF,EACF,EACF,GATOE,CAUT,CAEH,EACH,GACF,EACF,EAKJ,IAAOZ,EAAQO",
|
|
6
6
|
"names": ["brand_strip_exports", "__export", "brand_strip_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_link", "import_utils", "import_container", "BrandStrip", "data", "className", "itemClassName", "item", "index", "Link"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Fragment as K,jsx as e,jsxs as l}from"react/jsx-runtime";import Ce,{forwardRef as ee,useCallback as G,useEffect as H,useImperativeHandle as Se,useMemo as M,useRef as j,useState as B}from"react";import{Picture as q,Text as x,Button as $,Container as te,Link as O,Heading as se}from"../../components/index.js";import"../../shared/Styles.js";import{cn as w,atobID as De}from"../../helpers/utils.js";import Le,{useNavContext as W}from"./NavProvider.js";import{HeaderNavigationMenu as R,HeaderNavigationBlockType as I,HeaderNavigationActionBlockType as T}from"./types.js";import{debounce as Me}from"es-toolkit";import Pe from"jump.js";import{useGSAP as re}from"@gsap/react";import{gsap as oe}from"gsap";import{WithSidebar as ie,WithSupports as ce,WithMulticol as de,WithGroupCategory as ue}from"./withCategory.js";import{Menu as Ee,Close as pe,User as Be,RightArrow as ze,LeftArrow as He,DownArrow as ae,Polygon as Te}from"./icons/index.js";import $e from"../NavigationSearch/index.js";const Re=ee((t,a)=>{const{data:{headerNavigation:n}={},buildProps:c,event:i,profile:p,theme:d="light",isTop:b=!1,searchResult:f,onSearch:y,isSearching:o,keywords:D,onPrimaryNavClick:N,onSeriesProductClick:v,onSidebarNavClick:h,headerId:m,cartCount:g}=t,[r,u]=B(!1),[P,S]=B(!1),L=j(null),C=j(null),A=()=>{const k=document?.querySelector("body")?.offsetWidth||0;S(k<=1440)};H(()=>(A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}),[]),Se(a,()=>C.current),H(()=>{C.current&&b&&Pe(C.current,{duration:0,offset:C.current?.getBoundingClientRect()?.bottom||0})},[b]),H(()=>{i&&(i.search=()=>u(!0))},[i]),re(()=>{L?.current&&r&&oe.fromTo(L.current,{height:0},{height:"auto",duration:.3})},[r]),H(()=>{document.documentElement.style.overflow=r?"hidden":"auto"},[r]);const Q=M(()=>n?.headerBar?.actions?.find(k=>k?.blockType===T.Search)?.searchBar?.[0]||{},[n]);return e(Le,{buildProps:c,profile:p,isMobile:P,event:i,payloadData:n,onSidebarNavClick:h,onSeriesProductClick:v,cartCount:g,children:e("header",{id:m||"header","data-ui-component-id":"HeaderNavigation",className:"relative z-[100] bg-white",ref:C,children:l("div",{className:w("hover:bg-white hover:text-black",d==="light"?"text-black":"text-white",{}),children:[e(Ae,{data:n,className:"desktop:block hidden !bg-white",theme:d,onPrimaryNavClick:N}),e(Oe,{data:n,className:"desktop:hidden block !bg-white",onPrimaryNavClick:N}),r&&l("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${C?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[e("div",{ref:L,className:w("overflow-y-auto",{}),children:e($e,{data:Q,keywords:D,isSearching:o,searchResult:f,onSearch:k=>{y?.(k)},onClose:()=>{y?.(),u(!1)}})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>u(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:k=>{(k.key==="Enter"||k.key===" "||k.key==="Escape")&&(k.preventDefault(),u(!1))}})]})]})})})}),Ae=ee((t,a)=>{const{data:n,onNavItemClick:c,className:i,theme:p,onPrimaryNavClick:d}=t,{event:b,profile:f}=W(),[y,o]=B(!1),D=M(()=>ue(n?.categories?.filter(s=>s?.pcShow)),[n]),[N,v]=B(null),[h,m]=B([]),g=j(null),[r,u]=B(!1),P=j(null),S=j(null),L=j(D.map(s=>Array(s?.length||0).fill(null)));H(()=>{D?.length&&m(D?.map((s,E)=>s?.map((z,F)=>({groupIndex:E,index:F,open:!1}))))},[D]);const C=M(()=>{let s=null;for(const E of h){for(const z of E)if(z.open){s=z;break}if(s)break}return s},[h]);H(()=>{document.documentElement.style.overflow=C?.open||r?"hidden":"auto"},[C?.open,r]);const A=(s,E,z)=>{if(u(!1),N?.components?.[0]?.blockType===I.Links)N?.components?.[0]?.url&&window.open(N?.components?.[0]?.url);else{const F=D?.flat()||[],U=F?.findIndex(_=>_?.id===D[E][z]?.id);s.stopPropagation(),c?.(),d?.(F[U],U),v(D[E][z]),m(_=>_.map(we=>we.map(Y=>Y.groupIndex===E&&Y.index===z?{...Y,open:!Y.open}:{...Y,open:!1})))}},Q=(s,E,z)=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),A(s,E,z)):s.key==="Escape"&&C?.groupIndex===E&&C?.index===z&&(s.preventDefault(),k())},k=()=>{m(s=>s.map(E=>E.map(z=>({...z,open:!1}))))},X=M(()=>{if(N)return N?.components?.[0]?.blockType},[N]),J=ie(je,N),xe=de(Fe,N),Ne=ce(_e,{categoriesItem:N,currentNavItemRef:L.current?.[C?.groupIndex||0]?.[C?.index||0]}),ke=M(()=>{switch(X){case I.Sidebar:return e(J,{});case I.Supports:return e(Ne,{});case I.Multicol:return e(xe,{});default:return null}},[X,N]),ne=M(()=>n?.headerBar?.actions?.filter(s=>s?.pcShow),[n]),V=M(()=>ne?.find(s=>s?.blockType===T.Profile),[ne]),le=G(()=>{u(s=>!s)},[]);return H(()=>{if(g?.current){const s=g.current;return s.addEventListener("click",le),()=>{s.removeEventListener("click",le)}}},[le]),re(()=>{C?.open&&oe.fromTo(S?.current,{height:0},{height:"auto"})},[C?.open]),l(te,{className:w("relative h-[96px]",i),children:[l("div",{ref:P,onClick:k,className:"flex h-full flex-col justify-end gap-4",children:[l("div",{className:"flex items-center justify-between",children:[e(ge,{}),e(he,{ref:g,actions:ne,activeStatus:r})]}),e("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:D?.map((s,E)=>e("div",{className:"flex gap-3",children:s?.map((z,F)=>{const U=C?.groupIndex===E&&C?.index===F;return e("div",{ref:_=>{L.current[E][F]=_},className:"group cursor-pointer",children:l("div",{className:"relative",children:[l("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:_=>A(_,E,F),onKeyDown:_=>Q(_,E,F),"aria-expanded":U,"aria-haspopup":"true","aria-label":z.text,children:[e(x,{html:z.text,className:"text-sm font-bold leading-[1.4]"}),e(ae,{"aria-hidden":"true",className:w("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":U,"opacity-100":y&&U})})]}),e("div",{className:w("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":U},p==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},z.id)})},`groupCategory-${E}`))})]}),l("div",{role:"menu","aria-hidden":!(C?.open&&N),className:w("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(C?.open&&N)}),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),style:{height:`calc(100dvh - ${P?.current?.getBoundingClientRect()?.bottom}px)`},children:[e("div",{ref:S,className:w("relative z-50",{"overflow-hidden":X!==I.Supports}),children:ke}),e("div",{className:"flex-1 bg-transparent",onClick:k,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),k())}})]}),r&&l("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[e("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${g?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:f?.email?l(K,{children:[e(x,{html:f?.nick_name||V?.welcome,className:"text-sm font-bold"}),e("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),e("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:V?.profiles?.map(s=>e(Z,{className:"py-2",label:s?.title,href:s?.url},s.id))})]}):l(K,{children:[e(Te,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),e(x,{html:V?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:V?.benefits?.map(s=>l("div",{className:"flex items-center gap-[6px]",children:[e(q,{source:s.benefitIcon?.url,className:"size-4",alt:s.benefit,width:16,height:16}),e(x,{html:s.benefit,className:"text-sm font-bold leading-[1.4]"})]},s.id))}),l("div",{className:"mt-4 flex items-center gap-2",children:[e($,{variant:"secondary",size:"lg",onClick:()=>b?.join?.(),children:e(x,{html:V?.primaryButton||"Join Now",className:"font-bold"})}),e($,{variant:"primary",size:"lg",onClick:()=>b?.login?.(),children:e(x,{html:V?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>u(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),u(!1))}})]})]})}),je=Ce.memo(({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{buildProps:n,onSidebarNavClick:c}=W(),[i,p]=B([]),[d,b]=B(-1),f=j(null),y=G(()=>{const v=t?.subcategories;if(!v?.length)return;const h=v.findIndex(r=>!!r?.subSubCategories),m=v.findIndex(r=>!r?.subSubCategories),g=v.map((r,u)=>({index:u,open:h===u||m===u}));p(g)},[t]);H(()=>{y()},[y]);const o=M(()=>{const v=t?.subcategories?.[i?.find(m=>m.open)?.index||0],h=a?.find(m=>m?.label?.toLowerCase()===v?.label?.toLowerCase())||{};if(v?.collections){const m=n?.categories?.[v?.collections]||{};return{label:h?.label,isCollection:!0,banner:h?.banner,primary:h?.primary,series:[{products:m?.products}]}}else if(v?.subSubCategories){const m=v?.subSubCategories?.[d],g=a?.find(r=>r?.label?.toLowerCase()===m?.label?.toLowerCase())||{};if(m?.collections){const r=n?.categories?.[m?.collections]||{};return{label:g?.label,isCollection:!0,banner:g?.banner,primary:g?.primary,series:[{products:r?.products}]}}else return g}else return h},[t,i,d,a,n]),D=G((v,h)=>{if(h?.subSubCategories?.length>0?b(0):b(-1),h?.subSubCategories?.length>0)p(m=>m.map(g=>g.index===v?{...g,open:!0}:{...g,open:!1}));else{const g=t?.subcategories?.findIndex(r=>!!r?.subSubCategories);p(r=>r.map(u=>({...u,open:u.index===v||u.index===g})))}},[t]),N=(v,h)=>{p(m=>m.map(g=>g.index===v?{...g,open:!0}:{...g,open:!1})),b(h)};return l(te,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[l("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:f,children:[e("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((v,h)=>{const m=Array.isArray(v?.subSubCategories)&&v?.subSubCategories?.length>0,g=i?.find(r=>r.index===h)?.open;return l("div",{children:[l("button",{className:w("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!m&&g}),onClick:()=>{D(h,v),c?.(v,h)},"aria-expanded":m?g:void 0,"aria-haspopup":m?"true":void 0,children:[e(x,{html:v.label,className:"p-4 text-sm font-bold leading-[1.4]"}),m&&e(ae,{"aria-hidden":"true",className:w("size-4",{"rotate-180":g})})]}),g&&e("div",{className:"flex flex-col",role:"menu",children:v.subSubCategories?.map((r,u)=>e("button",{onClick:()=>{N(h,u),c?.(r,u)},className:w("w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left",{"bg-[#F5F5F7]":d===u}),role:"menuitem","aria-label":r.label,children:e(x,{html:r.label,className:"text-sm font-bold leading-[1.4] text-[#6D6D6F] hover:bg-[#F5F5F7]"})},`subSubItem-${h}-${u}`))})]},`subcategoryItem-${h}`)})}),t&&e("div",{className:"flex",children:l("div",{className:"flex flex-col gap-4",children:[t?.primary&&e($,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:t?.primary?.label}),t?.secondary&&e($,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:t?.secondary?.label})]})})]}),l("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(o).length>0&&l("div",{className:"mb-4 flex items-center justify-between",children:[l("div",{className:"flex items-center gap-2",children:[e(x,{html:o?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),o?.primary&&!o?.primary?.hide&&e($,{as:"a",href:`${o?.primary?.url}?ref=${o?.label}_viewmore`,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm font-bold leading-[1.2] no-underline",children:o?.primary?.label})]}),e(O,{href:o?.guide?.url,className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:o?.guide?.label})]}),e("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:o?.series?.map((v,h)=>l("div",{children:[v.label&&e(x,{html:v.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),l("div",{className:"grid grid-cols-3 gap-4",children:[!!o?.banner&&e(O,{asChild:!o?.banner?.href,href:o?.banner?.href,children:l("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(q,{source:o?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),l("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(se,{size:2,html:o?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),e(x,{html:o?.banner?.desc||"20.000mAh",className:"text-sm font-bold text-white"})]})]})}),v.products?.map((m,g)=>e(me,{seriesLabel:o?.label,product:m,isCollection:o?.isCollection},`seriesProductItem-${g}`))]})]},`seriesItem-${h}`))})]})]})}),Fe=({multicolMetadata:t})=>{const a=j(null);return e("div",{ref:a,children:e(te,{childClassName:"bg-white",className:"h-full",children:e("div",{className:"flex gap-4 py-4",children:t?.map((n,c)=>e("div",{className:"w-1/4",children:e(be,{item:n})},`multicolItem-${n?.label}-${c}`))})})})},_e=({supportsMetadata:t,currentNavItemRef:a})=>{const n=j(null),[c,i]=B(null),[p,d]=B(0);H(()=>{if(n?.current){const f=n?.current?.getBoundingClientRect();d(f.height)}},[n]);const b=Me(()=>{if(a){const f=a.getBoundingClientRect();i(f)}},500);return H(()=>(b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}),[b]),H(()=>{if(a){const f=a.getBoundingClientRect();i(f)}},[a]),e("div",{className:"absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${c?.right}px)`,height:p},children:e("div",{ref:n,className:"p-4",children:t?.map(f=>e("div",{className:"py-2",children:e(O,{href:f.url,className:"text-sm font-bold leading-[1.4] no-underline",children:f.label})},f.id))})})},me=({product:t,isCollection:a,position:n,seriesLabel:c})=>{const{buildProps:i,onSeriesProductClick:p}=W();let d=a?t:i?.products?.find(o=>o.handle===t.handle);const b=d?.variants?.find(o=>o.sku===t.sku)||d?.variants?.[0],f=M(()=>`/products/${d?.handle}?variant=${De(b?.id)}`,[d?.handle,b?.id]),y=M(()=>d?.tags?.filter?.(o=>o?.startsWith?.("CLtag"))?.map?.(o=>o?.replace?.("CLtag:",""))?.slice?.(0,2),[d?.tags]);return b?.availableForSale?e(O,{href:f,onClick:o=>{o.preventDefault(),window.open(f,"_self"),p?.(d,n||0,c)},className:"no-underline hover:text-current",children:l("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110",children:[e("div",{className:"shrink-0",children:e(q,{source:`${b?.image?.url||t?.images?.[0]?.url}}`,width:90,height:90,className:"size-[96px]",imgClassName:"object-contain h-full"})}),l("div",{className:"relative",children:[e("div",{className:"flex gap-1",children:Array.isArray(y)&&y?.map(o=>e(x,{as:"p",html:o,className:"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"}))}),e(x,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:d?.title||t?.name}),t?.desc&&e(x,{as:"p",html:t?.desc,className:"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]})}):null},be=({item:t,allPicture:a})=>l(K,{children:[t?.columns&&l(K,{children:[e(x,{html:t.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),e("div",{className:"mt-2 flex flex-col",children:t.columns?.map(n=>l("div",{className:"flex items-center gap-1 py-2",children:[e(O,{href:`${n.url}?ref=navMenu`,asChild:!n.url,className:"text-sm font-bold leading-[1.4] no-underline",children:n.label}),n?.badge&&e(x,{as:"p",html:n?.badge||"badge",className:"text-brand-0 h-[24px] rounded-full border-[1.6px] border-[var(--brand-color-0)] px-[6px] text-sm font-bold !leading-[22px]"})]},n.label))})]}),t?.imageUrl&&e("div",{className:w("laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",{"tablet:max-w-none laptop:max-w-none":a}),children:l(O,{href:`${t.url}?ref=navMenu`,asChild:!t.url,children:[e(q,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),l("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[e(x,{html:t.title,className:w("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":t?.theme==="dark"})}),t.subtitle&&e(x,{html:t.subtitle,className:w("text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"})}),t?.primary?.label&&e($,{as:"a",href:t?.primary?.url,variant:"link",size:"lg",className:w("mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"}),children:t?.primary?.label||"more"})]})]})})]}),Oe=ee(({data:t,className:a,onPrimaryNavClick:n},c)=>{const i=M(()=>ue(t?.categories?.filter(k=>k?.mobileShow)),[t]),{currentMenu:p,setCurrentMenu:d,subSubCategory:b}=W(),[f,y]=B(!1),[o,D]=B(0),[N,v]=B(null),h=j(null);H(()=>{if(h?.current&&f){const k=h?.current?.getBoundingClientRect();D(window?.innerHeight-(k?.bottom||0))}},[f]),re(()=>{oe.fromTo(h.current,{height:0},{height:o,duration:.3})},[o]),H(()=>{document.documentElement.style.overflow=f?"hidden":"auto"},[f]);const m=M(()=>N?.components?.[0]?.blockType,[N]),g=ce(Ke,{categoriesItem:N}),r=ie(We,N),u=de(Ue,N),P=M(()=>{switch(m){case I.Sidebar:return e(r,{});case I.Supports:return e(g,{});case I.Multicol:return e(u,{});default:return null}},[m,N,g]),S=G(()=>{y(!1),D(0),d&&d(R.Primary)},[y,D,d]),L=M(()=>t?.headerBar?.actions?.filter(k=>k?.mobileShow&&k?.blockType!==T.Profile),[t]),C=M(()=>t?.headerBar?.actions?.find(k=>k?.mobileShow&&k?.blockType===T.Profile)||{},[t]),A=M(()=>{switch(p){case R.Primary:return e(Je,{actions:L,menuOpen:f,onMenuOpenClose:()=>{y(!1),D(0)},onMenuOpenClick:()=>y(!0)});case R.Secondary:return e(ye,{title:N?.text,onMenuOpenClose:S,onMenuBackClick:()=>d?.(R.Primary)});case R.Third:return e(ye,{title:b?.label,onMenuOpenClose:S,onMenuBackClick:()=>d?.(R.Secondary)});default:return null}},[f,p,d,N,L,b,S]),Q=G((k,X)=>{const J=Array.isArray(i)?Array.isArray(i[k])?i[k][X]:{}:{};v(J),J?.components?.[0]?.blockType===I.Links?J?.components?.[0]?.url&&window.open(J?.components?.[0]?.url):d?.(R.Secondary)},[i,d]);return l(te,{className:w("relative h-[52px]",a),children:[A,f&&e("nav",{ref:h,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:o},role:"navigation","aria-label":"Mobile navigation menu",children:p===R.Primary?e(Ie,{categories:i,onPrimaryMenuClick:Q,onPrimaryNavClick:n,profileAction:C}):P})]})}),Ie=({categories:t,onPrimaryMenuClick:a,profileAction:n,onPrimaryNavClick:c})=>l("div",{className:"flex h-full flex-col justify-between",children:[e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((i,p)=>l("div",{className:"",children:[i?.map((d,b)=>e(Z,{label:d.text,onClick:()=>{const y=(t?.flat()||[])?.findIndex(o=>o?.id===t[p][b]?.id);a(p,b),c?.(d,y)},icon:d.components?.[0]?.icon},d.id)),e("div",{className:w("my-2 h-px w-full bg-[#E5E5E7]",{hidden:p===t.length-1})})]},`groupCategory-${p}`))}),e(Ge,{profileAction:n})]}),We=({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{currentMenu:n,setCurrentMenu:c,subSubCategory:i,setSubSubCategory:p,setCurrentSeriesMetadata:d,currentSeriesMetadata:b,buildProps:f,onSidebarNavClick:y}=W(),[o,D]=B([]),[N,v]=B([]);H(()=>{t?.subcategories?.length&&D(t?.subcategories?.map((r,u)=>({index:u,open:!1})))},[t]),H(()=>{i?.subSubCategories?.length&&v(i?.subSubCategories?.map((r,u)=>({index:u,open:u===0})))},[i]);const h=G((r,u)=>{c&&c(R.Third),p?.(r);const P=a?.find(S=>u!==void 0?r?.subSubCategories?.[u]?.label?.toLowerCase()===S.label?.toLowerCase():r?.label?.toLowerCase()===S.label?.toLowerCase())||{};if(r?.collections){const S=f?.categories?.[r?.collections]||{};d?.({label:P?.label,isCollection:!0,banner:P?.banner,primary:P?.primary,series:[{products:S?.products}]})}else d?.(P)},[a,c,p,d,f?.categories]),m=M(()=>a?.find(r=>!!r?.guide)?.guide,[a]);return M(()=>{switch(n){case R.Secondary:return l("div",{className:"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4",children:[e("div",{children:t?.subcategories?.map((r,u)=>e("div",{children:e(Z,{label:r?.label,active:o.find(P=>P.index===u)?.open,onClick:()=>{h(r),y?.(r,u)}})},`${r.label}-${u}`))}),l("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&e($,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:t?.primary?.label}),t?.secondary&&e($,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:t?.secondary?.label})]})]});case R.Third:return l("div",{className:"tablet:px-8 laptop:px-16 p-4",children:[i?.subSubCategories?i?.subSubCategories?.map((r,u)=>{const P=a?.find(L=>L.label.toLowerCase()===r?.label?.toLowerCase())||{};let S={};if(r?.collections){const L=f?.categories?.[r?.collections]||{};S={label:P?.label,isCollection:!0,banner:P?.banner,primary:P?.primary,series:[{products:L?.products}]}}else S=P;return l("div",{children:[Reflect.ownKeys(r).length>0&&e(fe,{matchSeriesMetadata:S,onSubSubCategoryItemClick:()=>{y?.(r,u),v(L=>L.map((C,A)=>({...C,open:A===u?!C.open:C.open})))},expanded:!!N?.find(L=>L.index===u)?.open}),N?.find(L=>L.index===u)?.open&&l(K,{children:[e(ve,{matchSeriesMetadata:S}),S?.primary&&e("div",{className:"my-4 text-center",children:e($,{as:"a",href:S?.primary?.url,className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:S?.primary?.label})})]})]},`${r.label}-${u}`)}):l(K,{children:[Reflect.ownKeys(b).length>0&&e(fe,{matchSeriesMetadata:b}),e(ve,{matchSeriesMetadata:b}),b?.primary&&e("div",{className:"my-4 text-center ",children:e($,{as:"a",href:`${b?.primary?.url}?ref=${b?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:b?.primary?.label})})]}),m&&e(O,{href:m?.url,children:e("div",{className:"mt-4",children:e(x,{html:m?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]});default:return null}},[n,t,a,o,N,i,b,f?.categories,m,h,y])},fe=({matchSeriesMetadata:t,onSubSubCategoryItemClick:a,expanded:n})=>{const c=l(K,{children:[t?.label&&e(x,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),a&&e(ae,{"aria-hidden":"true",className:w("size-5",{"rotate-180":n})})]});return a?e("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:a,"aria-expanded":n,children:c}):e("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:c})},ve=({matchSeriesMetadata:t})=>e("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((a,n)=>l("div",{children:[a.label&&e(x,{html:a.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),l("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&e(O,{asChild:!t?.banner?.href,href:t?.banner?.href,children:l("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(q,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),l("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(se,{size:2,html:t?.banner?.title||"Buy in Guide",className:w("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),e(x,{html:t?.banner?.desc||"20.000mAh",className:w("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),a.products?.map((c,i)=>e(me,{position:i,product:c,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${n}-${i}`))]})]},`seriesItem-${n}`))}),Ke=({supportsMetadata:t})=>e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map(a=>e(Z,{href:a.url,label:a.label,onClick:()=>{}},a.id))}),Ue=({multicolMetadata:t})=>{const a=M(()=>!t?.some(n=>!!n.columns),[t]);return e("div",{className:w("tablet:py-4 tablet:px-8 laptop:px-16 tablet:gap-6 flex flex-col gap-4 p-4",{"tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4":a}),children:t?.map((n,c)=>e("div",{children:e(be,{item:n,allPicture:a})},`multicolItem-${n?.label}-${c}`))})},Ge=({profileAction:t})=>{const[a,n]=B(!1),{profile:c,event:i}=W();return l("div",{className:w("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":a}),children:[l("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>n(!a),"aria-expanded":a,"aria-label":c?.nick_name||t?.welcome,children:[l("div",{className:"flex items-center gap-[14px]",children:[e("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:e(Be,{"aria-hidden":"true"})}),e(x,{html:c?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&e(ae,{"aria-hidden":"true",className:w("laptop:size-4 size-5",{"rotate-180":a})})]}),c?.email&&e("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:t?.profiles?.map(p=>e(Z,{label:p?.title,href:p?.url},p.id))}),a&&!c?.email&&l("div",{className:"mt-4",children:[e(x,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(p=>l("div",{className:"flex items-center gap-[6px]",children:[e(q,{source:p.benefitIcon?.url,className:"size-4",alt:p.benefit,width:16,height:16}),e(x,{html:p.benefit,className:"text-sm font-bold leading-[1.4]"})]},p.id))})]}),!c?.email&&l("div",{className:"mt-4 flex items-center gap-3",children:[e($,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>i?.join?.(),children:e(x,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),e($,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>i?.login?.(),children:e(x,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Je=({menuOpen:t,onMenuOpenClose:a,onMenuOpenClick:n,actions:c})=>l("div",{className:"flex h-full items-center justify-between gap-4",children:[e(ge,{}),l("div",{className:"desktop:gap-6 flex items-center gap-4",children:[e(he,{actions:c}),t?e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>a(),"aria-label":"Close menu","aria-expanded":"true",children:e(pe,{className:"size-5","aria-hidden":"true"})}):e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:e(Ee,{className:"size-5","aria-hidden":"true"})})]})]}),ge=()=>{const{payloadData:t,isMobile:a}=W();return e("a",{href:"/",className:"hover:text-brand-0 [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:a?t?.headerBar?.mobileLogo:t?.headerBar?.desktopLogo}})},he=ee(({actions:t,activeStatus:a=!1},n)=>{const{event:c,cartCount:i}=W(),[p,d]=B(null),b=y=>{switch(y){case T.Search:return"Search";case T.Cart:return`Shopping cart${i>0?` (${i} items)`:""}`;case T.Profile:return"User profile";case T.Livestream:return"Livestream";default:return"Action"}},f=G((y,o)=>{switch(d(o),y?.blockType){case T.Search:c?.search?.();break;case T.Cart:c?.cart?.();break;case T.Profile:c?.profile?.();break;case T.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return e("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((y,o)=>l("button",{className:"relative cursor-pointer border-0 bg-transparent p-0",ref:y.blockType===T.Profile?n:null,onClick:()=>f(y,o),"aria-label":b(y.blockType),"aria-pressed":a&&p===o,children:[e(x,{html:y.icon,className:w("size-5",{"text-brand-0":a&&p===o}),"aria-hidden":"true"}),y.blockType===T.Cart&&i>0&&e("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:e(x,{html:i?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},y.id))})}),ye=({title:t,onMenuOpenClose:a,onMenuBackClick:n})=>l("div",{className:"flex h-full items-center gap-3",children:[e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Back to previous menu",children:e(He,{className:"size-5","aria-hidden":"true"})}),e(x,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>a(),"aria-label":"Close menu",children:e(pe,{className:"size-5","aria-hidden":"true"})})]}),Z=({label:t,href:a,onClick:n,active:c,icon:i,className:p})=>{const d=l(K,{children:[l("div",{className:"flex items-center gap-4",children:[e(x,{html:t,className:w("text-sm font-bold leading-[1.4]",{underline:i})}),i&&e(x,{html:i,"aria-hidden":"true"})]}),e(ze,{className:w("laptop:size-4 size-5",{"rotate-90":c}),"aria-hidden":"true"})]});return a?e(O,{href:a,className:w("flex cursor-pointer items-center justify-between py-4 no-underline",p),children:d}):e("button",{className:w("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",p),onClick:n,"aria-expanded":c,children:d})};var it=Re;export{it as default};
|
|
1
|
+
"use client";import{Fragment as U,jsx as e,jsxs as l}from"react/jsx-runtime";import Ce,{forwardRef as ee,useCallback as V,useEffect as H,useImperativeHandle as Se,useMemo as L,useRef as j,useState as B}from"react";import{Picture as X,Text as h,Button as R,Container as te,Link as O,Heading as ie,BrandStrip as De}from"../../components/index.js";import"../../shared/Styles.js";import{cn as k,atobID as Le}from"../../helpers/utils.js";import Me,{useNavContext as K}from"./NavProvider.js";import{HeaderNavigationMenu as A,HeaderNavigationBlockType as I,HeaderNavigationActionBlockType as T}from"./types.js";import{debounce as Pe}from"es-toolkit";import Ee from"jump.js";import{useGSAP as oe}from"@gsap/react";import{gsap as se}from"gsap";import{WithSidebar as ce,WithSupports as de,WithMulticol as ue,WithGroupCategory as pe}from"./withCategory.js";import{Menu as Be,Close as me,User as ze,RightArrow as He,LeftArrow as Te,DownArrow as ae,Polygon as $e}from"./icons/index.js";import Re from"../NavigationSearch/index.js";const Ae=ee((t,a)=>{const{data:{headerNavigation:n}={},menuData:i,buildProps:b,event:c,profile:f,theme:p="light",isTop:y=!1,searchResult:v,onSearch:r,isSearching:M,keywords:w,onPrimaryNavClick:d,onSeriesProductClick:x,onSidebarNavClick:m,headerId:g,cartCount:o}=t,[u,S]=B(!1),[D,P]=B(!1),C=j(null),$=j(null),G=()=>{const N=document?.querySelector("body")?.offsetWidth||0;P(N<=1440)};H(()=>(G(),window.addEventListener("resize",G),()=>{window.removeEventListener("resize",G)}),[]),Se(a,()=>$.current),H(()=>{$.current&&y&&Ee($.current,{duration:0,offset:$.current?.getBoundingClientRect()?.bottom||0})},[y]),H(()=>{c&&(c.search=()=>S(!0))},[c]),oe(()=>{C?.current&&u&&se.fromTo(C.current,{height:0},{height:"auto",duration:.3})},[u]),H(()=>{document.documentElement.style.overflow=u?"hidden":"auto"},[u]);const W=L(()=>n?.headerBar?.actions?.find(N=>N?.blockType===T.Search)?.searchBar?.[0]||{},[n]);return e(Me,{buildProps:b,profile:f,isMobile:D,event:c,payloadData:n,onSidebarNavClick:m,onSeriesProductClick:x,cartCount:o,children:e("header",{id:g||"header","data-ui-component-id":"HeaderNavigation",className:"relative z-[100] bg-white",ref:$,children:l("div",{className:k("hover:bg-white hover:text-black",p==="light"?"text-black":"text-white",{}),children:[e(je,{data:n,className:"desktop:block hidden !bg-white",theme:p,onPrimaryNavClick:d}),e(Ie,{data:n,menuData:i,className:"desktop:hidden block !bg-white",onPrimaryNavClick:d}),u&&l("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${$?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[e("div",{ref:C,className:k("overflow-y-auto",{}),children:e(Re,{data:W,keywords:w,isSearching:M,searchResult:v,onSearch:N=>{r?.(N)},onClose:()=>{r?.(),S(!1)}})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>S(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:N=>{(N.key==="Enter"||N.key===" "||N.key==="Escape")&&(N.preventDefault(),S(!1))}})]})]})})})}),je=ee((t,a)=>{const{data:n,onNavItemClick:i,className:b,theme:c,onPrimaryNavClick:f}=t,{event:p,profile:y}=K(),[v,r]=B(!1),M=L(()=>pe(n?.categories?.filter(s=>s?.pcShow)),[n]),[w,d]=B(null),[x,m]=B([]),g=j(null),[o,u]=B(!1),S=j(null),D=j(null),P=j(M.map(s=>Array(s?.length||0).fill(null)));H(()=>{M?.length&&m(M?.map((s,E)=>s?.map((z,F)=>({groupIndex:E,index:F,open:!1}))))},[M]);const C=L(()=>{let s=null;for(const E of x){for(const z of E)if(z.open){s=z;break}if(s)break}return s},[x]);H(()=>{document.documentElement.style.overflow=C?.open||o?"hidden":"auto"},[C?.open,o]);const $=(s,E,z)=>{if(u(!1),w?.components?.[0]?.blockType===I.Links)w?.components?.[0]?.url&&window.open(w?.components?.[0]?.url);else{const F=M?.flat()||[],J=F?.findIndex(_=>_?.id===M[E][z]?.id);s.stopPropagation(),i?.(),f?.(F[J],J),d(M[E][z]),m(_=>_.map(we=>we.map(Y=>Y.groupIndex===E&&Y.index===z?{...Y,open:!Y.open}:{...Y,open:!1})))}},G=(s,E,z)=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),$(s,E,z)):s.key==="Escape"&&C?.groupIndex===E&&C?.index===z&&(s.preventDefault(),W())},W=()=>{m(s=>s.map(E=>E.map(z=>({...z,open:!1}))))},N=L(()=>{if(w)return w?.components?.[0]?.blockType},[w]),ne=ce(Fe,w),q=ue(_e,w),Ne=de(Oe,{categoriesItem:w,currentNavItemRef:P.current?.[C?.groupIndex||0]?.[C?.index||0]}),ke=L(()=>{switch(N){case I.Sidebar:return e(ne,{});case I.Supports:return e(Ne,{});case I.Multicol:return e(q,{});default:return null}},[N,w]),le=L(()=>n?.headerBar?.actions?.filter(s=>s?.pcShow),[n]),Q=L(()=>le?.find(s=>s?.blockType===T.Profile),[le]),re=V(()=>{u(s=>!s)},[]);return H(()=>{if(g?.current){const s=g.current;return s.addEventListener("click",re),()=>{s.removeEventListener("click",re)}}},[re]),oe(()=>{C?.open&&se.fromTo(D?.current,{height:0},{height:"auto"})},[C?.open]),l(te,{className:k("relative h-[96px]",b),children:[l("div",{ref:S,onClick:W,className:"flex h-full flex-col justify-end gap-4",children:[l("div",{className:"flex items-center justify-between",children:[e(he,{}),e(ye,{ref:g,actions:le,activeStatus:o})]}),e("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:M?.map((s,E)=>e("div",{className:"flex gap-3",children:s?.map((z,F)=>{const J=C?.groupIndex===E&&C?.index===F;return e("div",{ref:_=>{P.current[E][F]=_},className:"group cursor-pointer",children:l("div",{className:"relative",children:[l("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:_=>$(_,E,F),onKeyDown:_=>G(_,E,F),"aria-expanded":J,"aria-haspopup":"true","aria-label":z.text,children:[e(h,{html:z.text,className:"text-sm font-bold leading-[1.4]"}),e(ae,{"aria-hidden":"true",className:k("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":J,"opacity-100":v&&J})})]}),e("div",{className:k("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":J},c==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},z.id)})},`groupCategory-${E}`))})]}),l("div",{role:"menu","aria-hidden":!(C?.open&&w),className:k("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(C?.open&&w)}),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),style:{height:`calc(100dvh - ${S?.current?.getBoundingClientRect()?.bottom}px)`},children:[e("div",{ref:D,className:k("relative z-50",{"overflow-hidden":N!==I.Supports}),children:ke}),e("div",{className:"flex-1 bg-transparent",onClick:W,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),W())}})]}),o&&l("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[e("div",{className:"absolute w-[272px] bg-white p-4",style:{right:`calc(100% - ${g?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:y?.email?l(U,{children:[e(h,{html:y?.nick_name||Q?.welcome,className:"text-sm font-bold"}),e("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),e("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:Q?.profiles?.map(s=>e(Z,{className:"py-2",label:s?.title,href:s?.url},s.id))})]}):l(U,{children:[e($e,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),e(h,{html:Q?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:Q?.benefits?.map(s=>l("div",{className:"flex items-center gap-[6px]",children:[e(X,{source:s.benefitIcon?.url,className:"size-4",alt:s.benefit,width:16,height:16}),e(h,{html:s.benefit,className:"text-sm font-bold leading-[1.4]"})]},s.id))}),l("div",{className:"mt-4 flex items-center gap-2",children:[e(R,{variant:"secondary",size:"lg",onClick:()=>p?.join?.(),children:e(h,{html:Q?.primaryButton||"Join Now",className:"font-bold"})}),e(R,{variant:"primary",size:"lg",onClick:()=>p?.login?.(),children:e(h,{html:Q?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>u(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:s=>{(s.key==="Enter"||s.key===" "||s.key==="Escape")&&(s.preventDefault(),u(!1))}})]})]})}),Fe=Ce.memo(({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{buildProps:n,onSidebarNavClick:i}=K(),[b,c]=B([]),[f,p]=B(-1),y=j(null),v=V(()=>{const d=t?.subcategories;if(!d?.length)return;const x=d.findIndex(o=>!!o?.subSubCategories),m=d.findIndex(o=>!o?.subSubCategories),g=d.map((o,u)=>({index:u,open:x===u||m===u}));c(g)},[t]);H(()=>{v()},[v]);const r=L(()=>{const d=t?.subcategories?.[b?.find(m=>m.open)?.index||0],x=a?.find(m=>m?.label?.toLowerCase()===d?.label?.toLowerCase())||{};if(d?.collections){const m=n?.categories?.[d?.collections]||{};return{label:x?.label,isCollection:!0,banner:x?.banner,primary:x?.primary,series:[{products:m?.products}]}}else if(d?.subSubCategories){const m=d?.subSubCategories?.[f],g=a?.find(o=>o?.label?.toLowerCase()===m?.label?.toLowerCase())||{};if(m?.collections){const o=n?.categories?.[m?.collections]||{};return{label:g?.label,isCollection:!0,banner:g?.banner,primary:g?.primary,series:[{products:o?.products}]}}else return g}else return x},[t,b,f,a,n]),M=V((d,x)=>{if(x?.subSubCategories?.length>0?p(0):p(-1),x?.subSubCategories?.length>0)c(m=>m.map(g=>g.index===d?{...g,open:!0}:{...g,open:!1}));else{const g=t?.subcategories?.findIndex(o=>!!o?.subSubCategories);c(o=>o.map(u=>({...u,open:u.index===d||u.index===g})))}},[t]),w=(d,x)=>{c(m=>m.map(g=>g.index===d?{...g,open:!0}:{...g,open:!1})),p(x)};return l(te,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[l("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:y,children:[e("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((d,x)=>{const m=Array.isArray(d?.subSubCategories)&&d?.subSubCategories?.length>0,g=b?.find(o=>o.index===x)?.open;return l("div",{children:[l("button",{className:k("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!m&&g}),onClick:()=>{M(x,d),i?.(d,x)},"aria-expanded":m?g:void 0,"aria-haspopup":m?"true":void 0,children:[e(h,{html:d.label,className:"p-4 text-sm font-bold leading-[1.4]"}),m&&e(ae,{"aria-hidden":"true",className:k("size-4",{"rotate-180":g})})]}),g&&e("div",{className:"flex flex-col",role:"menu",children:d.subSubCategories?.map((o,u)=>e("button",{onClick:()=>{w(x,u),i?.(o,u)},className:k("w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left",{"bg-[#F5F5F7]":f===u}),role:"menuitem","aria-label":o.label,children:e(h,{html:o.label,className:"text-sm font-bold leading-[1.4] text-[#6D6D6F] hover:bg-[#F5F5F7]"})},`subSubItem-${x}-${u}`))})]},`subcategoryItem-${x}`)})}),t&&e("div",{className:"flex",children:l("div",{className:"flex flex-col gap-4",children:[t?.primary&&e(R,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:t?.primary?.label}),t?.secondary&&e(R,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:t?.secondary?.label})]})})]}),l("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(r).length>0&&l("div",{className:"mb-4 flex items-center justify-between",children:[l("div",{className:"flex items-center gap-2",children:[e(h,{html:r?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),r?.primary&&!r?.primary?.hide&&e(R,{as:"a",href:`${r?.primary?.url}?ref=${r?.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:r?.primary?.label})]}),e(O,{href:r?.guide?.url,className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:r?.guide?.label})]}),e("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:r?.series?.map((d,x)=>l("div",{children:[d.label&&e(h,{html:d.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),l("div",{className:"grid grid-cols-3 gap-4",children:[!!r?.banner&&e(O,{asChild:!r?.banner?.href,href:r?.banner?.href,children:l("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(X,{source:r?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),l("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(ie,{size:2,html:r?.banner?.title||"Buy in Guide",className:"font-bold text-white"}),e(h,{html:r?.banner?.desc||"20.000mAh",className:"text-sm font-bold text-white"})]})]})}),d.products?.map((m,g)=>e(be,{seriesLabel:r?.label,product:m,isCollection:r?.isCollection},`seriesProductItem-${g}`))]})]},`seriesItem-${x}`))})]})]})}),_e=({multicolMetadata:t})=>{const a=j(null);return e("div",{ref:a,children:e(te,{childClassName:"bg-white",className:"h-full",children:e("div",{className:"flex gap-4 py-4",children:t?.map((n,i)=>e("div",{className:"w-1/4",children:e(fe,{item:n})},`multicolItem-${n?.label}-${i}`))})})})},Oe=({supportsMetadata:t,currentNavItemRef:a})=>{const n=j(null),[i,b]=B(null),[c,f]=B(0);H(()=>{if(n?.current){const y=n?.current?.getBoundingClientRect();f(y.height)}},[n]);const p=Pe(()=>{if(a){const y=a.getBoundingClientRect();b(y)}},500);return H(()=>(p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}),[p]),H(()=>{if(a){const y=a.getBoundingClientRect();b(y)}},[a]),e("div",{className:"absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${i?.right}px)`,height:c},children:e("div",{ref:n,className:"p-4",children:t?.map(y=>e("div",{className:"py-2",children:e(O,{href:y.url,className:"text-sm font-bold leading-[1.4] no-underline",children:y.label})},y.id))})})},be=({product:t,isCollection:a,position:n,seriesLabel:i})=>{const{buildProps:b,onSeriesProductClick:c}=K();let f=a?t:b?.products?.find(r=>r.handle===t.handle);const p=f?.variants?.find(r=>r.sku===t.sku)||f?.variants?.[0],y=L(()=>`/products/${f?.handle}?variant=${Le(p?.id)}`,[f?.handle,p?.id]),v=L(()=>f?.tags?.filter?.(r=>r?.startsWith?.("CLtag"))?.map?.(r=>r?.replace?.("CLtag:",""))?.slice?.(0,2),[f?.tags]);return p?.availableForSale?e(O,{href:y,onClick:r=>{r.preventDefault(),window.open(y,"_self"),c?.(f,n||0,i)},className:"no-underline hover:text-current",children:l("div",{className:"flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110",children:[e("div",{className:"shrink-0",children:e(X,{source:`${p?.image?.url||t?.images?.[0]?.url}}`,width:90,height:90,className:"size-[96px]",imgClassName:"object-contain h-full"})}),l("div",{className:"relative",children:[e("div",{className:"flex gap-1",children:Array.isArray(v)&&v?.map(r=>e(h,{as:"p",html:r,className:"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"}))}),e(h,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:f?.title||t?.name}),t?.desc&&e(h,{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},fe=({item:t,allPicture:a})=>l(U,{children:[t?.columns&&l(U,{children:[e(h,{html:t.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),e("div",{className:"mt-2 flex flex-col",children:t.columns?.map(n=>l("div",{className:"flex items-center gap-1 py-2",children:[e(O,{href:`${n.url}?ref=navMenu`,asChild:!n.url,className:"text-sm font-bold leading-[1.4] no-underline",children:n.label}),n?.badge&&e(h,{as:"p",html:n?.badge||"badge",className:"text-brand-0 h-[24px] rounded-full border-[1.6px] border-[var(--brand-color-0)] px-[6px] text-sm font-bold !leading-[22px]"})]},n.label))})]}),t?.imageUrl&&e("div",{className:k("laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",{"tablet:max-w-none laptop:max-w-none":a}),children:l(O,{href:`${t.url}?ref=navMenu`,asChild:!t.url,children:[e(X,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),l("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[e(h,{html:t.title,className:k("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":t?.theme==="dark"})}),t.subtitle&&e(h,{html:t.subtitle,className:k("text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"})}),t?.primary?.label&&e(R,{as:"a",href:t?.primary?.url,variant:"link",size:"lg",className:k("mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":t?.theme==="dark"}),children:t?.primary?.label||"more"})]})]})})]}),Ie=ee(({data:t,menuData:a,className:n,onPrimaryNavClick:i},b)=>{const c=L(()=>pe(t?.categories?.filter(N=>N?.mobileShow)),[t]),{currentMenu:f,setCurrentMenu:p,subSubCategory:y}=K(),[v,r]=B(!1),[M,w]=B(0),[d,x]=B(null),m=j(null);H(()=>{if(m?.current&&v){const N=m?.current?.getBoundingClientRect();w(window?.innerHeight-(N?.bottom||0))}},[v]),oe(()=>{se.fromTo(m.current,{height:0},{height:M,duration:.3})},[M]),H(()=>{document.documentElement.style.overflow=v?"hidden":"auto"},[v]);const g=L(()=>d?.components?.[0]?.blockType,[d]),o=de(Ue,{categoriesItem:d}),u=ce(Ke,d),S=ue(Ge,d),D=L(()=>{switch(g){case I.Sidebar:return e(u,{});case I.Supports:return e(o,{});case I.Multicol:return e(S,{});default:return null}},[g,d,o]),P=V(()=>{r(!1),w(0),p&&p(A.Primary)},[r,w,p]),C=L(()=>t?.headerBar?.actions?.filter(N=>N?.mobileShow&&N?.blockType!==T.Profile),[t]),$=L(()=>t?.headerBar?.actions?.find(N=>N?.mobileShow&&N?.blockType===T.Profile)||{},[t]),G=L(()=>{switch(f){case A.Primary:return e(Ve,{actions:C,menuOpen:v,onMenuOpenClose:()=>{r(!1),w(0)},onMenuOpenClick:()=>r(!0)});case A.Secondary:return e(xe,{title:d?.text,onMenuOpenClose:P,onMenuBackClick:()=>p?.(A.Primary)});case A.Third:return e(xe,{title:y?.label,onMenuOpenClose:P,onMenuBackClick:()=>p?.(A.Secondary)});default:return null}},[v,f,p,d,C,y,P]),W=V((N,ne)=>{const q=Array.isArray(c)?Array.isArray(c[N])?c[N][ne]:{}:{};x(q),q?.components?.[0]?.blockType===I.Links?q?.components?.[0]?.url&&window.open(q?.components?.[0]?.url):p?.(A.Secondary)},[c,p]);return l(te,{className:k("relative h-[52px]",n),children:[G,e(De,{data:a}),v&&e("nav",{ref:m,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:f===A.Primary?e(We,{categories:c,onPrimaryMenuClick:W,onPrimaryNavClick:i,profileAction:$}):D})]})}),We=({categories:t,onPrimaryMenuClick:a,profileAction:n,onPrimaryNavClick:i})=>l("div",{className:"flex h-full flex-col justify-between",children:[e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((b,c)=>l("div",{className:"",children:[b?.map((f,p)=>e(Z,{label:f.text,onClick:()=>{const v=(t?.flat()||[])?.findIndex(r=>r?.id===t[c][p]?.id);a(c,p),i?.(f,v)},icon:f.components?.[0]?.icon},f.id)),e("div",{className:k("my-2 h-px w-full bg-[#E5E5E7]",{hidden:c===t.length-1})})]},`groupCategory-${c}`))}),e(Je,{profileAction:n})]}),Ke=({sidebarCategoriesMetadata:t,seriesMetadata:a})=>{const{currentMenu:n,setCurrentMenu:i,subSubCategory:b,setSubSubCategory:c,setCurrentSeriesMetadata:f,currentSeriesMetadata:p,buildProps:y,onSidebarNavClick:v}=K(),[r,M]=B([]),[w,d]=B([]);H(()=>{t?.subcategories?.length&&M(t?.subcategories?.map((o,u)=>({index:u,open:!1})))},[t]),H(()=>{b?.subSubCategories?.length&&d(b?.subSubCategories?.map((o,u)=>({index:u,open:u===0})))},[b]);const x=V((o,u)=>{i&&i(A.Third),c?.(o);const S=a?.find(D=>u!==void 0?o?.subSubCategories?.[u]?.label?.toLowerCase()===D.label?.toLowerCase():o?.label?.toLowerCase()===D.label?.toLowerCase())||{};if(o?.collections){const D=y?.categories?.[o?.collections]||{};f?.({label:S?.label,isCollection:!0,banner:S?.banner,primary:S?.primary,series:[{products:D?.products}]})}else f?.(S)},[a,i,c,f,y?.categories]),m=L(()=>a?.find(o=>!!o?.guide)?.guide,[a]);return L(()=>{switch(n){case A.Secondary:return l("div",{className:"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4",children:[e("div",{children:t?.subcategories?.map((o,u)=>e("div",{children:e(Z,{label:o?.label,active:r.find(S=>S.index===u)?.open,onClick:()=>{x(o),v?.(o,u)}})},`${o.label}-${u}`))}),l("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&e(R,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:t?.primary?.label}),t?.secondary&&e(R,{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 A.Third:return l("div",{className:"tablet:px-8 laptop:px-16 p-4",children:[b?.subSubCategories?b?.subSubCategories?.map((o,u)=>{const S=a?.find(P=>P.label.toLowerCase()===o?.label?.toLowerCase())||{};let D={};if(o?.collections){const P=y?.categories?.[o?.collections]||{};D={label:S?.label,isCollection:!0,banner:S?.banner,primary:S?.primary,series:[{products:P?.products}]}}else D=S;return l("div",{children:[Reflect.ownKeys(o).length>0&&e(ve,{matchSeriesMetadata:D,onSubSubCategoryItemClick:()=>{v?.(o,u),d(P=>P.map((C,$)=>({...C,open:$===u?!C.open:C.open})))},expanded:!!w?.find(P=>P.index===u)?.open}),w?.find(P=>P.index===u)?.open&&l(U,{children:[e(ge,{matchSeriesMetadata:D}),D?.primary&&e("div",{className:"my-4 text-center",children:e(R,{as:"a",href:D?.primary?.url,className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:D?.primary?.label})})]})]},`${o.label}-${u}`)}):l(U,{children:[Reflect.ownKeys(p).length>0&&e(ve,{matchSeriesMetadata:p}),e(ge,{matchSeriesMetadata:p}),p?.primary&&e("div",{className:"my-4 text-center ",children:e(R,{as:"a",href:`${p?.primary?.url}?ref=${p?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:p?.primary?.label})})]}),m&&e(O,{href:m?.url,children:e("div",{className:"mt-4",children:e(h,{html:m?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]});default:return null}},[n,t,a,r,w,b,p,y?.categories,m,x,v])},ve=({matchSeriesMetadata:t,onSubSubCategoryItemClick:a,expanded:n})=>{const i=l(U,{children:[t?.label&&e(h,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),a&&e(ae,{"aria-hidden":"true",className:k("size-5",{"rotate-180":n})})]});return a?e("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:a,"aria-expanded":n,children:i}):e("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:i})},ge=({matchSeriesMetadata:t})=>e("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((a,n)=>l("div",{children:[a.label&&e(h,{html:a.label,className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),l("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&e(O,{asChild:!t?.banner?.href,href:t?.banner?.href,children:l("div",{className:"[&_img]:hover:duration-600 relative [&_img]:hover:scale-110 [&_img]:hover:transition-all",children:[e(X,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),l("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(ie,{size:2,html:t?.banner?.title||"Buy in Guide",className:k("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),e(h,{html:t?.banner?.desc||"20.000mAh",className:k("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),a.products?.map((i,b)=>e(be,{position:b,product:i,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${n}-${b}`))]})]},`seriesItem-${n}`))}),Ue=({supportsMetadata:t})=>e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map(a=>e(Z,{href:a.url,label:a.label,onClick:()=>{}},a.id))}),Ge=({multicolMetadata:t})=>{const a=L(()=>!t?.some(n=>!!n.columns),[t]);return e("div",{className:k("tablet:py-4 tablet:px-8 laptop:px-16 tablet:gap-6 flex flex-col gap-4 p-4",{"tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4":a}),children:t?.map((n,i)=>e("div",{children:e(fe,{item:n,allPicture:a})},`multicolItem-${n?.label}-${i}`))})},Je=({profileAction:t})=>{const[a,n]=B(!1),{profile:i,event:b}=K();return l("div",{className:k("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":a}),children:[l("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>n(!a),"aria-expanded":a,"aria-label":i?.nick_name||t?.welcome,children:[l("div",{className:"flex items-center gap-[14px]",children:[e("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:e(ze,{"aria-hidden":"true"})}),e(h,{html:i?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!i?.email&&e(ae,{"aria-hidden":"true",className:k("laptop:size-4 size-5",{"rotate-180":a})})]}),i?.email&&e("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:t?.profiles?.map(c=>e(Z,{label:c?.title,href:c?.url},c.id))}),a&&!i?.email&&l("div",{className:"mt-4",children:[e(h,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(c=>l("div",{className:"flex items-center gap-[6px]",children:[e(X,{source:c.benefitIcon?.url,className:"size-4",alt:c.benefit,width:16,height:16}),e(h,{html:c.benefit,className:"text-sm font-bold leading-[1.4]"})]},c.id))})]}),!i?.email&&l("div",{className:"mt-4 flex items-center gap-3",children:[e(R,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>b?.join?.(),children:e(h,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),e(R,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>b?.login?.(),children:e(h,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Ve=({menuOpen:t,onMenuOpenClose:a,onMenuOpenClick:n,actions:i})=>l("div",{className:"flex h-full items-center justify-between gap-4",children:[e(he,{}),l("div",{className:"desktop:gap-6 flex items-center gap-4",children:[e(ye,{actions:i}),t?e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>a(),"aria-label":"Close menu","aria-expanded":"true",children:e(me,{className:"size-5","aria-hidden":"true"})}):e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:e(Be,{className:"size-5","aria-hidden":"true"})})]})]}),he=()=>{const{payloadData:t,isMobile:a}=K();return e("a",{href:"/",className:"hover:text-brand-0 [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:a?t?.headerBar?.mobileLogo:t?.headerBar?.desktopLogo}})},ye=ee(({actions:t,activeStatus:a=!1},n)=>{const{event:i,cartCount:b}=K(),[c,f]=B(null),p=v=>{switch(v){case T.Search:return"Search";case T.Cart:return`Shopping cart${b>0?` (${b} items)`:""}`;case T.Profile:return"User profile";case T.Livestream:return"Livestream";default:return"Action"}},y=V((v,r)=>{switch(f(r),v?.blockType){case T.Search:i?.search?.();break;case T.Cart:i?.cart?.();break;case T.Profile:i?.profile?.();break;case T.Livestream:i?.livestream?.();break;default:return()=>{}}},[i]);return e("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((v,r)=>l("button",{className:"relative cursor-pointer border-0 bg-transparent p-0",ref:v.blockType===T.Profile?n:null,onClick:()=>y(v,r),"aria-label":p(v.blockType),"aria-pressed":a&&c===r,children:[e(h,{html:v.icon,className:k("size-5",{"text-brand-0":a&&c===r}),"aria-hidden":"true"}),v.blockType===T.Cart&&b>0&&e("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:e(h,{html:b?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},v.id))})}),xe=({title:t,onMenuOpenClose:a,onMenuBackClick:n})=>l("div",{className:"flex h-full items-center gap-3",children:[e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>n(),"aria-label":"Back to previous menu",children:e(Te,{className:"size-5","aria-hidden":"true"})}),e(h,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>a(),"aria-label":"Close menu",children:e(me,{className:"size-5","aria-hidden":"true"})})]}),Z=({label:t,href:a,onClick:n,active:i,icon:b,className:c})=>{const f=l(U,{children:[l("div",{className:"flex items-center gap-4",children:[e(h,{html:t,className:k("text-sm font-bold leading-[1.4]",{underline:b})}),b&&e(h,{html:b,"aria-hidden":"true"})]}),e(He,{className:k("laptop:size-4 size-5",{"rotate-90":i}),"aria-hidden":"true"})]});return a?e(O,{href:a,className:k("flex cursor-pointer items-center justify-between py-4 no-underline",c),children:f}):e("button",{className:k("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",c),onClick:n,"aria-expanded":i,children:f})};var ct=Ae;export{ct as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|