@hhgtech/hhg-components 1.20.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/build/components/atoms/flag/index.d.ts +1 -1
  2. package/build/components/atoms/pureInput/index.d.ts +2 -2
  3. package/build/components/atoms/shadow/index.d.ts +1 -1
  4. package/build/components/molecules/doctorInfo/index.d.ts +1 -1
  5. package/build/components/molecules/dropdownSearch/index.styled.d.ts +1 -1
  6. package/build/components/organisms/navigationV2/components/molecules/menuCommunitiesList/Item/index.d.ts +1 -1
  7. package/build/components.js +1 -1
  8. package/build/core.js +1 -1
  9. package/build/esm/components.js +1 -1
  10. package/build/esm/core.js +1 -1
  11. package/build/esm/index-863ad334.js +1 -0
  12. package/build/esm/index-a62fd26f.js +1 -0
  13. package/build/esm/index.js +1 -1
  14. package/build/esm/index.styled-b6a3e607.js +1 -0
  15. package/build/esm/index.styled-f83a8dd2.js +1 -0
  16. package/build/esm/navigation.js +1 -1
  17. package/build/esm/number-3cb24023.js +1 -0
  18. package/build/esm/routing-9abd8389.js +1 -0
  19. package/build/esm/together.js +1 -1
  20. package/build/esm/types-8f0e9c59.js +1 -0
  21. package/build/index-19857024.js +1 -0
  22. package/build/index-6fd28747.js +1 -0
  23. package/build/index.js +1 -1
  24. package/build/index.styled-1b059989.js +1 -0
  25. package/build/index.styled-35dac3d3.js +1 -0
  26. package/build/navigation.js +1 -1
  27. package/build/number-87b13133.js +1 -0
  28. package/build/routing-27112fb4.js +1 -0
  29. package/build/together.js +1 -1
  30. package/build/types-60a07497.js +1 -0
  31. package/package.json +1 -1
  32. package/build/esm/index-4643d5f0.js +0 -1
  33. package/build/esm/index-7a791de2.js +0 -1
  34. package/build/esm/index-be3ea0d9.js +0 -1
  35. package/build/esm/index.styled-fe478117.js +0 -1
  36. package/build/esm/routing-914e53ff.js +0 -1
  37. package/build/esm/types-002306a2.js +0 -1
  38. package/build/index-1e5f3bb9.js +0 -1
  39. package/build/index-c0a2d14a.js +0 -1
  40. package/build/index-f129906d.js +0 -1
  41. package/build/index.styled-aeec8a9f.js +0 -1
  42. package/build/routing-d42175b7.js +0 -1
  43. package/build/types-454784c8.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";var t=require("./theme-81c0c062.js");exports.abbreviateNumber=function(t){var e=String(t);if(t>=1e3){for(var o=Math.floor((""+t).length/3),r=void 0,n=2;n>=1;n--){if(((r=parseFloat((0!=o?t/Math.pow(1e3,o):t).toPrecision(n)))+"").replace(/[^a-zA-Z 0-9]+/g,"").length<=2)break}r&&r%1!=0&&(r=r.toFixed(1)),e=r+["","k","m","b","t"][o]}return e},exports.getCareApiDomain=function(){return"https://".concat(t.isProduction?"health-care.":"service-health-care.","hellohealthgroup.com")},exports.getCurrentBaseUrl=function(e,o){void 0===o&&(o="helloSites");var r="marryBaby"===o,n="development"===process.env.NEXT_PUBLIC_DEPLOY_ENV,i=!n&&!t.isProduction;return n?"http://localhost:3000":"https://".concat(i?r?"fe.":"discover.":r?"www.":"").concat(t.domainLocales[e])},exports.getCurrentSsoUrl=function(e){return"https://".concat(t.isProduction?"id.":"staging-id.").concat(t.domainLocales[e])},exports.getDiscoverApiDomain=function(e){return"https://".concat(t.isProduction?"wp.":"staging.").concat(t.domainLocales[e])},exports.getTogetherApiDomain=function(){return"https://".concat(t.isProduction?"together.":"staging-together.","hellohealthgroup.com")};
