import{a4 as X,S as E,j as i,u as Y,a5 as Z}from"./main-ac2fa4b1.js";import{r as d}from"./chunk-react-162a731f.js";import{H as $,a as C,F as P,b as oo}from"./chunk-index-cb596e09.js";import{B as io,a as ro}from"./chunk-index-06e3c389.js";import{F as to,C as eo,a as so,b as co}from"./chunk-index-a37e06c2.js";import{P as lo,D as mo}from"./chunk-index-dbde51c6.js";import{H as ao}from"./chunk-Helmet-b4541bbd.js";import{m as no,B as po,G as n,e as _,M as T,C as j}from"./chunk-material-ui-42c43899.js";import"./chunk-lodash-6114c6d4.js";import"./chunk-index-a4bfef69.js";import"./chunk-index-89b7ba38.js";import"./chunk-index-2ed2285e.js";import"./chunk-index-c479aaf2.js";import"./chunk-index-60bb7016.js";import"./chunk-index-815ed3d5.js";import"./chunk-index-52e322f4.js";import"./chunk-index-9d37c6bf.js";import"./chunk-index-965fe2b4.js";import"./chunk-styled-bfd8e494.js";import"./chunk-createSvgIcon-288b305d.js";import"./chunk-index-9bb58e99.js";import"./chunk-index-e94d2725.js";import"./chunk-index-4b8e5f08.js";import"./chunk-effect-fade-17bfa8f3.js";import"./chunk-index-ba13af53.js";import"./chunk-index-36abcaa9.js";import"./chunk-pagination-4aa3111e.js";const xo=no(o=>({mainBlockContainer:{background:o.color.black0},mainBlockTitleContainer:{flexBasis:"auto","@media (min-width: 960px)":{marginBottom:18},"& > *:first-child":{marginBottom:34,marginTop:24,"@media (max-width: 960px)":{marginTop:"24px",marginBottom:0,padding:"0 0 18px 0"}}},mainBlock:{width:720,height:480,display:"flex",flexDirection:"column",paddingLeft:"120px",background:o.color.black20,position:"relative","@media (max-width: 1440px)":{paddingLeft:"80px"},"@media (max-width: 1024px)":{paddingLeft:"12px"},"@media (min-width: 960px)":{paddingRight:"20px"},"&::before":{height:14,width:"95%",zIndex:"10",content:"''",display:"block",position:"absolute",left:0,backgroundImage:"linear-gradient(to bottom, rgba(255, 255, 255, 0), #f0f3f6 70%)","@media (max-width: 960px)":{bottom:0},"@media (min-width: 960px)":{top:"96%",transform:"translate(0, 13%)"}}},mainBlockTextContainer:{overflow:"scroll",justifyContent:"start","&::-webkit-scrollbar":{height:"6px",width:"6px"},"&::-webkit-scrollbar-track":{borderRadius:"10px",background:"#F0F3F6"},"&::-webkit-scrollbar-thumb":{background:"#8F9BA4",borderRadius:100},"&::-webkit-scrollbar-corner":{background:"#F0F3F6"}},mainBlockBannerContainer:{display:"flex",position:"relative",alignSelf:"center",width:"720px","@media (min-width: 960px)":{height:"480px"}},mainBlockTextTitle:{fontSize:"48px",lineHeight:"56px",color:o.color.black100,width:"90%","@media (min-width: 960px)":{marginBottom:24}},mainBlockBodyText:{fontSize:"16px",lineHeight:"24px",color:o.color.black100,width:"96%","@media (max-width: 960px)":{marginBlockStart:18,marginBlockEnd:24}},mainBlockBannerImg:{width:"100%",height:"100%",objectFit:"cover",background:"linear-gradient(66.8deg, rgba(0, 0, 0, 0.32) 13.81%, rgba(255, 255, 255, 0) 79.42%)"},mainBlockBannerLogo:{position:"absolute",maxWidth:"15%",left:24,bottom:10,"@media (min-width: 960px)":{maxWidth:158,bottom:24}},loader:{position:"absolute",zIndex:1e3,left:"50%"},loaderDeterminate:{position:"relative",left:"50%",top:"50%"},querySeoBlock:{backgroundColor:"#f0f3f6",paddingBlock:20,marginBlockEnd:36,"@media (max-width: 768px)":{paddingBlock:7}}}),{name:"DetailBrand"}),uo=({brandsPageContent:o,isLoading:c,headerData:s})=>{var y,g,w,S,v,I;const r=xo(),l=(y=o==null?void 0:o.brand)==null?void 0:y.name,p=(g=o==null?void 0:o.brand)==null?void 0:g.description,u=(w=o==null?void 0:o.brand)==null?void 0:w.image,m=(S=o==null?void 0:o.brand)==null?void 0:S.logo,h=o==null?void 0:o.breadcrumb,x=o==null?void 0:o.products.filter(t=>t.product_id),a=o==null?void 0:o.navigation,[F,b]=d.useState(0),[D,A]=d.useState(),[H,L]=d.useState(1),f=(v=a==null?void 0:a.data)==null?void 0:v.current_page,z=(I=o==null?void 0:o.products)==null?void 0:I.length,{meta_desc:N,meta_title:O,seo_popular_query:M,seo_brand_text:R}=(s==null?void 0:s.SEO_BLOCK)||{},k=X(M),Q=R||p,W="Detail_brand";d.useEffect(()=>{if(f)return L(f)},[f]),d.useEffect(()=>{if(c){const t=setInterval(()=>{b(e=>e>=100?0:e+10)},150);return()=>{clearInterval(t)}}},[c]);const q=t=>x.find(({product_id:e})=>e==t),G=t=>x.findIndex(({product_id:e})=>e==t),[K]=E(),V=t=>{K({type:"showProducts",products:t.map(e=>{var B;return{id:e,price:(B=q(e))==null?void 0:B.colors_list[0].retail_price,index:G(e)}})})},J=d.useMemo(()=>{try{new IntersectionObserver((t,e)=>{if(o!=null&&o.products){const B=t.map(U=>U.target.dataset.id);V(B)}},{threshold:1})}catch{}},[o==null?void 0:o.products]);return i.jsxs(i.Fragment,{children:[i.jsxs(ao,{children:[i.jsx("meta",{property:"og:type",content:"website"}),i.jsx("meta",{property:"og:title",content:O}),i.jsx("meta",{property:"og:description",content:N}),i.jsx("meta",{property:"og:image",content:location.origin+m}),i.jsx("meta",{property:"og:url",content:location.href}),i.jsx("meta",{property:"og:site_name",content:"Траектория"})]}),i.jsxs(po,{className:r.mainBlockContainer,children:[i.jsxs(n,{container:!0,item:!0,classes:{root:r.mainBlockContainer},children:[i.jsxs(n,{md:6,xs:12,item:!0,classes:{root:r.mainBlock},children:[i.jsxs(n,{xs:12,item:!0,classes:{root:r.mainBlockTitleContainer},children:[i.jsx(io,{items:h,children:i.jsx(ro,{})}),i.jsx(_,{classes:{root:r.mainBlockTextTitle},variant:"h1",children:l})]}),i.jsx(n,{container:!0,direction:"row",justifyContent:"center",alignItems:"center",classes:{root:r.mainBlockTextContainer},children:i.jsx(_,{component:"a",classes:{root:r.mainBlockBodyText},dangerouslySetInnerHTML:{__html:Q}})})]}),i.jsx(n,{md:6,xs:12,item:!0,classes:{root:r.mainBlockBannerContainer},children:c?i.jsx(T,{classes:{root:r.loaderDeterminate},variant:"determinate",value:F}):i.jsxs(i.Fragment,{children:[i.jsx("img",{className:r.mainBlockBannerImg,src:u}),i.jsx("img",{className:r.mainBlockBannerLogo,src:m,alt:l,title:l})]})})]}),i.jsx(j,{fixed:!0,maxWidth:"xl",children:i.jsx(to,{page:H,filterData:o,headerContent:s})}),Array.isArray(k)&&i.jsx(n,{item:!0,xs:12,classes:{root:r.querySeoBlock},children:i.jsx(j,{fixed:!0,maxWidth:"xl",children:i.jsx(lo,{popularQuerySeoArray:k})})}),i.jsxs(j,{fixed:!0,maxWidth:"xl",children:[c&&i.jsx(T,{classes:{root:r.loader},color:"primary"}),i.jsxs(n,{container:!0,spacing:4,children:[c&&i.jsx(n,{container:!0,spacing:3,children:i.jsx(eo,{count:12})}),x&&x.map((t,e)=>i.jsx(so,{product:t,pageName:W,productPosition:e+1,setShowDisplayProductSizes:A,showDisplayProductSiazes:D===(t==null?void 0:t.product_id),observer:J},t==null?void 0:t.product_id))]}),a&&i.jsx(co,{items:a,sumProducs:z}),i.jsx(mo,{seoBlock:s==null?void 0:s.SEO_BLOCK})]})]})]})},ho=({data:o,isFetching:c})=>{var m,h,x,a;const s=o==null?void 0:o.data.HEADER,r=o==null?void 0:o.data.FOOTER,l=(h=(m=o==null?void 0:o.data)==null?void 0:m.MAIN)==null?void 0:h.content,p=(a=(x=o==null?void 0:o.data)==null?void 0:x.MAIN)==null?void 0:a.url,u=l&&{...l,url:p};return i.jsxs(i.Fragment,{children:[i.jsx($,{content:s,children:i.jsx(C,{isFetching:c})}),i.jsx(uo,{isLoading:c,brandsPageContent:u,headerData:s}),i.jsx(P,{content:r,children:i.jsx(oo,{isLoading:c})})]})},Go=()=>{var u,m;const{pathname:o,search:c}=Y(),[s]=E(),{data:r,isFetching:l}=Z({pathname:o,search:c}),p=(m=(u=r==null?void 0:r.data)==null?void 0:u.MAIN)==null?void 0:m.content;return d.useEffect(()=>{p&&s({type:"viewCategory",brand_id:p.brand.id})},[p]),i.jsx(ho,{data:r,isFetching:l})};export{Go as DetailBrandPage,ho as Page};