@hhgtech/hhg-components 1.27.114 → 1.27.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/build/babyGrowth.js +2 -2
  2. package/build/cache.js +1 -1
  3. package/build/care/components/organisms/bookingSearchBarV2/searchResultSpecialties/index.d.ts +1 -2
  4. package/build/care/components/organisms/bookingSearchBarV2/useSearchBarApi.d.ts +2 -1
  5. package/build/care.js +1 -1
  6. package/build/components/molecules/surveyOrPremiumBanner/context.d.ts +3 -1
  7. package/build/components/molecules/surveyOrPremiumBanner/index.d.ts +1 -1
  8. package/build/components.js +1 -1
  9. package/build/constants.js +1 -1
  10. package/build/core-e9e9ac59.js +1 -0
  11. package/build/ecom.js +1 -1
  12. package/build/esm/babyGrowth.js +5 -5
  13. package/build/esm/cache.js +1 -1
  14. package/build/esm/care/components/organisms/bookingSearchBarV2/searchResultSpecialties/index.d.ts +1 -2
  15. package/build/esm/care/components/organisms/bookingSearchBarV2/useSearchBarApi.d.ts +2 -1
  16. package/build/esm/care.js +1 -1
  17. package/build/esm/components/molecules/surveyOrPremiumBanner/context.d.ts +3 -1
  18. package/build/esm/components/molecules/surveyOrPremiumBanner/index.d.ts +1 -1
  19. package/build/esm/components.js +1 -1
  20. package/build/esm/constants.js +1 -1
  21. package/build/esm/{core-1028598f.js → core-d5f86c30.js} +1 -1
  22. package/build/esm/ecom.js +1 -1
  23. package/build/esm/{fixedBottomAdBlock-3c7c1b7a.js → fixedBottomAdBlock-6ec8bfe8.js} +1 -1
  24. package/build/esm/footer.js +1 -1
  25. package/build/esm/gAssets.js +1 -1
  26. package/build/esm/{getDynamicHealthTool-3e136ca5.js → getDynamicHealthTool-a48d1221.js} +1 -1
  27. package/build/esm/{getSocialList-b9454bb5.js → getSocialList-caa69154.js} +1 -1
  28. package/build/esm/hooks.js +1 -1
  29. package/build/esm/i18n.js +1 -1
  30. package/build/esm/i18nV2.js +1 -1
  31. package/build/esm/{index-91d7e60b.js → index-0027f4d5.js} +1 -1
  32. package/build/esm/{index-3f8465e8.js → index-20c430d5.js} +1 -1
  33. package/build/esm/{index-673ad233.js → index-27b5f2f6.js} +1 -1
  34. package/build/esm/{index-83dfe615.js → index-2cc58993.js} +1 -1
  35. package/build/esm/{index-1029c164.js → index-39c6d79e.js} +1 -1
  36. package/build/esm/{index-5c172717.js → index-479d7500.js} +1 -1
  37. package/build/esm/{index-85d07f57.js → index-5e88525b.js} +1 -1
  38. package/build/esm/{index-26b0307c.js → index-61b606da.js} +1 -1
  39. package/build/esm/{index-78f07a91.js → index-64e54f8a.js} +1 -1
  40. package/build/esm/{index-0485529f.js → index-8551904b.js} +1 -1
  41. package/build/esm/{index-c9f9d7d6.js → index-904154ed.js} +6 -6
  42. package/build/esm/index-93d96552.js +1 -0
  43. package/build/esm/{index-42e648eb.js → index-a39fdd9b.js} +1 -1
  44. package/build/esm/{index-1fba8a44.js → index-a3aacc1d.js} +2 -2
  45. package/build/esm/index-af3c4f7d.js +1 -0
  46. package/build/esm/{index-c1a69748.js → index-d02f6f7e.js} +1 -1
  47. package/build/esm/{index-a43cae38.js → index-d7b3c107.js} +1 -1
  48. package/build/esm/{index-d5977164.js → index-dada87eb.js} +1 -1
  49. package/build/esm/{index-e719fc88.js → index-e82154db.js} +1 -1
  50. package/build/esm/index-ee4107d0.js +1 -0
  51. package/build/esm/{index-4e95ea5e.js → index-f6f5f317.js} +1 -1
  52. package/build/esm/index.js +1 -1
  53. package/build/esm/{index.styled-5a1f46e0.js → index.styled-6196831f.js} +1 -1
  54. package/build/esm/index.styled-c548ab67.js +50 -0
  55. package/build/esm/{index.styled-2c442aec.js → index.styled-eeb89098.js} +1 -1
  56. package/build/esm/{index.styles-4b6147f8.js → index.styles-7a9113c1.js} +1 -1
  57. package/build/esm/lead.js +1 -1
  58. package/build/esm/mantine.js +1 -1
  59. package/build/esm/misc.js +1 -1
  60. package/build/esm/navigation.js +1 -1
  61. package/build/esm/{normalizeLink-4fc54cae.js → normalizeLink-4b74ae03.js} +1 -1
  62. package/build/esm/onboarding.js +1 -1
  63. package/build/esm/onboardingV2.js +1 -1
  64. package/build/esm/paths-93c43665.js +1 -0
  65. package/build/esm/pwg.js +1 -1
  66. package/build/esm/together.js +1 -1
  67. package/build/esm/{types-02f1425b.js → types-9fe85abc.js} +1 -1
  68. package/build/esm/{types-d45fcabb.js → types-e6c8e176.js} +3 -3
  69. package/build/esm/types.js +1 -1
  70. package/build/esm/{useCategory-71b1cf87.js → useCategory-16e50509.js} +1 -1
  71. package/build/esm/useHealthToolCache-3c6e7944.js +1 -0
  72. package/build/esm/{useRafState-24b792d0.js → useRafState-ac9467c8.js} +1 -1
  73. package/build/esm/useTranslations-b1be8a29.js +1 -0
  74. package/build/esm/{utils-d700dfb8.js → utils-e516ba3d.js} +1 -1
  75. package/build/esm/vaccination.js +5 -5
  76. package/build/{fixedBottomAdBlock-702fafee.js → fixedBottomAdBlock-b4f15122.js} +1 -1
  77. package/build/footer.js +1 -1
  78. package/build/gAssets.js +1 -1
  79. package/build/getDynamicHealthTool-c72bd725.js +1 -0
  80. package/build/{getSocialList-a848bd87.js → getSocialList-ae26e4f3.js} +1 -1
  81. package/build/hooks.js +1 -1
  82. package/build/i18n.js +1 -1
  83. package/build/i18nV2.js +1 -1
  84. package/build/{index-b4d93c49.js → index-0ca8783e.js} +1 -1
  85. package/build/{index-649bbfe6.js → index-118ca017.js} +2 -2
  86. package/build/{index-14990842.js → index-2631c46c.js} +15 -15
  87. package/build/{index-3202f8cf.js → index-41301f0c.js} +1 -1
  88. package/build/{index-f976641c.js → index-4b190dd5.js} +1 -1
  89. package/build/{index-750388bb.js → index-5c8fbc7a.js} +1 -1
  90. package/build/{index-5bd3a060.js → index-6857ac87.js} +2 -2
  91. package/build/{index-2eb2c405.js → index-7b7953ba.js} +1 -1
  92. package/build/{index-7491af14.js → index-883e5d33.js} +1 -1
  93. package/build/index-8dd8bc2b.js +1 -0
  94. package/build/{index-48ef1926.js → index-9e7ea74e.js} +1 -1
  95. package/build/{index-18deb764.js → index-9fe9bf65.js} +1 -1
  96. package/build/{index-25a06b31.js → index-a0e02781.js} +1 -1
  97. package/build/{index-011ab63f.js → index-ab048566.js} +1 -1
  98. package/build/{index-eb02f6c2.js → index-cd8a90ce.js} +4 -4
  99. package/build/{index-bda1c6fd.js → index-d2481555.js} +1 -1
  100. package/build/index-d73dfdc7.js +1 -0
  101. package/build/{index-cc07b195.js → index-ecc9315a.js} +1 -1
  102. package/build/{index-3be2930e.js → index-ed62f07d.js} +1 -1
  103. package/build/{index-571b9c6b.js → index-ee67f7a4.js} +1 -1
  104. package/build/{index-bd55921e.js → index-f8dc542c.js} +1 -1
  105. package/build/index.js +1 -1
  106. package/build/{index.styled-493521e6.js → index.styled-786fe414.js} +1 -1
  107. package/build/{index.styled-8fb7e77d.js → index.styled-96db1a5a.js} +4 -4
  108. package/build/{index.styled-ce98ee5b.js → index.styled-a20477d5.js} +4 -4
  109. package/build/{index.styles-2478c244.js → index.styles-412e2fb9.js} +1 -1
  110. package/build/lead.js +1 -1
  111. package/build/mantine.js +1 -1
  112. package/build/misc.js +1 -1
  113. package/build/navigation.js +1 -1
  114. package/build/{normalizeLink-69021303.js → normalizeLink-e0b77a83.js} +1 -1
  115. package/build/onboarding.js +1 -1
  116. package/build/onboardingV2.js +1 -1
  117. package/build/paths-dab476cc.js +1 -0
  118. package/build/pwg.js +1 -1
  119. package/build/together.js +1 -1
  120. package/build/{types-9a4dd2c6.js → types-624439ae.js} +3 -3
  121. package/build/{types-ada49557.js → types-afd6d465.js} +1 -1
  122. package/build/types.js +1 -1
  123. package/build/{useCategory-29b94a26.js → useCategory-20ea92de.js} +1 -1
  124. package/build/useHealthToolCache-efaa59f2.js +1 -0
  125. package/build/{useRafState-3f0610c7.js → useRafState-51954011.js} +1 -1
  126. package/build/{useTranslations-95f60387.js → useTranslations-8ddbe2cf.js} +1 -1
  127. package/build/utils-8a0e7a73.js +1 -0
  128. package/build/vaccination.js +1 -1
  129. package/package.json +1 -1
  130. package/build/core-ae10092d.js +0 -1
  131. package/build/esm/index-01e4d381.js +0 -1
  132. package/build/esm/index-7d503adc.js +0 -1
  133. package/build/esm/index-a555949a.js +0 -1
  134. package/build/esm/index.styled-527344f0.js +0 -50
  135. package/build/esm/paths-efe320e9.js +0 -1
  136. package/build/esm/useHealthToolCache-38c27f8d.js +0 -1
  137. package/build/esm/useTranslations-df44cab1.js +0 -1
  138. package/build/getDynamicHealthTool-e8f5869c.js +0 -1
  139. package/build/index-20a1a9b4.js +0 -1
  140. package/build/index-687a65e1.js +0 -1
  141. package/build/paths-7c86e869.js +0 -1
  142. package/build/useHealthToolCache-5cb64c10.js +0 -1
  143. package/build/utils-676840ec.js +0 -1
  144. /package/build/{BMI_BOYS.percentile.monthly-3c4e88ea.js → BMI_BOYS.percentile.monthly-a328ef5e.js} +0 -0
  145. /package/build/{BMI_BOYS.percentile.weekly-338ebcde.js → BMI_BOYS.percentile.weekly-65949882.js} +0 -0
  146. /package/build/{BMI_BOYS.percentile.yearly-f8af7365.js → BMI_BOYS.percentile.yearly-980702c1.js} +0 -0
  147. /package/build/{BMI_BOYS.zscore.monthly-d709e7d1.js → BMI_BOYS.zscore.monthly-223f4199.js} +0 -0
  148. /package/build/{BMI_BOYS.zscore.weekly-bda372dd.js → BMI_BOYS.zscore.weekly-0f46c205.js} +0 -0
  149. /package/build/{BMI_BOYS.zscore.yearly-56ed2ec1.js → BMI_BOYS.zscore.yearly-ca86b731.js} +0 -0
  150. /package/build/{BMI_GIRLS.percentile.monthly-a825ae13.js → BMI_GIRLS.percentile.monthly-0f3fb3a1.js} +0 -0
  151. /package/build/{BMI_GIRLS.percentile.weekly-e67b6cc8.js → BMI_GIRLS.percentile.weekly-5bdaccb7.js} +0 -0
  152. /package/build/{BMI_GIRLS.percentile.yearly-5930e297.js → BMI_GIRLS.percentile.yearly-344e432d.js} +0 -0
  153. /package/build/{BMI_GIRLS.zscore.monthly-dea3ebdf.js → BMI_GIRLS.zscore.monthly-953d0d6f.js} +0 -0
  154. /package/build/{BMI_GIRLS.zscore.weekly-a268b1ad.js → BMI_GIRLS.zscore.weekly-6f11181e.js} +0 -0
  155. /package/build/{BMI_GIRLS.zscore.yearly-96435480.js → BMI_GIRLS.zscore.yearly-37797d94.js} +0 -0
  156. /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-3ebc31f4.js → HEAD CIRCUM_BOYS.percentile.monthly-65c8cd64.js} +0 -0
  157. /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-33224269.js → HEAD CIRCUM_BOYS.percentile.weekly-50ff29c1.js} +0 -0
  158. /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-e994feec.js → HEAD CIRCUM_BOYS.percentile.yearly-82a01fcb.js} +0 -0
  159. /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-cde32c1f.js → HEAD CIRCUM_BOYS.zscore.monthly-d16866e6.js} +0 -0
  160. /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-1b3561c2.js → HEAD CIRCUM_BOYS.zscore.weekly-871d3825.js} +0 -0
  161. /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-4f7ac639.js → HEAD CIRCUM_BOYS.zscore.yearly-54b487eb.js} +0 -0
  162. /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-2df910a4.js → HEAD CIRCUM_GIRLS.percentile.monthly-3bf7839a.js} +0 -0
  163. /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-98d3a4f5.js → HEAD CIRCUM_GIRLS.percentile.weekly-867a3251.js} +0 -0
  164. /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-d1941f7e.js → HEAD CIRCUM_GIRLS.percentile.yearly-81f91e05.js} +0 -0
  165. /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-d9847228.js → HEAD CIRCUM_GIRLS.zscore.monthly-bbdcb858.js} +0 -0
  166. /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-8bfa923d.js → HEAD CIRCUM_GIRLS.zscore.weekly-5bd5564c.js} +0 -0
  167. /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-7875b0da.js → HEAD CIRCUM_GIRLS.zscore.yearly-9cfa7cfa.js} +0 -0
  168. /package/build/{HEIGHT_BOYS.percentile.monthly-da34b72e.js → HEIGHT_BOYS.percentile.monthly-a77de81f.js} +0 -0
  169. /package/build/{HEIGHT_BOYS.percentile.weekly-2f15c787.js → HEIGHT_BOYS.percentile.weekly-cd97a3cd.js} +0 -0
  170. /package/build/{HEIGHT_BOYS.percentile.yearly-c78c1b7e.js → HEIGHT_BOYS.percentile.yearly-8f02dfaa.js} +0 -0
  171. /package/build/{HEIGHT_BOYS.zscore.monthly-322c3614.js → HEIGHT_BOYS.zscore.monthly-e7bf346f.js} +0 -0
  172. /package/build/{HEIGHT_BOYS.zscore.weekly-f26452ec.js → HEIGHT_BOYS.zscore.weekly-f123f752.js} +0 -0
  173. /package/build/{HEIGHT_BOYS.zscore.yearly-d5cf084c.js → HEIGHT_BOYS.zscore.yearly-578c9f8f.js} +0 -0
  174. /package/build/{HEIGHT_GIRLS.percentile.monthly-15a66ec4.js → HEIGHT_GIRLS.percentile.monthly-c6663d49.js} +0 -0
  175. /package/build/{HEIGHT_GIRLS.percentile.weekly-4c15c2ee.js → HEIGHT_GIRLS.percentile.weekly-b8d87eb0.js} +0 -0
  176. /package/build/{HEIGHT_GIRLS.percentile.yearly-f3f04417.js → HEIGHT_GIRLS.percentile.yearly-18f8609f.js} +0 -0
  177. /package/build/{HEIGHT_GIRLS.zscore.monthly-e8cc77b4.js → HEIGHT_GIRLS.zscore.monthly-e98fe2e5.js} +0 -0
  178. /package/build/{HEIGHT_GIRLS.zscore.weekly-ef3bb57d.js → HEIGHT_GIRLS.zscore.weekly-5c331003.js} +0 -0
  179. /package/build/{HEIGHT_GIRLS.zscore.yearly-d1328748.js → HEIGHT_GIRLS.zscore.yearly-74ab8aba.js} +0 -0
  180. /package/build/{Onboarding-ff5a2403.js → Onboarding-816df77b.js} +0 -0
  181. /package/build/{Visible-51165983.js → Visible-7bbd829a.js} +0 -0
  182. /package/build/{WEIGHT_BOYS.percentile.monthly-a0c81107.js → WEIGHT_BOYS.percentile.monthly-6d3cca4a.js} +0 -0
  183. /package/build/{WEIGHT_BOYS.percentile.weekly-cd287dff.js → WEIGHT_BOYS.percentile.weekly-a1ca616d.js} +0 -0
  184. /package/build/{WEIGHT_BOYS.percentile.yearly-255025e1.js → WEIGHT_BOYS.percentile.yearly-fd6bf0ed.js} +0 -0
  185. /package/build/{WEIGHT_BOYS.zscore.monthly-ad2d5d48.js → WEIGHT_BOYS.zscore.monthly-4b120f96.js} +0 -0
  186. /package/build/{WEIGHT_BOYS.zscore.weekly-ea3af618.js → WEIGHT_BOYS.zscore.weekly-d1917acb.js} +0 -0
  187. /package/build/{WEIGHT_BOYS.zscore.yearly-c74b88b5.js → WEIGHT_BOYS.zscore.yearly-563a77b6.js} +0 -0
  188. /package/build/{WEIGHT_GIRLS.percentile.monthly-bc8f2079.js → WEIGHT_GIRLS.percentile.monthly-69238b90.js} +0 -0
  189. /package/build/{WEIGHT_GIRLS.percentile.weekly-f4fa637b.js → WEIGHT_GIRLS.percentile.weekly-3aaf18a6.js} +0 -0
  190. /package/build/{WEIGHT_GIRLS.percentile.yearly-21f9cfe2.js → WEIGHT_GIRLS.percentile.yearly-13f4a8f1.js} +0 -0
  191. /package/build/{WEIGHT_GIRLS.zscore.monthly-85ea4bf6.js → WEIGHT_GIRLS.zscore.monthly-a5e9746b.js} +0 -0
  192. /package/build/{WEIGHT_GIRLS.zscore.weekly-f96a4b62.js → WEIGHT_GIRLS.zscore.weekly-957a979c.js} +0 -0
  193. /package/build/{WEIGHT_GIRLS.zscore.yearly-ded7ee57.js → WEIGHT_GIRLS.zscore.yearly-1656a630.js} +0 -0
  194. /package/build/{constants-2da6233a.js → constants-d61064ed.js} +0 -0
  195. /package/build/{cookieHelper-1125bc56.js → cookieHelper-fd1952df.js} +0 -0
  196. /package/build/{dataTransform-89425807.js → dataTransform-fe55bddf.js} +0 -0
  197. /package/build/esm/{BMI_BOYS.percentile.monthly-10efc421.js → BMI_BOYS.percentile.monthly-e0d579c1.js} +0 -0
  198. /package/build/esm/{BMI_BOYS.percentile.weekly-cf594e8e.js → BMI_BOYS.percentile.weekly-5423a078.js} +0 -0
  199. /package/build/esm/{BMI_BOYS.percentile.yearly-4c627cd3.js → BMI_BOYS.percentile.yearly-5108f14e.js} +0 -0
  200. /package/build/esm/{BMI_BOYS.zscore.monthly-92d73563.js → BMI_BOYS.zscore.monthly-95a6ac9d.js} +0 -0
  201. /package/build/esm/{BMI_BOYS.zscore.weekly-9a13ffba.js → BMI_BOYS.zscore.weekly-bd28819b.js} +0 -0
  202. /package/build/esm/{BMI_BOYS.zscore.yearly-761916c1.js → BMI_BOYS.zscore.yearly-363113cb.js} +0 -0
  203. /package/build/esm/{BMI_GIRLS.percentile.monthly-83333439.js → BMI_GIRLS.percentile.monthly-6868bfc9.js} +0 -0
  204. /package/build/esm/{BMI_GIRLS.percentile.weekly-f22fef87.js → BMI_GIRLS.percentile.weekly-4dcf3a72.js} +0 -0
  205. /package/build/esm/{BMI_GIRLS.percentile.yearly-5bf8b9a4.js → BMI_GIRLS.percentile.yearly-a0633d46.js} +0 -0
  206. /package/build/esm/{BMI_GIRLS.zscore.monthly-e52e0786.js → BMI_GIRLS.zscore.monthly-cb8e2372.js} +0 -0
  207. /package/build/esm/{BMI_GIRLS.zscore.weekly-cbebeccf.js → BMI_GIRLS.zscore.weekly-eade51d8.js} +0 -0
  208. /package/build/esm/{BMI_GIRLS.zscore.yearly-9f6602f9.js → BMI_GIRLS.zscore.yearly-35314972.js} +0 -0
  209. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-00d9bc26.js → HEAD CIRCUM_BOYS.percentile.monthly-6ec3866f.js} +0 -0
  210. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-832deb37.js → HEAD CIRCUM_BOYS.percentile.weekly-f02f133c.js} +0 -0
  211. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-26f18164.js → HEAD CIRCUM_BOYS.percentile.yearly-0015852e.js} +0 -0
  212. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-6f17ba67.js → HEAD CIRCUM_BOYS.zscore.monthly-973f6d0d.js} +0 -0
  213. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-39a96ae5.js → HEAD CIRCUM_BOYS.zscore.weekly-f9e2c620.js} +0 -0
  214. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-e61f0bd5.js → HEAD CIRCUM_BOYS.zscore.yearly-9385af70.js} +0 -0
  215. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-de6ea58c.js → HEAD CIRCUM_GIRLS.percentile.monthly-3199770f.js} +0 -0
  216. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-cc400848.js → HEAD CIRCUM_GIRLS.percentile.weekly-038e2999.js} +0 -0
  217. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-ca728425.js → HEAD CIRCUM_GIRLS.percentile.yearly-09f3f554.js} +0 -0
  218. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-bc20f365.js → HEAD CIRCUM_GIRLS.zscore.monthly-4484c579.js} +0 -0
  219. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-9872ea70.js → HEAD CIRCUM_GIRLS.zscore.weekly-6fa18787.js} +0 -0
  220. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-8fdb64b1.js → HEAD CIRCUM_GIRLS.zscore.yearly-c8ac527c.js} +0 -0
  221. /package/build/esm/{HEIGHT_BOYS.percentile.monthly-391d50ac.js → HEIGHT_BOYS.percentile.monthly-dc2dfdc2.js} +0 -0
  222. /package/build/esm/{HEIGHT_BOYS.percentile.weekly-b36db2bd.js → HEIGHT_BOYS.percentile.weekly-0ae79629.js} +0 -0
  223. /package/build/esm/{HEIGHT_BOYS.percentile.yearly-689276df.js → HEIGHT_BOYS.percentile.yearly-e31d2be4.js} +0 -0
  224. /package/build/esm/{HEIGHT_BOYS.zscore.monthly-6020f6e4.js → HEIGHT_BOYS.zscore.monthly-597a3c01.js} +0 -0
  225. /package/build/esm/{HEIGHT_BOYS.zscore.weekly-e7fce9d4.js → HEIGHT_BOYS.zscore.weekly-66d7a037.js} +0 -0
  226. /package/build/esm/{HEIGHT_BOYS.zscore.yearly-13a69e2f.js → HEIGHT_BOYS.zscore.yearly-52e16651.js} +0 -0
  227. /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-c38e82ed.js → HEIGHT_GIRLS.percentile.monthly-1c3b6910.js} +0 -0
  228. /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-10262d47.js → HEIGHT_GIRLS.percentile.weekly-875011f6.js} +0 -0
  229. /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-119dfdfc.js → HEIGHT_GIRLS.percentile.yearly-6a6418bb.js} +0 -0
  230. /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-87a3472c.js → HEIGHT_GIRLS.zscore.monthly-b77727d1.js} +0 -0
  231. /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-8f752394.js → HEIGHT_GIRLS.zscore.weekly-6b8f65ed.js} +0 -0
  232. /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-6c11561e.js → HEIGHT_GIRLS.zscore.yearly-72bb2101.js} +0 -0
  233. /package/build/esm/{Onboarding-fb7a824d.js → Onboarding-4b540166.js} +0 -0
  234. /package/build/esm/{Visible-311efdfc.js → Visible-3cfa9ccd.js} +0 -0
  235. /package/build/esm/{WEIGHT_BOYS.percentile.monthly-66e5decf.js → WEIGHT_BOYS.percentile.monthly-53f2b898.js} +0 -0
  236. /package/build/esm/{WEIGHT_BOYS.percentile.weekly-0cb1395f.js → WEIGHT_BOYS.percentile.weekly-20340f48.js} +0 -0
  237. /package/build/esm/{WEIGHT_BOYS.percentile.yearly-533965e1.js → WEIGHT_BOYS.percentile.yearly-243cb49d.js} +0 -0
  238. /package/build/esm/{WEIGHT_BOYS.zscore.monthly-abef8ada.js → WEIGHT_BOYS.zscore.monthly-ad50aa7e.js} +0 -0
  239. /package/build/esm/{WEIGHT_BOYS.zscore.weekly-5640bae0.js → WEIGHT_BOYS.zscore.weekly-af3f02d2.js} +0 -0
  240. /package/build/esm/{WEIGHT_BOYS.zscore.yearly-a56a5534.js → WEIGHT_BOYS.zscore.yearly-7facefaa.js} +0 -0
  241. /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-f361fe21.js → WEIGHT_GIRLS.percentile.monthly-1963ac15.js} +0 -0
  242. /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-b34e4d8b.js → WEIGHT_GIRLS.percentile.weekly-7d86b805.js} +0 -0
  243. /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-688fd8a5.js → WEIGHT_GIRLS.percentile.yearly-0c5e4724.js} +0 -0
  244. /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-f6432df2.js → WEIGHT_GIRLS.zscore.monthly-1776fe58.js} +0 -0
  245. /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-ab21b5df.js → WEIGHT_GIRLS.zscore.weekly-b3f2c8e5.js} +0 -0
  246. /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-4b4baa0a.js → WEIGHT_GIRLS.zscore.yearly-377cb035.js} +0 -0
  247. /package/build/esm/{constants-52ab9dbc.js → constants-4db920a7.js} +0 -0
  248. /package/build/esm/{cookieHelper-52316f1c.js → cookieHelper-7cdc7050.js} +0 -0
  249. /package/build/esm/{dataTransform-a73ad32c.js → dataTransform-7db18bcb.js} +0 -0
  250. /package/build/esm/{index-f194cdd8.js → index-89868b22.js} +0 -0
  251. /package/build/esm/{isProduction-354d23e7.js → isProduction-674d3030.js} +0 -0
  252. /package/build/esm/{localizeNumberFormat-9027c73f.js → localizeNumberFormat-aab100cf.js} +0 -0
  253. /package/build/esm/{number-4ffea90c.js → number-136741a4.js} +0 -0
  254. /package/build/esm/{screenSizeContext-0f230429.js → screenSizeContext-59d225c9.js} +0 -0
  255. /package/build/esm/{theme-a77d1672.js → theme-eed2b691.js} +0 -0
  256. /package/build/esm/{translationsContext-c4fce264.js → translationsContext-94abb77a.js} +0 -0
  257. /package/build/esm/{tslib.es6-863a71ed.js → tslib.es6-c7c364d0.js} +0 -0
  258. /package/build/esm/{types-823cdd3d.js → types-40b3a5a2.js} +0 -0
  259. /package/build/esm/{useIsInit-60c46958.js → useIsInit-7a12e27f.js} +0 -0
  260. /package/build/esm/{useOutsideClick-c3599975.js → useOutsideClick-1eedbd72.js} +0 -0
  261. /package/build/esm/{useScrollbarSize-6433eae7.js → useScrollbarSize-64fe34f2.js} +0 -0
  262. /package/build/esm/{useUniqueId-403ec3d3.js → useUniqueId-c3fee558.js} +0 -0
  263. /package/build/{index-cfb836aa.js → index-ebe061ca.js} +0 -0
  264. /package/build/{isProduction-b744d6db.js → isProduction-fc8ac18d.js} +0 -0
  265. /package/build/{localizeNumberFormat-acfbf957.js → localizeNumberFormat-603766ef.js} +0 -0
  266. /package/build/{number-bafe3a62.js → number-d5cdd007.js} +0 -0
  267. /package/build/{screenSizeContext-8433c0f1.js → screenSizeContext-f2fc50bf.js} +0 -0
  268. /package/build/{theme-3bfd2865.js → theme-6eebc8ce.js} +0 -0
  269. /package/build/{translationsContext-20436537.js → translationsContext-41b73b25.js} +0 -0
  270. /package/build/{tslib.es6-08feefec.js → tslib.es6-888abbb9.js} +0 -0
  271. /package/build/{types-47237479.js → types-1879adc0.js} +0 -0
  272. /package/build/{useIsInit-c4a46d39.js → useIsInit-b9d8185f.js} +0 -0
  273. /package/build/{useOutsideClick-34d54bf1.js → useOutsideClick-d17db9ba.js} +0 -0
  274. /package/build/{useScrollbarSize-4a1557ea.js → useScrollbarSize-61f72af6.js} +0 -0
  275. /package/build/{useUniqueId-3591728a.js → useUniqueId-1bdb1e7b.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("./tslib.es6-08feefec.js"),t=require("react"),a=require("./useTranslations-95f60387.js"),i=require("lodash/debounce"),o=require("./constants-2da6233a.js"),l=require("./index-b4d93c49.js"),n=require("styled-components"),s=require("./index-cc07b195.js"),r=require("./theme-3bfd2865.js"),c=require("./screenSizeContext-8433c0f1.js"),d=require("react-loading-skeleton"),u=require("lodash/shuffle"),p=require("./useOutsideClick-34d54bf1.js"),h=require("./paths-7c86e869.js"),g=require("@mantine/core"),f=require("./index-48ef1926.js"),m=require("./cookieHelper-1125bc56.js"),C=require("./index-5bd3a060.js"),b=require("string-format");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function v(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var x=v(t),E=y(t),S=y(i),w=y(n),L=y(d),O=y(u),k=y(b);const I=e=>x.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},e),x.createElement("path",{d:"M7.99969 9.38055L5.45236 6.83322C5.17636 6.55722 4.72836 6.55722 4.45236 6.83322C4.17636 7.10922 4.17636 7.55722 4.45236 7.83322L7.52836 10.9092C7.78903 11.1699 8.21103 11.1699 8.47103 10.9092L11.547 7.83322C11.823 7.55722 11.823 7.10922 11.547 6.83322C11.271 6.55722 10.823 6.55722 10.547 6.83322L7.99969 9.38055Z"}));function T(){const[e,a]=t.useState((()=>{if("undefined"==typeof window)return"unset";if(m.getCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE))return"granted";const e=!location.protocol.includes("https")&&"localhost"!==location.hostname;return!navigator.geolocation||e?"denied":"unset"})),[i,o]=t.useState((()=>{if("undefined"==typeof window)return null;const e=m.getCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE);if(e)try{return JSON.parse(e)}catch(e){console.log(e)}return null})),l=t.useCallback((function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition((e=>{const t={lat:""+Math.round(1e7*e.coords.latitude)/1e7,lng:""+Math.round(1e7*e.coords.longitude)/1e7};m.setCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE,JSON.stringify(t),{minutes:15}),o(t),a("granted")}),(()=>{m.deleteCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE),a("denied")}))}),[]);return t.useMemo((()=>({geoLocationPermission:e,geoLocationCoordinates:i,requestGeoLocation:l})),[e,i])}const j=w.default.div``,M=w.default.div`
1
+ "use strict";var e=require("./tslib.es6-888abbb9.js"),t=require("react"),a=require("./useTranslations-8ddbe2cf.js"),i=require("lodash/debounce"),o=require("./constants-d61064ed.js"),l=require("./index-0ca8783e.js"),n=require("styled-components"),s=require("./index-ecc9315a.js"),r=require("./theme-6eebc8ce.js"),c=require("./screenSizeContext-f2fc50bf.js"),d=require("react-loading-skeleton"),u=require("lodash/shuffle"),p=require("./useOutsideClick-d17db9ba.js"),h=require("./paths-dab476cc.js"),g=require("@mantine/core"),f=require("./index-9e7ea74e.js"),m=require("./cookieHelper-fd1952df.js"),C=require("./index-6857ac87.js"),b=require("string-format");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function v(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var x=v(t),E=y(t),S=y(i),w=y(n),L=y(d),O=y(u),k=y(b);const I=e=>x.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},e),x.createElement("path",{d:"M7.99969 9.38055L5.45236 6.83322C5.17636 6.55722 4.72836 6.55722 4.45236 6.83322C4.17636 7.10922 4.17636 7.55722 4.45236 7.83322L7.52836 10.9092C7.78903 11.1699 8.21103 11.1699 8.47103 10.9092L11.547 7.83322C11.823 7.55722 11.823 7.10922 11.547 6.83322C11.271 6.55722 10.823 6.55722 10.547 6.83322L7.99969 9.38055Z"}));function T(){const[e,a]=t.useState((()=>{if("undefined"==typeof window)return"unset";if(m.getCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE))return"granted";const e=!location.protocol.includes("https")&&"localhost"!==location.hostname;return!navigator.geolocation||e?"denied":"unset"})),[i,o]=t.useState((()=>{if("undefined"==typeof window)return null;const e=m.getCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE);if(e)try{return JSON.parse(e)}catch(e){console.log(e)}return null})),l=t.useCallback((function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition((e=>{const t={lat:""+Math.round(1e7*e.coords.latitude)/1e7,lng:""+Math.round(1e7*e.coords.longitude)/1e7};m.setCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE,JSON.stringify(t),{minutes:15}),o(t),a("granted")}),(()=>{m.deleteCookie(f.USER_GEOLOCATION_COORDINATES_COOKIE),a("denied")}))}),[]);return t.useMemo((()=>({geoLocationPermission:e,geoLocationCoordinates:i,requestGeoLocation:l})),[e,i])}const j=w.default.div``,M=w.default.div`
2
2
  --searchbar-z-index: 305;
