@hhgtech/hhg-components 1.29.88 → 1.29.89

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 (459) hide show
  1. package/build/{LastPeriod-235fc10e.js → LastPeriod-c8c46da3.js} +1 -1
  2. package/build/MobileBottomNavigationIcon-efacfc0c.js +193 -0
  3. package/build/{WhatsApp-e6406d8d.js → WhatsApp-8a1d6d0c.js} +1 -1
  4. package/build/adapters.js +18 -16
  5. package/build/atoms.js +47 -45
  6. package/build/babyGrowth.js +82 -80
  7. package/build/cache.js +2 -2
  8. package/build/care.js +28 -25
  9. package/build/careBookingSearchBar.js +1594 -0
  10. package/build/careBookingSearchBarV2.js +1665 -0
  11. package/build/components.js +125 -115
  12. package/build/{constants-2d046b25.js → constants-f5c5e2ae.js} +1 -1
  13. package/build/constants.js +3 -3
  14. package/build/constantsDomainLocales.js +1 -1
  15. package/build/constantsRiskScreener.js +2 -2
  16. package/build/constantsSite.js +2 -2
  17. package/build/{core-ab09e68b.js → core-58a245c5.js} +1 -1
  18. package/build/{dataTransform-945e5f4f.js → dataTransform-9ec385e3.js} +1 -1
  19. package/build/ecom.js +4 -4
  20. package/build/editor-40386fe7.js +986 -0
  21. package/build/embeddedHeathToolCards_babyGrowth.js +22 -20
  22. package/build/embeddedHeathToolCards_babyPoop.js +18 -16
  23. package/build/embeddedHeathToolCards_babyVaccine.js +21 -19
  24. package/build/embeddedHeathToolCards_bmi_bmi.js +25 -23
  25. package/build/embeddedHeathToolCards_bmrBmr.js +25 -23
  26. package/build/embeddedHeathToolCards_dueDate_dueDate.js +21 -19
  27. package/build/embeddedHeathToolCards_ovulation_ovulation.js +21 -19
  28. package/build/embeddedHeathToolCards_pwg_pwg.js +26 -24
  29. package/build/embeddedHeathToolCards_targetHeartRate.js +27 -25
  30. package/build/esm/{LastPeriod-fcd2b5ec.js → LastPeriod-46d6c03f.js} +1 -1
  31. package/build/esm/MobileBottomNavigationIcon-ae6490d7.js +185 -0
  32. package/build/esm/{WhatsApp-2f54ed26.js → WhatsApp-ed8ce0f2.js} +1 -1
  33. package/build/esm/adapters.js +18 -16
  34. package/build/esm/atoms.js +44 -42
  35. package/build/esm/babyGrowth.js +82 -80
  36. package/build/esm/cache.js +2 -2
  37. package/build/esm/care.js +26 -23
  38. package/build/esm/careBookingSearchBar.js +1582 -0
  39. package/build/esm/careBookingSearchBarV2.js +1655 -0
  40. package/build/esm/components.js +93 -83
  41. package/build/esm/{constants-b68073ea.js → constants-e9ebe043.js} +1 -1
  42. package/build/esm/constants.js +3 -3
  43. package/build/esm/constantsDomainLocales.js +1 -1
  44. package/build/esm/constantsRiskScreener.js +2 -2
  45. package/build/esm/constantsSite.js +2 -2
  46. package/build/esm/{core-bcdf3422.js → core-6d8629c2.js} +1 -1
  47. package/build/esm/{dataTransform-c3905a10.js → dataTransform-2023858d.js} +2 -2
  48. package/build/esm/ecom.js +4 -4
  49. package/build/esm/editor-82c3d476.js +959 -0
  50. package/build/esm/embeddedHeathToolCards_babyGrowth.js +22 -20
  51. package/build/esm/embeddedHeathToolCards_babyPoop.js +18 -16
  52. package/build/esm/embeddedHeathToolCards_babyVaccine.js +21 -19
  53. package/build/esm/embeddedHeathToolCards_bmi_bmi.js +25 -23
  54. package/build/esm/embeddedHeathToolCards_bmrBmr.js +25 -23
  55. package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +21 -19
  56. package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +21 -19
  57. package/build/esm/embeddedHeathToolCards_pwg_pwg.js +26 -24
  58. package/build/esm/embeddedHeathToolCards_targetHeartRate.js +27 -25
  59. package/build/esm/{fixedBottomAdBlock-bb1a3c50.js → fixedBottomAdBlock-2af1606f.js} +26 -662
  60. package/build/esm/footer.js +20 -18
  61. package/build/esm/gAssets.js +2 -2
  62. package/build/esm/healthToolsCardWrapper.js +17 -15
  63. package/build/esm/healthToolsForm.js +33 -31
  64. package/build/esm/hooks.js +15 -15
  65. package/build/esm/i18n.js +2 -2
  66. package/build/esm/i18nV2.js +2 -2
  67. package/build/esm/{index-04146795.js → index-04ba5caa.js} +1 -1
  68. package/build/esm/{index-69c631bf.js → index-082a24ae.js} +12 -11
  69. package/build/esm/{index-478546e8.js → index-1313a7ac.js} +12 -11
  70. package/build/esm/{index-155daac5.js → index-13783871.js} +2 -2
  71. package/build/esm/{index-48fdf51c.js → index-16a4f1c7.js} +16 -15
  72. package/build/esm/{index-877a46df.js → index-19f27bd3.js} +2 -2
  73. package/build/esm/{index-8570e132.js → index-1a2bc551.js} +2 -2
  74. package/build/esm/{index-fcf9a2ce.js → index-275c8526.js} +14 -13
  75. package/build/esm/{index-0cf91429.js → index-277566f7.js} +1 -1
  76. package/build/esm/{index-67603e6c.js → index-2ac50d8f.js} +15 -14
  77. package/build/esm/{index-19a9a60d.js → index-2c4a2d31.js} +1 -1
  78. package/build/esm/{index-ef2b1e44.js → index-32a968a1.js} +6 -6
  79. package/build/esm/{index-cde1edae.js → index-346fd194.js} +21 -19
  80. package/build/esm/{index-b927d85a.js → index-38b87b21.js} +12 -11
  81. package/build/esm/{index-a7bfcfbd.js → index-46c22744.js} +6 -6
  82. package/build/esm/index-4cf37916.js +22 -0
  83. package/build/esm/{index-a715b700.js → index-4d27d02e.js} +15 -14
  84. package/build/esm/{index-9a0b3bcd.js → index-52d04cc5.js} +7 -7
  85. package/build/esm/index-538ca8aa.js +860 -0
  86. package/build/esm/{index-a2704991.js → index-57da0f13.js} +16 -88
  87. package/build/esm/{index-b4cab951.js → index-5e17f985.js} +16 -15
  88. package/build/esm/{index-83ab0594.js → index-605eed95.js} +35 -800
  89. package/build/esm/{index-5303fcd9.js → index-628c5e84.js} +2 -2
  90. package/build/esm/{index-321f0612.js → index-64b1cd5c.js} +1 -1
  91. package/build/esm/index-673fd5bd.js +1264 -0
  92. package/build/esm/{index-140ea208.js → index-70883b48.js} +17 -16
  93. package/build/esm/{index-e84f16f3.js → index-71c8b83f.js} +3 -142
  94. package/build/esm/{index-e5797070.js → index-72c269cf.js} +3 -3
  95. package/build/esm/index-7ad9db02.js +1030 -0
  96. package/build/esm/{index-17115a3b.js → index-7ca4ec53.js} +15 -14
  97. package/build/esm/{index-5a81cbdd.js → index-7decdf27.js} +1 -1
  98. package/build/esm/index-7e95ba03.js +144 -0
  99. package/build/esm/{index-11bc6557.js → index-84b3ef3d.js} +3 -3
  100. package/build/esm/{index-4e92aaf2.js → index-8b9c7b45.js} +3 -3
  101. package/build/esm/{index-63d30402.js → index-930b0a77.js} +16 -15
  102. package/build/esm/{index-2292c1f3.js → index-93c8863d.js} +2 -2
  103. package/build/esm/{index-29676661.js → index-949f771c.js} +6 -6
  104. package/build/esm/{index-7d97103f.js → index-99551970.js} +2 -2
  105. package/build/esm/{index-d3c3615e.js → index-9c268a93.js} +2 -2
  106. package/build/esm/{index-d10d5d1f.js → index-9d7d3a53.js} +4 -4
  107. package/build/esm/{index-69ca7b6a.js → index-9e220aaa.js} +2 -2
  108. package/build/esm/{index-58982ea1.js → index-a424a33d.js} +3 -3
  109. package/build/esm/{index-b23b0c82.js → index-a54b6536.js} +14 -13
  110. package/build/esm/{index-05075062.js → index-b09ced58.js} +1 -1
  111. package/build/esm/{index-1f944c2d.js → index-b5ed732f.js} +5 -5
  112. package/build/esm/{index-0e0f3ac6.js → index-b867d267.js} +1 -1
  113. package/build/esm/{index-2f06b1d8.js → index-c4b04b5f.js} +1 -1
  114. package/build/esm/{index-efdc151c.js → index-c5286b89.js} +12 -11
  115. package/build/esm/{index-2b20b8ce.js → index-cbb45a5d.js} +2 -2
  116. package/build/esm/{index-f42f0c66.js → index-d4dcfb68.js} +2 -2
  117. package/build/esm/{index-c0790cdc.js → index-dec46974.js} +20 -17
  118. package/build/esm/index-e19da15e.js +468 -0
  119. package/build/esm/{index-fbe76c43.js → index-e1d35fec.js} +7 -6
  120. package/build/esm/{index-58ed669e.js → index-e477c2a3.js} +23 -19
  121. package/build/esm/{index-7ab1ac4c.js → index-ed292946.js} +2 -2
  122. package/build/esm/index-f3f06437.js +281 -0
  123. package/build/esm/index.js +118 -98
  124. package/build/esm/index.styles-25454e9c.js +62 -0
  125. package/build/esm/interfaces/types/Subot.d.ts +3 -3
  126. package/build/esm/{labelSorting-db27bdad.js → labelSorting-27ecf45e.js} +4 -4
  127. package/build/esm/lead.js +22 -20
  128. package/build/esm/{logoIcon-6ed45e55.js → logoIcon-ef6d9e4c.js} +2 -2
  129. package/build/esm/mantine.js +24 -22
  130. package/build/esm/misc.js +18 -18
  131. package/build/esm/miscGetDynamicHealthTool.js +7 -7
  132. package/build/esm/miscGetSocialList.js +8 -8
  133. package/build/esm/miscScreenSizeContext.js +1 -1
  134. package/build/esm/mobileBottomNavigation.js +19 -0
  135. package/build/esm/mobileBottomNavigationIcon.js +10 -0
  136. package/build/esm/molecules.js +71 -64
  137. package/build/esm/moleculesArticleCard.js +85 -0
  138. package/build/esm/moleculesArticleCardV2.js +171 -0
  139. package/build/esm/navigation.js +40 -35
  140. package/build/esm/navigationLogoutPopup.js +116 -0
  141. package/build/esm/navigationProfileButton.js +43 -0
  142. package/build/esm/{normalizeLink-fcd22117.js → normalizeLink-d756e5e6.js} +1 -1
  143. package/build/esm/onboardingV2.js +27 -25
  144. package/build/esm/organisms.js +46 -41
  145. package/build/esm/post-86117110.js +267 -0
  146. package/build/esm/profileNavigation.js +441 -0
  147. package/build/esm/progressBar.js +250 -0
  148. package/build/esm/pwg.js +21 -19
  149. package/build/esm/{routing-ed745cc6.js → routing-b81b8f17.js} +1 -1
  150. package/build/esm/subot.js +29 -27
  151. package/build/esm/surveyOrPremiumBanner.js +30 -28
  152. package/build/esm/surveyQuestionCard.js +10 -10
  153. package/build/esm/{surveyThankyouCard-6fc9a327.js → surveyThankyouCard-1b30aa0b.js} +5 -5
  154. package/build/esm/together.js +53 -44
  155. package/build/esm/togetherApiUtils.js +4 -4
  156. package/build/esm/togetherAtoms.js +29 -26
  157. package/build/esm/togetherComponentGlobalContext.js +4 -4
  158. package/build/esm/togetherMolecules.js +56 -47
  159. package/build/esm/togetherMoleculesCardAuthor.js +41 -0
  160. package/build/esm/togetherMoleculesPostImagePreview.js +21 -0
  161. package/build/esm/togetherMoleculesProfileDetail.js +53 -0
  162. package/build/esm/togetherOrganisms.js +53 -44
  163. package/build/esm/togetherRichTextEditor.js +27 -0
  164. package/build/esm/togetherShareBox.js +305 -0
  165. package/build/esm/{treePopoverMenu-937ef815.js → treePopoverMenu-04ded0ef.js} +18 -17
  166. package/build/esm/types-3eb97d85.js +44 -0
  167. package/build/esm/types.js +2 -2
  168. package/build/esm/{useCategory-d239339f.js → useCategory-391ffab0.js} +5 -5
  169. package/build/esm/{useHealthToolCache-e6e0e96c.js → useHealthToolCache-931ab3ca.js} +1 -1
  170. package/build/esm/{useMantineLocale-2ece6eac.js → useMantineLocale-b29ca68b.js} +5 -5
  171. package/build/esm/{usePlacesAutocomplete-ecf31643.js → usePlacesAutocomplete-91226a4d.js} +1 -1
  172. package/build/esm/useTogetherAuthRequiredAction.js +4 -4
  173. package/build/esm/{useTranslations-160e66cc.js → useTranslations-b66d9f2b.js} +1 -1
  174. package/build/esm/utils-92e2bc22.js +206 -0
  175. package/build/esm/{utils-d78e02e6.js → utils-f4b925d7.js} +2 -2
  176. package/build/esm/{utils-3d9043fb.js → utils-f873578b.js} +4 -4
  177. package/build/esm/vaccination.js +20 -18
  178. package/build/{fixedBottomAdBlock-87988744.js → fixedBottomAdBlock-605a8692.js} +49 -691
  179. package/build/footer.js +20 -18
  180. package/build/gAssets.js +2 -2
  181. package/build/healthToolsCardWrapper.js +17 -15
  182. package/build/healthToolsForm.js +33 -31
  183. package/build/hooks.js +15 -15
  184. package/build/i18n.js +1 -1
  185. package/build/i18nV2.js +1 -1
  186. package/build/{index-6ce119f5.js → index-0afde39e.js} +2 -2
  187. package/build/{index-bac0bd08.js → index-0cb2de9d.js} +3 -3
  188. package/build/{index-84e8b355.js → index-188e2316.js} +15 -14
  189. package/build/index-1b06e81f.js +151 -0
  190. package/build/{index-fcf16e35.js → index-1cdccd4e.js} +2 -2
  191. package/build/index-27e50de1.js +478 -0
  192. package/build/{index-a688f865.js → index-32abfb15.js} +12 -11
  193. package/build/{index-a136cba7.js → index-36723718.js} +6 -6
  194. package/build/{index-9e92431c.js → index-36ba9947.js} +2 -2
  195. package/build/{index-5006f129.js → index-3c593ede.js} +6 -6
  196. package/build/{index-6c2d2f25.js → index-4bf6b5da.js} +24 -99
  197. package/build/{index-5ddda8f4.js → index-4fd69136.js} +16 -15
  198. package/build/{index-6313ec6f.js → index-526cee72.js} +6 -6
  199. package/build/{index-92e82d0d.js → index-549b9e8c.js} +1 -1
  200. package/build/{index-a6acde43.js → index-5b52b076.js} +38 -34
  201. package/build/{index-8b8263ed.js → index-5dbd317c.js} +34 -33
  202. package/build/index-5dcd87b7.js +289 -0
  203. package/build/{index-e4004288.js → index-648aac83.js} +2 -2
  204. package/build/{index-c294ccc2.js → index-6b7b4292.js} +3 -3
  205. package/build/{index-2de1a14d.js → index-6b95442c.js} +2 -2
  206. package/build/{index-9add51eb.js → index-6b9e8dda.js} +3 -3
  207. package/build/{index-b040447b.js → index-767f9ac6.js} +2 -2
  208. package/build/{index-1ebaa446.js → index-7ce45455.js} +16 -15
  209. package/build/{index-f05721a0.js → index-81ff6094.js} +7 -7
  210. package/build/{index-03834ac7.js → index-86ecfc48.js} +3 -3
  211. package/build/{index-66b34bd9.js → index-8a19ce1b.js} +96 -864
  212. package/build/{index-f3553904.js → index-8d9663db.js} +9 -8
  213. package/build/{index-227e17fd.js → index-9151d357.js} +2 -2
  214. package/build/index-922020ed.js +1045 -0
  215. package/build/{index-347a91f6.js → index-a76596ef.js} +1 -1
  216. package/build/{index-1489f027.js → index-a839c6ca.js} +3 -3
  217. package/build/{index-4dc41ef1.js → index-a8705384.js} +1 -1
  218. package/build/{index-b8620e16.js → index-aad249ab.js} +2 -2
  219. package/build/{index-92815934.js → index-af48fea3.js} +5 -5
  220. package/build/{index-ae03f378.js → index-b04c5212.js} +16 -15
  221. package/build/{index-7e8732ae.js → index-b4fd3100.js} +1 -1
  222. package/build/{index-f3f648e1.js → index-be0a9d63.js} +17 -16
  223. package/build/{index-d9559ac1.js → index-be262a50.js} +2 -2
  224. package/build/index-becfec7a.js +1307 -0
  225. package/build/index-bf3796aa.js +870 -0
  226. package/build/{index-196d4981.js → index-cc4ce0c4.js} +1 -1
  227. package/build/{index-9f995309.js → index-cd0db938.js} +34 -31
  228. package/build/{index-c016b1bb.js → index-d0610b0f.js} +14 -13
  229. package/build/{index-554ad68c.js → index-d393d57e.js} +1 -1
  230. package/build/{index-0772398f.js → index-d471ff2d.js} +1 -1
  231. package/build/{index-7024d536.js → index-d5d9ceb9.js} +15 -14
  232. package/build/{index-1245ea43.js → index-de26b5d1.js} +12 -11
  233. package/build/{index-7ca746d3.js → index-dec3abcf.js} +15 -14
  234. package/build/{index-a97a7a53.js → index-e018af91.js} +31 -29
  235. package/build/index-e8dc7fdb.js +29 -0
  236. package/build/{index-4a6c95fe.js → index-f30e56f1.js} +12 -11
  237. package/build/{index-519a6287.js → index-f6b32484.js} +12 -11
  238. package/build/{index-d39f2445.js → index-f91ed3be.js} +4 -4
  239. package/build/{index-e7b871b4.js → index-faa2908c.js} +3 -143
  240. package/build/{index-9cc21262.js → index-fbb369ff.js} +1 -1
  241. package/build/{index-f8a51099.js → index-fde11604.js} +2 -2
  242. package/build/index.js +182 -162
  243. package/build/index.styles-9031f6d6.js +65 -0
  244. package/build/interfaces/types/Subot.d.ts +3 -3
  245. package/build/{labelSorting-60b0f16a.js → labelSorting-11165c8e.js} +4 -4
  246. package/build/lead.js +22 -20
  247. package/build/{logoIcon-8e1ff0aa.js → logoIcon-f3283bfd.js} +2 -2
  248. package/build/mantine.js +20 -18
  249. package/build/misc.js +18 -18
  250. package/build/miscGetDynamicHealthTool.js +7 -7
  251. package/build/miscGetSocialList.js +8 -8
  252. package/build/miscScreenSizeContext.js +1 -1
  253. package/build/mobileBottomNavigation.js +27 -0
  254. package/build/mobileBottomNavigationIcon.js +18 -0
  255. package/build/molecules.js +76 -69
  256. package/build/moleculesArticleCard.js +93 -0
  257. package/build/moleculesArticleCardV2.js +180 -0
  258. package/build/navigation.js +40 -35
  259. package/build/navigationLogoutPopup.js +125 -0
  260. package/build/navigationProfileButton.js +51 -0
  261. package/build/onboardingV2.js +29 -27
  262. package/build/organisms.js +49 -44
  263. package/build/post-0fec66f4.js +303 -0
  264. package/build/profileNavigation.js +450 -0
  265. package/build/progressBar.js +260 -0
  266. package/build/pwg.js +21 -19
  267. package/build/{routing-d764168d.js → routing-7a9c8608.js} +1 -1
  268. package/build/subot.js +28 -26
  269. package/build/surveyOrPremiumBanner.js +30 -28
  270. package/build/surveyQuestionCard.js +10 -10
  271. package/build/{surveyThankyouCard-944ab001.js → surveyThankyouCard-db73c893.js} +5 -5
  272. package/build/together.js +77 -68
  273. package/build/togetherApiUtils.js +4 -4
  274. package/build/togetherAtoms.js +29 -26
  275. package/build/togetherComponentGlobalContext.js +4 -4
  276. package/build/togetherMolecules.js +79 -70
  277. package/build/togetherMoleculesCardAuthor.js +49 -0
  278. package/build/togetherMoleculesPostImagePreview.js +29 -0
  279. package/build/togetherMoleculesProfileDetail.js +70 -0
  280. package/build/togetherOrganisms.js +53 -44
  281. package/build/togetherRichTextEditor.js +36 -0
  282. package/build/togetherShareBox.js +314 -0
  283. package/build/{treePopoverMenu-0cbe3fd0.js → treePopoverMenu-61ebd05c.js} +18 -17
  284. package/build/types-57052089.js +52 -0
  285. package/build/types.js +2 -2
  286. package/build/{useCategory-32558796.js → useCategory-d9f73b82.js} +5 -5
  287. package/build/{useHealthToolCache-cbe4b1b4.js → useHealthToolCache-4b5bfb11.js} +1 -1
  288. package/build/{useMantineLocale-992ae094.js → useMantineLocale-cc272195.js} +5 -5
  289. package/build/{usePlacesAutocomplete-c19d396b.js → usePlacesAutocomplete-a0156f14.js} +1 -1
  290. package/build/useTogetherAuthRequiredAction.js +4 -4
  291. package/build/{useTranslations-5d28e8df.js → useTranslations-8a9fa84d.js} +1 -1
  292. package/build/{utils-1a876a51.js → utils-251b2841.js} +3 -3
  293. package/build/{utils-d3353e9c.js → utils-c29214c6.js} +2 -2
  294. package/build/utils-f47b2d2d.js +229 -0
  295. package/build/vaccination.js +24 -22
  296. package/package.json +1 -1
  297. package/build/esm/index-c7b92115.js +0 -5060
  298. package/build/esm/types-f387cdcf.js +0 -3433
  299. package/build/index-2ce324cf.js +0 -5123
  300. package/build/types-d798cef3.js +0 -3447
  301. /package/build/{BMI_BOYS.percentile.monthly-2fdec618.js → BMI_BOYS.percentile.monthly-5f29289b.js} +0 -0
  302. /package/build/{BMI_BOYS.percentile.weekly-4b1616c4.js → BMI_BOYS.percentile.weekly-53584232.js} +0 -0
  303. /package/build/{BMI_BOYS.percentile.yearly-f7761749.js → BMI_BOYS.percentile.yearly-84aaf8fb.js} +0 -0
  304. /package/build/{BMI_BOYS.zscore.monthly-6767b0d4.js → BMI_BOYS.zscore.monthly-76d7fd0e.js} +0 -0
  305. /package/build/{BMI_BOYS.zscore.weekly-5c57342b.js → BMI_BOYS.zscore.weekly-ed3d66f2.js} +0 -0
  306. /package/build/{BMI_BOYS.zscore.yearly-d970734e.js → BMI_BOYS.zscore.yearly-7e74f0e8.js} +0 -0
  307. /package/build/{BMI_GIRLS.percentile.monthly-ba4d972d.js → BMI_GIRLS.percentile.monthly-6973d8b0.js} +0 -0
  308. /package/build/{BMI_GIRLS.percentile.weekly-f73dacf3.js → BMI_GIRLS.percentile.weekly-a873a4e6.js} +0 -0
  309. /package/build/{BMI_GIRLS.percentile.yearly-a5b59a8c.js → BMI_GIRLS.percentile.yearly-e86761bb.js} +0 -0
  310. /package/build/{BMI_GIRLS.zscore.monthly-110d6823.js → BMI_GIRLS.zscore.monthly-9a12fa84.js} +0 -0
  311. /package/build/{BMI_GIRLS.zscore.weekly-cfe97ba9.js → BMI_GIRLS.zscore.weekly-5936ed5b.js} +0 -0
  312. /package/build/{BMI_GIRLS.zscore.yearly-ab4ae640.js → BMI_GIRLS.zscore.yearly-d40d8356.js} +0 -0
  313. /package/build/{ChevronDown-d37704eb.js → ChevronDown-a6775d48.js} +0 -0
  314. /package/build/{Close-1514c815.js → Close-9fa735bc.js} +0 -0
  315. /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-6c797045.js → HEAD CIRCUM_BOYS.percentile.monthly-873a839f.js} +0 -0
  316. /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-7ac501c0.js → HEAD CIRCUM_BOYS.percentile.weekly-bbe3965d.js} +0 -0
  317. /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-2999cdb8.js → HEAD CIRCUM_BOYS.percentile.yearly-645dfc78.js} +0 -0
  318. /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-7e3a78aa.js → HEAD CIRCUM_BOYS.zscore.monthly-9fe137bf.js} +0 -0
  319. /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-2ea72789.js → HEAD CIRCUM_BOYS.zscore.weekly-2ccb15fb.js} +0 -0
  320. /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-826ab425.js → HEAD CIRCUM_BOYS.zscore.yearly-48aed724.js} +0 -0
  321. /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-0f1636c1.js → HEAD CIRCUM_GIRLS.percentile.monthly-d99d6d30.js} +0 -0
  322. /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-b32da590.js → HEAD CIRCUM_GIRLS.percentile.weekly-8a49b504.js} +0 -0
  323. /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-850c4e29.js → HEAD CIRCUM_GIRLS.percentile.yearly-d747b0cd.js} +0 -0
  324. /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-f942b53a.js → HEAD CIRCUM_GIRLS.zscore.monthly-8ef18721.js} +0 -0
  325. /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-26daad32.js → HEAD CIRCUM_GIRLS.zscore.weekly-853cca20.js} +0 -0
  326. /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-0f331108.js → HEAD CIRCUM_GIRLS.zscore.yearly-4d5b2175.js} +0 -0
  327. /package/build/{HEIGHT_BOYS.percentile.monthly-6bfc3799.js → HEIGHT_BOYS.percentile.monthly-070590b8.js} +0 -0
  328. /package/build/{HEIGHT_BOYS.percentile.weekly-0ed4b053.js → HEIGHT_BOYS.percentile.weekly-56741428.js} +0 -0
  329. /package/build/{HEIGHT_BOYS.percentile.yearly-cc4c343d.js → HEIGHT_BOYS.percentile.yearly-9c81f767.js} +0 -0
  330. /package/build/{HEIGHT_BOYS.zscore.monthly-b2d384dc.js → HEIGHT_BOYS.zscore.monthly-729982c3.js} +0 -0
  331. /package/build/{HEIGHT_BOYS.zscore.weekly-b65aa792.js → HEIGHT_BOYS.zscore.weekly-ddb206fb.js} +0 -0
  332. /package/build/{HEIGHT_BOYS.zscore.yearly-0bae3840.js → HEIGHT_BOYS.zscore.yearly-5fc7ea6a.js} +0 -0
  333. /package/build/{HEIGHT_GIRLS.percentile.monthly-34960fd2.js → HEIGHT_GIRLS.percentile.monthly-8cbc8d18.js} +0 -0
  334. /package/build/{HEIGHT_GIRLS.percentile.weekly-949ca5b1.js → HEIGHT_GIRLS.percentile.weekly-7145e94f.js} +0 -0
  335. /package/build/{HEIGHT_GIRLS.percentile.yearly-4c40b714.js → HEIGHT_GIRLS.percentile.yearly-ab0e4f4e.js} +0 -0
  336. /package/build/{HEIGHT_GIRLS.zscore.monthly-a3856728.js → HEIGHT_GIRLS.zscore.monthly-b851b1d7.js} +0 -0
  337. /package/build/{HEIGHT_GIRLS.zscore.weekly-b39f321f.js → HEIGHT_GIRLS.zscore.weekly-98aef3cf.js} +0 -0
  338. /package/build/{HEIGHT_GIRLS.zscore.yearly-f50c6d58.js → HEIGHT_GIRLS.zscore.yearly-65d990f7.js} +0 -0
  339. /package/build/{Locale-e3b7ae56.js → Locale-07aceee9.js} +0 -0
  340. /package/build/{Visible-c6736a66.js → Visible-ddeaf4cc.js} +0 -0
  341. /package/build/{WEIGHT_BOYS.percentile.monthly-685aabfc.js → WEIGHT_BOYS.percentile.monthly-0ce96694.js} +0 -0
  342. /package/build/{WEIGHT_BOYS.percentile.weekly-3c1a6d2f.js → WEIGHT_BOYS.percentile.weekly-b5397f20.js} +0 -0
  343. /package/build/{WEIGHT_BOYS.percentile.yearly-2bd65c8f.js → WEIGHT_BOYS.percentile.yearly-80cccd42.js} +0 -0
  344. /package/build/{WEIGHT_BOYS.zscore.monthly-bba8cd92.js → WEIGHT_BOYS.zscore.monthly-12907f1f.js} +0 -0
  345. /package/build/{WEIGHT_BOYS.zscore.weekly-7bdc0673.js → WEIGHT_BOYS.zscore.weekly-a1af17eb.js} +0 -0
  346. /package/build/{WEIGHT_BOYS.zscore.yearly-32f635e0.js → WEIGHT_BOYS.zscore.yearly-2649ff58.js} +0 -0
  347. /package/build/{WEIGHT_GIRLS.percentile.monthly-ad305e84.js → WEIGHT_GIRLS.percentile.monthly-222d7201.js} +0 -0
  348. /package/build/{WEIGHT_GIRLS.percentile.weekly-92e552b6.js → WEIGHT_GIRLS.percentile.weekly-2997b740.js} +0 -0
  349. /package/build/{WEIGHT_GIRLS.percentile.yearly-df0dd71c.js → WEIGHT_GIRLS.percentile.yearly-3dc5928a.js} +0 -0
  350. /package/build/{WEIGHT_GIRLS.zscore.monthly-8820671b.js → WEIGHT_GIRLS.zscore.monthly-742b7617.js} +0 -0
  351. /package/build/{WEIGHT_GIRLS.zscore.weekly-31d29b05.js → WEIGHT_GIRLS.zscore.weekly-5ee1ca40.js} +0 -0
  352. /package/build/{WEIGHT_GIRLS.zscore.yearly-f731d1e2.js → WEIGHT_GIRLS.zscore.yearly-d6ca7d60.js} +0 -0
  353. /package/build/{animation-b224626d.js → animation-a1ed71d8.js} +0 -0
  354. /package/build/{cart-149e990d.js → cart-7bc1b943.js} +0 -0
  355. /package/build/{constants-f9eca9ad.js → constants-4cad9f4d.js} +0 -0
  356. /package/build/{constants-9c314450.js → constants-81b95117.js} +0 -0
  357. /package/build/{constants-42eed92d.js → constants-c3b9c9a9.js} +0 -0
  358. /package/build/{dataTransform-104761fc.js → dataTransform-867c472c.js} +0 -0
  359. /package/build/{doctor-d8f36158.js → doctor-dca6d1b2.js} +0 -0
  360. /package/build/esm/{BMI_BOYS.percentile.monthly-df1b3770.js → BMI_BOYS.percentile.monthly-2388d98f.js} +0 -0
  361. /package/build/esm/{BMI_BOYS.percentile.weekly-1d9595b1.js → BMI_BOYS.percentile.weekly-8ebe6955.js} +0 -0
  362. /package/build/esm/{BMI_BOYS.percentile.yearly-6bd2bb46.js → BMI_BOYS.percentile.yearly-3a97e95b.js} +0 -0
  363. /package/build/esm/{BMI_BOYS.zscore.monthly-658792d1.js → BMI_BOYS.zscore.monthly-f7572dcd.js} +0 -0
  364. /package/build/esm/{BMI_BOYS.zscore.weekly-d3c4d378.js → BMI_BOYS.zscore.weekly-d6281906.js} +0 -0
  365. /package/build/esm/{BMI_BOYS.zscore.yearly-8ad375e2.js → BMI_BOYS.zscore.yearly-fbebaaca.js} +0 -0
  366. /package/build/esm/{BMI_GIRLS.percentile.monthly-25f98c64.js → BMI_GIRLS.percentile.monthly-a75c8880.js} +0 -0
  367. /package/build/esm/{BMI_GIRLS.percentile.weekly-d60b034d.js → BMI_GIRLS.percentile.weekly-652bc9af.js} +0 -0
  368. /package/build/esm/{BMI_GIRLS.percentile.yearly-0560df43.js → BMI_GIRLS.percentile.yearly-8bcb5a6e.js} +0 -0
  369. /package/build/esm/{BMI_GIRLS.zscore.monthly-2104651f.js → BMI_GIRLS.zscore.monthly-ecbe2982.js} +0 -0
  370. /package/build/esm/{BMI_GIRLS.zscore.weekly-37757497.js → BMI_GIRLS.zscore.weekly-3abed735.js} +0 -0
  371. /package/build/esm/{BMI_GIRLS.zscore.yearly-56872c59.js → BMI_GIRLS.zscore.yearly-d88a34a0.js} +0 -0
  372. /package/build/esm/{ChevronDown-5633c5e8.js → ChevronDown-dfd91883.js} +0 -0
  373. /package/build/esm/{Close-f541a904.js → Close-b8fc27b1.js} +0 -0
  374. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-47e6539d.js → HEAD CIRCUM_BOYS.percentile.monthly-ff980a90.js} +0 -0
  375. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-594e065d.js → HEAD CIRCUM_BOYS.percentile.weekly-eb86eac9.js} +0 -0
  376. /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-d24f1cc6.js → HEAD CIRCUM_BOYS.percentile.yearly-27ed6504.js} +0 -0
  377. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-94d82cb5.js → HEAD CIRCUM_BOYS.zscore.monthly-0d345597.js} +0 -0
  378. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-cb0109d0.js → HEAD CIRCUM_BOYS.zscore.weekly-c182ab46.js} +0 -0
  379. /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-79a794c9.js → HEAD CIRCUM_BOYS.zscore.yearly-d45dbce1.js} +0 -0
  380. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-89615b43.js → HEAD CIRCUM_GIRLS.percentile.monthly-61919e45.js} +0 -0
  381. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-29d9184f.js → HEAD CIRCUM_GIRLS.percentile.weekly-51fa8f98.js} +0 -0
  382. /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-140da49d.js → HEAD CIRCUM_GIRLS.percentile.yearly-c1fa6006.js} +0 -0
  383. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-fe41d0e8.js → HEAD CIRCUM_GIRLS.zscore.monthly-4dfc55d8.js} +0 -0
  384. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-c6193e75.js → HEAD CIRCUM_GIRLS.zscore.weekly-b21b5bf1.js} +0 -0
  385. /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-7018fed4.js → HEAD CIRCUM_GIRLS.zscore.yearly-c42836fa.js} +0 -0
  386. /package/build/esm/{HEIGHT_BOYS.percentile.monthly-fae5e6a0.js → HEIGHT_BOYS.percentile.monthly-24ff8afa.js} +0 -0
  387. /package/build/esm/{HEIGHT_BOYS.percentile.weekly-ddc33aee.js → HEIGHT_BOYS.percentile.weekly-2be7b66e.js} +0 -0
  388. /package/build/esm/{HEIGHT_BOYS.percentile.yearly-9e3064f0.js → HEIGHT_BOYS.percentile.yearly-ac02aa2d.js} +0 -0
  389. /package/build/esm/{HEIGHT_BOYS.zscore.monthly-7c9e0bb8.js → HEIGHT_BOYS.zscore.monthly-b43667dc.js} +0 -0
  390. /package/build/esm/{HEIGHT_BOYS.zscore.weekly-50b0a6a0.js → HEIGHT_BOYS.zscore.weekly-abcfcf3a.js} +0 -0
  391. /package/build/esm/{HEIGHT_BOYS.zscore.yearly-afb6c4a2.js → HEIGHT_BOYS.zscore.yearly-71598c16.js} +0 -0
  392. /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-5c7487f0.js → HEIGHT_GIRLS.percentile.monthly-7f9d679c.js} +0 -0
  393. /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-33465e14.js → HEIGHT_GIRLS.percentile.weekly-6ce1d4e7.js} +0 -0
  394. /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-ae62b279.js → HEIGHT_GIRLS.percentile.yearly-c398fd6b.js} +0 -0
  395. /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-fd13c492.js → HEIGHT_GIRLS.zscore.monthly-8d33bc28.js} +0 -0
  396. /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-f509ffbe.js → HEIGHT_GIRLS.zscore.weekly-eb44c302.js} +0 -0
  397. /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-bf3a867b.js → HEIGHT_GIRLS.zscore.yearly-10b4d1fe.js} +0 -0
  398. /package/build/esm/{Locale-81beb37e.js → Locale-b86a7a92.js} +0 -0
  399. /package/build/esm/{Visible-3d8c22f1.js → Visible-69da852f.js} +0 -0
  400. /package/build/esm/{WEIGHT_BOYS.percentile.monthly-4db4c32c.js → WEIGHT_BOYS.percentile.monthly-fd349fe7.js} +0 -0
  401. /package/build/esm/{WEIGHT_BOYS.percentile.weekly-5321689a.js → WEIGHT_BOYS.percentile.weekly-d5e52d60.js} +0 -0
  402. /package/build/esm/{WEIGHT_BOYS.percentile.yearly-0c2aee80.js → WEIGHT_BOYS.percentile.yearly-929119b3.js} +0 -0
  403. /package/build/esm/{WEIGHT_BOYS.zscore.monthly-ddf307e5.js → WEIGHT_BOYS.zscore.monthly-3f0f08cd.js} +0 -0
  404. /package/build/esm/{WEIGHT_BOYS.zscore.weekly-be1d57ac.js → WEIGHT_BOYS.zscore.weekly-b9fd3298.js} +0 -0
  405. /package/build/esm/{WEIGHT_BOYS.zscore.yearly-6dab88ff.js → WEIGHT_BOYS.zscore.yearly-9945948d.js} +0 -0
  406. /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-a666fe8a.js → WEIGHT_GIRLS.percentile.monthly-1e83ae51.js} +0 -0
  407. /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-cd85042c.js → WEIGHT_GIRLS.percentile.weekly-c3531852.js} +0 -0
  408. /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-f22705ec.js → WEIGHT_GIRLS.percentile.yearly-3c0040b0.js} +0 -0
  409. /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-9f3f1083.js → WEIGHT_GIRLS.zscore.monthly-3baeda15.js} +0 -0
  410. /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-7dcf0ba5.js → WEIGHT_GIRLS.zscore.weekly-2d8e6618.js} +0 -0
  411. /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-c658040c.js → WEIGHT_GIRLS.zscore.yearly-826f5bdd.js} +0 -0
  412. /package/build/esm/{animation-db89f033.js → animation-7207941a.js} +0 -0
  413. /package/build/esm/{cart-47013af9.js → cart-4f482601.js} +0 -0
  414. /package/build/esm/{constants-f9614464.js → constants-0497b893.js} +0 -0
  415. /package/build/esm/{constants-247d5eb0.js → constants-af02be2a.js} +0 -0
  416. /package/build/esm/{constants-410be40f.js → constants-f7943ab2.js} +0 -0
  417. /package/build/esm/{dataTransform-f9e5b4ec.js → dataTransform-610e61bf.js} +0 -0
  418. /package/build/esm/{doctor-88e78d2c.js → doctor-63e09ada.js} +0 -0
  419. /package/build/esm/{index-907fffe6.js → index-20192854.js} +0 -0
  420. /package/build/esm/{index-c3d6b2ed.js → index-20199246.js} +0 -0
  421. /package/build/esm/{index-6dd5a329.js → index-5364f2db.js} +0 -0
  422. /package/build/esm/{index-0ca51fbb.js → index-56d0ac47.js} +0 -0
  423. /package/build/esm/{index-24f2f569.js → index-9f076f64.js} +0 -0
  424. /package/build/esm/{index-6f44d928.js → index-a2506e52.js} +0 -0
  425. /package/build/esm/{index-5f214b71.js → index-c130afdc.js} +0 -0
  426. /package/build/esm/{index-fcd9b927.js → index-c9467e39.js} +0 -0
  427. /package/build/esm/{localizeNumberFormat-be70a31e.js → localizeNumberFormat-3bf28240.js} +0 -0
  428. /package/build/esm/{number-7e3f376a.js → number-d26abebe.js} +0 -0
  429. /package/build/esm/{other-811b7d93.js → other-08d0b30e.js} +0 -0
  430. /package/build/esm/{paths-650d5eee.js → paths-ce59b252.js} +0 -0
  431. /package/build/esm/{translationsContext-0cbb21e6.js → translationsContext-8afb0ce3.js} +0 -0
  432. /package/build/esm/{tslib.es6-3970c414.js → tslib.es6-e0840efa.js} +0 -0
  433. /package/build/esm/{types-78bfaf40.js → types-41242882.js} +0 -0
  434. /package/build/esm/{useIsInit-3f7af1fd.js → useIsInit-f59c6bd2.js} +0 -0
  435. /package/build/esm/{useOutsideClick-2fae5fb5.js → useOutsideClick-12815e56.js} +0 -0
  436. /package/build/esm/{useScrollbarSize-2a7e6dd2.js → useScrollbarSize-431cf33c.js} +0 -0
  437. /package/build/esm/{useUniqueId-d714426d.js → useUniqueId-8f710187.js} +0 -0
  438. /package/build/esm/{utils-cee25689.js → utils-8a1f05c9.js} +0 -0
  439. /package/build/{index-27f25094.js → index-017f99b2.js} +0 -0
  440. /package/build/{index-1d528960.js → index-1a6a94cd.js} +0 -0
  441. /package/build/{index-41a348a2.js → index-668f591b.js} +0 -0
  442. /package/build/{index-32917720.js → index-70abc2ac.js} +0 -0
  443. /package/build/{index-20a5cee0.js → index-c6b0831a.js} +0 -0
  444. /package/build/{index-9f501aac.js → index-ce2d2850.js} +0 -0
  445. /package/build/{index-186f9324.js → index-e3e72aed.js} +0 -0
  446. /package/build/{index-e327613c.js → index-f70c0edf.js} +0 -0
  447. /package/build/{localizeNumberFormat-a5804ea2.js → localizeNumberFormat-30e7f015.js} +0 -0
  448. /package/build/{normalizeLink-2878a2ce.js → normalizeLink-c1b2b407.js} +0 -0
  449. /package/build/{number-35662113.js → number-20d56f69.js} +0 -0
  450. /package/build/{other-a7f01b3d.js → other-eedaf6ca.js} +0 -0
  451. /package/build/{paths-488dafd4.js → paths-4c182009.js} +0 -0
  452. /package/build/{translationsContext-951038ad.js → translationsContext-cd046df4.js} +0 -0
  453. /package/build/{tslib.es6-145af9ce.js → tslib.es6-f3c387c0.js} +0 -0
  454. /package/build/{types-aeea2cc2.js → types-2614ec58.js} +0 -0
  455. /package/build/{useIsInit-0c37752a.js → useIsInit-e56642e4.js} +0 -0
  456. /package/build/{useOutsideClick-aa477d22.js → useOutsideClick-f18dfe3f.js} +0 -0
  457. /package/build/{useScrollbarSize-01b12b72.js → useScrollbarSize-4aaa4dd1.js} +0 -0
  458. /package/build/{useUniqueId-17c2097b.js → useUniqueId-621ec272.js} +0 -0
  459. /package/build/{utils-a1cfbdac.js → utils-ae9740c0.js} +0 -0
