@hhgtech/hhg-components 1.19.17 → 1.19.18
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/{ageGenerate-e846bbcb.js → ageGenerate-bcd37ccf.js} +1 -1
- package/build/babyGrowth.js +1 -1
- package/build/care.js +1 -1
- package/build/components/organisms/navigationV2/hooks/useHeaderHeight.d.ts +1 -0
- package/build/components.js +1 -1
- package/build/core.js +1 -1
- package/build/esm/{ageGenerate-62d82532.js → ageGenerate-61e2769b.js} +1 -1
- package/build/esm/babyGrowth.js +1 -1
- package/build/esm/care.js +1 -1
- package/build/esm/components.js +1 -1
- package/build/esm/core.js +1 -1
- package/build/esm/{index-2bf6ca32.js → index-3a36f8a0.js} +1 -1
- package/build/esm/index-448bb306.js +1 -0
- package/build/esm/{index-54dd0dc4.js → index-6e0cbc08.js} +1 -1
- package/build/esm/{index-c0a77cf9.js → index-84fac470.js} +1 -1
- package/build/esm/{index-5917887f.js → index-a74b53cb.js} +1 -1
- package/build/esm/{index-3386acf9.js → index-e25a976f.js} +1 -1
- package/build/esm/{index-c47f17a7.js → index-e3b386f9.js} +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.styled-6559ec11.js +1 -0
- package/build/esm/index.styled-c1edfd6f.js +1 -0
- package/build/esm/{index.styled-c3a83617.js → index.styled-c5e035f3.js} +1 -1
- package/build/esm/navigation.js +1 -1
- package/build/esm/together.js +1 -1
- package/build/esm/{types-60ef9e30.js → types-0b6d82bd.js} +1 -1
- package/build/esm/types-4f1b39fd.js +1 -0
- package/build/esm/useTranslations-d76b98a9.js +1 -0
- package/build/{index-e517ed0e.js → index-12a7ec3c.js} +1 -1
- package/build/{index-740e88b9.js → index-164221e6.js} +1 -1
- package/build/{index-b2578f78.js → index-17aecf8d.js} +1 -1
- package/build/{index-ee42e5a5.js → index-84b9f3e8.js} +1 -1
- package/build/{index-1aff1d46.js → index-aa538c1f.js} +1 -1
- package/build/{index-3e076261.js → index-c198e6e5.js} +1 -1
- package/build/{index-2ea715f8.js → index-ea33edba.js} +1 -1
- package/build/index.js +1 -1
- package/build/{index.styled-0d3afe1b.js → index.styled-4a3d1b58.js} +1 -1
- package/build/{index.styled-afb2b3b3.js → index.styled-4b2a8c64.js} +1 -1
- package/build/{index.styled-9b7b2095.js → index.styled-b187cc54.js} +1 -1
- package/build/misc/utils.d.ts +1 -0
- package/build/navigation.js +1 -1
- package/build/together.js +1 -1
- package/build/types-2b869035.js +1 -0
- package/build/{types-890a575c.js → types-55844911.js} +1 -1
- package/build/{useTranslations-99cf899e.js → useTranslations-a86f0d1c.js} +1 -1
- package/package.json +1 -1
- package/build/esm/index-12332bd0.js +0 -1
- package/build/esm/index.styled-0eba6ff8.js +0 -1
- package/build/esm/index.styled-142eab0d.js +0 -1
- package/build/esm/types-9f973275.js +0 -1
- package/build/esm/useTranslations-2ba43851.js +0 -1
- package/build/types-d1bc9a86.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
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-c3a83617.js";import{a as p,D as v}from"./index-5917887f.js";import{u as g,t as h}from"./useTranslations-2ba43851.js";import{m as f,z as w,B as C,E as k,F as y,H as E,I as b,b as N,J as I,M as T,K as x,N as M,O as _,Q as P,R as L,V as S,W as j,L as B,X as F,Y as R,_ as D,Z as O,$ as A,a0 as z,a1 as V,a2 as U,y as H,a3 as W,j as Z,a4 as G,a5 as K,U as Q,a6 as X,a7 as J,a8 as Y,u as $,g as q,a9 as ee,aa as te,ab as ne,ac as ie,ad as oe,ae,af as re,ag as le,ah as se,ai as ce,aj as ue,ak as de,al as me,a as pe,am as ve,f as ge,C as he,an as fe,ao as we,ap as Ce,S as ke,aq as ye,o as Ee,ar as be,as as Ne,at as Ie}from"./index.styled-142eab0d.js";import{t as Te}from"./theme-731042bc.js";import"react-range";import*as xe from"react-dom";import"date-fns";import{I as Me}from"./index-3386acf9.js";import _e from"lodash/debounce";import{H as Pe}from"./index-c47f17a7.js";import{l as Le}from"./number-126ee62e.js";import{d as Se}from"./constants-17d17987.js";var je=function(i){var c=i.title,u=i.url,m=i.image,p=i.logo,v=i.className,g=i.style,h=i.noRefetch,b=a(f).data,N=b.locale,I=b.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})})),k(y(E.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(w,{"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(Pe,{tag:"h6"},B))))},Be=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(f),g=v.data.env.togetherBasePath,h=v.action.sanitizeFunction;return o.createElement(b,{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}})))})))},Fe=function(e){var t=e.onClick;e.color;var n=e.className,i=e.style,r=a(f).data.env.isMarryBaby,l=g().t;return o.createElement(N,{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})},Re=function(e){return{message:e("notification.failure"),type:"danger"}},De="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",Oe=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,I(y(E.POST.LIKE,{id:i,_locale:o}),"GET")]:[2];case 1:return[2,e.sent()]}}))}))},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,I(y(E.POST.DELETE,{id:i,_locale:o}),"DELETE")]:[2];case 1:return[2,e.sent()]}}))}))},ze=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=x(o),h=x(i),f=M(n),e.append("title",h),e.append("description",_(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(P(e,c))}),2e3*t)}))})))]:[3,2];case 1:return null==(w=t.sent())||w.filter(Boolean).slice(0,T).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]}}))}))},Ve=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,I(y(a?E.POST.CREATE_ARTICLE_COMMENT:E.POST.CREATE,{_locale:i}),"POST",{data:o,headers:{"Content-Type":"multipart/form-data"}})];case 1:return[2,e.sent()]}}))}))},Ue=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,I(y(E.POST.UPDATE,{id:i,_locale:o}),"POST",{data:a})];case 1:return[2,e.sent()]}}))}))},He=function(e){var t=e.id,n=e.reason,i=e.locale,o=new FormData;return o.append("reason",n),I(y(E.POST.REPORT,{_locale:i,id:t}),"POST",{data:o})},We=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}},Ze="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",Ge=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,C=r(null),k=C[0],y=C[1],E=l(null),b=We(h,v),N=b.onSelectImages,I=b.onRemoveImage,x=b.imageSrcs;return s((function(){m&&((null==k?void 0:k.url)?m({title:k.title||"",url:k.url||"",image:k.image||"",description:k.description||""}):m(null))}),[k]),o.createElement(L,{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(S,{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"),": ",j(c||"").length),(!x||0===x.length)&&k&&o.createElement("div",{className:"link-preview-wrapper"},k.isFetching?o.createElement(B,null):o.createElement(o.Fragment,null,o.createElement(je,{title:k.title,url:k.url||"#",image:k.image,noRefetch:!0}),o.createElement("img",{src:Ze,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}),x.length>T?o.createElement("div",{className:"input-notification"},o.createElement("img",{src:De}),o.createElement(d,{size:"p4",color:Te.colors.alertWarning},w("createPost.popup.warningImage"))):null,x.length>0&&o.createElement("div",{className:"image-gallery"},x.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:Ze,onClick:function(){return I(t)}}))}))))},Ke=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 F(a,o)},Qe=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],C=l(null);s((function(){if(C.current){var e=function(e){var t;e.preventDefault();var n=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,n)},t=C.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[C]);var k=(null==c?void 0:c.join(","))||"";s((function(){var e;if(k){var t=null===(e=C.current)||void 0===e?void 0:e.innerText;if(t){var n=F(t,c);n!==t&&(p&&p(n),w(n))}}}),[k]);var y=u(_e((function(e){if(C.current){var t=Ke(C.current.innerText,{limit:120,bannedWords:c});p&&p(t),w(t)}}),300),[]);return s((function(){setTimeout((function(){var e;null===(e=C.current)||void 0===e||e.focus()}),500)}),[]),o.createElement(R,{className:n,style:i},o.createElement(Me,{name:"title",value:m||f,size:"md",label:v("createPost.title"),CustomInput:o.createElement(D,{innerRef:C,html:m||f,onChange:function(e){if(C.current&&C.current.innerText!==(m||f)){var t=Ke(C.current.innerText,{bannedWords:c});p&&p(t),w(t),y(C.current.innerText)}},className:"title-input"})}),o.createElement(d,{size:"p4",className:"count-string"},v("createPost.popup.wordCount",{count:(null===(t=C.current)||void 0===t?void 0:t.innerText.length)||0,max:120})))},Xe=function(n){var u=n.className,d=n.style,m=n.topics,p=n.communityId,v=n.onChange,g=n.isLoading,h=n.disabled,w=n.forceTopics,C=n.selectedTopics,b=n.noFetch,N=a(f).data,I=N.locale,T=N.env.isMarryBaby,x=r(m?i([],m,!0):[]),M=x[0],_=x[1],P=r(C?i([],C,!0):[]),L=P[0],S=P[1],j=r(!1),F=j[0],R=j[1],D=l(m);D.current=m,s((function(){var n;!p||b||(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,k(y(E.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(A).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,b]);var z=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==w?void 0:w.map((function(e){return e.id})).join("-");s((function(){m&&void 0!==z&&z!==V&&_(m)}),[m,z,V]);var H=c((function(){return M.filter((function(e){return!(null==w?void 0:w.some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})))}))}),[V,U]);return o.createElement(O,{"data-is-marrybaby":T,className:u,style:d},w.map((function(e){return o.createElement(Je,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:!0,selected:!0})})),H.map((function(e){return o.createElement(Je,{key:"".concat(e.id,"-").concat(e.mappedCategoryId),topic:e,disabled:h,selected:(C||L).some((function(t){return t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId})),onClick:function(){var t=C||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&&C?v(t.slice()):(v&&v(t.slice()),S(t.slice()))}})})),(g||F)&&o.createElement(B,{className:"topic-spinner"}))},Je=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)},Ye=function(n){var l=n.className,c=n.style,u=n.onPostCreatedEdited,v=n.onClose,h=n.communities,w=void 0===h?[]:h,C=n.forceSelectCommunity,k=n.forceSelectTopics,y=n.articleId,E=n.optionalTopic,b=n.editPostData,N=n.defaultCommunity,I=n.defaultTopics,x=n.noFetchTopic,M=n.hideTopicList,_=!!(null==b?void 0:b.id),P=a(f),L=P.data,S=L.locale,B=L.env.isMarryBaby,F=P.action,R=F.pushNotifications,D=F.sanitizeFunction,O=g().t,A=r(!1),W=A[0],Z=A[1],G=r(""),K=G[0],Q=G[1],X=r(""),J=X[0],Y=X[1],$=r(C?{label:C.name,value:"".concat(C.id||"","-").concat(C.mappedCategoryId||"")}:{label:O("community.choose"),value:""}),q=$[0],ee=$[1],te=r(i([],k,!0)||[]),ne=te[0],ie=te[1],oe=r([]),ae=oe[0],re=oe[1],le=r([]),se=le[0],ce=le[1],ue=C||w.find((function(e){return"".concat(e.id||"","-").concat(e.mappedCategoryId||"")===q.value})),de=C?[C]:w.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&&j(J)&&(E||!E&&ne.length>0)&&ue&&(!ae||ae.length<=T)&&!(null==he?void 0:he.length)&&!W;s((function(){if(b){var e=b;Q(e.title||""),Y(z(V(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 Ce=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,ze({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,Ue({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,Ve({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(H(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(U,{className:l,style:c},o.createElement("div",{className:"input-group-container"},o.createElement(Qe,{className:"input-group",bannedWords:se,value:K,onChange:Q}),o.createElement(Ge,{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:!!C}),o.createElement(d,{size:"sm",className:"warning",color:Te.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":De}),o.createElement(d,{size:"base",color:Te.colors.gray500},O(ue?"createPost.popup.primary":"createPost.popup.warning"))),ue&&o.createElement(Xe,{className:"tag-list",communityId:ue.id,forceTopics:k,onChange:ie,selectedTopics:ne,noFetch:x}))),o.createElement(m,{theme:B?"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||W)return[3,5];Z(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Ce()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.error(e),R(Re(O)),[3,4];case 4:Z(!1),t.label=5;case 5:return[2]}}))}))},isDisabled:!we,isLoading:W},O("createPost.popup.submit")))},$e=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,w=e.isThumbnailIcon,C=e.onClose,k=a(f).data.env.isMarryBaby,y="boolean"==typeof n?n:k,E=r(!1),b=E[0],N=E[1];return s((function(){return h(!0),setTimeout((function(){return N(!0)}),0),function(){return h(!1)}}),[]),xe.createPortal(o.createElement(W,{"data-is-marrybaby":y,className:t,style:i,"data-open":b},o.createElement(Z,{className:"popup-frame",isOpen:b,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(w?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:g})),o.createElement(Pe,{className:"title",tag:"h2"},l),o.createElement(d,{className:"desc",size:"lg"},c),o.createElement("div",{className:"btn-group"},o.createElement(m,{theme:y?"marryBaby":"helloSites",size:"md",color:"secondary",onClick:function(){null==v||v(),null==C||C()}},u),o.createElement(m,{theme:y?"marryBaby":"helloSites",size:"md",onClick:C},p)))),y&&g&&o.createElement("div",{className:"thumbnail-container is-mobile ".concat(w?"is-icon":"")},o.createElement("img",{className:"thumbnail",src:g})))),document.body)},qe=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=_(o.replace(/(\ )+/g," "),s),m=M(n),a&&a.length>0?[4,Promise.all(null==a?void 0:a.map((function(e){return P(e,l)})))]:[3,2];case 1:t.sent().filter(Boolean).slice(0,T).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]}}))}))},et=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,I(y(E.COMMENT.CREATE,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},tt=function(n,i){return e(void 0,void 0,void 0,(function(){return t(this,(function(e){return[2,I(y(E.COMMENT.REPLY,{_locale:i}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}})]}))}))},nt=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,I(y(a?E.COMMENT.LIKE:E.COMMENT.UNLIKE,{_locale:r,id:i}),"GET")]}))}))},it=function(e){var t=e.id,n=e.locale;return I(y(E.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")},ot=function(i){var c=i.isReply,u=i.className,p=i.onClose,v=i.replyToName,h=i.style,w=i.replyingId,C=i.replyingUser,k=i.onPostSuccess;i.isMainCmt;var y=i.post,E=i.isMarryBaby,b=a(f),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,j=g().t,F=We(),R=F.onSelectImages,D=F.onRemoveImage,O=F.imageSrcs,A=F.onRemoveAllImages,z=F.imageFiles,V=r(""),U=V[0],H=V[1],W=a(G).trigger,Z=r(!1),Y=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(K,{"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:j("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(Q,{className:"avatar-wrapper ".concat(c?"avatar-wrapper-reply":""),avatar:(null==M?void 0:M.id)?M.avatar:X,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(Me,{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(S,{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)||Y)return[2];$(!0),t.label=1;case 1:return t.trys.push([1,4,,5]),e=function(e){H(""),A(),p&&p();var t=J(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),k&&k(t)},[4,qe(n({message:U,photos:z,postId:String(y.id),link:null==ce?void 0:ce.url,sanitizeFunction:T,locale:_},c&&w?{replyingUserId:String((null==C?void 0:C.id)||(null===(r=null==y?void 0:y.author)||void 0===r?void 0:r.id)||""),replyingId:w,replyingUserName:(null==C?void 0:C.name)||(null==C?void 0:C.username)||""}:{}))];case 2:return i=t.sent(),[4,c&&w?tt(i,_):et(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:j("notification.comment.blocked.title"),message:j("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:j("notification.comment.suspect.title"),message:j("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:j("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])||j("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 4:return t.sent(),I({title:"",message:j("notification.comment.somethingWrong"),type:"danger"}),[3,5];case 5:return $(!1),[2]}}))}))},isLoading:Y,isDisabled:!!(null==ie?void 0:ie.length)||Y||!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"},j("notification.limitUrlDomain")):null,(!O||0===O.length)&&ce&&o.createElement("div",{className:"link-preview-wrapper"},ce.isFetching?o.createElement(B,null):o.createElement(o.Fragment,null,o.createElement(je,{title:ce.title,url:ce.url||"#",image:ce.image,noRefetch:!0}),o.createElement("img",{src:Ze,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:Ze,className:"icon-close-circle",onClick:function(){return D(t)}}))}))))},at="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",rt=function(n){var i=n.className,l=n.style,s=n.reason,c=n.reasonText,u=n.onClose,p=n.postId,v=a(f),h=v.data,w=h.locale,C=h.env.isMarryBaby,k=v.action.pushNotifications,y=g().t,E=r(!1),b=E[0],N=E[1];return o.createElement(Y,{"data-is-marrybaby":C,className:i,style:l},o.createElement("ul",{className:"report-list"},o.createElement("li",{className:"report-item"},o.createElement("img",{src:at}),o.createElement(d,{className:"__label",color:Te.colors.gray800,size:"p4"},c))),o.createElement(m,{theme:C?"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,He({id:p,reason:s,locale:w})];case 2:return 1===(null==(e=t.sent())?void 0:e.status)&&(k({message:"Post reported",type:"success"}),u&&u()),[3,4];case 3:return t.sent(),[3,4];case 4:return N(!1),[2]}}))}))}},y("submit")))},lt=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],w=g().t,C=$().authActionWrapper,k=r(!1),y=k[0],E=k[1],b=z(V(s||"","display"),m),N=a(f).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(q,{isOpen:y,onClose:function(){return E(!1)},expertId:String(null==l?void 0:l.partnerId)}),o.createElement(ee,{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(),C((function(){return h(!0)}))},className:"see-more-text"},w("post.seeMore")))))},st=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)}),[]),xe.createPortal(o.createElement(te,{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"})})))),document.body)},ct="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",ut=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 xe.createPortal(o.createElement(ne,{"data-open":d&&!!p},o.createElement(ie,null,o.createElement("img",{src:oe,className:"icon-close",onClick:i,alt:"close"})),p&&l>=0&&o.createElement(o.Fragment,null,o.createElement(ae,null,o.createElement("img",{className:"img-preview",src:p,alt:"post img open"}),o.createElement(re,{"data-disabled":v,onClick:function(){return!v&&c(l-1)}},o.createElement(le,null,o.createElement("img",{src:ct,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":v}))),o.createElement(re,{"data-right":!0,"data-disabled":g,onClick:function(){return!g&&c(l+1)}},o.createElement(le,null,o.createElement("img",{src:ct,alt:"right arrow","data-disabled":g})))))),document.body)},dt=function(e){var t=e.className,n=e.images,i=void 0===n?[]:n,c=e.style,u=e.authorName,d=a(f).data.env.isMarryBaby,m="+ ".concat((i.length||0)-4),p=r(!1),v=p[0],g=p[1],w=r(-1),C=w[0],k=w[1];s((function(){setTimeout((function(){return null==Le?void 0:Le.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||C>=0?(h(!0),E.current=!0):(h(!1),E.current=!1)}),[v,C]),o.createElement(o.Fragment,null,o.createElement(se,{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):k(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(Pe,{tag:"h1",color:"white"},m)))}))),v&&o.createElement(st,{authorName:u||"",images:i,onClose:function(){return g(!1)},onOpenSingleView:k}),C>=0&&o.createElement(ut,{images:i,initialViewIndex:C,onClose:function(){return k(-1)}}))},mt=function(i){var u=i.url,d=i.image,m=i.className,p=i.style,v=a(f).data.locale,g=r(null),h=g[0],w=g[1];s((function(){e(void 0,void 0,void 0,(function(){return t(this,(function(e){return d?[2]:u?(w((function(e){return n(n({},e),{isFetching:!0})})),k(y(E.FETCH_PREVIEW,{_locale:v}),"POST",{data:{link:u}}).then((function(e){var t,n;w({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(){w(null)})),[2]):[2,w(null)]}))}))}),[u,d]);var b=(null==h?void 0:h.image)||d,N=(null==h?void 0:h.url)||u,I=c((function(){return ce(N)}),[N]),T=c((function(){return ue(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(de,{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(B,{className:"loading-spinner"}):o.createElement("img",{className:"link-image",src:b||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))},pt="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",vt="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",gt="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",ht=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(f),p=m.data,v=p.env.isMarryBaby,h=p.locale,w=m.action.pushNotifications,C=g().t,k=r(!1),y=k[0],E=k[1],b=$().authActionWrapper;return o.createElement("div",{className:c,onClick:function(e){e.preventDefault(),e.stopPropagation()}},y&&o.createElement($e,{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:C("popup.deleteComment.title"),description:C("popup.deleteComment.description"),acceptText:C("popup.deletePost.accept"),cancelText:C("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,it({id:l,locale:h})]:[2];case 1:return 1===(null==(e=t.sent())?void 0:e.status)?(i&&i(),w({title:"",message:C("notification.success"),type:"success"})):w({title:"",message:(null===(n=null==e?void 0:e.messages)||void 0===n?void 0:n[0])||C("notification.failure"),type:"danger"}),[2]}}))}))},onClose:function(){return E(!1)}}),o.createElement(me,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:gt,label:C("actionPopover.delete"),onClick:function(){b((function(){E(!0)}))}}]},className:d,toggleButtonContent:o.createElement("img",{src:v?pt:vt}),buttonProps:{}}))},ft=function(i){var l,u,d,p,h,w=i.className,C=i.style,y=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(f).data,B=j.locale,F=j.userInfo,R=j.env.isMarryBaby,D=g().t,O=r(y||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,q=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=$({_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],ke=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,k(we(Ce.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:Se[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,k(we(Ce.GET_DOCTOR_INFO,{doctorId:i,website_url:Se[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 Be=(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&&(Be||Fe);return o.createElement(pe,{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(ve,{className:w,style:C,"data-is-reply":!!I,"data-is-marrybaby":R,"data-has-booking":Re},"reply"===b&&o.createElement(v,{className:"top-divider",type:"solid"}),o.createElement(ge,{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(lt,{className:"post-content-wrapper",replyingTo:ie,mentionedUser:q,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(dt,{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(je,{url:Y})),"most-engaging"!==b?o.createElement(o.Fragment,null,o.createElement(he,{type:fe.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,nt({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(ot,{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==ke?void 0:ke.slice(0,re))||void 0===h?void 0:h.map((function(e){return o.createElement(ft,{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(ht,{onDeleteComment:_,className:"popover",commentId:A.id})))},wt="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",kt="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",yt=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,w=n.onEditPost,C=a(f),k=C.data,b=k.locale,N=k.userInfo,T=k.togetherUserId,x=k.env.isMarryBaby,M=C.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=$().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(ke,{url:s,text:null==c?void 0:c.title,onClose:function(){return O(!1)}}),B&&o.createElement($e,{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,Ae({id:c.id,locale:b})];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(me,{className:p,toggleButtonContent:o.createElement("img",{src:x?pt:vt}),position:"bottom",align:"end",buttonProps:{isLoading:L},data:z?{isShowheader:!1,type:"list",list:[{icon:kt,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:w},{icon:gt,label:_("actionPopover.delete"),onClick:function(){A((function(){return F(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:kt,label:_("morePopover.share"),onClick:function(){return O(!0)}},{icon:(null==c?void 0:c.bookmarked)?wt: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,I(y(E.BOOKMARK.DELETE,{_locale:b}),"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,I(y(E.BOOKMARK.CREATE,{_locale:b}),"POST",{data:{user_id:T||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:wt}),v&&v()):M({title:"",message:"Post saved failed",type:"danger",displayIcon:Ct}),t.label=4;case 4:return[2]}}))}))}))}},{icon:at,label:_("morePopover.report"),subTree:{title:_("morePopover.report.title"),description:_("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(ye).map((function(e){return{label:ye[e].label,reason:ye[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(rt,{reason:e.reasonValue,reasonText:_(e.reason),postId:null==c?void 0:c.id,onClose:function(){return t&&t(!1)}})}}}}))}}]}}))},Et=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,Ie(y(E.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(J))||void 0===r?void 0:r[0]]}}))}))},bt=function(i){var l=i.className,c=i.style,u=i.hideViewMoreComment,d=i.showMostEngaging,p=i.onCommentClick,v=i.onCommentCountClick,h=i.onMostEngagingCommentClick,w=i.onPostCommentSuccess,y=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),B=S[0],F=S[1],R=r(!1),D=R[0],O=R[1],A=r(T),z=A[0],V=A[1],U=B.community,H=B.topics,W=B.author,Z=B.slug,G=B.isPin,K=B.liked,Q=B.scheduleDateTime,X=B.createdAt,J=B.photos,Y=B.mentions,q=B.title,ee=B.description,te=B.previewUrl,ne=B.likesCount,ie=B.commentsCount,oe=B.id,ae=B.commented,re=a(f),le=re.data,se=le.locale,ce=le.env,ue=ce.isMarryBaby,de=ce.togetherBasePath,me=re.action.pushNotifications,ve=g().t,ye=r(M),Ie=ye[0],Te=ye[1],xe="".concat(de,"/").concat((null==U?void 0:U.slug)||"_","/").concat(Z||""),Me="".concat(Ee(se)).concat(xe),_e=$((null==U?void 0:U.slug)?{_joinCommunityIds:[U.id],_joinTopicIds:null==H?void 0:H.map((function(e){return e.id}))}:void 0).authActionWrapper,Le=r(!1),Se=Le[0],De=Le[1];s((function(){Te(M)}),[M]);var Ae=(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,k(we(Ce.GET_HOSPITAL_INFO,{hospital_branch_id:n,website_url:Ne[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,k(we(Ce.GET_DOCTOR_INFO,{doctorId:i,website_url:Ne[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,Et(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,Et(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(pe,{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(ke,{url:Me,avatar:C,text:q,onClose:function(){return O(!1)}}),o.createElement(be,{className:l,style:c,"data-is-marrybaby":ue},G?o.createElement(Fe,{className:"post-pin"}):null,o.createElement("div",{style:{position:"relative"}},o.createElement(ge,{avatar:Ve,name:Ae,username:ze,url:y?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(yt,{authorEmail:String(null==W?void 0:W.email),onDeletePost:b,shareUrl:Me,post:B,className:"popover",onEditPost:N})),o.createElement("a",{href:y?void 0:xe,className:"post-content-link-wrapper"},q&&o.createElement(Pe,{className:"post-content-title",as:"h1",tag:"h5",fontWeight:"bold"},j(q)),o.createElement(lt,{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(Be,{topics:H,className:"post-topics"}):null),o.createElement("div",{key:"social-preview"},(null==B?void 0:B.introUrl)?o.createElement("div",{className:"social-preview-wrapper ".concat((null==J?void 0:J.length)?"has-image":"")},o.createElement(mt,{url:B.introUrl,image:B.bannerImage})):null),o.createElement("div",{key:"image-preview"},(null==J?void 0:J.length)?o.createElement("div",{className:"image-preview-wrapper"},o.createElement(dt,{images:J,authorName:null==W?void 0:W.name})):null),o.createElement("div",{key:"link-preview"},(null==B?void 0:B.introUrl)||(null==J?void 0:J.length)||!(null==te?void 0:te.url)?null:o.createElement("div",{className:"link-preview-wrapper"},o.createElement(je,{title:te.title,url:te.url,image:te.image}))),o.createElement(he,{type:fe.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():!y&&(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];De(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Oe({id:oe,locale:se})];case 2:return 1!==(null==(e=t.sent())?void 0:e.status)?me(Re(ve)):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(Re(ve)),[3,4];case 4:return De(!1),[2]}}))}))},showingMostEngaging:!(!d||!(null==z?void 0:z.id))}),Ie&&o.createElement(ot,{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})})),w&&w(e)},post:B}),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(ft,{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"},ve("comment.seeMoreComments",{count:ie-1}))):null,_))},Nt=Object.freeze({__proto__:null});export{je as C,ot as I,Fe as L,$e as P,rt as S,Be as T,Ye as a,Ge as b,Qe as c,Xe as d,lt as e,st as f,ut as g,dt as h,bt as i,yt as j,ft as k,ht as l,Nt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as n}from"./tslib.es6-fd0a5c98.js";import{keyframes as t}from"styled-components";import{useContext as a,useMemo as r}from"react";import{T as i,d as e}from"./translationsContext-221a5963.js";var o,s,l,d,c;!function(n){n.Boy="boy",n.Girl="girl"}(o||(o={})),function(n){n[n.Weight=0]="Weight",n[n.Height=1]="Height",n[n.Head=2]="Head",n[n.BMI=3]="BMI"}(s||(s={})),function(n){n[n.Weekly=0]="Weekly",n[n.Monthly=1]="Monthly",n[n.Yearly=2]="Yearly"}(l||(l={})),function(n){n[n.Weight=0]="Weight",n[n.Height=1]="Height",n[n.Head=2]="Head",n[n.BMI=3]="BMI",n[n.Record=4]="Record"}(d||(d={})),function(n){n.Vietnam="vi-VN",n.Indonesia="id-ID",n.Malaysia="ms-MY",n.Cambodia="km-KH",n.PhilippinesEnglish="en-PH",n.PhilippinesTagalog="tl-PH",n.Thailand="th-TH",n.Myanmar="my-MM",n.Taiwan="zh-TW",n.India="hi-IN"}(c||(c={}));var m,f,u,p,_,I,E,T,B,O=function(n){var t=Object.keys(n);return t.length?"?"+t.map((function(t){return"".concat(t,"=").concat(n[t])})).join("&"):""},h=function(n,t,a){void 0===t&&(t=1),void 0===a&&(a="page");var r=n.split("?"),i=r[0],e=r[1],o=new URLSearchParams(e||""),s={};return o.forEach((function(n,t){n&&(s[t]=n)})),Number(t)>1?s[a]=String(t):delete s[a],i+O(s)},y=function(n){"undefined"!=typeof window&&(document.documentElement.style.overflow=n?"hidden":"")},A={BREAK_POINT_SMALL_MOBILE:481,BREAK_POINT_MOBILE:768,BREAK_POINT_TABLET:1024,BREAK_POINT_PC:1200},P={smbDown:"@media (max-width: ".concat(A.BREAK_POINT_SMALL_MOBILE-1,"px)"),smbUp:"@media (min-width: ".concat(A.BREAK_POINT_SMALL_MOBILE,"px)"),mbDown:"@media (max-width: ".concat(A.BREAK_POINT_MOBILE-1,"px)"),mbOnly:"@media (min-width: ".concat(A.BREAK_POINT_SMALL_MOBILE,"px) and (max-width: ").concat(A.BREAK_POINT_MOBILE-1,"px)"),mbUp:"@media (min-width: ".concat(A.BREAK_POINT_MOBILE,"px)"),tdDown:"@media (max-width: ".concat(A.BREAK_POINT_TABLET-1,"px)"),tdOnly:"@media (min-width: ".concat(A.BREAK_POINT_MOBILE,"px) and (max-width: ").concat(A.BREAK_POINT_TABLET-1,"px)"),tdUp:"@media (min-width: ".concat(A.BREAK_POINT_TABLET,"px)"),pcUp:"@media (min-width: ".concat(A.BREAK_POINT_PC,"px)"),pcOnly:"@media (min-width: ".concat(A.BREAK_POINT_TABLET,"px) and (max-width: ").concat(A.BREAK_POINT_PC-1,"px)"),pcDown:"@media (max-width: ".concat(A.BREAK_POINT_PC-1,"px)")},b=function(n){switch(n){case"smbDown":return[0,A.BREAK_POINT_SMALL_MOBILE-1];case"smbUp":return[A.BREAK_POINT_SMALL_MOBILE,0];case"mbDown":return[0,A.BREAK_POINT_MOBILE-1];case"mbOnly":return[A.BREAK_POINT_SMALL_MOBILE,A.BREAK_POINT_MOBILE-1];case"mbUp":return[A.BREAK_POINT_MOBILE,0];case"tdDown":return[0,A.BREAK_POINT_TABLET-1];case"tdOnly":return[A.BREAK_POINT_MOBILE,A.BREAK_POINT_TABLET-1];case"tdUp":return[A.BREAK_POINT_TABLET,0];case"pcUp":return[A.BREAK_POINT_PC,0];case"pcOnly":return[A.BREAK_POINT_TABLET,A.BREAK_POINT_PC-1];case"pcDown":return[0,A.BREAK_POINT_PC-1]}},L=t(m||(m=n(["\nfrom {\n transform: translate3d(0, 100%, 0);\n visibility: visible;\n}\n\nto {\n transform: translate3d(0, 0, 0);\n}\n"],["\nfrom {\n transform: translate3d(0, 100%, 0);\n visibility: visible;\n}\n\nto {\n transform: translate3d(0, 0, 0);\n}\n"]))),v=t(f||(f=n(["\nfrom {\n transform: translate3d(0, -100%, 0);\n visibility: visible;\n }\n\n to {\n transform: translate3d(0, 0, 0);\n }\n"],["\nfrom {\n transform: translate3d(0, -100%, 0);\n visibility: visible;\n }\n\n to {\n transform: translate3d(0, 0, 0);\n }\n"]))),w=t(u||(u=n(["\n from {\n transform: translate3d(-100%, 0, 0);\n visibility: visible;\n }\n\n to {\n transform: translate3d(0, 0, 0);\n }\n"],["\n from {\n transform: translate3d(-100%, 0, 0);\n visibility: visible;\n }\n\n to {\n transform: translate3d(0, 0, 0);\n }\n"]))),M=t(p||(p=n(["\n from {\n transform: translate3d(100%, 0, 0);\n visibility: visible;\n }\n\n to {\n transform: translate3d(0, 0, 0);\n }\n"],["\n from {\n transform: translate3d(100%, 0, 0);\n visibility: visible;\n }\n\n to {\n transform: translate3d(0, 0, 0);\n }\n"]))),N=t(_||(_=n(["\nfrom {\n transform: translate3d(0, 0, 0);\n}\n\nto {\n visibility: hidden;\n transform: translate3d(0, 100%, 0);\n}\n"],["\nfrom {\n transform: translate3d(0, 0, 0);\n}\n\nto {\n visibility: hidden;\n transform: translate3d(0, 100%, 0);\n}\n"]))),R=t(I||(I=n(["\nfrom {\n transform: translate3d(0, 0, 0);\n}\n\nto {\n visibility: hidden;\n transform: translate3d(-100%, 0, 0);\n}\n"],["\nfrom {\n transform: translate3d(0, 0, 0);\n}\n\nto {\n visibility: hidden;\n transform: translate3d(-100%, 0, 0);\n}\n"]))),K=t(E||(E=n(["\nfrom {\n transform: translate3d(0, 0, 0);\n}\n\nto {\n visibility: hidden;\n transform: translate3d(100%, 0, 0);\n}\n"],["\nfrom {\n transform: translate3d(0, 0, 0);\n}\n\nto {\n visibility: hidden;\n transform: translate3d(100%, 0, 0);\n}\n"]))),x=t(T||(T=n(["\n from {\n transform: translate3d(0, 0, 0);\n }\n\n to {\n visibility: hidden;\n transform: translate3d(0, -100%, 0);\n }\n"],["\n from {\n transform: translate3d(0, 0, 0);\n }\n\n to {\n visibility: hidden;\n transform: translate3d(0, -100%, 0);\n }\n"]))),g=t(B||(B=n(["\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n"],["\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n"]))),C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function H(n){var t={exports:{}};return n(t,t.exports),t.exports}var D=H((function(n){(function(t){function a(n){var t=new Error(n);return t.name="ValueError",t}function r(n){return function(t){var r=Array.prototype.slice.call(arguments,1),i=0,e="UNDEFINED";return t.replace(/([{}])\1|[{](.*?)(?:!(.+?))?[}]/g,(function(t,o,s,l){if(null!=o)return o;var d=s;if(d.length>0){if("IMPLICIT"===e)throw a("cannot switch from implicit to explicit numbering");e="EXPLICIT"}else{if("EXPLICIT"===e)throw a("cannot switch from explicit to implicit numbering");e="IMPLICIT",d=String(i),i+=1}var c=d.split("."),m=(/^\d+$/.test(c[0])?c:["0"].concat(c)).reduce((function(n,t){return n.reduce((function(n,a){return null!=a&&t in Object(a)?["function"==typeof a[t]?a[t]():a[t]]:[]}),[])}),[r]).reduce((function(n,t){return t}),"");if(null==l)return m;if(Object.prototype.hasOwnProperty.call(n,l))return n[l](m);throw a('no transformer named "'+l+'"')}))}}var i=r({});i.create=r,i.extend=function(n,a){var i=r(a);n.format=function(){var n=Array.prototype.slice.call(arguments);return n.unshift(this),i.apply(t,n)}},n.exports=i}).call(C,C)}));function S(){var n=a(i)||{locale:"en-PH"},t=n.values,o=n.locale;return r((function(){return{t:function(n,a){return t?t[n]?a?D(t[n]||n,a):t[n]||n:(console.warn("[useTranslations] Missing translation for key ".concat(n," and locale ").concat(o)),a?D(e[n]||n,a):e[n]||n):(console.error("[useTranslations] t method called before translation values are loaded"),n)},locale:o}}),[t,o])}export{A as B,o as G,c as L,P as M,v as a,w as b,M as c,x as d,N as e,R as f,K as g,g as h,h as i,b as j,s as k,l,O as m,d as n,H as o,C as p,D as q,L as s,y as t,S as u};
|
package/build/types-d1bc9a86.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("./tslib.es6-f7929e76.js"),t=require("react"),n=require("./index.styled-9b7b2095.js"),a=require("./index-e517ed0e.js"),o=require("./useTranslations-99cf899e.js"),i=require("./index.styled-0d3afe1b.js"),l=require("./theme-6cd33b22.js");require("react-range");var r=require("react-dom");require("date-fns");var s=require("./index-2ea715f8.js"),c=require("lodash/debounce"),u=require("./index-1aff1d46.js"),d=require("./number-95704111.js"),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,S=(null==k?void 0:k.logo)||s,P=(null==k?void 0:k.url)||l,x=P.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:P,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&&S&&!C&&f.default.createElement("img",{className:"link-logo",src:S,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]}}))}))},S=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()]}}))}))},P=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),S=T.onSelectImages,P=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:S}),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 P(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],S=b[1],P=t.useRef(l);P.current=l,t.useEffect((function(){var t;!r||p||(null===(t=P.current)||void 0===t?void 0:t.length)||(E([]),S(!0),e.__awaiter(void 0,void 0,void 0,(function(){var t,n,a,o;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,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),S(!1),[3,3];case 3:return S(!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})))),document.body)},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,S=_.env.isMarryBaby,P="boolean"==typeof h?h:S,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:P?"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"})})))),document.body)},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,o=e.onClose,l=t.useState(n),r=l[0],s=l[1],c=t.useState(!1),u=c[0],d=c[1];t.useEffect((function(){setTimeout((function(){d(!0)}),0)}),[]);var m=null==a?void 0:a[r],p=0===r,v=!(null==a?void 0:a.length)||r===(null==a?void 0:a.length)-1;return g.createPortal(f.default.createElement(i.StyledImagePreviewContainer,{"data-open":u&&!!m},f.default.createElement(i.StyledImagePreviewTopbar,null,f.default.createElement("img",{src:i.img,className:"icon-close",onClick:o,alt:"close"})),m&&r>=0&&f.default.createElement(f.default.Fragment,null,f.default.createElement(i.StyledImagePreviewWrapper,null,f.default.createElement("img",{className:"img-preview",src:m,alt:"post img open"}),f.default.createElement(i.StyledArrowWrapper,{"data-disabled":p,onClick:function(){return!p&&s(r-1)}},f.default.createElement(i.StyledCircleArrow,null,f.default.createElement("img",{src:Z,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":p}))),f.default.createElement(i.StyledArrowWrapper,{"data-right":!0,"data-disabled":v,onClick:function(){return!v&&s(r+1)}},f.default.createElement(i.StyledCircleArrow,null,f.default.createElement("img",{src:Z,alt:"right arrow","data-disabled":v})))))),document.body)},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,S=l.refetchComment,P=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 S&&S(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 Se=(null==be?void 0:be.valid_outpatient)||(null==be?void 0:be.valid_telemedicine),Pe=((null==ye?void 0:ye.total_available_service)||(null==ye?void 0:ye.total_available_doctor))>0,xe=P&&(Se||Pe);return 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:P})})),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,S=t.useState(!1),P=S[0],x=S[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)||P)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:P},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,S=a.mostEngagingComment,P=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(S),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),Se=Te[0],Pe=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==S?void 0:S.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==S?void 0:S.id]),t.useEffect((function(){H(S)}),[null==S?void 0:S.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})})),P&&P(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:Se?!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||Se)return[2];Pe(!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 Pe(!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,P({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,S({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;
|