import{j as c,ap as oe,a1 as xe,k as ae,Z,b as Ee,g as Se,ad as Ce}from"./main-ac2fa4b1.js";import{r as S,R as N,e as Ae}from"./chunk-react-162a731f.js";import{c as Pe}from"./chunk-index-89b7ba38.js";import{D as ie}from"./chunk-index-2ed2285e.js";import{m as H,G as E,e as w,i as se,ao as Oe,s as ce,f as le,I as we,aB as je,aC as Re,B as ue,L as ke,a8 as Fe,aD as g}from"./chunk-material-ui-42c43899.js";import{S as _e}from"./chunk-index-36abcaa9.js";import{b as Me}from"./chunk-index-965fe2b4.js";import{D as Ne}from"./chunk-index-52e322f4.js";import{U as Ie}from"./chunk-index-60bb7016.js";import{i as He}from"./chunk-styled-bfd8e494.js";import{r as De}from"./chunk-createSvgIcon-288b305d.js";import{g as de}from"./chunk-lodash-6114c6d4.js";const Be=H(t=>({sizeBlock:{marginBlockEnd:9,"@media (max-width: 280px)":{maxWidth:"100%",flexBasis:"100%"}},baseText:{fontFamily:"TTFirsNeue-Light, sans-serif","& > $baseText":{paddingLeft:t.spacing(2),whiteSpace:"nowrap"}},chooseSizeBlock:{cursor:"pointer",marginBlockEnd:9,"& p":{color:"#1e6ee4"}}}),{name:"CurrentSize"});function ze({sizeTitle:t,isShowPickSizeButton:e,pickSizeButtonTitle:n,gridSizeContent:r}){const o=Be(),[a,l]=S.useState(!1),i=()=>l(!1),s=()=>l(!0);return c.jsxs(c.Fragment,{children:[c.jsx(E,{item:!0,xs:4,classes:{root:o.sizeBlock},children:c.jsxs(w,{classes:{root:o.baseText},component:"p",variant:"body1",color:"secondary",children:["Размер:",c.jsx(w,{classes:{root:o.baseText},component:"span",variant:"body1",color:"primary",children:t})]})}),e&&c.jsxs(c.Fragment,{children:[c.jsx(E,{item:!0,xs:"auto",sm:5,md:"auto",onClick:s,className:o.chooseSizeBlock,children:c.jsx(w,{classes:{root:o.baseText},variant:"body1",children:n||"Подобрать размер"})}),c.jsx(ie,{open:a,onClose:i,onCloseIcon:i,dialogTitle:n||"Подобрать размер",scroll:"paper",maxWidth:!1,children:c.jsx(E,{container:!0,children:c.jsx(E,{item:!0,xs:12,children:r})})})]})]})}const Le=H(t=>({baseText:{fontFamily:"TTFirsNeue-Light, sans-serif","& > $baseText":{paddingLeft:t.spacing(2)}}}),{name:"CurrentSize"}),Ue=({colorName:t})=>{const e=Le();return c.jsx(E,{item:!0,xs:12,children:c.jsxs(w,{classes:{root:e.baseText},component:"p",variant:"body1",color:"secondary",children:["Цвет:",c.jsx(w,{classes:{root:e.baseText},component:"span",variant:"body1",color:"primary",children:t})]})})},We=H(t=>({sizesChip:{width:78,height:40,borderRadius:10,margin:0,fontSize:"1rem","&:after":{content:'""',position:"absolute",top:0,left:0,width:"200%",height:"180%",background:`linear-gradient(to top right,
                transparent calc(49% - 1px),
                #E0E3E6 calc(49.5% - 1px),
                #E0E3E6 calc(48.5% + 1px),
                transparent calc(48% + 1px))`},"& span":{paddingInline:7}},CardPreviewSizeBtn:{minWidth:71,minHeight:32,color:t.color.black100,borderRadius:10,backgroundColor:"#FFFFFF","@media (min-width: 1656px)":{minWidth:87,minHeight:35}},sizesChipOutline:{borderColor:t.color.black40,overflow:"hidden","&:after":{content:'""',position:"absolute",top:0,left:0,width:"200%",height:"180%",background:`linear-gradient(to top right,
                transparent calc(48.5% - 1px),
                #E0E3E6 calc(49% - 1px),
                #E0E3E6 calc(48% + 1px),
                transparent calc(46% + 1px))`},"&:hover":{"background-color":"#FFFFFF !important"}},noQuantity:{color:t.color.black40,borderColor:t.color.black40},popover:{pointerEvents:"none"},paper:{maxWidth:230,padding:"8px 12px",borderRadius:4},popoverText:{fontSize:t.typography.pxToRem(14)},dialogRoot:{minWidth:300,maxWidth:400,padding:24,"& .MuiDialogContent-dividers":{overflow:"initial",border:"none"},"& .MuiDialogTitle-root":{padding:0,"margin-block-end":24,"& h2":{fontSize:"20px",lineHeight:"30px"}}}}),{name:"NoQuantitySize"}),Xt=t=>{const e=We(),[n,r]=S.useState(null),[o,a]=S.useState(!1),[l,i]=S.useState(!1),[s,u]=S.useState(""),d=P=>{r(P.currentTarget)},p=()=>{r(null)},m=P=>{a(!0)},h=!!n,v=()=>a(!1),[b,{isLoading:x}]=oe(),y=()=>{b({email:s,product_id:t.product_id}).unwrap().then(({})=>{i(P=>!0)})},C=P=>{u(P.target.value)};return c.jsxs(c.Fragment,{children:[c.jsx(se,{"aria-owns":h?"mouse-over-popover":void 0,"aria-haspopup":"true",clickable:!0,onMouseEnter:d,onMouseLeave:p,variant:"outlined",classes:{root:t.productPreview?e.CardPreviewSizeBtn:e.sizesChip,outlinedPrimary:Pe([e.sizesChipOutline,e.noQuantity])},onClick:m,color:"primary",label:t.sizeTitle}),c.jsx(Oe,{open:h,className:e.popover,style:{top:10},classes:{paper:e.paper},anchorEl:n,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},elevation:0,onClose:p,disableRestoreFocus:!0,children:c.jsx(w,{variant:"body1",classes:{root:e.popoverText},children:"Кликните на размер для возможности подписаться на его поступления"})}),c.jsx(ie,{open:o,PaperProps:{classes:{root:e.dialogRoot}},scroll:"paper",onClose:v,onCloseIcon:v,dialogTitle:l?"Товар добавлен в подписки":"Подписаться на товар",children:c.jsxs(E,{container:!0,item:!0,spacing:3,children:[!l&&c.jsxs(c.Fragment,{children:[c.jsx(Ue,{colorName:t.colorName}),c.jsx(ze,{sizeTitle:t.sizeTitle}),c.jsx(E,{item:!0,xs:12,children:c.jsx(ce,{required:!0,fullWidth:!0,placeholder:"email",type:"email",onChange:C,value:s})})]}),l&&c.jsx(E,{item:!0,xs:12,children:c.jsx(w,{children:"Мы сообщим вам, когда он поступит на склад"})}),c.jsx(E,{item:!0,xs:12,children:c.jsx(le,{color:"default",variant:"contained",fullWidth:!0,onClick:l?v:y,children:l?"Готово":"Подписаться"})})]})})]})},$e=H(t=>({productRoot:{position:"relative",paddingBottom:t.spacing(5),"&:hover $favoriteIconStyle":{display:"block"}},productSmall:{width:280,"@media (max-width: 1440px)":{width:256},"@media (max-width: 1280px)":{width:256}},productMedium:{width:325,"@media (max-width: 1440px)":{width:256},"@media (max-width: 1280px)":{width:256}},productBig:{width:"100%","@media (max-width: 1440px)":{width:"100%"},"@media (max-width: 1280px)":{width:"100%"},"@media (max-width: 479px)":{width:"100%"}},productMain:{width:"100%","@media (max-width: 1440px)":{width:"100%"},"@media (max-width: 1280px)":{width:"100%"},"@media (max-width: 479px)":{width:"100%"}},containerLink:{height:"inherit"},badgeGrid:{display:"flex",flexDirection:"column",alignItems:"start",position:"absolute",left:"8px",top:"8px",zIndex:1,textTransform:"uppercase","& div":{height:24,fontSize:t.typography.pxToRem(14)},"& div + div":{marginBlockStart:15}},badgeStyle:{borderRadius:9,backgroundColor:t.color.black0,border:"1px solid currentcolor"},badgeSoon:{color:"#b1dff1"},badgeNew:{color:"#1e6ee4"},productImgGrid:{width:"100%",display:"flex",justifyContent:"center","@media (min-width: 540px)":{marginBlockEnd:15}},imgHover:{" :first-child":{display:"block"},"& :last-child":{display:"none"},"&:hover :first-child":{display:"none"},"&:hover :last-child":{display:"block"}},productImg:{objectFit:"contain"},productImgTechno:{width:"20%",position:"absolute",bottom:"-5%"},setNoQuantity:{flexDirection:"column","& svg":{margin:"0 !important"}},sizeContainer:{position:"absolute",left:0,bottom:0,padding:"0 10px",zIndex:1e3},sizeBtn:{minWidth:71,minHeight:32,color:t.color.black100,borderRadius:10,backgroundColor:"#FFFFFF","@media (min-width: 1656px)":{minWidth:87,minHeight:35}},sizeBtnClickable:{"&$sizeBtnOutlined":{"&:hover, &:focus":{backgroundColor:"#F0F3F6"}}},favoriteIconStyle:{display:"none",color:"#E0E3E6"},productPageFavoriteIconStyle:{color:t.color.black100},sizeBtnOutlined:{borderColor:t.color.black40},favoriteIcon:{margin:"16px 16px 0 0",right:0,position:"absolute",zIndex:2e3},btnAddToWish:{borderColor:t.color.black100,borderWidth:"1.25px",borderStyle:"solid",borderRadius:"1rem",width:"100%",padding:16,height:"100%"},paper:{maxWidth:230,padding:"8px 12px",borderRadius:4},popoverText:{fontSize:t.typography.pxToRem(14)},customPaperStyle:{width:"230px",padding:"8px 12px",borderRadius:"4px",position:"absolute",zIndex:1,backgroundColor:"#fff",border:"1px solid rgba(0, 16, 61, 0.16)",opacity:1,transform:"none",transition:"opacity 232ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 155ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",boxShadow:"0px 5px 5px -3px rgb(0 0 0 / 20%), 0px 8px 10px 1px rgb(0 0 0 / 14%), 0px 3px 14px 2px rgb(0 0 0 / 12%)"},productPopUpPosition:{transform:"translateX(-50%)",left:"50%"},catalogPopUpPosition:{top:"32px",left:"50%",transform:"translateX(-50%)"}}),{name:"CardPreview"}),qe=({wishListItem:t,open:e,handleClose:n})=>c.jsx(_e,{open:e,onClose:n,title:"Товар добавлен в избранное",children:c.jsx(c.Fragment,{children:!Array.isArray(t==null?void 0:t.data)&&c.jsx(Me,{sku:t==null?void 0:t.data.SKU_ID,itemName:t==null?void 0:t.data.NAME,link:t==null?void 0:t.data.URL,imgPath:t==null?void 0:t.data.IMAGE.PATH,color:t==null?void 0:t.data.COLOR,size:t==null?void 0:t.data.SIZE,currentPrice:t==null?void 0:t.data.PRICES.RETAIL.PRICE_DISPLAY})})}),Ge=({event:t,inWishlist:e,handleDeleteWishlist:n,handleClick:r,colorRef:o,setClickOnWishListIcon:a,setOpenUserAuth:l,setOpenPopUp:i})=>e?n():(r(o),t.preventDefault(),a&&a(!0),l(!0),i(!0)),Ye=t=>{var e;(e=t==null?void 0:t.current)==null||e.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})},Vt=({setClickOnWishListIcon:t,inWishlist:e,productSku:n,isUserAuth:r,addWishList:o,wishListItem:a,colorRef:l,parentRef:i,type:s})=>{const[u]=xe(),d=()=>{u({url:Ee.user.wishlist.delete,...Se({SITE_ID:"lid",bitrix_sessid:"bitrix_sessid"}),id:n})},[p,m]=S.useState(!1),[h,v]=N.useState(!1),[b,x]=S.useState(!1),y=$e(),C=s==="productPage",P=C?y.productPageFavoriteIconStyle:y.favoriteIconStyle,_=C?y.btnAddToWish:y.favoriteIcon,R=C?y.productPopUpPosition:y.catalogPopUpPosition,X=ae(k=>k.userAuth.authScreen),ve=!e&&r&&h,ye=a==null?void 0:a.data;S.useEffect(()=>{const k=W=>{var V;i!=null&&i.current&&!((V=i==null?void 0:i.current)!=null&&V.contains(W.target))&&(v(!1),t&&t(!1))};return document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[i]),S.useEffect(()=>{o&&(m(o),v(!1))},[o]);const be=(k,W)=>{W!=="clickaway"&&m(!1)};return c.jsxs(c.Fragment,{children:[c.jsx(we,{onClick:k=>{Ge({event:k,inWishlist:e,handleDeleteWishlist:d,handleClick:Ye,colorRef:l,setClickOnWishListIcon:t,setOpenUserAuth:x,setOpenPopUp:v})},classes:{root:_},type:"button",color:"secondary",children:e&&c.jsx(je,{color:"primary"})||c.jsx(Re,{className:P})}),ve&&c.jsx(ue,{className:`${y.customPaperStyle} ${R}`,children:c.jsx(w,{variant:"body1",classes:{root:y.popoverText},children:"Чтобы добавить товар в избранное кликните на цвет, затем на размер."})}),ye&&c.jsx(qe,{wishListItem:a,open:p,handleClose:be}),!r&&c.jsx(Ne,{isWrapped:!0,showCloseIcon:!0,open:b,onClose:()=>x(!1),handlerCloseIcon:()=>x(!1),closeIconPosition:"right",anchor:"right",title:Z[X].title,subTitle:Z[X].subTitle,children:c.jsx(Ie,{})})]})};var Q={},Qe=He;Object.defineProperty(Q,"__esModule",{value:!0});var pe=Q.default=void 0,Xe=Qe(De()),J=c;pe=Q.default=(0,Xe.default)([(0,J.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,J.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime");const Ve=H(()=>({mainBlock:{width:"100%"},soonGrid:{width:"48%"},boxStyle:{display:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",fontSize:"1rem",fontFamily:"TTFirsNeue-Regular,sans-serif",fontWeight:300,lineHeight:"24px",textTransform:"none","& .MuiLink-root:hover":{color:"#3A474E",borderBottom:"1px #3A474E dashed"},"& .MuiLink-underlineAlways":{color:"#1e6ee4",borderBottom:"1px #1e6ee4 dashed",textDecoration:"none"}},soonLogo:{marginInlineEnd:7,color:"#1e6ee4"},soonText:{fontFamily:"CirceWebBold,sans-serif",fontSize:"1.1rem",marginBlockStart:1,color:"#1e6ee4",textTransform:"uppercase",fontWeight:550},subscribedText:{marginBlockEnd:15},dialogRoot:{minWidth:300,maxWidth:400,padding:24,"& .MuiDialogContent-dividers":{overflow:"initial",border:"none"},"& .MuiDialogTitle-root":{padding:0,"margin-block-end":24,"& h2":{fontSize:"20px",lineHeight:"30px"}}}}),{name:"ComingSoon"}),Zt=({productId:t,isComingSoon:e,setIsComingSoon:n})=>{var C,P,_;const r=Ve(),[o,a]=S.useState(!1),[l,i]=S.useState(!1),[s,u]=S.useState(""),[d]=oe(),p=ae(R=>R.userAuth.isAuth),{data:m}=Ce(),h=(_=(P=(C=m==null?void 0:m.data)==null?void 0:C.MAIN)==null?void 0:P.PROFILE)==null?void 0:_.EMAIL,v=()=>a(!0),b=()=>{a(!1),e&&n(!1)},x=()=>{d({email:s,product_id:t}).unwrap().then(R=>{if(R.status==="error")return i(!1);i(!0)})},y=R=>{u(R.target.value)};return S.useEffect(()=>{e&&a(!0)},[]),S.useEffect(()=>u(p?h:""),[p,h]),c.jsxs(E,{item:!0,container:!0,spacing:3,classes:{root:r.mainBlock},children:[!e&&c.jsxs(c.Fragment,{children:[c.jsxs(E,{item:!0,container:!0,direction:"row",classes:{root:r.soonGrid},children:[c.jsx(pe,{className:r.soonLogo}),c.jsx(w,{className:r.soonText,children:"Скоро"})]}),c.jsx(ue,{className:r.boxStyle,onClick:v,children:c.jsx(ke,{href:"#",underline:"always",children:"Хочу узнать о поступлении"})})]}),c.jsx(Fe,{open:o,PaperProps:{classes:{root:r.dialogRoot}},scroll:"paper",onClose:b,dialogTitle:l?"Товар добавлен в подписки":"Подписаться на товар",children:c.jsxs(E,{container:!0,item:!0,spacing:3,children:[!l&&c.jsx(c.Fragment,{children:c.jsxs(E,{item:!0,xs:12,children:[c.jsx(w,{className:r.subscribedText,children:"Этот товар скоро поступит в продажу. Хотите узнать об этом первыми? Пожалуйста, оставьте свой e-mail для оповещения."}),c.jsx(ce,{required:!0,fullWidth:!0,placeholder:"email",type:"email",onChange:y,value:s})]})}),l&&c.jsx(E,{item:!0,container:!0,justifyContent:"center",xs:12,children:c.jsx(w,{children:"Мы сообщим вам, когда он поступит на склад"})}),c.jsx(E,{item:!0,xs:12,children:c.jsx(le,{color:"default",variant:"contained",fullWidth:!0,onClick:l?()=>b():x,children:l?"Готово":"Подписаться"})})]})})]})};function Ze(t){if(t&&t.indexOf("/")>-1){const[e,n]=t.split("/");return`linear-gradient(90deg, ${e} 0%, ${n} 100%)`}return t}const Je=H(t=>({chipStyle:{fontFamily:"TTFirsNeue-Light, sans-serif",fontSize:16}}),{name:"Badge"}),Jt=t=>{const e=Je(),{badge_text:n,badge_text_color:r,badge_background_color:o}=t,a={color:r,background:Ze(o)};return c.jsx(se,{classes:{root:e.chipStyle},style:a,label:n})};function Ke(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var fe=S,et=Ke(fe);function K(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var rt=!!(typeof window<"u"&&window.document&&window.document.createElement);function nt(t,e,n){if(typeof t!="function")throw new Error("Expected reducePropsToState to be a function.");if(typeof e!="function")throw new Error("Expected handleStateChangeOnClient to be a function.");if(typeof n<"u"&&typeof n!="function")throw new Error("Expected mapStateOnServer to either be undefined or a function.");function r(o){return o.displayName||o.name||"Component"}return function(a){if(typeof a!="function")throw new Error("Expected WrappedComponent to be a React component.");var l=[],i;function s(){i=t(l.map(function(d){return d.props})),u.canUseDOM?e(i):n&&(i=n(i))}var u=function(d){tt(p,d);function p(){return d.apply(this,arguments)||this}p.peek=function(){return i},p.rewind=function(){if(p.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var v=i;return i=void 0,l=[],v};var m=p.prototype;return m.UNSAFE_componentWillMount=function(){l.push(this),s()},m.componentDidUpdate=function(){s()},m.componentWillUnmount=function(){var v=l.indexOf(this);l.splice(v,1),s()},m.render=function(){return et.createElement(a,this.props)},p}(fe.PureComponent);return K(u,"displayName","SideEffect("+r(a)+")"),K(u,"canUseDOM",rt),u}}var ot=nt;const at=de(ot);var it=typeof Element<"u",st=typeof Map=="function",ct=typeof Set=="function",lt=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function L(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,o;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!L(t[r],e[r]))return!1;return!0}var a;if(st&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!L(r.value[1],e.get(r.value[0])))return!1;return!0}if(ct&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(lt&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof e.valueOf=="function")return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof e.toString=="function")return t.toString()===e.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,o[r]))return!1;if(it&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&t.$$typeof)&&!L(t[o[r]],e[o[r]]))return!1;return!0}return t!==t&&e!==e}var ut=function(e,n){try{return L(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const dt=de(ut);var F={BODY:"bodyAttributes",HTML:"htmlAttributes",TITLE:"titleAttributes"},f={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"};Object.keys(f).map(function(t){return f[t]});var T={CHARSET:"charset",CSS_TEXT:"cssText",HREF:"href",HTTPEQUIV:"http-equiv",INNER_HTML:"innerHTML",ITEM_PROP:"itemprop",NAME:"name",PROPERTY:"property",REL:"rel",SRC:"src",TARGET:"target"},U={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},z={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate"},pt=Object.keys(U).reduce(function(t,e){return t[U[e]]=e,t},{}),ft=[f.NOSCRIPT,f.SCRIPT,f.STYLE],O="data-react-helmet",mt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ht=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},gt=function(){function t(e,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),A=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Tt=function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},ee=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},vt=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t},q=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return n===!1?String(e):String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")},yt=function(e){var n=I(e,f.TITLE),r=I(e,z.TITLE_TEMPLATE);if(r&&n)return r.replace(/%s/g,function(){return Array.isArray(n)?n.join(""):n});var o=I(e,z.DEFAULT_TITLE);return n||o||void 0},bt=function(e){return I(e,z.ON_CHANGE_CLIENT_STATE)||function(){}},$=function(e,n){return n.filter(function(r){return typeof r[e]<"u"}).map(function(r){return r[e]}).reduce(function(r,o){return A({},r,o)},{})},xt=function(e,n){return n.filter(function(r){return typeof r[f.BASE]<"u"}).map(function(r){return r[f.BASE]}).reverse().reduce(function(r,o){if(!r.length)for(var a=Object.keys(o),l=0;l<a.length;l++){var i=a[l],s=i.toLowerCase();if(e.indexOf(s)!==-1&&o[s])return r.concat(o)}return r},[])},D=function(e,n,r){var o={};return r.filter(function(a){return Array.isArray(a[e])?!0:(typeof a[e]<"u"&&At("Helmet: "+e+' should be of type "Array". Instead found type "'+mt(a[e])+'"'),!1)}).map(function(a){return a[e]}).reverse().reduce(function(a,l){var i={};l.filter(function(m){for(var h=void 0,v=Object.keys(m),b=0;b<v.length;b++){var x=v[b],y=x.toLowerCase();n.indexOf(y)!==-1&&!(h===T.REL&&m[h].toLowerCase()==="canonical")&&!(y===T.REL&&m[y].toLowerCase()==="stylesheet")&&(h=y),n.indexOf(x)!==-1&&(x===T.INNER_HTML||x===T.CSS_TEXT||x===T.ITEM_PROP)&&(h=x)}if(!h||!m[h])return!1;var C=m[h].toLowerCase();return o[h]||(o[h]={}),i[h]||(i[h]={}),o[h][C]?!1:(i[h][C]=!0,!0)}).reverse().forEach(function(m){return a.push(m)});for(var s=Object.keys(i),u=0;u<s.length;u++){var d=s[u],p=Ae({},o[d],i[d]);o[d]=p}return a},[]).reverse()},I=function(e,n){for(var r=e.length-1;r>=0;r--){var o=e[r];if(o.hasOwnProperty(n))return o[n]}return null},Et=function(e){return{baseTag:xt([T.HREF,T.TARGET],e),bodyAttributes:$(F.BODY,e),defer:I(e,z.DEFER),encode:I(e,z.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:$(F.HTML,e),linkTags:D(f.LINK,[T.REL,T.HREF],e),metaTags:D(f.META,[T.NAME,T.CHARSET,T.HTTPEQUIV,T.PROPERTY,T.ITEM_PROP],e),noscriptTags:D(f.NOSCRIPT,[T.INNER_HTML],e),onChangeClientState:bt(e),scriptTags:D(f.SCRIPT,[T.SRC,T.INNER_HTML],e),styleTags:D(f.STYLE,[T.CSS_TEXT],e),title:yt(e),titleAttributes:$(F.TITLE,e)}},G=function(){var t=Date.now();return function(e){var n=Date.now();n-t>16?(t=n,e(n)):setTimeout(function(){G(e)},0)}}(),te=function(e){return clearTimeout(e)},St=typeof window<"u"?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||G:global.requestAnimationFrame||G,Ct=typeof window<"u"?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||te:global.cancelAnimationFrame||te,At=function(e){return console&&typeof console.warn=="function"&&console.warn(e)},B=null,Pt=function(e){B&&Ct(B),e.defer?B=St(function(){re(e,function(){B=null})}):(re(e),B=null)},re=function(e,n){var r=e.baseTag,o=e.bodyAttributes,a=e.htmlAttributes,l=e.linkTags,i=e.metaTags,s=e.noscriptTags,u=e.onChangeClientState,d=e.scriptTags,p=e.styleTags,m=e.title,h=e.titleAttributes;Y(f.BODY,o),Y(f.HTML,a),Ot(m,h);var v={baseTag:M(f.BASE,r),linkTags:M(f.LINK,l),metaTags:M(f.META,i),noscriptTags:M(f.NOSCRIPT,s),scriptTags:M(f.SCRIPT,d),styleTags:M(f.STYLE,p)},b={},x={};Object.keys(v).forEach(function(y){var C=v[y],P=C.newTags,_=C.oldTags;P.length&&(b[y]=P),_.length&&(x[y]=v[y].oldTags)}),n&&n(),u(e,b,x)},me=function(e){return Array.isArray(e)?e.join(""):e},Ot=function(e,n){typeof e<"u"&&document.title!==e&&(document.title=me(e)),Y(f.TITLE,n)},Y=function(e,n){var r=document.getElementsByTagName(e)[0];if(r){for(var o=r.getAttribute(O),a=o?o.split(","):[],l=[].concat(a),i=Object.keys(n),s=0;s<i.length;s++){var u=i[s],d=n[u]||"";r.getAttribute(u)!==d&&r.setAttribute(u,d),a.indexOf(u)===-1&&a.push(u);var p=l.indexOf(u);p!==-1&&l.splice(p,1)}for(var m=l.length-1;m>=0;m--)r.removeAttribute(l[m]);a.length===l.length?r.removeAttribute(O):r.getAttribute(O)!==i.join(",")&&r.setAttribute(O,i.join(","))}},M=function(e,n){var r=document.head||document.querySelector(f.HEAD),o=r.querySelectorAll(e+"["+O+"]"),a=Array.prototype.slice.call(o),l=[],i=void 0;return n&&n.length&&n.forEach(function(s){var u=document.createElement(e);for(var d in s)if(s.hasOwnProperty(d))if(d===T.INNER_HTML)u.innerHTML=s.innerHTML;else if(d===T.CSS_TEXT)u.styleSheet?u.styleSheet.cssText=s.cssText:u.appendChild(document.createTextNode(s.cssText));else{var p=typeof s[d]>"u"?"":s[d];u.setAttribute(d,p)}u.setAttribute(O,"true"),a.some(function(m,h){return i=h,u.isEqualNode(m)})?a.splice(i,1):l.push(u)}),a.forEach(function(s){return s.parentNode.removeChild(s)}),l.forEach(function(s){return r.appendChild(s)}),{oldTags:a,newTags:l}},he=function(e){return Object.keys(e).reduce(function(n,r){var o=typeof e[r]<"u"?r+'="'+e[r]+'"':""+r;return n?n+" "+o:o},"")},wt=function(e,n,r,o){var a=he(r),l=me(n);return a?"<"+e+" "+O+'="true" '+a+">"+q(l,o)+"</"+e+">":"<"+e+" "+O+'="true">'+q(l,o)+"</"+e+">"},jt=function(e,n,r){return n.reduce(function(o,a){var l=Object.keys(a).filter(function(u){return!(u===T.INNER_HTML||u===T.CSS_TEXT)}).reduce(function(u,d){var p=typeof a[d]>"u"?d:d+'="'+q(a[d],r)+'"';return u?u+" "+p:p},""),i=a.innerHTML||a.cssText||"",s=ft.indexOf(e)===-1;return o+"<"+e+" "+O+'="true" '+l+(s?"/>":">"+i+"</"+e+">")},"")},ge=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,o){return r[U[o]||o]=e[o],r},n)},Rt=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(e).reduce(function(r,o){return r[pt[o]||o]=e[o],r},n)},kt=function(e,n,r){var o,a=(o={key:n},o[O]=!0,o),l=ge(r,a);return[N.createElement(f.TITLE,l,n)]},Ft=function(e,n){return n.map(function(r,o){var a,l=(a={key:o},a[O]=!0,a);return Object.keys(r).forEach(function(i){var s=U[i]||i;if(s===T.INNER_HTML||s===T.CSS_TEXT){var u=r.innerHTML||r.cssText;l.dangerouslySetInnerHTML={__html:u}}else l[s]=r[i]}),N.createElement(e,l)})},j=function(e,n,r){switch(e){case f.TITLE:return{toComponent:function(){return kt(e,n.title,n.titleAttributes)},toString:function(){return wt(e,n.title,n.titleAttributes,r)}};case F.BODY:case F.HTML:return{toComponent:function(){return ge(n)},toString:function(){return he(n)}};default:return{toComponent:function(){return Ft(e,n)},toString:function(){return jt(e,n,r)}}}},Te=function(e){var n=e.baseTag,r=e.bodyAttributes,o=e.encode,a=e.htmlAttributes,l=e.linkTags,i=e.metaTags,s=e.noscriptTags,u=e.scriptTags,d=e.styleTags,p=e.title,m=p===void 0?"":p,h=e.titleAttributes;return{base:j(f.BASE,n,o),bodyAttributes:j(F.BODY,r,o),htmlAttributes:j(F.HTML,a,o),link:j(f.LINK,l,o),meta:j(f.META,i,o),noscript:j(f.NOSCRIPT,s,o),script:j(f.SCRIPT,u,o),style:j(f.STYLE,d,o),title:j(f.TITLE,{title:m,titleAttributes:h},o)}},_t=function(e){var n,r;return r=n=function(o){Tt(a,o);function a(){return ht(this,a),vt(this,o.apply(this,arguments))}return a.prototype.shouldComponentUpdate=function(i){return!dt(this.props,i)},a.prototype.mapNestedChildrenToProps=function(i,s){if(!s)return null;switch(i.type){case f.SCRIPT:case f.NOSCRIPT:return{innerHTML:s};case f.STYLE:return{cssText:s}}throw new Error("<"+i.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},a.prototype.flattenArrayTypeChildren=function(i){var s,u=i.child,d=i.arrayTypeChildren,p=i.newChildProps,m=i.nestedChildren;return A({},d,(s={},s[u.type]=[].concat(d[u.type]||[],[A({},p,this.mapNestedChildrenToProps(u,m))]),s))},a.prototype.mapObjectTypeChildren=function(i){var s,u,d=i.child,p=i.newProps,m=i.newChildProps,h=i.nestedChildren;switch(d.type){case f.TITLE:return A({},p,(s={},s[d.type]=h,s.titleAttributes=A({},m),s));case f.BODY:return A({},p,{bodyAttributes:A({},m)});case f.HTML:return A({},p,{htmlAttributes:A({},m)})}return A({},p,(u={},u[d.type]=A({},m),u))},a.prototype.mapArrayTypeChildrenToProps=function(i,s){var u=A({},s);return Object.keys(i).forEach(function(d){var p;u=A({},u,(p={},p[d]=i[d],p))}),u},a.prototype.warnOnInvalidChildren=function(i,s){return!0},a.prototype.mapChildrenToProps=function(i,s){var u=this,d={};return N.Children.forEach(i,function(p){if(!(!p||!p.props)){var m=p.props,h=m.children,v=ee(m,["children"]),b=Rt(v);switch(u.warnOnInvalidChildren(p,h),p.type){case f.LINK:case f.META:case f.NOSCRIPT:case f.SCRIPT:case f.STYLE:d=u.flattenArrayTypeChildren({child:p,arrayTypeChildren:d,newChildProps:b,nestedChildren:h});break;default:s=u.mapObjectTypeChildren({child:p,newProps:s,newChildProps:b,nestedChildren:h});break}}}),s=this.mapArrayTypeChildrenToProps(d,s),s},a.prototype.render=function(){var i=this.props,s=i.children,u=ee(i,["children"]),d=A({},u);return s&&(d=this.mapChildrenToProps(s,d)),N.createElement(e,d)},gt(a,null,[{key:"canUseDOM",set:function(i){e.canUseDOM=i}}]),a}(N.Component),n.propTypes={base:g.object,bodyAttributes:g.object,children:g.oneOfType([g.arrayOf(g.node),g.node]),defaultTitle:g.string,defer:g.bool,encodeSpecialCharacters:g.bool,htmlAttributes:g.object,link:g.arrayOf(g.object),meta:g.arrayOf(g.object),noscript:g.arrayOf(g.object),onChangeClientState:g.func,script:g.arrayOf(g.object),style:g.arrayOf(g.object),title:g.string,titleAttributes:g.object,titleTemplate:g.string},n.defaultProps={defer:!0,encodeSpecialCharacters:!0},n.peek=e.peek,n.rewind=function(){var o=e.rewind();return o||(o=Te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),o},r},Mt=function(){return null},Nt=at(Et,Pt,Te)(Mt),ne=_t(Nt);ne.renderStatic=ne.rewind;export{Jt as B,Ue as C,ne as H,Xt as N,Vt as W,ze as a,Zt as b,Ze as g,$e as s};