3
3
  &[data-is-modal='true'] {
4
4
  position: fixed;
@@ -705,7 +705,7 @@
705
705
  text-align: center;
706
706
  }
707
707
  }
708
- `,jt=({state:e,isMobile:i,specialties:l,isLoading:n,clientSlug:c="",dispatch:d})=>{const{t:u,locale:p}=a.useTranslations(),{selectedLocation:h}=e,f=t.useMemo((()=>o.LOCALIZED_SLUGS[p]),[p]),m=t.useMemo((()=>l.length>=9||e.searchKeywords.trim().length<=et[e.locale]),[e.searchKeywords,l]);return E.default.createElement(E.default.Fragment,null,!i&&E.default.createElement(It,{color:"#E4E8EC"}),E.default.createElement(Ot,null,l.length>0&&!n&&E.default.createElement(E.default.Fragment,null,l.map(((e,t)=>t>=9?E.default.createElement(E.default.Fragment,null):E.default.createElement(kt,{key:e.id,onClick:()=>(e=>{let t="";t=e===o.SLUG_VACIN_ID&&c?`/${h.slug}/${f.HOSPITAL}/${c}/`:`/${h.slug}/${f.DOCTOR}/${e}`,d({type:at.NavigateTo,payload:t})})(e.slug)},E.default.createElement("div",{className:"image-item"},E.default.createElement("img",{src:e.thumbnail,alt:e.name})),E.default.createElement("div",{className:"infor"},E.default.createElement("div",{className:"title"},e.name)))))),0===l.length&&!n&&E.default.createElement(s.Text,{size:"sm",color:r.theme.colors.gray400},u("booking.searchBar.noResults")),n&&Array(6).fill(void 0).map(((e,t)=>E.default.createElement(kt,{key:"loading"+t},E.default.createElement("div",{className:"image-item"},E.default.createElement(g.Skeleton,{height:40,animate:!0})),E.default.createElement("div",{className:"infor"},E.default.createElement("div",{className:"title"},E.default.createElement(g.Skeleton,{height:20,radius:"sm",animate:!0}))))))),m&&E.default.createElement(Tt,null,E.default.createElement("div",{className:"show-more",onClick:()=>{const e=`/${f.SPECIALTIES}`;d({type:at.NavigateTo,payload:e})}},u("home.seeAll"))))},Mt=w.default.div`
708
+ `,jt=({state:e,isMobile:i,specialties:l,isLoading:n,dispatch:c})=>{const{t:d,locale:u}=a.useTranslations(),{selectedLocation:p}=e,h=t.useMemo((()=>o.LOCALIZED_SLUGS[u]),[u]),f=t.useMemo((()=>l.length>=9||e.searchKeywords.trim().length<=et[e.locale]),[e.searchKeywords,l]);return E.default.createElement(E.default.Fragment,null,!i&&E.default.createElement(It,{color:"#E4E8EC"}),E.default.createElement(Ot,null,l.length>0&&!n&&E.default.createElement(E.default.Fragment,null,l.map(((e,t)=>t>=9?E.default.createElement(E.default.Fragment,null):E.default.createElement(kt,{key:e.id,onClick:()=>(e=>{let t="";t=e===o.SLUG_VACIN_ID?`/${p.slug}/${h.HOSPITAL}/${o.CLIENT_GSK}/`:`/${p.slug}/${h.DOCTOR}/${e}`,c({type:at.NavigateTo,payload:t})})(e.slug)},E.default.createElement("div",{className:"image-item"},E.default.createElement("img",{src:e.thumbnail,alt:e.name})),E.default.createElement("div",{className:"infor"},E.default.createElement("div",{className:"title"},e.name)))))),0===l.length&&!n&&E.default.createElement(s.Text,{size:"sm",color:r.theme.colors.gray400},d("booking.searchBar.noResults")),n&&Array(6).fill(void 0).map(((e,t)=>E.default.createElement(kt,{key:"loading"+t},E.default.createElement("div",{className:"image-item"},E.default.createElement(g.Skeleton,{height:40,animate:!0})),E.default.createElement("div",{className:"infor"},E.default.createElement("div",{className:"title"},E.default.createElement(g.Skeleton,{height:20,radius:"sm",animate:!0}))))))),f&&E.default.createElement(Tt,null,E.default.createElement("div",{className:"show-more",onClick:()=>{const e=`/${h.SPECIALTIES}`;c({type:at.NavigateTo,payload:e})}},d("home.seeAll"))))},Mt=w.default.div`
709
709
  display: flex;
710
710
  gap: 5px;
711
711
  margin-top: 16px;
@@ -756,4 +756,4 @@
756
756
  background: rgba(255, 255, 255, 0.64);
757
757
  backdrop-filter: blur(12px);
758
758
  border-bottom: 1px solid ${r.theme.colors.neutral100};
