@anker-in/headless-ui 1.3.69 → 1.3.70-alpha.1789549138545

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 (90) hide show
  1. package/dist/cjs/biz-components/ActiveShelf/MemberLabel.d.ts +42 -0
  2. package/dist/cjs/biz-components/ActiveShelf/MemberLabel.js +1 -0
  3. package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +50 -2
  4. package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
  5. package/dist/cjs/biz-components/ActiveShelf/index.d.ts +44 -5
  6. package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
  7. package/dist/cjs/biz-components/ActiveShelf/styles.d.ts +55 -0
  8. package/dist/cjs/biz-components/ActiveShelf/styles.js +1 -0
  9. package/dist/cjs/biz-components/ActiveShelf/types.d.ts +53 -0
  10. package/dist/cjs/biz-components/ActiveShelf/types.js +1 -1
  11. package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
  12. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
  13. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  14. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
  15. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
  16. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
  17. package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
  18. package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
  19. package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
  20. package/dist/cjs/biz-components/ImageTextOverlay/index.js +2 -2
  21. package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
  22. package/dist/cjs/biz-components/ImageWithText/types.d.ts +2 -2
  23. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  24. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  25. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.d.ts +7 -1
  26. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  27. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  28. package/dist/cjs/biz-components/Listing/components/PurchaseBar/types.d.ts +3 -0
  29. package/dist/cjs/biz-components/Listing/components/PurchaseBar/types.js +1 -1
  30. package/dist/cjs/biz-components/MediaTextOverlay/MediaTextOverlay.js +1 -1
  31. package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +10 -0
  32. package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
  33. package/dist/cjs/biz-components/Specs/dropdown.d.ts +2 -1
  34. package/dist/cjs/biz-components/Specs/dropdown.js +2 -2
  35. package/dist/cjs/biz-components/Specs/index.js +1 -1
  36. package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  37. package/dist/cjs/components/badge.d.ts +1 -1
  38. package/dist/cjs/components/badge.js +1 -1
  39. package/dist/cjs/components/link.js +1 -1
  40. package/dist/cjs/helpers/utils.js +1 -1
  41. package/dist/cjs/hooks/useDraggableScroll.js +1 -1
  42. package/dist/cjs/hooks/useExposure.d.ts +1 -1
  43. package/dist/cjs/hooks/useExposure.js +1 -1
  44. package/dist/cjs/hooks/useViewItemList.d.ts +1 -1
  45. package/dist/esm/biz-components/ActiveShelf/MemberLabel.d.ts +42 -0
  46. package/dist/esm/biz-components/ActiveShelf/MemberLabel.js +1 -0
  47. package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +50 -2
  48. package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
  49. package/dist/esm/biz-components/ActiveShelf/index.d.ts +44 -5
  50. package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
  51. package/dist/esm/biz-components/ActiveShelf/styles.d.ts +55 -0
  52. package/dist/esm/biz-components/ActiveShelf/styles.js +1 -0
  53. package/dist/esm/biz-components/ActiveShelf/types.d.ts +53 -0
  54. package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
  55. package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
  56. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  57. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
  58. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
  59. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
  60. package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
  61. package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
  62. package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
  63. package/dist/esm/biz-components/ImageTextOverlay/index.js +2 -2
  64. package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
  65. package/dist/esm/biz-components/ImageWithText/types.d.ts +2 -2
  66. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  67. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  68. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.d.ts +7 -1
  69. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  70. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  71. package/dist/esm/biz-components/Listing/components/PurchaseBar/types.d.ts +3 -0
  72. package/dist/esm/biz-components/MediaTextOverlay/MediaTextOverlay.js +1 -1
  73. package/dist/esm/biz-components/SecondaryBanner/index.d.ts +10 -0
  74. package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
  75. package/dist/esm/biz-components/Specs/dropdown.d.ts +2 -1
  76. package/dist/esm/biz-components/Specs/dropdown.js +2 -2
  77. package/dist/esm/biz-components/Specs/index.js +1 -1
  78. package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  79. package/dist/esm/components/badge.d.ts +1 -1
  80. package/dist/esm/components/badge.js +1 -1
  81. package/dist/esm/components/link.js +1 -1
  82. package/dist/esm/helpers/utils.js +1 -1
  83. package/dist/esm/hooks/useDraggableScroll.js +1 -1
  84. package/dist/esm/hooks/useExposure.d.ts +1 -1
  85. package/dist/esm/hooks/useExposure.js +1 -1
  86. package/dist/esm/hooks/useViewItemList.d.ts +1 -1
  87. package/dist/tokens/oneAnker.css +12 -0
  88. package/package.json +1 -1
  89. package/style.css +150 -22
  90. package/tailwind.config.js +6 -1
