"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2405],{YSTG: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 a=o("SwpR"),n=o("q1tI"),l=o("N0hu"),i=o("nq2p"),r=o("5DIC"),d=o("ns0B"),s=o.n(d),c=o("hmmJ"),p=o("Ejk3"),u=o("KUTG"),m=o("aZjv"),v=o("gLxU"),g=o("WvS7"),h=o("rBCA"),b=o("eePC"),y=o("iBNF"),w=o("Yhj9"),f=o("IQVP"),E=o("z6dh"),x=o("4mvA"),C=o("k9Fv"),k=o("UFl3"),I=o("i1bX"),S=o("G8oo"),_=o("oTwY"),P=o("iZ8j"),T=o("e0pn"),j=o("LWwf"),R=o("PbOM"),N=o("bpvy"),M=o("EBmB"),D=o("2YCo"),O=o("nzWZ"),L=o("0coF"),B=o("xrdX"),A="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",z="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",$="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:l,className:i="",popoverClassName:d="",onEditPost:s})=>{let{data:{locale:h,userInfo:b,env:{isMarryBaby:y}}}=(0,n.useContext)(v.T),{t:w}=(0,r.u)(),[f,E]=(0,n.useState)(!1),[x,C]=(0,n.useState)(!1),[k,I]=(0,n.useState)(!1),{authActionWrapper:S}=(0,m.iV)(),_=e&&(null==b?void 0:b.email)&&e===String(null==b?void 0:b.email);return n.createElement("div",{className:i,onClick:e=>{e.preventDefault(),e.stopPropagation()}},k&&n.createElement(c.S,{url:o,text:null==l?void 0:l.title,onClose:()=>I(!1)}),x&&n.createElement(c.P,{thumbnail:p.C.getAssetPath("trash-bin.svg"),isThumbnailIcon:!0,title:w("popup.deletePost.title"),description:w("popup.deletePost.description"),acceptText:w("popup.deletePost.accept"),cancelText:w("popup.deletePost.cancel"),onAccept:()=>(0,a.a)(void 0,void 0,void 0,function*(){if((null==l?void 0:l.id)&&!f){E(!0);try{let e=yield(0,c.h)({id:l.id,locale:h});(null==e?void 0:e.status)===1&&(null==t||t())}catch(e){}E(!1)}}),onClose:()=>C(!1)}),n.createElement(g.b,{className:d,toggleButtonContent:n.createElement("img",{src:y?A:z,loading:"lazy"}),position:"bottom",align:"end",buttonProps:{isLoading:f},data:_?{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:w("actionPopover.edit"),onClick:s},{icon:$,label:w("actionPopover.delete"),onClick:()=>{S(()=>C(!0))}}]}:{isShowheader:!1,type:"list",list:[{icon:c.i,label:w("morePopover.report"),subTree:{title:w("morePopover.report.title"),description:w("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:w(e.label),subTree:{title:w("morePopover.reportSubmit.title"),description:w("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:t=>n.createElement(c.b,{reason:e.reasonValue,reasonText:w(e.reason),postId:null==l?void 0:l.id,onClose:()=>t&&t(!1)})}}))}}]}}))},H=h.Z.div` position: relative; margin-bottom: 24px; background: white; border-radius: ${y.r.borderRadius}; a { text-decoration: none; } ${b.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: ${y.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; ${b.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; ${b.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; ${b.M.mbDown} { width: 18px; height: 18px; } } .popover-menu__content { &.--position-bottom { &.--align-end { &::before { right: 1rem; } width: 350px; ${b.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%); } } ${b.M.mbDown} { margin-bottom: 12px; } } `;var V="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:l=""})=>{let{data:{env:{isMarryBaby:i},locale:d},action:{pushNotifications:s}}=(0,n.useContext)(v.T),{t:p}=(0,r.u)(),[u,h]=(0,n.useState)(!1),{authActionWrapper:b}=(0,m.iV)();return n.createElement("div",{className:o,onClick:e=>{e.preventDefault(),e.stopPropagation()}},u&&n.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,a.a)(void 0,void 0,void 0,function*(){var o;if(!t)return;let a=yield(0,c.j)({id:t,locale:d});(null==a?void 0:a.status)===1?(e&&e(),s({title:"",message:p("notification.success"),type:"success"})):s({title:"",message:(null===(o=null==a?void 0:a.messages)||void 0===o?void 0:o[0])||p("notification.failure"),type:"danger"})}),onClose:()=>h(!1)}),n.createElement(g.b,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:$,label:p("actionPopover.delete"),onClick:()=>{b(()=>{h(!0)})}}]},className:l,toggleButtonContent:n.createElement("img",{src:i?A:z,loading:"lazy"}),buttonProps:{}}))},Z=h.Z.div` .add-link { color: ${y.r.colors.primaryBase}; } `,F=h.Z.div` margin: 16px 0; background: ${y.r.colors.yellow50}; padding: 5px 10px; border-radius: 2px; .icon { display: inline-block; vertical-align: middle; margin-right: 6px; } `,G=h.Z.div` display: flex; align-items: center; gap: 8px; `,U=h.Z.div` padding: 8px 16px; `,Y=h.Z.div` margin-bottom: 12px; width: 100%; `,W=h.Z.div``,Q=h.Z.div` margin-bottom: 16px; `,q=h.Z.div` display: flex; flex-wrap: wrap; row-gap: 16px; ${b.M.tdUp} { align-items: center; column-gap: 24px; } `,K=h.Z.a` display: flex; align-items: center; gap: 16px; ${b.M.mbDown} { width: 100%; justify-content: space-between; } `,X=h.Z.div` display: flex; align-items: center; gap: 16px; `,J=h.Z.div` border-radius: ${y.r.borderRadius}; overflow: hidden; width: 48px; height: 48px; img { object-fit: cover; width: 100%; height: 100%; } `,RecommentCategories=({categories:e})=>{let{t}=(0,r.u)(),{data:{locale:o,env:{isMarryBaby:a}}}=(0,n.useContext)(v.T),l=(0,L.g)(o,a);return n.createElement(W,null,n.createElement(Q,null,n.createElement(i.H,{tag:"h6",as:"h5"},t("cardReply.recommentCategories.heading"))),n.createElement(q,null,e.map(e=>n.createElement(K,{href:l+e.permalink,key:String(e.termId),target:"_blank"},n.createElement(X,null,n.createElement(J,null,n.createElement("img",{src:e.featureImage||p.C.getAssetPath(a?"mb-logo.svg":"/logo/logomark.png"),alt:e.displayName,loading:"lazy"})),n.createElement(D.T,{size:"s3",weight:"bold"},e.displayName)),n.createElement(P.Z,{size:20,color:y.r.colors.gray400})))))},ee=h.Z.a` padding: 12px 0; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid ${y.r.colors.neutral100}; text-decoration: none; &:first-child { border-top: 0; } `,SourceItem=({postTitle:e,articleReviewed:t,modifiedTime:o,href:a})=>{let{t:l}=(0,r.u)(),i=(()=>{let{expert:e,editor:o,is_author:a}=t;if(e){let t={name:e.display_name,role:"expert",avatar:e.avatar};return a?Object.assign({title:l("articleAuthor.title.written-by")},t):"expert"===e.role?Object.assign({title:l("articleAuthor.title.expert")},t):Object.assign({title:l("articleAuthor.title.medical")},t)}if(o)return{title:l("articleAuthor.title.fact-check"),name:o.display_name,avatar:o.avatar}})();return n.createElement(ee,{href:a,title:e,target:"_blank"},n.createElement(D.T,{size:"s3",as:"h5",weight:"bold"},e),n.createElement("div",null,n.createElement(x.C,{avatar:null==i?void 0:i.avatar,avatarProps:{size:32},name:null==i?void 0:i.name,role:null==i?void 0:i.role,hideBackground:!0},n.createElement(x.C.SubTextRow,null,n.createElement(x.C.SubText,null,null==i?void 0:i.title," ",n.createElement("span",{style:{color:y.r.colors.gray800}},null==i?void 0:i.name)),n.createElement(x.C.SubDivider,null),n.createElement(x.C.SubText,null,o)))))};var et={header:"F4mmgSy",chevron:"A7QrQ7A"};let SourceList=e=>{var{listUrl:t,hideSourceList:o,categorySlug:d,editMode:s,collapseSource:c,onListChange:u,isMarryBaby:m}=e,g=(0,a._)(e,["listUrl","hideSourceList","categorySlug","editMode","collapseSource","onListChange","isMarryBaby"]);let{t:h}=(0,r.u)(),[b,E]=(0,n.useState)(t||[]),[x,C]=(0,n.useState)([]),[k,I]=(0,n.useState)([]),[S,P]=(0,n.useState)(!1);(0,n.useEffect)(()=>{o||(0,a.a)(void 0,void 0,void 0,function*(){P(!0);let e=b.map(e=>{let t=new URL(e),o=String(t.pathname).split("/").filter(e=>""!=e),a=t.origin,n=-1!==a.search("marrybaby.vn");return{isMarrySite:n,path:o[o.length-1],href:e}}),t=[...e.map(e=>(0,v.c)(e.isMarrySite?(0,v.s)(f.D9.GET_PREVIEW_ARTICLE,{fullSlug:e.path},!0):(0,v.g)(f.D9.GET_PREVIEW_ARTICLE,{fullSlug:e.path},!0),"GET"))],o=yield Promise.all(t);C(o.map((t,o)=>{var a,n;return(null===(a=null==t?void 0:t.data)||void 0===a?void 0:a.post)&&Object.assign(Object.assign({},(0,w.b)(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.post)),{href:e[o].href})}).filter(Boolean)),P(!1)})},[]),(0,n.useEffect)(()=>{!o&&(null==x?void 0:x.length)===0&&d&&(0,a.a)(void 0,void 0,void 0,function*(){var e;let t=yield(0,v.c)(m?(0,v.s)(f.D9.GET_CATEGORY_OR_ARTICLE_DETAIL,{fullSlug:d},!0):(0,v.g)(f.D9.GET_CATEGORY_OR_ARTICLE_DETAIL,{fullSlug:d},!0),"GET");(null==t?void 0:t.data)&&I([(0,w.h)(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.category)])})},[x]);let handleRemoveItem=e=>{E(t=>{let o=[...t];return o.splice(e,1),o}),C(t=>{let o=[...t];return o.splice(e,1),o})};return(0,n.useEffect)(()=>{null==u||u(b)},[b]),n.createElement("div",Object.assign({},g),!s&&n.createElement(F,null,n.createElement("img",{className:"icon",src:p.C.getAssetPath("warning.svg"),alt:"warning",style:{marginBottom:"3px",width:"18px"},loading:"lazy"}),n.createElement(D.T,{size:"s3",as:"span",dangerouslySetInnerHTML:{__html:h("cardReply.disclaimer")}})),o?null:S?n.createElement(O.L,null):x.length>0||s?n.createElement(Z,null,n.createElement(N.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 ${y.r.colors.neutral100}`},item:{marginBottom:"16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",border:`1px solid ${y.r.colors.neutral100}`,borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px","&[data-active]":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}},chevron:n.createElement("div",{className:et.chevron},n.createElement(T.Z,{color:y.r.colors.gray600,size:20}))},n.createElement(N.U.Item,{value:"accordion"},n.createElement(N.U.Control,null,n.createElement("div",{className:et.header},n.createElement(i.H,{as:"h4",tag:"h6"},h("cardReply.source")))),n.createElement(N.U.Panel,null,n.createElement(U,null,(x||[]).map((e,t)=>n.createElement(G,{key:String(t)},"object"==typeof e?n.createElement(SourceItem,Object.assign({},e)):n.createElement(Y,null,n.createElement(M.I,{style:{width:"100%"},name:"source-list",value:e||"",size:"sm",onChange:e=>{E(o=>{let a=[...o];return a[t]=e,a}),C(o=>{let a=[...o];return a[t]=e,a})}})),s&&n.createElement(l.B,{size:"md",color:"transparent",icon:n.createElement(j.Z,null),onClick:()=>handleRemoveItem(t)}))),s&&n.createElement(l.B,{className:"add-link",color:"transparent",size:"md",icon:n.createElement(_.Z,{color:y.r.colors.primaryBase,size:18}),onClick:()=>{E(e=>[...e,""]),C(e=>[...e,""])}},"Add source")))))):n.createElement(RecommentCategories,{categories:k}))},eo=h.Z.div` position: relative; margin-bottom: 0; background: white; border-radius: ${y.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; ${b.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: ${y.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; ${b.M.mbDown} { margin-left: 40px; } > .post-author { margin-left: -56px; ${b.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; ${b.M.mbDown} { width: 24px; height: 24px; font-size: 12px; } } } &[data-is-reply] { > .post-author { .author-avatar-wrapper { width: 40px; height: 40px; font-size: 20px; ${b.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; ${b.M.mbDown} { padding-left: 0.5rem; } } ${b.M.mbDown} { margin-bottom: 12px; } } `,ea=(0,h.Z)(SourceList)` margin-top: 12px; padding: 0.5rem 1rem 1rem; `,VerifiedTag=({userId:e,avatar:t,name:o,role:a,title:i,className:d})=>{let{t:s}=(0,r.u)(),[c,p]=(0,n.useState)(!1);return n.createElement(n.Fragment,null,n.createElement(l.B,{className:`-dzIuHr ${d}`,color:"success",size:"xs",onClick:()=>p(!0),style:{padding:"5px 8px",marginBottom:"12px",borderRadius:"4px"}},n.createElement("span",{className:"text"},n.createElement(R.Z,{isSolid:!0,size:18,color:y.r.colors.green800,className:"icon"}),s("cardReply.verifyBy",{name:`${o||""}`}))),n.createElement(x.c,{open:c,onClose:()=>p(!1),profileModalProps:{zIndex:1e3}},n.createElement(C.a,{authorProps:{userId:e,avatar:t,name:o,role:a,title:i},hideQuestionTab:!0})))},CardReply=({className:e,style:t,comment:o,type:i="comment",level:d=0,replyingId:s,onPostCommentSuccess:p,post:u,onDeleteComment:h,refetchComment:b,hasQuickBookingEnable:y,handleMakeAppointment:w,cardAuthorProps:I,maxChars:_=600,disableShortenContent:P})=>{var T,j,R,N,M,D,O,L,A,z,$,H,V;let{data:{locale:Z,userInfo:F,env:{isMarryBaby:G}}}=(0,n.useContext)(v.T),{t:U}=(0,r.u)(),[Y,W]=(0,n.useState)(o||null),{id:Q,countLikes:q,content:K,replies:X=[],images:J=[],author:ee,liked:et,link:en,mentionedUser:el,mentions:ei}=Y,{text:er,replyingTo:ed}=(0,c.k)(K),{authActionWrapper:es}=(0,m.iV)({_joinCommunityIds:[null===(T=null==u?void 0:u.community)||void 0===T?void 0:T.id],_joinTopicIds:null===(j=null==u?void 0:u.topics)||void 0===j?void 0:j.map(e=>e.id)}),[ec,ep]=(0,n.useState)(4),eu=null!=F&&!!F.id&&(null==X?void 0:X.some(e=>e.author.id===F.id)),addNewReply=e=>{W(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 b&&b(o),o}return t})},[em,ev]=(0,n.useState)(!1),eg=(0,n.useMemo)(()=>"comment"===i&&X&&0!=X.length?X.sort((e,t)=>{let o=new Date(e.createdAt).getTime(),a=new Date(t.createdAt).getTime();return o>a?-1:o{var e,t;(null==ee?void 0:ee.hospitalId)&&(e=ee.hospitalId,(0,a.a)(void 0,void 0,void 0,function*(){var t;let o=yield(0,v.c)((0,v.b)(f.tC.GET_HOSPITAL_INFO,{hospital_branch_id:e,website_url:B.v[Z]}),"get");(null===(t=null==o?void 0:o._data)||void 0===t?void 0:t.branch)&&ek(null==o?void 0:o._data.branch)})),(null==ee?void 0:ee.doctorId)&&(t=ee.doctorId,(0,a.a)(void 0,void 0,void 0,function*(){var e;let o=yield(0,v.c)((0,v.b)(f.tC.GET_DOCTOR_INFO,{doctorId:t,website_url:B.v[Z]}),"get");(null===(e=null==o?void 0:o._data)||void 0===e?void 0:e.doctor)&&eS(null==o?void 0:o._data.doctor)}))},[ee.hospitalId,ee.doctorId]);let e_=(null==eI?void 0:eI.valid_outpatient)||(null==eI?void 0:eI.valid_telemedicine),eP=((null==eC?void 0:eC.total_available_service)||(null==eC?void 0:eC.total_available_doctor))>0,eT=y&&(e_||eP),ej=(null===(N=null==Y?void 0:Y.author)||void 0===N?void 0:N.type)==="chatbot";return n.createElement(m.I_,{defaultParams:{_joinCommunityIds:[null===(M=null==u?void 0:u.community)||void 0===M?void 0:M.id],_joinTopicIds:null===(D=null==u?void 0:u.topics)||void 0===D?void 0:D.map(e=>e.id)}},n.createElement(eo,{className:e,style:t,"data-is-reply":!!d,"data-is-marrybaby":G,"data-has-booking":eT},"reply"===i&&n.createElement(S.D,{className:"top-divider",type:"solid"}),n.createElement("div",{style:{padding:"16px 16px 0"}},n.createElement(x.C,Object.assign({avatar:ef,name:ey,username:ew,timeText:null==u?void 0:u.createdTime,community:null==u?void 0:u.community,className:`post-author ${eb?"with-popover":""}`,type:i,userId:null==ee?void 0:ee.id,role:eE,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:w,isAnonymous:(null==Y?void 0:Y.isAnonymous)||!!(null==u?void 0:u.isAnonymous)&&(null===(O=null==u?void 0:u.author)||void 0===O?void 0:O.username)===(null==ee?void 0:ee.username),hideBackground:ej,userType:null==ee?void 0:ee.type},I)),!!(null==Y?void 0:Y.isVerify)&&!(null==Y?void 0:Y.isOppose)&&n.createElement(VerifiedTag,{title:null===(L=null==Y?void 0:Y.userVerify)||void 0===L?void 0:L.title,name:null===(A=null==Y?void 0:Y.userVerify)||void 0===A?void 0:A.name,userId:null===(z=null==Y?void 0:Y.userVerify)||void 0===z?void 0:z.id,role:null===($=null==Y?void 0:Y.userVerify)||void 0===$?void 0:$.role,avatar:null===(H=null==Y?void 0:Y.userVerify)||void 0===H?void 0:H.avatar,className:"verify-tag"})),n.createElement(C.P,{className:"post-content-wrapper",replyingTo:ed,mentionedUser:el,description:er,mentions:ex,maxChars:_,disableShortenContent:P}),n.createElement("span",null),n.createElement("span",null),J&&J.length>0?n.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},n.createElement(k.a,{images:J,authorName:null==ee?void 0:ee.username})):null,(!J||0===J.length)&&en?n.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},n.createElement(E.C,{url:en})):null,"most-engaging"!==i?n.createElement(n.Fragment,null,ej&&n.createElement(ea,{listUrl:null==Y?void 0:Y.source,categorySlug:null==Y?void 0:Y.categorySlug}),n.createElement(g.C,{type:g.c.reply,loveCount:q,replyCount:eh,className:"post-reaction",liked:et,isReplied:eu,hideCommentIcon:"reply"===i||ej,hasShare:!1,onCommentClick:()=>es(()=>ev(e=>!e)),onCommentCountClick:()=>es(()=>{ev(!0)}),onLikeClick:()=>es(()=>(0,a.a)(void 0,void 0,void 0,function*(){if(Q){let e=yield(0,c.l)({commentId:Q,setLike:!et,locale:Z});1===e.status&&W(e=>Object.assign(Object.assign({},e),{liked:!et,countLikes:e.countLikes+(et?-1:1)}))}}))}),em&&n.createElement(c.I,{replyingId:s||Y.id,replyToName:ey,isReply:!0,onClose:()=>ev(!1),onPostSuccess:e=>{"reply"===i?p&&p(e):addNewReply(e)},post:u,replyingUser:ee}),"comment"===i&&X&&X.length>0?n.createElement("div",{className:"comment-reply-wrapper"},null===(V=null==eg?void 0:eg.slice(0,ec))||void 0===V?void 0:V.map(e=>n.createElement(CardReply,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:d+1,replyingId:Q,onPostCommentSuccess:addNewReply,post:u,onDeleteComment:()=>{W(t=>Object.assign(Object.assign({},t),{replies:t.replies.filter(t=>t.id!==e.id),countReplies:t.countReplies-1}))},handleMakeAppointment:w,hasQuickBookingEnable:y})),eh>ec&&n.createElement(n.Fragment,null,n.createElement(S.D,{className:"top-divider",type:"solid"}),n.createElement(l.B,{className:"more-cmt",size:"lg",color:"ghost",onClick:()=>ep(e=>e+4)},U("comment.seeMoreReplies",{count:eh-ec}),n.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,eb&&n.createElement(CardReplyPopover,{onDeleteComment:h,className:"popover",commentId:Y.id})))},getMostEngagingComment=(e,t)=>(0,a.a)(void 0,void 0,void 0,function*(){var o,a,n;let l=yield(0,v.t)((0,v.f)(f.yy.COMMENT.LIST,{postId:e,_locale:t,sort:"popularity",perPage:1,withoutReply:1}),"GET");return null===(n=null===(a=null===(o=null==l?void 0:l.data)||void 0===o?void 0:o.comments)||void 0===a?void 0:a.map(w.g))||void 0===n?void 0:n[0]}),CardPost=({className:e,style:t,hideViewMoreComment:o,showMostEngaging:d,onCommentClick:p,onCommentCountClick:h,onMostEngagingCommentClick:b,onPostCommentSuccess:y,disableCardLink:w,disableShortenContent:S,onDeletePost:_,onEditPost:P,post:T,mostEngagingComment:j,onDeleteComment:R,showInputComment:N,InlineCommentsComponent:M,hasQuickBookingEnable:D,handleMakeAppointment:O,onSaveUnsaveSuccess:L,cardAuthorProps:B,verticalReactions:A=!1})=>{let[z,$]=(0,n.useState)(T),[Z,F]=(0,n.useState)(!1),[G,U]=(0,n.useState)(j),{community:Y,topics:W,author:Q,slug:q,isPin:K,liked:X,photos:J,mentions:ee,title:et,description:eo,previewUrl:ea,likesCount:en,commentsCount:el,id:ei,commented:er}=z,{data:{locale:ed,togetherUserId:es,userInfo:ec,env:{isMarryBaby:ep,togetherBasePath:eu}},action:{pushNotifications:em}}=(0,n.useContext)(v.T),ev=!!(null==ec?void 0:ec.id),{t:eg}=(0,r.u)(),[eh,eb]=(0,n.useState)(N),ey=`${eu}/${(null==Y?void 0:Y.slug)||"_"}/${q||""}`,ew=`${(0,v.l)(ed)}${ey}`,{authActionWrapper:ef}=(0,m.iV)((null==Y?void 0:Y.slug)?{_joinCommunityIds:[Y.id],_joinTopicIds:null==W?void 0:W.map(e=>e.id)}:void 0),[eE,ex]=(0,n.useState)(!1);(0,n.useEffect)(()=>{eb(N)},[N]);let eC=(null==Q?void 0:Q.name)||(null==Q?void 0:Q.username)||"",ek=(null==Q?void 0:Q.username)||(null==Q?void 0:Q.name)||"",eI=null==Q?void 0:Q.avatar,eS=(null==z?void 0:z.isAnonymous)?void 0:null==Q?void 0:Q.role,[e_,eP]=(0,n.useState)(null),[eT,ej]=(0,n.useState)(null);(0,n.useEffect)(()=>{var e,t;(null==Q?void 0:Q.hospitalId)&&(e=Q.hospitalId,(0,a.a)(void 0,void 0,void 0,function*(){var t;let o=yield(0,v.c)((0,v.b)(f.tC.GET_HOSPITAL_INFO,{hospital_branch_id:e,website_url:v.m[ed]}),"get");(null===(t=null==o?void 0:o._data)||void 0===t?void 0:t.branch)&&eP(null==o?void 0:o._data.branch)})),(null==Q?void 0:Q.doctorId)&&(t=Q.doctorId,(0,a.a)(void 0,void 0,void 0,function*(){var e;let o=yield(0,v.c)((0,v.b)(f.tC.GET_DOCTOR_INFO,{doctorId:t,website_url:v.m[ed]}),"get");(null===(e=null==o?void 0:o._data)||void 0===e?void 0:e.doctor)&&ej(null==o?void 0:o._data.doctor)}))},[Q.hospitalId,Q.doctorId]);let eR=(null==eT?void 0:eT.valid_outpatient)||(null==eT?void 0:eT.valid_telemedicine),eN=((null==e_?void 0:e_.total_available_service)||(null==e_?void 0:e_.total_available_doctor))>0;(0,n.useEffect)(()=>{(0,a.a)(void 0,void 0,void 0,function*(){if(ei&&el&&d&&!(null==j?void 0:j.id)){let e=yield getMostEngagingComment(ei,ed);U(e)}})},[ei,ed,el,d,null==j?void 0:j.id]),(0,n.useEffect)(()=>{U(j)},[null==j?void 0:j.id]);let onDeleteComment=e=>(0,a.a)(void 0,void 0,void 0,function*(){if(el>1&&(null==G?void 0:G.id)&&(null==G?void 0:G.id)===(null==e?void 0:e.id)){let e=yield getMostEngagingComment(ei,ed);U(e)}$(e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount-1})),R&&R(e)});return n.createElement(m.I_,{defaultParams:(null==Y?void 0:Y.slug)?{_joinCommunityIds:[Y.id],_joinTopicIds:null==W?void 0:W.map(e=>e.id)}:void 0},Z&&n.createElement(c.S,{url:ew,avatar:u.a,text:et,onClose:()=>F(!1)}),n.createElement(H,{className:e,style:t,"data-is-marrybaby":ep},K?n.createElement(g.a,{className:"post-pin"}):null,n.createElement("div",{style:{position:"relative",padding:"1rem 1rem 0"}},n.createElement(x.C,Object.assign({avatar:eI,name:eC,username:ek,url:w?void 0:ey,community:Y,timeText:null==z?void 0:z.createdTime,className:"post-author",role:eS,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:D&&(eR||eN),handleMakeAppointment:O,"data-testid":"name",isAnonymous:!!(null==z?void 0:z.isAnonymous),extendEle:n.createElement(CardPostPopoverMore,{authorEmail:String(null==Q?void 0:Q.email),onDeletePost:_,shareUrl:ew,post:z,className:"popover",onEditPost:P})},B))),n.createElement("a",{href:w?void 0:ey,className:"post-content-link-wrapper"},et&&n.createElement(i.H,{className:"post-content-title",as:"h2",tag:"h5",fontWeight:"bold","data-testid":"Title of the Post"},s()(et)),n.createElement(C.P,{className:"post-content-wrapper",description:eo,disableShortenContent:S,mentions:ee,"data-testid":"Content of the Post"})),n.createElement("span",null),n.createElement("span",null),n.createElement("div",{key:"tag-topic"},W&&W.length>0?n.createElement(g.T,{topics:W,className:"post-topics"}):null),n.createElement("div",{key:"social-preview"},(null==z?void 0:z.introUrl)?n.createElement("div",{className:`social-preview-wrapper ${(null==J?void 0:J.length)?"has-image":""}`},n.createElement(I.S,{url:z.introUrl,image:z.bannerImage})):null),n.createElement("div",{key:"image-preview"},(null==J?void 0:J.length)?n.createElement("div",{className:"image-preview-wrapper"},n.createElement(k.a,{images:J,authorName:null==Q?void 0:Q.name,isSensitive:!!(null==z?void 0:z.isSensitive)})):null),n.createElement("div",{key:"link-preview"},(null==z?void 0:z.introUrl)||(null==J?void 0:J.length)||null==ea||!ea.url?null:n.createElement("div",{className:"link-preview-wrapper"},n.createElement(E.C,{title:ea.title,url:ea.url,image:ea.image}))),n.createElement(g.C,{isMarryBaby:ep,type:g.c.post,loveCount:en,replyCount:el,className:`post-reaction ${(null==J?void 0:J.length)||(null==ea?void 0:ea.url)?"hide-top-border":""}`,liked:eE?!X:X,isReplied:er,isSaved:(null==z?void 0:z.bookmarked)||!1,onCommentClick:()=>ef(()=>{p?p():eb(e=>!e)}),onCommentCountClick:()=>{ef(()=>{ep?eb(!0):h?h():w||(window.location.href=ey)})},onShareClick:()=>{F(!0)},onLikeClick:()=>(0,a.a)(void 0,void 0,void 0,function*(){ef(()=>(0,a.a)(void 0,void 0,void 0,function*(){if(ei&&!eE){ex(!0);try{let e=yield(0,c.m)({id:ei,locale:ed});(null==e?void 0:e.status)!==1?em((0,c.g)(eg)):$(e=>Object.assign(Object.assign({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked}))}catch(e){em((0,c.g)(eg))}ex(!1)}}))}),onSaveClick:()=>{ef(()=>(0,a.a)(void 0,void 0,void 0,function*(){if((null==ec?void 0:ec.id)&&(null==z?void 0:z.id)){if(null==z?void 0:z.bookmarked){let e=yield(0,v.e)((0,v.f)(f.yy.BOOKMARK.DELETE,{_locale:ed}),"DELETE",{headers:{"Content-Type":"application/json"},data:{post_id:String(z.id)}});(null==e?void 0:e.status)===1?(em({title:"",message:eg("post.remove.success"),type:"success",displayIcon:V}),null==L||L()):em({title:"",message:eg("post.remove.failed"),type:"danger",displayIcon:V})}else{let e=yield(0,v.e)((0,v.f)(f.yy.BOOKMARK.CREATE,{_locale:ed}),"POST",{headers:{"Content-Type":"application/json"},data:{user_id:es||ec.id,post_id:z.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:V})}}}))},onGoToUrl:e=>{let t=e?`${ew}${e}`:ew;ev?window.location.href=t:ef(()=>window.location.href=t)},showingMostEngaging:!!(d&&(null==G?void 0:G.id)),isVertical:A}),eh&&n.createElement(c.I,{isMainCmt:!N,onClose:()=>eb(!1),onPostSuccess:e=>{0!==el||(null==G?void 0:G.id)||U(e),$(e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount+1,commented:!0})),y&&y(e)},post:z}),d&&(null==G?void 0:G.id)?n.createElement("div",{className:"most-engaging-wrapper",onClick:e=>{b?(e.stopPropagation(),b()):window.location.href=ey}},n.createElement(CardReply,{hasQuickBookingEnable:D,handleMakeAppointment:O,comment:G,post:z,onDeleteComment:()=>{onDeleteComment&&onDeleteComment(G)},className:"most-engaging-comment",type:"most-engaging",key:G.id,cardAuthorProps:B}),el>1&&!o&&n.createElement(l.B,{className:"see-more-comments",color:"ghost",size:"md"},eg("comment.seeMoreComments",{count:el-1}))):null,M))}},uzdn:function(e,t,o){o.d(t,{S:function(){return n}});var a=o("2wr/");let n=a.r},mLKA:function(e,t,o){o.d(t,{C:function(){return CartCareButton},S:function(){return ShoppingCartCare}});var a=o("q1tI"),n=o("xXM3"),l=o.n(n),i=o("rBCA"),r=o("Eso5"),d=o("eePC"),s=o("iBNF"),c=o("5DIC"),p=o("2YCo");let ShoppingCartCare=e=>a.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 20 20",fill:"none"},e),a.createElement("path",{d:"M1.94434 1.94434L3.44545 2.31989C3.88211 2.42878 4.20989 2.791 4.27545 3.23656L5.55656 11.9454",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{d:"M16.9444 14.7218H4.99997C4.23331 14.7218 3.61108 14.0996 3.61108 13.3329C3.61108 12.5662 4.23331 11.944 4.99997 11.944H14.4766C14.9544 11.944 15.38 11.6385 15.5311 11.184L17.0122 6.73957C17.2522 6.01957 16.7166 5.27734 15.9578 5.27734H4.57553",stroke:"currentColor",strokeWidth:1.2,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{d:"M4.16648 18.8891C4.93354 18.8891 5.55537 18.2673 5.55537 17.5002C5.55537 16.7332 4.93354 16.1113 4.16648 16.1113C3.39941 16.1113 2.77759 16.7332 2.77759 17.5002C2.77759 18.2673 3.39941 18.8891 4.16648 18.8891Z",fill:"currentColor"}),a.createElement("path",{d:"M15.8332 18.8891C16.6003 18.8891 17.2221 18.2673 17.2221 17.5002C17.2221 16.7332 16.6003 16.1113 15.8332 16.1113C15.0662 16.1113 14.4443 16.7332 14.4443 17.5002C14.4443 18.2673 15.0662 18.8891 15.8332 18.8891Z",fill:"currentColor"})),u=(0,i.Z)(r.x)` display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #ffffff33; position: relative; flex-shrink: 0; cursor: pointer; /* Desktop: Square layout */ border-radius: 28px; max-height: 40px; padding: 9px 1rem; background-color: inherit; white-space: nowrap; .cart-care-icon { width: 20px; height: 20px; color: ${s.r.colors.white}; flex-shrink: 0; } .cart-care-button-text { display: block; font-size: 14px; font-weight: 500; line-height: 22px; } /* Mobile: Circle layout */ ${d.M.mbDown} { border-radius: 100%; aspect-ratio: 1/1; width: 32px; height: 32px; padding: auto; background-color: ${s.r.colors.white}; max-height: none; padding: 0; .cart-care-icon { width: 20px; height: 20px; color: ${s.r.colors.blue900}; flex-shrink: 0; } .cart-care-button-text { display: none; } } `,m=(0,i.Z)(r.x)` min-width: 20px; min-height: 20px; aspect-ratio: 1/1; border-radius: 100%; background-color: ${s.r.colors.red500}; color: ${s.r.colors.white}; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: absolute; top: -4px; right: -4px; ${d.M.mbDown} { top: -8px; right: -8px; } `,CartCareButton=e=>{let{count:t=0,href:o,classes:n,boxProps:i,anchorProps:r,tracking:d}=e,{t:v}=(0,c.u)();return a.createElement("a",Object.assign({className:l()("cart-care-button"),href:o,"data-testid":"cart-care-button","data-event-category":"Hamburger Navigation","data-event-action":"Cart Click","data-event-label":o},d,r),a.createElement(u,Object.assign({className:l()("cart-care-button-box",null==n?void 0:n.box)},i),a.createElement(ShoppingCartCare,{className:"cart-care-icon"}),a.createElement(p.T,{size:"label1",color:s.r.colors.white,fw:500,className:"cart-care-button-text"},v("navigation.button.cartCareService")),t>0&&a.createElement(m,{className:l()("cart-care-button-count-box",null==n?void 0:n.count)},a.createElement(p.T,{size:t>99?"label2":"c1",color:s.r.colors.white,fw:600,className:"cart-care-button-count-text"},t>99?"99+":t))))}},izJV:function(e,t,o){o.d(t,{B:function(){return BabyVaccineForm}});var a,n,l=o("SwpR"),i=o("q1tI"),r=o("iuhU"),d=o("8vDj"),s=o("cChf"),c=o("ZFu2"),p=o("tmJ0"),u=o("2YCo"),m=o("5DIC"),v=o("FGWO"),g=o("NgKr"),h=o("AUQL"),b=o("Zge2");let y=(0,i.createContext)({}),DefaultLayout=e=>{var t=(0,l._)(e,[]);let{t:o}=(0,m.u)(),{currentUrl:a,submitProps:n,form:d}=(0,i.useContext)(y),{classes:s={}}=(0,i.useContext)(v.C);return i.createElement(g.H,Object.assign({formLayout:"default"},t),i.createElement(g.H.FormRow,null,i.createElement(h.G,Object.assign({isBaby:!0},d.getInputProps("gender")))),i.createElement(g.H.FormRow,null,i.createElement(p.D,Object.assign({label:i.createElement(u.T,{size:"p2",weight:"semiBold"},o("babyGrowth.input.birthday")),placeholder:"DD/MM/YYYY",popoverProps:{withinPortal:!0},maxDate:new Date},d.getInputProps("age")))),i.createElement(g.H.FormRow,{className:s.submitWrapper},i.createElement(g.H.Submit,Object.assign({type:"submit",className:(0,r.default)("due-date-calculate-button",s.submitBtn),dataEventCategory:"Health Tool",dataEventAction:"Vaccination Tool",dataEventLabel:a},n),o("dueDatePage.lastPeriod.calculate"))))},InlineLayout=e=>{var t=(0,l._)(e,[]);let{t:o}=(0,m.u)(),{currentUrl:a,submitProps:n,form:d}=(0,i.useContext)(y),{classes:s={}}=(0,i.useContext)(v.C);return i.createElement(g.H,Object.assign({formLayout:"inline"},t),i.createElement(g.H.FormRow,null,i.createElement(g.H.BorderInlineControl,{label:o("tools.selectBabyGender"),width:"none"},i.createElement(h.G,Object.assign({isBaby:!0,hideLabel:!0,type:"radio"},d.getInputProps("gender")))),d.errors.gender&&i.createElement(g.H.Error,null,d.errors.gender)),i.createElement(g.H.FormRow,null,i.createElement(g.H.BorderInlineControl,{label:o("babyGrowth.input.birthday")},i.createElement(p.D,Object.assign({placeholder:"DD/MM/YYYY",popoverProps:{withinPortal:!0},maxDate:new Date},d.getInputProps("age"),{error:null}))),d.errors.age&&i.createElement(g.H.Error,null,d.errors.age)),i.createElement(g.H.FormRow,{className:s.submitWrapper},i.createElement(g.H.Submit,Object.assign({type:"submit",className:(0,r.default)("due-date-calculate-button",s.submitBtn),dataEventCategory:"Health Tool",dataEventAction:"Vaccination Tool",dataEventLabel:a},n),o("dueDatePage.lastPeriod.calculate"))))},MbLayout=e=>{var t=(0,l._)(e,[]);let{t:o}=(0,m.u)(),{currentUrl:a,submitProps:n,form:r}=(0,i.useContext)(y);return i.createElement(g.H,Object.assign({formLayout:"default"},t),i.createElement(g.H.Control,null,i.createElement(h.G,Object.assign({isBaby:!0},r.getInputProps("gender"),{error:null}))),r.errors.gender&&i.createElement(g.H.Error,null,r.errors.gender),i.createElement(g.H.FormRow,null,i.createElement(g.H.BorderBoxControl,{label:o("babyGrowth.input.birthday"),rightSection:i.createElement(b.Z,null)},i.createElement(p.D,Object.assign({placeholder:"DD/MM/YYYY",popoverProps:{withinPortal:!0},maxDate:new Date,rightSection:null},r.getInputProps("age"),{error:null}))),r.errors.age&&i.createElement(g.H.Error,null,r.errors.age)),i.createElement(g.H.Submit,Object.assign({type:"submit",className:"due-date-calculate-button",dataEventCategory:"Health Tool",dataEventAction:"Vaccination Tool",dataEventLabel:a},n),o("dueDatePage.lastPeriod.calculate")))};(a=n||(n={}))[a.trackPeriod=0]="trackPeriod",a[a.conceive=1]="conceive",a[a.avoidPregnancy=2]="avoidPregnancy";let BabyVaccineForm=e=>{var{formLayout:t="default",submitProps:o,currentUrl:a,onSubmit:n}=e,r=(0,l._)(e,["formLayout","submitProps","currentUrl","onSubmit"]);let{t:p}=(0,m.u)(),u=(0,d.rZ)(),v="mb"===u.other.template,g=(0,s.c)({validate:{gender:(0,c.U)(p("validation.error.requiredField")),age:(0,c.U)(p("validation.error.requiredField"))}}),h=Object.assign({onSubmit:g.onSubmit(n)},r);return i.createElement(y.Provider,{value:{submitProps:o,currentUrl:a,form:g}},"inline"===t?i.createElement(InlineLayout,Object.assign({},h)):v?i.createElement(MbLayout,Object.assign({formLayout:t},h)):i.createElement(DefaultLayout,Object.assign({},h)))}}}]);