"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1829],{Q5Rh:function(e,t,o){o.d(t,{C:function(){return ChoiceField},T:function(){return TextField},i:function(){return I},u:function(){return h}});var n=o("/npG"),r=o("iuhU"),i=o("Eso5"),a=o("8vDj"),l=o("5juI"),s=o("LufY"),d=o("q1tI"),c=o("ChHM"),p=o("AeFk"),u=o("rBCA"),m=o("iBNF"),h=(0,n.k)(e=>(0,l.G)(e)[l.C.LEADGEN]);let g=(0,d.createContext)({}),v=p.iv` height: 100% !important; min-height: calc(var(--container-height, 56px) * 24 / 56); line-height: calc(var(--container-height, 56px) * 24 / 56); border: none !important; border-radius: 0 !important; outline: none !important; box-shadow: none !important; padding: 0; cursor: pointer; /* opacity: 0; */ ::placeholder { color: ${m.r.colors.gray400}; } `,x=p.iv` height: auto !important; cursor: text; opacity: 1; transition: 0.1s ease-in-out all; `,b=p.iv` position: absolute; top: calc(var(--container-height) / 2); left: var(--space-x, 16px); margin: 0; z-index: 1; cursor: pointer; transform: translateY(-50%); transition: 0.125s ease-in all; right: 0; // auto grow width `,f=p.iv` top: var(--space-y-shrink, 6px); transform: translateY(0); transition: 0.125s ease-out all; right: 0; // auto grow width `,w=p.iv` min-height: var(--container-height, 56px); display: flex; align-items: flex-end; border: 1px solid ${m.r.colors.gray200}; border-radius: 8px; background-color: #fff; padding-inline: var(--space-x, 16px); padding-block: var(--space-y-not-shrink, 16px); cursor: pointer; pointer-events: none; &:has(.mantine-Input-rightSection) { padding-right: var(--container-height, 56px); } .mantine-Input-icon { display: none; } .mantine-NumberInput-control { border-color: ${m.r.colors.gray200}; } `,y=p.iv` height: auto; min-height: var(--container-height, 56px); padding-block: var(--space-y-shrink, 6px); cursor: text; pointer-events: auto; `,k=p.iv` color: ${m.r.colors.red800}; font-size: 12px; line-height: 1.5; `,E=u.Z.div` --space-x: 16px; --space-y-not-shrink: 15px; --space-y-shrink: 6px; --container-height: 56px; --label-not-shrink: 16px; --label-shrink: 12px; --input: 15px; position: relative; min-width: 100px; max-width: 100%; display: inline-block; .textField_wrapper { display: inline-block; width: 100%; cursor: pointer; } .mantine-InputWrapper-root { &[data-invalid='true'] { .mantine-Input-wrapper { border-color: ${m.r.colors.red400}; } } .mantine-Input-wrapper { &:has([data-invalid]) { border-color: ${m.r.colors.red400}; } } } .mantine-InputWrapper-label { ${b} } .mantine-Input-wrapper { ${w} + .mantine-Popover-dropdown[data-position="bottom-start"] { left: 0 !important; } + .mantine-Popover-dropdown[data-position='top-start'] { top: unset !important; left: 0 !important; bottom: 100% !important; } } .mantine-Input-input { ${v} } &.textField_shrink { .mantine-InputWrapper-label { ${f} } .mantine-Input-wrapper { ${y} &.mantine-Select-wrapper { .mantine-Select-rightSection { pointer-events: auto !important; } } } .mantine-Input-input { ${x} } &:has(.PhoneInput) { .mantine-InputWrapper-label { left: var(--space-x, 16px); } .PhoneInput { .PhoneInputInput { opacity: 1; } } } } &:focus-within { .mantine-Input-wrapper { transition: 0.25s linear border; border-color: ${m.r.colors.primary600}; box-shadow: 0 0 4px ${m.r.colors.primary200}; } } .PhoneInput { --phone-select: 75px; --phone-input-space-x: 8px; width: 100%; opacity: 1; border: none; .PhoneInputCountry { background-color: transparent; border: none; padding: 0; width: var(--phone-select, 75px); } .PhoneInputInput { flex: 1; min-width: 0; line-height: 1.5; outline: none !important; border: none; box-shadow: none; font-size: var(--input, 15px); padding: 0 var(--phone-input-space-x, 8px); /* opacity: 0; */ color: ${m.r.colors.gray800} !important; :focus { color: ${m.r.colors.gray800} !important; } } } &:has(.PhoneInput) { .mantine-InputWrapper-label { left: calc( var(--space-x, 16px) + var(--phone-select, 75px) + var(--phone-input-space-x, 8px) ); } } .icon { position: absolute; top: calc(var(--container-height) / 2); right: var(--space-x, 16px); transform: translateY(-50%); transition: 0.125s ease-in all; &.shrink { top: calc(var(--container-height) / 2 - 4px); transform: translateY(0); } } `,C=u.Z.div` &.leadgen-form_checkbox, &.leadgen-form_radio { width: 100%; } &.leadgen-form_dropdown { width: calc(50% - 12px); } .mantine-InputWrapper-root { display: block; } .mantine-InputWrapper-label { margin-bottom: 0.5rem; color: ${m.r.colors.gray800}; font-size: 16px; font-weight: 400; line-height: 1.5; } .mantine-Radio-root, .mantine-Checkbox-root { gap: 8px; min-width: calc(50% - 4px); // input[type='radio'], // input[type='checkbox'] { // border-color: ${m.r.colors.gray600}; // width: 18px; // height: 18px; // } // input[type='checkbox'] { // border-radius: 4px; // } // &[data-checked='true'] { // input[type='radio'], // input[type='checkbox'] { // border-color: ${m.r.colors.primary600}; // } // input[type='radio'] { // background-color: white; // } // } .mantine-Checkbox-input { &:checked { border-color: ${m.r.colors.primary600}; } } } .leadgen-choiceContainer { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; } .mantine-InputWrapper-error { ${k} } `;u.Z.div` position: absolute; top: calc(var(--container-height) / 2); right: var(--space-x, 16px); `;let TextField=e=>{let{shrink:t,onChangeShrink:o,children:n,className:i}=e,a=(0,s._)(e,["shrink","onChangeShrink","children","className"]),[l,c]=(0,d.useState)(t),[p,u]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{c(t)},[t]),d.createElement(g.Provider,Object.assign({value:{shrinkProps:t,shrink:l,setShrink:c,onChangeShrink:o,hasIcon:p,setHasIcon:u}},a),d.createElement(E,Object.assign({shrink:l,className:(0,r.default)(i,"textField",{textField_shrink:!!l})},a),n))},TextFieldControl=e=>{let{shrink:t,shrinkProps:o,onChangeShrink:n,setShrink:r,hasIcon:a}=(0,d.useContext)(g),{children:l,htmlFor:s}=e,p=(0,c.O)(()=>{o||(r(!1),null==n||n(!1))}),focusInput=e=>{setTimeout(()=>{let t=e.querySelectorAll('input:not([disabled]):not([type="submit"]),select:not([disabled]),textarea:not([disabled])'),o=t.item(t.length-1);o&&o.focus({preventScroll:!0})},150)},u=(0,d.useCallback)(e=>{if(t){focusInput(e.currentTarget);return}r(!0),null==n||n(!0),focusInput(e.currentTarget)},[t]);return(0,d.useEffect)(()=>{r(o)},[o]),d.createElement(i.x,{ref:p,onClick:u,className:"textField_wrapper",component:s?"label":"div",htmlFor:s},"function"==typeof l?l({shrink:!!t,hasIcon:a}):l)},TextFieldIcon=({Icon:e})=>{let{shrink:t,setHasIcon:o}=(0,d.useContext)(g),n=(0,a.rZ)();return(0,d.useEffect)(()=>{e&&o(!0)},[]),e?d.createElement(e,{className:`icon ${t?"shrink":""}`,shrink:t,size:24,color:n.colors.gray[9]}):null};TextField.Control=TextFieldControl,TextField.Icon=TextFieldIcon;let ChoiceField=e=>{let{children:t,className:o}=e,n=(0,s._)(e,["children","className"]);return d.createElement(C,Object.assign({className:(0,r.default)(o,"choiceField")},n),t)};var I=Object.freeze({__proto__:null,TextField:TextField,TextFieldControl:TextFieldControl,TextFieldIcon:TextFieldIcon,ChoiceField:ChoiceField})},CEkh:function(e,t,o){o.d(t,{C:function(){return Checkbox},I:function(){return ImageWrapV2},P:function(){return Pagination},S:function(){return f},a:function(){return g},b:function(){return SearchInput},c:function(){return Search2}});var n=o("q1tI"),r=o("rBCA"),i=o("kO4G"),a=o("iBNF"),l=o("LufY"),s=o("BH8n"),d=o("9uQI");let Search2=e=>n.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 24 25",fill:"none"},e),n.createElement("path",{d:"M11 18.957C14.866 18.957 18 15.823 18 11.957C18 8.09104 14.866 4.95703 11 4.95703C7.13401 4.95703 4 8.09104 4 11.957C4 15.823 7.13401 18.957 11 18.957Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),n.createElement("path",{d:"M20 20.957L16 16.957",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),c=r.Z.div` display: flex; cursor: pointer; &[data-theme='marryBaby'] { input { width: 20px; height: 20px; border: 1.3px solid ${a.r.mbColors.midGray}; border-radius: 9px; cursor: inherit; transition: border-color 0.4s, box-shadow 0.4s; &:hover, &:active { border-color: ${a.r.mbColors.cobalt}; box-shadow: 0 0 2px 2px ${a.r.mbColors.cobalt}; } &:focus-visible { border: 2px solid ${a.r.mbColors.cobalt}; } &:checked { border: 0; background: ${a.r.mbColors.cobalt} url("data:image/svg+xml,%3Csvg width='9' height='7' viewBox='0 0 9 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 4L3.45455 6L8 1' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A") no-repeat center center; } } label { max-width: 15rem; margin-left: 8px; width: calc(100% - 24px); cursor: inherit; font-weight: 600; font-size: 12px; line-height: 20px; letter-spacing: -0.2px; color: ${a.r.mbColors.gray}; } } input { width: 20px; height: 20px; border: solid 1px ${a.r.colors.gray500}; border-radius: 2px; cursor: inherit; transition: border-color 0.4s, box-shadow 0.4s; &:hover, &:active { border-color: ${a.r.colors.primaryBase}; box-shadow: 0 0 2px 2px ${a.r.colors.primary200}; } &:focus-visible { border: 2px solid ${a.r.colors.primaryActive}; } &:checked { border: 0; background: ${a.r.colors.primaryBase} url("data:image/svg+xml,%3Csvg width='12' height='9' viewBox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 1L4.125 8L1 4.81819' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A") no-repeat center center; } } label { max-width: 15rem; margin-left: 8px; font-weight: ${a.r.sizes.fwRegular}; width: calc(100% - 24px); cursor: inherit; ${i.M.mbDown} { font-size: 14px; line-height: 24px; } ${i.M.mbUp} { font-size: 16px; line-height: 22px; } } &[data-is-rectangle] > input { position: relative; width: unset; height: unset; padding: 5px 12px; border: 1px solid ${a.r.colors.neutral100}; border-radius: 32px; &::after { color: ${a.r.colors.gray800}; content: attr(data-label-text); font-size: 13px; } &:checked { border-color: ${a.r.colors.primary50}; &::after { color: ${a.r.colors.primaryBase}; } } &:checked { background: ${a.r.colors.primary50}; } } &[data-disabled] { color: ${a.r.colors.gray300}; cursor: not-allowed; input { border-color: ${a.r.colors.gray300}; &:hover { border-color: ${a.r.colors.gray300}; box-shadow: none; } } } `,Checkbox=({label:e,name:t,checked:o,className:r,isDisabled:i,onChange:a,value:l,isRectangle:s,inputDataTestId:d,siteType:p})=>n.createElement(c,{className:r,"data-disabled":i||void 0,"data-is-rectangle":s||void 0,"data-label-text":e,"data-theme":p},n.createElement("input",{type:"checkbox",checked:o,name:t,onChange:()=>a(l,!o),disabled:i,value:l,id:`${t}-${l}`,"data-label-text":e,"data-testid":d}),!s&&n.createElement("label",{htmlFor:`${t}-${l}`},e)),p=r.Z.div` display: flex; align-items: center; justify-content: space-between; user-select: none; li { transition: all 0.3s ease; } [data-page-active] { background: ${a.r.colors.primaryBase}; color: ${a.r.colors.white}; > a { color: ${a.r.colors.white}; } } `,u=r.Z.div` display: flex; width: 32px; height: 32px; box-sizing: border-box; align-items: center; justify-content: center; border: 1px solid ${a.r.colors.gray200}; margin: 0 2px; border-radius: 4px; color: ${a.r.colors.gray800}; cursor: pointer; font-size: 14px; font-weight: ${a.r.sizes.fwBold}; &[data-last-page] { border: none; background-color: ${a.r.colors.gray100}; cursor: not-allowed; pointer-events: none; svg { path { stroke: ${a.r.colors.gray300}; } } } `,m=r.Z.li` display: flex; width: 32px; height: 32px; align-items: center; justify-content: center; margin: 0 2px; border-radius: 4px; color: ${a.r.colors.gray800}; cursor: pointer; font-size: 14px; font-weight: ${a.r.sizes.fwBold}; > a { color: ${a.r.colors.gray800}; text-decoration: unset; display: block; width: 100%; height: 100%; line-height: 32px; text-align: center; } `,RenderPagiWithDots=({pagesAmount:e,activePage:t,handlePageChange:o,handleClick:r,href:a,queryPageName:l="page"})=>{let s=[...Array(e)].map((e,t)=>t+1),[d,c]=(0,n.useState)(t<=4?s.slice(0,5):t>=s.length-3?s.slice(s.length-5,s.length):s.slice(t-2,t+1));return(0,n.useEffect)(()=>{t<=4?c(s.slice(0,5)):t>=s.length-3?c(s.slice(s.length-5,s.length)):c(s.slice(t-2,t+1))},[t]),n.createElement(n.Fragment,null,t>4&&n.createElement(n.Fragment,null,n.createElement(m,{onClick:()=>o(1)},a?n.createElement("a",{href:a,onClick:r},1):1),n.createElement(m,null,"...")),d.map(e=>n.createElement(m,{key:`pagination+${e}`,"data-page-active":e===t||void 0,onClick:()=>o(e)},a?n.createElement("a",{href:(0,i.f)(a,e,l),onClick:r},e):e)),to(s.length)},a?n.createElement("a",{href:(0,i.f)(a,s.length,l),onClick:r},s.length):s.length)))},Pagination=({className:e,pagesAmount:t,currentPage:o,onChange:r,onClick:a,style:l,href:s,queryPageName:d="page"})=>{let c=[...Array(t)].map((e,t)=>t+1),[h,g]=(0,n.useState)(o),v=(0,n.useMemo)(()=>s&&s.endsWith("&page=")?s.replace("&page=",""):s,[s]),x=t-1,handlePageChange=e=>{e<=t&&e>0&&(g(e),r(e))},handleClick=e=>{a&&a(e)};return(0,n.useEffect)(()=>{g(o)},[o]),n.createElement(p,{className:e,style:l},n.createElement(u,{className:"prev-page",onClick:()=>handlePageChange(h-1),"data-last-page":1===h||void 0},v?n.createElement("a",{href:(0,i.f)(v,h,d),onClick:handleClick},n.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},n.createElement("path",{d:"M5.5 9L1.5 5L5.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))):n.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},n.createElement("path",{d:"M5.5 9L1.5 5L5.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),c.length>8?n.createElement(RenderPagiWithDots,{pagesAmount:t,activePage:h,handlePageChange:handlePageChange,handleClick:handleClick,href:v,queryPageName:d}):c.map(e=>n.createElement(m,{key:`pagination+${e}`,"data-page-active":e===h||void 0,onClick:()=>handlePageChange(e)},v?n.createElement("a",{href:(0,i.f)(v,e,d),onClick:handleClick},e):e)),n.createElement(u,{className:"next-page",onClick:()=>handlePageChange(h+1),"data-last-page":h===x+1||void 0},v?n.createElement("a",{href:(0,i.f)(v,h,d),onClick:handleClick},n.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},n.createElement("path",{d:"M1.5 9L5.5 5L1.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))):n.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},n.createElement("path",{d:"M1.5 9L5.5 5L1.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))))},h=r.Z.div` position: relative; width: 100%; &[data-has-error] { input { border-color: ${a.r.colors.red700}; } } input { width: 100%; padding: 12px 16px; border: solid 1px ${a.r.colors.gray200}; border-radius: ${a.r.borderRadius}; &:active, &:focus, .focused & { border-color: ${a.r.colors.primaryBase}; box-shadow: 0px 0px 2px 2px ${a.r.colors.primary200}; } &:disabled { background-color: ${a.r.colors.gray100}; cursor: not-allowed; } } &[data-has-action-icon] { input { padding: 12px 48px 12px 16px; } } &[data-has-display-icon] { input { padding: 12px 16px 12px 48px; } } &[data-has-action-icon][data-has-display-icon] { input { padding: 12px 48px; } } &[data-size='lg'] { input { font-size: 16px; font-weight: ${a.r.sizes.fwRegular}; ${i.M.mbDown} { font-size: 22px; line-height: 1.2; } ${i.M.mbUp} { font-size: 26px; line-height: 1.2; } } } &[data-size='md'] { input { font-weight: ${a.r.sizes.fwRegular}; ${i.M.mbDown} { font-size: 14px; line-height: 1.2; } ${i.M.mbUp} { font-size: 16px; line-height: 1.2; } } } &[data-size='sm'] { input { font-weight: ${a.r.sizes.fwRegular}; ${i.M.mbDown} { font-size: 13px; line-height: 1.5; } ${i.M.mbUp} { font-size: 13px; line-height: 1.5; } } } `,g=n.forwardRef((e,t)=>{var{name:o,errorMessage:r,autoComplete:i="off",defaultValue:a,actionIcon:d,displayIcon:c,isDeleteAction:p,onActionClick:u,label:m,placeholder:g,className:v,onChange:x,onKeyPress:b,isDisabled:f,CustomInput:w,size:y,style:k,autoFocus:E,type:C="text",isNumerousKeyboard:I=!1,onFocus:$,enterKeyHint:S,nativeOnChange:_}=e,T=(0,l._)(e,["name","errorMessage","autoComplete","defaultValue","actionIcon","displayIcon","isDeleteAction","onActionClick","label","placeholder","className","onChange","onKeyPress","isDisabled","CustomInput","size","style","autoFocus","type","isNumerousKeyboard","onFocus","enterKeyHint","nativeOnChange"]);let[P,N]=(0,n.useState)(a),handleOnChange=e=>{N(e),x(e)};return n.createElement(h,{"data-size":y,className:v,"data-has-action-icon":!!d||void 0,"data-has-display-icon":!!c||void 0,"data-has-error":r&&r.length>0||void 0,style:k},m&&n.createElement(s.L,{size:"label2",htmlFor:o,className:"inputLabel"},m),n.createElement("div",{style:{position:"relative"}},w||n.createElement("input",Object.assign({id:o,name:o,placeholder:g,onChange:null!=_?_:e=>handleOnChange(e.target.value),onKeyPress:b,type:C,"aria-label":C,disabled:f,value:P,autoComplete:i,ref:t,autoFocus:E,inputMode:I||"number"===C?"numeric":C,pattern:I?"[0-9]*":".*",onFocus:$,enterKeyHint:S},T)),c&&n.createElement(s.S,{className:"displayIcon"},c),d&&n.createElement(s.a,{className:"actionIcon",onClick:()=>{var e;p&&(N(""),null===(e=t.current)||void 0===e||e.focus()),u&&u()}},d)),r&&r.length>0&&n.createElement(s.b,{className:"errorLabel"},r))});g.displayName="PureInput";let v=[320,420,640,750,828,1080,1200,1440,1920,2048],defaultLoader=({src:e,width:t,quality:o})=>{try{let n=new URL(e,"undefined"!=typeof window?window.location.origin:"http://localhost");return n.searchParams.set("w",String(t)),n.searchParams.set("q",String(null!=o?o:75)),n.toString()}catch(t){return e}},ImageWrapV2=e=>{var{alt:t,backupSrc:o,src:r,placeholderSrc:i,style:a,ref:s,unoptimized:d=!1,quality:c,sizes:p,width:u}=e,m=(0,l._)(e,["alt","backupSrc","src","placeholderSrc","style","ref","unoptimized","quality","sizes","width"]);let[h,g]=(0,n.useState)(!1),b=(0,n.useMemo)(()=>d?[]:function(e){if(e.sizes)return v;if(e.width){let t=Math.max(1,Math.round(e.width));return Array.from(new Set([t,Math.min(2*t,2048)])).sort((e,t)=>e-t)}return v}({sizes:p,width:u}),[p,u,d]),f=(0,n.useMemo)(()=>{if(!d)return b.map(e=>`${defaultLoader({src:r,width:e,quality:c})} ${e}w`).join(", ")},[d,b,r,c]),w=(0,n.useMemo)(()=>{if(d)return r;let e=b.length?b[b.length-1]:null!=u?u:1920;return defaultLoader({src:r,width:e,quality:c})},[d,b,r,c,u]);return n.createElement(x,Object.assign({loading:"lazy",alt:t,srcSet:f,onError:()=>!h&&g(!0),src:h?o||w:w||o,style:Object.assign(Object.assign({},i?{backgroundImage:`url(${i})`}:{}),a),"data-has-placeholder":!!i,sizes:p,ref:s},m))},x=r.Z.img` &[data-has-placeholder='true'] { background-position: center; background-repeat: no-repeat; background-size: cover; } `,b=(0,r.Z)(d.I)` box-shadow: 0px 0px 1px 0px #0000000a, 0px 2px 8px 0px #0000000a, 0px 10px 16px 0px #0000000a; border-radius: 0.75rem; overflow: hidden; input.mantine-Input-input { border: none; font-size: 0.8125rem; line-height: 1.25rem; } `,f=(0,r.Z)(Search2)` color: ${a.r.colors.primaryBase}; width: 20px; height: 20px; `,SearchInput=e=>{let{loading:t,disabled:o,placeholder:r,value:i,onChange:a,icon:s=n.createElement(f,null),className:d,style:c}=e,p=(0,l._)(e,["loading","disabled","placeholder","value","onChange","icon","className","style"]);return n.createElement(b,Object.assign({disabled:t||o,size:"lg",value:i,onChangeRaw:e=>{a(e.currentTarget.value)},type:"text",placeholder:r,className:d,icon:s,style:c},p,{"data-event-label":i}))}},oj4Y:function(e,t,o){o.d(t,{C:function(){return CardPost},S:function(){return SourceList},V:function(){return VerifiedTag},a:function(){return CardPostPopoverMore},b:function(){return CardReply},c:function(){return CardReplyPopover}});var n=o("LufY"),r=o("q1tI"),i=o("OaJP"),a=o("h7+k"),l=o("J5bt"),s=o("ns0B"),d=o.n(s),c=o("QWYs"),p=o("UbCi"),u=o("aIjN"),m=o("aZjv"),h=o("Y8gQ"),g=o("LgGC"),v=o("rBCA"),x=o("kO4G"),b=o("iBNF"),f=o("Bkqm"),w=o("IQVP"),y=o("Wae/"),k=o("DIGB"),E=o("lc3p"),C=o("Ywcn"),I=o("HqVW"),$=o("sdrH"),S=o("oTwY"),_=o("iZ8j"),T=o("e0pn"),P=o("LWwf"),N=o("PbOM"),M=o("bpvy"),j=o("BH8n"),z=o("rrs9"),R=o("Oy6H"),L=o("LdDg"),O=o("xrdX"),B="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3e%3cpath fill='%233E3F58' d='M5 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2M19 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2'/%3e%3c/svg%3e",D="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='3' height='13' fill='none'%3e%3ccircle cx='1.583' cy='6.417' r='1.25' fill='%23595959' transform='rotate(90 1.583 6.417)'/%3e%3ccircle cx='1.583' cy='1.417' r='1.25' fill='%23595959' transform='rotate(90 1.583 1.417)'/%3e%3ccircle cx='1.583' cy='11.417' r='1.25' fill='%23595959' transform='rotate(90 1.583 11.417)'/%3e%3c/svg%3e",A="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M2 4h12'/%3e%3cpath stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M5.333 4V2.667a1.333 1.333 0 0 1 1.334-1.334h2.666a1.334 1.334 0 0 1 1.334 1.334V4m2 0v9.333a1.334 1.334 0 0 1-1.334 1.334H4.667a1.334 1.334 0 0 1-1.334-1.334V4zM6.667 7.333v4M9.333 7.333v4'/%3e%3c/svg%3e";let CardPostPopoverMore=({authorEmail:e,onDeletePost:t,shareUrl:o,post:i,className:a="",popoverClassName:s="",onEditPost:d})=>{let{data:{locale:v,userInfo:x,env:{isMarryBaby:b}}}=(0,r.useContext)(h.T),{t:f}=(0,l.u)(),[w,y]=(0,r.useState)(!1),[k,E]=(0,r.useState)(!1),[C,I]=(0,r.useState)(!1),{authActionWrapper:$}=(0,m.iV)(),S=e&&(null==x?void 0:x.email)&&e===String(null==x?void 0:x.email);return r.createElement("div",{className:a,onClick:e=>{e.preventDefault(),e.stopPropagation()}},C&&r.createElement(c.S,{url:o,text:null==i?void 0:i.title,onClose:()=>I(!1)}),k&&r.createElement(c.P,{thumbnail:p.C.getAssetPath("trash-bin.svg"),isThumbnailIcon:!0,title:f("popup.deletePost.title"),description:f("popup.deletePost.description"),acceptText:f("popup.deletePost.accept"),cancelText:f("popup.deletePost.cancel"),onAccept:()=>(0,n.a)(void 0,void 0,void 0,function*(){if((null==i?void 0:i.id)&&!w){y(!0);try{let e=yield(0,c.h)({id:i.id,locale:v});(null==e?void 0:e.status)===1&&(null==t||t())}catch(e){}y(!1)}}),onClose:()=>E(!1)}),r.createElement(g.b,{className:s,toggleButtonContent:r.createElement("img",{src:b?B:D,loading:"lazy"}),position:"bottom",align:"end",buttonProps:{isLoading:w},data:S?{isShowheader:!1,type:"list",list:[{icon:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M7.17 3.236H2.995a1.193 1.193 0 0 0-1.193 1.192v8.35a1.193 1.193 0 0 0 1.193 1.192h8.35a1.193 1.193 0 0 0 1.192-1.192V8.603'/%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M11.643 2.341a1.265 1.265 0 0 1 1.789 1.79L7.766 9.795l-2.385.596.596-2.385z'/%3e%3c/svg%3e",label:f("actionPopover.edit"),onClick:d},{icon:A,label:f("actionPopover.delete"),onClick:()=>{$(()=>E(!0))}}]}:{isShowheader:!1,type:"list",list:[{icon:c.i,label:f("morePopover.report"),subTree:{title:f("morePopover.report.title"),description:f("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(u.R).map(e=>({label:u.R[e].label,reason:u.R[e].reportReasonText,reasonValue:e})).map(e=>({label:f(e.label),subTree:{title:f("morePopover.reportSubmit.title"),description:f("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:t=>r.createElement(c.b,{reason:e.reasonValue,reasonText:f(e.reason),postId:null==i?void 0:i.id,onClose:()=>t&&t(!1)})}}))}}]}}))},F=v.Z.div` position: relative; margin-bottom: 24px; background: white; border-radius: ${b.r.borderRadius}; a { text-decoration: none; } ${x.M.mbDown} { margin-bottom: 8px; } &.flat-top { border-top-left-radius: 0; border-top-right-radius: 0; } .post-pin { padding: 0.5rem 1rem; border-radius: ${b.r.borderRadius} 6px 0 0; } .post-author { display: flex; align-items: center; justify-content: space-between; &.comment { padding-right: 2.6rem; } .author-avatar-wrapper { width: 40px; height: 40px; font-size: 20px; ${x.M.mbDown} { width: 32px; height: 32px; font-size: 16px; } } } .post-content-link-wrapper { color: inherit; cursor: pointer; .post-content-title { padding: 1rem 1rem 0; word-break: break-word; } } .social-preview-wrapper.has-image { margin-bottom: 5px; } .social-preview-wrapper, .image-preview-wrapper, .link-preview-wrapper { width: 100%; &[data-is-reply='true'] { padding-right: 1rem; padding-left: 1rem; } } .post-topics { padding: 0 1rem; } .post-reaction { background: none; border-radius: 0 0 6px 6px; &.hide-top-border { ::before { display: none; } } } .most-engaging-wrapper { padding: 1rem; cursor: pointer; .author-avatar-wrapper { width: 2rem; height: 2rem; font-size: 1rem; } .see-more-comments { width: 100%; padding: 12px 0 0; text-align: unset; } } &[data-most-engaging='true'] { border: none; ${x.M.mbDown} { margin: 1rem; border: 1px solid #e4e8ec; } } .top-divider { border-color: #e4e8ec; } .popover { .popover-menu__btn { display: flex; width: 1.5rem; height: 1rem; align-items: center; justify-content: center; padding: 0; background: transparent; &:hover { background-color: transparent; } } .popover-menu__content { &.--position-bottom { &.--align-end { &::before { right: 12.5px; } } } } } &[data-is-marrybaby='true'] { border: 1px solid #f3f3f3; border-radius: 1rem; /* shadow */ box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.08); .image-preview-wrapper, .link-preview-wrapper { padding-right: 1rem; padding-left: 1rem; } .popover { .popover-menu__btn { width: 24px; height: 24px; ${x.M.mbDown} { width: 18px; height: 18px; } } .popover-menu__content { &.--position-bottom { &.--align-end { &::before { right: 1rem; } width: 350px; ${x.M.mbDown} { max-width: calc(320px - 2rem); } } } } } .most-engaging-wrapper { position: relative; padding: 0; &::before { position: absolute; z-index: 5; top: 0; left: 50%; width: calc(100% - 2rem); height: 1px; background: #f3f3f3; content: ' '; transform: translateX(-50%); } } ${x.M.mbDown} { margin-bottom: 12px; } } `;var Z="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M12 13.333 8 10.37l-4 2.963V3.852c0-.314.12-.616.335-.838.214-.222.505-.347.808-.347h5.714c.303 0 .594.125.808.347s.335.524.335.838z'/%3e%3c/svg%3e";let CardReplyPopover=({onDeleteComment:e,commentId:t,className:o="",popoverClassName:i=""})=>{let{data:{env:{isMarryBaby:a},locale:s},action:{pushNotifications:d}}=(0,r.useContext)(h.T),{t:p}=(0,l.u)(),[u,v]=(0,r.useState)(!1),{authActionWrapper:x}=(0,m.iV)();return r.createElement("div",{className:o,onClick:e=>{e.preventDefault(),e.stopPropagation()}},u&&r.createElement(c.P,{thumbnail:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' fill='none'%3e%3cg stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' clip-path='url(%23a)'%3e%3cpath d='M2 4.008h12m-8.667 0V2.675a1.333 1.333 0 0 1 1.334-1.333h2.666a1.333 1.333 0 0 1 1.334 1.333v1.333m2 0v9.334a1.333 1.333 0 0 1-1.334 1.333H4.667a1.333 1.333 0 0 1-1.334-1.333V4.008zm-6 3.334v4m2.666-4v4'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='a'%3e%3cpath fill='white' d='M0 .008h16v16H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",isThumbnailIcon:!0,title:p("popup.deleteComment.title"),description:p("popup.deleteComment.description"),acceptText:p("popup.deletePost.accept"),cancelText:p("popup.deletePost.cancel"),onAccept:()=>(0,n.a)(void 0,void 0,void 0,function*(){var o;if(!t)return;let n=yield(0,c.j)({id:t,locale:s});(null==n?void 0:n.status)===1?(e&&e(),d({title:"",message:p("notification.success"),type:"success"})):d({title:"",message:(null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o[0])||p("notification.failure"),type:"danger"})}),onClose:()=>v(!1)}),r.createElement(g.b,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:A,label:p("actionPopover.delete"),onClick:()=>{x(()=>{v(!0)})}}]},className:i,toggleButtonContent:r.createElement("img",{src:a?B:D,loading:"lazy"}),buttonProps:{}}))},V=v.Z.div` .add-link { color: ${b.r.colors.primaryBase}; } `,W=v.Z.div` margin: 16px 0; background: ${b.r.colors.yellow50}; padding: 5px 10px; border-radius: 2px; .icon { display: inline-block; vertical-align: middle; margin-right: 6px; } `,U=v.Z.div` display: flex; align-items: center; gap: 8px; `,G=v.Z.div` padding: 8px 16px; `,H=v.Z.div` margin-bottom: 12px; width: 100%; `,Y=v.Z.div``,Q=v.Z.div` margin-bottom: 16px; `,q=v.Z.div` display: flex; flex-wrap: wrap; row-gap: 16px; ${x.M.tdUp} { align-items: center; column-gap: 24px; } `,K=v.Z.a` display: flex; align-items: center; gap: 16px; ${x.M.mbDown} { width: 100%; justify-content: space-between; } `,X=v.Z.div` display: flex; align-items: center; gap: 16px; `,J=v.Z.div` border-radius: ${b.r.borderRadius}; overflow: hidden; width: 48px; height: 48px; img { object-fit: cover; width: 100%; height: 100%; } `,RecommentCategories=({categories:e})=>{let{t}=(0,l.u)(),{data:{locale:o,env:{isMarryBaby:n}}}=(0,r.useContext)(h.T),i=(0,L.g)(o,n);return r.createElement(Y,null,r.createElement(Q,null,r.createElement(a.H,{tag:"h6",as:"h5"},t("cardReply.recommentCategories.heading"))),r.createElement(q,null,e.map(e=>r.createElement(K,{href:i+e.permalink,key:String(e.termId),target:"_blank"},r.createElement(X,null,r.createElement(J,null,r.createElement("img",{src:e.featureImage||p.C.getAssetPath(n?"mb-logo.svg":"/logo/logomark.png"),alt:e.displayName,loading:"lazy"})),r.createElement(z.T,{size:"s3",weight:"bold"},e.displayName)),r.createElement(_.Z,{size:20,color:b.r.colors.gray400})))))},ee=v.Z.a` padding: 12px 0; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid ${b.r.colors.neutral100}; text-decoration: none; &:first-child { border-top: 0; } `,SourceItem=({postTitle:e,articleReviewed:t,modifiedTime:o,href:n})=>{let{t:i}=(0,l.u)(),a=(()=>{let{expert:e,editor:o,is_author:n}=t;if(e){let t={name:e.display_name,role:"expert",avatar:e.avatar};return n?Object.assign({title:i("articleAuthor.title.written-by")},t):"expert"===e.role?Object.assign({title:i("articleAuthor.title.expert")},t):Object.assign({title:i("articleAuthor.title.medical")},t)}if(o)return{title:i("articleAuthor.title.fact-check"),name:o.display_name,avatar:o.avatar}})();return r.createElement(ee,{href:n,title:e,target:"_blank"},r.createElement(z.T,{size:"s3",as:"h5",weight:"bold"},e),r.createElement("div",null,r.createElement(k.C,{avatar:null==a?void 0:a.avatar,avatarProps:{size:32},name:null==a?void 0:a.name,role:null==a?void 0:a.role,hideBackground:!0},r.createElement(k.C.SubTextRow,null,r.createElement(k.C.SubText,null,null==a?void 0:a.title," ",r.createElement("span",{style:{color:b.r.colors.gray800}},null==a?void 0:a.name)),r.createElement(k.C.SubDivider,null),r.createElement(k.C.SubText,null,o)))))};var et={header:"F4mmgSy",chevron:"A7QrQ7A"};let SourceList=e=>{var{listUrl:t,hideSourceList:o,categorySlug:s,editMode:d,collapseSource:c,onListChange:u,isMarryBaby:m}=e,g=(0,n._)(e,["listUrl","hideSourceList","categorySlug","editMode","collapseSource","onListChange","isMarryBaby"]);let{t:v}=(0,l.u)(),[x,y]=(0,r.useState)(t||[]),[k,E]=(0,r.useState)([]),[C,I]=(0,r.useState)([]),[$,_]=(0,r.useState)(!1);(0,r.useEffect)(()=>{o||(0,n.a)(void 0,void 0,void 0,function*(){_(!0);let e=x.map(e=>{let t=new URL(e),o=String(t.pathname).split("/").filter(e=>""!=e),n=t.origin,r=-1!==n.search("marrybaby.vn");return{isMarrySite:r,path:o[o.length-1],href:e}}),t=[...e.map(e=>(0,h.c)(e.isMarrySite?(0,h.s)(w.D9.GET_PREVIEW_ARTICLE,{fullSlug:e.path},!0):(0,h.o)(w.D9.GET_PREVIEW_ARTICLE,{fullSlug:e.path},!0),"GET"))],o=yield Promise.all(t);E(o.map((t,o)=>{var n,r;return(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.post)&&Object.assign(Object.assign({},(0,f.g)(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.post)),{href:e[o].href})}).filter(Boolean)),_(!1)})},[]),(0,r.useEffect)(()=>{!o&&(null==k?void 0:k.length)===0&&s&&(0,n.a)(void 0,void 0,void 0,function*(){var e;let t=yield(0,h.c)(m?(0,h.s)(w.D9.GET_CATEGORY_OR_ARTICLE_DETAIL,{fullSlug:s},!0):(0,h.o)(w.D9.GET_CATEGORY_OR_ARTICLE_DETAIL,{fullSlug:s},!0),"GET");(null==t?void 0:t.data)&&I([(0,f.h)(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.category)])})},[k]);let handleRemoveItem=e=>{y(t=>{let o=[...t];return o.splice(e,1),o}),E(t=>{let o=[...t];return o.splice(e,1),o})};return(0,r.useEffect)(()=>{null==u||u(x)},[x]),r.createElement("div",Object.assign({},g),!d&&r.createElement(W,null,r.createElement("img",{className:"icon",src:p.C.getAssetPath("warning.svg"),alt:"warning",style:{marginBottom:"3px",width:"18px"},loading:"lazy"}),r.createElement(z.T,{size:"s3",as:"span",dangerouslySetInnerHTML:{__html:v("cardReply.disclaimer")}})),o?null:$?r.createElement(R.L,null):k.length>0||d?r.createElement(V,null,r.createElement(M.U,{defaultValue:!c&&"accordion",styles:{control:{borderRadius:"inherit",'&[aria-expanded="false"]':{borderBottom:0}},chevron:{width:"32px",height:"32px"},content:{padding:0,borderBottom:0,borderTop:`1px solid ${b.r.colors.neutral100}`},item:{marginBottom:"16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",border:`1px solid ${b.r.colors.neutral100}`,borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px","&[data-active]":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}},chevron:r.createElement("div",{className:et.chevron},r.createElement(T.Z,{color:b.r.colors.gray600,size:20}))},r.createElement(M.U.Item,{value:"accordion"},r.createElement(M.U.Control,null,r.createElement("div",{className:et.header},r.createElement(a.H,{as:"h4",tag:"h6"},v("cardReply.source")))),r.createElement(M.U.Panel,null,r.createElement(G,null,(k||[]).map((e,t)=>r.createElement(U,{key:String(t)},"object"==typeof e?r.createElement(SourceItem,Object.assign({},e)):r.createElement(H,null,r.createElement(j.I,{style:{width:"100%"},name:"source-list",value:e||"",size:"sm",onChange:e=>{y(o=>{let n=[...o];return n[t]=e,n}),E(o=>{let n=[...o];return n[t]=e,n})}})),d&&r.createElement(i.B,{size:"md",color:"transparent",icon:r.createElement(P.Z,null),onClick:()=>handleRemoveItem(t)}))),d&&r.createElement(i.B,{className:"add-link",color:"transparent",size:"md",icon:r.createElement(S.Z,{color:b.r.colors.primaryBase,size:18}),onClick:()=>{y(e=>[...e,""]),E(e=>[...e,""])}},"Add source")))))):r.createElement(RecommentCategories,{categories:C}))},eo=v.Z.div` position: relative; margin-bottom: 0; background: white; border-radius: ${b.r.borderRadius}; .verify-tag { margin-top: 12px; } .post-author { &.with-popover { padding-right: 2.6rem; } .author-avatar-wrapper { width: 40px; height: 40px; font-size: 20px; ${x.M.mbDown} { width: 32px; height: 32px; font-size: 16px; } } } .image-preview-wrapper, .link-preview-wrapper { width: 100%; &[data-is-reply='true'] { padding-right: 1rem; padding-left: 1rem; } } .post-reaction { background: none; border-radius: 0 0 6px 6px; } &[data-is-reply='true'] { > .post-author .author-avatar-wrapper { width: 20px; height: 20px; font-size: 10px; } } &[data-is-reply='false'] { border: 1px solid #e4e8ec; } .expert-wrapper { width: 100%; } &[data-has-booking='true'] { display: grid; .post-author { background-color: ${b.r.colors.primary50}; } .btn-wrapper { padding: 0 16px; .btn-booking { width: 100%; margin: 12px 0; } } } .comment-reply-wrapper { padding: 0 1rem; .more-cmt { .chevron-right { height: 1rem; width: 1rem; vertical-align: middle; } } } .top-divider { border-color: #e4e8ec; } .popover { position: absolute; top: 1.5rem; right: 1rem; .popover-menu__btn { display: flex; width: 1rem; height: 1rem; align-items: center; justify-content: center; padding: 0; background: transparent; &:hover { background-color: transparent; } .popover-menu__content { &.--position-bottom { &.--align-end { &::before { right: 12.5px; } } } } } } &[data-is-marrybaby='true'] { &[data-is-reply='false'] { border: none; } .image-preview-wrapper, .link-preview-wrapper { padding-right: 1rem; padding-left: 1rem; } .popover { .popover-menu__btn { width: 24px; height: 24px; } } margin-left: 56px; ${x.M.mbDown} { margin-left: 40px; } > .post-author { margin-left: -56px; ${x.M.mbDown} { margin-left: -40px; } .author-info { align-items: center; display: flex; align-items: center; .author-info-top { width: 100%; } .author-info-text-wrapper { justify-content: space-between; } } .author-avatar-wrapper { width: 40px; height: 40px; font-size: 20px; ${x.M.mbDown} { width: 24px; height: 24px; font-size: 12px; } } } &[data-is-reply] { > .post-author { .author-avatar-wrapper { width: 40px; height: 40px; font-size: 20px; ${x.M.mbDown} { width: 24px; height: 24px; font-size: 12px; } } } } .comment-reply-wrapper { padding-right: 0; padding-left: 0; } .post-reaction { &::after { position: absolute; bottom: 0; left: 50%; width: calc(100% - 2rem); height: 1px; background: #f3f3f3; content: ' '; transform: translateX(-50%); } } .post-content-wrapper { padding-top: 0; padding-bottom: 0; ${x.M.mbDown} { padding-left: 0.5rem; } } ${x.M.mbDown} { margin-bottom: 12px; } } `,en=(0,v.Z)(SourceList)` margin-top: 12px; padding: 0.5rem 1rem 1rem; `,VerifiedTag=({userId:e,avatar:t,name:o,role:n,title:a,className:s})=>{let{t:d}=(0,l.u)(),[c,p]=(0,r.useState)(!1);return r.createElement(r.Fragment,null,r.createElement(i.B,{className:`-dzIuHr ${s}`,color:"success",size:"xs",onClick:()=>p(!0),style:{padding:"5px 8px",marginBottom:"12px",borderRadius:"4px"}},r.createElement("span",{className:"text"},r.createElement(N.Z,{isSolid:!0,size:18,color:b.r.colors.green800,className:"icon"}),d("cardReply.verifyBy",{name:`${o||""}`}))),r.createElement(k.c,{open:c,onClose:()=>p(!1),profileModalProps:{zIndex:1e3}},r.createElement(E.a,{authorProps:{userId:e,avatar:t,name:o,role:n,title:a},hideQuestionTab:!0})))},CardReply=({className:e,style:t,comment:o,type:a="comment",level:s=0,replyingId:d,onPostCommentSuccess:p,post:u,onDeleteComment:v,refetchComment:x,hasQuickBookingEnable:b,handleMakeAppointment:f,cardAuthorProps:I,maxChars:S=600,disableShortenContent:_})=>{var T,P,N,M,j,z,R,L,B,D,A,F,Z;let{data:{locale:V,userInfo:W,env:{isMarryBaby:U}}}=(0,r.useContext)(h.T),{t:G}=(0,l.u)(),[H,Y]=(0,r.useState)(o||null),{id:Q,countLikes:q,content:K,replies:X=[],images:J=[],author:ee,liked:et,link:er,mentionedUser:ei,mentions:ea}=H,{text:el,replyingTo:es}=(0,c.k)(K),{authActionWrapper:ed}=(0,m.iV)({_joinCommunityIds:[null===(T=null==u?void 0:u.community)||void 0===T?void 0:T.id],_joinTopicIds:null===(P=null==u?void 0:u.topics)||void 0===P?void 0:P.map(e=>e.id)}),[ec,ep]=(0,r.useState)(4),eu=null!=W&&!!W.id&&(null==X?void 0:X.some(e=>e.author.id===W.id)),addNewReply=e=>{Y(t=>{if(!t.replies.find(t=>t.id===e.id)){t.replies.unshift(e);let o=Object.assign(Object.assign({},t),{replies:t.replies.slice(),countReplies:t.countReplies+1});return x&&x(o),o}return t})},[em,eh]=(0,r.useState)(!1),eg=(0,r.useMemo)(()=>"comment"===a&&X&&0!=X.length?X.sort((e,t)=>{let o=new Date(e.createdAt).getTime(),n=new Date(t.createdAt).getTime();return o>n?-1:o{var e,t;(null==ee?void 0:ee.hospitalId)&&(e=ee.hospitalId,(0,n.a)(void 0,void 0,void 0,function*(){var t;let o=yield(0,h.c)((0,h.g)(w.tC.GET_HOSPITAL_INFO,{hospital_branch_id:e,website_url:O.v[V]}),"get");(null===(t=null==o?void 0:o._data)||void 0===t?void 0:t.branch)&&eC(null==o?void 0:o._data.branch)})),(null==ee?void 0:ee.doctorId)&&(t=ee.doctorId,(0,n.a)(void 0,void 0,void 0,function*(){var e;let o=yield(0,h.c)((0,h.g)(w.tC.GET_DOCTOR_INFO,{doctorId:t,website_url:O.v[V]}),"get");(null===(e=null==o?void 0:o._data)||void 0===e?void 0:e.doctor)&&e$(null==o?void 0:o._data.doctor)}))},[ee.hospitalId,ee.doctorId]);let eS=(null==eI?void 0:eI.valid_outpatient)||(null==eI?void 0:eI.valid_telemedicine),e_=((null==eE?void 0:eE.total_available_service)||(null==eE?void 0:eE.total_available_doctor))>0,eT=b&&(eS||e_),eP=(null===(M=null==H?void 0:H.author)||void 0===M?void 0:M.type)==="chatbot";return r.createElement(m.I_,{defaultParams:{_joinCommunityIds:[null===(j=null==u?void 0:u.community)||void 0===j?void 0:j.id],_joinTopicIds:null===(z=null==u?void 0:u.topics)||void 0===z?void 0:z.map(e=>e.id)}},r.createElement(eo,{className:e,style:t,"data-is-reply":!!s,"data-is-marrybaby":U,"data-has-booking":eT},"reply"===a&&r.createElement($.D,{className:"top-divider",type:"solid"}),r.createElement("div",{style:{padding:"16px 16px 0"}},r.createElement(k.C,Object.assign({avatar:ew,name:eb,username:ef,timeText:null==u?void 0:u.createdTime,community:null==u?void 0:u.community,className:`post-author ${ex?"with-popover":""}`,type:a,userId:null==ee?void 0:ee.id,role:ey,expertId:null==ee?void 0:ee.partnerId,title:null==ee?void 0:ee.title,doctorId:null==ee?void 0:ee.doctorId,hospitalId:null==ee?void 0:ee.hospitalId,hasQuickBooking:eT,handleMakeAppointment:f,isAnonymous:(null==H?void 0:H.isAnonymous)||!!(null==u?void 0:u.isAnonymous)&&(null===(R=null==u?void 0:u.author)||void 0===R?void 0:R.username)===(null==ee?void 0:ee.username),hideBackground:eP,userType:null==ee?void 0:ee.type},I)),!!(null==H?void 0:H.isVerify)&&!(null==H?void 0:H.isOppose)&&r.createElement(VerifiedTag,{title:null===(L=null==H?void 0:H.userVerify)||void 0===L?void 0:L.title,name:null===(B=null==H?void 0:H.userVerify)||void 0===B?void 0:B.name,userId:null===(D=null==H?void 0:H.userVerify)||void 0===D?void 0:D.id,role:null===(A=null==H?void 0:H.userVerify)||void 0===A?void 0:A.role,avatar:null===(F=null==H?void 0:H.userVerify)||void 0===F?void 0:F.avatar,className:"verify-tag"})),r.createElement(E.P,{className:"post-content-wrapper",replyingTo:es,mentionedUser:ei,description:el,mentions:ek,maxChars:S,disableShortenContent:_}),r.createElement("span",null),r.createElement("span",null),J&&J.length>0?r.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},r.createElement(C.a,{images:J,authorName:null==ee?void 0:ee.username})):null,(!J||0===J.length)&&er?r.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},r.createElement(y.C,{url:er})):null,"most-engaging"!==a?r.createElement(r.Fragment,null,eP&&r.createElement(en,{listUrl:null==H?void 0:H.source,categorySlug:null==H?void 0:H.categorySlug}),r.createElement(g.C,{type:g.c.reply,loveCount:q,replyCount:ev,className:"post-reaction",liked:et,isReplied:eu,hideCommentIcon:"reply"===a||eP,hasShare:!1,onCommentClick:()=>ed(()=>eh(e=>!e)),onCommentCountClick:()=>ed(()=>{eh(!0)}),onLikeClick:()=>ed(()=>(0,n.a)(void 0,void 0,void 0,function*(){if(Q){let e=yield(0,c.l)({commentId:Q,setLike:!et,locale:V});1===e.status&&Y(e=>Object.assign(Object.assign({},e),{liked:!et,countLikes:e.countLikes+(et?-1:1)}))}}))}),em&&r.createElement(c.I,{replyingId:d||H.id,replyToName:eb,isReply:!0,onClose:()=>eh(!1),onPostSuccess:e=>{"reply"===a?p&&p(e):addNewReply(e)},post:u,replyingUser:ee}),"comment"===a&&X&&X.length>0?r.createElement("div",{className:"comment-reply-wrapper"},null===(Z=null==eg?void 0:eg.slice(0,ec))||void 0===Z?void 0:Z.map(e=>r.createElement(CardReply,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:s+1,replyingId:Q,onPostCommentSuccess:addNewReply,post:u,onDeleteComment:()=>{Y(t=>Object.assign(Object.assign({},t),{replies:t.replies.filter(t=>t.id!==e.id),countReplies:t.countReplies-1}))},handleMakeAppointment:f,hasQuickBookingEnable:b})),ev>ec&&r.createElement(r.Fragment,null,r.createElement($.D,{className:"top-divider",type:"solid"}),r.createElement(i.B,{className:"more-cmt",size:"lg",color:"ghost",onClick:()=>ep(e=>e+4)},G("comment.seeMoreReplies",{count:ev-ec}),r.createElement("img",{className:"chevron-right",src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%232D87F3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 12 4-4-4-4'/%3e%3c/svg%3e",loading:"lazy"})))):null):null,ex&&r.createElement(CardReplyPopover,{onDeleteComment:v,className:"popover",commentId:H.id})))},getMostEngagingComment=(e,t)=>(0,n.a)(void 0,void 0,void 0,function*(){var o,n,r;let i=yield(0,h.t)((0,h.e)(w.yy.COMMENT.LIST,{postId:e,_locale:t,sort:"popularity",perPage:1,withoutReply:1}),"GET");return null===(r=null===(n=null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.comments)||void 0===n?void 0:n.map(f.e))||void 0===r?void 0:r[0]}),CardPost=({className:e,style:t,hideViewMoreComment:o,showMostEngaging:s,onCommentClick:p,onCommentCountClick:v,onMostEngagingCommentClick:x,onPostCommentSuccess:b,disableCardLink:f,disableShortenContent:$,onDeletePost:S,onEditPost:_,post:T,mostEngagingComment:P,onDeleteComment:N,showInputComment:M,InlineCommentsComponent:j,hasQuickBookingEnable:z,handleMakeAppointment:R,onSaveUnsaveSuccess:L,cardAuthorProps:O,verticalReactions:B=!1})=>{let[D,A]=(0,r.useState)(T),[V,W]=(0,r.useState)(!1),[U,G]=(0,r.useState)(P),{community:H,topics:Y,author:Q,slug:q,isPin:K,liked:X,photos:J,mentions:ee,title:et,description:eo,previewUrl:en,likesCount:er,commentsCount:ei,id:ea,commented:el}=D,{data:{locale:es,togetherUserId:ed,userInfo:ec,env:{isMarryBaby:ep,togetherBasePath:eu}},action:{pushNotifications:em}}=(0,r.useContext)(h.T),eh=!!(null==ec?void 0:ec.id),{t:eg}=(0,l.u)(),[ev,ex]=(0,r.useState)(M),eb=`${eu}/${(null==H?void 0:H.slug)||"_"}/${q||""}`,ef=`${(0,h.k)(es)}${eb}`,{authActionWrapper:ew}=(0,m.iV)((null==H?void 0:H.slug)?{_joinCommunityIds:[H.id],_joinTopicIds:null==Y?void 0:Y.map(e=>e.id)}:void 0),[ey,ek]=(0,r.useState)(!1);(0,r.useEffect)(()=>{ex(M)},[M]);let eE=(null==Q?void 0:Q.name)||(null==Q?void 0:Q.username)||"",eC=(null==Q?void 0:Q.username)||(null==Q?void 0:Q.name)||"",eI=null==Q?void 0:Q.avatar,e$=(null==D?void 0:D.isAnonymous)?void 0:null==Q?void 0:Q.role,[eS,e_]=(0,r.useState)(null),[eT,eP]=(0,r.useState)(null);(0,r.useEffect)(()=>{var e,t;(null==Q?void 0:Q.hospitalId)&&(e=Q.hospitalId,(0,n.a)(void 0,void 0,void 0,function*(){var t;let o=yield(0,h.c)((0,h.g)(w.tC.GET_HOSPITAL_INFO,{hospital_branch_id:e,website_url:h.l[es]}),"get");(null===(t=null==o?void 0:o._data)||void 0===t?void 0:t.branch)&&e_(null==o?void 0:o._data.branch)})),(null==Q?void 0:Q.doctorId)&&(t=Q.doctorId,(0,n.a)(void 0,void 0,void 0,function*(){var e;let o=yield(0,h.c)((0,h.g)(w.tC.GET_DOCTOR_INFO,{doctorId:t,website_url:h.l[es]}),"get");(null===(e=null==o?void 0:o._data)||void 0===e?void 0:e.doctor)&&eP(null==o?void 0:o._data.doctor)}))},[Q.hospitalId,Q.doctorId]);let eN=(null==eT?void 0:eT.valid_outpatient)||(null==eT?void 0:eT.valid_telemedicine),eM=((null==eS?void 0:eS.total_available_service)||(null==eS?void 0:eS.total_available_doctor))>0;(0,r.useEffect)(()=>{(0,n.a)(void 0,void 0,void 0,function*(){if(ea&&ei&&s&&!(null==P?void 0:P.id)){let e=yield getMostEngagingComment(ea,es);G(e)}})},[ea,es,ei,s,null==P?void 0:P.id]),(0,r.useEffect)(()=>{G(P)},[null==P?void 0:P.id]);let onDeleteComment=e=>(0,n.a)(void 0,void 0,void 0,function*(){if(ei>1&&(null==U?void 0:U.id)&&(null==U?void 0:U.id)===(null==e?void 0:e.id)){let e=yield getMostEngagingComment(ea,es);G(e)}A(e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount-1})),N&&N(e)});return r.createElement(m.I_,{defaultParams:(null==H?void 0:H.slug)?{_joinCommunityIds:[H.id],_joinTopicIds:null==Y?void 0:Y.map(e=>e.id)}:void 0},V&&r.createElement(c.S,{url:ef,avatar:u.D,text:et,onClose:()=>W(!1)}),r.createElement(F,{className:e,style:t,"data-is-marrybaby":ep},K?r.createElement(g.a,{className:"post-pin"}):null,r.createElement("div",{style:{position:"relative",padding:"1rem 1rem 0"}},r.createElement(k.C,Object.assign({avatar:eI,name:eE,username:eC,url:f?void 0:eb,community:H,timeText:null==D?void 0:D.createdTime,className:"post-author",role:e$,userId:null==Q?void 0:Q.id,expertId:null==Q?void 0:Q.partnerId,doctorId:null==Q?void 0:Q.doctorId,hospitalId:null==Q?void 0:Q.hospitalId,title:null==Q?void 0:Q.title,hasQuickBooking:z&&(eN||eM),handleMakeAppointment:R,"data-testid":"name",isAnonymous:!!(null==D?void 0:D.isAnonymous),extendEle:r.createElement(CardPostPopoverMore,{authorEmail:String(null==Q?void 0:Q.email),onDeletePost:S,shareUrl:ef,post:D,className:"popover",onEditPost:_})},O))),r.createElement("a",{href:f?void 0:eb,className:"post-content-link-wrapper"},et&&r.createElement(a.H,{className:"post-content-title",as:"h2",tag:"h5",fontWeight:"bold","data-testid":"Title of the Post"},d()(et)),r.createElement(E.P,{className:"post-content-wrapper",description:eo,disableShortenContent:$,mentions:ee,"data-testid":"Content of the Post"})),r.createElement("span",null),r.createElement("span",null),r.createElement("div",{key:"tag-topic"},Y&&Y.length>0?r.createElement(g.T,{topics:Y,className:"post-topics"}):null),r.createElement("div",{key:"social-preview"},(null==D?void 0:D.introUrl)?r.createElement("div",{className:`social-preview-wrapper ${(null==J?void 0:J.length)?"has-image":""}`},r.createElement(I.S,{url:D.introUrl,image:D.bannerImage})):null),r.createElement("div",{key:"image-preview"},(null==J?void 0:J.length)?r.createElement("div",{className:"image-preview-wrapper"},r.createElement(C.a,{images:J,authorName:null==Q?void 0:Q.name,isSensitive:!!(null==D?void 0:D.isSensitive)})):null),r.createElement("div",{key:"link-preview"},(null==D?void 0:D.introUrl)||(null==J?void 0:J.length)||null==en||!en.url?null:r.createElement("div",{className:"link-preview-wrapper"},r.createElement(y.C,{title:en.title,url:en.url,image:en.image}))),r.createElement(g.C,{isMarryBaby:ep,type:g.c.post,loveCount:er,replyCount:ei,className:`post-reaction ${(null==J?void 0:J.length)||(null==en?void 0:en.url)?"hide-top-border":""}`,liked:ey?!X:X,isReplied:el,isSaved:(null==D?void 0:D.bookmarked)||!1,onCommentClick:()=>ew(()=>{p?p():ex(e=>!e)}),onCommentCountClick:()=>{ew(()=>{ep?ex(!0):v?v():f||(window.location.href=eb)})},onShareClick:()=>{W(!0)},onLikeClick:()=>(0,n.a)(void 0,void 0,void 0,function*(){ew(()=>(0,n.a)(void 0,void 0,void 0,function*(){if(ea&&!ey){ek(!0);try{let e=yield(0,c.m)({id:ea,locale:es});(null==e?void 0:e.status)!==1?em((0,c.g)(eg)):A(e=>Object.assign(Object.assign({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked}))}catch(e){em((0,c.g)(eg))}ek(!1)}}))}),onSaveClick:()=>{ew(()=>(0,n.a)(void 0,void 0,void 0,function*(){if((null==ec?void 0:ec.id)&&(null==D?void 0:D.id)){if(null==D?void 0:D.bookmarked){let e=yield(0,h.b)((0,h.e)(w.yy.BOOKMARK.DELETE,{_locale:es}),"DELETE",{headers:{"Content-Type":"application/json"},data:{post_id:String(D.id)}});(null==e?void 0:e.status)===1?(em({title:"",message:eg("post.remove.success"),type:"success",displayIcon:Z}),null==L||L()):em({title:"",message:eg("post.remove.failed"),type:"danger",displayIcon:Z})}else{let e=yield(0,h.b)((0,h.e)(w.yy.BOOKMARK.CREATE,{_locale:es}),"POST",{headers:{"Content-Type":"application/json"},data:{user_id:ed||ec.id,post_id:D.id}});(null==e?void 0:e.status)===1?(em({title:"",message:eg("post.save.success"),type:"success",displayIcon:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23595959'%3e%3cpath stroke='%23595959' stroke-linecap='round' stroke-linejoin='round' d='M12 13.333 8 10.37l-4 2.963V3.852c0-.314.12-.616.335-.838.214-.222.505-.347.808-.347h5.714c.303 0 .594.125.808.347s.335.524.335.838z'/%3e%3c/svg%3e"}),null==L||L()):em({title:"",message:eg("post.save.failed"),type:"danger",displayIcon:Z})}}}))},onGoToUrl:e=>{let t=e?`${ef}${e}`:ef;eh?window.location.href=t:ew(()=>window.location.href=t)},showingMostEngaging:!!(s&&(null==U?void 0:U.id)),isVertical:B}),ev&&r.createElement(c.I,{isMainCmt:!M,onClose:()=>ex(!1),onPostSuccess:e=>{0!==ei||(null==U?void 0:U.id)||G(e),A(e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount+1,commented:!0})),b&&b(e)},post:D}),s&&(null==U?void 0:U.id)?r.createElement("div",{className:"most-engaging-wrapper",onClick:e=>{x?(e.stopPropagation(),x()):window.location.href=eb}},r.createElement(CardReply,{hasQuickBookingEnable:z,handleMakeAppointment:R,comment:U,post:D,onDeleteComment:()=>{onDeleteComment&&onDeleteComment(U)},className:"most-engaging-comment",type:"most-engaging",key:U.id,cardAuthorProps:O}),ei>1&&!o&&r.createElement(i.B,{className:"see-more-comments",color:"ghost",size:"md"},eg("comment.seeMoreComments",{count:ei-1}))):null,j))}}}]);