@@ -1 +1 @@
1
- "use strict";var b=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var x=(t,l)=>{for(var n in l)b(t,n,{get:l[n],enumerable:!0})},v=(t,l,n,r)=>{if(l&&typeof l=="object"||typeof l=="function")for(let i of f(l))!g.call(t,i)&&i!==n&&b(t,i,{get:()=>l[i],enumerable:!(r=u(l,i))||r.enumerable});return t};var h=t=>v(b({},"__esModule",{value:!0}),t);var w={};x(w,{MenuItem:()=>N,SubSubCategoryContentComp:()=>k,SubSubCategoryItemComp:()=>y});module.exports=h(w);var e=require("react/jsx-runtime"),L=require("react"),o=require("../../components/index.js"),s=require("../../helpers/utils.js"),p=require("./icons/index.js"),c=require("./SidebarDropdown.js"),d=require("../AiuiProvider/index.js");const N=({label:t,href:l,onClick:n,active:r,icon:i,className:a})=>{const m=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(o.Text,{html:t,className:(0,s.cn)("text-sm font-bold leading-[1.4]",{underline:i})}),i&&(0,e.jsx)(o.Text,{html:i,"aria-hidden":"true"})]}),(0,e.jsx)("svg",{className:`size-5 ${r?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return l?(0,e.jsx)(o.Link,{href:l,className:(0,s.cn)("flex cursor-pointer items-center justify-between py-4 no-underline",a),onClick:n,children:m}):(0,e.jsx)("button",{onClick:n,className:(0,s.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",a),"aria-expanded":r,children:m})},y=({matchSeriesMetadata:t,onSubSubCategoryItemClick:l,expanded:n})=>{const r=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(o.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),l&&(0,e.jsx)(p.DownArrow,{"aria-hidden":"true",className:(0,s.cn)("size-5",{"rotate-180":n})})]});return l?(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:l,"aria-expanded":n,children:r}):(0,e.jsx)("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:r})},k=({matchSeriesMetadata:t})=>{const{locale:l="us"}=(0,d.useAiuiContext)();return(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)(o.Text,{html:n.label,as:"p",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)(o.Link,{asChild:!t?.banner?.href,href:(0,s.getLocalizedPath)(t?.banner?.href,l),children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(o.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)(o.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,s.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(o.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,s.cn)("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),n.products?.map((i,a)=>(0,e.jsx)(c.SeriesProductItem,{position:a,product:i,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${n?.label||""}-${r}-${a}`))]})]},`seriesItem-${n?.label||""}-${r}`))})};
1
+ "use strict";var b=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var v=(t,n)=>{for(var l in n)b(t,l,{get:n[l],enumerable:!0})},h=(t,n,l,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of g(n))!x.call(t,i)&&i!==l&&b(t,i,{get:()=>n[i],enumerable:!(r=f(n,i))||r.enumerable});return t};var N=t=>h(b({},"__esModule",{value:!0}),t);var C={};v(C,{MenuItem:()=>k,SubSubCategoryContentComp:()=>w,SubSubCategoryItemComp:()=>y});module.exports=N(C);var e=require("react/jsx-runtime"),$=require("react"),o=require("../../components/index.js"),s=require("../../helpers/utils.js"),c=require("./icons/index.js"),d=require("./SidebarDropdown.js"),u=require("../AiuiProvider/index.js");const k=({label:t,href:n,target:l,onClick:r,active:i,icon:a,className:m})=>{const p=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(o.Text,{html:t,className:(0,s.cn)("text-sm font-bold leading-[1.4]",{underline:a})}),a&&(0,e.jsx)(o.Text,{html:a,"aria-hidden":"true"})]}),(0,e.jsx)("svg",{className:`size-5 ${i?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?(0,e.jsx)(o.Link,{href:n,target:l,rel:l==="_blank"?"noopener noreferrer":void 0,className:(0,s.cn)("flex cursor-pointer items-center justify-between py-4 no-underline",m),onClick:r,children:p}):(0,e.jsx)("button",{onClick:r,className:(0,s.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",m),"aria-expanded":i,children:p})},y=({matchSeriesMetadata:t,onSubSubCategoryItemClick:n,expanded:l})=>{const r=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(o.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),n&&(0,e.jsx)(c.DownArrow,{"aria-hidden":"true",className:(0,s.cn)("size-5",{"rotate-180":l})})]});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":l,children:r}):(0,e.jsx)("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:r})},w=({matchSeriesMetadata:t})=>{const{locale:n="us"}=(0,u.useAiuiContext)();return(0,e.jsx)("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((l,r)=>(0,e.jsxs)("div",{children:[l.label&&(0,e.jsx)(o.Text,{html:l.label,as:"p",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)(o.Link,{asChild:!t?.banner?.href,href:(0,s.getLocalizedPath)(t?.banner?.href,n),children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(o.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)(o.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,s.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(o.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,s.cn)("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),l.products?.map((i,a)=>(0,e.jsx)(d.SeriesProductItem,{position:a,product:i,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${l?.label||""}-${r}-${a}`))]})]},`seriesItem-${l?.label||""}-${r}`))})};
@@ -1 +1 @@
1
- "use strict";var A=Object.create;var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var R=(t,i)=>{for(var m in i)C(t,m,{get:i[m],enumerable:!0})},L=(t,i,m,x)=>{if(i&&typeof i=="object"||typeof i=="function")for(let p of j(i))!O.call(t,p)&&p!==m&&C(t,p,{get:()=>i[p],enumerable:!(x=B(i,p))||x.enumerable});return t};var V=(t,i,m)=>(m=t!=null?A(E(t)):{},L(i||!t||!t.__esModule?C(m,"default",{value:t,enumerable:!0}):m,t)),W=t=>L(C({},"__esModule",{value:!0}),t);var H={};R(H,{SeriesProductItem:()=>_,SidebarDropdown:()=>P});module.exports=W(H);var e=require("react/jsx-runtime"),c=V(require("react")),n=require("../../components/index.js"),b=require("../../helpers/utils.js"),D=require("./icons/index.js"),$=require("./NavProvider.js"),F=require("../AiuiProvider/index.js");const P=c.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:i})=>{const{buildProps:m,onSidebarNavClick:x}=(0,$.useNavContext)(),{locale:p="us"}=(0,F.useAiuiContext)(),[v,N]=(0,c.useState)([]),[h,S]=(0,c.useState)(-1),g=(0,c.useRef)(null),y=(0,c.useRef)(null),k=(0,c.useCallback)(()=>{const a=t?.subcategories;if(!a?.length)return;const o=a.findIndex(u=>!!u?.subSubCategories),l=a.findIndex(u=>!u?.subSubCategories),r=a.map((u,d)=>({index:d,open:o===d||l===d}));N(r)},[t]);(0,c.useEffect)(()=>{k()},[k]);const s=(0,c.useMemo)(()=>{const a=t?.subcategories?.[v?.find(l=>l.open)?.index||0],o=i?.find(l=>l?.label?.toLowerCase()===a?.label?.toLowerCase())||{};if(a?.collections){const l=m?.categories?.[a?.collections]||{};return{label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,series:[{products:l?.products}]}}else if(a?.subSubCategories){const l=a?.subSubCategories?.[h],r=i?.find(u=>u?.label?.toLowerCase()===l?.label?.toLowerCase())||{};if(l?.collections){const u=m?.categories?.[l?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,series:[{products:u?.products}]}}else return r}else return o},[t,v,h,i,m]),f=(0,c.useCallback)((a,o)=>{const l=o?.subSubCategories?.length>0;S(l?0:-1);const r=y.current;N(u=>u.map((d,z)=>z===a?{...d,open:!d.open}:l?{...d,open:!1}:!r&&h===-1?{...d,open:!1}:r&&!r.hasSubSubCategories&&!l&&h===-1?{...d,open:!1}:d)),y.current={index:a,hasSubSubCategories:l}},[h]),w=(a,o)=>{N(l=>l.map(r=>r.index===a?{...r,open:!0}:{...r,open:!1})),S(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:g,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((a,o)=>{const l=Array.isArray(a?.subSubCategories)&&a?.subSubCategories?.length>0,r=v?.find(u=>u.index===o)?.open;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{className:(0,b.cn)("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!l&&r}),onClick:()=>{f(o,a),x?.(a,o)},"aria-expanded":l?r:void 0,"aria-haspopup":l?"true":void 0,children:[(0,e.jsx)(n.Text,{html:a.label,className:"p-4 text-sm font-bold leading-[1.4]"}),l&&(0,e.jsx)(D.DownArrow,{"aria-hidden":"true",className:(0,b.cn)("size-4",{"rotate-180":r})})]}),r&&(0,e.jsx)("div",{className:"flex flex-col",role:"menu",children:a.subSubCategories?.map((u,d)=>(0,e.jsx)("button",{onClick:()=>{w(o,d),x?.(u,d)},className:(0,b.cn)("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":h===d}),role:"menuitem","aria-label":u.label,children:(0,e.jsx)(n.Text,{html:u.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${o}-${d}`))})]},`${a?.label||""}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:`${(0,b.getLocalizedPath)(t?.primary?.url,p)}?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(s).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(()=>{const a=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.Text,{html:s?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),s?.primary&&!s?.primary?.hide&&(0,e.jsx)(n.Text,{className:"lg-desktop:text-base text-sm font-bold leading-[1.2]",html:s?.primary?.label})]});return s?.primary?.url?(0,e.jsx)(n.Button,{as:"a",href:`${(0,b.getLocalizedPath)(s?.primary?.url,p)}?ref=${s?.label}_viewmore`,variant:"link",size:"lg",iconClassName:"size-4",className:"flex items-center justify-start gap-2 !p-0 no-underline",children:a}):(0,e.jsx)("div",{className:"flex items-center gap-2",children:a})})(),t?.guide?.label&&(0,e.jsx)(n.Link,{href:(0,b.getLocalizedPath)(t?.guide?.url,p),className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:t?.guide?.label})]}),(0,e.jsx)("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s?.series?.map((a,o)=>(0,e.jsxs)("div",{children:[a.label&&(0,e.jsx)(n.Text,{html:a.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:[!!s?.banner&&(0,e.jsx)(n.Link,{asChild:!s?.banner?.href,href:(0,b.getLocalizedPath)(s?.banner?.href,p),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:s?.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:s?.banner?.title||"Buy in Guide",className:(0,b.cn)("font-bold text-white",{"text-black":s?.banner?.theme==="dark"})}),(0,e.jsx)(n.Text,{html:s?.banner?.desc||"20.000mAh",className:(0,b.cn)("text-sm font-bold text-white",{"text-black":s?.banner?.theme==="dark"})})]})]})}),a.products?.map((l,r)=>(0,e.jsx)(_,{seriesLabel:s?.label,product:l,isCollection:s?.isCollection},`seriesProductItem-${a?.label||""}-${o}-${r}`))]})]},`seriesItem-${a?.label||""}-${o}`))})]})]})});P.displayName="SidebarDropdown";const _=({product:t,isCollection:i,position:m,seriesLabel:x})=>{const{locale:p="us"}=(0,F.useAiuiContext)(),{buildProps:v,onSeriesProductClick:N,componentOverrides:h}=(0,$.useNavContext)(),S=h?.badge?.variant;let g=i?t:v?.products?.find(f=>f.handle===t.handle);const y=g?.variants?.find(f=>f.sku===t.sku)||g?.variants?.[0],k=(0,c.useMemo)(()=>`${(0,b.getLocalizedPath)(`/products/${g?.handle}`,p)}?variant=${(0,b.atobID)(y?.id)}`,[g?.handle,y?.id,p]),s=(0,c.useMemo)(()=>g?.tags?.filter?.(f=>f?.startsWith?.("CLtag"))?.map?.(f=>f?.replace?.("CLtag:",""))?.slice?.(0,2),[g?.tags]);return y?.availableForSale?(0,e.jsx)(n.Link,{href:k,onClick:f=>{f.preventDefault(),window.open(k,"_self"),N?.(g,m||0,x)},className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"rounded-sidebar-shelf 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:`${y?.image?.url||t?.images?.[0]?.url}&width=200`,loading:"lazy",alt:g?.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(s)&&s?.map((f,w)=>(0,e.jsx)(n.Badge,{size:"sm",variant:S,className:"mb-1 whitespace-nowrap",children:f},w))}),(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:t?.custom_name||y?.metafields?.infos?.page_short_title||g?.title}),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};
1
+ "use strict";var A=Object.create;var C=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var R=(t,i)=>{for(var m in i)C(t,m,{get:i[m],enumerable:!0})},L=(t,i,m,y)=>{if(i&&typeof i=="object"||typeof i=="function")for(let p of B(i))!O.call(t,p)&&p!==m&&C(t,p,{get:()=>i[p],enumerable:!(y=j(i,p))||y.enumerable});return t};var V=(t,i,m)=>(m=t!=null?A(E(t)):{},L(i||!t||!t.__esModule?C(m,"default",{value:t,enumerable:!0}):m,t)),W=t=>L(C({},"__esModule",{value:!0}),t);var H={};R(H,{SeriesProductItem:()=>_,SidebarDropdown:()=>P});module.exports=W(H);var e=require("react/jsx-runtime"),c=V(require("react")),n=require("../../components/index.js"),b=require("../../helpers/utils.js"),D=require("./icons/index.js"),$=require("./NavProvider.js"),F=require("../AiuiProvider/index.js");const P=c.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:i})=>{const{buildProps:m,onSidebarNavClick:y}=(0,$.useNavContext)(),{locale:p="us"}=(0,F.useAiuiContext)(),[v,N]=(0,c.useState)([]),[h,S]=(0,c.useState)(-1),g=(0,c.useRef)(null),x=(0,c.useRef)(null),k=(0,c.useCallback)(()=>{const a=t?.subcategories;if(!a?.length)return;const o=a.findIndex(u=>!!u?.subSubCategories),l=a.findIndex(u=>!u?.subSubCategories),r=a.map((u,d)=>({index:d,open:o===d||l===d}));N(r)},[t]);(0,c.useEffect)(()=>{k()},[k]);const s=(0,c.useMemo)(()=>{const a=t?.subcategories?.[v?.find(l=>l.open)?.index||0],o=i?.find(l=>l?.label?.toLowerCase()===a?.label?.toLowerCase())||{};if(a?.collections){const l=m?.categories?.[a?.collections]||{};return{label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,series:[{products:l?.products}]}}else if(a?.subSubCategories){const l=a?.subSubCategories?.[h],r=i?.find(u=>u?.label?.toLowerCase()===l?.label?.toLowerCase())||{};if(l?.collections){const u=m?.categories?.[l?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,series:[{products:u?.products}]}}else return r}else return o},[t,v,h,i,m]),f=(0,c.useCallback)((a,o)=>{const l=o?.subSubCategories?.length>0;S(l?0:-1);const r=x.current;N(u=>u.map((d,z)=>z===a?{...d,open:!d.open}:l?{...d,open:!1}:!r&&h===-1?{...d,open:!1}:r&&!r.hasSubSubCategories&&!l&&h===-1?{...d,open:!1}:d)),x.current={index:a,hasSubSubCategories:l}},[h]),w=(a,o)=>{N(l=>l.map(r=>r.index===a?{...r,open:!0}:{...r,open:!1})),S(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:g,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((a,o)=>{const l=Array.isArray(a?.subSubCategories)&&a?.subSubCategories?.length>0,r=v?.find(u=>u.index===o)?.open;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{className:(0,b.cn)("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!l&&r}),onClick:()=>{f(o,a),y?.(a,o)},"aria-expanded":l?r:void 0,"aria-haspopup":l?"true":void 0,children:[(0,e.jsx)(n.Text,{html:a.label,className:"p-4 text-sm font-bold leading-[1.4]"}),l&&(0,e.jsx)(D.DownArrow,{"aria-hidden":"true",className:(0,b.cn)("size-4",{"rotate-180":r})})]}),r&&(0,e.jsx)("div",{className:"flex flex-col",role:"menu",children:a.subSubCategories?.map((u,d)=>(0,e.jsx)("button",{onClick:()=>{w(o,d),y?.(u,d)},className:(0,b.cn)("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":h===d}),role:"menuitem","aria-label":u.label,children:(0,e.jsx)(n.Text,{html:u.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${o}-${d}`))})]},`${a?.label||""}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:`${(0,b.getLocalizedPath)(t?.primary?.url,p)}?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(s).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(()=>{const a=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.Text,{html:s?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),s?.primary&&!s?.primary?.hide&&(0,e.jsx)(n.Text,{className:"lg-desktop:text-base text-sm font-bold leading-[1.2]",html:s?.primary?.label})]});return s?.primary?.url?(0,e.jsx)(n.Button,{as:"a",href:`${(0,b.getLocalizedPath)(s?.primary?.url,p)}?ref=${s?.label}_viewmore`,variant:"link",size:"lg",iconClassName:"size-4",className:"flex items-center justify-start gap-2 !p-0 no-underline",children:a}):(0,e.jsx)("div",{className:"flex items-center gap-2",children:a})})(),t?.guide?.label&&(0,e.jsx)(n.Link,{href:(0,b.getLocalizedPath)(t?.guide?.url,p),className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:t?.guide?.label})]}),(0,e.jsx)("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s?.series?.map((a,o)=>(0,e.jsxs)("div",{children:[a.label&&(0,e.jsx)(n.Text,{html:a.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:[!!s?.banner&&(0,e.jsx)(n.Link,{asChild:!s?.banner?.href,href:(0,b.getLocalizedPath)(s?.banner?.href,p),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:s?.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:s?.banner?.title||"Buy in Guide",className:(0,b.cn)("font-bold text-white",{"text-black":s?.banner?.theme==="dark"})}),(0,e.jsx)(n.Text,{html:s?.banner?.desc||"20.000mAh",className:(0,b.cn)("text-sm font-bold text-white",{"text-black":s?.banner?.theme==="dark"})})]})]})}),a.products?.map((l,r)=>(0,e.jsx)(_,{seriesLabel:s?.label,product:l,isCollection:s?.isCollection},`seriesProductItem-${a?.label||""}-${o}-${r}`))]})]},`seriesItem-${a?.label||""}-${o}`))})]})]})});P.displayName="SidebarDropdown";const _=({product:t,isCollection:i,position:m,seriesLabel:y})=>{const{locale:p="us"}=(0,F.useAiuiContext)(),{buildProps:v,onSeriesProductClick:N,componentOverrides:h}=(0,$.useNavContext)(),S=h?.badge?.variant;let g=i?t:v?.products?.find(f=>f.handle===t.handle);const x=g?.variants?.find(f=>f.sku===t.sku)||g?.variants?.[0],k=(0,c.useMemo)(()=>`${(0,b.getLocalizedPath)(`/products/${g?.handle}`,p)}?variant=${(0,b.atobID)(x?.id)}`,[g?.handle,x?.id,p]),s=(0,c.useMemo)(()=>g?.tags?.filter?.(f=>f?.startsWith?.("CLtag"))?.map?.(f=>f?.replace?.("CLtag:",""))?.slice?.(0,2),[g?.tags]);return x?.availableForSale?(0,e.jsx)(n.Link,{href:k,onClick:f=>{f.preventDefault(),window.open(k,"_self"),N?.(g,m||0,y)},className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"rounded-sidebar-shelf relative 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:`${x?.image?.url||t?.images?.[0]?.url}&width=200`,loading:"lazy",alt:g?.title||t?.name,width:90,height:90,className:"size-[96px] object-contain"})}),Array.isArray(s)&&s?.length>0&&(0,e.jsx)("div",{className:"absolute right-1 top-1 flex gap-1",children:s?.map((f,w)=>(0,e.jsx)(n.Badge,{size:"xs",variant:S,className:"whitespace-nowrap",children:f},w))}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[(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:t?.custom_name||x?.metafields?.infos?.page_short_title||g?.title}),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};
@@ -1 +1 @@
1
- "use strict";"use client";var Me=Object.create;var Z=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var Te=(n,r)=>{for(var i in r)Z(n,i,{get:r[i],enumerable:!0})},le=(n,r,i,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Pe(r))!Ee.call(n,u)&&u!==i&&Z(n,u,{get:()=>r[u],enumerable:!(c=Se(r,u))||c.enumerable});return n};var ee=(n,r,i)=>(i=n!=null?Me(De(n)):{},le(r||!n||!n.__esModule?Z(i,"default",{value:n,enumerable:!0}):i,n)),He=n=>le(Z({},"__esModule",{value:!0}),n);var Ie={};Te(Ie,{default:()=>Re});module.exports=He(Ie);var e=require("react/jsx-runtime"),t=require("react"),l=require("../../components/index.js"),pe=require("../../shared/Styles.js"),k=require("../../helpers/utils.js"),F=ee(require("./NavProvider.js")),o=require("./types.js"),fe=ee(require("jump.js")),te=require("@gsap/react"),X=require("gsap"),C=require("./withCategory.js"),S=require("./icons/index.js"),be=ee(require("../NavigationSearch/index.js")),ve=require("./ResourceSidebarDropdown.js"),ge=require("./MobileResourceSidebarMenu.js"),he=require("./SidebarDropdown.js"),ae=require("./useScrollLock.js"),ye=require("./MulticolDropdown.js"),Ne=require("./SupportsDropdown.js"),ke=require("./MobileSidebarMenu.js"),we=require("./MobileSupportMenu.js"),xe=require("./MobileMulticolMenu.js"),ne=require("./MobileMenuComponents.js"),oe=require("../AiuiProvider/index.js"),ie=ee(require("../../shared/throttle.js"));const se=(0,t.forwardRef)((n,r)=>{const{data:{header:i}={},buildProps:c,event:u,profile:P,theme:s="light",isTop:m=!1,searchResult:x,onSearch:b,isSearching:p,keywords:_,onPrimaryNavClick:w,onSeriesProductClick:h,onSidebarNavClick:D,onMobileMenuToggle:U,headerId:E,cartCount:L,menuData:z,render:B,componentOverrides:G,...J}=n,[R,f]=(0,t.useState)(!1),[W,I]=(0,t.useState)(!1),[A,H]=(0,t.useState)(!1),[Y,g]=(0,t.useState)(!1),O=(0,t.useRef)(null),M=(0,t.useRef)(null),q=()=>{const y=document?.querySelector("body")?.offsetWidth||0;g(y<=1440)};(0,t.useEffect)(()=>(q(),window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q)}),[]),(0,t.useImperativeHandle)(r,()=>M.current),(0,t.useEffect)(()=>{M.current&&m&&(0,fe.default)(M.current,{duration:0,offset:M.current?.getBoundingClientRect()?.bottom||0})},[m]),(0,t.useEffect)(()=>{if(m){I(!1),H(!1);return}let y=0,a=0,d=0;const v=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,N=v();y=N,I(N>300),H(N>30);const $=(0,ie.default)(()=>{const T=v(),K=T-y;H(T>30),K>0?(a=0,d+=K,d>=300&&T>300&&I(!0)):K<0&&(d=0,a+=Math.abs(K),a>=300&&(I(!1),a=0)),y=T},100);return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[m]),(0,t.useEffect)(()=>{u&&(u.search=()=>f(!0))},[u]),(0,te.useGSAP)(()=>{O?.current&&R&&X.gsap.fromTo(O.current,{height:0},{height:"auto",duration:.3})},[R]),(0,ae.useScrollLock)(R);const Q=(0,t.useMemo)(()=>i?.bar?.actions?.find(y=>y?.blockType===o.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),j=B?.mobileHeaderNavigation;return(0,e.jsx)(F.default,{buildProps:c,profile:P,isMobile:Y,event:u,payloadData:i,onSidebarNavClick:D,onSeriesProductClick:h,cartCount:L,componentOverrides:G,children:(0,e.jsx)("header",{...J,id:E||"header","data-ui-component-id":"HeaderNavigation",className:m?"relative z-[100] bg-white":(0,k.cn)("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":W}),ref:M,children:(0,e.jsxs)("div",{className:(0,k.cn)("hover:bg-white hover:text-black",s==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!m&&A},{"hover:!text-black":s==="dark","!text-black":!m&&A}),onClick:()=>!m&&H(!0),children:[(0,e.jsx)(ce,{data:i,className:"desktop:block hidden !bg-white",theme:s,onNavItemClick:()=>!m&&H(!0),onPrimaryNavClick:w}),j?(0,e.jsx)(j,{className:"desktop:hidden block !bg-white",menuData:z,data:i,onPrimaryNavClick:w}):(0,e.jsx)(ue,{menuData:z,data:i,className:"desktop:hidden block !bg-white",onPrimaryNavClick:w,onMobileMenuToggle:U}),R&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${M?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:O,className:(0,k.cn)("overflow-y-auto",{}),children:(0,e.jsx)(be.default,{data:Q,keywords:_,isSearching:p,searchResult:x,onSearch:y=>{b?.(y)},onClose:()=>{b?.(),f(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>f(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:y=>{(y.key==="Enter"||y.key===" "||y.key==="Escape")&&(y.preventDefault(),f(!1))}})]})]})})})}),ce=(0,t.forwardRef)((n,r)=>{const{data:i,onNavItemClick:c,className:u,theme:P,onPrimaryNavClick:s}=n,{event:m,profile:x}=(0,F.useNavContext)(),[b,p]=(0,t.useState)(!1),{locale:_="us"}=(0,oe.useAiuiContext)(),w=(0,t.useMemo)(()=>(0,C.WithGroupCategory)(i?.categories?.filter(a=>a?.pcShow)),[i]),[h,D]=(0,t.useState)(null),[U,E]=(0,t.useState)([]),L=(0,t.useRef)(null),[z,B]=(0,t.useState)(!1),G=(0,t.useRef)(null),J=(0,t.useRef)(null),R=(0,t.useRef)(w.map(a=>Array(a?.length||0).fill(null)));(0,t.useEffect)(()=>{w?.length&&E(w?.map((a,d)=>a?.map((v,N)=>({groupIndex:d,index:N,open:!1}))))},[w]);const f=(0,t.useMemo)(()=>{let a=null;for(const d of U){for(const v of d)if(v.open){a=v;break}if(a)break}return a},[U]);(0,ae.useScrollLock)(!!f?.open||z);const W=(a,d,v)=>{B(!1);const N=w[d][v];if(N?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links)N?.components?.[0]?.url&&window.open(N?.components?.[0]?.url,N?.components?.[0]?.target??"_blank");else{const $=w?.flat()||[],T=$?.findIndex(K=>K?.id===w[d][v]?.id);a.stopPropagation(),c?.(),s?.($[T],T),D(N),E(K=>K.map(Ce=>Ce.map(V=>V.groupIndex===d&&V.index===v?{...V,open:!V.open}:{...V,open:!1})))}},I=(a,d,v)=>{a.key==="Enter"||a.key===" "?(a.preventDefault(),W(a,d,v)):a.key==="Escape"&&f?.groupIndex===d&&f?.index===v&&(a.preventDefault(),A())},A=()=>{E(a=>a.map(d=>d.map(v=>({...v,open:!1}))))},H=(0,t.useMemo)(()=>{if(h)return h?.components?.[0]?.blockType},[h]),Y=(0,C.WithSidebar)(he.SidebarDropdown,h),g=(0,C.WithResource)(ve.ResourceSidebarDropdown,h),O=(0,C.WithMulticol)(ye.MulticolDropdown,h),M=(0,C.WithSupports)(Ne.SupportsDropdown,{categoriesItem:h,currentNavItemRef:R.current?.[f?.groupIndex||0]?.[f?.index||0]}),q=(0,t.useMemo)(()=>{switch(H){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(Y,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(g,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(M,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(O,{});default:return null}},[H,h]),Q=(0,t.useMemo)(()=>i?.bar?.actions?.filter(a=>a?.pcShow),[i]),j=(0,t.useMemo)(()=>Q?.find(a=>a?.blockType===o.HeaderNavigationActionBlockType.Profile),[Q]),y=(0,t.useCallback)(()=>{B(a=>!a)},[]);return(0,t.useEffect)(()=>{if(L?.current){const a=L.current;return a.addEventListener("click",y),()=>{a.removeEventListener("click",y)}}},[y]),(0,te.useGSAP)(()=>{f?.open&&X.gsap.fromTo(J?.current,{height:0},{height:"auto"})},[f?.open]),(0,e.jsxs)(l.Container,{className:(0,k.cn)("relative h-[92px]",u),children:[(0,e.jsxs)("div",{ref:G,onClick:A,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)(de,{}),(0,e.jsx)(re,{ref:L,actions:Q,activeStatus:z})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:w?.map((a,d)=>(0,e.jsx)("div",{className:"flex gap-3",children:a?.map((v,N)=>{const $=f?.groupIndex===d&&f?.index===N;return(0,e.jsx)("div",{ref:T=>{R.current[d][N]=T},className:"group",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:T=>W(T,d,N),onKeyDown:T=>I(T,d,N),"aria-expanded":$,"aria-haspopup":"true","aria-label":v.text,children:[(0,e.jsx)(l.Text,{html:v.text,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)(S.DownArrow,{className:(0,k.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":f?.groupIndex===d&&f?.index===N,"opacity-100":b&&f?.groupIndex===d&&f?.index===N,invisible:!v?.components?.length||v?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links})})]}),(0,e.jsx)("div",{className:(0,k.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":$},P==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},v.id)})},`groupCategory-${d}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(f?.open&&h),className:(0,k.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:!(f?.open&&h)}),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{height:`calc(100dvh - ${G?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:J,className:(0,k.cn)("relative z-50",{"overflow-hidden":H!==o.HeaderNavigationBlockType.Supports}),children:q}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:A,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),A())}})]}),z&&(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:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${L?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:x?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:x?.nick_name||j?.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:j?.profiles?.map(a=>(0,e.jsx)(ne.MenuItem,{className:"py-2",label:a?.title,href:(0,k.getLocalizedPath)(a?.url,_)},a.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(S.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(l.Text,{html:j?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:j?.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 shrink-0",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 flex-wrap gap-2",children:[(0,e.jsx)(l.Button,{className:"grow",variant:"secondary",size:"lg",onClick:()=>m?.join?.(),children:(0,e.jsx)(l.Text,{html:j?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>m?.login?.(),children:(0,e.jsx)(l.Text,{html:j?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>B(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),B(!1))}})]})]})}),ue=(0,t.forwardRef)(({data:n,menuData:r,className:i,onPrimaryNavClick:c,onMobileMenuToggle:u},P)=>{const s=(0,t.useMemo)(()=>(0,C.WithGroupCategory)(n?.categories?.filter(g=>g?.mobileShow)),[n]),{currentMenu:m,setCurrentMenu:x,subSubCategory:b}=(0,F.useNavContext)(),[p,_]=(0,t.useState)(!1),[w,h]=(0,t.useState)(0),[D,U]=(0,t.useState)(null),E=(0,t.useRef)(null),L=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(E?.current&&p){const g=E?.current?.getBoundingClientRect();h(window?.innerHeight-(g?.top||0))}u?.({open:p})},[p,u]),(0,t.useEffect)(()=>{if(!p)return;const g=(0,ie.default)(()=>{if(E?.current){const O=E.current.getBoundingClientRect();L.current=!0,h(window?.innerHeight-(O?.top||0))}},100);return window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[p]),(0,te.useGSAP)(()=>{if(L.current){X.gsap.set(E.current,{height:w}),L.current=!1;return}X.gsap.fromTo(E.current,{height:0},{height:w,duration:.3})},[w]),(0,ae.useScrollLock)(p);const z=(0,t.useMemo)(()=>D?.components?.[0]?.blockType,[D]),B=(0,C.WithSupports)(we.MobileSupportMenu,{categoriesItem:D}),G=(0,C.WithSidebar)(ke.MobileSidebarMenu,D),J=(0,C.WithResource)(ge.MobileResourceSidebarMenu,D),R=(0,C.WithMulticol)(xe.MobileMulticolMenu,D),f=(0,t.useMemo)(()=>{switch(z){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(G,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(J,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(B,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(R,{});default:return null}},[z,D,B]),W=(0,t.useCallback)(()=>{_(!1),h(0),x&&x(o.HeaderNavigationMenu.Primary)},[_,h,x]),I=(0,t.useMemo)(()=>n?.bar?.actions?.filter(g=>g?.mobileShow&&g?.blockType!==o.HeaderNavigationActionBlockType.Profile),[n]),A=(0,t.useMemo)(()=>n?.bar?.actions?.find(g=>g?.mobileShow&&g?.blockType===o.HeaderNavigationActionBlockType.Profile)||{},[n]),H=(0,t.useMemo)(()=>{switch(m){case o.HeaderNavigationMenu.Primary:return(0,e.jsx)(Be,{actions:I,menuOpen:p,onMenuOpenClose:()=>{_(!1),h(0)},onMenuOpenClick:()=>_(!0)});case o.HeaderNavigationMenu.Secondary:return(0,e.jsx)(me,{title:D?.text,onMenuOpenClose:W,onMenuBackClick:()=>x?.(o.HeaderNavigationMenu.Primary)});case o.HeaderNavigationMenu.Third:return(0,e.jsx)(me,{title:b?.label,onMenuOpenClose:W,onMenuBackClick:()=>x?.(o.HeaderNavigationMenu.Secondary)});default:return null}},[p,m,x,D,I,b,W]),Y=(0,t.useCallback)((g,O)=>{const M=Array.isArray(s)?Array.isArray(s[g])?s[g][O]:{}:{};U(M),M?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links?M?.components?.[0]?.url&&window.open(M?.components?.[0]?.url,M?.components?.[0]?.target??"_blank"):x?.(o.HeaderNavigationMenu.Secondary)},[s,x]);return(0,e.jsxs)(l.Container,{className:(0,k.cn)("relative h-[56px]",i),children:[H,p&&(0,e.jsxs)("nav",{ref:E,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:w},role:"navigation","aria-label":"Mobile navigation menu",children:[m===o.HeaderNavigationMenu.Primary&&r?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:r})}):null,m===o.HeaderNavigationMenu.Primary?(0,e.jsx)(Le,{categories:s,onPrimaryMenuClick:Y,onPrimaryNavClick:c,profileAction:A}):f]})]})}),Le=({categories:n,onPrimaryMenuClick:r,profileAction:i,onPrimaryNavClick:c})=>(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((u,P)=>(0,e.jsxs)("div",{className:"",children:[(0,e.jsx)("div",{className:(0,k.cn)("my-2 h-px w-full bg-[#E5E5E7]")}),u?.map((s,m)=>(0,e.jsx)(ne.MenuItem,{label:s.text,onClick:()=>{const b=(n?.flat()||[])?.findIndex(p=>p?.id===n[P][m]?.id);r(P,m),c?.(s,b)},icon:s.components?.[0]?.icon},s.id))]},`groupCategory-${P}`))}),(0,e.jsx)(ze,{profileAction:i})]}),ze=({profileAction:n})=>{const[r,i]=(0,t.useState)(!1),{profile:c,event:u}=(0,F.useNavContext)(),{locale:P="us"}=(0,oe.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,k.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":c?.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)(S.User,{"aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:c?.nick_name||n?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&(0,e.jsx)(S.DownArrow,{"aria-hidden":"true",className:(0,k.cn)("laptop:size-4 size-5",{"rotate-180":r})})]}),c?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:n?.profiles?.map(s=>(0,e.jsx)(ne.MenuItem,{label:s?.title,href:(0,k.getLocalizedPath)(s?.url,P)},s.id))}),r&&!c?.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(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))})]}),!c?.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:()=>u?.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:()=>u?.login?.(),children:(0,e.jsx)(l.Text,{html:n?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Be=({menuOpen:n,onMenuOpenClose:r,onMenuOpenClick:i,actions:c})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(de,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(re,{actions:c}),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)(S.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)(S.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),de=()=>{const{payloadData:n,isMobile:r}=(0,F.useNavContext)(),{locale:i="us"}=(0,oe.useAiuiContext)();return(0,e.jsx)("a",{href:(0,k.getLocalizedPath)("/",i),className:"hover:text-[#00CBEB] [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:r?n?.bar?.mobileLogo:n?.bar?.desktopLogo}})},re=(0,t.forwardRef)(({actions:n,activeStatus:r=!1},i)=>{const{event:c,cartCount:u}=(0,F.useNavContext)(),[P,s]=(0,t.useState)(null),m=b=>{switch(b){case o.HeaderNavigationActionBlockType.Search:return"Search";case o.HeaderNavigationActionBlockType.Cart:return`Shopping cart${u>0?` (${u} items)`:""}`;case o.HeaderNavigationActionBlockType.Profile:return"User profile";case o.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},x=(0,t.useCallback)((b,p)=>{switch(s(p),b?.blockType){case o.HeaderNavigationActionBlockType.Search:c?.search?.();break;case o.HeaderNavigationActionBlockType.Cart:c?.cart?.();break;case o.HeaderNavigationActionBlockType.Profile:c?.profile?.();break;case o.HeaderNavigationActionBlockType.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(n)&&n?.map((b,p)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":b?.tag||"",ref:b.blockType===o.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>x(b,p),"aria-label":m(b.blockType),"aria-pressed":r&&P===p,children:[(0,e.jsx)(l.Text,{html:b.icon,className:(0,k.cn)("size-5",{"text-brand-0":r&&P===p}),"aria-hidden":"true"}),b.blockType===o.HeaderNavigationActionBlockType.Cart&&u>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:u?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},b.id))})}),me=({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)(S.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)(S.Close,{className:"size-5","aria-hidden":"true"})})]});ue.displayName="MobileNavigation",re.displayName="Actions",se.displayName="HeaderNavigation",ce.displayName="DesktopNavigation";var Re=(0,pe.withLayout)(se);
1
+ "use strict";"use client";var Le=Object.create;var re=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var Ie=(n,o)=>{for(var i in o)re(n,i,{get:o[i],enumerable:!0})},me=(n,o,i,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of Re(o))!ze.call(n,c)&&c!==i&&re(n,c,{get:()=>o[c],enumerable:!(s=He(o,c))||s.enumerable});return n};var oe=(n,o,i)=>(i=n!=null?Le(Be(n)):{},me(o||!n||!n.__esModule?re(i,"default",{value:n,enumerable:!0}):i,n)),Ae=n=>me(re({},"__esModule",{value:!0}),n);var Ke={};Ie(Ke,{default:()=>$e});module.exports=Ae(Ke);var e=require("react/jsx-runtime"),t=require("react"),l=require("../../components/index.js"),he=require("../../shared/Styles.js"),N=require("../../helpers/utils.js"),$=oe(require("./NavProvider.js")),r=require("./types.js"),ye=oe(require("jump.js")),ie=require("@gsap/react"),X=require("gsap"),M=require("./withCategory.js"),S=require("./icons/index.js"),Ne=oe(require("../NavigationSearch/index.js")),ke=require("./ResourceSidebarDropdown.js"),Ce=require("./MobileResourceSidebarMenu.js"),xe=require("./SidebarDropdown.js"),le=require("./useScrollLock.js"),we=require("./MulticolDropdown.js"),Me=require("./SupportsDropdown.js"),Se=require("./MobileSidebarMenu.js"),Te=require("./MobileSupportMenu.js"),De=require("./MobileMulticolMenu.js"),se=require("./MobileMenuComponents.js"),Z=require("../AiuiProvider/index.js"),de=oe(require("../../shared/throttle.js")),Pe=require("./useNavCollapse.js");const pe=(0,t.forwardRef)((n,o)=>{const{data:{header:i}={},buildProps:s,event:c,profile:E,theme:d="light",isTop:m=!1,searchResult:p,onSearch:v,isSearching:f,keywords:H,onPrimaryNavClick:k,onSeriesProductClick:y,onSidebarNavClick:T,onMobileMenuToggle:K,headerId:D,cartCount:R,menuData:B,render:z,componentOverrides:W,...F}=n,[C,I]=(0,t.useState)(!1),[g,A]=(0,t.useState)(!1),[U,O]=(0,t.useState)(!1),P=(0,t.useRef)(null),u=(0,t.useRef)(null),j=(0,Pe.useNavCollapse)(u);(0,t.useImperativeHandle)(o,()=>u.current),(0,t.useEffect)(()=>{u.current&&m&&(0,ye.default)(u.current,{duration:0,offset:u.current?.getBoundingClientRect()?.bottom||0})},[m]),(0,t.useEffect)(()=>{if(m){A(!1),O(!1);return}let x=0,J=0,Y=0;const te=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,q=te();x=q,A(q>300),O(q>30);const ae=(0,de.default)(()=>{const _=te(),L=_-x;O(_>30),L>0?(J=0,Y+=L,Y>=300&&_>300&&A(!0)):L<0&&(Y=0,J+=Math.abs(L),J>=300&&(A(!1),J=0)),x=_},100);return window.addEventListener("scroll",ae,{passive:!0}),()=>window.removeEventListener("scroll",ae)},[m]),(0,t.useEffect)(()=>{c&&(c.search=()=>I(!0))},[c]),(0,ie.useGSAP)(()=>{P?.current&&C&&X.gsap.fromTo(P.current,{height:0},{height:"auto",duration:.3})},[C]),(0,le.useScrollLock)(C);const G=(0,t.useMemo)(()=>i?.bar?.actions?.find(x=>x?.blockType===r.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),ee=z?.mobileHeaderNavigation;return(0,e.jsx)($.default,{buildProps:s,profile:E,isMobile:j,event:c,payloadData:i,onSidebarNavClick:T,onSeriesProductClick:y,cartCount:R,componentOverrides:W,children:(0,e.jsx)("header",{...F,id:D||"header","data-ui-component-id":"HeaderNavigation",className:m?"relative z-[100] bg-white":(0,N.cn)("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":g}),ref:u,children:(0,e.jsxs)("div",{className:(0,N.cn)("hover:bg-white hover:text-black",d==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!m&&U},{"hover:!text-black":d==="dark","!text-black":!m&&U}),onClick:()=>!m&&O(!0),children:[j?ee?(0,e.jsx)(ee,{menuData:B,data:i,onPrimaryNavClick:k}):(0,e.jsx)(be,{menuData:B,data:i,onPrimaryNavClick:k,onMobileMenuToggle:K,className:"!bg-white"}):(0,e.jsx)(fe,{data:i,theme:d,onNavItemClick:()=>!m&&O(!0),onPrimaryNavClick:k,className:"!bg-white"}),C&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${u?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:P,className:(0,N.cn)("overflow-y-auto",{}),children:(0,e.jsx)(Ne.default,{data:G,keywords:H,isSearching:f,searchResult:p,onSearch:x=>{v?.(x)},onClose:()=>{v?.(),I(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>I(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:x=>{(x.key==="Enter"||x.key===" "||x.key==="Escape")&&(x.preventDefault(),I(!1))}})]})]})})})}),fe=(0,t.forwardRef)((n,o)=>{const{data:i,onNavItemClick:s,className:c,theme:E,onPrimaryNavClick:d}=n,{event:m,profile:p}=(0,$.useNavContext)(),[v,f]=(0,t.useState)(!1),{locale:H="us"}=(0,Z.useAiuiContext)(),k=(0,t.useMemo)(()=>(0,M.WithGroupCategory)(i?.categories?.filter(a=>a?.pcShow)),[i]),[y,T]=(0,t.useState)(null),[K,D]=(0,t.useState)([]),R=(0,t.useRef)(null),[B,z]=(0,t.useState)(!1),W=(0,t.useRef)(null),F=(0,t.useRef)(null),C=(0,t.useRef)(null),I=(0,t.useRef)(k.map(a=>Array(a?.length||0).fill(null)));(0,t.useEffect)(()=>{k?.length&&D(k?.map((a,h)=>a?.map((b,w)=>({groupIndex:h,index:w,open:!1}))))},[k]);const g=(0,t.useMemo)(()=>{let a=null;for(const h of K){for(const b of h)if(b.open){a=b;break}if(a)break}return a},[K]);(0,le.useScrollLock)(!!g?.open||B);const A=(a,h)=>{z(!1),s?.();const b=k?.flat()||[],w=b?.findIndex(Q=>Q?.id===k[a][h]?.id);d?.(b[w],w)},U=(a,h)=>{const b=k[a][h],w=b?.components?.[0];w&&w?.blockType!==r.HeaderNavigationBlockType.Links&&(T(b),D(V=>V.map(Ee=>Ee.map(ne=>ne.groupIndex===a&&ne.index===h?{...ne,open:!0}:{...ne,open:!1}))))},O=(a,h,b)=>{a.key==="Escape"&&g?.groupIndex===h&&g?.index===b&&(a.preventDefault(),P())},P=()=>{D(a=>a.map(h=>h.map(b=>({...b,open:!1}))))},u=()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{P()},200)},j=()=>{C.current&&clearTimeout(C.current)},G=()=>{C.current&&clearTimeout(C.current)},ee=()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{P()},200)},x=(0,t.useMemo)(()=>{if(y)return y?.components?.[0]?.blockType},[y]),J=(0,M.WithSidebar)(xe.SidebarDropdown,y),Y=(0,M.WithResource)(ke.ResourceSidebarDropdown,y),te=(0,M.WithMulticol)(we.MulticolDropdown,y),q=(0,M.WithSupports)(Me.SupportsDropdown,{categoriesItem:y,currentNavItemRef:I.current?.[g?.groupIndex||0]?.[g?.index||0]}),ae=(0,t.useMemo)(()=>{switch(x){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(J,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(Y,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(q,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(te,{});default:return null}},[x,y]),_=(0,t.useMemo)(()=>i?.bar?.actions?.filter(a=>a?.pcShow),[i]),L=(0,t.useMemo)(()=>_?.find(a=>a?.blockType===r.HeaderNavigationActionBlockType.Profile),[_]),ce=(0,t.useCallback)(()=>{z(a=>!a)},[]);return(0,t.useEffect)(()=>{if(R?.current){const a=R.current;return a.addEventListener("click",ce),()=>{a.removeEventListener("click",ce)}}},[ce]),(0,ie.useGSAP)(()=>{g?.open&&X.gsap.fromTo(F?.current,{height:0},{height:"auto"})},[g?.open]),(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[92px]",c),children:[(0,e.jsxs)("div",{ref:W,onClick:P,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)(ve,{}),(0,e.jsx)(ue,{ref:R,actions:_,activeStatus:B})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",onMouseEnter:j,onMouseLeave:u,children:k?.map((a,h)=>(0,e.jsx)("div",{className:"flex gap-3","data-nav-item":!0,children:a?.map((b,w)=>{const Q=g?.groupIndex===h&&g?.index===w;return(0,e.jsx)("div",{ref:V=>{I.current[h][w]=V},className:"group",onMouseEnter:()=>U(h,w),children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("a",{href:(0,N.getLocalizedPath)(b.url,H),...b.target?{target:b.target}:{},rel:b.target==="_blank"?"noopener noreferrer":void 0,className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4 no-underline",onClick:()=>A(h,w),onKeyDown:V=>O(V,h,w),"aria-expanded":Q,"aria-haspopup":"true","aria-label":b.text,children:[(0,e.jsx)(l.Text,{html:b.text,"data-nav-item-label":!0,className:"whitespace-nowrap text-sm font-bold leading-[1.4]"}),(0,e.jsx)(S.DownArrow,{className:(0,N.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":g?.groupIndex===h&&g?.index===w,"opacity-100":v&&g?.groupIndex===h&&g?.index===w,invisible:!b?.components?.length||b?.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links})})]}),(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)]":Q},E==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},b.id)})},`groupCategory-${h}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(g?.open&&y),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:!(g?.open&&y)}),style:{height:`calc(100dvh - ${W?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:F,className:(0,N.cn)("relative z-50",{"overflow-hidden":x!==r.HeaderNavigationBlockType.Supports}),onMouseEnter:()=>{G(),f(!0)},onMouseLeave:()=>{ee(),f(!1)},children:ae}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:P,onMouseEnter:P,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),P())}})]}),B&&(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:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${R?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:p?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:p?.nick_name||L?.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:L?.profiles?.map(a=>(0,e.jsx)(se.MenuItem,{className:"py-2",label:a?.title,href:(0,N.getLocalizedPath)(a?.url,H)},a.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(S.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(l.Text,{html:L?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:L?.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 shrink-0",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 flex-wrap gap-2",children:[(0,e.jsx)(l.Button,{className:"grow",variant:"secondary",size:"lg",onClick:()=>m?.join?.(),children:(0,e.jsx)(l.Text,{html:L?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>m?.login?.(),children:(0,e.jsx)(l.Text,{html:L?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>z(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),z(!1))}})]})]})}),be=(0,t.forwardRef)(({data:n,menuData:o,className:i,onPrimaryNavClick:s,onMobileMenuToggle:c},E)=>{const d=(0,t.useMemo)(()=>(0,M.WithGroupCategory)(n?.categories?.filter(u=>u?.mobileShow)),[n]),{currentMenu:m,setCurrentMenu:p,subSubCategory:v}=(0,$.useNavContext)(),[f,H]=(0,t.useState)(!1),[k,y]=(0,t.useState)(0),[T,K]=(0,t.useState)(null),D=(0,t.useRef)(null),R=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(D?.current&&f){const u=D?.current?.getBoundingClientRect();y(window?.innerHeight-(u?.top||0))}c?.({open:f})},[f,c]),(0,t.useEffect)(()=>{if(!f)return;const u=(0,de.default)(()=>{if(D?.current){const j=D.current.getBoundingClientRect();R.current=!0,y(window?.innerHeight-(j?.top||0))}},100);return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[f]),(0,ie.useGSAP)(()=>{if(R.current){X.gsap.set(D.current,{height:k}),R.current=!1;return}X.gsap.fromTo(D.current,{height:0},{height:k,duration:.3})},[k]),(0,le.useScrollLock)(f);const B=(0,t.useMemo)(()=>T?.components?.[0]?.blockType,[T]),z=(0,M.WithSupports)(Te.MobileSupportMenu,{categoriesItem:T}),W=(0,M.WithSidebar)(Se.MobileSidebarMenu,T),F=(0,M.WithResource)(Ce.MobileResourceSidebarMenu,T),C=(0,M.WithMulticol)(De.MobileMulticolMenu,T),I=(0,t.useMemo)(()=>{switch(B){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(W,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(F,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(z,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(C,{});default:return null}},[B,T,z]),g=(0,t.useCallback)(()=>{H(!1),y(0),p&&p(r.HeaderNavigationMenu.Primary)},[H,y,p]),A=(0,t.useMemo)(()=>n?.bar?.actions?.filter(u=>u?.mobileShow&&u?.blockType!==r.HeaderNavigationActionBlockType.Profile),[n]),U=(0,t.useMemo)(()=>n?.bar?.actions?.find(u=>u?.mobileShow&&u?.blockType===r.HeaderNavigationActionBlockType.Profile)||{},[n]),O=(0,t.useMemo)(()=>{switch(m){case r.HeaderNavigationMenu.Primary:return(0,e.jsx)(_e,{actions:A,menuOpen:f,onMenuOpenClose:()=>{H(!1),y(0)},onMenuOpenClick:()=>H(!0)});case r.HeaderNavigationMenu.Secondary:return(0,e.jsx)(ge,{title:T?.text,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Primary)});case r.HeaderNavigationMenu.Third:return(0,e.jsx)(ge,{title:v?.label,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Secondary)});default:return null}},[f,m,p,T,A,v,g]),P=(0,t.useCallback)((u,j)=>{const G=Array.isArray(d)?Array.isArray(d[u])?d[u][j]:{}:{};G?.components?.[0]?.blockType!==r.HeaderNavigationBlockType.Links&&(K(G),p?.(r.HeaderNavigationMenu.Secondary))},[d,p]);return(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[56px]",i),children:[O,f&&(0,e.jsxs)("nav",{ref:D,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:[m===r.HeaderNavigationMenu.Primary&&o?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:o})}):null,m===r.HeaderNavigationMenu.Primary?(0,e.jsx)(Oe,{categories:d,onPrimaryMenuClick:P,onPrimaryNavClick:s,profileAction:U,menuData:o}):I]})]})}),Oe=({categories:n,onPrimaryMenuClick:o,profileAction:i,onPrimaryNavClick:s,menuData:c})=>{const{locale:E="us"}=(0,Z.useAiuiContext)();return(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,m)=>(0,e.jsxs)("div",{className:"",children:[m>0||c?(0,e.jsx)("div",{className:(0,N.cn)("my-2 h-px w-full bg-[#E5E5E7]")}):null,d?.map((p,v)=>{const f=p.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links;return(0,e.jsx)(se.MenuItem,{label:p.text,href:f?(0,N.getLocalizedPath)(p.url,E):void 0,target:f?p.target:void 0,onClick:()=>{const k=(n?.flat()||[])?.findIndex(y=>y?.id===n[m][v]?.id);o(m,v),s?.(p,k)},icon:p.components?.[0]?.icon},p.id)})]},`groupCategory-${m}`))}),(0,e.jsx)(je,{profileAction:i})]})},je=({profileAction:n})=>{const[o,i]=(0,t.useState)(!1),{profile:s,event:c}=(0,$.useNavContext)(),{locale:E="us"}=(0,Z.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,N.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":o}),children:[(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>i(!o),"aria-expanded":o,"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)(S.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)(S.DownArrow,{"aria-hidden":"true",className:(0,N.cn)("laptop:size-4 size-5",{"rotate-180":o})})]}),s?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:n?.profiles?.map(d=>(0,e.jsx)(se.MenuItem,{label:d?.title,href:(0,N.getLocalizedPath)(d?.url,E)},d.id))}),o&&!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(d=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:d.benefitIcon?.url,className:"size-4",alt:d.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:d.benefit,className:"text-sm font-bold leading-[1.4]"})]},d.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:()=>c?.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:()=>c?.login?.(),children:(0,e.jsx)(l.Text,{html:n?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},_e=({menuOpen:n,onMenuOpenClose:o,onMenuOpenClick:i,actions:s})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(ve,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(ue,{actions:s}),n?(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>o(),"aria-label":"Close menu","aria-expanded":"true",children:(0,e.jsx)(S.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)(S.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),ve=()=>{const{payloadData:n,isMobile:o}=(0,$.useNavContext)(),{locale:i="us"}=(0,Z.useAiuiContext)();return(0,e.jsx)("a",{href:(0,N.getLocalizedPath)("/",i),className:"hover:text-[#00CBEB] [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:o?n?.bar?.mobileLogo:n?.bar?.desktopLogo}})},ue=(0,t.forwardRef)(({actions:n,activeStatus:o=!1},i)=>{const{event:s,cartCount:c}=(0,$.useNavContext)(),[E,d]=(0,t.useState)(null),m=v=>{switch(v){case r.HeaderNavigationActionBlockType.Search:return"Search";case r.HeaderNavigationActionBlockType.Cart:return`Shopping cart${c>0?` (${c} items)`:""}`;case r.HeaderNavigationActionBlockType.Profile:return"User profile";case r.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},p=(0,t.useCallback)((v,f)=>{switch(d(f),v?.blockType){case r.HeaderNavigationActionBlockType.Search:s?.search?.();break;case r.HeaderNavigationActionBlockType.Cart:s?.cart?.();break;case r.HeaderNavigationActionBlockType.Profile:s?.profile?.();break;case r.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((v,f)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":v?.tag||"",ref:v.blockType===r.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>p(v,f),"aria-label":m(v.blockType),"aria-pressed":o&&E===f,children:[(0,e.jsx)(l.Text,{html:v.icon,className:(0,N.cn)("size-5",{"text-brand-0":o&&E===f}),"aria-hidden":"true"}),v.blockType===r.HeaderNavigationActionBlockType.Cart&&c>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:c?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},v.id))})}),ge=({title:n,onMenuOpenClose:o,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)(S.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:()=>o(),"aria-label":"Close menu",children:(0,e.jsx)(S.Close,{className:"size-5","aria-hidden":"true"})})]});be.displayName="MobileNavigation",ue.displayName="Actions",pe.displayName="HeaderNavigation",fe.displayName="DesktopNavigation";var $e=(0,he.withLayout)(pe);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * 导航内容驱动折叠判断 Hook
3
+ *
4
+ * 通过测量导航区真实渲染后的 DOM,判断是否满足任一「降级为移动端」的触发条件:
5
+ * 1. 导航组之间最小间距 < minGap (默认 16px)
6
+ * 2. 任一导航项文字发生换行或截断
7
+ * 3. 导航区总宽度溢出容器(横向滚动或元素压字)
8
+ *
9
+ * 说明:`[data-nav-item]` 标记的是「导航组」层(groupCategories 遍历后的 group 容器,
10
+ * 通常只有 2 个),组与组之间用 `justify-between` 分布,间距随容器宽度动态变化,
11
+ * 因此「间距过小」正是内容驱动折叠的核心信号;组内 tab 的 gap 是固定的,不参与间距判定。
12
+ *
13
+ * 相比固定断点,该方案让切换点由「内容」决定:导航区可以早于/晚于页面栅格断点切换。
14
+ * 通过滞回缓冲带 (buffer) 避免在临界宽度反复横跳(闪烁):
15
+ * - 展开 → 折叠:任一触发条件命中即折叠(阈值 = minGap)
16
+ * - 折叠 → 展开:需所有条件都满足「恢复到 minGap + buffer」以上才恢复展开
17
+ *
18
+ * 恢复兜底:内容驱动折叠是单向的——折叠后桌面导航被卸载,DOM 中不再有 [data-nav-item],
19
+ * 无法再用内容测量判断恢复。因此当处于折叠态且测不到导航组时,改用视口宽度兜底:
20
+ * 视口 > recoverBreakpoint 时恢复桌面样式(与 PRD 断点矩阵「1441–1920 中屏桌面」对齐)。
21
+ *
22
+ * @param containerRef 导航区容器 ref
23
+ * @param options { minGap: 最小间距阈值, buffer: 滞回缓冲带像素, recoverBreakpoint: 折叠态恢复桌面的视口阈值 }
24
+ * @returns shouldCollapse 是否应折叠为移动端形态
25
+ */
26
+ export declare function useNavCollapse(containerRef: React.RefObject<HTMLElement | null>, { minGap, buffer, recoverBreakpoint, }?: {
27
+ minGap?: number;
28
+ buffer?: number;
29
+ recoverBreakpoint?: number;
30
+ }): boolean;
@@ -0,0 +1 @@
1
+ "use strict";var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var l in e)f(t,l,{get:e[l],enumerable:!0})},A=(t,e,l,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of R(e))!S.call(t,r)&&r!==l&&f(t,r,{get:()=>e[r],enumerable:!(i=C(e,r))||i.enumerable});return t};var E=t=>A(f({},"__esModule",{value:!0}),t);var M={};W(M,{useNavCollapse:()=>L});module.exports=E(M);var s=require("react");function L(t,{minGap:e=16,buffer:l=20,recoverBreakpoint:i=1440}={}){const[r,d]=(0,s.useState)(()=>typeof window>"u"?!1:window.innerWidth<768),a=(0,s.useRef)(!1);return(0,s.useEffect)(()=>{const o=t.current;if(!o)return;const g=()=>{const c=Array.from(o.querySelectorAll("[data-nav-item]"));if(c.length===0){window.innerWidth>i&&(a.current=!1,d(!1));return}const H=a.current?e+l:e;let m=!1,p=!1,b=!1;o.scrollWidth>o.clientWidth+1&&(m=!0);const y=Array.from(o.querySelectorAll("[data-nav-item-label]"));for(const n of y){const u=parseFloat(getComputedStyle(n).lineHeight)||0,v=Math.ceil(u*1.4);if(n.scrollHeight>v+1||n.scrollWidth>n.clientWidth+1){p=!0;break}}for(let n=0;n<c.length-1;n++){const u=c[n].getBoundingClientRect();if(c[n+1].getBoundingClientRect().left-u.right<H){b=!0;break}}const w=m||p||b;a.current=w,d(w)};g();const h=new ResizeObserver(()=>g());return h.observe(o),()=>{h.disconnect()}},[t,e,l,i]),r}
@@ -1,4 +1,4 @@
1
- "use strict";"use client";var H=Object.create;var v=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var q=(e,t)=>{for(var l in t)v(e,l,{get:t[l],enumerable:!0})},S=(e,t,l,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of F(t))!Q.call(e,o)&&o!==l&&v(e,o,{get:()=>t[o],enumerable:!(s=V(t,o))||s.enumerable});return e};var N=(e,t,l)=>(l=e!=null?H(G(e)):{},S(t||!e||!e.__esModule?v(l,"default",{value:e,enumerable:!0}):l,e)),K=e=>S(v({},"__esModule",{value:!0}),e);var ae={};q(ae,{default:()=>te});module.exports=K(ae);var a=require("react/jsx-runtime"),T=N(require("react")),n=require("react"),r=require("../../helpers/utils.js"),P=require("../../components/heading.js"),D=require("../../components/text.js"),_=N(require("../../components/picture.js")),w=require("../../hooks/useExposure.js"),A=require("../../shared/Styles.js"),z=require("../../shared/trackUrlRef.js"),L=require("../../helpers/utils.js"),B=require("../AiuiProvider/index.js"),E=require("react-responsive"),b=require("swiper/react"),M=require("swiper/modules"),re=require("swiper/css"),oe=require("swiper/css/pagination");const U="content",x="image_text_overlay",I="image",$="image-text-overlay-mobile-pagination",y={default:767,tablet:1024,laptop:1439,desktop:1919,lgDesktop:9999},W=e=>{if(!e)return"";const t=[];return e.lgDesktop?.url&&t.push(`${e.lgDesktop.url}`),e.desktop?.url&&t.push(`${e.desktop.url} ${y.desktop}`),e.laptop?.url&&t.push(`${e.laptop.url} ${y.laptop}`),e.tablet?.url&&t.push(`${e.tablet.url} ${y.tablet}`),e.default?.url&&t.push(`${e.default.url} ${y.default}`),t.join(", ")},J=e=>e&&(e.default?.alt||e.tablet?.alt||e.laptop?.alt||e.desktop?.alt||e.lgDesktop?.alt)||"",X=(e,t)=>{const l=[];for(let s=0;s<e.length;s+=t)l.push(e.slice(s,s+t));return l},Y=e=>{switch(e){case 2:return"grid-cols-1 tablet:grid-cols-2";case 3:return"grid-cols-1 tablet:grid-cols-2 laptop:grid-cols-3";case 4:return"grid-cols-1 tablet:grid-cols-2";case 5:return"grid-cols-1 tablet:grid-cols-2 laptop:grid-cols-6";case 6:return"grid-cols-1 tablet:grid-cols-2 desktop:grid-cols-3";default:return e<=1?"grid-cols-1":"grid-cols-1 laptop:grid-cols-3"}},Z=(e,t)=>t===5?e<2?"laptop:col-span-3":"laptop:col-span-2":"",ee=(e,t)=>{switch(e){case 2:case 4:return"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[648/256] lg-desktop:aspect-[824/320]";case 3:return"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[288/192] desktop:aspect-[427/256] lg-desktop:aspect-[544/320]";case 5:return t<2?"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[648/256] lg-desktop:aspect-[824/320]":"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[288/192] desktop:aspect-[427/256] lg-desktop:aspect-[544/320]";case 6:return"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[427/256] lg-desktop:aspect-[544/320]";default:return e<=1?"aspect-[358/240]":"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[648/256] lg-desktop:aspect-[824/320]"}},R=({item:e,index:t,count:l,classNames:s})=>{const o=W(e.backgroundImage),d=J(e.backgroundImage),p=Z(t,l),m=T.useRef(null),{locale:k="us",pageHandle:g}=(0,B.useAiuiContext)();(0,w.useExposure)(m,{componentType:I,componentName:x,position:t+1,componentTitle:e.title,componentDescription:e.subtitle});const i=e.link?(0,L.getLocalizedPath)(e.link,k):void 0,f=i?(0,z.trackUrlRef)(i,`${g??""}_${I}_${x}`):void 0,h=`${e.title}#${e.subtitle||""}#${e.title}`,u=ee(l,t);return(0,a.jsxs)("div",{ref:m,className:(0,r.cn)("image-text-overlay-card rounded-card",{"aiui-dark":e.theme==="dark"},"desktop:p-6 lg-desktop:p-8 group relative flex flex-col items-start justify-end overflow-hidden p-4",u,p,s?.card),children:[f&&(0,a.jsx)("a",{href:f,className:"absolute inset-0 z-20","aria-label":e.title,"data-headless-type-name":`${I}#${x}`,"data-headless-title-desc-button":h}),e.backgroundImage?.isShowVideo?(0,a.jsxs)(a.Fragment,{children:[e.backgroundImage?.mobileVideo&&(0,a.jsx)("video",{className:(0,r.cn)("image-text-overlay-card-image","laptop:hidden absolute inset-0 size-full object-cover",s?.cardImage),src:e.backgroundImage.mobileVideo.url,autoPlay:!0,muted:!0,loop:!0,playsInline:!0}),e.backgroundImage?.desktopVideo&&(0,a.jsx)("video",{className:(0,r.cn)("image-text-overlay-card-image","laptop:block absolute inset-0 hidden size-full object-cover",s?.cardImage),src:e.backgroundImage.desktopVideo.url,autoPlay:!0,muted:!0,loop:!0,playsInline:!0})]}):o&&(0,a.jsx)(_.default,{source:o,alt:d||e.title,className:(0,r.cn)("image-text-overlay-card-image","absolute inset-0 size-full",s?.cardImage),imgClassName:"size-full object-cover cursor-pointer transition-all duration-300 group-hover:scale-105"}),(0,a.jsxs)("div",{className:(0,r.cn)("image-text-overlay-card-content","relative z-10 flex w-full flex-col gap-1",s?.cardContent),children:[(0,a.jsx)(P.Heading,{as:"h4",size:2,weight:"bold",html:e.title,className:(0,r.cn)("image-text-overlay-card-title text-info-primary line-clamp-1","w-full leading-[1.2] tracking-[-0.04em]","desktop:text-xl lg-desktop:text-2xl text-lg",s?.cardTitle)}),e.subtitle&&(0,a.jsx)(D.Text,{as:"p",size:"none",weight:"bold",html:e.subtitle,className:(0,r.cn)("image-text-overlay-card-subtitle text-info-primary line-clamp-1","w-full truncate leading-[1.4] tracking-[-0.02em]","lg-desktop:text-base text-sm",l<=3&&"lg-desktop:text-lg",s?.cardSubtitle)})]})]})},C=(0,n.forwardRef)(({data:e,className:t,classNames:l={},...s},o)=>{const d=T.useRef(null),{items:p=[]}=e,[m,k]=(0,n.useState)(!1),g=(0,E.useMediaQuery)({query:"(max-width: 767px)"});if((0,n.useEffect)(()=>{k(g)},[g]),(0,w.useExposure)(d,{componentType:U,componentName:x}),T.useImperativeHandle(o,()=>d.current),!p.length)return null;const i=p.length,f=i>3&&m,h=X(p,3);return(0,a.jsx)("div",{ref:d,className:(0,r.cn)("image-text-overlay-root",t,l.root),"data-ui-component-id":"ImageTextOverlay",...s,children:f?(0,a.jsxs)("div",{className:"image-text-overlay-mobile-swiper relative pb-8",children:[(0,a.jsx)(b.Swiper,{className:"w-full [&_.swiper-slide]:!h-auto [&_.swiper-wrapper]:items-stretch",modules:[M.Pagination],slidesPerView:1,pagination:{clickable:!0,el:`.${$}`,bulletClass:"image-text-overlay-bullet",bulletActiveClass:"image-text-overlay-bullet-active"},spaceBetween:16,children:h.map((u,c)=>(0,a.jsx)(b.SwiperSlide,{className:"!h-auto",children:(0,a.jsx)("div",{className:"flex flex-col gap-4",children:u.map((j,O)=>(0,a.jsx)(R,{item:j,index:c*3+O,count:i,classNames:l},c*3+O))})},c))}),(0,a.jsx)("div",{className:"absolute inset-x-0 bottom-0 z-10 flex justify-center",children:(0,a.jsx)("div",{className:(0,r.cn)($,"flex items-center justify-center gap-2 text-center","[&_.swiper-pagination-bullet]:m-0","[&_.swiper-pagination-bullet]:shrink-0","[&_.swiper-pagination-bullet]:opacity-100")})}),(0,a.jsx)("style",{children:`
1
+ "use strict";"use client";var V=Object.create;var v=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var l in t)v(e,l,{get:t[l],enumerable:!0})},N=(e,t,l,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!q.call(e,o)&&o!==l&&v(e,o,{get:()=>t[o],enumerable:!(s=F(t,o))||s.enumerable});return e};var S=(e,t,l)=>(l=e!=null?V(Q(e)):{},N(t||!e||!e.__esModule?v(l,"default",{value:e,enumerable:!0}):l,e)),U=e=>N(v({},"__esModule",{value:!0}),e);var se={};K(se,{default:()=>le});module.exports=U(se);var a=require("react/jsx-runtime"),I=S(require("react")),i=require("react"),r=require("../../helpers/utils.js"),P=require("../../components/heading.js"),D=require("../../components/text.js"),_=S(require("../../components/picture.js")),O=require("../../hooks/useExposure.js"),z=require("../../shared/Styles.js"),A=require("../../shared/trackUrlRef.js"),E=require("../../helpers/utils.js"),B=require("../AiuiProvider/index.js"),L=require("react-responsive"),b=require("swiper/react"),M=require("swiper/modules"),ie=require("swiper/css"),pe=require("swiper/css/pagination");const W="content",x="image_text_overlay",w="image",X="image-text-overlay-mobile-pagination",y={default:767,tablet:1024,laptop:1439,desktop:1919,lgDesktop:9999},J=e=>{if(!e)return"";const t=[];return e.lgDesktop?.url&&t.push(`${e.lgDesktop.url}`),e.desktop?.url&&t.push(`${e.desktop.url} ${y.desktop}`),e.laptop?.url&&t.push(`${e.laptop.url} ${y.laptop}`),e.tablet?.url&&t.push(`${e.tablet.url} ${y.tablet}`),e.default?.url&&t.push(`${e.default.url} ${y.default}`),t.join(", ")},Y=e=>e&&(e.default?.alt||e.tablet?.alt||e.laptop?.alt||e.desktop?.alt||e.lgDesktop?.alt)||"",Z=(e,t)=>{const l=[];for(let s=0;s<e.length;s+=t)l.push(e.slice(s,s+t));return l},ee=e=>{switch(e){case 2:return"grid-cols-1 tablet:grid-cols-2";case 3:return"grid-cols-1 tablet:grid-cols-2 laptop:grid-cols-3";case 4:return"grid-cols-1 tablet:grid-cols-2";case 5:return"grid-cols-1 tablet:grid-cols-2 laptop:grid-cols-6";case 6:return"grid-cols-1 tablet:grid-cols-2 desktop:grid-cols-3";default:return e<=1?"grid-cols-1":"grid-cols-1 laptop:grid-cols-3"}},te=(e,t)=>t===5?e<2?"laptop:col-span-3":"laptop:col-span-2":"",ae=(e,t)=>{switch(e){case 2:case 4:return"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[648/256] lg-desktop:aspect-[824/320]";case 3:return"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[288/192] desktop:aspect-[427/256] lg-desktop:aspect-[544/320]";case 5:return t<2?"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[648/256] lg-desktop:aspect-[824/320]":"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[288/192] desktop:aspect-[427/256] lg-desktop:aspect-[544/320]";case 6:return"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[427/256] lg-desktop:aspect-[544/320]";default:return e<=1?"aspect-[358/240]":"aspect-[358/240] tablet:aspect-[346/240] laptop:aspect-[440/192] desktop:aspect-[648/256] lg-desktop:aspect-[824/320]"}},R=({item:e,index:t,count:l,classNames:s})=>{const o=J(e.backgroundImage),d=Y(e.backgroundImage),p=te(t,l),m=I.useRef(null),{locale:k="us",pageHandle:g}=(0,B.useAiuiContext)();(0,O.useExposure)(m,{componentType:w,componentName:x,position:t+1,componentTitle:e.title,componentDescription:e.subtitle});const f=e.link?(0,E.getLocalizedPath)(e.link,k):void 0,u=f?(0,A.trackUrlRef)(f,`${g??""}_${w}_${x}`):void 0,c=`${e.title}#${e.subtitle||""}#${e.title}`,h=ae(l,t);return(0,a.jsxs)("div",{ref:m,className:(0,r.cn)("image-text-overlay-card rounded-card",{"aiui-dark":e.theme==="dark"},"desktop:p-6 lg-desktop:p-8 group relative flex flex-col items-start justify-end overflow-hidden p-4",h,p,s?.card),children:[u&&(0,a.jsx)("a",{href:u,className:"absolute inset-0 z-20","aria-label":e.title,"data-headless-type-name":`${w}#${x}`,"data-headless-title-desc-button":c}),e.backgroundImage?.isShowVideo?(0,a.jsxs)(a.Fragment,{children:[e.backgroundImage?.mobileVideo&&(0,a.jsx)("video",{className:(0,r.cn)("image-text-overlay-card-image","laptop:hidden absolute inset-0 size-full object-cover",s?.cardImage),src:e.backgroundImage.mobileVideo.url,autoPlay:!0,muted:!0,loop:!0,playsInline:!0}),e.backgroundImage?.desktopVideo&&(0,a.jsx)("video",{className:(0,r.cn)("image-text-overlay-card-image","laptop:block absolute inset-0 hidden size-full object-cover",s?.cardImage),src:e.backgroundImage.desktopVideo.url,autoPlay:!0,muted:!0,loop:!0,playsInline:!0})]}):o&&(0,a.jsx)(_.default,{source:o,alt:d||e.title,className:(0,r.cn)("image-text-overlay-card-image","absolute inset-0 size-full",s?.cardImage),imgClassName:"size-full object-cover cursor-pointer transition-all duration-300 group-hover:scale-105"}),(0,a.jsxs)("div",{className:(0,r.cn)("image-text-overlay-card-content","relative z-10 flex w-full flex-col gap-1",s?.cardContent),children:[(0,a.jsx)(P.Heading,{as:"h4",size:2,weight:"bold",html:e.title,className:(0,r.cn)("image-text-overlay-card-title text-info-primary line-clamp-1","w-full leading-[1.2] tracking-[-0.04em]","desktop:text-xl lg-desktop:text-2xl text-lg",s?.cardTitle)}),e.subtitle&&(0,a.jsx)(D.Text,{as:"p",size:"none",weight:"bold",html:e.subtitle,className:(0,r.cn)("image-text-overlay-card-subtitle text-info-primary line-clamp-1","w-full truncate leading-[1.4] tracking-[-0.02em]","lg-desktop:text-base text-sm",l<=3&&"lg-desktop:text-lg",s?.cardSubtitle)})]})]})},C=(0,i.forwardRef)(({data:e,className:t,classNames:l={},...s},o)=>{const d=I.useRef(null),{items:p=[]}=e,[m,k]=(0,i.useState)(!1),g=(0,L.useMediaQuery)({query:"(max-width: 767px)"}),f=(0,i.useId)(),u=`${X}-${f.replace(/[:]/g,"")}`;if((0,i.useEffect)(()=>{k(g)},[g]),(0,O.useExposure)(d,{componentType:W,componentName:x}),I.useImperativeHandle(o,()=>d.current),!p.length)return null;const c=p.length,h=c>3&&m,j=Z(p,3);return(0,a.jsx)("div",{ref:d,className:(0,r.cn)("image-text-overlay-root",t,l.root),"data-ui-component-id":"ImageTextOverlay",...s,children:h?(0,a.jsxs)("div",{className:"image-text-overlay-mobile-swiper relative pb-8",children:[(0,a.jsx)(b.Swiper,{className:"w-full [&_.swiper-slide]:!h-auto [&_.swiper-wrapper]:items-stretch",modules:[M.Pagination],slidesPerView:1,pagination:{clickable:!0,el:`.${u}`,bulletClass:"image-text-overlay-bullet",bulletActiveClass:"image-text-overlay-bullet-active"},spaceBetween:16,children:j.map((T,n)=>(0,a.jsx)(b.SwiperSlide,{className:"!h-auto",children:(0,a.jsx)("div",{className:"flex flex-col gap-4",children:T.map((H,$)=>(0,a.jsx)(R,{item:H,index:n*3+$,count:c,classNames:l},n*3+$))})},n))}),(0,a.jsx)("div",{className:"absolute inset-x-0 bottom-0 z-10 flex justify-center",children:(0,a.jsx)("div",{className:(0,r.cn)(u,"flex items-center justify-center gap-2 text-center","[&_.swiper-pagination-bullet]:m-0","[&_.swiper-pagination-bullet]:shrink-0","[&_.swiper-pagination-bullet]:opacity-100")})}),(0,a.jsx)("style",{children:`
2
2
  .image-text-overlay-bullet {
3
3
  display: inline-block;
4
4
  width: 8px;
@@ -14,4 +14,4 @@
14
14
  border-radius: 9999px;
15
15
  background: #080A0F;
16
16
  }
17
- `})]}):(0,a.jsx)("div",{className:(0,r.cn)("image-text-overlay-grid","grid gap-4",Y(i),l.grid),children:p.map((u,c)=>(0,a.jsx)(R,{item:u,index:c,count:i,classNames:l},c))})})});C.displayName="ImageTextOverlay";var te=(0,A.withLayout)(C);
17
+ `})]}):(0,a.jsx)("div",{className:(0,r.cn)("image-text-overlay-grid","grid gap-4",ee(c),l.grid),children:p.map((T,n)=>(0,a.jsx)(R,{item:T,index:n,count:c,classNames:l},n))})})});C.displayName="ImageTextOverlay";var le=(0,z.withLayout)(C);
@@ -1 +1 @@
1
- "use strict";"use client";var fe=Object.create;var S=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty;var we=(n,p)=>{for(var g in p)S(n,g,{get:p[g],enumerable:!0})},U=(n,p,g,b)=>{if(p&&typeof p=="object"||typeof p=="function")for(let v of ge(p))!be.call(n,v)&&v!==g&&S(n,v,{get:()=>p[v],enumerable:!(b=he(p,v))||b.enumerable});return n};var _e=(n,p,g)=>(g=n!=null?fe(ve(n)):{},U(p||!n||!n.__esModule?S(g,"default",{value:n,enumerable:!0}):g,n)),ye=n=>U(S({},"__esModule",{value:!0}),n);var Ie={};we(Ie,{default:()=>Te});module.exports=ye(Ie);var e=require("react/jsx-runtime"),a=_e(require("react")),r=require("../../components/index.js"),l=require("../../helpers/utils.js"),ee=require("../../shared/Styles.js"),te=require("../../hooks/useExposure.js"),ie=require("../../hooks/useIntersectionObserver.js"),ae=require("../AiuiProvider/index.js"),k=require("framer-motion");const ke="image",Ne="image_with_text",X=(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,e.jsx)("path",{d:"M6.91009 4.41058C7.23553 4.08514 7.76304 4.08514 8.08848 4.41058L13.0885 9.41058C13.4139 9.73602 13.4139 10.2635 13.0885 10.589L8.08848 15.589C7.76304 15.9144 7.23553 15.9144 6.91009 15.589C6.58466 15.2635 6.58466 14.736 6.91009 14.4106L11.3209 9.99977L6.91009 5.58897C6.58466 5.26353 6.58466 4.73602 6.91009 4.41058Z",fill:"currentColor"})}),Y=a.default.forwardRef(({data:n,className:p},g)=>{const{title:b,subtitle:v,desc:_,descIcon:M,image:N,padImage:z,mobileImage:E,theme:oe="dark",items:H=[],layout:le="left",mediaType:se="image",datalist:d=[],video:j,padVideo:R,mobVideo:W,button:w,textAlign:m="left",titleTag:re}=n,i=le,{locale:C="us"}=(0,ae.useAiuiContext)(),D=(0,a.useRef)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),P=(0,a.useRef)(null),A=(0,a.useRef)(null),[u,ne]=(0,a.useState)(0),q=(0,a.useRef)([]),[$,me]=(0,a.useState)({left:0,width:0}),[y,B]=(0,a.useState)(""),[F,O]=(0,a.useState)(""),[Z,G]=(0,a.useState)(""),c=d.length>0,T=se==="video";(0,te.useExposure)(D,{componentType:ke,componentName:Ne,componentTitle:b,componentDescription:v}),(0,a.useImperativeHandle)(g,()=>D.current),(0,a.useEffect)(()=>{if(d.length>0){const t=q.current[u];if(t){const{offsetLeft:s,offsetWidth:o}=t;me({left:s,width:o})}}},[u,d.length]);const[J,de]=(0,a.useState)(!1);(0,ie.useIntersectionObserverDelay)(A,{once:!0,threshold:.01,callback:()=>{de(!0)}}),(0,a.useEffect)(()=>{if(!J||!T)return;let t="",s="",o="";if(c&&d[u]){const f=d[u];t=f.video?.url||"",s=f.padVideo?.url||t,o=f.mobVideo?.url||t}else t=j?.url||"",s=R?.url||t,o=W?.url||t;t&&B(t),s&&O(s),o&&G(o),setTimeout(()=>{[I.current?.querySelector("video"),L.current?.querySelector("video"),P.current?.querySelector("video")].forEach(h=>{h&&(h.load(),h.play().catch(()=>{}))})},200)},[J,T,c,u,d,j?.url,R?.url,W?.url]);const pe=(t,s)=>{if(ne(t),s.target.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),T&&c&&d[t]){const o=d[t];o.video?.url&&B(o.video.url),o.padVideo?.url&&O(o.padVideo.url),o.mobVideo?.url&&G(o.mobVideo.url),setTimeout(()=>{[I.current?.querySelector("video"),L.current?.querySelector("video"),P.current?.querySelector("video")].forEach(h=>{h&&(h.load(),h.play().catch(()=>{}))})},300)}},ce=()=>!V||!w?.text||i==="top"||i==="bottom"?null:(0,e.jsx)("div",{className:(0,l.cn)("image-with-text__button-wrapper laptop:mt-[32px] mt-[24px]",{"flex justify-center":m==="center","flex justify-start":m==="left"}),children:(0,e.jsx)(r.Link,{href:(0,l.getLocalizedPath)(w.link||"",C),className:"image-with-text__button whitespace-nowrap no-underline",suffixIcon:X,children:w.text})}),x=H.length>0,V=!!w,K=()=>{if(c&&d[u]){const t=d[u];return`${t.image?.url} ,${t.imgPad?.url||t.image?.url} 1440, ${t.imageMob?.url||t.image?.url} 767`}return N?`${N?.url},${z?.url||N?.url} 1024, ${E?.url||N?.url} 768`:""},Q=()=>{if(c){const f=d[u],h=f.image?.url,xe=f.imgPad?.url||h,ue=f.imageMob?.url||h;return(0,e.jsx)(k.AnimatePresence,{mode:"wait",children:(0,e.jsx)(k.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__video-motion absolute left-0 top-0 w-full",children:(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:I,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:h,src:y,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:L,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:xe,src:F||y,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:ue,src:Z||y,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})},f.video?.url||f.image?.url)})}const t=N?.url,s=z?.url||t,o=E?.url||t;return(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box laptop:rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:I,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:t,src:y,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:L,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:s,src:F||y,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:o,src:Z||y,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})};return(0,e.jsxs)("section",{ref:D,"data-ui-component-id":"ImageWithText",className:(0,l.cn)("image-with-text text-info-primary",{"flex gap-[24px] laptop:gap-[48px] lg-desktop:gap-[64px]":!c,"flex-col":!c&&(i==="top"||i==="bottom"),"items-center":i==="left"||i==="right","flex-col laptop:flex-row":!c&&(i==="left"||i==="right"),"flex l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]":c,"aiui-dark":oe==="dark"},p),children:[c&&(b||_||d.length>0)&&(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__tab-content min-md:gap-[24px] laptop:basis-[36%] inline-flex flex-col justify-center",{"text-left":m==="left","text-center":m==="center"}),children:[(0,e.jsxs)("div",{className:"image-with-text__header",children:[(0,e.jsx)(r.Heading,{as:"h3",size:4,html:b,className:"image-with-text__title"}),(0,e.jsx)(r.Text,{as:"p",size:1,html:_,className:"image-with-text__description tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]"})]}),(0,e.jsx)("div",{className:(0,l.cn)("image-with-text__tabs-wrapper md:scrollbar-hidden relative md:overflow-hidden md:overflow-x-scroll",{"flex justify-center":m==="center"}),children:(0,e.jsxs)("div",{className:"image-with-text__tabs rounded-btn relative inline-flex bg-[#1D1D1F] px-[4px] md:my-[24px]",children:[(0,e.jsx)("div",{className:"image-with-text__slider rounded-btn absolute inset-y-0 bg-white transition-all duration-300 ease-in-out",style:{left:$.left,width:$.width}}),d.map((t,s)=>(0,e.jsx)("div",{ref:o=>{q.current[s]=o},onClick:o=>pe(s,o),className:(0,l.cn)("image-with-text__tab rounded-btn min-xxl:px-[28px] min-xxl:py-[15px] relative z-10 cursor-pointer px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px]",u===s?"image-with-text__tab--active text-black":"text-white"),children:(0,e.jsx)(r.Heading,{as:re??"h3",size:1,html:t?.title,className:"image-with-text__tab-title text-balance-normal !whitespace-nowrap md:text-[14px]"})},s))]})})]}),!c&&(b||v||_)&&(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__content flex w-full flex-col",{"justify-center":!V,"justify-between":V,"items-start":m==="left"&&x,"items-center":m==="center"&&x,"text-left":m==="left","text-center":m==="center","laptop:order-1":i==="left"}),children:[(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__main-content",{"flex flex-col":V}),children:[(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__header",{"laptop:flex laptop:items-end laptop:justify-between laptop:gap-16":(i==="top"||i==="bottom")&&w?.text}),children:[(0,e.jsxs)("div",{className:"image-with-text__title-wrapper flex min-w-0 flex-1 flex-col",children:[(0,e.jsx)(r.Heading,{as:"h2",size:4,html:b,className:(0,l.cn)("image-with-text__title",{"text-left":x&&m==="left","text-center":x&&m==="center"})}),v&&(0,e.jsx)(r.Text,{as:"p",size:x?4:3,html:v,className:(0,l.cn)("image-with-text__subtitle tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]",{"laptop:mt-[16px]":!x,"min-xxl:mt-[8px] laptop:text-[16px] lg-desktop:text-[18px]":x,"text-left":x&&m==="left","text-center":x&&m==="center"})})]}),(i==="top"||i==="bottom")&&w?.text&&(0,e.jsx)(r.Link,{href:(0,l.getLocalizedPath)(w.link||"",C),className:"laptop:flex hidden whitespace-nowrap no-underline",suffixIcon:X,children:w.text})]}),!x&&(_||M)&&(0,e.jsxs)("div",{className:"image-with-text__description flex flex-row gap-[8px]",children:[M&&(0,e.jsx)("img",{src:M,alt:"icon",className:"image-with-text__description-icon desktop:size-[48px] size-[36px]"}),_&&(0,e.jsx)(r.Heading,{as:"h4",size:5,html:_,className:"image-with-text__description-text min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] text-[#3AD1FF] md:text-[40px]"})]}),x&&(0,e.jsx)("div",{className:(0,l.cn)("image-with-text__items laptop:mt-[32px] desktop:mt-[48px] mt-[24px] grid w-full gap-6",{"!mt-6":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4 laptop:grid-cols-2":i==="left"||i==="right"}),children:H.map((t,s)=>(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__item",{"text-center":m==="center"}),children:[(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__item-header flex flex-row items-center gap-[8px]",{"justify-center":m==="center","justify-start":m==="left"}),children:[t.icon?.url&&(0,e.jsx)(r.Picture,{source:t.icon.url,alt:t.icon?.alt,className:"image-with-text__item-icon min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] desktop:h-[44px] lg-desktop:h-[52px] h-[28px] translate-y-[-12%] md:text-[40px]",imgClassName:"h-full !w-full"}),(0,e.jsx)(r.Heading,{size:4,as:"h6",className:"image-with-text__item-text bg-gradient-to-r from-[#3ad1ff] to-[#008cd6] bg-clip-text text-transparent",children:t.text})]}),(0,e.jsx)(r.Text,{size:4,as:"p",html:t.desc,className:"image-with-text__item-desc tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[-2px] text-[14px]"})]},s))})]}),ce()]}),(0,e.jsx)("div",{ref:A,className:(0,l.cn)("image-with-text__media-wrapper",{"laptop:w-[60%] w-full shrink-0":i==="left"||i==="right","aspect-[716/720] max-h-[560px] max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[824/560] shrink-0":x,"laptop:basis-[63%] desktop:basis-[57%]":x&&i==="left","relative w-full shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]":c,"!max-w-none !max-h-none aspect-auto":i==="top"||i==="bottom"}),children:c?T?Q():(0,e.jsx)(k.AnimatePresence,{mode:"wait",children:(0,e.jsx)(k.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__image-motion absolute left-0 top-0 w-full",children:(0,e.jsx)(r.Picture,{source:K(),alt:d[u].image?.alt,className:"image-with-text__image rounded-box min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] md:aspect-[358/360]"})},d[u].image?.url)}):T?Q():(0,e.jsx)(r.Picture,{source:K(),className:(0,l.cn)("image-with-text__image rounded-box laptop:rounded-box")})})]})});Y.displayName="ImageWithText";var Te=(0,ee.withLayout)(Y);
1
+ "use strict";"use client";var fe=Object.create;var S=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty;var we=(n,c)=>{for(var g in c)S(n,g,{get:c[g],enumerable:!0})},U=(n,c,g,b)=>{if(c&&typeof c=="object"||typeof c=="function")for(let v of ge(c))!be.call(n,v)&&v!==g&&S(n,v,{get:()=>c[v],enumerable:!(b=he(c,v))||b.enumerable});return n};var _e=(n,c,g)=>(g=n!=null?fe(ve(n)):{},U(c||!n||!n.__esModule?S(g,"default",{value:n,enumerable:!0}):g,n)),ye=n=>U(S({},"__esModule",{value:!0}),n);var Ie={};we(Ie,{default:()=>Te});module.exports=ye(Ie);var e=require("react/jsx-runtime"),i=_e(require("react")),r=require("../../components/index.js"),o=require("../../helpers/utils.js"),ee=require("../../shared/Styles.js"),te=require("../../hooks/useExposure.js"),ie=require("../../hooks/useIntersectionObserver.js"),ae=require("../AiuiProvider/index.js"),k=require("framer-motion");const ke="image",Ne="image_with_text",X=(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,e.jsx)("path",{d:"M6.91009 4.41058C7.23553 4.08514 7.76304 4.08514 8.08848 4.41058L13.0885 9.41058C13.4139 9.73602 13.4139 10.2635 13.0885 10.589L8.08848 15.589C7.76304 15.9144 7.23553 15.9144 6.91009 15.589C6.58466 15.2635 6.58466 14.736 6.91009 14.4106L11.3209 9.99977L6.91009 5.58897C6.58466 5.26353 6.58466 4.73602 6.91009 4.41058Z",fill:"currentColor"})}),Y=i.default.forwardRef(({data:n,className:c},g)=>{const{title:b,subtitle:v,desc:_,descIcon:M,image:N,padImage:z,mobileImage:E,theme:oe="dark",items:H=[],layout:le="left",mediaType:se="image",datalist:d=[],video:j,padVideo:R,mobVideo:W,button:w,textAlign:m="left",titleTag:re}=n,l=le,{locale:C="us"}=(0,ae.useAiuiContext)(),D=(0,i.useRef)(null),I=(0,i.useRef)(null),L=(0,i.useRef)(null),P=(0,i.useRef)(null),A=(0,i.useRef)(null),[u,ne]=(0,i.useState)(0),q=(0,i.useRef)([]),[$,me]=(0,i.useState)({left:0,width:0}),[y,B]=(0,i.useState)(""),[F,O]=(0,i.useState)(""),[Z,G]=(0,i.useState)(""),p=d.length>0,T=se==="video";(0,te.useExposure)(D,{componentType:ke,componentName:Ne,componentTitle:b,componentDescription:v}),(0,i.useImperativeHandle)(g,()=>D.current),(0,i.useEffect)(()=>{if(d.length>0){const t=q.current[u];if(t){const{offsetLeft:s,offsetWidth:a}=t;me({left:s,width:a})}}},[u,d.length]);const[J,de]=(0,i.useState)(!1);(0,ie.useIntersectionObserverDelay)(A,{once:!0,threshold:.01,callback:()=>{de(!0)}}),(0,i.useEffect)(()=>{if(!J||!T)return;let t="",s="",a="";if(p&&d[u]){const f=d[u];t=f.video?.url||"",s=f.padVideo?.url||t,a=f.mobVideo?.url||t}else t=j?.url||"",s=R?.url||t,a=W?.url||t;t&&B(t),s&&O(s),a&&G(a),setTimeout(()=>{[I.current?.querySelector("video"),L.current?.querySelector("video"),P.current?.querySelector("video")].forEach(h=>{h&&(h.load(),h.play().catch(()=>{}))})},200)},[J,T,p,u,d,j?.url,R?.url,W?.url]);const ce=(t,s)=>{if(ne(t),s.target.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),T&&p&&d[t]){const a=d[t];a.video?.url&&B(a.video.url),a.padVideo?.url&&O(a.padVideo.url),a.mobVideo?.url&&G(a.mobVideo.url),setTimeout(()=>{[I.current?.querySelector("video"),L.current?.querySelector("video"),P.current?.querySelector("video")].forEach(h=>{h&&(h.load(),h.play().catch(()=>{}))})},300)}},pe=()=>!V||!w?.text||l==="bottom"?null:(0,e.jsx)("div",{className:(0,o.cn)("image-with-text__button-wrapper laptop:mt-[32px] mt-[24px]",{"flex justify-center":m==="center","flex justify-start":m==="left"}),children:(0,e.jsx)(r.Link,{href:(0,o.getLocalizedPath)(w.link||"",C),className:"image-with-text__button whitespace-nowrap no-underline",suffixIcon:X,children:w.text})}),x=H.length>0,V=!!w,K=()=>{if(p&&d[u]){const t=d[u];return`${t.image?.url} ,${t.imgPad?.url||t.image?.url} 1440, ${t.imageMob?.url||t.image?.url} 767`}return N?`${N?.url},${z?.url||N?.url} 1024, ${E?.url||N?.url} 768`:""},Q=()=>{if(p){const f=d[u],h=f.image?.url,xe=f.imgPad?.url||h,ue=f.imageMob?.url||h;return(0,e.jsx)(k.AnimatePresence,{mode:"wait",children:(0,e.jsx)(k.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__video-motion absolute left-0 top-0 w-full",children:(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:I,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:h,src:y,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:L,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:xe,src:F||y,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:ue,src:Z||y,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})},f.video?.url||f.image?.url)})}const t=N?.url,s=z?.url||t,a=E?.url||t;return(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box laptop:rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:I,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:t,src:y,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:L,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:s,src:F||y,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:a,src:Z||y,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})};return(0,e.jsxs)("section",{ref:D,"data-ui-component-id":"ImageWithText",className:(0,o.cn)("image-with-text text-info-primary",{"flex gap-[24px] laptop:gap-[48px] lg-desktop:gap-[64px]":!p,"flex-col":!p&&l==="bottom","items-center":l==="left"||l==="right","flex-col laptop:flex-row":!p&&(l==="left"||l==="right"),"flex l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]":p,"aiui-dark":oe==="dark"},c),children:[p&&(b||_||d.length>0)&&(0,e.jsxs)("div",{className:(0,o.cn)("image-with-text__tab-content min-md:gap-[24px] laptop:basis-[36%] inline-flex flex-col justify-center",{"text-left":m==="left","text-center":m==="center"}),children:[(0,e.jsxs)("div",{className:"image-with-text__header",children:[(0,e.jsx)(r.Heading,{as:"h3",size:4,html:b,className:"image-with-text__title"}),(0,e.jsx)(r.Text,{as:"p",size:1,html:_,className:"image-with-text__description tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]"})]}),(0,e.jsx)("div",{className:(0,o.cn)("image-with-text__tabs-wrapper md:scrollbar-hidden relative md:overflow-hidden md:overflow-x-scroll",{"flex justify-center":m==="center"}),children:(0,e.jsxs)("div",{className:"image-with-text__tabs rounded-btn relative inline-flex bg-[#1D1D1F] px-[4px] md:my-[24px]",children:[(0,e.jsx)("div",{className:"image-with-text__slider rounded-btn absolute inset-y-0 bg-white transition-all duration-300 ease-in-out",style:{left:$.left,width:$.width}}),d.map((t,s)=>(0,e.jsx)("div",{ref:a=>{q.current[s]=a},onClick:a=>ce(s,a),className:(0,o.cn)("image-with-text__tab rounded-btn min-xxl:px-[28px] min-xxl:py-[15px] relative z-10 cursor-pointer px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px]",u===s?"image-with-text__tab--active text-black":"text-white"),children:(0,e.jsx)(r.Heading,{as:re??"h3",size:1,html:t?.title,className:"image-with-text__tab-title text-balance-normal !whitespace-nowrap md:text-[14px]"})},s))]})})]}),!p&&(b||v||_)&&(0,e.jsxs)("div",{className:(0,o.cn)("image-with-text__content flex w-full flex-col",{"justify-center":!V,"justify-between":V,"items-start":m==="left"&&x,"items-center":m==="center"&&x,"text-left":m==="left","text-center":m==="center","laptop:order-1":l==="left"}),children:[(0,e.jsxs)("div",{className:(0,o.cn)("image-with-text__main-content",{"flex flex-col":V}),children:[(0,e.jsxs)("div",{className:(0,o.cn)("image-with-text__header",{"laptop:flex laptop:items-end laptop:justify-between laptop:gap-16":l==="bottom"&&w?.text}),children:[(0,e.jsxs)("div",{className:"image-with-text__title-wrapper flex min-w-0 flex-1 flex-col",children:[(0,e.jsx)(r.Heading,{as:"h2",size:4,html:b,className:(0,o.cn)("image-with-text__title",{"text-left":x&&m==="left","text-center":x&&m==="center"})}),v&&(0,e.jsx)(r.Text,{as:"p",size:x?4:3,html:v,className:(0,o.cn)("image-with-text__subtitle tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]",{"laptop:mt-[16px]":!x,"min-xxl:mt-[8px] laptop:text-[16px] lg-desktop:text-[18px]":x,"text-left":x&&m==="left","text-center":x&&m==="center"})})]}),l==="bottom"&&w?.text&&(0,e.jsx)(r.Link,{href:(0,o.getLocalizedPath)(w.link||"",C),className:"laptop:flex hidden whitespace-nowrap no-underline",suffixIcon:X,children:w.text})]}),!x&&(_||M)&&(0,e.jsxs)("div",{className:"image-with-text__description flex flex-row gap-[8px]",children:[M&&(0,e.jsx)("img",{src:M,alt:"icon",className:"image-with-text__description-icon desktop:size-[48px] size-[36px]"}),_&&(0,e.jsx)(r.Heading,{as:"h4",size:5,html:_,className:"image-with-text__description-text min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] text-[#3AD1FF] md:text-[40px]"})]}),x&&(0,e.jsx)("div",{className:(0,o.cn)("image-with-text__items laptop:mt-[32px] desktop:mt-[48px] mt-[24px] grid w-full gap-6",{"!mt-6":l==="bottom","grid-cols-2 tablet:grid-cols-4":l==="bottom","grid-cols-2 tablet:grid-cols-4 laptop:grid-cols-2":l==="left"||l==="right"}),children:H.map((t,s)=>(0,e.jsxs)("div",{className:(0,o.cn)("image-with-text__item",{"text-center":m==="center"}),children:[(0,e.jsxs)("div",{className:(0,o.cn)("image-with-text__item-header flex flex-row items-center gap-[8px]",{"justify-center":m==="center","justify-start":m==="left"}),children:[t.icon?.url&&(0,e.jsx)(r.Picture,{source:t.icon.url,alt:t.icon?.alt,className:"image-with-text__item-icon min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] desktop:h-[44px] lg-desktop:h-[52px] h-[28px] translate-y-[-12%] md:text-[40px]",imgClassName:"h-full !w-full"}),(0,e.jsx)(r.Heading,{size:4,as:"h6",className:"image-with-text__item-text bg-gradient-to-r from-[#3ad1ff] to-[#008cd6] bg-clip-text text-transparent",children:t.text})]}),(0,e.jsx)(r.Text,{size:4,as:"p",html:t.desc,className:"image-with-text__item-desc tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[-2px] text-[14px]"})]},s))})]}),pe()]}),(0,e.jsx)("div",{ref:A,className:(0,o.cn)("image-with-text__media-wrapper",{"laptop:w-[60%] w-full shrink-0":l==="left"||l==="right","aspect-[716/720] max-h-[560px] max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[824/560] shrink-0":x&&l!=="bottom","laptop:basis-[63%] desktop:basis-[57%]":x&&l==="left","relative w-full shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]":p,"!max-w-none !max-h-none aspect-auto":l==="bottom"}),children:p?T?Q():(0,e.jsx)(k.AnimatePresence,{mode:"wait",children:(0,e.jsx)(k.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__image-motion absolute left-0 top-0 w-full",children:(0,e.jsx)(r.Picture,{source:K(),alt:d[u].image?.alt,className:"image-with-text__image rounded-box min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] md:aspect-[358/360]"})},d[u].image?.url)}):T?Q():(0,e.jsx)(r.Picture,{source:K(),className:(0,o.cn)("image-with-text__image rounded-box laptop:rounded-box")})})]})});Y.displayName="ImageWithText";var Te=(0,ee.withLayout)(Y);
@@ -45,7 +45,7 @@ export interface ImageWithTextTabItem {
45
45
  title: string;
46
46
  }
47
47
  export type MediaType = 'image' | 'video';
48
- export type LayoutPosition = 'left' | 'right' | 'top' | 'bottom';
48
+ export type LayoutPosition = 'left' | 'right' | 'bottom';
49
49
  export type TextAlign = 'left' | 'center';
50
50
  /** 列数枚举类型 */
51
51
  export declare enum Cols {
@@ -68,7 +68,7 @@ export interface ImageWithTextProps {
68
68
  descIcon?: string;
69
69
  /** 主题,默认 dark */
70
70
  theme?: Theme;
71
- /** 布局位置,默认 left。支持上下左右布局(left/right/top/bottom) */
71
+ /** 布局位置,默认 left。支持左右布局(left/right)和上下布局(bottom,图下文上) */
72
72
  layout?: LayoutPosition;
73
73
  /** 媒体类型,默认 image。所有模式都支持 image 和 video */
74
74
  mediaType?: MediaType;
@@ -1 +1 @@
1
- "use strict";var ie=Object.create;var H=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var ce=(e,l)=>{for(var i in l)H(e,i,{get:l[i],enumerable:!0})},O=(e,l,i,w)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of re(l))!se.call(e,s)&&s!==i&&H(e,s,{get:()=>l[s],enumerable:!(w=oe(l,s))||w.enumerable});return e};var de=(e,l,i)=>(i=e!=null?ie(ne(e)):{},O(l||!e||!e.__esModule?H(i,"default",{value:e,enumerable:!0}):i,e)),ue=e=>O(H({},"__esModule",{value:!0}),e);var fe={};ce(fe,{default:()=>ge});module.exports=ue(fe);var t=require("react/jsx-runtime"),W=require("../../../../AiuiProvider/index.js"),_=require("../../../../../components/index.js"),a=require("react"),T=require("swiper/react"),b=require("swiper/modules"),C=require("../../../../../helpers/index.js"),A=require("./types.js"),I=require("@radix-ui/react-tabs"),j=require("../../../BizProductProvider.js"),J=require("../../../hooks/use-variant-media.js"),Q=require("./components/SpecsModal.js"),X=de(require("./components/CompareModal.js")),ee=require("../../../utils/index.js"),te=require("../../../../../shared/Styles.js"),ae=require("../../../../../shared/track.js"),le=require("../../../../../components/index.js"),Y=require("es-toolkit");const q=e=>(0,t.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,t.jsx)("rect",{x:"48",y:"48",width:"48",height:"48",rx:"24",transform:"rotate(-180 48 48)",fill:"white"}),(0,t.jsx)("path",{d:"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z",fill:"currentColor"})]}),U=e=>(0,t.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,t.jsx)("rect",{width:"48",height:"48",rx:"24",transform:"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)",fill:"white"}),(0,t.jsx)("path",{d:"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z",fill:"currentColor"})]}),pe=()=>{const{copyWriting:e}=(0,W.useAiuiContext)(),{product:l,variant:i,selectedOptions:w}=(0,j.useBizProductContext)(),s=(0,J.useVariantMedia)({product:l,variant:i}),[y,N]=(0,a.useState)(null),V=(0,a.useRef)(null),f=i?.metafields?.component?.custom_media_list;let u,S,E,L;f&&f?.available?(u=f?.product||[],S=f?.scenarios||[],E=f?.keyFeatures||[],L=f?.video||[]):(u=s?.productList,S=s?.sceneList,E=s?.keyFeaturesList,L=s?.videoList);const p=(0,a.useMemo)(()=>[...u,...S,...L],[u,S,L]),g={productList:u,sceneList:S,keyFeaturesList:E,videoList:L},o=(0,a.useMemo)(()=>{const n=l?.payload?.components?.find(v=>v.componentKey==="ProductGallery")?.data||[],d=i?.payload?.components?.find(v=>v.componentKey==="ProductGallery")?.data||[];return n?.map(v=>{const k=Array.isArray(d)?d?.find(F=>v?.galleries===F?.galleries):{};let D=g[v?.galleries]||[];if(k?.images&&Array.isArray(k.images)&&k.images.length>0){const F=k.images.map(m=>{const M=[];if(m.image_1920&&m.image_1920.trim()&&M.push(`${m.image_1920}`),m.image_1440&&m.image_1440.trim()&&M.push(`${m.image_1440} 1919`),m.image_1024&&m.image_1024.trim()&&M.push(`${m.image_1024} 1439`),m.image_768&&m.image_768.trim()&&M.push(`${m.image_768} 1023`),m.image_390&&m.image_390.trim()&&M.push(`${m.image_390} 767`),M.length>0){const K=M.join(", ");return{image:{url:K,altText:v.comment?.content||""},_fromImages:!0,_responsiveSource:K}}return null}).filter(m=>m!==null);F.length>0&&(D=F)}return{...v,galleries:D}}).filter(v=>v.galleries.length>0)},[i?.payload,g,l?.payload]),[x,r]=(0,a.useState)(o?.[0]),[c,P]=(0,a.useState)(0),[h,G]=(0,a.useState)(null),R=(0,a.useCallback)(()=>{const n=(c+1)%o.length;P(n),r(o[n]),G(0)},[c,o]),z=(0,a.useCallback)(()=>{const n=c===0?o.length-1:c-1;P(n),r(o[n]);const d=o[n]?.galleries||[];G(d.length-1)},[c,o]);(0,a.useEffect)(()=>{c!=null&&requestAnimationFrame(()=>{V.current?.scrollToTab(c)})},[c]),(0,a.useEffect)(()=>{r(o[0]),P(0)},[i?.id]);const B=(n,d)=>{switch(n?.galleryTabType){case A.GalleryTabType.GALLERY_IMAGE_MAIN:return(0,t.jsx)($,{...n,index:d,onNextTab:R,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_IMAGE_FEATURES:return(0,t.jsx)($,{...n,index:d,onNextTab:R,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_IMAGE_SCENE:return(0,t.jsx)($,{...n,index:d,onNextTab:R,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});case A.GalleryTabType.GALLERY_VIDEO:return(0,t.jsx)(be,{...n,onNextTab:R,onPrevTab:z,targetSlideIndex:h,onSlideChange:()=>G(null)});default:return null}};return(0,t.jsx)("div",{id:"ipc-product-gallery",children:(0,t.jsxs)(I.Root,{className:"relative",value:x?.tabValue,defaultValue:o?.[0]?.tabValue,children:[(0,t.jsx)("div",{className:"tablet:h-[620px] laptop-md:rounded-2xl laptop-md:h-[560px] lg-desktop:h-[700px] laptop-md:relative h-[420px] overflow-hidden bg-[#EAEAEC] ",children:o.map((n,d)=>(0,t.jsx)(I.Content,{className:"h-full",value:n.tabValue,children:B(n,d)},n.tabValue))}),(0,t.jsx)(Z,{ref:V,galleryTabs:o,activeGalleryTab:x,setActiveGalleryTab:r,setActiveTabIndex:P,setTargetSlideIndex:G})]})})},Z=(0,a.forwardRef)((e,l)=>{const{galleryTabs:i,activeGalleryTab:w,setActiveGalleryTab:s,setActiveTabIndex:y,setTargetSlideIndex:N}=e,{product:V}=(0,j.useBizProductContext)(),f=(0,a.useRef)(null),u=(0,a.useRef)(new Map),S=(0,a.useCallback)(p=>{if(f.current){const g=f.current,o=p.currentTarget,x=o.offsetLeft-g.offsetWidth/2+o.offsetWidth/2;g.scrollTo({left:x,behavior:"smooth"})}},[]),E=(0,a.useCallback)((p,g,o)=>{s(g),y(o),N(0),S(p)},[s,y,N,S]),L=(0,a.useCallback)(p=>{if(f.current&&i[p]){const g=f.current,o=i[p],x=u.current.get(o.tabValue);if(x){const r=x.offsetLeft-g.offsetWidth/2+x.offsetWidth/2;g.scrollTo({left:r,behavior:"smooth"})}}},[i]);return(0,a.useImperativeHandle)(l,()=>({scrollToTab:L})),(0,t.jsxs)("div",{className:"laptop:inset-x-16 tablet:mt-3 laptop-md:static absolute inset-x-4 bottom-4 z-[2] flex items-center justify-between",children:[(0,t.jsx)(I.List,{ref:f,className:"laptop:p-0 laptop-md:p-1 overflow-x-auto rounded-full bg-[#EAEAEC] p-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,t.jsx)("div",{className:"whitespace-nowrap",children:i?.map((p,g)=>(0,t.jsx)(I.Trigger,{ref:o=>{o?u.current.set(p.tabValue,o):u.current.delete(p.tabValue)},className:(0,C.cn)("lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] rounded-full px-5 pb-[10px] pt-[11px] text-[14px] font-bold leading-tight",p.tabValue===w?.tabValue&&"bg-white"),onClick:o=>E(o,p,g),value:p.tabValue,children:p.tabLabel},p.tabValue+g))})}),(0,t.jsx)("div",{className:"desktop:gap-2 desktop:flex hidden",children:V.metafields?.global?.specifications&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q.SpecsModal,{})," | ",(0,t.jsx)(X.default,{})]})})]})});Z.displayName="ProductGalleryTab";const $=(0,a.forwardRef)((e,l)=>{const{locale:i="us",copyWriting:w}=(0,W.useAiuiContext)(),{variant:s,totalSavings:y}=(0,j.useBizProductContext)(),N=(0,a.useRef)(null),[V,f]=(0,a.useState)(null),[u,S]=(0,a.useState)(null),[E,L]=(0,a.useState)([]),p=(0,a.useRef)(null),g=(0,a.useMemo)(()=>{if(e?.galleryTabType===A.GalleryTabType.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";e?.galleryTabType===A.GalleryTabType.GALLERY_IMAGE_FEATURES||(e?.galleryTabType,A.GalleryTabType.GALLERY_IMAGE_SCENE)},[e?.galleryTabType]),o=(0,a.useCallback)(()=>{u?.isBeginning?e.onPrevTab?.():u?.slidePrev()},[u,e]),x=(0,a.useCallback)(()=>{u?.isEnd?e.onNextTab?.():u?.slideNext()},[u,e]);return(0,a.useEffect)(()=>{u&&e.targetSlideIndex&&(u.slideTo(e.targetSlideIndex,0),e.onSlideChange?.())},[u,e.targetSlideIndex,e]),(0,a.useEffect)(()=>{const r=()=>{if(!e?.comment?.content||!p.current)return;const h=p.current;h.textContent="Test";const R=h.offsetHeight*2+2,B=e.comment.content.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim().split(" "),n=[];let d="";for(let v=0;v<B.length;v++){const k=B[v],D=d?`${d} ${k}`:k;h.textContent=D,h.offsetHeight>R?d?(n.push(d),d=k):(n.push(k),d=""):d=D}d&&n.push(d),h.textContent="",L(n)},c=requestAnimationFrame(()=>{requestAnimationFrame(()=>{r()})}),P=()=>{r()};return window.addEventListener("resize",(0,Y.debounce)(P,500)),()=>{cancelAnimationFrame(c),window.removeEventListener("resize",(0,Y.debounce)(P,500))}},[e?.comment?.content]),(0,t.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,t.jsx)(T.Swiper,{ref:l,className:"h-full",onSwiper:S,onTouchEnd:(r,c)=>{r.isBeginning&&r.swipeDirection==="prev"?o():r.isEnd&&r.swipeDirection==="next"&&x()},pagination:{clickable:!0,el:N.current},thumbs:{swiper:V},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:e?.galleries?.map((r,c)=>{const P=`${e.tabValue}-${c}`,h=()=>{(0,ae.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${s.sku}`,component_type:"image",component_name:e?.tabLabel||"",position:c+1,creative_id:"",component_title:"",component_description:"",navigation:""}})},G=r?._responsiveSource||r?.image?.url||"";return(0,t.jsx)(T.SwiperSlide,{className:"h-full",children:(0,t.jsx)(le.ExposureDetector,{onExposure:h,exposureKey:P,threshold:.5,duration:2e3,className:"h-full",children:(0,t.jsx)(_.Picture,{source:G,alt:r?.image?.altText,className:(0,C.cn)("h-full",g),imgClassName:"object-cover h-full"})})},e?.id+"SwiperSlideItem"+c)})}),s.availableForSale&&!!y&&!e.index&&(0,t.jsx)(_.Badge,{size:"lg",className:"bg-brand-0 laptop:left-16 laptop:top-5 laptop-md:left-6 laptop-md:top-6 absolute left-4 top-3 z-[2] text-white",children:`${(0,ee.formatPrice)({amount:y,currencyCode:s?.price?.currencyCode,locale:i})} ${w?.off}`}),(0,t.jsx)("div",{className:(0,C.cn)("tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 laptop-md:left-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:o,children:(0,t.jsx)(q,{className:(0,C.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,t.jsx)("div",{className:(0,C.cn)("tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 laptop-md:right-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:x,children:(0,t.jsx)(U,{className:(0,C.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,t.jsxs)("div",{className:"tablet:bottom-[70px] tablet:flex laptop:inset-x-16 laptop-md:bottom-[20px] laptop-md:inset-x-6 absolute inset-x-4 bottom-[94px] z-10 items-center justify-between",children:[(0,t.jsx)("div",{className:"tablet:block hidden",children:(0,t.jsx)(T.Swiper,{className:"flex items-center justify-between",onSwiper:f,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[b.Navigation,b.Thumbs],children:e?.galleries?.map((r,c)=>(0,t.jsx)(T.SwiperSlide,{className:"[&.swiper-slide-thumb-active]:border-brand !w-auto cursor-pointer border border-transparent [&.swiper-slide-thumb-active]:rounded",children:(0,t.jsx)(_.Picture,{source:r.image?.url,alt:r.image?.altText,className:"lg-desktop:size-12 size-10 overflow-hidden rounded bg-white",imgClassName:"object-cover h-full"})},e?.id+"SwiperSlideThumbItem"+c))})}),!e?.index&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(_.Picture,{source:e?.comment?.avatar?.url,className:"laptop:size-10 size-8 shrink-0 rounded-full",imgClassName:"object-cover "}),(0,t.jsxs)("div",{className:"relative max-w-[528px]",children:[(0,t.jsx)("div",{ref:p,className:"lg-desktop:text-base pointer-events-none text-sm font-bold text-[#1D1D1F] opacity-0",style:{visibility:"hidden"}}),(0,t.jsx)(T.Swiper,{modules:[b.Autoplay],loop:E.length>1,className:"h-[44px]",direction:"vertical",autoplay:{delay:5e3,disableOnInteraction:!1},children:E.length>0?E.map((r,c)=>(0,t.jsx)(T.SwiperSlide,{children:(0,t.jsx)(_.Text,{html:r,as:"div",className:"lg-desktop:text-base overflow-hidden text-sm font-bold text-[#1D1D1F]"})},c+"text-group")):(0,t.jsx)(T.SwiperSlide,{children:(0,t.jsx)(_.Text,{as:"div",html:e?.comment?.content,className:"lg-desktop:text-base text-sm font-bold text-[#1D1D1F]"})})})]})]})]}),(0,t.jsx)("div",{ref:N,className:"tablet:hidden absolute inset-x-4 !bottom-[70px] z-10 text-center [&_.swiper-pagination-bullet-active]:!bg-[#080A0F] [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100"})]})});$.displayName="ProductGalleryTabImage";const me=({src:e})=>{const l=(0,a.useRef)(null);return(0,a.useEffect)(()=>{const i=l.current;i&&(i.muted=!0,i.play().catch(()=>{}))},[]),(0,t.jsxs)("video",{ref:l,playsInline:!0,autoPlay:!0,loop:!0,muted:!0,controls:!0,className:"w-full mt-20 laptop:size-full laptop:mt-0 aspect-video laptop:aspect-auto object-cover",children:[(0,t.jsx)("track",{kind:"captions"}),(0,t.jsx)("source",{src:e,type:"video/mp4"}),(0,t.jsx)("source",{src:e,type:"video/webm"}),(0,t.jsx)("source",{src:e,type:"video/ogg"})]})},be=e=>{const[l,i]=(0,a.useState)(null),w=(0,a.useCallback)(()=>{l?.isBeginning?e.onPrevTab?.():l?.slidePrev()},[l,e]),s=(0,a.useCallback)(()=>{l?.isEnd?e.onNextTab?.():l?.slideNext()},[l,e]);return(0,a.useEffect)(()=>{l&&e.targetSlideIndex!==null&&e.targetSlideIndex!==void 0&&(l.slideTo(e.targetSlideIndex,0),e.onSlideChange?.())},[l,e.targetSlideIndex,e]),(0,t.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,t.jsx)(T.Swiper,{className:"h-full",onSwiper:i,onTouchEnd:(y,N)=>{y.isBeginning&&y.swipeDirection==="prev"?w():y.isEnd&&y.swipeDirection==="next"&&s()},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:e?.galleries?.map((y,N)=>(0,t.jsx)(T.SwiperSlide,{className:"h-full bg-info-primary",children:(0,t.jsx)(me,{src:y?.sources?.[0]?.url})},e?.id+"SwiperSlideItem"+N))}),(0,t.jsx)("div",{className:(0,C.cn)("swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:w,children:(0,t.jsx)(q,{className:"tablet:size-10 lg-desktop:size-12"})}),(0,t.jsx)("div",{className:(0,C.cn)("tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:s,children:(0,t.jsx)(U,{className:"tablet:size-10 lg-desktop:size-12"})})]})},ye=e=>(0,t.jsx)("div",{children:"3D View"});var ge=(0,te.withLayout)(pe);
1
+ "use strict";var ie=Object.create;var H=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var ce=(e,l)=>{for(var r in l)H(e,r,{get:l[r],enumerable:!0})},O=(e,l,r,S)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of re(l))!se.call(e,c)&&c!==r&&H(e,c,{get:()=>l[c],enumerable:!(S=oe(l,c))||S.enumerable});return e};var de=(e,l,r)=>(r=e!=null?ie(ne(e)):{},O(l||!e||!e.__esModule?H(r,"default",{value:e,enumerable:!0}):r,e)),ue=e=>O(H({},"__esModule",{value:!0}),e);var fe={};ce(fe,{default:()=>ge});module.exports=ue(fe);var t=require("react/jsx-runtime"),W=require("../../../../AiuiProvider/index.js"),k=require("../../../../../components/index.js"),a=require("react"),w=require("swiper/react"),b=require("swiper/modules"),P=require("../../../../../helpers/index.js"),C=require("./types.js"),_=require("@radix-ui/react-tabs"),j=require("../../../BizProductProvider.js"),J=require("../../../hooks/use-variant-media.js"),Q=require("./components/SpecsModal.js"),X=de(require("./components/CompareModal.js")),ee=require("../../../utils/index.js"),te=require("../../../../../shared/Styles.js"),ae=require("../../../../../shared/track.js"),le=require("../../../../../components/index.js"),Y=require("es-toolkit");const q=e=>(0,t.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,t.jsx)("rect",{x:"48",y:"48",width:"48",height:"48",rx:"24",transform:"rotate(-180 48 48)",fill:"white"}),(0,t.jsx)("path",{d:"M25.1035 16.8545C25.5372 16.3818 26.246 16.3818 26.6797 16.8545C27.1067 17.3201 27.1067 18.0706 26.6797 18.5361L21.668 24L26.6797 29.4639C27.1067 29.9294 27.1067 30.6799 26.6797 31.1455C26.246 31.6182 25.5372 31.6182 25.1035 31.1455L19.3203 24.8408C18.8933 24.3752 18.8933 23.6248 19.3203 23.1592L25.1035 16.8545Z",fill:"currentColor"})]}),U=e=>(0,t.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,t.jsx)("rect",{width:"48",height:"48",rx:"24",transform:"matrix(1 -8.74228e-08 -8.74228e-08 -1 0 48)",fill:"white"}),(0,t.jsx)("path",{d:"M22.8965 16.8545C22.4628 16.3818 21.754 16.3818 21.3203 16.8545C20.8933 17.3201 20.8933 18.0706 21.3203 18.5361L26.332 24L21.3203 29.4639C20.8933 29.9294 20.8933 30.6799 21.3203 31.1455C21.754 31.6182 22.4628 31.6182 22.8965 31.1455L28.6797 24.8408C29.1067 24.3752 29.1067 23.6248 28.6797 23.1592L22.8965 16.8545Z",fill:"currentColor"})]}),pe=()=>{const{copyWriting:e}=(0,W.useAiuiContext)(),{product:l,variant:r,selectedOptions:S}=(0,j.useBizProductContext)(),c=(0,J.useVariantMedia)({product:l,variant:r}),[y,E]=(0,a.useState)(null),M=(0,a.useRef)(null),G=r?.metafields?.component?.custom_media_list;let s,h,x,T;G&&G?.available?(s=G?.product||[],h=G?.scenarios||[],x=G?.keyFeatures||[],T=G?.video||[]):(s=c?.productList,h=c?.sceneList,x=c?.keyFeaturesList,T=c?.videoList);const A=(0,a.useMemo)(()=>[...s,...h,...T],[s,h,T]),V={productList:s,sceneList:h,keyFeaturesList:x,videoList:T},p=(0,a.useMemo)(()=>{const n=l?.payload?.components?.find(v=>v.componentKey==="ProductGallery")?.data||[],u=r?.payload?.components?.find(v=>v.componentKey==="ProductGallery")?.data||[];return n?.map(v=>{const L=Array.isArray(u)?u?.find(F=>v?.galleries===F?.galleries):{};let D=V[v?.galleries]||[];if(L?.images&&Array.isArray(L.images)&&L.images.length>0){const F=L.images.map(m=>{const I=[];if(m.image_1920&&m.image_1920.trim()&&I.push(`${m.image_1920}`),m.image_1440&&m.image_1440.trim()&&I.push(`${m.image_1440} 1919`),m.image_1024&&m.image_1024.trim()&&I.push(`${m.image_1024} 1439`),m.image_768&&m.image_768.trim()&&I.push(`${m.image_768} 1023`),m.image_390&&m.image_390.trim()&&I.push(`${m.image_390} 767`),I.length>0){const K=I.join(", ");return{image:{url:K,altText:v.comment?.content||""},_fromImages:!0,_responsiveSource:K}}return null}).filter(m=>m!==null);F.length>0&&(D=F)}return{...v,galleries:D}}).filter(v=>v.galleries.length>0)},[r?.payload,V,l?.payload]),[d,i]=(0,a.useState)(p?.[0]),[o,g]=(0,a.useState)(0),[f,N]=(0,a.useState)(null),R=(0,a.useCallback)(()=>{const n=(o+1)%p.length;g(n),i(p[n]),N(0)},[o,p]),z=(0,a.useCallback)(()=>{const n=o===0?p.length-1:o-1;g(n),i(p[n]);const u=p[n]?.galleries||[];N(u.length-1)},[o,p]);(0,a.useEffect)(()=>{o!=null&&requestAnimationFrame(()=>{M.current?.scrollToTab(o)})},[o]),(0,a.useEffect)(()=>{i(p[0]),g(0)},[r?.id]);const B=(n,u)=>{switch(n?.galleryTabType){case C.GalleryTabType.GALLERY_IMAGE_MAIN:return(0,t.jsx)($,{...n,index:u,onNextTab:R,onPrevTab:z,targetSlideIndex:f,onSlideChange:()=>N(null)});case C.GalleryTabType.GALLERY_IMAGE_FEATURES:return(0,t.jsx)($,{...n,index:u,onNextTab:R,onPrevTab:z,targetSlideIndex:f,onSlideChange:()=>N(null)});case C.GalleryTabType.GALLERY_IMAGE_SCENE:return(0,t.jsx)($,{...n,index:u,onNextTab:R,onPrevTab:z,targetSlideIndex:f,onSlideChange:()=>N(null)});case C.GalleryTabType.GALLERY_VIDEO:return(0,t.jsx)(be,{...n,onNextTab:R,onPrevTab:z,targetSlideIndex:f,onSlideChange:()=>N(null)});default:return null}};return(0,t.jsx)("div",{id:"ipc-product-gallery",children:(0,t.jsxs)(_.Root,{className:"relative",value:d?.tabValue,defaultValue:p?.[0]?.tabValue,children:[(0,t.jsx)("div",{className:"tablet:h-[620px] laptop-md:rounded-2xl laptop-md:h-[560px] lg-desktop:h-[700px] laptop-md:relative h-[420px] overflow-hidden bg-[#EAEAEC] ",children:p.map((n,u)=>(0,t.jsx)(_.Content,{className:"h-full",value:n.tabValue,children:B(n,u)},n.tabValue))}),(0,t.jsx)(Z,{ref:M,galleryTabs:p,activeGalleryTab:d,setActiveGalleryTab:i,setActiveTabIndex:g,setTargetSlideIndex:N})]})})},Z=(0,a.forwardRef)((e,l)=>{const{galleryTabs:r,activeGalleryTab:S,setActiveGalleryTab:c,setActiveTabIndex:y,setTargetSlideIndex:E}=e,{product:M,compareData:G}=(0,j.useBizProductContext)(),s=(0,a.useRef)(null),h=(0,a.useRef)(new Map),x=!!M.metafields?.global?.specifications?.length,T=!!G?.specificationKeys?.length,A=(0,a.useCallback)(d=>{if(s.current){const i=s.current,o=d.currentTarget,g=o.offsetLeft-i.offsetWidth/2+o.offsetWidth/2;i.scrollTo({left:g,behavior:"smooth"})}},[]),V=(0,a.useCallback)((d,i,o)=>{c(i),y(o),E(0),A(d)},[c,y,E,A]),p=(0,a.useCallback)(d=>{if(s.current&&r[d]){const i=s.current,o=r[d],g=h.current.get(o.tabValue);if(g){const f=g.offsetLeft-i.offsetWidth/2+g.offsetWidth/2;i.scrollTo({left:f,behavior:"smooth"})}}},[r]);return(0,a.useImperativeHandle)(l,()=>({scrollToTab:p})),(0,t.jsxs)("div",{className:"laptop:inset-x-16 tablet:mt-3 laptop-md:static absolute inset-x-4 bottom-4 z-[2] flex items-center justify-between",children:[(0,t.jsx)(_.List,{ref:s,className:"laptop:p-0 laptop-md:p-1 overflow-x-auto rounded-full bg-[#EAEAEC] p-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,t.jsx)("div",{className:"whitespace-nowrap",children:r?.map((d,i)=>(0,t.jsx)(_.Trigger,{ref:o=>{o?h.current.set(d.tabValue,o):h.current.delete(d.tabValue)},className:(0,P.cn)("lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px] rounded-full px-5 pb-[10px] pt-[11px] text-[14px] font-bold leading-tight",d.tabValue===S?.tabValue&&"bg-white"),onClick:o=>V(o,d,i),value:d.tabValue,children:d.tabLabel},d.tabValue+i))})}),(x||T)&&(0,t.jsxs)("div",{className:"desktop:gap-2 desktop:flex hidden",children:[x&&(0,t.jsx)(Q.SpecsModal,{}),x&&T&&(0,t.jsx)("span",{children:"|"}),T&&(0,t.jsx)(X.default,{})]})]})});Z.displayName="ProductGalleryTab";const $=(0,a.forwardRef)((e,l)=>{const{locale:r="us",copyWriting:S}=(0,W.useAiuiContext)(),{variant:c,totalSavings:y}=(0,j.useBizProductContext)(),E=(0,a.useRef)(null),[M,G]=(0,a.useState)(null),[s,h]=(0,a.useState)(null),[x,T]=(0,a.useState)([]),A=(0,a.useRef)(null),V=(0,a.useMemo)(()=>{if(e?.galleryTabType===C.GalleryTabType.GALLERY_IMAGE_MAIN)return"size-[240px] mx-auto mt-[42px] tablet:mt-16 tablet:size-[420px] lg-desktop:size-[560px]";e?.galleryTabType===C.GalleryTabType.GALLERY_IMAGE_FEATURES||(e?.galleryTabType,C.GalleryTabType.GALLERY_IMAGE_SCENE)},[e?.galleryTabType]),p=(0,a.useCallback)(()=>{s?.isBeginning?e.onPrevTab?.():s?.slidePrev()},[s,e]),d=(0,a.useCallback)(()=>{s?.isEnd?e.onNextTab?.():s?.slideNext()},[s,e]);return(0,a.useEffect)(()=>{s&&e.targetSlideIndex&&(s.slideTo(e.targetSlideIndex,0),e.onSlideChange?.())},[s,e.targetSlideIndex,e]),(0,a.useEffect)(()=>{const i=()=>{if(!e?.comment?.content||!A.current)return;const f=A.current;f.textContent="Test";const R=f.offsetHeight*2+2,B=e.comment.content.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim().split(" "),n=[];let u="";for(let v=0;v<B.length;v++){const L=B[v],D=u?`${u} ${L}`:L;f.textContent=D,f.offsetHeight>R?u?(n.push(u),u=L):(n.push(L),u=""):u=D}u&&n.push(u),f.textContent="",T(n)},o=requestAnimationFrame(()=>{requestAnimationFrame(()=>{i()})}),g=()=>{i()};return window.addEventListener("resize",(0,Y.debounce)(g,500)),()=>{cancelAnimationFrame(o),window.removeEventListener("resize",(0,Y.debounce)(g,500))}},[e?.comment?.content]),(0,t.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,t.jsx)(w.Swiper,{ref:l,className:"h-full",onSwiper:h,onTouchEnd:(i,o)=>{i.isBeginning&&i.swipeDirection==="prev"?p():i.isEnd&&i.swipeDirection==="next"&&d()},pagination:{clickable:!0,el:E.current},thumbs:{swiper:M},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:e?.galleries?.map((i,o)=>{const g=`${e.tabValue}-${o}`,f=()=>{(0,ae.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${c.sku}`,component_type:"image",component_name:e?.tabLabel||"",position:o+1,creative_id:"",component_title:"",component_description:"",navigation:""}})},N=i?._responsiveSource||i?.image?.url||"";return(0,t.jsx)(w.SwiperSlide,{className:"h-full",children:(0,t.jsx)(le.ExposureDetector,{onExposure:f,exposureKey:g,threshold:.5,duration:2e3,className:"h-full",children:(0,t.jsx)(k.Picture,{source:N,alt:i?.image?.altText,className:(0,P.cn)("h-full",V),imgClassName:"object-cover h-full"})})},e?.id+"SwiperSlideItem"+o)})}),c.availableForSale&&!!y&&!e.index&&(0,t.jsx)(k.Badge,{size:"lg",className:"bg-brand-0 laptop:left-16 laptop:top-5 laptop-md:left-6 laptop-md:top-6 absolute left-4 top-3 z-[2] text-white",children:`${(0,ee.formatPrice)({amount:y,currencyCode:c?.price?.currencyCode,locale:r})} ${S?.off}`}),(0,t.jsx)("div",{className:(0,P.cn)("tablet:opacity-0 tablet:block tablet:absolute tablet:top-1/2 laptop:left-16 tablet:left-6 laptop-md:left-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:p,children:(0,t.jsx)(q,{className:(0,P.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,t.jsx)("div",{className:(0,P.cn)("tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 laptop:right-16 tablet:right-6 laptop-md:right-6 z-10 hidden -translate-y-1/2 cursor-pointer","swiper-button"),onClick:d,children:(0,t.jsx)(U,{className:(0,P.cn)("tablet:size-10 lg-desktop:size-12")})}),(0,t.jsxs)("div",{className:"tablet:bottom-[70px] tablet:flex laptop:inset-x-16 laptop-md:bottom-[20px] laptop-md:inset-x-6 absolute inset-x-4 bottom-[94px] z-10 items-center justify-between",children:[(0,t.jsx)("div",{className:"tablet:block hidden",children:(0,t.jsx)(w.Swiper,{className:"flex items-center justify-between",onSwiper:G,spaceBetween:12,slidesPerView:6,freeMode:!0,watchSlidesProgress:!0,modules:[b.Navigation,b.Thumbs],children:e?.galleries?.map((i,o)=>(0,t.jsx)(w.SwiperSlide,{className:"[&.swiper-slide-thumb-active]:border-brand !w-auto cursor-pointer border border-transparent [&.swiper-slide-thumb-active]:rounded",children:(0,t.jsx)(k.Picture,{source:i.image?.url,alt:i.image?.altText,className:"lg-desktop:size-12 size-10 overflow-hidden rounded bg-white",imgClassName:"object-cover h-full"})},e?.id+"SwiperSlideThumbItem"+o))})}),!e?.index&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(k.Picture,{source:e?.comment?.avatar?.url,className:"laptop:size-10 size-8 shrink-0 rounded-full",imgClassName:"object-cover "}),(0,t.jsxs)("div",{className:"relative max-w-[528px]",children:[(0,t.jsx)("div",{ref:A,className:"lg-desktop:text-base pointer-events-none text-sm font-bold text-[#1D1D1F] opacity-0",style:{visibility:"hidden"}}),(0,t.jsx)(w.Swiper,{modules:[b.Autoplay],loop:x.length>1,className:"h-[44px]",direction:"vertical",autoplay:{delay:5e3,disableOnInteraction:!1},children:x.length>0?x.map((i,o)=>(0,t.jsx)(w.SwiperSlide,{children:(0,t.jsx)(k.Text,{html:i,as:"div",className:"lg-desktop:text-base overflow-hidden text-sm font-bold text-[#1D1D1F]"})},o+"text-group")):(0,t.jsx)(w.SwiperSlide,{children:(0,t.jsx)(k.Text,{as:"div",html:e?.comment?.content,className:"lg-desktop:text-base text-sm font-bold text-[#1D1D1F]"})})})]})]})]}),(0,t.jsx)("div",{ref:E,className:"tablet:hidden absolute inset-x-4 !bottom-[70px] z-10 text-center [&_.swiper-pagination-bullet-active]:!bg-[#080A0F] [&_.swiper-pagination-bullet]:bg-white [&_.swiper-pagination-bullet]:opacity-100"})]})});$.displayName="ProductGalleryTabImage";const me=({src:e})=>{const l=(0,a.useRef)(null);return(0,a.useEffect)(()=>{const r=l.current;r&&(r.muted=!0,r.play().catch(()=>{}))},[]),(0,t.jsxs)("video",{ref:l,playsInline:!0,autoPlay:!0,loop:!0,muted:!0,controls:!0,className:"w-full mt-20 laptop:size-full laptop:mt-0 aspect-video laptop:aspect-auto object-cover",children:[(0,t.jsx)("track",{kind:"captions"}),(0,t.jsx)("source",{src:e,type:"video/mp4"}),(0,t.jsx)("source",{src:e,type:"video/webm"}),(0,t.jsx)("source",{src:e,type:"video/ogg"})]})},be=e=>{const[l,r]=(0,a.useState)(null),S=(0,a.useCallback)(()=>{l?.isBeginning?e.onPrevTab?.():l?.slidePrev()},[l,e]),c=(0,a.useCallback)(()=>{l?.isEnd?e.onNextTab?.():l?.slideNext()},[l,e]);return(0,a.useEffect)(()=>{l&&e.targetSlideIndex!==null&&e.targetSlideIndex!==void 0&&(l.slideTo(e.targetSlideIndex,0),e.onSlideChange?.())},[l,e.targetSlideIndex,e]),(0,t.jsxs)("div",{className:"h-full [&_.swiper-button]:hover:opacity-100",children:[(0,t.jsx)(w.Swiper,{className:"h-full",onSwiper:r,onTouchEnd:(y,E)=>{y.isBeginning&&y.swipeDirection==="prev"?S():y.isEnd&&y.swipeDirection==="next"&&c()},modules:[b.Mousewheel,b.Thumbs,b.Navigation,b.Pagination],mousewheel:{forceToAxis:!0},breakpoints:{0:{slidesPerView:1,freeMode:!1}},children:e?.galleries?.map((y,E)=>(0,t.jsx)(w.SwiperSlide,{className:"h-full bg-info-primary",children:(0,t.jsx)(me,{src:y?.sources?.[0]?.url})},e?.id+"SwiperSlideItem"+E))}),(0,t.jsx)("div",{className:(0,P.cn)("swiper-button tablet:block tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:left-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:S,children:(0,t.jsx)(q,{className:"tablet:size-10 lg-desktop:size-12"})}),(0,t.jsx)("div",{className:(0,P.cn)("tablet:block swiper-button tablet:opacity-0 tablet:absolute tablet:top-1/2 tablet:right-6 z-10 hidden -translate-y-1/2 cursor-pointer"),onClick:c,children:(0,t.jsx)(U,{className:"tablet:size-10 lg-desktop:size-12"})})]})},ye=e=>(0,t.jsx)("div",{children:"3D View"});var ge=(0,te.withLayout)(pe);
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var i=(a,p)=>{for(var t in p)c(a,t,{get:p[t],enumerable:!0})},x=(a,p,t,e)=>{if(p&&typeof p=="object"||typeof p=="function")for(let l of s(p))!r.call(a,l)&&l!==t&&c(a,l,{get:()=>p[l],enumerable:!(e=m(p,l))||e.enumerable});return a};var g=a=>x(c({},"__esModule",{value:!0}),a);var R={};i(R,{default:()=>N});module.exports=g(R);var o=require("react/jsx-runtime"),d=require("../../../../components/index.js");const G=({BoxLeftGallery:a,BoxRightDetail:p,BoxBottomSummary:t})=>(0,o.jsxs)("div",{id:"ipc-product-card",className:"laptop-md:pt-6 laptop-md:px-16 lg-desktop:px-[calc(50%-832px)]",children:[(0,o.jsxs)(d.Grid,{className:"laptop-md:gap-x-4 lg-desktop:gap-6 gap-8 laptop:gap-y-8 laptop-md:gap-y-8",children:[(0,o.jsx)(d.GridItem,{className:"laptop:px-0 laptop-md:col-start-1 laptop-md:col-span-8 laptop-md:sticky laptop-md:top-[124px] col-span-12 h-fit",children:a}),(0,o.jsx)(d.GridItem,{className:"laptop-md:col-start-9 laptop-md:col-span-4 col-span-12",children:p})]}),t]});var N=G;
1
+ "use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var s=(t,p)=>{for(var a in p)c(t,a,{get:p[a],enumerable:!0})},x=(t,p,a,e)=>{if(p&&typeof p=="object"||typeof p=="function")for(let d of m(p))!r.call(t,d)&&d!==a&&c(t,d,{get:()=>p[d],enumerable:!(e=i(p,d))||e.enumerable});return t};var g=t=>x(c({},"__esModule",{value:!0}),t);var R={};s(R,{default:()=>N});module.exports=g(R);var o=require("react/jsx-runtime"),l=require("../../../../components/index.js");const G=({BoxLeftGallery:t,BoxRightDetail:p,BoxBottomSummary:a})=>(0,o.jsxs)("div",{id:"ipc-product-card",className:"laptop-md:pt-6 laptop-md:px-16 lg-desktop:px-[calc(50%-832px)]",children:[(0,o.jsxs)(l.Grid,{className:"ipc-box-grid laptop-md:gap-x-4 lg-desktop:gap-6 gap-8 laptop:gap-y-8 laptop-md:gap-y-8",children:[(0,o.jsx)(l.GridItem,{className:"ipc-box-left-grid-item laptop:px-0 laptop-md:col-start-1 laptop-md:col-span-8 laptop-md:sticky laptop-md:top-[124px] col-span-12 h-fit",children:t}),(0,o.jsx)(l.GridItem,{className:"ipc-box-right-grid-item laptop-md:col-start-9 laptop-md:col-span-4 col-span-12",children:p})]}),a]});var N=G;
@@ -1,7 +1,13 @@
1
1
  import { type ReactNode } from 'react';
2
+ export interface ComparePriceRenderData {
3
+ /** 划线价金额 */
4
+ comparePrice: number;
5
+ }
2
6
  export interface ProductActionsProps {
3
7
  /** 自定义总节省组件,传入时会替代默认的 totalSavings 显示 */
4
8
  totalSavingsSlot?: ReactNode;
9
+ /** 自定义划线价渲染,传入时替换默认的划线价显示 */
10
+ renderComparePrice?: (data: ComparePriceRenderData) => ReactNode;
5
11
  }
6
- declare const ProductActions: ({ totalSavingsSlot }?: ProductActionsProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const ProductActions: ({ totalSavingsSlot, renderComparePrice }?: ProductActionsProps) => import("react/jsx-runtime").JSX.Element;
7
13
  export default ProductActions;
@@ -1 +1 @@
1
- "use strict";var j=Object.create;var u=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var $=(t,e)=>{for(var o in e)u(t,o,{get:e[o],enumerable:!0})},h=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z(e))!W.call(t,n)&&n!==o&&u(t,n,{get:()=>e[n],enumerable:!(c=q(e,n))||c.enumerable});return t};var G=(t,e,o)=>(o=t!=null?j(U(t)):{},h(e||!t||!t.__esModule?u(o,"default",{value:t,enumerable:!0}):o,t)),H=t=>h(u({},"__esModule",{value:!0}),t);var K={};$(K,{default:()=>J});module.exports=H(K);var a=require("react/jsx-runtime"),r=require("../../../../../components/index.js"),w=require("../../../../AiuiProvider/index.js"),S=require("../../../BizProductProvider.js"),b=require("react"),i=require("../../../utils/index.js"),f=require("../../../utils/textFormat.js"),T=require("../../../hooks/useBenefits.js"),k=G(require("../../CartActionButtons/index.js"));const I=({totalSavingsSlot:t}={})=>{const{copyWriting:e,locale:o="us",trackingData:c,currencyCode:n}=(0,w.useAiuiContext)(),{variant:l,finalPrice:A,totalSavings:d,isLogin:p,comparePrice:M,onAddToCart:P,onBuyNow:D,savingDetail:x,addToCartLoading:B,buyNowLoading:F,notifyMeMode:L,onNotifyMeClick:E,discount:Q,memberFunctionResult:g}=(0,S.useBizProductContext)(),R=(0,T.useBenefits)({variant:l}),{commonCoupon:m,memberDiscount:s}=R,O=c?.showComparePrice??!0,_=(0,b.useMemo)(()=>(0,f.replaceTemplate)(e?.totalSavings||"",{amount:(0,i.formatPrice)({amount:d,currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})}),[e?.totalSavings,d,l.price.currencyCode,o]),C=(0,b.useMemo)(()=>{if(!e?.unlockedSaving)return;const y=m?.enable?Number(m?.config?.fixed_value||0):0,v=s?.enable?s.config?.amount??0:0,N=Math.round((g?.withoutCouponMaxMemberTotalSave?Math.max(v,y):v+y)*100)/100;if(!(N<=0))return(0,f.replaceTemplate)(e.unlockedSaving,{amount:(0,i.formatPrice)({amount:N,currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})})},[e?.unlockedSaving,m?.enable,m?.config?.fixed_value,s?.enable,s?.config?.amount,g,l.price.currencyCode,o]);return(0,a.jsxs)(r.Container,{childClassName:"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4",className:"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3",children:[l.availableForSale?(0,a.jsxs)("div",{className:"laptop-md:items-end flex flex-col justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(r.Text,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]",html:(0,i.formatPrice)({amount:parseFloat(A.toFixed(2)),currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})}),O&&(d>0||x?.member>0&&p)&&(0,a.jsx)(r.Text,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through",html:(0,i.formatPrice)({amount:M,currencyCode:l.price.currencyCode,locale:n==="CAD"?"us":o||"us"})}),x?.member>0&&p&&(0,a.jsx)(r.Text,{className:"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white",html:e?.memberPrice||"Member Price"})]}),t||(d>0||x?.member>0&&p?(0,a.jsx)(r.Text,{className:"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:`${_}`}):C?(0,a.jsx)(r.Text,{className:"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:C}):null)]}):(0,a.jsx)(r.Text,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),(0,a.jsx)("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:(0,a.jsx)(k.default,{mode:L,availableForSale:l.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:B,buyNowLoading:F,onAddToCart:P,onBuyNow:D,onNotifyMeClick:E,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var J=I;
1
+ "use strict";var q=Object.create;var p=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var G=(t,o)=>{for(var e in o)p(t,e,{get:o[e],enumerable:!0})},S=(t,o,e,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of U(o))!$.call(t,i)&&i!==e&&p(t,i,{get:()=>o[i],enumerable:!(n=z(o,i))||n.enumerable});return t};var H=(t,o,e)=>(e=t!=null?q(W(t)):{},S(o||!t||!t.__esModule?p(e,"default",{value:t,enumerable:!0}):e,t)),I=t=>S(p({},"__esModule",{value:!0}),t);var Q={};G(Q,{default:()=>K});module.exports=I(Q);var a=require("react/jsx-runtime"),l=require("../../../../../components/index.js"),P=require("../../../../AiuiProvider/index.js"),T=require("../../../BizProductProvider.js"),f=require("react"),c=require("../../../utils/index.js"),g=require("../../../utils/textFormat.js"),k=require("../../../hooks/useBenefits.js"),A=H(require("../../CartActionButtons/index.js"));const J=({totalSavingsSlot:t,renderComparePrice:o}={})=>{const{copyWriting:e,locale:n="us",trackingData:i,currencyCode:d}=(0,P.useAiuiContext)(),{variant:r,finalPrice:M,totalSavings:m,isLogin:x,comparePrice:C,onAddToCart:D,onBuyNow:B,savingDetail:b,addToCartLoading:F,buyNowLoading:R,notifyMeMode:L,onNotifyMeClick:E,discount:V,memberFunctionResult:y}=(0,T.useBizProductContext)(),O=(0,k.useBenefits)({variant:r}),{commonCoupon:s,memberDiscount:u}=O,_=i?.showComparePrice??!0,j=(0,f.useMemo)(()=>(0,g.replaceTemplate)(e?.totalSavings||"",{amount:(0,c.formatPrice)({amount:m,currencyCode:r.price.currencyCode,locale:d==="CAD"?"us":n||"us"})}),[e?.totalSavings,m,r.price.currencyCode,n]),v=(0,f.useMemo)(()=>{if(!e?.unlockedSaving)return;const N=s?.enable?Number(s?.config?.fixed_value||0):0,h=u?.enable?u.config?.amount??0:0,w=Math.round((y?.withoutCouponMaxMemberTotalSave?Math.max(h,N):h+N)*100)/100;if(!(w<=0))return(0,g.replaceTemplate)(e.unlockedSaving,{amount:(0,c.formatPrice)({amount:w,currencyCode:r.price.currencyCode,locale:d==="CAD"?"us":n||"us"})})},[e?.unlockedSaving,s?.enable,s?.config?.fixed_value,u?.enable,u?.config?.amount,y,r.price.currencyCode,n]);return(0,a.jsxs)(l.Container,{childClassName:"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4",className:"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3",children:[r.availableForSale?(0,a.jsxs)("div",{className:"laptop-md:items-end flex flex-col justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(l.Text,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]",html:(0,c.formatPrice)({amount:parseFloat(M.toFixed(2)),currencyCode:r.price.currencyCode,locale:d==="CAD"?"us":n||"us"})}),o?o({comparePrice:C}):_&&(m>0||b?.member>0&&x)&&(0,a.jsx)(l.Text,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through",html:(0,c.formatPrice)({amount:C,currencyCode:r.price.currencyCode,locale:d==="CAD"?"us":n||"us"})}),b?.member>0&&x&&(0,a.jsx)(l.Text,{className:"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white",html:e?.memberPrice||"Member Price"})]}),t||(m>0||b?.member>0&&x?(0,a.jsx)(l.Text,{className:"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:`${j}`}):v?(0,a.jsx)(l.Text,{className:"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:v}):null)]}):(0,a.jsx)(l.Text,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),(0,a.jsx)("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:(0,a.jsx)(A.default,{mode:L,availableForSale:r.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:F,buyNowLoading:R,onAddToCart:D,onBuyNow:B,onNotifyMeClick:E,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var K=J;
@@ -1 +1 @@
1
- "use strict";var b=Object.create;var s=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h(e))!g.call(t,o)&&o!==r&&s(t,o,{get:()=>e[o],enumerable:!(l=v(e,o))||l.enumerable});return t};var P=(t,e,r)=>(r=t!=null?b(N(t)):{},m(e||!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),y=t=>m(s({},"__esModule",{value:!0}),t);var C={};w(C,{default:()=>B});module.exports=y(C);var a=require("react/jsx-runtime"),i=require("../../../../components/index.js"),n=require("../index.js"),c=require("../../BizProductProvider.js"),u=require("../../hooks/useComponentData.js"),p=P(require("./ScrollSpyNav/index.js")),f=require("../../../../shared/Styles.js");const x=({onSpyNavItemClick:t,totalSavingsSlot:e,actionsSlot:r})=>{const{product:l,renderRating:o}=(0,c.useBizProductContext)(),d=(0,u.useComponentData)("PurchaseBar")??[];return(0,a.jsxs)("div",{id:"purchase-bar",className:"sticky left-0 top-0 z-[45] w-full border-b border-[#E4E5E6] bg-white",children:[(0,a.jsx)(i.Container,{children:(0,a.jsxs)("div",{className:"tablet:justify-between laptop-md:gap-16 tablet:gap-0 tablet:w-full flex flex-wrap items-center gap-[10px]",children:[(0,a.jsxs)("div",{className:"laptop-md:pt-6 laptop-md:pb-0 min-w-0 flex-1 py-3",children:[(0,a.jsx)(i.Heading,{as:"h1",size:2,className:"line-clamp-2 text-wrap",html:l?.title}),(0,a.jsx)("div",{className:"laptop-md:block mt-3 hidden",children:(0,a.jsx)(p.default,{tabs:d,className:"",renderRating:o,onSpyNavItemClick:t})})]}),(0,a.jsx)("div",{className:"laptop-md:block hidden shrink-0",children:r??(0,a.jsx)(n.ProductActions,{totalSavingsSlot:e})})]})}),(0,a.jsxs)(i.Container,{className:"laptop-md:hidden relative",children:[(0,a.jsx)("div",{className:"absolute left-0 top-0 h-px w-full bg-[#E4E5E6]"}),(0,a.jsx)(p.default,{tabs:d,renderRating:o,onSpyNavItemClick:t})]})]})};var B=(0,f.withLayout)(x);
1
+ "use strict";var v=Object.create;var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var w=(a,e)=>{for(var r in e)p(a,r,{get:e[r],enumerable:!0})},n=(a,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N(e))!P.call(a,o)&&o!==r&&p(a,o,{get:()=>e[o],enumerable:!(l=h(e,o))||l.enumerable});return a};var y=(a,e,r)=>(r=a!=null?v(g(a)):{},n(e||!a||!a.__esModule?p(r,"default",{value:a,enumerable:!0}):r,a)),x=a=>n(p({},"__esModule",{value:!0}),a);var E={};w(E,{default:()=>B});module.exports=x(E);var t=require("react/jsx-runtime"),i=require("../../../../components/index.js"),c=require("../index.js"),u=require("../../BizProductProvider.js"),f=require("../../hooks/useComponentData.js"),s=y(require("./ScrollSpyNav/index.js")),b=require("../../../../shared/Styles.js");const C=({onSpyNavItemClick:a,totalSavingsSlot:e,actionsSlot:r,renderComparePrice:l})=>{const{product:o,renderRating:d}=(0,u.useBizProductContext)(),m=(0,f.useComponentData)("PurchaseBar")??[];return(0,t.jsxs)("div",{id:"purchase-bar",className:"sticky left-0 top-0 z-[45] w-full border-b border-[#E4E5E6] bg-white",children:[(0,t.jsx)(i.Container,{children:(0,t.jsxs)("div",{className:"tablet:justify-between laptop-md:gap-16 tablet:gap-0 tablet:w-full flex flex-wrap items-center gap-[10px]",children:[(0,t.jsxs)("div",{className:"laptop-md:pt-6 laptop-md:pb-0 min-w-0 flex-1 py-3",children:[(0,t.jsx)(i.Heading,{as:"h1",size:2,className:"line-clamp-2 text-wrap",html:o?.title}),(0,t.jsx)("div",{className:"laptop-md:block mt-3 hidden",children:(0,t.jsx)(s.default,{tabs:m,className:"",renderRating:d,onSpyNavItemClick:a})})]}),(0,t.jsx)("div",{className:"laptop-md:block hidden shrink-0",children:r??(0,t.jsx)(c.ProductActions,{totalSavingsSlot:e,renderComparePrice:l})})]})}),(0,t.jsxs)(i.Container,{className:"laptop-md:hidden relative",children:[(0,t.jsx)("div",{className:"absolute left-0 top-0 h-px w-full bg-[#E4E5E6]"}),(0,t.jsx)(s.default,{tabs:m,renderRating:d,onSpyNavItemClick:a})]})]})};var B=(0,b.withLayout)(C);
@@ -1,10 +1,13 @@
1
1
  import type { ReactNode } from 'react';
2
+ import type { ComparePriceRenderData } from './ProductActions/index.js';
2
3
  export interface PurchaseBarProps {
3
4
  onSpyNavItemClick?: (tab: ScrollSpyNavItem) => void;
4
5
  /** 自定义总节省组件,传入时会替代默认的 totalSavings 显示 */
5
6
  totalSavingsSlot?: ReactNode;
6
7
  /** 自定义右侧 Actions 插槽,传入时替代默认的 ProductActions */
7
8
  actionsSlot?: ReactNode;
9
+ /** 自定义划线价渲染,传入时替换默认的划线价显示 */
10
+ renderComparePrice?: (data: ComparePriceRenderData) => ReactNode;
8
11
  }
9
12
  export interface ScrollSpyNavItem {
10
13
  label: string;
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var s=(t,e,c,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of l(e))!p.call(t,r)&&r!==c&&o(t,r,{get:()=>e[r],enumerable:!(a=i(e,r))||a.enumerable});return t};var S=t=>s(o({},"__esModule",{value:!0}),t);var n={};module.exports=S(n);
1
+ "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var l=(r,e,c,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!n.call(r,t)&&t!==c&&o(r,t,{get:()=>e[t],enumerable:!(a=i(e,t))||a.enumerable});return r};var s=r=>l(o({},"__esModule",{value:!0}),r);var d={};module.exports=s(d);