@@ -0,0 +1,1582 @@
1
+ import { a as __awaiter } from './tslib.es6-e0840efa.js';
2
+ import React__default, { useMemo, useEffect, useRef, useCallback, useState, useReducer } from 'react';
3
+ import { Global, css } from '@emotion/react';
4
+ import { S as StyledLocationResultsWrapper, a as StyledLocationResultsList, b as StyledLiSkeleton, c as StyledLocationItem, d as StyledPinIcon, M as MagnifierIcon, C as CloseIcon, e as ClearIcon, P as PinIcon, D as DefaultThumbnailAny, f as DefaultThumbnailDoctor, g as DefaultThumbnailService, h as getApiPath, u as useGeolocation } from './utils-92e2bc22.js';
5
+ import { u as useTranslations } from './useTranslations-b66d9f2b.js';
6
+ import debounce from 'lodash/debounce';
7
+ import { I as ID_OPTION_ALL_LOCATION, L as LOCALIZED_SLUGS, a as ID_OPTION_CURRENT_LOCATION } from './constants-f7943ab2.js';
8
+ import styled from '@emotion/styled';
9
+ import { I as Input } from './index-d4dcfb68.js';
10
+ import { T as Text } from './index-99551970.js';
11
+ import { theme } from './miscTheme.js';
12
+ import shuffle from 'lodash/shuffle';
13
+ import { a as useOutsideClick } from './useOutsideClick-12815e56.js';
14
+ import { M as MediaQueries } from './utils-8a1f05c9.js';
15
+ import Skeleton from 'react-loading-skeleton';
16
+ import { P as PATHS } from './paths-ce59b252.js';
17
+ import './index-9e220aaa.js';
18
+ import 'date-fns/locale';
19
+ import './index-7decdf27.js';
20
+ import './Locale-b86a7a92.js';
21
+ import './constantsIsProduction.js';
22
+ import './constantsSite.js';
23
+ import './constantsDomainLocales.js';
24
+ import './constantsRiskScreener.js';
25
+ import './miscCookieHelper.js';
26
+ import 'string-format';
27
+ import './translationsContext-8afb0ce3.js';
28
+ import '@mantine/core';
29
+ import './other-08d0b30e.js';
30
+
31
+ const StyledSearchBarWrapper = styled.div ``;
32
+ const StyledSearchBarMobileWrapper = styled.div `
33
+ --searchbar-z-index: 305;
34
+ &[data-is-modal='true'] {
35
+ position: fixed;
36
+ left: 0;
37
+ right: 0;
38
+ top: 0;
39
+ height: var(--mobile-care-searchbar-height, 100%);
40
+ overflow-y: auto;
41
+ -webkit-overflow-scrolling: touch;
42
+ background-color: white;
43
+ z-index: var(--searchbar-z-index);
44
+ }
45
+ `;
46
+ const StyledSearchBarMobileModalHeader = styled.section ``;
47
+ const StyledHiddenInputMobile = styled.input `
48
+ position: fixed;
49
+ left: -100%;
50
+ top: -100%;
51
+ `;
52
+ const StyledInput = styled(Input) `
53
+ #booking-search-bar & {
54
+ input {
55
+ font-size: 16px;
56
+ }
57
+ }
58
+ `;
59
+
60
+ const LocationResults = ({ cities, isLoading, onLocationClick, selectedLocation, }) => {
61
+ const { t, locale } = useTranslations();
62
+ const renderContent = () => {
63
+ if (isLoading) {
64
+ return React__default.createElement(StyledLiSkeleton, { count: 5 });
65
+ }
66
+ if (!cities || cities.length < 1) {
67
+ return (React__default.createElement(React__default.Fragment, null,
68
+ React__default.createElement(StyledLocationItem, { "data-is-denied": "true" },
69
+ React__default.createElement(Text, { size: "sm", color: "#ccc" }, t('booking.searchBar.noResults')))));
70
+ }
71
+ return (React__default.createElement(React__default.Fragment, null,
72
+ React__default.createElement(StyledLocationItem, { key: "all-location", role: "button", tabIndex: 0, onClick: () => {
73
+ var _a;
74
+ if (onLocationClick) {
75
+ onLocationClick({
76
+ name: t('booking.searchBar.allLocations'),
77
+ id: ID_OPTION_ALL_LOCATION,
78
+ slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
79
+ });
80
+ }
81
+ } },
82
+ React__default.createElement(StyledPinIcon, { color: theme.colors.neutral400 }),
83
+ React__default.createElement(Text, { size: "md" }, t('booking.searchBar.allLocations'))),
84
+ cities.map((city) => (React__default.createElement(StyledLocationItem, { key: city.id, onClick: (evt) => {
85
+ evt.nativeEvent.stopImmediatePropagation();
86
+ if (onLocationClick) {
87
+ onLocationClick(city);
88
+ }
89
+ }, role: "button", tabIndex: 0, "aria-label": `Select ${city.name} as location`, isSelected: (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === city.id },
90
+ React__default.createElement(StyledPinIcon, { color: theme.colors.neutral400 }),
91
+ React__default.createElement(Text, { size: "md" }, city.name))))));
92
+ };
93
+ return (React__default.createElement(StyledLocationResultsWrapper, { "data-testid": "location-search-results" },
94
+ React__default.createElement(StyledLocationResultsList, null, renderContent())));
95
+ };
96
+
97
+ const EVENT_NAMES = {
98
+ TYPE_CHARACTER: 'TYPE_CHARACTER',
99
+ REMOVE_CHARACTER: 'REMOVE_CHARACTER',
100
+ REMOVE_ALL: 'REMOVE_ALL',
101
+ REMOVE_LAST_VISIBLE_NODE: 'REMOVE_LAST_VISIBLE_NODE',
102
+ PAUSE_FOR: 'PAUSE_FOR',
103
+ CHANGE_DELETE_SPEED: 'CHANGE_DELETE_SPEED',
104
+ CHANGE_DELAY: 'CHANGE_DELAY',
105
+ PASTE_STRING: 'PASTE_STRING',
106
+ };
107
+ const getRandomInteger = (min, max) => {
108
+ return Math.floor(Math.random() * (max - min + 1)) + min;
109
+ };
110
+ const VISIBLE_NODE_TYPES = {
111
+ TEXT_NODE: 'TEXT_NODE',
112
+ };
113
+ class Typewriter {
114
+ constructor(options) {
115
+ this.state = {
116
+ lastFrameTime: null,
117
+ pauseUntil: null,
118
+ eventQueue: [],
119
+ eventLoop: null,
120
+ eventLoopPaused: false,
121
+ reverseCalledEvents: [],
122
+ calledEvents: [],
123
+ visibleNodes: [],
124
+ initialOptions: null,
125
+ };
126
+ this.options = {
127
+ strings: null,
128
+ delay: 'natural',
129
+ pauseFor: 1500,
130
+ deleteSpeed: 'natural',
131
+ loop: false,
132
+ autoStart: false,
133
+ stringSplitter: null,
134
+ onCreateTextNode: null,
135
+ onRemoveNode: null,
136
+ };
137
+ this.start = () => {
138
+ this.state.eventLoopPaused = false;
139
+ this.runEventLoop();
140
+ return this;
141
+ };
142
+ this.pause = () => {
143
+ this.state.eventLoopPaused = true;
144
+ return this;
145
+ };
146
+ this.stop = () => {
147
+ if (this.state.eventLoop) {
148
+ window.cancelAnimationFrame(this.state.eventLoop);
149
+ this.state.eventLoop = null;
150
+ }
151
+ return this;
152
+ };
153
+ this.pauseFor = (ms) => {
154
+ this.addEventToQueue(EVENT_NAMES.PAUSE_FOR, { ms });
155
+ return this;
156
+ };
157
+ this.typeOutAllStrings = () => {
158
+ if (typeof this.options.strings === 'string') {
159
+ this.typeString(this.options.strings).pauseFor(this.options.pauseFor);
160
+ return this;
161
+ }
162
+ this.options.strings.forEach((string) => {
163
+ this.typeString(string)
164
+ .pauseFor(this.options.pauseFor)
165
+ .deleteAll(this.options.deleteSpeed);
166
+ });
167
+ return this;
168
+ };
169
+ this.typeString = (string, node = null) => {
170
+ if (string) {
171
+ const { stringSplitter } = this.options || {};
172
+ const characters = typeof stringSplitter === 'function'
173
+ ? stringSplitter(string)
174
+ : string.split('');
175
+ this.typeCharacters(characters, node);
176
+ }
177
+ return this;
178
+ };
179
+ this.pasteString = (string, node = null) => {
180
+ if (string) {
181
+ this.addEventToQueue(EVENT_NAMES.PASTE_STRING, {
182
+ character: string,
183
+ node,
184
+ });
185
+ }
186
+ return this;
187
+ };
188
+ this.deleteAll = (speed = 'natural') => {
189
+ this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, { speed });
190
+ return this;
191
+ };
192
+ this.changeDeleteSpeed = (speed) => {
193
+ if (!speed) {
194
+ throw new Error('Must provide new delete speed');
195
+ }
196
+ this.addEventToQueue(EVENT_NAMES.CHANGE_DELETE_SPEED, { speed });
197
+ return this;
198
+ };
199
+ this.changeDelay = (delay) => {
200
+ if (!delay) {
201
+ throw new Error('Must provide new delay');
202
+ }
203
+ this.addEventToQueue(EVENT_NAMES.CHANGE_DELAY, { delay });
204
+ return this;
205
+ };
206
+ this.deleteChars = (amount) => {
207
+ if (!amount) {
208
+ throw new Error('Must provide amount of characters to delete');
209
+ }
210
+ for (let i = 0; i < amount; i++) {
211
+ this.addEventToQueue(EVENT_NAMES.REMOVE_CHARACTER);
212
+ }
213
+ return this;
214
+ };
215
+ this.typeCharacters = (characters, node = null) => {
216
+ if (!characters || !Array.isArray(characters)) {
217
+ throw new Error('Characters must be an array');
218
+ }
219
+ characters.forEach((character) => {
220
+ this.addEventToQueue(EVENT_NAMES.TYPE_CHARACTER, { character, node });
221
+ });
222
+ return this;
223
+ };
224
+ this.removeCharacters = (characters) => {
225
+ if (!characters || !Array.isArray(characters)) {
226
+ throw new Error('Characters must be an array');
227
+ }
228
+ characters.forEach(() => {
229
+ this.addEventToQueue(EVENT_NAMES.REMOVE_CHARACTER);
230
+ });
231
+ return this;
232
+ };
233
+ this.addEventToQueue = (eventName, eventArgs, prepend = false) => {
234
+ return this.addEventToStateProperty(eventName, eventArgs, prepend, 'eventQueue');
235
+ };
236
+ this.addReverseCalledEvent = (eventName, eventArgs, prepend = false) => {
237
+ const { loop } = this.options;
238
+ if (!loop) {
239
+ return this;
240
+ }
241
+ return this.addEventToStateProperty(eventName, eventArgs, prepend, 'reverseCalledEvents');
242
+ };
243
+ this.addEventToStateProperty = (eventName, eventArgs, prepend = false, property) => {
244
+ const eventItem = {
245
+ eventName,
246
+ eventArgs: eventArgs || {},
247
+ };
248
+ if (prepend) {
249
+ this.state[property] = [eventItem, ...this.state[property]];
250
+ }
251
+ else {
252
+ this.state[property] = [...this.state[property], eventItem];
253
+ }
254
+ return this;
255
+ };
256
+ this.runEventLoop = () => {
257
+ if (!this.state.lastFrameTime) {
258
+ this.state.lastFrameTime = Date.now();
259
+ }
260
+ // Setup variables to calculate if this frame should run
261
+ const nowTime = Date.now();
262
+ const delta = nowTime - this.state.lastFrameTime;
263
+ if (!this.state.eventQueue.length) {
264
+ if (!this.options.loop) {
265
+ return;
266
+ }
267
+ // Reset event queue if we are looping
268
+ this.state.eventQueue = [...this.state.calledEvents];
269
+ this.state.calledEvents = [];
270
+ this.options = Object.assign({}, this.state.initialOptions);
271
+ }
272
+ // Request next frame
273
+ this.state.eventLoop = window.requestAnimationFrame(this.runEventLoop);
274
+ // Check if event loop is paused
275
+ if (this.state.eventLoopPaused) {
276
+ return;
277
+ }
278
+ // Check if state has pause until time
279
+ if (this.state.pauseUntil) {
280
+ // Check if event loop should be paused
281
+ if (nowTime < this.state.pauseUntil) {
282
+ return;
283
+ }
284
+ // Reset pause time
285
+ this.state.pauseUntil = null;
286
+ }
287
+ // Make a clone of event queue
288
+ const eventQueue = [...this.state.eventQueue];
289
+ // Get first event from queue
290
+ const currentEvent = eventQueue.shift();
291
+ // Setup delay variable
292
+ let delay = 0;
293
+ // Check if frame should run or be
294
+ // skipped based on fps interval
295
+ if (currentEvent.eventName === EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE ||
296
+ currentEvent.eventName === EVENT_NAMES.REMOVE_CHARACTER) {
297
+ delay =
298
+ this.options.deleteSpeed === 'natural'
299
+ ? getRandomInteger(40, 80)
300
+ : this.options.deleteSpeed;
301
+ }
302
+ else {
303
+ delay =
304
+ this.options.delay === 'natural'
305
+ ? getRandomInteger(120, 160)
306
+ : this.options.delay;
307
+ }
308
+ if (delta <= delay) {
309
+ return;
310
+ }
311
+ // Get current event args
312
+ const { eventName, eventArgs } = currentEvent;
313
+ // Run item from event loop
314
+ switch (eventName) {
315
+ case EVENT_NAMES.PASTE_STRING:
316
+ case EVENT_NAMES.TYPE_CHARACTER: {
317
+ const { character } = eventArgs;
318
+ const textNode = document.createTextNode(character);
319
+ let textNodeToUse = textNode;
320
+ if (this.options.onCreateTextNode &&
321
+ typeof this.options.onCreateTextNode === 'function') {
322
+ textNodeToUse = this.options.onCreateTextNode(character, textNode);
323
+ }
324
+ this.state.visibleNodes = [
325
+ ...this.state.visibleNodes,
326
+ {
327
+ type: VISIBLE_NODE_TYPES.TEXT_NODE,
328
+ character,
329
+ node: textNodeToUse,
330
+ },
331
+ ];
332
+ break;
333
+ }
334
+ case EVENT_NAMES.REMOVE_CHARACTER: {
335
+ eventQueue.unshift({
336
+ eventName: EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE,
337
+ eventArgs: { removingCharacterNode: true },
338
+ });
339
+ break;
340
+ }
341
+ case EVENT_NAMES.PAUSE_FOR: {
342
+ const { ms } = currentEvent.eventArgs;
343
+ this.state.pauseUntil = Date.now() + parseInt(ms);
344
+ break;
345
+ }
346
+ case EVENT_NAMES.REMOVE_ALL: {
347
+ const { visibleNodes } = this.state;
348
+ const { speed } = eventArgs;
349
+ const removeAllEventItems = [];
350
+ if (speed) {
351
+ removeAllEventItems.push({
352
+ eventName: EVENT_NAMES.CHANGE_DELETE_SPEED,
353
+ eventArgs: { speed, temp: true },
354
+ });
355
+ }
356
+ for (let i = 0, length = visibleNodes.length; i < length; i++) {
357
+ removeAllEventItems.push({
358
+ eventName: EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE,
359
+ eventArgs: { removingCharacterNode: false },
360
+ });
361
+ }
362
+ if (speed) {
363
+ removeAllEventItems.push({
364
+ eventName: EVENT_NAMES.CHANGE_DELETE_SPEED,
365
+ eventArgs: { speed: this.options.deleteSpeed, temp: true },
366
+ });
367
+ }
368
+ eventQueue.unshift(...removeAllEventItems);
369
+ break;
370
+ }
371
+ case EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE: {
372
+ if (this.state.visibleNodes.length) {
373
+ const { node, character } = this.state.visibleNodes.pop();
374
+ if (this.options.onRemoveNode &&
375
+ typeof this.options.onRemoveNode === 'function') {
376
+ this.options.onRemoveNode({
377
+ node,
378
+ character,
379
+ });
380
+ }
381
+ if (node) {
382
+ node.parentNode.removeChild(node);
383
+ }
384
+ }
385
+ break;
386
+ }
387
+ case EVENT_NAMES.CHANGE_DELETE_SPEED: {
388
+ this.options.deleteSpeed = currentEvent.eventArgs.speed;
389
+ break;
390
+ }
391
+ case EVENT_NAMES.CHANGE_DELAY: {
392
+ this.options.delay = currentEvent.eventArgs.delay;
393
+ break;
394
+ }
395
+ }
396
+ // Add que item to called queue if we are looping
397
+ if (this.options.loop) {
398
+ if (currentEvent.eventName !== EVENT_NAMES.REMOVE_LAST_VISIBLE_NODE &&
399
+ !(currentEvent.eventArgs && currentEvent.eventArgs.temp)) {
400
+ this.state.calledEvents = [...this.state.calledEvents, currentEvent];
401
+ }
402
+ }
403
+ // Replace state event queue with cloned queue
404
+ this.state.eventQueue = eventQueue;
405
+ // Set last frame time so it can be used to calculate next frame
406
+ this.state.lastFrameTime = nowTime;
407
+ };
408
+ if (options) {
409
+ this.options = Object.assign(Object.assign({}, this.options), options);
410
+ }
411
+ this.state.initialOptions = Object.assign({}, this.options);
412
+ this.init();
413
+ }
414
+ init() {
415
+ this.addEventToQueue(EVENT_NAMES.REMOVE_ALL, null, true);
416
+ if (this.options.autoStart === true && this.options.strings) {
417
+ this.typeOutAllStrings().start();
418
+ }
419
+ }
420
+ }
421
+
422
+ function useAnimatedPlaceholder({ inputRef, wrapperRef, disabled, }) {
423
+ const { t, locale } = useTranslations();
424
+ const values = useMemo(() => {
425
+ if (disabled) {
426
+ return [];
427
+ }
428
+ const shuffleKeys = [
429
+ 'booking.searchBar.placeholder.hospital',
430
+ 'booking.searchBar.placeholder.doctor',
431
+ ];
432
+ if (locale !== 'zh-TW') {
433
+ shuffleKeys.push('booking.searchBar.placeholder.specialty', 'booking.searchBar.placeholder.service');
434
+ }
435
+ return shuffle(shuffleKeys).map((s) => t(s));
436
+ }, [t, locale]);
437
+ useEffect(() => {
438
+ if (disabled) {
439
+ return;
440
+ }
441
+ const input = getInput();
442
+ if (input) {
443
+ input.placeholder = '';
444
+ new Typewriter({
445
+ strings: values,
446
+ autoStart: true,
447
+ loop: true,
448
+ delay: 32,
449
+ deleteSpeed: 32,
450
+ pauseFor: 1500,
451
+ onCreateTextNode: customNodeCreator,
452
+ onRemoveNode: onRemoveNode,
453
+ });
454
+ }
455
+ }, [inputRef, wrapperRef]);
456
+ function customNodeCreator(character) {
457
+ const input = getInput();
458
+ if (input) {
459
+ input.placeholder = input.placeholder + character;
460
+ }
461
+ return null;
462
+ }
463
+ function onRemoveNode() {
464
+ const input = getInput();
465
+ if (input) {
466
+ input.placeholder = input.placeholder.slice(0, -1);
467
+ }
468
+ }
469
+ function getInput() {
470
+ if (inputRef && inputRef.current) {
471
+ return inputRef.current;
472
+ }
473
+ else if (wrapperRef && wrapperRef.current) {
474
+ return wrapperRef.current.querySelector('input') || null;
475
+ }
476
+ return null;
477
+ }
478
+ return;
479
+ }
480
+
481
+ const StyledFakeInputSearchMobile = styled.div `
482
+ user-select: none;
483
+ input {
484
+ pointer-events: none;
485
+ background-color: white;
486
+ }
487
+ `;
488
+ function MobileFakeInput({ focused, value = '', onClick, trackingAttributes, inputSearchPlaceholder, }) {
489
+ const { t } = useTranslations();
490
+ const wrapperRef = useRef(null);
491
+ useAnimatedPlaceholder({ wrapperRef, disabled: !!inputSearchPlaceholder });
492
+ const gaAttributes = useMemo(() => {
493
+ if (trackingAttributes) {
494
+ return {
495
+ 'data-event-category': trackingAttributes.dataEventCategory,
496
+ 'data-event-action': trackingAttributes.dataEventAction,
497
+ 'data-event-label': trackingAttributes.dataEventLabel,
498
+ };
499
+ }
500
+ else {
501
+ return {};
502
+ }
503
+ }, [trackingAttributes]);
504
+ return (React__default.createElement(StyledFakeInputSearchMobile, Object.assign({ onClick: () => onClick && onClick(), ref: wrapperRef }, gaAttributes),
505
+ React__default.createElement(StyledInput, { inputClassName: focused === 'location' ? 'focused' : undefined, name: "booking-search-placeholder", displayIcon: React__default.createElement(MagnifierIcon, { color: theme.colors.gray400 }), placeholder: t('booking.searchBar.searchInput.placeholder'), value: value, size: "md" })));
506
+ }
507
+
508
+ const StyledTopBar = styled.header `
509
+ display: flex;
510
+ height: 64px;
511
+ align-items: center;
512
+ justify-content: space-between;
513
+ margin: 0 auto;
514
+ position: sticky;
515
+ z-index: 99;
516
+ background-color: white;
517
+ top: 0;
518
+ left: 0;
519
+ `;
520
+ const StyledTopBarHeaderRight = styled.div `
521
+ display: inline-flex;
522
+ flex: 1;
523
+ justify-content: flex-end;
524
+ cursor: pointer;
525
+ text-decoration: underline;
526
+ `;
527
+ const StyledTopBarIcon = styled.div `
528
+ display: flex;
529
+ align-items: center;
530
+ margin-left: 16px;
531
+ cursor: pointer;
532
+ `;
533
+ const StyledTopbarHeading = styled.div `
534
+ width: 100%;
535
+ margin-left: 24px;
536
+ `;
537
+ const StyledTopbarHeadingText = styled(Text) `
538
+ color: ${theme.colors.secondaryDark};
539
+ text-align: start;
540
+ `;
541
+
542
+ const MobileTopBar = ({ className, onLeftClick, headingText, onRightClick, iconLeft, textRight, }) => {
543
+ return (React__default.createElement(StyledTopBar, { className: className },
544
+ React__default.createElement(StyledTopBarIcon, { onClick: onLeftClick }, iconLeft || React__default.createElement(CloseIcon, { color: theme.colors.gray800 })),
545
+ React__default.createElement(StyledTopbarHeading, null,
546
+ React__default.createElement(StyledTopbarHeadingText, { size: "md", weight: "bold" }, headingText)),
547
+ React__default.createElement(StyledTopBarHeaderRight, { onClick: onRightClick }, textRight && React__default.createElement("p", null, textRight))));
548
+ };
549
+
550
+ const SEARCH_KEYWORD_MIN_LENGTH = {
551
+ 'en-PH': 3,
552
+ 'tl-PH': 2,
553
+ 'id-ID': 3,
554
+ 'vi-VN': 2,
555
+ 'zh-TW': 0,
556
+ 'ms-MY': 2,
557
+ };
558
+
559
+ const initialState = {
560
+ isMobile: false,
561
+ isDebug: false,
562
+ navigateTo: null,
563
+ geoLocationPermission: 'unset',
564
+ geoLocationCoordinates: null,
565
+ focused: 'none',
566
+ searchLocationKeywords: '',
567
+ searchKeywords: '',
568
+ selectedLocation: null,
569
+ defaultCity: null,
570
+ initialCities: [],
571
+ cities: [],
572
+ searchResults: [],
573
+ initialSearchResults: [],
574
+ isLoadingCities: false,
575
+ isLoadingSearchResults: false,
576
+ isMobileModalOpened: false,
577
+ initialSelectedCity: null,
578
+ autoCompleteDisabled: false,
579
+ inputSearchPlaceholder: '',
580
+ locale: 'vi-VN',
581
+ };
582
+ var ActionTypes;
583
+ (function (ActionTypes) {
584
+ ActionTypes["NavigateTo"] = "navigate to url";
585
+ ActionTypes["ClickOutsideInputLocation"] = "click outside input location";
586
+ ActionTypes["ClickOutsideInputSearch"] = "click outside input search";
587
+ ActionTypes["SelectCurrentLocation"] = "select current location";
588
+ ActionTypes["FocusInputLocation"] = "focus input location";
589
+ ActionTypes["FocusInputSearch"] = "focus input search";
590
+ ActionTypes["ChangeInputLocation"] = "change input location";
591
+ ActionTypes["ChangeInputSearch"] = "change input search";
592
+ ActionTypes["ClearInputLocation"] = "clear input location";
593
+ ActionTypes["ClearInputSearch"] = "clear input search";
594
+ ActionTypes["SelectLocation"] = "select location";
595
+ ActionTypes["FetchCitiesStart"] = "fetch cities start";
596
+ ActionTypes["FetchCitiesFinish"] = "fetch cities finish";
597
+ ActionTypes["FetchSearchResultsStart"] = "fetch search results start";
598
+ ActionTypes["FetchSearchResultsComplete"] = "fetch search results complete";
599
+ ActionTypes["FetchSearchResultsFinish"] = "fetch search results finish";
600
+ ActionTypes["FetchCitiesByGeoIpComplete"] = "fetch cities by geo IP finish";
601
+ ActionTypes["FetchCitiesByKeywordComplete"] = "fetch cities by keyword finish";
602
+ ActionTypes["DisplayInitialCities"] = "display initial cities";
603
+ ActionTypes["DisplayInitialSearchResults"] = "display initial search results";
604
+ ActionTypes["GrantGeoLocationPermission"] = "grant geolocation permission";
605
+ ActionTypes["DenyGeoLocationPermission"] = "deny geolocation permission";
606
+ ActionTypes["OpenMobileModal"] = "open mobile modal";
607
+ ActionTypes["CloseMobileModal"] = "close mobile modal";
608
+ ActionTypes["UpdateInitialSearchValue"] = "update initial search value";
609
+ ActionTypes["SelectSearchResult"] = "select search result";
610
+ ActionTypes["SetInputSearchPlaceholder"] = "set input search placeholder";
611
+ })(ActionTypes || (ActionTypes = {}));
612
+ function resetSearchLocationKeywords(state) {
613
+ const { selectedLocation, searchLocationKeywords } = state;
614
+ if (selectedLocation && searchLocationKeywords !== selectedLocation.name) {
615
+ return Object.assign(Object.assign({}, state), { searchLocationKeywords: selectedLocation.name });
616
+ }
617
+ return state;
618
+ }
619
+ function reducer(state, action) {
620
+ var _a;
621
+ if (state.isDebug) {
622
+ console.log('bookingSearchBar', { action, state });
623
+ }
624
+ switch (action.type) {
625
+ case ActionTypes.NavigateTo:
626
+ return Object.assign(Object.assign({}, state), { navigateTo: action.payload, focused: 'none', isMobileModalOpened: false });
627
+ case ActionTypes.ClickOutsideInputLocation: {
628
+ if (state.isMobile || state.focused !== 'location') {
629
+ return state;
630
+ }
631
+ return resetSearchLocationKeywords(Object.assign(Object.assign({}, state), { focused: 'none' }));
632
+ }
633
+ case ActionTypes.ClickOutsideInputSearch: {
634
+ if (state.isMobile || state.focused !== 'search') {
635
+ return state;
636
+ }
637
+ return Object.assign(Object.assign({}, state), { focused: 'none' });
638
+ }
639
+ case ActionTypes.FocusInputLocation: {
640
+ const nextState = Object.assign(Object.assign({}, state), { focused: 'location' });
641
+ if (((_a = state.selectedLocation) === null || _a === void 0 ? void 0 : _a.id) === ID_OPTION_CURRENT_LOCATION) {
642
+ nextState.searchLocationKeywords = '';
643
+ }
644
+ return nextState;
645
+ }
646
+ case ActionTypes.FocusInputSearch:
647
+ const nextState = Object.assign(Object.assign({}, state), { focused: 'search' });
648
+ if (state.isMobile) {
649
+ return resetSearchLocationKeywords(nextState);
650
+ }
651
+ return nextState;
652
+ case ActionTypes.ChangeInputLocation:
653
+ return Object.assign(Object.assign({}, state), { searchLocationKeywords: action.payload });
654
+ case ActionTypes.ChangeInputSearch: {
655
+ const keyword = action.payload;
656
+ return Object.assign(Object.assign({}, state), { searchKeywords: keyword, isLoadingSearchResults: keyword.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale] });
657
+ }
658
+ case ActionTypes.SelectCurrentLocation:
659
+ return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
660
+ case ActionTypes.ClearInputLocation:
661
+ return Object.assign(Object.assign({}, state), { focused: 'location', cities: state.initialCities, searchLocationKeywords: '' });
662
+ case ActionTypes.ClearInputSearch:
663
+ return Object.assign(Object.assign({}, state), { focused: 'search', searchKeywords: '' });
664
+ case ActionTypes.SelectLocation:
665
+ return Object.assign(Object.assign({}, state), { focused: 'none', selectedLocation: action.payload, searchLocationKeywords: action.payload.name });
666
+ case ActionTypes.SelectSearchResult:
667
+ return Object.assign(Object.assign({}, state), { searchKeywords: action.payload.name, isMobileModalOpened: false, focused: 'none', navigateTo: action.payload.url });
668
+ case ActionTypes.FetchCitiesStart:
669
+ return Object.assign(Object.assign({}, state), { isLoadingCities: true });
670
+ case ActionTypes.FetchCitiesFinish:
671
+ return Object.assign(Object.assign({}, state), { isLoadingCities: false });
672
+ case ActionTypes.FetchSearchResultsStart:
673
+ return Object.assign(Object.assign({}, state), { isLoadingSearchResults: true });
674
+ case ActionTypes.FetchSearchResultsFinish:
675
+ return Object.assign(Object.assign({}, state), { isLoadingSearchResults: false });
676
+ case ActionTypes.FetchSearchResultsComplete: {
677
+ const nextState = Object.assign(Object.assign({}, state), { searchResults: action.payload });
678
+ if (state.initialSearchResults.length === 0) {
679
+ nextState.initialSearchResults = action.payload;
680
+ }
681
+ return nextState;
682
+ }
683
+ case ActionTypes.FetchCitiesByGeoIpComplete: {
684
+ let { cities } = action.payload;
685
+ const { default: defaultCity } = action.payload;
686
+ cities = cities.filter((c) => c.id !== defaultCity.id);
687
+ cities.unshift(defaultCity);
688
+ if (state.initialSelectedCity &&
689
+ !cities.find((c) => c.id === state.initialSelectedCity.id)) {
690
+ cities.unshift(state.initialSelectedCity);
691
+ }
692
+ const nextState = Object.assign(Object.assign({}, state), { defaultCity, initialCities: cities, cities });
693
+ if (state.geoLocationPermission === 'denied' &&
694
+ !state.initialSelectedCity) {
695
+ nextState.selectedLocation = defaultCity;
696
+ nextState.searchLocationKeywords = defaultCity.name;
697
+ }
698
+ return nextState;
699
+ }
700
+ case ActionTypes.FetchCitiesByKeywordComplete:
701
+ return Object.assign(Object.assign({}, state), { cities: action.payload });
702
+ case ActionTypes.DisplayInitialCities:
703
+ return Object.assign(Object.assign({}, state), { cities: state.initialCities });
704
+ case ActionTypes.DisplayInitialSearchResults:
705
+ return Object.assign(Object.assign({}, state), { searchResults: state.initialSearchResults, isLoadingSearchResults: false });
706
+ case ActionTypes.GrantGeoLocationPermission:
707
+ return Object.assign(Object.assign({}, state), { geoLocationPermission: 'granted', geoLocationCoordinates: action.payload });
708
+ case ActionTypes.DenyGeoLocationPermission:
709
+ return Object.assign(Object.assign({}, state), { geoLocationPermission: 'denied', geoLocationCoordinates: null });
710
+ case ActionTypes.OpenMobileModal:
711
+ return Object.assign(Object.assign({}, state), { isMobileModalOpened: true });
712
+ case ActionTypes.CloseMobileModal:
713
+ return Object.assign(Object.assign({}, state), { isMobileModalOpened: false });
714
+ case ActionTypes.UpdateInitialSearchValue:
715
+ return Object.assign(Object.assign({}, state), { searchKeywords: action.payload });
716
+ case ActionTypes.SetInputSearchPlaceholder:
717
+ return Object.assign(Object.assign({}, state), { inputSearchPlaceholder: action.payload });
718
+ default:
719
+ return state;
720
+ }
721
+ }
722
+
723
+ const StyledSearchBarInputsWrapper = styled.div `
724
+ display: flex;
725
+ gap: 16px;
726
+ ${MediaQueries.mbDown} {
727
+ flex-direction: column;
728
+ padding: 14px;
729
+ background-color: ${theme.colors.primary50};
730
+
731
+ input {
732
+ filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.04))
733
+ drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.06))
734
+ drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.04));
735
+ }
736
+ }
737
+
738
+ input {
739
+ background-color: white;
740
+ }
741
+ `;
742
+ const StyledInputWrapper = styled.div `
743
+ position: relative;
744
+ `;
745
+ const StyledInputLocationWrapper = styled(StyledInputWrapper) `
746
+ flex: 1;
747
+ `;
748
+ const StyledInputSearchWrapper = styled(StyledInputWrapper) `
749
+ flex: 2;
750
+ `;
751
+ const StyledClearIcon = styled(ClearIcon) `
752
+ display: none;
753
+ &.shown {
754
+ display: block;
755
+ }
756
+ `;
757
+
758
+ const SearchIcon = () => (React__default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18" },
759
+ React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.97887 8.15493C2.97887 5.29627 5.29627 2.97887 8.15493 2.97887C11.0136 2.97887 13.331 5.29627 13.331 8.15493C13.331 11.0136 11.0136 13.331 8.15493 13.331C5.29627 13.331 2.97887 11.0136 2.97887 8.15493ZM8.15493 1.5C4.47951 1.5 1.5 4.47951 1.5 8.15493C1.5 11.8303 4.47951 14.8099 8.15493 14.8099C9.72624 14.8099 11.1704 14.2653 12.3089 13.3546L15.2377 16.2834C15.5265 16.5722 15.9947 16.5722 16.2834 16.2834C16.5722 15.9947 16.5722 15.5265 16.2834 15.2377L13.3546 12.3089C14.2653 11.1704 14.8099 9.72624 14.8099 8.15493C14.8099 4.47951 11.8303 1.5 8.15493 1.5Z", fill: "white" })));
760
+ const StyledSearchIcon = styled.button `
761
+ min-height: 100%;
762
+ border-radius: 6px;
763
+ background-color: ${theme.colors.primaryBase};
764
+ display: flex;
765
+ justify-content: center;
766
+ align-items: center;
767
+ gap: 11px;
768
+ cursor: pointer;
769
+ flex: 0.3;
770
+
771
+ ${MediaQueries.mbDown} {
772
+ --margin: 16px;
773
+ min-height: 44px;
774
+ margin: var(--margin);
775
+ width: calc(100% - var(--margin) * 2);
776
+ position: absolute;
777
+ bottom: 0;
778
+ }
779
+
780
+ &:hover {
781
+ background-color: ${theme.colors.primaryHover};
782
+ }
783
+
784
+ &:active {
785
+ background-color: ${theme.colors.primaryActive};
786
+ }
787
+
788
+ &:focus-visible {
789
+ outline: 1px solid black;
790
+ }
791
+ `;
792
+ const StyledText$1 = styled(Text) `
793
+ font-weight: ${theme.sizes.fwSemiBold};
794
+ `;
795
+ const SearchButton = ({ onClick }) => {
796
+ const { t } = useTranslations();
797
+ const title = t('booking.searchBar.searchButton');
798
+ return (React__default.createElement(StyledSearchIcon, { onClick: onClick, title: title },
799
+ React__default.createElement(SearchIcon, null),
800
+ React__default.createElement(StyledText$1, { size: "s3", color: "white" }, title)));
801
+ };
802
+
803
+ function SearchInputs({ isMobile, state, dispatch, debouncedFetchCitiesByKeyword, debouncedFetchSearchResults, focusLocationInput, focusSearchInput, renderLocationResults, renderSearchResults, locationTrackingAttributes, trackingAttributes, onSearch, initalSearchValue, }) {
804
+ const inputLocationWrapperRef = useRef(null);
805
+ const inputSearchWrapperRef = useRef(null);
806
+ const { focused, searchLocationKeywords, geoLocationPermission, selectedLocation, searchKeywords, inputSearchPlaceholder, } = state;
807
+ const { t } = useTranslations();
808
+ useAnimatedPlaceholder({
809
+ wrapperRef: inputSearchWrapperRef,
810
+ disabled: !!inputSearchPlaceholder,
811
+ });
812
+ useOutsideClick(inputLocationWrapperRef, () => {
813
+ if (!isMobile) {
814
+ dispatch({ type: ActionTypes.ClickOutsideInputLocation });
815
+ }
816
+ });
817
+ useOutsideClick(inputSearchWrapperRef, () => {
818
+ if (!isMobile) {
819
+ dispatch({ type: ActionTypes.ClickOutsideInputSearch });
820
+ }
821
+ });
822
+ function handleLocationInputClear() {
823
+ dispatch({ type: ActionTypes.ClearInputLocation });
824
+ debouncedFetchCitiesByKeyword.cancel();
825
+ focusLocationInput();
826
+ }
827
+ function handleSearchInputClear() {
828
+ dispatch({ type: ActionTypes.ClearInputSearch });
829
+ debouncedFetchSearchResults.cancel();
830
+ debouncedFetchSearchResults('', state);
831
+ focusSearchInput();
832
+ }
833
+ const searchInputPinIconColor = useMemo(() => {
834
+ if (geoLocationPermission === 'granted' &&
835
+ (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === ID_OPTION_CURRENT_LOCATION) {
836
+ return theme.colors.primaryBase;
837
+ }
838
+ else {
839
+ return theme.colors.gray400;
840
+ }
841
+ }, [geoLocationPermission, selectedLocation]);
842
+ const handleSearchInputChange = useCallback(function handleSearchInputChange(value) {
843
+ dispatch({ type: ActionTypes.ChangeInputSearch, payload: value });
844
+ if (typeof onSearch === 'function') {
845
+ return;
846
+ }
847
+ if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale] ||
848
+ initalSearchValue) {
849
+ debouncedFetchSearchResults(value.trim(), state);
850
+ }
851
+ else {
852
+ debouncedFetchSearchResults.cancel();
853
+ dispatch({ type: ActionTypes.DisplayInitialSearchResults });
854
+ }
855
+ }, [dispatch, state]);
856
+ const handleSearchLocationInputChange = useCallback(function handleSearchLocationInputChange(value) {
857
+ dispatch({ type: ActionTypes.ChangeInputLocation, payload: value });
858
+ if (value.trim().length > SEARCH_KEYWORD_MIN_LENGTH[state.locale]) {
859
+ debouncedFetchCitiesByKeyword(value.trim());
860
+ }
861
+ else {
862
+ debouncedFetchCitiesByKeyword.cancel();
863
+ dispatch({ type: ActionTypes.DisplayInitialCities });
864
+ }
865
+ }, [debouncedFetchCitiesByKeyword, dispatch]);
866
+ const handleKeyPress = (e) => {
867
+ if (state.autoCompleteDisabled && e.key === 'Enter' && onSearch) {
868
+ onSearch({
869
+ cityId: state.selectedLocation.id,
870
+ keyword: searchKeywords,
871
+ });
872
+ }
873
+ };
874
+ return (React__default.createElement(StyledSearchBarInputsWrapper, null,
875
+ React__default.createElement(StyledInputLocationWrapper, { ref: inputLocationWrapperRef },
876
+ React__default.createElement(StyledInput, { inputClassName: focused === 'location' ? 'focused' : undefined, placeholder: t('booking.searchBar.locationPlaceholder'), autoComplete: "off", name: "search-location", displayIcon: React__default.createElement(PinIcon, { className: "location-pin-icon", color: searchInputPinIconColor }), actionIcon: React__default.createElement(StyledClearIcon, { color: theme.colors.gray300, className: searchLocationKeywords !== '' ? 'shown' : '' }), onActionClick: handleLocationInputClear, value: searchLocationKeywords, onChange: handleSearchLocationInputChange, onFocus: () => dispatch({ type: ActionTypes.FocusInputLocation }), size: "md", trackingAttributes: locationTrackingAttributes }),
877
+ !isMobile && renderLocationResults()),
878
+ React__default.createElement(StyledInputSearchWrapper, { ref: inputSearchWrapperRef },
879
+ React__default.createElement(StyledInput, { placeholder: inputSearchPlaceholder ||
880
+ t('booking.searchBar.searchInput.placeholder'), autoComplete: "off", name: "search-results", actionIcon: React__default.createElement(StyledClearIcon, { color: theme.colors.gray300, className: searchKeywords !== '' ? 'shown' : '' }), onActionClick: handleSearchInputClear, value: searchKeywords, onChange: handleSearchInputChange, onFocus: () => dispatch({ type: ActionTypes.FocusInputSearch }), inputClassName: focused === 'search' ? 'focused' : undefined, size: "md", trackingAttributes: trackingAttributes, onKeyPress: handleKeyPress, enterKeyHint: state.autoCompleteDisabled ? 'search' : undefined }),
881
+ !isMobile && renderSearchResults()),
882
+ state.autoCompleteDisabled && !state.isMobile && (React__default.createElement(SearchButton, { onClick: () => {
883
+ onSearch({
884
+ cityId: state.selectedLocation.id,
885
+ keyword: searchKeywords,
886
+ });
887
+ } }))));
888
+ }
889
+
890
+ const DoctorIcon = () => (React__default.createElement("svg", { width: "14", height: "18", viewBox: "0 0 14 18" },
891
+ React__default.createElement("path", { d: "M7 .667c-1.702 0-3.36.146-4.48.365a1.67 1.67 0 0 0-1.353 1.64v2.162c0 .459.374.833.833.833h10a.835.835 0 0 0 .833-.833V2.698c0-.804-.566-1.487-1.354-1.64C10.356.84 8.693.667 7 .667m-.833.833h1.666v.834h.834V4h-.834v.834H6.167V4h-.834V2.334h.834zm-4.74 5a8 8 0 0 0-.234 1.276c-.046.404-.137 1.478-.13 1.589a1.94 1.94 0 0 0-.73 1.536c0 .935.645 1.735 1.51 1.928.902 2.19 2.71 4.505 5.157 4.505s4.255-2.338 5.156-4.532a1.935 1.935 0 0 0 1.51-1.9 1.94 1.94 0 0 0-.729-1.537c.007-.11-.08-1.205-.13-1.615a8.4 8.4 0 0 0-.234-1.25H5.359c1.169 1.706 3.916.687 5.678 1.12.537 1.172.13 2.813.13 2.813l.65.208c.095.03.183.114.183.26 0 .157-.114.293-.312.287l-.678-.104-.234.65C9.966 14.05 8.413 15.668 7 15.668s-2.965-1.618-3.776-3.932l-.26-.651-.704.104c-.143 0-.26-.13-.26-.287a.26.26 0 0 1 .182-.26l.651-.208c-.1.12-.423-1.729 0-2.396.759-.524 1.394-.16 2.292-1.537zm3.75 2.552c-.605 0-1.094.502-1.094 1.12s.489 1.12 1.094 1.12 1.094-.501 1.094-1.12c0-.618-.488-1.12-1.094-1.12m3.646 0c-.606 0-1.094.502-1.094 1.12s.488 1.12 1.094 1.12c.605 0 1.094-.501 1.094-1.12 0-.618-.489-1.12-1.094-1.12", fill: "#9AA2AC" })));
892
+ const ServiceIcon = () => (React__default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18" },
893
+ React__default.createElement("path", { d: "M9 .667A8.33 8.33 0 0 0 2.333 4H4.6A6.7 6.7 0 0 1 9 2.334c1.637 0 3.2.612 4.401 1.666h2.266A8.33 8.33 0 0 0 9 .667M1.786 4.834c-.71 2.207-1.12 4.765-1.12 7.5 0 1.751.16 3.434.47 5h15.729c.309-1.566.468-3.249.468-5 0-2.735-.41-5.293-1.12-7.5zM9 7.334a4.166 4.166 0 1 1 0 8.332 4.166 4.166 0 0 1 0-8.332M8.167 9v1.667H6.5v1.667h1.667V14h1.666v-1.666H11.5v-1.667H9.833V9z", fill: "#9AA2AC" })));
894
+ const HospitalIcon = () => (React__default.createElement("svg", { width: "16", height: "17", viewBox: "0 0 16 17" },
895
+ React__default.createElement("path", { d: "M8 .667.5 5.635v9.199c0 .92.746 1.666 1.667 1.666h11.666c.921 0 1.667-.745 1.667-1.666V5.635zm3.333 10h-2.5v2.5H7.167v-2.5h-2.5V9h2.5V6.5h1.666V9h2.5z", fill: "#9AA2AC" })));
896
+ const SpecialtyIcon = () => (React__default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16" },
897
+ React__default.createElement("path", { d: "M3.833.5a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667M10.5.5c-.92 0-1.667.746-1.667 1.667V5.5c0 .92.746 1.667 1.667 1.667h3.333c.921 0 1.667-.746 1.667-1.667V2.167C15.5 1.246 14.754.5 13.833.5zM3.833 8.833a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667m8.334 0a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667", fill: "#9AA2AC" })));
898
+
899
+ const StyledTypeHeader = styled.header `
900
+ display: flex;
901
+ justify-content: space-between;
902
+ padding: 12px 24px;
903
+ background-color: ${theme.colors.neutral50};
904
+ box-shadow: inset 0px 1px 0px #e4e8ec;
905
+ `;
906
+ const StyledInfoWrapper = styled.div `
907
+ display: grid;
908
+ flex: 2;
909
+ align-items: center;
910
+ gap: 16px;
911
+ grid-template-columns: 16px 1fr;
912
+ `;
913
+ const StyledTypeName = styled.p `
914
+ color: ${theme.colors.neutral800};
915
+ font-size: 14px;
916
+ font-weight: ${theme.sizes.fwSemiBold};
917
+ letter-spacing: -0.2px;
918
+ line-height: 22px;
919
+ `;
920
+ const StyledSeeMoreButton = styled.button `
921
+ flex: 1;
922
+ cursor: pointer;
923
+ text-align: end;
924
+ `;
925
+ const StyledResultsContainer = styled.section `
926
+ padding: 12px 16px;
927
+ --rowGap: 16px;
928
+ --graphicSize: 32px;
929
+
930
+ ${MediaQueries.tdUp} {
931
+ --rowGap: 8px;
932
+ }
933
+ `;
934
+ const StyledItemsWrapper = styled.ul `
935
+ --gap: 16px;
936
+ ${MediaQueries.tdUp} {
937
+ --gap: 8px;
938
+ }
939
+
940
+ display: grid;
941
+ overflow: hidden;
942
+ gap: var(--gap);
943
+ transition: max-height 0.8s ease-out;
944
+
945
+ ${({ isMore }) => isMore &&
946
+ `
947
+ height: auto;
948
+ max-height: 0;
949
+ margin-top: var(--gap);
950
+ `}
951
+
952
+ ${({ isShown }) => isShown &&
953
+ `
954
+ max-height: 600px;
955
+ `}
956
+
957
+ @media (prefers-reduced-motion) {
958
+ transition: none;
959
+ }
960
+
961
+ ${MediaQueries.tdUp} {
962
+ grid-template-columns: 1fr 1fr;
963
+ }
964
+ `;
965
+ const StyledSeeMore = styled(Text) `
966
+ margin-top: 12px;
967
+ margin-bottom: 8px;
968
+ cursor: pointer;
969
+ text-align: start;
970
+ text-transform: capitalize;
971
+ `;
972
+
973
+ const StyledResult = styled.li `
974
+ display: flex;
975
+ align-items: center;
976
+ gap: var(--rowGap);
977
+ cursor: pointer;
978
+ &.not-nav {
979
+ cursor: default;
980
+ }
981
+ `;
982
+ const StyledRoundedIconWrapper = styled.div `
983
+ --wrapper-size: var(--graphicSize);
984
+ border-radius: calc(var(--wrapper-size) / 2);
985
+ background-color: var(--neutral50);
986
+ width: var(--wrapper-size);
987
+ height: var(--wrapper-size);
988
+ aspect-ratio: 1/1;
989
+ overflow: hidden;
990
+
991
+ ${({ type }) => type &&
992
+ type === 'doctors' &&
993
+ `
994
+ border-radius: calc(var(--graphicSize) / 2);
995
+ `}
996
+
997
+ img {
998
+ width: var(--graphicSize);
999
+ height: var(--graphicSize);
1000
+ ${({ type }) => type && type === 'doctors'
1001
+ ? `
1002
+
1003
+ object-fit: cover;
1004
+ `
1005
+ : `
1006
+ object-fit: contain;
1007
+ `}
1008
+ }
1009
+
1010
+ &:focus-visible {
1011
+ outline: 1px solid ${theme.colors.gray600};
1012
+ }
1013
+ `;
1014
+ const StyledText = styled(Text) `
1015
+ line-height: 22px;
1016
+ letter-spacing: -0.2px;
1017
+
1018
+ ${MediaQueries.tdUp} {
1019
+ &[data-size='p3'] {
1020
+ font-size: 14px;
1021
+ }
1022
+ }
1023
+ `;
1024
+ const StyledPictureWrapper = styled.figure `
1025
+ max-width: var(--graphicSize);
1026
+ min-width: var(--graphicSize);
1027
+ `;
1028
+ const StyledLocationPin = styled.svg `
1029
+ margin: 0 auto;
1030
+ display: block;
1031
+ `;
1032
+ const StyledImageSkeletonWrapper = styled.div `
1033
+ display: grid;
1034
+ place-items: center;
1035
+ `;
1036
+
1037
+ const defaultThumbnailByType = {
1038
+ doctors: DefaultThumbnailDoctor,
1039
+ services: DefaultThumbnailService,
1040
+ };
1041
+ const ResultSectionItem = ({ type, item, imageUrl, className, onClickItem, }) => {
1042
+ const onKeyDown = (e) => {
1043
+ if (e.key === 'Enter' || e.key === 'Space') {
1044
+ if (onClickItem) {
1045
+ onClickItem(item);
1046
+ }
1047
+ }
1048
+ };
1049
+ const defaultThumbnail = useMemo(() => {
1050
+ const Cmp = defaultThumbnailByType[type] || DefaultThumbnailAny;
1051
+ return React__default.createElement(Cmp, { width: 32, height: type === 'services' ? 32 : 24 });
1052
+ }, [type]);
1053
+ return (React__default.createElement(StyledResult, { onClick: () => onClickItem && onClickItem(item), onKeyDown: onKeyDown, tabIndex: 0, role: "button", className: className },
1054
+ React__default.createElement(StyledPictureWrapper, null, type === 'hospitals' ? (React__default.createElement(StyledLocationPin, { width: "12", height: "16", viewBox: "0 0 12 16" },
1055
+ React__default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.75 5.94873C0.75 3.04623 3.0975 0.69873 6 0.69873C8.9025 0.69873 11.25 3.04623 11.25 5.94873C11.25 9.07623 7.935 13.3887 6.5775 15.0312C6.2775 15.3912 5.73 15.3912 5.43 15.0312C4.065 13.3887 0.75 9.07623 0.75 5.94873ZM4.125 5.94873C4.125 6.98373 4.965 7.82373 6 7.82373C7.035 7.82373 7.875 6.98373 7.875 5.94873C7.875 4.91373 7.035 4.07373 6 4.07373C4.965 4.07373 4.125 4.91373 4.125 5.94873Z", fill: "#9AA2AC" }))) : (React__default.createElement(StyledRoundedIconWrapper, { type: type }, imageUrl ? (React__default.createElement("img", { src: imageUrl, width: 32, height: type === 'services' ? 32 : 24, loading: "lazy" })) : (defaultThumbnail)))),
1056
+ React__default.createElement(StyledText, { color: theme.colors.gray800, size: "p3" }, item.name)));
1057
+ };
1058
+
1059
+ const ResultSection = ({ type, data, state, dispatch, itemsToShow, itemsToShowDesktop, isMobile, isLoading, keyword, isNavResultItem, }) => {
1060
+ const [seeMoreOpen, setSeeMoreOpen] = useState(false);
1061
+ const { t, locale } = useTranslations();
1062
+ const { selectedLocation, searchKeywords } = state;
1063
+ const slugs = useMemo(() => LOCALIZED_SLUGS[locale], [locale]);
1064
+ const isMalay = locale === 'ms-MY';
1065
+ const typeInformation = useMemo(() => {
1066
+ return {
1067
+ doctors: {
1068
+ name: t('booking.searchPopup.doctors'),
1069
+ icon: React__default.createElement(DoctorIcon, null),
1070
+ slug: slugs.DOCTOR,
1071
+ },
1072
+ services: {
1073
+ name: t('booking.searchPopup.services'),
1074
+ icon: React__default.createElement(ServiceIcon, null),
1075
+ slug: slugs.SERVICE,
1076
+ },
1077
+ hospitals: {
1078
+ name: t('booking.searchPopup.hospitals'),
1079
+ icon: React__default.createElement(HospitalIcon, null),
1080
+ slug: slugs.HOSPITAL,
1081
+ },
1082
+ specialties: {
1083
+ name: t('booking.searchPopup.specialties'),
1084
+ icon: React__default.createElement(SpecialtyIcon, null),
1085
+ slug: slugs.SPECIALTIES,
1086
+ },
1087
+ };
1088
+ }, [type, slugs]);
1089
+ const typeSlug = useMemo(() => typeInformation[type].slug, [typeInformation]);
1090
+ const showItemCount = isMobile ? itemsToShow : itemsToShowDesktop;
1091
+ function onClickItem(item) {
1092
+ let url = '';
1093
+ switch (type) {
1094
+ case 'specialties':
1095
+ url = `/${selectedLocation.slug}/${typeInformation.doctors.slug}/${item.slug}`;
1096
+ break;
1097
+ case 'services':
1098
+ url = `/${selectedLocation.slug}/${typeSlug}/${item.slug}`;
1099
+ break;
1100
+ case 'doctors':
1101
+ case 'hospitals':
1102
+ url = `/${typeSlug}/${item.slug}-${item.id}`;
1103
+ break;
1104
+ }
1105
+ if (url) {
1106
+ dispatch({
1107
+ type: ActionTypes.SelectSearchResult,
1108
+ payload: { name: item.name, url },
1109
+ });
1110
+ }
1111
+ }
1112
+ function renderItem(item) {
1113
+ return (React__default.createElement(ResultSectionItem, { key: item.id, item: item, type: type, imageUrl: item.logo || item.avatar || item.thumbnail, className: !isNavResultItem ? 'not-nav' : '', onClickItem: isNavResultItem && onClickItem }));
1114
+ }
1115
+ function onSeeAllClick() {
1116
+ let url = '';
1117
+ switch (type) {
1118
+ case 'specialties':
1119
+ url = `/${typeSlug}`;
1120
+ break;
1121
+ case 'services':
1122
+ case 'doctors':
1123
+ case 'hospitals':
1124
+ url = `/${selectedLocation.slug}/${typeSlug}`;
1125
+ break;
1126
+ }
1127
+ if (url) {
1128
+ dispatch({ type: ActionTypes.NavigateTo, payload: url });
1129
+ }
1130
+ }
1131
+ function onClickSearchByKeyword() {
1132
+ const { slug: typeSlug } = typeInformation[type];
1133
+ const url = `/${selectedLocation.slug}/${typeSlug}?q=${searchKeywords}`;
1134
+ dispatch({ type: ActionTypes.NavigateTo, payload: url });
1135
+ }
1136
+ return (React__default.createElement("section", null,
1137
+ React__default.createElement(StyledTypeHeader, null,
1138
+ React__default.createElement(StyledInfoWrapper, null,
1139
+ typeInformation[type].icon,
1140
+ React__default.createElement(StyledTypeName, null, typeInformation[type].name)),
1141
+ (keyword.trim().length <= SEARCH_KEYWORD_MIN_LENGTH[locale] ||
1142
+ isMalay) && (React__default.createElement(StyledSeeMoreButton, { onClick: onSeeAllClick },
1143
+ React__default.createElement(Text, { size: "p3", color: theme.colors.primaryBase }, t('booking.searchPopup.seeAll'))))),
1144
+ (isLoading || (data && data.length > 0)) && (React__default.createElement(StyledResultsContainer, null,
1145
+ React__default.createElement(StyledItemsWrapper, null,
1146
+ isLoading &&
1147
+ Array(2)
1148
+ .fill(undefined)
1149
+ .map((_, i) => (React__default.createElement(StyledResult, { key: type + 'loading' + i },
1150
+ React__default.createElement(StyledPictureWrapper, null,
1151
+ React__default.createElement(StyledImageSkeletonWrapper, null,
1152
+ React__default.createElement(Skeleton, { height: 14, width: type === 'hospitals' ? 12 : 32, style: {
1153
+ maxWidth: 'var(--graphicSize)',
1154
+ minHeight: 'var(--graphicSize)',
1155
+ } }))),
1156
+ React__default.createElement(Skeleton, { width: 120, height: 24 })))),
1157
+ !isLoading &&
1158
+ data &&
1159
+ data.length > 0 &&
1160
+ data.slice(0, showItemCount).map(renderItem)),
1161
+ React__default.createElement(StyledItemsWrapper, { isShown: seeMoreOpen, isMore: true }, data.slice(showItemCount, -1).map(renderItem)),
1162
+ type === 'specialties' &&
1163
+ showItemCount < data.length &&
1164
+ !isLoading && (React__default.createElement("button", { onClick: () => setSeeMoreOpen(!seeMoreOpen) },
1165
+ React__default.createElement(StyledSeeMore, { size: "p3", color: theme.colors.primaryBase }, seeMoreOpen
1166
+ ? t('booking.searchPopup.seeLessSpecialties')
1167
+ : t('booking.searchPopup.seeMoreSpecialties')))),
1168
+ type !== 'specialties' &&
1169
+ (showItemCount < data.length || isMalay) &&
1170
+ !isLoading &&
1171
+ keyword.trim().length > SEARCH_KEYWORD_MIN_LENGTH[locale] && (React__default.createElement("button", { onClick: onClickSearchByKeyword },
1172
+ React__default.createElement(StyledSeeMore, { size: "p3", color: theme.colors.primaryBase }, t(`booking.searchPopup.searchIn.${type}`, {
1173
+ name: keyword,
1174
+ })))))),
1175
+ !isLoading && (data === null || data === void 0 ? void 0 : data.length) === 0 && (React__default.createElement(StyledResultsContainer, null,
1176
+ React__default.createElement(Text, { size: "sm", color: theme.colors.gray400 }, t('booking.searchBar.noResults'))))));
1177
+ };
1178
+
1179
+ const StyledSection = styled.section `
1180
+ background-color: white;
1181
+ border-radius: 4px;
1182
+ position: absolute;
1183
+ width: 100%;
1184
+ z-index: 30;
1185
+
1186
+ ${MediaQueries.tdUp} {
1187
+ box-shadow: 0px 24px 32px rgba(0, 0, 0, 0.04),
1188
+ 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04),
1189
+ 0px 0px 1px rgba(0, 0, 0, 0.04);
1190
+ }
1191
+ `;
1192
+ const SearchResults = ({ data, state, dispatch, isMobile, isLoading, keyword, hideResults, isNavResultItem, }) => {
1193
+ return (React__default.createElement(StyledSection, null, data &&
1194
+ data.map((data) => {
1195
+ if (hideResults && hideResults.includes(data.type)) {
1196
+ return React__default.createElement(React__default.Fragment, null);
1197
+ }
1198
+ return (React__default.createElement(ResultSection, { type: data.type, state: state, dispatch: dispatch, itemsToShow: 2, itemsToShowDesktop: 4, key: data.type, data: data.results, isMobile: isMobile, isLoading: isLoading, keyword: keyword, isNavResultItem: isNavResultItem }));
1199
+ })));
1200
+ };
1201
+
1202
+ function useSearchBarApi({ dispatch, careApiDomain, locale = 'vi-VN', }) {
1203
+ const fetchCitiesApi = useCallback(function fetchCitiesApi(path, params = {}) {
1204
+ const url = `${careApiDomain}${path}`;
1205
+ dispatch({ type: ActionTypes.FetchCitiesStart });
1206
+ return fetch(getApiPath(url, params, locale), { method: 'GET' })
1207
+ .then((res) => res.json())
1208
+ .then((data) => {
1209
+ if (data._status !== 1 || !data._data) {
1210
+ console.log('error loading cities', data);
1211
+ return Promise.reject(data);
1212
+ }
1213
+ return data === null || data === void 0 ? void 0 : data._data;
1214
+ })
1215
+ .finally(() => dispatch({ type: ActionTypes.FetchCitiesFinish }));
1216
+ }, [locale]);
1217
+ const fetchCitiesByLocation = useCallback(function fetchCitiesByLocation({ coordinates }) {
1218
+ let params = {};
1219
+ const moreParams = {};
1220
+ if (coordinates) {
1221
+ params = {
1222
+ lat: coordinates.lat,
1223
+ lng: coordinates.lng,
1224
+ };
1225
+ }
1226
+ if (locale === 'ms-MY') {
1227
+ moreParams.noPaging = 1;
1228
+ }
1229
+ const requests = [
1230
+ fetchCitiesApi(PATHS.GET_CITY_BY_IP, Object.assign(Object.assign({}, params), moreParams)),
1231
+ ];
1232
+ if (locale === 'zh-TW') {
1233
+ requests.push(fetchCitiesApi(PATHS.GET_CITIES_LIST, { noPaging: 1 }));
1234
+ }
1235
+ return Promise.all(requests)
1236
+ .then(([data1, data2]) => {
1237
+ const data = Object.assign({}, data1);
1238
+ if (data2) {
1239
+ const citiesIds = data.cities.map((c) => c.id);
1240
+ data.cities = data.cities.concat(data2.cities.filter((c) => !citiesIds.includes(c.id)));
1241
+ }
1242
+ dispatch({
1243
+ type: ActionTypes.FetchCitiesByGeoIpComplete,
1244
+ payload: data,
1245
+ });
1246
+ })
1247
+ .catch((err) => console.error('error loading cities by location', err));
1248
+ }, [locale, careApiDomain, dispatch]);
1249
+ const fetchCitiesByKeyword = useCallback(function fetchCitiesByKeyword(keyword) {
1250
+ return fetchCitiesApi(PATHS.GET_CITIES_LIST, { keyword })
1251
+ .then((data) => {
1252
+ dispatch({
1253
+ type: ActionTypes.FetchCitiesByKeywordComplete,
1254
+ payload: data.cities,
1255
+ });
1256
+ })
1257
+ .catch((err) => console.error('error loading cities by keyword', err));
1258
+ }, [locale, careApiDomain, dispatch]);
1259
+ const fetchSearchResults = useCallback(function fetchSearchResults(searchKeywords, state) {
1260
+ const url = `${careApiDomain}${PATHS.GET_SEARCH_V2}`;
1261
+ dispatch({ type: ActionTypes.FetchSearchResultsStart });
1262
+ const { defaultCity, selectedLocation, geoLocationCoordinates } = state;
1263
+ let cityId = '';
1264
+ if (!selectedLocation || !defaultCity) {
1265
+ dispatch({ type: ActionTypes.FetchSearchResultsFinish });
1266
+ return;
1267
+ }
1268
+ const isCurrentLocationSelected = selectedLocation.id === ID_OPTION_CURRENT_LOCATION;
1269
+ if (isCurrentLocationSelected) {
1270
+ if (!geoLocationCoordinates) {
1271
+ cityId = defaultCity.id;
1272
+ }
1273
+ }
1274
+ else if (selectedLocation.id === ID_OPTION_ALL_LOCATION) {
1275
+ cityId = '';
1276
+ }
1277
+ else {
1278
+ cityId = selectedLocation.id;
1279
+ }
1280
+ const lat = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lat) || '';
1281
+ const lng = (geoLocationCoordinates === null || geoLocationCoordinates === void 0 ? void 0 : geoLocationCoordinates.lng) || '';
1282
+ return fetch(getApiPath(url, {
1283
+ domain: careApiDomain,
1284
+ searchType: 'global',
1285
+ keyword: searchKeywords.trim().length > SEARCH_KEYWORD_MIN_LENGTH[locale]
1286
+ ? searchKeywords.trim()
1287
+ : '',
1288
+ city: cityId === ID_OPTION_CURRENT_LOCATION ? '' : cityId,
1289
+ lat,
1290
+ lng,
1291
+ }, locale), {
1292
+ method: 'GET',
1293
+ headers: {
1294
+ accept: 'version=2.0.0.0',
1295
+ },
1296
+ })
1297
+ .then((res) => res.json())
1298
+ .then((data) => {
1299
+ if (data._status !== 1 || !data._data) {
1300
+ return Promise.reject(data);
1301
+ }
1302
+ return data === null || data === void 0 ? void 0 : data._data;
1303
+ })
1304
+ .then((results) => dispatch({
1305
+ type: ActionTypes.FetchSearchResultsComplete,
1306
+ payload: results,
1307
+ }))
1308
+ .catch((error) => {
1309
+ console.log('error loading search results', { url, error });
1310
+ })
1311
+ .finally(() => dispatch({ type: ActionTypes.FetchSearchResultsFinish }));
1312
+ }, [locale, careApiDomain, dispatch]);
1313
+ return {
1314
+ fetchCitiesByLocation,
1315
+ fetchCitiesByKeyword,
1316
+ fetchSearchResults,
1317
+ };
1318
+ }
1319
+
1320
+ const BookingSearchBar = ({ isMobile, careApiDomain, geoLocationPermission: geoLocationPermissionFromProps, geoLocationCoordinates: geoLocationCoordinatesFromProps, initialSelectedCity: initialSelectedCityFromProps, initialSearchValue = '', careFrontDomain = '/care', isDebug = false, askForGeolocationPermission = false, gaTrackingSearchBar, gaTrackingLocationSearch, autoCompleteDisabled = false, inputSearchPlaceholder = '', isOptionAllLocation = false, hideResults = [], isNavResultItem = true, routerPush, onGeoLocationPermissionChange, onSearch, onChangeLocation, }) => {
1321
+ const { t, locale } = useTranslations();
1322
+ const wrapperRef = useRef(null);
1323
+ const hiddenInputRef = useRef(null);
1324
+ const [viewportHeight, setViewportHeight] = useState(undefined);
1325
+ const [isNavResultPage, setIsNavResultPage] = useState(false);
1326
+ const { geoLocationPermission: geoLocationPermissionFromHook, geoLocationCoordinates: geoLocationCoordinatesFromHook, requestGeoLocation, } = useGeolocation();
1327
+ const [state, dispatch] = useReducer(reducer, initialState, (s) => (Object.assign(Object.assign({}, s), { isDebug,
1328
+ isMobile, geoLocationPermission: geoLocationPermissionFromProps ||
1329
+ geoLocationPermissionFromHook ||
1330
+ 'unset', geoLocationCoordinates: geoLocationCoordinatesFromProps ||
1331
+ geoLocationCoordinatesFromHook ||
1332
+ null, searchKeywords: initialSearchValue, initialSelectedCity: initialSelectedCityFromProps || null, selectedLocation: initialSelectedCityFromProps || s.selectedLocation || null, searchLocationKeywords: (initialSelectedCityFromProps === null || initialSelectedCityFromProps === void 0 ? void 0 : initialSelectedCityFromProps.name) || s.searchLocationKeywords, autoCompleteDisabled,
1333
+ inputSearchPlaceholder,
1334
+ locale })));
1335
+ const { navigateTo, focused, isLoadingCities, cities, searchKeywords, geoLocationPermission, selectedLocation, initialSelectedCity, defaultCity, searchResults, isLoadingSearchResults, isMobileModalOpened, inputSearchPlaceholder: inputSearchPlaceholderState, } = state;
1336
+ const { fetchCitiesByLocation, fetchCitiesByKeyword, fetchSearchResults } = useSearchBarApi({
1337
+ dispatch,
1338
+ locale,
1339
+ careApiDomain,
1340
+ });
1341
+ const currentLocationCityItem = useMemo(() => {
1342
+ var _a;
1343
+ return ({
1344
+ id: ID_OPTION_CURRENT_LOCATION,
1345
+ name: t('booking.searchBar.currentLocation'),
1346
+ slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.CURRENT,
1347
+ });
1348
+ }, [t, locale]);
1349
+ const debouncedFetchCitiesByKeyword = useMemo(() => debounce(fetchCitiesByKeyword, 400), [fetchCitiesByKeyword]);
1350
+ const debouncedFetchSearchResults = useMemo(() => debounce(fetchSearchResults, 400), [fetchSearchResults]);
1351
+ useEffect(() => {
1352
+ if (initialSearchValue !== '' &&
1353
+ initialSearchValue !== state.searchKeywords) {
1354
+ dispatch({
1355
+ type: ActionTypes.UpdateInitialSearchValue,
1356
+ payload: initialSearchValue,
1357
+ });
1358
+ }
1359
+ }, [initialSearchValue]);
1360
+ useEffect(() => {
1361
+ if (askForGeolocationPermission &&
1362
+ (selectedLocation === null || selectedLocation === void 0 ? void 0 : selectedLocation.id) === ID_OPTION_CURRENT_LOCATION &&
1363
+ geoLocationPermission === 'unset') {
1364
+ requestGeoLocation();
1365
+ }
1366
+ }, [askForGeolocationPermission, selectedLocation, geoLocationPermission]);
1367
+ useEffect(() => {
1368
+ if (!geoLocationPermissionFromProps &&
1369
+ geoLocationPermission !== geoLocationPermissionFromHook) {
1370
+ if (geoLocationPermissionFromHook === 'granted' &&
1371
+ geoLocationCoordinatesFromHook) {
1372
+ dispatch({
1373
+ type: ActionTypes.GrantGeoLocationPermission,
1374
+ payload: geoLocationCoordinatesFromHook,
1375
+ });
1376
+ }
1377
+ else if (geoLocationPermissionFromHook === 'denied') {
1378
+ dispatch({ type: ActionTypes.DenyGeoLocationPermission });
1379
+ }
1380
+ }
1381
+ }, [
1382
+ geoLocationPermission,
1383
+ geoLocationPermissionFromHook,
1384
+ geoLocationCoordinatesFromHook,
1385
+ geoLocationPermissionFromProps,
1386
+ ]);
1387
+ useEffect(() => {
1388
+ if (navigateTo) {
1389
+ if (routerPush) {
1390
+ routerPush(navigateTo);
1391
+ }
1392
+ else {
1393
+ window.location.href = `${careFrontDomain}${navigateTo}`;
1394
+ }
1395
+ }
1396
+ }, [navigateTo]);
1397
+ const selectCurrentLocation = useCallback(function selectCurrentLocation() {
1398
+ dispatch({
1399
+ type: ActionTypes.SelectCurrentLocation,
1400
+ payload: currentLocationCityItem,
1401
+ });
1402
+ }, [t, dispatch]);
1403
+ useEffect(() => {
1404
+ var _a;
1405
+ if (geoLocationPermission !== 'denied' && !initialSelectedCity) {
1406
+ dispatch({
1407
+ type: ActionTypes.SelectLocation,
1408
+ payload: {
1409
+ name: t('booking.searchBar.allLocations'),
1410
+ id: ID_OPTION_ALL_LOCATION,
1411
+ slug: (_a = LOCALIZED_SLUGS[locale]) === null || _a === void 0 ? void 0 : _a.ALL,
1412
+ },
1413
+ });
1414
+ }
1415
+ if (onGeoLocationPermissionChange) {
1416
+ onGeoLocationPermissionChange(geoLocationPermission, state.geoLocationCoordinates);
1417
+ }
1418
+ if (isMobile && geoLocationPermission === 'granted' && selectedLocation) {
1419
+ dispatch({ type: ActionTypes.FocusInputSearch });
1420
+ }
1421
+ fetchCitiesByLocation({ coordinates: state.geoLocationCoordinates });
1422
+ }, [geoLocationPermission]);
1423
+ useEffect(() => {
1424
+ if (selectedLocation && defaultCity) {
1425
+ fetchSearchResults(state.searchKeywords, state);
1426
+ }
1427
+ }, [selectedLocation, defaultCity]);
1428
+ useEffect(() => {
1429
+ if (inputSearchPlaceholder !== inputSearchPlaceholderState) {
1430
+ dispatch({
1431
+ type: ActionTypes.SetInputSearchPlaceholder,
1432
+ payload: inputSearchPlaceholder,
1433
+ });
1434
+ }
1435
+ }, [inputSearchPlaceholder, inputSearchPlaceholderState]);
1436
+ useEffect(() => {
1437
+ if (isMobileModalOpened) {
1438
+ document.body.classList.add('care-popup-open');
1439
+ }
1440
+ else {
1441
+ document.body.classList.remove('care-popup-open');
1442
+ }
1443
+ }, [isMobileModalOpened]);
1444
+ const handleLocationClick = useCallback(function handleLocationClick(city) {
1445
+ if (locale === 'ms-MY') {
1446
+ setIsNavResultPage(true);
1447
+ }
1448
+ dispatch({ type: ActionTypes.SelectLocation, payload: city });
1449
+ if (locale !== 'ms-MY') {
1450
+ focusSearchInput();
1451
+ }
1452
+ if (onChangeLocation) {
1453
+ onChangeLocation(city);
1454
+ }
1455
+ }, [t, dispatch]);
1456
+ function handleCurrentLocationClick() {
1457
+ if (locale === 'ms-MY') {
1458
+ setIsNavResultPage(true);
1459
+ }
1460
+ if (isMobile && state.geoLocationPermission !== 'granted') {
1461
+ requestGeoLocation();
1462
+ }
1463
+ else {
1464
+ selectCurrentLocation();
1465
+ if (locale !== 'ms-MY') {
1466
+ focusSearchInput();
1467
+ }
1468
+ }
1469
+ }
1470
+ function handleMobileFakeInputClick() {
1471
+ var _a;
1472
+ return __awaiter(this, void 0, void 0, function* () {
1473
+ if (hiddenInputRef.current) {
1474
+ hiddenInputRef.current.focus();
1475
+ }
1476
+ dispatch({ type: ActionTypes.OpenMobileModal });
1477
+ yield Promise.resolve();
1478
+ if (wrapperRef.current) {
1479
+ (_a = wrapperRef.current
1480
+ .querySelector('input[name="search-location"]')) === null || _a === void 0 ? void 0 : _a.focus();
1481
+ }
1482
+ });
1483
+ }
1484
+ function focusLocationInput() {
1485
+ var _a;
1486
+ if (wrapperRef.current) {
1487
+ (_a = wrapperRef.current
1488
+ .querySelector('input[name="search-location"]')) === null || _a === void 0 ? void 0 : _a.focus();
1489
+ }
1490
+ }
1491
+ function focusSearchInput() {
1492
+ var _a;
1493
+ if (wrapperRef.current) {
1494
+ (_a = wrapperRef.current
1495
+ .querySelector('input[name="search-results"]')) === null || _a === void 0 ? void 0 : _a.focus();
1496
+ }
1497
+ }
1498
+ function handleMobileTopBarClose() {
1499
+ dispatch({ type: ActionTypes.CloseMobileModal });
1500
+ }
1501
+ function renderLocationResults() {
1502
+ if (focused !== 'location') {
1503
+ return null;
1504
+ }
1505
+ return (React__default.createElement(LocationResults, { isLoading: isLoadingCities, cities: cities, onLocationClick: handleLocationClick, onCurrentLocationClick: handleCurrentLocationClick, isLocationLoading: isLoadingCities, geoLocationPermission: geoLocationPermission, selectedLocation: selectedLocation, isOptionAllLocation: isOptionAllLocation }));
1506
+ }
1507
+ function renderSearchResults() {
1508
+ if (focused !== 'search') {
1509
+ return null;
1510
+ }
1511
+ if (state.autoCompleteDisabled) {
1512
+ if (!isMobile) {
1513
+ return null;
1514
+ }
1515
+ return (React__default.createElement(SearchButton, { onClick: () => {
1516
+ onSearch({
1517
+ cityId: state.selectedLocation.id,
1518
+ keyword: searchKeywords,
1519
+ });
1520
+ handleMobileTopBarClose();
1521
+ } }));
1522
+ }
1523
+ return (React__default.createElement(SearchResults, { data: searchResults, state: state, dispatch: dispatch, isMobile: false, keyword: searchKeywords, isLoading: isLoadingSearchResults, hideResults: hideResults, isNavResultItem: isNavResultItem }));
1524
+ }
1525
+ function renderSearchInputs() {
1526
+ return (React__default.createElement(SearchInputs, { isMobile: isMobile, state: state, dispatch: dispatch, debouncedFetchCitiesByKeyword: debouncedFetchCitiesByKeyword, debouncedFetchSearchResults: debouncedFetchSearchResults, focusLocationInput: focusLocationInput, focusSearchInput: focusSearchInput, renderLocationResults: renderLocationResults, renderSearchResults: renderSearchResults, trackingAttributes: gaTrackingSearchBar, locationTrackingAttributes: gaTrackingLocationSearch, onSearch: onSearch, initalSearchValue: initialSearchValue }));
1527
+ }
1528
+ useEffect(() => {
1529
+ if (window.visualViewport) {
1530
+ const resizeHandler = (evt) => {
1531
+ const viewport = evt.target;
1532
+ setViewportHeight(viewport === null || viewport === void 0 ? void 0 : viewport.height);
1533
+ };
1534
+ window.visualViewport.addEventListener('resize', resizeHandler, {
1535
+ passive: true,
1536
+ });
1537
+ return () => {
1538
+ window.visualViewport.removeEventListener('resize', resizeHandler);
1539
+ };
1540
+ }
1541
+ }, [setViewportHeight]);
1542
+ useEffect(() => {
1543
+ // Apply for ms-MY. Navigation to result page after selected location
1544
+ if (selectedLocation && isNavResultPage && locale === 'ms-MY') {
1545
+ const url = `/${selectedLocation.slug}/hospital`;
1546
+ dispatch({ type: ActionTypes.NavigateTo, payload: url });
1547
+ setIsNavResultPage(false);
1548
+ }
1549
+ }, [isNavResultPage, locale, selectedLocation]);
1550
+ if (isMobile) {
1551
+ return (React__default.createElement(React__default.Fragment, null,
1552
+ React__default.createElement(Global, { styles: css `
1553
+ .care-popup-open {
1554
+ overflow: hidden;
1555
+ position: fixed;
1556
+ &::before {
1557
+ content: '';
1558
+ inset: 0;
1559
+ position: absolute;
1560
+ background-color: white;
1561
+ min-height: 100vh;
1562
+ min-width: 100vw;
1563
+ z-index: 2;
1564
+ }
1565
+ }
1566
+ ` }),
1567
+ React__default.createElement(StyledHiddenInputMobile, { ref: hiddenInputRef }),
1568
+ React__default.createElement(StyledSearchBarMobileWrapper, { id: "booking-search-bar", ref: wrapperRef, "data-is-modal": isMobile && isMobileModalOpened, style: {
1569
+ '--mobile-care-searchbar-height': isMobileModalOpened && viewportHeight
1570
+ ? `${viewportHeight}px`
1571
+ : '100%',
1572
+ } }, !isMobileModalOpened ? (React__default.createElement(MobileFakeInput, { onClick: handleMobileFakeInputClick, focused: focused, value: searchKeywords, trackingAttributes: gaTrackingSearchBar, inputSearchPlaceholder: inputSearchPlaceholder })) : (React__default.createElement(React__default.Fragment, null,
1573
+ React__default.createElement(StyledSearchBarMobileModalHeader, null,
1574
+ React__default.createElement(MobileTopBar, { headingText: t('booking.searchBar.searchButton'), onLeftClick: handleMobileTopBarClose }),
1575
+ renderSearchInputs()),
1576
+ renderLocationResults(),
1577
+ renderSearchResults())))));
1578
+ }
1579
+ return (React__default.createElement(StyledSearchBarWrapper, { id: "booking-search-bar", ref: wrapperRef }, renderSearchInputs()));
1580
+ };
1581
+
1582
+ export { BookingSearchBar };