@@ -1 +0,0 @@
1
- "use strict";var e=require("./tslib.es6-f7929e76.js"),t=require("react"),n=require("./index.styled-d41606bf.js"),a=require("./index.styled-3898ef06.js"),o=require("./index-f129906d.js"),i=require("./useTranslations-e724fe88.js"),l=require("innertext"),r=require("./theme-81c0c062.js"),s=require("./index.styled-aeec8a9f.js");require("react-range");var c=require("react-dom"),u=require("./constants-3cd37eba.js"),d=require("lodash/debounce"),m=require("react-contenteditable"),p=require("./lazyLoad-0454885d.js");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}require("date-fns"),require("styled-components");var g=v(t),h=v(l),C=f(c),w=v(d),E=v(m),y=function(o){var i=o.title,l=o.url,r=o.image,c=o.logo,u=o.className,d=o.style,m=o.noRefetch,p=t.useContext(s.TogetherComponentGlobalContext).data,v=p.locale,f=p.env.isMarryBaby,h=t.useState(!1),C=h[0],w=h[1],E=t.useRef(m);E.current=m;var y=t.useState(null),k=y[0],_=y[1];t.useEffect((function(){e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(t){return E.current?[2]:l?(_((function(t){return e.__assign(e.__assign({},t),{isFetching:!0})})),s.callApi(s.getApiPath(s.PATHS.FETCH_PREVIEW,{_locale:v}),"POST",{data:{link:l}}).then((function(e){var t,n,a;w(!1),_({title:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.title,url:l,image:(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.image)||(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.logo)})})).catch((function(){_(null)})),[2]):[2,_(null)]}))}))}),[l]);var b=(null==k?void 0:k.image)||r,T=(null==k?void 0:k.title)||i,S=(null==k?void 0:k.logo)||c,P=(null==k?void 0:k.url)||l,x=P.replace("http://","").replace("https://","").split(/[/?#]/)[0],N=t.useRef(!1);return g.default.createElement(s.StyledCardLink,{"data-is-marrybaby":f,className:"".concat(u," no-replace-click"),style:d},g.default.createElement("a",{href:P,target:"_blank",rel:"noreferrer"},b&&g.default.createElement("div",{className:"link-image-wrapper"},!f&&g.default.createElement("img",{className:"link-image-blur",src:b,onError:function(e){N.current||(N.current=!0,e.currentTarget.src=s.DEFAULT_IMG)}}),g.default.createElement("img",{className:"link-image",src:b,onError:function(e){N.current||(N.current=!0,e.currentTarget.src=s.DEFAULT_IMG)}})),g.default.createElement("div",{className:"link-info-container"},g.default.createElement(a.Text,{size:"n1"},f&&S&&!C&&g.default.createElement("img",{className:"link-logo",src:S,onError:function(e){return w(!0)}}),x),g.default.createElement(n.Heading,{tag:"h6"},T))))},k=function(e){var n=e.topics,o=e.onClick,i=e.className,l=e.style,r=function(){var e=t.useState(!1),n=e[0],a=e[1],o=t.useRef(null),i=t.useRef(null),l=t.useRef();return{sliding:n,mouseDownHandler:function(e){if(o.current){l.current=setTimeout((function(){a(!0)}),500),i.current={left:o.current.scrollLeft,x:e.clientX};var t=function(e){var t=i.current;if(t){var n=e.clientX-t.x;o.current&&(o.current.scrollLeft=t.left-n)}},n=function(){l.current&&(clearTimeout(l.current),l.current=void 0),a(!1),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",n)}},sliderRef:o,pos:i}}(),c=r.sliding,u=r.mouseDownHandler,d=r.sliderRef,m=t.useContext(s.TogetherComponentGlobalContext),p=m.data.env.togetherBasePath,v=m.action.sanitizeFunction;return g.default.createElement(s.StyledTagTopic,{ref:d,onClick:o,onMouseDown:function(e){return u(e)},className:"".concat(i," ").concat(c?"sliding":""),style:l},n.map((function(e,t){return g.default.createElement("a",{className:"tag-link-item",key:t,href:e.isActive&&!e.isHidden?"".concat(p).concat(e.url):void 0},g.default.createElement(a.Text,{size:"p3"},g.default.createElement("span",{dangerouslySetInnerHTML:{__html:(null==v?void 0:v(e.name))||e.name}})))})))},_=function(e){var n=e.onClick;e.color;var a=e.className,o=e.style,l=t.useContext(s.TogetherComponentGlobalContext).data.env.isMarryBaby,r=i.useTranslations().t;return g.default.createElement(s.LabelSortPin,{label:g.default.createElement(g.default.Fragment,null,l&&g.default.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M3.5 19.9999L7.87 15.6299' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.95634 11.294C4.56534 11.685 4.56534 12.318 4.95634 12.708L7.87434 15.626L10.7923 18.544C11.1833 18.935 11.8163 18.935 12.2063 18.544L13.3813 17.369C13.5693 17.181 13.6743 16.927 13.6743 16.662V12.726L16.5743 9.82597L18.8833 9.94897C19.1663 9.96397 19.4433 9.85797 19.6433 9.65797L20.2173 9.08397C20.6083 8.69297 20.6083 8.05997 20.2173 7.66997L15.8313 3.28397C15.4403 2.89297 14.8073 2.89297 14.4173 3.28397L13.8433 3.85797C13.6423 4.05897 13.5363 4.33497 13.5523 4.61797L13.6753 6.92697L10.7753 9.82697H6.83834C6.57334 9.82697 6.31834 9.93197 6.13134 10.12L4.95634 11.294V11.294Z' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath d='M16.5699 9.83018L13.6699 6.93018' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3c/svg%3e"})," ",r("label.pinnedPost")),rightLabel:!l&&g.default.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cline x1='7.18605' y1='7.68219' x2='3.68219' y2='13.8139' stroke='%23FEA21E' stroke-linecap='round'/%3e%3cpath d='M3.24591 7.78426C3.21275 7.84168 3.20376 7.90993 3.22092 7.97398C3.23808 8.03803 3.27998 8.09264 3.3374 8.12579L8.78429 11.2706C8.90385 11.3396 9.05674 11.2986 9.12578 11.1791C9.71191 10.1641 9.71348 8.97262 9.23682 7.99339L10.8583 5.18521C11.5115 5.00603 12.0982 4.57973 12.4638 3.94629C12.5328 3.82672 12.4919 3.67383 12.3723 3.6048L8.18237 1.18584C8.12494 1.15268 8.0567 1.1437 7.99265 1.16086C7.92861 1.17803 7.874 1.21993 7.84086 1.27736C7.47521 1.91077 7.39934 2.63194 7.57065 3.28723L5.94919 6.09545C4.86323 6.1723 3.83201 6.76934 3.24591 7.78426Z' fill='%23FEA21E' stroke='%23FEA21E' stroke-width='0.5' stroke-linejoin='round'/%3e%3c/svg%3e"}),onClick:n,color:"white",className:"label-pinned ".concat(a),style:o})},b=function(e){return{message:e("notification.failure"),type:"danger"}},T="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%23FE921D'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",S=function(t){var n=t.id,a=t.locale;return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return n?[4,s.callApiWithAuth(s.getApiPath(s.PATHS.POST.LIKE,{id:n,_locale:a}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},P=function(t){var n=t.id,a=t.locale;return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return n?[4,s.callApiWithAuth(s.getApiPath(s.PATHS.POST.DELETE,{id:n,_locale:a}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},x=function(t){var n=t.title,a=t.description,o=t.communityId,i=t.imageFiles,l=t.previewUrl,r=t.topicIds,c=t.locale,u=t.sanitizeFunction,d=t.categoryCommunityId,m=t.categoryTopicIds,p=t.introUrl,v=t.bannerUrl,f=t.scheduleTime;return e.__awaiter(void 0,void 0,void 0,(function(){var t,g,h,C,w;return e.__generator(this,(function(e){switch(e.label){case 0:return t=new FormData,g=s.removeBannedWordWrapper(a),h=s.removeBannedWordWrapper(n),C=s.getMentionIdsFromString(g),t.append("title",h),t.append("description",s.encodePostContent(g,u)),d?t.append("category_community",String(d)):o&&t.append("community_id",String(o)),(null==l?void 0:l.title)&&t.append("preview_title",l.title),(null==l?void 0:l.description)&&t.append("preview_description",l.description),(null==l?void 0:l.url)&&t.append("preview_link",l.url),(null==l?void 0:l.image)&&t.append("preview_image",l.image),null==r||r.forEach((function(e){t.append("topics[]",String(e||""))})),null==m||m.forEach((function(e){t.append("category_topics[]",String(e||""))})),(null==i?void 0:i.length)?[4,Promise.all(i.map((function(e,t){return new Promise((function(n){setTimeout((function(){n(s.uploadAndGetSrc(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=e.sent())||w.filter(Boolean).slice(0,s.MAX_IMAGE_UPLOADS).forEach((function(e,n){t.append("images[".concat(n,"]"),e)})),[3,3];case 2:t.append("images",""),e.label=3;case 3:return null==C||C.forEach((function(e){t.append("mention_ids[]",e)})),t.append("intro_url",p||""),t.append("banner",v||""),f&&(t.append("post_type","scheduled"),t.append("schedule_datetime",f)),[2,t]}}))}))},N=function(t){var n=t.locale,a=t.formData,o=t.isArticleComment;return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.callApiWithAuth(s.getApiPath(o?s.PATHS.POST.CREATE_ARTICLE_COMMENT:s.PATHS.POST.CREATE,{_locale:n}),"POST",{data:a,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},I=function(t){var n=t.id,a=t.locale,o=t.formData;return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.callApiWithAuth(s.getApiPath(s.PATHS.POST.UPDATE,{id:n,_locale:a}),"POST",{data:o})];case 1:return[2,e.sent()]}}))}))},A=function(e){var t=e.id,n=e.reason,a=e.locale,o=new FormData;return o.append("reason",n),s.callApiWithAuth(s.getApiPath(s.PATHS.POST.REPORT,{_locale:a,id:t}),"POST",{data:o})},M=function(e,n){var a=t.useState(e||[]),o=a[0],i=a[1];return{onSelectImages:function(t){var a=t.target.files;a&&(n&&e?n((e||o).concat(Array.from(a))):i((function(t){var o=e||t;return n&&n(o.concat(Array.from(a))),o.concat(Array.from(a))})))},onRemoveImage:function(t){if(n&&e){var a=e;a.splice(t,1),n(a.slice())}else i((function(a){var o=e||a;return o.splice(t,1),n&&n(o.slice()),o.slice()}))},onRemoveAllImages:function(){n?n([]):i([])},imageSrcs:t.useMemo((function(){return(e||o).map((function(e){return"string"==typeof e?e:URL.createObjectURL(e)}))}),[e,o]),imageFiles:e||o}},L="data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 22.9844C17.5228 22.9844 22 18.5072 22 12.9844C22 7.46153 17.5228 2.98438 12 2.98438C6.47715 2.98438 2 7.46153 2 12.9844C2 18.5072 6.47715 22.9844 12 22.9844Z' fill='%23262626'/%3e%3cpath d='M14.8281 10.1562L9.17127 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.17188 10.1562L14.8287 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",R=function(e){var n=e.className,o=e.style,l=e.bannedWords,c=void 0===l?[]:l,u=e.value,d=e.onChange,m=e.onPreviewUrlChange,p=e.onInvalidUrlsChange,v=e.onImageFilesChange,f=e.imageFiles,C=e.isReplying,w=i.useTranslations().t,E=t.useState(null),k=E[0],_=E[1],b=t.useRef(null),S=M(f,v),P=S.onSelectImages,x=S.onRemoveImage,N=S.imageSrcs;return t.useEffect((function(){m&&((null==k?void 0:k.url)?m({title:k.title||"",url:k.url||"",image:k.image||"",description:k.description||""}):m(null))}),[k]),g.default.createElement(s.StyledCreatePostDescription,{className:n,style:o},g.default.createElement(a.Text,{size:"p4",className:"description-label"},w("createPost.popup.description")),g.default.createElement("div",{className:"textarea-control"},g.default.createElement("div",{className:"textarea-wrapper"},g.default.createElement(s.RichTextEditor,{html:u||"",onChange:d,bannedWords:c,onImagePickerClick:function(){var e;return null===(e=b.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:_,onInvalidUrlsChange:p,isReplying:C}))),g.default.createElement(a.Text,{size:"p4",className:"count-string"},w("character"),": ",h.default(u||"").length),(!N||0===N.length)&&k&&g.default.createElement("div",{className:"link-preview-wrapper"},k.isFetching?g.default.createElement(s.Loading,null):g.default.createElement(g.default.Fragment,null,g.default.createElement(y,{title:k.title,url:k.url||"#",image:k.image,noRefetch:!0}),g.default.createElement("img",{src:L,className:"icon-close",onClick:function(){return _(null)}}))),g.default.createElement("input",{ref:b,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:P}),N.length>s.MAX_IMAGE_UPLOADS?g.default.createElement("div",{className:"input-notification"},g.default.createElement("img",{src:T}),g.default.createElement(a.Text,{size:"p4",color:r.theme.colors.alertWarning},w("createPost.popup.warningImage"))):null,N.length>0&&g.default.createElement("div",{className:"image-gallery"},N.map((function(e,t){return g.default.createElement("div",{key:t,className:"image-item"},g.default.createElement("img",{src:e}),g.default.createElement("img",{className:"close-btn",src:L,onClick:function(){return x(t)}}))}))))},B=function(e,t){if(!t)return e;var n=t.limit,a=t.bannedWords,o=void 0===a?[]:a,i="number"==typeof n&&n>=0?e.substring(0,n):e;return s.highlightBadWords(i,o)},j=function(e){var n,o=e.className,l=e.style,r=e.bannedWords,c=void 0===r?[]:r,d=e.value,m=e.onChange,p=i.useTranslations().t,v=t.useState(""),f=v[0],h=v[1],C=t.useRef(null);t.useEffect((function(){if(C.current){var e=function(e){var t;e.preventDefault();var n=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,n)},t=C.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[C]);var y=(null==c?void 0:c.join(","))||"";t.useEffect((function(){var e;if(y){var t=null===(e=C.current)||void 0===e?void 0:e.innerText;if(t){var n=s.highlightBadWords(t,c);n!==t&&(m&&m(n),h(n))}}}),[y]);var k=t.useCallback(w.default((function(e){if(C.current){var t=B(C.current.innerText,{limit:120,bannedWords:c});m&&m(t),h(t)}}),300),[]);return t.useEffect((function(){setTimeout((function(){var e;null===(e=C.current)||void 0===e||e.focus()}),500)}),[]),g.default.createElement(s.StyledCreatePostTitle,{className:o,style:l},g.default.createElement(u.Input,{name:"title",value:d||f,size:"md",label:p("createPost.title"),CustomInput:g.default.createElement(E.default,{innerRef:C,html:d||f,onChange:function(e){if(C.current&&C.current.innerText!==(d||f)){var t=B(C.current.innerText,{bannedWords:c});m&&m(t),h(t),k(C.current.innerText)}},className:"title-input"})}),g.default.createElement(a.Text,{size:"p4",className:"count-string"},p("createPost.popup.wordCount",{count:(null===(n=C.current)||void 0===n?void 0:n.innerText.length)||0,max:120})))},F=function(n){var a=n.className,o=n.style,i=n.topics,l=n.communityId,r=n.onChange,c=n.isLoading,u=n.disabled,d=n.forceTopics,m=n.selectedTopics,p=n.noFetch,v=t.useContext(s.TogetherComponentGlobalContext).data,f=v.locale,h=v.env.isMarryBaby,C=t.useState(i?e.__spreadArray([],i,!0):[]),w=C[0],E=C[1],y=t.useState(m?e.__spreadArray([],m,!0):[]),k=y[0],_=y[1],b=t.useState(!1),T=b[0],S=b[1],P=t.useRef(i);P.current=i,t.useEffect((function(){var t;!l||p||(null===(t=P.current)||void 0===t?void 0:t.length)||(E([]),S(!0),e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s.callApi(s.getApiPath(s.PATHS.TOPIC.LIST,{communityId:l,_locale:f}),"GET")];case 1:return t=e.sent(),n=null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.topics,Array.isArray(n)&&E((function(){return(null==n?void 0:n.map(s.formatTopic).sort((function(e,t){return(e.order||0)-(t.order||0)})))||[]})),[3,3];case 2:return a=e.sent(),console.log(a),S(!1),[3,3];case 3:return S(!1),[2]}}))})))}),[l,p]);var x=null==i?void 0:i.map((function(e){return e.id})).join("-"),N=null==w?void 0:w.map((function(e){return e.id})).join("-"),I=null==d?void 0:d.map((function(e){return e.id})).join("-");t.useEffect((function(){i&&void 0!==x&&x!==N&&E(i)}),[i,x,N]);var A=t.useMemo((function(){return w.filter((function(e){return!(null==d?void 0:d.some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})))}))}),[N,I]);return g.default.createElement(s.StyledTopicSelectList,{"data-is-marrybaby":h,className:a,style:o},d.map((function(e){return g.default.createElement(D,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),A.map((function(e){return g.default.createElement(D,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:u,selected:(m||k).some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})),onClick:function(){var t=m||k,n=t.findIndex((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId}));-1!==n?t.splice(n,1):t.push(e),r&&m?r(t.slice()):(r&&r(t.slice()),_(t.slice()))}})})),(c||T)&&g.default.createElement(s.Loading,{className:"topic-spinner"}))},D=function(e){var t=e.topic,n=e.disabled,a=e.selected,o=e.onClick;return g.default.createElement("div",{className:"tag-item"+(a?" --active":""),"data-disabled":n,onClick:n?void 0:o},t.name)},O=function(e){var o=e.className,l=e.isMarryBaby,r=e.style,c=e.title,u=e.description,d=e.acceptText,m=e.cancelText,p=e.onAccept,v=e.thumbnail,f=e.isThumbnailIcon,h=e.onClose,w=t.useContext(s.TogetherComponentGlobalContext).data.env.isMarryBaby,E="boolean"==typeof l?l:w,y=t.useState(!1),k=y[0],_=y[1];return t.useEffect((function(){return i.toggleNoScroll(!0),setTimeout((function(){return _(!0)}),0),function(){return i.toggleNoScroll(!1)}}),[]),C.createPortal(g.default.createElement(s.StyledPopupDanger,{"data-is-marrybaby":E,className:o,style:r,"data-open":k},g.default.createElement(s.PopupFrame,{className:"popup-frame",isOpen:k,onClose:h},g.default.createElement("div",{className:"confirm-dialog",onClick:function(e){return e.stopPropagation()}},g.default.createElement("div",{className:"confirm-content"},v&&g.default.createElement("div",{className:"thumbnail-container ".concat(f?"is-icon":"")},g.default.createElement("img",{className:"thumbnail",src:v})),g.default.createElement(n.Heading,{className:"title",tag:"h2"},c),g.default.createElement(a.Text,{className:"desc",size:"lg"},u),g.default.createElement("div",{className:"btn-group"},g.default.createElement(n.Button,{theme:E?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==p||p(),null==h||h()}},d),g.default.createElement(n.Button,{theme:E?"marryBaby":"helloSites",size:"md",onClick:h},m)))),E&&v&&g.default.createElement("div",{className:"thumbnail-container is-mobile ".concat(f?"is-icon":"")},g.default.createElement("img",{className:"thumbnail",src:v})))),i.getPopupWrapperDom())},H=function(t){var n=t.postId,a=t.message,o=t.photos,i=t.link,l=t.locale,r=t.sanitizeFunction,c=t.replyingUserId,u=t.replyingUserName,d=t.replyingId;return e.__awaiter(void 0,void 0,void 0,(function(){var t,m,p;return e.__generator(this,(function(e){switch(e.label){case 0:return t=new FormData,m=s.encodePostContent(a.replace(/(\&nbsp;)+/g," "),r),p=s.getMentionIdsFromString(m),o&&o.length>0?[4,Promise.all(null==o?void 0:o.map((function(e){return s.uploadAndGetSrc(e,l)})))]:[3,2];case 1:e.sent().filter(Boolean).slice(0,s.MAX_IMAGE_UPLOADS).forEach((function(e){t.append("images[]",e)})),e.label=2;case 2:return i&&t.append("link",i),null==p||p.forEach((function(e){t.append("mention_ids[]",e)})),t.append("post_id",n),d&&t.append("parent_id",d),c&&(p.unshift(c),m='[mention+id="'.concat(c,'"+name="').concat((u||"").replace('"',"'"),'"]').concat(m),t.append("parent_user_id",String(c))),t.append("content",m),t.append("content",m),[2,t]}}))}))},W=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.CREATE,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}})]}))}))},U=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.REPLY,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}})]}))}))},z=function(t){var n=t.commentId,a=t.setLike,o=void 0!==a&&a,i=t.locale;return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,s.callApiWithAuth(s.getApiPath(o?s.PATHS.COMMENT.LIKE:s.PATHS.COMMENT.UNLIKE,{_locale:i,id:n}),"GET")]}))}))},V=function(e){var t=e.id,n=e.locale;return s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},G=function(o){var l=o.isReply,r=o.className,c=o.onClose,d=o.replyToName,m=o.style,p=o.replyingId,v=o.replyingUser,f=o.onPostSuccess;o.isMainCmt;var h=o.post,C=o.isMarryBaby,w=t.useContext(s.TogetherComponentGlobalContext),E=w.action,k=E.pushNotifications,_=E.sanitizeFunction,b=w.data,T=b.userInfo,S=b.locale,P=b.env.isMarryBaby,x="boolean"==typeof C?C:P,N=i.useTranslations().t,I=M(),A=I.onSelectImages,R=I.onRemoveImage,B=I.imageSrcs,j=I.onRemoveAllImages,F=I.imageFiles,D=t.useState(""),O=D[0],z=D[1],V=t.useContext(s.MainInputTriggerContext).trigger,G=t.useState(!1),Z=G[0],q=G[1],$=t.useRef(null),K=t.useRef(null),Q=t.useRef(null),X=t.useState([]),J=X[0],Y=X[1],ee=t.useState([]),te=ee[0],ne=ee[1],ae=t.useState(null),oe=ae[0],ie=ae[1];return t.useEffect((function(){var e;null===(e=Q.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout((function(){var e;null===(e=K.current)||void 0===e||e.focus()}),400)}),[V]),g.default.createElement(s.StyledInputCommentBar,{"data-is-reply":l,className:r,style:m},l&&g.default.createElement("div",{className:"reply-to-container"},g.default.createElement(a.Text,{size:"p4"},g.default.createElement("span",{dangerouslySetInnerHTML:{__html:N("inputComment.replyTo",{name:'<span style="color: #2D87F3; cursor: pointer">@'.concat(d||"","</span>")})}})),g.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8.00016' cy='8.50004' r='6.66667' fill='white' stroke='%23404040'/%3e%3cpath d='M10 6.5L6 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6 6.5L10 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-close-comment",onClick:function(){return c&&c()}})),g.default.createElement("div",{className:"input-container",ref:Q},g.default.createElement(s.UserAvatar,{className:"avatar-wrapper ".concat(l?"avatar-wrapper-reply":""),avatar:(null==T?void 0:T.id)?T.avatar:s.DEFAULT_AVATAR_IMG,username:(null==T?void 0:T.name)||(null==T?void 0:T.username)}),g.default.createElement("input",{ref:$,onChange:A,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),g.default.createElement(u.Input,{value:O,name:"input",size:"md",className:"input-wrapper",displayIcon:g.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.7543 4.85352H4.49227C4.01776 4.85352 3.56268 5.04201 3.22715 5.37754C2.89162 5.71307 2.70313 6.16815 2.70312 6.64266V19.1667C2.70313 19.6412 2.89162 20.0963 3.22715 20.4318C3.56268 20.7673 4.01776 20.9558 4.49227 20.9558H17.0163C17.4908 20.9558 17.9459 20.7673 18.2814 20.4318C18.6169 20.0963 18.8054 19.6412 18.8054 19.1667V12.9047' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M17.4633 3.51187C17.8192 3.15599 18.3019 2.95605 18.8052 2.95605C19.3085 2.95605 19.7912 3.15599 20.147 3.51187C20.5029 3.86775 20.7029 4.35044 20.7029 4.85373C20.7029 5.35702 20.5029 5.83971 20.147 6.19559L11.6486 14.694L8.07031 15.5886L8.96489 12.0103L17.4633 3.51187Z' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e"}),CustomInput:g.default.createElement("div",{className:"as-input"},g.default.createElement(s.RichTextEditor,{className:"textarea",html:O,onChange:z,onImagePickerClick:function(){var e;return null===(e=$.current)||void 0===e?void 0:e.click()},bannedWords:te,onPreviewUrlChange:ie,onInvalidUrlsChange:Y,setEditorRef:function(e){return K.current=e},isReplying:l}))}),g.default.createElement(n.Button,{theme:x?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o,i,r,u,d,m,g,C,w,E;return e.__generator(this,(function(y){switch(y.label){case 0:if(!(null==h?void 0:h.id)||Z)return[2];q(!0),y.label=1;case 1:return y.trys.push([1,4,,5]),t=function(e){z(""),j(),c&&c();var t=s.formatComment(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),f&&f(t)},[4,H(e.__assign({message:O,photos:F,postId:String(h.id),link:null==oe?void 0:oe.url,sanitizeFunction:_,locale:S},l&&p?{replyingUserId:String((null==v?void 0:v.id)||(null===(i=null==h?void 0:h.author)||void 0===i?void 0:i.id)||""),replyingId:p,replyingUserName:(null==v?void 0:v.name)||(null==v?void 0:v.username)||""}:{}))];case 2:return n=y.sent(),[4,l&&p?U(n,S):W(n,S)];case 3:return a=y.sent(),(null==(o=null==a?void 0:a.data)?void 0:o.id)&&!(null===(u=null===(r=null==a?void 0:a.messages)||void 0===r?void 0:r.moderation)||void 0===u?void 0:u.type)?t(a):"banned"===(null===(m=null===(d=null==a?void 0:a.messages)||void 0===d?void 0:d.moderation)||void 0===m?void 0:m.type)?(k({title:N("notification.comment.blocked.title"),message:N("notification.comment.blocked.message"),type:"danger"}),a.messages.moderation.words&&ne(a.messages.moderation.words)):"suspect"===(null===(C=null===(g=null==a?void 0:a.messages)||void 0===g?void 0:g.moderation)||void 0===C?void 0:C.type)?(k({title:N("notification.comment.suspect.title"),message:N("notification.comment.suspect.message"),type:"warning"}),z(""),j(),c&&c()):(null===(w=null==a?void 0:a.messages)||void 0===w?void 0:w.find((function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(k({message:N("notification.suspend.message"),type:"warning"}),z(""),j(),c&&c()):k({title:"",message:(null===(E=null==a?void 0:a.messages)||void 0===E?void 0:E[0])||N("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return y.sent(),k({title:"",message:N("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return q(!1),[2]}}))}))},isLoading:Z,isDisabled:!!(null==J?void 0:J.length)||Z||!O||(null==O?void 0:O.length)<2||!O.trim()},g.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='20' height='21' viewBox='0 0 20 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 9.73438L3.75 13.4844L7.5 17.2344' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M16.25 4.73438L16.25 10.3026C16.25 11.1464 15.9208 11.9557 15.3347 12.5524C14.7487 13.1491 13.9538 13.4844 13.125 13.4844L3.75 13.4844' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-enter"}))),(null==J?void 0:J.length)?g.default.createElement("div",{className:"error-text"},N("notification.limitUrlDomain")):null,(!B||0===B.length)&&oe&&g.default.createElement("div",{className:"link-preview-wrapper"},oe.isFetching?g.default.createElement(s.Loading,null):g.default.createElement(g.default.Fragment,null,g.default.createElement(y,{title:oe.title,url:oe.url||"#",image:oe.image,noRefetch:!0}),g.default.createElement("img",{src:L,className:"icon-close",onClick:function(){return ie(null)}}))),B&&B.length>0&&g.default.createElement("div",{className:"preview-images-container"},B.map((function(e,t){return g.default.createElement("div",{key:t,className:"image-src-wrapper"},g.default.createElement("img",{className:"preview-image",src:e}),g.default.createElement("img",{src:L,className:"icon-close-circle",onClick:function(){return R(t)}}))}))))},Z="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 5V8' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11H8.00708' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",q=function(o){var l=o.className,c=o.style,u=o.reason,d=o.reasonText,m=o.onClose,p=o.postId,v=t.useContext(s.TogetherComponentGlobalContext),f=v.data,h=f.locale,C=f.env.isMarryBaby,w=v.action.pushNotifications,E=i.useTranslations().t,y=t.useState(!1),k=y[0],_=y[1];return g.default.createElement(s.StyledSubmitReportForm,{"data-is-marrybaby":C,className:l,style:c},g.default.createElement("ul",{className:"report-list"},g.default.createElement("li",{className:"report-item"},g.default.createElement("img",{src:Z}),g.default.createElement(a.Text,{className:"__label",color:r.theme.colors.gray800,size:"p4"},d))),g.default.createElement(n.Button,{theme:C?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:k,onClick:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:if(!p||k)return[2];_(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,A({id:p,reason:u,locale:h})];case 2:return 1===(null==(t=e.sent())?void 0:t.status)&&(w({message:"Post reported",type:"success"}),m&&m()),[3,4];case 3:return e.sent(),[3,4];case 4:return _(!1),[2]}}))}))}},E("submit")))},$=function(e){var n=e.className,a=e.style,o=e.replyingTo,l=e.mentionedUser,r=e.description,c=e.disableShortenContent,u=e.mentions,d=void 0===u?[]:u,m=t.useState(!1),p=m[0],v=m[1],f=i.useTranslations().t,h=s.useTogetherAuthRequiredAction().authActionWrapper,C=t.useState(!1),w=C[0],E=C[1],y=s.decodeMention(s.decodePostUrl(r||"","display"),d),k=t.useContext(s.TogetherComponentGlobalContext).action.sanitizeFunction,_=t.useMemo((function(){var e=k(y||"");if(c||p)return{showContent:e,hasSeeMore:!1};var t=e.slice(0,1e3),n=1e3-27*((t.match(/<\/div>/g)||[]).length-1),a=(t||"").slice(0,n<40?40:n),o=k(a.replace(/(<|<\/)( +|[a-zA-Z]*)$/gi,"")),i=o.length<e.length-10;return{showContent:i?o:e,hasSeeMore:i}}),[c,p,y]),b=(null==l?void 0:l.name)||o,T="expert"===(null==l?void 0:l.role)&&!!(null==l?void 0:l.partnerId);return g.default.createElement(g.default.Fragment,null,T&&g.default.createElement(s.PopupExpert,{isOpen:w,onClose:function(){return E(!1)},expertId:String(null==l?void 0:l.partnerId)}),g.default.createElement(s.StyledPostContent,{className:"".concat(n," no-replace-click"),style:a},b&&g.default.createElement("span",{onClick:function(){return T&&E(!0)},className:"post-content-replying"},"@",b),(null==r?void 0:r.startsWith("[mention+id="))&&g.default.createElement("span",{className:"post-content-replying tag-only"},"@"),g.default.createElement("span",{dangerouslySetInnerHTML:{__html:_.showContent},className:"post-content ".concat(_.hasSeeMore?"has-see-more":"")}),_.hasSeeMore&&!p&&g.default.createElement("span",null,"... ",g.default.createElement("span",{onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(){return v(!0)}))},className:"see-more-text"},f("post.seeMore")))))},K=function(e){var n=e.className,o=e.style,l=e.authorName,r=e.images,c=e.onClose,u=e.onOpenSingleView,d=i.useTranslations().t,m=t.useState(!1),p=m[0],v=m[1];return t.useEffect((function(){setTimeout((function(){v(!0)}),0)}),[]),C.createPortal(g.default.createElement(s.StyledImagePreviewPopup,{className:n,style:o,"data-open":p},g.default.createElement("div",{className:"top-bar"},g.default.createElement("img",{className:"icon-arrow-left",src:"data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.0508 18.0607L4.00078 12.0367L10.0508 6.01172' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.00195 12.0352L19.002 12.0352' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",onClick:c,alt:"go back"}),g.default.createElement(a.Text,{size:"p2",type:"bold",style:{textAlign:"center"}},d("previewPhotos.title",{name:l}))),g.default.createElement("div",{className:"container"},r.map((function(e,t){return g.default.createElement("img",{className:"img-preview",key:t,src:e,onClick:function(){return null==u?void 0:u(t)},alt:"post img"})})))),i.getPopupWrapperDom())},Q="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12.8125L10 8.8125L6 4.8125' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",X=function(e){var n=e.initialViewIndex,a=e.images,o=e.onClose,l=t.useState(n),r=l[0],c=l[1],u=t.useState(!1),d=u[0],m=u[1];t.useEffect((function(){setTimeout((function(){m(!0)}),0)}),[]);var p=null==a?void 0:a[r],v=0===r,f=!(null==a?void 0:a.length)||r===(null==a?void 0:a.length)-1;return C.createPortal(g.default.createElement(s.StyledImagePreviewContainer,{"data-open":d&&!!p},g.default.createElement(s.StyledImagePreviewTopbar,null,g.default.createElement("img",{src:s.img,className:"icon-close",onClick:o,alt:"close"})),p&&r>=0&&g.default.createElement(g.default.Fragment,null,g.default.createElement(s.StyledImagePreviewWrapper,null,g.default.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),g.default.createElement(s.StyledArrowWrapper,{"data-disabled":v,onClick:function(){return!v&&c(r-1)}},g.default.createElement(s.StyledCircleArrow,null,g.default.createElement("img",{src:Q,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),g.default.createElement(s.StyledArrowWrapper,{"data-right":!0,"data-disabled":f,onClick:function(){return!f&&c(r+1)}},g.default.createElement(s.StyledCircleArrow,null,g.default.createElement("img",{src:Q,alt:"right arrow","data-disabled":f})))))),i.getPopupWrapperDom())},J=function(e){var n=e.image,a=e.isShortcut,o=t.useState(!0),l=o[0],r=o[1],c=i.useTranslations().t;return t.useEffect((function(){setTimeout((function(){return null===p.lazyLoadInstance||void 0===p.lazyLoadInstance?void 0:p.lazyLoadInstance.update()}),100)}),[n]),g.default.createElement(s.StyledWrapper$4,{"data-is-blurred":l,onClick:function(e){return l&&e.stopPropagation()}},g.default.createElement("img",{className:"lazy img-preview","data-src":n}),g.default.createElement(s.StyledInner,null,g.default.createElement(s.StyledInnerWrapper,null,g.default.createElement(s.StyledIcon$3,{"data-is-shortcut":a,onClick:function(){return r(!l)}},g.default.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},g.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.71 4.54039C2.32 4.15039 2.32 3.52039 2.71 3.13039C3.1 2.74039 3.74 2.74039 4.13 3.13039L20.44 19.4604C20.83 19.8504 20.83 20.4804 20.44 20.8704C20.05 21.2604 19.42 21.2604 19.03 20.8704L16.31 18.1504C14.97 18.6704 13.52 18.9704 12 18.9704C7 18.9704 2.73 15.8604 1 11.4704C1.77 9.50039 3.06 7.80039 4.68 6.51039L2.71 4.54039ZM17 11.4704C17 8.71039 14.76 6.47039 12 6.47039C11.49 6.47039 11 6.57039 10.53 6.71039L8.36 4.54039C9.51 4.17039 10.73 3.97039 12 3.97039C17 3.97039 21.27 7.08039 23 11.4604C22.31 13.2204 21.21 14.7604 19.82 15.9904L16.76 12.9304C16.9 12.4704 17 11.9804 17 11.4704ZM12 16.4704C9.24 16.4704 7 14.2304 7 11.4704C7 10.7004 7.18 9.97039 7.49 9.33039L9.06 10.9004C9.03 11.0804 9 11.2704 9 11.4704C9 13.1304 10.34 14.4704 12 14.4704C12.2 14.4704 12.38 14.4404 12.57 14.4004L14.14 15.9704C13.49 16.2904 12.77 16.4704 12 16.4704ZM14.97 11.1404C14.82 9.74039 13.72 8.65039 12.33 8.50039L14.97 11.1404Z",fill:"#ffffff"}))),g.default.createElement(s.StyledContentWrapper$2,null,!a&&g.default.createElement(s.StyledContainer$8,null,g.default.createElement(s.StyledHeading$2,null,c("sensitiveMask.contentWarningMessage")),g.default.createElement(s.StyledContent$1,null,c("sensitiveMask.contentWarningDescription"))),(a&&!l||!a)&&g.default.createElement(s.StyledAction,null,g.default.createElement(s.StyledButton,{size:"sm",onClick:function(e){!l&&e.stopPropagation(),r(!l)}},c(l?"sensitiveMask.unblur":"sensitiveMask.blur")))))))},Y=function(e){var a=e.className,o=e.images,l=void 0===o?[]:o,r=e.style,c=e.authorName,u=e.isSensitive,d=void 0!==u&&u,m=t.useContext(s.TogetherComponentGlobalContext).data.env.isMarryBaby,v="+ ".concat((l.length||0)-4),f=t.useState(!1),h=f[0],C=f[1],w=t.useState(-1),E=w[0],y=w[1];t.useEffect((function(){setTimeout((function(){return null===p.lazyLoadInstance||void 0===p.lazyLoadInstance?void 0:p.lazyLoadInstance.update()}),100)}),[null==l?void 0:l.slice(0,5).join("|")]);var k=l.length>5,_=t.useRef(!1);return t.useEffect((function(){return function(){_.current&&i.toggleNoScroll(!1)}}),[]),t.useEffect((function(){h||E>=0?(i.toggleNoScroll(!0),_.current=!0):(i.toggleNoScroll(!1),_.current=!1)}),[h,E]),g.default.createElement(g.default.Fragment,null,g.default.createElement(s.StyledPostImagePreview,{className:a,style:r,"data-image-count":k?5:l.length||0,"data-is-marrybaby":m},null==l?void 0:l.slice(0,5).map((function(e,t){return g.default.createElement("div",{className:"img-wrapper",key:t,onClick:function(){t>=4&&k?C(!0):y(t)}},d&&g.default.createElement(J,{image:e,isShortcut:0!==t}),!m&&g.default.createElement("img",{className:"lazy img-preview-blur","data-src":e}),g.default.createElement("img",{className:"lazy img-preview","data-src":e}),4===t&&k&&g.default.createElement("div",{className:"img-more-overlay"},g.default.createElement(n.Heading,{tag:"h1",color:"white"},v)))}))),h&&g.default.createElement(K,{authorName:c||"",images:l,onClose:function(){return C(!1)},onOpenSingleView:y}),E>=0&&g.default.createElement(X,{images:l,initialViewIndex:E,onClose:function(){return y(-1)}}))},ee=function(n){var a=n.url,o=n.image,i=n.className,l=n.style,r=t.useContext(s.TogetherComponentGlobalContext).data.locale,c=t.useState(null),u=c[0],d=c[1];t.useEffect((function(){e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(t){return o?[2]:a?(d((function(t){return e.__assign(e.__assign({},t),{isFetching:!0})})),s.callApi(s.getApiPath(s.PATHS.FETCH_PREVIEW,{_locale:r}),"POST",{data:{link:a}}).then((function(e){var t,n;d({url:a,image:(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.image)||(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.logo)})})).catch((function(){d(null)})),[2]):[2,d(null)]}))}))}),[a,o]);var m=(null==u?void 0:u.image)||o,p=(null==u?void 0:u.url)||a,v=t.useMemo((function(){return s.youtubeVidIdGetter(p)}),[p]),f=t.useMemo((function(){return s.facebookVidIdGetter(p)}),[p]),h=t.useRef(0),C=t.useRef(0),w=t.useState(!1),E=w[0],y=w[1];t.useEffect((function(){var e=function(){var e,t=null===(e=k.current)||void 0===e?void 0:e.getBoundingClientRect(),n=!1;t&&(!h.current||Math.abs((h.current-t.width)/(null==t?void 0:t.width))>.2)&&(h.current=Math.floor(t.width),n=!0),t&&(!C.current||Math.abs((C.current-t.height)/(null==t?void 0:t.height))>.2)&&(C.current=Math.floor(t.height),n=!0),n&&y((function(e){return!e}))};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var k=t.useRef(null),_=t.useRef(!1);return g.default.createElement(s.StyledSocialLinkPreview,{className:"".concat(i," no-replace-click"),style:l,ref:k},o||!v&&!f?g.default.createElement("a",{href:p,target:"_blank",rel:"noreferrer"},g.default.createElement("div",{className:"link-image-wrapper ".concat((null==u?void 0:u.isFetching)?"fetching":"")},(null==u?void 0:u.isFetching)?g.default.createElement(s.Loading,{className:"loading-spinner"}):g.default.createElement("img",{className:"link-image",src:m||s.DEFAULT_IMG,onError:function(e){_.current||(_.current=!0,e.currentTarget.src=s.DEFAULT_IMG)}}))):g.default.createElement("div",{className:"link-image-wrapper"},v?g.default.createElement("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/".concat(v,"?&autoplay=1&mute=1"),frameBorder:"0",allowFullScreen:!0,style:{position:"absolute",top:0,left:0,border:"none",overflow:"hidden"}}):f?g.default.createElement("iframe",{key:String(E),src:"https://www.facebook.com/plugins/video.php?href=".concat(encodeURIComponent(p),"&autoplay=1&show_text=false&t=0&width=").concat(h.current,"&height=").concat(C.current),style:{position:"absolute",top:"50%",left:"50%",border:"none",overflow:"hidden",height:C.current,width:h.current,transform:"translate(-50%, -50%)"},scrolling:"no",frameBorder:"0",allowFullScreen:!0,allow:"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"}):null))},te="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10Z' fill='%233E3F58'/%3e %3cpath d='M19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10Z' fill='%233E3F58'/%3e %3cpath d='M12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z' fill='%233E3F58'/%3e %3c/svg%3e",ne="data:image/svg+xml,%3csvg width='3' height='13' viewBox='0 0 3 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='1.58326' cy='6.41663' r='1.25' transform='rotate(89.9997 1.58326 6.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='1.41663' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 1.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='11.4166' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 11.4166)' fill='%23595959'/%3e%3c/svg%3e",ae="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2 4H3.33333H14' stroke='%23737373' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33334 3.99992V2.66659C5.33334 2.31296 5.47382 1.97382 5.72387 1.72378C5.97392 1.47373 6.31305 1.33325 6.66668 1.33325H9.33334C9.68697 1.33325 10.0261 1.47373 10.2762 1.72378C10.5262 1.97382 10.6667 2.31296 10.6667 2.66659V3.99992M12.6667 3.99992V13.3333C12.6667 13.6869 12.5262 14.026 12.2762 14.2761C12.0261 14.5261 11.687 14.6666 11.3333 14.6666H4.66668C4.31305 14.6666 3.97392 14.5261 3.72387 14.2761C3.47382 14.026 3.33334 13.6869 3.33334 13.3333V3.99992H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66666 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33334 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",oe=function(n){var a=n.onDeleteComment,o=n.commentId,l=n.className,r=void 0===l?"":l,c=n.popoverClassName,u=void 0===c?"":c,d=t.useContext(s.TogetherComponentGlobalContext),m=d.data,p=m.env.isMarryBaby,v=m.locale,f=d.action.pushNotifications,h=i.useTranslations().t,C=t.useState(!1),w=C[0],E=C[1],y=s.useTogetherAuthRequiredAction().authActionWrapper;return g.default.createElement("div",{className:r,onClick:function(e){e.preventDefault(),e.stopPropagation()}},w&&g.default.createElement(O,{thumbnail:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0)'%3e%3cpath d='M2 4.00781H3.33333H14' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33337 4.00846V2.67513C5.33337 2.32151 5.47385 1.98237 5.7239 1.73232C5.97395 1.48227 6.31309 1.3418 6.66671 1.3418H9.33337C9.687 1.3418 10.0261 1.48227 10.2762 1.73232C10.5262 1.98237 10.6667 2.32151 10.6667 2.67513V4.00846M12.6667 4.00846V13.3418C12.6667 13.6954 12.5262 14.0346 12.2762 14.2846C12.0261 14.5347 11.687 14.6751 11.3334 14.6751H4.66671C4.31309 14.6751 3.97395 14.5347 3.7239 14.2846C3.47385 14.0346 3.33337 13.6954 3.33337 13.3418V4.00846H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66663 7.3418V11.3418' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33337 7.3418V11.3418' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0'%3e%3crect width='16' height='16' fill='white' transform='translate(0 0.0078125)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",isThumbnailIcon:!0,title:h("popup.deleteComment.title"),description:h("popup.deleteComment.description"),acceptText:h("popup.deletePost.accept"),cancelText:h("popup.deletePost.cancel"),onAccept:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){switch(e.label){case 0:return o?[4,V({id:o,locale:v})]:[2];case 1:return 1===(null==(t=e.sent())?void 0:t.status)?(a&&a(),f({title:"",message:h("notification.success"),type:"success"})):f({title:"",message:(null===(n=null==t?void 0:t.messages)||void 0===n?void 0:n[0])||h("notification.failure"),type:"danger"}),[2]}}))}))},onClose:function(){return E(!1)}}),g.default.createElement(s.TreePopoverMenu,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:ae,label:h("actionPopover.delete"),onClick:function(){y((function(){E(!0)}))}}]},className:u,toggleButtonContent:g.default.createElement("img",{src:p?te:ne}),buttonProps:{}}))},ie=function(a){var l,c,u,d,m,p=a.className,v=a.style,f=a.comment,h=a.type,C=void 0===h?"comment":h,w=a.level,E=void 0===w?0:w,k=a.replyingId,_=a.onPostCommentSuccess,b=a.post,T=a.onDeleteComment,S=a.refetchComment,P=a.hasQuickBookingEnable,x=a.handleMakeAppointment,N=t.useContext(s.TogetherComponentGlobalContext).data,I=N.locale,A=N.userInfo,M=N.env.isMarryBaby,L=i.useTranslations().t,R=t.useState(f||null),B=R[0],j=R[1],F=B.id;B.countReplies;var D=B.countLikes,O=B.content,H=B.createdAt,W=B.replies,U=void 0===W?[]:W,V=B.images,Z=void 0===V?[]:V,q=B.author,K=B.liked,Q=B.link,X=B.mentionedUser,J=B.mentions,ee=function(e){try{var t=e.match(/\[@([^\]]+)\]/),n=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:n}}catch(e){}return{text:""}}(O),te=ee.text,ne=ee.replyingTo,ae=s.useTogetherAuthRequiredAction({_joinCommunityIds:[null===(l=null==b?void 0:b.community)||void 0===l?void 0:l.id],_joinTopicIds:null===(c=null==b?void 0:b.topics)||void 0===c?void 0:c.map((function(e){return e.id}))}).authActionWrapper,le=t.useState(4),re=le[0],se=le[1],ce=!!(null==A?void 0:A.id)&&(null==U?void 0:U.some((function(e){return e.author.id===A.id}))),ue=function(t){j((function(n){if(!n.replies.find((function(e){return e.id===t.id}))){n.replies.unshift(t);var a=e.__assign(e.__assign({},n),{replies:n.replies.slice(),countReplies:n.countReplies+1});return S&&S(a),a}return n}))},de=t.useState(!1),me=de[0],pe=de[1],ve=t.useMemo((function(){return"comment"===C&&U&&0!=U.length?U.sort((function(e,t){var n=new Date(e.createdAt).getTime(),a=new Date(t.createdAt).getTime();return n>a?-1:n<a?1:0})):U}),[C,U]),fe=(null==U?void 0:U.length)||0,ge=String(null==q?void 0:q.email)&&(null==A?void 0:A.email)&&String(null==q?void 0:q.email)===String(null==A?void 0:A.email),he=(null==q?void 0:q.name)||(null==q?void 0:q.username)||"",Ce=null==q?void 0:q.avatar,we=(null==q?void 0:q.username)||(null==q?void 0:q.name)||"",Ee=t.useState(null),ye=Ee[0],ke=Ee[1],_e=t.useState(null),be=_e[0],Te=_e[1];t.useEffect((function(){if(null==q?void 0:q.hospitalId){t=q.hospitalId,e.__awaiter(void 0,void 0,void 0,(function(){var n,a;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.callApi(s.getCarePath(s.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:r.domainLocales[I]}),"get")];case 1:return n=e.sent(),(null===(a=null==n?void 0:n._data)||void 0===a?void 0:a.branch)&&ke(null==n?void 0:n._data.branch),[2]}}))}))}var t,n;if(null==q?void 0:q.doctorId){n=q.doctorId,e.__awaiter(void 0,void 0,void 0,(function(){var t,a;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.callApi(s.getCarePath(s.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:n,website_url:r.domainLocales[I]}),"get")];case 1:return t=e.sent(),(null===(a=null==t?void 0:t._data)||void 0===a?void 0:a.doctor)&&Te(null==t?void 0:t._data.doctor),[2]}}))}))}}),[q.hospitalId,q.doctorId]);var Se=(null==be?void 0:be.valid_outpatient)||(null==be?void 0:be.valid_telemedicine),Pe=((null==ye?void 0:ye.total_available_service)||(null==ye?void 0:ye.total_available_doctor))>0,xe=P&&(Se||Pe);return g.default.createElement(s.TogetherAuthConfigContextProvider,{defaultParams:{_joinCommunityIds:[null===(u=null==b?void 0:b.community)||void 0===u?void 0:u.id],_joinTopicIds:null===(d=null==b?void 0:b.topics)||void 0===d?void 0:d.map((function(e){return e.id}))}},g.default.createElement(s.StyledCardPost,{className:p,style:v,"data-is-reply":!!E,"data-is-marrybaby":M,"data-has-booking":xe},"reply"===C&&g.default.createElement(o.Divider,{className:"top-divider",type:"solid"}),g.default.createElement(s.CardAuthor,{avatar:Ce,name:he,username:we,email:null==q?void 0:q.email,time:H,className:"post-author ".concat(ge?"with-popover":""),type:C,userId:null==q?void 0:q.id,role:null==q?void 0:q.role,expertId:null==q?void 0:q.partnerId,title:null==q?void 0:q.title,doctorId:null==q?void 0:q.doctorId,hospitalId:null==q?void 0:q.hospitalId,hasQuickBooking:xe,handleMakeAppointment:x}),g.default.createElement($,{className:"post-content-wrapper",replyingTo:ne,mentionedUser:X,description:te,mentions:J}),g.default.createElement("span",null),g.default.createElement("span",null),Z&&Z.length>0?g.default.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},g.default.createElement(Y,{images:Z,authorName:null==q?void 0:q.username})):null,Z&&0!==Z.length||!Q?null:g.default.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},g.default.createElement(y,{url:Q})),"most-engaging"!==C?g.default.createElement(g.default.Fragment,null,g.default.createElement(s.CardReactions,{type:s.CardReactionType.reply,loveCount:D,replyCount:fe,className:"post-reaction",liked:K,isReplied:ce,hideCommentIcon:"reply"===C,onCommentClick:function(){return ae((function(){return pe((function(e){return!e}))}))},onCommentCountClick:function(){return ae((function(){pe(!0)}))},onLikeClick:function(){return ae((function(){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return F?[4,z({commentId:F,setLike:!K,locale:I})]:[3,2];case 1:1===t.sent().status&&j((function(t){return e.__assign(e.__assign({},t),{liked:!K,countLikes:t.countLikes+(K?-1:1)})})),t.label=2;case 2:return[2]}}))}))}))}}),me&&g.default.createElement(G,{replyingId:k||B.id,replyToName:q.name||q.username||"",isReply:!0,onClose:function(){return pe(!1)},onPostSuccess:function(e){"reply"===C?_&&_(e):ue(e)},post:b,replyingUser:q}),"comment"===C&&U&&U.length>0?g.default.createElement("div",{className:"comment-reply-wrapper"},null===(m=null==ve?void 0:ve.slice(0,re))||void 0===m?void 0:m.map((function(t){return g.default.createElement(ie,{key:t.id,comment:t,type:"reply",className:"comment-reply-item",level:E+1,replyingId:F,onPostCommentSuccess:ue,post:b,onDeleteComment:function(){j((function(n){return e.__assign(e.__assign({},n),{replies:n.replies.filter((function(e){return e.id!==t.id})),countReplies:n.countReplies-1})}))},handleMakeAppointment:x,hasQuickBookingEnable:P})})),fe>re&&g.default.createElement(g.default.Fragment,null,g.default.createElement(o.Divider,{className:"top-divider",type:"solid"}),g.default.createElement(n.Button,{className:"more-cmt",size:"lg",color:"ghost",onClick:function(){return se((function(e){return e+4}))}},L("comment.seeMoreReplies",{count:fe-re}),g.default.createElement("img",{className:"chevron-right",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12L10 8L6 4' stroke='%232D87F3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e"})))):null):null,ge&&g.default.createElement(oe,{onDeleteComment:T,className:"popover",commentId:B.id})))},le="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='%23595959' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",re="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",se="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 5.33337C13.1046 5.33337 14 4.43794 14 3.33337C14 2.2288 13.1046 1.33337 12 1.33337C10.8954 1.33337 10 2.2288 10 3.33337C10 4.43794 10.8954 5.33337 12 5.33337Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4 10C5.10457 10 6 9.10457 6 8C6 6.89543 5.10457 6 4 6C2.89543 6 2 6.89543 2 8C2 9.10457 2.89543 10 4 10Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M12 14.6666C13.1046 14.6666 14 13.7712 14 12.6666C14 11.5621 13.1046 10.6666 12 10.6666C10.8954 10.6666 10 11.5621 10 12.6666C10 13.7712 10.8954 14.6666 12 14.6666Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.72668 9.00665L10.28 11.66' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M10.2734 4.33997L5.72668 6.9933' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",ce=function(n){var a=n.authorEmail,o=n.onDeletePost,l=n.shareUrl,r=n.post,c=n.className,u=void 0===c?"":c,d=n.popoverClassName,m=void 0===d?"":d,p=n.onBookmark,v=n.onRemoveBookmark,f=n.onEditPost,h=t.useContext(s.TogetherComponentGlobalContext),C=h.data,w=C.locale,E=C.userInfo,y=C.togetherUserId,k=C.env.isMarryBaby,_=h.action.pushNotifications,b=i.useTranslations().t,T=t.useState(!1),S=T[0],x=T[1],N=t.useState(!1),I=N[0],A=N[1],M=t.useState(!1),L=M[0],R=M[1],B=s.useTogetherAuthRequiredAction().authActionWrapper,j=a&&(null==E?void 0:E.email)&&a===String(null==E?void 0:E.email);return g.default.createElement("div",{className:u,onClick:function(e){e.preventDefault(),e.stopPropagation()}},L&&g.default.createElement(s.SharePopup,{url:l,text:null==r?void 0:r.title,onClose:function(){return R(!1)}}),I&&g.default.createElement(O,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:b("popup.deletePost.title"),description:b("popup.deletePost.description"),acceptText:b("popup.deletePost.accept"),cancelText:b("popup.deletePost.cancel"),onAccept:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:if(!(null==r?void 0:r.id)||S)return[2];x(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,P({id:r.id,locale:w})];case 2:return 1===(null==(t=e.sent())?void 0:t.status)&&(null==o||o()),[3,4];case 3:return e.sent(),[3,4];case 4:return x(!1),[2]}}))}))},onClose:function(){return A(!1)}}),g.default.createElement(s.TreePopoverMenu,{className:m,toggleButtonContent:g.default.createElement("img",{src:k?te:ne}),position:"bottom",align:"end",buttonProps:{isLoading:S},data:j?{isShowheader:!1,type:"list",list:[{icon:se,label:b("morePopover.share"),onClick:function(){return R(!0)}},{icon:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.16952 3.2356H2.99484C2.6785 3.2356 2.37512 3.36126 2.15143 3.58495C1.92774 3.80863 1.80208 4.11202 1.80208 4.42836V12.7777C1.80208 13.094 1.92774 13.3974 2.15143 13.6211C2.37512 13.8448 2.6785 13.9705 2.99484 13.9705H11.3442C11.6605 13.9705 11.9639 13.8448 12.1876 13.6211C12.4113 13.3974 12.537 13.094 12.537 12.7777V8.60303' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M11.6425 2.341C11.8798 2.10375 12.2016 1.97046 12.5371 1.97046C12.8726 1.97046 13.1944 2.10375 13.4317 2.341C13.6689 2.57826 13.8022 2.90005 13.8022 3.23558C13.8022 3.57111 13.6689 3.89289 13.4317 4.13015L7.76607 9.79578L5.38054 10.3922L5.97692 8.00663L11.6425 2.341Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",label:b("actionPopover.edit"),onClick:f},{icon:ae,label:b("actionPopover.delete"),onClick:function(){B((function(){return A(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:se,label:b("morePopover.share"),onClick:function(){return R(!0)}},{icon:(null==r?void 0:r.bookmarked)?le:re,label:(null==r?void 0:r.bookmarked)?b("morePopover.unsavePost"):b("morePopover.savePost"),onClick:function(){B((function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return(null==E?void 0:E.id)&&(null==r?void 0:r.id)?(null==r?void 0:r.bookmarked)?[4,s.callApiWithAuth(s.getApiPath(s.PATHS.BOOKMARK.DELETE,{_locale:w}),"DELETE",{data:{post_id:String(r.id)}})]:[3,2]:[2];case 1:return 1===(null==(t=e.sent())?void 0:t.status)?(_({title:"",message:"Removed saved post",type:"success",displayIcon:re}),v&&v()):_({title:"",message:"Remove failed",type:"danger",displayIcon:re}),[3,4];case 2:return[4,s.callApiWithAuth(s.getApiPath(s.PATHS.BOOKMARK.CREATE,{_locale:w}),"POST",{data:{user_id:y||E.id,post_id:r.id}})];case 3:1===(null==(t=e.sent())?void 0:t.status)?(_({title:"",message:"Post saved",type:"success",displayIcon:le}),p&&p()):_({title:"",message:"Post saved failed",type:"danger",displayIcon:re}),e.label=4;case 4:return[2]}}))}))}))}},{icon:Z,label:b("morePopover.report"),subTree:{title:b("morePopover.report.title"),description:b("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(s.REPORT_REASON_MAP).map((function(e){return{label:s.REPORT_REASON_MAP[e].label,reason:s.REPORT_REASON_MAP[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:b(e.label),subTree:{title:b("morePopover.reportSubmit.title"),description:b("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return g.default.createElement(q,{reason:e.reasonValue,reasonText:b(e.reason),postId:null==r?void 0:r.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},ue=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){var a,o,i,l;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.callApiWithOptionalAuth(s.getApiPath(s.PATHS.COMMENT.LIST,{postId:t,_locale:n,sort:"popularity",perPage:1,withoutReply:1}),"GET")];case 1:return a=e.sent(),[2,null===(l=null===(i=null===(o=null==a?void 0:a.data)||void 0===o?void 0:o.comments)||void 0===i?void 0:i.map(s.formatComment))||void 0===l?void 0:l[0]]}}))}))},de=Object.freeze({__proto__:null});exports.CardLink=y,exports.CardPost=function(a){var o=a.className,l=a.style,r=a.hideViewMoreComment,c=a.showMostEngaging,u=a.onCommentClick,d=a.onCommentCountClick,m=a.onMostEngagingCommentClick,p=a.onPostCommentSuccess,v=a.disableCardLink,f=a.disableShortenContent,C=a.onDeletePost,w=a.onEditPost,E=a.post,T=a.mostEngagingComment,P=a.onDeleteComment,x=a.showInputComment,N=a.InlineCommentsComponent,I=a.hasQuickBookingEnable,A=a.handleMakeAppointment,M=t.useState(E),L=M[0],R=M[1],B=t.useState(!1),j=B[0],F=B[1],D=t.useState(T),O=D[0],H=D[1],W=L.community,U=L.topics,z=L.author,V=L.slug,Z=L.isPin,q=L.liked,K=L.scheduleDateTime,Q=L.createdAt,X=L.photos,J=L.mentions,te=L.title,ne=L.description,ae=L.previewUrl,oe=L.likesCount,le=L.commentsCount,re=L.id,se=L.commented,de=t.useContext(s.TogetherComponentGlobalContext),me=de.data,pe=me.locale,ve=me.env,fe=ve.isMarryBaby,ge=ve.togetherBasePath,he=de.action.pushNotifications,Ce=i.useTranslations().t,we=t.useState(x),Ee=we[0],ye=we[1],ke="".concat(ge,"/").concat((null==W?void 0:W.slug)||"_","/").concat(V||""),_e="".concat(s.getCurrentBaseUrl(pe)).concat(ke),be=s.useTogetherAuthRequiredAction((null==W?void 0:W.slug)?{_joinCommunityIds:[W.id],_joinTopicIds:null==U?void 0:U.map((function(e){return e.id}))}:void 0).authActionWrapper,Te=t.useState(!1),Se=Te[0],Pe=Te[1];t.useEffect((function(){ye(x)}),[x]);var xe=(null==z?void 0:z.name)||(null==z?void 0:z.username)||"",Ne=(null==z?void 0:z.username)||(null==z?void 0:z.name)||"",Ie=null==z?void 0:z.avatar,Ae=t.useState(null),Me=Ae[0],Le=Ae[1],Re=t.useState(null),Be=Re[0],je=Re[1];t.useEffect((function(){if(null==z?void 0:z.hospitalId){t=z.hospitalId,e.__awaiter(void 0,void 0,void 0,(function(){var n,a;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.callApi(s.getCarePath(s.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:s.domainLocales[pe]}),"get")];case 1:return n=e.sent(),(null===(a=null==n?void 0:n._data)||void 0===a?void 0:a.branch)&&Le(null==n?void 0:n._data.branch),[2]}}))}))}var t,n;if(null==z?void 0:z.doctorId){n=z.doctorId,e.__awaiter(void 0,void 0,void 0,(function(){var t,a;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.callApi(s.getCarePath(s.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:n,website_url:s.domainLocales[pe]}),"get")];case 1:return t=e.sent(),(null===(a=null==t?void 0:t._data)||void 0===a?void 0:a.doctor)&&je(null==t?void 0:t._data.doctor),[2]}}))}))}}),[z.hospitalId,z.doctorId]);var Fe=(null==Be?void 0:Be.valid_outpatient)||(null==Be?void 0:Be.valid_telemedicine),De=((null==Me?void 0:Me.total_available_service)||(null==Me?void 0:Me.total_available_doctor))>0,Oe=I&&(Fe||De);t.useEffect((function(){e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return re&&le&&c&&!(null==T?void 0:T.id)?[4,ue(re,pe)]:[3,2];case 1:t=e.sent(),H(t),e.label=2;case 2:return[2]}}))}))}),[re,pe,le,c,null==T?void 0:T.id]),t.useEffect((function(){H(T)}),[null==T?void 0:T.id]);var He=function(t){return e.__awaiter(void 0,void 0,void 0,(function(){var n;return e.__generator(this,(function(a){switch(a.label){case 0:return le>1&&(null==O?void 0:O.id)&&(null==O?void 0:O.id)===(null==t?void 0:t.id)?[4,ue(re,pe)]:[3,2];case 1:n=a.sent(),H(n),a.label=2;case 2:return R((function(t){return e.__assign(e.__assign({},t),{commentsCount:t.commentsCount-1})})),P&&P(t),[2]}}))}))};return g.default.createElement(s.TogetherAuthConfigContextProvider,{defaultParams:(null==W?void 0:W.slug)?{_joinCommunityIds:[W.id],_joinTopicIds:null==U?void 0:U.map((function(e){return e.id}))}:void 0},j&&g.default.createElement(s.SharePopup,{url:_e,avatar:s.DEFAULT_IMG,text:te,onClose:function(){return F(!1)}}),g.default.createElement(s.StyledCardPost$1,{className:o,style:l,"data-is-marrybaby":fe},Z?g.default.createElement(_,{className:"post-pin"}):null,g.default.createElement("div",{style:{position:"relative"}},g.default.createElement(s.CardAuthor,{avatar:Ie,name:xe,username:Ne,url:v?void 0:ke,email:null==z?void 0:z.email,time:K||Q,community:W,className:"post-author",role:null==z?void 0:z.role,userId:null==z?void 0:z.id,expertId:null==z?void 0:z.partnerId,doctorId:null==z?void 0:z.doctorId,hospitalId:null==z?void 0:z.hospitalId,title:null==z?void 0:z.title,hasQuickBooking:Oe,handleMakeAppointment:A}),g.default.createElement(ce,{authorEmail:String(null==z?void 0:z.email),onDeletePost:C,shareUrl:_e,post:L,className:"popover",onEditPost:w})),g.default.createElement("a",{href:v?void 0:ke,className:"post-content-link-wrapper"},te&&g.default.createElement(n.Heading,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},h.default(te)),g.default.createElement($,{className:"post-content-wrapper",description:ne,disableShortenContent:f,mentions:J})),g.default.createElement("span",null),g.default.createElement("span",null),g.default.createElement("div",{key:"tag-topic"},U&&U.length>0?g.default.createElement(k,{topics:U,className:"post-topics"}):null),g.default.createElement("div",{key:"social-preview"},(null==L?void 0:L.introUrl)?g.default.createElement("div",{className:"social-preview-wrapper ".concat((null==X?void 0:X.length)?"has-image":"")},g.default.createElement(ee,{url:L.introUrl,image:L.bannerImage})):null),g.default.createElement("div",{key:"image-preview"},(null==X?void 0:X.length)?g.default.createElement("div",{className:"image-preview-wrapper"},g.default.createElement(Y,{images:X,authorName:null==z?void 0:z.name})):null),g.default.createElement("div",{key:"link-preview"},(null==L?void 0:L.introUrl)||(null==X?void 0:X.length)||!(null==ae?void 0:ae.url)?null:g.default.createElement("div",{className:"link-preview-wrapper"},g.default.createElement(y,{title:ae.title,url:ae.url,image:ae.image}))),g.default.createElement(s.CardReactions,{type:s.CardReactionType.post,loveCount:oe,replyCount:le,className:"post-reaction ".concat((null==X?void 0:X.length)||(null==ae?void 0:ae.url)?"hide-top-border":""),liked:Se?!q:q,isReplied:se,onCommentClick:function(){return be((function(){u?u():ye((function(e){return!e}))}))},onCommentCountClick:function(){be((function(){fe?ye(!0):d?d():!v&&(window.location.href=ke)}))},onShareClick:function(){F(!0)},onLikeClick:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(n){switch(n.label){case 0:if(!re||Se)return[2];Pe(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,S({id:re,locale:pe})];case 2:return 1!==(null==(t=n.sent())?void 0:t.status)?he(b(Ce)):R((function(t){return e.__assign(e.__assign({},t),{likesCount:(t.likesCount||0)+(t.liked?-1:1),liked:!t.liked})})),[3,4];case 3:return n.sent(),he(b(Ce)),[3,4];case 4:return Pe(!1),[2]}}))}))},showingMostEngaging:!(!c||!(null==O?void 0:O.id))}),Ee&&g.default.createElement(G,{isMainCmt:!x,onClose:function(){return ye(!1)},onPostSuccess:function(t){0!==le||(null==O?void 0:O.id)||H(t),R((function(t){return e.__assign(e.__assign({},t),{commentsCount:t.commentsCount+1,commented:!0})})),p&&p(t)},post:L}),c&&(null==O?void 0:O.id)?g.default.createElement("div",{className:"most-engaging-wrapper",onClick:function(e){m?(e.stopPropagation(),m()):window.location.href=ke}},g.default.createElement(ie,{hasQuickBookingEnable:I,handleMakeAppointment:A,comment:O,onDeleteComment:function(){He&&He(O)},className:"most-engaging-comment",type:"most-engaging",key:O.id}),le>1&&!r&&g.default.createElement(n.Button,{className:"see-more-comments",color:"ghost",size:"md"},Ce("comment.seeMoreComments",{count:le-1}))):null,N))},exports.CardPostPopoverMore=ce,exports.CardReply=ie,exports.CardReplyPopover=oe,exports.CreateNewPostContent=function(l){var c=l.className,u=l.style,d=l.onPostCreatedEdited,m=l.onClose,p=l.communities,v=void 0===p?[]:p,f=l.forceSelectCommunity,C=l.forceSelectTopics,w=l.articleId,E=l.optionalTopic,y=l.editPostData,k=l.defaultCommunity,_=l.defaultTopics,S=l.noFetchTopic,P=l.hideTopicList,A=!!(null==y?void 0:y.id),M=t.useContext(s.TogetherComponentGlobalContext),L=M.data,B=L.locale,D=L.env.isMarryBaby,O=M.action,H=O.pushNotifications,W=O.sanitizeFunction,U=i.useTranslations().t,z=t.useState(!1),V=z[0],G=z[1],Z=t.useState(""),q=Z[0],$=Z[1],K=t.useState(""),Q=K[0],X=K[1],J=t.useState(f?{label:f.name,value:"".concat(f.id||"","-").concat(f.mappedCategoryId||"")}:{label:U("community.choose"),value:""}),Y=J[0],ee=J[1],te=t.useState(e.__spreadArray([],C,!0)||[]),ne=te[0],ae=te[1],oe=t.useState([]),ie=oe[0],le=oe[1],re=t.useState([]),se=re[0],ce=re[1],ue=f||v.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===Y.value})),de=f?[f]:v.filter((function(e){return e.isActive})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),me=t.useState(null),pe=me[0],ve=me[1],fe=t.useState([]),ge=fe[0],he=fe[1],Ce=q&&h.default(Q)&&(E||!E&&ne.length>0)&&ue&&(!ie||ie.length<=s.MAX_IMAGE_UPLOADS)&&!(null==ge?void 0:ge.length)&&!V;t.useEffect((function(){if(y){var e=y;$(e.title||""),X(s.decodeMention(s.decodePostUrl(e.description||"","edit"),e.mentions)),ee({label:e.community.name,value:"".concat(e.community.id||"","-").concat(e.community.mappedCategoryId||"")}),ae(e.topics||[]),le(e.photos||[])}else k&&ee({label:k.name,value:"".concat(k.id||"","-").concat(k.mappedCategoryId||"")}),_&&ae(_)}),[]);var we=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o,i,l,r,c,u,p,v,f;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,x({title:q,description:Q,communityId:String((null==ue?void 0:ue.id)||""),imageFiles:ie,previewUrl:pe,topicIds:null==ne?void 0:ne.map((function(e){return String(e.id||"")})).filter(Boolean),locale:B,sanitizeFunction:W,categoryCommunityId:String((null==ue?void 0:ue.mappedCategoryId)||""),categoryTopicIds:null==ne?void 0:ne.map((function(e){return String(e.mappedCategoryId||"")})).filter(Boolean)})];case 1:return t=e.sent(),w&&t.append("article_id",w),A?(null==y?void 0:y.id)?[4,I({id:y.id,formData:t,locale:B})]:[3,3]:[3,4];case 2:n=e.sent(),e.label=3;case 3:return[3,6];case 4:return[4,N({formData:t,locale:B,isArticleComment:!(null==ue?void 0:ue.id)&&!!(null==ue?void 0:ue.mappedCategoryId)})];case 5:n=e.sent(),e.label=6;case 6:return(null==(a=null==n?void 0:n.data)?void 0:a.id)&&!(null===(i=null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o.moderation)||void 0===i?void 0:i.type)?(H({message:U("createPost.popup.success"),type:"success"}),function(e){d&&d(s.formatPost(e),A),m&&m()}(a)):"banned"===(null===(r=null===(l=null==n?void 0:n.messages)||void 0===l?void 0:l.moderation)||void 0===r?void 0:r.type)?(H({title:U("notification.post.blocked.title"),message:U("notification.post.blocked.message"),type:"danger"}),n.messages.moderation.words&&ce(n.messages.moderation.words)):"suspect"===(null===(u=null===(c=null==n?void 0:n.messages)||void 0===c?void 0:c.moderation)||void 0===u?void 0:u.type)?(H({title:U("notification.post.suspect.title"),message:U("notification.post.suspect.message"),type:"warning"}),m&&m()):(null===(v=null===(p=null==n?void 0:n.messages)||void 0===p?void 0:p.find)||void 0===v?void 0:v.call(p,(function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(H({message:U("notification.suspend.message"),type:"danger"}),m&&m()):H({message:(null===(f=null==n?void 0:n.messages)||void 0===f?void 0:f[0])||U("notification.failure"),type:"danger"}),[2]}}))}))};return g.default.createElement(s.StyledCreateNewPost,{className:c,style:u},g.default.createElement("div",{className:"input-group-container"},g.default.createElement(j,{className:"input-group",bannedWords:se,value:q,onChange:$}),g.default.createElement(R,{className:"input-group",bannedWords:se,value:Q,onChange:X,onPreviewUrlChange:ve,onInvalidUrlsChange:he,onImageFilesChange:le,imageFiles:ie}),g.default.createElement("div",{className:"input-group"},g.default.createElement(a.Text,{size:"p4",className:"input-group-label"},U("admin.community")),g.default.createElement(o.Dropdown,{options:(null==de?void 0:de.map((function(e,t){return{label:e.name,value:"".concat(e.id||"","-").concat(e.mappedCategoryId||"")}})))||[],id:"community-picker",placeholder:U("community.choose"),value:Y,onChange:function(e){ee({label:e.label,value:String(e.value)}),ae([])},disabled:!!f}),g.default.createElement(a.Text,{size:"sm",className:"warning",color:r.theme.colors.gray400},"* ",U("commentPopup.warning.newPost"))),!P&&g.default.createElement("div",{className:"input-group"},g.default.createElement(a.Text,{size:"p4",className:"input-group-label"},U("tab.topic")),g.default.createElement("div",{className:"input-notification"},g.default.createElement("img",{src:ue?"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%232D87F3'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e":T}),g.default.createElement(a.Text,{size:"base",color:r.theme.colors.gray500},U(ue?"createPost.popup.primary":"createPost.popup.warning"))),ue&&g.default.createElement(F,{className:"tag-list",communityId:ue.id,forceTopics:C,onChange:ae,selectedTopics:ne,noFetch:S}))),g.default.createElement(n.Button,{theme:D?"marryBaby":"helloSites",className:"submit-btn",size:"lg",onClick:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:if(!Ce||V)return[3,5];G(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,we()];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),console.error(t),H(b(U)),[3,4];case 4:G(!1),e.label=5;case 5:return[2]}}))}))},isDisabled:!Ce,isLoading:V},U("createPost.popup.submit")))},exports.CreatePostDescription=R,exports.CreatePostTitle=j,exports.ImagePreviewPopup=K,exports.InputCommentBar=G,exports.LabelPin=_,exports.PopupDanger=O,exports.PostContent=$,exports.PostImagePreview=Y,exports.PostSingleImageViewPopup=X,exports.SubmitReportForm=q,exports.TagTopic=k,exports.TopicSelectList=F,exports.types=de;