@hhgtech/hhg-components 1.19.18 → 1.19.19
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.
- package/build/components/molecules/index.d.ts +2 -1
- package/build/esm/index.js +1 -1
- package/build/esm/together.js +1 -1
- package/build/esm/{types-4f1b39fd.js → types-05e4d87b.js} +1 -1
- package/build/index.js +1 -1
- package/build/together.js +1 -1
- package/build/{types-2b869035.js → types-8f709939.js} +1 -1
- package/package.json +1 -1
|
@@ -32,7 +32,8 @@ export { LanguageSwitcher } from './languageSwitcher';
|
|
|
32
32
|
export type { Props as LanguageSwitcherProps } from './languageSwitcher';
|
|
33
33
|
export { AmpNextPage } from './ampNextPage';
|
|
34
34
|
export type { Props as AmpNextPageProps } from './ampNextPage';
|
|
35
|
-
export { DateRangePicker
|
|
35
|
+
export { DateRangePicker } from './dateRangePicker';
|
|
36
|
+
export type { DateRangePickerProps } from './dateRangePicker';
|
|
36
37
|
export type { DateRangeInterval } from './dateRangePicker/types';
|
|
37
38
|
export { ChildCard } from './childCard';
|
|
38
39
|
export type { ChildCardProps } from './childCard';
|
package/build/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{i as Types,a as ageGenerate,u as useFbDataLayer}from"./ageGenerate-61e2769b.js";export{c as Constants}from"./constants-17d17987.js";export{A as Alert,v as AmpNextPage,g as ArticleCard,B as Badge,a as BorderHeading,h as Breadcrumbs,n as Carousel,i as CategoryCard,C as Checkbox,j as CheckboxGroup,t as CookieAcceptConfirm,D as DatePicker,w as DateRangePicker,F as FileDropdown,s as FloatButtonGroup,E as Footer,G as Grid,I as IconText,L as Layout,M as Modal,y as NavigationBar,N as NavigationLayout,P as Pagination,f as Progress,k as ProgressBar,R as Radio,l as RadioGroup,e as RateStars,u as SeoHead,S as Shadow,m as SideMenu,x as SiteWide,b as Slider,o as StatisticCard,z as StickySponsoredBy,r as SurveyThankyouCard,p as Table,q as Tabs,T as Tag,c as Toggle,U as UnderlinedLink,d as Uploader}from"./index-84fac470.js";export{A as Avatar,f as CardAuthor,C as CardReactions,D as DefaultComponentGlobalContextData,G as GlobalData,b as LabelSortPin,e as LabelSorting,L as Loading,l as PopoverMenu,P as Popup,h as PopupDoctor,g as PopupExpert,j as PopupFrame,i as PopupHospital,k as ShareBox,S as SharePopup,T as TogetherAuthConfigContext,a as TogetherAuthConfigContextProvider,m as TogetherComponentGlobalContext,n as TogetherComponentGlobalContextProvider,c as TogetherConstants,d as TogetherDataTransforms,U as UserAvatar,u as useTogetherAuthRequiredAction}from"./index.styled-6559ec11.js";export{d as BabyGrowthSwitch,e as BabyGrowthTooltip,B as Button,C as Container,L as Label,a as Logo,M as Menu,P as PureInput,R as RadioImageGroup,T as Text,b as TextArea,c as TextDivider}from"./index.styled-c5e035f3.js";export{D as Divider,a as Dropdown}from"./index-a74b53cb.js";export{D as DoctorInfo,F as Flag,L as LanguageSwitcher,M as MobileBottomNavigation,b as MobileBottomNavigationIcon,h as NavigationLogoutPopup,i as NavigationProfileButton,N as NavigationV2,P as ProfilePopup,S as ScrollList,a as SurveyQuestionCard,U as UserProfileNavigation,e as UserProfileNavigationHeader,f as UserProfileNavigationStats,d as defaultTranslation,g as getNavMenuContent,c as getNavMenuContentWithCache}from"./index-448bb306.js";export{H as Heading}from"./index-e3b386f9.js";export{I as Input}from"./index-e25a976f.js";export{d as BabyGrowthChooseProfileDrawer,B as BabyGrowthGender,a as BabyGrowthLegend,b as BabyGrowthProfileRadio,c as BabyGrowthRecord,C as ChildCard,I as Icon}from"./index-6e0cbc08.js";export{D as Drawer}from"./index.styled-c1edfd6f.js";export{B as Breakpoints,M as MediaQueries,h as fadeIn,i as formatUrlWithPageParam,j as getBoundariesFromMediaQueryKey,k as getPopupWrapperDom,m as makeParams,a as slideInDown,b as slideInLeft,c as slideInRight,s as slideInUp,e as slideOutDown,f as slideOutLeft,g as slideOutRight,d as slideOutUp,t as toggleNoScroll,u as useTranslations}from"./useTranslations-d76b98a9.js";export{M as MEASURE_ELEMENT_CLASS,u as useScrollbarSize}from"./useScrollbarSize-99db33e1.js";export{T as TranslationsProvider,t as translationsMap}from"./translationsProvider-3b4b064d.js";export{T as TranslationsContext,d as defaultTranslations}from"./translationsContext-221a5963.js";export{C as CardLink,i as CardPost,j as CardPostPopoverMore,k as CardReply,l as CardReplyPopover,a as CreateNewPostContent,b as CreatePostDescription,c as CreatePostTitle,f as ImagePreviewPopup,I as InputCommentBar,L as LabelPin,P as PopupDanger,e as PostContent,h as PostImagePreview,g as PostSingleImageViewPopup,S as SubmitReportForm,T as TagTopic,t as TogetherTypes,d as TopicSelectList}from"./types-
|
|
1
|
+
export{i as Types,a as ageGenerate,u as useFbDataLayer}from"./ageGenerate-61e2769b.js";export{c as Constants}from"./constants-17d17987.js";export{A as Alert,v as AmpNextPage,g as ArticleCard,B as Badge,a as BorderHeading,h as Breadcrumbs,n as Carousel,i as CategoryCard,C as Checkbox,j as CheckboxGroup,t as CookieAcceptConfirm,D as DatePicker,w as DateRangePicker,F as FileDropdown,s as FloatButtonGroup,E as Footer,G as Grid,I as IconText,L as Layout,M as Modal,y as NavigationBar,N as NavigationLayout,P as Pagination,f as Progress,k as ProgressBar,R as Radio,l as RadioGroup,e as RateStars,u as SeoHead,S as Shadow,m as SideMenu,x as SiteWide,b as Slider,o as StatisticCard,z as StickySponsoredBy,r as SurveyThankyouCard,p as Table,q as Tabs,T as Tag,c as Toggle,U as UnderlinedLink,d as Uploader}from"./index-84fac470.js";export{A as Avatar,f as CardAuthor,C as CardReactions,D as DefaultComponentGlobalContextData,G as GlobalData,b as LabelSortPin,e as LabelSorting,L as Loading,l as PopoverMenu,P as Popup,h as PopupDoctor,g as PopupExpert,j as PopupFrame,i as PopupHospital,k as ShareBox,S as SharePopup,T as TogetherAuthConfigContext,a as TogetherAuthConfigContextProvider,m as TogetherComponentGlobalContext,n as TogetherComponentGlobalContextProvider,c as TogetherConstants,d as TogetherDataTransforms,U as UserAvatar,u as useTogetherAuthRequiredAction}from"./index.styled-6559ec11.js";export{d as BabyGrowthSwitch,e as BabyGrowthTooltip,B as Button,C as Container,L as Label,a as Logo,M as Menu,P as PureInput,R as RadioImageGroup,T as Text,b as TextArea,c as TextDivider}from"./index.styled-c5e035f3.js";export{D as Divider,a as Dropdown}from"./index-a74b53cb.js";export{D as DoctorInfo,F as Flag,L as LanguageSwitcher,M as MobileBottomNavigation,b as MobileBottomNavigationIcon,h as NavigationLogoutPopup,i as NavigationProfileButton,N as NavigationV2,P as ProfilePopup,S as ScrollList,a as SurveyQuestionCard,U as UserProfileNavigation,e as UserProfileNavigationHeader,f as UserProfileNavigationStats,d as defaultTranslation,g as getNavMenuContent,c as getNavMenuContentWithCache}from"./index-448bb306.js";export{H as Heading}from"./index-e3b386f9.js";export{I as Input}from"./index-e25a976f.js";export{d as BabyGrowthChooseProfileDrawer,B as BabyGrowthGender,a as BabyGrowthLegend,b as BabyGrowthProfileRadio,c as BabyGrowthRecord,C as ChildCard,I as Icon}from"./index-6e0cbc08.js";export{D as Drawer}from"./index.styled-c1edfd6f.js";export{B as Breakpoints,M as MediaQueries,h as fadeIn,i as formatUrlWithPageParam,j as getBoundariesFromMediaQueryKey,k as getPopupWrapperDom,m as makeParams,a as slideInDown,b as slideInLeft,c as slideInRight,s as slideInUp,e as slideOutDown,f as slideOutLeft,g as slideOutRight,d as slideOutUp,t as toggleNoScroll,u as useTranslations}from"./useTranslations-d76b98a9.js";export{M as MEASURE_ELEMENT_CLASS,u as useScrollbarSize}from"./useScrollbarSize-99db33e1.js";export{T as TranslationsProvider,t as translationsMap}from"./translationsProvider-3b4b064d.js";export{T as TranslationsContext,d as defaultTranslations}from"./translationsContext-221a5963.js";export{C as CardLink,i as CardPost,j as CardPostPopoverMore,k as CardReply,l as CardReplyPopover,a as CreateNewPostContent,b as CreatePostDescription,c as CreatePostTitle,f as ImagePreviewPopup,I as InputCommentBar,L as LabelPin,P as PopupDanger,e as PostContent,h as PostImagePreview,g as PostSingleImageViewPopup,S as SubmitReportForm,T as TagTopic,t as TogetherTypes,d as TopicSelectList}from"./types-05e4d87b.js";export{B as BookingSearchBar,t as CareTypes}from"./types-0b6d82bd.js";export{c as CareConstants}from"./constants-dc22740c.js";export{a as EcomApiTypes,c as EcomConstants,i as EcomDataFormatter,d as EcomDataTypes,t as EcomTypes}from"./types-0402f8a4.js";export{d as deleteCookie,g as getCookie,s as setCookie}from"./cookieHelper-0e8521c3.js";export{a as abbreviateNumber,l as lazyLoadInstance}from"./number-126ee62e.js";import"react";import"styled-components";export{t as theme}from"./theme-731042bc.js";export{d as getCareApiDomain,g as getCurrentBaseUrl,a as getCurrentSsoUrl,c as getDiscoverApiDomain,b as getTogetherApiDomain}from"./routing-93ed4dbc.js";import"date-fns";import"./tslib.es6-fd0a5c98.js";import"react-range";import"react-id-generator";import"react-day-picker/DayPickerInput";import"react-dom";import"lodash";import"./useOutsideClick-6004483a.js";import"date-fns/locale/en-US";import"date-fns/locale/id";import"date-fns/locale/vi";import"date-fns/locale/zh-TW";import"lodash/debounce";import"react-loading-skeleton";import"date-fns/locale/hi";import"date-fns/locale/ms";import"date-fns/locale/th";import"./core-3d8a3f90.js";import"smoothscroll-polyfill";import"lodash/shuffle";
|
package/build/esm/together.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{f as CardAuthor,C as CardReactions,D as DefaultComponentGlobalContextData,G as GlobalData,b as LabelSortPin,e as LabelSorting,L as Loading,l as PopoverMenu,h as PopupDoctor,g as PopupExpert,j as PopupFrame,i as PopupHospital,k as ShareBox,S as SharePopup,T as TogetherAuthConfigContext,a as TogetherAuthConfigContextProvider,m as TogetherComponentGlobalContext,n as TogetherComponentGlobalContextProvider,c as TogetherConstants,d as TogetherDataTransforms,U as UserAvatar,u as useTogetherAuthRequiredAction}from"./index.styled-6559ec11.js";export{C as CardLink,i as CardPost,j as CardPostPopoverMore,k as CardReply,l as CardReplyPopover,a as CreateNewPostContent,b as CreatePostDescription,c as CreatePostTitle,f as ImagePreviewPopup,I as InputCommentBar,L as LabelPin,P as PopupDanger,e as PostContent,h as PostImagePreview,g as PostSingleImageViewPopup,S as SubmitReportForm,T as TagTopic,t as TogetherTypes,d as TopicSelectList}from"./types-
|
|
1
|
+
export{f as CardAuthor,C as CardReactions,D as DefaultComponentGlobalContextData,G as GlobalData,b as LabelSortPin,e as LabelSorting,L as Loading,l as PopoverMenu,h as PopupDoctor,g as PopupExpert,j as PopupFrame,i as PopupHospital,k as ShareBox,S as SharePopup,T as TogetherAuthConfigContext,a as TogetherAuthConfigContextProvider,m as TogetherComponentGlobalContext,n as TogetherComponentGlobalContextProvider,c as TogetherConstants,d as TogetherDataTransforms,U as UserAvatar,u as useTogetherAuthRequiredAction}from"./index.styled-6559ec11.js";export{C as CardLink,i as CardPost,j as CardPostPopoverMore,k as CardReply,l as CardReplyPopover,a as CreateNewPostContent,b as CreatePostDescription,c as CreatePostTitle,f as ImagePreviewPopup,I as InputCommentBar,L as LabelPin,P as PopupDanger,e as PostContent,h as PostImagePreview,g as PostSingleImageViewPopup,S as SubmitReportForm,T as TagTopic,t as TogetherTypes,d as TopicSelectList}from"./types-05e4d87b.js";import"./tslib.es6-fd0a5c98.js";import"styled-components";import"react";import"./cookieHelper-0e8521c3.js";import"./index.styled-c5e035f3.js";import"./theme-731042bc.js";import"./useTranslations-d76b98a9.js";import"./translationsContext-221a5963.js";import"./number-126ee62e.js";import"./index-e3b386f9.js";import"date-fns";import"date-fns/locale/en-US";import"date-fns/locale/hi";import"date-fns/locale/id";import"date-fns/locale/ms";import"date-fns/locale/th";import"date-fns/locale/vi";import"date-fns/locale/zh-TW";import"./constants-17d17987.js";import"react-id-generator";import"./index-e25a976f.js";import"lodash";import"react-dom";import"./index-a74b53cb.js";import"react-range";import"lodash/debounce";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,e as t,_ as n,a as i}from"./tslib.es6-fd0a5c98.js";import o,{useContext as a,useState as r,useRef as l,useEffect as s,useMemo as c,useCallback as u}from"react";import{T as d,B as m}from"./index.styled-c5e035f3.js";import{a as p,D as v}from"./index-a74b53cb.js";import{u as g,t as h,k as f}from"./useTranslations-d76b98a9.js";import{m as w,z as k,B as C,E as y,F as E,H as b,I as N,b as I,J as T,M as x,K as M,N as _,O as P,Q as L,R as S,V as j,W as B,L as F,X as R,Y as D,_ as O,Z as A,$ as z,a0 as V,a1 as U,a2 as H,y as W,a3 as Z,j as G,a4 as K,a5 as Q,U as X,a6 as J,a7 as Y,a8 as $,u as q,g as ee,a9 as te,aa as ne,ab as ie,ac as oe,ad as ae,ae as re,af as le,ag as se,ah as ce,ai as ue,aj as de,ak as me,al as pe,a as ve,am as ge,f as he,C as fe,an as we,ao as ke,ap as Ce,S as ye,aq as Ee,o as be,ar as Ne,as as Ie,at as Te}from"./index.styled-6559ec11.js";import{t as xe}from"./theme-731042bc.js";import"react-range";import*as Me from"react-dom";import"date-fns";import{I as _e}from"./index-e25a976f.js";import Pe from"lodash/debounce";import{H as Le}from"./index-e3b386f9.js";import{l as Se}from"./number-126ee62e.js";import"styled-components";import{d as je}from"./constants-17d17987.js";var Be=function(i){var c=i.title,u=i.url,m=i.image,p=i.logo,v=i.className,g=i.style,h=i.noRefetch,f=a(w).data,N=f.locale,I=f.env.isMarryBaby,T=r(!1),x=T[0],M=T[1],_=l(h);_.current=h;var P=r(null),L=P[0],S=P[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return _.current?[2]:u?(S((function(e){return n(n({},e),{isFetching:!0})})),y(E(b.FETCH_PREVIEW,{_locale:N}),"POST",{data:{link:u}}).then((function(e){var t,n,i;M(!1),S({title:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.title,url:u,image:(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.image)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.logo)})})).catch((function(){S(null)})),[2]):[2,S(null)]}))}))}),[u]);var j=(null==L?void 0:L.image)||m,B=(null==L?void 0:L.title)||c,F=(null==L?void 0:L.logo)||p,R=(null==L?void 0:L.url)||u,D=R.replace("http://","").replace("https://","").split(/[/?#]/)[0],O=l(!1);return o.createElement(k,{"data-is-marrybaby":I,className:"".concat(v," no-replace-click"),style:g},o.createElement("a",{href:R,target:"_blank",rel:"noreferrer"},j&&o.createElement("div",{className:"link-image-wrapper"},!I&&o.createElement("img",{className:"link-image-blur",src:j,onError:function(e){O.current||(O.current=!0,e.currentTarget.src=C)}}),o.createElement("img",{className:"link-image",src:j,onError:function(e){O.current||(O.current=!0,e.currentTarget.src=C)}})),o.createElement("div",{className:"link-info-container"},o.createElement(d,{size:"n1"},I&&F&&!x&&o.createElement("img",{className:"link-logo",src:F,onError:function(e){return M(!0)}}),D),o.createElement(Le,{tag:"h6"},B))))},Fe=function(e){var t=e.topics,n=e.onClick,i=e.className,s=e.style,c=function(){var e=r(!1),t=e[0],n=e[1],i=l(null),o=l(null),a=l();return{sliding:t,mouseDownHandler:function(e){if(i.current){a.current=setTimeout((function(){n(!0)}),500),o.current={left:i.current.scrollLeft,x:e.clientX};var t=function(e){var t=o.current;if(t){var n=e.clientX-t.x;i.current&&(i.current.scrollLeft=t.left-n)}},r=function(){a.current&&(clearTimeout(a.current),a.current=void 0),n(!1),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}},sliderRef:i,pos:o}}(),u=c.sliding,m=c.mouseDownHandler,p=c.sliderRef,v=a(w),g=v.data.env.togetherBasePath,h=v.action.sanitizeFunction;return o.createElement(N,{ref:p,onClick:n,onMouseDown:function(e){return m(e)},className:"".concat(i," ").concat(u?"sliding":""),style:s},t.map((function(e,t){return o.createElement("a",{className:"tag-link-item",key:t,href:e.isActive&&!e.isHidden?"".concat(g).concat(e.url):void 0},o.createElement(d,{size:"p3"},o.createElement("span",{dangerouslySetInnerHTML:{__html:(null==h?void 0:h(e.name))||e.name}})))})))},Re=function(e){var t=e.onClick;e.color;var n=e.className,i=e.style,r=a(w).data.env.isMarryBaby,l=g().t;return o.createElement(I,{label:o.createElement(o.Fragment,null,r&&o.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"})," ",l("label.pinnedPost")),rightLabel:!r&&o.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:t,color:"white",className:"label-pinned ".concat(n),style:i})},De=function(e){return{message:e("notification.failure"),type:"danger"}},Oe="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",Ae=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,T(E(b.POST.LIKE,{id:i,_locale:o}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},ze=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,T(E(b.POST.DELETE,{id:i,_locale:o}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},Ve=function(n){var i=n.title,o=n.description,a=n.communityId,r=n.imageFiles,l=n.previewUrl,s=n.topicIds,c=n.locale,u=n.sanitizeFunction,d=n.categoryCommunityId,m=n.categoryTopicIds,p=n.introUrl,v=n.bannerUrl,g=n.scheduleTime;return e(void 0,void 0,void 0,(function(){var e,n,h,f,w;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=M(o),h=M(i),f=_(n),e.append("title",h),e.append("description",P(n,u)),d?e.append("category_community",String(d)):a&&e.append("community_id",String(a)),(null==l?void 0:l.title)&&e.append("preview_title",l.title),(null==l?void 0:l.description)&&e.append("preview_description",l.description),(null==l?void 0:l.url)&&e.append("preview_link",l.url),(null==l?void 0:l.image)&&e.append("preview_image",l.image),null==s||s.forEach((function(t){e.append("topics[]",String(t||""))})),null==m||m.forEach((function(t){e.append("category_topics[]",String(t||""))})),(null==r?void 0:r.length)?[4,Promise.all(r.map((function(e,t){return new Promise((function(n){setTimeout((function(){n(L(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=t.sent())||w.filter(Boolean).slice(0,x).forEach((function(t,n){e.append("images[".concat(n,"]"),t)})),[3,3];case 2:e.append("images",""),t.label=3;case 3:return null==f||f.forEach((function(t){e.append("mention_ids[]",t)})),e.append("intro_url",p||""),e.append("banner",v||""),g&&(e.append("post_type","scheduled"),e.append("schedule_datetime",g)),[2,e]}}))}))},Ue=function(n){var i=n.locale,o=n.formData,a=n.isArticleComment;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,T(E(a?b.POST.CREATE_ARTICLE_COMMENT:b.POST.CREATE,{_locale:i}),"POST",{data:o,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},He=function(n){var i=n.id,o=n.locale,a=n.formData;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,T(E(b.POST.UPDATE,{id:i,_locale:o}),"POST",{data:a})];case 1:return[2,e.sent()]}}))}))},We=function(e){var t=e.id,n=e.reason,i=e.locale,o=new FormData;return o.append("reason",n),T(E(b.POST.REPORT,{_locale:i,id:t}),"POST",{data:o})},Ze=function(e,t){var n=r(e||[]),i=n[0],o=n[1];return{onSelectImages:function(n){var a=n.target.files;a&&(t&&e?t((e||i).concat(Array.from(a))):o((function(n){var i=e||n;return t&&t(i.concat(Array.from(a))),i.concat(Array.from(a))})))},onRemoveImage:function(n){if(t&&e){var i=e;i.splice(n,1),t(i.slice())}else o((function(i){var o=e||i;return o.splice(n,1),t&&t(o.slice()),o.slice()}))},onRemoveAllImages:function(){t?t([]):o([])},imageSrcs:c((function(){return(e||i).map((function(e){return"string"==typeof e?e:URL.createObjectURL(e)}))}),[e,i]),imageFiles:e||i}},Ge="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",Ke=function(e){var t=e.className,n=e.style,i=e.bannedWords,a=void 0===i?[]:i,c=e.value,u=e.onChange,m=e.onPreviewUrlChange,p=e.onInvalidUrlsChange,v=e.onImageFilesChange,h=e.imageFiles,f=e.isReplying,w=g().t,k=r(null),C=k[0],y=k[1],E=l(null),b=Ze(h,v),N=b.onSelectImages,I=b.onRemoveImage,T=b.imageSrcs;return s((function(){m&&((null==C?void 0:C.url)?m({title:C.title||"",url:C.url||"",image:C.image||"",description:C.description||""}):m(null))}),[C]),o.createElement(S,{className:t,style:n},o.createElement(d,{size:"p4",className:"description-label"},w("createPost.popup.description")),o.createElement("div",{className:"textarea-control"},o.createElement("div",{className:"textarea-wrapper"},o.createElement(j,{html:c||"",onChange:u,bannedWords:a,onImagePickerClick:function(){var e;return null===(e=E.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:y,onInvalidUrlsChange:p,isReplying:f}))),o.createElement(d,{size:"p4",className:"count-string"},w("character"),": ",B(c||"").length),(!T||0===T.length)&&C&&o.createElement("div",{className:"link-preview-wrapper"},C.isFetching?o.createElement(F,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:C.title,url:C.url||"#",image:C.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return y(null)}}))),o.createElement("input",{ref:E,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:N}),T.length>x?o.createElement("div",{className:"input-notification"},o.createElement("img",{src:Oe}),o.createElement(d,{size:"p4",color:xe.colors.alertWarning},w("createPost.popup.warningImage"))):null,T.length>0&&o.createElement("div",{className:"image-gallery"},T.map((function(e,t){return o.createElement("div",{key:t,className:"image-item"},o.createElement("img",{src:e}),o.createElement("img",{className:"close-btn",src:Ge,onClick:function(){return I(t)}}))}))))},Qe=function(e,t){if(!t)return e;var n=t.limit,i=t.bannedWords,o=void 0===i?[]:i,a="number"==typeof n&&n>=0?e.substring(0,n):e;return R(a,o)},Xe=function(e){var t,n=e.className,i=e.style,a=e.bannedWords,c=void 0===a?[]:a,m=e.value,p=e.onChange,v=g().t,h=r(""),f=h[0],w=h[1],k=l(null);s((function(){if(k.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=k.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[k]);var C=(null==c?void 0:c.join(","))||"";s((function(){var e;if(C){var t=null===(e=k.current)||void 0===e?void 0:e.innerText;if(t){var n=R(t,c);n!==t&&(p&&p(n),w(n))}}}),[C]);var y=u(Pe((function(e){if(k.current){var t=Qe(k.current.innerText,{limit:120,bannedWords:c});p&&p(t),w(t)}}),300),[]);return s((function(){setTimeout((function(){var e;null===(e=k.current)||void 0===e||e.focus()}),500)}),[]),o.createElement(D,{className:n,style:i},o.createElement(_e,{name:"title",value:m||f,size:"md",label:v("createPost.title"),CustomInput:o.createElement(O,{innerRef:k,html:m||f,onChange:function(e){if(k.current&&k.current.innerText!==(m||f)){var t=Qe(k.current.innerText,{bannedWords:c});p&&p(t),w(t),y(k.current.innerText)}},className:"title-input"})}),o.createElement(d,{size:"p4",className:"count-string"},v("createPost.popup.wordCount",{count:(null===(t=k.current)||void 0===t?void 0:t.innerText.length)||0,max:120})))},Je=function(n){var u=n.className,d=n.style,m=n.topics,p=n.communityId,v=n.onChange,g=n.isLoading,h=n.disabled,f=n.forceTopics,k=n.selectedTopics,C=n.noFetch,N=a(w).data,I=N.locale,T=N.env.isMarryBaby,x=r(m?i([],m,!0):[]),M=x[0],_=x[1],P=r(k?i([],k,!0):[]),L=P[0],S=P[1],j=r(!1),B=j[0],R=j[1],D=l(m);D.current=m,s((function(){var n;!p||C||(null===(n=D.current)||void 0===n?void 0:n.length)||(_([]),R(!0),e(void 0,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,y(E(b.TOPIC.LIST,{communityId:p,_locale:I}),"GET")];case 1:return e=t.sent(),n=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.topics,Array.isArray(n)&&_((function(){return(null==n?void 0:n.map(z).sort((function(e,t){return(e.order||0)-(t.order||0)})))||[]})),[3,3];case 2:return i=t.sent(),console.log(i),R(!1),[3,3];case 3:return R(!1),[2]}}))})))}),[p,C]);var O=null==m?void 0:m.map((function(e){return e.id})).join("-"),V=null==M?void 0:M.map((function(e){return e.id})).join("-"),U=null==f?void 0:f.map((function(e){return e.id})).join("-");s((function(){m&&void 0!==O&&O!==V&&_(m)}),[m,O,V]);var H=c((function(){return M.filter((function(e){return!(null==f?void 0:f.some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})))}))}),[V,U]);return o.createElement(A,{"data-is-marrybaby":T,className:u,style:d},f.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),H.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:h,selected:(k||L).some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})),onClick:function(){var t=k||L,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),v&&k?v(t.slice()):(v&&v(t.slice()),S(t.slice()))}})})),(g||B)&&o.createElement(F,{className:"topic-spinner"}))},Ye=function(e){var t=e.topic,n=e.disabled,i=e.selected,a=e.onClick;return o.createElement("div",{className:"tag-item"+(i?" --active":""),"data-disabled":n,onClick:n?void 0:a},t.name)},$e=function(n){var l=n.className,c=n.style,u=n.onPostCreatedEdited,v=n.onClose,h=n.communities,f=void 0===h?[]:h,k=n.forceSelectCommunity,C=n.forceSelectTopics,y=n.articleId,E=n.optionalTopic,b=n.editPostData,N=n.defaultCommunity,I=n.defaultTopics,T=n.noFetchTopic,M=n.hideTopicList,_=!!(null==b?void 0:b.id),P=a(w),L=P.data,S=L.locale,j=L.env.isMarryBaby,F=P.action,R=F.pushNotifications,D=F.sanitizeFunction,O=g().t,A=r(!1),z=A[0],Z=A[1],G=r(""),K=G[0],Q=G[1],X=r(""),J=X[0],Y=X[1],$=r(k?{label:k.name,value:"".concat(k.id||"","-").concat(k.mappedCategoryId||"")}:{label:O("community.choose"),value:""}),q=$[0],ee=$[1],te=r(i([],C,!0)||[]),ne=te[0],ie=te[1],oe=r([]),ae=oe[0],re=oe[1],le=r([]),se=le[0],ce=le[1],ue=k||f.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===q.value})),de=k?[k]:f.filter((function(e){return e.isActive})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),me=r(null),pe=me[0],ve=me[1],ge=r([]),he=ge[0],fe=ge[1],we=K&&B(J)&&(E||!E&&ne.length>0)&&ue&&(!ae||ae.length<=x)&&!(null==he?void 0:he.length)&&!z;s((function(){if(b){var e=b;Q(e.title||""),Y(V(U(e.description||"","edit"),e.mentions)),ee({label:e.community.name,value:"".concat(e.community.id||"","-").concat(e.community.mappedCategoryId||"")}),ie(e.topics||[]),re(e.photos||[])}else N&&ee({label:N.name,value:"".concat(N.id||"","-").concat(N.mappedCategoryId||"")}),I&&ie(I)}),[]);var ke=function(){return e(void 0,void 0,void 0,(function(){var e,n,i,o,a,r,l,s,c,d,m,p;return t(this,(function(t){switch(t.label){case 0:return[4,Ve({title:K,description:J,communityId:String((null==ue?void 0:ue.id)||""),imageFiles:ae,previewUrl:pe,topicIds:null==ne?void 0:ne.map((function(e){return String(e.id||"")})).filter(Boolean),locale:S,sanitizeFunction:D,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 e=t.sent(),y&&e.append("article_id",y),_?(null==b?void 0:b.id)?[4,He({id:b.id,formData:e,locale:S})]:[3,3]:[3,4];case 2:n=t.sent(),t.label=3;case 3:return[3,6];case 4:return[4,Ue({formData:e,locale:S,isArticleComment:!(null==ue?void 0:ue.id)&&!!(null==ue?void 0:ue.mappedCategoryId)})];case 5:n=t.sent(),t.label=6;case 6:return(null==(i=null==n?void 0:n.data)?void 0:i.id)&&!(null===(a=null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o.moderation)||void 0===a?void 0:a.type)?(R({message:O("createPost.popup.success"),type:"success"}),function(e){u&&u(W(e),_),v&&v()}(i)):"banned"===(null===(l=null===(r=null==n?void 0:n.messages)||void 0===r?void 0:r.moderation)||void 0===l?void 0:l.type)?(R({title:O("notification.post.blocked.title"),message:O("notification.post.blocked.message"),type:"danger"}),n.messages.moderation.words&&ce(n.messages.moderation.words)):"suspect"===(null===(c=null===(s=null==n?void 0:n.messages)||void 0===s?void 0:s.moderation)||void 0===c?void 0:c.type)?(R({title:O("notification.post.suspect.title"),message:O("notification.post.suspect.message"),type:"warning"}),v&&v()):(null===(m=null===(d=null==n?void 0:n.messages)||void 0===d?void 0:d.find)||void 0===m?void 0:m.call(d,(function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(R({message:O("notification.suspend.message"),type:"danger"}),v&&v()):R({message:(null===(p=null==n?void 0:n.messages)||void 0===p?void 0:p[0])||O("notification.failure"),type:"danger"}),[2]}}))}))};return o.createElement(H,{className:l,style:c},o.createElement("div",{className:"input-group-container"},o.createElement(Xe,{className:"input-group",bannedWords:se,value:K,onChange:Q}),o.createElement(Ke,{className:"input-group",bannedWords:se,value:J,onChange:Y,onPreviewUrlChange:ve,onInvalidUrlsChange:fe,onImageFilesChange:re,imageFiles:ae}),o.createElement("div",{className:"input-group"},o.createElement(d,{size:"p4",className:"input-group-label"},O("admin.community")),o.createElement(p,{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:O("community.choose"),value:q,onChange:function(e){ee({label:e.label,value:String(e.value)}),ie([])},disabled:!!k}),o.createElement(d,{size:"sm",className:"warning",color:xe.colors.gray400},"* ",O("commentPopup.warning.newPost"))),!M&&o.createElement("div",{className:"input-group"},o.createElement(d,{size:"p4",className:"input-group-label"},O("tab.topic")),o.createElement("div",{className:"input-notification"},o.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":Oe}),o.createElement(d,{size:"base",color:xe.colors.gray500},O(ue?"createPost.popup.primary":"createPost.popup.warning"))),ue&&o.createElement(Je,{className:"tag-list",communityId:ue.id,forceTopics:C,onChange:ie,selectedTopics:ne,noFetch:T}))),o.createElement(m,{theme:j?"marryBaby":"helloSites",className:"submit-btn",size:"lg",onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!we||z)return[3,5];Z(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ke()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.error(e),R(De(O)),[3,4];case 4:Z(!1),t.label=5;case 5:return[2]}}))}))},isDisabled:!we,isLoading:z},O("createPost.popup.submit")))},qe=function(e){var t=e.className,n=e.isMarryBaby,i=e.style,l=e.title,c=e.description,u=e.acceptText,p=e.cancelText,v=e.onAccept,g=e.thumbnail,k=e.isThumbnailIcon,C=e.onClose,y=a(w).data.env.isMarryBaby,E="boolean"==typeof n?n:y,b=r(!1),N=b[0],I=b[1];return s((function(){return h(!0),setTimeout((function(){return I(!0)}),0),function(){return h(!1)}}),[]),Me.createPortal(o.createElement(Z,{"data-is-marrybaby":E,className:t,style:i,"data-open":N},o.createElement(G,{className:"popup-frame",isOpen:N,onClose:C},o.createElement("div",{className:"confirm-dialog",onClick:function(e){return e.stopPropagation()}},o.createElement("div",{className:"confirm-content"},g&&o.createElement("div",{className:"thumbnail-container ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:g})),o.createElement(Le,{className:"title",tag:"h2"},l),o.createElement(d,{className:"desc",size:"lg"},c),o.createElement("div",{className:"btn-group"},o.createElement(m,{theme:E?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==v||v(),null==C||C()}},u),o.createElement(m,{theme:E?"marryBaby":"helloSites",size:"md",onClick:C},p)))),E&&g&&o.createElement("div",{className:"thumbnail-container is-mobile ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:g})))),f())},et=function(n){var i=n.postId,o=n.message,a=n.photos,r=n.link,l=n.locale,s=n.sanitizeFunction,c=n.replyingUserId,u=n.replyingUserName,d=n.replyingId;return e(void 0,void 0,void 0,(function(){var e,n,m;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=P(o.replace(/(\ )+/g," "),s),m=_(n),a&&a.length>0?[4,Promise.all(null==a?void 0:a.map((function(e){return L(e,l)})))]:[3,2];case 1:t.sent().filter(Boolean).slice(0,x).forEach((function(t){e.append("images[]",t)})),t.label=2;case 2:return r&&e.append("link",r),null==m||m.forEach((function(t){e.append("mention_ids[]",t)})),e.append("post_id",i),d&&e.append("parent_id",d),c&&(m.unshift(c),n='[mention+id="'.concat(c,'"+name="').concat((u||"").replace('"',"'"),'"]').concat(n),e.append("parent_user_id",String(c))),e.append("content",n),e.append("content",n),[2,e]}}))}))},tt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,T(E(b.COMMENT.CREATE,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},nt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,T(E(b.COMMENT.REPLY,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},it=function(n){var i=n.commentId,o=n.setLike,a=void 0!==o&&o,r=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,T(E(a?b.COMMENT.LIKE:b.COMMENT.UNLIKE,{_locale:r,id:i}),"GET")]}))}))},ot=function(e){var t=e.id,n=e.locale;return T(E(b.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},at=function(i){var c=i.isReply,u=i.className,p=i.onClose,v=i.replyToName,h=i.style,f=i.replyingId,k=i.replyingUser,C=i.onPostSuccess;i.isMainCmt;var y=i.post,E=i.isMarryBaby,b=a(w),N=b.action,I=N.pushNotifications,T=N.sanitizeFunction,x=b.data,M=x.userInfo,_=x.locale,P=x.env.isMarryBaby,L="boolean"==typeof E?E:P,S=g().t,B=Ze(),R=B.onSelectImages,D=B.onRemoveImage,O=B.imageSrcs,A=B.onRemoveAllImages,z=B.imageFiles,V=r(""),U=V[0],H=V[1],W=a(K).trigger,Z=r(!1),G=Z[0],$=Z[1],q=l(null),ee=l(null),te=l(null),ne=r([]),ie=ne[0],oe=ne[1],ae=r([]),re=ae[0],le=ae[1],se=r(null),ce=se[0],ue=se[1];return s((function(){var e;null===(e=te.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout((function(){var e;null===(e=ee.current)||void 0===e||e.focus()}),400)}),[W]),o.createElement(Q,{"data-is-reply":c,className:u,style:h},c&&o.createElement("div",{className:"reply-to-container"},o.createElement(d,{size:"p4"},o.createElement("span",{dangerouslySetInnerHTML:{__html:S("inputComment.replyTo",{name:'<span style="color: #2D87F3; cursor: pointer">@'.concat(v||"","</span>")})}})),o.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 p&&p()}})),o.createElement("div",{className:"input-container",ref:te},o.createElement(X,{className:"avatar-wrapper ".concat(c?"avatar-wrapper-reply":""),avatar:(null==M?void 0:M.id)?M.avatar:J,username:(null==M?void 0:M.name)||(null==M?void 0:M.username)}),o.createElement("input",{ref:q,onChange:R,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),o.createElement(_e,{value:U,name:"input",size:"md",className:"input-wrapper",displayIcon:o.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:o.createElement("div",{className:"as-input"},o.createElement(j,{className:"textarea",html:U,onChange:H,onImagePickerClick:function(){var e;return null===(e=q.current)||void 0===e?void 0:e.click()},bannedWords:re,onPreviewUrlChange:ue,onInvalidUrlsChange:oe,setEditorRef:function(e){return ee.current=e},isReplying:c}))}),o.createElement(m,{theme:L?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:function(){return e(void 0,void 0,void 0,(function(){var e,i,o,a,r,l,s,u,d,m,v,g,h;return t(this,(function(t){switch(t.label){case 0:if(!(null==y?void 0:y.id)||G)return[2];$(!0),t.label=1;case 1:return t.trys.push([1,4,,5]),e=function(e){H(""),A(),p&&p();var t=Y(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),C&&C(t)},[4,et(n({message:U,photos:z,postId:String(y.id),link:null==ce?void 0:ce.url,sanitizeFunction:T,locale:_},c&&f?{replyingUserId:String((null==k?void 0:k.id)||(null===(r=null==y?void 0:y.author)||void 0===r?void 0:r.id)||""),replyingId:f,replyingUserName:(null==k?void 0:k.name)||(null==k?void 0:k.username)||""}:{}))];case 2:return i=t.sent(),[4,c&&f?nt(i,_):tt(i,_)];case 3:return o=t.sent(),(null==(a=null==o?void 0:o.data)?void 0:a.id)&&!(null===(s=null===(l=null==o?void 0:o.messages)||void 0===l?void 0:l.moderation)||void 0===s?void 0:s.type)?e(o):"banned"===(null===(d=null===(u=null==o?void 0:o.messages)||void 0===u?void 0:u.moderation)||void 0===d?void 0:d.type)?(I({title:S("notification.comment.blocked.title"),message:S("notification.comment.blocked.message"),type:"danger"}),o.messages.moderation.words&&le(o.messages.moderation.words)):"suspect"===(null===(v=null===(m=null==o?void 0:o.messages)||void 0===m?void 0:m.moderation)||void 0===v?void 0:v.type)?(I({title:S("notification.comment.suspect.title"),message:S("notification.comment.suspect.message"),type:"warning"}),H(""),A(),p&&p()):(null===(g=null==o?void 0:o.messages)||void 0===g?void 0:g.find((function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(I({message:S("notification.suspend.message"),type:"warning"}),H(""),A(),p&&p()):I({title:"",message:(null===(h=null==o?void 0:o.messages)||void 0===h?void 0:h[0])||S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return t.sent(),I({title:"",message:S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return $(!1),[2]}}))}))},isLoading:G,isDisabled:!!(null==ie?void 0:ie.length)||G||!U||(null==U?void 0:U.length)<2||!U.trim()},o.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==ie?void 0:ie.length)?o.createElement("div",{className:"error-text"},S("notification.limitUrlDomain")):null,(!O||0===O.length)&&ce&&o.createElement("div",{className:"link-preview-wrapper"},ce.isFetching?o.createElement(F,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:ce.title,url:ce.url||"#",image:ce.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return ue(null)}}))),O&&O.length>0&&o.createElement("div",{className:"preview-images-container"},O.map((function(e,t){return o.createElement("div",{key:t,className:"image-src-wrapper"},o.createElement("img",{className:"preview-image",src:e}),o.createElement("img",{src:Ge,className:"icon-close-circle",onClick:function(){return D(t)}}))}))))},rt="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",lt=function(n){var i=n.className,l=n.style,s=n.reason,c=n.reasonText,u=n.onClose,p=n.postId,v=a(w),h=v.data,f=h.locale,k=h.env.isMarryBaby,C=v.action.pushNotifications,y=g().t,E=r(!1),b=E[0],N=E[1];return o.createElement($,{"data-is-marrybaby":k,className:i,style:l},o.createElement("ul",{className:"report-list"},o.createElement("li",{className:"report-item"},o.createElement("img",{src:rt}),o.createElement(d,{className:"__label",color:xe.colors.gray800,size:"p4"},c))),o.createElement(m,{theme:k?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:b,onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!p||b)return[2];N(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,We({id:p,reason:s,locale:f})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(C({message:"Post reported",type:"success"}),u&&u()),[3,4];case 3:return t.sent(),[3,4];case 4:return N(!1),[2]}}))}))}},y("submit")))},st=function(e){var t=e.className,n=e.style,i=e.replyingTo,l=e.mentionedUser,s=e.description,u=e.disableShortenContent,d=e.mentions,m=void 0===d?[]:d,p=r(!1),v=p[0],h=p[1],f=g().t,k=q().authActionWrapper,C=r(!1),y=C[0],E=C[1],b=V(U(s||"","display"),m),N=a(w).action.sanitizeFunction,I=c((function(){var e=N(b||"");if(u||v)return{showContent:e,hasSeeMore:!1};var t=e.slice(0,200),n=200-27*((t.match(/<\/div>/g)||[]).length-1),i=(t||"").slice(0,n<40?40:n),o=N(i.replace(/(<|<\/)( +|[a-zA-Z]*)$/gi,"")),a=o.length<e.length-10;return{showContent:a?o:e,hasSeeMore:a}}),[u,v,b]),T=(null==l?void 0:l.name)||i,x="expert"===(null==l?void 0:l.role)&&!!(null==l?void 0:l.partnerId);return o.createElement(o.Fragment,null,x&&o.createElement(ee,{isOpen:y,onClose:function(){return E(!1)},expertId:String(null==l?void 0:l.partnerId)}),o.createElement(te,{className:"".concat(t," no-replace-click"),style:n},T&&o.createElement("span",{onClick:function(){return x&&E(!0)},className:"post-content-replying"},"@",T),(null==s?void 0:s.startsWith("[mention+id="))&&o.createElement("span",{className:"post-content-replying tag-only"},"@"),o.createElement("span",{dangerouslySetInnerHTML:{__html:I.showContent},className:"post-content ".concat(I.hasSeeMore?"has-see-more":"")}),I.hasSeeMore&&!v&&o.createElement("span",null,"... ",o.createElement("span",{onClick:function(e){e.preventDefault(),e.stopPropagation(),k((function(){return h(!0)}))},className:"see-more-text"},f("post.seeMore")))))},ct=function(e){var t=e.className,n=e.style,i=e.authorName,a=e.images,l=e.onClose,c=e.onOpenSingleView,u=g().t,m=r(!1),p=m[0],v=m[1];return s((function(){setTimeout((function(){v(!0)}),0)}),[]),Me.createPortal(o.createElement(ne,{className:t,style:n,"data-open":p},o.createElement("div",{className:"top-bar"},o.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:l,alt:"go back"}),o.createElement(d,{size:"p2",type:"bold",style:{textAlign:"center"}},u("previewPhotos.title",{name:i}))),o.createElement("div",{className:"container"},a.map((function(e,t){return o.createElement("img",{className:"img-preview",key:t,src:e,onClick:function(){return null==c?void 0:c(t)},alt:"post img"})})))),f())},ut="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",dt=function(e){var t=e.initialViewIndex,n=e.images,i=e.onClose,a=r(t),l=a[0],c=a[1],u=r(!1),d=u[0],m=u[1];s((function(){setTimeout((function(){m(!0)}),0)}),[]);var p=null==n?void 0:n[l],v=0===l,g=!(null==n?void 0:n.length)||l===(null==n?void 0:n.length)-1;return Me.createPortal(o.createElement(ie,{"data-open":d&&!!p},o.createElement(oe,null,o.createElement("img",{src:ae,className:"icon-close",onClick:i,alt:"close"})),p&&l>=0&&o.createElement(o.Fragment,null,o.createElement(re,null,o.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),o.createElement(le,{"data-disabled":v,onClick:function(){return!v&&c(l-1)}},o.createElement(se,null,o.createElement("img",{src:ut,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),o.createElement(le,{"data-right":!0,"data-disabled":g,onClick:function(){return!g&&c(l+1)}},o.createElement(se,null,o.createElement("img",{src:ut,alt:"right arrow","data-disabled":g})))))),f())},mt=function(e){var t=e.className,n=e.images,i=void 0===n?[]:n,c=e.style,u=e.authorName,d=a(w).data.env.isMarryBaby,m="+ ".concat((i.length||0)-4),p=r(!1),v=p[0],g=p[1],f=r(-1),k=f[0],C=f[1];s((function(){setTimeout((function(){return null==Se?void 0:Se.update()}),100)}),[null==i?void 0:i.slice(0,5).join("|")]);var y=i.length>5,E=l(!1);return s((function(){return function(){E.current&&h(!1)}}),[]),s((function(){v||k>=0?(h(!0),E.current=!0):(h(!1),E.current=!1)}),[v,k]),o.createElement(o.Fragment,null,o.createElement(ce,{className:t,style:c,"data-image-count":y?5:i.length||0,"data-is-marrybaby":d},null==i?void 0:i.slice(0,5).map((function(e,t){return o.createElement("div",{className:"img-wrapper",key:t,onClick:function(){t>=4&&y?g(!0):C(t)}},!d&&o.createElement("img",{className:"lazy img-preview-blur","data-src":e}),o.createElement("img",{className:"lazy img-preview","data-src":e}),4===t&&y&&o.createElement("div",{className:"img-more-overlay"},o.createElement(Le,{tag:"h1",color:"white"},m)))}))),v&&o.createElement(ct,{authorName:u||"",images:i,onClose:function(){return g(!1)},onOpenSingleView:C}),k>=0&&o.createElement(dt,{images:i,initialViewIndex:k,onClose:function(){return C(-1)}}))},pt=function(i){var u=i.url,d=i.image,m=i.className,p=i.style,v=a(w).data.locale,g=r(null),h=g[0],f=g[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return d?[2]:u?(f((function(e){return n(n({},e),{isFetching:!0})})),y(E(b.FETCH_PREVIEW,{_locale:v}),"POST",{data:{link:u}}).then((function(e){var t,n;f({url:u,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(){f(null)})),[2]):[2,f(null)]}))}))}),[u,d]);var k=(null==h?void 0:h.image)||d,N=(null==h?void 0:h.url)||u,I=c((function(){return ue(N)}),[N]),T=c((function(){return de(N)}),[N]),x=l(0),M=l(0),_=r(!1),P=_[0],L=_[1];s((function(){var e=function(){var e,t=null===(e=S.current)||void 0===e?void 0:e.getBoundingClientRect(),n=!1;t&&(!x.current||Math.abs((x.current-t.width)/(null==t?void 0:t.width))>.2)&&(x.current=Math.floor(t.width),n=!0),t&&(!M.current||Math.abs((M.current-t.height)/(null==t?void 0:t.height))>.2)&&(M.current=Math.floor(t.height),n=!0),n&&L((function(e){return!e}))};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var S=l(null),j=l(!1);return o.createElement(me,{className:"".concat(m," no-replace-click"),style:p,ref:S},d||!I&&!T?o.createElement("a",{href:N,target:"_blank",rel:"noreferrer"},o.createElement("div",{className:"link-image-wrapper ".concat((null==h?void 0:h.isFetching)?"fetching":"")},(null==h?void 0:h.isFetching)?o.createElement(F,{className:"loading-spinner"}):o.createElement("img",{className:"link-image",src:k||C,onError:function(e){j.current||(j.current=!0,e.currentTarget.src=C)}}))):o.createElement("div",{className:"link-image-wrapper"},I?o.createElement("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/".concat(I,"?&autoplay=1&mute=1"),frameBorder:"0",allowFullScreen:!0,style:{position:"absolute",top:0,left:0,border:"none",overflow:"hidden"}}):T?o.createElement("iframe",{key:String(P),src:"https://www.facebook.com/plugins/video.php?href=".concat(encodeURIComponent(N),"&autoplay=1&show_text=false&t=0&width=").concat(x.current,"&height=").concat(M.current),style:{position:"absolute",top:"50%",left:"50%",border:"none",overflow:"hidden",height:M.current,width:x.current,transform:"translate(-50%, -50%)"},scrolling:"no",frameBorder:"0",allowFullScreen:!0,allow:"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"}):null))},vt="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",gt="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",ht="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",ft=function(n){var i=n.onDeleteComment,l=n.commentId,s=n.className,c=void 0===s?"":s,u=n.popoverClassName,d=void 0===u?"":u,m=a(w),p=m.data,v=p.env.isMarryBaby,h=p.locale,f=m.action.pushNotifications,k=g().t,C=r(!1),y=C[0],E=C[1],b=q().authActionWrapper;return o.createElement("div",{className:c,onClick:function(e){e.preventDefault(),e.stopPropagation()}},y&&o.createElement(qe,{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:k("popup.deleteComment.title"),description:k("popup.deleteComment.description"),acceptText:k("popup.deletePost.accept"),cancelText:k("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return l?[4,ot({id:l,locale:h})]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(i&&i(),f({title:"",message:k("notification.success"),type:"success"})):f({title:"",message:(null===(n=null==e?void 0:e.messages)||void 0===n?void 0:n[0])||k("notification.failure"),type:"danger"}),[2]}}))}))},onClose:function(){return E(!1)}}),o.createElement(pe,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:ht,label:k("actionPopover.delete"),onClick:function(){b((function(){E(!0)}))}}]},className:d,toggleButtonContent:o.createElement("img",{src:v?vt:gt}),buttonProps:{}}))},wt=function(i){var l,u,d,p,h,f=i.className,k=i.style,C=i.comment,E=i.type,b=void 0===E?"comment":E,N=i.level,I=void 0===N?0:N,T=i.replyingId,x=i.onPostCommentSuccess,M=i.post,_=i.onDeleteComment,P=i.refetchComment,L=i.hasQuickBookingEnable,S=i.handleMakeAppointment,j=a(w).data,B=j.locale,F=j.userInfo,R=j.env.isMarryBaby,D=g().t,O=r(C||null),A=O[0],z=O[1],V=A.id;A.countReplies;var U=A.countLikes,H=A.content,W=A.createdAt,Z=A.replies,G=void 0===Z?[]:Z,K=A.images,Q=void 0===K?[]:K,X=A.author,J=A.liked,Y=A.link,$=A.mentionedUser,ee=A.mentions,te=function(e){try{var t=e.match(/\[@([^\]]+)\]/),n=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:n}}catch(e){}return{text:""}}(H),ne=te.text,ie=te.replyingTo,oe=q({_joinCommunityIds:[null===(l=null==M?void 0:M.community)||void 0===l?void 0:l.id],_joinTopicIds:null===(u=null==M?void 0:M.topics)||void 0===u?void 0:u.map((function(e){return e.id}))}).authActionWrapper,ae=r(4),re=ae[0],le=ae[1],se=!!(null==F?void 0:F.id)&&(null==G?void 0:G.some((function(e){return e.author.id===F.id}))),ce=function(e){z((function(t){t.replies.unshift(e);var i=n(n({},t),{replies:t.replies.slice(),countReplies:t.countReplies+1});return P&&P(i),i}))},ue=r(!1),de=ue[0],me=ue[1],pe=c((function(){return"comment"===b&&G&&0!=G.length?G.sort((function(e,t){var n=new Date(e.createdAt).getTime(),i=new Date(t.createdAt).getTime();return n>i?-1:n<i?1:0})):G}),[b,G]),ye=(null==G?void 0:G.length)||0,Ee=String(null==X?void 0:X.email)&&(null==F?void 0:F.email)&&String(null==X?void 0:X.email)===String(null==F?void 0:F.email),be=(null==X?void 0:X.name)||(null==X?void 0:X.username)||"",Ne=null==X?void 0:X.avatar,Ie=(null==X?void 0:X.username)||(null==X?void 0:X.name)||"",Te=r(null),xe=Te[0],Me=Te[1],_e=r(null),Pe=_e[0],Le=_e[1];s((function(){if(null==X?void 0:X.hospitalId){n=X.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:je[B]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&Me(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==X?void 0:X.doctorId){i=X.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_DOCTOR_INFO,{doctorId:i,website_url:je[B]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Le(null==e?void 0:e._data.doctor),[2]}}))}))}}),[X.hospitalId,X.doctorId]);var Se=(null==Pe?void 0:Pe.valid_outpatient)||(null==Pe?void 0:Pe.valid_telemedicine),Fe=((null==xe?void 0:xe.total_available_service)||(null==xe?void 0:xe.total_available_doctor))>0,Re=L&&(Se||Fe);return o.createElement(ve,{defaultParams:{_joinCommunityIds:[null===(d=null==M?void 0:M.community)||void 0===d?void 0:d.id],_joinTopicIds:null===(p=null==M?void 0:M.topics)||void 0===p?void 0:p.map((function(e){return e.id}))}},o.createElement(ge,{className:f,style:k,"data-is-reply":!!I,"data-is-marrybaby":R,"data-has-booking":Re},"reply"===b&&o.createElement(v,{className:"top-divider",type:"solid"}),o.createElement(he,{avatar:Ne,name:be,username:Ie,email:null==X?void 0:X.email,time:W,className:"post-author ".concat(Ee?"with-popover":""),type:b,userId:null==X?void 0:X.id,role:null==X?void 0:X.role,expertId:null==X?void 0:X.partnerId,title:null==X?void 0:X.title,doctorId:null==X?void 0:X.doctorId,hospitalId:null==X?void 0:X.hospitalId,hasQuickBooking:Re,handleMakeAppointment:S}),o.createElement(st,{className:"post-content-wrapper",replyingTo:ie,mentionedUser:$,description:ne,mentions:ee}),o.createElement("span",null),o.createElement("span",null),Q&&Q.length>0?o.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},o.createElement(mt,{images:Q,authorName:null==X?void 0:X.username})):null,Q&&0!==Q.length||!Y?null:o.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},o.createElement(Be,{url:Y})),"most-engaging"!==b?o.createElement(o.Fragment,null,o.createElement(fe,{type:we.reply,loveCount:U,replyCount:ye,className:"post-reaction",liked:J,isReplied:se,hideCommentIcon:"reply"===b,onCommentClick:function(){return oe((function(){return me((function(e){return!e}))}))},onCommentCountClick:function(){return oe((function(){me(!0)}))},onLikeClick:function(){return oe((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return V?[4,it({commentId:V,setLike:!J,locale:B})]:[3,2];case 1:1===e.sent().status&&z((function(e){return n(n({},e),{liked:!J,countLikes:e.countLikes+(J?-1:1)})})),e.label=2;case 2:return[2]}}))}))}))}}),de&&o.createElement(at,{replyingId:T||A.id,replyToName:X.name||X.username||"",isReply:!0,onClose:function(){return me(!1)},onPostSuccess:function(e){"reply"===b?x&&x(e):ce(e)},post:M,replyingUser:X}),"comment"===b&&G&&G.length>0?o.createElement("div",{className:"comment-reply-wrapper"},null===(h=null==pe?void 0:pe.slice(0,re))||void 0===h?void 0:h.map((function(e){return o.createElement(wt,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:I+1,replyingId:V,onPostCommentSuccess:ce,post:M,onDeleteComment:function(){z((function(t){return n(n({},t),{replies:t.replies.filter((function(t){return t.id!==e.id})),countReplies:t.countReplies-1})}))},handleMakeAppointment:S,hasQuickBookingEnable:L})})),ye>re&&o.createElement(o.Fragment,null,o.createElement(v,{className:"top-divider",type:"solid"}),o.createElement(m,{className:"more-cmt",size:"lg",color:"ghost",onClick:function(){return le((function(e){return e+4}))}},D("comment.seeMoreReplies",{count:ye-re}),o.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,Ee&&o.createElement(ft,{onDeleteComment:_,className:"popover",commentId:A.id})))},kt="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",Ct="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",yt="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",Et=function(n){var i=n.authorEmail,l=n.onDeletePost,s=n.shareUrl,c=n.post,u=n.className,d=void 0===u?"":u,m=n.popoverClassName,p=void 0===m?"":m,v=n.onBookmark,h=n.onRemoveBookmark,f=n.onEditPost,k=a(w),C=k.data,y=C.locale,N=C.userInfo,I=C.togetherUserId,x=C.env.isMarryBaby,M=k.action.pushNotifications,_=g().t,P=r(!1),L=P[0],S=P[1],j=r(!1),B=j[0],F=j[1],R=r(!1),D=R[0],O=R[1],A=q().authActionWrapper,z=i&&(null==N?void 0:N.email)&&i===String(null==N?void 0:N.email);return o.createElement("div",{className:d,onClick:function(e){e.preventDefault(),e.stopPropagation()}},D&&o.createElement(ye,{url:s,text:null==c?void 0:c.title,onClose:function(){return O(!1)}}),B&&o.createElement(qe,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:_("popup.deletePost.title"),description:_("popup.deletePost.description"),acceptText:_("popup.deletePost.accept"),cancelText:_("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!(null==c?void 0:c.id)||L)return[2];S(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ze({id:c.id,locale:y})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(null==l||l()),[3,4];case 3:return t.sent(),[3,4];case 4:return S(!1),[2]}}))}))},onClose:function(){return F(!1)}}),o.createElement(pe,{className:p,toggleButtonContent:o.createElement("img",{src:x?vt:gt}),position:"bottom",align:"end",buttonProps:{isLoading:L},data:z?{isShowheader:!1,type:"list",list:[{icon:yt,label:_("morePopover.share"),onClick:function(){return O(!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:_("actionPopover.edit"),onClick:f},{icon:ht,label:_("actionPopover.delete"),onClick:function(){A((function(){return F(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:yt,label:_("morePopover.share"),onClick:function(){return O(!0)}},{icon:(null==c?void 0:c.bookmarked)?kt:Ct,label:(null==c?void 0:c.bookmarked)?_("morePopover.unsavePost"):_("morePopover.savePost"),onClick:function(){A((function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(null==N?void 0:N.id)&&(null==c?void 0:c.id)?(null==c?void 0:c.bookmarked)?[4,T(E(b.BOOKMARK.DELETE,{_locale:y}),"DELETE",{data:{post_id:String(c.id)}})]:[3,2]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(M({title:"",message:"Removed saved post",type:"success",displayIcon:Ct}),h&&h()):M({title:"",message:"Remove failed",type:"danger",displayIcon:Ct}),[3,4];case 2:return[4,T(E(b.BOOKMARK.CREATE,{_locale:y}),"POST",{data:{user_id:I||N.id,post_id:c.id}})];case 3:1===(null==(e=t.sent())?void 0:e.status)?(M({title:"",message:"Post saved",type:"success",displayIcon:kt}),v&&v()):M({title:"",message:"Post saved failed",type:"danger",displayIcon:Ct}),t.label=4;case 4:return[2]}}))}))}))}},{icon:rt,label:_("morePopover.report"),subTree:{title:_("morePopover.report.title"),description:_("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(Ee).map((function(e){return{label:Ee[e].label,reason:Ee[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:_(e.label),subTree:{title:_("morePopover.reportSubmit.title"),description:_("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return o.createElement(lt,{reason:e.reasonValue,reasonText:_(e.reason),postId:null==c?void 0:c.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},bt=function(n,i){return e(void 0,void 0,void 0,(function(){var e,o,a,r;return t(this,(function(t){switch(t.label){case 0:return[4,Te(E(b.COMMENT.LIST,{postId:n,_locale:i,sort:"popularity",perPage:1,withoutReply:1}),"GET")];case 1:return e=t.sent(),[2,null===(r=null===(a=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.comments)||void 0===a?void 0:a.map(Y))||void 0===r?void 0:r[0]]}}))}))},Nt=function(i){var l=i.className,c=i.style,u=i.hideViewMoreComment,d=i.showMostEngaging,p=i.onCommentClick,v=i.onCommentCountClick,h=i.onMostEngagingCommentClick,f=i.onPostCommentSuccess,k=i.disableCardLink,E=i.disableShortenContent,b=i.onDeletePost,N=i.onEditPost,I=i.post,T=i.mostEngagingComment,x=i.onDeleteComment,M=i.showInputComment,_=i.InlineCommentsComponent,P=i.hasQuickBookingEnable,L=i.handleMakeAppointment,S=r(I),j=S[0],F=S[1],R=r(!1),D=R[0],O=R[1],A=r(T),z=A[0],V=A[1],U=j.community,H=j.topics,W=j.author,Z=j.slug,G=j.isPin,K=j.liked,Q=j.scheduleDateTime,X=j.createdAt,J=j.photos,Y=j.mentions,$=j.title,ee=j.description,te=j.previewUrl,ne=j.likesCount,ie=j.commentsCount,oe=j.id,ae=j.commented,re=a(w),le=re.data,se=le.locale,ce=le.env,ue=ce.isMarryBaby,de=ce.togetherBasePath,me=re.action.pushNotifications,pe=g().t,ge=r(M),Ee=ge[0],Te=ge[1],xe="".concat(de,"/").concat((null==U?void 0:U.slug)||"_","/").concat(Z||""),Me="".concat(be(se)).concat(xe),_e=q((null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==H?void 0:H.map((function(e){return e.id}))}:void 0).authActionWrapper,Pe=r(!1),Se=Pe[0],je=Pe[1];s((function(){Te(M)}),[M]);var Oe=(null==W?void 0:W.name)||(null==W?void 0:W.username)||"",ze=(null==W?void 0:W.username)||(null==W?void 0:W.name)||"",Ve=null==W?void 0:W.avatar,Ue=r(null),He=Ue[0],We=Ue[1],Ze=r(null),Ge=Ze[0],Ke=Ze[1];s((function(){if(null==W?void 0:W.hospitalId){n=W.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:Ie[se]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&We(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==W?void 0:W.doctorId){i=W.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_DOCTOR_INFO,{doctorId:i,website_url:Ie[se]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Ke(null==e?void 0:e._data.doctor),[2]}}))}))}}),[W.hospitalId,W.doctorId]);var Qe=(null==Ge?void 0:Ge.valid_outpatient)||(null==Ge?void 0:Ge.valid_telemedicine),Xe=((null==He?void 0:He.total_available_service)||(null==He?void 0:He.total_available_doctor))>0,Je=P&&(Qe||Xe);s((function(){e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return oe&&ie&&d&&!(null==T?void 0:T.id)?[4,bt(oe,se)]:[3,2];case 1:e=t.sent(),V(e),t.label=2;case 2:return[2]}}))}))}),[oe,se,ie,d,null==T?void 0:T.id]),s((function(){V(T)}),[null==T?void 0:T.id]);var Ye=function(i){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return ie>1&&(null==z?void 0:z.id)&&(null==z?void 0:z.id)===(null==i?void 0:i.id)?[4,bt(oe,se)]:[3,2];case 1:e=t.sent(),V(e),t.label=2;case 2:return F((function(e){return n(n({},e),{commentsCount:e.commentsCount-1})})),x&&x(i),[2]}}))}))};return o.createElement(ve,{defaultParams:(null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==H?void 0:H.map((function(e){return e.id}))}:void 0},D&&o.createElement(ye,{url:Me,avatar:C,text:$,onClose:function(){return O(!1)}}),o.createElement(Ne,{className:l,style:c,"data-is-marrybaby":ue},G?o.createElement(Re,{className:"post-pin"}):null,o.createElement("div",{style:{position:"relative"}},o.createElement(he,{avatar:Ve,name:Oe,username:ze,url:k?void 0:xe,email:null==W?void 0:W.email,time:Q||X,community:U,className:"post-author",role:null==W?void 0:W.role,userId:null==W?void 0:W.id,expertId:null==W?void 0:W.partnerId,doctorId:null==W?void 0:W.doctorId,hospitalId:null==W?void 0:W.hospitalId,title:null==W?void 0:W.title,hasQuickBooking:Je,handleMakeAppointment:L}),o.createElement(Et,{authorEmail:String(null==W?void 0:W.email),onDeletePost:b,shareUrl:Me,post:j,className:"popover",onEditPost:N})),o.createElement("a",{href:k?void 0:xe,className:"post-content-link-wrapper"},$&&o.createElement(Le,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},B($)),o.createElement(st,{className:"post-content-wrapper",description:ee,disableShortenContent:E,mentions:Y})),o.createElement("span",null),o.createElement("span",null),o.createElement("div",{key:"tag-topic"},H&&H.length>0?o.createElement(Fe,{topics:H,className:"post-topics"}):null),o.createElement("div",{key:"social-preview"},(null==j?void 0:j.introUrl)?o.createElement("div",{className:"social-preview-wrapper ".concat((null==J?void 0:J.length)?"has-image":"")},o.createElement(pt,{url:j.introUrl,image:j.bannerImage})):null),o.createElement("div",{key:"image-preview"},(null==J?void 0:J.length)?o.createElement("div",{className:"image-preview-wrapper"},o.createElement(mt,{images:J,authorName:null==W?void 0:W.name})):null),o.createElement("div",{key:"link-preview"},(null==j?void 0:j.introUrl)||(null==J?void 0:J.length)||!(null==te?void 0:te.url)?null:o.createElement("div",{className:"link-preview-wrapper"},o.createElement(Be,{title:te.title,url:te.url,image:te.image}))),o.createElement(fe,{type:we.post,loveCount:ne,replyCount:ie,className:"post-reaction ".concat((null==J?void 0:J.length)||(null==te?void 0:te.url)?"hide-top-border":""),liked:Se?!K:K,isReplied:ae,onCommentClick:function(){return _e((function(){p?p():Te((function(e){return!e}))}))},onCommentCountClick:function(){_e((function(){ue?Te(!0):v?v():!k&&(window.location.href=xe)}))},onShareClick:function(){O(!0)},onLikeClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!oe||Se)return[2];je(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ae({id:oe,locale:se})];case 2:return 1!==(null==(e=t.sent())?void 0:e.status)?me(De(pe)):F((function(e){return n(n({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked})})),[3,4];case 3:return t.sent(),me(De(pe)),[3,4];case 4:return je(!1),[2]}}))}))},showingMostEngaging:!(!d||!(null==z?void 0:z.id))}),Ee&&o.createElement(at,{isMainCmt:!M,onClose:function(){return Te(!1)},onPostSuccess:function(e){0!==ie||(null==z?void 0:z.id)||V(e),F((function(e){return n(n({},e),{commentsCount:e.commentsCount+1,commented:!0})})),f&&f(e)},post:j}),d&&(null==z?void 0:z.id)?o.createElement("div",{className:"most-engaging-wrapper",onClick:function(e){h?(e.stopPropagation(),h()):window.location.href=xe}},o.createElement(wt,{hasQuickBookingEnable:P,handleMakeAppointment:L,comment:z,onDeleteComment:function(){Ye&&Ye(z)},className:"most-engaging-comment",type:"most-engaging",key:z.id}),ie>1&&!u&&o.createElement(m,{className:"see-more-comments",color:"ghost",size:"md"},pe("comment.seeMoreComments",{count:ie-1}))):null,_))},It=Object.freeze({__proto__:null});export{Be as C,at as I,Re as L,qe as P,lt as S,Fe as T,$e as a,Ke as b,Xe as c,Je as d,st as e,ct as f,dt as g,mt as h,Nt as i,Et as j,wt as k,ft as l,It as t};
|
|
1
|
+
import{d as e,e as t,_ as n,a as i}from"./tslib.es6-fd0a5c98.js";import o,{useContext as a,useState as r,useRef as l,useEffect as s,useMemo as c,useCallback as u}from"react";import{T as d,B as m}from"./index.styled-c5e035f3.js";import{a as p,D as v}from"./index-a74b53cb.js";import{u as g,t as h,k as f}from"./useTranslations-d76b98a9.js";import{m as w,z as k,B as C,E as y,F as E,H as b,I as N,b as I,J as T,M as x,K as M,N as _,O as P,Q as L,R as S,V as j,W as B,L as F,X as R,Y as D,_ as O,Z as A,$ as z,a0 as V,a1 as U,a2 as H,y as W,a3 as Z,j as G,a4 as K,a5 as Q,U as X,a6 as J,a7 as Y,a8 as $,u as q,g as ee,a9 as te,aa as ne,ab as ie,ac as oe,ad as ae,ae as re,af as le,ag as se,ah as ce,ai as ue,aj as de,ak as me,al as pe,a as ve,am as ge,f as he,C as fe,an as we,ao as ke,ap as Ce,S as ye,aq as Ee,o as be,ar as Ne,as as Ie,at as Te}from"./index.styled-6559ec11.js";import{t as xe}from"./theme-731042bc.js";import"react-range";import*as Me from"react-dom";import"date-fns";import{I as _e}from"./index-e25a976f.js";import Pe from"lodash/debounce";import{H as Le}from"./index-e3b386f9.js";import{l as Se}from"./number-126ee62e.js";import"styled-components";import{d as je}from"./constants-17d17987.js";var Be=function(i){var c=i.title,u=i.url,m=i.image,p=i.logo,v=i.className,g=i.style,h=i.noRefetch,f=a(w).data,N=f.locale,I=f.env.isMarryBaby,T=r(!1),x=T[0],M=T[1],_=l(h);_.current=h;var P=r(null),L=P[0],S=P[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return _.current?[2]:u?(S((function(e){return n(n({},e),{isFetching:!0})})),y(E(b.FETCH_PREVIEW,{_locale:N}),"POST",{data:{link:u}}).then((function(e){var t,n,i;M(!1),S({title:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.title,url:u,image:(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.image)||(null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.logo)})})).catch((function(){S(null)})),[2]):[2,S(null)]}))}))}),[u]);var j=(null==L?void 0:L.image)||m,B=(null==L?void 0:L.title)||c,F=(null==L?void 0:L.logo)||p,R=(null==L?void 0:L.url)||u,D=R.replace("http://","").replace("https://","").split(/[/?#]/)[0],O=l(!1);return o.createElement(k,{"data-is-marrybaby":I,className:"".concat(v," no-replace-click"),style:g},o.createElement("a",{href:R,target:"_blank",rel:"noreferrer"},j&&o.createElement("div",{className:"link-image-wrapper"},!I&&o.createElement("img",{className:"link-image-blur",src:j,onError:function(e){O.current||(O.current=!0,e.currentTarget.src=C)}}),o.createElement("img",{className:"link-image",src:j,onError:function(e){O.current||(O.current=!0,e.currentTarget.src=C)}})),o.createElement("div",{className:"link-info-container"},o.createElement(d,{size:"n1"},I&&F&&!x&&o.createElement("img",{className:"link-logo",src:F,onError:function(e){return M(!0)}}),D),o.createElement(Le,{tag:"h6"},B))))},Fe=function(e){var t=e.topics,n=e.onClick,i=e.className,s=e.style,c=function(){var e=r(!1),t=e[0],n=e[1],i=l(null),o=l(null),a=l();return{sliding:t,mouseDownHandler:function(e){if(i.current){a.current=setTimeout((function(){n(!0)}),500),o.current={left:i.current.scrollLeft,x:e.clientX};var t=function(e){var t=o.current;if(t){var n=e.clientX-t.x;i.current&&(i.current.scrollLeft=t.left-n)}},r=function(){a.current&&(clearTimeout(a.current),a.current=void 0),n(!1),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}},sliderRef:i,pos:o}}(),u=c.sliding,m=c.mouseDownHandler,p=c.sliderRef,v=a(w),g=v.data.env.togetherBasePath,h=v.action.sanitizeFunction;return o.createElement(N,{ref:p,onClick:n,onMouseDown:function(e){return m(e)},className:"".concat(i," ").concat(u?"sliding":""),style:s},t.map((function(e,t){return o.createElement("a",{className:"tag-link-item",key:t,href:e.isActive&&!e.isHidden?"".concat(g).concat(e.url):void 0},o.createElement(d,{size:"p3"},o.createElement("span",{dangerouslySetInnerHTML:{__html:(null==h?void 0:h(e.name))||e.name}})))})))},Re=function(e){var t=e.onClick;e.color;var n=e.className,i=e.style,r=a(w).data.env.isMarryBaby,l=g().t;return o.createElement(I,{label:o.createElement(o.Fragment,null,r&&o.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"})," ",l("label.pinnedPost")),rightLabel:!r&&o.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:t,color:"white",className:"label-pinned ".concat(n),style:i})},De=function(e){return{message:e("notification.failure"),type:"danger"}},Oe="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",Ae=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,T(E(b.POST.LIKE,{id:i,_locale:o}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},ze=function(n){var i=n.id,o=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return i?[4,T(E(b.POST.DELETE,{id:i,_locale:o}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},Ve=function(n){var i=n.title,o=n.description,a=n.communityId,r=n.imageFiles,l=n.previewUrl,s=n.topicIds,c=n.locale,u=n.sanitizeFunction,d=n.categoryCommunityId,m=n.categoryTopicIds,p=n.introUrl,v=n.bannerUrl,g=n.scheduleTime;return e(void 0,void 0,void 0,(function(){var e,n,h,f,w;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=M(o),h=M(i),f=_(n),e.append("title",h),e.append("description",P(n,u)),d?e.append("category_community",String(d)):a&&e.append("community_id",String(a)),(null==l?void 0:l.title)&&e.append("preview_title",l.title),(null==l?void 0:l.description)&&e.append("preview_description",l.description),(null==l?void 0:l.url)&&e.append("preview_link",l.url),(null==l?void 0:l.image)&&e.append("preview_image",l.image),null==s||s.forEach((function(t){e.append("topics[]",String(t||""))})),null==m||m.forEach((function(t){e.append("category_topics[]",String(t||""))})),(null==r?void 0:r.length)?[4,Promise.all(r.map((function(e,t){return new Promise((function(n){setTimeout((function(){n(L(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=t.sent())||w.filter(Boolean).slice(0,x).forEach((function(t,n){e.append("images[".concat(n,"]"),t)})),[3,3];case 2:e.append("images",""),t.label=3;case 3:return null==f||f.forEach((function(t){e.append("mention_ids[]",t)})),e.append("intro_url",p||""),e.append("banner",v||""),g&&(e.append("post_type","scheduled"),e.append("schedule_datetime",g)),[2,e]}}))}))},Ue=function(n){var i=n.locale,o=n.formData,a=n.isArticleComment;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,T(E(a?b.POST.CREATE_ARTICLE_COMMENT:b.POST.CREATE,{_locale:i}),"POST",{data:o,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},He=function(n){var i=n.id,o=n.locale,a=n.formData;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,T(E(b.POST.UPDATE,{id:i,_locale:o}),"POST",{data:a})];case 1:return[2,e.sent()]}}))}))},We=function(e){var t=e.id,n=e.reason,i=e.locale,o=new FormData;return o.append("reason",n),T(E(b.POST.REPORT,{_locale:i,id:t}),"POST",{data:o})},Ze=function(e,t){var n=r(e||[]),i=n[0],o=n[1];return{onSelectImages:function(n){var a=n.target.files;a&&(t&&e?t((e||i).concat(Array.from(a))):o((function(n){var i=e||n;return t&&t(i.concat(Array.from(a))),i.concat(Array.from(a))})))},onRemoveImage:function(n){if(t&&e){var i=e;i.splice(n,1),t(i.slice())}else o((function(i){var o=e||i;return o.splice(n,1),t&&t(o.slice()),o.slice()}))},onRemoveAllImages:function(){t?t([]):o([])},imageSrcs:c((function(){return(e||i).map((function(e){return"string"==typeof e?e:URL.createObjectURL(e)}))}),[e,i]),imageFiles:e||i}},Ge="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",Ke=function(e){var t=e.className,n=e.style,i=e.bannedWords,a=void 0===i?[]:i,c=e.value,u=e.onChange,m=e.onPreviewUrlChange,p=e.onInvalidUrlsChange,v=e.onImageFilesChange,h=e.imageFiles,f=e.isReplying,w=g().t,k=r(null),C=k[0],y=k[1],E=l(null),b=Ze(h,v),N=b.onSelectImages,I=b.onRemoveImage,T=b.imageSrcs;return s((function(){m&&((null==C?void 0:C.url)?m({title:C.title||"",url:C.url||"",image:C.image||"",description:C.description||""}):m(null))}),[C]),o.createElement(S,{className:t,style:n},o.createElement(d,{size:"p4",className:"description-label"},w("createPost.popup.description")),o.createElement("div",{className:"textarea-control"},o.createElement("div",{className:"textarea-wrapper"},o.createElement(j,{html:c||"",onChange:u,bannedWords:a,onImagePickerClick:function(){var e;return null===(e=E.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:y,onInvalidUrlsChange:p,isReplying:f}))),o.createElement(d,{size:"p4",className:"count-string"},w("character"),": ",B(c||"").length),(!T||0===T.length)&&C&&o.createElement("div",{className:"link-preview-wrapper"},C.isFetching?o.createElement(F,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:C.title,url:C.url||"#",image:C.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return y(null)}}))),o.createElement("input",{ref:E,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:N}),T.length>x?o.createElement("div",{className:"input-notification"},o.createElement("img",{src:Oe}),o.createElement(d,{size:"p4",color:xe.colors.alertWarning},w("createPost.popup.warningImage"))):null,T.length>0&&o.createElement("div",{className:"image-gallery"},T.map((function(e,t){return o.createElement("div",{key:t,className:"image-item"},o.createElement("img",{src:e}),o.createElement("img",{className:"close-btn",src:Ge,onClick:function(){return I(t)}}))}))))},Qe=function(e,t){if(!t)return e;var n=t.limit,i=t.bannedWords,o=void 0===i?[]:i,a="number"==typeof n&&n>=0?e.substring(0,n):e;return R(a,o)},Xe=function(e){var t,n=e.className,i=e.style,a=e.bannedWords,c=void 0===a?[]:a,m=e.value,p=e.onChange,v=g().t,h=r(""),f=h[0],w=h[1],k=l(null);s((function(){if(k.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=k.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[k]);var C=(null==c?void 0:c.join(","))||"";s((function(){var e;if(C){var t=null===(e=k.current)||void 0===e?void 0:e.innerText;if(t){var n=R(t,c);n!==t&&(p&&p(n),w(n))}}}),[C]);var y=u(Pe((function(e){if(k.current){var t=Qe(k.current.innerText,{limit:120,bannedWords:c});p&&p(t),w(t)}}),300),[]);return s((function(){setTimeout((function(){var e;null===(e=k.current)||void 0===e||e.focus()}),500)}),[]),o.createElement(D,{className:n,style:i},o.createElement(_e,{name:"title",value:m||f,size:"md",label:v("createPost.title"),CustomInput:o.createElement(O,{innerRef:k,html:m||f,onChange:function(e){if(k.current&&k.current.innerText!==(m||f)){var t=Qe(k.current.innerText,{bannedWords:c});p&&p(t),w(t),y(k.current.innerText)}},className:"title-input"})}),o.createElement(d,{size:"p4",className:"count-string"},v("createPost.popup.wordCount",{count:(null===(t=k.current)||void 0===t?void 0:t.innerText.length)||0,max:120})))},Je=function(n){var u=n.className,d=n.style,m=n.topics,p=n.communityId,v=n.onChange,g=n.isLoading,h=n.disabled,f=n.forceTopics,k=n.selectedTopics,C=n.noFetch,N=a(w).data,I=N.locale,T=N.env.isMarryBaby,x=r(m?i([],m,!0):[]),M=x[0],_=x[1],P=r(k?i([],k,!0):[]),L=P[0],S=P[1],j=r(!1),B=j[0],R=j[1],D=l(m);D.current=m,s((function(){var n;!p||C||(null===(n=D.current)||void 0===n?void 0:n.length)||(_([]),R(!0),e(void 0,void 0,void 0,(function(){var e,n,i,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,y(E(b.TOPIC.LIST,{communityId:p,_locale:I}),"GET")];case 1:return e=t.sent(),n=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.topics,Array.isArray(n)&&_((function(){return(null==n?void 0:n.map(z).sort((function(e,t){return(e.order||0)-(t.order||0)})))||[]})),[3,3];case 2:return i=t.sent(),console.log(i),R(!1),[3,3];case 3:return R(!1),[2]}}))})))}),[p,C]);var O=null==m?void 0:m.map((function(e){return e.id})).join("-"),V=null==M?void 0:M.map((function(e){return e.id})).join("-"),U=null==f?void 0:f.map((function(e){return e.id})).join("-");s((function(){m&&void 0!==O&&O!==V&&_(m)}),[m,O,V]);var H=c((function(){return M.filter((function(e){return!(null==f?void 0:f.some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})))}))}),[V,U]);return o.createElement(A,{"data-is-marrybaby":T,className:u,style:d},f.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),H.map((function(e){return o.createElement(Ye,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:h,selected:(k||L).some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})),onClick:function(){var t=k||L,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),v&&k?v(t.slice()):(v&&v(t.slice()),S(t.slice()))}})})),(g||B)&&o.createElement(F,{className:"topic-spinner"}))},Ye=function(e){var t=e.topic,n=e.disabled,i=e.selected,a=e.onClick;return o.createElement("div",{className:"tag-item"+(i?" --active":""),"data-disabled":n,onClick:n?void 0:a},t.name)},$e=function(n){var l=n.className,c=n.style,u=n.onPostCreatedEdited,v=n.onClose,h=n.communities,f=void 0===h?[]:h,k=n.forceSelectCommunity,C=n.forceSelectTopics,y=n.articleId,E=n.optionalTopic,b=n.editPostData,N=n.defaultCommunity,I=n.defaultTopics,T=n.noFetchTopic,M=n.hideTopicList,_=!!(null==b?void 0:b.id),P=a(w),L=P.data,S=L.locale,j=L.env.isMarryBaby,F=P.action,R=F.pushNotifications,D=F.sanitizeFunction,O=g().t,A=r(!1),z=A[0],Z=A[1],G=r(""),K=G[0],Q=G[1],X=r(""),J=X[0],Y=X[1],$=r(k?{label:k.name,value:"".concat(k.id||"","-").concat(k.mappedCategoryId||"")}:{label:O("community.choose"),value:""}),q=$[0],ee=$[1],te=r(i([],C,!0)||[]),ne=te[0],ie=te[1],oe=r([]),ae=oe[0],re=oe[1],le=r([]),se=le[0],ce=le[1],ue=k||f.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===q.value})),de=k?[k]:f.filter((function(e){return e.isActive})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),me=r(null),pe=me[0],ve=me[1],ge=r([]),he=ge[0],fe=ge[1],we=K&&B(J)&&(E||!E&&ne.length>0)&&ue&&(!ae||ae.length<=x)&&!(null==he?void 0:he.length)&&!z;s((function(){if(b){var e=b;Q(e.title||""),Y(V(U(e.description||"","edit"),e.mentions)),ee({label:e.community.name,value:"".concat(e.community.id||"","-").concat(e.community.mappedCategoryId||"")}),ie(e.topics||[]),re(e.photos||[])}else N&&ee({label:N.name,value:"".concat(N.id||"","-").concat(N.mappedCategoryId||"")}),I&&ie(I)}),[]);var ke=function(){return e(void 0,void 0,void 0,(function(){var e,n,i,o,a,r,l,s,c,d,m,p;return t(this,(function(t){switch(t.label){case 0:return[4,Ve({title:K,description:J,communityId:String((null==ue?void 0:ue.id)||""),imageFiles:ae,previewUrl:pe,topicIds:null==ne?void 0:ne.map((function(e){return String(e.id||"")})).filter(Boolean),locale:S,sanitizeFunction:D,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 e=t.sent(),y&&e.append("article_id",y),_?(null==b?void 0:b.id)?[4,He({id:b.id,formData:e,locale:S})]:[3,3]:[3,4];case 2:n=t.sent(),t.label=3;case 3:return[3,6];case 4:return[4,Ue({formData:e,locale:S,isArticleComment:!(null==ue?void 0:ue.id)&&!!(null==ue?void 0:ue.mappedCategoryId)})];case 5:n=t.sent(),t.label=6;case 6:return(null==(i=null==n?void 0:n.data)?void 0:i.id)&&!(null===(a=null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o.moderation)||void 0===a?void 0:a.type)?(R({message:O("createPost.popup.success"),type:"success"}),function(e){u&&u(W(e),_),v&&v()}(i)):"banned"===(null===(l=null===(r=null==n?void 0:n.messages)||void 0===r?void 0:r.moderation)||void 0===l?void 0:l.type)?(R({title:O("notification.post.blocked.title"),message:O("notification.post.blocked.message"),type:"danger"}),n.messages.moderation.words&&ce(n.messages.moderation.words)):"suspect"===(null===(c=null===(s=null==n?void 0:n.messages)||void 0===s?void 0:s.moderation)||void 0===c?void 0:c.type)?(R({title:O("notification.post.suspect.title"),message:O("notification.post.suspect.message"),type:"warning"}),v&&v()):(null===(m=null===(d=null==n?void 0:n.messages)||void 0===d?void 0:d.find)||void 0===m?void 0:m.call(d,(function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(R({message:O("notification.suspend.message"),type:"danger"}),v&&v()):R({message:(null===(p=null==n?void 0:n.messages)||void 0===p?void 0:p[0])||O("notification.failure"),type:"danger"}),[2]}}))}))};return o.createElement(H,{className:l,style:c},o.createElement("div",{className:"input-group-container"},o.createElement(Xe,{className:"input-group",bannedWords:se,value:K,onChange:Q}),o.createElement(Ke,{className:"input-group",bannedWords:se,value:J,onChange:Y,onPreviewUrlChange:ve,onInvalidUrlsChange:fe,onImageFilesChange:re,imageFiles:ae}),o.createElement("div",{className:"input-group"},o.createElement(d,{size:"p4",className:"input-group-label"},O("admin.community")),o.createElement(p,{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:O("community.choose"),value:q,onChange:function(e){ee({label:e.label,value:String(e.value)}),ie([])},disabled:!!k}),o.createElement(d,{size:"sm",className:"warning",color:xe.colors.gray400},"* ",O("commentPopup.warning.newPost"))),!M&&o.createElement("div",{className:"input-group"},o.createElement(d,{size:"p4",className:"input-group-label"},O("tab.topic")),o.createElement("div",{className:"input-notification"},o.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":Oe}),o.createElement(d,{size:"base",color:xe.colors.gray500},O(ue?"createPost.popup.primary":"createPost.popup.warning"))),ue&&o.createElement(Je,{className:"tag-list",communityId:ue.id,forceTopics:C,onChange:ie,selectedTopics:ne,noFetch:T}))),o.createElement(m,{theme:j?"marryBaby":"helloSites",className:"submit-btn",size:"lg",onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!we||z)return[3,5];Z(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ke()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.error(e),R(De(O)),[3,4];case 4:Z(!1),t.label=5;case 5:return[2]}}))}))},isDisabled:!we,isLoading:z},O("createPost.popup.submit")))},qe=function(e){var t=e.className,n=e.isMarryBaby,i=e.style,l=e.title,c=e.description,u=e.acceptText,p=e.cancelText,v=e.onAccept,g=e.thumbnail,k=e.isThumbnailIcon,C=e.onClose,y=a(w).data.env.isMarryBaby,E="boolean"==typeof n?n:y,b=r(!1),N=b[0],I=b[1];return s((function(){return h(!0),setTimeout((function(){return I(!0)}),0),function(){return h(!1)}}),[]),Me.createPortal(o.createElement(Z,{"data-is-marrybaby":E,className:t,style:i,"data-open":N},o.createElement(G,{className:"popup-frame",isOpen:N,onClose:C},o.createElement("div",{className:"confirm-dialog",onClick:function(e){return e.stopPropagation()}},o.createElement("div",{className:"confirm-content"},g&&o.createElement("div",{className:"thumbnail-container ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:g})),o.createElement(Le,{className:"title",tag:"h2"},l),o.createElement(d,{className:"desc",size:"lg"},c),o.createElement("div",{className:"btn-group"},o.createElement(m,{theme:E?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==v||v(),null==C||C()}},u),o.createElement(m,{theme:E?"marryBaby":"helloSites",size:"md",onClick:C},p)))),E&&g&&o.createElement("div",{className:"thumbnail-container is-mobile ".concat(k?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:g})))),f())},et=function(n){var i=n.postId,o=n.message,a=n.photos,r=n.link,l=n.locale,s=n.sanitizeFunction,c=n.replyingUserId,u=n.replyingUserName,d=n.replyingId;return e(void 0,void 0,void 0,(function(){var e,n,m;return t(this,(function(t){switch(t.label){case 0:return e=new FormData,n=P(o.replace(/(\ )+/g," "),s),m=_(n),a&&a.length>0?[4,Promise.all(null==a?void 0:a.map((function(e){return L(e,l)})))]:[3,2];case 1:t.sent().filter(Boolean).slice(0,x).forEach((function(t){e.append("images[]",t)})),t.label=2;case 2:return r&&e.append("link",r),null==m||m.forEach((function(t){e.append("mention_ids[]",t)})),e.append("post_id",i),d&&e.append("parent_id",d),c&&(m.unshift(c),n='[mention+id="'.concat(c,'"+name="').concat((u||"").replace('"',"'"),'"]').concat(n),e.append("parent_user_id",String(c))),e.append("content",n),e.append("content",n),[2,e]}}))}))},tt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,T(E(b.COMMENT.CREATE,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},nt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,T(E(b.COMMENT.REPLY,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},it=function(n){var i=n.commentId,o=n.setLike,a=void 0!==o&&o,r=n.locale;return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,T(E(a?b.COMMENT.LIKE:b.COMMENT.UNLIKE,{_locale:r,id:i}),"GET")]}))}))},ot=function(e){var t=e.id,n=e.locale;return T(E(b.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},at=function(i){var c=i.isReply,u=i.className,p=i.onClose,v=i.replyToName,h=i.style,f=i.replyingId,k=i.replyingUser,C=i.onPostSuccess;i.isMainCmt;var y=i.post,E=i.isMarryBaby,b=a(w),N=b.action,I=N.pushNotifications,T=N.sanitizeFunction,x=b.data,M=x.userInfo,_=x.locale,P=x.env.isMarryBaby,L="boolean"==typeof E?E:P,S=g().t,B=Ze(),R=B.onSelectImages,D=B.onRemoveImage,O=B.imageSrcs,A=B.onRemoveAllImages,z=B.imageFiles,V=r(""),U=V[0],H=V[1],W=a(K).trigger,Z=r(!1),G=Z[0],$=Z[1],q=l(null),ee=l(null),te=l(null),ne=r([]),ie=ne[0],oe=ne[1],ae=r([]),re=ae[0],le=ae[1],se=r(null),ce=se[0],ue=se[1];return s((function(){var e;null===(e=te.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout((function(){var e;null===(e=ee.current)||void 0===e||e.focus()}),400)}),[W]),o.createElement(Q,{"data-is-reply":c,className:u,style:h},c&&o.createElement("div",{className:"reply-to-container"},o.createElement(d,{size:"p4"},o.createElement("span",{dangerouslySetInnerHTML:{__html:S("inputComment.replyTo",{name:'<span style="color: #2D87F3; cursor: pointer">@'.concat(v||"","</span>")})}})),o.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 p&&p()}})),o.createElement("div",{className:"input-container",ref:te},o.createElement(X,{className:"avatar-wrapper ".concat(c?"avatar-wrapper-reply":""),avatar:(null==M?void 0:M.id)?M.avatar:J,username:(null==M?void 0:M.name)||(null==M?void 0:M.username)}),o.createElement("input",{ref:q,onChange:R,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),o.createElement(_e,{value:U,name:"input",size:"md",className:"input-wrapper",displayIcon:o.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:o.createElement("div",{className:"as-input"},o.createElement(j,{className:"textarea",html:U,onChange:H,onImagePickerClick:function(){var e;return null===(e=q.current)||void 0===e?void 0:e.click()},bannedWords:re,onPreviewUrlChange:ue,onInvalidUrlsChange:oe,setEditorRef:function(e){return ee.current=e},isReplying:c}))}),o.createElement(m,{theme:L?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:function(){return e(void 0,void 0,void 0,(function(){var e,i,o,a,r,l,s,u,d,m,v,g,h;return t(this,(function(t){switch(t.label){case 0:if(!(null==y?void 0:y.id)||G)return[2];$(!0),t.label=1;case 1:return t.trys.push([1,4,,5]),e=function(e){H(""),A(),p&&p();var t=Y(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),C&&C(t)},[4,et(n({message:U,photos:z,postId:String(y.id),link:null==ce?void 0:ce.url,sanitizeFunction:T,locale:_},c&&f?{replyingUserId:String((null==k?void 0:k.id)||(null===(r=null==y?void 0:y.author)||void 0===r?void 0:r.id)||""),replyingId:f,replyingUserName:(null==k?void 0:k.name)||(null==k?void 0:k.username)||""}:{}))];case 2:return i=t.sent(),[4,c&&f?nt(i,_):tt(i,_)];case 3:return o=t.sent(),(null==(a=null==o?void 0:o.data)?void 0:a.id)&&!(null===(s=null===(l=null==o?void 0:o.messages)||void 0===l?void 0:l.moderation)||void 0===s?void 0:s.type)?e(o):"banned"===(null===(d=null===(u=null==o?void 0:o.messages)||void 0===u?void 0:u.moderation)||void 0===d?void 0:d.type)?(I({title:S("notification.comment.blocked.title"),message:S("notification.comment.blocked.message"),type:"danger"}),o.messages.moderation.words&&le(o.messages.moderation.words)):"suspect"===(null===(v=null===(m=null==o?void 0:o.messages)||void 0===m?void 0:m.moderation)||void 0===v?void 0:v.type)?(I({title:S("notification.comment.suspect.title"),message:S("notification.comment.suspect.message"),type:"warning"}),H(""),A(),p&&p()):(null===(g=null==o?void 0:o.messages)||void 0===g?void 0:g.find((function(e){var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(I({message:S("notification.suspend.message"),type:"warning"}),H(""),A(),p&&p()):I({title:"",message:(null===(h=null==o?void 0:o.messages)||void 0===h?void 0:h[0])||S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return t.sent(),I({title:"",message:S("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return $(!1),[2]}}))}))},isLoading:G,isDisabled:!!(null==ie?void 0:ie.length)||G||!U||(null==U?void 0:U.length)<2||!U.trim()},o.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==ie?void 0:ie.length)?o.createElement("div",{className:"error-text"},S("notification.limitUrlDomain")):null,(!O||0===O.length)&&ce&&o.createElement("div",{className:"link-preview-wrapper"},ce.isFetching?o.createElement(F,null):o.createElement(o.Fragment,null,o.createElement(Be,{title:ce.title,url:ce.url||"#",image:ce.image,noRefetch:!0}),o.createElement("img",{src:Ge,className:"icon-close",onClick:function(){return ue(null)}}))),O&&O.length>0&&o.createElement("div",{className:"preview-images-container"},O.map((function(e,t){return o.createElement("div",{key:t,className:"image-src-wrapper"},o.createElement("img",{className:"preview-image",src:e}),o.createElement("img",{src:Ge,className:"icon-close-circle",onClick:function(){return D(t)}}))}))))},rt="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",lt=function(n){var i=n.className,l=n.style,s=n.reason,c=n.reasonText,u=n.onClose,p=n.postId,v=a(w),h=v.data,f=h.locale,k=h.env.isMarryBaby,C=v.action.pushNotifications,y=g().t,E=r(!1),b=E[0],N=E[1];return o.createElement($,{"data-is-marrybaby":k,className:i,style:l},o.createElement("ul",{className:"report-list"},o.createElement("li",{className:"report-item"},o.createElement("img",{src:rt}),o.createElement(d,{className:"__label",color:xe.colors.gray800,size:"p4"},c))),o.createElement(m,{theme:k?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:b,onClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!p||b)return[2];N(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,We({id:p,reason:s,locale:f})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(C({message:"Post reported",type:"success"}),u&&u()),[3,4];case 3:return t.sent(),[3,4];case 4:return N(!1),[2]}}))}))}},y("submit")))},st=function(e){var t=e.className,n=e.style,i=e.replyingTo,l=e.mentionedUser,s=e.description,u=e.disableShortenContent,d=e.mentions,m=void 0===d?[]:d,p=r(!1),v=p[0],h=p[1],f=g().t,k=q().authActionWrapper,C=r(!1),y=C[0],E=C[1],b=V(U(s||"","display"),m),N=a(w).action.sanitizeFunction,I=c((function(){var e=N(b||"");if(u||v)return{showContent:e,hasSeeMore:!1};var t=e.slice(0,1e3),n=1e3-27*((t.match(/<\/div>/g)||[]).length-1),i=(t||"").slice(0,n<40?40:n),o=N(i.replace(/(<|<\/)( +|[a-zA-Z]*)$/gi,"")),a=o.length<e.length-10;return{showContent:a?o:e,hasSeeMore:a}}),[u,v,b]),T=(null==l?void 0:l.name)||i,x="expert"===(null==l?void 0:l.role)&&!!(null==l?void 0:l.partnerId);return o.createElement(o.Fragment,null,x&&o.createElement(ee,{isOpen:y,onClose:function(){return E(!1)},expertId:String(null==l?void 0:l.partnerId)}),o.createElement(te,{className:"".concat(t," no-replace-click"),style:n},T&&o.createElement("span",{onClick:function(){return x&&E(!0)},className:"post-content-replying"},"@",T),(null==s?void 0:s.startsWith("[mention+id="))&&o.createElement("span",{className:"post-content-replying tag-only"},"@"),o.createElement("span",{dangerouslySetInnerHTML:{__html:I.showContent},className:"post-content ".concat(I.hasSeeMore?"has-see-more":"")}),I.hasSeeMore&&!v&&o.createElement("span",null,"... ",o.createElement("span",{onClick:function(e){e.preventDefault(),e.stopPropagation(),k((function(){return h(!0)}))},className:"see-more-text"},f("post.seeMore")))))},ct=function(e){var t=e.className,n=e.style,i=e.authorName,a=e.images,l=e.onClose,c=e.onOpenSingleView,u=g().t,m=r(!1),p=m[0],v=m[1];return s((function(){setTimeout((function(){v(!0)}),0)}),[]),Me.createPortal(o.createElement(ne,{className:t,style:n,"data-open":p},o.createElement("div",{className:"top-bar"},o.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:l,alt:"go back"}),o.createElement(d,{size:"p2",type:"bold",style:{textAlign:"center"}},u("previewPhotos.title",{name:i}))),o.createElement("div",{className:"container"},a.map((function(e,t){return o.createElement("img",{className:"img-preview",key:t,src:e,onClick:function(){return null==c?void 0:c(t)},alt:"post img"})})))),f())},ut="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",dt=function(e){var t=e.initialViewIndex,n=e.images,i=e.onClose,a=r(t),l=a[0],c=a[1],u=r(!1),d=u[0],m=u[1];s((function(){setTimeout((function(){m(!0)}),0)}),[]);var p=null==n?void 0:n[l],v=0===l,g=!(null==n?void 0:n.length)||l===(null==n?void 0:n.length)-1;return Me.createPortal(o.createElement(ie,{"data-open":d&&!!p},o.createElement(oe,null,o.createElement("img",{src:ae,className:"icon-close",onClick:i,alt:"close"})),p&&l>=0&&o.createElement(o.Fragment,null,o.createElement(re,null,o.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),o.createElement(le,{"data-disabled":v,onClick:function(){return!v&&c(l-1)}},o.createElement(se,null,o.createElement("img",{src:ut,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),o.createElement(le,{"data-right":!0,"data-disabled":g,onClick:function(){return!g&&c(l+1)}},o.createElement(se,null,o.createElement("img",{src:ut,alt:"right arrow","data-disabled":g})))))),f())},mt=function(e){var t=e.className,n=e.images,i=void 0===n?[]:n,c=e.style,u=e.authorName,d=a(w).data.env.isMarryBaby,m="+ ".concat((i.length||0)-4),p=r(!1),v=p[0],g=p[1],f=r(-1),k=f[0],C=f[1];s((function(){setTimeout((function(){return null==Se?void 0:Se.update()}),100)}),[null==i?void 0:i.slice(0,5).join("|")]);var y=i.length>5,E=l(!1);return s((function(){return function(){E.current&&h(!1)}}),[]),s((function(){v||k>=0?(h(!0),E.current=!0):(h(!1),E.current=!1)}),[v,k]),o.createElement(o.Fragment,null,o.createElement(ce,{className:t,style:c,"data-image-count":y?5:i.length||0,"data-is-marrybaby":d},null==i?void 0:i.slice(0,5).map((function(e,t){return o.createElement("div",{className:"img-wrapper",key:t,onClick:function(){t>=4&&y?g(!0):C(t)}},!d&&o.createElement("img",{className:"lazy img-preview-blur","data-src":e}),o.createElement("img",{className:"lazy img-preview","data-src":e}),4===t&&y&&o.createElement("div",{className:"img-more-overlay"},o.createElement(Le,{tag:"h1",color:"white"},m)))}))),v&&o.createElement(ct,{authorName:u||"",images:i,onClose:function(){return g(!1)},onOpenSingleView:C}),k>=0&&o.createElement(dt,{images:i,initialViewIndex:k,onClose:function(){return C(-1)}}))},pt=function(i){var u=i.url,d=i.image,m=i.className,p=i.style,v=a(w).data.locale,g=r(null),h=g[0],f=g[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return d?[2]:u?(f((function(e){return n(n({},e),{isFetching:!0})})),y(E(b.FETCH_PREVIEW,{_locale:v}),"POST",{data:{link:u}}).then((function(e){var t,n;f({url:u,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(){f(null)})),[2]):[2,f(null)]}))}))}),[u,d]);var k=(null==h?void 0:h.image)||d,N=(null==h?void 0:h.url)||u,I=c((function(){return ue(N)}),[N]),T=c((function(){return de(N)}),[N]),x=l(0),M=l(0),_=r(!1),P=_[0],L=_[1];s((function(){var e=function(){var e,t=null===(e=S.current)||void 0===e?void 0:e.getBoundingClientRect(),n=!1;t&&(!x.current||Math.abs((x.current-t.width)/(null==t?void 0:t.width))>.2)&&(x.current=Math.floor(t.width),n=!0),t&&(!M.current||Math.abs((M.current-t.height)/(null==t?void 0:t.height))>.2)&&(M.current=Math.floor(t.height),n=!0),n&&L((function(e){return!e}))};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]);var S=l(null),j=l(!1);return o.createElement(me,{className:"".concat(m," no-replace-click"),style:p,ref:S},d||!I&&!T?o.createElement("a",{href:N,target:"_blank",rel:"noreferrer"},o.createElement("div",{className:"link-image-wrapper ".concat((null==h?void 0:h.isFetching)?"fetching":"")},(null==h?void 0:h.isFetching)?o.createElement(F,{className:"loading-spinner"}):o.createElement("img",{className:"link-image",src:k||C,onError:function(e){j.current||(j.current=!0,e.currentTarget.src=C)}}))):o.createElement("div",{className:"link-image-wrapper"},I?o.createElement("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/".concat(I,"?&autoplay=1&mute=1"),frameBorder:"0",allowFullScreen:!0,style:{position:"absolute",top:0,left:0,border:"none",overflow:"hidden"}}):T?o.createElement("iframe",{key:String(P),src:"https://www.facebook.com/plugins/video.php?href=".concat(encodeURIComponent(N),"&autoplay=1&show_text=false&t=0&width=").concat(x.current,"&height=").concat(M.current),style:{position:"absolute",top:"50%",left:"50%",border:"none",overflow:"hidden",height:M.current,width:x.current,transform:"translate(-50%, -50%)"},scrolling:"no",frameBorder:"0",allowFullScreen:!0,allow:"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"}):null))},vt="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",gt="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",ht="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",ft=function(n){var i=n.onDeleteComment,l=n.commentId,s=n.className,c=void 0===s?"":s,u=n.popoverClassName,d=void 0===u?"":u,m=a(w),p=m.data,v=p.env.isMarryBaby,h=p.locale,f=m.action.pushNotifications,k=g().t,C=r(!1),y=C[0],E=C[1],b=q().authActionWrapper;return o.createElement("div",{className:c,onClick:function(e){e.preventDefault(),e.stopPropagation()}},y&&o.createElement(qe,{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:k("popup.deleteComment.title"),description:k("popup.deleteComment.description"),acceptText:k("popup.deletePost.accept"),cancelText:k("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return l?[4,ot({id:l,locale:h})]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(i&&i(),f({title:"",message:k("notification.success"),type:"success"})):f({title:"",message:(null===(n=null==e?void 0:e.messages)||void 0===n?void 0:n[0])||k("notification.failure"),type:"danger"}),[2]}}))}))},onClose:function(){return E(!1)}}),o.createElement(pe,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:ht,label:k("actionPopover.delete"),onClick:function(){b((function(){E(!0)}))}}]},className:d,toggleButtonContent:o.createElement("img",{src:v?vt:gt}),buttonProps:{}}))},wt=function(i){var l,u,d,p,h,f=i.className,k=i.style,C=i.comment,E=i.type,b=void 0===E?"comment":E,N=i.level,I=void 0===N?0:N,T=i.replyingId,x=i.onPostCommentSuccess,M=i.post,_=i.onDeleteComment,P=i.refetchComment,L=i.hasQuickBookingEnable,S=i.handleMakeAppointment,j=a(w).data,B=j.locale,F=j.userInfo,R=j.env.isMarryBaby,D=g().t,O=r(C||null),A=O[0],z=O[1],V=A.id;A.countReplies;var U=A.countLikes,H=A.content,W=A.createdAt,Z=A.replies,G=void 0===Z?[]:Z,K=A.images,Q=void 0===K?[]:K,X=A.author,J=A.liked,Y=A.link,$=A.mentionedUser,ee=A.mentions,te=function(e){try{var t=e.match(/\[@([^\]]+)\]/),n=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:n}}catch(e){}return{text:""}}(H),ne=te.text,ie=te.replyingTo,oe=q({_joinCommunityIds:[null===(l=null==M?void 0:M.community)||void 0===l?void 0:l.id],_joinTopicIds:null===(u=null==M?void 0:M.topics)||void 0===u?void 0:u.map((function(e){return e.id}))}).authActionWrapper,ae=r(4),re=ae[0],le=ae[1],se=!!(null==F?void 0:F.id)&&(null==G?void 0:G.some((function(e){return e.author.id===F.id}))),ce=function(e){z((function(t){if(!t.replies.find((function(t){return t.id===e.id}))){t.replies.unshift(e);var i=n(n({},t),{replies:t.replies.slice(),countReplies:t.countReplies+1});return P&&P(i),i}return t}))},ue=r(!1),de=ue[0],me=ue[1],pe=c((function(){return"comment"===b&&G&&0!=G.length?G.sort((function(e,t){var n=new Date(e.createdAt).getTime(),i=new Date(t.createdAt).getTime();return n>i?-1:n<i?1:0})):G}),[b,G]),ye=(null==G?void 0:G.length)||0,Ee=String(null==X?void 0:X.email)&&(null==F?void 0:F.email)&&String(null==X?void 0:X.email)===String(null==F?void 0:F.email),be=(null==X?void 0:X.name)||(null==X?void 0:X.username)||"",Ne=null==X?void 0:X.avatar,Ie=(null==X?void 0:X.username)||(null==X?void 0:X.name)||"",Te=r(null),xe=Te[0],Me=Te[1],_e=r(null),Pe=_e[0],Le=_e[1];s((function(){if(null==X?void 0:X.hospitalId){n=X.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:je[B]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&Me(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==X?void 0:X.doctorId){i=X.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_DOCTOR_INFO,{doctorId:i,website_url:je[B]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Le(null==e?void 0:e._data.doctor),[2]}}))}))}}),[X.hospitalId,X.doctorId]);var Se=(null==Pe?void 0:Pe.valid_outpatient)||(null==Pe?void 0:Pe.valid_telemedicine),Fe=((null==xe?void 0:xe.total_available_service)||(null==xe?void 0:xe.total_available_doctor))>0,Re=L&&(Se||Fe);return o.createElement(ve,{defaultParams:{_joinCommunityIds:[null===(d=null==M?void 0:M.community)||void 0===d?void 0:d.id],_joinTopicIds:null===(p=null==M?void 0:M.topics)||void 0===p?void 0:p.map((function(e){return e.id}))}},o.createElement(ge,{className:f,style:k,"data-is-reply":!!I,"data-is-marrybaby":R,"data-has-booking":Re},"reply"===b&&o.createElement(v,{className:"top-divider",type:"solid"}),o.createElement(he,{avatar:Ne,name:be,username:Ie,email:null==X?void 0:X.email,time:W,className:"post-author ".concat(Ee?"with-popover":""),type:b,userId:null==X?void 0:X.id,role:null==X?void 0:X.role,expertId:null==X?void 0:X.partnerId,title:null==X?void 0:X.title,doctorId:null==X?void 0:X.doctorId,hospitalId:null==X?void 0:X.hospitalId,hasQuickBooking:Re,handleMakeAppointment:S}),o.createElement(st,{className:"post-content-wrapper",replyingTo:ie,mentionedUser:$,description:ne,mentions:ee}),o.createElement("span",null),o.createElement("span",null),Q&&Q.length>0?o.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},o.createElement(mt,{images:Q,authorName:null==X?void 0:X.username})):null,Q&&0!==Q.length||!Y?null:o.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},o.createElement(Be,{url:Y})),"most-engaging"!==b?o.createElement(o.Fragment,null,o.createElement(fe,{type:we.reply,loveCount:U,replyCount:ye,className:"post-reaction",liked:J,isReplied:se,hideCommentIcon:"reply"===b,onCommentClick:function(){return oe((function(){return me((function(e){return!e}))}))},onCommentCountClick:function(){return oe((function(){me(!0)}))},onLikeClick:function(){return oe((function(){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return V?[4,it({commentId:V,setLike:!J,locale:B})]:[3,2];case 1:1===e.sent().status&&z((function(e){return n(n({},e),{liked:!J,countLikes:e.countLikes+(J?-1:1)})})),e.label=2;case 2:return[2]}}))}))}))}}),de&&o.createElement(at,{replyingId:T||A.id,replyToName:X.name||X.username||"",isReply:!0,onClose:function(){return me(!1)},onPostSuccess:function(e){"reply"===b?x&&x(e):ce(e)},post:M,replyingUser:X}),"comment"===b&&G&&G.length>0?o.createElement("div",{className:"comment-reply-wrapper"},null===(h=null==pe?void 0:pe.slice(0,re))||void 0===h?void 0:h.map((function(e){return o.createElement(wt,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:I+1,replyingId:V,onPostCommentSuccess:ce,post:M,onDeleteComment:function(){z((function(t){return n(n({},t),{replies:t.replies.filter((function(t){return t.id!==e.id})),countReplies:t.countReplies-1})}))},handleMakeAppointment:S,hasQuickBookingEnable:L})})),ye>re&&o.createElement(o.Fragment,null,o.createElement(v,{className:"top-divider",type:"solid"}),o.createElement(m,{className:"more-cmt",size:"lg",color:"ghost",onClick:function(){return le((function(e){return e+4}))}},D("comment.seeMoreReplies",{count:ye-re}),o.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,Ee&&o.createElement(ft,{onDeleteComment:_,className:"popover",commentId:A.id})))},kt="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",Ct="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",yt="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",Et=function(n){var i=n.authorEmail,l=n.onDeletePost,s=n.shareUrl,c=n.post,u=n.className,d=void 0===u?"":u,m=n.popoverClassName,p=void 0===m?"":m,v=n.onBookmark,h=n.onRemoveBookmark,f=n.onEditPost,k=a(w),C=k.data,y=C.locale,N=C.userInfo,I=C.togetherUserId,x=C.env.isMarryBaby,M=k.action.pushNotifications,_=g().t,P=r(!1),L=P[0],S=P[1],j=r(!1),B=j[0],F=j[1],R=r(!1),D=R[0],O=R[1],A=q().authActionWrapper,z=i&&(null==N?void 0:N.email)&&i===String(null==N?void 0:N.email);return o.createElement("div",{className:d,onClick:function(e){e.preventDefault(),e.stopPropagation()}},D&&o.createElement(ye,{url:s,text:null==c?void 0:c.title,onClose:function(){return O(!1)}}),B&&o.createElement(qe,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:_("popup.deletePost.title"),description:_("popup.deletePost.description"),acceptText:_("popup.deletePost.accept"),cancelText:_("popup.deletePost.cancel"),onAccept:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!(null==c?void 0:c.id)||L)return[2];S(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ze({id:c.id,locale:y})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(null==l||l()),[3,4];case 3:return t.sent(),[3,4];case 4:return S(!1),[2]}}))}))},onClose:function(){return F(!1)}}),o.createElement(pe,{className:p,toggleButtonContent:o.createElement("img",{src:x?vt:gt}),position:"bottom",align:"end",buttonProps:{isLoading:L},data:z?{isShowheader:!1,type:"list",list:[{icon:yt,label:_("morePopover.share"),onClick:function(){return O(!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:_("actionPopover.edit"),onClick:f},{icon:ht,label:_("actionPopover.delete"),onClick:function(){A((function(){return F(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:yt,label:_("morePopover.share"),onClick:function(){return O(!0)}},{icon:(null==c?void 0:c.bookmarked)?kt:Ct,label:(null==c?void 0:c.bookmarked)?_("morePopover.unsavePost"):_("morePopover.savePost"),onClick:function(){A((function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return(null==N?void 0:N.id)&&(null==c?void 0:c.id)?(null==c?void 0:c.bookmarked)?[4,T(E(b.BOOKMARK.DELETE,{_locale:y}),"DELETE",{data:{post_id:String(c.id)}})]:[3,2]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(M({title:"",message:"Removed saved post",type:"success",displayIcon:Ct}),h&&h()):M({title:"",message:"Remove failed",type:"danger",displayIcon:Ct}),[3,4];case 2:return[4,T(E(b.BOOKMARK.CREATE,{_locale:y}),"POST",{data:{user_id:I||N.id,post_id:c.id}})];case 3:1===(null==(e=t.sent())?void 0:e.status)?(M({title:"",message:"Post saved",type:"success",displayIcon:kt}),v&&v()):M({title:"",message:"Post saved failed",type:"danger",displayIcon:Ct}),t.label=4;case 4:return[2]}}))}))}))}},{icon:rt,label:_("morePopover.report"),subTree:{title:_("morePopover.report.title"),description:_("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(Ee).map((function(e){return{label:Ee[e].label,reason:Ee[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:_(e.label),subTree:{title:_("morePopover.reportSubmit.title"),description:_("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return o.createElement(lt,{reason:e.reasonValue,reasonText:_(e.reason),postId:null==c?void 0:c.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},bt=function(n,i){return e(void 0,void 0,void 0,(function(){var e,o,a,r;return t(this,(function(t){switch(t.label){case 0:return[4,Te(E(b.COMMENT.LIST,{postId:n,_locale:i,sort:"popularity",perPage:1,withoutReply:1}),"GET")];case 1:return e=t.sent(),[2,null===(r=null===(a=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.comments)||void 0===a?void 0:a.map(Y))||void 0===r?void 0:r[0]]}}))}))},Nt=function(i){var l=i.className,c=i.style,u=i.hideViewMoreComment,d=i.showMostEngaging,p=i.onCommentClick,v=i.onCommentCountClick,h=i.onMostEngagingCommentClick,f=i.onPostCommentSuccess,k=i.disableCardLink,E=i.disableShortenContent,b=i.onDeletePost,N=i.onEditPost,I=i.post,T=i.mostEngagingComment,x=i.onDeleteComment,M=i.showInputComment,_=i.InlineCommentsComponent,P=i.hasQuickBookingEnable,L=i.handleMakeAppointment,S=r(I),j=S[0],F=S[1],R=r(!1),D=R[0],O=R[1],A=r(T),z=A[0],V=A[1],U=j.community,H=j.topics,W=j.author,Z=j.slug,G=j.isPin,K=j.liked,Q=j.scheduleDateTime,X=j.createdAt,J=j.photos,Y=j.mentions,$=j.title,ee=j.description,te=j.previewUrl,ne=j.likesCount,ie=j.commentsCount,oe=j.id,ae=j.commented,re=a(w),le=re.data,se=le.locale,ce=le.env,ue=ce.isMarryBaby,de=ce.togetherBasePath,me=re.action.pushNotifications,pe=g().t,ge=r(M),Ee=ge[0],Te=ge[1],xe="".concat(de,"/").concat((null==U?void 0:U.slug)||"_","/").concat(Z||""),Me="".concat(be(se)).concat(xe),_e=q((null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==H?void 0:H.map((function(e){return e.id}))}:void 0).authActionWrapper,Pe=r(!1),Se=Pe[0],je=Pe[1];s((function(){Te(M)}),[M]);var Oe=(null==W?void 0:W.name)||(null==W?void 0:W.username)||"",ze=(null==W?void 0:W.username)||(null==W?void 0:W.name)||"",Ve=null==W?void 0:W.avatar,Ue=r(null),He=Ue[0],We=Ue[1],Ze=r(null),Ge=Ze[0],Ke=Ze[1];s((function(){if(null==W?void 0:W.hospitalId){n=W.hospitalId,e(void 0,void 0,void 0,(function(){var e,i;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:Ie[se]}),"get")];case 1:return e=t.sent(),(null===(i=null==e?void 0:e._data)||void 0===i?void 0:i.branch)&&We(null==e?void 0:e._data.branch),[2]}}))}))}var n,i;if(null==W?void 0:W.doctorId){i=W.doctorId,e(void 0,void 0,void 0,(function(){var e,n;return t(this,(function(t){switch(t.label){case 0:return[4,y(ke(Ce.GET_DOCTOR_INFO,{doctorId:i,website_url:Ie[se]}),"get")];case 1:return e=t.sent(),(null===(n=null==e?void 0:e._data)||void 0===n?void 0:n.doctor)&&Ke(null==e?void 0:e._data.doctor),[2]}}))}))}}),[W.hospitalId,W.doctorId]);var Qe=(null==Ge?void 0:Ge.valid_outpatient)||(null==Ge?void 0:Ge.valid_telemedicine),Xe=((null==He?void 0:He.total_available_service)||(null==He?void 0:He.total_available_doctor))>0,Je=P&&(Qe||Xe);s((function(){e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return oe&&ie&&d&&!(null==T?void 0:T.id)?[4,bt(oe,se)]:[3,2];case 1:e=t.sent(),V(e),t.label=2;case 2:return[2]}}))}))}),[oe,se,ie,d,null==T?void 0:T.id]),s((function(){V(T)}),[null==T?void 0:T.id]);var Ye=function(i){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return ie>1&&(null==z?void 0:z.id)&&(null==z?void 0:z.id)===(null==i?void 0:i.id)?[4,bt(oe,se)]:[3,2];case 1:e=t.sent(),V(e),t.label=2;case 2:return F((function(e){return n(n({},e),{commentsCount:e.commentsCount-1})})),x&&x(i),[2]}}))}))};return o.createElement(ve,{defaultParams:(null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==H?void 0:H.map((function(e){return e.id}))}:void 0},D&&o.createElement(ye,{url:Me,avatar:C,text:$,onClose:function(){return O(!1)}}),o.createElement(Ne,{className:l,style:c,"data-is-marrybaby":ue},G?o.createElement(Re,{className:"post-pin"}):null,o.createElement("div",{style:{position:"relative"}},o.createElement(he,{avatar:Ve,name:Oe,username:ze,url:k?void 0:xe,email:null==W?void 0:W.email,time:Q||X,community:U,className:"post-author",role:null==W?void 0:W.role,userId:null==W?void 0:W.id,expertId:null==W?void 0:W.partnerId,doctorId:null==W?void 0:W.doctorId,hospitalId:null==W?void 0:W.hospitalId,title:null==W?void 0:W.title,hasQuickBooking:Je,handleMakeAppointment:L}),o.createElement(Et,{authorEmail:String(null==W?void 0:W.email),onDeletePost:b,shareUrl:Me,post:j,className:"popover",onEditPost:N})),o.createElement("a",{href:k?void 0:xe,className:"post-content-link-wrapper"},$&&o.createElement(Le,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},B($)),o.createElement(st,{className:"post-content-wrapper",description:ee,disableShortenContent:E,mentions:Y})),o.createElement("span",null),o.createElement("span",null),o.createElement("div",{key:"tag-topic"},H&&H.length>0?o.createElement(Fe,{topics:H,className:"post-topics"}):null),o.createElement("div",{key:"social-preview"},(null==j?void 0:j.introUrl)?o.createElement("div",{className:"social-preview-wrapper ".concat((null==J?void 0:J.length)?"has-image":"")},o.createElement(pt,{url:j.introUrl,image:j.bannerImage})):null),o.createElement("div",{key:"image-preview"},(null==J?void 0:J.length)?o.createElement("div",{className:"image-preview-wrapper"},o.createElement(mt,{images:J,authorName:null==W?void 0:W.name})):null),o.createElement("div",{key:"link-preview"},(null==j?void 0:j.introUrl)||(null==J?void 0:J.length)||!(null==te?void 0:te.url)?null:o.createElement("div",{className:"link-preview-wrapper"},o.createElement(Be,{title:te.title,url:te.url,image:te.image}))),o.createElement(fe,{type:we.post,loveCount:ne,replyCount:ie,className:"post-reaction ".concat((null==J?void 0:J.length)||(null==te?void 0:te.url)?"hide-top-border":""),liked:Se?!K:K,isReplied:ae,onCommentClick:function(){return _e((function(){p?p():Te((function(e){return!e}))}))},onCommentCountClick:function(){_e((function(){ue?Te(!0):v?v():!k&&(window.location.href=xe)}))},onShareClick:function(){O(!0)},onLikeClick:function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:if(!oe||Se)return[2];je(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ae({id:oe,locale:se})];case 2:return 1!==(null==(e=t.sent())?void 0:e.status)?me(De(pe)):F((function(e){return n(n({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked})})),[3,4];case 3:return t.sent(),me(De(pe)),[3,4];case 4:return je(!1),[2]}}))}))},showingMostEngaging:!(!d||!(null==z?void 0:z.id))}),Ee&&o.createElement(at,{isMainCmt:!M,onClose:function(){return Te(!1)},onPostSuccess:function(e){0!==ie||(null==z?void 0:z.id)||V(e),F((function(e){return n(n({},e),{commentsCount:e.commentsCount+1,commented:!0})})),f&&f(e)},post:j}),d&&(null==z?void 0:z.id)?o.createElement("div",{className:"most-engaging-wrapper",onClick:function(e){h?(e.stopPropagation(),h()):window.location.href=xe}},o.createElement(wt,{hasQuickBookingEnable:P,handleMakeAppointment:L,comment:z,onDeleteComment:function(){Ye&&Ye(z)},className:"most-engaging-comment",type:"most-engaging",key:z.id}),ie>1&&!u&&o.createElement(m,{className:"see-more-comments",color:"ghost",size:"md"},pe("comment.seeMoreComments",{count:ie-1}))):null,_))},It=Object.freeze({__proto__:null});export{Be as C,at as I,Re as L,qe as P,lt as S,Fe as T,$e as a,Ke as b,Xe as c,Je as d,st as e,ct as f,dt as g,mt as h,Nt as i,Et as j,wt as k,ft as l,It as t};
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ageGenerate-bcd37ccf.js"),o=require("./constants-d4ec4195.js"),r=require("./index-84b9f3e8.js"),t=require("./index.styled-4a3d1b58.js"),a=require("./index.styled-b187cc54.js"),s=require("./index-12a7ec3c.js"),i=require("./index-164221e6.js"),p=require("./index-aa538c1f.js"),n=require("./index-ea33edba.js"),x=require("./index-c198e6e5.js"),u=require("./index.styled-4b2a8c64.js"),l=require("./useTranslations-a86f0d1c.js"),d=require("./useScrollbarSize-586f6706.js"),g=require("./translationsProvider-91e90e10.js"),c=require("./translationsContext-f8e45a1a.js"),C=require("./types-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ageGenerate-bcd37ccf.js"),o=require("./constants-d4ec4195.js"),r=require("./index-84b9f3e8.js"),t=require("./index.styled-4a3d1b58.js"),a=require("./index.styled-b187cc54.js"),s=require("./index-12a7ec3c.js"),i=require("./index-164221e6.js"),p=require("./index-aa538c1f.js"),n=require("./index-ea33edba.js"),x=require("./index-c198e6e5.js"),u=require("./index.styled-4b2a8c64.js"),l=require("./useTranslations-a86f0d1c.js"),d=require("./useScrollbarSize-586f6706.js"),g=require("./translationsProvider-91e90e10.js"),c=require("./translationsContext-f8e45a1a.js"),C=require("./types-8f709939.js"),P=require("./types-55844911.js"),h=require("./constants-ea7b35a2.js"),b=require("./types-9555904f.js"),m=require("./cookieHelper-612b90fa.js"),y=require("./number-95704111.js");require("react"),require("styled-components");var T=require("./theme-6cd33b22.js"),f=require("./routing-3fb6d350.js");require("date-fns"),require("./tslib.es6-f7929e76.js"),require("react-range"),require("react-id-generator"),require("react-day-picker/DayPickerInput"),require("react-dom"),require("lodash"),require("./useOutsideClick-528bfd6c.js"),require("date-fns/locale/en-US"),require("date-fns/locale/id"),require("date-fns/locale/vi"),require("date-fns/locale/zh-TW"),require("lodash/debounce"),require("react-loading-skeleton"),require("date-fns/locale/hi"),require("date-fns/locale/ms"),require("date-fns/locale/th"),require("./core-8fcc56eb.js"),require("smoothscroll-polyfill"),require("lodash/shuffle"),exports.Types=e.index,exports.ageGenerate=e.ageGenerate,exports.useFbDataLayer=e.useFbDataLayer,exports.Constants=o.constants,exports.Alert=r.Alert,exports.AmpNextPage=r.AmpNextPage,exports.ArticleCard=r.ArticleCard,exports.Badge=r.Badge,exports.BorderHeading=r.BorderHeading,exports.Breadcrumbs=r.Breadcrumbs,exports.Carousel=r.Carousel,exports.CategoryCard=r.CategoryCard,exports.Checkbox=r.Checkbox,exports.CheckboxGroup=r.CheckboxGroup,exports.CookieAcceptConfirm=r.CookieAcceptConfirm,exports.DatePicker=r.DatePicker,exports.DateRangePicker=r.DateRangePicker,exports.FileDropdown=r.FileDropdown,exports.FloatButtonGroup=r.FloatButtonGroup,exports.Footer=r.Footer,exports.Grid=r.Grid,exports.IconText=r.IconText,exports.Layout=r.Layout,exports.Modal=r.Modal,exports.NavigationBar=r.NavigationBar,exports.NavigationLayout=r.NavigationLayout,exports.Pagination=r.Pagination,exports.Progress=r.Progress,exports.ProgressBar=r.ProgressBar,exports.Radio=r.Radio,exports.RadioGroup=r.RadioGroup,exports.RateStars=r.RateStars,exports.SeoHead=r.SeoHead,exports.Shadow=r.Shadow,exports.SideMenu=r.index,exports.SiteWide=r.SiteWide,exports.Slider=r.Slider,exports.StatisticCard=r.StatisticCard,exports.StickySponsoredBy=r.StickySponsoredBy,exports.SurveyThankyouCard=r.SurveyThankyouCard,exports.Table=r.index$1,exports.Tabs=r.Tabs,exports.Tag=r.Tag,exports.Toggle=r.Toggle,exports.UnderlinedLink=r.UnderlinedLink,exports.Uploader=r.Uploader,exports.Avatar=t.Avatar,exports.CardAuthor=t.CardAuthor,exports.CardReactions=t.CardReactions,exports.DefaultComponentGlobalContextData=t.DefaultComponentGlobalContextData,Object.defineProperty(exports,"GlobalData",{enumerable:!0,get:function(){return t.GlobalData}}),exports.LabelSortPin=t.LabelSortPin,exports.LabelSorting=t.LabelSorting,exports.Loading=t.Loading,exports.PopoverMenu=t.PopoverMenu,exports.Popup=t.Popup,exports.PopupDoctor=t.PopupDoctor,exports.PopupExpert=t.PopupExpert,exports.PopupFrame=t.PopupFrame,exports.PopupHospital=t.PopupHospital,exports.ShareBox=t.ShareBox,exports.SharePopup=t.SharePopup,exports.TogetherAuthConfigContext=t.TogetherAuthConfigContext,exports.TogetherAuthConfigContextProvider=t.TogetherAuthConfigContextProvider,exports.TogetherComponentGlobalContext=t.TogetherComponentGlobalContext,exports.TogetherComponentGlobalContextProvider=t.TogetherComponentGlobalContextProvider,exports.TogetherConstants=t.constants,exports.TogetherDataTransforms=t.dataTransform,exports.UserAvatar=t.UserAvatar,exports.useTogetherAuthRequiredAction=t.useTogetherAuthRequiredAction,exports.BabyGrowthSwitch=a.BabyGrowthSwitch,exports.BabyGrowthTooltip=a.BabyGrowthTooltip,exports.Button=a.Button,exports.Container=a.Container,exports.Label=a.Label,exports.Logo=a.Logo,exports.Menu=a.Menu,exports.PureInput=a.PureInput,exports.RadioImageGroup=a.RadioImageGroup,exports.Text=a.Text,exports.TextArea=a.TextArea,exports.TextDivider=a.TextDivider,exports.Divider=s.Divider,exports.Dropdown=s.Dropdown,exports.DoctorInfo=i.DoctorInfo,exports.Flag=i.Flag,exports.LanguageSwitcher=i.LanguageSwitcher,exports.MobileBottomNavigation=i.MobileBottomNavigation,exports.MobileBottomNavigationIcon=i.MobileBottomNavigationIcon,exports.NavigationLogoutPopup=i.NavigationLogoutPopup,exports.NavigationProfileButton=i.NavigationProfileButton,exports.NavigationV2=i.NavigationV2,exports.ProfilePopup=i.ProfilePopup,exports.ScrollList=i.ScrollList,exports.SurveyQuestionCard=i.SurveyQuestionCard,exports.UserProfileNavigation=i.UserProfileNavigation,exports.UserProfileNavigationHeader=i.NavHeader,exports.UserProfileNavigationStats=i.UserStats,exports.defaultTranslation=i.defaultTranslation,exports.getNavMenuContent=i.getNavMenuContent,exports.getNavMenuContentWithCache=i.getNavMenuContentWithCache,exports.Heading=p.Heading,exports.Input=n.Input,exports.BabyGrowthChooseProfileDrawer=x.BabyGrowthChooseProfileDrawer,exports.BabyGrowthGender=x.BabyGrowthGender,exports.BabyGrowthLegend=x.BabyGrowthLegend,exports.BabyGrowthProfileRadio=x.BabyGrowthProfileRadio,exports.BabyGrowthRecord=x.BabyGrowthRecord,exports.ChildCard=x.ChildCard,exports.Icon=x.Icon,exports.Drawer=u.Drawer,exports.Breakpoints=l.Breakpoints,exports.MediaQueries=l.MediaQueries,exports.fadeIn=l.fadeIn,exports.formatUrlWithPageParam=l.formatUrlWithPageParam,exports.getBoundariesFromMediaQueryKey=l.getBoundariesFromMediaQueryKey,exports.getPopupWrapperDom=l.getPopupWrapperDom,exports.makeParams=l.makeParams,exports.slideInDown=l.slideInDown,exports.slideInLeft=l.slideInLeft,exports.slideInRight=l.slideInRight,exports.slideInUp=l.slideInUp,exports.slideOutDown=l.slideOutDown,exports.slideOutLeft=l.slideOutLeft,exports.slideOutRight=l.slideOutRight,exports.slideOutUp=l.slideOutUp,exports.toggleNoScroll=l.toggleNoScroll,exports.useTranslations=l.useTranslations,exports.MEASURE_ELEMENT_CLASS=d.MEASURE_ELEMENT_CLASS,exports.useScrollbarSize=d.useScrollbarSize,exports.TranslationsProvider=g.TranslationsProvider,exports.translationsMap=g.translationsMap,exports.TranslationsContext=c.TranslationsContext,exports.defaultTranslations=c.defaultTranslations,exports.CardLink=C.CardLink,exports.CardPost=C.CardPost,exports.CardPostPopoverMore=C.CardPostPopoverMore,exports.CardReply=C.CardReply,exports.CardReplyPopover=C.CardReplyPopover,exports.CreateNewPostContent=C.CreateNewPostContent,exports.CreatePostDescription=C.CreatePostDescription,exports.CreatePostTitle=C.CreatePostTitle,exports.ImagePreviewPopup=C.ImagePreviewPopup,exports.InputCommentBar=C.InputCommentBar,exports.LabelPin=C.LabelPin,exports.PopupDanger=C.PopupDanger,exports.PostContent=C.PostContent,exports.PostImagePreview=C.PostImagePreview,exports.PostSingleImageViewPopup=C.PostSingleImageViewPopup,exports.SubmitReportForm=C.SubmitReportForm,exports.TagTopic=C.TagTopic,exports.TogetherTypes=C.types,exports.TopicSelectList=C.TopicSelectList,exports.BookingSearchBar=P.BookingSearchBar,exports.CareTypes=P.types,exports.CareConstants=h.constants,exports.EcomApiTypes=b.apiTypes,exports.EcomConstants=b.constants,exports.EcomDataFormatter=b.index,exports.EcomDataTypes=b.dataTypes,exports.EcomTypes=b.types,exports.deleteCookie=m.deleteCookie,exports.getCookie=m.getCookie,exports.setCookie=m.setCookie,exports.abbreviateNumber=y.abbreviateNumber,Object.defineProperty(exports,"lazyLoadInstance",{enumerable:!0,get:function(){return y.lazyLoadInstance}}),exports.theme=T.theme,exports.getCareApiDomain=f.getCareApiDomain,exports.getCurrentBaseUrl=f.getCurrentBaseUrl,exports.getCurrentSsoUrl=f.getCurrentSsoUrl,exports.getDiscoverApiDomain=f.getDiscoverApiDomain,exports.getTogetherApiDomain=f.getTogetherApiDomain;
|
package/build/together.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./index.styled-4a3d1b58.js"),r=require("./types-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./index.styled-4a3d1b58.js"),r=require("./types-8f709939.js");require("./tslib.es6-f7929e76.js"),require("styled-components"),require("react"),require("./cookieHelper-612b90fa.js"),require("./index.styled-b187cc54.js"),require("./theme-6cd33b22.js"),require("./useTranslations-a86f0d1c.js"),require("./translationsContext-f8e45a1a.js"),require("./number-95704111.js"),require("./index-aa538c1f.js"),require("date-fns"),require("date-fns/locale/en-US"),require("date-fns/locale/hi"),require("date-fns/locale/id"),require("date-fns/locale/ms"),require("date-fns/locale/th"),require("date-fns/locale/vi"),require("date-fns/locale/zh-TW"),require("./constants-d4ec4195.js"),require("react-id-generator"),require("./index-ea33edba.js"),require("lodash"),require("react-dom"),require("./index-12a7ec3c.js"),require("react-range"),require("lodash/debounce"),exports.CardAuthor=e.CardAuthor,exports.CardReactions=e.CardReactions,exports.DefaultComponentGlobalContextData=e.DefaultComponentGlobalContextData,Object.defineProperty(exports,"GlobalData",{enumerable:!0,get:function(){return e.GlobalData}}),exports.LabelSortPin=e.LabelSortPin,exports.LabelSorting=e.LabelSorting,exports.Loading=e.Loading,exports.PopoverMenu=e.PopoverMenu,exports.PopupDoctor=e.PopupDoctor,exports.PopupExpert=e.PopupExpert,exports.PopupFrame=e.PopupFrame,exports.PopupHospital=e.PopupHospital,exports.ShareBox=e.ShareBox,exports.SharePopup=e.SharePopup,exports.TogetherAuthConfigContext=e.TogetherAuthConfigContext,exports.TogetherAuthConfigContextProvider=e.TogetherAuthConfigContextProvider,exports.TogetherComponentGlobalContext=e.TogetherComponentGlobalContext,exports.TogetherComponentGlobalContextProvider=e.TogetherComponentGlobalContextProvider,exports.TogetherConstants=e.constants,exports.TogetherDataTransforms=e.dataTransform,exports.UserAvatar=e.UserAvatar,exports.useTogetherAuthRequiredAction=e.useTogetherAuthRequiredAction,exports.CardLink=r.CardLink,exports.CardPost=r.CardPost,exports.CardPostPopoverMore=r.CardPostPopoverMore,exports.CardReply=r.CardReply,exports.CardReplyPopover=r.CardReplyPopover,exports.CreateNewPostContent=r.CreateNewPostContent,exports.CreatePostDescription=r.CreatePostDescription,exports.CreatePostTitle=r.CreatePostTitle,exports.ImagePreviewPopup=r.ImagePreviewPopup,exports.InputCommentBar=r.InputCommentBar,exports.LabelPin=r.LabelPin,exports.PopupDanger=r.PopupDanger,exports.PostContent=r.PostContent,exports.PostImagePreview=r.PostImagePreview,exports.PostSingleImageViewPopup=r.PostSingleImageViewPopup,exports.SubmitReportForm=r.SubmitReportForm,exports.TagTopic=r.TagTopic,exports.TogetherTypes=r.types,exports.TopicSelectList=r.TopicSelectList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./tslib.es6-f7929e76.js"),t=require("react"),n=require("./index.styled-b187cc54.js"),a=require("./index-12a7ec3c.js"),o=require("./useTranslations-a86f0d1c.js"),i=require("./index.styled-4a3d1b58.js"),l=require("./theme-6cd33b22.js");require("react-range");var r=require("react-dom");require("date-fns");var s=require("./index-ea33edba.js"),c=require("lodash/debounce"),u=require("./index-aa538c1f.js"),d=require("./number-95704111.js");require("styled-components");var m=require("./constants-d4ec4195.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function v(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)}var f=p(t),g=v(r),h=p(c),C=function(a){var o=a.title,l=a.url,r=a.image,s=a.logo,c=a.className,d=a.style,m=a.noRefetch,p=t.useContext(i.TogetherComponentGlobalContext).data,v=p.locale,g=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})})),i.callApi(i.getApiPath(i.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)||o,P=(null==k?void 0:k.logo)||s,S=(null==k?void 0:k.url)||l,x=S.replace("http://","").replace("https://","").split(/[/?#]/)[0],N=t.useRef(!1);return f.default.createElement(i.StyledCardLink,{"data-is-marrybaby":g,className:"".concat(c," no-replace-click"),style:d},f.default.createElement("a",{href:S,target:"_blank",rel:"noreferrer"},b&&f.default.createElement("div",{className:"link-image-wrapper"},!g&&f.default.createElement("img",{className:"link-image-blur",src:b,onError:function(e){N.current||(N.current=!0,e.currentTarget.src=i.DEFAULT_IMG)}}),f.default.createElement("img",{className:"link-image",src:b,onError:function(e){N.current||(N.current=!0,e.currentTarget.src=i.DEFAULT_IMG)}})),f.default.createElement("div",{className:"link-info-container"},f.default.createElement(n.Text,{size:"n1"},g&&P&&!C&&f.default.createElement("img",{className:"link-logo",src:P,onError:function(e){return w(!0)}}),x),f.default.createElement(u.Heading,{tag:"h6"},T))))},w=function(e){var a=e.topics,o=e.onClick,l=e.className,r=e.style,s=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=s.sliding,u=s.mouseDownHandler,d=s.sliderRef,m=t.useContext(i.TogetherComponentGlobalContext),p=m.data.env.togetherBasePath,v=m.action.sanitizeFunction;return f.default.createElement(i.StyledTagTopic,{ref:d,onClick:o,onMouseDown:function(e){return u(e)},className:"".concat(l," ").concat(c?"sliding":""),style:r},a.map((function(e,t){return f.default.createElement("a",{className:"tag-link-item",key:t,href:e.isActive&&!e.isHidden?"".concat(p).concat(e.url):void 0},f.default.createElement(n.Text,{size:"p3"},f.default.createElement("span",{dangerouslySetInnerHTML:{__html:(null==v?void 0:v(e.name))||e.name}})))})))},E=function(e){var n=e.onClick;e.color;var a=e.className,l=e.style,r=t.useContext(i.TogetherComponentGlobalContext).data.env.isMarryBaby,s=o.useTranslations().t;return f.default.createElement(i.LabelSortPin,{label:f.default.createElement(f.default.Fragment,null,r&&f.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"})," ",s("label.pinnedPost")),rightLabel:!r&&f.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:l})},y=function(e){return{message:e("notification.failure"),type:"danger"}},k="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",_=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,i.callApiWithAuth(i.getApiPath(i.PATHS.POST.LIKE,{id:n,_locale:a}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},b=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,i.callApiWithAuth(i.getApiPath(i.PATHS.POST.DELETE,{id:n,_locale:a}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},T=function(t){var n=t.title,a=t.description,o=t.communityId,l=t.imageFiles,r=t.previewUrl,s=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=i.removeBannedWordWrapper(a),h=i.removeBannedWordWrapper(n),C=i.getMentionIdsFromString(g),t.append("title",h),t.append("description",i.encodePostContent(g,u)),d?t.append("category_community",String(d)):o&&t.append("community_id",String(o)),(null==r?void 0:r.title)&&t.append("preview_title",r.title),(null==r?void 0:r.description)&&t.append("preview_description",r.description),(null==r?void 0:r.url)&&t.append("preview_link",r.url),(null==r?void 0:r.image)&&t.append("preview_image",r.image),null==s||s.forEach((function(e){t.append("topics[]",String(e||""))})),null==m||m.forEach((function(e){t.append("category_topics[]",String(e||""))})),(null==l?void 0:l.length)?[4,Promise.all(l.map((function(e,t){return new Promise((function(n){setTimeout((function(){n(i.uploadAndGetSrc(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=e.sent())||w.filter(Boolean).slice(0,i.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]}}))}))},P=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,i.callApiWithAuth(i.getApiPath(o?i.PATHS.POST.CREATE_ARTICLE_COMMENT:i.PATHS.POST.CREATE,{_locale:n}),"POST",{data:a,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},S=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,i.callApiWithAuth(i.getApiPath(i.PATHS.POST.UPDATE,{id:n,_locale:a}),"POST",{data:o})];case 1:return[2,e.sent()]}}))}))},x=function(e){var t=e.id,n=e.reason,a=e.locale,o=new FormData;return o.append("reason",n),i.callApiWithAuth(i.getApiPath(i.PATHS.POST.REPORT,{_locale:a,id:t}),"POST",{data:o})},N=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}},I="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",A=function(e){var a=e.className,r=e.style,s=e.bannedWords,c=void 0===s?[]:s,u=e.value,d=e.onChange,m=e.onPreviewUrlChange,p=e.onInvalidUrlsChange,v=e.onImageFilesChange,g=e.imageFiles,h=e.isReplying,w=o.useTranslations().t,E=t.useState(null),y=E[0],_=E[1],b=t.useRef(null),T=N(g,v),P=T.onSelectImages,S=T.onRemoveImage,x=T.imageSrcs;return t.useEffect((function(){m&&((null==y?void 0:y.url)?m({title:y.title||"",url:y.url||"",image:y.image||"",description:y.description||""}):m(null))}),[y]),f.default.createElement(i.StyledCreatePostDescription,{className:a,style:r},f.default.createElement(n.Text,{size:"p4",className:"description-label"},w("createPost.popup.description")),f.default.createElement("div",{className:"textarea-control"},f.default.createElement("div",{className:"textarea-wrapper"},f.default.createElement(i.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:h}))),f.default.createElement(n.Text,{size:"p4",className:"count-string"},w("character"),": ",i.innertext_1(u||"").length),(!x||0===x.length)&&y&&f.default.createElement("div",{className:"link-preview-wrapper"},y.isFetching?f.default.createElement(i.Loading,null):f.default.createElement(f.default.Fragment,null,f.default.createElement(C,{title:y.title,url:y.url||"#",image:y.image,noRefetch:!0}),f.default.createElement("img",{src:I,className:"icon-close",onClick:function(){return _(null)}}))),f.default.createElement("input",{ref:b,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:P}),x.length>i.MAX_IMAGE_UPLOADS?f.default.createElement("div",{className:"input-notification"},f.default.createElement("img",{src:k}),f.default.createElement(n.Text,{size:"p4",color:l.theme.colors.alertWarning},w("createPost.popup.warningImage"))):null,x.length>0&&f.default.createElement("div",{className:"image-gallery"},x.map((function(e,t){return f.default.createElement("div",{key:t,className:"image-item"},f.default.createElement("img",{src:e}),f.default.createElement("img",{className:"close-btn",src:I,onClick:function(){return S(t)}}))}))))},M=function(e,t){if(!t)return e;var n=t.limit,a=t.bannedWords,o=void 0===a?[]:a,l="number"==typeof n&&n>=0?e.substring(0,n):e;return i.highlightBadWords(l,o)},L=function(e){var a,l=e.className,r=e.style,c=e.bannedWords,u=void 0===c?[]:c,d=e.value,m=e.onChange,p=o.useTranslations().t,v=t.useState(""),g=v[0],C=v[1],w=t.useRef(null);t.useEffect((function(){if(w.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=w.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[w]);var E=(null==u?void 0:u.join(","))||"";t.useEffect((function(){var e;if(E){var t=null===(e=w.current)||void 0===e?void 0:e.innerText;if(t){var n=i.highlightBadWords(t,u);n!==t&&(m&&m(n),C(n))}}}),[E]);var y=t.useCallback(h.default((function(e){if(w.current){var t=M(w.current.innerText,{limit:120,bannedWords:u});m&&m(t),C(t)}}),300),[]);return t.useEffect((function(){setTimeout((function(){var e;null===(e=w.current)||void 0===e||e.focus()}),500)}),[]),f.default.createElement(i.StyledCreatePostTitle,{className:l,style:r},f.default.createElement(s.Input,{name:"title",value:d||g,size:"md",label:p("createPost.title"),CustomInput:f.default.createElement(i._default,{innerRef:w,html:d||g,onChange:function(e){if(w.current&&w.current.innerText!==(d||g)){var t=M(w.current.innerText,{bannedWords:u});m&&m(t),C(t),y(w.current.innerText)}},className:"title-input"})}),f.default.createElement(n.Text,{size:"p4",className:"count-string"},p("createPost.popup.wordCount",{count:(null===(a=w.current)||void 0===a?void 0:a.innerText.length)||0,max:120})))},R=function(n){var a=n.className,o=n.style,l=n.topics,r=n.communityId,s=n.onChange,c=n.isLoading,u=n.disabled,d=n.forceTopics,m=n.selectedTopics,p=n.noFetch,v=t.useContext(i.TogetherComponentGlobalContext).data,g=v.locale,h=v.env.isMarryBaby,C=t.useState(l?e.__spreadArray([],l,!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],P=b[1],S=t.useRef(l);S.current=l,t.useEffect((function(){var t;!r||p||(null===(t=S.current)||void 0===t?void 0:t.length)||(E([]),P(!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,i.callApi(i.getApiPath(i.PATHS.TOPIC.LIST,{communityId:r,_locale:g}),"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(i.formatTopic).sort((function(e,t){return(e.order||0)-(t.order||0)})))||[]})),[3,3];case 2:return a=e.sent(),console.log(a),P(!1),[3,3];case 3:return P(!1),[2]}}))})))}),[r,p]);var x=null==l?void 0:l.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(){l&&void 0!==x&&x!==N&&E(l)}),[l,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 f.default.createElement(i.StyledTopicSelectList,{"data-is-marrybaby":h,className:a,style:o},d.map((function(e){return f.default.createElement(B,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),A.map((function(e){return f.default.createElement(B,{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),s&&m?s(t.slice()):(s&&s(t.slice()),_(t.slice()))}})})),(c||T)&&f.default.createElement(i.Loading,{className:"topic-spinner"}))},B=function(e){var t=e.topic,n=e.disabled,a=e.selected,o=e.onClick;return f.default.createElement("div",{className:"tag-item"+(a?" --active":""),"data-disabled":n,onClick:n?void 0:o},t.name)},j=function(e){var a=e.className,l=e.isMarryBaby,r=e.style,s=e.title,c=e.description,d=e.acceptText,m=e.cancelText,p=e.onAccept,v=e.thumbnail,h=e.isThumbnailIcon,C=e.onClose,w=t.useContext(i.TogetherComponentGlobalContext).data.env.isMarryBaby,E="boolean"==typeof l?l:w,y=t.useState(!1),k=y[0],_=y[1];return t.useEffect((function(){return o.toggleNoScroll(!0),setTimeout((function(){return _(!0)}),0),function(){return o.toggleNoScroll(!1)}}),[]),g.createPortal(f.default.createElement(i.StyledPopupDanger,{"data-is-marrybaby":E,className:a,style:r,"data-open":k},f.default.createElement(i.PopupFrame,{className:"popup-frame",isOpen:k,onClose:C},f.default.createElement("div",{className:"confirm-dialog",onClick:function(e){return e.stopPropagation()}},f.default.createElement("div",{className:"confirm-content"},v&&f.default.createElement("div",{className:"thumbnail-container ".concat(h?"is-icon":"")},f.default.createElement("img",{className:"thumbnail",src:v})),f.default.createElement(u.Heading,{className:"title",tag:"h2"},s),f.default.createElement(n.Text,{className:"desc",size:"lg"},c),f.default.createElement("div",{className:"btn-group"},f.default.createElement(n.Button,{theme:E?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==p||p(),null==C||C()}},d),f.default.createElement(n.Button,{theme:E?"marryBaby":"helloSites",size:"md",onClick:C},m)))),E&&v&&f.default.createElement("div",{className:"thumbnail-container is-mobile ".concat(h?"is-icon":"")},f.default.createElement("img",{className:"thumbnail",src:v})))),o.getPopupWrapperDom())},F=function(t){var n=t.postId,a=t.message,o=t.photos,l=t.link,r=t.locale,s=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=i.encodePostContent(a.replace(/(\ )+/g," "),s),p=i.getMentionIdsFromString(m),o&&o.length>0?[4,Promise.all(null==o?void 0:o.map((function(e){return i.uploadAndGetSrc(e,r)})))]:[3,2];case 1:e.sent().filter(Boolean).slice(0,i.MAX_IMAGE_UPLOADS).forEach((function(e){t.append("images[]",e)})),e.label=2;case 2:return l&&t.append("link",l),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]}}))}))},D=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,i.callApiWithAuth(i.getApiPath(i.PATHS.COMMENT.CREATE,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}})]}))}))},O=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,i.callApiWithAuth(i.getApiPath(i.PATHS.COMMENT.REPLY,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}})]}))}))},H=function(t){var n=t.commentId,a=t.setLike,o=void 0!==a&&a,l=t.locale;return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,i.callApiWithAuth(i.getApiPath(o?i.PATHS.COMMENT.LIKE:i.PATHS.COMMENT.UNLIKE,{_locale:l,id:n}),"GET")]}))}))},U=function(e){var t=e.id,n=e.locale;return i.callApiWithAuth(i.getApiPath(i.PATHS.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},W=function(a){var l=a.isReply,r=a.className,c=a.onClose,u=a.replyToName,d=a.style,m=a.replyingId,p=a.replyingUser,v=a.onPostSuccess;a.isMainCmt;var g=a.post,h=a.isMarryBaby,w=t.useContext(i.TogetherComponentGlobalContext),E=w.action,y=E.pushNotifications,k=E.sanitizeFunction,_=w.data,b=_.userInfo,T=_.locale,P=_.env.isMarryBaby,S="boolean"==typeof h?h:P,x=o.useTranslations().t,A=N(),M=A.onSelectImages,L=A.onRemoveImage,R=A.imageSrcs,B=A.onRemoveAllImages,j=A.imageFiles,H=t.useState(""),U=H[0],W=H[1],z=t.useContext(i.MainInputTriggerContext).trigger,V=t.useState(!1),G=V[0],q=V[1],Z=t.useRef(null),K=t.useRef(null),Q=t.useRef(null),X=t.useState([]),$=X[0],J=X[1],Y=t.useState([]),ee=Y[0],te=Y[1],ne=t.useState(null),ae=ne[0],oe=ne[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)}),[z]),f.default.createElement(i.StyledInputCommentBar,{"data-is-reply":l,className:r,style:d},l&&f.default.createElement("div",{className:"reply-to-container"},f.default.createElement(n.Text,{size:"p4"},f.default.createElement("span",{dangerouslySetInnerHTML:{__html:x("inputComment.replyTo",{name:'<span style="color: #2D87F3; cursor: pointer">@'.concat(u||"","</span>")})}})),f.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()}})),f.default.createElement("div",{className:"input-container",ref:Q},f.default.createElement(i.UserAvatar,{className:"avatar-wrapper ".concat(l?"avatar-wrapper-reply":""),avatar:(null==b?void 0:b.id)?b.avatar:i.DEFAULT_AVATAR_IMG,username:(null==b?void 0:b.name)||(null==b?void 0:b.username)}),f.default.createElement("input",{ref:Z,onChange:M,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),f.default.createElement(s.Input,{value:U,name:"input",size:"md",className:"input-wrapper",displayIcon:f.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:f.default.createElement("div",{className:"as-input"},f.default.createElement(i.RichTextEditor,{className:"textarea",html:U,onChange:W,onImagePickerClick:function(){var e;return null===(e=Z.current)||void 0===e?void 0:e.click()},bannedWords:ee,onPreviewUrlChange:oe,onInvalidUrlsChange:J,setEditorRef:function(e){return K.current=e},isReplying:l}))}),f.default.createElement(n.Button,{theme:S?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o,r,s,u,d,f,h,C,w,E;return e.__generator(this,(function(_){switch(_.label){case 0:if(!(null==g?void 0:g.id)||G)return[2];q(!0),_.label=1;case 1:return _.trys.push([1,4,,5]),t=function(e){W(""),B(),c&&c();var t=i.formatComment(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),v&&v(t)},[4,F(e.__assign({message:U,photos:j,postId:String(g.id),link:null==ae?void 0:ae.url,sanitizeFunction:k,locale:T},l&&m?{replyingUserId:String((null==p?void 0:p.id)||(null===(r=null==g?void 0:g.author)||void 0===r?void 0:r.id)||""),replyingId:m,replyingUserName:(null==p?void 0:p.name)||(null==p?void 0:p.username)||""}:{}))];case 2:return n=_.sent(),[4,l&&m?O(n,T):D(n,T)];case 3:return a=_.sent(),(null==(o=null==a?void 0:a.data)?void 0:o.id)&&!(null===(u=null===(s=null==a?void 0:a.messages)||void 0===s?void 0:s.moderation)||void 0===u?void 0:u.type)?t(a):"banned"===(null===(f=null===(d=null==a?void 0:a.messages)||void 0===d?void 0:d.moderation)||void 0===f?void 0:f.type)?(y({title:x("notification.comment.blocked.title"),message:x("notification.comment.blocked.message"),type:"danger"}),a.messages.moderation.words&&te(a.messages.moderation.words)):"suspect"===(null===(C=null===(h=null==a?void 0:a.messages)||void 0===h?void 0:h.moderation)||void 0===C?void 0:C.type)?(y({title:x("notification.comment.suspect.title"),message:x("notification.comment.suspect.message"),type:"warning"}),W(""),B(),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"))})))?(y({message:x("notification.suspend.message"),type:"warning"}),W(""),B(),c&&c()):y({title:"",message:(null===(E=null==a?void 0:a.messages)||void 0===E?void 0:E[0])||x("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return _.sent(),y({title:"",message:x("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return q(!1),[2]}}))}))},isLoading:G,isDisabled:!!(null==$?void 0:$.length)||G||!U||(null==U?void 0:U.length)<2||!U.trim()},f.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==$?void 0:$.length)?f.default.createElement("div",{className:"error-text"},x("notification.limitUrlDomain")):null,(!R||0===R.length)&&ae&&f.default.createElement("div",{className:"link-preview-wrapper"},ae.isFetching?f.default.createElement(i.Loading,null):f.default.createElement(f.default.Fragment,null,f.default.createElement(C,{title:ae.title,url:ae.url||"#",image:ae.image,noRefetch:!0}),f.default.createElement("img",{src:I,className:"icon-close",onClick:function(){return oe(null)}}))),R&&R.length>0&&f.default.createElement("div",{className:"preview-images-container"},R.map((function(e,t){return f.default.createElement("div",{key:t,className:"image-src-wrapper"},f.default.createElement("img",{className:"preview-image",src:e}),f.default.createElement("img",{src:I,className:"icon-close-circle",onClick:function(){return L(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",V=function(a){var r=a.className,s=a.style,c=a.reason,u=a.reasonText,d=a.onClose,m=a.postId,p=t.useContext(i.TogetherComponentGlobalContext),v=p.data,g=v.locale,h=v.env.isMarryBaby,C=p.action.pushNotifications,w=o.useTranslations().t,E=t.useState(!1),y=E[0],k=E[1];return f.default.createElement(i.StyledSubmitReportForm,{"data-is-marrybaby":h,className:r,style:s},f.default.createElement("ul",{className:"report-list"},f.default.createElement("li",{className:"report-item"},f.default.createElement("img",{src:z}),f.default.createElement(n.Text,{className:"__label",color:l.theme.colors.gray800,size:"p4"},u))),f.default.createElement(n.Button,{theme:h?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:y,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(!m||y)return[2];k(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,x({id:m,reason:c,locale:g})];case 2:return 1===(null==(t=e.sent())?void 0:t.status)&&(C({message:"Post reported",type:"success"}),d&&d()),[3,4];case 3:return e.sent(),[3,4];case 4:return k(!1),[2]}}))}))}},w("submit")))},G=function(e){var n=e.className,a=e.style,l=e.replyingTo,r=e.mentionedUser,s=e.description,c=e.disableShortenContent,u=e.mentions,d=void 0===u?[]:u,m=t.useState(!1),p=m[0],v=m[1],g=o.useTranslations().t,h=i.useTogetherAuthRequiredAction().authActionWrapper,C=t.useState(!1),w=C[0],E=C[1],y=i.decodeMention(i.decodePostUrl(s||"","display"),d),k=t.useContext(i.TogetherComponentGlobalContext).action.sanitizeFunction,_=t.useMemo((function(){var e=k(y||"");if(c||p)return{showContent:e,hasSeeMore:!1};var t=e.slice(0,200),n=200-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==r?void 0:r.name)||l,T="expert"===(null==r?void 0:r.role)&&!!(null==r?void 0:r.partnerId);return f.default.createElement(f.default.Fragment,null,T&&f.default.createElement(i.PopupExpert,{isOpen:w,onClose:function(){return E(!1)},expertId:String(null==r?void 0:r.partnerId)}),f.default.createElement(i.StyledPostContent,{className:"".concat(n," no-replace-click"),style:a},b&&f.default.createElement("span",{onClick:function(){return T&&E(!0)},className:"post-content-replying"},"@",b),(null==s?void 0:s.startsWith("[mention+id="))&&f.default.createElement("span",{className:"post-content-replying tag-only"},"@"),f.default.createElement("span",{dangerouslySetInnerHTML:{__html:_.showContent},className:"post-content ".concat(_.hasSeeMore?"has-see-more":"")}),_.hasSeeMore&&!p&&f.default.createElement("span",null,"... ",f.default.createElement("span",{onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(){return v(!0)}))},className:"see-more-text"},g("post.seeMore")))))},q=function(e){var a=e.className,l=e.style,r=e.authorName,s=e.images,c=e.onClose,u=e.onOpenSingleView,d=o.useTranslations().t,m=t.useState(!1),p=m[0],v=m[1];return t.useEffect((function(){setTimeout((function(){v(!0)}),0)}),[]),g.createPortal(f.default.createElement(i.StyledImagePreviewPopup,{className:a,style:l,"data-open":p},f.default.createElement("div",{className:"top-bar"},f.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"}),f.default.createElement(n.Text,{size:"p2",type:"bold",style:{textAlign:"center"}},d("previewPhotos.title",{name:r}))),f.default.createElement("div",{className:"container"},s.map((function(e,t){return f.default.createElement("img",{className:"img-preview",key:t,src:e,onClick:function(){return null==u?void 0:u(t)},alt:"post img"})})))),o.getPopupWrapperDom())},Z="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",K=function(e){var n=e.initialViewIndex,a=e.images,l=e.onClose,r=t.useState(n),s=r[0],c=r[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[s],v=0===s,h=!(null==a?void 0:a.length)||s===(null==a?void 0:a.length)-1;return g.createPortal(f.default.createElement(i.StyledImagePreviewContainer,{"data-open":d&&!!p},f.default.createElement(i.StyledImagePreviewTopbar,null,f.default.createElement("img",{src:i.img,className:"icon-close",onClick:l,alt:"close"})),p&&s>=0&&f.default.createElement(f.default.Fragment,null,f.default.createElement(i.StyledImagePreviewWrapper,null,f.default.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),f.default.createElement(i.StyledArrowWrapper,{"data-disabled":v,onClick:function(){return!v&&c(s-1)}},f.default.createElement(i.StyledCircleArrow,null,f.default.createElement("img",{src:Z,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),f.default.createElement(i.StyledArrowWrapper,{"data-right":!0,"data-disabled":h,onClick:function(){return!h&&c(s+1)}},f.default.createElement(i.StyledCircleArrow,null,f.default.createElement("img",{src:Z,alt:"right arrow","data-disabled":h})))))),o.getPopupWrapperDom())},Q=function(e){var n=e.className,a=e.images,l=void 0===a?[]:a,r=e.style,s=e.authorName,c=t.useContext(i.TogetherComponentGlobalContext).data.env.isMarryBaby,m="+ ".concat((l.length||0)-4),p=t.useState(!1),v=p[0],g=p[1],h=t.useState(-1),C=h[0],w=h[1];t.useEffect((function(){setTimeout((function(){return null===d.lazyLoadInstance||void 0===d.lazyLoadInstance?void 0:d.lazyLoadInstance.update()}),100)}),[null==l?void 0:l.slice(0,5).join("|")]);var E=l.length>5,y=t.useRef(!1);return t.useEffect((function(){return function(){y.current&&o.toggleNoScroll(!1)}}),[]),t.useEffect((function(){v||C>=0?(o.toggleNoScroll(!0),y.current=!0):(o.toggleNoScroll(!1),y.current=!1)}),[v,C]),f.default.createElement(f.default.Fragment,null,f.default.createElement(i.StyledPostImagePreview,{className:n,style:r,"data-image-count":E?5:l.length||0,"data-is-marrybaby":c},null==l?void 0:l.slice(0,5).map((function(e,t){return f.default.createElement("div",{className:"img-wrapper",key:t,onClick:function(){t>=4&&E?g(!0):w(t)}},!c&&f.default.createElement("img",{className:"lazy img-preview-blur","data-src":e}),f.default.createElement("img",{className:"lazy img-preview","data-src":e}),4===t&&E&&f.default.createElement("div",{className:"img-more-overlay"},f.default.createElement(u.Heading,{tag:"h1",color:"white"},m)))}))),v&&f.default.createElement(q,{authorName:s||"",images:l,onClose:function(){return g(!1)},onOpenSingleView:w}),C>=0&&f.default.createElement(K,{images:l,initialViewIndex:C,onClose:function(){return w(-1)}}))},X=function(n){var a=n.url,o=n.image,l=n.className,r=n.style,s=t.useContext(i.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})})),i.callApi(i.getApiPath(i.PATHS.FETCH_PREVIEW,{_locale:s}),"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 i.youtubeVidIdGetter(p)}),[p]),g=t.useMemo((function(){return i.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 f.default.createElement(i.StyledSocialLinkPreview,{className:"".concat(l," no-replace-click"),style:r,ref:k},o||!v&&!g?f.default.createElement("a",{href:p,target:"_blank",rel:"noreferrer"},f.default.createElement("div",{className:"link-image-wrapper ".concat((null==u?void 0:u.isFetching)?"fetching":"")},(null==u?void 0:u.isFetching)?f.default.createElement(i.Loading,{className:"loading-spinner"}):f.default.createElement("img",{className:"link-image",src:m||i.DEFAULT_IMG,onError:function(e){_.current||(_.current=!0,e.currentTarget.src=i.DEFAULT_IMG)}}))):f.default.createElement("div",{className:"link-image-wrapper"},v?f.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"}}):g?f.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))},$="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",J="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",Y="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",ee=function(n){var a=n.onDeleteComment,l=n.commentId,r=n.className,s=void 0===r?"":r,c=n.popoverClassName,u=void 0===c?"":c,d=t.useContext(i.TogetherComponentGlobalContext),m=d.data,p=m.env.isMarryBaby,v=m.locale,g=d.action.pushNotifications,h=o.useTranslations().t,C=t.useState(!1),w=C[0],E=C[1],y=i.useTogetherAuthRequiredAction().authActionWrapper;return f.default.createElement("div",{className:s,onClick:function(e){e.preventDefault(),e.stopPropagation()}},w&&f.default.createElement(j,{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 l?[4,U({id:l,locale:v})]:[2];case 1:return 1===(null==(t=e.sent())?void 0:t.status)?(a&&a(),g({title:"",message:h("notification.success"),type:"success"})):g({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)}}),f.default.createElement(i.TreePopoverMenu,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:Y,label:h("actionPopover.delete"),onClick:function(){y((function(){E(!0)}))}}]},className:u,toggleButtonContent:f.default.createElement("img",{src:p?$:J}),buttonProps:{}}))},te=function(l){var r,s,c,u,d,p=l.className,v=l.style,g=l.comment,h=l.type,w=void 0===h?"comment":h,E=l.level,y=void 0===E?0:E,k=l.replyingId,_=l.onPostCommentSuccess,b=l.post,T=l.onDeleteComment,P=l.refetchComment,S=l.hasQuickBookingEnable,x=l.handleMakeAppointment,N=t.useContext(i.TogetherComponentGlobalContext).data,I=N.locale,A=N.userInfo,M=N.env.isMarryBaby,L=o.useTranslations().t,R=t.useState(g||null),B=R[0],j=R[1],F=B.id;B.countReplies;var D=B.countLikes,O=B.content,U=B.createdAt,z=B.replies,V=void 0===z?[]:z,q=B.images,Z=void 0===q?[]:q,K=B.author,X=B.liked,$=B.link,J=B.mentionedUser,Y=B.mentions,ne=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),ae=ne.text,oe=ne.replyingTo,ie=i.useTogetherAuthRequiredAction({_joinCommunityIds:[null===(r=null==b?void 0:b.community)||void 0===r?void 0:r.id],_joinTopicIds:null===(s=null==b?void 0:b.topics)||void 0===s?void 0:s.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==V?void 0:V.some((function(e){return e.author.id===A.id}))),ue=function(t){j((function(n){n.replies.unshift(t);var a=e.__assign(e.__assign({},n),{replies:n.replies.slice(),countReplies:n.countReplies+1});return P&&P(a),a}))},de=t.useState(!1),me=de[0],pe=de[1],ve=t.useMemo((function(){return"comment"===w&&V&&0!=V.length?V.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})):V}),[w,V]),fe=(null==V?void 0:V.length)||0,ge=String(null==K?void 0:K.email)&&(null==A?void 0:A.email)&&String(null==K?void 0:K.email)===String(null==A?void 0:A.email),he=(null==K?void 0:K.name)||(null==K?void 0:K.username)||"",Ce=null==K?void 0:K.avatar,we=(null==K?void 0:K.username)||(null==K?void 0:K.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==K?void 0:K.hospitalId){t=K.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:m.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==K?void 0:K.doctorId){n=K.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:n,website_url:m.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]}}))}))}}),[K.hospitalId,K.doctorId]);var Pe=(null==be?void 0:be.valid_outpatient)||(null==be?void 0:be.valid_telemedicine),Se=((null==ye?void 0:ye.total_available_service)||(null==ye?void 0:ye.total_available_doctor))>0,xe=S&&(Pe||Se);return f.default.createElement(i.TogetherAuthConfigContextProvider,{defaultParams:{_joinCommunityIds:[null===(c=null==b?void 0:b.community)||void 0===c?void 0:c.id],_joinTopicIds:null===(u=null==b?void 0:b.topics)||void 0===u?void 0:u.map((function(e){return e.id}))}},f.default.createElement(i.StyledCardPost,{className:p,style:v,"data-is-reply":!!y,"data-is-marrybaby":M,"data-has-booking":xe},"reply"===w&&f.default.createElement(a.Divider,{className:"top-divider",type:"solid"}),f.default.createElement(i.CardAuthor,{avatar:Ce,name:he,username:we,email:null==K?void 0:K.email,time:U,className:"post-author ".concat(ge?"with-popover":""),type:w,userId:null==K?void 0:K.id,role:null==K?void 0:K.role,expertId:null==K?void 0:K.partnerId,title:null==K?void 0:K.title,doctorId:null==K?void 0:K.doctorId,hospitalId:null==K?void 0:K.hospitalId,hasQuickBooking:xe,handleMakeAppointment:x}),f.default.createElement(G,{className:"post-content-wrapper",replyingTo:oe,mentionedUser:J,description:ae,mentions:Y}),f.default.createElement("span",null),f.default.createElement("span",null),Z&&Z.length>0?f.default.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},f.default.createElement(Q,{images:Z,authorName:null==K?void 0:K.username})):null,Z&&0!==Z.length||!$?null:f.default.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},f.default.createElement(C,{url:$})),"most-engaging"!==w?f.default.createElement(f.default.Fragment,null,f.default.createElement(i.CardReactions,{type:i.CardReactionType.reply,loveCount:D,replyCount:fe,className:"post-reaction",liked:X,isReplied:ce,hideCommentIcon:"reply"===w,onCommentClick:function(){return ie((function(){return pe((function(e){return!e}))}))},onCommentCountClick:function(){return ie((function(){pe(!0)}))},onLikeClick:function(){return ie((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,H({commentId:F,setLike:!X,locale:I})]:[3,2];case 1:1===t.sent().status&&j((function(t){return e.__assign(e.__assign({},t),{liked:!X,countLikes:t.countLikes+(X?-1:1)})})),t.label=2;case 2:return[2]}}))}))}))}}),me&&f.default.createElement(W,{replyingId:k||B.id,replyToName:K.name||K.username||"",isReply:!0,onClose:function(){return pe(!1)},onPostSuccess:function(e){"reply"===w?_&&_(e):ue(e)},post:b,replyingUser:K}),"comment"===w&&V&&V.length>0?f.default.createElement("div",{className:"comment-reply-wrapper"},null===(d=null==ve?void 0:ve.slice(0,re))||void 0===d?void 0:d.map((function(t){return f.default.createElement(te,{key:t.id,comment:t,type:"reply",className:"comment-reply-item",level:y+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:S})})),fe>re&&f.default.createElement(f.default.Fragment,null,f.default.createElement(a.Divider,{className:"top-divider",type:"solid"}),f.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}),f.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&&f.default.createElement(ee,{onDeleteComment:T,className:"popover",commentId:B.id})))},ne="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",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='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",oe="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",ie=function(n){var a=n.authorEmail,l=n.onDeletePost,r=n.shareUrl,s=n.post,c=n.className,u=void 0===c?"":c,d=n.popoverClassName,m=void 0===d?"":d,p=n.onBookmark,v=n.onRemoveBookmark,g=n.onEditPost,h=t.useContext(i.TogetherComponentGlobalContext),C=h.data,w=C.locale,E=C.userInfo,y=C.togetherUserId,k=C.env.isMarryBaby,_=h.action.pushNotifications,T=o.useTranslations().t,P=t.useState(!1),S=P[0],x=P[1],N=t.useState(!1),I=N[0],A=N[1],M=t.useState(!1),L=M[0],R=M[1],B=i.useTogetherAuthRequiredAction().authActionWrapper,F=a&&(null==E?void 0:E.email)&&a===String(null==E?void 0:E.email);return f.default.createElement("div",{className:u,onClick:function(e){e.preventDefault(),e.stopPropagation()}},L&&f.default.createElement(i.SharePopup,{url:r,text:null==s?void 0:s.title,onClose:function(){return R(!1)}}),I&&f.default.createElement(j,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:T("popup.deletePost.title"),description:T("popup.deletePost.description"),acceptText:T("popup.deletePost.accept"),cancelText:T("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==s?void 0:s.id)||S)return[2];x(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,b({id:s.id,locale:w})];case 2:return 1===(null==(t=e.sent())?void 0:t.status)&&(null==l||l()),[3,4];case 3:return e.sent(),[3,4];case 4:return x(!1),[2]}}))}))},onClose:function(){return A(!1)}}),f.default.createElement(i.TreePopoverMenu,{className:m,toggleButtonContent:f.default.createElement("img",{src:k?$:J}),position:"bottom",align:"end",buttonProps:{isLoading:S},data:F?{isShowheader:!1,type:"list",list:[{icon:oe,label:T("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:T("actionPopover.edit"),onClick:g},{icon:Y,label:T("actionPopover.delete"),onClick:function(){B((function(){return A(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:oe,label:T("morePopover.share"),onClick:function(){return R(!0)}},{icon:(null==s?void 0:s.bookmarked)?ne:ae,label:(null==s?void 0:s.bookmarked)?T("morePopover.unsavePost"):T("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==s?void 0:s.id)?(null==s?void 0:s.bookmarked)?[4,i.callApiWithAuth(i.getApiPath(i.PATHS.BOOKMARK.DELETE,{_locale:w}),"DELETE",{data:{post_id:String(s.id)}})]:[3,2]:[2];case 1:return 1===(null==(t=e.sent())?void 0:t.status)?(_({title:"",message:"Removed saved post",type:"success",displayIcon:ae}),v&&v()):_({title:"",message:"Remove failed",type:"danger",displayIcon:ae}),[3,4];case 2:return[4,i.callApiWithAuth(i.getApiPath(i.PATHS.BOOKMARK.CREATE,{_locale:w}),"POST",{data:{user_id:y||E.id,post_id:s.id}})];case 3:1===(null==(t=e.sent())?void 0:t.status)?(_({title:"",message:"Post saved",type:"success",displayIcon:ne}),p&&p()):_({title:"",message:"Post saved failed",type:"danger",displayIcon:ae}),e.label=4;case 4:return[2]}}))}))}))}},{icon:z,label:T("morePopover.report"),subTree:{title:T("morePopover.report.title"),description:T("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(i.REPORT_REASON_MAP).map((function(e){return{label:i.REPORT_REASON_MAP[e].label,reason:i.REPORT_REASON_MAP[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:T(e.label),subTree:{title:T("morePopover.reportSubmit.title"),description:T("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return f.default.createElement(V,{reason:e.reasonValue,reasonText:T(e.reason),postId:null==s?void 0:s.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},le=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){var a,o,l,r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,i.callApiWithOptionalAuth(i.getApiPath(i.PATHS.COMMENT.LIST,{postId:t,_locale:n,sort:"popularity",perPage:1,withoutReply:1}),"GET")];case 1:return a=e.sent(),[2,null===(r=null===(l=null===(o=null==a?void 0:a.data)||void 0===o?void 0:o.comments)||void 0===l?void 0:l.map(i.formatComment))||void 0===r?void 0:r[0]]}}))}))},re=Object.freeze({__proto__:null});exports.CardLink=C,exports.CardPost=function(a){var l=a.className,r=a.style,s=a.hideViewMoreComment,c=a.showMostEngaging,d=a.onCommentClick,m=a.onCommentCountClick,p=a.onMostEngagingCommentClick,v=a.onPostCommentSuccess,g=a.disableCardLink,h=a.disableShortenContent,k=a.onDeletePost,b=a.onEditPost,T=a.post,P=a.mostEngagingComment,S=a.onDeleteComment,x=a.showInputComment,N=a.InlineCommentsComponent,I=a.hasQuickBookingEnable,A=a.handleMakeAppointment,M=t.useState(T),L=M[0],R=M[1],B=t.useState(!1),j=B[0],F=B[1],D=t.useState(P),O=D[0],H=D[1],U=L.community,z=L.topics,V=L.author,q=L.slug,Z=L.isPin,K=L.liked,$=L.scheduleDateTime,J=L.createdAt,Y=L.photos,ee=L.mentions,ne=L.title,ae=L.description,oe=L.previewUrl,re=L.likesCount,se=L.commentsCount,ce=L.id,ue=L.commented,de=t.useContext(i.TogetherComponentGlobalContext),me=de.data,pe=me.locale,ve=me.env,fe=ve.isMarryBaby,ge=ve.togetherBasePath,he=de.action.pushNotifications,Ce=o.useTranslations().t,we=t.useState(x),Ee=we[0],ye=we[1],ke="".concat(ge,"/").concat((null==U?void 0:U.slug)||"_","/").concat(q||""),_e="".concat(i.getCurrentBaseUrl(pe)).concat(ke),be=i.useTogetherAuthRequiredAction((null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==z?void 0:z.map((function(e){return e.id}))}:void 0).authActionWrapper,Te=t.useState(!1),Pe=Te[0],Se=Te[1];t.useEffect((function(){ye(x)}),[x]);var xe=(null==V?void 0:V.name)||(null==V?void 0:V.username)||"",Ne=(null==V?void 0:V.username)||(null==V?void 0:V.name)||"",Ie=null==V?void 0:V.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==V?void 0:V.hospitalId){t=V.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:i.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==V?void 0:V.doctorId){n=V.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:n,website_url:i.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]}}))}))}}),[V.hospitalId,V.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 ce&&se&&c&&!(null==P?void 0:P.id)?[4,le(ce,pe)]:[3,2];case 1:t=e.sent(),H(t),e.label=2;case 2:return[2]}}))}))}),[ce,pe,se,c,null==P?void 0:P.id]),t.useEffect((function(){H(P)}),[null==P?void 0:P.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 se>1&&(null==O?void 0:O.id)&&(null==O?void 0:O.id)===(null==t?void 0:t.id)?[4,le(ce,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})})),S&&S(t),[2]}}))}))};return f.default.createElement(i.TogetherAuthConfigContextProvider,{defaultParams:(null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==z?void 0:z.map((function(e){return e.id}))}:void 0},j&&f.default.createElement(i.SharePopup,{url:_e,avatar:i.DEFAULT_IMG,text:ne,onClose:function(){return F(!1)}}),f.default.createElement(i.StyledCardPost$1,{className:l,style:r,"data-is-marrybaby":fe},Z?f.default.createElement(E,{className:"post-pin"}):null,f.default.createElement("div",{style:{position:"relative"}},f.default.createElement(i.CardAuthor,{avatar:Ie,name:xe,username:Ne,url:g?void 0:ke,email:null==V?void 0:V.email,time:$||J,community:U,className:"post-author",role:null==V?void 0:V.role,userId:null==V?void 0:V.id,expertId:null==V?void 0:V.partnerId,doctorId:null==V?void 0:V.doctorId,hospitalId:null==V?void 0:V.hospitalId,title:null==V?void 0:V.title,hasQuickBooking:Oe,handleMakeAppointment:A}),f.default.createElement(ie,{authorEmail:String(null==V?void 0:V.email),onDeletePost:k,shareUrl:_e,post:L,className:"popover",onEditPost:b})),f.default.createElement("a",{href:g?void 0:ke,className:"post-content-link-wrapper"},ne&&f.default.createElement(u.Heading,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},i.innertext_1(ne)),f.default.createElement(G,{className:"post-content-wrapper",description:ae,disableShortenContent:h,mentions:ee})),f.default.createElement("span",null),f.default.createElement("span",null),f.default.createElement("div",{key:"tag-topic"},z&&z.length>0?f.default.createElement(w,{topics:z,className:"post-topics"}):null),f.default.createElement("div",{key:"social-preview"},(null==L?void 0:L.introUrl)?f.default.createElement("div",{className:"social-preview-wrapper ".concat((null==Y?void 0:Y.length)?"has-image":"")},f.default.createElement(X,{url:L.introUrl,image:L.bannerImage})):null),f.default.createElement("div",{key:"image-preview"},(null==Y?void 0:Y.length)?f.default.createElement("div",{className:"image-preview-wrapper"},f.default.createElement(Q,{images:Y,authorName:null==V?void 0:V.name})):null),f.default.createElement("div",{key:"link-preview"},(null==L?void 0:L.introUrl)||(null==Y?void 0:Y.length)||!(null==oe?void 0:oe.url)?null:f.default.createElement("div",{className:"link-preview-wrapper"},f.default.createElement(C,{title:oe.title,url:oe.url,image:oe.image}))),f.default.createElement(i.CardReactions,{type:i.CardReactionType.post,loveCount:re,replyCount:se,className:"post-reaction ".concat((null==Y?void 0:Y.length)||(null==oe?void 0:oe.url)?"hide-top-border":""),liked:Pe?!K:K,isReplied:ue,onCommentClick:function(){return be((function(){d?d():ye((function(e){return!e}))}))},onCommentCountClick:function(){be((function(){fe?ye(!0):m?m():!g&&(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(!ce||Pe)return[2];Se(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,_({id:ce,locale:pe})];case 2:return 1!==(null==(t=n.sent())?void 0:t.status)?he(y(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(y(Ce)),[3,4];case 4:return Se(!1),[2]}}))}))},showingMostEngaging:!(!c||!(null==O?void 0:O.id))}),Ee&&f.default.createElement(W,{isMainCmt:!x,onClose:function(){return ye(!1)},onPostSuccess:function(t){0!==se||(null==O?void 0:O.id)||H(t),R((function(t){return e.__assign(e.__assign({},t),{commentsCount:t.commentsCount+1,commented:!0})})),v&&v(t)},post:L}),c&&(null==O?void 0:O.id)?f.default.createElement("div",{className:"most-engaging-wrapper",onClick:function(e){p?(e.stopPropagation(),p()):window.location.href=ke}},f.default.createElement(te,{hasQuickBookingEnable:I,handleMakeAppointment:A,comment:O,onDeleteComment:function(){He&&He(O)},className:"most-engaging-comment",type:"most-engaging",key:O.id}),se>1&&!s&&f.default.createElement(n.Button,{className:"see-more-comments",color:"ghost",size:"md"},Ce("comment.seeMoreComments",{count:se-1}))):null,N))},exports.CardPostPopoverMore=ie,exports.CardReply=te,exports.CardReplyPopover=ee,exports.CreateNewPostContent=function(r){var s=r.className,c=r.style,u=r.onPostCreatedEdited,d=r.onClose,m=r.communities,p=void 0===m?[]:m,v=r.forceSelectCommunity,g=r.forceSelectTopics,h=r.articleId,C=r.optionalTopic,w=r.editPostData,E=r.defaultCommunity,_=r.defaultTopics,b=r.noFetchTopic,x=r.hideTopicList,N=!!(null==w?void 0:w.id),I=t.useContext(i.TogetherComponentGlobalContext),M=I.data,B=M.locale,j=M.env.isMarryBaby,F=I.action,D=F.pushNotifications,O=F.sanitizeFunction,H=o.useTranslations().t,U=t.useState(!1),W=U[0],z=U[1],V=t.useState(""),G=V[0],q=V[1],Z=t.useState(""),K=Z[0],Q=Z[1],X=t.useState(v?{label:v.name,value:"".concat(v.id||"","-").concat(v.mappedCategoryId||"")}:{label:H("community.choose"),value:""}),$=X[0],J=X[1],Y=t.useState(e.__spreadArray([],g,!0)||[]),ee=Y[0],te=Y[1],ne=t.useState([]),ae=ne[0],oe=ne[1],ie=t.useState([]),le=ie[0],re=ie[1],se=v||p.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===$.value})),ce=v?[v]:p.filter((function(e){return e.isActive})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),ue=t.useState(null),de=ue[0],me=ue[1],pe=t.useState([]),ve=pe[0],fe=pe[1],ge=G&&i.innertext_1(K)&&(C||!C&&ee.length>0)&&se&&(!ae||ae.length<=i.MAX_IMAGE_UPLOADS)&&!(null==ve?void 0:ve.length)&&!W;t.useEffect((function(){if(w){var e=w;q(e.title||""),Q(i.decodeMention(i.decodePostUrl(e.description||"","edit"),e.mentions)),J({label:e.community.name,value:"".concat(e.community.id||"","-").concat(e.community.mappedCategoryId||"")}),te(e.topics||[]),oe(e.photos||[])}else E&&J({label:E.name,value:"".concat(E.id||"","-").concat(E.mappedCategoryId||"")}),_&&te(_)}),[]);var he=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o,l,r,s,c,m,p,v,f;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,T({title:G,description:K,communityId:String((null==se?void 0:se.id)||""),imageFiles:ae,previewUrl:de,topicIds:null==ee?void 0:ee.map((function(e){return String(e.id||"")})).filter(Boolean),locale:B,sanitizeFunction:O,categoryCommunityId:String((null==se?void 0:se.mappedCategoryId)||""),categoryTopicIds:null==ee?void 0:ee.map((function(e){return String(e.mappedCategoryId||"")})).filter(Boolean)})];case 1:return t=e.sent(),h&&t.append("article_id",h),N?(null==w?void 0:w.id)?[4,S({id:w.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,P({formData:t,locale:B,isArticleComment:!(null==se?void 0:se.id)&&!!(null==se?void 0:se.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===(l=null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o.moderation)||void 0===l?void 0:l.type)?(D({message:H("createPost.popup.success"),type:"success"}),function(e){u&&u(i.formatPost(e),N),d&&d()}(a)):"banned"===(null===(s=null===(r=null==n?void 0:n.messages)||void 0===r?void 0:r.moderation)||void 0===s?void 0:s.type)?(D({title:H("notification.post.blocked.title"),message:H("notification.post.blocked.message"),type:"danger"}),n.messages.moderation.words&&re(n.messages.moderation.words)):"suspect"===(null===(m=null===(c=null==n?void 0:n.messages)||void 0===c?void 0:c.moderation)||void 0===m?void 0:m.type)?(D({title:H("notification.post.suspect.title"),message:H("notification.post.suspect.message"),type:"warning"}),d&&d()):(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"))})))?(D({message:H("notification.suspend.message"),type:"danger"}),d&&d()):D({message:(null===(f=null==n?void 0:n.messages)||void 0===f?void 0:f[0])||H("notification.failure"),type:"danger"}),[2]}}))}))};return f.default.createElement(i.StyledCreateNewPost,{className:s,style:c},f.default.createElement("div",{className:"input-group-container"},f.default.createElement(L,{className:"input-group",bannedWords:le,value:G,onChange:q}),f.default.createElement(A,{className:"input-group",bannedWords:le,value:K,onChange:Q,onPreviewUrlChange:me,onInvalidUrlsChange:fe,onImageFilesChange:oe,imageFiles:ae}),f.default.createElement("div",{className:"input-group"},f.default.createElement(n.Text,{size:"p4",className:"input-group-label"},H("admin.community")),f.default.createElement(a.Dropdown,{options:(null==ce?void 0:ce.map((function(e,t){return{label:e.name,value:"".concat(e.id||"","-").concat(e.mappedCategoryId||"")}})))||[],id:"community-picker",placeholder:H("community.choose"),value:$,onChange:function(e){J({label:e.label,value:String(e.value)}),te([])},disabled:!!v}),f.default.createElement(n.Text,{size:"sm",className:"warning",color:l.theme.colors.gray400},"* ",H("commentPopup.warning.newPost"))),!x&&f.default.createElement("div",{className:"input-group"},f.default.createElement(n.Text,{size:"p4",className:"input-group-label"},H("tab.topic")),f.default.createElement("div",{className:"input-notification"},f.default.createElement("img",{src:se?"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":k}),f.default.createElement(n.Text,{size:"base",color:l.theme.colors.gray500},H(se?"createPost.popup.primary":"createPost.popup.warning"))),se&&f.default.createElement(R,{className:"tag-list",communityId:se.id,forceTopics:g,onChange:te,selectedTopics:ee,noFetch:b}))),f.default.createElement(n.Button,{theme:j?"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(!ge||W)return[3,5];z(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,he()];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),console.error(t),D(y(H)),[3,4];case 4:z(!1),e.label=5;case 5:return[2]}}))}))},isDisabled:!ge,isLoading:W},H("createPost.popup.submit")))},exports.CreatePostDescription=A,exports.CreatePostTitle=L,exports.ImagePreviewPopup=q,exports.InputCommentBar=W,exports.LabelPin=E,exports.PopupDanger=j,exports.PostContent=G,exports.PostImagePreview=Q,exports.PostSingleImageViewPopup=K,exports.SubmitReportForm=V,exports.TagTopic=w,exports.TopicSelectList=R,exports.types=re;
|
|
1
|
+
"use strict";var e=require("./tslib.es6-f7929e76.js"),t=require("react"),n=require("./index.styled-b187cc54.js"),a=require("./index-12a7ec3c.js"),o=require("./useTranslations-a86f0d1c.js"),i=require("./index.styled-4a3d1b58.js"),l=require("./theme-6cd33b22.js");require("react-range");var r=require("react-dom");require("date-fns");var s=require("./index-ea33edba.js"),c=require("lodash/debounce"),u=require("./index-aa538c1f.js"),d=require("./number-95704111.js");require("styled-components");var m=require("./constants-d4ec4195.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function v(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)}var f=p(t),g=v(r),h=p(c),C=function(a){var o=a.title,l=a.url,r=a.image,s=a.logo,c=a.className,d=a.style,m=a.noRefetch,p=t.useContext(i.TogetherComponentGlobalContext).data,v=p.locale,g=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})})),i.callApi(i.getApiPath(i.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)||o,P=(null==k?void 0:k.logo)||s,S=(null==k?void 0:k.url)||l,x=S.replace("http://","").replace("https://","").split(/[/?#]/)[0],N=t.useRef(!1);return f.default.createElement(i.StyledCardLink,{"data-is-marrybaby":g,className:"".concat(c," no-replace-click"),style:d},f.default.createElement("a",{href:S,target:"_blank",rel:"noreferrer"},b&&f.default.createElement("div",{className:"link-image-wrapper"},!g&&f.default.createElement("img",{className:"link-image-blur",src:b,onError:function(e){N.current||(N.current=!0,e.currentTarget.src=i.DEFAULT_IMG)}}),f.default.createElement("img",{className:"link-image",src:b,onError:function(e){N.current||(N.current=!0,e.currentTarget.src=i.DEFAULT_IMG)}})),f.default.createElement("div",{className:"link-info-container"},f.default.createElement(n.Text,{size:"n1"},g&&P&&!C&&f.default.createElement("img",{className:"link-logo",src:P,onError:function(e){return w(!0)}}),x),f.default.createElement(u.Heading,{tag:"h6"},T))))},w=function(e){var a=e.topics,o=e.onClick,l=e.className,r=e.style,s=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=s.sliding,u=s.mouseDownHandler,d=s.sliderRef,m=t.useContext(i.TogetherComponentGlobalContext),p=m.data.env.togetherBasePath,v=m.action.sanitizeFunction;return f.default.createElement(i.StyledTagTopic,{ref:d,onClick:o,onMouseDown:function(e){return u(e)},className:"".concat(l," ").concat(c?"sliding":""),style:r},a.map((function(e,t){return f.default.createElement("a",{className:"tag-link-item",key:t,href:e.isActive&&!e.isHidden?"".concat(p).concat(e.url):void 0},f.default.createElement(n.Text,{size:"p3"},f.default.createElement("span",{dangerouslySetInnerHTML:{__html:(null==v?void 0:v(e.name))||e.name}})))})))},E=function(e){var n=e.onClick;e.color;var a=e.className,l=e.style,r=t.useContext(i.TogetherComponentGlobalContext).data.env.isMarryBaby,s=o.useTranslations().t;return f.default.createElement(i.LabelSortPin,{label:f.default.createElement(f.default.Fragment,null,r&&f.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"})," ",s("label.pinnedPost")),rightLabel:!r&&f.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:l})},y=function(e){return{message:e("notification.failure"),type:"danger"}},k="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",_=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,i.callApiWithAuth(i.getApiPath(i.PATHS.POST.LIKE,{id:n,_locale:a}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},b=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,i.callApiWithAuth(i.getApiPath(i.PATHS.POST.DELETE,{id:n,_locale:a}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},T=function(t){var n=t.title,a=t.description,o=t.communityId,l=t.imageFiles,r=t.previewUrl,s=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=i.removeBannedWordWrapper(a),h=i.removeBannedWordWrapper(n),C=i.getMentionIdsFromString(g),t.append("title",h),t.append("description",i.encodePostContent(g,u)),d?t.append("category_community",String(d)):o&&t.append("community_id",String(o)),(null==r?void 0:r.title)&&t.append("preview_title",r.title),(null==r?void 0:r.description)&&t.append("preview_description",r.description),(null==r?void 0:r.url)&&t.append("preview_link",r.url),(null==r?void 0:r.image)&&t.append("preview_image",r.image),null==s||s.forEach((function(e){t.append("topics[]",String(e||""))})),null==m||m.forEach((function(e){t.append("category_topics[]",String(e||""))})),(null==l?void 0:l.length)?[4,Promise.all(l.map((function(e,t){return new Promise((function(n){setTimeout((function(){n(i.uploadAndGetSrc(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=e.sent())||w.filter(Boolean).slice(0,i.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]}}))}))},P=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,i.callApiWithAuth(i.getApiPath(o?i.PATHS.POST.CREATE_ARTICLE_COMMENT:i.PATHS.POST.CREATE,{_locale:n}),"POST",{data:a,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},S=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,i.callApiWithAuth(i.getApiPath(i.PATHS.POST.UPDATE,{id:n,_locale:a}),"POST",{data:o})];case 1:return[2,e.sent()]}}))}))},x=function(e){var t=e.id,n=e.reason,a=e.locale,o=new FormData;return o.append("reason",n),i.callApiWithAuth(i.getApiPath(i.PATHS.POST.REPORT,{_locale:a,id:t}),"POST",{data:o})},N=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}},I="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",A=function(e){var a=e.className,r=e.style,s=e.bannedWords,c=void 0===s?[]:s,u=e.value,d=e.onChange,m=e.onPreviewUrlChange,p=e.onInvalidUrlsChange,v=e.onImageFilesChange,g=e.imageFiles,h=e.isReplying,w=o.useTranslations().t,E=t.useState(null),y=E[0],_=E[1],b=t.useRef(null),T=N(g,v),P=T.onSelectImages,S=T.onRemoveImage,x=T.imageSrcs;return t.useEffect((function(){m&&((null==y?void 0:y.url)?m({title:y.title||"",url:y.url||"",image:y.image||"",description:y.description||""}):m(null))}),[y]),f.default.createElement(i.StyledCreatePostDescription,{className:a,style:r},f.default.createElement(n.Text,{size:"p4",className:"description-label"},w("createPost.popup.description")),f.default.createElement("div",{className:"textarea-control"},f.default.createElement("div",{className:"textarea-wrapper"},f.default.createElement(i.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:h}))),f.default.createElement(n.Text,{size:"p4",className:"count-string"},w("character"),": ",i.innertext_1(u||"").length),(!x||0===x.length)&&y&&f.default.createElement("div",{className:"link-preview-wrapper"},y.isFetching?f.default.createElement(i.Loading,null):f.default.createElement(f.default.Fragment,null,f.default.createElement(C,{title:y.title,url:y.url||"#",image:y.image,noRefetch:!0}),f.default.createElement("img",{src:I,className:"icon-close",onClick:function(){return _(null)}}))),f.default.createElement("input",{ref:b,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:P}),x.length>i.MAX_IMAGE_UPLOADS?f.default.createElement("div",{className:"input-notification"},f.default.createElement("img",{src:k}),f.default.createElement(n.Text,{size:"p4",color:l.theme.colors.alertWarning},w("createPost.popup.warningImage"))):null,x.length>0&&f.default.createElement("div",{className:"image-gallery"},x.map((function(e,t){return f.default.createElement("div",{key:t,className:"image-item"},f.default.createElement("img",{src:e}),f.default.createElement("img",{className:"close-btn",src:I,onClick:function(){return S(t)}}))}))))},M=function(e,t){if(!t)return e;var n=t.limit,a=t.bannedWords,o=void 0===a?[]:a,l="number"==typeof n&&n>=0?e.substring(0,n):e;return i.highlightBadWords(l,o)},L=function(e){var a,l=e.className,r=e.style,c=e.bannedWords,u=void 0===c?[]:c,d=e.value,m=e.onChange,p=o.useTranslations().t,v=t.useState(""),g=v[0],C=v[1],w=t.useRef(null);t.useEffect((function(){if(w.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=w.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[w]);var E=(null==u?void 0:u.join(","))||"";t.useEffect((function(){var e;if(E){var t=null===(e=w.current)||void 0===e?void 0:e.innerText;if(t){var n=i.highlightBadWords(t,u);n!==t&&(m&&m(n),C(n))}}}),[E]);var y=t.useCallback(h.default((function(e){if(w.current){var t=M(w.current.innerText,{limit:120,bannedWords:u});m&&m(t),C(t)}}),300),[]);return t.useEffect((function(){setTimeout((function(){var e;null===(e=w.current)||void 0===e||e.focus()}),500)}),[]),f.default.createElement(i.StyledCreatePostTitle,{className:l,style:r},f.default.createElement(s.Input,{name:"title",value:d||g,size:"md",label:p("createPost.title"),CustomInput:f.default.createElement(i._default,{innerRef:w,html:d||g,onChange:function(e){if(w.current&&w.current.innerText!==(d||g)){var t=M(w.current.innerText,{bannedWords:u});m&&m(t),C(t),y(w.current.innerText)}},className:"title-input"})}),f.default.createElement(n.Text,{size:"p4",className:"count-string"},p("createPost.popup.wordCount",{count:(null===(a=w.current)||void 0===a?void 0:a.innerText.length)||0,max:120})))},R=function(n){var a=n.className,o=n.style,l=n.topics,r=n.communityId,s=n.onChange,c=n.isLoading,u=n.disabled,d=n.forceTopics,m=n.selectedTopics,p=n.noFetch,v=t.useContext(i.TogetherComponentGlobalContext).data,g=v.locale,h=v.env.isMarryBaby,C=t.useState(l?e.__spreadArray([],l,!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],P=b[1],S=t.useRef(l);S.current=l,t.useEffect((function(){var t;!r||p||(null===(t=S.current)||void 0===t?void 0:t.length)||(E([]),P(!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,i.callApi(i.getApiPath(i.PATHS.TOPIC.LIST,{communityId:r,_locale:g}),"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(i.formatTopic).sort((function(e,t){return(e.order||0)-(t.order||0)})))||[]})),[3,3];case 2:return a=e.sent(),console.log(a),P(!1),[3,3];case 3:return P(!1),[2]}}))})))}),[r,p]);var x=null==l?void 0:l.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(){l&&void 0!==x&&x!==N&&E(l)}),[l,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 f.default.createElement(i.StyledTopicSelectList,{"data-is-marrybaby":h,className:a,style:o},d.map((function(e){return f.default.createElement(B,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),A.map((function(e){return f.default.createElement(B,{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),s&&m?s(t.slice()):(s&&s(t.slice()),_(t.slice()))}})})),(c||T)&&f.default.createElement(i.Loading,{className:"topic-spinner"}))},B=function(e){var t=e.topic,n=e.disabled,a=e.selected,o=e.onClick;return f.default.createElement("div",{className:"tag-item"+(a?" --active":""),"data-disabled":n,onClick:n?void 0:o},t.name)},j=function(e){var a=e.className,l=e.isMarryBaby,r=e.style,s=e.title,c=e.description,d=e.acceptText,m=e.cancelText,p=e.onAccept,v=e.thumbnail,h=e.isThumbnailIcon,C=e.onClose,w=t.useContext(i.TogetherComponentGlobalContext).data.env.isMarryBaby,E="boolean"==typeof l?l:w,y=t.useState(!1),k=y[0],_=y[1];return t.useEffect((function(){return o.toggleNoScroll(!0),setTimeout((function(){return _(!0)}),0),function(){return o.toggleNoScroll(!1)}}),[]),g.createPortal(f.default.createElement(i.StyledPopupDanger,{"data-is-marrybaby":E,className:a,style:r,"data-open":k},f.default.createElement(i.PopupFrame,{className:"popup-frame",isOpen:k,onClose:C},f.default.createElement("div",{className:"confirm-dialog",onClick:function(e){return e.stopPropagation()}},f.default.createElement("div",{className:"confirm-content"},v&&f.default.createElement("div",{className:"thumbnail-container ".concat(h?"is-icon":"")},f.default.createElement("img",{className:"thumbnail",src:v})),f.default.createElement(u.Heading,{className:"title",tag:"h2"},s),f.default.createElement(n.Text,{className:"desc",size:"lg"},c),f.default.createElement("div",{className:"btn-group"},f.default.createElement(n.Button,{theme:E?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==p||p(),null==C||C()}},d),f.default.createElement(n.Button,{theme:E?"marryBaby":"helloSites",size:"md",onClick:C},m)))),E&&v&&f.default.createElement("div",{className:"thumbnail-container is-mobile ".concat(h?"is-icon":"")},f.default.createElement("img",{className:"thumbnail",src:v})))),o.getPopupWrapperDom())},F=function(t){var n=t.postId,a=t.message,o=t.photos,l=t.link,r=t.locale,s=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=i.encodePostContent(a.replace(/(\ )+/g," "),s),p=i.getMentionIdsFromString(m),o&&o.length>0?[4,Promise.all(null==o?void 0:o.map((function(e){return i.uploadAndGetSrc(e,r)})))]:[3,2];case 1:e.sent().filter(Boolean).slice(0,i.MAX_IMAGE_UPLOADS).forEach((function(e){t.append("images[]",e)})),e.label=2;case 2:return l&&t.append("link",l),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]}}))}))},D=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,i.callApiWithAuth(i.getApiPath(i.PATHS.COMMENT.CREATE,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}})]}))}))},O=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,i.callApiWithAuth(i.getApiPath(i.PATHS.COMMENT.REPLY,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}})]}))}))},H=function(t){var n=t.commentId,a=t.setLike,o=void 0!==a&&a,l=t.locale;return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,i.callApiWithAuth(i.getApiPath(o?i.PATHS.COMMENT.LIKE:i.PATHS.COMMENT.UNLIKE,{_locale:l,id:n}),"GET")]}))}))},U=function(e){var t=e.id,n=e.locale;return i.callApiWithAuth(i.getApiPath(i.PATHS.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},W=function(a){var l=a.isReply,r=a.className,c=a.onClose,u=a.replyToName,d=a.style,m=a.replyingId,p=a.replyingUser,v=a.onPostSuccess;a.isMainCmt;var g=a.post,h=a.isMarryBaby,w=t.useContext(i.TogetherComponentGlobalContext),E=w.action,y=E.pushNotifications,k=E.sanitizeFunction,_=w.data,b=_.userInfo,T=_.locale,P=_.env.isMarryBaby,S="boolean"==typeof h?h:P,x=o.useTranslations().t,A=N(),M=A.onSelectImages,L=A.onRemoveImage,R=A.imageSrcs,B=A.onRemoveAllImages,j=A.imageFiles,H=t.useState(""),U=H[0],W=H[1],z=t.useContext(i.MainInputTriggerContext).trigger,V=t.useState(!1),G=V[0],q=V[1],Z=t.useRef(null),K=t.useRef(null),Q=t.useRef(null),X=t.useState([]),$=X[0],J=X[1],Y=t.useState([]),ee=Y[0],te=Y[1],ne=t.useState(null),ae=ne[0],oe=ne[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)}),[z]),f.default.createElement(i.StyledInputCommentBar,{"data-is-reply":l,className:r,style:d},l&&f.default.createElement("div",{className:"reply-to-container"},f.default.createElement(n.Text,{size:"p4"},f.default.createElement("span",{dangerouslySetInnerHTML:{__html:x("inputComment.replyTo",{name:'<span style="color: #2D87F3; cursor: pointer">@'.concat(u||"","</span>")})}})),f.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()}})),f.default.createElement("div",{className:"input-container",ref:Q},f.default.createElement(i.UserAvatar,{className:"avatar-wrapper ".concat(l?"avatar-wrapper-reply":""),avatar:(null==b?void 0:b.id)?b.avatar:i.DEFAULT_AVATAR_IMG,username:(null==b?void 0:b.name)||(null==b?void 0:b.username)}),f.default.createElement("input",{ref:Z,onChange:M,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),f.default.createElement(s.Input,{value:U,name:"input",size:"md",className:"input-wrapper",displayIcon:f.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:f.default.createElement("div",{className:"as-input"},f.default.createElement(i.RichTextEditor,{className:"textarea",html:U,onChange:W,onImagePickerClick:function(){var e;return null===(e=Z.current)||void 0===e?void 0:e.click()},bannedWords:ee,onPreviewUrlChange:oe,onInvalidUrlsChange:J,setEditorRef:function(e){return K.current=e},isReplying:l}))}),f.default.createElement(n.Button,{theme:S?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o,r,s,u,d,f,h,C,w,E;return e.__generator(this,(function(_){switch(_.label){case 0:if(!(null==g?void 0:g.id)||G)return[2];q(!0),_.label=1;case 1:return _.trys.push([1,4,,5]),t=function(e){W(""),B(),c&&c();var t=i.formatComment(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),v&&v(t)},[4,F(e.__assign({message:U,photos:j,postId:String(g.id),link:null==ae?void 0:ae.url,sanitizeFunction:k,locale:T},l&&m?{replyingUserId:String((null==p?void 0:p.id)||(null===(r=null==g?void 0:g.author)||void 0===r?void 0:r.id)||""),replyingId:m,replyingUserName:(null==p?void 0:p.name)||(null==p?void 0:p.username)||""}:{}))];case 2:return n=_.sent(),[4,l&&m?O(n,T):D(n,T)];case 3:return a=_.sent(),(null==(o=null==a?void 0:a.data)?void 0:o.id)&&!(null===(u=null===(s=null==a?void 0:a.messages)||void 0===s?void 0:s.moderation)||void 0===u?void 0:u.type)?t(a):"banned"===(null===(f=null===(d=null==a?void 0:a.messages)||void 0===d?void 0:d.moderation)||void 0===f?void 0:f.type)?(y({title:x("notification.comment.blocked.title"),message:x("notification.comment.blocked.message"),type:"danger"}),a.messages.moderation.words&&te(a.messages.moderation.words)):"suspect"===(null===(C=null===(h=null==a?void 0:a.messages)||void 0===h?void 0:h.moderation)||void 0===C?void 0:C.type)?(y({title:x("notification.comment.suspect.title"),message:x("notification.comment.suspect.message"),type:"warning"}),W(""),B(),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"))})))?(y({message:x("notification.suspend.message"),type:"warning"}),W(""),B(),c&&c()):y({title:"",message:(null===(E=null==a?void 0:a.messages)||void 0===E?void 0:E[0])||x("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return _.sent(),y({title:"",message:x("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return q(!1),[2]}}))}))},isLoading:G,isDisabled:!!(null==$?void 0:$.length)||G||!U||(null==U?void 0:U.length)<2||!U.trim()},f.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==$?void 0:$.length)?f.default.createElement("div",{className:"error-text"},x("notification.limitUrlDomain")):null,(!R||0===R.length)&&ae&&f.default.createElement("div",{className:"link-preview-wrapper"},ae.isFetching?f.default.createElement(i.Loading,null):f.default.createElement(f.default.Fragment,null,f.default.createElement(C,{title:ae.title,url:ae.url||"#",image:ae.image,noRefetch:!0}),f.default.createElement("img",{src:I,className:"icon-close",onClick:function(){return oe(null)}}))),R&&R.length>0&&f.default.createElement("div",{className:"preview-images-container"},R.map((function(e,t){return f.default.createElement("div",{key:t,className:"image-src-wrapper"},f.default.createElement("img",{className:"preview-image",src:e}),f.default.createElement("img",{src:I,className:"icon-close-circle",onClick:function(){return L(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",V=function(a){var r=a.className,s=a.style,c=a.reason,u=a.reasonText,d=a.onClose,m=a.postId,p=t.useContext(i.TogetherComponentGlobalContext),v=p.data,g=v.locale,h=v.env.isMarryBaby,C=p.action.pushNotifications,w=o.useTranslations().t,E=t.useState(!1),y=E[0],k=E[1];return f.default.createElement(i.StyledSubmitReportForm,{"data-is-marrybaby":h,className:r,style:s},f.default.createElement("ul",{className:"report-list"},f.default.createElement("li",{className:"report-item"},f.default.createElement("img",{src:z}),f.default.createElement(n.Text,{className:"__label",color:l.theme.colors.gray800,size:"p4"},u))),f.default.createElement(n.Button,{theme:h?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:y,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(!m||y)return[2];k(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,x({id:m,reason:c,locale:g})];case 2:return 1===(null==(t=e.sent())?void 0:t.status)&&(C({message:"Post reported",type:"success"}),d&&d()),[3,4];case 3:return e.sent(),[3,4];case 4:return k(!1),[2]}}))}))}},w("submit")))},G=function(e){var n=e.className,a=e.style,l=e.replyingTo,r=e.mentionedUser,s=e.description,c=e.disableShortenContent,u=e.mentions,d=void 0===u?[]:u,m=t.useState(!1),p=m[0],v=m[1],g=o.useTranslations().t,h=i.useTogetherAuthRequiredAction().authActionWrapper,C=t.useState(!1),w=C[0],E=C[1],y=i.decodeMention(i.decodePostUrl(s||"","display"),d),k=t.useContext(i.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==r?void 0:r.name)||l,T="expert"===(null==r?void 0:r.role)&&!!(null==r?void 0:r.partnerId);return f.default.createElement(f.default.Fragment,null,T&&f.default.createElement(i.PopupExpert,{isOpen:w,onClose:function(){return E(!1)},expertId:String(null==r?void 0:r.partnerId)}),f.default.createElement(i.StyledPostContent,{className:"".concat(n," no-replace-click"),style:a},b&&f.default.createElement("span",{onClick:function(){return T&&E(!0)},className:"post-content-replying"},"@",b),(null==s?void 0:s.startsWith("[mention+id="))&&f.default.createElement("span",{className:"post-content-replying tag-only"},"@"),f.default.createElement("span",{dangerouslySetInnerHTML:{__html:_.showContent},className:"post-content ".concat(_.hasSeeMore?"has-see-more":"")}),_.hasSeeMore&&!p&&f.default.createElement("span",null,"... ",f.default.createElement("span",{onClick:function(e){e.preventDefault(),e.stopPropagation(),h((function(){return v(!0)}))},className:"see-more-text"},g("post.seeMore")))))},q=function(e){var a=e.className,l=e.style,r=e.authorName,s=e.images,c=e.onClose,u=e.onOpenSingleView,d=o.useTranslations().t,m=t.useState(!1),p=m[0],v=m[1];return t.useEffect((function(){setTimeout((function(){v(!0)}),0)}),[]),g.createPortal(f.default.createElement(i.StyledImagePreviewPopup,{className:a,style:l,"data-open":p},f.default.createElement("div",{className:"top-bar"},f.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"}),f.default.createElement(n.Text,{size:"p2",type:"bold",style:{textAlign:"center"}},d("previewPhotos.title",{name:r}))),f.default.createElement("div",{className:"container"},s.map((function(e,t){return f.default.createElement("img",{className:"img-preview",key:t,src:e,onClick:function(){return null==u?void 0:u(t)},alt:"post img"})})))),o.getPopupWrapperDom())},Z="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",K=function(e){var n=e.initialViewIndex,a=e.images,l=e.onClose,r=t.useState(n),s=r[0],c=r[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[s],v=0===s,h=!(null==a?void 0:a.length)||s===(null==a?void 0:a.length)-1;return g.createPortal(f.default.createElement(i.StyledImagePreviewContainer,{"data-open":d&&!!p},f.default.createElement(i.StyledImagePreviewTopbar,null,f.default.createElement("img",{src:i.img,className:"icon-close",onClick:l,alt:"close"})),p&&s>=0&&f.default.createElement(f.default.Fragment,null,f.default.createElement(i.StyledImagePreviewWrapper,null,f.default.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),f.default.createElement(i.StyledArrowWrapper,{"data-disabled":v,onClick:function(){return!v&&c(s-1)}},f.default.createElement(i.StyledCircleArrow,null,f.default.createElement("img",{src:Z,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),f.default.createElement(i.StyledArrowWrapper,{"data-right":!0,"data-disabled":h,onClick:function(){return!h&&c(s+1)}},f.default.createElement(i.StyledCircleArrow,null,f.default.createElement("img",{src:Z,alt:"right arrow","data-disabled":h})))))),o.getPopupWrapperDom())},Q=function(e){var n=e.className,a=e.images,l=void 0===a?[]:a,r=e.style,s=e.authorName,c=t.useContext(i.TogetherComponentGlobalContext).data.env.isMarryBaby,m="+ ".concat((l.length||0)-4),p=t.useState(!1),v=p[0],g=p[1],h=t.useState(-1),C=h[0],w=h[1];t.useEffect((function(){setTimeout((function(){return null===d.lazyLoadInstance||void 0===d.lazyLoadInstance?void 0:d.lazyLoadInstance.update()}),100)}),[null==l?void 0:l.slice(0,5).join("|")]);var E=l.length>5,y=t.useRef(!1);return t.useEffect((function(){return function(){y.current&&o.toggleNoScroll(!1)}}),[]),t.useEffect((function(){v||C>=0?(o.toggleNoScroll(!0),y.current=!0):(o.toggleNoScroll(!1),y.current=!1)}),[v,C]),f.default.createElement(f.default.Fragment,null,f.default.createElement(i.StyledPostImagePreview,{className:n,style:r,"data-image-count":E?5:l.length||0,"data-is-marrybaby":c},null==l?void 0:l.slice(0,5).map((function(e,t){return f.default.createElement("div",{className:"img-wrapper",key:t,onClick:function(){t>=4&&E?g(!0):w(t)}},!c&&f.default.createElement("img",{className:"lazy img-preview-blur","data-src":e}),f.default.createElement("img",{className:"lazy img-preview","data-src":e}),4===t&&E&&f.default.createElement("div",{className:"img-more-overlay"},f.default.createElement(u.Heading,{tag:"h1",color:"white"},m)))}))),v&&f.default.createElement(q,{authorName:s||"",images:l,onClose:function(){return g(!1)},onOpenSingleView:w}),C>=0&&f.default.createElement(K,{images:l,initialViewIndex:C,onClose:function(){return w(-1)}}))},X=function(n){var a=n.url,o=n.image,l=n.className,r=n.style,s=t.useContext(i.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})})),i.callApi(i.getApiPath(i.PATHS.FETCH_PREVIEW,{_locale:s}),"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 i.youtubeVidIdGetter(p)}),[p]),g=t.useMemo((function(){return i.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 f.default.createElement(i.StyledSocialLinkPreview,{className:"".concat(l," no-replace-click"),style:r,ref:k},o||!v&&!g?f.default.createElement("a",{href:p,target:"_blank",rel:"noreferrer"},f.default.createElement("div",{className:"link-image-wrapper ".concat((null==u?void 0:u.isFetching)?"fetching":"")},(null==u?void 0:u.isFetching)?f.default.createElement(i.Loading,{className:"loading-spinner"}):f.default.createElement("img",{className:"link-image",src:m||i.DEFAULT_IMG,onError:function(e){_.current||(_.current=!0,e.currentTarget.src=i.DEFAULT_IMG)}}))):f.default.createElement("div",{className:"link-image-wrapper"},v?f.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"}}):g?f.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))},$="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",J="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",Y="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",ee=function(n){var a=n.onDeleteComment,l=n.commentId,r=n.className,s=void 0===r?"":r,c=n.popoverClassName,u=void 0===c?"":c,d=t.useContext(i.TogetherComponentGlobalContext),m=d.data,p=m.env.isMarryBaby,v=m.locale,g=d.action.pushNotifications,h=o.useTranslations().t,C=t.useState(!1),w=C[0],E=C[1],y=i.useTogetherAuthRequiredAction().authActionWrapper;return f.default.createElement("div",{className:s,onClick:function(e){e.preventDefault(),e.stopPropagation()}},w&&f.default.createElement(j,{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 l?[4,U({id:l,locale:v})]:[2];case 1:return 1===(null==(t=e.sent())?void 0:t.status)?(a&&a(),g({title:"",message:h("notification.success"),type:"success"})):g({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)}}),f.default.createElement(i.TreePopoverMenu,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:Y,label:h("actionPopover.delete"),onClick:function(){y((function(){E(!0)}))}}]},className:u,toggleButtonContent:f.default.createElement("img",{src:p?$:J}),buttonProps:{}}))},te=function(l){var r,s,c,u,d,p=l.className,v=l.style,g=l.comment,h=l.type,w=void 0===h?"comment":h,E=l.level,y=void 0===E?0:E,k=l.replyingId,_=l.onPostCommentSuccess,b=l.post,T=l.onDeleteComment,P=l.refetchComment,S=l.hasQuickBookingEnable,x=l.handleMakeAppointment,N=t.useContext(i.TogetherComponentGlobalContext).data,I=N.locale,A=N.userInfo,M=N.env.isMarryBaby,L=o.useTranslations().t,R=t.useState(g||null),B=R[0],j=R[1],F=B.id;B.countReplies;var D=B.countLikes,O=B.content,U=B.createdAt,z=B.replies,V=void 0===z?[]:z,q=B.images,Z=void 0===q?[]:q,K=B.author,X=B.liked,$=B.link,J=B.mentionedUser,Y=B.mentions,ne=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),ae=ne.text,oe=ne.replyingTo,ie=i.useTogetherAuthRequiredAction({_joinCommunityIds:[null===(r=null==b?void 0:b.community)||void 0===r?void 0:r.id],_joinTopicIds:null===(s=null==b?void 0:b.topics)||void 0===s?void 0:s.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==V?void 0:V.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 P&&P(a),a}return n}))},de=t.useState(!1),me=de[0],pe=de[1],ve=t.useMemo((function(){return"comment"===w&&V&&0!=V.length?V.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})):V}),[w,V]),fe=(null==V?void 0:V.length)||0,ge=String(null==K?void 0:K.email)&&(null==A?void 0:A.email)&&String(null==K?void 0:K.email)===String(null==A?void 0:A.email),he=(null==K?void 0:K.name)||(null==K?void 0:K.username)||"",Ce=null==K?void 0:K.avatar,we=(null==K?void 0:K.username)||(null==K?void 0:K.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==K?void 0:K.hospitalId){t=K.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:m.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==K?void 0:K.doctorId){n=K.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:n,website_url:m.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]}}))}))}}),[K.hospitalId,K.doctorId]);var Pe=(null==be?void 0:be.valid_outpatient)||(null==be?void 0:be.valid_telemedicine),Se=((null==ye?void 0:ye.total_available_service)||(null==ye?void 0:ye.total_available_doctor))>0,xe=S&&(Pe||Se);return f.default.createElement(i.TogetherAuthConfigContextProvider,{defaultParams:{_joinCommunityIds:[null===(c=null==b?void 0:b.community)||void 0===c?void 0:c.id],_joinTopicIds:null===(u=null==b?void 0:b.topics)||void 0===u?void 0:u.map((function(e){return e.id}))}},f.default.createElement(i.StyledCardPost,{className:p,style:v,"data-is-reply":!!y,"data-is-marrybaby":M,"data-has-booking":xe},"reply"===w&&f.default.createElement(a.Divider,{className:"top-divider",type:"solid"}),f.default.createElement(i.CardAuthor,{avatar:Ce,name:he,username:we,email:null==K?void 0:K.email,time:U,className:"post-author ".concat(ge?"with-popover":""),type:w,userId:null==K?void 0:K.id,role:null==K?void 0:K.role,expertId:null==K?void 0:K.partnerId,title:null==K?void 0:K.title,doctorId:null==K?void 0:K.doctorId,hospitalId:null==K?void 0:K.hospitalId,hasQuickBooking:xe,handleMakeAppointment:x}),f.default.createElement(G,{className:"post-content-wrapper",replyingTo:oe,mentionedUser:J,description:ae,mentions:Y}),f.default.createElement("span",null),f.default.createElement("span",null),Z&&Z.length>0?f.default.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},f.default.createElement(Q,{images:Z,authorName:null==K?void 0:K.username})):null,Z&&0!==Z.length||!$?null:f.default.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},f.default.createElement(C,{url:$})),"most-engaging"!==w?f.default.createElement(f.default.Fragment,null,f.default.createElement(i.CardReactions,{type:i.CardReactionType.reply,loveCount:D,replyCount:fe,className:"post-reaction",liked:X,isReplied:ce,hideCommentIcon:"reply"===w,onCommentClick:function(){return ie((function(){return pe((function(e){return!e}))}))},onCommentCountClick:function(){return ie((function(){pe(!0)}))},onLikeClick:function(){return ie((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,H({commentId:F,setLike:!X,locale:I})]:[3,2];case 1:1===t.sent().status&&j((function(t){return e.__assign(e.__assign({},t),{liked:!X,countLikes:t.countLikes+(X?-1:1)})})),t.label=2;case 2:return[2]}}))}))}))}}),me&&f.default.createElement(W,{replyingId:k||B.id,replyToName:K.name||K.username||"",isReply:!0,onClose:function(){return pe(!1)},onPostSuccess:function(e){"reply"===w?_&&_(e):ue(e)},post:b,replyingUser:K}),"comment"===w&&V&&V.length>0?f.default.createElement("div",{className:"comment-reply-wrapper"},null===(d=null==ve?void 0:ve.slice(0,re))||void 0===d?void 0:d.map((function(t){return f.default.createElement(te,{key:t.id,comment:t,type:"reply",className:"comment-reply-item",level:y+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:S})})),fe>re&&f.default.createElement(f.default.Fragment,null,f.default.createElement(a.Divider,{className:"top-divider",type:"solid"}),f.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}),f.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&&f.default.createElement(ee,{onDeleteComment:T,className:"popover",commentId:B.id})))},ne="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",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='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",oe="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",ie=function(n){var a=n.authorEmail,l=n.onDeletePost,r=n.shareUrl,s=n.post,c=n.className,u=void 0===c?"":c,d=n.popoverClassName,m=void 0===d?"":d,p=n.onBookmark,v=n.onRemoveBookmark,g=n.onEditPost,h=t.useContext(i.TogetherComponentGlobalContext),C=h.data,w=C.locale,E=C.userInfo,y=C.togetherUserId,k=C.env.isMarryBaby,_=h.action.pushNotifications,T=o.useTranslations().t,P=t.useState(!1),S=P[0],x=P[1],N=t.useState(!1),I=N[0],A=N[1],M=t.useState(!1),L=M[0],R=M[1],B=i.useTogetherAuthRequiredAction().authActionWrapper,F=a&&(null==E?void 0:E.email)&&a===String(null==E?void 0:E.email);return f.default.createElement("div",{className:u,onClick:function(e){e.preventDefault(),e.stopPropagation()}},L&&f.default.createElement(i.SharePopup,{url:r,text:null==s?void 0:s.title,onClose:function(){return R(!1)}}),I&&f.default.createElement(j,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:T("popup.deletePost.title"),description:T("popup.deletePost.description"),acceptText:T("popup.deletePost.accept"),cancelText:T("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==s?void 0:s.id)||S)return[2];x(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,b({id:s.id,locale:w})];case 2:return 1===(null==(t=e.sent())?void 0:t.status)&&(null==l||l()),[3,4];case 3:return e.sent(),[3,4];case 4:return x(!1),[2]}}))}))},onClose:function(){return A(!1)}}),f.default.createElement(i.TreePopoverMenu,{className:m,toggleButtonContent:f.default.createElement("img",{src:k?$:J}),position:"bottom",align:"end",buttonProps:{isLoading:S},data:F?{isShowheader:!1,type:"list",list:[{icon:oe,label:T("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:T("actionPopover.edit"),onClick:g},{icon:Y,label:T("actionPopover.delete"),onClick:function(){B((function(){return A(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:oe,label:T("morePopover.share"),onClick:function(){return R(!0)}},{icon:(null==s?void 0:s.bookmarked)?ne:ae,label:(null==s?void 0:s.bookmarked)?T("morePopover.unsavePost"):T("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==s?void 0:s.id)?(null==s?void 0:s.bookmarked)?[4,i.callApiWithAuth(i.getApiPath(i.PATHS.BOOKMARK.DELETE,{_locale:w}),"DELETE",{data:{post_id:String(s.id)}})]:[3,2]:[2];case 1:return 1===(null==(t=e.sent())?void 0:t.status)?(_({title:"",message:"Removed saved post",type:"success",displayIcon:ae}),v&&v()):_({title:"",message:"Remove failed",type:"danger",displayIcon:ae}),[3,4];case 2:return[4,i.callApiWithAuth(i.getApiPath(i.PATHS.BOOKMARK.CREATE,{_locale:w}),"POST",{data:{user_id:y||E.id,post_id:s.id}})];case 3:1===(null==(t=e.sent())?void 0:t.status)?(_({title:"",message:"Post saved",type:"success",displayIcon:ne}),p&&p()):_({title:"",message:"Post saved failed",type:"danger",displayIcon:ae}),e.label=4;case 4:return[2]}}))}))}))}},{icon:z,label:T("morePopover.report"),subTree:{title:T("morePopover.report.title"),description:T("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(i.REPORT_REASON_MAP).map((function(e){return{label:i.REPORT_REASON_MAP[e].label,reason:i.REPORT_REASON_MAP[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:T(e.label),subTree:{title:T("morePopover.reportSubmit.title"),description:T("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return f.default.createElement(V,{reason:e.reasonValue,reasonText:T(e.reason),postId:null==s?void 0:s.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},le=function(t,n){return e.__awaiter(void 0,void 0,void 0,(function(){var a,o,l,r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,i.callApiWithOptionalAuth(i.getApiPath(i.PATHS.COMMENT.LIST,{postId:t,_locale:n,sort:"popularity",perPage:1,withoutReply:1}),"GET")];case 1:return a=e.sent(),[2,null===(r=null===(l=null===(o=null==a?void 0:a.data)||void 0===o?void 0:o.comments)||void 0===l?void 0:l.map(i.formatComment))||void 0===r?void 0:r[0]]}}))}))},re=Object.freeze({__proto__:null});exports.CardLink=C,exports.CardPost=function(a){var l=a.className,r=a.style,s=a.hideViewMoreComment,c=a.showMostEngaging,d=a.onCommentClick,m=a.onCommentCountClick,p=a.onMostEngagingCommentClick,v=a.onPostCommentSuccess,g=a.disableCardLink,h=a.disableShortenContent,k=a.onDeletePost,b=a.onEditPost,T=a.post,P=a.mostEngagingComment,S=a.onDeleteComment,x=a.showInputComment,N=a.InlineCommentsComponent,I=a.hasQuickBookingEnable,A=a.handleMakeAppointment,M=t.useState(T),L=M[0],R=M[1],B=t.useState(!1),j=B[0],F=B[1],D=t.useState(P),O=D[0],H=D[1],U=L.community,z=L.topics,V=L.author,q=L.slug,Z=L.isPin,K=L.liked,$=L.scheduleDateTime,J=L.createdAt,Y=L.photos,ee=L.mentions,ne=L.title,ae=L.description,oe=L.previewUrl,re=L.likesCount,se=L.commentsCount,ce=L.id,ue=L.commented,de=t.useContext(i.TogetherComponentGlobalContext),me=de.data,pe=me.locale,ve=me.env,fe=ve.isMarryBaby,ge=ve.togetherBasePath,he=de.action.pushNotifications,Ce=o.useTranslations().t,we=t.useState(x),Ee=we[0],ye=we[1],ke="".concat(ge,"/").concat((null==U?void 0:U.slug)||"_","/").concat(q||""),_e="".concat(i.getCurrentBaseUrl(pe)).concat(ke),be=i.useTogetherAuthRequiredAction((null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==z?void 0:z.map((function(e){return e.id}))}:void 0).authActionWrapper,Te=t.useState(!1),Pe=Te[0],Se=Te[1];t.useEffect((function(){ye(x)}),[x]);var xe=(null==V?void 0:V.name)||(null==V?void 0:V.username)||"",Ne=(null==V?void 0:V.username)||(null==V?void 0:V.name)||"",Ie=null==V?void 0:V.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==V?void 0:V.hospitalId){t=V.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:i.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==V?void 0:V.doctorId){n=V.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,i.callApi(i.getCarePath(i.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:n,website_url:i.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]}}))}))}}),[V.hospitalId,V.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 ce&&se&&c&&!(null==P?void 0:P.id)?[4,le(ce,pe)]:[3,2];case 1:t=e.sent(),H(t),e.label=2;case 2:return[2]}}))}))}),[ce,pe,se,c,null==P?void 0:P.id]),t.useEffect((function(){H(P)}),[null==P?void 0:P.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 se>1&&(null==O?void 0:O.id)&&(null==O?void 0:O.id)===(null==t?void 0:t.id)?[4,le(ce,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})})),S&&S(t),[2]}}))}))};return f.default.createElement(i.TogetherAuthConfigContextProvider,{defaultParams:(null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==z?void 0:z.map((function(e){return e.id}))}:void 0},j&&f.default.createElement(i.SharePopup,{url:_e,avatar:i.DEFAULT_IMG,text:ne,onClose:function(){return F(!1)}}),f.default.createElement(i.StyledCardPost$1,{className:l,style:r,"data-is-marrybaby":fe},Z?f.default.createElement(E,{className:"post-pin"}):null,f.default.createElement("div",{style:{position:"relative"}},f.default.createElement(i.CardAuthor,{avatar:Ie,name:xe,username:Ne,url:g?void 0:ke,email:null==V?void 0:V.email,time:$||J,community:U,className:"post-author",role:null==V?void 0:V.role,userId:null==V?void 0:V.id,expertId:null==V?void 0:V.partnerId,doctorId:null==V?void 0:V.doctorId,hospitalId:null==V?void 0:V.hospitalId,title:null==V?void 0:V.title,hasQuickBooking:Oe,handleMakeAppointment:A}),f.default.createElement(ie,{authorEmail:String(null==V?void 0:V.email),onDeletePost:k,shareUrl:_e,post:L,className:"popover",onEditPost:b})),f.default.createElement("a",{href:g?void 0:ke,className:"post-content-link-wrapper"},ne&&f.default.createElement(u.Heading,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},i.innertext_1(ne)),f.default.createElement(G,{className:"post-content-wrapper",description:ae,disableShortenContent:h,mentions:ee})),f.default.createElement("span",null),f.default.createElement("span",null),f.default.createElement("div",{key:"tag-topic"},z&&z.length>0?f.default.createElement(w,{topics:z,className:"post-topics"}):null),f.default.createElement("div",{key:"social-preview"},(null==L?void 0:L.introUrl)?f.default.createElement("div",{className:"social-preview-wrapper ".concat((null==Y?void 0:Y.length)?"has-image":"")},f.default.createElement(X,{url:L.introUrl,image:L.bannerImage})):null),f.default.createElement("div",{key:"image-preview"},(null==Y?void 0:Y.length)?f.default.createElement("div",{className:"image-preview-wrapper"},f.default.createElement(Q,{images:Y,authorName:null==V?void 0:V.name})):null),f.default.createElement("div",{key:"link-preview"},(null==L?void 0:L.introUrl)||(null==Y?void 0:Y.length)||!(null==oe?void 0:oe.url)?null:f.default.createElement("div",{className:"link-preview-wrapper"},f.default.createElement(C,{title:oe.title,url:oe.url,image:oe.image}))),f.default.createElement(i.CardReactions,{type:i.CardReactionType.post,loveCount:re,replyCount:se,className:"post-reaction ".concat((null==Y?void 0:Y.length)||(null==oe?void 0:oe.url)?"hide-top-border":""),liked:Pe?!K:K,isReplied:ue,onCommentClick:function(){return be((function(){d?d():ye((function(e){return!e}))}))},onCommentCountClick:function(){be((function(){fe?ye(!0):m?m():!g&&(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(!ce||Pe)return[2];Se(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,_({id:ce,locale:pe})];case 2:return 1!==(null==(t=n.sent())?void 0:t.status)?he(y(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(y(Ce)),[3,4];case 4:return Se(!1),[2]}}))}))},showingMostEngaging:!(!c||!(null==O?void 0:O.id))}),Ee&&f.default.createElement(W,{isMainCmt:!x,onClose:function(){return ye(!1)},onPostSuccess:function(t){0!==se||(null==O?void 0:O.id)||H(t),R((function(t){return e.__assign(e.__assign({},t),{commentsCount:t.commentsCount+1,commented:!0})})),v&&v(t)},post:L}),c&&(null==O?void 0:O.id)?f.default.createElement("div",{className:"most-engaging-wrapper",onClick:function(e){p?(e.stopPropagation(),p()):window.location.href=ke}},f.default.createElement(te,{hasQuickBookingEnable:I,handleMakeAppointment:A,comment:O,onDeleteComment:function(){He&&He(O)},className:"most-engaging-comment",type:"most-engaging",key:O.id}),se>1&&!s&&f.default.createElement(n.Button,{className:"see-more-comments",color:"ghost",size:"md"},Ce("comment.seeMoreComments",{count:se-1}))):null,N))},exports.CardPostPopoverMore=ie,exports.CardReply=te,exports.CardReplyPopover=ee,exports.CreateNewPostContent=function(r){var s=r.className,c=r.style,u=r.onPostCreatedEdited,d=r.onClose,m=r.communities,p=void 0===m?[]:m,v=r.forceSelectCommunity,g=r.forceSelectTopics,h=r.articleId,C=r.optionalTopic,w=r.editPostData,E=r.defaultCommunity,_=r.defaultTopics,b=r.noFetchTopic,x=r.hideTopicList,N=!!(null==w?void 0:w.id),I=t.useContext(i.TogetherComponentGlobalContext),M=I.data,B=M.locale,j=M.env.isMarryBaby,F=I.action,D=F.pushNotifications,O=F.sanitizeFunction,H=o.useTranslations().t,U=t.useState(!1),W=U[0],z=U[1],V=t.useState(""),G=V[0],q=V[1],Z=t.useState(""),K=Z[0],Q=Z[1],X=t.useState(v?{label:v.name,value:"".concat(v.id||"","-").concat(v.mappedCategoryId||"")}:{label:H("community.choose"),value:""}),$=X[0],J=X[1],Y=t.useState(e.__spreadArray([],g,!0)||[]),ee=Y[0],te=Y[1],ne=t.useState([]),ae=ne[0],oe=ne[1],ie=t.useState([]),le=ie[0],re=ie[1],se=v||p.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===$.value})),ce=v?[v]:p.filter((function(e){return e.isActive})).sort((function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),ue=t.useState(null),de=ue[0],me=ue[1],pe=t.useState([]),ve=pe[0],fe=pe[1],ge=G&&i.innertext_1(K)&&(C||!C&&ee.length>0)&&se&&(!ae||ae.length<=i.MAX_IMAGE_UPLOADS)&&!(null==ve?void 0:ve.length)&&!W;t.useEffect((function(){if(w){var e=w;q(e.title||""),Q(i.decodeMention(i.decodePostUrl(e.description||"","edit"),e.mentions)),J({label:e.community.name,value:"".concat(e.community.id||"","-").concat(e.community.mappedCategoryId||"")}),te(e.topics||[]),oe(e.photos||[])}else E&&J({label:E.name,value:"".concat(E.id||"","-").concat(E.mappedCategoryId||"")}),_&&te(_)}),[]);var he=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o,l,r,s,c,m,p,v,f;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,T({title:G,description:K,communityId:String((null==se?void 0:se.id)||""),imageFiles:ae,previewUrl:de,topicIds:null==ee?void 0:ee.map((function(e){return String(e.id||"")})).filter(Boolean),locale:B,sanitizeFunction:O,categoryCommunityId:String((null==se?void 0:se.mappedCategoryId)||""),categoryTopicIds:null==ee?void 0:ee.map((function(e){return String(e.mappedCategoryId||"")})).filter(Boolean)})];case 1:return t=e.sent(),h&&t.append("article_id",h),N?(null==w?void 0:w.id)?[4,S({id:w.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,P({formData:t,locale:B,isArticleComment:!(null==se?void 0:se.id)&&!!(null==se?void 0:se.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===(l=null===(o=null==n?void 0:n.messages)||void 0===o?void 0:o.moderation)||void 0===l?void 0:l.type)?(D({message:H("createPost.popup.success"),type:"success"}),function(e){u&&u(i.formatPost(e),N),d&&d()}(a)):"banned"===(null===(s=null===(r=null==n?void 0:n.messages)||void 0===r?void 0:r.moderation)||void 0===s?void 0:s.type)?(D({title:H("notification.post.blocked.title"),message:H("notification.post.blocked.message"),type:"danger"}),n.messages.moderation.words&&re(n.messages.moderation.words)):"suspect"===(null===(m=null===(c=null==n?void 0:n.messages)||void 0===c?void 0:c.moderation)||void 0===m?void 0:m.type)?(D({title:H("notification.post.suspect.title"),message:H("notification.post.suspect.message"),type:"warning"}),d&&d()):(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"))})))?(D({message:H("notification.suspend.message"),type:"danger"}),d&&d()):D({message:(null===(f=null==n?void 0:n.messages)||void 0===f?void 0:f[0])||H("notification.failure"),type:"danger"}),[2]}}))}))};return f.default.createElement(i.StyledCreateNewPost,{className:s,style:c},f.default.createElement("div",{className:"input-group-container"},f.default.createElement(L,{className:"input-group",bannedWords:le,value:G,onChange:q}),f.default.createElement(A,{className:"input-group",bannedWords:le,value:K,onChange:Q,onPreviewUrlChange:me,onInvalidUrlsChange:fe,onImageFilesChange:oe,imageFiles:ae}),f.default.createElement("div",{className:"input-group"},f.default.createElement(n.Text,{size:"p4",className:"input-group-label"},H("admin.community")),f.default.createElement(a.Dropdown,{options:(null==ce?void 0:ce.map((function(e,t){return{label:e.name,value:"".concat(e.id||"","-").concat(e.mappedCategoryId||"")}})))||[],id:"community-picker",placeholder:H("community.choose"),value:$,onChange:function(e){J({label:e.label,value:String(e.value)}),te([])},disabled:!!v}),f.default.createElement(n.Text,{size:"sm",className:"warning",color:l.theme.colors.gray400},"* ",H("commentPopup.warning.newPost"))),!x&&f.default.createElement("div",{className:"input-group"},f.default.createElement(n.Text,{size:"p4",className:"input-group-label"},H("tab.topic")),f.default.createElement("div",{className:"input-notification"},f.default.createElement("img",{src:se?"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":k}),f.default.createElement(n.Text,{size:"base",color:l.theme.colors.gray500},H(se?"createPost.popup.primary":"createPost.popup.warning"))),se&&f.default.createElement(R,{className:"tag-list",communityId:se.id,forceTopics:g,onChange:te,selectedTopics:ee,noFetch:b}))),f.default.createElement(n.Button,{theme:j?"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(!ge||W)return[3,5];z(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,he()];case 2:return e.sent(),[3,4];case 3:return t=e.sent(),console.error(t),D(y(H)),[3,4];case 4:z(!1),e.label=5;case 5:return[2]}}))}))},isDisabled:!ge,isLoading:W},H("createPost.popup.submit")))},exports.CreatePostDescription=A,exports.CreatePostTitle=L,exports.ImagePreviewPopup=q,exports.InputCommentBar=W,exports.LabelPin=E,exports.PopupDanger=j,exports.PostContent=G,exports.PostImagePreview=Q,exports.PostSingleImageViewPopup=K,exports.SubmitReportForm=V,exports.TagTopic=w,exports.TopicSelectList=R,exports.types=re;
|