"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2420],{ohJh:function(e,t,o){o.d(t,{C:function(){return CreateNewPostContent},S:function(){return SkipQuestionOfExpertBtn},T:function(){return TopicSelectList},a:function(){return CreateNewPostContentV2},b:function(){return CreatePostDescription$1},c:function(){return CreatePostTitle$1}});var i,r,a=o("FRPj"),l=o("q1tI"),n=o("J+gj"),s=o("UAco"),c=o("UG+c"),d=o("Gx+P"),p=o("ns0B"),u=o.n(p),m=o("iBNF"),g=o("fdQd"),v=o("8vDj"),h=o("gtaG"),f=o("LES+"),x=o("wp0n"),b=o("8wjV"),y=o("uuQu"),C=o("mihF"),w=o("VhOp"),E=o("rBCA"),k=o("Fo2T"),$=o("Aqof"),S=o("0CvA"),P=o("bJUT"),N=o("pq7p"),T=o("l9Yf"),L=o("sEfC"),z=o.n(L),I=o("UiDi"),D=o.n(I),M=o("IQVP"),A=o("zPX9"),Z=o("wbWA"),B=o("fDsU"),R=o("eosF"),_=o("i8i4"),F=o("xA8p"),H=o("voTM"),U=o("LgdP"),j=o("27Mu"),O=o("g35t"),V=o("dxY4"),q=o("ywlr"),W=o("q9DY"),G=o("m42D");let K=E.Z.div` position: relative; display: flex; height: 100%; flex-direction: column; padding: 16px 24px; ${y.M.mbDown} { padding: 16px 16px; } .input-group-container { flex: 1; padding-right: 2px; padding-left: 2px; margin-bottom: 24px; -ms-overflow-style: none; /* IE and Edge */ overflow-y: auto; scrollbar-width: none; /* Firefox */ &::-webkit-scrollbar { display: none; } } .input-group { :not(:last-child) { margin-bottom: 0.6rem; } input:focus, textarea:focus, [contenteditable='true'] { outline: none; } label { margin-bottom: 5px; color: ${m.r.colors.gray600}; /* font-family: 'Open Sans', sans-serif; */ font-size: 13px; font-weight: bold; } .input-group-label { margin-bottom: 5px; color: ${m.r.colors.gray600}; /* font-family: 'Open Sans', sans-serif; */ font-size: 13px; font-weight: bold; } .input-notification { display: flex; & > img { width: 16px; height: 16px; margin-top: 1.5px; margin-right: 8px; } } .tag-list { } } .warning { margin-top: 16px; } .submit-btn { width: 100%; } .switch-label { display: flex; align-items: center; } .swich-input-group { padding: 12px 16px; border-radius: 8px; background: ${m.r.colors.neutral50}; &.askdoctor-switch { background: ${m.r.colors.primary50}; &.mb-color { background: ${m.r.mbColors.tonePink}; } } .mantine-Switch-labelWrapper { flex-grow: 1; } .mantine-Checkbox-body { display: flex; width: 100%; align-items: center; justify-content: space-between; } .mantine-Switch-track { margin-bottom: 0; } .label-txt { font-weight: normal; font-size: 14px; color: ${m.r.colors.gray800}; margin-left: 10px; } } `,Q=E.Z.div` display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 0 0 8px 8px; background: ${m.r.colors.neutral50}; border: 1px solid ${m.r.colors.gray200}; gap: 12px; &.has-error { border: 1px solid ${m.r.colors.red600}; } &.error-description { border: 1px solid ${m.r.colors.red600}; border-top: none; } &[data-is-marry-baby='true'] { background: ${m.r.mbColors.tonePink}; } .switch-label { display: flex; gap: 4px; align-items: flex-start; svg { margin-top: 2px; } .wrapper-text { .label-txt { color: ${m.r.colors.gray800}; font-size: 14px; font-weight: 600; line-height: 22px; } .description-txt { color: ${m.r.colors.gray700}; font-size: 12px; font-weight: 400; line-height: 18px; } } } button { height: 40px; &:hover, &.primary { border-radius: 16px; border: 1px solid ${m.r.colors.blue100}; background: ${m.r.colors.blue50}; color: ${m.r.colors.primaryBase}; } } `,J=E.Z.div` margin-bottom: 12px; color: ${m.r.colors.red700}; svg { margin-right: 5px; } svg, span { vertical-align: middle; } `,Y=E.Z.div` .swich-input-group { padding: 12px 16px; border-radius: 8px; background: ${m.r.colors.neutral50}; &.askdoctor-switch { background: ${m.r.colors.blue50}; } .switch-label { display: flex; align-items: center; } .mantine-Switch-labelWrapper { flex-grow: 1; } .mantine-Checkbox-body { display: flex; width: 100%; align-items: center; justify-content: space-between; } .mantine-Switch-track { margin-bottom: 0; } .label-txt { font-weight: normal; font-size: 14px; color: ${m.r.colors.gray800}; margin-left: 14px; } } `,X=E.Z.div` display: flex; gap: 12px; .avatar { width: 40px; height: 40px; border-radius: 100%; img { border-radius: 100%; } .author-avatar { .col-left { display: none; } } } .post-action-form { display: flex; flex-direction: column; gap: 4px; } .post-action-by { color: ${m.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; } .post-action-result { display: flex; position: relative; &:after { content: ''; display: inline-block; width: 5px; height: 5px; background-color: ${m.r.colors.error}; border-radius: 100%; position: absolute; right: 7px; } } .dropdown-post-action { background: ${m.r.colors.white} !important; border-radius: 2px; border: 1px solid ${m.r.colors.neutral200} !important; > div { padding: 3px 8px; } span { flex: 1; color: ${m.r.colors.gray600}; font-size: 12px; font-weight: 600; line-height: 18px; } ul { width: 130px; li { img { flex: 0 0 16px; width: 16px; } } } } `,ee=E.Z.div` display: inline-flex; gap: 8px; align-items: center; cursor: pointer; .session-title { color: ${m.r.colors.gray700}; font-size: 14px; font-weight: 400; line-height: 22px; flex: 1; } `;var et="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3e%3cpath d='M8.78785 10.7863H7.21084C5.77572 10.237 4.20739 10.237 2.77223 10.7863H1.55404V11.6457H2.41467V11.6537C2.41802 13.0707 3.57408 14.2238 4.99111 14.2238C6.4069 14.2238 7.56293 13.072 7.56797 11.6566L7.56803 11.6457H8.4303V11.6537C8.43365 13.0707 9.58971 14.2238 11.0067 14.2238C12.4225 14.2238 13.5786 13.072 13.5836 11.6566L13.5837 11.6457H14.4447V10.7863H13.2265C11.7913 10.237 10.223 10.237 8.78785 10.7863Z' fill='%238C8C8C'/%3e%3cpath d='M0.666016 6.48926V6.91895C0.666016 8.10354 1.62986 9.06738 2.81445 9.06738H13.1842C14.3688 9.06738 15.3327 8.10354 15.3327 6.91895V6.48926H0.666016Z' fill='%238C8C8C'/%3e%3cpath d='M12.36 3.18227C11.9916 2.07614 10.961 1.33301 9.7953 1.33301C9.13524 1.33301 8.48902 1.58185 7.99935 2.01991C7.50965 1.58185 6.86346 1.33301 6.2034 1.33301C5.03772 1.33301 4.00712 2.07614 3.63871 3.18184L2.8207 5.62988H13.1779L12.36 3.18227Z' fill='%238C8C8C'/%3e%3c/svg%3e",eo="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3e%3cpath d='M8.00045 14.3336C7.12449 14.3336 6.30114 14.1674 5.53038 13.835C4.75962 13.5025 4.08916 13.0513 3.51902 12.4815C2.94886 11.9116 2.49749 11.2414 2.1649 10.471C1.83231 9.70056 1.66602 8.87738 1.66602 8.00143C1.66602 7.12547 1.83224 6.30211 2.16468 5.53136C2.49713 4.76059 2.94829 4.09014 3.51818 3.51999C4.08808 2.94984 4.75824 2.49847 5.52867 2.16588C6.29908 1.83329 7.12226 1.66699 7.99822 1.66699C8.87417 1.66699 9.69753 1.83322 10.4683 2.16566C11.239 2.4981 11.9095 2.94927 12.4796 3.51916C13.0498 4.08906 13.5012 4.75922 13.8338 5.52964C14.1664 6.30005 14.3327 7.12324 14.3327 7.99919C14.3327 8.87515 14.1664 9.6985 13.834 10.4693C13.5015 11.24 13.0504 11.9105 12.4805 12.4806C11.9106 13.0508 11.2404 13.5022 10.47 13.8347C9.69959 14.1673 8.8764 14.3336 8.00045 14.3336ZM7.99933 13.3336C9.48822 13.3336 10.7493 12.817 11.7827 11.7836C12.816 10.7503 13.3327 9.4892 13.3327 8.00031C13.3327 7.92253 13.331 7.84304 13.3275 7.76184C13.3241 7.68065 13.3203 7.608 13.316 7.54389C13.2733 7.85329 13.1393 8.10928 12.9141 8.31184C12.6889 8.51441 12.4181 8.61569 12.1019 8.61569H10.5891C10.2506 8.61569 9.96087 8.49527 9.71985 8.25441C9.47883 8.01357 9.35832 7.72403 9.35832 7.38581V6.77088H6.89678V5.54099C6.89678 5.20277 7.01729 4.91272 7.25832 4.67084C7.49935 4.42896 7.78909 4.30803 8.12755 4.30803H8.74293V4.05159C8.74293 3.76185 8.83054 3.52189 9.00575 3.33173C9.18097 3.14155 9.39209 3.00885 9.6391 2.93364C9.37841 2.84818 9.11262 2.78236 8.84173 2.73621C8.57084 2.69005 8.29004 2.66698 7.99933 2.66698C6.51044 2.66698 5.24933 3.18364 4.216 4.21698C3.18267 5.25031 2.666 6.51142 2.666 8.00031V8.09648C2.666 8.12639 2.66814 8.15844 2.67242 8.19263H5.83265C6.5147 8.19263 7.09547 8.43237 7.57495 8.91186C8.05444 9.39134 8.29418 9.97114 8.29418 10.6513V11.2695H6.44803V13.0965C6.6959 13.1734 6.94847 13.2321 7.20573 13.2727C7.463 13.3133 7.72753 13.3336 7.99933 13.3336Z' fill='%238C8C8C'/%3e%3c/svg%3e";E.Z.div` background-color: white; z-index: 1000; top: 0; left: 0; height: 100%; position: absolute; width: 100%; .drawer-header { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid ${m.r.colors.gray200}; .input-group-label { flex: 1; } img { cursor: pointer; } p { flex: 1; } } .drawer-content { padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; height: calc(100% - 49px); .input-field-label { margin-bottom: 8px; } &.drawer-content-full-screen { max-width: 680px; margin: 0 auto; padding: 16px 24px; } } `;let ei=E.Z.div` display: flex; flex-direction: column; gap: 8px; margin-top: 8px; .topic-review { display: flex; gap: 4px; flex-wrap: wrap; } .community-review { .tag-item { background-color: ${m.r.colors.neutral50}; img { border-radius: 50%; margin-right: 8px; } } } `,PostCommunityReview=({selectedTopics:e,currentCommunity:t})=>l.createElement(ei,null,l.createElement("div",{className:"community-review"},l.createElement(b.B,{skipHover:!0,size:"md",radius:"xl",className:"tag-item",variant:"tertiary"},l.createElement(x.T,{size:"p4",as:"span",color:"inherit"},t.name))),l.createElement("div",{className:"topic-review",style:{display:"none"}},e.map(e=>l.createElement(b.B,{skipHover:!0,size:"sm",radius:"xl",className:"tag-item",key:e.id,variant:"tertiary"},l.createElement(x.T,{size:"p4",as:"span",color:"inherit"},e.name))))),CreatePostCommunity$1=({communitiesList:e,currentCommunity:t,selectedTopics:o,forceTopics:i,communityValue:r,isFullscreen:a,isInEditMode:n,setSelectedTopics:s,setCommunityValue:c,removeKeyError:p})=>{let{t:u}=(0,d.u)();return console.log({communitiesList:e,currentCommunity:t,selectedTopics:o,communityValue:r,isFullscreen:a,isInEditMode:n,forceTopics:i,setSelectedTopics:s,setCommunityValue:c,removeKeyError:p}),l.createElement("div",{className:"input-group"},l.createElement(ee,null,l.createElement("img",{alt:"anonymous-icon",src:"data:image/svg+xml,%3csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.86019 13.3957C4.98735 13.5229 5.14492 13.5865 5.33291 13.5865H13.3233L15.9771 16.2403V5.91343C15.9771 5.72546 15.9135 5.56789 15.7864 5.44072C15.6592 5.31356 15.5016 5.24998 15.3136 5.24998H14.1887V12.036L13.9507 11.798H4.66944V12.923C4.66944 13.111 4.73302 13.2686 4.86019 13.3957ZM2.01562 3.28847V12.9519L4.66944 10.298H12.0252C12.2132 10.298 12.3708 10.2345 12.4979 10.1073C12.6251 9.98014 12.6887 9.82257 12.6887 9.63459V3.28847C12.6887 3.10048 12.6251 2.94291 12.4979 2.81574C12.3708 2.68858 12.2132 2.625 12.0252 2.625H2.67909C2.49111 2.625 2.33353 2.68858 2.20637 2.81574C2.07921 2.94291 2.01562 3.10048 2.01562 3.28847Z' fill='%232D87F3'/%3e%3c/svg%3e",style:{width:"18px",height:"18px",objectFit:"contain",marginLeft:"auto"}}),l.createElement("div",{className:"session-title"},u("createPost.communityAndTopic"))),l.createElement(PostCommunityReview,{selectedTopics:o,currentCommunity:t}))},CreatePostDescription$1=({className:e,style:t,bannedWords:o=[],value:i,onChange:r,onPreviewUrlChange:a,onInvalidUrlsChange:n,isReplying:s,footerEditor:c})=>{let{t:p}=(0,d.u)(),[m,g]=(0,l.useState)(null),v=(0,l.useRef)(null);return(0,l.useEffect)(()=>{a&&((null==m?void 0:m.url)?a({title:m.title||"",url:m.url||"",image:m.image||"",description:m.description||""}):a(null))},[m]),l.createElement(N.S,{className:e,style:t},l.createElement(x.T,{size:"p4",className:"description-label"},p("createPost.popup.description")),l.createElement("div",{className:"textarea-control"},l.createElement("div",{className:"textarea-wrapper"},l.createElement(N.R,{html:i||"",onChange:r,bannedWords:o,onImagePickerClick:()=>{var e;return null===(e=v.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:g,onInvalidUrlsChange:n,isReplying:s}))),c,l.createElement(x.T,{size:"p4",className:"count-string"},p("character"),": ",u()(i||"").length))};var er="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3e%3cpath d='M5.3077 20.5C4.80257 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.3077C3.5 4.80257 3.675 4.375 4.025 4.025C4.375 3.675 4.80257 3.5 5.3077 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80257 20.5 5.3077V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.3077ZM7.65388 16.75H16.423C16.6038 16.75 16.7377 16.6679 16.8249 16.5038C16.9121 16.3397 16.8987 16.1807 16.7845 16.0269L14.4 12.8327C14.3064 12.7122 14.1859 12.6519 14.0384 12.6519C13.891 12.6519 13.7705 12.7122 13.6769 12.8327L11.2308 16.0192L9.5923 13.9192C9.49872 13.8051 9.37981 13.7481 9.23558 13.7481C9.09134 13.7481 8.97243 13.8083 8.87885 13.9289L7.30195 16.0269C7.18143 16.1807 7.16477 16.3397 7.25195 16.5038C7.33913 16.6679 7.47311 16.75 7.65388 16.75Z' fill='%232D87F3'/%3e%3c/svg%3e";let CreatePostPhotos$1=({imageFiles:e,setImageFiles:t})=>{let o=(0,l.useRef)(null),{t:i}=(0,d.u)(),{onSelectImages:r}=(0,C.u)(e,t);return l.createElement("div",{className:"input-group"},l.createElement(ee,{onClick:()=>{var e;null===(e=null==o?void 0:o.current)||void 0===e||e.click()}},l.createElement("img",{alt:"anonymous-icon",src:er,style:{width:"18px",height:"18px",objectFit:"contain",marginLeft:"auto"}}),l.createElement("div",{className:"session-title"},i("createPost.photos"))),l.createElement("input",{ref:o,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:e=>r(e)}))},ea=E.Z.div` input:focus, textarea:focus, [contenteditable='true'] { outline: none; } .title-input { overflow: hidden; width: 100%; padding: 12px 16px; border: solid 1px #d9d9d9; border-radius: ${m.r.borderRadius}; font-size: 16px; line-height: 1.2; white-space: nowrap; :focus { border-color: ${e=>e.color}; box-shadow: 0px 0px 2px 2px ${e=>e.colorShadow}; } br { display: none; } * { display: inline; white-space: nowrap; } mocka { padding: 2px 6px; border-radius: 1rem; &[data-error='true'] { background-color: #ffeeee; color: red; text-decoration: underline; font-style: bold; } } ol, ul { padding-left: 1rem; } } label { display: block; margin-bottom: 5px; color: ${m.r.colors.gray600}; font-size: 13px; font-weight: bold; } .count-string { margin-top: 5px; color: ${m.r.colors.gray500}; font-size: 11px; text-align: right; } `,inputModify$3=(e,t)=>{if(!t)return e;let{limit:o,bannedWords:i=[]}=t,r="number"==typeof o&&o>=0?e.substring(0,o):e,a=(0,S.h)(r,i);return a},CreatePostTitle$1=({className:e,style:t,bannedWords:o=[],value:i,onChange:r})=>{var a;let n=(0,v.rZ)(),{t:s}=(0,d.u)(),[c,p]=(0,l.useState)(""),u=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(u.current){let pasteHandler=e=>{var t;e.preventDefault();let o=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,o)},e=u.current;return e.addEventListener("paste",pasteHandler,{passive:!0}),()=>e.removeEventListener("paste",pasteHandler)}},[u]);let m=(null==o?void 0:o.join(","))||"";(0,l.useEffect)(()=>{var e;if(m){let t=null===(e=u.current)||void 0===e?void 0:e.innerText;if(t){let e=(0,S.h)(t,o);e!==t&&(r&&r(e),p(e))}}},[m]);let g=(0,l.useCallback)(z()(()=>{if(u.current){let e=inputModify$3(u.current.innerText,{limit:120,bannedWords:o});r&&r(e),p(e)}},300),[]);return(0,l.useEffect)(()=>{setTimeout(()=>{var e;null===(e=u.current)||void 0===e||e.focus()},500)},[]),l.createElement(ea,{className:e,style:t,color:n.colors[n.primaryColor][0],colorShadow:n.colors[n.primaryColor][2]},l.createElement(T.I,{name:"title",value:i||c,size:"md",label:s("createPost.title"),CustomInput:l.createElement(D(),{innerRef:u,html:i||c,onChange:()=>{if(u.current&&u.current.innerText!==(i||c)){let e=inputModify$3(u.current.innerText,{bannedWords:o});r&&r(e),p(e),g()}},className:"title-input"})}),l.createElement(x.T,{size:"p4",className:"count-string"},s("createPost.popup.wordCount",{count:(null===(a=u.current)||void 0===a?void 0:a.innerText.length)||0,max:120})))},el=(0,E.Z)(C.a)` & > div[data-open]:first-child { z-index: 1000; height: auto; max-width: 448px; } .custom-media-dialog { padding: 1rem; .image-gallery { display: none; .image-item { &.no-image { cursor: pointer; } .camera-btn { position: absolute; top: calc(100% - 32px); right: 8px; left: unset; width: 24px; height: 24px; } } } .custom-media-add-btn { margin-left: auto; display: block; } } `,en=(0,E.Z)(g.I)` margin-bottom: 10px; `,es=E.Z.div` display: flex; gap: 4px; align-items: flex-start; margin-bottom: 14px; img { margin-top: 2px; max-width: 16px; } `,SocialLinkPopup=({isOpen:e,onClose:t,onSocialLinkChanged:o,socialLinkData:i})=>{let{t:r}=(0,d.u)(),a=(0,l.useRef)(null),[n,s]=(0,l.useState)(""),{onSelectImages:c,onRemoveImage:p,imageSrcs:u,imageFiles:m}=(0,C.u)();(0,l.useEffect)(()=>{e&&s((null==i?void 0:i.url)||"")},[e]);let g=n.includes("youtu.be")||n.includes("youtube.com")||n.includes("facebook.com")||n.includes("fb.watch")||n.includes("tiktok.com"),v=!!n&&g;return l.createElement(l.Fragment,null,l.createElement("input",{ref:a,type:"file",accept:"image/png, image/gif, image/jpeg",style:{display:"none"},onChange:c}),l.createElement(el,{isOpen:e,onClose:t,heading:"Insert",style:{zIndex:3}},l.createElement("div",{className:"custom-media-dialog",onClick:e=>e.stopPropagation()},l.createElement(en,{size:"md",name:"custom-media-url",placeholder:"URL",value:n,onChange:e=>s(e),label:""}),l.createElement(es,null,l.createElement("img",{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='M8.0026 1.33334C4.3206 1.33334 1.33594 4.31801 1.33594 8.00001C1.33594 11.682 4.3206 14.6667 8.0026 14.6667C11.6846 14.6667 14.6693 11.682 14.6693 8.00001C14.6693 4.31801 11.6846 1.33334 8.0026 1.33334ZM8.0026 11.3333C7.6346 11.3333 7.33594 11.0347 7.33594 10.6667V8.00001C7.33594 7.63201 7.6346 7.33334 8.0026 7.33334C8.3706 7.33334 8.66927 7.63201 8.66927 8.00001V10.6667C8.66927 11.0347 8.3706 11.3333 8.0026 11.3333ZM8.33594 6.00001H7.66927C7.48527 6.00001 7.33594 5.85068 7.33594 5.66668V5.00001C7.33594 4.81601 7.48527 4.66668 7.66927 4.66668H8.33594C8.51994 4.66668 8.66927 4.81601 8.66927 5.00001V5.66668C8.66927 5.85068 8.51994 6.00001 8.33594 6.00001Z' fill='%232D87F3'/%3e%3c/svg%3e",alt:""}),l.createElement(x.T,{size:"c2",color:"#737373"},r("editor.addSocialLink.warningDomain"))),u[0]?l.createElement("div",{className:"image-gallery"},l.createElement("div",{className:"image-item"},l.createElement("img",{src:u[0],alt:""}),l.createElement("img",{className:"close-btn",alt:"",onClick:()=>p(0)}))):l.createElement("div",{className:"image-gallery"},l.createElement("div",{className:"image-item no-image",onClick:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.click()}})),l.createElement(b.B,{color:"primary",size:"md",variant:"primary",type:"button",className:"custom-media-add-btn",onClick:e=>{null==e||e.preventDefault(),null==e||e.stopPropagation(),v&&(null==o||o({url:n.includes("http")?n:"https://"+n,banner:m[0]}),null==t||t())},disabled:!v},r("editor.addSocialLink.addLink")))))},CreatePostVideo=({socialLinkData:e,setSocialLinkData:t})=>{let{t:o}=(0,d.u)(),[i,r]=(0,l.useState)(!1);return l.createElement("div",{className:"input-group"},l.createElement(ee,{onClick:()=>{r(!0)}},l.createElement("img",{alt:"anonymous-icon",src:"data:image/svg+xml,%3csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M3.23078 14.625C2.85193 14.625 2.53125 14.4937 2.26875 14.2312C2.00625 13.9687 1.875 13.648 1.875 13.2692V4.73078C1.875 4.35193 2.00625 4.03125 2.26875 3.76875C2.53125 3.50625 2.85193 3.375 3.23078 3.375H14.7692C15.148 3.375 15.4687 3.50625 15.7312 3.76875C15.9937 4.03125 16.125 4.35193 16.125 4.73078V10.315C15.8029 10.1922 15.4534 10.125 15.0882 10.125H11.9117C10.3036 10.125 8.99998 11.4286 8.99998 13.0368C8.99998 13.6227 9.17304 14.1682 9.47085 14.625H3.23078ZM7.83606 11.6899L11.5846 9.28988C11.6875 9.21969 11.7389 9.12306 11.7389 8.99998C11.7389 8.87691 11.6875 8.78028 11.5846 8.71009L7.83606 6.31011C7.72067 6.23222 7.60456 6.22597 7.48774 6.29136C7.37091 6.35673 7.3125 6.45721 7.3125 6.59278V11.4072C7.3125 11.5428 7.37091 11.6432 7.48774 11.7086C7.60456 11.774 7.72067 11.7677 7.83606 11.6899ZM10.7181 14.6953C11.1136 15.0907 11.5889 15.2884 12.1442 15.2884H12.8099C12.9325 15.2884 13.0352 15.247 13.1182 15.1642C13.2011 15.0813 13.2426 14.9786 13.2426 14.856C13.2426 14.7333 13.2011 14.6305 13.1182 14.5475C13.0352 14.4646 12.9325 14.4231 12.8099 14.4231H12.1442C11.8269 14.4231 11.5553 14.3101 11.3293 14.0841C11.1033 13.8582 10.9903 13.5865 10.9903 13.2692C10.9903 12.9519 11.1033 12.6803 11.3293 12.4543C11.5553 12.2284 11.8269 12.1154 12.1442 12.1154H12.8099C12.9325 12.1154 13.0352 12.074 13.1182 11.9911C13.2011 11.9083 13.2426 11.8055 13.2426 11.6829C13.2426 11.5602 13.2011 11.4574 13.1182 11.3745C13.0352 11.2915 12.9325 11.25 12.8099 11.25H12.1442C11.5889 11.25 11.1136 11.4477 10.7181 11.8432C10.3227 12.2386 10.125 12.7139 10.125 13.2692C10.125 13.8245 10.3227 14.2999 10.7181 14.6953ZM12.2686 13.5775C12.3515 13.6604 12.4543 13.7019 12.5769 13.7019H15.1731C15.2957 13.7019 15.3984 13.6605 15.4814 13.5776C15.5643 13.4948 15.6058 13.3921 15.6058 13.2694C15.6058 13.1468 15.5643 13.044 15.4814 12.961C15.3984 12.878 15.2957 12.8365 15.1731 12.8365H12.5769C12.4543 12.8365 12.3515 12.878 12.2686 12.9608C12.1857 13.0436 12.1442 13.1464 12.1442 13.269C12.1442 13.3917 12.1857 13.4945 12.2686 13.5775ZM14.9401 15.2884H15.6058C16.161 15.2884 16.6364 15.0911 17.0318 14.6966C17.4273 14.3019 17.625 13.8268 17.625 13.271C17.625 12.7068 17.4273 12.2289 17.0318 11.8374C16.6364 11.4458 16.161 11.25 15.6058 11.25H14.9401C14.8175 11.25 14.7147 11.2914 14.6318 11.3743C14.5488 11.4571 14.5074 11.5598 14.5074 11.6825C14.5074 11.8051 14.5488 11.908 14.6318 11.9909C14.7147 12.0739 14.8175 12.1154 14.9401 12.1154H15.6058C15.9231 12.1154 16.1947 12.2284 16.4207 12.4543C16.6466 12.6803 16.7596 12.9519 16.7596 13.2692C16.7596 13.5865 16.6466 13.8582 16.4207 14.0841C16.1947 14.3101 15.9231 14.4231 15.6058 14.4231H14.9401C14.8175 14.4231 14.7147 14.4645 14.6318 14.5473C14.5488 14.6302 14.5074 14.7329 14.5074 14.8556C14.5074 14.9782 14.5488 15.081 14.6318 15.164C14.7147 15.247 14.8175 15.2884 14.9401 15.2884Z' fill='%23F44D2C'/%3e%3c/svg%3e",style:{width:"18px",height:"18px",objectFit:"contain",marginLeft:"auto"}}),l.createElement("div",{className:"session-title"},o("createPost.videoOrLink"))),l.createElement(SocialLinkPopup,{isOpen:i,onClose:()=>r(!1),onSocialLinkChanged:t,socialLinkData:e}))},ec=E.Z.div` .mantine-Text-root { margin-bottom: 4px; } .preview-images-container { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; .image-src-wrapper { flex: 0 0 140px; width: 140px; height: 96px; border-radius: 4px; position: relative; img { border-radius: 4px; } .icon-close { position: absolute; top: 6px; right: 6px; cursor: pointer; z-index: 10; max-height: 24px; max-width: 24px; } } } `,PostPhotosReview$1=({error:e,imageFiles:t,setImageFiles:o,removeKeyError:i})=>{let{t:r}=(0,d.u)(),{imageSrcs:a,onRemoveImage:n}=(0,C.u)(t,o);return l.createElement(ec,{className:"input-group"},l.createElement(x.T,{size:"p5",weight:"semiBold"},r("createPost.photos")),l.createElement("div",{className:"preview-images-container"},null==a?void 0:a.map((e,t)=>l.createElement("div",{className:"image-src-wrapper",key:t},l.createElement("img",{src:e,className:"preview-image",alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}),l.createElement("img",{alt:"",className:"icon-close",src:C.c,onClick:()=>{i&&i("photos"),n(t)}})))),e&&(null==e?void 0:e.photos)&&l.createElement(J,null,l.createElement(x.T,{size:"p5",color:m.r.colors.red600},e.photos)))},inputModify$2=(e,t)=>{var o;let{formatUrl:i,bannedWords:r=[]}=t||{},a=(0,S.f)((0,S.r)(e));if(!i)return{value:(0,S.h)(a,r)};let l=(0,S.a)((0,S.w)(a)),n=(0,S.g)(a);if(n){let e=[];return n.forEach(t=>{if(t)try{let o=new URL(t);if(!S.A.some(e=>o.origin.endsWith(e))){e.push("notification.limitUrlDomain");return}if(t.endsWith("&")){e.push("notification.urlWrongFormat");return}}catch(o){e.push(t)}}),e.length>0&&(l=l.replace(RegExp(`data-url="true">(${e.map(S.e).join("|")})<`,"gi"),'data-error="true" data-url="true">$1<').replace(RegExp(`data-href="/(${e.map(S.e).join("|")})" data-url="true">`,"gi"),'data-href="/$1" data-error="true" data-url="true">')),{invalidUrls:e,previewUrl:null===(o=n.filter(t=>-1===e.indexOf(t)))||void 0===o?void 0:o[0],value:(0,S.h)(l,r)}}return{value:(0,S.h)(l,r)}},usePreviewUrl=(e,t)=>{let{data:{locale:o}}=(0,l.useContext)(w.T),[i,r]=(0,l.useState)(null),a=(0,l.useRef)([]);a.current=e;let fetchPreviewData=e=>{i&&i.url===e||(null==r||r({url:e,isFetching:!0}),(0,w.c)((0,w.e)(M.yy.FETCH_PREVIEW,{_locale:o}),"POST",{data:{link:e},headers:{"Content-Type":"application/json"}}).then(t=>{var o,i,a,l;null==r||r({title:null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.title,description:null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.description,image:(null===(a=null==t?void 0:t.data)||void 0===a?void 0:a.image)||(null===(l=null==t?void 0:t.data)||void 0===l?void 0:l.logo),url:e})}).catch(()=>{null==r||r(null)}))},n=(0,l.useRef)(fetchPreviewData);n.current=fetchPreviewData;let[s,c]=(0,l.useState)([]),d=(0,l.useCallback)(z()(e=>{if(e){let o=inputModify$2(e,{bannedWords:a.current,formatUrl:!0}),{invalidUrls:i,previewUrl:l,value:s}=o;i&&(null==i?void 0:i.length)?(c(i),null==r||r(null)):(c([]),l?n.current(l):null==r||r(null),s!==e&&(null==t||t(s)))}},500),[]);return{previewUrl:i,setPreviewUrl:r,invalidUrls:s,debounceInputModify:d,fetchPreviewData}},ed=E.Z.div` .link-preview-wrapper { position: relative; .icon-close { position: absolute; top: 6px; right: 6px; cursor: pointer; z-index: 10; max-width: 24px; max-height: 24px; } } .mantine-Text-root { margin-bottom: 4px; } `,PostVideoReview=({socialLinkData:e,bannedWords:t,onChange:o,onInvalidUrlsChange:i,onSocialLinkChanged:r})=>{let{t:a}=(0,d.u)(),{invalidUrls:n,previewUrl:s,fetchPreviewData:c,setPreviewUrl:p}=usePreviewUrl(t||[],o);return(0,l.useEffect)(()=>{e&&e.url&&c(e.url)},[e,c]),(0,l.useEffect)(()=>{n&&(null==i||i(n))},[n]),l.createElement(ed,{className:"input-group"},l.createElement(x.T,{size:"p5",weight:"semiBold"},a("createPost.video")),l.createElement("div",{className:"link-preview-wrapper"},(null==e?void 0:e.url)&&s&&l.createElement("div",{className:"link-preview-wrapper"},s.isFetching?l.createElement(A.L,null):l.createElement(l.Fragment,null,l.createElement(Z.C,{title:s.title,url:s.url||"#",image:s.image,noRefetch:!0}),l.createElement("img",{alt:"",src:C.c,className:"icon-close",onClick:()=>{p(null),r&&r(null)}})))))},ep=[R.L.PhilippinesEnglish,R.L.PhilippinesTagalog,R.L.Indonesia,R.L.Malaysia,R.L.Vietnam],CreateNewPostContent=({className:e,style:t,onPostCreatedEdited:o,onClose:i,communities:r=[],forceSelectCommunity:p,forceSelectTopics:g,articleId:v,optionalTopic:h,editPostData:f,defaultCommunity:y,defaultTopics:E,selectAskDoctor:N,showAskDoctorOptions:T,userInfo:L,isMarryBaby:z=!1})=>{let I=!!(null==f?void 0:f.id),{data:{locale:D,router:M,env:{togetherBasePath:A}},action:{pushNotifications:Z,sanitizeFunction:R}}=(0,l.useContext)(w.T),{asPath:_}=M||{},{t:F}=(0,d.u)(),[H,U]=(0,l.useState)(N),[j,O]=(0,l.useState)(!1),[V,q]=(0,l.useState)(!1),[W,G]=(0,l.useState)(""),[ee,ei]=(0,l.useState)(""),[er,ea]=(0,l.useState)(p?{label:p.name,value:`${p.id||""}-${p.mappedCategoryId||""}`}:{label:F("community.choose"),value:""}),[el,en]=(0,l.useState)([...g]),[es,ec]=(0,l.useState)(),[ed,eu]=(0,l.useState)({}),[em,eg]=(0,l.useState)([]),[ev,eh]=(0,l.useState)([]),[ef,ex]=(0,l.useState)({label:F("cardPost.public"),value:"public"}),{imageSrcs:eb=[]}=(0,C.u)(em),ey=p||r.find(e=>`${e.id||""}-${e.mappedCategoryId||""}`===er.value),eC=p?[p]:r.filter(e=>e.isActive).sort((e,t)=>e.name>t.name?1:e.name0)&&ey&&(!em||em.length<=$.M)&&!(null==ek?void 0:ek.length)&&!V,eP=[{label:F("cardPost.public"),value:"public",icon:l.createElement("img",{alt:"anonymous-icon",src:eo,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}})},{label:F("cardPost.anonymous"),value:"anonymous",icon:l.createElement("img",{alt:"anonymous-icon",src:et,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}})}];(0,l.useEffect)(()=>{f?(G(f.title||""),ei((0,S.d)((0,S.b)(f.description||"","edit"),f.mentions)),ea({label:f.community.name,value:`${f.community.id||""}-${f.community.mappedCategoryId||""}`}),en(f.topics||[]),eg(f.photos||[]),U(!!f.isAskDoctor)):(y&&ea({label:y.name,value:`${y.id||""}-${y.mappedCategoryId||""}`}),E&&en(E))},[]),(0,l.useEffect)(()=>{O(ep.includes(D)&&""!==W&&!/[a-zA-Z]/.test(W)),eu({})},[W]);let onCreateEditSuccess=e=>{o&&o((0,k.a)(e),I),i&&i()},validationUploadPhoto=e=>{let t=Object.assign({},ed);if(e&&e.length>10&&(t.photos=F("createPost.message.photoMaxium")),e&&e.length){let o=e.some(e=>(null==e?void 0:e.size)>10485760);o&&(t.photos=F("createPost.message.photoSize"))}eu(t)},validationPost=()=>{let e=!1,t={},o=u()(ee);if(o||(t.description=F("createPost.message.requiredDescription"),e=!0),I&&!W&&(t.title=F("createPost.message.requiredTitle"),e=!0),o&&o.split(" ").length<10&&(t.description=F("createPost.message.lengthDescription"),e=!0),!T||(null==t?void 0:t.description)||void 0!==H||(t.askDoctor=F("createPost.message.askDoctorRequireMess"),e=!0),em&&em.length>10&&(t.photos=F("createPost.message.photoMaxium"),e=!0),em&&em.length){let o=em.some(e=>(null==e?void 0:e.size)>10485760);o&&(t.photos=F("createPost.message.photoSize"),e=!0)}return ek&&ek.length&&(t.video="Invalid video url",e=!0),eu(t),e},removeKeyError=e=>{if(ed[e]){let t=Object.assign({},ed),o=`${e}`,i=t[o],r=(0,a._)(t,["symbol"==typeof o?o:o+""]);eu(r),console.log(i)}},submitPost=()=>(0,a.a)(void 0,void 0,void 0,function*(){var e,t,o,r,a,l,n,s,c;let d;let p=validationPost();if(p)return;let u=yield(0,C.d)({title:W,description:ee,communityId:String((null==ey?void 0:ey.id)||""),imageFiles:em,previewUrl:ew,topicIds:null==el?void 0:el.map(e=>String(e.id||"")).filter(Boolean),locale:D,sanitizeFunction:R,categoryCommunityId:String((null==ey?void 0:ey.mappedCategoryId)||""),categoryTopicIds:null==el?void 0:el.map(e=>String((null==e?void 0:e.mappedCategoryId)||"")).filter(Boolean),isAnonymous:(null==ef?void 0:ef.value)==="anonymous"?1:0,isAskDoctor:H?1:0,introUrl:(null==es?void 0:es.url)||""});v&&u.append("article_id",v),I?(null==f?void 0:f.id)&&(d=yield(0,C.e)({id:f.id,formData:u,locale:D})):d=yield(0,C.f)({formData:u,locale:D,isArticleComment:!(null==ey?void 0:ey.id)&&!!(null==ey?void 0:ey.mappedCategoryId)});let m=null==d?void 0:d.data;(null==m?void 0:m.id)&&!(null===(t=null===(e=null==d?void 0:d.messages)||void 0===e?void 0:e.moderation)||void 0===t?void 0:t.type)?(Z({message:F("createPost.popup.success"),type:"success"}),onCreateEditSuccess(m)):(null===(r=null===(o=null==d?void 0:d.messages)||void 0===o?void 0:o.moderation)||void 0===r?void 0:r.type)==="banned"?(Z({title:F("notification.post.blocked.title"),message:F("notification.post.blocked.message"),type:"danger"}),d.messages.moderation.words&&eh(d.messages.moderation.words)):(null===(l=null===(a=null==d?void 0:d.messages)||void 0===a?void 0:a.moderation)||void 0===l?void 0:l.type)==="suspect"?(Z({title:F("notification.post.suspect.title"),message:F("notification.post.suspect.message"),type:"warning"}),i&&i()):(null===(s=null===(n=null==d?void 0:d.messages)||void 0===n?void 0:n.find)||void 0===s?void 0:s.call(n,e=>{var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))}))?(Z({message:F("notification.suspend.message"),type:"danger"}),i&&i()):Z({message:(null===(c=null==d?void 0:d.messages)||void 0===c?void 0:c[0])||F("notification.failure"),type:"danger"})});return l.createElement(K,{className:`${e} create-post-popup-frame`,style:t},l.createElement("div",{className:"input-group-container"},l.createElement(Y,null,l.createElement("div",{className:"input-group"},l.createElement(X,null,l.createElement("div",{className:"avatar"},(null==L?void 0:L.avatar)?l.createElement("img",{alt:"avatar-icon",src:null==L?void 0:L.avatar,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}}):l.createElement(P.C,{showDetailPopup:!1,avatar:"",avatarProps:{size:40},name:null==L?void 0:L.name,userId:null==L?void 0:L.userId,className:"author-avatar"})),l.createElement("div",{className:"post-action-form"},l.createElement("div",{className:"post-action-by"},(null==L?void 0:L.name)||""),l.createElement(c.D,{disabled:I,options:eP,id:"post-action-type",size:"sm",className:"dropdown-post-action",placeholder:F("community.choose"),value:ef,onChange:e=>{ex({label:e.label,value:String(e.value)})},placeholderIcon:l.createElement("div",{className:"post-action-result"},"public"===ef.value?l.createElement("img",{alt:"public-icon",src:eo,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}}):l.createElement("img",{alt:"anonymous-icon",src:et,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}})),style:{zIndex:10,width:"calc(100% + 20px)"}})))),l.createElement(CreatePostTitle$1,{className:"input-group",bannedWords:ev,value:W,onChange:G}),j&&l.createElement(J,null,l.createElement(n.Z,{isSolid:!0,color:m.r.colors.red700,size:14}),l.createElement(x.T,{size:"p3",as:"span",color:m.r.colors.red700},F("createPost.popup.specialCharErr"))),l.createElement("div",{className:"input-group"},l.createElement(CreatePostDescription$1,{bannedWords:ev,value:ee,onChange:e=>{ei(e),removeKeyError("description")},onPreviewUrlChange:eE,onInvalidUrlsChange:e$,onImageFilesChange:eg,imageFiles:em,className:`${ed&&(null==ed?void 0:ed.description)?"error-description":""} ${T?"has-ask-doctor-option":""}`,footerEditor:l.createElement(l.Fragment,null,T&&l.createElement(Q,{color:"",className:`${ed&&(null==ed?void 0:ed.askDoctor)?"has-error":""} ${ed&&(null==ed?void 0:ed.description)?"error-description":""}`},l.createElement("div",{className:"switch-label"},l.createElement(s.Z,{size:z?32:24,isMarryBaby:z}),l.createElement("div",{className:"wrapper-text"},l.createElement("div",{className:"label-txt"},F("createPost.askDoctor")),l.createElement("div",{className:"description-txt"},F("createPost.askDoctor.description")))),l.createElement(B.B,{value:H,choices:[{label:F("createPost.askDoctorChoice.yes"),value:!0,dataEventCategory:"Together",dataEventAction:"Write Post Click - Ask Doctor",dataEventLabel:(0,w.p)(D,A,_)},{label:F("createPost.askDoctorChoice.no"),value:!1}],onChange:e=>{"boolean"==typeof e&&(U(e),removeKeyError("askDoctor"))}})),ed&&(null==ed?void 0:ed.askDoctor)&&l.createElement(J,{style:{margin:"4px 0 0"}},l.createElement(x.T,{size:"p5",as:"span",color:m.r.colors.red600},ed.askDoctor)),ed&&(null==ed?void 0:ed.description)&&l.createElement(J,{style:{margin:"4px 0 0"}},l.createElement(x.T,{size:"p5",as:"span",color:m.r.colors.red600},ed.description)))})),eb.length>0&&l.createElement(PostPhotosReview$1,{imageFiles:em,error:ed,setImageFiles:eg,removeKeyError:removeKeyError}),es&&l.createElement(PostVideoReview,{bannedWords:ev,socialLinkData:es,onSocialLinkChanged:ec,onInvalidUrlsChange:e$,onChange:e=>{ei(e)}}),l.createElement(CreatePostCommunity$1,{communitiesList:eC,currentCommunity:ey,selectedTopics:el,forceTopics:g,communityValue:er,error:ed,isFullscreen:!1,isInEditMode:I,setSelectedTopics:en,setCommunityValue:ea}),l.createElement(CreatePostPhotos$1,{imageFiles:em,setImageFiles:e=>{eg(e),validationUploadPhoto(e)}}),l.createElement(CreatePostVideo,{socialLinkData:es,setSocialLinkData:ec}))),l.createElement("div",{className:"form-action"},l.createElement("div",{className:"input-group"},l.createElement(b.B,{className:"submit-btn pointer-event-child-none",size:"lg","data-event-category":"Ask Doctor","data-event-action":"Submit Question","data-event-label":window.location.href,onClick:()=>(0,a.a)(void 0,void 0,void 0,function*(){if(eS&&!V){q(!0);try{yield submitPost()}catch(e){console.error(e),Z((0,C.g)(F))}q(!1)}}),disabled:!eS,loading:V},F("createPost.popup.submit")))))};function toBoolean(e){let t=e.toLowerCase();return"true"===t||"1"===t||"yes"===t}let eu=E.Z.div``,em=E.Z.div` display: flex; flex-direction: column; gap: 16px; .mantine-TopicSelectList-root { padding: 0; } .mantine-TopicSelectList-list { gap: 12px; } .tag-list { margin: 0; } `,eg=E.Z.div` display: flex; flex-direction: column; gap: 8px; .other-btn-community { color: ${m.r.colors.gray400}; font-size: 16px; font-weight: 600; line-height: 24px; cursor: pointer; } `,ev=E.Z.div` display: flex; width: 100%; flex-wrap: wrap; margin-top: 1rem; gap: 12px; .tag-item { min-height: 32px; padding: 5px 12px; border: 1px solid ${m.r.colors.neutral100}; border-radius: 1rem; color: ${m.r.colors.gray800}; cursor: pointer; font-size: 13px; line-height: 22px; transition: all 0.2s; &.--active { border-color: ${m.r.colors.primary50}; background: ${m.r.colors.primary50}; color: ${m.r.colors.primaryBase}; } &[data-disabled='true'] { background: ${m.r.colors.gray100}; color: ${m.r.colors.gray800}; } } .topic-spinner { margin-right: auto; margin-left: auto; & > button { width: 24px; height: 24px; } } &[data-is-marrybaby='true'] { .tag-item { border-color: transparent; background: #f3f3f3; color: #3e3f58; &.--active { border-color: #b6cdff; background: #e0e9fb; color: #3e3f58; } } } `,TopicSelectList$1=({className:e,style:t,topics:o,communityId:i,onChange:r,isLoading:n,disabled:s,selectedTopics:c,noFetch:d,dataEventCategory:p,dataEventAction:u,dataEventLabel:m})=>{let{data:{locale:g,env:{isMarryBaby:v}}}=(0,l.useContext)(w.T),[h,f]=(0,l.useState)([]),[x,b]=(0,l.useState)([]),[y,C]=(0,l.useState)(!1),E=(0,l.useRef)(o);return E.current=o,(0,l.useEffect)(()=>{var e;!i||d||(null===(e=E.current)||void 0===e?void 0:e.length)||(f([]),C(!0),(0,a.a)(void 0,void 0,void 0,function*(){var e;try{let t=yield(0,w.c)((0,w.e)(M.yy.TOPIC.LIST,{communityId:i,_locale:g}),"GET"),o=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.topics;if(Array.isArray(o)){let e=[];null==o||o.forEach(t=>{e=e.concat(t.discover_category)}),f(e)}}catch(e){console.log(e),C(!1)}C(!1)}))},[i,d]),l.createElement(ev,{"data-is-marrybaby":v,className:e,style:t},h.map(e=>l.createElement(TopicItem$1,{key:`${e.id}-${e.category_id}`,topic:e,disabled:s,selected:(c||x).some(t=>t.id&&t.id===e.id||(null==t?void 0:t.category_id)&&(null==t?void 0:t.category_id)===e.category_id),onClick:()=>{let t=c||x,o=t.findIndex(t=>t.id&&t.id===e.id||(null==t?void 0:t.category_id)&&(null==t?void 0:t.category_id)===e.category_id);-1!==o?t.splice(o,1):t.push(e),r&&c?r(t.slice()):(r&&r(t.slice()),b(t.slice()))},dataEventAction:u,dataEventCategory:p,dataEventLabel:m})),(n||y)&&l.createElement(F.L,{className:"topic-spinner"}))},TopicItem$1=e=>{var{topic:t,disabled:o,selected:i,onClick:r}=e,n=(0,a._)(e,["topic","disabled","selected","onClick"]);return l.createElement("div",Object.assign({className:"tag-item"+(i?" --active":""),"data-disabled":o,onClick:o?void 0:r},n),t.name)},eh=E.Z.div` border-radius: 8px; border: 1px solid ${m.r.colors.neutral100}; background: ${m.r.colors.white}; border: 1px solid ${m.r.colors.neutral100}; .card-header { padding: 12px 16px; color: ${m.r.colors.gray800}; font-size: 14px; font-weight: 600; line-height: 22px; border-bottom: 1px solid ${m.r.colors.neutral100}; background: ${m.r.colors.neutral50}; border-radius: 8px 8px 0px 0px; } .card-body { padding: 16px; } `,CardPostCommunity=({title:e,children:t})=>l.createElement(eh,null,l.createElement("div",{className:"card-header"},e),l.createElement("div",{className:"card-body"},t)),CommonCommunity=({communitiesList:e,communityValue:t,selectedTopics:o,defaultCommunity:i,isInEditMode:r,setCommunityValue:a,setSelectedTopics:n,onSubmitPost:s})=>{let{t:p}=(0,d.u)();return(0,l.useEffect)(()=>{i&&!r&&a({label:i.name,value:i.id})},[i,r]),l.createElement(eu,null,l.createElement(em,null,l.createElement(CardPostCommunity,{title:p("admin.community")},l.createElement(c.D,{options:(null==e?void 0:e.map(e=>({label:e.name,value:e.id||""})))||[],id:"community-picker",disabled:r,value:t,placeholder:p("community.choose"),onChange:e=>{a({label:e.label,value:String(e.value)}),n([])},style:{zIndex:1}})),l.createElement(CardPostCommunity,{title:p("tab.topic")},t.value?l.createElement(TopicSelectList$1,{className:"tag-list",communityId:Number(t.value),onChange:e=>n(e),selectedTopics:o,forceTopics:[]}):l.createElement("div",{style:{height:"30px"}})),l.createElement(eg,null,l.createElement(b.B,{className:"submit-btn",size:"lg","data-event-category":"Ask Doctor","data-event-action":"Submit Question","data-event-label":window.location.href,"data-testid":"Button Post",disabled:!t.value,onClick:()=>s()},p("createPost.popup.submit")))))};E.Z.div` display: flex; flex-direction: column; gap: 8px; margin-top: 8px; .topic-review { display: flex; gap: 4px; flex-wrap: wrap; } .community-review { .tag-item { background-color: ${m.r.colors.neutral50}; img { border-radius: 50%; margin-right: 8px; } } } `;let ef=E.Z.div` background-color: white; z-index: 1000; top: 0; left: 0; height: 100%; position: absolute; width: 100%; .drawer-header { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid ${m.r.colors.gray200}; img { cursor: pointer; } p { flex: 1; } } .drawer-content { padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; height: calc(100% - 49px); ${y.M.mbDown} { padding: 16px; &.drawer-content-adjust { justify-content: center; } } .input-field-label { margin-bottom: 8px; } &.drawer-content-full-screen { max-width: 680px; margin: 0 auto; padding: 16px 24px; } } `,ex=E.Z.div` display: flex; flex-direction: column; gap: 32px; `,eb=E.Z.div` display: flex; flex-direction: column; justify-content: center; gap: 24px; align-items: center; max-width: 400px; margin: 0 auto; .search-description { text-align: center; font-size: 16px; font-weight: 600; line-height: 24px; background: linear-gradient(92deg, #45a4ff 16.17%, #00c076 98.95%); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .result-search-description { color: ${m.r.colors.gray800}; font-size: 16px; font-weight: 400; line-height: 24px; text-align: center; } `,ey=E.Z.div` display: flex; flex-direction: column; gap: 16px; .tag-item-review { display: flex; align-items: center; gap: 12px; .tag-item-label { flex: 1; color: ${m.r.colors.gray800}; font-size: 16px; font-weight: 400; line-height: 24px; } } .topic-item-review-wrapper { display: flex; gap: 12px; flex-wrap: wrap; } .topic-item-review { border-radius: 40px; background: ${m.r.colors.blue50}; padding: 6px 12px; } `,eC=E.Z.div` display: flex; flex-direction: column; gap: 8px; .other-btn-community { color: ${m.r.colors.gray400}; font-size: 16px; font-weight: 600; line-height: 24px; cursor: pointer; } `,SuggestedCommunity=({currentCommunity:e,selectedTopics:t,isLoading:o,clickOtherCommunity:i,onSubmitPost:r})=>{let{t:a}=(0,d.u)();return l.createElement(ex,null,o||!e?l.createElement(eb,null,l.createElement("img",{alt:"anonymous-icon",src:"data:image/svg+xml,%3csvg width='268' height='268' viewBox='0 0 268 268' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg filter='url(%23filter0_f_270_203608)'%3e%3ccircle cx='134.175' cy='134.174' r='99.1225' fill='url(%23paint0_linear_270_203608)'/%3e%3c/g%3e%3cpath d='M143.63 122.941C143.884 121.934 145.315 121.934 145.569 122.941L146.243 125.609C147.585 130.925 151.907 134.969 157.301 135.954L158.295 136.136C159.389 136.336 159.389 137.903 158.295 138.103L157.301 138.285C151.907 139.271 147.585 143.314 146.243 148.631L145.569 151.299C145.315 152.306 143.884 152.306 143.63 151.299L142.956 148.631C141.614 143.314 137.292 139.271 131.899 138.285L130.904 138.103C129.81 137.904 129.81 136.336 130.904 136.136L131.899 135.954C137.292 134.969 141.614 130.925 142.956 125.609L143.63 122.941Z' fill='url(%23paint1_linear_270_203608)'/%3e%3cpath d='M134.365 89.0399C134.461 88.2144 135.659 88.2144 135.755 89.04L135.958 90.7817C136.317 93.8718 138.673 96.3541 141.74 96.8746L143.713 97.2094C144.49 97.3413 144.49 98.4578 143.713 98.5897L141.74 98.9246C138.673 99.4451 136.317 101.927 135.958 105.017L135.755 106.759C135.659 107.585 134.461 107.585 134.365 106.759L134.162 105.017C133.803 101.927 131.447 99.4451 128.38 98.9246L126.407 98.5897C125.629 98.4578 125.629 97.3413 126.407 97.2094L128.38 96.8746C131.447 96.3541 133.803 93.8718 134.162 90.7816L134.365 89.0399Z' fill='url(%23paint2_linear_270_203608)'/%3e%3cdefs%3e%3cfilter id='filter0_f_270_203608' x='0.782799' y='0.781822' width='266.784' height='266.785' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3e%3cfeFlood flood-opacity='0' result='BackgroundImageFix'/%3e%3cfeBlend mode='normal' in='SourceGraphic' in2='BackgroundImageFix' result='shape'/%3e%3cfeGaussianBlur stdDeviation='17.135' result='effect1_foregroundBlur_270_203608'/%3e%3c/filter%3e%3clinearGradient id='paint0_linear_270_203608' x1='55.5444' y1='48.7129' x2='193.903' y2='233.297' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='%23A7D2FF'/%3e%3cstop offset='1' stop-color='%2376EE9A' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear_270_203608' x1='144.6' y1='118.518' x2='144.6' y2='155.721' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0.26' stop-color='%2378B0F6'/%3e%3cstop offset='1' stop-color='%2376F197'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear_270_203608' x1='135.06' y1='82.5809' x2='135.06' y2='113.218' gradientUnits='userSpaceOnUse'%3e%3cstop offset='0.26' stop-color='%2378B0F6'/%3e%3cstop offset='1' stop-color='%2376F197'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",style:{width:"212px",height:"212px",objectFit:"contain"}}),o?l.createElement("div",{className:"search-description"},a("createPost.message.suggestLoading"),"..."):l.createElement("div",{className:"result-search-description"},a("createPost.message.suggestResult"))):l.createElement(ey,null,l.createElement(CardPostCommunity,{title:a("admin.community")},l.createElement(l.Fragment,null,e&&l.createElement("div",{className:"tag-item-review"},l.createElement("img",{alt:"community-thumbnail",src:e.thumbnail,style:{width:"40px",height:"40px",objectFit:"contain",marginLeft:"auto",flex:"0 0 40px"}}),l.createElement(x.T,{size:"p4",as:"span",color:"inherit",className:"tag-item-label"},e.name)))),t.length>0&&l.createElement(CardPostCommunity,{title:a("tab.topic")},l.createElement("div",{className:"topic-item-review-wrapper"},t.map((e,t)=>l.createElement("div",{className:"topic-item-review",key:t},l.createElement(x.T,{size:"p4",as:"span",color:"inherit",className:"tag-item-label"},e.name)))))),!o&&l.createElement(eC,null,l.createElement(b.B,{className:"submit-btn",size:"lg","data-testid":"Button Post","data-event-category":"Ask Doctor","data-event-action":"Submit Question","data-event-label":window.location.href,onClick:()=>r(!e)},a("createPost.now")),l.createElement(b.B,{variant:"ghost",className:"other-btn-community",type:"button",onClick:i},a(e?"choose.other.community":"choose.community"))))},CreatePostCommunity=({communitiesList:e,currentCommunity:t,selectedTopics:o,communityValue:i,isInEditMode:r,isLoadingSuggest:a,defaultCommunity:n,isMarryBaby:s=!1,setSelectedTopics:c,setCommunityValue:p,onSubmitPost:u,setStepPost:m})=>{let{t:g,locale:v}=(0,d.u)(),[h,f]=(0,l.useState)("chatbot");return _.createPortal(l.createElement(ef,null,l.createElement("div",{className:"drawer-header"},l.createElement("img",{alt:"public-icon",src:H.b,onClick:()=>{p({label:g("community.choose"),value:""}),c([]),null==m||m("step_info")},style:{width:"24px",height:"24px",objectFit:"contain",marginLeft:"auto"}}),l.createElement(x.T,{size:"p3",className:"input-group-label",weight:"semiBold"},g("createPost.communityAndTopic"))),l.createElement("div",{className:"drawer-content"},r||"chatbot"!==h||v!==R.L.Vietnam||s?l.createElement(CommonCommunity,{communitiesList:e,communityValue:i,selectedTopics:o,isInEditMode:r,defaultCommunity:n,setCommunityValue:p,setSelectedTopics:c,onSubmitPost:u}):l.createElement(SuggestedCommunity,{selectedTopics:o,currentCommunity:t,isLoading:a,clickOtherCommunity:()=>{f("manual"),p({label:g("community.choose"),value:""}),c([])},onSubmitPost:u}))),document.querySelector(".create-post-popup-frame")||document.body)},ew=E.Z.div` input:focus, textarea:focus, [contenteditable='true'] { outline: none; } &.has-ask-doctor-option { .textarea-control { border-bottom: none; border-radius: 4px 4px 0 0; } } &.error-description { .textarea-control { border: 1px solid ${m.r.colors.red600}; border-bottom: none; } } .textarea-control { position: relative; border: 1px solid ${m.r.colors.gray200}; border-bottom: none; border-radius: 8px 8px 0 0; &.--focus { border-color: ${m.r.colors.primaryBase}; box-shadow: 0px 0px 2px 2px ${m.r.colors.primary200}; } .textarea-wrapper { width: 100%; min-height: 268px; height: auto; } .control-tool { position: absolute; bottom: 0; left: 0; display: flex; width: calc(100% - 2rem); height: 40px; align-items: center; justify-content: flex-end; border-top: 1px solid ${m.r.colors.gray200}; margin: 0 1rem; .tool-button { display: flex; width: 2rem; height: 2rem; align-items: center; justify-content: center; background: transparent; cursor: pointer; } .image-icon { vertical-align: middle; } } } .link-preview-wrapper { position: relative; .icon-close { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; cursor: pointer; } } .image-gallery { margin-bottom: 1rem; .image-item { position: relative; overflow: hidden; width: 100%; height: 0; padding-top: 67%; margin-top: 1rem; border-radius: ${m.r.borderRadius}; & > img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; } .close-btn { position: absolute; top: 8px; right: 8px; left: unset; width: 24px; height: 24px; cursor: pointer; } } } .description-label { margin-bottom: 5px; color: ${m.r.colors.gray600}; /* font-family: 'Open Sans', sans-serif; */ font-size: 13px; font-weight: bold; } .count-string { margin-top: 5px; color: ${m.r.colors.gray500}; font-size: 11px; text-align: right; } .input-notification { display: flex; & > img { width: 16px; height: 16px; margin-top: 1.5px; margin-right: 8px; } } `,eE=E.Z.div` height: 100%; position: relative; width: 100%; display: flex; flex-direction: column; .ql-toolbar.ql-snow { top: 0; width: 100%; // position: sticky; z-index: 3; border: none; border-bottom: 1px solid #ccc; border-radius: 8px 8px 0 0; background: white; .ql-formats { display: inline-flex; align-items: center; margin-right: 0.5rem; .link-tool-wrapper { .popover-menu__content { padding: 0.5rem; transform: translateX(calc(-50% - 1rem)); max-width: calc(100vw - 4rem); ::before { right: calc(50% - 8px); } .link-tool-popover { input { padding-left: 1rem; } .link-input-url { margin-bottom: 0.5rem; } .link-input-text { margin-bottom: 0.5rem; } label { display: inline-block; margin-bottom: 0.2rem; } .link-input-button-wrapper { &[data-is-marrybaby='true'] { .link-input-button { border: solid 2px ${m.r.mbColors.pink}; background-color: ${m.r.mbColors.pink}; &:hover:not(:disabled) { border: solid 2px ${m.r.mbColors.pink}; background-color: ${m.r.colors.white}; color: ${m.r.mbColors.pink}; } } } } .link-input-button { width: auto; height: auto; padding: 0.4rem 1rem; background-color: ${m.r.colors.primaryBase}; &:disabled { border-color: #bfbfbf; background-color: #bfbfbf; color: #fff; cursor: not-allowed; } &:hover:not(:disabled) { background-color: ${m.r.colors.primaryHover}; } } .error-text { padding: 0; margin-bottom: 0.5rem; font-weight: 600; color: ${m.r.colors.red700}; } } } } } @media (max-width: 450px) { position: relative; .ql-formats { .link-tool-wrapper { position: unset; .popover-menu__content { left: 0; transform: unset; max-width: 100%; } } } } } .quill { flex: 1; overflow-y: hidden; .ql-container { display: inline-block; width: 100%; min-height: 100%; /* padding: 14px 16px; */ border: none; border-radius: ${m.r.borderRadius}; color: ${m.r.colors.gray800}; font-size: 1rem; line-height: 1.5; resize: none; white-space: break-spaces; .ql-editor { word-break: break-word; overflow-wrap: break-word; /* -ms-overflow-style: none; scrollbar-width: none; &::-webkit-scrollbar { display: none; } */ &::before { font-size: 16px; color: ${m.r.colors.gray400}; font-weight: 400; line-height: 24px; font-style: normal; } } mocka { padding: 2px 6px; border-radius: 1rem; &[data-url='true'] { /* background-color: #eeeeff; */ font-style: italic; color: #1890ff; cursor: pointer; outline: none; text-decoration: underline; } &[data-error='true'] { background-color: #ffeeee; color: red; text-decoration: underline; font-style: bold; } } mention { padding: 2px 6px; border-radius: 1rem; background-color: #eeeeff; color: #1890ff; cursor: pointer; outline: none; text-decoration: none; } ol, ul { padding-left: 1rem; } } } .mention-search-container { position: absolute; background: white; border-radius: ${m.r.borderRadius}; filter: drop-shadow(0px 10px 16px rgba(0, 0, 0, 0.04)) drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04)); overflow-y: scroll; z-index: 99; ::-webkit-scrollbar { -webkit-appearance: none; } ::-webkit-scrollbar:vertical { width: 14px; } ::-webkit-scrollbar-thumb { border-radius: ${m.r.borderRadius}; background-color: #d9d9d9; @supports (background-clip: padding-box) { border: 3px solid rgba(0, 0, 0, 0); background-clip: padding-box; } @supports not (background-clip: padding-box) { border: 3px solid white; } } ::-webkit-scrollbar-track { background-color: #fff; border-radius: 0 6px 6px 0; border-left: 1px solid #f2f2f2; } .mention-search-item { cursor: pointer; padding: 12px 1rem; display: flex; align-items: center; &.item-selected { background-color: ${m.r.colors.gray100}; } .search-avatar { width: 40px; height: 40px; font-size: 20px; margin-right: 20px; } } } `,ek=null;(0,a.a)(void 0,void 0,void 0,function*(){if("undefined"==typeof window)return;let e=yield Promise.all([o.e(9774),o.e(2937),o.e(2138),o.e(9467),o.e(4467),o.e(6966),o.e(5243),o.e(8132),o.e(1375),o.e(4561),o.e(1448),o.e(5465),o.e(1217),o.e(5480),o.e(731),o.e(2050),o.e(2008),o.e(8469),o.e(8214),o.e(1482),o.e(6817),o.e(467),o.e(5951),o.e(9357),o.e(747),o.e(5675),o.e(6753),o.e(4802),o.e(3046),o.e(5745),o.e(3437),o.e(252),o.e(6839),o.e(9424),o.e(5702),o.e(8922),o.e(6399),o.e(553),o.e(2902),o.e(4969),o.e(3257),o.e(6611),o.e(7538),o.e(6894),o.e(5341)]).then(o.t.bind(o,"rmP6",23));ek=e.default;let t=e.Quill||ek.Quill;t.register("modules/preserveWhiteSpace",class{constructor(e,t){this.quill=e,this.options=t,e.container.style.whiteSpace="pre-line"}});let i=t.import("blots/inline");let MockABlot=class MockABlot extends i{static create(e){if(!e)return super.create(!1);let t=super.create(e);return MockABlot.setNodeConfigurations(t,e),t}static formats(e){return!!(e.innerText&&(e.getAttribute("data-href")||e.getAttribute("data-url")||e.getAttribute("data-error")||e.getAttribute("data-bad-word")))&&{"data-bad-word":e.getAttribute("data-bad-word"),"data-error":e.getAttribute("data-error"),"data-href":e.getAttribute("data-href"),"data-url":e.getAttribute("data-url"),"data-text":e.innerText||e.getAttribute("data-href")}}static setNodeConfigurations(e,t){var o,i;t&&(null===(i=null===(o=null==t?void 0:t["data-text"])||void 0===o?void 0:o.replace(/(\ )+/g," "))||void 0===i?void 0:i.replace(/(\u200c|‌)+/g,""))&&(t["data-bad-word"]&&e.setAttribute("data-bad-word",t["data-bad-word"]),t["data-href"]&&e.setAttribute("data-href",t["data-href"]),t["data-error"]&&e.setAttribute("data-error",t["data-error"]),t["data-url"]&&e.setAttribute("data-url",t["data-url"]))}};MockABlot.blotName="mocka1",MockABlot.tagName="mocka",t.register(MockABlot);let MentionBlot=class MentionBlot extends i{static create(e){if(!e)return super.create(!1);let t=super.create(e);return MentionBlot.setNodeConfigurations(t,e),t}static formats(e){return!!(e.getAttribute("data-name")&&e.getAttribute("data-id"))&&{"data-name":e.getAttribute("data-name"),"data-id":e.getAttribute("data-id")}}static setNodeConfigurations(e,t){var o,i;t&&t["data-id"]&&(null===(i=null===(o=null==t?void 0:t["data-name"])||void 0===o?void 0:o.replace(/(\ )+/g," "))||void 0===i?void 0:i.replace(/(\u200c|‌)+/g,""))&&(t["data-id"]&&e.setAttribute("data-id",t["data-id"]),t["data-name"]&&e.setAttribute("data-name",t["data-name"]))}};MentionBlot.blotName="mention",MentionBlot.tagName="mention",t.register(MentionBlot)});let inputModify$1=(e,t)=>{var o;let{formatUrl:i,bannedWords:r=[]}=t||{},a=(0,S.f)((0,S.r)(e));if(!i)return{value:(0,S.h)(a,r)};let l=(0,S.a)((0,S.w)(a)),n=(0,S.g)(a);if(n){let e=[];return n.forEach(t=>{if(t)try{let o=new URL(t);S.A.some(e=>o.origin.endsWith(e))||e.push(t)}catch(o){e.push(t)}}),e.length>0&&(l=l.replace(RegExp(`data-url="true">(${e.map(S.e).join("|")})<`,"gi"),'data-error="true" data-url="true">$1<').replace(RegExp(`data-href="/(${e.map(S.e).join("|")})" data-url="true">`,"gi"),'data-href="/$1" data-error="true" data-url="true">')),{invalidUrls:e,previewUrl:null===(o=n.filter(t=>-1===e.indexOf(t)))||void 0===o?void 0:o[0],value:(0,S.h)(l,r)}}return{value:(0,S.h)(l,r)}},RichTextEditor=({html:e,onChange:t,className:o,style:i,placeholder:r,onImagePickerClick:n,bannedWords:s=[],onInvalidUrlsChange:c,onPreviewUrlChange:d,setEditorRef:p,isReplying:u})=>{var m,g,v,h;let f=(0,l.useRef)([]);f.current=s;let[b,y]=(0,l.useState)([]),[C,E]=(0,l.useState)(null),{data:{locale:k}}=(0,l.useContext)(w.T),P=(null==s?void 0:s.join(","))||"";(0,l.useEffect)(()=>{var e,t;let o=null===(t=null===(e=Z.current)||void 0===e?void 0:e.getEditor())||void 0===t?void 0:t.root.innerHTML;T(o)},[P]);let fetchPreviewData=e=>{C&&C.url===e||(E({url:e,isFetching:!0}),(0,w.c)((0,w.e)(M.yy.FETCH_PREVIEW,{_locale:k}),"POST",{data:{link:e}}).then(t=>{var o,i,r,a;E({title:null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.title,description:null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.description,image:(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.image)||(null===(a=null==t?void 0:t.data)||void 0===a?void 0:a.logo),url:e})}).catch(()=>{E(null)}))},N=(0,l.useRef)(fetchPreviewData);N.current=fetchPreviewData;let T=(0,l.useCallback)(z()(e=>{if(e){let o=inputModify$1(e,{bannedWords:f.current,formatUrl:!0}),{invalidUrls:i,previewUrl:r,value:a}=o;i&&y(i),r?N.current(r):E(null),a!==e&&(null==t||t(a))}},200),[]);(0,l.useEffect)(()=>{c&&c(b)},[b]),(0,l.useEffect)(()=>{d&&((null==C?void 0:C.url)?d({title:C.title||"",url:C.url||"",image:C.image||"",description:C.description||""}):d(null))},[C]);let L=(0,l.useRef)(n);L.current=n;let I=(0,O.a)(),D=(0,l.useRef)({toolbar:{handlers:{image:()=>{var e;return null===(e=L.current)||void 0===e?void 0:e.call(L)},link:()=>!1},container:"#toolbar-"+I},preserveWhiteSpace:!0}),A=(0,l.useRef)(-1),Z=(0,l.useRef)(null);p&&(null===(g=null===(m=Z.current)||void 0===m?void 0:m.getEditor())||void 0===g?void 0:g.root)&&p(null===(h=null===(v=Z.current)||void 0===v?void 0:v.getEditor())||void 0===h?void 0:h.root);let handleSelectionChange=()=>{var e,t,o,i,r,a,l,n;if(null===(t=null===(e=Z.current)||void 0===e?void 0:e.getEditor())||void 0===t?void 0:t.root){let e=function(e){var t,o;let i=-1;if(void 0!==window.getSelection){let r=window.getSelection();if((null==r?void 0:r.rangeCount)&&(null==r?void 0:r.rangeCount)>0){let r=null===(t=window.getSelection())||void 0===t?void 0:t.getRangeAt(0);if(r){let t=r.cloneRange();t.selectNodeContents(e),t.setEnd(r.endContainer,r.endOffset),i=function calculateChildNodeOffset(e,t){return e.forEach((o,i)=>{let r=i+1===e.length;if(o.nodeType===Node.ELEMENT_NODE){let e=o.outerHTML;if(r)t+=e.indexOf(">")+1,t=calculateChildNodeOffset(o.childNodes,t);else{t+=e.length;return}}else o.nodeType===Node.TEXT_NODE&&(t+=(o.nodeValue||"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").length)}),t}(t.cloneContents().childNodes,i);let a=null===(o=r.endContainer.parentElement)||void 0===o?void 0:o.closest("mocka"),l=r.endContainer.nodeValue||r.endContainer.outerHTML;a&&(null==l?void 0:l.length)&&(i=i-r.endOffset+(a.outerHTML.length-(null==a?void 0:a.outerHTML.lastIndexOf(l))))}}}return i}(null===(i=null===(o=Z.current)||void 0===o?void 0:o.getEditor())||void 0===i?void 0:i.root),t=null===(a=null===(r=Z.current)||void 0===r?void 0:r.getEditor())||void 0===a?void 0:a.root.innerHTML;if(e>=0&&e0){let r=null===(t=window.getSelection())||void 0===t?void 0:t.getRangeAt(0);if(r){let t=r.cloneRange();t.selectNodeContents(e),t.setEnd(r.endContainer,r.endOffset);let a=(t.endContainer.nodeValue||"").substring(0,r.endOffset),l=a.lastIndexOf("@");if(l+1(0,a.a)(void 0,void 0,void 0,function*(){var i,r,a,l;if(!e||!DOMRect)return R([]);let n=yield((null===(i=(0,j.ej)($.B))||void 0===i?void 0:i.length)||0)>0?(0,w.b)((0,w.e)(M.yy.SEARCH_USER,{_locale:k,name:e}),"get"):(0,w.q)((0,w.e)(M.qf.SEARCH_USER,{_locale:k,name:e}),"get");K(0),R(null===(a=null===(r=null==n?void 0:n.data)||void 0===r?void 0:r.users)||void 0===a?void 0:a.filter(e=>!(null==o?void 0:o.includes(String(e.id)))));let s=null===(l=U.current)||void 0===l?void 0:l.getBoundingClientRect();if(t&&s){let e={top:t.bottom-s.top,width:"min(343px, 100%)",maxHeight:256},o=s.width-(t.left-s.left);o<343?e.right=0:e.left=t.left-s.left,F(e)}}),500),[]),setSelectUser=(e,t)=>{var o,i,r;if(q.current){q.current.deleteContents();let a=document.createElement("mention");a.setAttribute("data-id",e),a.setAttribute("data-name",t),a.innerText=t;let l=document.createTextNode(" ");q.current.insertNode(l),q.current.insertNode(a);let n=null===(i=null===(o=Z.current)||void 0===o?void 0:o.getEditor())||void 0===i?void 0:i.root;n.focus();let s=null===(r=window.getSelection())||void 0===r?void 0:r.getRangeAt(0);null==s||s.setStart(q.current.endContainer,q.current.endOffset),null==s||s.setEnd(q.current.endContainer,q.current.endOffset)}R([])},U=(0,l.useRef)(null),q=(0,l.useRef)(null),W=(0,l.useRef)(null),[G,K]=(0,l.useState)(0);return(0,l.useEffect)(()=>{if(W.current){let e=W.current,t=e.children.item(G);if(t){let o=e.getBoundingClientRect(),i=t.getBoundingClientRect();t.offsetTope.scrollTop+o.height&&(e.scrollTop=t.offsetTop-o.height+i.height)}}},[G]),(0,l.useEffect)(()=>{let clickHandler=function(e){var t;(null===(t=U.current)||void 0===t?void 0:t.contains(e.target))||R([])};return window.addEventListener("click",clickHandler,{passive:!0}),()=>{window.removeEventListener("click",clickHandler)}},[]),(0,l.useEffect)(()=>{var e,t;if(r&&Z){let o=null===(t=null===(e=Z.current)||void 0===e?void 0:e.getEditor())||void 0===t?void 0:t.root;o&&o.setAttribute("data-placeholder",r)}},[r]),l.createElement(eE,{ref:U,className:o,style:i,onKeyDownCapture:e=>{if(null==B?void 0:B.length){let t=!1;if("ArrowDown"===e.key)t=!0,K(e=>e+1>=B.length?0:e+1);else if("Escape"===e.key)t=!0,K(0),R([]);else if("ArrowUp"===e.key)t=!0,K(e=>e-1<0?B.length-1:e-1);else if("Enter"===e.key||"Tab"===e.key){let e=B[G];e&&(t=!0,setSelectUser(e.id,e.name))}if(t)return e.preventDefault(),!1}}},l.createElement(CustomToolbar,{id:I,onAddLink:(e,o)=>{var i,r;let a=A.current+1,l=null===(r=null===(i=Z.current)||void 0===i?void 0:i.getEditor())||void 0===r?void 0:r.root.innerHTML,n=((null==l?void 0:l.substring(0,a))||"")+`${e} `+((null==l?void 0:l.substring(a))||"");null==t||t(n),T(n)}}),ek&&l.createElement(ek,{ref:Z,theme:"snow",value:e,placeholder:r,onChange:e=>{null==t||t(e),T(e),handleSelectionChange()},onChangeSelection:()=>{handleSelectionChange()},modules:D.current,formats:["mocka1","mention","id","key","bold","italic","underline","list","bullet"]}),!!(null==B?void 0:B.length)&&l.createElement("div",{ref:W,className:"mention-search-container",style:_},B.map((e,t)=>l.createElement("div",{className:`mention-search-item ${G===t?"item-selected":""}`,key:e.id,onClick:t=>{t.preventDefault(),t.stopPropagation(),setSelectUser(e.id,e.name)},onMouseEnter:()=>{K(t)}},l.createElement(V.U,{className:"search-avatar",username:e.name,avatar:e.avatar}),l.createElement("div",null,l.createElement(x.T,{size:"p2"},e.name),l.createElement(x.T,{size:"p4",color:"#595959"},"@",e.username))))))},CustomToolbar=({onAddLink:e,id:t})=>l.createElement("div",{id:"toolbar-"+t,onClick:e=>{e.preventDefault(),e.stopPropagation()}},l.createElement("span",{className:"ql-formats"},l.createElement("button",{className:"ql-bold",type:"button"}),l.createElement("button",{className:"ql-italic",type:"button"}),l.createElement("button",{className:"ql-underline",type:"button"})),l.createElement("span",{className:"ql-formats"},l.createElement("button",{className:"ql-list",value:"ordered",type:"button"}),l.createElement("button",{className:"ql-list",value:"bullet",type:"button"})),l.createElement("span",{className:"ql-formats"},e&&l.createElement(q.P,{className:"link-tool-wrapper",toggleButtonContent:l.createElement("img",{className:"link-icon",src:N.I,loading:"lazy"}),buttonProps:{size:"md",color:"transparent"},align:"end"},({setShow:t})=>l.createElement(LinkToolInputPopover,{onAddUrl:e,setShow:t})))),e$=["notification.limitUrlDomain","notification.urlWrongFormat"],LinkToolInputPopover=({onAddUrl:e,setShow:t})=>{let{data:{env:{isMarryBaby:o}}}=(0,l.useContext)(w.T),{t:i}=(0,d.u)(),[r,a]=(0,l.useState)(""),[n,s]=(0,l.useState)(""),[c,p]=(0,l.useState)(-1),checkUrlValid=e=>{let t=(0,S.c)(e.trim());try{let e=new URL(t);if(!e.protocol.startsWith("http"))return p(1),!1;if(!S.A.some(t=>e.origin.endsWith("/"+t)||e.origin.endsWith("."+t)))return p(0),!1;return p(-1),!0}catch(e){return p(1),!1}},u=r.trim()&&n.trim()&&c<0;return l.createElement("div",{className:"link-tool-popover"},l.createElement(T.I,{name:"url",value:r,size:"md",label:"URL",placeholder:i("placeholder.enterUrlHere"),type:"text",className:"link-input-url",onChange:e=>{a(e),checkUrlValid(e)}}),c>=0&&l.createElement(x.T,{size:"c2",className:"error-text"},i(e$[c])),l.createElement(T.I,{name:"text",value:n,size:"md",label:i("createPost.urlText"),placeholder:i("placeholder.enterUrlTextHere"),type:"text",className:"link-input-text",onChange:e=>s(e)}),l.createElement("div",{"data-is-marrybaby":o,className:"link-input-button-wrapper"},l.createElement(U.B,{theme:o?"marryBaby":"helloSites",size:"sm",color:"primary",className:"link-input-button",onClick:()=>{u&&(e(n.trim(),(0,S.c)(r.trim())),t&&t(!1))},isDisabled:!u},i("insert"))))},eS=E.Z.div` input:focus, textarea:focus, [contenteditable='true'] { outline: none; } input { &::placeholder { font-size: 16px; color: ${m.r.colors.gray400}; font-weight: 400; line-height: 24px; } } .title-input { overflow: hidden; width: 100%; padding: 12px 16px; border: solid 1px #d9d9d9; border-radius: ${m.r.borderRadius}; font-size: 16px; line-height: 1.2; white-space: nowrap; :focus { border-color: ${e=>e.color}; box-shadow: 0px 0px 2px 2px ${e=>e.colorShadow}; } br { display: none; } * { display: inline; white-space: nowrap; } mocka { padding: 2px 6px; border-radius: 1rem; &[data-error='true'] { background-color: #ffeeee; color: red; text-decoration: underline; font-style: bold; } } ol, ul { padding-left: 1rem; } } label { display: block; margin-bottom: 5px; color: ${m.r.colors.gray600}; font-size: 13px; font-weight: bold; } .count-string { color: ${m.r.colors.gray400}; font-size: 14px; text-align: right; font-weight: 400; line-height: 22px; letter-spacing: -0.2px; text-transform: lowercase; } .has-input-error { input { border: 1px solid ${m.r.colors.red600}; } } `,eP=E.Z.div` display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; .field-label { color: ${m.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; } `;(i=r||(r={})).title="create-post-title-field",i.description="create-post-description-field",i.photos="create-post-photos-field";let eN=["title","description","photos"],CreatePostDescription=({className:e,style:t,bannedWords:o=[],value:i,placeholder:a="",onChange:n,onPreviewUrlChange:s,onInvalidUrlsChange:c,isReplying:p,footerEditor:u})=>{let{t:m}=(0,d.u)(),[g,v]=(0,l.useState)(null),h=(0,l.useRef)(null);return(0,l.useEffect)(()=>{s&&((null==g?void 0:g.url)?s({title:g.title||"",url:g.url||"",image:g.image||"",description:g.description||""}):s(null))},[g]),l.createElement("div",null,l.createElement(eP,null,l.createElement(x.T,{size:"p4",className:"field-label"},m("createPost.popup.description"))),l.createElement(ew,{className:e,style:t},l.createElement("div",{className:`textarea-control ${r.description}`},l.createElement("div",{className:"textarea-wrapper"},l.createElement(RichTextEditor,{html:i||"",placeholder:a,onChange:n,bannedWords:o,onImagePickerClick:()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:v,onInvalidUrlsChange:c,isReplying:p}))),u))},eT=E.Z.div` position: relative; display: flex; height: 100%; flex-direction: column; ${y.M.mbDown} { padding: 16px 16px; } .input-group-container { flex: 1; padding: 16px 24px; -ms-overflow-style: none; /* IE and Edge */ overflow-y: auto; scrollbar-width: none; /* Firefox */ &::-webkit-scrollbar { display: none; } } .input-group { :not(:last-child) { margin-bottom: 0.6rem; } input:focus, textarea:focus, [contenteditable='true'] { outline: none; } label { margin-bottom: 5px; color: ${m.r.colors.gray600}; /* font-family: 'Open Sans', sans-serif; */ font-size: 13px; font-weight: bold; } .input-group-label { margin-bottom: 5px; color: ${m.r.colors.gray600}; /* font-family: 'Open Sans', sans-serif; */ font-size: 13px; font-weight: bold; } .input-notification { display: flex; & > img { width: 16px; height: 16px; margin-top: 1.5px; margin-right: 8px; } } .tag-list { } } .warning { margin-top: 16px; } .submit-btn { width: 100%; } .switch-label { display: flex; align-items: center; } .swich-input-group { padding: 12px 16px; border-radius: 8px; background: ${m.r.colors.neutral50}; &.askdoctor-switch { background: ${m.r.colors.primary50}; &.mb-color { background: ${m.r.mbColors.tonePink}; } } .mantine-Switch-labelWrapper { flex-grow: 1; } .mantine-Checkbox-body { display: flex; width: 100%; align-items: center; justify-content: space-between; } .mantine-Switch-track { margin-bottom: 0; } .label-txt { font-weight: normal; font-size: 14px; color: ${m.r.colors.gray800}; margin-left: 10px; } } `,eL=E.Z.div` display: flex; width: 100%; align-items: center; justify-content: space-between; border-radius: 8px; background: ${m.r.colors.neutral50}; gap: 12px; &.has-error { border: 1px solid ${m.r.colors.red600}; } &.error-description { border: 1px solid ${m.r.colors.red600}; border-top: none; } &[data-is-marry-baby='true'] { background: ${m.r.mbColors.tonePink}; } .switch-label { display: flex; gap: 12px; align-items: center; .wrapper-text { .label-txt { color: ${m.r.colors.gray800}; font-size: 14px; font-weight: 600; line-height: 22px; } .description-txt { color: ${m.r.colors.gray700}; font-size: 12px; font-weight: 400; line-height: 18px; } } } .switch-btn { .mantine-Switch-track { margin: 0; min-width: 40px; width: 40px; } .mantine-Switch-labelWrapper { display: none; } } button { height: 40px; &:hover, &.primary { border-radius: 16px; border: 1px solid ${m.r.colors.blue100}; background: ${m.r.colors.blue50}; color: ${m.r.colors.primaryBase}; } } `,ez=E.Z.div` margin-bottom: 12px; color: ${m.r.colors.red700}; svg { margin-right: 5px; } svg, span { vertical-align: middle; } .mantine-Text-root { color: ${m.r.colors.red600}; font-size: 12px; font-weight: 400; line-height: 18px; display: block; } `,eI=E.Z.div` .swich-input-group { padding: 12px 16px; border-radius: 8px; background: ${m.r.colors.neutral50}; &.askdoctor-switch { background: ${m.r.colors.blue50}; } .switch-label { display: flex; align-items: center; } .mantine-Switch-labelWrapper { flex-grow: 1; } .mantine-Checkbox-body { display: flex; width: 100%; align-items: center; justify-content: space-between; } .mantine-Switch-track { margin-bottom: 0; } .label-txt { font-weight: normal; font-size: 14px; color: ${m.r.colors.gray800}; margin-left: 14px; } } `,eD=E.Z.div` display: flex; gap: 12px; .avatar { width: 40px; height: 40px; border-radius: 100%; &.avatar-anonymous { background: ${m.r.colors.neutral100}; } img { border-radius: 100%; } .author-avatar { .col-left { display: none; } } } .post-action-form { display: flex; flex-direction: column; gap: 4px; } .post-action-by { color: ${m.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; } .post-action-result { display: flex; position: relative; } .dropdown-post-action { background: ${m.r.colors.white} !important; border-radius: 8px; border: 1px solid ${m.r.colors.neutral200} !important; > div { padding: 3px 8px; } span { flex: 1; color: ${m.r.colors.gray600}; font-size: 12px; font-weight: 600; line-height: 18px; } ul { width: 130px; li { img { flex: 0 0 16px; width: 16px; } } } } `,eM=E.Z.div` display: inline-flex; gap: 8px; align-items: center; cursor: pointer; .session-title { color: ${m.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; flex: 1; } `,eA=E.Z.div` padding: 10px 16px; border-top: none; border-radius: 12px; background: ${m.r.colors.neutral50}; display: flex; flex-direction: column; gap: 8px; &.has-error { border: 1px solid ${m.r.colors.red600}; } &.error-description { border: 1px solid ${m.r.colors.red600}; border-top: none; } `,eZ=E.Z.div` display: flex; padding: 16px 24px 24px 24px; justify-content: space-between; align-items: center; box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.08); ${y.M.mbDown} { padding: 8px 16px 12px 16px; gap: 12px; flex-direction: column; justify-content: flex-start; align-items: flex-start; .action-wrapper { width: 100%; flex: 1 1 100%; } } .input-group { margin-bottom: 0 !important; } `,eB=E.Z.div` padding: 8px 8px; border: 1px solid ${m.r.colors.gray200}; border-top: none; border-radius: 0 0 8px 8px; &.has-error { border: 1px solid ${m.r.colors.red600}; } &.error-description { border: 1px solid ${m.r.colors.red600}; border-top: none; } .error-choice-question { color: ${m.r.colors.red600}; font-size: 12px; font-weight: 400; line-height: 22px; letter-spacing: -0.2px; } `,eR=(0,E.Z)(h.s)` gap: 8px; &.mantine-SegmentedControl-root { background-color: transparent; padding: 0px; } .mantine-SegmentedControl-indicator { display: none; } .mantine-SegmentedControl-label { margin-bottom: 0px !important; display: flex; padding: 5px 12px; justify-content: center; align-items: center; gap: 8px; height: 32px; border: 1px solid ${m.r.colors.neutral100}; } .mantine-SegmentedControl-control { color: ${m.r.colors.gray800}; font-size: 14px; font-style: normal; font-weight: 600; line-height: 22px; border-radius: 8px; background: ${m.r.colors.white}; border-width: 0 !important; } .mantine-SegmentedControl-controlActive { border-radius: 8px; background: ${m.r.colors.blue50}; .mantine-SegmentedControl-label { color: ${m.r.colors.primaryBase}; border: 1px solid ${m.r.colors.blue50}; } } &.segmented-marry-baby { .mantine-SegmentedControl-control { border-radius: 16px; } .mantine-SegmentedControl-label { border-radius: 16px; } .mantine-SegmentedControl-controlActive { border-radius: 16px; background: ${m.r.colors.pink500}; .mantine-SegmentedControl-label { color: ${m.r.colors.white}; border: 1px solid ${m.r.colors.pink500}; } } } `,CreatePostPhotos=({imageFiles:e,setImageFiles:t})=>{let o=(0,l.useRef)(null),{t:i}=(0,d.u)(),{onSelectImages:r}=(0,C.u)(e,t);return l.createElement("div",{className:"input-group"},l.createElement(eM,{onClick:()=>{var e;null===(e=null==o?void 0:o.current)||void 0===e||e.click()}},l.createElement("img",{alt:"anonymous-icon",src:er,style:{width:"18px",height:"18px",objectFit:"contain",marginLeft:"auto"}}),l.createElement("div",{className:"session-title"},i("createPost.photos"))),l.createElement("input",{ref:o,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:e=>r(e)}))},inputModify=(e,t)=>{if(!t)return e;let{limit:o,bannedWords:i=[]}=t,r="number"==typeof o&&o>=0?e.substring(0,o):e,a=(0,S.h)(r,i);return a},CreatePostTitle=({className:e,style:t,bannedWords:o=[],value:i,placeholder:a="",error:n,onChange:s})=>{let c=(0,v.rZ)(),{t:p}=(0,d.u)(),[u,g]=(0,l.useState)(""),h=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(h.current){let pasteHandler=e=>{var t;e.preventDefault();let o=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,o)},e=h.current;return e.addEventListener("paste",pasteHandler,{passive:!0}),()=>e.removeEventListener("paste",pasteHandler)}},[h]);let f=(null==o?void 0:o.join(","))||"";(0,l.useEffect)(()=>{var e;if(f){let t=null===(e=h.current)||void 0===e?void 0:e.innerText;if(t){let e=(0,S.h)(t,o);e!==t&&(s&&s(e),g(e))}}},[f]);let b=(0,l.useCallback)(z()(e=>{if(e){let t=inputModify(e,{limit:120,bannedWords:o});s&&s(t),g(t)}},300),[]);return l.createElement(eS,{className:e,style:t,color:c.colors[c.primaryColor][0],colorShadow:c.colors[c.primaryColor][2]},l.createElement(eP,null,l.createElement(x.T,{size:"p4",className:"field-label"},p("createPost.title")),l.createElement(x.T,{size:"p4",className:"count-string"},`${null==i?void 0:i.length}/120`,"\xa0",p("character"))),l.createElement(T.I,{name:"title",value:i||u,size:"md",label:"",placeholder:a,onChange:e=>{if(e!==(i||u)){let t=inputModify(e,{bannedWords:o});s&&s(t),g(t),b(e)}},className:`${r.title} ${n&&(null==n?void 0:n.title)?"has-input-error":""}`}),n&&(null==n?void 0:n.title)&&l.createElement(ez,{style:{margin:"4px 0 0"}},l.createElement(x.T,{size:"p5",as:"span",color:m.r.colors.red600},n.title)))},e_=E.Z.div` .mantine-Text-root { margin-bottom: 4px; } .preview-images-container { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; .image-src-wrapper { flex: 0 0 116px; width: 116px; height: 116px; border-radius: 4px; position: relative; img { border-radius: 4px; } .icon-close { position: absolute; top: 6px; right: 6px; cursor: pointer; z-index: 10; max-height: 24px; max-width: 24px; } &.image-has-error { .preview-image { border: 1.5px solid ${m.r.colors.red600}; } } } } `,PostPhotosReview=({error:e,imageFiles:t,indexImageError:o=[],setIndexImageError:i,setImageFiles:a,removeKeyError:n})=>{let{t:s}=(0,d.u)(),{imageSrcs:c,onRemoveImage:p}=(0,C.u)(t,a);return l.createElement(e_,{className:"input-group"},l.createElement(x.T,{size:"p5",weight:"semiBold"},s("createPost.photos")),l.createElement("div",{className:`${r.photos} preview-images-container`},null==c?void 0:c.map((e,t)=>{let r=o.includes(t);return l.createElement("div",{className:`image-src-wrapper ${r?"image-has-error":""}`,key:t},l.createElement("img",{src:e,className:"preview-image",alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}),l.createElement("img",{alt:"",className:"icon-close",src:C.c,onClick:()=>{n&&n("photos"),p(t);let e=o.filter(e=>e!==t)||[];i(e)}}))})),e&&(null==e?void 0:e.photos)&&l.createElement(ez,null,l.createElement(x.T,{size:"p5",color:m.r.colors.red600},e.photos)))},eF=[R.L.PhilippinesEnglish,R.L.PhilippinesTagalog,R.L.Indonesia,R.L.Malaysia,R.L.Vietnam],CreateNewPostContentV2=({className:e,style:t,onClose:o,onPostCreatedEdited:i,forceSelectCommunity:p,forceSelectTopics:g,articleId:v,editPostData:h,defaultCommunity:f,communities:y,userInfo:E,isMarryBaby:$=!1})=>{let N=!!(null==h?void 0:h.id),{data:{locale:T},action:{pushNotifications:L,sanitizeFunction:z}}=(0,l.useContext)(w.T),{t:I}=(0,d.u)(),D=(0,l.useRef)(null),[A,Z]=(0,l.useState)(""),[B,_]=(0,l.useState)(!1),[F,H]=(0,l.useState)(""),[U,j]=(0,l.useState)(""),[O,V]=(0,l.useState)({label:I("community.choose"),value:""}),[q,W]=(0,l.useState)([...g]),[G,K]=(0,l.useState)({}),[Q,J]=(0,l.useState)([]),[Y,X]=(0,l.useState)([]),[ee,ei]=(0,l.useState)([]),[er,ea]=(0,l.useState)({label:I("cardPost.public"),value:"public"}),[el,en]=(0,l.useState)([]),[es,ec]=(0,l.useState)([]),{imageSrcs:ed=[]}=(0,C.u)(Q),[ep,eu]=(0,l.useState)(null),[em,eg]=(0,l.useState)([]),[ev,eh]=(0,l.useState)("step_info"),[ef,ex]=(0,l.useState)(!1),[eb,ey]=(0,l.useState)(""),[eC,ew]=(0,l.useState)(!1),eE=[{label:I("cardPost.public"),value:"public",icon:l.createElement("img",{alt:"anonymous-icon",src:eo,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}})},{label:I("cardPost.option.anonymous"),value:"anonymous",icon:l.createElement("img",{alt:"anonymous-icon",src:et,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}})}],ek=p||y.find(e=>`${e.id||""}-${e.mappedCategoryId||""}`===O.value);(0,l.useEffect)(()=>{h?(H(h.title||""),j((0,S.d)((0,S.b)(h.description||"","edit"),h.mentions)),V({label:h.community.name,value:`${h.community.id||""}-${h.community.mappedCategoryId||""}`}),J(h.photos||[]),Z((!!h.isAskDoctor).toString()||"false")):f&&V({label:f.name,value:`${f.id||""}-${f.mappedCategoryId||""}`})},[]),(0,l.useEffect)(()=>{_(eF.includes(T)&&""!==F&&!/[a-zA-Z]/.test(F)),K({})},[F]),(0,l.useEffect)(()=>{(0,a.a)(void 0,void 0,void 0,function*(){var e,t,o;let[i,r,a]=yield Promise.all([(0,w.b)((0,w.e)(M.yy.COMMUNITY.LIST,{_locale:T,pageSize:100}),"GET"),(0,w.b)((0,w.e)(M.yy.TOPIC.LIST,{_locale:T,pageSize:100}),"GET"),(0,w.b)((0,w.e)(M.yy.COMMUNITY.GET_UNCATEGORIZED,{_locale:T}),"GET")]),l=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.communities;if(Array.isArray(l)&&l.length){let e=l.map(e=>(0,k.f)(e));en(e)}let n=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.topics;Array.isArray(n)&&ec(()=>null==n?void 0:n.map(k.c));let s=null===(o=null==a?void 0:a.data)||void 0===o?void 0:o.communities;Array.isArray(s)&&s.length&&ey(String(s[0].id))})},[]);let onCreateEditSuccess=e=>{i&&i((0,k.a)(e),N),o&&o()},validationUploadPhoto=e=>{let t=Object.assign({},G);if(e&&e.length>10&&(t.photos=I("createPost.message.photoMaxium")),e&&e.length){let o=!1,i=[];e.forEach((e,t)=>{(null==e?void 0:e.size)>10485760&&(o=!0,i.push(t))}),o&&(t.photos=I("createPost.message.photoSize")),ei(i)}else ei([]);K(t)},validationPost=()=>{let e=!1,t={},o=u()(U);if(o||(t.description=I("createPost.message.requiredDescription"),e=!0),o&&o.split(" ").length<10&&(t.description=I("createPost.message.lengthDescription",{currentLength:o.split(" ").length}),e=!0),A||(t.askDoctor=I("createPost.message.askDoctor"),e=!0),Q&&Q.length>10&&(t.photos=I("createPost.message.photoMaxium"),e=!0),Q&&Q.length){let o=!1,i=[];Q.forEach((e,t)=>{(null==e?void 0:e.size)>10485760&&(o=!0,i.push(t))}),o&&(t.photos=I("createPost.message.photoSize"),e=!0),ei(i)}else ei([]);return em&&em.length&&(t.video="Invalid video url",e=!0),K(t),e},removeKeyError=e=>{if(G[e]){let t=Object.assign({},G),o=`${e}`,i=t[o],r=(0,a._)(t,["symbol"==typeof o?o:o+""]);K(r),console.log(i)}};console.log(eb),console.log(es);let submitPost=e=>(0,a.a)(void 0,void 0,void 0,function*(){var t,i,r,a,l,n,s,c,d;if(!eC){let p;ew(!0);let u=validationPost();if(u)return ew(!1);let m=yield(0,C.d)({title:F,description:U,communityId:String((null==ek?void 0:ek.id)||""),imageFiles:Q,previewUrl:ep,topicIds:null==q?void 0:q.map(e=>String(e.id||"")).filter(Boolean),locale:T,sanitizeFunction:z,categoryCommunityId:String((null==ek?void 0:ek.mappedCategoryId)||""),categoryTopicIds:null==q?void 0:q.map(e=>String((null==e?void 0:e.mappedCategoryId)||"")).filter(Boolean),isAnonymous:(null==er?void 0:er.value)==="anonymous"?1:0,isAskDoctor:toBoolean(A)?1:0,introUrl:""});v&&m.append("article_id",v),console.log(e),N?(null==h?void 0:h.id)&&(p=yield(0,C.e)({id:h.id,formData:m,locale:T})):p=yield(0,C.f)({formData:m,locale:T,isArticleComment:!0});let g=null==p?void 0:p.data;(null==g?void 0:g.id)&&!(null===(i=null===(t=null==p?void 0:p.messages)||void 0===t?void 0:t.moderation)||void 0===i?void 0:i.type)?(L({message:N?I("updatePost.popup.success"):I("createPost.popup.success"),type:"success"}),onCreateEditSuccess(g)):(null===(a=null===(r=null==p?void 0:p.messages)||void 0===r?void 0:r.moderation)||void 0===a?void 0:a.type)==="banned"?(L({title:I("notification.post.blocked.title"),message:I("notification.post.blocked.message"),type:"danger"}),p.messages.moderation.words&&X(p.messages.moderation.words)):(null===(n=null===(l=null==p?void 0:p.messages)||void 0===l?void 0:l.moderation)||void 0===n?void 0:n.type)==="suspect"?(L({title:I("notification.post.suspect.title"),message:I("notification.post.suspect.message"),type:"warning"}),o&&o()):(null===(c=null===(s=null==p?void 0:p.messages)||void 0===s?void 0:s.find)||void 0===c?void 0:c.call(s,e=>{var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))}))?(L({message:I("notification.suspend.message"),type:"danger"}),o&&o()):L({message:(null===(d=null==p?void 0:p.messages)||void 0===d?void 0:d[0])||I("notification.failure"),type:"danger"}),ew(!1)}}),getFirstOrderErroKey=e=>{let t=e.find(e=>!!G.hasOwnProperty(e)&&!!G[e]);return t?r[t]:""},handleScrollToError=e=>{if((null==D?void 0:D.current)&&e){let t=document.querySelector(`.${e}`);if(t&&D.current){let e=D.current;e&&e.scrollTo({top:t.offsetTop-40,behavior:"smooth"})}}};return l.createElement(eT,{className:`${e} create-post-popup-frame`,style:t},l.createElement("div",{className:"input-group-container",ref:D},l.createElement(eI,null,l.createElement("div",{className:"input-group"},l.createElement(eD,null,l.createElement("div",{className:`avatar ${"anonymous"===er.value?"avatar-anonymous":""}`},"anonymous"===er.value?l.createElement("img",{alt:"avatar-icon",src:"data:image/svg+xml,%3csvg width='27' height='34' viewBox='0 0 27 34' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M26.6198 30.8276C26.1994 29.8612 25.6858 28.938 25.0862 28.0712C24.7039 27.4646 24.1752 26.9639 23.5487 26.6152L20.809 24.8984H6.56441L3.82386 26.6152C3.19735 26.9639 2.66863 27.4646 2.28637 28.0712C1.68686 28.938 1.1733 29.8612 0.752979 30.8276C0.66293 31.0085 0.641973 31.216 0.694039 31.4113C0.746105 31.6065 0.867615 31.776 1.03578 31.8881C3.0517 33.0766 8.44044 33.6133 13.6865 33.6133C18.9327 33.6133 24.3197 33.0766 26.3357 31.8881C26.5041 31.7762 26.6259 31.6068 26.6782 31.4116C26.7305 31.2163 26.7098 31.0087 26.6198 30.8276Z' fill='%23626D7C'/%3e%3cpath d='M10.0127 16.6728C11.3205 16.6728 12.3808 15.6125 12.3808 14.3046C12.3808 12.9968 11.3205 11.9365 10.0127 11.9365C8.70478 11.9365 7.64453 12.9968 7.64453 14.3046C7.64453 15.6125 8.70478 16.6728 10.0127 16.6728Z' fill='%23626D7C'/%3e%3cpath d='M17.3642 16.6728C18.6721 16.6728 19.7323 15.6125 19.7323 14.3046C19.7323 12.9968 18.6721 11.9365 17.3642 11.9365C16.0563 11.9365 14.9961 12.9968 14.9961 14.3046C14.9961 15.6125 16.0563 16.6728 17.3642 16.6728Z' fill='%23626D7C'/%3e%3cpath d='M21.9864 28.0466C22.082 29.5658 21.4126 32.585 21.0465 33.4184C20.347 33.5359 19.612 33.6342 18.8497 33.7162C19.2541 28.6723 18.254 25.817 17.3633 23.1885C19.6065 23.9945 20.3088 24.4426 20.8088 24.8989C21.6531 25.664 21.8006 26.2187 21.6094 26.5192C21.4181 26.828 20.5082 27.0438 20.5082 27.0438C21.6831 27.3225 21.9564 27.5958 21.9864 28.0466Z' fill='%2387909C'/%3e%3cpath d='M10.0121 23.1885C9.11859 25.817 8.11855 28.6723 8.52293 33.7162C7.76061 33.6342 7.02561 33.5359 6.32613 33.4184C5.95999 32.585 5.29057 29.5658 5.3862 28.0466C5.41625 27.5958 5.68949 27.3225 6.8644 27.0438C6.8644 27.0438 5.95726 26.828 5.76326 26.5219C5.56927 26.2159 5.72228 25.664 6.56384 24.8989C7.06659 24.4426 7.76881 23.9945 10.0121 23.1885Z' fill='%2387909C'/%3e%3cpath d='M3.82307 26.6153L6.56361 24.8994C5.72205 25.6645 5.57177 26.2191 5.76304 26.5224C5.9543 26.8257 6.86417 27.0443 6.86417 27.0443C5.68926 27.323 5.41603 27.5962 5.38597 28.0471C5.29034 29.5663 5.95977 32.5855 6.3259 33.4189C3.99248 33.0391 2.07164 32.4981 1.03608 31.8888C0.868115 31.7766 0.746669 31.6072 0.694385 31.4122C0.6421 31.2171 0.662547 31.0097 0.751911 30.8286C1.17295 29.8624 1.68628 28.9392 2.28476 28.0717C2.66772 27.4653 3.19662 26.9645 3.82307 26.6153Z' fill='%23626D7C'/%3e%3cpath d='M26.6201 30.8286C26.7101 31.0096 26.7309 31.2172 26.6786 31.4124C26.6262 31.6077 26.5044 31.7771 26.3359 31.8888C25.3031 32.4981 23.3822 33.0391 21.0461 33.4189C21.4122 32.5855 22.0816 29.5663 21.986 28.0471C21.956 27.5962 21.6827 27.323 20.5078 27.0443C20.5078 27.0443 21.4177 26.8285 21.6089 26.5197C21.8002 26.2191 21.6527 25.6645 20.8084 24.8994L23.5489 26.6153C24.1754 26.9645 24.7043 27.4653 25.0872 28.0717C25.6863 28.9388 26.1996 29.8621 26.6201 30.8286Z' fill='%23626D7C'/%3e%3cpath d='M17.3632 23.1885C18.254 25.817 19.254 28.6723 18.8496 33.7162C17.1356 33.9049 15.4126 33.9998 13.6882 34.0004C11.963 33.9997 10.239 33.9049 8.5241 33.7162C8.11971 28.6723 9.11975 25.817 10.0132 23.1885C10.2264 22.4453 10.5843 22.3497 10.8411 22.3797C11.4805 22.4562 12.1171 23.0136 13.6828 23.0136H13.691C15.2566 23.0136 15.896 22.4562 16.5326 22.3797C16.7895 22.3497 17.1501 22.4453 17.3632 23.1885Z' fill='%23D2D6DC'/%3e%3cpath d='M21.5965 8.49707H5.7789C3.77117 8.55172 2.41347 9.08289 2.59189 9.89057C2.8889 11.2362 7.55957 13.0035 13.6877 13.0035C19.8158 13.0035 24.4865 11.2362 24.7835 9.89057C24.9619 9.08289 23.6042 8.55117 21.5965 8.49707Z' fill='%2387909C'/%3e%3cpath d='M21.6065 8.49671C21.6725 8.82817 21.7208 9.1629 21.7513 9.49949C21.7513 10.2072 18.1009 11.2263 13.6882 11.2263C9.27542 11.2263 5.625 10.2072 5.625 9.49949C5.65547 9.1629 5.70381 8.82817 5.76981 8.49671C6.50755 4.6441 9.52133 -0.744085 12.8001 1.00735C13.0736 1.15268 13.3785 1.22867 13.6882 1.22867C13.9978 1.22867 14.3027 1.15268 14.5762 1.00735C17.855 -0.744085 20.8688 4.6441 21.6065 8.49671Z' fill='%23626D7C'/%3e%3c/svg%3e",style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}}):(null==E?void 0:E.avatar)?l.createElement("img",{alt:"avatar-icon",src:null==E?void 0:E.avatar,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}}):l.createElement(P.C,{showDetailPopup:!1,avatar:"",avatarProps:{size:40},name:null==E?void 0:E.name,userId:null==E?void 0:E.userId,className:"author-avatar"})),l.createElement("div",{className:"post-action-form"},l.createElement("div",{className:"post-action-by"},(null==er?void 0:er.value)==="anonymous"?I("cardPost.anonymous"):null==E?void 0:E.name),l.createElement(c.D,{disabled:N,options:eE,id:"post-action-type",size:"sm",className:"dropdown-post-action",placeholder:I("community.choose"),value:er,onChange:e=>{ea({label:e.label,value:String(e.value)})},placeholderIcon:l.createElement("div",{className:"post-action-result"},"public"===er.value?l.createElement("img",{alt:"public-icon",src:eo,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}}):l.createElement("img",{alt:"anonymous-icon",src:et,style:{width:"100%",height:"100%",objectFit:"contain",marginLeft:"auto"}})),style:{zIndex:10,width:"calc(100% + 20px)"}})))),l.createElement(CreatePostTitle,{className:"input-group",bannedWords:Y,value:F,error:G,placeholder:toBoolean(A)?I("createPost.post.askDoctor.title"):I("createPost.post.title"),onChange:H}),B&&l.createElement(ez,null,l.createElement(n.Z,{isSolid:!0,color:m.r.colors.red700,size:14}),l.createElement(x.T,{size:"p3",as:"span",color:m.r.colors.red700},I("createPost.popup.specialCharErr"))),l.createElement("div",{className:"input-group"},l.createElement(CreatePostDescription,{bannedWords:Y,value:U,placeholder:toBoolean(A)?I("createPost.post.askDoctor.description"):I("createPost.post.description"),onChange:e=>{j(e),removeKeyError("description")},onPreviewUrlChange:eu,onInvalidUrlsChange:eg,onImageFilesChange:J,imageFiles:Q,className:`${G&&(null==G?void 0:G.description)?"error-description":""}`,footerEditor:l.createElement(l.Fragment,null,l.createElement(eB,{className:G&&(null==G?void 0:G.description)?"error-description":""},l.createElement(eA,null,l.createElement(eL,{color:m.r.colors.primaryBase},l.createElement("div",{className:"switch-label"},l.createElement(s.Z,{isMarryBaby:$,size:$?32:24,color:m.r.colors.primaryBase,className:"label-icon"}),l.createElement("div",{className:"wrapper-text"},l.createElement("div",{className:"label-txt"},I("createPost.askDoctor.description")))),l.createElement(eR,{value:A,onChange:e=>{Z(e)},className:$?"segmented-marry-baby":"",data:[{label:I("switchBtn.yes"),value:"true"},{label:I("switchBtn.no"),value:"false"}]})),G&&(null==G?void 0:G.askDoctor)&&l.createElement("div",{className:"error-choice-question"},G.askDoctor))),G&&(null==G?void 0:G.description)&&l.createElement(ez,{style:{margin:"4px 0 0"}},l.createElement(x.T,{size:"p5",as:"span",color:m.r.colors.red600},G.description)))})),"step_community"===ev&&l.createElement(CreatePostCommunity,{communitiesList:el,currentCommunity:ek,selectedTopics:q,communityValue:O,defaultCommunity:p,error:G,isFullscreen:!1,isMarryBaby:$,isInEditMode:N,isLoadingSuggest:ef,setSelectedTopics:W,setCommunityValue:V,removeKeyError:removeKeyError,setStepPost:eh,onSubmitPost:submitPost}),ed.length>0&&l.createElement(PostPhotosReview,{imageFiles:Q,error:G,indexImageError:ee,setIndexImageError:ei,setImageFiles:J,removeKeyError:removeKeyError}))),l.createElement(eZ,null,l.createElement(CreatePostPhotos,{imageFiles:Q,setImageFiles:e=>{J(e),validationUploadPhoto(e)}}),l.createElement("div",{className:"action-wrapper"},l.createElement(b.B,{className:"submit-btn pointer-event-child-none",size:"lg","data-event-category":"Ask Doctor","data-event-action":"Submit Question","data-event-label":window.location.href,onClick:()=>(0,a.a)(void 0,void 0,void 0,function*(){var e;let t=validationPost();if(t){let e=getFirstOrderErroKey(eN);handleScrollToError(e);return}if(submitPost(),!ev){if(N){submitPost();return}if(eh("step_community"),T===R.L.Vietnam&&!$&&!N)try{ex(!0);let t=yield(0,w.b)((0,w.r)(M.yy.CHATBOT.GET_SUGGEST_COMMUNITY),"POST",{data:{title:F,description:U},headers:{"Content-Type":"application/json"}});if(!t)throw Error();if(null==t?void 0:t.community){let o=el.find(e=>String(e.id)===String(null==t?void 0:t.community.id));if(o&&(V({label:o.name,value:String(o.id)}),(null==t?void 0:t.topic)&&(null==t?void 0:t.topic.length))){let o=t.topic.map(e=>e.id),i=yield(0,w.b)((0,w.e)(M.yy.TOPIC.LIST,{_locale:T,topic_in:o.join(),pageSize:100}),"GET"),r=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.topics,a=[];null==r||r.forEach(e=>{a=a.concat(e.discover_category)}),W(a)}}}catch(e){console.log("err")}finally{ex(!1)}}}),loading:ef||eC,disabled:ef||eC},I("createPost.popup.submit")))))},eH=E.Z.div` display: flex; width: 100%; flex-wrap: wrap; margin-top: 1rem; .tag-item { min-height: 32px; padding: 5px 12px; border: 1px solid ${m.r.colors.neutral100}; margin-right: 1rem; margin-bottom: 8px; border-radius: 1rem; color: ${m.r.colors.gray800}; cursor: pointer; font-size: 13px; line-height: 22px; transition: all 0.2s; &.--active { border-color: ${m.r.colors.primary50}; background: ${m.r.colors.primary50}; color: ${m.r.colors.primaryBase}; } &[data-disabled='true'] { background: ${m.r.colors.gray100}; color: ${m.r.colors.gray800}; } } .topic-spinner { margin-right: auto; margin-left: auto; & > button { width: 24px; height: 24px; } } &[data-is-marrybaby='true'] { .tag-item { border-color: transparent; background: #f3f3f3; color: #3e3f58; &.--active { border-color: #b6cdff; background: #e0e9fb; color: #3e3f58; } } } `,TopicSelectList=({className:e,style:t,topics:o,communityId:i,onChange:r,isLoading:n,disabled:s,forceTopics:c,selectedTopics:d,noFetch:p,dataEventCategory:u,dataEventAction:m,dataEventLabel:g})=>{let{data:{locale:v,env:{isMarryBaby:h}}}=(0,l.useContext)(w.T),[f,x]=(0,l.useState)(o?[...o]:[]),[b,y]=(0,l.useState)(d?[...d]:[]),[C,E]=(0,l.useState)(!1),$=(0,l.useRef)(o);$.current=o,(0,l.useEffect)(()=>{var e;!i||p||(null===(e=$.current)||void 0===e?void 0:e.length)||(x([]),E(!0),(0,a.a)(void 0,void 0,void 0,function*(){var e;try{let t=yield(0,w.c)((0,w.e)(M.yy.TOPIC.LIST,{communityId:i,_locale:v}),"GET"),o=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.topics;Array.isArray(o)&&x(()=>(null==o?void 0:o.map(k.c).sort((e,t)=>(e.order||0)-(t.order||0)))||[])}catch(e){console.log(e),E(!1)}E(!1)}))},[i,p]);let S=null==o?void 0:o.map(e=>e.id).join("-"),P=null==f?void 0:f.map(e=>e.id).join("-"),N=null==c?void 0:c.map(e=>e.id).join("-");(0,l.useEffect)(()=>{o&&void 0!==S&&S!==P&&x(o)},[o,S,P]);let T=(0,l.useMemo)(()=>f.filter(e=>!(null==c?void 0:c.some(t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId))),[P,N]);return l.createElement(eH,{"data-is-marrybaby":h,className:e,style:t},c.map(e=>l.createElement(TopicItem,{key:`${e.id}-${e.mappedCategoryId}`,topic:e,disabled:!0,selected:!0,dataEventAction:m,dataEventCategory:u,dataEventLabel:g})),T.map(e=>l.createElement(TopicItem,{key:`${e.id}-${e.mappedCategoryId}`,topic:e,disabled:s,selected:(d||b).some(t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId),onClick:()=>{let t=d||b,o=t.findIndex(t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId);-1!==o?t.splice(o,1):t.push(e),r&&d?r(t.slice()):(r&&r(t.slice()),y(t.slice()))},dataEventAction:m,dataEventCategory:u,dataEventLabel:g})),(n||C)&&l.createElement(F.L,{className:"topic-spinner"}))},TopicItem=e=>{var{topic:t,disabled:o,selected:i,onClick:r}=e,n=(0,a._)(e,["topic","disabled","selected","onClick"]);return l.createElement("div",Object.assign({className:"tag-item"+(i?" --active":""),"data-disabled":o,onClick:o?void 0:r},n),t.name)},SkipQuestionOfExpertBtn=e=>{var{post:t,onSkip:o,btnText:i,currentPageUrl:r}=e,n=(0,a._)(e,["post","onSkip","btnText","currentPageUrl"]);let{t:s}=(0,d.u)(),{data:{locale:c},action:{pushNotifications:p}}=(0,l.useContext)(w.T),[u,m]=(0,l.useState)(!1),[g,h]=(0,l.useState)(!1),x=(0,v.rZ)(),y=(0,l.useCallback)(()=>(0,a.a)(void 0,void 0,void 0,function*(){var e;h(!0);let i=yield(0,w.b)((0,w.e)(M.yy.USER.SKIP_QUESTION,{_locale:c,id:null==t?void 0:t.id}),"PUT");(null==i?void 0:i.status)===1?(null==o||o({id:(null==t?void 0:t.id)||"",communityId:(null===(e=null==t?void 0:t.community)||void 0===e?void 0:e.id)||""}),m(!1),p({title:"",message:"Skip success",type:"success"})):p({title:"",message:null==i?void 0:i.messages,type:"danger"}),h(!1)}),[]);return l.createElement(f.J,{width:327,withArrow:!0,shadow:"md",opened:u},l.createElement(f.J.Target,null,l.createElement("div",Object.assign({className:`KsWg8i6 ${(null==n?void 0:n.className)||""}`,onClick:()=>m(!0)},n),i||s("profilePanel.questionNotClear"))),l.createElement(f.J.Dropdown,null,l.createElement("div",null,l.createElement("div",{className:"_9tS0EUN"},s("profilePanel.skipQuestion.heading")),l.createElement("div",{className:"kyyRKlb"},s("profilePanel.skipQuestion.content")),l.createElement("div",{className:"-Uqqka-"},l.createElement(b.B,{size:"md",variant:"secondary",leftIcon:l.createElement(W.Z,{color:x.fn.primaryColor(),size:24}),onClick:()=>m(!1),styles:()=>({leftIcon:{marginRight:0}})}),l.createElement(b.B,{variant:"primary",size:"md",leftIcon:l.createElement(G.Z,{color:"white",size:24}),onClick:y,loading:g,"data-event-category":"Together","data-event-action":"Unclear Question Click","data-event-label":r,styles:()=>({leftIcon:{marginRight:0}})})))))}}}]);