759
- `,_t=({currentTab:e,hideTabBookingSearch:i=[],isMobile:o,setCurrentTab:l})=>{const{t:n}=a.useTranslations(),s=t.useMemo((()=>({root:{overflowY:o?"hidden":"initial",overflowX:o?"auto":"initial"},tabsList:{background:"rgba(255, 255, 255, 0)",borderBottom:"none",flexWrap:"nowrap",".mantine-Tabs-tab":{"&:last-child":{"&:after":{display:"none"}}}},tab:{padding:o?"12px 16px 12px 16px":"15px 40px 15px 40px",borderTop:"2px solid transparent",borderBottom:"none",margin:0,borderRadius:0,position:"relative",width:"auto",'&[data-active="true"]':{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:after":{display:"none"},"&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:hover":{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:after":{content:'""',width:"1px",height:"24px",backgroundColor:"#E4E8EC",position:"absolute",right:"-1px"}},tabLabel:{color:"#595959",fontSize:o?"14px":"16px",fontWeight:600,lineHeight:o?"22px":"24px"}})),[o]),r=(()=>{const{t:e}=a.useTranslations();return[{value:"hospital",label:e("booking.searchPopup.hospitals")},{value:"doctor",label:e("booking.searchPopup.doctors")},{value:"service",label:e("booking.searchPopup.services")},{value:"specialty",label:e("booking.searchPopup.specialties")}]})(),c=t.useMemo((()=>r.filter((e=>!i.includes(e.value)))||[]),[i,r]);return E.default.createElement(Pt,{className:"booking-search-tab"},E.default.createElement(C.Container,null,E.default.createElement(g.Tabs,{value:e,onTabChange:e=>{l(e)},styles:s},E.default.createElement(g.Tabs.List,null,c.map((e=>E.default.createElement(g.Tabs.Tab,{value:e.value,key:e.value},n(e.label))))))))};var Ft;!function(e){e.doctor="doctor",e.service="hospital_service",e.hospital="hospital_branch"}(Ft||(Ft={}));var $t;!function(e){e[e.SPECIALTY=1]="SPECIALTY",e[e.DOCTOR=2]="DOCTOR",e[e.CLINIC=3]="CLINIC",e[e.SERVICE=4]="SERVICE"}($t||($t={}));var Dt=Object.freeze({__proto__:null,get RedirectType(){return $t}});exports.BookingSearchBar=({isMobile:i,careApiDomain:l,geoLocationPermission:n,geoLocationCoordinates:s,initialSelectedCity:r,initialSearchValue:c="",careFrontDomain:d="/care",isDebug:u=!1,askForGeolocationPermission:p=!1,gaTrackingSearchBar:g,gaTrackingLocationSearch:f,autoCompleteDisabled:m=!1,inputSearchPlaceholder:C="",isOptionAllLocation:b=!1,hideResults:y=[],isNavResultItem:v=!0,routerPush:x,onGeoLocationPermissionChange:w,onSearch:L,onChangeLocation:O})=>{const{t:k,locale:I}=a.useTranslations(),N=t.useRef(null),_=t.useRef(null),[F,$]=t.useState(void 0),[D,B]=t.useState(!1),{geoLocationPermission:V,geoLocationCoordinates:K,requestGeoLocation:H}=T(),[z,G]=t.useReducer(Ce,ge,(e=>Object.assign(Object.assign({},e),{isDebug:u,isMobile:i,geoLocationPermission:n||V||"unset",geoLocationCoordinates:s||K||null,searchKeywords:c,initialSelectedCity:r||null,selectedLocation:r||e.selectedLocation||null,searchLocationKeywords:(null==r?void 0:r.name)||e.searchLocationKeywords,autoCompleteDisabled:m,inputSearchPlaceholder:C,locale:I}))),{navigateTo:U,focused:Q,isLoadingCities:q,cities:Y,searchKeywords:W,geoLocationPermission:J,selectedLocation:X,initialSelectedCity:ee,defaultCity:te,searchResults:ae,isLoadingSearchResults:ie,isMobileModalOpened:oe,inputSearchPlaceholder:le}=z,{fetchCitiesByLocation:se,fetchCitiesByKeyword:re,fetchSearchResults:ce}=function({dispatch:e,careApiDomain:a,locale:i="vi-VN"}){const l=t.useCallback((function(t,o={}){const l=`${a}${t}`;return e({type:fe.FetchCitiesStart}),fetch(Ye(l,o,i),{method:"GET"}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e)))).finally((()=>e({type:fe.FetchCitiesFinish})))}),[i]);return{fetchCitiesByLocation:t.useCallback((function({coordinates:t}){let a={};const o={};t&&(a={lat:t.lat,lng:t.lng}),"ms-MY"===i&&(o.noPaging=1);const n=[l(h.PATHS.GET_CITY_BY_IP,Object.assign(Object.assign({},a),o))];return"zh-TW"===i&&n.push(l(h.PATHS.GET_CITIES_LIST,{noPaging:1})),Promise.all(n).then((([t,a])=>{const i=Object.assign({},t);if(a){const e=i.cities.map((e=>e.id));i.cities=i.cities.concat(a.cities.filter((t=>!e.includes(t.id))))}e({type:fe.FetchCitiesByGeoIpComplete,payload:i})})).catch((e=>console.error("error loading cities by location",e)))}),[i,a,e]),fetchCitiesByKeyword:t.useCallback((function(t){return l(h.PATHS.GET_CITIES_LIST,{keyword:t}).then((t=>{e({type:fe.FetchCitiesByKeywordComplete,payload:t.cities})})).catch((e=>console.error("error loading cities by keyword",e)))}),[i,a,e]),fetchSearchResults:t.useCallback((function(t,l){const n=`${a}${h.PATHS.GET_SEARCH_V2}`;e({type:fe.FetchSearchResultsStart});const{defaultCity:s,selectedLocation:r,geoLocationCoordinates:c}=l;let d="";if(!r||!s)return void e({type:fe.FetchSearchResultsFinish});r.id===o.ID_OPTION_CURRENT_LOCATION?c||(d=s.id):d=r.id===o.ID_OPTION_ALL_LOCATION?"":r.id;const u=(null==c?void 0:c.lat)||"",p=(null==c?void 0:c.lng)||"";return fetch(Ye(n,{domain:a,searchType:"global",keyword:t.trim().length>he[i]?t.trim():"",city:d===o.ID_OPTION_CURRENT_LOCATION?"":d,lat:u,lng:p},i),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>e({type:fe.FetchSearchResultsComplete,payload:t}))).catch((e=>{console.log("error loading search results",{url:n,error:e})})).finally((()=>e({type:fe.FetchSearchResultsFinish})))}),[i,a,e])}}({dispatch:G,locale:I,careApiDomain:l}),de=t.useMemo((()=>{var e;return{id:o.ID_OPTION_CURRENT_LOCATION,name:k("booking.searchBar.currentLocation"),slug:null===(e=o.LOCALIZED_SLUGS[I])||void 0===e?void 0:e.CURRENT}}),[k,I]),ue=t.useMemo((()=>S.default(re,400)),[re]),me=t.useMemo((()=>S.default(ce,400)),[ce]);t.useEffect((()=>{""!==c&&c!==z.searchKeywords&&G({type:fe.UpdateInitialSearchValue,payload:c})}),[c]),t.useEffect((()=>{p&&(null==X?void 0:X.id)===o.ID_OPTION_CURRENT_LOCATION&&"unset"===J&&H()}),[p,X,J]),t.useEffect((()=>{n||J===V||("granted"===V&&K?G({type:fe.GrantGeoLocationPermission,payload:K}):"denied"===V&&G({type:fe.DenyGeoLocationPermission}))}),[J,V,K,n]),t.useEffect((()=>{U&&(x?x(U):window.location.href=`${d}${U}`)}),[U]);const be=t.useCallback((function(){G({type:fe.SelectCurrentLocation,payload:de})}),[k,G]);t.useEffect((()=>{var e;"denied"===J||ee||G({type:fe.SelectLocation,payload:{name:k("booking.searchBar.allLocations"),id:o.ID_OPTION_ALL_LOCATION,slug:null===(e=o.LOCALIZED_SLUGS[I])||void 0===e?void 0:e.ALL}}),w&&w(J,z.geoLocationCoordinates),i&&"granted"===J&&X&&G({type:fe.FocusInputSearch}),se({coordinates:z.geoLocationCoordinates})}),[J]),t.useEffect((()=>{X&&te&&ce(z.searchKeywords,z)}),[X,te]),t.useEffect((()=>{C!==le&&G({type:fe.SetInputSearchPlaceholder,payload:C})}),[C,le]),t.useEffect((()=>{oe?document.body.classList.add("care-popup-open"):document.body.classList.remove("care-popup-open")}),[oe]);const ye=t.useCallback((function(e){"ms-MY"===I&&B(!0),G({type:fe.SelectLocation,payload:e}),"ms-MY"!==I&&Ee(),O&&O(e)}),[k,G]);function ve(){"ms-MY"===I&&B(!0),i&&"granted"!==z.geoLocationPermission?H():(be(),"ms-MY"!==I&&Ee())}function xe(){var e;N.current&&(null===(e=N.current.querySelector('input[name="search-location"]'))||void 0===e||e.focus())}function Ee(){var e;N.current&&(null===(e=N.current.querySelector('input[name="search-results"]'))||void 0===e||e.focus())}function Se(){G({type:fe.CloseMobileModal})}function we(){return"location"!==Q?null:E.default.createElement(Z,{isLoading:q,cities:Y,onLocationClick:ye,onCurrentLocationClick:ve,isLocationLoading:q,geoLocationPermission:J,selectedLocation:X,isOptionAllLocation:b})}function Le(){return"search"!==Q?null:z.autoCompleteDisabled?i?E.default.createElement(Oe,{onClick:()=>{L({cityId:z.selectedLocation.id,keyword:W}),Se()}}):null:E.default.createElement(qe,{data:ae,state:z,dispatch:G,isMobile:!1,keyword:W,isLoading:ie,hideResults:y,isNavResultItem:v})}function Ie(){return E.default.createElement(ke,{isMobile:i,state:z,dispatch:G,debouncedFetchCitiesByKeyword:ue,debouncedFetchSearchResults:me,focusLocationInput:xe,focusSearchInput:Ee,renderLocationResults:we,renderSearchResults:Le,trackingAttributes:g,locationTrackingAttributes:f,onSearch:L,initalSearchValue:c})}return t.useEffect((()=>{if(window.visualViewport){const e=e=>{const t=e.target;$(null==t?void 0:t.height)};return window.visualViewport.addEventListener("resize",e,{passive:!0}),()=>{window.visualViewport.removeEventListener("resize",e)}}}),[$]),t.useEffect((()=>{if(X&&D&&"ms-MY"===I){const e=`/${X.slug}/hospital`;G({type:fe.NavigateTo,payload:e}),B(!1)}}),[D,I,X]),i?E.default.createElement(E.default.Fragment,null,E.default.createElement(P,null),E.default.createElement(A,{ref:_}),E.default.createElement(M,{id:"booking-search-bar",ref:N,"data-is-modal":i&&oe,style:{"--mobile-care-searchbar-height":oe&&F?`${F}px`:"100%"}},oe?E.default.createElement(E.default.Fragment,null,E.default.createElement(R,null,E.default.createElement(pe,{headingText:k("booking.searchBar.searchButton"),onLeftClick:Se}),Ie()),we(),Le()):E.default.createElement(ne,{onClick:function(){var t;return e.__awaiter(this,void 0,void 0,(function*(){_.current&&_.current.focus(),G({type:fe.OpenMobileModal}),yield Promise.resolve(),N.current&&(null===(t=N.current.querySelector('input[name="search-location"]'))||void 0===t||t.focus())}))},focused:Q,value:W,trackingAttributes:g,inputSearchPlaceholder:C}))):E.default.createElement(j,{id:"booking-search-bar",ref:N},Ie())},exports.BookingSearchBarV2=({isMobile:e,careApiDomain:i,geoLocationPermission:l,geoLocationCoordinates:n,initialSelectedCity:s,initialSearchValue:r="",initTypeSearch:c="hospital",initSpecialty:d,careFrontDomain:u="/care",isDebug:f=!1,gaTrackingSearchBar:m,gaTrackingLocationSearch:C,autoCompleteDisabled:b=!1,inputSearchPlaceholder:y="",hideTabBookingSearch:v=[],hideSpecialtySelection:x=!1,hidePopularSearchKeys:w=!1,clientSlug:L="",routerPush:O,onGeoLocationPermissionChange:k,onChangeLocation:I})=>{const{locale:j,t:M}=a.useTranslations(),R=t.useRef(null),A=t.useRef(null),[N,P]=t.useState(c),{geoLocationPermission:_,geoLocationCoordinates:F}=T(),[$,D]=t.useReducer(ot,tt,(t=>Object.assign(Object.assign({},t),{isDebug:f,isMobile:e,geoLocationPermission:l||_||"unset",geoLocationCoordinates:n||F||null,searchKeywords:r,initialSelectedCity:s||null,selectedLocation:s||t.selectedLocation||null,searchLocationKeywords:(null==s?void 0:s.name)||t.searchLocationKeywords,autoCompleteDisabled:b,inputSearchPlaceholder:y,locale:j}))),{navigateTo:B,focusedSpecialty:V,searchKeywords:K,geoLocationPermission:H,selectedLocation:z,selectedSpecialty:G,initialSelectedCity:Z,searchResults:U,isLoadingSearchResults:Q}=$,{fetchCitiesByLocation:q,fetchCitiesByKeyword:Y,fetchSearchResults:W,fetchAllSpecialties:J,fetchPopularKeys:X}=function({dispatch:e,careApiDomain:a,locale:i="vi-VN"}){const l=t.useCallback((function(t,o={}){const l=`${a}${t}`;return e({type:at.FetchCitiesStart}),fetch(Ye(l,o,i),{method:"GET"}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e)))).finally((()=>e({type:at.FetchCitiesFinish})))}),[i]);return{fetchCitiesByLocation:t.useCallback((function({coordinates:t}){let a={};const o={};t&&(a={lat:t.lat,lng:t.lng}),"ms-MY"===i&&(o.noPaging=1);const n=[l(h.PATHS.GET_CITY_BY_IP,Object.assign(Object.assign({},a),o))];return"zh-TW"===i&&n.push(l(h.PATHS.GET_CITIES_LIST,{noPaging:1})),Promise.all(n).then((([t,a])=>{const i=Object.assign({},t);if(a){const e=i.cities.map((e=>e.id));i.cities=i.cities.concat(a.cities.filter((t=>!e.includes(t.id))))}e({type:at.FetchCitiesByGeoIpComplete,payload:i})})).catch((e=>console.error("error loading cities by location",e)))}),[i,a,e]),fetchCitiesByKeyword:t.useCallback((function(t){return l(h.PATHS.GET_CITIES_LIST,{keyword:t}).then((t=>{e({type:at.FetchCitiesByKeywordComplete,payload:t.cities})})).catch((e=>console.error("error loading cities by keyword",e)))}),[i,a,e]),fetchSearchResults:t.useCallback((function(t,l,n,s,r){const c="specialty"===n?`${a}${h.PATHS.GET_SEARCH_SPECIALTY}`:`${a}${h.PATHS.GET_SEARCH_V2}`;e({type:at.FetchSearchResultsStart});const{selectedLocation:d,geoLocationCoordinates:u,selectedSpecialty:p}=l;let g="";if(!d)return void e({type:at.FetchSearchResultsFinish});g=d.id===o.ID_OPTION_ALL_LOCATION?"":d.id;const f=(null==u?void 0:u.lat)||"",m=(null==u?void 0:u.lng)||"",C=(null==p?void 0:p.id)>0?null==p?void 0:p.id:"",b=t.trim().length>et[i]?t.trim():"";return fetch(Ye(c,{domain:a,searchType:n||"global",keyword:b,city:g===o.ID_OPTION_CURRENT_LOCATION?"":g,lat:f,lng:m,specialty_id:C,client_slug:s},i),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>{let a=[];"specialty"!==n&&(a=t.searches),"specialty"===n&&(a=b?t.specialties:t.default),e({type:at.FetchSearchResultsComplete,payload:{key:n,searches:a||[]}}),r&&e({type:at.UpdateInitialSearchResults,payload:{key:n,searches:a||[]}})})).catch((e=>{console.log("error loading search results",{url:c,error:e})})).finally((()=>e({type:at.FetchSearchResultsFinish})))}),[i,a,e]),fetchAllSpecialties:t.useCallback((function(){const t=`${a}${h.PATHS.GET_SEARCH_SPECIALTY}`;return fetch(Ye(t,{domain:a,searchType:""},i),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>{e({type:at.FetchAllSpecialties,payload:t.specialties||[]})})).catch((e=>{console.log("error loading search results",{url:t,error:e})}))}),[i,a,e]),fetchPopularKeys:t.useCallback((function(t){const o=`${a}${h.PATHS.GET_SEARCH_POPULAR_KEY}`;return fetch(Ye(o,{domain:a,searchType:Ft[t],sort_by:"display_order",sort_order:"asc"},i)).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>{e({type:at.FetchPopularKeys,payload:t.popular_searches||[]})})).catch((e=>{console.log("error loading search results",{url:o,error:e})}))}),[i,a,e])}}({dispatch:D,locale:j,careApiDomain:i}),ee=t.useMemo((()=>o.LOCALIZED_SLUGS[j]),[j]),te=t.useMemo((()=>({doctor:{name:M("booking.searchPopup.doctors"),icon:E.default.createElement(ft,null),slug:ee.DOCTOR},service:{name:M("booking.searchPopup.services"),icon:E.default.createElement(mt,null),slug:ee.SERVICE},hospital:{name:M("booking.searchPopup.hospitals"),icon:E.default.createElement(Ct,null),slug:ee.HOSPITAL},specialty:{name:M("booking.searchPopup.specialties"),icon:E.default.createElement(bt,null),slug:ee.SPECIALTIES}})),[N]),ae=t.useMemo((()=>S.default(Y,400)),[Y]),ie=t.useMemo((()=>S.default(W,400)),[W]),oe=t.useCallback((function(e){D({type:at.SelectLocation,payload:e}),le(),I&&I(e)}),[M,D]);function le(){var e;R.current&&(null===(e=R.current.querySelector('input[name="search-results"]'))||void 0===e||e.focus())}return p.useOutsideClick(A,(()=>{D({type:at.ClickOutsideInputSearchSpecialty})})),t.useEffect((()=>{var t;"denied"===H||Z||D({type:at.SelectLocation,payload:{name:M("booking.searchBar.allLocations"),id:o.ID_OPTION_ALL_LOCATION,slug:null===(t=o.LOCALIZED_SLUGS[j])||void 0===t?void 0:t.ALL}}),k&&k(H,$.geoLocationCoordinates),e&&"granted"===H&&z&&D({type:at.FocusInputSearch}),q({coordinates:$.geoLocationCoordinates})}),[H]),t.useEffect((()=>{const e=d||{name:M("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:ee.SPECIALTIES};$.selectedSpecialty||D({type:at.SelectSpecialty,payload:e})}),[d,$.selectedSpecialty]),t.useEffect((()=>{J()}),[]),t.useEffect((()=>{X(N)}),[N]),t.useEffect((()=>{B&&(O?O(B):window.location.href=`${u}${B}`)}),[B]),t.useEffect((()=>{W($.searchKeywords,$,N,L,!0)}),[z,G,N]),E.default.createElement(We,{ref:R},E.default.createElement(_t,{currentTab:N,setCurrentTab:P,isMobile:e,hideTabBookingSearch:v}),E.default.createElement(Je,{className:"booking-search-container"},E.default.createElement(Xe,null,E.default.createElement("div",{ref:A},E.default.createElement(g.Flex,{gap:"12px",justify:"space-between",align:"center",direction:e?"column":"row",className:"flex-search-input"},"specialty"!==N&&E.default.createElement(Lt,{state:$,isMobile:e,dispatch:D,debouncedFetchCitiesByKeyword:ae,selectedLocation:z,onLocationClick:oe,trackingAttributes:C}),E.default.createElement(vt,{type:N,isMobile:e,state:$,dispatch:D,debouncedFetchSearchResults:ie,initalSearchValue:r,focusSearchInput:le,typeInformation:te,trackingAttributes:m,isLoading:Q,hideSpecialtySelection:x,clientSlug:L}),E.default.createElement(g.Button,{size:e?"md":"lg",fullWidth:e,onClick:function(){let e="";const{slug:t}=te[N];let a="";("doctor"===N||"hospital"===N)&&$.selectedSpecialty.id>0&&(a=`&specialtyId=${$.selectedSpecialty.id}`),e="specialty"===N?`/${t}`:`/${z.slug}/${t}`,L===o.CLIENT_GSK&&(e+=`/${L}`),e+=`?q=${K}${a}`,e&&D({type:at.NavigateTo,payload:e})},styles:{root:{height:e?"40px":"48px"}}},M("booking.searchBar.searchButton"))),!w&&"specialty"!==N&&$.popularKeys.length>0&&E.default.createElement(Nt,{type:N,state:$,typeInformation:te,dispatch:D}),"specialty"===N&&"search"===V&&E.default.createElement(jt,{state:$,isMobile:e,dispatch:D,specialties:(null==U?void 0:U.specialty)||[],isLoading:Q,clientSlug:L})))))},exports.ChevronDown=I,exports.types=Dt;
759
+ `,_t=({currentTab:e,hideTabBookingSearch:i=[],isMobile:o,setCurrentTab:l})=>{const{t:n}=a.useTranslations(),s=t.useMemo((()=>({root:{overflowY:o?"hidden":"initial",overflowX:o?"auto":"initial"},tabsList:{background:"rgba(255, 255, 255, 0)",borderBottom:"none",flexWrap:"nowrap",".mantine-Tabs-tab":{"&:last-child":{"&:after":{display:"none"}}}},tab:{padding:o?"12px 16px 12px 16px":"15px 40px 15px 40px",borderTop:"2px solid transparent",borderBottom:"none",margin:0,borderRadius:0,position:"relative",width:"auto",'&[data-active="true"]':{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:after":{display:"none"},"&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:hover":{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:after":{content:'""',width:"1px",height:"24px",backgroundColor:"#E4E8EC",position:"absolute",right:"-1px"}},tabLabel:{color:"#595959",fontSize:o?"14px":"16px",fontWeight:600,lineHeight:o?"22px":"24px"}})),[o]),r=(()=>{const{t:e}=a.useTranslations();return[{value:"hospital",label:e("booking.searchPopup.hospitals")},{value:"doctor",label:e("booking.searchPopup.doctors")},{value:"service",label:e("booking.searchPopup.services")},{value:"specialty",label:e("booking.searchPopup.specialties")}]})(),c=t.useMemo((()=>r.filter((e=>!i.includes(e.value)))||[]),[i,r]);return E.default.createElement(Pt,{className:"booking-search-tab"},E.default.createElement(C.Container,null,E.default.createElement(g.Tabs,{value:e,onTabChange:e=>{l(e)},styles:s},E.default.createElement(g.Tabs.List,null,c.map((e=>E.default.createElement(g.Tabs.Tab,{value:e.value,key:e.value},n(e.label))))))))};var Ft;!function(e){e.doctor="doctor",e.service="hospital_service",e.hospital="hospital_branch"}(Ft||(Ft={}));var $t;!function(e){e[e.SPECIALTY=1]="SPECIALTY",e[e.DOCTOR=2]="DOCTOR",e[e.CLINIC=3]="CLINIC",e[e.SERVICE=4]="SERVICE"}($t||($t={}));var Dt=Object.freeze({__proto__:null,get RedirectType(){return $t}});exports.BookingSearchBar=({isMobile:i,careApiDomain:l,geoLocationPermission:n,geoLocationCoordinates:s,initialSelectedCity:r,initialSearchValue:c="",careFrontDomain:d="/care",isDebug:u=!1,askForGeolocationPermission:p=!1,gaTrackingSearchBar:g,gaTrackingLocationSearch:f,autoCompleteDisabled:m=!1,inputSearchPlaceholder:C="",isOptionAllLocation:b=!1,hideResults:y=[],isNavResultItem:v=!0,routerPush:x,onGeoLocationPermissionChange:w,onSearch:L,onChangeLocation:O})=>{const{t:k,locale:I}=a.useTranslations(),N=t.useRef(null),_=t.useRef(null),[F,$]=t.useState(void 0),[D,B]=t.useState(!1),{geoLocationPermission:V,geoLocationCoordinates:K,requestGeoLocation:H}=T(),[z,G]=t.useReducer(Ce,ge,(e=>Object.assign(Object.assign({},e),{isDebug:u,isMobile:i,geoLocationPermission:n||V||"unset",geoLocationCoordinates:s||K||null,searchKeywords:c,initialSelectedCity:r||null,selectedLocation:r||e.selectedLocation||null,searchLocationKeywords:(null==r?void 0:r.name)||e.searchLocationKeywords,autoCompleteDisabled:m,inputSearchPlaceholder:C,locale:I}))),{navigateTo:U,focused:Q,isLoadingCities:q,cities:Y,searchKeywords:W,geoLocationPermission:J,selectedLocation:X,initialSelectedCity:ee,defaultCity:te,searchResults:ae,isLoadingSearchResults:ie,isMobileModalOpened:oe,inputSearchPlaceholder:le}=z,{fetchCitiesByLocation:se,fetchCitiesByKeyword:re,fetchSearchResults:ce}=function({dispatch:e,careApiDomain:a,locale:i="vi-VN"}){const l=t.useCallback((function(t,o={}){const l=`${a}${t}`;return e({type:fe.FetchCitiesStart}),fetch(Ye(l,o,i),{method:"GET"}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e)))).finally((()=>e({type:fe.FetchCitiesFinish})))}),[i]);return{fetchCitiesByLocation:t.useCallback((function({coordinates:t}){let a={};const o={};t&&(a={lat:t.lat,lng:t.lng}),"ms-MY"===i&&(o.noPaging=1);const n=[l(h.PATHS.GET_CITY_BY_IP,Object.assign(Object.assign({},a),o))];return"zh-TW"===i&&n.push(l(h.PATHS.GET_CITIES_LIST,{noPaging:1})),Promise.all(n).then((([t,a])=>{const i=Object.assign({},t);if(a){const e=i.cities.map((e=>e.id));i.cities=i.cities.concat(a.cities.filter((t=>!e.includes(t.id))))}e({type:fe.FetchCitiesByGeoIpComplete,payload:i})})).catch((e=>console.error("error loading cities by location",e)))}),[i,a,e]),fetchCitiesByKeyword:t.useCallback((function(t){return l(h.PATHS.GET_CITIES_LIST,{keyword:t}).then((t=>{e({type:fe.FetchCitiesByKeywordComplete,payload:t.cities})})).catch((e=>console.error("error loading cities by keyword",e)))}),[i,a,e]),fetchSearchResults:t.useCallback((function(t,l){const n=`${a}${h.PATHS.GET_SEARCH_V2}`;e({type:fe.FetchSearchResultsStart});const{defaultCity:s,selectedLocation:r,geoLocationCoordinates:c}=l;let d="";if(!r||!s)return void e({type:fe.FetchSearchResultsFinish});r.id===o.ID_OPTION_CURRENT_LOCATION?c||(d=s.id):d=r.id===o.ID_OPTION_ALL_LOCATION?"":r.id;const u=(null==c?void 0:c.lat)||"",p=(null==c?void 0:c.lng)||"";return fetch(Ye(n,{domain:a,searchType:"global",keyword:t.trim().length>he[i]?t.trim():"",city:d===o.ID_OPTION_CURRENT_LOCATION?"":d,lat:u,lng:p},i),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>e({type:fe.FetchSearchResultsComplete,payload:t}))).catch((e=>{console.log("error loading search results",{url:n,error:e})})).finally((()=>e({type:fe.FetchSearchResultsFinish})))}),[i,a,e])}}({dispatch:G,locale:I,careApiDomain:l}),de=t.useMemo((()=>{var e;return{id:o.ID_OPTION_CURRENT_LOCATION,name:k("booking.searchBar.currentLocation"),slug:null===(e=o.LOCALIZED_SLUGS[I])||void 0===e?void 0:e.CURRENT}}),[k,I]),ue=t.useMemo((()=>S.default(re,400)),[re]),me=t.useMemo((()=>S.default(ce,400)),[ce]);t.useEffect((()=>{""!==c&&c!==z.searchKeywords&&G({type:fe.UpdateInitialSearchValue,payload:c})}),[c]),t.useEffect((()=>{p&&(null==X?void 0:X.id)===o.ID_OPTION_CURRENT_LOCATION&&"unset"===J&&H()}),[p,X,J]),t.useEffect((()=>{n||J===V||("granted"===V&&K?G({type:fe.GrantGeoLocationPermission,payload:K}):"denied"===V&&G({type:fe.DenyGeoLocationPermission}))}),[J,V,K,n]),t.useEffect((()=>{U&&(x?x(U):window.location.href=`${d}${U}`)}),[U]);const be=t.useCallback((function(){G({type:fe.SelectCurrentLocation,payload:de})}),[k,G]);t.useEffect((()=>{var e;"denied"===J||ee||G({type:fe.SelectLocation,payload:{name:k("booking.searchBar.allLocations"),id:o.ID_OPTION_ALL_LOCATION,slug:null===(e=o.LOCALIZED_SLUGS[I])||void 0===e?void 0:e.ALL}}),w&&w(J,z.geoLocationCoordinates),i&&"granted"===J&&X&&G({type:fe.FocusInputSearch}),se({coordinates:z.geoLocationCoordinates})}),[J]),t.useEffect((()=>{X&&te&&ce(z.searchKeywords,z)}),[X,te]),t.useEffect((()=>{C!==le&&G({type:fe.SetInputSearchPlaceholder,payload:C})}),[C,le]),t.useEffect((()=>{oe?document.body.classList.add("care-popup-open"):document.body.classList.remove("care-popup-open")}),[oe]);const ye=t.useCallback((function(e){"ms-MY"===I&&B(!0),G({type:fe.SelectLocation,payload:e}),"ms-MY"!==I&&Ee(),O&&O(e)}),[k,G]);function ve(){"ms-MY"===I&&B(!0),i&&"granted"!==z.geoLocationPermission?H():(be(),"ms-MY"!==I&&Ee())}function xe(){var e;N.current&&(null===(e=N.current.querySelector('input[name="search-location"]'))||void 0===e||e.focus())}function Ee(){var e;N.current&&(null===(e=N.current.querySelector('input[name="search-results"]'))||void 0===e||e.focus())}function Se(){G({type:fe.CloseMobileModal})}function we(){return"location"!==Q?null:E.default.createElement(Z,{isLoading:q,cities:Y,onLocationClick:ye,onCurrentLocationClick:ve,isLocationLoading:q,geoLocationPermission:J,selectedLocation:X,isOptionAllLocation:b})}function Le(){return"search"!==Q?null:z.autoCompleteDisabled?i?E.default.createElement(Oe,{onClick:()=>{L({cityId:z.selectedLocation.id,keyword:W}),Se()}}):null:E.default.createElement(qe,{data:ae,state:z,dispatch:G,isMobile:!1,keyword:W,isLoading:ie,hideResults:y,isNavResultItem:v})}function Ie(){return E.default.createElement(ke,{isMobile:i,state:z,dispatch:G,debouncedFetchCitiesByKeyword:ue,debouncedFetchSearchResults:me,focusLocationInput:xe,focusSearchInput:Ee,renderLocationResults:we,renderSearchResults:Le,trackingAttributes:g,locationTrackingAttributes:f,onSearch:L,initalSearchValue:c})}return t.useEffect((()=>{if(window.visualViewport){const e=e=>{const t=e.target;$(null==t?void 0:t.height)};return window.visualViewport.addEventListener("resize",e,{passive:!0}),()=>{window.visualViewport.removeEventListener("resize",e)}}}),[$]),t.useEffect((()=>{if(X&&D&&"ms-MY"===I){const e=`/${X.slug}/hospital`;G({type:fe.NavigateTo,payload:e}),B(!1)}}),[D,I,X]),i?E.default.createElement(E.default.Fragment,null,E.default.createElement(P,null),E.default.createElement(A,{ref:_}),E.default.createElement(M,{id:"booking-search-bar",ref:N,"data-is-modal":i&&oe,style:{"--mobile-care-searchbar-height":oe&&F?`${F}px`:"100%"}},oe?E.default.createElement(E.default.Fragment,null,E.default.createElement(R,null,E.default.createElement(pe,{headingText:k("booking.searchBar.searchButton"),onLeftClick:Se}),Ie()),we(),Le()):E.default.createElement(ne,{onClick:function(){var t;return e.__awaiter(this,void 0,void 0,(function*(){_.current&&_.current.focus(),G({type:fe.OpenMobileModal}),yield Promise.resolve(),N.current&&(null===(t=N.current.querySelector('input[name="search-location"]'))||void 0===t||t.focus())}))},focused:Q,value:W,trackingAttributes:g,inputSearchPlaceholder:C}))):E.default.createElement(j,{id:"booking-search-bar",ref:N},Ie())},exports.BookingSearchBarV2=({isMobile:e,careApiDomain:i,geoLocationPermission:l,geoLocationCoordinates:n,initialSelectedCity:s,initialSearchValue:r="",initTypeSearch:c="hospital",initSpecialty:d,careFrontDomain:u="/care",isDebug:f=!1,gaTrackingSearchBar:m,gaTrackingLocationSearch:C,autoCompleteDisabled:b=!1,inputSearchPlaceholder:y="",hideTabBookingSearch:v=[],hideSpecialtySelection:x=!1,hidePopularSearchKeys:w=!1,clientSlug:L="",routerPush:O,onGeoLocationPermissionChange:k,onChangeLocation:I})=>{const{locale:j,t:M}=a.useTranslations(),R=t.useRef(null),A=t.useRef(null),[N,P]=t.useState(c),{geoLocationPermission:_,geoLocationCoordinates:F}=T(),[$,D]=t.useReducer(ot,tt,(t=>Object.assign(Object.assign({},t),{isDebug:f,isMobile:e,geoLocationPermission:l||_||"unset",geoLocationCoordinates:n||F||null,searchKeywords:r,initialSelectedCity:s||null,selectedLocation:s||t.selectedLocation||null,searchLocationKeywords:(null==s?void 0:s.name)||t.searchLocationKeywords,autoCompleteDisabled:b,inputSearchPlaceholder:y,locale:j}))),{navigateTo:B,focusedSpecialty:V,searchKeywords:K,geoLocationPermission:H,selectedLocation:z,selectedSpecialty:G,initialSelectedCity:Z,searchResults:U,isLoadingSearchResults:Q}=$,{fetchCitiesByLocation:q,fetchCitiesByKeyword:Y,fetchSearchResults:W,fetchAllSpecialties:J,fetchPopularKeys:X}=function({dispatch:e,careApiDomain:a,locale:i="vi-VN",client:l=""}){const n=t.useCallback((function(t,o={}){const l=`${a}${t}`;return e({type:at.FetchCitiesStart}),fetch(Ye(l,o,i),{method:"GET"}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e)))).finally((()=>e({type:at.FetchCitiesFinish})))}),[i]);return{fetchCitiesByLocation:t.useCallback((function({coordinates:t}){let a={};const o={};t&&(a={lat:t.lat,lng:t.lng}),"ms-MY"===i&&(o.noPaging=1);const s=[n(h.PATHS.GET_CITY_BY_IP,Object.assign(Object.assign(Object.assign({},a),o),{client:l}))];return"zh-TW"===i&&s.push(n(h.PATHS.GET_CITIES_LIST,{noPaging:1,client:l})),Promise.all(s).then((([t,a])=>{const i=Object.assign({},t);if(a){const e=i.cities.map((e=>e.id));i.cities=i.cities.concat(a.cities.filter((t=>!e.includes(t.id))))}e({type:at.FetchCitiesByGeoIpComplete,payload:i})})).catch((e=>console.error("error loading cities by location",e)))}),[i,a,e]),fetchCitiesByKeyword:t.useCallback((function(t){return n(h.PATHS.GET_CITIES_LIST,{keyword:t,client:l}).then((t=>{e({type:at.FetchCitiesByKeywordComplete,payload:t.cities})})).catch((e=>console.error("error loading cities by keyword",e)))}),[i,a,e]),fetchSearchResults:t.useCallback((function(t,l,n,s,r){const c="specialty"===n?`${a}${h.PATHS.GET_SEARCH_SPECIALTY}`:`${a}${h.PATHS.GET_SEARCH_V2}`;e({type:at.FetchSearchResultsStart});const{selectedLocation:d,geoLocationCoordinates:u,selectedSpecialty:p}=l;let g="";if(!d)return void e({type:at.FetchSearchResultsFinish});g=d.id===o.ID_OPTION_ALL_LOCATION?"":d.id;const f=(null==u?void 0:u.lat)||"",m=(null==u?void 0:u.lng)||"",C=(null==p?void 0:p.id)>0?null==p?void 0:p.id:"",b=t.trim().length>et[i]?t.trim():"";return fetch(Ye(c,{domain:a,searchType:n||"global",keyword:b,city:g===o.ID_OPTION_CURRENT_LOCATION?"":g,lat:f,lng:m,specialty_id:C,client_slug:s},i),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>{let a=[];"specialty"!==n&&(a=t.searches),"specialty"===n&&(a=b?t.specialties:t.default),e({type:at.FetchSearchResultsComplete,payload:{key:n,searches:a||[]}}),r&&e({type:at.UpdateInitialSearchResults,payload:{key:n,searches:a||[]}})})).catch((e=>{console.log("error loading search results",{url:c,error:e})})).finally((()=>e({type:at.FetchSearchResultsFinish})))}),[i,a,e]),fetchAllSpecialties:t.useCallback((function(){const t=`${a}${h.PATHS.GET_SEARCH_SPECIALTY}`;return fetch(Ye(t,{domain:a,searchType:""},i),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>{e({type:at.FetchAllSpecialties,payload:t.specialties||[]})})).catch((e=>{console.log("error loading search results",{url:t,error:e})}))}),[i,a,e]),fetchPopularKeys:t.useCallback((function(t){const o=`${a}${h.PATHS.GET_SEARCH_POPULAR_KEY}`;return fetch(Ye(o,{domain:a,searchType:Ft[t],sort_by:"display_order",sort_order:"asc"},i)).then((e=>e.json())).then((e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e))).then((t=>{e({type:at.FetchPopularKeys,payload:t.popular_searches||[]})})).catch((e=>{console.log("error loading search results",{url:o,error:e})}))}),[i,a,e])}}({dispatch:D,locale:j,careApiDomain:i,client:L}),ee=t.useMemo((()=>o.LOCALIZED_SLUGS[j]),[j]),te=t.useMemo((()=>({doctor:{name:M("booking.searchPopup.doctors"),icon:E.default.createElement(ft,null),slug:ee.DOCTOR},service:{name:M("booking.searchPopup.services"),icon:E.default.createElement(mt,null),slug:ee.SERVICE},hospital:{name:M("booking.searchPopup.hospitals"),icon:E.default.createElement(Ct,null),slug:ee.HOSPITAL},specialty:{name:M("booking.searchPopup.specialties"),icon:E.default.createElement(bt,null),slug:ee.SPECIALTIES}})),[N]),ae=t.useMemo((()=>S.default(Y,400)),[Y]),ie=t.useMemo((()=>S.default(W,400)),[W]),oe=t.useCallback((function(e){D({type:at.SelectLocation,payload:e}),le(),I&&I(e)}),[M,D]);function le(){var e;R.current&&(null===(e=R.current.querySelector('input[name="search-results"]'))||void 0===e||e.focus())}return p.useOutsideClick(A,(()=>{D({type:at.ClickOutsideInputSearchSpecialty})})),t.useEffect((()=>{var t;"denied"===H||Z||D({type:at.SelectLocation,payload:{name:M("booking.searchBar.allLocations"),id:o.ID_OPTION_ALL_LOCATION,slug:null===(t=o.LOCALIZED_SLUGS[j])||void 0===t?void 0:t.ALL}}),k&&k(H,$.geoLocationCoordinates),e&&"granted"===H&&z&&D({type:at.FocusInputSearch}),q({coordinates:$.geoLocationCoordinates})}),[H]),t.useEffect((()=>{const e=d||{name:M("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:ee.SPECIALTIES};$.selectedSpecialty||D({type:at.SelectSpecialty,payload:e})}),[d,$.selectedSpecialty]),t.useEffect((()=>{J()}),[]),t.useEffect((()=>{X(N)}),[N]),t.useEffect((()=>{B&&(O?O(B):window.location.href=`${u}${B}`)}),[B]),t.useEffect((()=>{W($.searchKeywords,$,N,L,!0)}),[z,G,N]),E.default.createElement(We,{ref:R},E.default.createElement(_t,{currentTab:N,setCurrentTab:P,isMobile:e,hideTabBookingSearch:v}),E.default.createElement(Je,{className:"booking-search-container"},E.default.createElement(Xe,null,E.default.createElement("div",{ref:A},E.default.createElement(g.Flex,{gap:"12px",justify:"space-between",align:"center",direction:e?"column":"row",className:"flex-search-input"},"specialty"!==N&&E.default.createElement(Lt,{state:$,isMobile:e,dispatch:D,debouncedFetchCitiesByKeyword:ae,selectedLocation:z,onLocationClick:oe,trackingAttributes:C}),E.default.createElement(vt,{type:N,isMobile:e,state:$,dispatch:D,debouncedFetchSearchResults:ie,initalSearchValue:r,focusSearchInput:le,typeInformation:te,trackingAttributes:m,isLoading:Q,hideSpecialtySelection:x,clientSlug:L}),E.default.createElement(g.Button,{size:e?"md":"lg",fullWidth:e,onClick:function(){let e="";const{slug:t}=te[N];let a="";("doctor"===N||"hospital"===N)&&$.selectedSpecialty.id>0&&(a=`&specialtyId=${$.selectedSpecialty.id}`),e="specialty"===N?`/${t}`:`/${z.slug}/${t}`,L===o.CLIENT_GSK&&(e+=`/${L}`),e+=`?q=${K}${a}`,e&&D({type:at.NavigateTo,payload:e})},styles:{root:{height:e?"40px":"48px"}}},M("booking.searchBar.searchButton"))),!w&&"specialty"!==N&&$.popularKeys.length>0&&E.default.createElement(Nt,{type:N,state:$,typeInformation:te,dispatch:D}),"specialty"===N&&"search"===V&&E.default.createElement(jt,{state:$,isMobile:e,dispatch:D,specialties:(null==U?void 0:U.specialty)||[],isLoading:Q})))))},exports.ChevronDown=I,exports.types=Dt;
@@ -1 +1 @@
1
- "use strict";var e=require("./tslib.es6-08feefec.js"),t=require("react"),a=require("@mantine/core"),l=require("./index-14990842.js"),o=require("./useTranslations-95f60387.js"),n=require("innertext"),i=require("./theme-3bfd2865.js"),r=require("./index-5bd3a060.js"),s=require("./index.styles-2478c244.js");require("@mantine/dates");var d=require("./index-48ef1926.js");require("./Onboarding-ff5a2403.js");var c=require("./gAssets.js");require("dayjs");var u=require("./screenSizeContext-8433c0f1.js");require("styled-components"),require("./isProduction-b744d6db.js");var m=require("./index-649bbfe6.js");require("@mantine/hooks");var p=require("./index-bd55921e.js"),v=require("./index.styled-493521e6.js"),g=require("./index-cc07b195.js"),f=require("./index-b4d93c49.js"),h=require("lodash/debounce"),y=require("react-contenteditable");require("./useCategory-29b94a26.js");var C=require("./index-3be2930e.js"),E=require("react-dom");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function k(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var l=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,l.get?l:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}require("date-fns"),require("react-day-picker/DayPickerInput"),require("./index-25a06b31.js"),require("lodash/throttle"),require("./types-47237479.js"),require("react-hook-form"),require("date-fns/locale/en-US"),require("date-fns/locale/id"),require("date-fns/locale/vi"),require("date-fns/locale/zh-TW"),require("./index.styled-8fb7e77d.js"),require("uuid"),require("./utils-676840ec.js"),require("string-format");var b=w(t),P=w(n),T=w(h),S=w(y),x=k(E);const N=({title:o,url:n,image:i,logo:r,className:d,style:c,noRefetch:u})=>{const{data:{locale:m,env:{isMarryBaby:p}}}=t.useContext(s.TogetherComponentGlobalContext),[v,f]=t.useState(!1),h=a.useMantineTheme(),y=t.useRef(u);y.current=u;const[C,E]=t.useState(null);t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){if(!y.current){if(!n)return E(null);E((e=>Object.assign(Object.assign({},e),{isFetching:!0}))),s.callApi(s.getApiPath(s.PATHS.FETCH_PREVIEW,{_locale:m}),"POST",{data:{link:n},headers:{"Content-Type":"application/json"}}).then((e=>{var t,a,l;f(!1),E({title:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.title,url:n,image:(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.image)||(null===(l=null==e?void 0:e.data)||void 0===l?void 0:l.logo)})})).catch((()=>{E(null)}))}}))}),[n]);const w=(null==C?void 0:C.image)||i,k=(null==C?void 0:C.title)||o,P=(null==C?void 0:C.logo)||r,T=(null==C?void 0:C.url)||n,S=T.replace("http://","").replace("https://","").split(/[/?#]/)[0],x=t.useRef(!1);return b.default.createElement(l.StyledCardLink,{"data-is-marrybaby":p,className:`${d} no-replace-click`,style:c,color:h.colors[h.primaryColor][0]},b.default.createElement("a",{href:T,target:"_blank",rel:"noreferrer"},w&&b.default.createElement("div",{className:"link-image-wrapper"},!p&&b.default.createElement("img",{className:"link-image-blur",src:w,onError:e=>{x.current||(x.current=!0,e.currentTarget.src=s.DEFAULT_IMG)},loading:"lazy"}),b.default.createElement("img",{className:"link-image",src:w,onError:e=>{x.current||(x.current=!0,e.currentTarget.src=s.DEFAULT_IMG)},loading:"lazy"})),b.default.createElement("div",{className:"link-info-container"},b.default.createElement(g.Text,{size:"n1"},p&&P&&!v&&b.default.createElement("img",{className:"link-logo",src:P,onError:()=>f(!0),loading:"lazy"}),S),b.default.createElement(s.Heading,{tag:"h6"},k))))};const A=({onClick:e,color:a,className:n,style:i})=>{const{data:{env:{isMarryBaby:r}}}=t.useContext(s.TogetherComponentGlobalContext),{t:d}=o.useTranslations();return b.default.createElement(l.LabelSortPin,{label:b.default.createElement(b.default.Fragment,null,r&&b.default.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M3.5 19.9999L7.87 15.6299' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.95634 11.294C4.56534 11.685 4.56534 12.318 4.95634 12.708L7.87434 15.626L10.7923 18.544C11.1833 18.935 11.8163 18.935 12.2063 18.544L13.3813 17.369C13.5693 17.181 13.6743 16.927 13.6743 16.662V12.726L16.5743 9.82597L18.8833 9.94897C19.1663 9.96397 19.4433 9.85797 19.6433 9.65797L20.2173 9.08397C20.6083 8.69297 20.6083 8.05997 20.2173 7.66997L15.8313 3.28397C15.4403 2.89297 14.8073 2.89297 14.4173 3.28397L13.8433 3.85797C13.6423 4.05897 13.5363 4.33497 13.5523 4.61797L13.6753 6.92697L10.7753 9.82697H6.83834C6.57334 9.82697 6.31834 9.93197 6.13134 10.12L4.95634 11.294V11.294Z' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath d='M16.5699 9.83018L13.6699 6.93018' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3c/svg%3e",loading:"lazy"})," ",d("label.pinnedPost")),rightLabel:!r&&b.default.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cline x1='7.18605' y1='7.68219' x2='3.68219' y2='13.8139' stroke='%23FEA21E' stroke-linecap='round'/%3e%3cpath d='M3.24591 7.78426C3.21275 7.84168 3.20376 7.90993 3.22092 7.97398C3.23808 8.03803 3.27998 8.09264 3.3374 8.12579L8.78429 11.2706C8.90385 11.3396 9.05674 11.2986 9.12578 11.1791C9.71191 10.1641 9.71348 8.97262 9.23682 7.99339L10.8583 5.18521C11.5115 5.00603 12.0982 4.57973 12.4638 3.94629C12.5328 3.82672 12.4919 3.67383 12.3723 3.6048L8.18237 1.18584C8.12494 1.15268 8.0567 1.1437 7.99265 1.16086C7.92861 1.17803 7.874 1.21993 7.84086 1.27736C7.47521 1.91077 7.39934 2.63194 7.57065 3.28723L5.94919 6.09545C4.86323 6.1723 3.83201 6.76934 3.24591 7.78426Z' fill='%23FEA21E' stroke='%23FEA21E' stroke-width='0.5' stroke-linejoin='round'/%3e%3c/svg%3e",loading:"lazy"}),onClick:e,color:"white",className:`label-pinned ${n}`,style:i})},I=e=>({message:e("notification.failure"),type:"danger"});var _="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%23FE921D'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const M=(e,a)=>{const[l,o]=t.useState(e||[]);return{onSelectImages:t=>{const n=t.target.files;if(n)if(a&&e){a((e||l).concat(Array.from(n)))}else o((t=>{const l=e||t;return a&&a(l.concat(Array.from(n))),l.concat(Array.from(n))}))},onRemoveImage:t=>{if(a&&e){const l=e;l.splice(t,1),a(l.slice())}else o((l=>{const o=e||l;return o.splice(t,1),a&&a(o.slice()),o.slice()}))},onRemoveAllImages:()=>{a?a([]):o([])},imageSrcs:t.useMemo((()=>(e||l).map((e=>"string"==typeof e?e:URL.createObjectURL(e)))),[e,l]),imageFiles:e||l}};var L="data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 22.9844C17.5228 22.9844 22 18.5072 22 12.9844C22 7.46153 17.5228 2.98438 12 2.98438C6.47715 2.98438 2 7.46153 2 12.9844C2 18.5072 6.47715 22.9844 12 22.9844Z' fill='%23262626'/%3e%3cpath d='M14.8281 10.1562L9.17127 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.17188 10.1562L14.8287 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const j=({className:e,style:a,bannedWords:n=[],value:r,onChange:d,onPreviewUrlChange:c,onInvalidUrlsChange:u,onImageFilesChange:m,imageFiles:p,isReplying:v})=>{const{t:f}=o.useTranslations(),[h,y]=t.useState(null),C=t.useRef(null),{onSelectImages:E,onRemoveImage:w,imageSrcs:k}=M(p,m);return t.useEffect((()=>{c&&((null==h?void 0:h.url)?c({title:h.title||"",url:h.url||"",image:h.image||"",description:h.description||""}):c(null))}),[h]),b.default.createElement(l.StyledCreatePostDescription,{className:e,style:a},b.default.createElement(g.Text,{size:"p4",className:"description-label"},f("createPost.popup.description")),b.default.createElement("div",{className:"textarea-control"},b.default.createElement("div",{className:"textarea-wrapper"},b.default.createElement(l.RichTextEditor,{html:r||"",onChange:d,bannedWords:n,onImagePickerClick:()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:y,onInvalidUrlsChange:u,isReplying:v}))),b.default.createElement(g.Text,{size:"p4",className:"count-string"},f("character"),": ",P.default(r||"").length),(!k||0===k.length)&&h&&b.default.createElement("div",{className:"link-preview-wrapper"},h.isFetching?b.default.createElement(l.Loading,null):b.default.createElement(b.default.Fragment,null,b.default.createElement(N,{title:h.title,url:h.url||"#",image:h.image,noRefetch:!0}),b.default.createElement("img",{src:L,className:"icon-close",onClick:()=>y(null),loading:"lazy"}))),b.default.createElement("input",{ref:C,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:E}),k.length>s.MAX_IMAGE_UPLOADS?b.default.createElement("div",{className:"input-notification"},b.default.createElement("img",{src:_,loading:"lazy"}),b.default.createElement(g.Text,{size:"p4",color:i.theme.colors.alertWarning},f("createPost.popup.warningImage"))):null,k.length>0&&b.default.createElement("div",{className:"image-gallery"},k.map(((e,t)=>b.default.createElement("div",{key:t,className:"image-item"},b.default.createElement("img",{src:e,loading:"lazy"}),b.default.createElement("img",{className:"close-btn",src:L,onClick:()=>w(t),loading:"lazy"}))))))},R=(e,t)=>{if(!t)return e;const{limit:a,bannedWords:o=[]}=t,n="number"==typeof a&&a>=0?e.substring(0,a):e;return l.highlightBadWords(n,o)},B=({className:e,style:a,bannedWords:n=[],value:i,onChange:r})=>{var s;const{t:d}=o.useTranslations(),[c,u]=t.useState(""),m=t.useRef(null);t.useEffect((()=>{if(m.current){const e=e=>{var t;e.preventDefault();const a=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,a)},t=m.current;return t.addEventListener("paste",e,{passive:!0}),()=>t.removeEventListener("paste",e)}}),[m]);const p=(null==n?void 0:n.join(","))||"";t.useEffect((()=>{var e;if(p){const t=null===(e=m.current)||void 0===e?void 0:e.innerText;if(t){const e=l.highlightBadWords(t,n);e!==t&&(r&&r(e),u(e))}}}),[p]);const v=t.useCallback(T.default((()=>{if(m.current){const e=R(m.current.innerText,{limit:120,bannedWords:n});r&&r(e),u(e)}}),300),[]);return t.useEffect((()=>{setTimeout((()=>{var e;null===(e=m.current)||void 0===e||e.focus()}),500)}),[]),b.default.createElement(l.StyledCreatePostTitle,{className:e,style:a},b.default.createElement(f.Input,{name:"title",value:i||c,size:"md",label:d("createPost.title"),CustomInput:b.default.createElement(S.default,{innerRef:m,html:i||c,onChange:()=>{if(m.current&&m.current.innerText!==(i||c)){const e=R(m.current.innerText,{bannedWords:n});r&&r(e),u(e),v()}},className:"title-input"})}),b.default.createElement(g.Text,{size:"p4",className:"count-string"},d("createPost.popup.wordCount",{count:(null===(s=m.current)||void 0===s?void 0:s.innerText.length)||0,max:120})))},O=({className:a,style:o,topics:n,communityId:i,onChange:r,isLoading:d,disabled:c,forceTopics:u,selectedTopics:m,noFetch:p,dataEventCategory:g,dataEventAction:f,dataEventLabel:h})=>{const{data:{locale:y,env:{isMarryBaby:C}}}=t.useContext(s.TogetherComponentGlobalContext),[E,w]=t.useState(n?[...n]:[]),[k,P]=t.useState(m?[...m]:[]),[T,S]=t.useState(!1),x=t.useRef(n);x.current=n,t.useEffect((()=>{var t;!i||p||(null===(t=x.current)||void 0===t?void 0:t.length)||(w([]),S(!0),e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{const t=yield s.callApi(s.getApiPath(s.PATHS.TOPIC.LIST,{communityId:i,_locale:y}),"GET"),a=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.topics;Array.isArray(a)&&w((()=>(null==a?void 0:a.map(v.formatTopic).sort(((e,t)=>(e.order||0)-(t.order||0))))||[]))}catch(e){console.log(e),S(!1)}S(!1)})))}),[i,p]);const N=null==n?void 0:n.map((e=>e.id)).join("-"),A=null==E?void 0:E.map((e=>e.id)).join("-"),I=null==u?void 0:u.map((e=>e.id)).join("-");t.useEffect((()=>{n&&void 0!==N&&N!==A&&w(n)}),[n,N,A]);const _=t.useMemo((()=>E.filter((e=>!(null==u?void 0:u.some((t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId)))))),[A,I]);return b.default.createElement(l.StyledTopicSelectList,{"data-is-marrybaby":C,className:a,style:o},u.map((e=>b.default.createElement(z,{key:`${e.id}-${e.mappedCategoryId}`,topic:e,disabled:!0,selected:!0,dataEventAction:f,dataEventCategory:g,dataEventLabel:h}))),_.map((e=>b.default.createElement(z,{key:`${e.id}-${e.mappedCategoryId}`,topic:e,disabled:c,selected:(m||k).some((t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId)),onClick:()=>{const t=m||k,a=t.findIndex((t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId));-1!==a?t.splice(a,1):t.push(e),r&&m?r(t.slice()):(r&&r(t.slice()),P(t.slice()))},dataEventAction:f,dataEventCategory:g,dataEventLabel:h}))),(d||T)&&b.default.createElement(l.Loading,{className:"topic-spinner"}))},z=t=>{var{topic:a,disabled:l,selected:o,onClick:n}=t,i=e.__rest(t,["topic","disabled","selected","onClick"]);return b.default.createElement("div",Object.assign({className:"tag-item"+(o?" --active":""),"data-disabled":l,onClick:l?void 0:n},i),a.name)},D=({className:e,isMarryBaby:a,style:o,title:n,description:i,acceptText:r,cancelText:d,onAccept:c,onCancel:m,thumbnail:p,isThumbnailIcon:v,onClose:f,acceptBtnTracking:h,acceptBtnProps:y,cancelBtnProps:E})=>{const{data:{env:{isMarryBaby:w}}}=t.useContext(s.TogetherComponentGlobalContext),k="boolean"==typeof a?a:w,[P,T]=t.useState(!1);return t.useEffect((()=>(u.toggleNoScroll(!0),setTimeout((()=>T(!0)),0),()=>u.toggleNoScroll(!1))),[]),"undefined"==typeof window?null:x.createPortal(b.default.createElement(l.StyledPopupDanger,{"data-is-marrybaby":k,className:e,style:o,"data-open":P},b.default.createElement(l.PopupFrame,{className:"popup-frame",isOpen:P,onClose:f},b.default.createElement("div",{className:"confirm-dialog",onClick:e=>e.stopPropagation()},b.default.createElement("div",{className:"confirm-content"},p&&b.default.createElement("div",{className:"thumbnail-container "+(v?"is-icon":"")},b.default.createElement("img",{className:"thumbnail",src:p,loading:"lazy"})),b.default.createElement(s.Heading,{className:"title",tag:"h2"},n),b.default.createElement(g.Text,{className:"desc",size:"lg"},i),b.default.createElement("div",{className:"btn-group"},b.default.createElement(C.Button,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",color:"tertiary",onClick:()=>{null==c||c(),null==f||f()}},y,h),r),b.default.createElement(C.Button,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",onClick:()=>{null==m||m(),null==f||f()}},E),d)))),k&&p&&b.default.createElement("div",{className:"thumbnail-container is-mobile "+(v?"is-icon":"")},b.default.createElement("img",{className:"thumbnail",src:p,loading:"lazy"})))),u.getPopupWrapperDom())};const F=({isReply:a,className:n,onClose:i,replyToName:r,style:d,replyingId:c,replyingUser:u,onPostSuccess:m,post:p,isMarryBaby:h})=>{const{action:{pushNotifications:y,sanitizeFunction:E},data:{userInfo:w,locale:k,env:{isMarryBaby:P}}}=t.useContext(s.TogetherComponentGlobalContext),T="boolean"==typeof h?h:P,{t:S}=o.useTranslations(),{onSelectImages:x,onRemoveImage:A,imageSrcs:I,onRemoveAllImages:_,imageFiles:j}=M(),[R,B]=t.useState(""),{trigger:O}=t.useContext(l.MainInputTriggerContext),[z,D]=t.useState(!1),F=t.useRef(null),U=t.useRef(null),H=t.useRef(null),[q,W]=t.useState([]),[V,$]=t.useState([]),[G,Z]=t.useState(null);return t.useEffect((()=>{var e;null===(e=H.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout((()=>{var e;null===(e=U.current)||void 0===e||e.focus()}),400)}),[O]),b.default.createElement(l.StyledInputCommentBar,{"data-is-reply":a,className:n,style:d},a&&b.default.createElement("div",{className:"reply-to-container"},b.default.createElement(g.Text,{size:"p4"},b.default.createElement("span",{dangerouslySetInnerHTML:{__html:S("inputComment.replyTo",{name:`<span style="color: #2D87F3; cursor: pointer">@${r||""}</span>`})}})),b.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8.00016' cy='8.50004' r='6.66667' fill='white' stroke='%23404040'/%3e%3cpath d='M10 6.5L6 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6 6.5L10 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-close-comment",onClick:()=>i&&i(),loading:"lazy"})),b.default.createElement("div",{className:"input-container",ref:H},b.default.createElement(v.UserAvatar,{className:"avatar-wrapper "+(a?"avatar-wrapper-reply":""),avatar:(null==w?void 0:w.id)?w.avatar:s.DEFAULT_AVATAR_IMG,username:(null==w?void 0:w.name)||(null==w?void 0:w.username)}),b.default.createElement("input",{ref:F,onChange:x,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),b.default.createElement(f.Input,{value:R,name:"input",size:"md",className:"input-wrapper",displayIcon:b.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.7543 4.85352H4.49227C4.01776 4.85352 3.56268 5.04201 3.22715 5.37754C2.89162 5.71307 2.70313 6.16815 2.70312 6.64266V19.1667C2.70313 19.6412 2.89162 20.0963 3.22715 20.4318C3.56268 20.7673 4.01776 20.9558 4.49227 20.9558H17.0163C17.4908 20.9558 17.9459 20.7673 18.2814 20.4318C18.6169 20.0963 18.8054 19.6412 18.8054 19.1667V12.9047' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M17.4633 3.51187C17.8192 3.15599 18.3019 2.95605 18.8052 2.95605C19.3085 2.95605 19.7912 3.15599 20.147 3.51187C20.5029 3.86775 20.7029 4.35044 20.7029 4.85373C20.7029 5.35702 20.5029 5.83971 20.147 6.19559L11.6486 14.694L8.07031 15.5886L8.96489 12.0103L17.4633 3.51187Z' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",loading:"lazy"}),CustomInput:b.default.createElement("div",{className:"as-input"},b.default.createElement(l.RichTextEditor,{className:"textarea",html:R,onChange:B,onImagePickerClick:()=>{var e;return null===(e=F.current)||void 0===e?void 0:e.click()},bannedWords:V,onPreviewUrlChange:Z,onInvalidUrlsChange:W,setEditorRef:e=>U.current=e,isReplying:a}))}),b.default.createElement(C.Button,{theme:T?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var t,o,n,r,d,g,f,h,C;if((null==p?void 0:p.id)&&!z){D(!0);try{const w=e=>{B(""),_(),i&&i();const t=v.formatComment(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),m&&m(t)},b=yield(({postId:t,message:a,photos:o,link:n,locale:i,sanitizeFunction:r,replyingUserId:d,replyingUserName:c,replyingId:u})=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=new FormData;let m=l.encodePostContent(a.replace(/(\&nbsp;)+/g," "),r);const p=l.getMentionIdsFromString(m);return o&&o.length>0&&(yield Promise.all(null==o?void 0:o.map((e=>l.uploadAndGetSrc(e,i))))).filter(Boolean).slice(0,s.MAX_IMAGE_UPLOADS).forEach((t=>{e.append("images[]",t)})),n&&e.append("link",n),null==p||p.forEach((t=>{e.append("mention_ids[]",t)})),e.append("post_id",t),u&&e.append("parent_id",u),d&&(p.unshift(d),m=`[mention+id="${d}"+name="${(c||"").replace('"',"'")}"]${m}`,e.append("parent_user_id",String(d))),e.append("content",m),e.append("content",m),e})))(Object.assign({message:R,photos:j,postId:String(p.id),link:null==G?void 0:G.url,sanitizeFunction:E,locale:k},a&&c?{replyingUserId:String((null==u?void 0:u.id)||(null===(t=null==p?void 0:p.author)||void 0===t?void 0:t.id)||""),replyingId:c,replyingUserName:(null==u?void 0:u.name)||(null==u?void 0:u.username)||""}:{})),P=yield a&&c?((t,a)=>e.__awaiter(void 0,void 0,void 0,(function*(){return s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.REPLY,{_locale:a}),"POST",{data:t})})))(b,k):((t,a)=>e.__awaiter(void 0,void 0,void 0,(function*(){return s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.CREATE,{_locale:a}),"POST",{data:t})})))(b,k),T=null==P?void 0:P.data;(null==T?void 0:T.id)&&!(null===(n=null===(o=null==P?void 0:P.messages)||void 0===o?void 0:o.moderation)||void 0===n?void 0:n.type)?w(P):"banned"===(null===(d=null===(r=null==P?void 0:P.messages)||void 0===r?void 0:r.moderation)||void 0===d?void 0:d.type)?(y({title:S("notification.comment.blocked.title"),message:S("notification.comment.blocked.message"),type:"danger"}),P.messages.moderation.words&&$(P.messages.moderation.words)):"suspect"===(null===(f=null===(g=null==P?void 0:P.messages)||void 0===g?void 0:g.moderation)||void 0===f?void 0:f.type)?(y({title:S("notification.comment.suspect.title"),message:S("notification.comment.suspect.message"),type:"warning"}),B(""),_(),i&&i()):(null===(h=null==P?void 0:P.messages)||void 0===h?void 0:h.find((e=>{var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(y({message:S("notification.suspend.message"),type:"warning"}),B(""),_(),i&&i()):y({title:"",message:(null===(C=null==P?void 0:P.messages)||void 0===C?void 0:C[0])||S("notification.comment.somethingWrong"),type:"danger"})}catch(e){y({title:"",message:S("notification.comment.somethingWrong"),type:"danger"})}D(!1)}})),isLoading:z,isDisabled:!!(null==q?void 0:q.length)||z||!R||(null==R?void 0:R.length)<2||!R.trim()},b.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='20' height='21' viewBox='0 0 20 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 9.73438L3.75 13.4844L7.5 17.2344' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M16.25 4.73438L16.25 10.3026C16.25 11.1464 15.9208 11.9557 15.3347 12.5524C14.7487 13.1491 13.9538 13.4844 13.125 13.4844L3.75 13.4844' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-enter",loading:"lazy"}))),(null==q?void 0:q.length)?b.default.createElement("div",{className:"error-text"},S("notification.limitUrlDomain")):null,(!I||0===I.length)&&G&&b.default.createElement("div",{className:"link-preview-wrapper"},G.isFetching?b.default.createElement(l.Loading,null):b.default.createElement(b.default.Fragment,null,b.default.createElement(N,{title:G.title,url:G.url||"#",image:G.image,noRefetch:!0}),b.default.createElement("img",{src:L,className:"icon-close",onClick:()=>Z(null),loading:"lazy"}))),I&&I.length>0&&b.default.createElement("div",{className:"preview-images-container"},I.map(((e,t)=>b.default.createElement("div",{key:t,className:"image-src-wrapper"},b.default.createElement("img",{className:"preview-image",src:e,loading:"lazy"}),b.default.createElement("img",{src:L,className:"icon-close-circle",onClick:()=>A(t),loading:"lazy"}))))))};var U="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 5V8' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11H8.00708' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const H=({className:a,style:n,reason:r,reasonText:d,onClose:c,postId:u})=>{const{data:{locale:m,env:{isMarryBaby:p}},action:{pushNotifications:v}}=t.useContext(s.TogetherComponentGlobalContext),{t:f}=o.useTranslations(),[h,y]=t.useState(!1);return b.default.createElement(l.StyledSubmitReportForm,{"data-is-marrybaby":p,className:a,style:n},b.default.createElement("ul",{className:"report-list"},b.default.createElement("li",{className:"report-item"},b.default.createElement("img",{src:U,loading:"lazy"}),b.default.createElement(g.Text,{className:"__label",color:i.theme.colors.gray800,size:"p4"},d))),b.default.createElement(C.Button,{theme:p?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:h,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(u&&!h){y(!0);try{const e=yield(({id:e,reason:t,locale:a})=>{const l=new FormData;return l.append("reason",t),s.callApiWithAuth(s.getApiPath(s.PATHS.POST.REPORT,{_locale:a,id:e}),"POST",{data:l})})({id:u,reason:r,locale:m});1===(null==e?void 0:e.status)&&(v({message:"Post reported",type:"success"}),c&&c())}catch(e){}y(!1)}}))},f("submit")))};const q=({className:e,style:n,authorName:i,images:r,onClose:s,onOpenSingleView:d,alt:c})=>{const{t:u}=o.useTranslations(),[m,p]=t.useState(!1);return t.useEffect((()=>{setTimeout((()=>{p(!0)}),0)}),[]),b.default.createElement(a.Portal,null,b.default.createElement(l.StyledImagePreviewPopup,{className:e,style:n,"data-open":m},b.default.createElement("div",{className:"top-bar"},b.default.createElement("img",{className:"icon-arrow-left",src:"data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.0508 18.0607L4.00078 12.0367L10.0508 6.01172' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.00195 12.0352L19.002 12.0352' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",onClick:s,alt:"go back",loading:"lazy"}),b.default.createElement(g.Text,{size:"p2",type:"bold",style:{textAlign:"center"}},u("previewPhotos.title",{name:i}))),b.default.createElement("div",{className:"container"},r.map(((e,t)=>b.default.createElement("img",{className:"img-preview",key:t,src:e,onClick:()=>null==d?void 0:d(t),alt:c,loading:"lazy"}))))),",")};var W="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12.8125L10 8.8125L6 4.8125' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const V=({initialViewIndex:e,images:o,onClose:n,alt:i})=>{const[r,s]=t.useState(e),[d,c]=t.useState(!1);t.useEffect((()=>{setTimeout((()=>{c(!0)}),0)}),[]);const u=null==o?void 0:o[r],m=0===r,p=!(null==o?void 0:o.length)||r===(null==o?void 0:o.length)-1;return b.default.createElement(a.Portal,null,b.default.createElement(l.StyledImagePreviewContainer,{"data-open":d&&!!u},b.default.createElement(l.StyledImagePreviewTopbar,null,b.default.createElement("img",{src:l.img,className:"icon-close",onClick:n,alt:"close",loading:"lazy"})),u&&r>=0&&b.default.createElement(b.default.Fragment,null,b.default.createElement(l.StyledImagePreviewWrapper,null,b.default.createElement("img",{className:"img-preview",src:u,alt:i,loading:"lazy"}),b.default.createElement(l.StyledArrowWrapper,{"data-disabled":m,onClick:()=>!m&&s(r-1)},b.default.createElement(l.StyledCircleArrow,null,b.default.createElement("img",{src:W,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":m,loading:"lazy"}))),b.default.createElement(l.StyledArrowWrapper,{"data-right":!0,"data-disabled":p,onClick:()=>!p&&s(r+1)},b.default.createElement(l.StyledCircleArrow,null,b.default.createElement("img",{src:W,alt:"right arrow","data-disabled":p,loading:"lazy"})))))))},$=({image:e,showIcon:a=!0})=>{const[o,n]=t.useState(!0);return b.default.createElement(l.StyledWrapper$1,{"data-is-blurred":o,onClick:e=>o&&e.stopPropagation()},b.default.createElement("img",{loading:"lazy",className:"img-preview",src:e}),b.default.createElement(l.StyledInner,{onClick:e=>{e.stopPropagation(),n(!o)}},a&&b.default.createElement(l.StyledIcon,null,o?b.default.createElement("svg",{width:"22",height:"20",viewBox:"0 0 22 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.71 2.5399C1.32 2.1499 1.32 1.5199 1.71 1.1299C2.1 0.739902 2.74 0.739902 3.13 1.1299L19.44 17.4599C19.83 17.8499 19.83 18.4799 19.44 18.8699C19.05 19.2599 18.42 19.2599 18.03 18.8699L15.31 16.1499C13.97 16.6699 12.52 16.9699 11 16.9699C6 16.9699 1.73 13.8599 0 9.4699C0.77 7.4999 2.06 5.7999 3.68 4.5099L1.71 2.5399ZM16 9.4699C16 6.7099 13.76 4.4699 11 4.4699C10.49 4.4699 10 4.5699 9.53 4.7099L7.36 2.5399C8.51 2.1699 9.73 1.9699 11 1.9699C16 1.9699 20.27 5.0799 22 9.4599C21.31 11.2199 20.21 12.7599 18.82 13.9899L15.76 10.9299C15.9 10.4699 16 9.9799 16 9.4699ZM11 14.4699C8.24 14.4699 6 12.2299 6 9.4699C6 8.6999 6.18 7.9699 6.49 7.3299L8.06 8.8999C8.03 9.0799 8 9.2699 8 9.4699C8 11.1299 9.34 12.4699 11 12.4699C11.2 12.4699 11.38 12.4399 11.57 12.3999L13.14 13.9699C12.49 14.2899 11.77 14.4699 11 14.4699ZM13.97 9.1399C13.82 7.7399 12.72 6.6499 11.33 6.4999L13.97 9.1399Z",fill:"white"})):b.default.createElement("svg",{width:"23",height:"16",viewBox:"0 0 23 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.default.createElement("path",{d:"M11.9999 0C5.14188 0 1.88558 5.87864 1.09558 7.55664C0.963582 7.83664 0.963582 8.16141 1.09558 8.44141C1.88558 10.1204 5.14188 16 11.9999 16C18.8339 16 22.0924 10.1629 22.8964 8.46094C23.0344 8.16794 23.0344 7.83206 22.8964 7.53906C22.0924 5.83706 18.8339 0 11.9999 0ZM11.9999 3C14.7609 3 16.9999 5.239 16.9999 8C16.9999 10.761 14.7609 13 11.9999 13C9.23888 13 6.99988 10.761 6.99988 8C6.99988 5.239 9.23888 3 11.9999 3ZM11.9999 5C11.2042 5 10.4412 5.31607 9.87856 5.87868C9.31595 6.44129 8.99988 7.20435 8.99988 8C8.99988 8.79565 9.31595 9.55871 9.87856 10.1213C10.4412 10.6839 11.2042 11 11.9999 11C12.7955 11 13.5586 10.6839 14.1212 10.1213C14.6838 9.55871 14.9999 8.79565 14.9999 8C14.9999 7.20435 14.6838 6.44129 14.1212 5.87868C13.5586 5.31607 12.7955 5 11.9999 5Z",fill:"#2D87F3"})))))},G=({className:e,images:a=[],style:n,authorName:i,isSensitive:r=!1,alt:d})=>{const{data:{env:{isMarryBaby:c}}}=t.useContext(s.TogetherComponentGlobalContext),{t:m}=o.useTranslations(),p="+ "+((a.length||0)-4),[v,g]=t.useState(!1),[f,h]=t.useState(-1),y=a.length>5,C=t.useRef(!1);return t.useEffect((()=>()=>{C.current&&u.toggleNoScroll(!1)}),[]),t.useEffect((()=>{v||f>=0?(u.toggleNoScroll(!0),C.current=!0):(u.toggleNoScroll(!1),C.current=!1)}),[v,f]),b.default.createElement(b.default.Fragment,null,r&&b.default.createElement(l.StyledNotificationBar,{message:m("sensitiveMask.contentWarningDescription"),icon:b.default.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.00002 0.666748C4.40002 0.666748 0.666687 4.40008 0.666687 9.00008C0.666687 13.6001 4.40002 17.3334 9.00002 17.3334C13.6 17.3334 17.3334 13.6001 17.3334 9.00008C17.3334 4.40008 13.6 0.666748 9.00002 0.666748ZM9.00002 9.83341C8.54169 9.83341 8.16669 9.45841 8.16669 9.00008V5.66675C8.16669 5.20842 8.54169 4.83342 9.00002 4.83342C9.45835 4.83342 9.83335 5.20842 9.83335 5.66675V9.00008C9.83335 9.45841 9.45835 9.83341 9.00002 9.83341ZM8.16669 11.5001V13.1667H9.83335V11.5001H8.16669Z",fill:"#FE921D"}))}),b.default.createElement(l.StyledPostImagePreview,{className:e,style:n,"data-image-count":y?5:a.length||0,"data-is-marrybaby":c,"data-cursor-pointer":!r},null==a?void 0:a.slice(0,5).map(((e,t)=>{const a=4===t&&y;return b.default.createElement("div",{className:"img-wrapper",key:t,onClick:()=>{t>=4&&y?g(!0):h(t)}},r&&b.default.createElement($,{image:e,showIcon:!a}),!c&&b.default.createElement("img",{loading:"lazy",className:"img-preview-blur",src:e,alt:d}),b.default.createElement("img",{loading:"lazy",className:"img-preview",src:e,alt:d}),a&&b.default.createElement("div",{className:"img-more-overlay"},b.default.createElement(s.Heading,{tag:"h1",as:"h2",color:"white"},p)))}))),v&&b.default.createElement(q,{authorName:i||"",images:a,onClose:()=>g(!1),onOpenSingleView:h,alt:d}),f>=0&&b.default.createElement(V,{images:a,initialViewIndex:f,onClose:()=>h(-1),alt:d}))},Z=({url:o,image:n,className:i,style:r,autoPlay:d=!0})=>{const{data:{locale:c}}=t.useContext(s.TogetherComponentGlobalContext),[u,p]=t.useState(null);t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){if(!n){if(!o)return p(null);p((e=>Object.assign(Object.assign({},e),{isFetching:!0}))),s.callApi(s.getApiPath(s.PATHS.FETCH_PREVIEW,{_locale:c}),"POST",{data:{link:o},headers:{"Content-Type":"application/json"}}).then((e=>{var t,a;p({url:o,image:(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.image)||(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.logo)})})).catch((()=>{p(null)}))}}))}),[o,n]);const v=n||(null==u?void 0:u.image),g=(null==u?void 0:u.url)||o,f=t.useMemo((()=>l.youtubeVidIdGetter(g)),[g]),h=t.useMemo((()=>g.includes("facebook.com")||g.includes("fb.watch")),[g]),y=t.useRef(0),C=t.useRef(0),[E,w]=t.useState(!1);t.useEffect((()=>{const e=()=>{var e;const t=null===(e=k.current)||void 0===e?void 0:e.getBoundingClientRect();let a=!1;t&&(!y.current||Math.abs((y.current-t.width)/(null==t?void 0:t.width))>.2)&&(y.current=Math.floor(t.width),a=!0),t&&(!C.current||Math.abs((C.current-t.height)/(null==t?void 0:t.height))>.2)&&(C.current=Math.floor(t.height),a=!0),a&&w((e=>!e))};return e(),window.addEventListener("resize",e,{passive:!0}),()=>{window.removeEventListener("resize",e)}}),[]);const k=t.useRef(null),P=a.useMantineTheme();return b.default.createElement(l.StyledSocialLinkPreview,{className:`${i} no-replace-click`,style:r,ref:k,color:P.colors[P.primaryColor][0]},n||!f&&!h?b.default.createElement("a",{href:g,target:"_blank",rel:"noreferrer"},b.default.createElement("div",{className:"link-image-wrapper "+((null==u?void 0:u.isFetching)?"fetching":"")},(null==u?void 0:u.isFetching)?b.default.createElement(l.Loading,{className:"loading-spinner"}):b.default.createElement(m.ImageWrap,{className:"link-image",src:v||s.DEFAULT_IMG,backupSrc:s.DEFAULT_IMG,alt:g}))):b.default.createElement("div",{className:"link-image-wrapper"},f?b.default.createElement("iframe",{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${f}?&autoplay=${d?1:0}&mute=1&enablejsapi=1`,frameBorder:"0",allowFullScreen:!0,style:{position:"absolute",top:0,left:0,border:"none",overflow:"hidden"},loading:"lazy"}):h?b.default.createElement("iframe",{key:String(E),src:`https://www.facebook.com/plugins/video.php?href=${encodeURIComponent(g)}&autoplay=${d?1:0}&show_text=false&t=0&width=${y.current}&height=${C.current}`,style:{position:"absolute",top:"50%",left:"50%",border:"none",overflow:"hidden",height:C.current,width:y.current,transform:"translate(-50%, -50%)"},scrolling:"no",frameBorder:"0",allowFullScreen:!0,allow:"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share",loading:"lazy"}):null))};var Q="KsWg8i6",K="_9tS0EUN",X="kyyRKlb",J="-Uqqka-";var Y="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10Z' fill='%233E3F58'/%3e %3cpath d='M19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10Z' fill='%233E3F58'/%3e %3cpath d='M12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z' fill='%233E3F58'/%3e %3c/svg%3e",ee="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='%23595959' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",te="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",ae="data:image/svg+xml,%3csvg width='3' height='13' viewBox='0 0 3 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='1.58326' cy='6.41663' r='1.25' transform='rotate(89.9997 1.58326 6.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='1.41663' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 1.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='11.4166' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 11.4166)' fill='%23595959'/%3e%3c/svg%3e",le="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 5.33337C13.1046 5.33337 14 4.43794 14 3.33337C14 2.2288 13.1046 1.33337 12 1.33337C10.8954 1.33337 10 2.2288 10 3.33337C10 4.43794 10.8954 5.33337 12 5.33337Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4 10C5.10457 10 6 9.10457 6 8C6 6.89543 5.10457 6 4 6C2.89543 6 2 6.89543 2 8C2 9.10457 2.89543 10 4 10Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M12 14.6666C13.1046 14.6666 14 13.7712 14 12.6666C14 11.5621 13.1046 10.6666 12 10.6666C10.8954 10.6666 10 11.5621 10 12.6666C10 13.7712 10.8954 14.6666 12 14.6666Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.72668 9.00665L10.28 11.66' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M10.2734 4.33997L5.72668 6.9933' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",oe="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2 4H3.33333H14' stroke='%23737373' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33334 3.99992V2.66659C5.33334 2.31296 5.47382 1.97382 5.72387 1.72378C5.97392 1.47373 6.31305 1.33325 6.66668 1.33325H9.33334C9.68697 1.33325 10.0261 1.47373 10.2762 1.72378C10.5262 1.97382 10.6667 2.31296 10.6667 2.66659V3.99992M12.6667 3.99992V13.3333C12.6667 13.6869 12.5262 14.026 12.2762 14.2761C12.0261 14.5261 11.687 14.6666 11.3333 14.6666H4.66668C4.31305 14.6666 3.97392 14.5261 3.72387 14.2761C3.47382 14.026 3.33334 13.6869 3.33334 13.3333V3.99992H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66666 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33334 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const ne=({authorEmail:a,onDeletePost:n,shareUrl:i,post:r,className:d="",popoverClassName:u="",onBookmark:m,onRemoveBookmark:p,onEditPost:v})=>{const{data:{locale:g,userInfo:f,togetherUserId:h,env:{isMarryBaby:y}},action:{pushNotifications:C}}=t.useContext(s.TogetherComponentGlobalContext),{t:E}=o.useTranslations(),[w,k]=t.useState(!1),[P,T]=t.useState(!1),[S,x]=t.useState(!1),{authActionWrapper:N}=l.useTogetherAuthRequiredAction(),A=a&&(null==f?void 0:f.email)&&a===String(null==f?void 0:f.email);return b.default.createElement("div",{className:d,onClick:e=>{e.preventDefault(),e.stopPropagation()}},S&&b.default.createElement(l.SharePopup,{url:i,text:null==r?void 0:r.title,onClose:()=>x(!1)}),P&&b.default.createElement(D,{thumbnail:c.CommonGAssets.getAssetPath("trash-bin.svg"),isThumbnailIcon:!0,title:E("popup.deletePost.title"),description:E("popup.deletePost.description"),acceptText:E("popup.deletePost.accept"),cancelText:E("popup.deletePost.cancel"),onAccept:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if((null==r?void 0:r.id)&&!w){k(!0);try{const t=yield(({id:t,locale:a})=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t)return yield s.callApiWithAuth(s.getApiPath(s.PATHS.POST.DELETE,{id:t,_locale:a}),"DELETE")})))({id:r.id,locale:g});1===(null==t?void 0:t.status)&&(null==n||n())}catch(e){}k(!1)}})),onClose:()=>T(!1)}),b.default.createElement(l.TreePopoverMenu,{className:u,toggleButtonContent:b.default.createElement("img",{src:y?Y:ae,loading:"lazy"}),position:"bottom",align:"end",buttonProps:{isLoading:w},data:A?{isShowheader:!1,type:"list",list:[{icon:le,label:E("morePopover.share"),onClick:()=>x(!0)},{icon:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.16952 3.2356H2.99484C2.6785 3.2356 2.37512 3.36126 2.15143 3.58495C1.92774 3.80863 1.80208 4.11202 1.80208 4.42836V12.7777C1.80208 13.094 1.92774 13.3974 2.15143 13.6211C2.37512 13.8448 2.6785 13.9705 2.99484 13.9705H11.3442C11.6605 13.9705 11.9639 13.8448 12.1876 13.6211C12.4113 13.3974 12.537 13.094 12.537 12.7777V8.60303' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M11.6425 2.341C11.8798 2.10375 12.2016 1.97046 12.5371 1.97046C12.8726 1.97046 13.1944 2.10375 13.4317 2.341C13.6689 2.57826 13.8022 2.90005 13.8022 3.23558C13.8022 3.57111 13.6689 3.89289 13.4317 4.13015L7.76607 9.79578L5.38054 10.3922L5.97692 8.00663L11.6425 2.341Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",label:E("actionPopover.edit"),onClick:v},{icon:oe,label:E("actionPopover.delete"),onClick:()=>{N((()=>T(!0)))}}]}:{isShowheader:!1,type:"list",list:[{icon:le,label:E("morePopover.share"),onClick:()=>x(!0)},{icon:(null==r?void 0:r.bookmarked)?ee:te,label:(null==r?void 0:r.bookmarked)?E("morePopover.unsavePost"):E("morePopover.savePost"),onClick:()=>{N((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if((null==f?void 0:f.id)&&(null==r?void 0:r.id))if(null==r?void 0:r.bookmarked){const e=yield s.callApiWithAuth(s.getApiPath(s.PATHS.BOOKMARK.DELETE,{_locale:g}),"DELETE",{data:{post_id:String(r.id)}});1===(null==e?void 0:e.status)?(C({title:"",message:"Removed saved post",type:"success",displayIcon:te}),p&&p()):C({title:"",message:"Remove failed",type:"danger",displayIcon:te})}else{const e=yield s.callApiWithAuth(s.getApiPath(s.PATHS.BOOKMARK.CREATE,{_locale:g}),"POST",{data:{user_id:h||f.id,post_id:r.id}});1===(null==e?void 0:e.status)?(C({title:"",message:"Post saved",type:"success",displayIcon:ee}),m&&m()):C({title:"",message:"Post saved failed",type:"danger",displayIcon:te})}}))))}},{icon:U,label:E("morePopover.report"),subTree:{title:E("morePopover.report.title"),description:E("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(s.REPORT_REASON_MAP).map((e=>({label:s.REPORT_REASON_MAP[e].label,reason:s.REPORT_REASON_MAP[e].reportReasonText,reasonValue:e}))).map((e=>({label:E(e.label),subTree:{title:E("morePopover.reportSubmit.title"),description:E("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:t=>b.default.createElement(H,{reason:e.reasonValue,reasonText:E(e.reason),postId:null==r?void 0:r.id,onClose:()=>t&&t(!1)})}})))}}]}}))};const ie=({onDeleteComment:a,commentId:n,className:i="",popoverClassName:r=""})=>{const{data:{env:{isMarryBaby:d},locale:c},action:{pushNotifications:u}}=t.useContext(s.TogetherComponentGlobalContext),{t:m}=o.useTranslations(),[p,v]=t.useState(!1),{authActionWrapper:g}=l.useTogetherAuthRequiredAction();return b.default.createElement("div",{className:i,onClick:e=>{e.preventDefault(),e.stopPropagation()}},p&&b.default.createElement(D,{thumbnail:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' fill='none'%3e%3cg stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' clip-path='url(%23clip0)'%3e%3cpath d='M2 4.008h12M5.333 4.008V2.675a1.333 1.333 0 0 1 1.334-1.333h2.666a1.333 1.333 0 0 1 1.334 1.333v1.333m2 0v9.334a1.333 1.333 0 0 1-1.334 1.333H4.667a1.333 1.333 0 0 1-1.334-1.333V4.008h9.334ZM6.667 7.342v4M9.333 7.342v4'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0'%3e%3cpath fill='white' d='M0 .008h16v16H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",isThumbnailIcon:!0,title:m("popup.deleteComment.title"),description:m("popup.deleteComment.description"),acceptText:m("popup.deletePost.accept"),cancelText:m("popup.deletePost.cancel"),onAccept:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;if(!n)return;const t=yield(({id:e,locale:t})=>s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.DELETE,{_locale:t,id:e}),"DELETE"))({id:n,locale:c});1===(null==t?void 0:t.status)?(a&&a(),u({title:"",message:m("notification.success"),type:"success"})):u({title:"",message:(null===(e=null==t?void 0:t.messages)||void 0===e?void 0:e[0])||m("notification.failure"),type:"danger"})})),onClose:()=>v(!1)}),b.default.createElement(l.TreePopoverMenu,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:oe,label:m("actionPopover.delete"),onClick:()=>{g((()=>{v(!0)}))}}]},className:r,toggleButtonContent:b.default.createElement("img",{src:d?Y:ae,loading:"lazy"}),buttonProps:{}}))};var re="-dzIuHr";const se=({userId:e,avatar:a,name:n,role:s,title:d,className:c})=>{const{t:u}=o.useTranslations(),[m,p]=t.useState(!1);return b.default.createElement(b.default.Fragment,null,b.default.createElement(C.Button,{className:`${re} ${c}`,color:"success",size:"xs",onClick:()=>p(!0),style:{padding:"5px 8px",marginBottom:"12px",borderRadius:"4px"}},b.default.createElement("span",{className:"text"},b.default.createElement(r.Icon.Endorse,{isSolid:!0,size:18,color:i.theme.colors.green800,className:"icon"}),u("cardReply.verifyBy",{name:`${n||""}`}))),b.default.createElement(l.ProfileDetailModal,{open:m,onClose:()=>p(!1),profileModalProps:{zIndex:1e3}},b.default.createElement(l.ProfileDetail,{authorProps:{userId:e,avatar:a,name:n,role:s,title:d},hideQuestionTab:!0})))};const de=({className:a,style:n,comment:i,type:r="comment",level:c=0,replyingId:u,onPostCommentSuccess:m,post:v,onDeleteComment:g,refetchComment:f,hasQuickBookingEnable:h,handleMakeAppointment:y,cardAuthorProps:E,maxChars:w=600,disableShortenContent:k})=>{var P,T,S,x,A,I,_,M,L,j,R,B,O;const{data:{locale:z,userInfo:D,env:{isMarryBaby:U}}}=t.useContext(s.TogetherComponentGlobalContext),{t:H}=o.useTranslations(),[q,W]=t.useState(i||null),{id:V,countLikes:$,content:Z,replies:Q=[],images:K=[],author:X,liked:J,link:Y,mentionedUser:ee,mentions:te}=q,{text:ae,replyingTo:le}=(e=>{try{const t=e.match(/\[@([^\]]+)\]/),a=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:a}}catch(e){}return{text:""}})(Z),{authActionWrapper:oe}=l.useTogetherAuthRequiredAction({_joinCommunityIds:[null===(P=null==v?void 0:v.community)||void 0===P?void 0:P.id],_joinTopicIds:null===(T=null==v?void 0:v.topics)||void 0===T?void 0:T.map((e=>e.id))}),[ne,re]=t.useState(4),ce=!!(null==D?void 0:D.id)&&(null==Q?void 0:Q.some((e=>e.author.id===D.id))),ue=e=>{W((t=>{if(!t.replies.find((t=>t.id===e.id))){t.replies.unshift(e);const a=Object.assign(Object.assign({},t),{replies:t.replies.slice(),countReplies:t.countReplies+1});return f&&f(a),a}return t}))},[me,pe]=t.useState(!1),ve=t.useMemo((()=>"comment"===r&&Q&&0!=Q.length?Q.sort(((e,t)=>{const a=new Date(e.createdAt).getTime(),l=new Date(t.createdAt).getTime();return a>l?-1:a<l?1:0})):Q),[r,Q]),ge=(null==Q?void 0:Q.length)||0,fe=String(null==X?void 0:X.email)&&(null==D?void 0:D.email)&&String(null==X?void 0:X.email)===String(null==D?void 0:D.email),he=(null==X?void 0:X.name)||(null==X?void 0:X.username)||"",ye=(null==X?void 0:X.username)||(null==X?void 0:X.name)||"",Ce=null==X?void 0:X.avatar,Ee=(null==v?void 0:v.isAnonymous)||null==X?void 0:X.role,we=[...(null==v?void 0:v.isAnonymous)?[{id:(null===(S=null==v?void 0:v.author)||void 0===S?void 0:S.id)||0,name:H("cardPost.anonymous")}]:[],...te||[]],[ke,be]=t.useState(null),[Pe,Te]=t.useState(null);t.useEffect((()=>{if(null==X?void 0:X.hospitalId){const t=t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:d.domainLocales[z]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.branch)&&be(null==a?void 0:a._data.branch)}));t(X.hospitalId)}if(null==X?void 0:X.doctorId){const t=t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:t,website_url:d.domainLocales[z]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.doctor)&&Te(null==a?void 0:a._data.doctor)}));t(X.doctorId)}}),[X.hospitalId,X.doctorId]);const Se=(null==Pe?void 0:Pe.valid_outpatient)||(null==Pe?void 0:Pe.valid_telemedicine),xe=((null==ke?void 0:ke.total_available_service)||(null==ke?void 0:ke.total_available_doctor))>0,Ne=h&&(Se||xe),Ae="chatbot"===(null===(x=null==q?void 0:q.author)||void 0===x?void 0:x.type);return b.default.createElement(l.TogetherAuthConfigContextProvider,{defaultParams:{_joinCommunityIds:[null===(A=null==v?void 0:v.community)||void 0===A?void 0:A.id],_joinTopicIds:null===(I=null==v?void 0:v.topics)||void 0===I?void 0:I.map((e=>e.id))}},b.default.createElement(l.StyledCardPost,{className:a,style:n,"data-is-reply":!!c,"data-is-marrybaby":U,"data-has-booking":Ne},"reply"===r&&b.default.createElement(p.Divider,{className:"top-divider",type:"solid"}),b.default.createElement("div",{style:{padding:"16px 16px 0"}},b.default.createElement(l.CardAuthor,Object.assign({avatar:Ce,name:he,username:ye,timeText:null==v?void 0:v.createdTime,community:null==v?void 0:v.community,className:"post-author "+(fe?"with-popover":""),type:r,userId:null==X?void 0:X.id,role:Ee,expertId:null==X?void 0:X.partnerId,title:null==X?void 0:X.title,doctorId:null==X?void 0:X.doctorId,hospitalId:null==X?void 0:X.hospitalId,hasQuickBooking:Ne,handleMakeAppointment:y,isAnonymous:(null==q?void 0:q.isAnonymous)||Boolean(null==v?void 0:v.isAnonymous)&&(null===(_=null==v?void 0:v.author)||void 0===_?void 0:_.username)===(null==X?void 0:X.username),hideBackground:Ae,userType:null==X?void 0:X.type},E)),Boolean(null==q?void 0:q.isVerify)&&!Boolean(null==q?void 0:q.isOppose)&&b.default.createElement(se,{title:null===(M=null==q?void 0:q.userVerify)||void 0===M?void 0:M.title,name:null===(L=null==q?void 0:q.userVerify)||void 0===L?void 0:L.name,userId:null===(j=null==q?void 0:q.userVerify)||void 0===j?void 0:j.id,role:null===(R=null==q?void 0:q.userVerify)||void 0===R?void 0:R.role,avatar:null===(B=null==q?void 0:q.userVerify)||void 0===B?void 0:B.avatar,className:"verify-tag"})),b.default.createElement(l.PostContent,{className:"post-content-wrapper",replyingTo:le,mentionedUser:ee,description:ae,mentions:we,maxChars:w,disableShortenContent:k}),b.default.createElement("span",null),b.default.createElement("span",null),K&&K.length>0?b.default.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},b.default.createElement(G,{images:K,authorName:null==X?void 0:X.username})):null,K&&0!==K.length||!Y?null:b.default.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},b.default.createElement(N,{url:Y})),"most-engaging"!==r?b.default.createElement(b.default.Fragment,null,Ae&&b.default.createElement(l.StyledSourceList,{listUrl:null==q?void 0:q.source,categorySlug:null==q?void 0:q.categorySlug}),b.default.createElement(l.CardReactions,{type:l.CardReactionType.reply,loveCount:$,replyCount:ge,className:"post-reaction",liked:J,isReplied:ce,hideCommentIcon:"reply"===r||Ae,hasShare:!1,onCommentClick:()=>oe((()=>pe((e=>!e)))),onCommentCountClick:()=>oe((()=>{pe(!0)})),onLikeClick:()=>oe((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(V){const t=yield(({commentId:t,setLike:a=!1,locale:l})=>e.__awaiter(void 0,void 0,void 0,(function*(){return s.callApiWithAuth(s.getApiPath(a?s.PATHS.COMMENT.LIKE:s.PATHS.COMMENT.UNLIKE,{_locale:l,id:t}),"GET")})))({commentId:V,setLike:!J,locale:z});1===t.status&&W((e=>Object.assign(Object.assign({},e),{liked:!J,countLikes:e.countLikes+(J?-1:1)})))}}))))}),me&&b.default.createElement(F,{replyingId:u||q.id,replyToName:he,isReply:!0,onClose:()=>pe(!1),onPostSuccess:e=>{"reply"===r?m&&m(e):ue(e)},post:v,replyingUser:X}),"comment"===r&&Q&&Q.length>0?b.default.createElement("div",{className:"comment-reply-wrapper"},null===(O=null==ve?void 0:ve.slice(0,ne))||void 0===O?void 0:O.map((e=>b.default.createElement(de,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:c+1,replyingId:V,onPostCommentSuccess:ue,post:v,onDeleteComment:()=>{W((t=>Object.assign(Object.assign({},t),{replies:t.replies.filter((t=>t.id!==e.id)),countReplies:t.countReplies-1})))},handleMakeAppointment:y,hasQuickBookingEnable:h}))),ge>ne&&b.default.createElement(b.default.Fragment,null,b.default.createElement(p.Divider,{className:"top-divider",type:"solid"}),b.default.createElement(C.Button,{className:"more-cmt",size:"lg",color:"ghost",onClick:()=>re((e=>e+4))},H("comment.seeMoreReplies",{count:ge-ne}),b.default.createElement("img",{className:"chevron-right",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12L10 8L6 4' stroke='%232D87F3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",loading:"lazy"})))):null):null,fe&&b.default.createElement(ie,{onDeleteComment:g,className:"popover",commentId:q.id})))},ce=(t,a)=>e.__awaiter(void 0,void 0,void 0,(function*(){var e,l,o;const n=yield s.callApiWithOptionalAuth(s.getApiPath(s.PATHS.COMMENT.LIST,{postId:t,_locale:a,sort:"popularity",perPage:1,withoutReply:1}),"GET");return null===(o=null===(l=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.comments)||void 0===l?void 0:l.map(v.formatComment))||void 0===o?void 0:o[0]}));var ue=Object.freeze({__proto__:null});exports.CardLink=N,exports.CardPost=({className:a,style:n,hideViewMoreComment:i,showMostEngaging:r,onCommentClick:d,onCommentCountClick:c,onMostEngagingCommentClick:u,onPostCommentSuccess:m,disableCardLink:p,disableShortenContent:v,onDeletePost:g,onEditPost:f,post:h,mostEngagingComment:y,onDeleteComment:E,showInputComment:w,InlineCommentsComponent:k,hasQuickBookingEnable:T,handleMakeAppointment:S,cardAuthorProps:x})=>{const[_,M]=t.useState(h),[L,j]=t.useState(!1),[R,B]=t.useState(y),{community:O,topics:z,author:D,slug:U,isPin:H,liked:q,photos:W,mentions:V,title:$,description:Q,previewUrl:K,likesCount:X,commentsCount:J,id:Y,commented:ee}=_,{data:{locale:te,env:{isMarryBaby:ae,togetherBasePath:le}},action:{pushNotifications:oe}}=t.useContext(s.TogetherComponentGlobalContext),{t:ie}=o.useTranslations(),[re,se]=t.useState(w),ue=`${le}/${(null==O?void 0:O.slug)||"_"}/${U||""}`,me=`${s.getCurrentBaseUrl(te)}${ue}`,{authActionWrapper:pe}=l.useTogetherAuthRequiredAction((null==O?void 0:O.slug)?{_joinCommunityIds:[O.id],_joinTopicIds:null==z?void 0:z.map((e=>e.id))}:void 0),[ve,ge]=t.useState(!1);t.useEffect((()=>{se(w)}),[w]);const fe=(null==D?void 0:D.name)||(null==D?void 0:D.username)||"",he=(null==D?void 0:D.username)||(null==D?void 0:D.name)||"",ye=null==D?void 0:D.avatar,Ce=(null==_?void 0:_.isAnonymous)||null==D?void 0:D.role,[Ee,we]=t.useState(null),[ke,be]=t.useState(null);t.useEffect((()=>{if(null==D?void 0:D.hospitalId){(t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:s.domainLocales[te]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.branch)&&we(null==a?void 0:a._data.branch)})))(D.hospitalId)}if(null==D?void 0:D.doctorId){(t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:t,website_url:s.domainLocales[te]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.doctor)&&be(null==a?void 0:a._data.doctor)})))(D.doctorId)}}),[D.hospitalId,D.doctorId]);const Pe=(null==ke?void 0:ke.valid_outpatient)||(null==ke?void 0:ke.valid_telemedicine),Te=((null==Ee?void 0:Ee.total_available_service)||(null==Ee?void 0:Ee.total_available_doctor))>0,Se=T&&(Pe||Te);t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){if(Y&&J&&r&&!(null==y?void 0:y.id)){const e=yield ce(Y,te);B(e)}}))}),[Y,te,J,r,null==y?void 0:y.id]),t.useEffect((()=>{B(y)}),[null==y?void 0:y.id]);const xe=t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(J>1&&(null==R?void 0:R.id)&&(null==R?void 0:R.id)===(null==t?void 0:t.id)){const e=yield ce(Y,te);B(e)}M((e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount-1}))),E&&E(t)}));return b.default.createElement(l.TogetherAuthConfigContextProvider,{defaultParams:(null==O?void 0:O.slug)?{_joinCommunityIds:[O.id],_joinTopicIds:null==z?void 0:z.map((e=>e.id))}:void 0},L&&b.default.createElement(l.SharePopup,{url:me,avatar:s.DEFAULT_IMG,text:$,onClose:()=>j(!1)}),b.default.createElement(l.StyledCardPost$1,{className:a,style:n,"data-is-marrybaby":ae},H?b.default.createElement(A,{className:"post-pin"}):null,b.default.createElement("div",{style:{position:"relative",padding:"1rem 1rem 0"}},b.default.createElement(l.CardAuthor,Object.assign({avatar:ye,name:fe,username:he,url:p?void 0:ue,community:O,timeText:null==_?void 0:_.createdTime,className:"post-author",role:Ce,userId:null==D?void 0:D.id,expertId:null==D?void 0:D.partnerId,doctorId:null==D?void 0:D.doctorId,hospitalId:null==D?void 0:D.hospitalId,title:null==D?void 0:D.title,hasQuickBooking:Se,handleMakeAppointment:S,"data-testid":"name",isAnonymous:!!(null==_?void 0:_.isAnonymous),extendEle:b.default.createElement(ne,{authorEmail:String(null==D?void 0:D.email),onDeletePost:g,shareUrl:me,post:_,className:"popover",onEditPost:f})},x))),b.default.createElement("a",{href:p?void 0:ue,className:"post-content-link-wrapper"},$&&b.default.createElement(s.Heading,{className:"post-content-title",as:"h2",tag:"h5",fontWeight:"bold","data-testid":"Title of the Post"},P.default($)),b.default.createElement(l.PostContent,{className:"post-content-wrapper",description:Q,disableShortenContent:v,mentions:V,"data-testid":"Content of the Post"})),b.default.createElement("span",null),b.default.createElement("span",null),b.default.createElement("div",{key:"tag-topic"},z&&z.length>0?b.default.createElement(l.TagTopic,{topics:z,className:"post-topics"}):null),b.default.createElement("div",{key:"social-preview"},(null==_?void 0:_.introUrl)?b.default.createElement("div",{className:"social-preview-wrapper "+((null==W?void 0:W.length)?"has-image":"")},b.default.createElement(Z,{url:_.introUrl,image:_.bannerImage})):null),b.default.createElement("div",{key:"image-preview"},(null==W?void 0:W.length)?b.default.createElement("div",{className:"image-preview-wrapper"},b.default.createElement(G,{images:W,authorName:null==D?void 0:D.name})):null),b.default.createElement("div",{key:"link-preview"},(null==_?void 0:_.introUrl)||(null==W?void 0:W.length)||!(null==K?void 0:K.url)?null:b.default.createElement("div",{className:"link-preview-wrapper"},b.default.createElement(N,{title:K.title,url:K.url,image:K.image}))),b.default.createElement(l.CardReactions,{isMarryBaby:ae,type:l.CardReactionType.post,loveCount:X,replyCount:J,className:"post-reaction "+((null==W?void 0:W.length)||(null==K?void 0:K.url)?"hide-top-border":""),liked:ve?!q:q,isReplied:ee,onCommentClick:()=>pe((()=>{d?d():se((e=>!e))})),onCommentCountClick:()=>{pe((()=>{ae?se(!0):c?c():!p&&(window.location.href=ue)}))},onShareClick:()=>{j(!0)},onLikeClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(Y&&!ve){ge(!0);try{const t=yield(({id:t,locale:a})=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t)return yield s.callApiWithAuth(s.getApiPath(s.PATHS.POST.LIKE,{id:t,_locale:a}),"GET")})))({id:Y,locale:te});1!==(null==t?void 0:t.status)?oe(I(ie)):M((e=>Object.assign(Object.assign({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked})))}catch(e){oe(I(ie))}ge(!1)}})),showingMostEngaging:!(!r||!(null==R?void 0:R.id))}),re&&b.default.createElement(F,{isMainCmt:!w,onClose:()=>se(!1),onPostSuccess:e=>{0!==J||(null==R?void 0:R.id)||B(e),M((e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount+1,commented:!0}))),m&&m(e)},post:_}),r&&(null==R?void 0:R.id)?b.default.createElement("div",{className:"most-engaging-wrapper",onClick:e=>{u?(e.stopPropagation(),u()):window.location.href=ue}},b.default.createElement(de,{hasQuickBookingEnable:T,handleMakeAppointment:S,comment:R,post:_,onDeleteComment:()=>{xe&&xe(R)},className:"most-engaging-comment",type:"most-engaging",key:R.id,cardAuthorProps:x}),J>1&&!i&&b.default.createElement(C.Button,{className:"see-more-comments",color:"ghost",size:"md"},ie("comment.seeMoreComments",{count:J-1}))):null,k))},exports.CardPostPopoverMore=ne,exports.CardReply=de,exports.CardReplyPopover=ie,exports.CreateNewPostContent=({className:n,style:d,onPostCreatedEdited:m,onClose:g,communities:f=[],forceSelectCommunity:h,forceSelectTopics:y,articleId:C,optionalTopic:E,editPostData:w,defaultCommunity:k,defaultTopics:T,noFetchTopic:S,hideTopicList:x,selectAskDoctor:N,showAskDoctorOptions:A,currentPageUrl:M})=>{const L=!!(null==w?void 0:w.id),{data:{locale:R,env:{isMarryBaby:z}},action:{pushNotifications:D,sanitizeFunction:F}}=t.useContext(s.TogetherComponentGlobalContext),{t:U}=o.useTranslations(),[H,q]=t.useState(!1),[W,V]=t.useState(N),[$,G]=t.useState(!1),[Z,Q]=t.useState(!1),[K,X]=t.useState(!1),[J,Y]=t.useState(""),[ee,te]=t.useState(""),[ae,le]=t.useState(h?{label:h.name,value:`${h.id||""}-${h.mappedCategoryId||""}`}:{label:U("community.choose"),value:""}),[oe,ne]=t.useState([...y]||[]),[ie,re]=t.useState([]),[se,de]=t.useState([]),ce=h||f.find((e=>`${e.id||""}-${e.mappedCategoryId||""}`===ae.value)),ue=h?[h]:f.filter((e=>e.isActive)).sort(((e,t)=>e.name>t.name?1:e.name<t.name?-1:0)),[me,pe]=t.useState(null),[ve,ge]=t.useState([]),fe=J&&!Z&&P.default(ee)&&(E||!E&&oe.length>0)&&ce&&(!ie||ie.length<=s.MAX_IMAGE_UPLOADS)&&!(null==ve?void 0:ve.length)&&!K;t.useEffect((()=>{if(w){const e=w;Y(e.title||""),te(l.decodeMention(l.decodePostUrl(e.description||"","edit"),e.mentions)),le({label:e.community.name,value:`${e.community.id||""}-${e.community.mappedCategoryId||""}`}),ne(e.topics||[]),re(e.photos||[]),q(!!e.isAnonymous||!1),V(!!e.isAskDoctor||!1)}else k&&le({label:k.name,value:`${k.id||""}-${k.mappedCategoryId||""}`}),T&&ne(T)}),[]),t.useEffect((()=>{Q(""!==J&&!/[a-zA-Z]/.test(J))}),[J]);const he=()=>e.__awaiter(void 0,void 0,void 0,(function*(){var t,a,o,n,i,r,d,c,p;if(A&&void 0===W)return G(!0),!1;const f=yield(({title:t,description:a,communityId:o,imageFiles:n,previewUrl:i,topicIds:r,locale:d,sanitizeFunction:c,categoryCommunityId:m,categoryTopicIds:p,introUrl:v,bannerUrl:g,scheduleTime:f,isAnonymous:h,isAskDoctor:y})=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=new FormData,C=l.removeBannedWordWrapper(a),E=l.removeBannedWordWrapper(t),w=l.getMentionIdsFromString(C);if(e.append("title",E),e.append("description",l.encodePostContent(C,c)),m?e.append("category_community",String(m)):o&&e.append("community_id",String(o)),e.append("is_anonymous",h?"1":"0"),e.append("is_question",y?"1":"0"),(null==i?void 0:i.title)&&e.append("preview_title",i.title),(null==i?void 0:i.description)&&e.append("preview_description",i.description),(null==i?void 0:i.url)&&e.append("preview_link",u.safeEncodeURI(i.url)),(null==i?void 0:i.image)&&e.append("preview_image",u.safeEncodeURI(i.image)),null==r||r.forEach((t=>{e.append("topics[]",String(t||""))})),null==p||p.forEach((t=>{e.append("category_topics[]",String(t||""))})),null==n?void 0:n.length){const t=yield Promise.all(n.map(((e,t)=>new Promise((a=>{setTimeout((()=>{a(l.uploadAndGetSrc(e,d))}),2e3*t)})))));null==t||t.filter(Boolean).slice(0,s.MAX_IMAGE_UPLOADS).forEach(((t,a)=>{e.append(`images[${a}]`,t)}))}else e.append("images","");return null==w||w.forEach((t=>{e.append("mention_ids[]",t)})),e.append("intro_url",v||""),e.append("banner",g||""),f&&(e.append("post_type","scheduled"),e.append("schedule_datetime",f)),e})))({title:J,description:ee,communityId:String((null==ce?void 0:ce.id)||""),imageFiles:ie,previewUrl:me,topicIds:null==oe?void 0:oe.map((e=>String(e.id||""))).filter(Boolean),locale:R,sanitizeFunction:F,categoryCommunityId:String((null==ce?void 0:ce.mappedCategoryId)||""),categoryTopicIds:null==oe?void 0:oe.map((e=>String(e.mappedCategoryId||""))).filter(Boolean),isAnonymous:H?1:0,isAskDoctor:W?1:0});let h;C&&f.append("article_id",C),L?(null==w?void 0:w.id)&&(h=yield(({id:t,locale:a,formData:l})=>e.__awaiter(void 0,void 0,void 0,(function*(){return yield s.callApiWithAuth(s.getApiPath(s.PATHS.POST.UPDATE,{id:t,_locale:a}),"POST",{data:l})})))({id:w.id,formData:f,locale:R})):h=yield(({locale:t,formData:a,isArticleComment:l})=>e.__awaiter(void 0,void 0,void 0,(function*(){return yield s.callApiWithAuth(s.getApiPath(l?s.PATHS.POST.CREATE_ARTICLE_COMMENT:s.PATHS.POST.CREATE,{_locale:t}),"POST",{data:a})})))({formData:f,locale:R,isArticleComment:!(null==ce?void 0:ce.id)&&!!(null==ce?void 0:ce.mappedCategoryId)});const y=null==h?void 0:h.data;(null==y?void 0:y.id)&&!(null===(a=null===(t=null==h?void 0:h.messages)||void 0===t?void 0:t.moderation)||void 0===a?void 0:a.type)?(D({message:U("createPost.popup.success"),type:"success"}),(e=>{m&&m(v.formatPost(e),L),g&&g()})(y)):"banned"===(null===(n=null===(o=null==h?void 0:h.messages)||void 0===o?void 0:o.moderation)||void 0===n?void 0:n.type)?(D({title:U("notification.post.blocked.title"),message:U("notification.post.blocked.message"),type:"danger"}),h.messages.moderation.words&&de(h.messages.moderation.words)):"suspect"===(null===(r=null===(i=null==h?void 0:h.messages)||void 0===i?void 0:i.moderation)||void 0===r?void 0:r.type)?(D({title:U("notification.post.suspect.title"),message:U("notification.post.suspect.message"),type:"warning"}),g&&g()):(null===(c=null===(d=null==h?void 0:h.messages)||void 0===d?void 0:d.find)||void 0===c?void 0:c.call(d,(e=>{var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(D({message:U("notification.suspend.message"),type:"danger"}),g&&g()):D({message:(null===(p=null==h?void 0:h.messages)||void 0===p?void 0:p[0])||U("notification.failure"),type:"danger"})}));return b.default.createElement(l.StyledCreateNewPost,{className:n,style:d},b.default.createElement("div",{className:"input-group-container"},b.default.createElement(B,{className:"input-group",bannedWords:se,value:J,onChange:Y}),Z&&b.default.createElement(l.StyledError,null,b.default.createElement(r.Info,{isSolid:!0,color:i.theme.colors.red700,size:14}),b.default.createElement(s.Text,{size:"p3",as:"span",color:i.theme.colors.red700},U("createPost.popup.specialCharErr"))),b.default.createElement(j,{className:"input-group",bannedWords:se,value:ee,onChange:te,onPreviewUrlChange:pe,onInvalidUrlsChange:ge,onImageFilesChange:re,imageFiles:ie}),A&&b.default.createElement(l.StyledIsQuestion,{"data-is-marry-baby":z},b.default.createElement("div",{className:"switch-label"},b.default.createElement(r.Ask,{isMarryBaby:z,size:z?32:24,color:i.theme.colors.primaryBase,className:"label-icon"}),b.default.createElement("span",{className:"label-txt"},U("createPost.askDoctor"))),b.default.createElement(p.BtnChoice,{value:W,choices:[{label:U("createPost.askDoctorChoice.yes"),value:!0,dataEventCategory:"Together",dataEventAction:"Write Post Click - Ask Doctor",dataEventLabel:M},{label:U("createPost.askDoctorChoice.no"),value:!1}],onChange:e=>{"boolean"==typeof e&&(G(!1),V(e))}})),$&&b.default.createElement(l.StyledError,null,b.default.createElement(r.Info,{isSolid:!0,color:i.theme.colors.red700,size:14}),b.default.createElement(s.Text,{size:"p3",as:"span",color:i.theme.colors.red700},U("createPost.message.askDoctorRequire"))),b.default.createElement("div",{className:"input-group"},b.default.createElement(s.Text,{size:"p4",className:"input-group-label"},U("admin.community")),b.default.createElement(l.Dropdown,{options:(null==ue?void 0:ue.map((e=>({label:e.name,value:`${e.id||""}-${e.mappedCategoryId||""}`}))))||[],id:"community-picker",placeholder:U("community.choose"),value:ae,dropdownLabelTrackingAttributes:{"data-event-category":"Together","data-event-action":"Write Post Click - Choose Community/Topic","data-event-label":M},onChange:e=>{le({label:e.label,value:String(e.value)}),ne([])},disabled:!!h}),b.default.createElement(s.Text,{size:"sm",className:"warning",color:i.theme.colors.gray400},"* ",U("commentPopup.warning.newPost"))),!x&&b.default.createElement("div",{className:"input-group"},b.default.createElement(s.Text,{size:"p4",className:"input-group-label"},U("tab.topic")),b.default.createElement("div",{className:"input-notification"},b.default.createElement("img",{src:ce?"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%232D87F3'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e":_,loading:"lazy"}),b.default.createElement(s.Text,{size:"base",color:i.theme.colors.gray500},U(ce?"createPost.popup.primary":"createPost.popup.warning"))),ce&&b.default.createElement(O,{className:"tag-list",communityId:ce.id,forceTopics:y,onChange:ne,selectedTopics:oe,noFetch:S,dataEventCategory:"Together",dataEventAction:"Write Post Click - Choose Community/Topic",dataEventLabel:M}))),b.default.createElement("div",{className:"form-action"},b.default.createElement("div",{className:"input-group"},b.default.createElement(a.Checkbox,{className:"swich-input-group",labelPosition:"left",name:"PostAnonymous",checked:H,color:z?"pink":void 0,"data-event-category":"Together","data-event-action":"Write Post Click - Incognito","data-event-label":M,label:b.default.createElement("div",{className:"switch-label"},b.default.createElement("img",{className:"label-icon",src:c.CommonGAssets.getAssetPath("anomyous-avatar.svg"),alt:"anomyous avatar",style:{marginRight:"10px",width:"24px"},loading:"lazy"}),b.default.createElement("span",{className:"label-txt"},U("createPost.postAnonymous"))),value:"Post Anonymous",onChange:e=>q(e.currentTarget.checked),styles:{body:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},label:{display:"flex",alignItems:"center"}}})),b.default.createElement("div",{className:"input-group"},b.default.createElement(s.Button,{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:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(fe&&!K){X(!0);try{yield he()}catch(e){console.error(e),D(I(U))}X(!1)}})),disabled:!fe,loading:K},U("createPost.popup.submit")))))},exports.CreatePostDescription=j,exports.CreatePostTitle=B,exports.ImagePreviewPopup=q,exports.InputCommentBar=F,exports.LabelPin=A,exports.PopupDanger=D,exports.PostImagePreview=G,exports.PostSingleImageViewPopup=V,exports.SkipQuestionOfExpertBtn=l=>{var{post:n,onSkip:i,btnText:d,currentPageUrl:c}=l,u=e.__rest(l,["post","onSkip","btnText","currentPageUrl"]);const{t:m}=o.useTranslations(),{data:{locale:p},action:{pushNotifications:v}}=t.useContext(s.TogetherComponentGlobalContext),[g,f]=t.useState(!1),[h,y]=t.useState(!1),C=a.useMantineTheme(),E=t.useCallback((()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;y(!0);const t=yield s.callApiWithAuth(s.getApiPath(s.PATHS.USER.SKIP_QUESTION,{_locale:p,id:null==n?void 0:n.id}),"PUT");1===(null==t?void 0:t.status)?(null==i||i({id:(null==n?void 0:n.id)||"",communityId:(null===(e=null==n?void 0:n.community)||void 0===e?void 0:e.id)||""}),f(!1),v({title:"",message:"Skip success",type:"success"})):v({title:"",message:null==t?void 0:t.messages,type:"danger"}),y(!1)}))),[]);return b.default.createElement(a.Popover,{width:327,withArrow:!0,shadow:"md",opened:g},b.default.createElement(a.Popover.Target,null,b.default.createElement("div",Object.assign({className:`${Q} ${(null==u?void 0:u.className)||""}`,onClick:()=>f(!0)},u),d||m("profilePanel.questionNotClear"))),b.default.createElement(a.Popover.Dropdown,null,b.default.createElement("div",null,b.default.createElement("div",{className:K},m("profilePanel.skipQuestion.heading")),b.default.createElement("div",{className:X},m("profilePanel.skipQuestion.content")),b.default.createElement("div",{className:J},b.default.createElement(s.Button,{size:"md",variant:"secondary",leftIcon:b.default.createElement(r.Close,{color:C.fn.primaryColor(),size:24}),onClick:()=>f(!1),styles:()=>({leftIcon:{marginRight:0}})}),b.default.createElement(s.Button,{variant:"primary",size:"md",leftIcon:b.default.createElement(r.Check,{color:"white",size:24}),onClick:E,loading:h,"data-event-category":"Together","data-event-action":"Unclear Question Click","data-event-label":c,styles:()=>({leftIcon:{marginRight:0}})})))))},exports.SocialLinkPreview=Z,exports.SubmitReportForm=H,exports.TopicSelectList=O,exports.VerifiedTag=se,exports.types=ue;
1
+ "use strict";var e=require("./tslib.es6-888abbb9.js"),t=require("react"),a=require("@mantine/core"),l=require("./index-2631c46c.js"),o=require("./useTranslations-8ddbe2cf.js"),n=require("innertext"),i=require("./theme-6eebc8ce.js"),r=require("./index-6857ac87.js"),s=require("./index.styles-412e2fb9.js");require("@mantine/dates");var d=require("./index-9e7ea74e.js");require("./Onboarding-816df77b.js");var c=require("./gAssets.js");require("dayjs");var u=require("./screenSizeContext-f2fc50bf.js");require("styled-components"),require("./isProduction-fc8ac18d.js");var m=require("./index-118ca017.js");require("@mantine/hooks");var p=require("./index-f8dc542c.js"),v=require("./index.styled-786fe414.js"),g=require("./index-ecc9315a.js"),f=require("./index-0ca8783e.js"),h=require("lodash/debounce"),y=require("react-contenteditable");require("./useCategory-20ea92de.js");var C=require("./index-ed62f07d.js"),E=require("react-dom");function w(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function k(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var l=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,l.get?l:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}require("date-fns"),require("react-day-picker/DayPickerInput"),require("./index-a0e02781.js"),require("lodash/throttle"),require("./types-1879adc0.js"),require("react-hook-form"),require("date-fns/locale/en-US"),require("date-fns/locale/id"),require("date-fns/locale/vi"),require("date-fns/locale/zh-TW"),require("./index.styled-96db1a5a.js"),require("uuid"),require("./utils-8a0e7a73.js"),require("string-format");var b=w(t),P=w(n),T=w(h),S=w(y),x=k(E);const N=({title:o,url:n,image:i,logo:r,className:d,style:c,noRefetch:u})=>{const{data:{locale:m,env:{isMarryBaby:p}}}=t.useContext(s.TogetherComponentGlobalContext),[v,f]=t.useState(!1),h=a.useMantineTheme(),y=t.useRef(u);y.current=u;const[C,E]=t.useState(null);t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){if(!y.current){if(!n)return E(null);E((e=>Object.assign(Object.assign({},e),{isFetching:!0}))),s.callApi(s.getApiPath(s.PATHS.FETCH_PREVIEW,{_locale:m}),"POST",{data:{link:n},headers:{"Content-Type":"application/json"}}).then((e=>{var t,a,l;f(!1),E({title:null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.title,url:n,image:(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.image)||(null===(l=null==e?void 0:e.data)||void 0===l?void 0:l.logo)})})).catch((()=>{E(null)}))}}))}),[n]);const w=(null==C?void 0:C.image)||i,k=(null==C?void 0:C.title)||o,P=(null==C?void 0:C.logo)||r,T=(null==C?void 0:C.url)||n,S=T.replace("http://","").replace("https://","").split(/[/?#]/)[0],x=t.useRef(!1);return b.default.createElement(l.StyledCardLink,{"data-is-marrybaby":p,className:`${d} no-replace-click`,style:c,color:h.colors[h.primaryColor][0]},b.default.createElement("a",{href:T,target:"_blank",rel:"noreferrer"},w&&b.default.createElement("div",{className:"link-image-wrapper"},!p&&b.default.createElement("img",{className:"link-image-blur",src:w,onError:e=>{x.current||(x.current=!0,e.currentTarget.src=s.DEFAULT_IMG)},loading:"lazy"}),b.default.createElement("img",{className:"link-image",src:w,onError:e=>{x.current||(x.current=!0,e.currentTarget.src=s.DEFAULT_IMG)},loading:"lazy"})),b.default.createElement("div",{className:"link-info-container"},b.default.createElement(g.Text,{size:"n1"},p&&P&&!v&&b.default.createElement("img",{className:"link-logo",src:P,onError:()=>f(!0),loading:"lazy"}),S),b.default.createElement(s.Heading,{tag:"h6"},k))))};const A=({onClick:e,color:a,className:n,style:i})=>{const{data:{env:{isMarryBaby:r}}}=t.useContext(s.TogetherComponentGlobalContext),{t:d}=o.useTranslations();return b.default.createElement(l.LabelSortPin,{label:b.default.createElement(b.default.Fragment,null,r&&b.default.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M3.5 19.9999L7.87 15.6299' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.95634 11.294C4.56534 11.685 4.56534 12.318 4.95634 12.708L7.87434 15.626L10.7923 18.544C11.1833 18.935 11.8163 18.935 12.2063 18.544L13.3813 17.369C13.5693 17.181 13.6743 16.927 13.6743 16.662V12.726L16.5743 9.82597L18.8833 9.94897C19.1663 9.96397 19.4433 9.85797 19.6433 9.65797L20.2173 9.08397C20.6083 8.69297 20.6083 8.05997 20.2173 7.66997L15.8313 3.28397C15.4403 2.89297 14.8073 2.89297 14.4173 3.28397L13.8433 3.85797C13.6423 4.05897 13.5363 4.33497 13.5523 4.61797L13.6753 6.92697L10.7753 9.82697H6.83834C6.57334 9.82697 6.31834 9.93197 6.13134 10.12L4.95634 11.294V11.294Z' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3cpath d='M16.5699 9.83018L13.6699 6.93018' stroke='%23FB8C00' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e %3c/svg%3e",loading:"lazy"})," ",d("label.pinnedPost")),rightLabel:!r&&b.default.createElement("img",{className:"label-sort-pin-icon",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cline x1='7.18605' y1='7.68219' x2='3.68219' y2='13.8139' stroke='%23FEA21E' stroke-linecap='round'/%3e%3cpath d='M3.24591 7.78426C3.21275 7.84168 3.20376 7.90993 3.22092 7.97398C3.23808 8.03803 3.27998 8.09264 3.3374 8.12579L8.78429 11.2706C8.90385 11.3396 9.05674 11.2986 9.12578 11.1791C9.71191 10.1641 9.71348 8.97262 9.23682 7.99339L10.8583 5.18521C11.5115 5.00603 12.0982 4.57973 12.4638 3.94629C12.5328 3.82672 12.4919 3.67383 12.3723 3.6048L8.18237 1.18584C8.12494 1.15268 8.0567 1.1437 7.99265 1.16086C7.92861 1.17803 7.874 1.21993 7.84086 1.27736C7.47521 1.91077 7.39934 2.63194 7.57065 3.28723L5.94919 6.09545C4.86323 6.1723 3.83201 6.76934 3.24591 7.78426Z' fill='%23FEA21E' stroke='%23FEA21E' stroke-width='0.5' stroke-linejoin='round'/%3e%3c/svg%3e",loading:"lazy"}),onClick:e,color:"white",className:`label-pinned ${n}`,style:i})},I=e=>({message:e("notification.failure"),type:"danger"});var _="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%23FE921D'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const M=(e,a)=>{const[l,o]=t.useState(e||[]);return{onSelectImages:t=>{const n=t.target.files;if(n)if(a&&e){a((e||l).concat(Array.from(n)))}else o((t=>{const l=e||t;return a&&a(l.concat(Array.from(n))),l.concat(Array.from(n))}))},onRemoveImage:t=>{if(a&&e){const l=e;l.splice(t,1),a(l.slice())}else o((l=>{const o=e||l;return o.splice(t,1),a&&a(o.slice()),o.slice()}))},onRemoveAllImages:()=>{a?a([]):o([])},imageSrcs:t.useMemo((()=>(e||l).map((e=>"string"==typeof e?e:URL.createObjectURL(e)))),[e,l]),imageFiles:e||l}};var L="data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 22.9844C17.5228 22.9844 22 18.5072 22 12.9844C22 7.46153 17.5228 2.98438 12 2.98438C6.47715 2.98438 2 7.46153 2 12.9844C2 18.5072 6.47715 22.9844 12 22.9844Z' fill='%23262626'/%3e%3cpath d='M14.8281 10.1562L9.17127 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.17188 10.1562L14.8287 15.8131' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const j=({className:e,style:a,bannedWords:n=[],value:r,onChange:d,onPreviewUrlChange:c,onInvalidUrlsChange:u,onImageFilesChange:m,imageFiles:p,isReplying:v})=>{const{t:f}=o.useTranslations(),[h,y]=t.useState(null),C=t.useRef(null),{onSelectImages:E,onRemoveImage:w,imageSrcs:k}=M(p,m);return t.useEffect((()=>{c&&((null==h?void 0:h.url)?c({title:h.title||"",url:h.url||"",image:h.image||"",description:h.description||""}):c(null))}),[h]),b.default.createElement(l.StyledCreatePostDescription,{className:e,style:a},b.default.createElement(g.Text,{size:"p4",className:"description-label"},f("createPost.popup.description")),b.default.createElement("div",{className:"textarea-control"},b.default.createElement("div",{className:"textarea-wrapper"},b.default.createElement(l.RichTextEditor,{html:r||"",onChange:d,bannedWords:n,onImagePickerClick:()=>{var e;return null===(e=C.current)||void 0===e?void 0:e.click()},onPreviewUrlChange:y,onInvalidUrlsChange:u,isReplying:v}))),b.default.createElement(g.Text,{size:"p4",className:"count-string"},f("character"),": ",P.default(r||"").length),(!k||0===k.length)&&h&&b.default.createElement("div",{className:"link-preview-wrapper"},h.isFetching?b.default.createElement(l.Loading,null):b.default.createElement(b.default.Fragment,null,b.default.createElement(N,{title:h.title,url:h.url||"#",image:h.image,noRefetch:!0}),b.default.createElement("img",{src:L,className:"icon-close",onClick:()=>y(null),loading:"lazy"}))),b.default.createElement("input",{ref:C,type:"file",accept:"image/png, image/gif, image/jpeg",multiple:!0,style:{display:"none"},onChange:E}),k.length>s.MAX_IMAGE_UPLOADS?b.default.createElement("div",{className:"input-notification"},b.default.createElement("img",{src:_,loading:"lazy"}),b.default.createElement(g.Text,{size:"p4",color:i.theme.colors.alertWarning},f("createPost.popup.warningImage"))):null,k.length>0&&b.default.createElement("div",{className:"image-gallery"},k.map(((e,t)=>b.default.createElement("div",{key:t,className:"image-item"},b.default.createElement("img",{src:e,loading:"lazy"}),b.default.createElement("img",{className:"close-btn",src:L,onClick:()=>w(t),loading:"lazy"}))))))},R=(e,t)=>{if(!t)return e;const{limit:a,bannedWords:o=[]}=t,n="number"==typeof a&&a>=0?e.substring(0,a):e;return l.highlightBadWords(n,o)},B=({className:e,style:a,bannedWords:n=[],value:i,onChange:r})=>{var s;const{t:d}=o.useTranslations(),[c,u]=t.useState(""),m=t.useRef(null);t.useEffect((()=>{if(m.current){const e=e=>{var t;e.preventDefault();const a=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,a)},t=m.current;return t.addEventListener("paste",e,{passive:!0}),()=>t.removeEventListener("paste",e)}}),[m]);const p=(null==n?void 0:n.join(","))||"";t.useEffect((()=>{var e;if(p){const t=null===(e=m.current)||void 0===e?void 0:e.innerText;if(t){const e=l.highlightBadWords(t,n);e!==t&&(r&&r(e),u(e))}}}),[p]);const v=t.useCallback(T.default((()=>{if(m.current){const e=R(m.current.innerText,{limit:120,bannedWords:n});r&&r(e),u(e)}}),300),[]);return t.useEffect((()=>{setTimeout((()=>{var e;null===(e=m.current)||void 0===e||e.focus()}),500)}),[]),b.default.createElement(l.StyledCreatePostTitle,{className:e,style:a},b.default.createElement(f.Input,{name:"title",value:i||c,size:"md",label:d("createPost.title"),CustomInput:b.default.createElement(S.default,{innerRef:m,html:i||c,onChange:()=>{if(m.current&&m.current.innerText!==(i||c)){const e=R(m.current.innerText,{bannedWords:n});r&&r(e),u(e),v()}},className:"title-input"})}),b.default.createElement(g.Text,{size:"p4",className:"count-string"},d("createPost.popup.wordCount",{count:(null===(s=m.current)||void 0===s?void 0:s.innerText.length)||0,max:120})))},O=({className:a,style:o,topics:n,communityId:i,onChange:r,isLoading:d,disabled:c,forceTopics:u,selectedTopics:m,noFetch:p,dataEventCategory:g,dataEventAction:f,dataEventLabel:h})=>{const{data:{locale:y,env:{isMarryBaby:C}}}=t.useContext(s.TogetherComponentGlobalContext),[E,w]=t.useState(n?[...n]:[]),[k,P]=t.useState(m?[...m]:[]),[T,S]=t.useState(!1),x=t.useRef(n);x.current=n,t.useEffect((()=>{var t;!i||p||(null===(t=x.current)||void 0===t?void 0:t.length)||(w([]),S(!0),e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{const t=yield s.callApi(s.getApiPath(s.PATHS.TOPIC.LIST,{communityId:i,_locale:y}),"GET"),a=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.topics;Array.isArray(a)&&w((()=>(null==a?void 0:a.map(v.formatTopic).sort(((e,t)=>(e.order||0)-(t.order||0))))||[]))}catch(e){console.log(e),S(!1)}S(!1)})))}),[i,p]);const N=null==n?void 0:n.map((e=>e.id)).join("-"),A=null==E?void 0:E.map((e=>e.id)).join("-"),I=null==u?void 0:u.map((e=>e.id)).join("-");t.useEffect((()=>{n&&void 0!==N&&N!==A&&w(n)}),[n,N,A]);const _=t.useMemo((()=>E.filter((e=>!(null==u?void 0:u.some((t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId)))))),[A,I]);return b.default.createElement(l.StyledTopicSelectList,{"data-is-marrybaby":C,className:a,style:o},u.map((e=>b.default.createElement(z,{key:`${e.id}-${e.mappedCategoryId}`,topic:e,disabled:!0,selected:!0,dataEventAction:f,dataEventCategory:g,dataEventLabel:h}))),_.map((e=>b.default.createElement(z,{key:`${e.id}-${e.mappedCategoryId}`,topic:e,disabled:c,selected:(m||k).some((t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId)),onClick:()=>{const t=m||k,a=t.findIndex((t=>t.id&&t.id===e.id||t.mappedCategoryId&&t.mappedCategoryId===e.mappedCategoryId));-1!==a?t.splice(a,1):t.push(e),r&&m?r(t.slice()):(r&&r(t.slice()),P(t.slice()))},dataEventAction:f,dataEventCategory:g,dataEventLabel:h}))),(d||T)&&b.default.createElement(l.Loading,{className:"topic-spinner"}))},z=t=>{var{topic:a,disabled:l,selected:o,onClick:n}=t,i=e.__rest(t,["topic","disabled","selected","onClick"]);return b.default.createElement("div",Object.assign({className:"tag-item"+(o?" --active":""),"data-disabled":l,onClick:l?void 0:n},i),a.name)},D=({className:e,isMarryBaby:a,style:o,title:n,description:i,acceptText:r,cancelText:d,onAccept:c,onCancel:m,thumbnail:p,isThumbnailIcon:v,onClose:f,acceptBtnTracking:h,acceptBtnProps:y,cancelBtnProps:E})=>{const{data:{env:{isMarryBaby:w}}}=t.useContext(s.TogetherComponentGlobalContext),k="boolean"==typeof a?a:w,[P,T]=t.useState(!1);return t.useEffect((()=>(u.toggleNoScroll(!0),setTimeout((()=>T(!0)),0),()=>u.toggleNoScroll(!1))),[]),"undefined"==typeof window?null:x.createPortal(b.default.createElement(l.StyledPopupDanger,{"data-is-marrybaby":k,className:e,style:o,"data-open":P},b.default.createElement(l.PopupFrame,{className:"popup-frame",isOpen:P,onClose:f},b.default.createElement("div",{className:"confirm-dialog",onClick:e=>e.stopPropagation()},b.default.createElement("div",{className:"confirm-content"},p&&b.default.createElement("div",{className:"thumbnail-container "+(v?"is-icon":"")},b.default.createElement("img",{className:"thumbnail",src:p,loading:"lazy"})),b.default.createElement(s.Heading,{className:"title",tag:"h2"},n),b.default.createElement(g.Text,{className:"desc",size:"lg"},i),b.default.createElement("div",{className:"btn-group"},b.default.createElement(C.Button,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",color:"tertiary",onClick:()=>{null==c||c(),null==f||f()}},y,h),r),b.default.createElement(C.Button,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",onClick:()=>{null==m||m(),null==f||f()}},E),d)))),k&&p&&b.default.createElement("div",{className:"thumbnail-container is-mobile "+(v?"is-icon":"")},b.default.createElement("img",{className:"thumbnail",src:p,loading:"lazy"})))),u.getPopupWrapperDom())};const F=({isReply:a,className:n,onClose:i,replyToName:r,style:d,replyingId:c,replyingUser:u,onPostSuccess:m,post:p,isMarryBaby:h})=>{const{action:{pushNotifications:y,sanitizeFunction:E},data:{userInfo:w,locale:k,env:{isMarryBaby:P}}}=t.useContext(s.TogetherComponentGlobalContext),T="boolean"==typeof h?h:P,{t:S}=o.useTranslations(),{onSelectImages:x,onRemoveImage:A,imageSrcs:I,onRemoveAllImages:_,imageFiles:j}=M(),[R,B]=t.useState(""),{trigger:O}=t.useContext(l.MainInputTriggerContext),[z,D]=t.useState(!1),F=t.useRef(null),U=t.useRef(null),H=t.useRef(null),[q,W]=t.useState([]),[V,$]=t.useState([]),[G,Z]=t.useState(null);return t.useEffect((()=>{var e;null===(e=H.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout((()=>{var e;null===(e=U.current)||void 0===e||e.focus()}),400)}),[O]),b.default.createElement(l.StyledInputCommentBar,{"data-is-reply":a,className:n,style:d},a&&b.default.createElement("div",{className:"reply-to-container"},b.default.createElement(g.Text,{size:"p4"},b.default.createElement("span",{dangerouslySetInnerHTML:{__html:S("inputComment.replyTo",{name:`<span style="color: #2D87F3; cursor: pointer">@${r||""}</span>`})}})),b.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8.00016' cy='8.50004' r='6.66667' fill='white' stroke='%23404040'/%3e%3cpath d='M10 6.5L6 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6 6.5L10 10.5' stroke='%23404040' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-close-comment",onClick:()=>i&&i(),loading:"lazy"})),b.default.createElement("div",{className:"input-container",ref:H},b.default.createElement(v.UserAvatar,{className:"avatar-wrapper "+(a?"avatar-wrapper-reply":""),avatar:(null==w?void 0:w.id)?w.avatar:s.DEFAULT_AVATAR_IMG,username:(null==w?void 0:w.name)||(null==w?void 0:w.username)}),b.default.createElement("input",{ref:F,onChange:x,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),b.default.createElement(f.Input,{value:R,name:"input",size:"md",className:"input-wrapper",displayIcon:b.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.7543 4.85352H4.49227C4.01776 4.85352 3.56268 5.04201 3.22715 5.37754C2.89162 5.71307 2.70313 6.16815 2.70312 6.64266V19.1667C2.70313 19.6412 2.89162 20.0963 3.22715 20.4318C3.56268 20.7673 4.01776 20.9558 4.49227 20.9558H17.0163C17.4908 20.9558 17.9459 20.7673 18.2814 20.4318C18.6169 20.0963 18.8054 19.6412 18.8054 19.1667V12.9047' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M17.4633 3.51187C17.8192 3.15599 18.3019 2.95605 18.8052 2.95605C19.3085 2.95605 19.7912 3.15599 20.147 3.51187C20.5029 3.86775 20.7029 4.35044 20.7029 4.85373C20.7029 5.35702 20.5029 5.83971 20.147 6.19559L11.6486 14.694L8.07031 15.5886L8.96489 12.0103L17.4633 3.51187Z' stroke='%232D87F3' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",loading:"lazy"}),CustomInput:b.default.createElement("div",{className:"as-input"},b.default.createElement(l.RichTextEditor,{className:"textarea",html:R,onChange:B,onImagePickerClick:()=>{var e;return null===(e=F.current)||void 0===e?void 0:e.click()},bannedWords:V,onPreviewUrlChange:Z,onInvalidUrlsChange:W,setEditorRef:e=>U.current=e,isReplying:a}))}),b.default.createElement(C.Button,{theme:T?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var t,o,n,r,d,g,f,h,C;if((null==p?void 0:p.id)&&!z){D(!0);try{const w=e=>{B(""),_(),i&&i();const t=v.formatComment(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),m&&m(t)},b=yield(({postId:t,message:a,photos:o,link:n,locale:i,sanitizeFunction:r,replyingUserId:d,replyingUserName:c,replyingId:u})=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=new FormData;let m=l.encodePostContent(a.replace(/(\&nbsp;)+/g," "),r);const p=l.getMentionIdsFromString(m);return o&&o.length>0&&(yield Promise.all(null==o?void 0:o.map((e=>l.uploadAndGetSrc(e,i))))).filter(Boolean).slice(0,s.MAX_IMAGE_UPLOADS).forEach((t=>{e.append("images[]",t)})),n&&e.append("link",n),null==p||p.forEach((t=>{e.append("mention_ids[]",t)})),e.append("post_id",t),u&&e.append("parent_id",u),d&&(p.unshift(d),m=`[mention+id="${d}"+name="${(c||"").replace('"',"'")}"]${m}`,e.append("parent_user_id",String(d))),e.append("content",m),e.append("content",m),e})))(Object.assign({message:R,photos:j,postId:String(p.id),link:null==G?void 0:G.url,sanitizeFunction:E,locale:k},a&&c?{replyingUserId:String((null==u?void 0:u.id)||(null===(t=null==p?void 0:p.author)||void 0===t?void 0:t.id)||""),replyingId:c,replyingUserName:(null==u?void 0:u.name)||(null==u?void 0:u.username)||""}:{})),P=yield a&&c?((t,a)=>e.__awaiter(void 0,void 0,void 0,(function*(){return s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.REPLY,{_locale:a}),"POST",{data:t})})))(b,k):((t,a)=>e.__awaiter(void 0,void 0,void 0,(function*(){return s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.CREATE,{_locale:a}),"POST",{data:t})})))(b,k),T=null==P?void 0:P.data;(null==T?void 0:T.id)&&!(null===(n=null===(o=null==P?void 0:P.messages)||void 0===o?void 0:o.moderation)||void 0===n?void 0:n.type)?w(P):"banned"===(null===(d=null===(r=null==P?void 0:P.messages)||void 0===r?void 0:r.moderation)||void 0===d?void 0:d.type)?(y({title:S("notification.comment.blocked.title"),message:S("notification.comment.blocked.message"),type:"danger"}),P.messages.moderation.words&&$(P.messages.moderation.words)):"suspect"===(null===(f=null===(g=null==P?void 0:P.messages)||void 0===g?void 0:g.moderation)||void 0===f?void 0:f.type)?(y({title:S("notification.comment.suspect.title"),message:S("notification.comment.suspect.message"),type:"warning"}),B(""),_(),i&&i()):(null===(h=null==P?void 0:P.messages)||void 0===h?void 0:h.find((e=>{var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(y({message:S("notification.suspend.message"),type:"warning"}),B(""),_(),i&&i()):y({title:"",message:(null===(C=null==P?void 0:P.messages)||void 0===C?void 0:C[0])||S("notification.comment.somethingWrong"),type:"danger"})}catch(e){y({title:"",message:S("notification.comment.somethingWrong"),type:"danger"})}D(!1)}})),isLoading:z,isDisabled:!!(null==q?void 0:q.length)||z||!R||(null==R?void 0:R.length)<2||!R.trim()},b.default.createElement("img",{src:"data:image/svg+xml,%3csvg width='20' height='21' viewBox='0 0 20 21' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.5 9.73438L3.75 13.4844L7.5 17.2344' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M16.25 4.73438L16.25 10.3026C16.25 11.1464 15.9208 11.9557 15.3347 12.5524C14.7487 13.1491 13.9538 13.4844 13.125 13.4844L3.75 13.4844' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",className:"icon-enter",loading:"lazy"}))),(null==q?void 0:q.length)?b.default.createElement("div",{className:"error-text"},S("notification.limitUrlDomain")):null,(!I||0===I.length)&&G&&b.default.createElement("div",{className:"link-preview-wrapper"},G.isFetching?b.default.createElement(l.Loading,null):b.default.createElement(b.default.Fragment,null,b.default.createElement(N,{title:G.title,url:G.url||"#",image:G.image,noRefetch:!0}),b.default.createElement("img",{src:L,className:"icon-close",onClick:()=>Z(null),loading:"lazy"}))),I&&I.length>0&&b.default.createElement("div",{className:"preview-images-container"},I.map(((e,t)=>b.default.createElement("div",{key:t,className:"image-src-wrapper"},b.default.createElement("img",{className:"preview-image",src:e,loading:"lazy"}),b.default.createElement("img",{src:L,className:"icon-close-circle",onClick:()=>A(t),loading:"lazy"}))))))};var U="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 5V8' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11H8.00708' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const H=({className:a,style:n,reason:r,reasonText:d,onClose:c,postId:u})=>{const{data:{locale:m,env:{isMarryBaby:p}},action:{pushNotifications:v}}=t.useContext(s.TogetherComponentGlobalContext),{t:f}=o.useTranslations(),[h,y]=t.useState(!1);return b.default.createElement(l.StyledSubmitReportForm,{"data-is-marrybaby":p,className:a,style:n},b.default.createElement("ul",{className:"report-list"},b.default.createElement("li",{className:"report-item"},b.default.createElement("img",{src:U,loading:"lazy"}),b.default.createElement(g.Text,{className:"__label",color:i.theme.colors.gray800,size:"p4"},d))),b.default.createElement(C.Button,{theme:p?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:h,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(u&&!h){y(!0);try{const e=yield(({id:e,reason:t,locale:a})=>{const l=new FormData;return l.append("reason",t),s.callApiWithAuth(s.getApiPath(s.PATHS.POST.REPORT,{_locale:a,id:e}),"POST",{data:l})})({id:u,reason:r,locale:m});1===(null==e?void 0:e.status)&&(v({message:"Post reported",type:"success"}),c&&c())}catch(e){}y(!1)}}))},f("submit")))};const q=({className:e,style:n,authorName:i,images:r,onClose:s,onOpenSingleView:d,alt:c})=>{const{t:u}=o.useTranslations(),[m,p]=t.useState(!1);return t.useEffect((()=>{setTimeout((()=>{p(!0)}),0)}),[]),b.default.createElement(a.Portal,null,b.default.createElement(l.StyledImagePreviewPopup,{className:e,style:n,"data-open":m},b.default.createElement("div",{className:"top-bar"},b.default.createElement("img",{className:"icon-arrow-left",src:"data:image/svg+xml,%3csvg width='24' height='25' viewBox='0 0 24 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M10.0508 18.0607L4.00078 12.0367L10.0508 6.01172' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4.00195 12.0352L19.002 12.0352' stroke='%23262626' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",onClick:s,alt:"go back",loading:"lazy"}),b.default.createElement(g.Text,{size:"p2",type:"bold",style:{textAlign:"center"}},u("previewPhotos.title",{name:i}))),b.default.createElement("div",{className:"container"},r.map(((e,t)=>b.default.createElement("img",{className:"img-preview",key:t,src:e,onClick:()=>null==d?void 0:d(t),alt:c,loading:"lazy"}))))),",")};var W="data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12.8125L10 8.8125L6 4.8125' stroke='white' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const V=({initialViewIndex:e,images:o,onClose:n,alt:i})=>{const[r,s]=t.useState(e),[d,c]=t.useState(!1);t.useEffect((()=>{setTimeout((()=>{c(!0)}),0)}),[]);const u=null==o?void 0:o[r],m=0===r,p=!(null==o?void 0:o.length)||r===(null==o?void 0:o.length)-1;return b.default.createElement(a.Portal,null,b.default.createElement(l.StyledImagePreviewContainer,{"data-open":d&&!!u},b.default.createElement(l.StyledImagePreviewTopbar,null,b.default.createElement("img",{src:l.img,className:"icon-close",onClick:n,alt:"close",loading:"lazy"})),u&&r>=0&&b.default.createElement(b.default.Fragment,null,b.default.createElement(l.StyledImagePreviewWrapper,null,b.default.createElement("img",{className:"img-preview",src:u,alt:i,loading:"lazy"}),b.default.createElement(l.StyledArrowWrapper,{"data-disabled":m,onClick:()=>!m&&s(r-1)},b.default.createElement(l.StyledCircleArrow,null,b.default.createElement("img",{src:W,style:{transform:"rotate(180deg)"},alt:"left arrow","data-disabled":m,loading:"lazy"}))),b.default.createElement(l.StyledArrowWrapper,{"data-right":!0,"data-disabled":p,onClick:()=>!p&&s(r+1)},b.default.createElement(l.StyledCircleArrow,null,b.default.createElement("img",{src:W,alt:"right arrow","data-disabled":p,loading:"lazy"})))))))},$=({image:e,showIcon:a=!0})=>{const[o,n]=t.useState(!0);return b.default.createElement(l.StyledWrapper$1,{"data-is-blurred":o,onClick:e=>o&&e.stopPropagation()},b.default.createElement("img",{loading:"lazy",className:"img-preview",src:e}),b.default.createElement(l.StyledInner,{onClick:e=>{e.stopPropagation(),n(!o)}},a&&b.default.createElement(l.StyledIcon,null,o?b.default.createElement("svg",{width:"22",height:"20",viewBox:"0 0 22 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.71 2.5399C1.32 2.1499 1.32 1.5199 1.71 1.1299C2.1 0.739902 2.74 0.739902 3.13 1.1299L19.44 17.4599C19.83 17.8499 19.83 18.4799 19.44 18.8699C19.05 19.2599 18.42 19.2599 18.03 18.8699L15.31 16.1499C13.97 16.6699 12.52 16.9699 11 16.9699C6 16.9699 1.73 13.8599 0 9.4699C0.77 7.4999 2.06 5.7999 3.68 4.5099L1.71 2.5399ZM16 9.4699C16 6.7099 13.76 4.4699 11 4.4699C10.49 4.4699 10 4.5699 9.53 4.7099L7.36 2.5399C8.51 2.1699 9.73 1.9699 11 1.9699C16 1.9699 20.27 5.0799 22 9.4599C21.31 11.2199 20.21 12.7599 18.82 13.9899L15.76 10.9299C15.9 10.4699 16 9.9799 16 9.4699ZM11 14.4699C8.24 14.4699 6 12.2299 6 9.4699C6 8.6999 6.18 7.9699 6.49 7.3299L8.06 8.8999C8.03 9.0799 8 9.2699 8 9.4699C8 11.1299 9.34 12.4699 11 12.4699C11.2 12.4699 11.38 12.4399 11.57 12.3999L13.14 13.9699C12.49 14.2899 11.77 14.4699 11 14.4699ZM13.97 9.1399C13.82 7.7399 12.72 6.6499 11.33 6.4999L13.97 9.1399Z",fill:"white"})):b.default.createElement("svg",{width:"23",height:"16",viewBox:"0 0 23 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.default.createElement("path",{d:"M11.9999 0C5.14188 0 1.88558 5.87864 1.09558 7.55664C0.963582 7.83664 0.963582 8.16141 1.09558 8.44141C1.88558 10.1204 5.14188 16 11.9999 16C18.8339 16 22.0924 10.1629 22.8964 8.46094C23.0344 8.16794 23.0344 7.83206 22.8964 7.53906C22.0924 5.83706 18.8339 0 11.9999 0ZM11.9999 3C14.7609 3 16.9999 5.239 16.9999 8C16.9999 10.761 14.7609 13 11.9999 13C9.23888 13 6.99988 10.761 6.99988 8C6.99988 5.239 9.23888 3 11.9999 3ZM11.9999 5C11.2042 5 10.4412 5.31607 9.87856 5.87868C9.31595 6.44129 8.99988 7.20435 8.99988 8C8.99988 8.79565 9.31595 9.55871 9.87856 10.1213C10.4412 10.6839 11.2042 11 11.9999 11C12.7955 11 13.5586 10.6839 14.1212 10.1213C14.6838 9.55871 14.9999 8.79565 14.9999 8C14.9999 7.20435 14.6838 6.44129 14.1212 5.87868C13.5586 5.31607 12.7955 5 11.9999 5Z",fill:"#2D87F3"})))))},G=({className:e,images:a=[],style:n,authorName:i,isSensitive:r=!1,alt:d})=>{const{data:{env:{isMarryBaby:c}}}=t.useContext(s.TogetherComponentGlobalContext),{t:m}=o.useTranslations(),p="+ "+((a.length||0)-4),[v,g]=t.useState(!1),[f,h]=t.useState(-1),y=a.length>5,C=t.useRef(!1);return t.useEffect((()=>()=>{C.current&&u.toggleNoScroll(!1)}),[]),t.useEffect((()=>{v||f>=0?(u.toggleNoScroll(!0),C.current=!0):(u.toggleNoScroll(!1),C.current=!1)}),[v,f]),b.default.createElement(b.default.Fragment,null,r&&b.default.createElement(l.StyledNotificationBar,{message:m("sensitiveMask.contentWarningDescription"),icon:b.default.createElement("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.default.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.00002 0.666748C4.40002 0.666748 0.666687 4.40008 0.666687 9.00008C0.666687 13.6001 4.40002 17.3334 9.00002 17.3334C13.6 17.3334 17.3334 13.6001 17.3334 9.00008C17.3334 4.40008 13.6 0.666748 9.00002 0.666748ZM9.00002 9.83341C8.54169 9.83341 8.16669 9.45841 8.16669 9.00008V5.66675C8.16669 5.20842 8.54169 4.83342 9.00002 4.83342C9.45835 4.83342 9.83335 5.20842 9.83335 5.66675V9.00008C9.83335 9.45841 9.45835 9.83341 9.00002 9.83341ZM8.16669 11.5001V13.1667H9.83335V11.5001H8.16669Z",fill:"#FE921D"}))}),b.default.createElement(l.StyledPostImagePreview,{className:e,style:n,"data-image-count":y?5:a.length||0,"data-is-marrybaby":c,"data-cursor-pointer":!r},null==a?void 0:a.slice(0,5).map(((e,t)=>{const a=4===t&&y;return b.default.createElement("div",{className:"img-wrapper",key:t,onClick:()=>{t>=4&&y?g(!0):h(t)}},r&&b.default.createElement($,{image:e,showIcon:!a}),!c&&b.default.createElement("img",{loading:"lazy",className:"img-preview-blur",src:e,alt:d}),b.default.createElement("img",{loading:"lazy",className:"img-preview",src:e,alt:d}),a&&b.default.createElement("div",{className:"img-more-overlay"},b.default.createElement(s.Heading,{tag:"h1",as:"h2",color:"white"},p)))}))),v&&b.default.createElement(q,{authorName:i||"",images:a,onClose:()=>g(!1),onOpenSingleView:h,alt:d}),f>=0&&b.default.createElement(V,{images:a,initialViewIndex:f,onClose:()=>h(-1),alt:d}))},Z=({url:o,image:n,className:i,style:r,autoPlay:d=!0})=>{const{data:{locale:c}}=t.useContext(s.TogetherComponentGlobalContext),[u,p]=t.useState(null);t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){if(!n){if(!o)return p(null);p((e=>Object.assign(Object.assign({},e),{isFetching:!0}))),s.callApi(s.getApiPath(s.PATHS.FETCH_PREVIEW,{_locale:c}),"POST",{data:{link:o},headers:{"Content-Type":"application/json"}}).then((e=>{var t,a;p({url:o,image:(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.image)||(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.logo)})})).catch((()=>{p(null)}))}}))}),[o,n]);const v=n||(null==u?void 0:u.image),g=(null==u?void 0:u.url)||o,f=t.useMemo((()=>l.youtubeVidIdGetter(g)),[g]),h=t.useMemo((()=>g.includes("facebook.com")||g.includes("fb.watch")),[g]),y=t.useRef(0),C=t.useRef(0),[E,w]=t.useState(!1);t.useEffect((()=>{const e=()=>{var e;const t=null===(e=k.current)||void 0===e?void 0:e.getBoundingClientRect();let a=!1;t&&(!y.current||Math.abs((y.current-t.width)/(null==t?void 0:t.width))>.2)&&(y.current=Math.floor(t.width),a=!0),t&&(!C.current||Math.abs((C.current-t.height)/(null==t?void 0:t.height))>.2)&&(C.current=Math.floor(t.height),a=!0),a&&w((e=>!e))};return e(),window.addEventListener("resize",e,{passive:!0}),()=>{window.removeEventListener("resize",e)}}),[]);const k=t.useRef(null),P=a.useMantineTheme();return b.default.createElement(l.StyledSocialLinkPreview,{className:`${i} no-replace-click`,style:r,ref:k,color:P.colors[P.primaryColor][0]},n||!f&&!h?b.default.createElement("a",{href:g,target:"_blank",rel:"noreferrer"},b.default.createElement("div",{className:"link-image-wrapper "+((null==u?void 0:u.isFetching)?"fetching":"")},(null==u?void 0:u.isFetching)?b.default.createElement(l.Loading,{className:"loading-spinner"}):b.default.createElement(m.ImageWrap,{className:"link-image",src:v||s.DEFAULT_IMG,backupSrc:s.DEFAULT_IMG,alt:g}))):b.default.createElement("div",{className:"link-image-wrapper"},f?b.default.createElement("iframe",{width:"100%",height:"100%",src:`https://www.youtube.com/embed/${f}?&autoplay=${d?1:0}&mute=1&enablejsapi=1`,frameBorder:"0",allowFullScreen:!0,style:{position:"absolute",top:0,left:0,border:"none",overflow:"hidden"},loading:"lazy"}):h?b.default.createElement("iframe",{key:String(E),src:`https://www.facebook.com/plugins/video.php?href=${encodeURIComponent(g)}&autoplay=${d?1:0}&show_text=false&t=0&width=${y.current}&height=${C.current}`,style:{position:"absolute",top:"50%",left:"50%",border:"none",overflow:"hidden",height:C.current,width:y.current,transform:"translate(-50%, -50%)"},scrolling:"no",frameBorder:"0",allowFullScreen:!0,allow:"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share",loading:"lazy"}):null))};var Q="KsWg8i6",K="_9tS0EUN",X="kyyRKlb",J="-Uqqka-";var Y="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10Z' fill='%233E3F58'/%3e %3cpath d='M19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10Z' fill='%233E3F58'/%3e %3cpath d='M12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z' fill='%233E3F58'/%3e %3c/svg%3e",ee="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='%23595959' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",te="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 13.3334L8 10.3704L4 13.3334V3.85187C4 3.53754 4.12041 3.23608 4.33474 3.01382C4.54906 2.79155 4.83975 2.66669 5.14286 2.66669H10.8571C11.1602 2.66669 11.4509 2.79155 11.6653 3.01382C11.8796 3.23608 12 3.53754 12 3.85187V13.3334Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",ae="data:image/svg+xml,%3csvg width='3' height='13' viewBox='0 0 3 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='1.58326' cy='6.41663' r='1.25' transform='rotate(89.9997 1.58326 6.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='1.41663' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 1.41663)' fill='%23595959'/%3e%3cellipse cx='1.58326' cy='11.4166' rx='1.25' ry='1.25' transform='rotate(89.9997 1.58326 11.4166)' fill='%23595959'/%3e%3c/svg%3e",le="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 5.33337C13.1046 5.33337 14 4.43794 14 3.33337C14 2.2288 13.1046 1.33337 12 1.33337C10.8954 1.33337 10 2.2288 10 3.33337C10 4.43794 10.8954 5.33337 12 5.33337Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M4 10C5.10457 10 6 9.10457 6 8C6 6.89543 5.10457 6 4 6C2.89543 6 2 6.89543 2 8C2 9.10457 2.89543 10 4 10Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M12 14.6666C13.1046 14.6666 14 13.7712 14 12.6666C14 11.5621 13.1046 10.6666 12 10.6666C10.8954 10.6666 10 11.5621 10 12.6666C10 13.7712 10.8954 14.6666 12 14.6666Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.72668 9.00665L10.28 11.66' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M10.2734 4.33997L5.72668 6.9933' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",oe="data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M2 4H3.33333H14' stroke='%23737373' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M5.33334 3.99992V2.66659C5.33334 2.31296 5.47382 1.97382 5.72387 1.72378C5.97392 1.47373 6.31305 1.33325 6.66668 1.33325H9.33334C9.68697 1.33325 10.0261 1.47373 10.2762 1.72378C10.5262 1.97382 10.6667 2.31296 10.6667 2.66659V3.99992M12.6667 3.99992V13.3333C12.6667 13.6869 12.5262 14.026 12.2762 14.2761C12.0261 14.5261 11.687 14.6666 11.3333 14.6666H4.66668C4.31305 14.6666 3.97392 14.5261 3.72387 14.2761C3.47382 14.026 3.33334 13.6869 3.33334 13.3333V3.99992H12.6667Z' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M6.66666 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M9.33334 7.33325V11.3333' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e";const ne=({authorEmail:a,onDeletePost:n,shareUrl:i,post:r,className:d="",popoverClassName:u="",onBookmark:m,onRemoveBookmark:p,onEditPost:v})=>{const{data:{locale:g,userInfo:f,togetherUserId:h,env:{isMarryBaby:y}},action:{pushNotifications:C}}=t.useContext(s.TogetherComponentGlobalContext),{t:E}=o.useTranslations(),[w,k]=t.useState(!1),[P,T]=t.useState(!1),[S,x]=t.useState(!1),{authActionWrapper:N}=l.useTogetherAuthRequiredAction(),A=a&&(null==f?void 0:f.email)&&a===String(null==f?void 0:f.email);return b.default.createElement("div",{className:d,onClick:e=>{e.preventDefault(),e.stopPropagation()}},S&&b.default.createElement(l.SharePopup,{url:i,text:null==r?void 0:r.title,onClose:()=>x(!1)}),P&&b.default.createElement(D,{thumbnail:c.CommonGAssets.getAssetPath("trash-bin.svg"),isThumbnailIcon:!0,title:E("popup.deletePost.title"),description:E("popup.deletePost.description"),acceptText:E("popup.deletePost.accept"),cancelText:E("popup.deletePost.cancel"),onAccept:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if((null==r?void 0:r.id)&&!w){k(!0);try{const t=yield(({id:t,locale:a})=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t)return yield s.callApiWithAuth(s.getApiPath(s.PATHS.POST.DELETE,{id:t,_locale:a}),"DELETE")})))({id:r.id,locale:g});1===(null==t?void 0:t.status)&&(null==n||n())}catch(e){}k(!1)}})),onClose:()=>T(!1)}),b.default.createElement(l.TreePopoverMenu,{className:u,toggleButtonContent:b.default.createElement("img",{src:y?Y:ae,loading:"lazy"}),position:"bottom",align:"end",buttonProps:{isLoading:w},data:A?{isShowheader:!1,type:"list",list:[{icon:le,label:E("morePopover.share"),onClick:()=>x(!0)},{icon:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.16952 3.2356H2.99484C2.6785 3.2356 2.37512 3.36126 2.15143 3.58495C1.92774 3.80863 1.80208 4.11202 1.80208 4.42836V12.7777C1.80208 13.094 1.92774 13.3974 2.15143 13.6211C2.37512 13.8448 2.6785 13.9705 2.99484 13.9705H11.3442C11.6605 13.9705 11.9639 13.8448 12.1876 13.6211C12.4113 13.3974 12.537 13.094 12.537 12.7777V8.60303' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M11.6425 2.341C11.8798 2.10375 12.2016 1.97046 12.5371 1.97046C12.8726 1.97046 13.1944 2.10375 13.4317 2.341C13.6689 2.57826 13.8022 2.90005 13.8022 3.23558C13.8022 3.57111 13.6689 3.89289 13.4317 4.13015L7.76607 9.79578L5.38054 10.3922L5.97692 8.00663L11.6425 2.341Z' stroke='%23595959' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",label:E("actionPopover.edit"),onClick:v},{icon:oe,label:E("actionPopover.delete"),onClick:()=>{N((()=>T(!0)))}}]}:{isShowheader:!1,type:"list",list:[{icon:le,label:E("morePopover.share"),onClick:()=>x(!0)},{icon:(null==r?void 0:r.bookmarked)?ee:te,label:(null==r?void 0:r.bookmarked)?E("morePopover.unsavePost"):E("morePopover.savePost"),onClick:()=>{N((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if((null==f?void 0:f.id)&&(null==r?void 0:r.id))if(null==r?void 0:r.bookmarked){const e=yield s.callApiWithAuth(s.getApiPath(s.PATHS.BOOKMARK.DELETE,{_locale:g}),"DELETE",{data:{post_id:String(r.id)}});1===(null==e?void 0:e.status)?(C({title:"",message:"Removed saved post",type:"success",displayIcon:te}),p&&p()):C({title:"",message:"Remove failed",type:"danger",displayIcon:te})}else{const e=yield s.callApiWithAuth(s.getApiPath(s.PATHS.BOOKMARK.CREATE,{_locale:g}),"POST",{data:{user_id:h||f.id,post_id:r.id}});1===(null==e?void 0:e.status)?(C({title:"",message:"Post saved",type:"success",displayIcon:ee}),m&&m()):C({title:"",message:"Post saved failed",type:"danger",displayIcon:te})}}))))}},{icon:U,label:E("morePopover.report"),subTree:{title:E("morePopover.report.title"),description:E("morePopover.report.description"),isShowheader:!0,type:"list",list:Object.keys(s.REPORT_REASON_MAP).map((e=>({label:s.REPORT_REASON_MAP[e].label,reason:s.REPORT_REASON_MAP[e].reportReasonText,reasonValue:e}))).map((e=>({label:E(e.label),subTree:{title:E("morePopover.reportSubmit.title"),description:E("morePopover.reportSubmit.description"),isShowheader:!0,type:"jsx",jsxRenderer:t=>b.default.createElement(H,{reason:e.reasonValue,reasonText:E(e.reason),postId:null==r?void 0:r.id,onClose:()=>t&&t(!1)})}})))}}]}}))};const ie=({onDeleteComment:a,commentId:n,className:i="",popoverClassName:r=""})=>{const{data:{env:{isMarryBaby:d},locale:c},action:{pushNotifications:u}}=t.useContext(s.TogetherComponentGlobalContext),{t:m}=o.useTranslations(),[p,v]=t.useState(!1),{authActionWrapper:g}=l.useTogetherAuthRequiredAction();return b.default.createElement("div",{className:i,onClick:e=>{e.preventDefault(),e.stopPropagation()}},p&&b.default.createElement(D,{thumbnail:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' fill='none'%3e%3cg stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' clip-path='url(%23clip0)'%3e%3cpath d='M2 4.008h12M5.333 4.008V2.675a1.333 1.333 0 0 1 1.334-1.333h2.666a1.333 1.333 0 0 1 1.334 1.333v1.333m2 0v9.334a1.333 1.333 0 0 1-1.334 1.333H4.667a1.333 1.333 0 0 1-1.334-1.333V4.008h9.334ZM6.667 7.342v4M9.333 7.342v4'/%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0'%3e%3cpath fill='white' d='M0 .008h16v16H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",isThumbnailIcon:!0,title:m("popup.deleteComment.title"),description:m("popup.deleteComment.description"),acceptText:m("popup.deletePost.accept"),cancelText:m("popup.deletePost.cancel"),onAccept:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;if(!n)return;const t=yield(({id:e,locale:t})=>s.callApiWithAuth(s.getApiPath(s.PATHS.COMMENT.DELETE,{_locale:t,id:e}),"DELETE"))({id:n,locale:c});1===(null==t?void 0:t.status)?(a&&a(),u({title:"",message:m("notification.success"),type:"success"})):u({title:"",message:(null===(e=null==t?void 0:t.messages)||void 0===e?void 0:e[0])||m("notification.failure"),type:"danger"})})),onClose:()=>v(!1)}),b.default.createElement(l.TreePopoverMenu,{position:"bottom",align:"end",data:{isShowheader:!1,type:"list",list:[{icon:oe,label:m("actionPopover.delete"),onClick:()=>{g((()=>{v(!0)}))}}]},className:r,toggleButtonContent:b.default.createElement("img",{src:d?Y:ae,loading:"lazy"}),buttonProps:{}}))};var re="-dzIuHr";const se=({userId:e,avatar:a,name:n,role:s,title:d,className:c})=>{const{t:u}=o.useTranslations(),[m,p]=t.useState(!1);return b.default.createElement(b.default.Fragment,null,b.default.createElement(C.Button,{className:`${re} ${c}`,color:"success",size:"xs",onClick:()=>p(!0),style:{padding:"5px 8px",marginBottom:"12px",borderRadius:"4px"}},b.default.createElement("span",{className:"text"},b.default.createElement(r.Icon.Endorse,{isSolid:!0,size:18,color:i.theme.colors.green800,className:"icon"}),u("cardReply.verifyBy",{name:`${n||""}`}))),b.default.createElement(l.ProfileDetailModal,{open:m,onClose:()=>p(!1),profileModalProps:{zIndex:1e3}},b.default.createElement(l.ProfileDetail,{authorProps:{userId:e,avatar:a,name:n,role:s,title:d},hideQuestionTab:!0})))};const de=({className:a,style:n,comment:i,type:r="comment",level:c=0,replyingId:u,onPostCommentSuccess:m,post:v,onDeleteComment:g,refetchComment:f,hasQuickBookingEnable:h,handleMakeAppointment:y,cardAuthorProps:E,maxChars:w=600,disableShortenContent:k})=>{var P,T,S,x,A,I,_,M,L,j,R,B,O;const{data:{locale:z,userInfo:D,env:{isMarryBaby:U}}}=t.useContext(s.TogetherComponentGlobalContext),{t:H}=o.useTranslations(),[q,W]=t.useState(i||null),{id:V,countLikes:$,content:Z,replies:Q=[],images:K=[],author:X,liked:J,link:Y,mentionedUser:ee,mentions:te}=q,{text:ae,replyingTo:le}=(e=>{try{const t=e.match(/\[@([^\]]+)\]/),a=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:a}}catch(e){}return{text:""}})(Z),{authActionWrapper:oe}=l.useTogetherAuthRequiredAction({_joinCommunityIds:[null===(P=null==v?void 0:v.community)||void 0===P?void 0:P.id],_joinTopicIds:null===(T=null==v?void 0:v.topics)||void 0===T?void 0:T.map((e=>e.id))}),[ne,re]=t.useState(4),ce=!!(null==D?void 0:D.id)&&(null==Q?void 0:Q.some((e=>e.author.id===D.id))),ue=e=>{W((t=>{if(!t.replies.find((t=>t.id===e.id))){t.replies.unshift(e);const a=Object.assign(Object.assign({},t),{replies:t.replies.slice(),countReplies:t.countReplies+1});return f&&f(a),a}return t}))},[me,pe]=t.useState(!1),ve=t.useMemo((()=>"comment"===r&&Q&&0!=Q.length?Q.sort(((e,t)=>{const a=new Date(e.createdAt).getTime(),l=new Date(t.createdAt).getTime();return a>l?-1:a<l?1:0})):Q),[r,Q]),ge=(null==Q?void 0:Q.length)||0,fe=String(null==X?void 0:X.email)&&(null==D?void 0:D.email)&&String(null==X?void 0:X.email)===String(null==D?void 0:D.email),he=(null==X?void 0:X.name)||(null==X?void 0:X.username)||"",ye=(null==X?void 0:X.username)||(null==X?void 0:X.name)||"",Ce=null==X?void 0:X.avatar,Ee=(null==v?void 0:v.isAnonymous)||null==X?void 0:X.role,we=[...(null==v?void 0:v.isAnonymous)?[{id:(null===(S=null==v?void 0:v.author)||void 0===S?void 0:S.id)||0,name:H("cardPost.anonymous")}]:[],...te||[]],[ke,be]=t.useState(null),[Pe,Te]=t.useState(null);t.useEffect((()=>{if(null==X?void 0:X.hospitalId){const t=t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:d.domainLocales[z]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.branch)&&be(null==a?void 0:a._data.branch)}));t(X.hospitalId)}if(null==X?void 0:X.doctorId){const t=t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:t,website_url:d.domainLocales[z]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.doctor)&&Te(null==a?void 0:a._data.doctor)}));t(X.doctorId)}}),[X.hospitalId,X.doctorId]);const Se=(null==Pe?void 0:Pe.valid_outpatient)||(null==Pe?void 0:Pe.valid_telemedicine),xe=((null==ke?void 0:ke.total_available_service)||(null==ke?void 0:ke.total_available_doctor))>0,Ne=h&&(Se||xe),Ae="chatbot"===(null===(x=null==q?void 0:q.author)||void 0===x?void 0:x.type);return b.default.createElement(l.TogetherAuthConfigContextProvider,{defaultParams:{_joinCommunityIds:[null===(A=null==v?void 0:v.community)||void 0===A?void 0:A.id],_joinTopicIds:null===(I=null==v?void 0:v.topics)||void 0===I?void 0:I.map((e=>e.id))}},b.default.createElement(l.StyledCardPost,{className:a,style:n,"data-is-reply":!!c,"data-is-marrybaby":U,"data-has-booking":Ne},"reply"===r&&b.default.createElement(p.Divider,{className:"top-divider",type:"solid"}),b.default.createElement("div",{style:{padding:"16px 16px 0"}},b.default.createElement(l.CardAuthor,Object.assign({avatar:Ce,name:he,username:ye,timeText:null==v?void 0:v.createdTime,community:null==v?void 0:v.community,className:"post-author "+(fe?"with-popover":""),type:r,userId:null==X?void 0:X.id,role:Ee,expertId:null==X?void 0:X.partnerId,title:null==X?void 0:X.title,doctorId:null==X?void 0:X.doctorId,hospitalId:null==X?void 0:X.hospitalId,hasQuickBooking:Ne,handleMakeAppointment:y,isAnonymous:(null==q?void 0:q.isAnonymous)||Boolean(null==v?void 0:v.isAnonymous)&&(null===(_=null==v?void 0:v.author)||void 0===_?void 0:_.username)===(null==X?void 0:X.username),hideBackground:Ae,userType:null==X?void 0:X.type},E)),Boolean(null==q?void 0:q.isVerify)&&!Boolean(null==q?void 0:q.isOppose)&&b.default.createElement(se,{title:null===(M=null==q?void 0:q.userVerify)||void 0===M?void 0:M.title,name:null===(L=null==q?void 0:q.userVerify)||void 0===L?void 0:L.name,userId:null===(j=null==q?void 0:q.userVerify)||void 0===j?void 0:j.id,role:null===(R=null==q?void 0:q.userVerify)||void 0===R?void 0:R.role,avatar:null===(B=null==q?void 0:q.userVerify)||void 0===B?void 0:B.avatar,className:"verify-tag"})),b.default.createElement(l.PostContent,{className:"post-content-wrapper",replyingTo:le,mentionedUser:ee,description:ae,mentions:we,maxChars:w,disableShortenContent:k}),b.default.createElement("span",null),b.default.createElement("span",null),K&&K.length>0?b.default.createElement("div",{key:"image-preview",className:"image-preview-wrapper","data-is-reply":!0},b.default.createElement(G,{images:K,authorName:null==X?void 0:X.username})):null,K&&0!==K.length||!Y?null:b.default.createElement("div",{key:"link-preview",className:"link-preview-wrapper","data-is-reply":!0},b.default.createElement(N,{url:Y})),"most-engaging"!==r?b.default.createElement(b.default.Fragment,null,Ae&&b.default.createElement(l.StyledSourceList,{listUrl:null==q?void 0:q.source,categorySlug:null==q?void 0:q.categorySlug}),b.default.createElement(l.CardReactions,{type:l.CardReactionType.reply,loveCount:$,replyCount:ge,className:"post-reaction",liked:J,isReplied:ce,hideCommentIcon:"reply"===r||Ae,hasShare:!1,onCommentClick:()=>oe((()=>pe((e=>!e)))),onCommentCountClick:()=>oe((()=>{pe(!0)})),onLikeClick:()=>oe((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(V){const t=yield(({commentId:t,setLike:a=!1,locale:l})=>e.__awaiter(void 0,void 0,void 0,(function*(){return s.callApiWithAuth(s.getApiPath(a?s.PATHS.COMMENT.LIKE:s.PATHS.COMMENT.UNLIKE,{_locale:l,id:t}),"GET")})))({commentId:V,setLike:!J,locale:z});1===t.status&&W((e=>Object.assign(Object.assign({},e),{liked:!J,countLikes:e.countLikes+(J?-1:1)})))}}))))}),me&&b.default.createElement(F,{replyingId:u||q.id,replyToName:he,isReply:!0,onClose:()=>pe(!1),onPostSuccess:e=>{"reply"===r?m&&m(e):ue(e)},post:v,replyingUser:X}),"comment"===r&&Q&&Q.length>0?b.default.createElement("div",{className:"comment-reply-wrapper"},null===(O=null==ve?void 0:ve.slice(0,ne))||void 0===O?void 0:O.map((e=>b.default.createElement(de,{key:e.id,comment:e,type:"reply",className:"comment-reply-item",level:c+1,replyingId:V,onPostCommentSuccess:ue,post:v,onDeleteComment:()=>{W((t=>Object.assign(Object.assign({},t),{replies:t.replies.filter((t=>t.id!==e.id)),countReplies:t.countReplies-1})))},handleMakeAppointment:y,hasQuickBookingEnable:h}))),ge>ne&&b.default.createElement(b.default.Fragment,null,b.default.createElement(p.Divider,{className:"top-divider",type:"solid"}),b.default.createElement(C.Button,{className:"more-cmt",size:"lg",color:"ghost",onClick:()=>re((e=>e+4))},H("comment.seeMoreReplies",{count:ge-ne}),b.default.createElement("img",{className:"chevron-right",src:"data:image/svg+xml,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M6 12L10 8L6 4' stroke='%232D87F3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e",loading:"lazy"})))):null):null,fe&&b.default.createElement(ie,{onDeleteComment:g,className:"popover",commentId:q.id})))},ce=(t,a)=>e.__awaiter(void 0,void 0,void 0,(function*(){var e,l,o;const n=yield s.callApiWithOptionalAuth(s.getApiPath(s.PATHS.COMMENT.LIST,{postId:t,_locale:a,sort:"popularity",perPage:1,withoutReply:1}),"GET");return null===(o=null===(l=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.comments)||void 0===l?void 0:l.map(v.formatComment))||void 0===o?void 0:o[0]}));var ue=Object.freeze({__proto__:null});exports.CardLink=N,exports.CardPost=({className:a,style:n,hideViewMoreComment:i,showMostEngaging:r,onCommentClick:d,onCommentCountClick:c,onMostEngagingCommentClick:u,onPostCommentSuccess:m,disableCardLink:p,disableShortenContent:v,onDeletePost:g,onEditPost:f,post:h,mostEngagingComment:y,onDeleteComment:E,showInputComment:w,InlineCommentsComponent:k,hasQuickBookingEnable:T,handleMakeAppointment:S,cardAuthorProps:x})=>{const[_,M]=t.useState(h),[L,j]=t.useState(!1),[R,B]=t.useState(y),{community:O,topics:z,author:D,slug:U,isPin:H,liked:q,photos:W,mentions:V,title:$,description:Q,previewUrl:K,likesCount:X,commentsCount:J,id:Y,commented:ee}=_,{data:{locale:te,env:{isMarryBaby:ae,togetherBasePath:le}},action:{pushNotifications:oe}}=t.useContext(s.TogetherComponentGlobalContext),{t:ie}=o.useTranslations(),[re,se]=t.useState(w),ue=`${le}/${(null==O?void 0:O.slug)||"_"}/${U||""}`,me=`${s.getCurrentBaseUrl(te)}${ue}`,{authActionWrapper:pe}=l.useTogetherAuthRequiredAction((null==O?void 0:O.slug)?{_joinCommunityIds:[O.id],_joinTopicIds:null==z?void 0:z.map((e=>e.id))}:void 0),[ve,ge]=t.useState(!1);t.useEffect((()=>{se(w)}),[w]);const fe=(null==D?void 0:D.name)||(null==D?void 0:D.username)||"",he=(null==D?void 0:D.username)||(null==D?void 0:D.name)||"",ye=null==D?void 0:D.avatar,Ce=(null==_?void 0:_.isAnonymous)||null==D?void 0:D.role,[Ee,we]=t.useState(null),[ke,be]=t.useState(null);t.useEffect((()=>{if(null==D?void 0:D.hospitalId){(t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_HOSPITAL_INFO,{hospital_branch_id:t,website_url:s.domainLocales[te]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.branch)&&we(null==a?void 0:a._data.branch)})))(D.hospitalId)}if(null==D?void 0:D.doctorId){(t=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;const a=yield s.callApi(s.getCarePath(s.CARE_PATHS.GET_DOCTOR_INFO,{doctorId:t,website_url:s.domainLocales[te]}),"get");(null===(e=null==a?void 0:a._data)||void 0===e?void 0:e.doctor)&&be(null==a?void 0:a._data.doctor)})))(D.doctorId)}}),[D.hospitalId,D.doctorId]);const Pe=(null==ke?void 0:ke.valid_outpatient)||(null==ke?void 0:ke.valid_telemedicine),Te=((null==Ee?void 0:Ee.total_available_service)||(null==Ee?void 0:Ee.total_available_doctor))>0,Se=T&&(Pe||Te);t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){if(Y&&J&&r&&!(null==y?void 0:y.id)){const e=yield ce(Y,te);B(e)}}))}),[Y,te,J,r,null==y?void 0:y.id]),t.useEffect((()=>{B(y)}),[null==y?void 0:y.id]);const xe=t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(J>1&&(null==R?void 0:R.id)&&(null==R?void 0:R.id)===(null==t?void 0:t.id)){const e=yield ce(Y,te);B(e)}M((e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount-1}))),E&&E(t)}));return b.default.createElement(l.TogetherAuthConfigContextProvider,{defaultParams:(null==O?void 0:O.slug)?{_joinCommunityIds:[O.id],_joinTopicIds:null==z?void 0:z.map((e=>e.id))}:void 0},L&&b.default.createElement(l.SharePopup,{url:me,avatar:s.DEFAULT_IMG,text:$,onClose:()=>j(!1)}),b.default.createElement(l.StyledCardPost$1,{className:a,style:n,"data-is-marrybaby":ae},H?b.default.createElement(A,{className:"post-pin"}):null,b.default.createElement("div",{style:{position:"relative",padding:"1rem 1rem 0"}},b.default.createElement(l.CardAuthor,Object.assign({avatar:ye,name:fe,username:he,url:p?void 0:ue,community:O,timeText:null==_?void 0:_.createdTime,className:"post-author",role:Ce,userId:null==D?void 0:D.id,expertId:null==D?void 0:D.partnerId,doctorId:null==D?void 0:D.doctorId,hospitalId:null==D?void 0:D.hospitalId,title:null==D?void 0:D.title,hasQuickBooking:Se,handleMakeAppointment:S,"data-testid":"name",isAnonymous:!!(null==_?void 0:_.isAnonymous),extendEle:b.default.createElement(ne,{authorEmail:String(null==D?void 0:D.email),onDeletePost:g,shareUrl:me,post:_,className:"popover",onEditPost:f})},x))),b.default.createElement("a",{href:p?void 0:ue,className:"post-content-link-wrapper"},$&&b.default.createElement(s.Heading,{className:"post-content-title",as:"h2",tag:"h5",fontWeight:"bold","data-testid":"Title of the Post"},P.default($)),b.default.createElement(l.PostContent,{className:"post-content-wrapper",description:Q,disableShortenContent:v,mentions:V,"data-testid":"Content of the Post"})),b.default.createElement("span",null),b.default.createElement("span",null),b.default.createElement("div",{key:"tag-topic"},z&&z.length>0?b.default.createElement(l.TagTopic,{topics:z,className:"post-topics"}):null),b.default.createElement("div",{key:"social-preview"},(null==_?void 0:_.introUrl)?b.default.createElement("div",{className:"social-preview-wrapper "+((null==W?void 0:W.length)?"has-image":"")},b.default.createElement(Z,{url:_.introUrl,image:_.bannerImage})):null),b.default.createElement("div",{key:"image-preview"},(null==W?void 0:W.length)?b.default.createElement("div",{className:"image-preview-wrapper"},b.default.createElement(G,{images:W,authorName:null==D?void 0:D.name})):null),b.default.createElement("div",{key:"link-preview"},(null==_?void 0:_.introUrl)||(null==W?void 0:W.length)||!(null==K?void 0:K.url)?null:b.default.createElement("div",{className:"link-preview-wrapper"},b.default.createElement(N,{title:K.title,url:K.url,image:K.image}))),b.default.createElement(l.CardReactions,{isMarryBaby:ae,type:l.CardReactionType.post,loveCount:X,replyCount:J,className:"post-reaction "+((null==W?void 0:W.length)||(null==K?void 0:K.url)?"hide-top-border":""),liked:ve?!q:q,isReplied:ee,onCommentClick:()=>pe((()=>{d?d():se((e=>!e))})),onCommentCountClick:()=>{pe((()=>{ae?se(!0):c?c():!p&&(window.location.href=ue)}))},onShareClick:()=>{j(!0)},onLikeClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(Y&&!ve){ge(!0);try{const t=yield(({id:t,locale:a})=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t)return yield s.callApiWithAuth(s.getApiPath(s.PATHS.POST.LIKE,{id:t,_locale:a}),"GET")})))({id:Y,locale:te});1!==(null==t?void 0:t.status)?oe(I(ie)):M((e=>Object.assign(Object.assign({},e),{likesCount:(e.likesCount||0)+(e.liked?-1:1),liked:!e.liked})))}catch(e){oe(I(ie))}ge(!1)}})),showingMostEngaging:!(!r||!(null==R?void 0:R.id))}),re&&b.default.createElement(F,{isMainCmt:!w,onClose:()=>se(!1),onPostSuccess:e=>{0!==J||(null==R?void 0:R.id)||B(e),M((e=>Object.assign(Object.assign({},e),{commentsCount:e.commentsCount+1,commented:!0}))),m&&m(e)},post:_}),r&&(null==R?void 0:R.id)?b.default.createElement("div",{className:"most-engaging-wrapper",onClick:e=>{u?(e.stopPropagation(),u()):window.location.href=ue}},b.default.createElement(de,{hasQuickBookingEnable:T,handleMakeAppointment:S,comment:R,post:_,onDeleteComment:()=>{xe&&xe(R)},className:"most-engaging-comment",type:"most-engaging",key:R.id,cardAuthorProps:x}),J>1&&!i&&b.default.createElement(C.Button,{className:"see-more-comments",color:"ghost",size:"md"},ie("comment.seeMoreComments",{count:J-1}))):null,k))},exports.CardPostPopoverMore=ne,exports.CardReply=de,exports.CardReplyPopover=ie,exports.CreateNewPostContent=({className:n,style:d,onPostCreatedEdited:m,onClose:g,communities:f=[],forceSelectCommunity:h,forceSelectTopics:y,articleId:C,optionalTopic:E,editPostData:w,defaultCommunity:k,defaultTopics:T,noFetchTopic:S,hideTopicList:x,selectAskDoctor:N,showAskDoctorOptions:A,currentPageUrl:M})=>{const L=!!(null==w?void 0:w.id),{data:{locale:R,env:{isMarryBaby:z}},action:{pushNotifications:D,sanitizeFunction:F}}=t.useContext(s.TogetherComponentGlobalContext),{t:U}=o.useTranslations(),[H,q]=t.useState(!1),[W,V]=t.useState(N),[$,G]=t.useState(!1),[Z,Q]=t.useState(!1),[K,X]=t.useState(!1),[J,Y]=t.useState(""),[ee,te]=t.useState(""),[ae,le]=t.useState(h?{label:h.name,value:`${h.id||""}-${h.mappedCategoryId||""}`}:{label:U("community.choose"),value:""}),[oe,ne]=t.useState([...y]||[]),[ie,re]=t.useState([]),[se,de]=t.useState([]),ce=h||f.find((e=>`${e.id||""}-${e.mappedCategoryId||""}`===ae.value)),ue=h?[h]:f.filter((e=>e.isActive)).sort(((e,t)=>e.name>t.name?1:e.name<t.name?-1:0)),[me,pe]=t.useState(null),[ve,ge]=t.useState([]),fe=J&&!Z&&P.default(ee)&&(E||!E&&oe.length>0)&&ce&&(!ie||ie.length<=s.MAX_IMAGE_UPLOADS)&&!(null==ve?void 0:ve.length)&&!K;t.useEffect((()=>{if(w){const e=w;Y(e.title||""),te(l.decodeMention(l.decodePostUrl(e.description||"","edit"),e.mentions)),le({label:e.community.name,value:`${e.community.id||""}-${e.community.mappedCategoryId||""}`}),ne(e.topics||[]),re(e.photos||[]),q(!!e.isAnonymous||!1),V(!!e.isAskDoctor||!1)}else k&&le({label:k.name,value:`${k.id||""}-${k.mappedCategoryId||""}`}),T&&ne(T)}),[]),t.useEffect((()=>{Q(""!==J&&!/[a-zA-Z]/.test(J))}),[J]);const he=()=>e.__awaiter(void 0,void 0,void 0,(function*(){var t,a,o,n,i,r,d,c,p;if(A&&void 0===W)return G(!0),!1;const f=yield(({title:t,description:a,communityId:o,imageFiles:n,previewUrl:i,topicIds:r,locale:d,sanitizeFunction:c,categoryCommunityId:m,categoryTopicIds:p,introUrl:v,bannerUrl:g,scheduleTime:f,isAnonymous:h,isAskDoctor:y})=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=new FormData,C=l.removeBannedWordWrapper(a),E=l.removeBannedWordWrapper(t),w=l.getMentionIdsFromString(C);if(e.append("title",E),e.append("description",l.encodePostContent(C,c)),m?e.append("category_community",String(m)):o&&e.append("community_id",String(o)),e.append("is_anonymous",h?"1":"0"),e.append("is_question",y?"1":"0"),(null==i?void 0:i.title)&&e.append("preview_title",i.title),(null==i?void 0:i.description)&&e.append("preview_description",i.description),(null==i?void 0:i.url)&&e.append("preview_link",u.safeEncodeURI(i.url)),(null==i?void 0:i.image)&&e.append("preview_image",u.safeEncodeURI(i.image)),null==r||r.forEach((t=>{e.append("topics[]",String(t||""))})),null==p||p.forEach((t=>{e.append("category_topics[]",String(t||""))})),null==n?void 0:n.length){const t=yield Promise.all(n.map(((e,t)=>new Promise((a=>{setTimeout((()=>{a(l.uploadAndGetSrc(e,d))}),2e3*t)})))));null==t||t.filter(Boolean).slice(0,s.MAX_IMAGE_UPLOADS).forEach(((t,a)=>{e.append(`images[${a}]`,t)}))}else e.append("images","");return null==w||w.forEach((t=>{e.append("mention_ids[]",t)})),e.append("intro_url",v||""),e.append("banner",g||""),f&&(e.append("post_type","scheduled"),e.append("schedule_datetime",f)),e})))({title:J,description:ee,communityId:String((null==ce?void 0:ce.id)||""),imageFiles:ie,previewUrl:me,topicIds:null==oe?void 0:oe.map((e=>String(e.id||""))).filter(Boolean),locale:R,sanitizeFunction:F,categoryCommunityId:String((null==ce?void 0:ce.mappedCategoryId)||""),categoryTopicIds:null==oe?void 0:oe.map((e=>String(e.mappedCategoryId||""))).filter(Boolean),isAnonymous:H?1:0,isAskDoctor:W?1:0});let h;C&&f.append("article_id",C),L?(null==w?void 0:w.id)&&(h=yield(({id:t,locale:a,formData:l})=>e.__awaiter(void 0,void 0,void 0,(function*(){return yield s.callApiWithAuth(s.getApiPath(s.PATHS.POST.UPDATE,{id:t,_locale:a}),"POST",{data:l})})))({id:w.id,formData:f,locale:R})):h=yield(({locale:t,formData:a,isArticleComment:l})=>e.__awaiter(void 0,void 0,void 0,(function*(){return yield s.callApiWithAuth(s.getApiPath(l?s.PATHS.POST.CREATE_ARTICLE_COMMENT:s.PATHS.POST.CREATE,{_locale:t}),"POST",{data:a})})))({formData:f,locale:R,isArticleComment:!(null==ce?void 0:ce.id)&&!!(null==ce?void 0:ce.mappedCategoryId)});const y=null==h?void 0:h.data;(null==y?void 0:y.id)&&!(null===(a=null===(t=null==h?void 0:h.messages)||void 0===t?void 0:t.moderation)||void 0===a?void 0:a.type)?(D({message:U("createPost.popup.success"),type:"success"}),(e=>{m&&m(v.formatPost(e),L),g&&g()})(y)):"banned"===(null===(n=null===(o=null==h?void 0:h.messages)||void 0===o?void 0:o.moderation)||void 0===n?void 0:n.type)?(D({title:U("notification.post.blocked.title"),message:U("notification.post.blocked.message"),type:"danger"}),h.messages.moderation.words&&de(h.messages.moderation.words)):"suspect"===(null===(r=null===(i=null==h?void 0:h.messages)||void 0===i?void 0:i.moderation)||void 0===r?void 0:r.type)?(D({title:U("notification.post.suspect.title"),message:U("notification.post.suspect.message"),type:"warning"}),g&&g()):(null===(c=null===(d=null==h?void 0:h.messages)||void 0===d?void 0:d.find)||void 0===c?void 0:c.call(d,(e=>{var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))})))?(D({message:U("notification.suspend.message"),type:"danger"}),g&&g()):D({message:(null===(p=null==h?void 0:h.messages)||void 0===p?void 0:p[0])||U("notification.failure"),type:"danger"})}));return b.default.createElement(l.StyledCreateNewPost,{className:n,style:d},b.default.createElement("div",{className:"input-group-container"},b.default.createElement(B,{className:"input-group",bannedWords:se,value:J,onChange:Y}),Z&&b.default.createElement(l.StyledError,null,b.default.createElement(r.Info,{isSolid:!0,color:i.theme.colors.red700,size:14}),b.default.createElement(s.Text,{size:"p3",as:"span",color:i.theme.colors.red700},U("createPost.popup.specialCharErr"))),b.default.createElement(j,{className:"input-group",bannedWords:se,value:ee,onChange:te,onPreviewUrlChange:pe,onInvalidUrlsChange:ge,onImageFilesChange:re,imageFiles:ie}),A&&b.default.createElement(l.StyledIsQuestion,{"data-is-marry-baby":z},b.default.createElement("div",{className:"switch-label"},b.default.createElement(r.Ask,{isMarryBaby:z,size:z?32:24,color:i.theme.colors.primaryBase,className:"label-icon"}),b.default.createElement("span",{className:"label-txt"},U("createPost.askDoctor"))),b.default.createElement(p.BtnChoice,{value:W,choices:[{label:U("createPost.askDoctorChoice.yes"),value:!0,dataEventCategory:"Together",dataEventAction:"Write Post Click - Ask Doctor",dataEventLabel:M},{label:U("createPost.askDoctorChoice.no"),value:!1}],onChange:e=>{"boolean"==typeof e&&(G(!1),V(e))}})),$&&b.default.createElement(l.StyledError,null,b.default.createElement(r.Info,{isSolid:!0,color:i.theme.colors.red700,size:14}),b.default.createElement(s.Text,{size:"p3",as:"span",color:i.theme.colors.red700},U("createPost.message.askDoctorRequire"))),b.default.createElement("div",{className:"input-group"},b.default.createElement(s.Text,{size:"p4",className:"input-group-label"},U("admin.community")),b.default.createElement(l.Dropdown,{options:(null==ue?void 0:ue.map((e=>({label:e.name,value:`${e.id||""}-${e.mappedCategoryId||""}`}))))||[],id:"community-picker",placeholder:U("community.choose"),value:ae,dropdownLabelTrackingAttributes:{"data-event-category":"Together","data-event-action":"Write Post Click - Choose Community/Topic","data-event-label":M},onChange:e=>{le({label:e.label,value:String(e.value)}),ne([])},disabled:!!h}),b.default.createElement(s.Text,{size:"sm",className:"warning",color:i.theme.colors.gray400},"* ",U("commentPopup.warning.newPost"))),!x&&b.default.createElement("div",{className:"input-group"},b.default.createElement(s.Text,{size:"p4",className:"input-group-label"},U("tab.topic")),b.default.createElement("div",{className:"input-notification"},b.default.createElement("img",{src:ce?"data:image/svg+xml,%3csvg width='16' height='17' viewBox='0 0 16 17' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M8 14.5C11.3137 14.5 14 11.8137 14 8.5C14 5.18629 11.3137 2.5 8 2.5C4.68629 2.5 2 5.18629 2 8.5C2 11.8137 4.68629 14.5 8 14.5Z' fill='%232D87F3'/%3e%3cpath d='M8 5.5V8.5' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3cpath d='M8 11.5H8.00708' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e":_,loading:"lazy"}),b.default.createElement(s.Text,{size:"base",color:i.theme.colors.gray500},U(ce?"createPost.popup.primary":"createPost.popup.warning"))),ce&&b.default.createElement(O,{className:"tag-list",communityId:ce.id,forceTopics:y,onChange:ne,selectedTopics:oe,noFetch:S,dataEventCategory:"Together",dataEventAction:"Write Post Click - Choose Community/Topic",dataEventLabel:M}))),b.default.createElement("div",{className:"form-action"},b.default.createElement("div",{className:"input-group"},b.default.createElement(a.Checkbox,{className:"swich-input-group",labelPosition:"left",name:"PostAnonymous",checked:H,color:z?"pink":void 0,"data-event-category":"Together","data-event-action":"Write Post Click - Incognito","data-event-label":M,label:b.default.createElement("div",{className:"switch-label"},b.default.createElement("img",{className:"label-icon",src:c.CommonGAssets.getAssetPath("anomyous-avatar.svg"),alt:"anomyous avatar",style:{marginRight:"10px",width:"24px"},loading:"lazy"}),b.default.createElement("span",{className:"label-txt"},U("createPost.postAnonymous"))),value:"Post Anonymous",onChange:e=>q(e.currentTarget.checked),styles:{body:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},label:{display:"flex",alignItems:"center"}}})),b.default.createElement("div",{className:"input-group"},b.default.createElement(s.Button,{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:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(fe&&!K){X(!0);try{yield he()}catch(e){console.error(e),D(I(U))}X(!1)}})),disabled:!fe,loading:K},U("createPost.popup.submit")))))},exports.CreatePostDescription=j,exports.CreatePostTitle=B,exports.ImagePreviewPopup=q,exports.InputCommentBar=F,exports.LabelPin=A,exports.PopupDanger=D,exports.PostImagePreview=G,exports.PostSingleImageViewPopup=V,exports.SkipQuestionOfExpertBtn=l=>{var{post:n,onSkip:i,btnText:d,currentPageUrl:c}=l,u=e.__rest(l,["post","onSkip","btnText","currentPageUrl"]);const{t:m}=o.useTranslations(),{data:{locale:p},action:{pushNotifications:v}}=t.useContext(s.TogetherComponentGlobalContext),[g,f]=t.useState(!1),[h,y]=t.useState(!1),C=a.useMantineTheme(),E=t.useCallback((()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;y(!0);const t=yield s.callApiWithAuth(s.getApiPath(s.PATHS.USER.SKIP_QUESTION,{_locale:p,id:null==n?void 0:n.id}),"PUT");1===(null==t?void 0:t.status)?(null==i||i({id:(null==n?void 0:n.id)||"",communityId:(null===(e=null==n?void 0:n.community)||void 0===e?void 0:e.id)||""}),f(!1),v({title:"",message:"Skip success",type:"success"})):v({title:"",message:null==t?void 0:t.messages,type:"danger"}),y(!1)}))),[]);return b.default.createElement(a.Popover,{width:327,withArrow:!0,shadow:"md",opened:g},b.default.createElement(a.Popover.Target,null,b.default.createElement("div",Object.assign({className:`${Q} ${(null==u?void 0:u.className)||""}`,onClick:()=>f(!0)},u),d||m("profilePanel.questionNotClear"))),b.default.createElement(a.Popover.Dropdown,null,b.default.createElement("div",null,b.default.createElement("div",{className:K},m("profilePanel.skipQuestion.heading")),b.default.createElement("div",{className:X},m("profilePanel.skipQuestion.content")),b.default.createElement("div",{className:J},b.default.createElement(s.Button,{size:"md",variant:"secondary",leftIcon:b.default.createElement(r.Close,{color:C.fn.primaryColor(),size:24}),onClick:()=>f(!1),styles:()=>({leftIcon:{marginRight:0}})}),b.default.createElement(s.Button,{variant:"primary",size:"md",leftIcon:b.default.createElement(r.Check,{color:"white",size:24}),onClick:E,loading:h,"data-event-category":"Together","data-event-action":"Unclear Question Click","data-event-label":c,styles:()=>({leftIcon:{marginRight:0}})})))))},exports.SocialLinkPreview=Z,exports.SubmitReportForm=H,exports.TopicSelectList=O,exports.VerifiedTag=se,exports.types=ue;
package/build/types.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Onboarding-ff5a2403.js");Object.defineProperty(exports,"BabyGrowthChartDuration",{enumerable:!0,get:function(){return e.BabyGrowthChartDuration}}),Object.defineProperty(exports,"BabyGrowthChartType",{enumerable:!0,get:function(){return e.BabyGrowthChartType}}),Object.defineProperty(exports,"BabyGrowthResultTab",{enumerable:!0,get:function(){return e.BabyGrowthResultTab}}),Object.defineProperty(exports,"Gender",{enumerable:!0,get:function(){return e.Gender}}),Object.defineProperty(exports,"LOCALE",{enumerable:!0,get:function(){return e.LOCALE}}),Object.defineProperty(exports,"OnboardingStep",{enumerable:!0,get:function(){return e.OnboardingStep}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Onboarding-816df77b.js");Object.defineProperty(exports,"BabyGrowthChartDuration",{enumerable:!0,get:function(){return e.BabyGrowthChartDuration}}),Object.defineProperty(exports,"BabyGrowthChartType",{enumerable:!0,get:function(){return e.BabyGrowthChartType}}),Object.defineProperty(exports,"BabyGrowthResultTab",{enumerable:!0,get:function(){return e.BabyGrowthResultTab}}),Object.defineProperty(exports,"Gender",{enumerable:!0,get:function(){return e.Gender}}),Object.defineProperty(exports,"LOCALE",{enumerable:!0,get:function(){return e.LOCALE}}),Object.defineProperty(exports,"OnboardingStep",{enumerable:!0,get:function(){return e.OnboardingStep}});
@@ -1 +1 @@
1
- "use strict";var e=require("react"),a=require("./Onboarding-ff5a2403.js"),n=require("./useTranslations-95f60387.js");const t={"vi-VN":"mang-thai","id-ID":"kehamilan","ms-MY":"kehamilan","km-KH":"ពពោះ","en-PH":"pregnancy","tl-PH":"pregnancy","th-TH":"การตั้งครรภ์","my-MM":"pregnancy","zh-TW":"pregnancy","hi-IN":"pregnancy"},b={[a.LOCALE.Vietnam]:{sexualWellness:"suc-khoe-tinh-duc",health:"suc-khoe",healthyEating:"an-uong-lanh-manh",skinHealth:"da-lieu",healthyHabit:"thoi-quen-lanh-manh",drug:"thuoc",womensHealth:"suc-khoe-phu-nu",fitness:"the-duc-the-thao",pregnancy:"mang-thai",parenting:"nuoi-day-con",diabetes:"tieu-duong-dai-thao-duong",healthyMind:"tam-ly-tam-than"},[a.LOCALE.Indonesia]:{pregnancy:"kehamilan",parenting:"parenting",health:"sehat",diabetes:"diabetes",womensHealth:"wanita",drug:"obat-suplemen",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Malaysia]:{pregnancy:"kehamilan",parenting:"keibubapaan",health:"kesihatan",diabetes:"kencing-manis",womensHealth:"kesihatan-wanita",drug:"ubat",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Cambodia]:{pregnancy:"%e1%9e%96%e1%9e%96%e1%9f%84%e1%9f%87",parenting:"%e1%9e%85%e1%9e%b7%e1%9e%89%e1%9f%92%e1%9e%85%e1%9e%b9%e1%9e%98%e1%9e%80%e1%9e%bc%e1%9e%93",health:"%e1%9e%9f%e1%9e%bb%e1%9e%81%e1%9e%97%e1%9e%b6%e1%9e%96%e1%9e%91%e1%9e%bc%e1%9e%91%e1%9f%85",diabetes:"%e1%9e%87%e1%9f%86%e1%9e%84%e1%9e%ba%e1%9e%91%e1%9e%b9%e1%9e%80%e1%9e%93%e1%9f%84%e1%9e%98%e1%9e%95%e1%9f%92%e1%9e%a2%e1%9f%82%e1%9e%98",womensHealth:"%e1%9e%9f%e1%9e%bb%e1%9e%81%e1%9e%97%e1%9e%b6%e1%9e%96%e1%9e%9f%e1%9f%92%e1%9e%8f%e1%9f%92%e1%9e%9a%e1%9e%b8",drug:"%e1%9e%b1%e1%9e%9f%e1%9e%90%e1%9e%93%e1%9e%b7%e1%9e%84%e1%9e%a2%e1%9e%b6%e1%9e%a0%e1%9e%b6%e1%9e%9a%e1%9e%94%e1%9f%86%e1%9e%94%e1%9f%89%e1%9e%93",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.PhilippinesEnglish]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",drug:"drugs-supplements",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.PhilippinesTagalog]:{pregnancy:"pagbubuntis",parenting:"pagiging-magulang",health:"kalusugan",diabetes:"diabetes-fil",womensHealth:"kalusugan-kababaihan",drug:"drugs-at-supplements",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Thailand]:{pregnancy:"%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b8%a3%e0%b8%a3%e0%b8%a0%e0%b9%8c",parenting:"%e0%b8%9e%e0%b9%88%e0%b8%ad%e0%b9%81%e0%b8%a1%e0%b9%88%e0%b9%80%e0%b8%a5%e0%b8%b5%e0%b9%89%e0%b8%a2%e0%b8%87%e0%b8%a5%e0%b8%b9%e0%b8%81",health:"%e0%b8%aa%e0%b8%b8%e0%b8%82%e0%b8%a0%e0%b8%b2%e0%b8%9e",diabetes:"%e0%b9%82%e0%b8%a3%e0%b8%84%e0%b9%80%e0%b8%9a%e0%b8%b2%e0%b8%ab%e0%b8%a7%e0%b8%b2%e0%b8%99",womensHealth:"%e0%b8%aa%e0%b8%b8%e0%b8%82%e0%b8%a0%e0%b8%b2%e0%b8%9e%e0%b8%ab%e0%b8%8d%e0%b8%b4%e0%b8%87",drug:"%e0%b8%a2%e0%b8%b2%e0%b9%81%e0%b8%a5%e0%b8%b0%e0%b8%ad%e0%b8%b2%e0%b8%ab%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%aa%e0%b8%a3%e0%b8%b4%e0%b8%a1",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Myanmar]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",drug:"drugs-az",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Taiwan]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",drug:"drugs-supplement",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.India]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",diabetesEn:"en-diabetes",drug:"dawaai",sexualWellness:"",healthyEating:"",skinHealth:""}};exports.MAPPED_CATEGORY_SLUGS=b,exports.PREGNANCY_SLUG=t,exports.useCategory=a=>{const{locale:s}=n.useTranslations();return{isPregnancy:e.useMemo((()=>decodeURI(a.replace(/\//gi,"")).includes(t[s])),[]),isParenting:e.useMemo((()=>{var e;return decodeURI(a.replace(/\//gi,"")).includes(null===(e=b[s])||void 0===e?void 0:e.parenting)}),[]),type:e.useMemo((()=>function(e,a){const n=e.split("/");for(const e in a){const t=a[e];if(n.includes(t))return e}return null}(a,b[s])),[a,s])}};
1
+ "use strict";var e=require("react"),a=require("./Onboarding-816df77b.js"),n=require("./useTranslations-8ddbe2cf.js");const t={"vi-VN":"mang-thai","id-ID":"kehamilan","ms-MY":"kehamilan","km-KH":"ពពោះ","en-PH":"pregnancy","tl-PH":"pregnancy","th-TH":"การตั้งครรภ์","my-MM":"pregnancy","zh-TW":"pregnancy","hi-IN":"pregnancy"},b={[a.LOCALE.Vietnam]:{sexualWellness:"suc-khoe-tinh-duc",health:"suc-khoe",healthyEating:"an-uong-lanh-manh",skinHealth:"da-lieu",healthyHabit:"thoi-quen-lanh-manh",drug:"thuoc",womensHealth:"suc-khoe-phu-nu",fitness:"the-duc-the-thao",pregnancy:"mang-thai",parenting:"nuoi-day-con",diabetes:"tieu-duong-dai-thao-duong",healthyMind:"tam-ly-tam-than"},[a.LOCALE.Indonesia]:{pregnancy:"kehamilan",parenting:"parenting",health:"sehat",diabetes:"diabetes",womensHealth:"wanita",drug:"obat-suplemen",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Malaysia]:{pregnancy:"kehamilan",parenting:"keibubapaan",health:"kesihatan",diabetes:"kencing-manis",womensHealth:"kesihatan-wanita",drug:"ubat",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Cambodia]:{pregnancy:"%e1%9e%96%e1%9e%96%e1%9f%84%e1%9f%87",parenting:"%e1%9e%85%e1%9e%b7%e1%9e%89%e1%9f%92%e1%9e%85%e1%9e%b9%e1%9e%98%e1%9e%80%e1%9e%bc%e1%9e%93",health:"%e1%9e%9f%e1%9e%bb%e1%9e%81%e1%9e%97%e1%9e%b6%e1%9e%96%e1%9e%91%e1%9e%bc%e1%9e%91%e1%9f%85",diabetes:"%e1%9e%87%e1%9f%86%e1%9e%84%e1%9e%ba%e1%9e%91%e1%9e%b9%e1%9e%80%e1%9e%93%e1%9f%84%e1%9e%98%e1%9e%95%e1%9f%92%e1%9e%a2%e1%9f%82%e1%9e%98",womensHealth:"%e1%9e%9f%e1%9e%bb%e1%9e%81%e1%9e%97%e1%9e%b6%e1%9e%96%e1%9e%9f%e1%9f%92%e1%9e%8f%e1%9f%92%e1%9e%9a%e1%9e%b8",drug:"%e1%9e%b1%e1%9e%9f%e1%9e%90%e1%9e%93%e1%9e%b7%e1%9e%84%e1%9e%a2%e1%9e%b6%e1%9e%a0%e1%9e%b6%e1%9e%9a%e1%9e%94%e1%9f%86%e1%9e%94%e1%9f%89%e1%9e%93",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.PhilippinesEnglish]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",drug:"drugs-supplements",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.PhilippinesTagalog]:{pregnancy:"pagbubuntis",parenting:"pagiging-magulang",health:"kalusugan",diabetes:"diabetes-fil",womensHealth:"kalusugan-kababaihan",drug:"drugs-at-supplements",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Thailand]:{pregnancy:"%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b8%b1%e0%b9%89%e0%b8%87%e0%b8%84%e0%b8%a3%e0%b8%a3%e0%b8%a0%e0%b9%8c",parenting:"%e0%b8%9e%e0%b9%88%e0%b8%ad%e0%b9%81%e0%b8%a1%e0%b9%88%e0%b9%80%e0%b8%a5%e0%b8%b5%e0%b9%89%e0%b8%a2%e0%b8%87%e0%b8%a5%e0%b8%b9%e0%b8%81",health:"%e0%b8%aa%e0%b8%b8%e0%b8%82%e0%b8%a0%e0%b8%b2%e0%b8%9e",diabetes:"%e0%b9%82%e0%b8%a3%e0%b8%84%e0%b9%80%e0%b8%9a%e0%b8%b2%e0%b8%ab%e0%b8%a7%e0%b8%b2%e0%b8%99",womensHealth:"%e0%b8%aa%e0%b8%b8%e0%b8%82%e0%b8%a0%e0%b8%b2%e0%b8%9e%e0%b8%ab%e0%b8%8d%e0%b8%b4%e0%b8%87",drug:"%e0%b8%a2%e0%b8%b2%e0%b9%81%e0%b8%a5%e0%b8%b0%e0%b8%ad%e0%b8%b2%e0%b8%ab%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%aa%e0%b8%a3%e0%b8%b4%e0%b8%a1",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Myanmar]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",drug:"drugs-az",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.Taiwan]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",drug:"drugs-supplement",sexualWellness:"",healthyEating:"",skinHealth:""},[a.LOCALE.India]:{pregnancy:"pregnancy",parenting:"parenting",health:"health",diabetes:"diabetes",womensHealth:"womens-health",diabetesEn:"en-diabetes",drug:"dawaai",sexualWellness:"",healthyEating:"",skinHealth:""}};exports.MAPPED_CATEGORY_SLUGS=b,exports.PREGNANCY_SLUG=t,exports.useCategory=a=>{const{locale:s}=n.useTranslations();return{isPregnancy:e.useMemo((()=>decodeURI(a.replace(/\//gi,"")).includes(t[s])),[]),isParenting:e.useMemo((()=>{var e;return decodeURI(a.replace(/\//gi,"")).includes(null===(e=b[s])||void 0===e?void 0:e.parenting)}),[]),type:e.useMemo((()=>function(e,a){const n=e.split("/");for(const e in a){const t=a[e];if(n.includes(t))return e}return null}(a,b[s])),[a,s])}};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./tslib.es6-888abbb9.js"),t=require("react"),a=require("./getDynamicHealthTool-c72bd725.js");exports.useHealthToolsCache=o=>{const[i,l]=t.useState([]);t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){const e=yield a.getDynamicHealthToolWithCache(o);l(e)}))}),[a.getDynamicHealthToolWithCache,o]);const r=t.useCallback((e=>{var t;return(null===(t=i.find((t=>t.template===e)))||void 0===t?void 0:t.link)||""}),[i]);return{allTools:i,getHealthToolLink:r}};