@sheerid/jslib-nightly 3.0.0-preview.1621 → 3.0.0-preview.1628

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 (510) hide show
  1. package/_mysheerid-preview.css +4 -4
  2. package/_mysheerid-preview.js +1177 -1046
  3. package/_mysheerid-preview.js.map +1 -1
  4. package/chunk/{AddressComponent-CicgG-Ap.js → AddressComponent-BtJQiY48.js} +9 -9
  5. package/chunk/{AddressComponent-CicgG-Ap.js.map → AddressComponent-BtJQiY48.js.map} +1 -1
  6. package/chunk/{AddressComponent-SyKsvFCQ.js → AddressComponent-DP9ULqtw.js} +9 -9
  7. package/chunk/{AddressComponent-SyKsvFCQ.js.map → AddressComponent-DP9ULqtw.js.map} +1 -1
  8. package/chunk/AddressFieldRow-BWYhS8VE.js +15 -0
  9. package/chunk/AddressFieldRow-BWYhS8VE.js.map +1 -0
  10. package/chunk/AddressFieldRow-DjhsZq8R.js +19 -0
  11. package/chunk/AddressFieldRow-DjhsZq8R.js.map +1 -0
  12. package/chunk/{AnnouncingHeader-CNUB901t.js → AnnouncingHeader-CmgyK603.js} +6 -6
  13. package/chunk/{AnnouncingHeader-CNUB901t.js.map → AnnouncingHeader-CmgyK603.js.map} +1 -1
  14. package/chunk/{AnnouncingHeader-DCiZuMUz.js → AnnouncingHeader-TMbsnXRN.js} +6 -6
  15. package/chunk/{AnnouncingHeader-DCiZuMUz.js.map → AnnouncingHeader-TMbsnXRN.js.map} +1 -1
  16. package/chunk/{ApiUrls-B4z1Ry3u.js → ApiUrls-CIgwmz09.js} +6 -6
  17. package/chunk/{ApiUrls-B4z1Ry3u.js.map → ApiUrls-CIgwmz09.js.map} +1 -1
  18. package/chunk/{ApiUrls-2RecghDh.js → ApiUrls-Cbvfd-lx.js} +6 -6
  19. package/chunk/{ApiUrls-2RecghDh.js.map → ApiUrls-Cbvfd-lx.js.map} +1 -1
  20. package/chunk/{BirthDateComponent-BvW3thf7.js → BirthDateComponent-BhzBNnhz.js} +9 -9
  21. package/chunk/{BirthDateComponent-BvW3thf7.js.map → BirthDateComponent-BhzBNnhz.js.map} +1 -1
  22. package/chunk/{BirthDateComponent-R-9mMaGu.js → BirthDateComponent-COtwQq3l.js} +9 -9
  23. package/chunk/{BirthDateComponent-R-9mMaGu.js.map → BirthDateComponent-COtwQq3l.js.map} +1 -1
  24. package/chunk/{CaptchaComponent-CELn5byp.js → CaptchaComponent-B6F_IroY.js} +642 -612
  25. package/chunk/CaptchaComponent-B6F_IroY.js.map +1 -0
  26. package/chunk/{CaptchaComponent-jgmYS8PD.js → CaptchaComponent-Cvfnq94R.js} +687 -657
  27. package/chunk/CaptchaComponent-Cvfnq94R.js.map +1 -0
  28. package/chunk/{ChangeLocaleComponent-Dp2emhBO.js → ChangeLocaleComponent-Bo_VnyV_.js} +11 -11
  29. package/chunk/{ChangeLocaleComponent-Dp2emhBO.js.map → ChangeLocaleComponent-Bo_VnyV_.js.map} +1 -1
  30. package/chunk/{ChangeLocaleComponent-H3FlQ3cA.js → ChangeLocaleComponent-QEzC2ahY.js} +11 -11
  31. package/chunk/{ChangeLocaleComponent-H3FlQ3cA.js.map → ChangeLocaleComponent-QEzC2ahY.js.map} +1 -1
  32. package/chunk/{City-BawrEn1_.js → City-BTjuf99s.js} +9 -9
  33. package/chunk/{City-BQKUXtCs.js.map → City-BTjuf99s.js.map} +1 -1
  34. package/chunk/{City-BQKUXtCs.js → City-Dd-sI-wK.js} +9 -9
  35. package/chunk/{City-BawrEn1_.js.map → City-Dd-sI-wK.js.map} +1 -1
  36. package/chunk/{CollegeNameComponent-CAIRXL5p.js → CollegeNameComponent-B-C-9pQI.js} +12 -12
  37. package/chunk/{CollegeNameComponent-CAIRXL5p.js.map → CollegeNameComponent-B-C-9pQI.js.map} +1 -1
  38. package/chunk/{CollegeNameComponent-BZ2MjvAc.js → CollegeNameComponent-CBDIIWG3.js} +12 -12
  39. package/chunk/{CollegeNameComponent-BZ2MjvAc.js.map → CollegeNameComponent-CBDIIWG3.js.map} +1 -1
  40. package/chunk/{CopyToClipboardComponent-BrWPnNPn.js → CopyToClipboardComponent-CWnba0yN.js} +6 -6
  41. package/chunk/{CopyToClipboardComponent-BrWPnNPn.js.map → CopyToClipboardComponent-CWnba0yN.js.map} +1 -1
  42. package/chunk/{CopyToClipboardComponent-uJ-6jBXB.js → CopyToClipboardComponent-Cb9wlwWJ.js} +6 -6
  43. package/chunk/{CopyToClipboardComponent-uJ-6jBXB.js.map → CopyToClipboardComponent-Cb9wlwWJ.js.map} +1 -1
  44. package/chunk/{CountryComponentWrapper-C20l0Hp9.js → CountryComponentWrapper-BKnHFvsi.js} +13 -13
  45. package/chunk/{CountryComponentWrapper-C20l0Hp9.js.map → CountryComponentWrapper-BKnHFvsi.js.map} +1 -1
  46. package/chunk/{CountryComponentWrapper-Cbo3tE2x.js → CountryComponentWrapper-Cjtba0XQ.js} +13 -13
  47. package/chunk/{CountryComponentWrapper-Cbo3tE2x.js.map → CountryComponentWrapper-Cjtba0XQ.js.map} +1 -1
  48. package/chunk/{DischargeDateComponent-DYymcxuK.js → DischargeDateComponent-DI4byXKt.js} +14 -14
  49. package/chunk/{DischargeDateComponent-DYymcxuK.js.map → DischargeDateComponent-DI4byXKt.js.map} +1 -1
  50. package/chunk/{DischargeDateComponent-H6vRxx9K.js → DischargeDateComponent-DJsMxV6V.js} +14 -14
  51. package/chunk/{DischargeDateComponent-H6vRxx9K.js.map → DischargeDateComponent-DJsMxV6V.js.map} +1 -1
  52. package/chunk/{DriverLicenseNumberComponent-GeE_vJ-6.js → DriverLicenseNumberComponent-2kNyRBoD.js} +9 -9
  53. package/chunk/{DriverLicenseNumberComponent-BTXjrzCy.js.map → DriverLicenseNumberComponent-2kNyRBoD.js.map} +1 -1
  54. package/chunk/{DriverLicenseNumberComponent-BTXjrzCy.js → DriverLicenseNumberComponent-D8-T8RG1.js} +9 -9
  55. package/chunk/{DriverLicenseNumberComponent-GeE_vJ-6.js.map → DriverLicenseNumberComponent-D8-T8RG1.js.map} +1 -1
  56. package/chunk/{EmailLoopPending-cFuBbba2.js → EmailLoopPending-B6XvUCzv.js} +14 -14
  57. package/chunk/{EmailLoopPending-cFuBbba2.js.map → EmailLoopPending-B6XvUCzv.js.map} +1 -1
  58. package/chunk/{EmailLoopPending-8SpBGanx.js → EmailLoopPending-CgoO6Cj0.js} +14 -14
  59. package/chunk/{EmailLoopPending-8SpBGanx.js.map → EmailLoopPending-CgoO6Cj0.js.map} +1 -1
  60. package/chunk/{ExtraMessage-WH33nlul.js → ExtraMessage-BOUiL1v2.js} +7 -7
  61. package/chunk/{ExtraMessage-At4-m1_R.js.map → ExtraMessage-BOUiL1v2.js.map} +1 -1
  62. package/chunk/{ExtraMessage-At4-m1_R.js → ExtraMessage-C3rLE7pH.js} +7 -7
  63. package/chunk/{ExtraMessage-WH33nlul.js.map → ExtraMessage-C3rLE7pH.js.map} +1 -1
  64. package/chunk/{FirstResponderOrganizationComponent-B6Kpl__I.js → FirstResponderOrganizationComponent-CZQlt29E.js} +11 -11
  65. package/chunk/{FirstResponderOrganizationComponent-B6Kpl__I.js.map → FirstResponderOrganizationComponent-CZQlt29E.js.map} +1 -1
  66. package/chunk/{FirstResponderOrganizationComponent-HZN2oyQe.js → FirstResponderOrganizationComponent-DympWWsT.js} +11 -11
  67. package/chunk/{FirstResponderOrganizationComponent-HZN2oyQe.js.map → FirstResponderOrganizationComponent-DympWWsT.js.map} +1 -1
  68. package/chunk/{FormFieldInputSelect-D6KB_lSA.js → FormFieldInputSelect-DcLExjg1.js} +7 -7
  69. package/chunk/{FormFieldInputSelect-BkP4JViC.js.map → FormFieldInputSelect-DcLExjg1.js.map} +1 -1
  70. package/chunk/{FormFieldInputSelect-BkP4JViC.js → FormFieldInputSelect-DjvrXRYz.js} +7 -7
  71. package/chunk/{FormFieldInputSelect-D6KB_lSA.js.map → FormFieldInputSelect-DjvrXRYz.js.map} +1 -1
  72. package/chunk/{FormFieldLayout-CdAF5eOb.js → FormFieldLayout-C0SpJlpv.js} +7 -7
  73. package/chunk/{FormFieldLayout-B6UWlgPZ.js.map → FormFieldLayout-C0SpJlpv.js.map} +1 -1
  74. package/chunk/{FormFieldLayout-B6UWlgPZ.js → FormFieldLayout-lJ_u3Dgo.js} +7 -7
  75. package/chunk/{FormFieldLayout-CdAF5eOb.js.map → FormFieldLayout-lJ_u3Dgo.js.map} +1 -1
  76. package/chunk/{FormFieldText-C95_VXFp.js → FormFieldText-BC4bIifh.js} +7 -7
  77. package/chunk/{FormFieldText-C95_VXFp.js.map → FormFieldText-BC4bIifh.js.map} +1 -1
  78. package/chunk/{FormFieldText-DF4JNdNJ.js → FormFieldText-mvrX2IIF.js} +7 -7
  79. package/chunk/{FormFieldText-DF4JNdNJ.js.map → FormFieldText-mvrX2IIF.js.map} +1 -1
  80. package/chunk/{FormFieldTypeahead-BbMRLwcq.js → FormFieldTypeahead-DQ7HUrTC.js} +556 -552
  81. package/chunk/{FormFieldTypeahead-BWO62nSf.js.map → FormFieldTypeahead-DQ7HUrTC.js.map} +1 -1
  82. package/chunk/{FormFieldTypeahead-BWO62nSf.js → FormFieldTypeahead-Ds8Iad_j.js} +362 -366
  83. package/chunk/{FormFieldTypeahead-BbMRLwcq.js.map → FormFieldTypeahead-Ds8Iad_j.js.map} +1 -1
  84. package/chunk/{FormFooterComponent-T4dnyYOP.js → FormFooterComponent-CnOOoGJa.js} +6 -6
  85. package/chunk/{FormFooterComponent-C4nUMHpv.js.map → FormFooterComponent-CnOOoGJa.js.map} +1 -1
  86. package/chunk/{FormFooterComponent-C4nUMHpv.js → FormFooterComponent-SVXUJ4ta.js} +6 -6
  87. package/chunk/{FormFooterComponent-T4dnyYOP.js.map → FormFooterComponent-SVXUJ4ta.js.map} +1 -1
  88. package/chunk/FormSelectChoice-Da11OJMy.js +4 -4
  89. package/chunk/{InputSelectComponent-DFomMBKx.js → InputSelectComponent-D54U7YXX.js} +759 -759
  90. package/chunk/{InputSelectComponent-DFomMBKx.js.map → InputSelectComponent-D54U7YXX.js.map} +1 -1
  91. package/chunk/{InputSelectComponent-xKOg0Mfy.js → InputSelectComponent-DYUtOb7C.js} +613 -613
  92. package/chunk/{InputSelectComponent-xKOg0Mfy.js.map → InputSelectComponent-DYUtOb7C.js.map} +1 -1
  93. package/chunk/{InputText-DO36IbjF.js → InputText-DVLYDw0h.js} +7 -7
  94. package/chunk/{InputText-DO36IbjF.js.map → InputText-DVLYDw0h.js.map} +1 -1
  95. package/chunk/{InputText-XskZSQrt.js → InputText-DjdofHyX.js} +7 -7
  96. package/chunk/{InputText-XskZSQrt.js.map → InputText-DjdofHyX.js.map} +1 -1
  97. package/chunk/{LicensedProfessionalOrganizationComponent-B79SU_Ho.js → LicensedProfessionalOrganizationComponent-BNzpkSMd.js} +11 -11
  98. package/chunk/{LicensedProfessionalOrganizationComponent-B79SU_Ho.js.map → LicensedProfessionalOrganizationComponent-BNzpkSMd.js.map} +1 -1
  99. package/chunk/{LicensedProfessionalOrganizationComponent-Bh2HJaux.js → LicensedProfessionalOrganizationComponent-D4fMc-74.js} +11 -11
  100. package/chunk/{LicensedProfessionalOrganizationComponent-Bh2HJaux.js.map → LicensedProfessionalOrganizationComponent-D4fMc-74.js.map} +1 -1
  101. package/chunk/{LogoComponent-D3p_K04d.js → LogoComponent-6tFjcgVM.js} +7 -7
  102. package/chunk/{LogoComponent-D3p_K04d.js.map → LogoComponent-6tFjcgVM.js.map} +1 -1
  103. package/chunk/{LogoComponent-waBbF_Hz.js → LogoComponent-mUZySaE6.js} +7 -7
  104. package/chunk/{LogoComponent-waBbF_Hz.js.map → LogoComponent-mUZySaE6.js.map} +1 -1
  105. package/chunk/{LowIncomeOrganizationComponent-B7nmTUWV.js → LowIncomeOrganizationComponent-BVwf7jjC.js} +16 -16
  106. package/chunk/{LowIncomeOrganizationComponent-B7nmTUWV.js.map → LowIncomeOrganizationComponent-BVwf7jjC.js.map} +1 -1
  107. package/chunk/{LowIncomeOrganizationComponent-BAf5x0-f.js → LowIncomeOrganizationComponent-lYkGVIRC.js} +16 -16
  108. package/chunk/{LowIncomeOrganizationComponent-BAf5x0-f.js.map → LowIncomeOrganizationComponent-lYkGVIRC.js.map} +1 -1
  109. package/chunk/{LowRewardPoolNote-D53DGp7d.js → LowRewardPoolNote-CtOLmlnn.js} +27 -25
  110. package/chunk/LowRewardPoolNote-CtOLmlnn.js.map +1 -0
  111. package/chunk/{LowRewardPoolNote-CAcUOjXU.js → LowRewardPoolNote-DG_MMjGN.js} +27 -25
  112. package/chunk/LowRewardPoolNote-DG_MMjGN.js.map +1 -0
  113. package/chunk/{MedicalProfessionalOrganizationComponent-CIPYgOg7.js → MedicalProfessionalOrganizationComponent-BLl6Da9c.js} +11 -11
  114. package/chunk/{MedicalProfessionalOrganizationComponent-CIPYgOg7.js.map → MedicalProfessionalOrganizationComponent-BLl6Da9c.js.map} +1 -1
  115. package/chunk/{MedicalProfessionalOrganizationComponent-BnURpR77.js → MedicalProfessionalOrganizationComponent-DIZA7RvJ.js} +11 -11
  116. package/chunk/{MedicalProfessionalOrganizationComponent-BnURpR77.js.map → MedicalProfessionalOrganizationComponent-DIZA7RvJ.js.map} +1 -1
  117. package/chunk/{MemberIdComponent-CvBccNKk.js → MemberIdComponent-BTlvABAU.js} +9 -9
  118. package/chunk/{MemberIdComponent-CYJuZbZS.js.map → MemberIdComponent-BTlvABAU.js.map} +1 -1
  119. package/chunk/{MemberIdComponent-CYJuZbZS.js → MemberIdComponent-ClI7Lrzf.js} +9 -9
  120. package/chunk/{MemberIdComponent-CvBccNKk.js.map → MemberIdComponent-ClI7Lrzf.js.map} +1 -1
  121. package/chunk/{MembershipOrganizationComponent-Hyvx9XaK.js → MembershipOrganizationComponent-BPizE5cP.js} +11 -11
  122. package/chunk/{MembershipOrganizationComponent-Hyvx9XaK.js.map → MembershipOrganizationComponent-BPizE5cP.js.map} +1 -1
  123. package/chunk/{MembershipOrganizationComponent-CgwT1kz9.js → MembershipOrganizationComponent-ChUpP3B6.js} +11 -11
  124. package/chunk/{MembershipOrganizationComponent-CgwT1kz9.js.map → MembershipOrganizationComponent-ChUpP3B6.js.map} +1 -1
  125. package/chunk/{Message-CCPUNbvb.js → Message-5IZ4lXNe.js} +22 -20
  126. package/chunk/Message-5IZ4lXNe.js.map +1 -0
  127. package/chunk/{Message-BJpuZuCw.js → Message-CwmUrRnS.js} +22 -20
  128. package/chunk/Message-CwmUrRnS.js.map +1 -0
  129. package/chunk/Onfido-CTCgAwnB.js +4 -4
  130. package/chunk/PersonalInfoStepFrame-ClEKETJL.js +52 -0
  131. package/chunk/PersonalInfoStepFrame-ClEKETJL.js.map +1 -0
  132. package/chunk/PersonalInfoStepFrame-DHPclK45.js +83 -0
  133. package/chunk/PersonalInfoStepFrame-DHPclK45.js.map +1 -0
  134. package/chunk/PersonalInfoStepSubmitButton-BzrRG3Jn.js +101 -0
  135. package/chunk/PersonalInfoStepSubmitButton-BzrRG3Jn.js.map +1 -0
  136. package/chunk/PersonalInfoStepSubmitButton-DFwDHOdp.js +97 -0
  137. package/chunk/PersonalInfoStepSubmitButton-DFwDHOdp.js.map +1 -0
  138. package/chunk/{PostalCodeComponent-D-Wlqd3h.js → PostalCodeComponent-CP0rzyjy.js} +9 -9
  139. package/chunk/{PostalCodeComponent-D-Wlqd3h.js.map → PostalCodeComponent-CP0rzyjy.js.map} +1 -1
  140. package/chunk/{PostalCodeComponent-Bfyrs-OS.js → PostalCodeComponent-KP-2qj83.js} +9 -9
  141. package/chunk/{PostalCodeComponent-Bfyrs-OS.js.map → PostalCodeComponent-KP-2qj83.js.map} +1 -1
  142. package/chunk/{SSN-CpZKLMZh.js → SSN-CLxg9aqc.js} +8 -8
  143. package/chunk/{SSN-CpZKLMZh.js.map → SSN-CLxg9aqc.js.map} +1 -1
  144. package/chunk/{SSN-DfQKic30.js → SSN-TkC3k_yT.js} +8 -8
  145. package/chunk/{SSN-DfQKic30.js.map → SSN-TkC3k_yT.js.map} +1 -1
  146. package/chunk/{StateSelectComponent-uRb4CZto.js → StateSelectComponent-BSKbExE7.js} +7 -7
  147. package/chunk/{StateSelectComponent-uRb4CZto.js.map → StateSelectComponent-BSKbExE7.js.map} +1 -1
  148. package/chunk/{StateSelectComponent-B0vfzaHI.js → StateSelectComponent-C5zsszV4.js} +7 -7
  149. package/chunk/{StateSelectComponent-B0vfzaHI.js.map → StateSelectComponent-C5zsszV4.js.map} +1 -1
  150. package/chunk/{StatusComponent-ZjAfp6D1.js → StatusComponent-CjJzTs66.js} +10 -10
  151. package/chunk/{StatusComponent-RqqyyDyR.js.map → StatusComponent-CjJzTs66.js.map} +1 -1
  152. package/chunk/{StatusComponent-RqqyyDyR.js → StatusComponent-DLYbEtYO.js} +10 -10
  153. package/chunk/{StatusComponent-ZjAfp6D1.js.map → StatusComponent-DLYbEtYO.js.map} +1 -1
  154. package/chunk/StepAgePersonalInfo-5MpjInxr.js +154 -0
  155. package/chunk/StepAgePersonalInfo-5MpjInxr.js.map +1 -0
  156. package/chunk/StepAgePersonalInfo-BLIpWgcW.js +158 -0
  157. package/chunk/StepAgePersonalInfo-BLIpWgcW.js.map +1 -0
  158. package/chunk/{StepCard-wwdNHa6o.js → StepCard-C76ZfmqM.js} +5 -5
  159. package/chunk/{StepCard-ELVyeUE5.js.map → StepCard-C76ZfmqM.js.map} +1 -1
  160. package/chunk/{StepCard-ELVyeUE5.js → StepCard-CXGXGFI-.js} +5 -5
  161. package/chunk/{StepCard-wwdNHa6o.js.map → StepCard-CXGXGFI-.js.map} +1 -1
  162. package/chunk/StepCollectIdentifier-4GqjrMR9.js +64 -0
  163. package/chunk/StepCollectIdentifier-4GqjrMR9.js.map +1 -0
  164. package/chunk/StepCollectIdentifier-IsEVaXVN.js +60 -0
  165. package/chunk/StepCollectIdentifier-IsEVaXVN.js.map +1 -0
  166. package/chunk/StepCollectMilitaryPersonalInfoComponent-CGsMi0Qe.js +224 -0
  167. package/chunk/StepCollectMilitaryPersonalInfoComponent-CGsMi0Qe.js.map +1 -0
  168. package/chunk/StepCollectMilitaryPersonalInfoComponent-CgRV67Kn.js +220 -0
  169. package/chunk/StepCollectMilitaryPersonalInfoComponent-CgRV67Kn.js.map +1 -0
  170. package/chunk/StepCollectPersonalInfo-B0-Tj9ms.js +348 -0
  171. package/chunk/StepCollectPersonalInfo-B0-Tj9ms.js.map +1 -0
  172. package/chunk/StepCollectPersonalInfo-BgSOHYiZ.js +352 -0
  173. package/chunk/StepCollectPersonalInfo-BgSOHYiZ.js.map +1 -0
  174. package/chunk/{StepCompleteAuthentication-B3iM05Rm.js → StepCompleteAuthentication-CbjrrB6R.js} +10 -10
  175. package/chunk/{StepCompleteAuthentication-B3iM05Rm.js.map → StepCompleteAuthentication-CbjrrB6R.js.map} +1 -1
  176. package/chunk/{StepCompleteAuthentication-DmURi_hs.js → StepCompleteAuthentication-D_LaDe1h.js} +10 -10
  177. package/chunk/{StepCompleteAuthentication-DmURi_hs.js.map → StepCompleteAuthentication-D_LaDe1h.js.map} +1 -1
  178. package/chunk/{StepConsolation-CFWMHxRq.js → StepConsolation-CHt2g_dn.js} +10 -10
  179. package/chunk/{StepConsolation-CFWMHxRq.js.map → StepConsolation-CHt2g_dn.js.map} +1 -1
  180. package/chunk/{StepConsolation-nN23KvH2.js → StepConsolation-CkVYeAFw.js} +10 -10
  181. package/chunk/{StepConsolation-nN23KvH2.js.map → StepConsolation-CkVYeAFw.js.map} +1 -1
  182. package/chunk/{StepDocUpload-DAI4hd-K.js → StepDocUpload-BDxM8MmK.js} +613 -611
  183. package/chunk/StepDocUpload-BDxM8MmK.js.map +1 -0
  184. package/chunk/{StepDocUpload-DXj4mEM6.js → StepDocUpload-V99c9o9B.js} +526 -524
  185. package/chunk/StepDocUpload-V99c9o9B.js.map +1 -0
  186. package/chunk/StepDriverLicensePersonalInfoComponent-CO_D9enW.js +121 -0
  187. package/chunk/StepDriverLicensePersonalInfoComponent-CO_D9enW.js.map +1 -0
  188. package/chunk/StepDriverLicensePersonalInfoComponent-S3GMlNVG.js +125 -0
  189. package/chunk/StepDriverLicensePersonalInfoComponent-S3GMlNVG.js.map +1 -0
  190. package/chunk/{StepEmailLoop-CuaFZ_b2.js → StepEmailLoop-Dw2_8QHT.js} +14 -14
  191. package/chunk/{StepEmailLoop-CuaFZ_b2.js.map → StepEmailLoop-Dw2_8QHT.js.map} +1 -1
  192. package/chunk/{StepEmailLoop-C490ilfk.js → StepEmailLoop-cJGhzoxB.js} +14 -14
  193. package/chunk/{StepEmailLoop-C490ilfk.js.map → StepEmailLoop-cJGhzoxB.js.map} +1 -1
  194. package/chunk/StepEmploymentPersonalInfo-C1p6zQJU.js +195 -0
  195. package/chunk/StepEmploymentPersonalInfo-C1p6zQJU.js.map +1 -0
  196. package/chunk/StepEmploymentPersonalInfo-Cf5-yMap.js +191 -0
  197. package/chunk/StepEmploymentPersonalInfo-Cf5-yMap.js.map +1 -0
  198. package/chunk/StepFirstResponderPersonalInfo-BgZVPaDN.js +159 -0
  199. package/chunk/StepFirstResponderPersonalInfo-BgZVPaDN.js.map +1 -0
  200. package/chunk/StepFirstResponderPersonalInfo-nM5k1qr0.js +163 -0
  201. package/chunk/StepFirstResponderPersonalInfo-nM5k1qr0.js.map +1 -0
  202. package/chunk/StepGeneralIdentityPersonalInfoComponent-CpTD4_cn.js +155 -0
  203. package/chunk/StepGeneralIdentityPersonalInfoComponent-CpTD4_cn.js.map +1 -0
  204. package/chunk/StepGeneralIdentityPersonalInfoComponent-DBLhfod8.js +159 -0
  205. package/chunk/StepGeneralIdentityPersonalInfoComponent-DBLhfod8.js.map +1 -0
  206. package/chunk/StepHybridIdentityPersonalInfoComponent-BlPU1xTJ.js +164 -0
  207. package/chunk/StepHybridIdentityPersonalInfoComponent-BlPU1xTJ.js.map +1 -0
  208. package/chunk/StepHybridIdentityPersonalInfoComponent-t80dX6ge.js +168 -0
  209. package/chunk/StepHybridIdentityPersonalInfoComponent-t80dX6ge.js.map +1 -0
  210. package/chunk/{StepIDCheckLoop-CGuZberW.js → StepIDCheckLoop-DixyWIxE.js} +9 -9
  211. package/chunk/{StepIDCheckLoop-CGuZberW.js.map → StepIDCheckLoop-DixyWIxE.js.map} +1 -1
  212. package/chunk/{StepIDCheckLoop-DDNgoWKs.js → StepIDCheckLoop-DxYk4IJu.js} +9 -9
  213. package/chunk/{StepIDCheckLoop-DDNgoWKs.js.map → StepIDCheckLoop-DxYk4IJu.js.map} +1 -1
  214. package/chunk/{StepIDCheckLoopOnfido-2fSt4PC7.js → StepIDCheckLoopOnfido-BNbAwHVt.js} +15 -15
  215. package/chunk/{StepIDCheckLoopOnfido-2fSt4PC7.js.map → StepIDCheckLoopOnfido-BNbAwHVt.js.map} +1 -1
  216. package/chunk/{StepIDCheckLoopOnfido-BajgwcIU.js → StepIDCheckLoopOnfido-COVPb_S5.js} +15 -15
  217. package/chunk/{StepIDCheckLoopOnfido-BajgwcIU.js.map → StepIDCheckLoopOnfido-COVPb_S5.js.map} +1 -1
  218. package/chunk/{StepIDCheckLoopRegula-BWkVIExj.js → StepIDCheckLoopRegula-DKbVSfuV.js} +15 -15
  219. package/chunk/{StepIDCheckLoopRegula-BWkVIExj.js.map → StepIDCheckLoopRegula-DKbVSfuV.js.map} +1 -1
  220. package/chunk/{StepIDCheckLoopRegula-DBEhCcOx.js → StepIDCheckLoopRegula-mvQ8qDWR.js} +13 -13
  221. package/chunk/{StepIDCheckLoopRegula-DBEhCcOx.js.map → StepIDCheckLoopRegula-mvQ8qDWR.js.map} +1 -1
  222. package/chunk/StepLicensedProfessionalPersonalInfo-C2CIk-nr.js +152 -0
  223. package/chunk/StepLicensedProfessionalPersonalInfo-C2CIk-nr.js.map +1 -0
  224. package/chunk/StepLicensedProfessionalPersonalInfo-CTE2jZqH.js +156 -0
  225. package/chunk/StepLicensedProfessionalPersonalInfo-CTE2jZqH.js.map +1 -0
  226. package/chunk/StepLowIncomePersonalInfo-Be9qCxGX.js +208 -0
  227. package/chunk/StepLowIncomePersonalInfo-Be9qCxGX.js.map +1 -0
  228. package/chunk/StepLowIncomePersonalInfo-Bzh9WTNR.js +212 -0
  229. package/chunk/StepLowIncomePersonalInfo-Bzh9WTNR.js.map +1 -0
  230. package/chunk/StepMedicalProfessionalPersonalInfo-B2BR4rqc.js +181 -0
  231. package/chunk/StepMedicalProfessionalPersonalInfo-B2BR4rqc.js.map +1 -0
  232. package/chunk/StepMedicalProfessionalPersonalInfo-DUc_JDXL.js +177 -0
  233. package/chunk/StepMedicalProfessionalPersonalInfo-DUc_JDXL.js.map +1 -0
  234. package/chunk/StepMemberPersonalInfo-B_lcCFCr.js +143 -0
  235. package/chunk/StepMemberPersonalInfo-B_lcCFCr.js.map +1 -0
  236. package/chunk/StepMemberPersonalInfo-gHVsFx6L.js +139 -0
  237. package/chunk/StepMemberPersonalInfo-gHVsFx6L.js.map +1 -0
  238. package/chunk/StepMoverPersonalInfo-1u0Ayivh.js +124 -0
  239. package/chunk/StepMoverPersonalInfo-1u0Ayivh.js.map +1 -0
  240. package/chunk/StepMoverPersonalInfo-BqcbV8cH.js +120 -0
  241. package/chunk/StepMoverPersonalInfo-BqcbV8cH.js.map +1 -0
  242. package/chunk/{StepOverrideComponent-Df7suQby.js → StepOverrideComponent-BRdS2H3m.js} +14 -14
  243. package/chunk/{StepOverrideComponent-Df7suQby.js.map → StepOverrideComponent-BRdS2H3m.js.map} +1 -1
  244. package/chunk/{StepOverrideComponent-_2tBwss0.js → StepOverrideComponent-BmmBE8nB.js} +14 -14
  245. package/chunk/{StepOverrideComponent-_2tBwss0.js.map → StepOverrideComponent-BmmBE8nB.js.map} +1 -1
  246. package/chunk/{StepSMSLoop-BVbQi9Eq.js → StepSMSLoop-CRd8TtzV.js} +11 -11
  247. package/chunk/{StepSMSLoop-BVbQi9Eq.js.map → StepSMSLoop-CRd8TtzV.js.map} +1 -1
  248. package/chunk/{StepSMSLoop-DJdI9NJ-.js → StepSMSLoop-CTF2WyJG.js} +11 -11
  249. package/chunk/{StepSMSLoop-DJdI9NJ-.js.map → StepSMSLoop-CTF2WyJG.js.map} +1 -1
  250. package/chunk/StepSSO-CVwwDxgB.js +8 -0
  251. package/chunk/StepSSO-DSR38vO8.js +12 -0
  252. package/chunk/{StepSocialSecurityNumber-CKW8pUck.js → StepSocialSecurityNumber-CkHNhkLX.js} +13 -13
  253. package/chunk/{StepSocialSecurityNumber-CKW8pUck.js.map → StepSocialSecurityNumber-CkHNhkLX.js.map} +1 -1
  254. package/chunk/{StepSocialSecurityNumber-CBmG_7kt.js → StepSocialSecurityNumber-tST0N2Ij.js} +13 -13
  255. package/chunk/{StepSocialSecurityNumber-CBmG_7kt.js.map → StepSocialSecurityNumber-tST0N2Ij.js.map} +1 -1
  256. package/chunk/StepStudentPersonalInfo-CuZt_5Qb.js +213 -0
  257. package/chunk/StepStudentPersonalInfo-CuZt_5Qb.js.map +1 -0
  258. package/chunk/StepStudentPersonalInfo-D8LOtrpG.js +209 -0
  259. package/chunk/StepStudentPersonalInfo-D8LOtrpG.js.map +1 -0
  260. package/chunk/{StepSuccess-lXDU9RzB.js → StepSuccess-7wdEnCFs.js} +15 -15
  261. package/chunk/{StepSuccess-lXDU9RzB.js.map → StepSuccess-7wdEnCFs.js.map} +1 -1
  262. package/chunk/{StepSuccess-B_b_cLvk.js → StepSuccess-CUOqyiUg.js} +15 -15
  263. package/chunk/{StepSuccess-B_b_cLvk.js.map → StepSuccess-CUOqyiUg.js.map} +1 -1
  264. package/chunk/StepTeacherPersonalInfo-DJrHR00w.js +137 -0
  265. package/chunk/StepTeacherPersonalInfo-DJrHR00w.js.map +1 -0
  266. package/chunk/StepTeacherPersonalInfo-f9rRcLw9.js +133 -0
  267. package/chunk/StepTeacherPersonalInfo-f9rRcLw9.js.map +1 -0
  268. package/chunk/StepThirdPartyLoop-BY7ytJrS.js +12 -0
  269. package/chunk/StepThirdPartyLoop-B__GCNlS.js +8 -0
  270. package/chunk/{TeacherSchoolComponent-DpNEEKfb.js → TeacherSchoolComponent-1DEfJKNl.js} +12 -12
  271. package/chunk/{TeacherSchoolComponent-DpNEEKfb.js.map → TeacherSchoolComponent-1DEfJKNl.js.map} +1 -1
  272. package/chunk/{TeacherSchoolComponent-BFiJ7Wq2.js → TeacherSchoolComponent-CLYNsumk.js} +12 -12
  273. package/chunk/{TeacherSchoolComponent-BFiJ7Wq2.js.map → TeacherSchoolComponent-CLYNsumk.js.map} +1 -1
  274. package/chunk/{TestingRouteOverrides-BEm8Sf8D.js → TestingRouteOverrides-CoyYU2dB.js} +6 -6
  275. package/chunk/{TestingRouteOverrides-BEm8Sf8D.js.map → TestingRouteOverrides-CoyYU2dB.js.map} +1 -1
  276. package/chunk/{TestingRouteOverrides-CY6cZruo.js → TestingRouteOverrides-DdBMBH84.js} +6 -6
  277. package/chunk/{TestingRouteOverrides-CY6cZruo.js.map → TestingRouteOverrides-DdBMBH84.js.map} +1 -1
  278. package/chunk/ThreatMetrix-D_TbL50B.js +4 -4
  279. package/chunk/{VerificationApiClient-BeOvbT_t.js → VerificationApiClient-BUZofFET.js} +7 -7
  280. package/chunk/{VerificationApiClient-BeOvbT_t.js.map → VerificationApiClient-BUZofFET.js.map} +1 -1
  281. package/chunk/{VerificationApiClient-BvR36fUk.js → VerificationApiClient-DxDGUQ-S.js} +7 -7
  282. package/chunk/{VerificationApiClient-BvR36fUk.js.map → VerificationApiClient-DxDGUQ-S.js.map} +1 -1
  283. package/chunk/{addEventListener-CjrfonA-.js → addEventListener-BVNWtC2P.js} +8 -8
  284. package/chunk/{addEventListener-DuM7oJdm.js.map → addEventListener-BVNWtC2P.js.map} +1 -1
  285. package/chunk/{addEventListener-DuM7oJdm.js → addEventListener-BcjpXDjJ.js} +8 -8
  286. package/chunk/{addEventListener-CjrfonA-.js.map → addEventListener-BcjpXDjJ.js.map} +1 -1
  287. package/chunk/ar-D5CO913q.js +4 -4
  288. package/chunk/bg-1mhA5kYF.js +4 -4
  289. package/chunk/bn-IN-CpDqyRb_.js +4 -4
  290. package/chunk/{button-DIPXKy0a.js → button-D5HIQ4Y0.js} +8 -8
  291. package/chunk/{button-DIPXKy0a.js.map → button-D5HIQ4Y0.js.map} +1 -1
  292. package/chunk/{button-BlkqJX_E.js → button-ac_Hqm_6.js} +11 -11
  293. package/chunk/{button-BlkqJX_E.js.map → button-ac_Hqm_6.js.map} +1 -1
  294. package/chunk/clsx-DC8twM4t.js +4 -4
  295. package/chunk/countryUtils-BA0alsCj.js +12 -0
  296. package/chunk/{countryUtils-DKwoRV2T.js.map → countryUtils-BA0alsCj.js.map} +1 -1
  297. package/chunk/{countryUtils-DKwoRV2T.js → countryUtils-DOhg01BA.js} +5 -5
  298. package/chunk/{countryUtils-SAP2nHeP.js.map → countryUtils-DOhg01BA.js.map} +1 -1
  299. package/chunk/cs-Chh7FAGt.js +4 -4
  300. package/chunk/da-DwrVoxto.js +4 -4
  301. package/chunk/de-IWGZLhgY.js +4 -4
  302. package/chunk/dist-In8P1UpN.js +4 -4
  303. package/chunk/el-DbDcvSPJ.js +4 -4
  304. package/chunk/{empties-D2KXGsVY.js → empties-BnfYnQnj.js} +8 -5
  305. package/chunk/empties-BnfYnQnj.js.map +1 -0
  306. package/chunk/{empties-CJE5It5a.js → empties-DIWFhdB0.js} +8 -5
  307. package/chunk/{empties-CJE5It5a.js.map → empties-DIWFhdB0.js.map} +1 -1
  308. package/chunk/en-GB-CNQ8Ww2j.js +4 -4
  309. package/chunk/es-ES-DWimqEZ_.js +4 -4
  310. package/chunk/es-qhC-seq5.js +4 -4
  311. package/chunk/et-yF9G-Mym.js +4 -4
  312. package/chunk/eventEmitter-CSG6jR7V.js +4 -4
  313. package/chunk/fa-BcdSf7og.js +4 -4
  314. package/chunk/fi-D-IP_KHm.js +4 -4
  315. package/chunk/fr-BmUuYxk0.js +4 -4
  316. package/chunk/fr-CA-DVQ4xmzZ.js +4 -4
  317. package/chunk/ga-DuZycND3.js +4 -4
  318. package/chunk/getInstallType-BRxisNNY.js +4 -4
  319. package/chunk/getInstallType-DlS_DNKt.js +4 -4
  320. package/chunk/hi-IN-l6Rn5Ewm.js +4 -4
  321. package/chunk/{hooks-Cjcd--GE.js → hooks-BtGKgRAK.js} +6 -6
  322. package/chunk/hooks-BtGKgRAK.js.map +1 -0
  323. package/chunk/{hooks-D72YoqAe.js → hooks-DKM9cJde.js} +6 -6
  324. package/chunk/hooks-DKM9cJde.js.map +1 -0
  325. package/chunk/hr-BtqyDzDB.js +4 -4
  326. package/chunk/hu-C6syKJfb.js +4 -4
  327. package/chunk/id-GgI-Z2a5.js +4 -4
  328. package/chunk/{index.es-C_UCMoRU.js → index.es-DpZtkqxf.js} +6 -6
  329. package/chunk/{index.es-C_UCMoRU.js.map → index.es-DpZtkqxf.js.map} +1 -1
  330. package/chunk/{index.es-0Ly0eUxm.js → index.es-FjuPwOz0.js} +6 -6
  331. package/chunk/{index.es-0Ly0eUxm.js.map → index.es-FjuPwOz0.js.map} +1 -1
  332. package/chunk/{input-Bnmror_i.js → input-BfKnTtbM.js} +8 -8
  333. package/chunk/{input-Bnmror_i.js.map → input-BfKnTtbM.js.map} +1 -1
  334. package/chunk/{input-CbFmDZR4.js → input-CwRvN2sJ.js} +8 -8
  335. package/chunk/{input-CbFmDZR4.js.map → input-CwRvN2sJ.js.map} +1 -1
  336. package/chunk/is-CvmKEON9.js +4 -4
  337. package/chunk/it-CnmveGgC.js +4 -4
  338. package/chunk/iw-DFUYHkxF.js +4 -4
  339. package/chunk/ja-CjVb2tWW.js +4 -4
  340. package/chunk/{jsx-runtime-B5jXYl8q.js → jsx-runtime-DDrPHZwN.js} +5 -5
  341. package/chunk/{jsx-runtime-B5jXYl8q.js.map → jsx-runtime-DDrPHZwN.js.map} +1 -1
  342. package/chunk/{jsx-runtime-BnRn7GM8.js → jsx-runtime-NC2eM5ec.js} +5 -5
  343. package/chunk/{jsx-runtime-BnRn7GM8.js.map → jsx-runtime-NC2eM5ec.js.map} +1 -1
  344. package/chunk/kk-Dvz4nK6K.js +4 -4
  345. package/chunk/ko-DzOqBMGC.js +4 -4
  346. package/chunk/lo-C2WPq55d.js +4 -4
  347. package/chunk/lt-BSDYvjTF.js +4 -4
  348. package/chunk/lv-CefDPT-M.js +4 -4
  349. package/chunk/mockProgramBranding-C9Ysu3Mp.js +4 -4
  350. package/chunk/mockProgramConfiguration-BNqSCrMG.js +4 -4
  351. package/chunk/mockProgramI18n-CgYx_1_a.js +4 -4
  352. package/chunk/mockProgramTheme-Cfk2dzF3.js +4 -4
  353. package/chunk/{mocks-BuI-FNT-.js → mocks-CHQ1TVI3.js} +5 -5
  354. package/chunk/{mocks-C6Bm8r6i.js.map → mocks-CHQ1TVI3.js.map} +1 -1
  355. package/chunk/{mocks-C6Bm8r6i.js → mocks-Dd0Dlwr1.js} +5 -5
  356. package/chunk/{mocks-BuI-FNT-.js.map → mocks-Dd0Dlwr1.js.map} +1 -1
  357. package/chunk/ms-BjestZxy.js +4 -4
  358. package/chunk/nl-B1FyUfCT.js +4 -4
  359. package/chunk/nl-BE-CbeAd3nq.js +4 -4
  360. package/chunk/no-Dr633Ddi.js +4 -4
  361. package/chunk/pl-UYTjMIq_.js +4 -4
  362. package/chunk/{programThemeGetters-CLeOiedB.js → programThemeGetters-BAbsTY-b.js} +6 -6
  363. package/chunk/{programThemeGetters-CLeOiedB.js.map → programThemeGetters-BAbsTY-b.js.map} +1 -1
  364. package/chunk/{programThemeGetters-TRIvr7Go.js → programThemeGetters-k8rZASZ-.js} +6 -6
  365. package/chunk/{programThemeGetters-TRIvr7Go.js.map → programThemeGetters-k8rZASZ-.js.map} +1 -1
  366. package/chunk/pt-BR-C8SYMT-J.js +4 -4
  367. package/chunk/pt-uH-M3GdN.js +4 -4
  368. package/chunk/refs-Mq0rtW9K.js +4 -4
  369. package/chunk/ro-CAOSXZ7h.js +4 -4
  370. package/chunk/ru-iwYoEydL.js +4 -4
  371. package/chunk/runtimeTypes-B2AGNJMT.js +4 -4
  372. package/chunk/sk-DYYNV3zw.js +4 -4
  373. package/chunk/sl-D_-eeM5N.js +4 -4
  374. package/chunk/sr-BTi9_anL.js +4 -4
  375. package/chunk/{stepComponentHelpers-CzsNPyXM.js → stepComponentHelpers-Db0mTMF5.js} +6 -6
  376. package/chunk/{stepComponentHelpers-CzsNPyXM.js.map → stepComponentHelpers-Db0mTMF5.js.map} +1 -1
  377. package/chunk/{stepComponentHelpers-IolnFznH.js → stepComponentHelpers-jZe9fteF.js} +6 -6
  378. package/chunk/{stepComponentHelpers-IolnFznH.js.map → stepComponentHelpers-jZe9fteF.js.map} +1 -1
  379. package/chunk/strings-DWLVdUcm.js +4 -4
  380. package/chunk/sv-DRwY4shG.js +4 -4
  381. package/chunk/sw-Bvj2mYmM.js +4 -4
  382. package/chunk/ta-CmtaYoNe.js +4 -4
  383. package/chunk/th-12r2yKkJ.js +4 -4
  384. package/chunk/tl-BGNfO7md.js +4 -4
  385. package/chunk/tr-DH2ZSJhs.js +4 -4
  386. package/chunk/uk-CELBZlTd.js +4 -4
  387. package/chunk/ur-MR8DTbmd.js +4 -4
  388. package/chunk/{useCollectFieldsEndpoint-olPOcYoz.js → useCollectFieldsEndpoint-BzHmfuvW.js} +9 -9
  389. package/chunk/{useCollectFieldsEndpoint-olPOcYoz.js.map → useCollectFieldsEndpoint-BzHmfuvW.js.map} +1 -1
  390. package/chunk/{useCollectFieldsEndpoint-CvBJD-m5.js → useCollectFieldsEndpoint-DS_VOcED.js} +9 -9
  391. package/chunk/{useCollectFieldsEndpoint-CvBJD-m5.js.map → useCollectFieldsEndpoint-DS_VOcED.js.map} +1 -1
  392. package/chunk/useFocusOnMount-CM4T5Z88.js +18 -0
  393. package/chunk/{useFocusOnMount-B4gVB2JN.js.map → useFocusOnMount-CM4T5Z88.js.map} +1 -1
  394. package/chunk/{useFocusOnMount-B4gVB2JN.js → useFocusOnMount-CfNgS3Ag.js} +6 -6
  395. package/chunk/{useFocusOnMount-CoKIEDuF.js.map → useFocusOnMount-CfNgS3Ag.js.map} +1 -1
  396. package/chunk/{useFooterShieldSrc-CmKqak9A.js → useFooterShieldSrc-BbUsX_E3.js} +13 -13
  397. package/chunk/{useFooterShieldSrc-CmKqak9A.js.map → useFooterShieldSrc-BbUsX_E3.js.map} +1 -1
  398. package/chunk/{useFooterShieldSrc-CWTHh0Mk.js → useFooterShieldSrc-Ch42sUV8.js} +13 -13
  399. package/chunk/{useFooterShieldSrc-CWTHh0Mk.js.map → useFooterShieldSrc-Ch42sUV8.js.map} +1 -1
  400. package/chunk/{useMetrics-DKU_qdJm.js → useMetrics-CsJd9Mos.js} +7 -7
  401. package/chunk/{useMetrics-DKU_qdJm.js.map → useMetrics-CsJd9Mos.js.map} +1 -1
  402. package/chunk/{useMetrics-CK1qxUD4.js → useMetrics-Oeia1mNS.js} +7 -7
  403. package/chunk/{useMetrics-CK1qxUD4.js.map → useMetrics-Oeia1mNS.js.map} +1 -1
  404. package/chunk/{useOnMount-B3CK3L_o.js → useOnMount-D-FexEcU.js} +6 -6
  405. package/chunk/{useOnMount-B3CK3L_o.js.map → useOnMount-D-FexEcU.js.map} +1 -1
  406. package/chunk/{useOnMount-DTplONXt.js → useOnMount-IlmAw-W-.js} +6 -6
  407. package/chunk/{useOnMount-DTplONXt.js.map → useOnMount-IlmAw-W-.js.map} +1 -1
  408. package/chunk/vi-DtZ-SqD5.js +4 -4
  409. package/chunk/zh-DjyVyYac.js +4 -4
  410. package/chunk/zh-HK-CN1HarHq.js +4 -4
  411. package/chunk/zu-DPhgIh1z.js +4 -4
  412. package/package.json +1 -1
  413. package/sheerid-install.css +4 -4
  414. package/sheerid-install.js +4 -4
  415. package/sheerid.css +5 -5
  416. package/sheerid.js +1479 -1348
  417. package/sheerid.js.map +1 -1
  418. package/chunk/CaptchaComponent-CELn5byp.js.map +0 -1
  419. package/chunk/CaptchaComponent-jgmYS8PD.js.map +0 -1
  420. package/chunk/LowRewardPoolNote-CAcUOjXU.js.map +0 -1
  421. package/chunk/LowRewardPoolNote-D53DGp7d.js.map +0 -1
  422. package/chunk/Message-BJpuZuCw.js.map +0 -1
  423. package/chunk/Message-CCPUNbvb.js.map +0 -1
  424. package/chunk/PersonalInfoStepSubmitButton-Bkfehzde.js +0 -142
  425. package/chunk/PersonalInfoStepSubmitButton-Bkfehzde.js.map +0 -1
  426. package/chunk/PersonalInfoStepSubmitButton-vKWA-7OM.js +0 -138
  427. package/chunk/PersonalInfoStepSubmitButton-vKWA-7OM.js.map +0 -1
  428. package/chunk/PersonalInfoStepWrapper-CO1Ai4CL.js +0 -53
  429. package/chunk/PersonalInfoStepWrapper-CO1Ai4CL.js.map +0 -1
  430. package/chunk/PersonalInfoStepWrapper-XIy5r6WD.js +0 -85
  431. package/chunk/PersonalInfoStepWrapper-XIy5r6WD.js.map +0 -1
  432. package/chunk/StepAgePersonalInfo-B_rJGRgX.js +0 -177
  433. package/chunk/StepAgePersonalInfo-B_rJGRgX.js.map +0 -1
  434. package/chunk/StepAgePersonalInfo-DJPM2PJz.js +0 -173
  435. package/chunk/StepAgePersonalInfo-DJPM2PJz.js.map +0 -1
  436. package/chunk/StepCollectIdentifier-D3Enfb3G.js +0 -62
  437. package/chunk/StepCollectIdentifier-D3Enfb3G.js.map +0 -1
  438. package/chunk/StepCollectIdentifier-DJsPPf_t.js +0 -66
  439. package/chunk/StepCollectIdentifier-DJsPPf_t.js.map +0 -1
  440. package/chunk/StepCollectMilitaryPersonalInfoComponent-CZaentAm.js +0 -250
  441. package/chunk/StepCollectMilitaryPersonalInfoComponent-CZaentAm.js.map +0 -1
  442. package/chunk/StepCollectMilitaryPersonalInfoComponent-Cd25YUFV.js +0 -246
  443. package/chunk/StepCollectMilitaryPersonalInfoComponent-Cd25YUFV.js.map +0 -1
  444. package/chunk/StepCollectPersonalInfo-BPw22iU2.js +0 -380
  445. package/chunk/StepCollectPersonalInfo-BPw22iU2.js.map +0 -1
  446. package/chunk/StepCollectPersonalInfo-PbZ_Lh5v.js +0 -384
  447. package/chunk/StepCollectPersonalInfo-PbZ_Lh5v.js.map +0 -1
  448. package/chunk/StepDocUpload-DAI4hd-K.js.map +0 -1
  449. package/chunk/StepDocUpload-DXj4mEM6.js.map +0 -1
  450. package/chunk/StepDriverLicensePersonalInfoComponent-CyWd-3C8.js +0 -144
  451. package/chunk/StepDriverLicensePersonalInfoComponent-CyWd-3C8.js.map +0 -1
  452. package/chunk/StepDriverLicensePersonalInfoComponent-DQzI18NJ.js +0 -148
  453. package/chunk/StepDriverLicensePersonalInfoComponent-DQzI18NJ.js.map +0 -1
  454. package/chunk/StepEmploymentPersonalInfo-BVeVxEtT.js +0 -222
  455. package/chunk/StepEmploymentPersonalInfo-BVeVxEtT.js.map +0 -1
  456. package/chunk/StepEmploymentPersonalInfo-DRdFErAM.js +0 -218
  457. package/chunk/StepEmploymentPersonalInfo-DRdFErAM.js.map +0 -1
  458. package/chunk/StepFirstResponderPersonalInfo-DYbPTeIq.js +0 -186
  459. package/chunk/StepFirstResponderPersonalInfo-DYbPTeIq.js.map +0 -1
  460. package/chunk/StepFirstResponderPersonalInfo-kH-D-gpm.js +0 -182
  461. package/chunk/StepFirstResponderPersonalInfo-kH-D-gpm.js.map +0 -1
  462. package/chunk/StepGeneralIdentityPersonalInfoComponent-BF7dYmjn.js +0 -177
  463. package/chunk/StepGeneralIdentityPersonalInfoComponent-BF7dYmjn.js.map +0 -1
  464. package/chunk/StepGeneralIdentityPersonalInfoComponent-DjEZH38x.js +0 -181
  465. package/chunk/StepGeneralIdentityPersonalInfoComponent-DjEZH38x.js.map +0 -1
  466. package/chunk/StepHybridIdentityPersonalInfoComponent-8Om7yEMT.js +0 -186
  467. package/chunk/StepHybridIdentityPersonalInfoComponent-8Om7yEMT.js.map +0 -1
  468. package/chunk/StepHybridIdentityPersonalInfoComponent-D9Je6yj-.js +0 -190
  469. package/chunk/StepHybridIdentityPersonalInfoComponent-D9Je6yj-.js.map +0 -1
  470. package/chunk/StepLicensedProfessionalPersonalInfo-AGQwXrgt.js +0 -182
  471. package/chunk/StepLicensedProfessionalPersonalInfo-AGQwXrgt.js.map +0 -1
  472. package/chunk/StepLicensedProfessionalPersonalInfo-ChdI7Jgm.js +0 -178
  473. package/chunk/StepLicensedProfessionalPersonalInfo-ChdI7Jgm.js.map +0 -1
  474. package/chunk/StepLowIncomePersonalInfo-Cl_eJwaC.js +0 -236
  475. package/chunk/StepLowIncomePersonalInfo-Cl_eJwaC.js.map +0 -1
  476. package/chunk/StepLowIncomePersonalInfo-DJjuE6iI.js +0 -232
  477. package/chunk/StepLowIncomePersonalInfo-DJjuE6iI.js.map +0 -1
  478. package/chunk/StepMedicalProfessionalPersonalInfo-CmAOUKJB.js +0 -209
  479. package/chunk/StepMedicalProfessionalPersonalInfo-CmAOUKJB.js.map +0 -1
  480. package/chunk/StepMedicalProfessionalPersonalInfo-snvlB1q5.js +0 -213
  481. package/chunk/StepMedicalProfessionalPersonalInfo-snvlB1q5.js.map +0 -1
  482. package/chunk/StepMemberPersonalInfo-CdX8LAGC.js +0 -160
  483. package/chunk/StepMemberPersonalInfo-CdX8LAGC.js.map +0 -1
  484. package/chunk/StepMemberPersonalInfo-PxKH7YN4.js +0 -156
  485. package/chunk/StepMemberPersonalInfo-PxKH7YN4.js.map +0 -1
  486. package/chunk/StepMoverPersonalInfo-MYGnyYc-.js +0 -147
  487. package/chunk/StepMoverPersonalInfo-MYGnyYc-.js.map +0 -1
  488. package/chunk/StepMoverPersonalInfo-u_-Eve-G.js +0 -143
  489. package/chunk/StepMoverPersonalInfo-u_-Eve-G.js.map +0 -1
  490. package/chunk/StepSSO-CybtMBjF.js +0 -12
  491. package/chunk/StepSSO-pglHGWRO.js +0 -8
  492. package/chunk/StepStudentPersonalInfo-Bb2UFiSf.js +0 -237
  493. package/chunk/StepStudentPersonalInfo-Bb2UFiSf.js.map +0 -1
  494. package/chunk/StepStudentPersonalInfo-BrV5nUQm.js +0 -233
  495. package/chunk/StepStudentPersonalInfo-BrV5nUQm.js.map +0 -1
  496. package/chunk/StepTeacherPersonalInfo-8xYbzOQu.js +0 -153
  497. package/chunk/StepTeacherPersonalInfo-8xYbzOQu.js.map +0 -1
  498. package/chunk/StepTeacherPersonalInfo-aiSuLSkE.js +0 -157
  499. package/chunk/StepTeacherPersonalInfo-aiSuLSkE.js.map +0 -1
  500. package/chunk/StepThirdPartyLoop-Bl9PW1-v.js +0 -8
  501. package/chunk/StepThirdPartyLoop-Cs_tIVeY.js +0 -12
  502. package/chunk/countryUtils-SAP2nHeP.js +0 -12
  503. package/chunk/empties-D2KXGsVY.js.map +0 -1
  504. package/chunk/hooks-Cjcd--GE.js.map +0 -1
  505. package/chunk/hooks-D72YoqAe.js.map +0 -1
  506. package/chunk/tslib.es6-BjMMQAso.js +0 -149
  507. package/chunk/tslib.es6-BjMMQAso.js.map +0 -1
  508. package/chunk/tslib.es6-DBUmCTli.js +0 -153
  509. package/chunk/tslib.es6-DBUmCTli.js.map +0 -1
  510. package/chunk/useFocusOnMount-CoKIEDuF.js +0 -18
@@ -1 +1 @@
1
- {"version":3,"file":"FormFieldTypeahead-BbMRLwcq.js","names":["createContext","useContext","createContext","useContext","useState","useCallback","useState","useCallback","useMemo","useState","useRef","_Fragment","useRef","GROUP_NAME","Collection","useCollection","createCollectionScope","ITEM_NAME","wrapArray","focusFirst","PopperPrimitive.Root","PopperPrimitive.Anchor","PORTAL_NAME","PortalPrimitive","CONTENT_NAME","RemoveScroll","RovingFocusGroup.Root","PopperPrimitive.Content","GROUP_NAME","LABEL_NAME","ITEM_NAME","RovingFocusGroup.Item","CHECKBOX_ITEM_NAME","RADIO_GROUP_NAME","RADIO_ITEM_NAME","SEPARATOR_NAME","ARROW_NAME","PopperPrimitive.Arrow","SUB_TRIGGER_NAME","SUB_CONTENT_NAME","Content2","Item2","MenuPrimitive.Root","MenuPrimitive.Anchor","MenuPrimitive.Portal","MenuPrimitive.Content","MenuPrimitive.Group","MenuPrimitive.Label","MenuPrimitive.Item","MenuPrimitive.CheckboxItem","MenuPrimitive.RadioGroup","MenuPrimitive.RadioItem","MenuPrimitive.ItemIndicator","MenuPrimitive.Separator","MenuPrimitive.Arrow","MenuPrimitive.SubTrigger","MenuPrimitive.SubContent","DropdownMenu.Root","DropdownMenu.Trigger","BarsArrowDownIcon","DropdownMenu.Content","DropdownMenu.Item","compute","debounce","PropTypes","React","useRef","useCallback","useMemo","Children","useMemo","useState","useRef","useCallback","debounce","_Fragment","useState","useRef","getSafe","useState","recordGaEvent","DEFAULT_LOCALE","__commonJSMin","__toESM","EventName","getSafe","getQueryParam","getLocaleSafely","getOptions","CustomMetricNames","assertValidFunction","require_react","require_jsx_runtime","_objectWithoutPropertiesLoose","_extends","require_react_is","useProgramConfiguration","logger","useMessage","LinkExternal","Message","fetchOrganization","useFlag","setRef","require_prop_types","FormattedHTMLMessage","dashed","useId","ReactRemoveScroll","dispatchDiscreteCustomEvent","Presence","composeRefs","Arrow","FocusScope","Content","LoadingSpinnerComponent","Primitive","useComposedRefs","createPopperScope","DismissableLayer","hideOthers","createSlot","Root2$1","useCallbackRef","useControllableState","createContextScope","useFocusGuards","Anchor","composeEventHandlers","getSafe$1","cn","getFormFieldLabelHtmlId","FormFieldLayout","Input","MetricIds","useMetrics","isCountrySelectionNeeded","import_react","SearchOverlayContext","useSearchOverlay","SearchRankingContext","useSearchRanking","useGeoLocation","location","setLocation","error","setError","loading","setLoading","loc","position","resolve","geoError","err","reject","import_jsx_runtime","SearchRankingProvider","sortMode","setSortMode","userLocation","setUserLocation","locationDenied","setLocationDenied","geoLocation","requestLocation","value","FOCUSABLE_SELECTOR","FALLBACK_PAGE_TINT","pageTint","foreground","themed","SearchOverlay","isOpen","setIsOpen","containerRef","showOverlay","enabled","scrollTo","setShowOverlay","inFrame","state","modalMax","currentHeight","handleKeyDown","container","focusableElements","firstElement","lastElement","closeSectionLabel","children","SelectedOrg","inputRef","org","inputValue","labelId","clearSelectionLabel","onClear","EARTH_RADIUS_KM","calculateDistance","toRadians","degrees","dLat","lat2","lat1","dLon","lon2","lon1","a","MILES_LOCALES","getDistanceUnit","locale","formatDistance","suffix","unit","distance","distanceKm","rounded","createCollection","PROVIDER_NAME","name","createCollectionContext","createCollectionScope","CollectionProviderImpl","useCollectionContext","CollectionProvider","props","ref","itemMap","COLLECTION_SLOT_NAME","CollectionSlotImpl","CollectionSlot","context","scope","composedRefs","forwardedRef","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlotImpl","CollectionItemSlot","itemData","useCollection","collectionNode","orderedNodes","b","DirectionContext","useDirection","globalDir","localDir","ENTRY_FOCUS","EVENT_OPTIONS","GROUP_NAME$2","Collection$1","useCollection$1","createCollectionScope$1","createRovingFocusGroupContext","createRovingFocusGroupScope","RovingFocusProvider","useRovingFocusContext","RovingFocusGroup","RovingFocusGroupImpl","currentTabStopIdProp","groupProps","direction","dir","currentTabStopId","setCurrentTabStopId","defaultCurrentTabStopId","onCurrentTabStopIdChange","isTabbingBackOut","setIsTabbingBackOut","handleEntryFocus","onEntryFocus","getItems","__scopeRovingFocusGroup","isClickFocusRef","focusableItemsCount","setFocusableItemsCount","node","tabStopId","prevCount","orientation","isKeyboardFocus","event","entryFocusEvent","items","item","preventScrollOnEntryFocus","ITEM_NAME$2","RovingFocusGroupItem","itemProps","autoId","id","isCurrentTabStop","focusable","onFocusableItemAdd","onFocusableItemRemove","focusIntent","getFocusIntent","candidateNodes","currentIndex","wrapArray$1","focusFirst$1","MAP_KEY_TO_FOCUS_INTENT","getDirectionAwareKey","key","PREVIOUSLY_FOCUSED_ELEMENT","candidate","candidates","array","startIndex","index","Root","Item","SELECTION_KEYS","FIRST_KEYS","LAST_KEYS","FIRST_LAST_KEYS","SUB_OPEN_KEYS","SUB_CLOSE_KEYS","MENU_NAME","Collection","createMenuContext","createMenuScope","usePopperScope","useRovingFocusGroupScope","MenuProvider","useMenuContext","MenuRootProvider","useMenuRootContext","Menu","popperScope","__scopeMenu","content","setContent","isUsingKeyboardRef","handleOpenChange","onOpenChange","handlePointer","ANCHOR_NAME","MenuAnchor","anchorProps","PortalProvider","usePortalContext","CONTENT_NAME$1","MenuContentProvider","useMenuContentContext","MenuContent","portalContext","contentProps","rootContext","forceMount","MenuRootContentModal","MenuRootContentNonModal","MenuContentImpl","Slot","rovingFocusGroupScope","currentItemId","setCurrentItemId","contentRef","timerRef","searchRef","pointerGraceTimerRef","pointerGraceIntentRef","pointerDirRef","lastPointerXRef","ScrollLockWrapper","disableOutsideScroll","scrollLockWrapperProps","handleTypeaheadSearch","search","currentItem","currentMatch","nextMatch","getNextMatch","newItem","updateSearch","isPointerMovingToSubmenu","isPointerInGraceArea","intent","trapFocus","onOpenAutoFocus","onCloseAutoFocus","getOpenState","isKeyDownInside","isModifierKey","isCharacterKey","focusFirst","whenMouse","target","pointerXHasChanged","newDir","GROUP_NAME$1","MenuGroup","LABEL_NAME$1","MenuLabel","labelProps","ITEM_NAME$1","ITEM_SELECT","MenuItem","contentContext","isPointerDownRef","handleSelect","menuItem","disabled","itemSelectEvent","onSelect","MenuItemImpl","isTypingAhead","isFocused","setIsFocused","textContent","setTextContent","textValue","CHECKBOX_ITEM_NAME$1","MenuCheckboxItem","checkboxItemProps","ItemIndicatorProvider","isIndeterminate","checked","getCheckedState","onCheckedChange","RADIO_GROUP_NAME$1","RadioGroupProvider","useRadioGroupContext","MenuRadioGroup","handleValueChange","onValueChange","RADIO_ITEM_NAME$1","MenuRadioItem","radioItemProps","ITEM_INDICATOR_NAME","useItemIndicatorContext","MenuItemIndicator","itemIndicatorProps","indicatorContext","SEPARATOR_NAME$1","MenuSeparator","separatorProps","ARROW_NAME$1","MenuArrow","arrowProps","MenuSubProvider","useMenuSubContext","SUB_TRIGGER_NAME$1","MenuSubTrigger","subContext","openTimerRef","clearOpenTimer","pointerGraceTimer","onPointerGraceIntentChange","contentRect","side","rightSide","bleed","contentNearEdge","contentFarEdge","SUB_CONTENT_NAME$1","MenuSubContent","subContentProps","isCloseKey","open","wrapArray","normalizedSearch","char","currentMatchIndex","values","wrappedValues","v","isPointInPolygon","point","inside","i","j","polygon","ii","jj","xi","yi","xj","yj","y","x","area","handler","Root3","Anchor2","Content2$1","Group","Label","Item2$1","CheckboxItem","RadioGroup","RadioItem","ItemIndicator","Separator","Arrow2","SubTrigger","SubContent","DROPDOWN_MENU_NAME","createDropdownMenuContext","createDropdownMenuScope","useMenuScope","DropdownMenuProvider","useDropdownMenuContext","DropdownMenu","openProp","menuScope","__scopeDropdownMenu","triggerRef","setOpen","defaultOpen","prevOpen","TRIGGER_NAME","DropdownMenuTrigger","triggerProps","CONTENT_NAME","DropdownMenuContent","hasInteractedOutsideRef","originalEvent","ctrlLeftClick","isRightClick","GROUP_NAME","DropdownMenuGroup","LABEL_NAME","DropdownMenuLabel","ITEM_NAME","DropdownMenuItem","CHECKBOX_ITEM_NAME","DropdownMenuCheckboxItem","RADIO_GROUP_NAME","DropdownMenuRadioGroup","radioGroupProps","RADIO_ITEM_NAME","DropdownMenuRadioItem","INDICATOR_NAME","DropdownMenuItemIndicator","SEPARATOR_NAME","DropdownMenuSeparator","ARROW_NAME","DropdownMenuArrow","SUB_TRIGGER_NAME","DropdownMenuSubTrigger","subTriggerProps","SUB_CONTENT_NAME","DropdownMenuSubContent","Root2","Trigger","Content2","Item2","BarsArrowDownIcon","svgRef","titleId","title","ForwardRef","SortDropdown","searchRanking","on","accessibilityLabel","sortByRelevanceLabel","sortByDistanceLabel","import_prop_types","t","e","n","o","r","l","c","f","u","g","p","m","w","W","H","M","E","C","I","R","T","B","F","V","k","D","L","s","d","h","S","X","Y","idCounter","generateId","useLatestRef","val","handleRefs$1","refs","callAllEventHandlers$1","fns","args","fn","debounce$1","timeoutId","cancel","wrapper","time","cleanupStatus","document","getStatusDiv","statusDiv","setStatus","status","div","cleanupStatusDiv","noop","validatePropTypes$1","getState","newState","scrollIntoView","menuNode","el","_ref","top","left","isOrContainsNode","parent","child","environment","debounce$2","callAllEventHandlers","handleRefs","isControlledProp","normalizeArrowKey","keyCode","getHighlightedIndex","circular","count","itemsLastIndex","start","offset","current","highlightedIndex","getNonDisabledIndex","isItemDisabled","backwards","_index","targetWithinDownshift","checkActiveElement","downshiftElements","contextNode","capitalizeString","string","callOnChangeProps","type","action","changes","keys","_i","_keys","invokeOnChangeHandler","useEnhancedReducer","prevStateRef","actionRef","propsRef","enhancedReducer","reducer","_React$useReducer","createInitialState","dispatch","prevState","isStateEqual","useControlledReducer$1","_useEnhancedReducer","getItemAndIndex","itemProp","indexProp","errorMessage","useIsInitialMount","isInitialMountRef","stateReducer","propTypes$5","getDefaultValue$1","defaultValue","propKey","defaultStateValues","getInitialValue$1","initialValue","updateA11yStatus","useA11yMessageStatus","isInitialMount","getA11yStatusMessage","options","dependencyArray","propTypes$4","defaultProps$3","defaultStateValues$1","useIsomorphicLayoutEffect","isAcceptedCharacterKey","getInitialState$3","selectedItem","getInitialHighlightedIndex","getHighlightedIndexOnOpen","initialHighlightedIndex","defaultHighlightedIndex","itemToKey","useMouseAndTouchTracker","mouseAndTouchTrackersRef","getDownshiftElements","downshiftRefs","onMouseDown","onMouseUp","handleBlur","onTouchStart","onTouchMove","onTouchEnd","useGetterPropsCalledChecker","useScrollIntoView","itemRefs","getItemNodeFromIndex","menuElement","scrollIntoViewProp","shouldScrollRef","useControlPropsValidator","getChangesOnSelection","shouldSelect","isDropdownsStateEqual","getDefaultHighlightedIndex","downshiftCommonReducer","stateChangeTypes","propTypes$3","defaultProps$2","getItemIndexByCharacterKey","keysSoFar","itemToString","lowerCasedKeysSoFar","offsetIndex","_item","ToggleButtonClick$1","ToggleButtonKeyDownArrowDown","ToggleButtonKeyDownArrowUp","ToggleButtonKeyDownCharacter","ToggleButtonKeyDownEscape","ToggleButtonKeyDownHome","ToggleButtonKeyDownEnd","ToggleButtonKeyDownEnter","ToggleButtonKeyDownSpaceButton","ToggleButtonKeyDownPageUp","ToggleButtonKeyDownPageDown","ToggleButtonBlur","MenuMouseLeave$1","ItemMouseMove$1","ItemClick$1","FunctionToggleMenu$1","FunctionOpenMenu$1","FunctionCloseMenu$1","FunctionSetHighlightedIndex$1","FunctionSelectItem$1","FunctionSetInputValue$1","FunctionReset$2","stateChangeTypes$3","downshiftSelectReducer","altKey","lowercasedKey","reactUseId$1","useElementIds$1","useElementIdsR18$1","useElementIdsLegacy$1","menuId","getItemId","toggleButtonId","inputId","reactId","_ref2","baseId","_excluded$3","_excluded2$3","_excluded3$2","_excluded4$1","useSelect","userProps","_useControlledReducer","toggleButtonRef","menuRef","clearTimeoutRef","elementIds","latest","mouseAndTouchTrackers","setGetterPropCallInfo","toggleButtonKeyDownHandlers","currentState","toggleMenu","closeMenu","openMenu","setHighlightedIndex","newHighlightedIndex","selectItem","newSelectedItem","reset","setInputValue","newInputValue","getLabelProps","_temp","onClick","_toggleButtonRef$curr","getMenuProps","_extends2","_temp2","onMouseLeave","_ref2$refKey","refKey","rest","_ref3$suppressRefErro","_temp3","_extends3","_ref4","_temp4","onBlur","onKeyDown","_ref4$refKey","_ref5$suppressRefErro","_temp5","suppressRefError","latestState","toggleButtonHandleClick","toggleButtonHandleBlur","toggleButtonHandleKeyDown","toggleProps","toggleButtonNode","_extends4","_ref6","_temp6","onMouseMove","_ref6$refKey","disabledProp","_latest$current","latestProps","_getItemAndIndex","itemHandleMouseMove","itemHandleClick","itemHandleMouseDown","itemNode","InputKeyDownArrowDown","InputKeyDownArrowUp","InputKeyDownEscape","InputKeyDownHome","InputKeyDownEnd","InputKeyDownPageUp","InputKeyDownPageDown","InputKeyDownEnter","InputChange","InputBlur","InputClick","MenuMouseLeave","ItemMouseMove","ItemClick","ToggleButtonClick","FunctionToggleMenu","FunctionOpenMenu","FunctionCloseMenu","FunctionSetHighlightedIndex","FunctionSelectItem","FunctionSetInputValue","FunctionReset$1","ControlledPropUpdatedSelectedItem","stateChangeTypes$2","getInitialState$2","initialState","propTypes$2","useControlledReducer","previousSelectedItemRef","defaultProps$1","downshiftUseComboboxReducer","_excluded$2","_excluded2$2","_excluded3$1","_excluded4","useCombobox","previousResultCountRef","_inputRef$current","inputKeyDownHandlers","_ref$refKey","_ref2$suppressRefErro","getItemProps","_ref3","_ref3$refKey","onSelectKey","customClickHandler","getToggleButtonProps","_ref5","_ref5$refKey","getInputProps","_extends5","onChange","onInput","_ref7$suppressRefErro","inputHandleKeyDown","inputHandleChange","inputHandleBlur","inputHandleClick","onChangeKey","eventHandlers","_eventHandlers","inputNode","getInitialValue","getDefaultValue","getInitialState$1","isKeyDownOperationPermitted","element","isStateEqual$1","defaultProps","validatePropTypes","SelectedItemClick","SelectedItemKeyDownDelete","SelectedItemKeyDownBackspace","SelectedItemKeyDownNavigationNext","SelectedItemKeyDownNavigationPrevious","DropdownKeyDownNavigationPrevious","DropdownKeyDownBackspace","DropdownClick","FunctionAddSelectedItem","FunctionRemoveSelectedItem","FunctionSetSelectedItems","FunctionSetActiveIndex","FunctionReset","stateChangeTypes$1","downshiftMultipleSelectionReducer","activeIndex","selectedItems","newActiveIndex","_newActiveIndex","selectedItemIndex","_excluded$1","_excluded2$1","useMultipleSelection","keyNavigationNext","keyNavigationPrevious","dropdownRef","selectedItemRefs","selectedItemKeyDownHandlers","dropdownKeyDownHandlers","selectedItemProp","isFocusable","selectedItemNode","_ref4$preventKeyActio","preventKeyAction","dropdownNode","newSelectedItems","TagClick","TagGroupKeyDownArrowLeft","TagGroupKeyDownArrowRight","TagGroupKeyDownDelete","TagGroupKeyDownBackspace","TagRemoveClick","FunctionAddItem","useTagGroupReducer","newItems","_newItems","_newItems2","_newActiveIndex2","reactUseId","useElementIds","useElementIdsR18","useElementIdsLegacy","tagGroupId","getTagId","getInitialState","oldState","A11Y_DESCRIPTION_ELEMENT_ID","useAccessibleDescription","accessibleDescriptionElement","description","getMergedProps","useRovingTagFocus","previousActiveIndexRef","previousItemsLengthRef","itemsLength","_itemRefs$current$get","propTypes","_excluded","_excluded2","_excluded3","_useTagGroup","getTagGroupProps","getTagProps","_options$refKey","handleClick","tagId","getTagRemoveProps","tagRemoveId","import_debounce","debounce","timeout","timestamp","result","wait","later","last","immediate","func","debounced","callNow","ROW_HEIGHT","MAX_ITEMS","OrganizationListComponent","childrenCount","fullHeight","organizations","overlayEnabled","distanceUnit","getDistanceDisplay","organization","elem","distanceDisplay","maxItemsToDisplay","LightbulbIcon","AddSchoolRequestRow","shouldShowTips","setShouldShowTips","urlAddSchoolForm","programId","trackEvent","onTipsShown","getSearchValue","orgSearchUrl","getAttribution","updateSearchUrl","searchValue","newParams","params","origin","pathname","FetchOrganizationsComponent","setOrganizations","isErrored","setIsErrored","mountedRef","prevSearchTermRef","searchRankingRef","searchTerm","doFetch","url","sv","loaded","fetchParams","ranking","fetchedOrganizations","currentSearchTerm","debouncedFetchRef","prevSearchTerm","minimumSearchValueLength","userLatitude","userLongitude","orgSearchAttribution","openOrgSearchEnabled","onClickAddSchool","handleStateChange","opts","TypeaheadClearButtonComponent","handleOnBlur","TypeaheadComponent","loadedOrgs","setLoadedOrgs","numReworksRef","startTimeRef","tipsShownRef","searchAfterTipsTrackedRef","showClearButton","setShowClearButton","disabledClearButton","setDisabledClearButton","inputHtmlId","selectedRank","timeUntilSelection","recordNumericMetric","handleInputChange","handleOnFocus","handleOnInteraction","className","isWarned","isRequired","ariaDescribedBy","msg","loadedOrganizations","isOpenOrganization","shouldCollectPostalCode","programConfiguration","viewModel","FormFieldTypeahead","labelHtmlId","fieldId","errorHtmlId","warningHtmlId","verificationService","countryChoiceValue","needToPickCountry","verificationResponse","autoFocus","setAutoFocus","showSearchOverlay","showSelectedOrgBox","showOpenOrgWarningOrange","showOpenOrgWarningGray","showOpenOrgWarningFlag","showOpenOrgWarning","setShowOpenOrgWarning","handleChange","newValue","openOrgWarningMessage","warningMsg","warningMessage","helperMsg","helperMessage","explanation"],"sources":["../../../packages/org-search/src/SearchOverlay/context.ts","../../../packages/org-search/src/SearchRanking/context.ts","../../../packages/org-search/src/hooks/useGeoLocation.ts","../../../packages/org-search/src/SearchRanking/SearchRankingProvider.tsx","../../../packages/org-search/src/SearchOverlay/SearchOverlay.tsx","../../../packages/org-search/src/SelectedOrg/SelectedOrg.tsx","../../../packages/org-search/src/utils/distance.ts","../../../node_modules/@radix-ui/react-collection/dist/index.mjs","../../../node_modules/@radix-ui/react-direction/dist/index.mjs","../../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs","../../../node_modules/@radix-ui/react-menu/dist/index.mjs","../../../node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs","../../../node_modules/@heroicons/react/24/outline/esm/BarsArrowDownIcon.js","../../../packages/org-search/src/SortDropdown/SortDropdown.tsx","../../../node_modules/compute-scroll-into-view/dist/index.js","../../../node_modules/downshift/dist/downshift.esm.mjs","../../../node_modules/debounce/index.js","../../src/components/OrganizationList/OrganizationListComponent.tsx","../../src/components/FetchOrganizationsComponent.tsx","../../src/components/FormInputs/Typeahead/TypeaheadComponentHelper.ts","../../src/components/FormInputs/Typeahead/TypeaheadClearButton/TypeaheadClearButtonComponent.tsx","../../src/components/FormInputs/Typeahead/TypeaheadComponent.tsx","../../src/lib/organization/organization.ts","../../src/components/FormFields/FormFieldTypeahead/FormFieldTypeahead.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\ntype SearchOverlayContext = {\n showOverlay: boolean;\n setShowOverlay: (open: boolean) => void;\n};\n\nexport const SearchOverlayContext = createContext<SearchOverlayContext>({\n showOverlay: false,\n setShowOverlay: () => undefined,\n});\n\nexport const useSearchOverlay = () => useContext(SearchOverlayContext);\n","import { createContext, useContext } from \"react\";\n\nimport type { GeoLocation } from \"../hooks/useGeoLocation\";\n\nexport type SortMode = \"relevance\" | \"distance\";\n\nexport type SearchRankingContextType = {\n sortMode: SortMode;\n userLocation: GeoLocation | null;\n locationDenied: boolean;\n setSortMode: (mode: SortMode) => void;\n requestLocation: () => Promise<GeoLocation>;\n};\n\nexport const SearchRankingContext = createContext<SearchRankingContextType | null>(null);\n\n/*\n * Will return null if not inside a SearchRanking context\n */\nexport const useSearchRanking = (): SearchRankingContextType | null => {\n const context = useContext(SearchRankingContext);\n return context;\n};\n","import { useState, useCallback } from \"react\";\n\nexport type GeoLocation = {\n latitude: number;\n longitude: number;\n};\n\nexport type GeoLocationError = {\n code: number;\n message: string;\n};\n\nexport type UseGeoLocationResult = {\n location: GeoLocation | null;\n error: GeoLocationError | null;\n loading: boolean;\n requestLocation: () => Promise<GeoLocation>;\n};\n\nexport function useGeoLocation(): UseGeoLocationResult {\n const [location, setLocation] = useState<GeoLocation | null>(null);\n const [error, setError] = useState<GeoLocationError | null>(null);\n const [loading, setLoading] = useState(false);\n\n const requestLocation = useCallback((): Promise<GeoLocation> => {\n setLoading(true);\n setError(null);\n\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n (position) => {\n const loc = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n };\n setLocation(loc);\n setLoading(false);\n resolve(loc);\n },\n (err) => {\n const geoError = { code: err.code, message: err.message };\n setError(geoError);\n setLoading(false);\n reject(geoError);\n },\n );\n });\n }, []);\n\n return {\n location,\n error,\n loading,\n requestLocation,\n };\n}\n","import type React from \"react\";\nimport { useState, useCallback, useMemo } from \"react\";\n\nimport { useGeoLocation, type GeoLocation } from \"../hooks/useGeoLocation\";\n\nimport { SearchRankingContext, type SortMode } from \"./context\";\n\ntype SearchRankingProviderProps = {\n children: React.ReactNode;\n};\n\nexport const SearchRankingProvider: React.FC<SearchRankingProviderProps> = ({ children }) => {\n const [sortMode, setSortMode] = useState<SortMode>(\"relevance\");\n const [userLocation, setUserLocation] = useState<GeoLocation | null>(null);\n const [locationDenied, setLocationDenied] = useState(false);\n const geoLocation = useGeoLocation();\n\n const requestLocation = useCallback(async (): Promise<GeoLocation> => {\n try {\n const location = await geoLocation.requestLocation();\n setUserLocation(location);\n setLocationDenied(false);\n return location;\n } catch {\n setLocationDenied(true);\n throw new Error(\"Location denied\");\n }\n }, [geoLocation]);\n\n const value = useMemo(\n () => ({\n sortMode,\n userLocation,\n locationDenied,\n setSortMode,\n requestLocation,\n }),\n [sortMode, userLocation, locationDenied, requestLocation],\n );\n\n return <SearchRankingContext.Provider value={value}>{children}</SearchRankingContext.Provider>;\n};\n","import type React from \"react\";\nimport { useEffect, useRef, useState, type PropsWithChildren, type ReactNode } from \"react\";\n\nimport { SearchRankingProvider } from \"../SearchRanking\";\n\nimport { SearchOverlayContext } from \"./context\";\n\ninterface Props {\n closeSectionLabel?: ReactNode;\n enabled: boolean;\n}\n\nconst FOCUSABLE_SELECTOR =\n 'button, a[href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n// The page behind the overlay gets the scrim's tint: the theme's text colour at 10%. The body sits\n// outside the themed element, where theme variables don't resolve, so the colour is read from\n// inside the overlay and written as a value.\nconst FALLBACK_PAGE_TINT = \"rgba(0,0,0,.1)\";\nconst pageTint = (themed: HTMLElement | null): string => {\n const foreground = themed && getComputedStyle(themed).getPropertyValue(\"--foreground\").trim();\n return foreground ? `color-mix(in oklab, ${foreground} 10%, transparent)` : FALLBACK_PAGE_TINT;\n};\n\nexport const SearchOverlay: React.FC<PropsWithChildren<Props>> = ({\n children,\n enabled,\n closeSectionLabel,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const showOverlay = enabled && isOpen;\n const scrollTo = useRef(0);\n\n /**\n * we're creating a full-screen modal. Thats mostly handled in the CSS. but we\n * don't want it to mess with the the underlying scroll. So we track the\n * existing scroll location, turn off scrolling & move to the top. Then we\n * undo that when we close.\n */\n const setShowOverlay = (state: boolean) => {\n if (!enabled) return;\n const inFrame = window !== window.top;\n\n if (state && isOpen === false) {\n scrollTo.current = window.scrollY;\n document.body.style.overflow = \"hidden\";\n document.body.style.backgroundColor = pageTint(containerRef.current);\n window.scrollTo({ top: 0 });\n\n // We're in a frame, hard set the iframe body element to the modal max\n // height or the current document height. Whichever is smaller.\n // When turning off the overlay we unset this.\n if (inFrame) {\n // calc(100vh - 80px) is the modal css max height\n // It would be nice to be able to do this entirely in css\n // but css lengths fall down a bit inside frames.\n const modalMax = window.screen.availHeight - 80;\n const currentHeight = document.body.clientHeight;\n\n document.body.style.height = `${Math.min(currentHeight, modalMax)}px`;\n }\n\n if (containerRef.current) {\n setTimeout(() => {\n containerRef.current.scrollIntoView();\n }, 0);\n }\n }\n\n if (!state && isOpen) {\n document.body.style.overflow = \"\";\n document.body.style.backgroundColor = \"\";\n window.scrollTo({ top: scrollTo.current });\n if (inFrame) {\n document.body.style.height = \"\";\n }\n }\n\n setIsOpen(state);\n };\n\n // Focus trapping: keep Tab/Shift+Tab within overlay, close on Escape\n useEffect(() => {\n if (!showOverlay) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\") return;\n\n const container = containerRef.current;\n if (!container) return;\n\n const focusableElements = container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n\n if (e.shiftKey && document.activeElement === firstElement) {\n e.preventDefault();\n lastElement?.focus();\n } else if (!e.shiftKey && document.activeElement === lastElement) {\n e.preventDefault();\n firstElement?.focus();\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown, true);\n return () => document.removeEventListener(\"keydown\", handleKeyDown, true);\n }, [showOverlay]);\n\n if (!enabled) {\n return <>{children}</>;\n }\n\n return (\n <SearchOverlayContext.Provider value={{ showOverlay, setShowOverlay }}>\n <SearchRankingProvider>\n <div className={showOverlay ? \"sid-search-overlay__overlay\" : undefined}>\n <div\n className={showOverlay ? \"sid-search-overlay__container\" : undefined}\n ref={containerRef}\n >\n {showOverlay && (\n <button className=\"sid-search-overlay__close\" onClick={() => setShowOverlay(false)}>\n {closeSectionLabel}\n </button>\n )}\n {children}\n </div>\n </div>\n </SearchRankingProvider>\n </SearchOverlayContext.Provider>\n );\n};\n","import type React from \"react\";\nimport { useEffect, useRef } from \"react\";\n\ntype Organization = {\n id: number;\n name: string;\n state?: string;\n city?: string;\n};\n\ninterface Props {\n org: Organization;\n onClear: () => void;\n clearSelectionLabel: string;\n labelId: string;\n}\n\nexport const SelectedOrg: React.FC<Props> = ({ org, onClear, clearSelectionLabel, labelId }) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const location = [org.city, org.state].filter(Boolean).join(\", \");\n const inputValue = [org.name, location].filter(Boolean).join(\", \");\n\n useEffect(() => {\n inputRef.current?.focus();\n }, []);\n\n return (\n <div className=\"sid-selected-org__wrapper\">\n <input\n ref={inputRef}\n className=\"sid-h-screen-reader-only\"\n type=\"text\"\n readOnly\n aria-labelledby={labelId}\n aria-expanded={false}\n value={inputValue}\n />\n <div className=\"sid-selected-org__container\">\n <div className=\"sid-selected-org__name\" aria-hidden=\"true\">\n {org.name}\n {location && <span className=\"sid-selected-org__location\">{location}</span>}\n </div>\n <button\n className=\"sid-selected-org__clear\"\n aria-label={clearSelectionLabel}\n onClick={onClear}\n >\n ✕\n </button>\n </div>\n </div>\n );\n};\n","export type DistanceUnit = \"miles\" | \"kilometers\";\n\nconst EARTH_RADIUS_KM = 6371;\n\n/**\n * Calculate the distance between two points using the Haversine formula\n * @returns Distance in kilometers\n */\nexport function calculateDistance(lat1: number, lon1: number, lat2: number, lon2: number): number {\n const toRadians = (degrees: number) => (degrees * Math.PI) / 180;\n\n const dLat = toRadians(lat2 - lat1);\n const dLon = toRadians(lon2 - lon1);\n\n const a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);\n\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return EARTH_RADIUS_KM * c;\n}\n\nconst MILES_LOCALES = [\"en-us\", \"en-gb\"];\n\n/**\n * Determine the appropriate distance unit based on locale\n * US and GB use miles, others use kilometers\n */\nexport function getDistanceUnit(locale: string): DistanceUnit {\n return MILES_LOCALES.includes(locale.toLowerCase()) ? \"miles\" : \"kilometers\";\n}\n\n/**\n * Format a distance value with the appropriate unit suffix\n * Distances < 10 show one decimal, >= 10 show whole number\n *\n * @param distanceKm in km\n * @param unit DistanceUnit\n *\n * If unit is miles, convert internally.\n */\nexport function formatDistance(distanceKm: number, unit: DistanceUnit): string {\n const suffix = unit === \"miles\" ? \"mi\" : \"km\";\n const distance = unit === \"miles\" ? distanceKm * 0.621371 : distanceKm;\n\n // Round to one decimal first to determine display format\n const rounded = Math.round(distance * 10) / 10;\n\n if (rounded >= 10) {\n return `${Math.round(distance)} ${suffix}`;\n }\n\n return `${rounded} ${suffix}`;\n}\n","\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n insert(index, key, value) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i];\n if (keys[i] === key) {\n nextKey = keys[i + 1];\n }\n if (has) {\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1];\n const currentValue = nextValue;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n find(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return void 0;\n }\n findIndex(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n filter(predicate, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new _OrderedDict(entries);\n }\n map(callbackfn, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new _OrderedDict(entries);\n }\n reduce(...args) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0);\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1);\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index);\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index);\n const element = this.get(key);\n reversed.set(key, element);\n }\n return reversed;\n }\n toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\n }\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index);\n const element = this.get(key);\n result.set(key, element);\n }\n return result;\n }\n every(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n some(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n};\nfunction at(array, index) {\n if (\"at\" in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0\n }\n );\n const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\n });\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\n if (a === b) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\") return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === \"childList\") {\n callback();\n return;\n }\n }\n });\n return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/direction/src/direction.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DirectionContext = React.createContext(void 0);\nvar DirectionProvider = (props) => {\n const { dir, children } = props;\n return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });\n};\nfunction useDirection(localDir) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\nvar Provider = DirectionProvider;\nexport {\n DirectionProvider,\n Provider,\n useDirection\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/roving-focus-group.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { jsx } from \"react/jsx-runtime\";\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = React.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ jsx(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: React.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: composeEventHandlers(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: composeEventHandlers(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n React.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n }),\n children: typeof children === \"function\" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\nexport {\n Item,\n Root,\n RovingFocusGroup,\n RovingFocusGroupItem,\n createRovingFocusGroupScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/menu.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs, composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\";\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useId } from \"@radix-ui/react-id\";\nimport * as PopperPrimitive from \"@radix-ui/react-popper\";\nimport { createPopperScope } from \"@radix-ui/react-popper\";\nimport { Portal as PortalPrimitive } from \"@radix-ui/react-portal\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport * as RovingFocusGroup from \"@radix-ui/react-roving-focus\";\nimport { createRovingFocusGroupScope } from \"@radix-ui/react-roving-focus\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { hideOthers } from \"aria-hidden\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { jsx } from \"react/jsx-runtime\";\nvar SELECTION_KEYS = [\"Enter\", \" \"];\nvar FIRST_KEYS = [\"ArrowDown\", \"PageUp\", \"Home\"];\nvar LAST_KEYS = [\"ArrowUp\", \"PageDown\", \"End\"];\nvar FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nvar SUB_OPEN_KEYS = {\n ltr: [...SELECTION_KEYS, \"ArrowRight\"],\n rtl: [...SELECTION_KEYS, \"ArrowLeft\"]\n};\nvar SUB_CLOSE_KEYS = {\n ltr: [\"ArrowLeft\"],\n rtl: [\"ArrowRight\"]\n};\nvar MENU_NAME = \"Menu\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(MENU_NAME);\nvar [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [\n createCollectionScope,\n createPopperScope,\n createRovingFocusGroupScope\n]);\nvar usePopperScope = createPopperScope();\nvar useRovingFocusGroupScope = createRovingFocusGroupScope();\nvar [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);\nvar [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);\nvar Menu = (props) => {\n const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;\n const popperScope = usePopperScope(__scopeMenu);\n const [content, setContent] = React.useState(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const direction = useDirection(dir);\n React.useEffect(() => {\n const handleKeyDown = () => {\n isUsingKeyboardRef.current = true;\n document.addEventListener(\"pointerdown\", handlePointer, { capture: true, once: true });\n document.addEventListener(\"pointermove\", handlePointer, { capture: true, once: true });\n };\n const handlePointer = () => isUsingKeyboardRef.current = false;\n document.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n document.removeEventListener(\"pointerdown\", handlePointer, { capture: true });\n document.removeEventListener(\"pointermove\", handlePointer, { capture: true });\n };\n }, []);\n return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx(\n MenuProvider,\n {\n scope: __scopeMenu,\n open,\n onOpenChange: handleOpenChange,\n content,\n onContentChange: setContent,\n children: /* @__PURE__ */ jsx(\n MenuRootProvider,\n {\n scope: __scopeMenu,\n onClose: React.useCallback(() => handleOpenChange(false), [handleOpenChange]),\n isUsingKeyboardRef,\n dir: direction,\n modal,\n children\n }\n )\n }\n ) });\n};\nMenu.displayName = MENU_NAME;\nvar ANCHOR_NAME = \"MenuAnchor\";\nvar MenuAnchor = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...anchorProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });\n }\n);\nMenuAnchor.displayName = ANCHOR_NAME;\nvar PORTAL_NAME = \"MenuPortal\";\nvar [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, {\n forceMount: void 0\n});\nvar MenuPortal = (props) => {\n const { __scopeMenu, forceMount, children, container } = props;\n const context = useMenuContext(PORTAL_NAME, __scopeMenu);\n return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children }) }) });\n};\nMenuPortal.displayName = PORTAL_NAME;\nvar CONTENT_NAME = \"MenuContent\";\nvar [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME);\nvar MenuContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });\n }\n);\nvar MenuRootContentModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n return /* @__PURE__ */ jsx(\n MenuContentImpl,\n {\n ...props,\n ref: composedRefs,\n trapFocus: context.open,\n disableOutsidePointerEvents: context.open,\n disableOutsideScroll: true,\n onFocusOutside: composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false }\n ),\n onDismiss: () => context.onOpenChange(false)\n }\n );\n }\n);\nvar MenuRootContentNonModal = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n return /* @__PURE__ */ jsx(\n MenuContentImpl,\n {\n ...props,\n ref: forwardedRef,\n trapFocus: false,\n disableOutsidePointerEvents: false,\n disableOutsideScroll: false,\n onDismiss: () => context.onOpenChange(false)\n }\n );\n});\nvar Slot = createSlot(\"MenuContent.ScrollLock\");\nvar MenuContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeMenu,\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEntryFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME, __scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const getItems = useCollection(__scopeMenu);\n const [currentItemId, setCurrentItemId] = React.useState(null);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);\n const timerRef = React.useRef(0);\n const searchRef = React.useRef(\"\");\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef(null);\n const pointerDirRef = React.useRef(\"right\");\n const lastPointerXRef = React.useRef(0);\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot, allowPinchZoom: true } : void 0;\n const handleTypeaheadSearch = (key) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n (function updateSearch(value) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== \"\") timerRef.current = window.setTimeout(() => updateSearch(\"\"), 1e3);\n })(search);\n if (newItem) {\n setTimeout(() => newItem.focus());\n }\n };\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n useFocusGuards();\n const isPointerMovingToSubmenu = React.useCallback((event) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n return /* @__PURE__ */ jsx(\n MenuContentProvider,\n {\n scope: __scopeMenu,\n searchRef,\n onItemEnter: React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n ),\n onItemLeave: React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu]\n ),\n onTriggerLeave: React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n ),\n pointerGraceTimerRef,\n onPointerGraceIntentChange: React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, []),\n children: /* @__PURE__ */ jsx(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx(\n FocusScope,\n {\n asChild: true,\n trapped: trapFocus,\n onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, (event) => {\n event.preventDefault();\n contentRef.current?.focus({ preventScroll: true });\n }),\n onUnmountAutoFocus: onCloseAutoFocus,\n children: /* @__PURE__ */ jsx(\n DismissableLayer,\n {\n asChild: true,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n children: /* @__PURE__ */ jsx(\n RovingFocusGroup.Root,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n dir: rootContext.dir,\n orientation: \"vertical\",\n loop,\n currentTabStopId: currentItemId,\n onCurrentTabStopIdChange: setCurrentItemId,\n onEntryFocus: composeEventHandlers(onEntryFocus, (event) => {\n if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();\n }),\n preventScrollOnEntryFocus: true,\n children: /* @__PURE__ */ jsx(\n PopperPrimitive.Content,\n {\n role: \"menu\",\n \"aria-orientation\": \"vertical\",\n \"data-state\": getOpenState(context.open),\n \"data-radix-menu-content\": \"\",\n dir: rootContext.dir,\n ...popperScope,\n ...contentProps,\n ref: composedRefs,\n style: { outline: \"none\", ...contentProps.style },\n onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {\n const target = event.target;\n const isKeyDownInside = target.closest(\"[data-radix-menu-content]\") === event.currentTarget;\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n const isCharacterKey = event.key.length === 1;\n if (isKeyDownInside) {\n if (event.key === \"Tab\") event.preventDefault();\n if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);\n }\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n }),\n onBlur: composeEventHandlers(props.onBlur, (event) => {\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = \"\";\n }\n }),\n onPointerMove: composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? \"right\" : \"left\";\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n })\n )\n }\n )\n }\n )\n }\n )\n }\n ) })\n }\n );\n }\n);\nMenuContent.displayName = CONTENT_NAME;\nvar GROUP_NAME = \"MenuGroup\";\nvar MenuGroup = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...groupProps } = props;\n return /* @__PURE__ */ jsx(Primitive.div, { role: \"group\", ...groupProps, ref: forwardedRef });\n }\n);\nMenuGroup.displayName = GROUP_NAME;\nvar LABEL_NAME = \"MenuLabel\";\nvar MenuLabel = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...labelProps } = props;\n return /* @__PURE__ */ jsx(Primitive.div, { ...labelProps, ref: forwardedRef });\n }\n);\nMenuLabel.displayName = LABEL_NAME;\nvar ITEM_NAME = \"MenuItem\";\nvar ITEM_SELECT = \"menu.itemSelect\";\nvar MenuItem = React.forwardRef(\n (props, forwardedRef) => {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef(null);\n const rootContext = useMenuRootContext(ITEM_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isPointerDownRef = React.useRef(false);\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) {\n isPointerDownRef.current = false;\n } else {\n rootContext.onClose();\n }\n }\n };\n return /* @__PURE__ */ jsx(\n MenuItemImpl,\n {\n ...itemProps,\n ref: composedRefs,\n disabled,\n onClick: composeEventHandlers(props.onClick, handleSelect),\n onPointerDown: (event) => {\n props.onPointerDown?.(event);\n isPointerDownRef.current = true;\n },\n onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {\n if (!isPointerDownRef.current) event.currentTarget?.click();\n }),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== \"\";\n if (disabled || isTypingAhead && event.key === \" \") return;\n if (SELECTION_KEYS.includes(event.key)) {\n event.currentTarget.click();\n event.preventDefault();\n }\n })\n }\n );\n }\n);\nMenuItem.displayName = ITEM_NAME;\nvar MenuItemImpl = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;\n const contentContext = useMenuContentContext(ITEM_NAME, __scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [isFocused, setIsFocused] = React.useState(false);\n const [textContent, setTextContent] = React.useState(\"\");\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? \"\").trim());\n }\n }, [itemProps.children]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeMenu,\n disabled,\n textValue: textValue ?? textContent,\n children: /* @__PURE__ */ jsx(RovingFocusGroup.Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n role: \"menuitem\",\n \"data-highlighted\": isFocused ? \"\" : void 0,\n \"aria-disabled\": disabled || void 0,\n \"data-disabled\": disabled ? \"\" : void 0,\n ...itemProps,\n ref: composedRefs,\n onPointerMove: composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus({ preventScroll: true });\n }\n }\n })\n ),\n onPointerLeave: composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event))\n ),\n onFocus: composeEventHandlers(props.onFocus, () => setIsFocused(true)),\n onBlur: composeEventHandlers(props.onBlur, () => setIsFocused(false))\n }\n ) })\n }\n );\n }\n);\nvar CHECKBOX_ITEM_NAME = \"MenuCheckboxItem\";\nvar MenuCheckboxItem = React.forwardRef(\n (props, forwardedRef) => {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return /* @__PURE__ */ jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx(\n MenuItem,\n {\n role: \"menuitemcheckbox\",\n \"aria-checked\": isIndeterminate(checked) ? \"mixed\" : checked,\n ...checkboxItemProps,\n ref: forwardedRef,\n \"data-state\": getCheckedState(checked),\n onSelect: composeEventHandlers(\n checkboxItemProps.onSelect,\n () => onCheckedChange?.(isIndeterminate(checked) ? true : !checked),\n { checkForDefaultPrevented: false }\n )\n }\n ) });\n }\n);\nMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\nvar RADIO_GROUP_NAME = \"MenuRadioGroup\";\nvar [RadioGroupProvider, useRadioGroupContext] = createMenuContext(\n RADIO_GROUP_NAME,\n { value: void 0, onValueChange: () => {\n } }\n);\nvar MenuRadioGroup = React.forwardRef(\n (props, forwardedRef) => {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n return /* @__PURE__ */ jsx(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsx(MenuGroup, { ...groupProps, ref: forwardedRef }) });\n }\n);\nMenuRadioGroup.displayName = RADIO_GROUP_NAME;\nvar RADIO_ITEM_NAME = \"MenuRadioItem\";\nvar MenuRadioItem = React.forwardRef(\n (props, forwardedRef) => {\n const { value, ...radioItemProps } = props;\n const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);\n const checked = value === context.value;\n return /* @__PURE__ */ jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx(\n MenuItem,\n {\n role: \"menuitemradio\",\n \"aria-checked\": checked,\n ...radioItemProps,\n ref: forwardedRef,\n \"data-state\": getCheckedState(checked),\n onSelect: composeEventHandlers(\n radioItemProps.onSelect,\n () => context.onValueChange?.(value),\n { checkForDefaultPrevented: false }\n )\n }\n ) });\n }\n);\nMenuRadioItem.displayName = RADIO_ITEM_NAME;\nvar ITEM_INDICATOR_NAME = \"MenuItemIndicator\";\nvar [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(\n ITEM_INDICATOR_NAME,\n { checked: false }\n);\nvar MenuItemIndicator = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;\n const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);\n return /* @__PURE__ */ jsx(\n Presence,\n {\n present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n ...itemIndicatorProps,\n ref: forwardedRef,\n \"data-state\": getCheckedState(indicatorContext.checked)\n }\n )\n }\n );\n }\n);\nMenuItemIndicator.displayName = ITEM_INDICATOR_NAME;\nvar SEPARATOR_NAME = \"MenuSeparator\";\nvar MenuSeparator = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...separatorProps } = props;\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n role: \"separator\",\n \"aria-orientation\": \"horizontal\",\n ...separatorProps,\n ref: forwardedRef\n }\n );\n }\n);\nMenuSeparator.displayName = SEPARATOR_NAME;\nvar ARROW_NAME = \"MenuArrow\";\nvar MenuArrow = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });\n }\n);\nMenuArrow.displayName = ARROW_NAME;\nvar SUB_NAME = \"MenuSub\";\nvar [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);\nvar MenuSub = (props) => {\n const { __scopeMenu, children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const [trigger, setTrigger] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx(\n MenuProvider,\n {\n scope: __scopeMenu,\n open,\n onOpenChange: handleOpenChange,\n content,\n onContentChange: setContent,\n children: /* @__PURE__ */ jsx(\n MenuSubProvider,\n {\n scope: __scopeMenu,\n contentId: useId(),\n triggerId: useId(),\n trigger,\n onTriggerChange: setTrigger,\n children\n }\n )\n }\n ) });\n};\nMenuSub.displayName = SUB_NAME;\nvar SUB_TRIGGER_NAME = \"MenuSubTrigger\";\nvar MenuSubTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const openTimerRef = React.useRef(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n const scope = { __scopeMenu: props.__scopeMenu };\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n return /* @__PURE__ */ jsx(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx(\n MenuItemImpl,\n {\n id: subContext.triggerId,\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": context.open,\n \"aria-controls\": subContext.contentId,\n \"data-state\": getOpenState(context.open),\n ...props,\n ref: composeRefs(forwardedRef, subContext.onTriggerChange),\n onClick: (event) => {\n props.onClick?.(event);\n if (props.disabled || event.defaultPrevented) return;\n event.currentTarget.focus();\n if (!context.open) context.onOpenChange(true);\n },\n onPointerMove: composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n })\n ),\n onPointerLeave: composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n const side = context.content?.dataset.side;\n const rightSide = side === \"right\";\n const bleed = rightSide ? -5 : 5;\n const contentNearEdge = contentRect[rightSide ? \"left\" : \"right\"];\n const contentFarEdge = contentRect[rightSide ? \"right\" : \"left\"];\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom }\n ],\n side\n });\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n contentContext.onPointerGraceIntentChange(null);\n }\n })\n ),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== \"\";\n if (props.disabled || isTypingAhead && event.key === \" \") return;\n if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {\n context.onOpenChange(true);\n context.content?.focus();\n event.preventDefault();\n }\n })\n }\n ) });\n }\n);\nMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\nvar SUB_CONTENT_NAME = \"MenuSubContent\";\nvar MenuSubContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, ...subContentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(\n MenuContentImpl,\n {\n id: subContext.contentId,\n \"aria-labelledby\": subContext.triggerId,\n ...subContentProps,\n ref: composedRefs,\n align: \"start\",\n side: rootContext.dir === \"rtl\" ? \"left\" : \"right\",\n disableOutsidePointerEvents: false,\n disableOutsideScroll: false,\n trapFocus: false,\n onOpenAutoFocus: (event) => {\n if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n },\n onCloseAutoFocus: (event) => event.preventDefault(),\n onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {\n if (event.target !== subContext.trigger) context.onOpenChange(false);\n }),\n onEscapeKeyDown: composeEventHandlers(props.onEscapeKeyDown, (event) => {\n rootContext.onClose();\n event.preventDefault();\n }),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n const isKeyDownInside = event.currentTarget.contains(event.target);\n const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n subContext.trigger?.focus();\n event.preventDefault();\n }\n })\n }\n ) }) }) });\n }\n);\nMenuSubContent.displayName = SUB_CONTENT_NAME;\nfunction getOpenState(open) {\n return open ? \"open\" : \"closed\";\n}\nfunction isIndeterminate(checked) {\n return checked === \"indeterminate\";\n}\nfunction getCheckedState(checked) {\n return isIndeterminate(checked) ? \"indeterminate\" : checked ? \"checked\" : \"unchecked\";\n}\nfunction focusFirst(candidates) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nfunction getNextMatch(values, search, currentMatch) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find(\n (value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase())\n );\n return nextMatch !== currentMatch ? nextMatch : void 0;\n}\nfunction isPointInPolygon(point, polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const ii = polygon[i];\n const jj = polygon[j];\n const xi = ii.x;\n const yi = ii.y;\n const xj = jj.x;\n const yj = jj.y;\n const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;\n if (intersect) inside = !inside;\n }\n return inside;\n}\nfunction isPointerInGraceArea(event, area) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\nfunction whenMouse(handler) {\n return (event) => event.pointerType === \"mouse\" ? handler(event) : void 0;\n}\nvar Root3 = Menu;\nvar Anchor2 = MenuAnchor;\nvar Portal = MenuPortal;\nvar Content2 = MenuContent;\nvar Group = MenuGroup;\nvar Label = MenuLabel;\nvar Item2 = MenuItem;\nvar CheckboxItem = MenuCheckboxItem;\nvar RadioGroup = MenuRadioGroup;\nvar RadioItem = MenuRadioItem;\nvar ItemIndicator = MenuItemIndicator;\nvar Separator = MenuSeparator;\nvar Arrow2 = MenuArrow;\nvar Sub = MenuSub;\nvar SubTrigger = MenuSubTrigger;\nvar SubContent = MenuSubContent;\nexport {\n Anchor2 as Anchor,\n Arrow2 as Arrow,\n CheckboxItem,\n Content2 as Content,\n Group,\n Item2 as Item,\n ItemIndicator,\n Label,\n Menu,\n MenuAnchor,\n MenuArrow,\n MenuCheckboxItem,\n MenuContent,\n MenuGroup,\n MenuItem,\n MenuItemIndicator,\n MenuLabel,\n MenuPortal,\n MenuRadioGroup,\n MenuRadioItem,\n MenuSeparator,\n MenuSub,\n MenuSubContent,\n MenuSubTrigger,\n Portal,\n RadioGroup,\n RadioItem,\n Root3 as Root,\n Separator,\n Sub,\n SubContent,\n SubTrigger,\n createMenuScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/dropdown-menu.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport * as MenuPrimitive from \"@radix-ui/react-menu\";\nimport { createMenuScope } from \"@radix-ui/react-menu\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DROPDOWN_MENU_NAME = \"DropdownMenu\";\nvar [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nvar useMenuScope = createMenuScope();\nvar [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);\nvar DropdownMenu = (props) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef(null);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: DROPDOWN_MENU_NAME\n });\n return /* @__PURE__ */ jsx(\n DropdownMenuProvider,\n {\n scope: __scopeDropdownMenu,\n triggerId: useId(),\n triggerRef,\n contentId: useId(),\n open,\n onOpenChange: setOpen,\n onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),\n modal,\n children: /* @__PURE__ */ jsx(MenuPrimitive.Root, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })\n }\n );\n};\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\nvar TRIGGER_NAME = \"DropdownMenuTrigger\";\nvar DropdownMenuTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n id: context.triggerId,\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": context.open,\n \"aria-controls\": context.open ? context.contentId : void 0,\n \"data-state\": context.open ? \"open\" : \"closed\",\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n ...triggerProps,\n ref: composeRefs(forwardedRef, context.triggerRef),\n onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n if (!context.open) event.preventDefault();\n }\n }),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if ([\"Enter\", \" \"].includes(event.key)) context.onOpenToggle();\n if (event.key === \"ArrowDown\") context.onOpenChange(true);\n if ([\"Enter\", \" \", \"ArrowDown\"].includes(event.key)) event.preventDefault();\n })\n }\n ) });\n }\n);\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\nvar PORTAL_NAME = \"DropdownMenuPortal\";\nvar DropdownMenuPortal = (props) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Portal, { ...menuScope, ...portalProps });\n};\nDropdownMenuPortal.displayName = PORTAL_NAME;\nvar CONTENT_NAME = \"DropdownMenuContent\";\nvar DropdownMenuContent = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n return /* @__PURE__ */ jsx(\n MenuPrimitive.Content,\n {\n id: context.contentId,\n \"aria-labelledby\": context.triggerId,\n ...menuScope,\n ...contentProps,\n ref: forwardedRef,\n onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n event.preventDefault();\n }),\n onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n }),\n style: {\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n \"--radix-dropdown-menu-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"--radix-dropdown-menu-content-available-width\": \"var(--radix-popper-available-width)\",\n \"--radix-dropdown-menu-content-available-height\": \"var(--radix-popper-available-height)\",\n \"--radix-dropdown-menu-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"--radix-dropdown-menu-trigger-height\": \"var(--radix-popper-anchor-height)\"\n }\n }\n }\n );\n }\n);\nDropdownMenuContent.displayName = CONTENT_NAME;\nvar GROUP_NAME = \"DropdownMenuGroup\";\nvar DropdownMenuGroup = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef });\n }\n);\nDropdownMenuGroup.displayName = GROUP_NAME;\nvar LABEL_NAME = \"DropdownMenuLabel\";\nvar DropdownMenuLabel = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef });\n }\n);\nDropdownMenuLabel.displayName = LABEL_NAME;\nvar ITEM_NAME = \"DropdownMenuItem\";\nvar DropdownMenuItem = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });\n }\n);\nDropdownMenuItem.displayName = ITEM_NAME;\nvar CHECKBOX_ITEM_NAME = \"DropdownMenuCheckboxItem\";\nvar DropdownMenuCheckboxItem = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });\n});\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\nvar RADIO_GROUP_NAME = \"DropdownMenuRadioGroup\";\nvar DropdownMenuRadioGroup = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });\n});\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\nvar RADIO_ITEM_NAME = \"DropdownMenuRadioItem\";\nvar DropdownMenuRadioItem = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });\n});\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\nvar INDICATOR_NAME = \"DropdownMenuItemIndicator\";\nvar DropdownMenuItemIndicator = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });\n});\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\nvar SEPARATOR_NAME = \"DropdownMenuSeparator\";\nvar DropdownMenuSeparator = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });\n});\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\nvar ARROW_NAME = \"DropdownMenuArrow\";\nvar DropdownMenuArrow = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });\n }\n);\nDropdownMenuArrow.displayName = ARROW_NAME;\nvar DropdownMenuSub = (props) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: \"DropdownMenuSub\"\n });\n return /* @__PURE__ */ jsx(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children });\n};\nvar SUB_TRIGGER_NAME = \"DropdownMenuSubTrigger\";\nvar DropdownMenuSubTrigger = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });\n});\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\nvar SUB_CONTENT_NAME = \"DropdownMenuSubContent\";\nvar DropdownMenuSubContent = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(\n MenuPrimitive.SubContent,\n {\n ...menuScope,\n ...subContentProps,\n ref: forwardedRef,\n style: {\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n \"--radix-dropdown-menu-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"--radix-dropdown-menu-content-available-width\": \"var(--radix-popper-available-width)\",\n \"--radix-dropdown-menu-content-available-height\": \"var(--radix-popper-available-height)\",\n \"--radix-dropdown-menu-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"--radix-dropdown-menu-trigger-height\": \"var(--radix-popper-anchor-height)\"\n }\n }\n }\n );\n});\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\nvar Root2 = DropdownMenu;\nvar Trigger = DropdownMenuTrigger;\nvar Portal2 = DropdownMenuPortal;\nvar Content2 = DropdownMenuContent;\nvar Group2 = DropdownMenuGroup;\nvar Label2 = DropdownMenuLabel;\nvar Item2 = DropdownMenuItem;\nvar CheckboxItem2 = DropdownMenuCheckboxItem;\nvar RadioGroup2 = DropdownMenuRadioGroup;\nvar RadioItem2 = DropdownMenuRadioItem;\nvar ItemIndicator2 = DropdownMenuItemIndicator;\nvar Separator2 = DropdownMenuSeparator;\nvar Arrow2 = DropdownMenuArrow;\nvar Sub2 = DropdownMenuSub;\nvar SubTrigger2 = DropdownMenuSubTrigger;\nvar SubContent2 = DropdownMenuSubContent;\nexport {\n Arrow2 as Arrow,\n CheckboxItem2 as CheckboxItem,\n Content2 as Content,\n DropdownMenu,\n DropdownMenuArrow,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuItemIndicator,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n Group2 as Group,\n Item2 as Item,\n ItemIndicator2 as ItemIndicator,\n Label2 as Label,\n Portal2 as Portal,\n RadioGroup2 as RadioGroup,\n RadioItem2 as RadioItem,\n Root2 as Root,\n Separator2 as Separator,\n Sub2 as Sub,\n SubContent2 as SubContent,\n SubTrigger2 as SubTrigger,\n Trigger,\n createDropdownMenuScope\n};\n//# sourceMappingURL=index.mjs.map\n","import * as React from \"react\";\nfunction BarsArrowDownIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0-3.75-3.75M17.25 21 21 17.25\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(BarsArrowDownIcon);\nexport default ForwardRef;","import type React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { BarsArrowDownIcon } from \"@heroicons/react/24/outline\";\n\nimport { useSearchRanking } from \"../SearchRanking/context\";\n\nexport type SortDropdownProps = {\n sortByRelevanceLabel: string;\n sortByDistanceLabel: string;\n accessibilityLabel: string;\n // metrics events\n on?: (event: \"openSortMenu\" | \"sortDistance\" | \"sortRelevance\") => void;\n};\n\nexport const SortDropdown: React.FC<SortDropdownProps> = ({\n sortByRelevanceLabel,\n sortByDistanceLabel,\n accessibilityLabel,\n on = () => {}, // default no-op\n}) => {\n const searchRanking = useSearchRanking();\n if (!searchRanking) {\n throw new Error(\"SortDropdown must be used within a SearchRankingProvider\");\n }\n const { sortMode, setSortMode, requestLocation, locationDenied } = searchRanking;\n\n const handleRelevanceClick = () => {\n setSortMode(\"relevance\");\n on(\"sortRelevance\");\n };\n\n const handleDistanceClick = async () => {\n if (locationDenied) return;\n\n try {\n await requestLocation();\n setSortMode(\"distance\");\n on(\"sortDistance\");\n } catch {\n // Location denied - state is updated by requestLocation\n }\n };\n\n return (\n <DropdownMenu.Root onOpenChange={(isOpen) => isOpen && on(\"openSortMenu\")}>\n <DropdownMenu.Trigger asChild>\n <button\n type=\"button\"\n className=\"sid-sort-dropdown__trigger\"\n aria-label={accessibilityLabel}\n >\n <BarsArrowDownIcon className=\"sid-sort-dropdown__icon\" />\n </button>\n </DropdownMenu.Trigger>\n\n <DropdownMenu.Content\n className=\"sid-sort-dropdown__content\"\n sideOffset={0}\n collisionPadding={10}\n align=\"end\"\n >\n <DropdownMenu.Item\n className=\"sid-sort-dropdown__item\"\n onSelect={handleRelevanceClick}\n data-active={sortMode === \"relevance\" ? \"\" : undefined}\n >\n {sortByRelevanceLabel}\n </DropdownMenu.Item>\n\n <DropdownMenu.Item\n className=\"sid-sort-dropdown__item\"\n onSelect={handleDistanceClick}\n disabled={locationDenied}\n data-active={sortMode === \"distance\" ? \"\" : undefined}\n >\n {sortByDistanceLabel}\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n );\n};\n","const t=t=>\"object\"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||\"hidden\"!==t)&&(\"visible\"!==t&&\"clip\"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return!1},o=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if(\"undefined\"==typeof document)return[];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p=\"function\"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError(\"Invalid target\");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W)}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k=\"start\"===f||\"nearest\"===f?x-T:\"end\"===f?I+F:x+v/2-T+F,D=\"center\"===u?R+E/2-V+B:\"end\"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:l,width:r,top:i,right:s,bottom:d,left:h}=e.getBoundingClientRect();if(\"if-needed\"===c&&x>=0&&R>=0&&I<=H&&C<=b&&(e===m&&!n(e)||x>=i&&I<=d&&R>=h&&C<=s))return L;const a=getComputedStyle(e),g=parseInt(a.borderLeftWidth,10),p=parseInt(a.borderTopWidth,10),W=parseInt(a.borderRightWidth,10),T=parseInt(a.borderBottomWidth,10);let B=0,F=0;const V=\"offsetWidth\"in e?e.offsetWidth-e.clientWidth-g-W:0,S=\"offsetHeight\"in e?e.offsetHeight-e.clientHeight-p-T:0,X=\"offsetWidth\"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,Y=\"offsetHeight\"in e?0===e.offsetHeight?0:l/e.offsetHeight:0;if(m===e)B=\"start\"===f?k:\"end\"===f?k-H:\"nearest\"===f?o(M,M+H,H,p,T,M+k,M+k+v,v):k-H/2,F=\"start\"===u?D:\"center\"===u?D-b/2:\"end\"===u?D-b:o(y,y+b,b,g,W,y+D,y+D+E,E),B=Math.max(0,B+M),F=Math.max(0,F+y);else{B=\"start\"===f?k-i-p:\"end\"===f?k-d+T+S:\"nearest\"===f?o(i,d,l,p,T+S,k,k+v,v):k-(i+l/2)+S/2,F=\"start\"===u?D-h-g:\"center\"===u?D-(h+r/2)+V/2:\"end\"===u?D-s+W+V:o(h,s,r,g,W+V,D,D+E,E);const{scrollLeft:t,scrollTop:n}=e;B=0===Y?0:Math.max(0,Math.min(n+B/Y,e.scrollHeight-l/Y+S)),F=0===X?0:Math.max(0,Math.min(t+F/X,e.scrollWidth-r/X+V)),k+=n-B,D+=t-F}L.push({el:e,top:B,left:F})}return L};export{r as compute};//# sourceMappingURL=index.js.map\n","import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport PropTypes from 'prop-types';\nimport * as React from 'react';\nimport { cloneElement, Component, useRef, useCallback, useEffect, useMemo } from 'react';\nimport { isForwardRef } from 'react-is';\nimport { compute } from 'compute-scroll-into-view';\n\nvar unknown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_unknown__' : 0;\nvar mouseUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_mouseup__' : 1;\nvar itemMouseEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_item_mouseenter__' : 2;\nvar keyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_up__' : 3;\nvar keyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_down__' : 4;\nvar keyDownEscape = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_escape__' : 5;\nvar keyDownEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_enter__' : 6;\nvar keyDownHome = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_home__' : 7;\nvar keyDownEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_end__' : 8;\nvar clickItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_item__' : 9;\nvar blurInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_input__' : 10;\nvar changeInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_change_input__' : 11;\nvar keyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_space_button__' : 12;\nvar clickButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_button__' : 13;\nvar blurButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_button__' : 14;\nvar controlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_controlled_prop_updated_selected_item__' : 15;\nvar touchEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_touchend__' : 16;\n\nvar stateChangeTypes$4 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n blurButton: blurButton,\n blurInput: blurInput,\n changeInput: changeInput,\n clickButton: clickButton,\n clickItem: clickItem,\n controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,\n itemMouseEnter: itemMouseEnter,\n keyDownArrowDown: keyDownArrowDown,\n keyDownArrowUp: keyDownArrowUp,\n keyDownEnd: keyDownEnd,\n keyDownEnter: keyDownEnter,\n keyDownEscape: keyDownEscape,\n keyDownHome: keyDownHome,\n keyDownSpaceButton: keyDownSpaceButton,\n mouseUp: mouseUp,\n touchEnd: touchEnd,\n unknown: unknown\n});\n\nvar idCounter = 0;\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {string} the unique ID\n */\nfunction generateId() {\n return String(idCounter++);\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n // istanbul ignore next\n if ('useId' in React) {\n console.warn(\"It is not necessary to call resetIdCounter when using React 18+\");\n return;\n }\n idCounter = 0;\n}\n\nfunction useLatestRef(val) {\n var ref = React.useRef(val);\n // technically this is not \"concurrent mode safe\" because we're manipulating\n // the value during render (so it's not idempotent). However, the places this\n // hook is used is to support memoizing callbacks which will be called\n // *during* render, so we need the latest values *during* render.\n // If not for this, then we'd probably want to use useLayoutEffect instead.\n ref.current = val;\n return ref;\n}\n\nfunction handleRefs$1() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n return function (node) {\n refs.forEach(function (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n });\n };\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param fns the event handler functions\n * @return the event handler to add to an element\n */\nfunction callAllEventHandlers$1() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n return function (event) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n return fns.some(function (fn) {\n if (fn) {\n fn.apply(void 0, [event].concat(args));\n }\n return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;\n });\n };\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n */\nfunction debounce$1(fn, time) {\n var timeoutId;\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n function wrapper() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n cancel();\n timeoutId = setTimeout(function () {\n timeoutId = null;\n fn.apply(void 0, args);\n }, time);\n }\n wrapper.cancel = cancel;\n return wrapper;\n}\n\nvar cleanupStatus = debounce$1(function (document) {\n getStatusDiv(document).textContent = '';\n}, 500);\n\n/**\n * Get the status node or create it if it does not already exist.\n */\nfunction getStatusDiv(document) {\n var statusDiv = document.getElementById('a11y-status-message');\n if (statusDiv) {\n return statusDiv;\n }\n statusDiv = document.createElement('div');\n statusDiv.setAttribute('id', 'a11y-status-message');\n statusDiv.setAttribute('role', 'status');\n statusDiv.setAttribute('aria-live', 'polite');\n statusDiv.setAttribute('aria-relevant', 'additions text');\n Object.assign(statusDiv.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px'\n });\n document.body.appendChild(statusDiv);\n return statusDiv;\n}\n\n/**\n * Sets aria live status to a div element that's visually hidden.\n */\nfunction setStatus(status, document) {\n if (!status || !document) {\n return;\n }\n var div = getStatusDiv(document);\n div.textContent = status;\n cleanupStatus(document);\n}\n\n/**\n * Removes the status element from the DOM\n */\nfunction cleanupStatusDiv(document) {\n var statusDiv = document == null ? void 0 : document.getElementById('a11y-status-message');\n if (statusDiv) {\n statusDiv.remove();\n }\n}\n\nfunction noop() {}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes$1 = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes$1 = function validatePropTypes(options, caller, propTypes) {\n PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name);\n };\n}\n\n/**\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param state The state of the component/hook.\n * @param props The props that may contain controlled values.\n * @returns The merged controlled state.\n */\nfunction getState(state, props) {\n if (!props) {\n return state;\n }\n var keys = Object.keys(state);\n return keys.reduce(function (newState, key) {\n if (props[key] !== undefined) {\n newState[key] = props[key];\n }\n return newState;\n }, _extends({}, state));\n}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} menuNode the menu element of the component\n */\nfunction scrollIntoView(node, menuNode) {\n if (!node) {\n return;\n }\n var actions = compute(node, {\n boundary: menuNode,\n block: 'nearest',\n scrollMode: 'if-needed'\n });\n actions.forEach(function (_ref) {\n var el = _ref.el,\n top = _ref.top,\n left = _ref.left;\n el.scrollTop = top;\n el.scrollLeft = left;\n });\n}\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n return typeof cb === 'function' ? cb : noop;\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @param {Window} environment The window context where downshift renders.\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child, environment) {\n var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);\n return result;\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n var timeoutId;\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n function wrapper() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n cancel();\n timeoutId = setTimeout(function () {\n timeoutId = null;\n fn.apply(void 0, args);\n }, time);\n }\n wrapper.cancel = cancel;\n return wrapper;\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers() {\n for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n fns[_key2] = arguments[_key2];\n }\n return function (event) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n return fns.some(function (fn) {\n if (fn) {\n fn.apply(void 0, [event].concat(args));\n }\n return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;\n });\n };\n}\nfunction handleRefs() {\n for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n refs[_key4] = arguments[_key4];\n }\n return function (node) {\n refs.forEach(function (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n });\n };\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specify if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage(_ref) {\n var isOpen = _ref.isOpen,\n resultCount = _ref.resultCount,\n previousResultCount = _ref.previousResultCount;\n if (!isOpen) {\n return '';\n }\n if (!resultCount) {\n return 'No results are available.';\n }\n if (resultCount !== previousResultCount) {\n return resultCount + \" result\" + (resultCount === 1 ? ' is' : 's are') + \" available, use up and down arrow keys to navigate. Press Enter key to select.\";\n }\n return '';\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */arg[0] : arg;\n if (!arg && defaultValue) {\n return defaultValue;\n } else {\n return arg;\n }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n\n // then we assume this is react\n return typeof element.type === 'string';\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n return element.props;\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n // eslint-disable-next-line no-console\n console.error(\"The property \\\"\" + propName + \"\\\" is required in \\\"\" + fnName + \"\\\"\");\n}\nvar stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state) {\n if (state === void 0) {\n state = {};\n }\n var result = {};\n stateKeys.forEach(function (k) {\n if (state.hasOwnProperty(k)) {\n result[k] = state[k];\n }\n });\n return result;\n}\n\n/**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n *\n * @param {Object} props The props that may contain controlled values.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\nfunction isControlledProp(props, key) {\n return props[key] !== undefined;\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n var key = event.key,\n keyCode = event.keyCode;\n /* istanbul ignore next (ie) */\n if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n return \"Arrow\" + key;\n }\n return key;\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\n/**\n * Returns the next non-disabled highlightedIndex value.\n *\n * @param {number} start The current highlightedIndex.\n * @param {number} offset The offset from the current highlightedIndex to start searching.\n * @param {unknown[]} items The items array.\n * @param {(item: unknown, index: number) => boolean} isItemDisabled Function that tells if an item is disabled or not.\n * @param {boolean?} circular If the search reaches the end, if it can search again starting from the other end.\n * @returns {number} The next highlightedIndex.\n */\nfunction getHighlightedIndex(start, offset, items, isItemDisabled, circular) {\n if (circular === void 0) {\n circular = false;\n }\n var count = items.length;\n if (count === 0) {\n return -1;\n }\n var itemsLastIndex = count - 1;\n if (typeof start !== 'number' || start < 0 || start > itemsLastIndex) {\n start = offset > 0 ? -1 : itemsLastIndex + 1;\n }\n var current = start + offset;\n if (current < 0) {\n current = circular ? itemsLastIndex : 0;\n } else if (current > itemsLastIndex) {\n current = circular ? 0 : itemsLastIndex;\n }\n var highlightedIndex = getNonDisabledIndex(current, offset < 0, items, isItemDisabled, circular);\n if (highlightedIndex === -1) {\n return start >= count ? -1 : start;\n }\n return highlightedIndex;\n}\n\n/**\n * Returns the next non-disabled highlightedIndex value.\n *\n * @param {number} start The current highlightedIndex.\n * @param {boolean} backwards If true, it will search backwards from the start.\n * @param {unknown[]} items The items array.\n * @param {(item: unknown, index: number) => boolean} isItemDisabled Function that tells if an item is disabled or not.\n * @param {boolean} circular If the search reaches the end, if it can search again starting from the other end.\n * @returns {number} The next non-disabled index.\n */\nfunction getNonDisabledIndex(start, backwards, items, isItemDisabled, circular) {\n if (circular === void 0) {\n circular = false;\n }\n var count = items.length;\n if (backwards) {\n for (var index = start; index >= 0; index--) {\n if (!isItemDisabled(items[index], index)) {\n return index;\n }\n }\n } else {\n for (var _index = start; _index < count; _index++) {\n if (!isItemDisabled(items[_index], _index)) {\n return _index;\n }\n }\n }\n if (circular) {\n return getNonDisabledIndex(backwards ? count - 1 : 0, backwards, items, isItemDisabled);\n }\n return -1;\n}\n\n/**\n * Checks if event target is within the downshift elements.\n *\n * @param {EventTarget} target Target to check.\n * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).\n * @param {Window} environment The window context where downshift renders.\n * @param {boolean} checkActiveElement Whether to also check activeElement.\n *\n * @returns {boolean} Whether or not the target is within downshift elements.\n */\nfunction targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {\n if (checkActiveElement === void 0) {\n checkActiveElement = true;\n }\n return environment && downshiftElements.some(function (contextNode) {\n return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));\n });\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validateControlledUnchanged = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged = function validateControlledUnchanged(state, prevProps, nextProps) {\n var warningDescription = \"This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props\";\n Object.keys(state).forEach(function (propKey) {\n if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: A component has changed the controlled prop \\\"\" + propKey + \"\\\" to be uncontrolled. \" + warningDescription);\n } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: A component has changed the uncontrolled prop \\\"\" + propKey + \"\\\" to be controlled. \" + warningDescription);\n }\n });\n };\n}\n\nvar _excluded$4 = [\"refKey\", \"ref\"],\n _excluded2$4 = [\"onClick\", \"onPress\", \"onKeyDown\", \"onKeyUp\", \"onBlur\"],\n _excluded3$3 = [\"onKeyDown\", \"onBlur\", \"onChange\", \"onInput\", \"onChangeText\"],\n _excluded4$2 = [\"refKey\", \"ref\"],\n _excluded5 = [\"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"index\", \"item\"];\nvar Downshift = /*#__PURE__*/function () {\n var Downshift = /*#__PURE__*/function (_Component) {\n function Downshift(_props) {\n var _this;\n _this = _Component.call(this, _props) || this;\n // fancy destructuring + defaults + aliases\n // this basically says each value of state should either be set to\n // the initial value or the default value if the initial value is not provided\n _this.id = _this.props.id || \"downshift-\" + generateId();\n _this.menuId = _this.props.menuId || _this.id + \"-menu\";\n _this.labelId = _this.props.labelId || _this.id + \"-label\";\n _this.inputId = _this.props.inputId || _this.id + \"-input\";\n _this.getItemId = _this.props.getItemId || function (index) {\n return _this.id + \"-item-\" + index;\n };\n _this.items = [];\n // itemCount can be changed asynchronously\n // from within downshift (so it can't come from a prop)\n // this is why we store it as an instance and use\n // getItemCount rather than just use items.length\n // (to support windowing + async)\n _this.itemCount = null;\n _this.previousResultCount = 0;\n _this.timeoutIds = [];\n /**\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n */\n _this.internalSetTimeout = function (fn, time) {\n var id = setTimeout(function () {\n _this.timeoutIds = _this.timeoutIds.filter(function (i) {\n return i !== id;\n });\n fn();\n }, time);\n _this.timeoutIds.push(id);\n };\n _this.setItemCount = function (count) {\n _this.itemCount = count;\n };\n _this.unsetItemCount = function () {\n _this.itemCount = null;\n };\n _this.isItemDisabled = function (_item, index) {\n var currentElementNode = _this.getItemNodeFromIndex(index);\n return currentElementNode && currentElementNode.hasAttribute('disabled');\n };\n _this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {\n if (highlightedIndex === void 0) {\n highlightedIndex = _this.props.defaultHighlightedIndex;\n }\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(_extends({\n highlightedIndex: highlightedIndex\n }, otherStateToSet));\n };\n _this.clearSelection = function (cb) {\n _this.internalSetState({\n selectedItem: null,\n inputValue: '',\n highlightedIndex: _this.props.defaultHighlightedIndex,\n isOpen: _this.props.defaultIsOpen\n }, cb);\n };\n _this.selectItem = function (item, otherStateToSet, cb) {\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(_extends({\n isOpen: _this.props.defaultIsOpen,\n highlightedIndex: _this.props.defaultHighlightedIndex,\n selectedItem: item,\n inputValue: _this.props.itemToString(item)\n }, otherStateToSet), cb);\n };\n _this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {\n var item = _this.items[itemIndex];\n if (item == null) {\n return;\n }\n _this.selectItem(item, otherStateToSet, cb);\n };\n _this.selectHighlightedItem = function (otherStateToSet, cb) {\n return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);\n };\n // any piece of our state can live in two places:\n // 1. Uncontrolled: it's internal (this.state)\n // We will call this.setState to update that state\n // 2. Controlled: it's external (this.props)\n // We will call this.props.onStateChange to update that state\n //\n // In addition, we'll call this.props.onChange if the\n // selectedItem is changed.\n _this.internalSetState = function (stateToSet, cb) {\n var isItemSelected, onChangeArg;\n var onStateChangeArg = {};\n var isStateToSetFunction = typeof stateToSet === 'function';\n\n // we want to call `onInputValueChange` before the `setState` call\n // so someone controlling the `inputValue` state gets notified of\n // the input change as soon as possible. This avoids issues with\n // preserving the cursor position.\n // See https://github.com/downshift-js/downshift/issues/217 for more info.\n if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));\n }\n return _this.setState(function (state) {\n var _newStateToSet;\n state = _this.getState(state);\n var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet;\n\n // Your own function that could modify the state that will be set.\n newStateToSet = _this.props.stateReducer(state, newStateToSet);\n\n // checks if an item is selected, regardless of if it's different from\n // what was selected before\n // used to determine if onSelect and onChange callbacks should be called\n isItemSelected = newStateToSet.hasOwnProperty('selectedItem');\n // this keeps track of the object we want to call with setState\n var nextState = {};\n // we need to call on change if the outside world is controlling any of our state\n // and we're trying to update that state. OR if the selection has changed and we're\n // trying to update the selection\n if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {\n onChangeArg = newStateToSet.selectedItem;\n }\n (_newStateToSet = newStateToSet).type || (_newStateToSet.type = unknown);\n Object.keys(newStateToSet).forEach(function (key) {\n // onStateChangeArg should only have the state that is\n // actually changing\n if (state[key] !== newStateToSet[key]) {\n onStateChangeArg[key] = newStateToSet[key];\n }\n // the type is useful for the onStateChangeArg\n // but we don't actually want to set it in internal state.\n // this is an undocumented feature for now... Not all internalSetState\n // calls support it and I'm not certain we want them to yet.\n // But it enables users controlling the isOpen state to know when\n // the isOpen state changes due to mouseup events which is quite handy.\n if (key === 'type') {\n return;\n }\n newStateToSet[key];\n // if it's coming from props, then we don't care to set it internally\n if (!isControlledProp(_this.props, key)) {\n nextState[key] = newStateToSet[key];\n }\n });\n\n // if stateToSet is a function, then we weren't able to call onInputValueChange\n // earlier, so we'll call it now that we know what the inputValue state will be.\n if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {\n _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));\n }\n return nextState;\n }, function () {\n // call the provided callback if it's a function\n cbToCb(cb)();\n\n // only call the onStateChange and onChange callbacks if\n // we have relevant information to pass them.\n var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;\n if (hasMoreStateThanType) {\n _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());\n }\n if (isItemSelected) {\n _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());\n }\n if (onChangeArg !== undefined) {\n _this.props.onChange(onChangeArg, _this.getStateAndHelpers());\n }\n // this is currently undocumented and therefore subject to change\n // We'll try to not break it, but just be warned.\n _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());\n });\n };\n //////////////////////////// ROOT\n _this.rootRef = function (node) {\n return _this._rootNode = node;\n };\n _this.getRootProps = function (_temp, _temp2) {\n var _extends2;\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$refKey = _ref.refKey,\n refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n ref = _ref.ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$suppressRefErro = _ref2.suppressRefError,\n suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n // this is used in the render to know whether the user has called getRootProps.\n // It uses that to know whether to apply the props automatically\n _this.getRootProps.called = true;\n _this.getRootProps.refKey = refKey;\n _this.getRootProps.suppressRefError = suppressRefError;\n var _this$getState = _this.getState(),\n isOpen = _this$getState.isOpen;\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : undefined, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n _this.keyDownHandlers = {\n ArrowDown: function ArrowDown(event) {\n var _this2 = this;\n event.preventDefault();\n if (this.getState().isOpen) {\n var amount = event.shiftKey ? 5 : 1;\n this.moveHighlightedIndex(amount, {\n type: keyDownArrowDown\n });\n } else {\n this.internalSetState({\n isOpen: true,\n type: keyDownArrowDown\n }, function () {\n var itemCount = _this2.getItemCount();\n if (itemCount > 0) {\n var _this2$getState = _this2.getState(),\n highlightedIndex = _this2$getState.highlightedIndex;\n var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, 1, {\n length: itemCount\n }, _this2.isItemDisabled, true);\n _this2.setHighlightedIndex(nextHighlightedIndex, {\n type: keyDownArrowDown\n });\n }\n });\n }\n },\n ArrowUp: function ArrowUp(event) {\n var _this3 = this;\n event.preventDefault();\n if (this.getState().isOpen) {\n var amount = event.shiftKey ? -5 : -1;\n this.moveHighlightedIndex(amount, {\n type: keyDownArrowUp\n });\n } else {\n this.internalSetState({\n isOpen: true,\n type: keyDownArrowUp\n }, function () {\n var itemCount = _this3.getItemCount();\n if (itemCount > 0) {\n var _this3$getState = _this3.getState(),\n highlightedIndex = _this3$getState.highlightedIndex;\n var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, -1, {\n length: itemCount\n }, _this3.isItemDisabled, true);\n _this3.setHighlightedIndex(nextHighlightedIndex, {\n type: keyDownArrowUp\n });\n }\n });\n }\n },\n Enter: function Enter(event) {\n if (event.which === 229) {\n return;\n }\n var _this$getState2 = this.getState(),\n isOpen = _this$getState2.isOpen,\n highlightedIndex = _this$getState2.highlightedIndex;\n if (isOpen && highlightedIndex != null) {\n event.preventDefault();\n var item = this.items[highlightedIndex];\n var itemNode = this.getItemNodeFromIndex(highlightedIndex);\n if (item == null || itemNode && itemNode.hasAttribute('disabled')) {\n return;\n }\n this.selectHighlightedItem({\n type: keyDownEnter\n });\n }\n },\n Escape: function Escape(event) {\n event.preventDefault();\n this.reset(_extends({\n type: keyDownEscape\n }, !this.state.isOpen && {\n selectedItem: null,\n inputValue: ''\n }));\n }\n };\n //////////////////////////// BUTTON\n _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n ' ': function _(event) {\n event.preventDefault();\n this.toggleMenu({\n type: keyDownSpaceButton\n });\n }\n });\n _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n Home: function Home(event) {\n var _this$getState3 = this.getState(),\n isOpen = _this$getState3.isOpen;\n if (!isOpen) {\n return;\n }\n event.preventDefault();\n var itemCount = this.getItemCount();\n if (itemCount <= 0 || !isOpen) {\n return;\n }\n\n // get next non-disabled starting downwards from 0 if that's disabled.\n var newHighlightedIndex = getNonDisabledIndex(0, false, {\n length: itemCount\n }, this.isItemDisabled);\n this.setHighlightedIndex(newHighlightedIndex, {\n type: keyDownHome\n });\n },\n End: function End(event) {\n var _this$getState4 = this.getState(),\n isOpen = _this$getState4.isOpen;\n if (!isOpen) {\n return;\n }\n event.preventDefault();\n var itemCount = this.getItemCount();\n if (itemCount <= 0 || !isOpen) {\n return;\n }\n\n // get next non-disabled starting upwards from last index if that's disabled.\n var newHighlightedIndex = getNonDisabledIndex(itemCount - 1, true, {\n length: itemCount\n }, this.isItemDisabled);\n this.setHighlightedIndex(newHighlightedIndex, {\n type: keyDownEnd\n });\n }\n });\n _this.getToggleButtonProps = function (_temp3) {\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n onClick = _ref3.onClick;\n _ref3.onPress;\n var onKeyDown = _ref3.onKeyDown,\n onKeyUp = _ref3.onKeyUp,\n onBlur = _ref3.onBlur,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$4);\n var _this$getState5 = _this.getState(),\n isOpen = _this$getState5.isOpen;\n var enabledEventHandlers = {\n onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),\n onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),\n onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)\n };\n var eventHandlers = rest.disabled ? {} : enabledEventHandlers;\n return _extends({\n type: 'button',\n role: 'button',\n 'aria-label': isOpen ? 'close menu' : 'open menu',\n 'aria-haspopup': true,\n 'data-toggle': true\n }, eventHandlers, rest);\n };\n _this.buttonHandleKeyUp = function (event) {\n // Prevent click event from emitting in Firefox\n event.preventDefault();\n };\n _this.buttonHandleKeyDown = function (event) {\n var key = normalizeArrowKey(event);\n if (_this.buttonKeyDownHandlers[key]) {\n _this.buttonKeyDownHandlers[key].call(_this, event);\n }\n };\n _this.buttonHandleClick = function (event) {\n event.preventDefault();\n // handle odd case for Safari and Firefox which\n // don't give the button the focus properly.\n /* istanbul ignore if (can't reasonably test this) */\n if (_this.props.environment) {\n var _this$props$environme = _this.props.environment.document,\n body = _this$props$environme.body,\n activeElement = _this$props$environme.activeElement;\n if (body && body === activeElement) {\n event.target.focus();\n }\n }\n // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n // when building for production and should therefore have no impact on production code.\n if (process.env.NODE_ENV === 'test') {\n _this.toggleMenu({\n type: clickButton\n });\n } else {\n // Ensure that toggle of menu occurs after the potential blur event in iOS\n _this.internalSetTimeout(function () {\n return _this.toggleMenu({\n type: clickButton\n });\n });\n }\n };\n _this.buttonHandleBlur = function (event) {\n var blurTarget = event.target; // Save blur target for comparison with activeElement later\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n _this.internalSetTimeout(function () {\n if (_this.isMouseDown || !_this.props.environment) {\n return;\n }\n var activeElement = _this.props.environment.document.activeElement;\n if ((activeElement == null || activeElement.id !== _this.inputId) && activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n ) {\n _this.reset({\n type: blurButton\n });\n }\n });\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n /////////////////////////////// LABEL\n _this.getLabelProps = function (props) {\n return _extends({\n htmlFor: _this.inputId,\n id: _this.labelId\n }, props);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n /////////////////////////////// INPUT\n _this.getInputProps = function (_temp4) {\n var _ref4 = _temp4 === void 0 ? {} : _temp4,\n onKeyDown = _ref4.onKeyDown,\n onBlur = _ref4.onBlur,\n onChange = _ref4.onChange,\n onInput = _ref4.onInput;\n _ref4.onChangeText;\n var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$3);\n var onChangeKey;\n var eventHandlers = {};\n\n /* istanbul ignore next (preact) */\n {\n onChangeKey = 'onChange';\n }\n var _this$getState6 = _this.getState(),\n inputValue = _this$getState6.inputValue,\n isOpen = _this$getState6.isOpen,\n highlightedIndex = _this$getState6.highlightedIndex;\n if (!rest.disabled) {\n var _eventHandlers;\n eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);\n }\n return _extends({\n 'aria-autocomplete': 'list',\n 'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : undefined,\n 'aria-controls': isOpen ? _this.menuId : undefined,\n 'aria-labelledby': rest && rest['aria-label'] ? undefined : _this.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: inputValue,\n id: _this.inputId\n }, eventHandlers, rest);\n };\n _this.inputHandleKeyDown = function (event) {\n var key = normalizeArrowKey(event);\n if (key && _this.inputKeyDownHandlers[key]) {\n _this.inputKeyDownHandlers[key].call(_this, event);\n }\n };\n _this.inputHandleChange = function (event) {\n _this.internalSetState({\n type: changeInput,\n isOpen: true,\n inputValue: event.target.value,\n highlightedIndex: _this.props.defaultHighlightedIndex\n });\n };\n _this.inputHandleBlur = function () {\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n _this.internalSetTimeout(function () {\n var _activeElement$datase;\n if (_this.isMouseDown || !_this.props.environment) {\n return;\n }\n var activeElement = _this.props.environment.document.activeElement;\n var downshiftButtonIsActive = (activeElement == null || (_activeElement$datase = activeElement.dataset) == null ? void 0 : _activeElement$datase.toggle) && _this._rootNode && _this._rootNode.contains(activeElement);\n if (!downshiftButtonIsActive) {\n _this.reset({\n type: blurInput\n });\n }\n });\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n /////////////////////////////// MENU\n _this.menuRef = function (node) {\n _this._menuNode = node;\n };\n _this.getMenuProps = function (_temp5, _temp6) {\n var _extends3;\n var _ref5 = _temp5 === void 0 ? {} : _temp5,\n _ref5$refKey = _ref5.refKey,\n refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n ref = _ref5.ref,\n props = _objectWithoutPropertiesLoose(_ref5, _excluded4$2);\n var _ref6 = _temp6 === void 0 ? {} : _temp6,\n _ref6$suppressRefErro = _ref6.suppressRefError,\n suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;\n _this.getMenuProps.called = true;\n _this.getMenuProps.refKey = refKey;\n _this.getMenuProps.suppressRefError = suppressRefError;\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? undefined : _this.labelId, _extends3.id = _this.menuId, _extends3), props);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n /////////////////////////////// ITEM\n _this.getItemProps = function (_temp7) {\n var _enabledEventHandlers;\n var _ref7 = _temp7 === void 0 ? {} : _temp7,\n onMouseMove = _ref7.onMouseMove,\n onMouseDown = _ref7.onMouseDown,\n onClick = _ref7.onClick;\n _ref7.onPress;\n var index = _ref7.index,\n _ref7$item = _ref7.item,\n item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ? /* istanbul ignore next */undefined : requiredProp('getItemProps', 'item') : _ref7$item,\n rest = _objectWithoutPropertiesLoose(_ref7, _excluded5);\n if (index === undefined) {\n _this.items.push(item);\n index = _this.items.indexOf(item);\n } else {\n _this.items[index] = item;\n }\n var onSelectKey = 'onClick';\n var customClickHandler = onClick;\n var enabledEventHandlers = (_enabledEventHandlers = {\n // onMouseMove is used over onMouseEnter here. onMouseMove\n // is only triggered on actual mouse movement while onMouseEnter\n // can fire on DOM changes, interrupting keyboard navigation\n onMouseMove: callAllEventHandlers(onMouseMove, function () {\n if (index === _this.getState().highlightedIndex) {\n return;\n }\n _this.setHighlightedIndex(index, {\n type: itemMouseEnter\n });\n\n // We never want to manually scroll when changing state based\n // on `onMouseMove` because we will be moving the element out\n // from under the user which is currently scrolling/moving the\n // cursor\n _this.avoidScrolling = true;\n _this.internalSetTimeout(function () {\n return _this.avoidScrolling = false;\n }, 250);\n }),\n onMouseDown: callAllEventHandlers(onMouseDown, function (event) {\n // This prevents the activeElement from being changed\n // to the item so it can remain with the current activeElement\n // which is a more common use case.\n event.preventDefault();\n })\n }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {\n _this.selectItemAtIndex(index, {\n type: clickItem\n });\n }), _enabledEventHandlers);\n\n // Passing down the onMouseDown handler to prevent redirect\n // of the activeElement if clicking on disabled items\n var eventHandlers = rest.disabled ? {\n onMouseDown: enabledEventHandlers.onMouseDown\n } : enabledEventHandlers;\n return _extends({\n id: _this.getItemId(index),\n role: 'option',\n 'aria-selected': _this.getState().highlightedIndex === index\n }, eventHandlers, rest);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n _this.clearItems = function () {\n _this.items = [];\n };\n _this.reset = function (otherStateToSet, cb) {\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(function (_ref8) {\n var selectedItem = _ref8.selectedItem;\n return _extends({\n isOpen: _this.props.defaultIsOpen,\n highlightedIndex: _this.props.defaultHighlightedIndex,\n inputValue: _this.props.itemToString(selectedItem)\n }, otherStateToSet);\n }, cb);\n };\n _this.toggleMenu = function (otherStateToSet, cb) {\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(function (_ref9) {\n var isOpen = _ref9.isOpen;\n return _extends({\n isOpen: !isOpen\n }, isOpen && {\n highlightedIndex: _this.props.defaultHighlightedIndex\n }, otherStateToSet);\n }, function () {\n var _this$getState7 = _this.getState(),\n isOpen = _this$getState7.isOpen,\n highlightedIndex = _this$getState7.highlightedIndex;\n if (isOpen) {\n if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {\n _this.setHighlightedIndex(highlightedIndex, otherStateToSet);\n }\n }\n cbToCb(cb)();\n });\n };\n _this.openMenu = function (cb) {\n _this.internalSetState({\n isOpen: true\n }, cb);\n };\n _this.closeMenu = function (cb) {\n _this.internalSetState({\n isOpen: false\n }, cb);\n };\n _this.updateStatus = debounce(function () {\n var _this$props;\n if (!((_this$props = _this.props) != null && (_this$props = _this$props.environment) != null && _this$props.document)) {\n return;\n }\n var state = _this.getState();\n var item = _this.items[state.highlightedIndex];\n var resultCount = _this.getItemCount();\n var status = _this.props.getA11yStatusMessage(_extends({\n itemToString: _this.props.itemToString,\n previousResultCount: _this.previousResultCount,\n resultCount: resultCount,\n highlightedItem: item\n }, state));\n _this.previousResultCount = resultCount;\n setStatus(status, _this.props.environment.document);\n }, 200);\n var _this$props2 = _this.props,\n defaultHighlightedIndex = _this$props2.defaultHighlightedIndex,\n _this$props2$initialH = _this$props2.initialHighlightedIndex,\n _highlightedIndex = _this$props2$initialH === void 0 ? defaultHighlightedIndex : _this$props2$initialH,\n defaultIsOpen = _this$props2.defaultIsOpen,\n _this$props2$initialI = _this$props2.initialIsOpen,\n _isOpen = _this$props2$initialI === void 0 ? defaultIsOpen : _this$props2$initialI,\n _this$props2$initialI2 = _this$props2.initialInputValue,\n _inputValue = _this$props2$initialI2 === void 0 ? '' : _this$props2$initialI2,\n _this$props2$initialS = _this$props2.initialSelectedItem,\n _selectedItem = _this$props2$initialS === void 0 ? null : _this$props2$initialS;\n var _state = _this.getState({\n highlightedIndex: _highlightedIndex,\n isOpen: _isOpen,\n inputValue: _inputValue,\n selectedItem: _selectedItem\n });\n if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {\n _state.inputValue = _this.props.itemToString(_state.selectedItem);\n }\n _this.state = _state;\n return _this;\n }\n _inheritsLoose(Downshift, _Component);\n var _proto = Downshift.prototype;\n /**\n * Clear all running timeouts\n */\n _proto.internalClearTimeouts = function internalClearTimeouts() {\n this.timeoutIds.forEach(function (id) {\n clearTimeout(id);\n });\n this.timeoutIds = [];\n }\n\n /**\n * Gets the state based on internal state or props\n * If a state value is passed via props, then that\n * is the value given, otherwise it's retrieved from\n * stateToMerge\n *\n * @param {Object} stateToMerge defaults to this.state\n * @return {Object} the state\n */;\n _proto.getState = function getState$1(stateToMerge) {\n if (stateToMerge === void 0) {\n stateToMerge = this.state;\n }\n return getState(stateToMerge, this.props);\n };\n _proto.getItemCount = function getItemCount() {\n // things read better this way. They're in priority order:\n // 1. `this.itemCount`\n // 2. `this.props.itemCount`\n // 3. `this.items.length`\n var itemCount = this.items.length;\n if (this.itemCount != null) {\n itemCount = this.itemCount;\n } else if (this.props.itemCount !== undefined) {\n itemCount = this.props.itemCount;\n }\n return itemCount;\n };\n _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {\n return this.props.environment ? this.props.environment.document.getElementById(this.getItemId(index)) : null;\n };\n _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {\n /* istanbul ignore else (react-native) */\n {\n var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);\n this.props.scrollIntoView(node, this._menuNode);\n }\n };\n _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {\n var itemCount = this.getItemCount();\n var _this$getState8 = this.getState(),\n highlightedIndex = _this$getState8.highlightedIndex;\n if (itemCount > 0) {\n var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, amount, {\n length: itemCount\n }, this.isItemDisabled, true);\n this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);\n }\n };\n _proto.getStateAndHelpers = function getStateAndHelpers() {\n var _this$getState9 = this.getState(),\n highlightedIndex = _this$getState9.highlightedIndex,\n inputValue = _this$getState9.inputValue,\n selectedItem = _this$getState9.selectedItem,\n isOpen = _this$getState9.isOpen;\n var itemToString = this.props.itemToString;\n var id = this.id;\n var getRootProps = this.getRootProps,\n getToggleButtonProps = this.getToggleButtonProps,\n getLabelProps = this.getLabelProps,\n getMenuProps = this.getMenuProps,\n getInputProps = this.getInputProps,\n getItemProps = this.getItemProps,\n openMenu = this.openMenu,\n closeMenu = this.closeMenu,\n toggleMenu = this.toggleMenu,\n selectItem = this.selectItem,\n selectItemAtIndex = this.selectItemAtIndex,\n selectHighlightedItem = this.selectHighlightedItem,\n setHighlightedIndex = this.setHighlightedIndex,\n clearSelection = this.clearSelection,\n clearItems = this.clearItems,\n reset = this.reset,\n setItemCount = this.setItemCount,\n unsetItemCount = this.unsetItemCount,\n setState = this.internalSetState;\n return {\n // prop getters\n getRootProps: getRootProps,\n getToggleButtonProps: getToggleButtonProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getInputProps: getInputProps,\n getItemProps: getItemProps,\n // actions\n reset: reset,\n openMenu: openMenu,\n closeMenu: closeMenu,\n toggleMenu: toggleMenu,\n selectItem: selectItem,\n selectItemAtIndex: selectItemAtIndex,\n selectHighlightedItem: selectHighlightedItem,\n setHighlightedIndex: setHighlightedIndex,\n clearSelection: clearSelection,\n clearItems: clearItems,\n setItemCount: setItemCount,\n unsetItemCount: unsetItemCount,\n setState: setState,\n // props\n itemToString: itemToString,\n // derived\n id: id,\n // state\n highlightedIndex: highlightedIndex,\n inputValue: inputValue,\n isOpen: isOpen,\n selectedItem: selectedItem\n };\n };\n _proto.componentDidMount = function componentDidMount() {\n var _this4 = this;\n /* istanbul ignore if (react-native) */\n if (process.env.NODE_ENV !== 'production' && true && this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n }\n\n /* istanbul ignore if (react-native or SSR) */\n if (!this.props.environment) {\n this.cleanup = function () {\n _this4.internalClearTimeouts();\n };\n } else {\n // this.isMouseDown helps us track whether the mouse is currently held down.\n // This is useful when the user clicks on an item in the list, but holds the mouse\n // down long enough for the list to disappear (because the blur event fires on the input)\n // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n // trigger hiding the menu.\n var onMouseDown = function onMouseDown() {\n _this4.isMouseDown = true;\n };\n var onMouseUp = function onMouseUp(event) {\n _this4.isMouseDown = false;\n // if the target element or the activeElement is within a downshift node\n // then we don't want to reset downshift\n var contextWithinDownshift = targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment);\n if (!contextWithinDownshift && _this4.getState().isOpen) {\n _this4.reset({\n type: mouseUp\n }, function () {\n return _this4.props.onOuterClick(_this4.getStateAndHelpers());\n });\n }\n };\n // Touching an element in iOS gives focus and hover states, but touching out of\n // the element will remove hover, and persist the focus state, resulting in the\n // blur event not being triggered.\n // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.\n // If the user taps outside of Downshift, the component should be reset,\n // but not if the user is swiping\n var onTouchStart = function onTouchStart() {\n _this4.isTouchMove = false;\n };\n var onTouchMove = function onTouchMove() {\n _this4.isTouchMove = true;\n };\n var onTouchEnd = function onTouchEnd(event) {\n var contextWithinDownshift = targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment, false);\n if (!_this4.isTouchMove && !contextWithinDownshift && _this4.getState().isOpen) {\n _this4.reset({\n type: touchEnd\n }, function () {\n return _this4.props.onOuterClick(_this4.getStateAndHelpers());\n });\n }\n };\n var environment = this.props.environment;\n environment.addEventListener('mousedown', onMouseDown);\n environment.addEventListener('mouseup', onMouseUp);\n environment.addEventListener('touchstart', onTouchStart);\n environment.addEventListener('touchmove', onTouchMove);\n environment.addEventListener('touchend', onTouchEnd);\n this.cleanup = function () {\n _this4.internalClearTimeouts();\n _this4.updateStatus.cancel();\n environment.removeEventListener('mousedown', onMouseDown);\n environment.removeEventListener('mouseup', onMouseUp);\n environment.removeEventListener('touchstart', onTouchStart);\n environment.removeEventListener('touchmove', onTouchMove);\n environment.removeEventListener('touchend', onTouchEnd);\n };\n }\n };\n _proto.shouldScroll = function shouldScroll(prevState, prevProps) {\n var _ref0 = this.props.highlightedIndex === undefined ? this.getState() : this.props,\n currentHighlightedIndex = _ref0.highlightedIndex;\n var _ref1 = prevProps.highlightedIndex === undefined ? prevState : prevProps,\n prevHighlightedIndex = _ref1.highlightedIndex;\n var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;\n var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;\n return scrollWhenOpen || scrollWhenNavigating;\n };\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged(this.state, prevProps, this.props);\n /* istanbul ignore if (react-native) */\n if (this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n }\n }\n if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {\n this.internalSetState({\n type: controlledPropUpdatedSelectedItem,\n inputValue: this.props.itemToString(this.props.selectedItem)\n });\n }\n if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {\n this.scrollHighlightedItemIntoView();\n }\n\n /* istanbul ignore else (react-native) */\n {\n this.updateStatus();\n }\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.cleanup(); // avoids memory leak\n };\n _proto.render = function render() {\n var children = unwrapArray(this.props.children, noop);\n // because the items are rerendered every time we call the children\n // we clear this out each render and it will be populated again as\n // getItemProps is called.\n this.clearItems();\n // we reset this so we know whether the user calls getRootProps during\n // this render. If they do then we don't need to do anything,\n // if they don't then we need to clone the element they return and\n // apply the props for them.\n this.getRootProps.called = false;\n this.getRootProps.refKey = undefined;\n this.getRootProps.suppressRefError = undefined;\n // we do something similar for getMenuProps\n this.getMenuProps.called = false;\n this.getMenuProps.refKey = undefined;\n this.getMenuProps.suppressRefError = undefined;\n // we do something similar for getLabelProps\n this.getLabelProps.called = false;\n // and something similar for getInputProps\n this.getInputProps.called = false;\n var element = unwrapArray(children(this.getStateAndHelpers()));\n if (!element) {\n return null;\n }\n if (this.getRootProps.called || this.props.suppressRefError) {\n if (process.env.NODE_ENV !== 'production' && !this.getRootProps.suppressRefError && !this.props.suppressRefError) {\n validateGetRootPropsCalledCorrectly(element, this.getRootProps);\n }\n return element;\n } else if (isDOMElement(element)) {\n // they didn't apply the root props, but we can clone\n // this and apply the props ourselves\n return /*#__PURE__*/cloneElement(element, this.getRootProps(getElementProps(element)));\n }\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n // they didn't apply the root props, but they need to\n // otherwise we can't query around the autocomplete\n\n throw new Error('downshift: If you return a non-DOM element, you must apply the getRootProps function');\n }\n\n /* istanbul ignore next */\n return undefined;\n };\n return Downshift;\n }(Component);\n Downshift.defaultProps = {\n defaultHighlightedIndex: null,\n defaultIsOpen: false,\n getA11yStatusMessage: getA11yStatusMessage,\n itemToString: function itemToString(i) {\n if (i == null) {\n return '';\n }\n if (process.env.NODE_ENV !== 'production' && isPlainObject(i) && !i.hasOwnProperty('toString')) {\n // eslint-disable-next-line no-console\n console.warn('downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.', 'The object that was passed:', i);\n }\n return String(i);\n },\n onStateChange: noop,\n onInputValueChange: noop,\n onUserAction: noop,\n onChange: noop,\n onSelect: noop,\n onOuterClick: noop,\n selectedItemChanged: function selectedItemChanged(prevItem, item) {\n return prevItem !== item;\n },\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' || false ? undefined : window,\n stateReducer: function stateReducer(state, stateToSet) {\n return stateToSet;\n },\n suppressRefError: false,\n scrollIntoView: scrollIntoView\n };\n Downshift.stateChangeTypes = stateChangeTypes$4;\n return Downshift;\n}();\nprocess.env.NODE_ENV !== \"production\" ? Downshift.propTypes = {\n children: PropTypes.func,\n defaultHighlightedIndex: PropTypes.number,\n defaultIsOpen: PropTypes.bool,\n initialHighlightedIndex: PropTypes.number,\n initialSelectedItem: PropTypes.any,\n initialInputValue: PropTypes.string,\n initialIsOpen: PropTypes.bool,\n getA11yStatusMessage: PropTypes.func,\n itemToString: PropTypes.func,\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onStateChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n onUserAction: PropTypes.func,\n onOuterClick: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n stateReducer: PropTypes.func,\n itemCount: PropTypes.number,\n id: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func.isRequired,\n removeEventListener: PropTypes.func.isRequired,\n document: PropTypes.shape({\n createElement: PropTypes.func.isRequired,\n getElementById: PropTypes.func.isRequired,\n activeElement: PropTypes.any.isRequired,\n body: PropTypes.any.isRequired\n }).isRequired,\n Node: PropTypes.func.isRequired\n }),\n suppressRefError: PropTypes.bool,\n scrollIntoView: PropTypes.func,\n // things we keep in state for uncontrolled components\n // but can accept as props for controlled components\n /* eslint-disable react/no-unused-prop-types */\n selectedItem: PropTypes.any,\n isOpen: PropTypes.bool,\n inputValue: PropTypes.string,\n highlightedIndex: PropTypes.number,\n labelId: PropTypes.string,\n inputId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func\n /* eslint-enable react/no-unused-prop-types */\n} : void 0;\nfunction validateGetMenuPropsCalledCorrectly(node, _ref10) {\n var refKey = _ref10.refKey;\n if (!node) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from getMenuProps was not applied correctly on your menu element.\");\n }\n}\nfunction validateGetRootPropsCalledCorrectly(element, _ref11) {\n var refKey = _ref11.refKey;\n var refKeySpecified = refKey !== 'ref';\n var isComposite = !isDOMElement(element);\n if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n // eslint-disable-next-line no-console\n console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');\n } else if (!isComposite && refKeySpecified) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \\\"\" + refKey + \"\\\"\");\n }\n if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You must apply the ref prop \\\"\" + refKey + \"\\\" from getRootProps onto your root element.\");\n }\n}\n\nfunction capitalizeString(string) {\n return \"\" + string.slice(0, 1).toUpperCase() + string.slice(1);\n}\n\nfunction callOnChangeProps(action, props, state, newState) {\n var type = action.type;\n var changes = {};\n var keys = Object.keys(state);\n for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {\n var key = _keys[_i];\n invokeOnChangeHandler(key, action, props, state, newState);\n if (newState[key] !== state[key]) {\n changes[key] = newState[key];\n }\n }\n if (props.onStateChange && Object.keys(changes).length) {\n props.onStateChange(_extends({\n type: type\n }, changes));\n }\n}\nfunction invokeOnChangeHandler(key, action, props, state, newState) {\n if (newState[key] === state[key]) {\n return;\n }\n var handlerKey = \"on\" + capitalizeString(key) + \"Change\";\n var handler = props[handlerKey];\n if (typeof handler !== 'function') {\n return;\n }\n var type = action.type;\n handler(_extends({\n type: type\n }, newState));\n}\n\n/**\n * Computes the controlled state using a the previous state, props,\n * two reducers, one from downshift and an optional one from the user.\n * Also calls the onChange handlers for state values that have changed.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} props The hook props, also passed to createInitialState.\n * @param {Function} createInitialState Function that returns the initial state.\n * @param {Function} isStateEqual Function that checks if a previous state is equal to the next.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {\n var prevStateRef = React.useRef(null);\n var actionRef = React.useRef(undefined);\n var propsRef = useLatestRef(props);\n var enhancedReducer = React.useCallback(function (state, action) {\n actionRef.current = action;\n state = getState(state, propsRef.current);\n var changes = reducer(state, propsRef.current, action);\n var newState = propsRef.current.stateReducer(state, _extends({}, action, {\n changes: changes\n }));\n return _extends({}, state, newState);\n }, [propsRef, reducer]);\n var _React$useReducer = React.useReducer(enhancedReducer, props, createInitialState),\n state = _React$useReducer[0],\n dispatch = _React$useReducer[1];\n var action = actionRef.current;\n React.useEffect(function () {\n var _prevStateRef$current;\n var prevState = getState((_prevStateRef$current = prevStateRef.current) != null ? _prevStateRef$current : {}, propsRef.current);\n var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevState, state);\n if (shouldCallOnChangeProps) {\n callOnChangeProps(action, propsRef.current, prevState, state);\n }\n prevStateRef.current = state;\n }, [state, action, isStateEqual, propsRef]);\n return [state, dispatch];\n}\n\n/**\n * Wraps the useEnhancedReducer and applies the controlled prop values before\n * returning the new state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} props The hook props, also passed to createInitialState.\n * @param {Function} createInitialState Function that returns the initial state.\n * @param {Function} isStateEqual Function that checks if a previous state is equal to the next.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer$1(reducer, props, createInitialState, isStateEqual) {\n var _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual),\n state = _useEnhancedReducer[0],\n dispatch = _useEnhancedReducer[1];\n return [getState(state, props), dispatch];\n}\n\n/**\n * Returns both the item and index when both or either is passed.\n *\n * @param itemProp The item which could be undefined.\n * @param indexProp The index which could be undefined.\n * @param items The array of items to get the item based on index.\n * @param errorMessage The error to be thrown if index and item could not be returned for any reason.\n * @returns An array with item and index.\n */\nfunction getItemAndIndex(itemProp, indexProp, items, errorMessage) {\n if (itemProp !== undefined && indexProp !== undefined) {\n return [itemProp, indexProp];\n }\n if (itemProp !== undefined) {\n var index = items.indexOf(itemProp);\n if (index < 0) {\n throw new Error(errorMessage);\n }\n return [itemProp, items.indexOf(itemProp)];\n }\n if (indexProp !== undefined) {\n var item = items[indexProp];\n if (item === undefined) {\n throw new Error(errorMessage);\n }\n return [item, indexProp];\n }\n throw new Error(errorMessage);\n}\n\n/**\n * Tracks if it's the first render.\n */\nfunction useIsInitialMount() {\n var isInitialMountRef = React.useRef(true);\n React.useEffect(function () {\n isInitialMountRef.current = false;\n return function () {\n isInitialMountRef.current = true;\n };\n }, []);\n return isInitialMountRef.current;\n}\n\n/**\n * Default state reducer that returns the changes.\n *\n */\nfunction stateReducer(_s, a) {\n return a.changes;\n}\n\n// Shared between all exports.\nvar propTypes$5 = {\n environment: PropTypes.shape({\n addEventListener: PropTypes.func.isRequired,\n removeEventListener: PropTypes.func.isRequired,\n document: PropTypes.shape({\n createElement: PropTypes.func.isRequired,\n getElementById: PropTypes.func.isRequired,\n activeElement: PropTypes.any.isRequired,\n body: PropTypes.any.isRequired\n }).isRequired,\n Node: PropTypes.func.isRequired\n }),\n itemToKey: PropTypes.func,\n stateReducer: PropTypes.func\n};\n\nfunction getDefaultValue$1(props, propKey, defaultStateValues) {\n var defaultValue = props[\"default\" + capitalizeString(propKey)];\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n return defaultStateValues[propKey];\n}\n\nfunction getInitialValue$1(props, propKey, defaultStateValues) {\n var value = props[propKey];\n if (value !== undefined) {\n return value;\n }\n var initialValue = props[\"initial\" + capitalizeString(propKey)];\n if (initialValue !== undefined) {\n return initialValue;\n }\n return getDefaultValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Debounced call for updating the a11y message.\n */\nvar updateA11yStatus = debounce$1(function (status, document) {\n setStatus(status, document);\n}, 200);\n\n/**\n * Adds an a11y aria live status message if getA11yStatusMessage is passed.\n * @param getA11yStatusMessage The function that builds the status message.\n * @param options The options to be passed to getA11yStatusMessage if called.\n * @param dependencyArray The dependency array that triggers the status message setter via useEffect.\n * @param environment The environment object containing the document.\n */\nfunction useA11yMessageStatus(getA11yStatusMessage, options, dependencyArray, environment) {\n var document = environment == null ? void 0 : environment.document;\n var isInitialMount = useIsInitialMount();\n\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n React.useEffect(function () {\n if (!getA11yStatusMessage || isInitialMount || false || !document) {\n return;\n }\n var status = getA11yStatusMessage(options);\n updateA11yStatus(status, document);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencyArray);\n\n // Cleanup the status message container.\n React.useEffect(function () {\n return function () {\n updateA11yStatus.cancel();\n cleanupStatusDiv(document);\n };\n }, [document]);\n}\n\n// Shared between useSelect, useCombobox, Downshift.\nvar propTypes$4 = _extends({}, propTypes$5, {\n getA11yStatusMessage: PropTypes.func,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n toggleButtonId: PropTypes.string,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n scrollIntoView: PropTypes.func\n});\n\nvar defaultProps$3 = {\n itemToString: function itemToString(item) {\n return item ? String(item) : '';\n },\n itemToKey: function itemToKey(item) {\n return item;\n },\n stateReducer: stateReducer,\n scrollIntoView: scrollIntoView,\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' || false ? undefined : window\n};\n\nvar defaultStateValues$1 = {\n highlightedIndex: -1,\n isOpen: false,\n selectedItem: null,\n inputValue: ''\n};\n\n// istanbul ignore next\nvar useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;\nfunction isAcceptedCharacterKey(key) {\n return /^\\S{1}$/.test(key);\n}\nfunction getInitialState$3(props) {\n var selectedItem = getInitialValue$1(props, 'selectedItem', defaultStateValues$1);\n var isOpen = getInitialValue$1(props, 'isOpen', defaultStateValues$1);\n var highlightedIndex = getInitialHighlightedIndex(props);\n var inputValue = getInitialValue$1(props, 'inputValue', defaultStateValues$1);\n return {\n highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.findIndex(function (item) {\n return props.itemToKey(item) === props.itemToKey(selectedItem);\n }) : highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\nfunction getHighlightedIndexOnOpen(props, state, offset) {\n var items = props.items,\n initialHighlightedIndex = props.initialHighlightedIndex,\n defaultHighlightedIndex = props.defaultHighlightedIndex,\n isItemDisabled = props.isItemDisabled,\n itemToKey = props.itemToKey;\n var selectedItem = state.selectedItem,\n highlightedIndex = state.highlightedIndex;\n if (items.length === 0) {\n return -1;\n }\n\n // initialHighlightedIndex will give value to highlightedIndex on initial state only.\n if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex], initialHighlightedIndex)) {\n return initialHighlightedIndex;\n }\n if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex], defaultHighlightedIndex)) {\n return defaultHighlightedIndex;\n }\n if (selectedItem) {\n return items.findIndex(function (item) {\n return itemToKey(selectedItem) === itemToKey(item);\n });\n }\n if (offset < 0 && !isItemDisabled(items[items.length - 1], items.length - 1)) {\n return items.length - 1;\n }\n if (offset > 0 && !isItemDisabled(items[0], 0)) {\n return 0;\n }\n return -1;\n}\n/**\n * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.\n *\n * @param {Window} environment The environment to add the event listeners to, for instance window.\n * @param {() => void} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.\n * @param {Array<{current: HTMLElement}>} downshiftElementsRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.\n * @returns {{isMouseDown: boolean, isTouchMove: boolean, isTouchEnd: boolean}} The mouse and touch events information, if any of are happening.\n */\nfunction useMouseAndTouchTracker(environment, handleBlur, downshiftRefs) {\n var mouseAndTouchTrackersRef = React.useRef({\n isMouseDown: false,\n isTouchMove: false,\n isTouchEnd: false\n });\n var getDownshiftElements = React.useCallback(function () {\n return downshiftRefs.map(function (ref) {\n return ref.current;\n });\n }, [downshiftRefs]);\n React.useEffect(function () {\n if (!environment) {\n return noop;\n }\n function onMouseDown() {\n mouseAndTouchTrackersRef.current.isTouchEnd = false; // reset this one.\n mouseAndTouchTrackersRef.current.isMouseDown = true;\n }\n function onMouseUp(event) {\n mouseAndTouchTrackersRef.current.isMouseDown = false;\n if (!targetWithinDownshift(event.target, getDownshiftElements(), environment)) {\n handleBlur();\n }\n }\n function onTouchStart() {\n mouseAndTouchTrackersRef.current.isTouchEnd = false;\n mouseAndTouchTrackersRef.current.isTouchMove = false;\n }\n function onTouchMove() {\n mouseAndTouchTrackersRef.current.isTouchMove = true;\n }\n function onTouchEnd(event) {\n mouseAndTouchTrackersRef.current.isTouchEnd = true;\n if (!mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, getDownshiftElements(), environment, false)) {\n handleBlur();\n }\n }\n environment.addEventListener('mousedown', onMouseDown);\n environment.addEventListener('mouseup', onMouseUp);\n environment.addEventListener('touchstart', onTouchStart);\n environment.addEventListener('touchmove', onTouchMove);\n environment.addEventListener('touchend', onTouchEnd);\n return function cleanup() {\n environment.removeEventListener('mousedown', onMouseDown);\n environment.removeEventListener('mouseup', onMouseUp);\n environment.removeEventListener('touchstart', onTouchStart);\n environment.removeEventListener('touchmove', onTouchMove);\n environment.removeEventListener('touchend', onTouchEnd);\n };\n }, [environment, getDownshiftElements, handleBlur]);\n return mouseAndTouchTrackersRef.current;\n}\n\n/* istanbul ignore next */\n// eslint-disable-next-line import/no-mutable-exports\nvar useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n return noop;\n};\n/**\n * Custom hook that checks if getter props are called correctly.\n *\n * @param {...any} propKeys Getter prop names to be handled.\n * @returns {Function} Setter function called inside getter props to set call information.\n */\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n for (var _len = arguments.length, propKeys = new Array(_len), _key = 0; _key < _len; _key++) {\n propKeys[_key] = arguments[_key];\n }\n var getterPropsCalledRef = React.useRef(propKeys.reduce(function (acc, propKey) {\n acc[propKey] = {};\n return acc;\n }, {}));\n React.useEffect(function () {\n Object.keys(getterPropsCalledRef.current).forEach(function (propKey) {\n var propCallInfo = getterPropsCalledRef.current[propKey];\n if (!Object.keys(propCallInfo).length) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You forgot to call the \" + propKey + \" getter function on your component / element.\");\n return;\n }\n var suppressRefError = propCallInfo.suppressRefError,\n refKey = propCallInfo.refKey,\n elementRef = propCallInfo.elementRef;\n if (suppressRefError) {\n return;\n }\n if (!(elementRef != null && elementRef.current)) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from \" + propKey + \" was not applied correctly on your element.\");\n }\n });\n }, []);\n var setGetterPropCallInfo = React.useCallback(function (propKey, suppressRefError, refKey, elementRef) {\n getterPropsCalledRef.current[propKey] = {\n suppressRefError: suppressRefError,\n refKey: refKey,\n elementRef: elementRef\n };\n }, []);\n return setGetterPropCallInfo;\n };\n}\nfunction useScrollIntoView(_ref) {\n var highlightedIndex = _ref.highlightedIndex,\n isOpen = _ref.isOpen,\n itemRefs = _ref.itemRefs,\n getItemNodeFromIndex = _ref.getItemNodeFromIndex,\n menuElement = _ref.menuElement,\n scrollIntoViewProp = _ref.scrollIntoView;\n // used not to scroll on highlight by mouse.\n var shouldScrollRef = React.useRef(true);\n // Scroll on highlighted item if change comes from keyboard.\n useIsomorphicLayoutEffect(function () {\n if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {\n return;\n }\n if (shouldScrollRef.current === false) {\n shouldScrollRef.current = true;\n } else {\n scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex]);\n return shouldScrollRef;\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar useControlPropsValidator = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useControlPropsValidator = function useControlPropsValidator(_ref2) {\n var props = _ref2.props,\n state = _ref2.state;\n // used for checking when props are moving from controlled to uncontrolled.\n var prevPropsRef = React.useRef(props);\n var isInitialMount = useIsInitialMount();\n React.useEffect(function () {\n if (isInitialMount) {\n return;\n }\n validateControlledUnchanged(state, prevPropsRef.current, props);\n prevPropsRef.current = props;\n }, [state, props, isInitialMount]);\n };\n}\n\n/**\n * Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted.\n * In that case, selects the item and resets to defaults for open state and highlighted idex.\n * @param {Object} props The useCombobox props.\n * @param {number} highlightedIndex The index from the state.\n * @param {boolean} inputValue Also return the input value for state.\n * @returns The changes for the state.\n */\nfunction getChangesOnSelection(props, highlightedIndex, inputValue) {\n var _props$items;\n if (inputValue === void 0) {\n inputValue = true;\n }\n var shouldSelect = ((_props$items = props.items) == null ? void 0 : _props$items.length) && highlightedIndex >= 0;\n return _extends({\n isOpen: false,\n highlightedIndex: -1\n }, shouldSelect && _extends({\n selectedItem: props.items[highlightedIndex],\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n highlightedIndex: getDefaultValue$1(props, 'highlightedIndex', defaultStateValues$1)\n }, inputValue && {\n inputValue: props.itemToString(props.items[highlightedIndex])\n }));\n}\n\n/**\n * Check if a state is equal for dropdowns, by comparing isOpen, inputValue, highlightedIndex and selected item.\n * Used by useSelect and useCombobox.\n *\n * @param {Object} prevState\n * @param {Object} newState\n * @returns {boolean} Wheather the states are deeply equal.\n */\nfunction isDropdownsStateEqual(prevState, newState) {\n return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;\n}\n\n/**\n * Returns the new highlightedIndex based on the defaultHighlightedIndex prop, if it's not disabled.\n *\n * @param {Object} props Props from useCombobox or useSelect.\n * @returns {number} The highlighted index.\n */\nfunction getDefaultHighlightedIndex(props) {\n var highlightedIndex = getDefaultValue$1(props, 'highlightedIndex', defaultStateValues$1);\n if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {\n return -1;\n }\n return highlightedIndex;\n}\n\n/**\n * Returns the new highlightedIndex based on the initialHighlightedIndex prop, if not disabled.\n *\n * @param {Object} props Props from useCombobox or useSelect.\n * @returns {number} The highlighted index.\n */\nfunction getInitialHighlightedIndex(props) {\n var highlightedIndex = getInitialValue$1(props, 'highlightedIndex', defaultStateValues$1);\n if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {\n return -1;\n }\n return highlightedIndex;\n}\n\nfunction downshiftCommonReducer(state, props, action, stateChangeTypes) {\n var type = action.type;\n var changes;\n switch (type) {\n case stateChangeTypes.ItemMouseMove:\n changes = {\n highlightedIndex: action.disabled ? -1 : action.index\n };\n break;\n case stateChangeTypes.MenuMouseLeave:\n changes = {\n highlightedIndex: -1\n };\n break;\n case stateChangeTypes.ToggleButtonClick:\n case stateChangeTypes.FunctionToggleMenu:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case stateChangeTypes.FunctionOpenMenu:\n changes = {\n isOpen: true,\n highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case stateChangeTypes.FunctionCloseMenu:\n changes = {\n isOpen: false\n };\n break;\n case stateChangeTypes.FunctionSetHighlightedIndex:\n changes = {\n highlightedIndex: props.isItemDisabled(props.items[action.highlightedIndex], action.highlightedIndex) ? -1 : action.highlightedIndex\n };\n break;\n case stateChangeTypes.FunctionSetInputValue:\n changes = {\n inputValue: action.inputValue\n };\n break;\n case stateChangeTypes.FunctionReset:\n changes = {\n highlightedIndex: getDefaultHighlightedIndex(props),\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n selectedItem: getDefaultValue$1(props, 'selectedItem', defaultStateValues$1),\n inputValue: getDefaultValue$1(props, 'inputValue', defaultStateValues$1)\n };\n break;\n default:\n throw new Error('Reducer called without proper action type.');\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar propTypes$3 = _extends({}, propTypes$4, {\n items: PropTypes.array.isRequired,\n isItemDisabled: PropTypes.func\n});\n\nvar defaultProps$2 = _extends({}, defaultProps$3, {\n isItemDisabled: function isItemDisabled() {\n return false;\n }\n});\n\nfunction getItemIndexByCharacterKey(_ref) {\n var keysSoFar = _ref.keysSoFar,\n highlightedIndex = _ref.highlightedIndex,\n items = _ref.items,\n itemToString = _ref.itemToString,\n isItemDisabled = _ref.isItemDisabled;\n var lowerCasedKeysSoFar = keysSoFar.toLowerCase();\n for (var _index = 0; _index < items.length; _index++) {\n // if we already have a search query in progress, we also consider the current highlighted item.\n var offsetIndex = (_index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;\n var _item = items[offsetIndex];\n if (_item !== undefined && itemToString(_item).toLowerCase().startsWith(lowerCasedKeysSoFar) && !isItemDisabled(_item, offsetIndex)) {\n return offsetIndex;\n }\n }\n return highlightedIndex;\n}\n\nvar ToggleButtonClick$1 = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 0;\nvar ToggleButtonKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_down__' : 1;\nvar ToggleButtonKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_up__' : 2;\nvar ToggleButtonKeyDownCharacter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_character__' : 3;\nvar ToggleButtonKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_escape__' : 4;\nvar ToggleButtonKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_home__' : 5;\nvar ToggleButtonKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_end__' : 6;\nvar ToggleButtonKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_enter__' : 7;\nvar ToggleButtonKeyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_space_button__' : 8;\nvar ToggleButtonKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_up__' : 9;\nvar ToggleButtonKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_down__' : 10;\nvar ToggleButtonBlur = process.env.NODE_ENV !== \"production\" ? '__togglebutton_blur__' : 11;\nvar MenuMouseLeave$1 = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 12;\nvar ItemMouseMove$1 = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 13;\nvar ItemClick$1 = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 14;\nvar FunctionToggleMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem$1 = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$2 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\n\nvar stateChangeTypes$3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n FunctionCloseMenu: FunctionCloseMenu$1,\n FunctionOpenMenu: FunctionOpenMenu$1,\n FunctionReset: FunctionReset$2,\n FunctionSelectItem: FunctionSelectItem$1,\n FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,\n FunctionSetInputValue: FunctionSetInputValue$1,\n FunctionToggleMenu: FunctionToggleMenu$1,\n ItemClick: ItemClick$1,\n ItemMouseMove: ItemMouseMove$1,\n MenuMouseLeave: MenuMouseLeave$1,\n ToggleButtonBlur: ToggleButtonBlur,\n ToggleButtonClick: ToggleButtonClick$1,\n ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,\n ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,\n ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,\n ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,\n ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,\n ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,\n ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,\n ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,\n ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,\n ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton\n});\n\n/* eslint-disable complexity */\nfunction downshiftSelectReducer(state, props, action) {\n var _props$items;\n var type = action.type,\n altKey = action.altKey;\n var changes;\n switch (type) {\n case ItemClick$1:\n changes = {\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n highlightedIndex: getDefaultHighlightedIndex(props),\n selectedItem: props.items[action.index]\n };\n break;\n case ToggleButtonKeyDownCharacter:\n {\n var lowercasedKey = action.key;\n var inputValue = \"\" + state.inputValue + lowercasedKey;\n var prevHighlightedIndex = !state.isOpen && state.selectedItem ? props.items.findIndex(function (item) {\n return props.itemToKey(item) === props.itemToKey(state.selectedItem);\n }) : state.highlightedIndex;\n var highlightedIndex = getItemIndexByCharacterKey({\n keysSoFar: inputValue,\n highlightedIndex: prevHighlightedIndex,\n items: props.items,\n itemToString: props.itemToString,\n isItemDisabled: props.isItemDisabled\n });\n changes = {\n inputValue: inputValue,\n highlightedIndex: highlightedIndex,\n isOpen: true\n };\n }\n break;\n case ToggleButtonKeyDownArrowDown:\n {\n var _highlightedIndex = state.isOpen ? getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled) : altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1);\n changes = {\n highlightedIndex: _highlightedIndex,\n isOpen: true\n };\n }\n break;\n case ToggleButtonKeyDownArrowUp:\n if (state.isOpen && altKey) {\n changes = getChangesOnSelection(props, state.highlightedIndex, false);\n } else {\n var _highlightedIndex2 = state.isOpen ? getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled) : getHighlightedIndexOnOpen(props, state, -1);\n changes = {\n highlightedIndex: _highlightedIndex2,\n isOpen: true\n };\n }\n break;\n // only triggered when menu is open.\n case ToggleButtonKeyDownEnter:\n case ToggleButtonKeyDownSpaceButton:\n changes = getChangesOnSelection(props, state.highlightedIndex, false);\n break;\n case ToggleButtonKeyDownHome:\n changes = {\n highlightedIndex: getNonDisabledIndex(0, false, props.items, props.isItemDisabled),\n isOpen: true\n };\n break;\n case ToggleButtonKeyDownEnd:\n changes = {\n highlightedIndex: getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled),\n isOpen: true\n };\n break;\n case ToggleButtonKeyDownPageUp:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled)\n };\n break;\n case ToggleButtonKeyDownPageDown:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled)\n };\n break;\n case ToggleButtonKeyDownEscape:\n changes = {\n isOpen: false,\n highlightedIndex: -1\n };\n break;\n case ToggleButtonBlur:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && {\n selectedItem: props.items[state.highlightedIndex]\n });\n break;\n case FunctionSelectItem$1:\n changes = {\n selectedItem: action.selectedItem\n };\n break;\n default:\n return downshiftCommonReducer(state, props, action, stateChangeTypes$3);\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\n// https://github.com/downshift-js/downshift/issues/1674#issuecomment-3924320872\nvar SafeReact$1 = _extends({}, React);\nvar reactUseId$1 = SafeReact$1.useId;\nvar useElementIds$1 = typeof reactUseId$1 === 'function' ? useElementIdsR18$1 : useElementIdsLegacy$1;\nfunction useElementIdsR18$1(_ref) {\n var id = _ref.id,\n labelId = _ref.labelId,\n menuId = _ref.menuId,\n getItemId = _ref.getItemId,\n toggleButtonId = _ref.toggleButtonId,\n inputId = _ref.inputId;\n var reactId = \"downshift-\" + reactUseId$1();\n if (!id) {\n id = reactId;\n }\n var elementIds = React.useMemo(function () {\n return {\n labelId: labelId != null ? labelId : id + \"-label\",\n menuId: menuId != null ? menuId : id + \"-menu\",\n getItemId: getItemId != null ? getItemId : function (index) {\n return id + \"-item-\" + index;\n },\n toggleButtonId: toggleButtonId != null ? toggleButtonId : id + \"-toggle-button\",\n inputId: inputId != null ? inputId : id + \"-input\"\n };\n }, [getItemId, id, inputId, labelId, menuId, toggleButtonId]);\n return elementIds;\n}\nfunction useElementIdsLegacy$1(_ref2) {\n var id = _ref2.id,\n labelId = _ref2.labelId,\n menuId = _ref2.menuId,\n getItemId = _ref2.getItemId,\n toggleButtonId = _ref2.toggleButtonId,\n inputId = _ref2.inputId;\n var baseIdRef = React.useRef(id != null ? id : \"downshift-\" + generateId());\n var baseId = baseIdRef.current;\n var elementIds = React.useMemo(function () {\n return {\n labelId: labelId != null ? labelId : baseId + \"-label\",\n menuId: menuId != null ? menuId : baseId + \"-menu\",\n getItemId: getItemId != null ? getItemId : function (index) {\n return baseId + \"-item-\" + index;\n },\n toggleButtonId: toggleButtonId != null ? toggleButtonId : baseId + \"-toggle-button\",\n inputId: inputId != null ? inputId : baseId + \"-input\"\n };\n }, [getItemId, inputId, labelId, menuId, toggleButtonId, baseId]);\n return elementIds;\n}\n\nvar _excluded$3 = [\"onClick\"],\n _excluded2$3 = [\"onMouseLeave\", \"refKey\", \"ref\"],\n _excluded3$2 = [\"onBlur\", \"onClick\", \"onPress\", \"onKeyDown\", \"refKey\", \"ref\"],\n _excluded4$1 = [\"item\", \"index\", \"onMouseMove\", \"onClick\", \"onMouseDown\", \"onPress\", \"refKey\", \"disabled\", \"ref\"];\nuseSelect.stateChangeTypes = stateChangeTypes$3;\nfunction useSelect(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes$1(userProps, useSelect, propTypes$3);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps$2, userProps);\n var scrollIntoView = props.scrollIntoView,\n environment = props.environment,\n getA11yStatusMessage = props.getA11yStatusMessage;\n // Initial state depending on controlled props.\n var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, props, getInitialState$3, isDropdownsStateEqual),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var isOpen = state.isOpen,\n highlightedIndex = state.highlightedIndex,\n selectedItem = state.selectedItem,\n inputValue = state.inputValue;\n // Element efs.\n var toggleButtonRef = useRef(null);\n var menuRef = useRef(null);\n var itemRefs = useRef({});\n\n // used to keep the inputValue clearTimeout object between renders.\n var clearTimeoutRef = useRef(null);\n // prevent id re-generation between renders.\n var elementIds = useElementIds$1(props);\n // utility callback to get item element.\n var latest = useLatestRef({\n state: state,\n props: props\n });\n\n // Some utils.\n var getItemNodeFromIndex = useCallback(function (index) {\n return itemRefs.current[elementIds.getItemId(index)];\n }, [elementIds]);\n\n // Effects.\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n useA11yMessageStatus(getA11yStatusMessage, state, [isOpen, highlightedIndex, selectedItem, inputValue], environment);\n // Scroll on highlighted item if change comes from keyboard.\n var shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n itemRefs: itemRefs,\n scrollIntoView: scrollIntoView,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n // Sets cleanup for the keysSoFar callback, debounded after 500ms.\n useEffect(function () {\n // init the clean function here as we need access to dispatch.\n clearTimeoutRef.current = debounce(function (outerDispatch) {\n outerDispatch({\n type: FunctionSetInputValue$1,\n inputValue: ''\n });\n }, 500);\n\n // Cancel any pending debounced calls on mount\n return function () {\n clearTimeoutRef.current.cancel();\n };\n }, []);\n // Invokes the keysSoFar callback set up above.\n useEffect(function () {\n if (!inputValue) {\n return;\n }\n clearTimeoutRef.current(dispatch);\n }, [dispatch, inputValue]);\n useControlPropsValidator({\n props: props,\n state: state\n });\n // Focus the toggle button on first render if required.\n useEffect(function () {\n var focusOnOpen = getInitialValue$1(props, 'isOpen', defaultStateValues$1);\n if (focusOnOpen && toggleButtonRef.current) {\n toggleButtonRef.current.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n var handleBlurInTracker = useCallback(function handleBlur() {\n if (latest.current.state.isOpen) {\n dispatch({\n type: ToggleButtonBlur\n });\n }\n }, [dispatch, latest]);\n var downshiftRefs = useMemo(function () {\n return [menuRef, toggleButtonRef];\n }, []);\n var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, handleBlurInTracker, downshiftRefs);\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');\n // Reset itemRefs on close.\n useEffect(function () {\n if (!isOpen) {\n itemRefs.current = {};\n }\n }, [isOpen]);\n\n // Event handler functions.\n var toggleButtonKeyDownHandlers = useMemo(function () {\n return {\n ArrowDown: function ArrowDown(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownArrowDown,\n altKey: event.altKey\n });\n },\n ArrowUp: function ArrowUp(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownArrowUp,\n altKey: event.altKey\n });\n },\n Home: function Home(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownHome\n });\n },\n End: function End(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownEnd\n });\n },\n Escape: function Escape() {\n if (latest.current.state.isOpen) {\n dispatch({\n type: ToggleButtonKeyDownEscape\n });\n }\n },\n Enter: function Enter(event) {\n event.preventDefault();\n dispatch({\n type: latest.current.state.isOpen ? ToggleButtonKeyDownEnter : ToggleButtonClick$1\n });\n },\n PageUp: function PageUp(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownPageUp\n });\n }\n },\n PageDown: function PageDown(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownPageDown\n });\n }\n },\n ' ': function _(event) {\n event.preventDefault();\n var currentState = latest.current.state;\n if (!currentState.isOpen) {\n dispatch({\n type: ToggleButtonClick$1\n });\n return;\n }\n if (currentState.inputValue) {\n dispatch({\n type: ToggleButtonKeyDownCharacter,\n key: ' '\n });\n } else {\n dispatch({\n type: ToggleButtonKeyDownSpaceButton\n });\n }\n }\n };\n }, [dispatch, latest]);\n\n // Action functions.\n var toggleMenu = useCallback(function () {\n dispatch({\n type: FunctionToggleMenu$1\n });\n }, [dispatch]);\n var closeMenu = useCallback(function () {\n dispatch({\n type: FunctionCloseMenu$1\n });\n }, [dispatch]);\n var openMenu = useCallback(function () {\n dispatch({\n type: FunctionOpenMenu$1\n });\n }, [dispatch]);\n var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n dispatch({\n type: FunctionSetHighlightedIndex$1,\n highlightedIndex: newHighlightedIndex\n });\n }, [dispatch]);\n var selectItem = useCallback(function (newSelectedItem) {\n dispatch({\n type: FunctionSelectItem$1,\n selectedItem: newSelectedItem\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset$2\n });\n }, [dispatch]);\n var setInputValue = useCallback(function (newInputValue) {\n dispatch({\n type: FunctionSetInputValue$1,\n inputValue: newInputValue\n });\n }, [dispatch]);\n // Getter functions.\n var getLabelProps = useCallback(function (_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n onClick = _ref.onClick,\n labelProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);\n var labelHandleClick = function labelHandleClick() {\n var _toggleButtonRef$curr;\n (_toggleButtonRef$curr = toggleButtonRef.current) == null || _toggleButtonRef$curr.focus();\n };\n return _extends({\n id: elementIds.labelId,\n htmlFor: elementIds.toggleButtonId,\n onClick: callAllEventHandlers(onClick, labelHandleClick)\n }, labelProps);\n }, [elementIds]);\n var getMenuProps = useCallback(function (_temp2, _temp3) {\n var _extends2;\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n onMouseLeave = _ref2.onMouseLeave,\n _ref2$refKey = _ref2.refKey,\n refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,\n ref = _ref2.ref,\n rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$3);\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n _ref3$suppressRefErro = _ref3.suppressRefError,\n suppressRefError = _ref3$suppressRefErro === void 0 ? false : _ref3$suppressRefErro;\n var menuHandleMouseLeave = function menuHandleMouseLeave() {\n dispatch({\n type: MenuMouseLeave$1\n });\n };\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n menuRef.current = menuNode;\n }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends2), rest);\n }, [dispatch, setGetterPropCallInfo, elementIds]);\n var getToggleButtonProps = useCallback(function (_temp4, _temp5) {\n var _extends3;\n var _ref4 = _temp4 === void 0 ? {} : _temp4,\n onBlur = _ref4.onBlur,\n onClick = _ref4.onClick;\n _ref4.onPress;\n var onKeyDown = _ref4.onKeyDown,\n _ref4$refKey = _ref4.refKey,\n refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,\n ref = _ref4.ref,\n rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);\n var _ref5 = _temp5 === void 0 ? {} : _temp5,\n _ref5$suppressRefErro = _ref5.suppressRefError,\n suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;\n var latestState = latest.current.state;\n var toggleButtonHandleClick = function toggleButtonHandleClick() {\n dispatch({\n type: ToggleButtonClick$1\n });\n };\n var toggleButtonHandleBlur = function toggleButtonHandleBlur() {\n if (latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {\n dispatch({\n type: ToggleButtonBlur\n });\n }\n };\n var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && toggleButtonKeyDownHandlers[key]) {\n toggleButtonKeyDownHandlers[key](event);\n } else if (isAcceptedCharacterKey(key)) {\n dispatch({\n type: ToggleButtonKeyDownCharacter,\n key: key\n });\n }\n };\n var toggleProps = _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {\n toggleButtonRef.current = toggleButtonNode;\n }), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);\n if (!rest.disabled) {\n /* istanbul ignore if (react-native) */\n {\n toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);\n toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);\n }\n }\n setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);\n return toggleProps;\n }, [dispatch, elementIds, latest, mouseAndTouchTrackers, setGetterPropCallInfo, toggleButtonKeyDownHandlers]);\n var getItemProps = useCallback(function (_temp6) {\n var _extends4;\n var _ref6 = _temp6 === void 0 ? {} : _temp6,\n itemProp = _ref6.item,\n indexProp = _ref6.index,\n onMouseMove = _ref6.onMouseMove,\n onClick = _ref6.onClick,\n onMouseDown = _ref6.onMouseDown;\n _ref6.onPress;\n var _ref6$refKey = _ref6.refKey,\n refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,\n disabledProp = _ref6.disabled,\n ref = _ref6.ref,\n rest = _objectWithoutPropertiesLoose(_ref6, _excluded4$1);\n if (disabledProp !== undefined) {\n console.warn('Passing \"disabled\" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.');\n }\n var _latest$current = latest.current,\n latestState = _latest$current.state,\n latestProps = _latest$current.props;\n var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n item = _getItemAndIndex[0],\n index = _getItemAndIndex[1];\n var disabled = latestProps.isItemDisabled(item, index);\n var itemHandleMouseMove = function itemHandleMouseMove() {\n if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {\n return;\n }\n shouldScrollRef.current = false;\n dispatch({\n type: ItemMouseMove$1,\n index: index,\n disabled: disabled\n });\n };\n var itemHandleClick = function itemHandleClick() {\n dispatch({\n type: ItemClick$1,\n index: index\n });\n };\n var itemHandleMouseDown = function itemHandleMouseDown(e) {\n return e.preventDefault();\n }; // keep focus on the toggle after item click select.\n\n var itemProps = _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(index)] = itemNode;\n }\n }), _extends4['aria-disabled'] = disabled, _extends4['aria-selected'] = item === latestState.selectedItem, _extends4.id = elementIds.getItemId(index), _extends4.role = 'option', _extends4), rest);\n if (!disabled) {\n /* istanbul ignore next (react-native) */\n {\n itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);\n }\n }\n itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);\n itemProps.onMouseDown = callAllEventHandlers(onMouseDown, itemHandleMouseDown);\n return itemProps;\n }, [latest, elementIds, mouseAndTouchTrackers, shouldScrollRef, dispatch]);\n return {\n // prop getters.\n getToggleButtonProps: getToggleButtonProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getItemProps: getItemProps,\n // actions.\n toggleMenu: toggleMenu,\n openMenu: openMenu,\n closeMenu: closeMenu,\n setHighlightedIndex: setHighlightedIndex,\n selectItem: selectItem,\n reset: reset,\n setInputValue: setInputValue,\n // state.\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\n\nvar InputKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_down__' : 0;\nvar InputKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_up__' : 1;\nvar InputKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__input_keydown_escape__' : 2;\nvar InputKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__input_keydown_home__' : 3;\nvar InputKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__input_keydown_end__' : 4;\nvar InputKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_up__' : 5;\nvar InputKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_down__' : 6;\nvar InputKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__input_keydown_enter__' : 7;\nvar InputChange = process.env.NODE_ENV !== \"production\" ? '__input_change__' : 8;\nvar InputBlur = process.env.NODE_ENV !== \"production\" ? '__input_blur__' : 9;\nvar InputClick = process.env.NODE_ENV !== \"production\" ? '__input_click__' : 10;\nvar MenuMouseLeave = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 11;\nvar ItemMouseMove = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 12;\nvar ItemClick = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 13;\nvar ToggleButtonClick = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 14;\nvar FunctionToggleMenu = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$1 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\nvar ControlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__controlled_prop_updated_selected_item__' : 22;\n\nvar stateChangeTypes$2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem,\n FunctionCloseMenu: FunctionCloseMenu,\n FunctionOpenMenu: FunctionOpenMenu,\n FunctionReset: FunctionReset$1,\n FunctionSelectItem: FunctionSelectItem,\n FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,\n FunctionSetInputValue: FunctionSetInputValue,\n FunctionToggleMenu: FunctionToggleMenu,\n InputBlur: InputBlur,\n InputChange: InputChange,\n InputClick: InputClick,\n InputKeyDownArrowDown: InputKeyDownArrowDown,\n InputKeyDownArrowUp: InputKeyDownArrowUp,\n InputKeyDownEnd: InputKeyDownEnd,\n InputKeyDownEnter: InputKeyDownEnter,\n InputKeyDownEscape: InputKeyDownEscape,\n InputKeyDownHome: InputKeyDownHome,\n InputKeyDownPageDown: InputKeyDownPageDown,\n InputKeyDownPageUp: InputKeyDownPageUp,\n ItemClick: ItemClick,\n ItemMouseMove: ItemMouseMove,\n MenuMouseLeave: MenuMouseLeave,\n ToggleButtonClick: ToggleButtonClick\n});\n\nfunction getInitialState$2(props) {\n var initialState = getInitialState$3(props);\n var selectedItem = initialState.selectedItem;\n var inputValue = initialState.inputValue;\n if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {\n inputValue = props.itemToString(selectedItem);\n }\n return _extends({}, initialState, {\n inputValue: inputValue\n });\n}\nvar propTypes$2 = _extends({}, propTypes$4, {\n items: PropTypes.array.isRequired,\n isItemDisabled: PropTypes.func,\n inputValue: PropTypes.string,\n defaultInputValue: PropTypes.string,\n initialInputValue: PropTypes.string,\n inputId: PropTypes.string,\n onInputValueChange: PropTypes.func\n});\n\n/**\n * The useCombobox version of useControlledReducer, which also\n * checks if the controlled prop selectedItem changed between\n * renders. If so, it will also update inputValue with its\n * string equivalent. It uses the common useEnhancedReducer to\n * compute the rest of the state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} props The hook props, also passed to createInitialState.\n * @param {Function} createInitialState Function that returns the initial state.\n * @param {Function} isStateEqual Function that checks if a previous state is equal to the next.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer(reducer, props, createInitialState, isStateEqual) {\n var previousSelectedItemRef = useRef();\n var _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual),\n state = _useEnhancedReducer[0],\n dispatch = _useEnhancedReducer[1];\n var isInitialMount = useIsInitialMount();\n useEffect(function () {\n if (!isControlledProp(props, 'selectedItem')) {\n return;\n }\n if (!isInitialMount // on first mount we already have the proper inputValue for a initial selected item.\n ) {\n var shouldCallDispatch = props.itemToKey(props.selectedItem) !== props.itemToKey(previousSelectedItemRef.current);\n if (shouldCallDispatch) {\n dispatch({\n type: ControlledPropUpdatedSelectedItem,\n inputValue: props.itemToString(props.selectedItem)\n });\n }\n }\n previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.selectedItem, props.selectedItem]);\n return [getState(state, props), dispatch];\n}\nvar defaultProps$1 = _extends({}, defaultProps$3, {\n isItemDisabled: function isItemDisabled() {\n return false;\n }\n});\n\n/* eslint-disable complexity */\nfunction downshiftUseComboboxReducer(state, props, action) {\n var _props$items;\n var type = action.type,\n altKey = action.altKey;\n var changes;\n switch (type) {\n case ItemClick:\n changes = {\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n highlightedIndex: getDefaultHighlightedIndex(props),\n selectedItem: props.items[action.index],\n inputValue: props.itemToString(props.items[action.index])\n };\n break;\n case InputKeyDownArrowDown:\n if (state.isOpen) {\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled, true)\n };\n } else {\n changes = {\n highlightedIndex: altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1),\n isOpen: props.items.length >= 0\n };\n }\n break;\n case InputKeyDownArrowUp:\n if (state.isOpen) {\n if (altKey) {\n changes = getChangesOnSelection(props, state.highlightedIndex);\n } else {\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled, true)\n };\n }\n } else {\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(props, state, -1),\n isOpen: props.items.length >= 0\n };\n }\n break;\n case InputKeyDownEnter:\n changes = getChangesOnSelection(props, state.highlightedIndex);\n break;\n case InputKeyDownEscape:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, !state.isOpen && {\n selectedItem: null,\n inputValue: ''\n });\n break;\n case InputKeyDownPageUp:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled, true)\n };\n break;\n case InputKeyDownPageDown:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled, true)\n };\n break;\n case InputKeyDownHome:\n changes = {\n highlightedIndex: getNonDisabledIndex(0, false, props.items, props.isItemDisabled)\n };\n break;\n case InputKeyDownEnd:\n changes = {\n highlightedIndex: getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled)\n };\n break;\n case InputBlur:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && action.selectItem && {\n selectedItem: props.items[state.highlightedIndex],\n inputValue: props.itemToString(props.items[state.highlightedIndex])\n });\n break;\n case InputChange:\n changes = {\n isOpen: true,\n highlightedIndex: getDefaultHighlightedIndex(props),\n inputValue: action.inputValue\n };\n break;\n case InputClick:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case FunctionSelectItem:\n changes = {\n selectedItem: action.selectedItem,\n inputValue: props.itemToString(action.selectedItem)\n };\n break;\n case ControlledPropUpdatedSelectedItem:\n changes = {\n inputValue: action.inputValue\n };\n break;\n default:\n return downshiftCommonReducer(state, props, action, stateChangeTypes$2);\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar _excluded$2 = [\"onMouseLeave\", \"refKey\", \"ref\"],\n _excluded2$2 = [\"item\", \"index\", \"refKey\", \"ref\", \"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"disabled\"],\n _excluded3$1 = [\"onClick\", \"onPress\", \"refKey\", \"ref\"],\n _excluded4 = [\"onKeyDown\", \"onChange\", \"onInput\", \"onBlur\", \"onChangeText\", \"onClick\", \"refKey\", \"ref\"];\nuseCombobox.stateChangeTypes = stateChangeTypes$2;\nfunction useCombobox(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes$1(userProps, useCombobox, propTypes$2);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps$1, userProps);\n var items = props.items,\n scrollIntoView = props.scrollIntoView,\n environment = props.environment,\n getA11yStatusMessage = props.getA11yStatusMessage;\n // Initial state depending on controlled props.\n var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, props, getInitialState$2, isDropdownsStateEqual),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var isOpen = state.isOpen,\n highlightedIndex = state.highlightedIndex,\n selectedItem = state.selectedItem,\n inputValue = state.inputValue;\n\n // Element refs.\n var menuRef = useRef(null);\n var itemRefs = useRef({});\n var inputRef = useRef(null);\n var toggleButtonRef = useRef(null);\n var isInitialMount = useIsInitialMount();\n\n // prevent id re-generation between renders.\n var elementIds = useElementIds$1(props);\n // used to keep track of how many items we had on previous cycle.\n var previousResultCountRef = useRef();\n // utility callback to get item element.\n var latest = useLatestRef({\n state: state,\n props: props\n });\n var getItemNodeFromIndex = useCallback(function (index) {\n return itemRefs.current[elementIds.getItemId(index)];\n }, [elementIds]);\n\n // Effects.\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n useA11yMessageStatus(getA11yStatusMessage, state, [isOpen, highlightedIndex, selectedItem, inputValue], environment);\n // Scroll on highlighted item if change comes from keyboard.\n var shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n itemRefs: itemRefs,\n scrollIntoView: scrollIntoView,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n useControlPropsValidator({\n props: props,\n state: state\n });\n // Focus the input on first render if required.\n useEffect(function () {\n var focusOnOpen = getInitialValue$1(props, 'isOpen', defaultStateValues$1);\n if (focusOnOpen && inputRef.current) {\n inputRef.current.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n useEffect(function () {\n if (!isInitialMount) {\n previousResultCountRef.current = items.length;\n }\n });\n var handleBlurInTracker = useCallback(function handleBlur() {\n if (latest.current.state.isOpen) {\n dispatch({\n type: InputBlur\n });\n }\n }, [dispatch, latest]);\n var downshiftRefs = useMemo(function () {\n return [menuRef, toggleButtonRef, inputRef];\n }, []);\n var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, handleBlurInTracker, downshiftRefs);\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');\n // Reset itemRefs on close.\n useEffect(function () {\n if (!isOpen) {\n itemRefs.current = {};\n }\n }, [isOpen]);\n // Reset itemRefs on close.\n useEffect(function () {\n var _inputRef$current;\n if (!isOpen || !(environment != null && environment.document) || !(inputRef != null && (_inputRef$current = inputRef.current) != null && _inputRef$current.focus)) {\n return;\n }\n if (environment.document.activeElement !== inputRef.current) {\n inputRef.current.focus();\n }\n }, [isOpen, environment]);\n\n /* Event handler functions */\n var inputKeyDownHandlers = useMemo(function () {\n return {\n ArrowDown: function ArrowDown(event) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownArrowDown,\n altKey: event.altKey\n });\n },\n ArrowUp: function ArrowUp(event) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownArrowUp,\n altKey: event.altKey\n });\n },\n Home: function Home(event) {\n if (!latest.current.state.isOpen) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownHome\n });\n },\n End: function End(event) {\n if (!latest.current.state.isOpen) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownEnd\n });\n },\n Escape: function Escape(event) {\n var latestState = latest.current.state;\n if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownEscape\n });\n }\n },\n Enter: function Enter(event) {\n var latestState = latest.current.state;\n // if closed or no highlighted index, do nothing.\n if (!latestState.isOpen || event.which === 229 // if IME composing, wait for next Enter keydown event.\n ) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownEnter\n });\n },\n PageUp: function PageUp(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownPageUp\n });\n }\n },\n PageDown: function PageDown(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownPageDown\n });\n }\n }\n };\n }, [dispatch, latest]);\n\n // Getter props.\n var getLabelProps = useCallback(function (labelProps) {\n return _extends({\n id: elementIds.labelId,\n htmlFor: elementIds.inputId\n }, labelProps);\n }, [elementIds]);\n var getMenuProps = useCallback(function (_temp, _temp2) {\n var _extends2;\n var _ref = _temp === void 0 ? {} : _temp,\n onMouseLeave = _ref.onMouseLeave,\n _ref$refKey = _ref.refKey,\n refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n ref = _ref.ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$suppressRefErro = _ref2.suppressRefError,\n suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n menuRef.current = menuNode;\n }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {\n dispatch({\n type: MenuMouseLeave\n });\n }), _extends2), rest);\n }, [dispatch, setGetterPropCallInfo, elementIds]);\n var getItemProps = useCallback(function (_temp3) {\n var _extends3, _ref4;\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n itemProp = _ref3.item,\n indexProp = _ref3.index,\n _ref3$refKey = _ref3.refKey,\n refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n ref = _ref3.ref,\n onMouseMove = _ref3.onMouseMove,\n onMouseDown = _ref3.onMouseDown,\n onClick = _ref3.onClick;\n _ref3.onPress;\n var disabledProp = _ref3.disabled,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$2);\n if (disabledProp !== undefined) {\n console.warn('Passing \"disabled\" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');\n }\n var _latest$current = latest.current,\n latestProps = _latest$current.props,\n latestState = _latest$current.state;\n var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n item = _getItemAndIndex[0],\n index = _getItemAndIndex[1];\n var disabled = latestProps.isItemDisabled(item, index);\n var onSelectKey = 'onClick';\n var customClickHandler = onClick;\n var itemHandleMouseMove = function itemHandleMouseMove() {\n if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {\n return;\n }\n shouldScrollRef.current = false;\n dispatch({\n type: ItemMouseMove,\n index: index,\n disabled: disabled\n });\n };\n var itemHandleClick = function itemHandleClick() {\n dispatch({\n type: ItemClick,\n index: index\n });\n };\n var itemHandleMouseDown = function itemHandleMouseDown(e) {\n return e.preventDefault();\n }; // keep focus on the input after item click select.\n\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(index)] = itemNode;\n }\n }), _extends3['aria-disabled'] = disabled, _extends3['aria-selected'] = index === latestState.highlightedIndex, _extends3.id = elementIds.getItemId(index), _extends3.role = 'option', _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), {\n onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),\n onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown)\n }, rest);\n }, [dispatch, elementIds, latest, mouseAndTouchTrackers, shouldScrollRef]);\n var getToggleButtonProps = useCallback(function (_temp4) {\n var _extends4;\n var _ref5 = _temp4 === void 0 ? {} : _temp4,\n onClick = _ref5.onClick;\n _ref5.onPress;\n var _ref5$refKey = _ref5.refKey,\n refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n ref = _ref5.ref,\n rest = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);\n var latestState = latest.current.state;\n var toggleButtonHandleClick = function toggleButtonHandleClick() {\n dispatch({\n type: ToggleButtonClick\n });\n };\n return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {\n toggleButtonRef.current = toggleButtonNode;\n }), _extends4['aria-controls'] = elementIds.menuId, _extends4['aria-expanded'] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({}, {\n onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)\n }), rest);\n }, [dispatch, latest, elementIds]);\n var getInputProps = useCallback(function (_temp5, _temp6) {\n var _extends5;\n var _ref6 = _temp5 === void 0 ? {} : _temp5,\n onKeyDown = _ref6.onKeyDown,\n onChange = _ref6.onChange,\n onInput = _ref6.onInput,\n onBlur = _ref6.onBlur;\n _ref6.onChangeText;\n var onClick = _ref6.onClick,\n _ref6$refKey = _ref6.refKey,\n refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,\n ref = _ref6.ref,\n rest = _objectWithoutPropertiesLoose(_ref6, _excluded4);\n var _ref7 = _temp6 === void 0 ? {} : _temp6,\n _ref7$suppressRefErro = _ref7.suppressRefError,\n suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;\n setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);\n var latestState = latest.current.state;\n var inputHandleKeyDown = function inputHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && inputKeyDownHandlers[key]) {\n inputKeyDownHandlers[key](event);\n }\n };\n var inputHandleChange = function inputHandleChange(event) {\n dispatch({\n type: InputChange,\n inputValue: event.target.value\n });\n };\n var inputHandleBlur = function inputHandleBlur(event) {\n /* istanbul ignore else */\n if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {\n var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;\n dispatch({\n type: InputBlur,\n selectItem: !isBlurByTabChange\n });\n }\n };\n var inputHandleClick = function inputHandleClick() {\n dispatch({\n type: InputClick\n });\n };\n\n /* istanbul ignore next (preact) */\n var onChangeKey = 'onChange';\n var eventHandlers = {};\n if (!rest.disabled) {\n var _eventHandlers;\n eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onClick = callAllEventHandlers(onClick, inputHandleClick), _eventHandlers);\n }\n return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {\n inputRef.current = inputNode;\n }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);\n }, [dispatch, elementIds, environment, inputKeyDownHandlers, latest, mouseAndTouchTrackers, setGetterPropCallInfo]);\n\n // returns\n var toggleMenu = useCallback(function () {\n dispatch({\n type: FunctionToggleMenu\n });\n }, [dispatch]);\n var closeMenu = useCallback(function () {\n dispatch({\n type: FunctionCloseMenu\n });\n }, [dispatch]);\n var openMenu = useCallback(function () {\n dispatch({\n type: FunctionOpenMenu\n });\n }, [dispatch]);\n var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n dispatch({\n type: FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex\n });\n }, [dispatch]);\n var selectItem = useCallback(function (newSelectedItem) {\n dispatch({\n type: FunctionSelectItem,\n selectedItem: newSelectedItem\n });\n }, [dispatch]);\n var setInputValue = useCallback(function (newInputValue) {\n dispatch({\n type: FunctionSetInputValue,\n inputValue: newInputValue\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset$1\n });\n }, [dispatch]);\n return {\n // prop getters.\n getItemProps: getItemProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getInputProps: getInputProps,\n getToggleButtonProps: getToggleButtonProps,\n // actions.\n toggleMenu: toggleMenu,\n openMenu: openMenu,\n closeMenu: closeMenu,\n setHighlightedIndex: setHighlightedIndex,\n setInputValue: setInputValue,\n selectItem: selectItem,\n reset: reset,\n // state.\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\n\nvar defaultStateValues = {\n activeIndex: -1,\n selectedItems: []\n};\n\n/**\n * Returns the initial value for a state key in the following order:\n * 1. controlled prop, 2. initial prop, 3. default prop, 4. default\n * value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getInitialValue(props, propKey) {\n return getInitialValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Returns the default value for a state key in the following order:\n * 1. controlled prop, 2. default prop, 3. default value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getDefaultValue(props, propKey) {\n return getDefaultValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Gets the initial state based on the provided props. It uses initial, default\n * and controlled props related to state in order to compute the initial value.\n *\n * @param {Object} props Props passed to the hook.\n * @returns {Object} The initial state.\n */\nfunction getInitialState$1(props) {\n var activeIndex = getInitialValue(props, 'activeIndex');\n var selectedItems = getInitialValue(props, 'selectedItems');\n return {\n activeIndex: activeIndex,\n selectedItems: selectedItems\n };\n}\n\n/**\n * Returns true if dropdown keydown operation is permitted. Should not be\n * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on\n * input element with text content that is either highlighted or selection\n * cursor is not at the starting position.\n *\n * @param {KeyboardEvent} event The event from keydown.\n * @returns {boolean} Whether the operation is allowed.\n */\nfunction isKeyDownOperationPermitted(event) {\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n var element = event.target;\n if (element instanceof HTMLInputElement &&\n // if element is a text input\n element.value !== '' && (\n // and we have text in it\n // and cursor is either not at the start or is currently highlighting text.\n element.selectionStart !== 0 || element.selectionEnd !== 0)) {\n return false;\n }\n return true;\n}\n\n/**\n * Check if a state is equal for taglist, by comparing active index and selected items.\n * Used by useSelect and useCombobox.\n *\n * @param {Object} prevState\n * @param {Object} newState\n * @returns {boolean} Wheather the states are deeply equal.\n */\nfunction isStateEqual$1(prevState, newState) {\n return prevState.selectedItems === newState.selectedItems && prevState.activeIndex === newState.activeIndex;\n}\nvar propTypes$1 = {\n stateReducer: propTypes$4.stateReducer,\n itemToKey: propTypes$4.itemToKey,\n environment: propTypes$4.environment,\n selectedItems: PropTypes.array,\n initialSelectedItems: PropTypes.array,\n defaultSelectedItems: PropTypes.array,\n getA11yStatusMessage: PropTypes.func,\n activeIndex: PropTypes.number,\n initialActiveIndex: PropTypes.number,\n defaultActiveIndex: PropTypes.number,\n onActiveIndexChange: PropTypes.func,\n onSelectedItemsChange: PropTypes.func,\n keyNavigationNext: PropTypes.string,\n keyNavigationPrevious: PropTypes.string\n};\nvar defaultProps = {\n itemToKey: defaultProps$3.itemToKey,\n stateReducer: defaultProps$3.stateReducer,\n environment: defaultProps$3.environment,\n keyNavigationNext: 'ArrowRight',\n keyNavigationPrevious: 'ArrowLeft'\n};\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes = function validatePropTypes(options, caller) {\n PropTypes.checkPropTypes(propTypes$1, options, 'prop', caller.name);\n };\n}\n\nvar SelectedItemClick = process.env.NODE_ENV !== \"production\" ? '__selected_item_click__' : 0;\nvar SelectedItemKeyDownDelete = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_delete__' : 1;\nvar SelectedItemKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_backspace__' : 2;\nvar SelectedItemKeyDownNavigationNext = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_next__' : 3;\nvar SelectedItemKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_previous__' : 4;\nvar DropdownKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_navigation_previous__' : 5;\nvar DropdownKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_backspace__' : 6;\nvar DropdownClick = process.env.NODE_ENV !== \"production\" ? '__dropdown_click__' : 7;\nvar FunctionAddSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_add_selected_item__' : 8;\nvar FunctionRemoveSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_remove_selected_item__' : 9;\nvar FunctionSetSelectedItems = process.env.NODE_ENV !== \"production\" ? '__function_set_selected_items__' : 10;\nvar FunctionSetActiveIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_active_index__' : 11;\nvar FunctionReset = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 12;\n\nvar stateChangeTypes$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n DropdownClick: DropdownClick,\n DropdownKeyDownBackspace: DropdownKeyDownBackspace,\n DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,\n FunctionAddSelectedItem: FunctionAddSelectedItem,\n FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,\n FunctionReset: FunctionReset,\n FunctionSetActiveIndex: FunctionSetActiveIndex,\n FunctionSetSelectedItems: FunctionSetSelectedItems,\n SelectedItemClick: SelectedItemClick,\n SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,\n SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,\n SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,\n SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious\n});\n\n/* eslint-disable complexity */\nfunction downshiftMultipleSelectionReducer(state, props, action) {\n var type = action.type,\n index = action.index,\n selectedItem = action.selectedItem;\n var activeIndex = state.activeIndex,\n selectedItems = state.selectedItems;\n var changes;\n switch (type) {\n case SelectedItemClick:\n changes = {\n activeIndex: index\n };\n break;\n case SelectedItemKeyDownNavigationPrevious:\n changes = {\n activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1\n };\n break;\n case SelectedItemKeyDownNavigationNext:\n changes = {\n activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1\n };\n break;\n case SelectedItemKeyDownBackspace:\n case SelectedItemKeyDownDelete:\n {\n if (activeIndex < 0) {\n break;\n }\n var newActiveIndex = activeIndex;\n if (selectedItems.length === 1) {\n newActiveIndex = -1;\n } else if (activeIndex === selectedItems.length - 1) {\n newActiveIndex = selectedItems.length - 2;\n }\n changes = _extends({\n selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))\n }, {\n activeIndex: newActiveIndex\n });\n break;\n }\n case DropdownKeyDownNavigationPrevious:\n changes = {\n activeIndex: selectedItems.length - 1\n };\n break;\n case DropdownKeyDownBackspace:\n changes = {\n selectedItems: selectedItems.slice(0, selectedItems.length - 1)\n };\n break;\n case FunctionAddSelectedItem:\n changes = {\n selectedItems: [].concat(selectedItems, [selectedItem])\n };\n break;\n case DropdownClick:\n changes = {\n activeIndex: -1\n };\n break;\n case FunctionRemoveSelectedItem:\n {\n var _newActiveIndex = activeIndex;\n var selectedItemIndex = selectedItems.findIndex(function (item) {\n return props.itemToKey(item) === props.itemToKey(selectedItem);\n });\n if (selectedItemIndex < 0) {\n break;\n }\n if (selectedItems.length === 1) {\n _newActiveIndex = -1;\n } else if (selectedItemIndex === selectedItems.length - 1) {\n _newActiveIndex = selectedItems.length - 2;\n }\n changes = {\n selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)),\n activeIndex: _newActiveIndex\n };\n break;\n }\n case FunctionSetSelectedItems:\n {\n var newSelectedItems = action.selectedItems;\n changes = {\n selectedItems: newSelectedItems\n };\n break;\n }\n case FunctionSetActiveIndex:\n {\n var _newActiveIndex2 = action.activeIndex;\n changes = {\n activeIndex: _newActiveIndex2\n };\n break;\n }\n case FunctionReset:\n changes = {\n activeIndex: getDefaultValue(props, 'activeIndex'),\n selectedItems: getDefaultValue(props, 'selectedItems')\n };\n break;\n default:\n throw new Error('Reducer called without proper action type.');\n }\n return _extends({}, state, changes);\n}\n\nvar _excluded$1 = [\"refKey\", \"ref\", \"onClick\", \"onKeyDown\", \"selectedItem\", \"index\"],\n _excluded2$1 = [\"refKey\", \"ref\", \"onKeyDown\", \"onClick\", \"preventKeyAction\"];\nuseMultipleSelection.stateChangeTypes = stateChangeTypes$1;\nfunction useMultipleSelection(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes(userProps, useMultipleSelection);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps, userProps);\n var getA11yStatusMessage = props.getA11yStatusMessage,\n environment = props.environment,\n keyNavigationNext = props.keyNavigationNext,\n keyNavigationPrevious = props.keyNavigationPrevious;\n\n // Reducer init.\n var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, props, getInitialState$1, isStateEqual$1),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var activeIndex = state.activeIndex,\n selectedItems = state.selectedItems;\n\n // Refs.\n var isInitialMount = useIsInitialMount();\n var dropdownRef = useRef(null);\n var selectedItemRefs = useRef();\n selectedItemRefs.current = [];\n var latest = useLatestRef({\n state: state,\n props: props\n });\n\n // Effects.\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n useA11yMessageStatus(getA11yStatusMessage, state, [activeIndex, selectedItems], environment);\n // Sets focus on active item.\n useEffect(function () {\n if (isInitialMount) {\n return;\n }\n if (activeIndex === -1 && dropdownRef.current) {\n dropdownRef.current.focus();\n } else if (selectedItemRefs.current[activeIndex]) {\n selectedItemRefs.current[activeIndex].focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex]);\n useControlPropsValidator({\n props: props,\n state: state\n });\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps');\n\n // Event handler functions.\n var selectedItemKeyDownHandlers = useMemo(function () {\n var _ref;\n return _ref = {}, _ref[keyNavigationPrevious] = function () {\n dispatch({\n type: SelectedItemKeyDownNavigationPrevious\n });\n }, _ref[keyNavigationNext] = function () {\n dispatch({\n type: SelectedItemKeyDownNavigationNext\n });\n }, _ref.Delete = function Delete() {\n dispatch({\n type: SelectedItemKeyDownDelete\n });\n }, _ref.Backspace = function Backspace() {\n dispatch({\n type: SelectedItemKeyDownBackspace\n });\n }, _ref;\n }, [dispatch, keyNavigationNext, keyNavigationPrevious]);\n var dropdownKeyDownHandlers = useMemo(function () {\n var _ref2;\n return _ref2 = {}, _ref2[keyNavigationPrevious] = function (event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: DropdownKeyDownNavigationPrevious\n });\n }\n }, _ref2.Backspace = function Backspace(event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: DropdownKeyDownBackspace\n });\n }\n }, _ref2;\n }, [dispatch, keyNavigationPrevious]);\n\n // Getter props.\n var getSelectedItemProps = useCallback(function (_temp) {\n var _extends2;\n var _ref3 = _temp === void 0 ? {} : _temp,\n _ref3$refKey = _ref3.refKey,\n refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n ref = _ref3.ref,\n onClick = _ref3.onClick,\n onKeyDown = _ref3.onKeyDown,\n selectedItemProp = _ref3.selectedItem,\n indexProp = _ref3.index,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded$1);\n var latestState = latest.current.state;\n var _getItemAndIndex = getItemAndIndex(selectedItemProp, indexProp, latestState.selectedItems, 'Pass either item or index to getSelectedItemProps!'),\n index = _getItemAndIndex[1];\n var isFocusable = index > -1 && index === latestState.activeIndex;\n var selectedItemHandleClick = function selectedItemHandleClick() {\n dispatch({\n type: SelectedItemClick,\n index: index\n });\n };\n var selectedItemHandleKeyDown = function selectedItemHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && selectedItemKeyDownHandlers[key]) {\n selectedItemKeyDownHandlers[key](event);\n }\n };\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (selectedItemNode) {\n if (selectedItemNode) {\n selectedItemRefs.current.push(selectedItemNode);\n }\n }), _extends2.tabIndex = isFocusable ? 0 : -1, _extends2.onClick = callAllEventHandlers(onClick, selectedItemHandleClick), _extends2.onKeyDown = callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends2), rest);\n }, [dispatch, latest, selectedItemKeyDownHandlers]);\n var getDropdownProps = useCallback(function (_temp2, _temp3) {\n var _extends3;\n var _ref4 = _temp2 === void 0 ? {} : _temp2,\n _ref4$refKey = _ref4.refKey,\n refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,\n ref = _ref4.ref,\n onKeyDown = _ref4.onKeyDown,\n onClick = _ref4.onClick,\n _ref4$preventKeyActio = _ref4.preventKeyAction,\n preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,\n rest = _objectWithoutPropertiesLoose(_ref4, _excluded2$1);\n var _ref5 = _temp3 === void 0 ? {} : _temp3,\n _ref5$suppressRefErro = _ref5.suppressRefError,\n suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;\n setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);\n var dropdownHandleKeyDown = function dropdownHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && dropdownKeyDownHandlers[key]) {\n dropdownKeyDownHandlers[key](event);\n }\n };\n var dropdownHandleClick = function dropdownHandleClick() {\n dispatch({\n type: DropdownClick\n });\n };\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (dropdownNode) {\n if (dropdownNode) {\n dropdownRef.current = dropdownNode;\n }\n }), _extends3), !preventKeyAction && {\n onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),\n onClick: callAllEventHandlers(onClick, dropdownHandleClick)\n }, rest);\n }, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]);\n\n // returns\n var addSelectedItem = useCallback(function (selectedItem) {\n dispatch({\n type: FunctionAddSelectedItem,\n selectedItem: selectedItem\n });\n }, [dispatch]);\n var removeSelectedItem = useCallback(function (selectedItem) {\n dispatch({\n type: FunctionRemoveSelectedItem,\n selectedItem: selectedItem\n });\n }, [dispatch]);\n var setSelectedItems = useCallback(function (newSelectedItems) {\n dispatch({\n type: FunctionSetSelectedItems,\n selectedItems: newSelectedItems\n });\n }, [dispatch]);\n var setActiveIndex = useCallback(function (newActiveIndex) {\n dispatch({\n type: FunctionSetActiveIndex,\n activeIndex: newActiveIndex\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset\n });\n }, [dispatch]);\n return {\n getSelectedItemProps: getSelectedItemProps,\n getDropdownProps: getDropdownProps,\n addSelectedItem: addSelectedItem,\n removeSelectedItem: removeSelectedItem,\n setSelectedItems: setSelectedItems,\n setActiveIndex: setActiveIndex,\n reset: reset,\n selectedItems: selectedItems,\n activeIndex: activeIndex\n };\n}\n\nvar TagClick = process.env.NODE_ENV !== \"production\" ? '__tag_click__' : 0;\nvar TagGroupKeyDownArrowLeft = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_arrowleft__' : 1;\nvar TagGroupKeyDownArrowRight = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_arrowright__' : 2;\nvar TagGroupKeyDownDelete = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_delete__' : 3;\nvar TagGroupKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_backspace__' : 4;\nvar TagRemoveClick = process.env.NODE_ENV !== \"production\" ? '__tagremove_click__' : 5;\nvar FunctionAddItem = process.env.NODE_ENV !== \"production\" ? '__function_add_item__' : 6;\n\nvar stateChangeTypes = /*#__PURE__*/Object.freeze({\n __proto__: null,\n FunctionAddItem: FunctionAddItem,\n TagClick: TagClick,\n TagGroupKeyDownArrowLeft: TagGroupKeyDownArrowLeft,\n TagGroupKeyDownArrowRight: TagGroupKeyDownArrowRight,\n TagGroupKeyDownBackspace: TagGroupKeyDownBackspace,\n TagGroupKeyDownDelete: TagGroupKeyDownDelete,\n TagRemoveClick: TagRemoveClick\n});\n\nfunction useTagGroupReducer(state, _props, action) {\n var type = action.type;\n var changes;\n switch (type) {\n case TagClick:\n changes = {\n activeIndex: action.index\n };\n break;\n case TagGroupKeyDownArrowLeft:\n changes = {\n activeIndex: state.activeIndex === 0 ? state.items.length - 1 : state.activeIndex - 1\n };\n break;\n case TagGroupKeyDownArrowRight:\n changes = {\n activeIndex: state.activeIndex === state.items.length - 1 ? 0 : state.activeIndex + 1\n };\n break;\n case TagGroupKeyDownBackspace:\n case TagGroupKeyDownDelete:\n {\n var newItems = [].concat(state.items.slice(0, state.activeIndex), state.items.slice(state.activeIndex + 1));\n var newActiveIndex = newItems.length === 0 ? -1 : newItems.length === state.activeIndex ? state.activeIndex - 1 : state.activeIndex;\n changes = {\n items: [].concat(state.items.slice(0, state.activeIndex), state.items.slice(state.activeIndex + 1)),\n activeIndex: newActiveIndex\n };\n break;\n }\n case TagRemoveClick:\n {\n var _newItems = [].concat(state.items.slice(0, action.index), state.items.slice(action.index + 1));\n var _newActiveIndex = _newItems.length === 0 ? -1 : _newItems.length === action.index ? action.index - 1 : action.index;\n changes = {\n items: _newItems,\n activeIndex: _newActiveIndex\n };\n }\n break;\n case FunctionAddItem:\n {\n var _newItems2 = [];\n if (action.index === undefined) {\n _newItems2 = [].concat(state.items, [action.item]);\n } else {\n _newItems2 = [].concat(state.items.slice(0, action.index), [action.item], state.items.slice(action.index));\n }\n var _newActiveIndex2 = state.activeIndex === -1 ? _newItems2.length - 1 : state.activeIndex;\n changes = {\n items: _newItems2,\n activeIndex: _newActiveIndex2\n };\n break;\n }\n default:\n throw new Error('Invalid useTagGroup reducer action.');\n }\n return _extends({}, state, changes);\n}\n\n// https://github.com/downshift-js/downshift/issues/1674#issuecomment-3924320872\nvar SafeReact = _extends({}, React);\nvar reactUseId = SafeReact.useId;\n\n// istanbul ignore next\nvar useElementIds = typeof reactUseId === 'function' ? useElementIdsR18 : useElementIdsLegacy;\nfunction useElementIdsR18(_ref) {\n var id = _ref.id,\n tagGroupId = _ref.tagGroupId,\n getTagId = _ref.getTagId;\n var reactId = \"downshift-\" + reactUseId();\n if (!id) {\n id = reactId;\n }\n var elementIds = React.useMemo(function () {\n return {\n tagGroupId: tagGroupId != null ? tagGroupId : id + \"-tag-group\",\n getTagId: getTagId != null ? getTagId : function (index) {\n return id + \"-tag-\" + index;\n }\n };\n }, [getTagId, id, tagGroupId]);\n return elementIds;\n}\nfunction useElementIdsLegacy(_ref2) {\n var id = _ref2.id,\n getTagId = _ref2.getTagId,\n tagGroupId = _ref2.tagGroupId;\n var baseIdRef = React.useRef(id != null ? id : \"downshift-\" + generateId());\n var baseId = baseIdRef.current;\n var elementIds = React.useMemo(function () {\n return {\n tagGroupId: tagGroupId != null ? tagGroupId : baseId + \"-tag-group\",\n getTagId: getTagId != null ? getTagId : function (index) {\n return baseId + \"-tag-\" + index;\n }\n };\n }, [getTagId, baseId, tagGroupId]);\n return elementIds;\n}\n\nfunction getInitialState(props) {\n var _ref, _props$items, _ref2, _props$activeIndex;\n var items = (_ref = (_props$items = props.items) != null ? _props$items : props.initialItems) != null ? _ref : [];\n var activeIndex = (_ref2 = (_props$activeIndex = props.activeIndex) != null ? _props$activeIndex : props.initialActiveIndex) != null ? _ref2 : items.length === 0 ? -1 : 0;\n return {\n activeIndex: activeIndex,\n items: items\n };\n}\n\nfunction isStateEqual(oldState, newState) {\n return oldState.activeIndex === newState.activeIndex && oldState.items === newState.items;\n}\n\nvar A11Y_DESCRIPTION_ELEMENT_ID = 'tag-group-a11y-description';\nfunction useAccessibleDescription(document, description) {\n React.useEffect(function () {\n if (!document) {\n return;\n }\n var accessibleDescriptionElement = document.createElement('div');\n accessibleDescriptionElement.setAttribute('id', A11Y_DESCRIPTION_ELEMENT_ID);\n accessibleDescriptionElement.style.display = 'none';\n accessibleDescriptionElement.textContent = description;\n document.body.appendChild(accessibleDescriptionElement);\n return function () {\n accessibleDescriptionElement.remove();\n };\n }, [description, document]);\n}\n\nfunction getMergedProps(userProps) {\n return _extends({\n stateReducer: function stateReducer(_s, _ref) {\n var changes = _ref.changes;\n return changes;\n },\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' || false ? undefined : window,\n removeElementDescription: 'Press Delete or Backspace to remove tag.'\n }, userProps);\n}\n\n/**\n * Focuses the tag at activeIndex when it changes or when an item is removed.\n */\nfunction useRovingTagFocus(activeIndex, itemsLength, getTagId) {\n var itemRefs = React.useRef({});\n var previousActiveIndexRef = React.useRef(activeIndex);\n var previousItemsLengthRef = React.useRef(itemsLength);\n React.useEffect(function () {\n if (activeIndex !== -1 && previousActiveIndexRef.current !== -1 && activeIndex !== previousActiveIndexRef.current || previousItemsLengthRef.current === itemsLength + 1) {\n var _itemRefs$current$get;\n (_itemRefs$current$get = itemRefs.current[getTagId(activeIndex)]) == null || _itemRefs$current$get.focus();\n }\n previousActiveIndexRef.current = activeIndex;\n previousItemsLengthRef.current = itemsLength;\n }, [activeIndex, getTagId, itemsLength]);\n return itemRefs;\n}\n\nvar propTypes = {\n isItemDisabled: PropTypes.func\n};\n\nvar _excluded = [\"onKeyDown\"],\n _excluded2 = [\"index\", \"refKey\", \"ref\", \"onClick\"],\n _excluded3 = [\"index\", \"onClick\"];\nvar _useTagGroup = function useTagGroup(userProps) {\n var _props$environment;\n if (userProps === void 0) {\n userProps = {};\n }\n /* State and Props */\n\n validatePropTypes$1(userProps, _useTagGroup, propTypes);\n var props = getMergedProps(userProps);\n var _useControlledReducer = useControlledReducer$1(useTagGroupReducer, props, getInitialState, isStateEqual),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var activeIndex = state.activeIndex,\n items = state.items;\n\n /* Refs */\n\n var latest = useLatestRef({\n state: state,\n props: props\n });\n var elementIds = useElementIds({\n getTagId: props.getTagId,\n id: props.id,\n tagGroupId: props.tagGroupId\n });\n\n /* Effects */\n\n useAccessibleDescription((_props$environment = props.environment) == null ? void 0 : _props$environment.document, props.removeElementDescription);\n var itemRefs = useRovingTagFocus(activeIndex, items.length, elementIds.getTagId);\n\n /* Getter functions */\n\n var getTagGroupProps = useCallback(function (options) {\n var _ref = options != null ? options : {},\n onKeyDown = _ref.onKeyDown,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n var handleKeyDown = function handleKeyDown(e) {\n switch (e.key) {\n case 'ArrowLeft':\n dispatch({\n type: TagGroupKeyDownArrowLeft\n });\n break;\n case 'ArrowRight':\n dispatch({\n type: TagGroupKeyDownArrowRight\n });\n break;\n case 'Delete':\n dispatch({\n type: TagGroupKeyDownDelete\n });\n break;\n case 'Backspace':\n dispatch({\n type: TagGroupKeyDownBackspace\n });\n break;\n }\n };\n var tagGroupProps = _extends({\n id: elementIds.tagGroupId,\n 'aria-live': 'polite',\n 'aria-atomic': 'false',\n 'aria-relevant': 'additions',\n role: 'listbox',\n onKeyDown: callAllEventHandlers$1(onKeyDown, handleKeyDown)\n }, rest);\n return tagGroupProps;\n }, [dispatch, elementIds.tagGroupId]);\n var getTagProps = useCallback(function (options) {\n var _extends2;\n var index = options.index,\n _options$refKey = options.refKey,\n refKey = _options$refKey === void 0 ? 'ref' : _options$refKey,\n ref = options.ref,\n onClick = options.onClick,\n rest = _objectWithoutPropertiesLoose(options, _excluded2);\n if (!Number.isInteger(index) || index < 0) {\n throw new Error('Pass correct item index to getTagProps!');\n }\n var latestState = latest.current.state;\n var handleClick = function handleClick() {\n dispatch({\n type: TagClick,\n index: index\n });\n };\n var tagId = elementIds.getTagId(index);\n return _extends((_extends2 = {\n 'aria-describedby': A11Y_DESCRIPTION_ELEMENT_ID\n }, _extends2[refKey] = handleRefs$1(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[tagId] = itemNode;\n }\n }), _extends2['aria-labelledby'] = tagId, _extends2.role = 'option', _extends2.id = tagId, _extends2.onClick = callAllEventHandlers$1(onClick, handleClick), _extends2.tabIndex = latestState.activeIndex === index ? 0 : -1, _extends2), rest);\n }, [dispatch, elementIds, latest, itemRefs]);\n var getTagRemoveProps = useCallback(function (options) {\n var index = options.index,\n onClick = options.onClick,\n rest = _objectWithoutPropertiesLoose(options, _excluded3);\n if (!Number.isInteger(index) || index < 0) {\n throw new Error('Pass correct item index to getTagRemoveProps!');\n }\n var handleClick = function handleClick(event) {\n event.stopPropagation();\n dispatch({\n type: TagRemoveClick,\n index: index\n });\n };\n var tagId = elementIds.getTagId(index);\n var tagRemoveId = tagId + \"-remove\";\n return _extends({\n id: tagRemoveId,\n tabIndex: -1,\n 'aria-labelledby': tagRemoveId + \" \" + tagId,\n onClick: callAllEventHandlers$1(onClick, handleClick)\n }, rest);\n }, [elementIds, dispatch]);\n\n /* Imperative Functions */\n\n var addItem = useCallback(function (item, index) {\n dispatch({\n type: FunctionAddItem,\n item: item,\n index: index\n });\n }, [dispatch]);\n return {\n activeIndex: activeIndex,\n addItem: addItem,\n getTagGroupProps: getTagGroupProps,\n getTagProps: getTagProps,\n getTagRemoveProps: getTagRemoveProps,\n items: items\n };\n};\n_useTagGroup.stateChangeTypes = stateChangeTypes;\n\nexport { Downshift as default, resetIdCounter, useCombobox, useMultipleSelection, useSelect, _useTagGroup as useTagGroup };\n","/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n\n var debounced = function(){\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n \n debounced.flush = function() {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n \n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n};\n\n// Adds compatibility for ES modules\ndebounce.debounce = debounce;\n\nmodule.exports = debounce;\n","import type React from \"react\";\nimport { Children, useEffect, useMemo } from \"react\";\n\nimport {\n useSearchRanking,\n calculateDistance,\n getDistanceUnit,\n formatDistance,\n} from \"@jslib/OrgSearch\";\n\nimport { getLocaleSafely } from \"@/lib/intl/intl\";\n\nimport { type Organization } from \"../../lib/types/types\";\nimport { useFlag } from \"../FeatureFlags/hooks\";\n\ninterface OrganizationListProps {\n getItemProps: any;\n highlightedIndex: number;\n itemToString: any;\n organizations: Organization[];\n children: React.ReactNode;\n maxItemsToDisplay?: number; // eslint-disable-line\n // Next line is deprecated. Menu is always mounted now, up in TypeaheadComponent.\n getMenuProps?: any; // eslint-disable-line\n}\n\nconst ROW_HEIGHT = 42;\nconst MAX_ITEMS = 26;\n\nconst OrganizationList = ({\n getItemProps,\n highlightedIndex,\n organizations,\n itemToString,\n children,\n maxItemsToDisplay = MAX_ITEMS,\n}: OrganizationListProps) => {\n const childrenCount = Children.count(children);\n const fullHeight = (organizations.length + childrenCount) * ROW_HEIGHT;\n const itemRefs = {};\n const overlayEnabled = useFlag(\"org-search-overlay\") === \"overlay\";\n const searchRanking = useSearchRanking();\n const locale = getLocaleSafely();\n\n // Get user's locale for distance unit preference\n const distanceUnit = useMemo(() => getDistanceUnit(locale), [locale]);\n\n const getDistanceDisplay = (organization: Organization): string | null => {\n if (!searchRanking?.userLocation) return null;\n if (organization.latitude == null || organization.longitude == null) return null;\n\n const distanceKm = calculateDistance(\n searchRanking.userLocation.latitude,\n searchRanking.userLocation.longitude,\n organization.latitude,\n organization.longitude,\n );\n\n return formatDistance(distanceKm, distanceUnit);\n };\n\n useEffect(() => {\n const elem = document\n .getElementsByClassName(\"sid-organization-list__item--highlighted\")\n .item(0);\n if (elem) {\n // elem.scrollIntoViewIfNeeded is nonstandard but has a better\n // experience, particularly on mobile browsers. So try it first.\n if (\"scrollIntoViewIfNeeded\" in elem && typeof elem.scrollIntoViewIfNeeded === \"function\") {\n elem.scrollIntoViewIfNeeded(true);\n } else {\n elem.scrollIntoView({ behavior: \"instant\", block: \"center\" });\n }\n }\n }, [highlightedIndex]);\n\n const item = (organization: Organization, index: number) => {\n const location = [organization.city, organization.state].filter(Boolean).join(\", \");\n const distanceDisplay = getDistanceDisplay(organization);\n\n return (\n <div\n className={`sid-organization-list__item ${\n highlightedIndex === index ? \"sid-organization-list__item--highlighted\" : \"\"\n }`}\n key={index}\n role=\"option\"\n aria-selected={highlightedIndex === index}\n {...getItemProps({\n index,\n item: organization,\n })}\n ref={itemRefs[highlightedIndex]}\n >\n <span className=\"sid-organization-list__name\">{itemToString(organization)}</span>\n {overlayEnabled && location && (\n <span className=\"sid-organization-list__location\">{location}</span>\n )}\n {distanceDisplay && (\n <span className=\"sid-organization-list__distance\" data-testid=\"org-distance\">\n {distanceDisplay}\n </span>\n )}\n </div>\n );\n };\n\n return (\n <div\n id=\"sid-org-list-menu\"\n className=\"sid-organization-list__menu\"\n tabIndex={-1}\n role=\"listbox\"\n >\n <div style={{ height: Math.min(fullHeight, 280) }}>\n {organizations\n .filter((_, index) => index <= maxItemsToDisplay - 1)\n .map((organization, index) => item(organization, index))}\n {children}\n </div>\n </div>\n );\n};\n\nexport const OrganizationListComponent = OrganizationList;\n","import React, { useState, useEffect, useRef, useCallback } from \"react\";\nimport { FormattedHTMLMessage } from \"react-intl\";\nimport { debounce } from \"debounce\";\n\nimport { logger } from \"@jslib/shared/utils/logger\";\nimport { useSearchRanking } from \"@jslib/OrgSearch\";\n\nimport { fetchOrganization } from \"../lib/ServerApi/OrganizationApiClient\";\nimport { type OrganizationSearchResp, type DatabaseId, type Locale } from \"../lib/types/types\";\nimport { DEBOUNCE_TIMEOUT, DEFAULT_LOCALE } from \"../constants\";\nimport { EventName, type OrgsDisplayedEvent, recordGaEvent } from \"../lib/GoogleAnalytics/ga\";\nimport { getQueryParam } from \"../lib/utils/routing/Url\";\n\nimport { LinkExternal } from \"./LinkExternal\";\nimport { LoadingSpinnerComponent } from \"./LoadingSpinner/LoadingSpinnerComponent\";\nimport { OrganizationListComponent } from \"./OrganizationList/OrganizationListComponent\";\nimport { MetricIds, useMetrics } from \"./FeatureFlags/useMetrics\";\n\ninterface FetchOrganizationsProps {\n getItemProps: any;\n highlightedIndex: any;\n itemToString: any;\n minimumSearchValueLength: number;\n onLoaded: any;\n programId: DatabaseId;\n orgSearchUrl?: string;\n locale?: Locale;\n urlAddSchoolForm?: string;\n openOrgSearchEnabled?: boolean;\n onClickAddSchool?: () => void;\n onTipsShown?: () => void;\n // optional search params that are set before the query is sent\n searchUrlParams?: Record<string, string>;\n /** @deprecated */\n // eslint-disable-next-line react/no-unused-prop-types\n countryCode?: string;\n /** @deprecated orgSearchTags has no affect, pass a full orgSearchUrl, instead */\n // eslint-disable-next-line react/no-unused-prop-types\n orgSearchTags?: string;\n /** @deprecated pass a complete orgSearchUrl instead, using the `name` parameter with a value of what you would have given `searchValue` */\n searchValue?: string;\n /** @deprecated. Menu is always mounted now, up in TypeaheadComponent. */\n getMenuProps?: any;\n}\n\ntype AddSchoolRequestRowProps = {\n programId: DatabaseId;\n locale: Locale;\n urlAddSchoolForm: string;\n onClick?: () => void;\n onTipsShown?: () => void;\n};\n\nconst LightbulbIcon: React.FC<{ className?: string }> = ({ className }) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className={className}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18\"\n />\n </svg>\n);\n\nconst AddSchoolRequestRow: React.FC<AddSchoolRequestRowProps> = ({\n urlAddSchoolForm,\n programId,\n locale = DEFAULT_LOCALE,\n onClick = () => undefined,\n onTipsShown,\n}: AddSchoolRequestRowProps) => {\n const [shouldShowTips, setShouldShowTips] = React.useState(false);\n const { trackEvent } = useMetrics({ programId });\n\n const handleOnClick = () => {\n recordGaEvent({\n eventName: EventName.ASR_TIPS_SHOWN,\n params: { programId, locale },\n });\n trackEvent(MetricIds.AsrTipsShown);\n // Notify parent that tips are now shown\n onTipsShown?.();\n\n setShouldShowTips(true);\n };\n\n if (shouldShowTips) {\n return (\n <div className=\"sid-organization-list__add-school-tips\">\n <div className=\"sid-organization-list__tips\">\n <div>\n <LightbulbIcon className=\"sid-organization-list__tips-icon\" />\n </div>\n\n <div className=\"sid-organization-list__tips-text\">\n <FormattedHTMLMessage\n id=\"multipleLocationsTips\"\n defaultMessage=\"If your academic institution has multiple locations and you didn't see yours, enter the main location.\"\n />\n <FormattedHTMLMessage\n id=\"tryFullNameTips\"\n defaultMessage=\"Try typing the full name of the academic institution rather than using acronyms or abbreviations.\"\n />\n </div>\n </div>\n\n <LinkExternal\n onClick={onClick}\n className=\"sid-organization-list__item sid-organization-list__request-school sid-link\"\n href={`${urlAddSchoolForm}?pid=${programId}&locale=${locale}`}\n >\n <FormattedHTMLMessage\n id=\"requestSchool\"\n defaultMessage=\"Don't see your school? Request to have it added\"\n />\n </LinkExternal>\n </div>\n );\n }\n\n return (\n <LinkExternal\n onClick={handleOnClick}\n className=\"sid-organization-list__item sid-organization-list__request-school sid-link\"\n >\n <FormattedHTMLMessage\n id=\"cantFindYourSchool\"\n defaultMessage=\"Can't find your school? Click to show tips\"\n />\n </LinkExternal>\n );\n};\n\nconst getSearchValue = (orgSearchUrl: string): string => getQueryParam(\"name\", orgSearchUrl) || \"\";\n\nexport const getAttribution = (organizations: OrganizationSearchResp): React.ReactNode => {\n if (!organizations) {\n return null;\n }\n\n // When organization results are provided by Google Place, Google requires their logo be presented as attribution.\n // org.source denotes where the organization data is coming from, in case of Google Place, it is \"PLACE\".\n const requiresGooglePlaceAttribution = organizations.find((org) => org.source === \"PLACE\");\n if (requiresGooglePlaceAttribution) {\n return (\n <img\n className=\"sid-organization-list__attribution-logo\"\n src=\"https://developers.google.com/static/maps/documentation/images/google_on_white.png\"\n alt=\"Google\"\n />\n );\n }\n return null;\n};\n\n/**\n * Support deprecated prop \"searchValue\"\n * @TODO remove searchValue prop and this function in v2\n * @param orgSearchUrl\n */\nexport const updateSearchUrl = (\n orgSearchUrl: string,\n searchValue: string,\n newParams?: Record<string, string>,\n): string => {\n if (!searchValue && !newParams) {\n return orgSearchUrl;\n }\n if (!orgSearchUrl) {\n logger.error(\"Expected orgSearchUrl\");\n return orgSearchUrl;\n }\n\n try {\n const url = new URL(orgSearchUrl);\n const { origin, pathname, search } = url;\n const params = new URLSearchParams(search);\n if (searchValue) {\n params.set(\"name\", searchValue);\n }\n if (newParams) {\n Object.entries(newParams).forEach(([k, v]) => {\n params.set(k, v);\n });\n }\n params.sort();\n return `${origin}${pathname}?${params.toString()}`;\n } catch (e) {\n logger.error(e);\n }\n};\n\nconst FetchOrganizations: React.FC<FetchOrganizationsProps> = ({\n getItemProps,\n getMenuProps,\n highlightedIndex,\n itemToString,\n minimumSearchValueLength,\n onLoaded,\n programId,\n orgSearchUrl,\n locale,\n urlAddSchoolForm,\n openOrgSearchEnabled,\n onClickAddSchool,\n onTipsShown,\n searchUrlParams,\n searchValue,\n}) => {\n const [loading, setLoading] = useState(false);\n const [organizations, setOrganizations] = useState<OrganizationSearchResp>(null);\n const [isErrored, setIsErrored] = useState<string>(null);\n const mountedRef = useRef(false);\n const prevSearchTermRef = useRef<string>(null);\n\n const searchRanking = useSearchRanking();\n\n // Store props in refs so debounced fetch always uses latest values (like this.props in class)\n const propsRef = useRef({ orgSearchUrl, searchValue, searchUrlParams, onLoaded });\n propsRef.current = { orgSearchUrl, searchValue, searchUrlParams, onLoaded };\n\n // Store search ranking in ref for debounced fetch\n const searchRankingRef = useRef(searchRanking);\n searchRankingRef.current = searchRanking;\n\n const searchTerm = searchValue || getSearchValue(orgSearchUrl) || \"\";\n\n // Stable fetch function that reads from refs (like this.fetch in class component)\n const doFetch = useCallback(async () => {\n if (!mountedRef.current) {\n return;\n }\n\n const {\n orgSearchUrl: url,\n searchValue: sv,\n searchUrlParams: params,\n onLoaded: loaded,\n } = propsRef.current;\n\n // Build params including location if distance sorting is enabled\n let fetchParams = params;\n const ranking = searchRankingRef.current;\n if (ranking && ranking.sortMode === \"distance\" && ranking.userLocation) {\n fetchParams = {\n ...params,\n lat: String(ranking.userLocation.latitude),\n long: String(ranking.userLocation.longitude),\n };\n }\n\n const start = Date.now();\n const fetchedOrganizations: OrganizationSearchResp = await fetchOrganization(\n updateSearchUrl(url, sv, fetchParams),\n );\n\n if (!mountedRef.current) {\n return;\n }\n\n if (fetchedOrganizations) {\n loaded(fetchedOrganizations);\n setOrganizations(fetchedOrganizations);\n setLoading(false);\n }\n\n try {\n const currentSearchTerm = sv || getSearchValue(url) || \"\";\n const event: OrgsDisplayedEvent = {\n eventName: EventName.ORGS_DISPLAYED,\n params: {\n queryLength: currentSearchTerm.length,\n eventDuration: Date.now() - start,\n numberOfResults: fetchedOrganizations?.length,\n },\n };\n recordGaEvent(event);\n } catch (e) {\n logger.error(e);\n }\n }, []); // No dependencies - reads from refs\n\n // Create a stable debounced function once\n const debouncedFetchRef = useRef<ReturnType<typeof debounce>>(null);\n if (!debouncedFetchRef.current) {\n debouncedFetchRef.current = debounce(doFetch, DEBOUNCE_TIMEOUT);\n }\n\n // Handle mount/unmount\n useEffect(() => {\n mountedRef.current = true;\n\n return () => {\n mountedRef.current = false;\n if (debouncedFetchRef.current) {\n debouncedFetchRef.current.clear();\n }\n };\n }, []);\n\n // Handle search term changes (replaces componentDidMount and componentDidUpdate logic)\n useEffect(() => {\n const prevSearchTerm = prevSearchTermRef.current;\n\n // On mount or when search term changes\n if (prevSearchTerm !== searchTerm) {\n if (searchTerm.length >= minimumSearchValueLength) {\n // Reset state and trigger fetch\n setIsErrored(null);\n setLoading(true);\n setOrganizations(null);\n if (debouncedFetchRef.current) {\n debouncedFetchRef.current();\n }\n } else {\n // Reset state without fetching\n setIsErrored(null);\n setLoading(false);\n setOrganizations(null);\n if (prevSearchTerm !== null) {\n // Only log on updates, not initial mount with short search term\n logger.info(\n `No organizations fetched. Search searchTterm \"${searchTerm}\" is less than ${minimumSearchValueLength} characters.`,\n );\n } else if (searchTerm.length > 0) {\n // Log on initial mount if there's a search term that's too short\n logger.info(\n `No organizations fetched. Search searchTerm \"${searchTerm}\" is less than ${minimumSearchValueLength} characters.`,\n );\n }\n }\n }\n\n prevSearchTermRef.current = searchTerm;\n }, [searchTerm, minimumSearchValueLength]);\n\n // Re-fetch when sort mode or user location changes (but not on initial render)\n const sortMode = searchRanking?.sortMode;\n const userLatitude = searchRanking?.userLocation?.latitude;\n const userLongitude = searchRanking?.userLocation?.longitude;\n\n useEffect(() => {\n if (searchTerm.length >= minimumSearchValueLength) {\n setIsErrored(null);\n setLoading(true);\n setOrganizations(null);\n debouncedFetchRef.current?.();\n }\n }, [sortMode, userLatitude, userLongitude, searchTerm, minimumSearchValueLength]);\n\n const orgSearchAttribution = getAttribution(organizations);\n\n if (loading) {\n return (\n <div className=\"sid-organization-list__menu\">\n <div className=\"sid-organization-list__message sid-organization-list__spinner-container\">\n <div id=\"sid-spinner-container\">\n <LoadingSpinnerComponent />\n </div>\n </div>\n </div>\n );\n }\n if (isErrored) {\n return (\n <div className=\"sid-organization-list__menu\">\n <div className=\"sid-organization-list__message\">\n {/* TODO: Define correct message ID from backend (backend need to send this message?) */}\n <FormattedHTMLMessage\n id=\"errorId.unknownError\"\n defaultMessage=\"An unknown error occurred\"\n />\n </div>\n </div>\n );\n }\n\n if (organizations && organizations.length > 0) {\n return (\n <>\n {orgSearchAttribution && (\n <div className=\"sid-organization-list__attribution\">{orgSearchAttribution}</div>\n )}\n\n <OrganizationListComponent\n getItemProps={getItemProps}\n getMenuProps={getMenuProps}\n highlightedIndex={highlightedIndex}\n itemToString={itemToString}\n organizations={organizations}\n >\n {searchTerm &&\n !openOrgSearchEnabled &&\n urlAddSchoolForm &&\n (!organizations || organizations.length < 26) && (\n <AddSchoolRequestRow\n onClick={onClickAddSchool}\n onTipsShown={onTipsShown}\n urlAddSchoolForm={urlAddSchoolForm}\n programId={programId}\n locale={locale}\n />\n )}\n </OrganizationListComponent>\n </>\n );\n }\n\n if (\n searchTerm &&\n !openOrgSearchEnabled &&\n urlAddSchoolForm &&\n (!organizations || organizations.length === 0)\n ) {\n return (\n <div className=\"sid-organization-list__menu\">\n <AddSchoolRequestRow\n onClick={onClickAddSchool}\n onTipsShown={onTipsShown}\n urlAddSchoolForm={urlAddSchoolForm}\n programId={programId}\n locale={locale}\n />\n </div>\n );\n }\n\n return null;\n};\n\nexport const FetchOrganizationsComponent = FetchOrganizations;\n","import { useCombobox, type UseComboboxStateChange } from \"downshift\";\n\nimport { type Organization } from \"../../../lib/types/types\";\n\nexport const handleStateChange = (\n changes: UseComboboxStateChange<Organization>,\n onChange: Function,\n opts: {\n openOrgSearchEnabled: boolean;\n _searchOverlayEnabled?: boolean;\n },\n) => {\n if (changes.type === useCombobox.stateChangeTypes.FunctionSelectItem) {\n const { selectedItem } = changes;\n onChange(selectedItem);\n } else if (changes.type === useCombobox.stateChangeTypes.InputBlur) {\n if (!opts.openOrgSearchEnabled && !opts._searchOverlayEnabled) {\n onChange({\n id: undefined,\n name: \"\",\n });\n }\n }\n};\n","import type React from \"react\";\n\ninterface TypeaheadClearButtonProps {\n id: string;\n onMouseDown: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n handleOnBlur: (event: React.FocusEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n}\n\nconst TypeaheadClearButton = ({\n id,\n onMouseDown,\n disabled,\n onKeyDown,\n handleOnBlur,\n}: TypeaheadClearButtonProps) => (\n <button\n id={id}\n type=\"button\"\n onMouseDown={onMouseDown}\n onKeyDown={onKeyDown}\n onBlur={handleOnBlur}\n className={`sid-input-clear-button ${disabled ? \"sid-input-clear-button--disabled\" : \"\"}`}\n aria-label=\"clear text\"\n aria-disabled={disabled}\n tabIndex={0}\n >\n <svg\n viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"none\"\n width={28}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.1\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n </button>\n);\n\nexport const TypeaheadClearButtonComponent = TypeaheadClearButton;\n","import type React from \"react\";\nimport { useRef, useEffect, useState } from \"react\";\nimport { useCombobox } from \"downshift\";\n\nimport { useSearchOverlay, SortDropdown } from \"@jslib/OrgSearch\";\nimport { logger } from \"@jslib/shared/utils/logger\";\nimport { Input } from \"@jslib/ui/components/input\";\nimport { cn } from \"@jslib/ui/lib/utils\";\n\nimport { useFlag } from \"@/components/FeatureFlags/hooks\";\nimport { MetricIds, useMetrics } from \"@/components/FeatureFlags/useMetrics\";\nimport { useMessage } from \"@/components/Message\";\n\nimport { FetchOrganizationsComponent } from \"../../FetchOrganizationsComponent\";\nimport {\n type Organization,\n type DatabaseId,\n type Country,\n type Locale,\n} from \"../../../lib/types/types\";\nimport { setRef } from \"../../../lib/refs/refs\";\nimport { assertValidFunction } from \"../../../lib/types/assertions\";\nimport {\n type AsrEvent,\n CustomMetricNames,\n EventName,\n type OrgSelectedEvent,\n recordGaEvent,\n} from \"../../../lib/GoogleAnalytics/ga\";\n\nimport { handleStateChange } from \"./TypeaheadComponentHelper\";\nimport { TypeaheadClearButtonComponent } from \"./TypeaheadClearButton/TypeaheadClearButtonComponent\";\n\nexport interface TypeaheadProps {\n onChange: (org: Organization) => void;\n programId: DatabaseId;\n inputHtmlId: string;\n autoFocus?: boolean;\n className?: string;\n countryCode?: Country;\n disabled?: boolean;\n minimumSearchValueLength?: number;\n placeholder?: string;\n value?: Organization;\n openOrgSearchEnabled?: boolean;\n orgSearchUrl: string;\n isRequired?: boolean;\n locale?: Locale;\n urlAddSchoolForm?: string;\n isErrored?: boolean;\n /** Paints the warning border; FormFieldLayout shows the warning text. */\n isWarned?: boolean;\n ariaDescribedBy?: string;\n onBlur?: () => void;\n}\n\nexport const TypeaheadComponent = ({\n onChange,\n programId,\n className,\n countryCode,\n disabled,\n minimumSearchValueLength,\n placeholder,\n value,\n inputHtmlId,\n openOrgSearchEnabled,\n orgSearchUrl,\n isRequired,\n locale,\n urlAddSchoolForm,\n isErrored,\n isWarned = false,\n ariaDescribedBy,\n autoFocus = false,\n onBlur = () => {},\n}: TypeaheadProps) => {\n const { msg } = useMessage();\n const [inputValue, setInputValue] = useState(value ? value.name : \"\");\n const [loadedOrgs, setLoadedOrgs] = useState([]);\n\n const numReworksRef = useRef(0);\n const startTimeRef = useRef(0);\n const tipsShownRef = useRef(false);\n const searchAfterTipsTrackedRef = useRef(false);\n\n const [showClearButton, setShowClearButton] = useState(false);\n const [disabledClearButton, setDisabledClearButton] = useState(false);\n const { recordNumericMetric, trackEvent } = useMetrics({ programId });\n const overlayEnabled = useFlag(\"org-search-overlay\") === \"overlay\";\n const { showOverlay, setShowOverlay } = useSearchOverlay();\n\n assertValidFunction(onChange);\n\n const itemToString = (item: Organization) => (item ? item.name : \"\");\n\n const { isOpen, highlightedIndex, getMenuProps, getItemProps, getInputProps } = useCombobox({\n itemToString,\n id: inputHtmlId,\n items: loadedOrgs,\n inputValue,\n onStateChange: (changes) =>\n handleStateChange(changes, onChange, {\n openOrgSearchEnabled,\n _searchOverlayEnabled: showOverlay,\n }),\n selectedItem: value,\n onSelectedItemChange: ({ selectedItem }) => {\n if (!selectedItem) {\n setInputValue(\"\");\n setShowOverlay(false);\n onChange({\n id: 0,\n name: \"\",\n });\n return;\n }\n\n setInputValue(itemToString(selectedItem));\n\n const selectedRank = loadedOrgs.findIndex((o) => o.id === selectedItem.id) + 1;\n const timeUntilSelection = Date.now() - startTimeRef.current;\n try {\n const event: OrgSelectedEvent = {\n eventName: EventName.ORG_SELECTED,\n params: {\n [CustomMetricNames.QUERY_LENGTH]: inputValue.length,\n [CustomMetricNames.NUMBER_REWORKS]: numReworksRef.current,\n [CustomMetricNames.SELECTED_RESULT_RANK]: selectedRank,\n [CustomMetricNames.EVENT_DURATION]: timeUntilSelection,\n [CustomMetricNames.NUMBER_OF_RESULTS]: loadedOrgs.length,\n },\n };\n recordGaEvent(event);\n } catch (e) {\n logger.error(e);\n }\n\n try {\n recordNumericMetric(MetricIds.OrgSearchNumReworks, numReworksRef.current);\n recordNumericMetric(MetricIds.OrgSearchQueryLength, inputValue.length);\n recordNumericMetric(MetricIds.OrgSearchResultRank, selectedRank);\n recordNumericMetric(MetricIds.OrgSearchTimeUntilSelection, timeUntilSelection);\n } catch (e) {\n logger.error(e);\n }\n\n startTimeRef.current = 0;\n numReworksRef.current = 0;\n setShowOverlay(false);\n onChange(selectedItem);\n },\n });\n\n const onClickAddSchool = () => {\n try {\n const event: AsrEvent = {\n eventName: EventName.ASR_SELECTED,\n params: {\n [CustomMetricNames.QUERY_LENGTH]: inputValue.length,\n [CustomMetricNames.NUMBER_REWORKS]: numReworksRef.current,\n [CustomMetricNames.EVENT_DURATION]: Date.now() - startTimeRef.current,\n [CustomMetricNames.NUMBER_OF_RESULTS]: loadedOrgs.length,\n },\n };\n recordGaEvent(event);\n trackEvent(MetricIds.AsrClickThrough);\n } catch (e) {\n logger.error(e);\n }\n };\n\n const onTipsShown = () => {\n tipsShownRef.current = true;\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newInputValue = event.target.value;\n\n if (newInputValue) {\n setDisabledClearButton(false);\n } else {\n setDisabledClearButton(true);\n }\n\n try {\n if (startTimeRef.current === 0) {\n startTimeRef.current = Date.now();\n }\n if (newInputValue.length < inputValue.length) {\n numReworksRef.current += 1;\n }\n\n // Track when user searches again after seeing tips (only once)\n if (tipsShownRef.current && !searchAfterTipsTrackedRef.current && newInputValue) {\n searchAfterTipsTrackedRef.current = true;\n recordGaEvent({\n eventName: EventName.ASR_SEARCH_AFTER_TIPS,\n params: { programId },\n });\n trackEvent(MetricIds.AsrSearchAfterTips);\n }\n } catch (e) {\n logger.error(e);\n }\n\n setInputValue(newInputValue);\n onChange({\n id: 0,\n name: newInputValue,\n });\n };\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // NOTE: Dependency array omitted to account for use of resetRef(), as useEffect with dep arr\n // will only trigger on initial render leaving the refs empty, this replicates prior version\n // where ref callback would trigger with each re-render\n useEffect(() => {\n setRef(\"organization\", inputRef.current);\n });\n\n // Follow `value` when it changes from outside the input (`setViewModel`, or an unselected org cleared on blur). While the input has focus its text belongs to the user: a typed value echoed back through `onChange` must not overwrite it, or IME composition breaks (HC-1468).\n useEffect(() => {\n const root = inputRef.current?.getRootNode() as Document | ShadowRoot | undefined;\n if (root?.activeElement !== inputRef.current) {\n setInputValue(value?.name ?? \"\");\n }\n }, [value?.id, value?.name]);\n\n const handleOnFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setShowClearButton(true);\n if (!event.currentTarget.value) {\n setDisabledClearButton(true);\n } else {\n setDisabledClearButton(false);\n setShowOverlay(true);\n }\n };\n\n const handleOnBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget?.id !== `${inputHtmlId}-clear-button`) {\n setShowClearButton(false);\n onBlur();\n }\n };\n\n const handleOnInteraction = (\n event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n if (event.type === \"mousedown\" || (\"key\" in event && event.key === \"Enter\")) {\n setInputValue(\"\");\n onChange({\n id: undefined,\n name: \"\",\n });\n inputRef.current.focus();\n }\n };\n\n return (\n <div className=\"sid-organization-list\">\n <div className=\"sid-text-input__wrapper\">\n <Input\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getInputProps({\n ref: inputRef,\n onChange: handleInputChange,\n onFocus: (event) => handleOnFocus(event),\n onBlur: (event) => handleOnBlur(event),\n onKeyDown: (event) => {\n // we want to start the overlay if someone starts\n // typing, not if they are tabbing past or pressing Escape.\n if (event.key !== \"Tab\" && event.key !== \"Escape\") {\n setShowOverlay(true);\n }\n },\n })}\n // The look comes from @jslib/ui's Input; the legacy class names stay for legacy SCSS and\n // tests. pe-7.5 keeps the text clear of the clear button.\n hidePlaceholder\n className={cn(\n \"sid-l-full-width sid-hidden-placeholder sid-text-input pe-7.5 data-warning:border-warning\",\n className,\n )}\n data-warning={isWarned || undefined}\n disabled={disabled}\n id={inputHtmlId}\n // Autofocus is situational here, it's only added when org is cleared.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n placeholder={placeholder}\n aria-required={isRequired}\n aria-controls=\"sid-org-list-menu\"\n aria-describedby={ariaDescribedBy}\n aria-invalid={isErrored}\n // Maintain same labelledby value as previous versions even though label has \"for\" attribute\n aria-labelledby={`${inputHtmlId}-label`}\n />\n {showOverlay && (\n <SortDropdown\n sortByRelevanceLabel={msg({ id: \"orgSearchSortByRelevance\" })}\n sortByDistanceLabel={msg({ id: \"orgSearchSortByDistance\" })}\n accessibilityLabel={msg({ id: \"orgSearchSortAccessibilityLabel\" })}\n on={(event) => {\n switch (event) {\n case \"openSortMenu\":\n trackEvent(MetricIds.OrgSearchOpenSortMenu);\n break;\n\n case \"sortDistance\":\n trackEvent(MetricIds.OrgSearchSortDistance);\n break;\n\n case \"sortRelevance\":\n trackEvent(MetricIds.OrgSearchSortRelevance);\n break;\n default:\n break;\n }\n }}\n />\n )}\n </div>\n\n {showClearButton && !showOverlay ? (\n <TypeaheadClearButtonComponent\n id={`${inputHtmlId}-clear-button`}\n disabled={disabledClearButton}\n onMouseDown={handleOnInteraction}\n onKeyDown={handleOnInteraction}\n handleOnBlur={handleOnBlur}\n />\n ) : null}\n\n <div {...getMenuProps()} className=\"sid-organization-list__menu-wrapper\">\n {/* when using the overlay we don't want to use downshift's isOpen */}\n {(inputValue && isOpen) || (showOverlay && inputValue) ? (\n <FetchOrganizationsComponent\n countryCode={countryCode}\n getItemProps={getItemProps}\n highlightedIndex={highlightedIndex}\n itemToString={itemToString}\n minimumSearchValueLength={minimumSearchValueLength}\n onLoaded={(loadedOrganizations) => setLoadedOrgs(loadedOrganizations)}\n programId={programId}\n orgSearchUrl={orgSearchUrl}\n locale={locale}\n urlAddSchoolForm={urlAddSchoolForm}\n onClickAddSchool={onClickAddSchool}\n onTipsShown={onTipsShown}\n openOrgSearchEnabled={openOrgSearchEnabled}\n searchUrlParams={overlayEnabled ? { format: \"detailed\" } : undefined}\n />\n ) : null}\n </div>\n </div>\n );\n};\n","import {\n type Organization,\n type ProgramConfiguration,\n type WithOrganization,\n} from \"../types/types\";\nimport { getSafe } from \"../utils/getSafe\";\n\nexport const isOpenOrganization = (organization?: Organization): boolean =>\n getSafe(() => organization.id) === 0 && getSafe(() => organization.name, \"\").length > 0;\n\nexport const shouldCollectPostalCode = (\n programConfiguration: ProgramConfiguration,\n viewModel: WithOrganization,\n) =>\n getSafe(() => programConfiguration.openOrgSearchEnabled) &&\n isOpenOrganization(viewModel.organization);\n","import type React from \"react\";\nimport { useState } from \"react\";\n\nimport { SelectedOrg, SearchOverlay } from \"@jslib/OrgSearch\";\nimport { getSafe } from \"@jslib/shared/utils/getSafe\";\n\nimport { Message, useMessage } from \"@/components/Message\";\nimport { useFlag } from \"@/components/FeatureFlags/hooks\";\n\nimport { useProgramConfiguration } from \"@/lib/state/contextHooks\";\n\nimport { dashed } from \"../../../lib/utils/strings\";\nimport { FormFieldLayout, getFormFieldLabelHtmlId } from \"../FormFieldLayout/FormFieldLayout\";\nimport {\n TypeaheadComponent,\n type TypeaheadProps,\n} from \"../../FormInputs/Typeahead/TypeaheadComponent\";\nimport { type Locale, type VerificationService } from \"../../../lib/types/types\";\nimport { getOptions } from \"../../../options/options\";\nimport { getLocaleSafely } from \"../../../lib/intl/intl\";\nimport { isCountrySelectionNeeded } from \"../Country/countryUtils\";\nimport { isOpenOrganization } from \"../../../lib/organization/organization\";\n\n// Extend TypeaheadProps to pass along things like required, onKeyUp, etc.\n// Omit errorId, isErrored, etc because those are handled within this component\nexport interface FormFieldTypeaheadComponentProps extends Omit<\n TypeaheadProps,\n | \"inputHtmlId\"\n | \"id\"\n | \"errorId\"\n | \"isErrored\"\n | \"locale\"\n | \"programId\"\n | \"country\"\n | \"orgSearchUrl\" // omit b/c this component (FormFieldTypeaheadComponent) has a fallback so orgSearchUrl is optional\n | \"onBlur\"\n> {\n fieldId: string; // should be camelCase\n verificationService: VerificationService;\n label: React.ReactNode; // Label is always required for screen readers\n showPlaceholderAndHideLabel?: boolean;\n errorMessage?: React.ReactNode;\n warningMessage?: React.ReactNode;\n helperMessage?: React.ReactNode;\n explanation?: string | JSX.Element;\n orgSearchUrl: string;\n}\n\n/**\n * Generic typeahead field component.\n * In the JSLIB, a field has a label, inline error message, and an input of some kind.\n */\nexport const FormFieldTypeahead = ({\n fieldId,\n value,\n verificationService,\n onChange,\n placeholder,\n label,\n errorMessage,\n warningMessage,\n helperMessage,\n showPlaceholderAndHideLabel = false,\n isRequired = true,\n explanation = \"\",\n orgSearchUrl,\n urlAddSchoolForm,\n disabled = false,\n}: FormFieldTypeaheadComponentProps) => {\n const { msg } = useMessage();\n const programConfiguration = useProgramConfiguration();\n\n const labelHtmlId = `sid-${dashed(fieldId)}`;\n const errorHtmlId = `sid-${dashed(fieldId)}-error`;\n const warningHtmlId = `sid-${dashed(fieldId)}-warning`;\n const { programId, verificationResponse, viewModel } = verificationService;\n const countryChoiceValue = getSafe(() => viewModel.countryChoice.value);\n const needToPickCountry = isCountrySelectionNeeded(programConfiguration, countryChoiceValue);\n const locale: Locale = getLocaleSafely(viewModel, verificationResponse);\n const [autoFocus, setAutoFocus] = useState(false);\n const showSearchOverlay = useFlag(\"org-search-overlay\") === \"overlay\";\n const showSelectedOrgBox = showSearchOverlay || useFlag(\"org-selected-display\") === \"box-display\";\n const showOpenOrgWarningOrange = useFlag(\"hc-open-org-warning\") === \"warning-orange\";\n const showOpenOrgWarningGray = useFlag(\"hc-open-org-warning\") === \"warning-gray\";\n const showOpenOrgWarningFlag = showOpenOrgWarningOrange || showOpenOrgWarningGray;\n\n const [showOpenOrgWarning, setShowOpenOrgWarning] = useState(false);\n const openOrgSearchEnabled = getSafe(() => programConfiguration.openOrgSearchEnabled);\n\n const handleBlur = () => {\n if (openOrgSearchEnabled && isOpenOrganization(value)) {\n setShowOpenOrgWarning(true);\n } else {\n setShowOpenOrgWarning(false);\n }\n };\n\n const handleChange = (newValue: typeof value) => {\n if (showOpenOrgWarning) {\n setShowOpenOrgWarning(false);\n }\n onChange(newValue);\n };\n\n // Combine prop warning with internal open org warning\n const openOrgWarningMessage = showOpenOrgWarning && showOpenOrgWarningFlag && (\n <Message id=\"warningId.openOrganization\" />\n );\n const warningMsg = warningMessage || (showOpenOrgWarningOrange && openOrgWarningMessage);\n const helperMsg = helperMessage || (showOpenOrgWarningGray && openOrgWarningMessage);\n\n const getAriaDescribedBy = () => {\n if (errorMessage) return errorHtmlId;\n if (warningMsg) return warningHtmlId;\n return undefined;\n };\n\n return (\n <SearchOverlay enabled={showSearchOverlay} closeSectionLabel={<Message id=\"closeSection\" />}>\n <FormFieldLayout\n fieldId={fieldId}\n label={label}\n errorMessage={errorMessage}\n warningMessage={warningMsg}\n helperMessage={helperMsg}\n showPlaceholderAndHideLabel={showPlaceholderAndHideLabel}\n isRequired={isRequired || needToPickCountry}\n explanation={needToPickCountry ? <Message id=\"chooseCountry\" /> : explanation}\n >\n {showSelectedOrgBox && value.id ? (\n <SelectedOrg\n org={value}\n onClear={() => {\n handleChange(undefined);\n setAutoFocus(true);\n }}\n clearSelectionLabel={msg({ id: \"clearSelection\" })}\n labelId={getFormFieldLabelHtmlId(fieldId)}\n />\n ) : (\n <TypeaheadComponent\n disabled={needToPickCountry || disabled}\n countryCode={countryChoiceValue}\n minimumSearchValueLength={getOptions().minimumOrganizationSearchLength}\n onChange={handleChange}\n placeholder={placeholder}\n programId={programId}\n value={value}\n inputHtmlId={labelHtmlId}\n openOrgSearchEnabled={programConfiguration.openOrgSearchEnabled}\n locale={locale}\n orgSearchUrl={orgSearchUrl || getSafe(() => programConfiguration.orgSearchUrl)}\n urlAddSchoolForm={urlAddSchoolForm}\n isRequired={isRequired}\n isErrored={!!errorMessage}\n isWarned={!errorMessage && !!warningMsg}\n ariaDescribedBy={getAriaDescribedBy()}\n autoFocus={autoFocus}\n onBlur={handleBlur}\n />\n )}\n </FormFieldLayout>\n </SearchOverlay>\n );\n};\n"],"ignoreList":[7,8,9,10,11,12,14,15,16],"mappings":";;;;;;;;;;;;;;;;;;A,mCAOa0I,MAAA,GAAuB1I,EAAAA,cAAAA,CAAoC;CACtE,aAAa;CACb,sBAAsB,KAAA;AACxB,CAAC,GAEY2I,YAAA,GAAyB1I,EAAAA,WAAAA,CAAWyI,EAAoB,GCExDE,MAAA,GAAuB1I,EAAAA,cAAAA,CAA+C,IAAI,GAK1E2I,YAEX,GADgB1I,EAAAA,WAAAA,CAAWyI,EACpB;;;ACFT,SAAgBE,KAAuC;CACrD,IAAM,CAACC,GAAUC,MAAA,GAAe5I,EAAAA,SAAAA,CAA6B,IAAI,GAC3D,CAAC6I,GAAOC,MAAA,GAAY9I,EAAAA,SAAAA,CAAkC,IAAI,GAC1D,CAAC+I,GAASC,MAAA,GAAchJ,EAAAA,SAAAA,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.js","names":["createContext","useContext","createContext","useContext","useState","useCallback","useState","useCallback","useMemo","useState","useRef","_Fragment","useRef","GROUP_NAME","Collection","useCollection","createCollectionScope","ITEM_NAME","wrapArray","focusFirst","PopperPrimitive.Root","PopperPrimitive.Anchor","PORTAL_NAME","PortalPrimitive","CONTENT_NAME","RemoveScroll","RovingFocusGroup.Root","PopperPrimitive.Content","GROUP_NAME","LABEL_NAME","ITEM_NAME","RovingFocusGroup.Item","CHECKBOX_ITEM_NAME","RADIO_GROUP_NAME","RADIO_ITEM_NAME","SEPARATOR_NAME","ARROW_NAME","PopperPrimitive.Arrow","SUB_TRIGGER_NAME","SUB_CONTENT_NAME","Content2","Item2","MenuPrimitive.Root","MenuPrimitive.Anchor","MenuPrimitive.Portal","MenuPrimitive.Content","MenuPrimitive.Group","MenuPrimitive.Label","MenuPrimitive.Item","MenuPrimitive.CheckboxItem","MenuPrimitive.RadioGroup","MenuPrimitive.RadioItem","MenuPrimitive.ItemIndicator","MenuPrimitive.Separator","MenuPrimitive.Arrow","MenuPrimitive.SubTrigger","MenuPrimitive.SubContent","DropdownMenu.Root","DropdownMenu.Trigger","BarsArrowDownIcon","DropdownMenu.Content","DropdownMenu.Item","compute","debounce","PropTypes","React","useRef","useCallback","useMemo","Children","useMemo","useState","useRef","useCallback","debounce","_Fragment","useState","useRef","getSafe","useState","recordGaEvent","DEFAULT_LOCALE","__commonJSMin","__toESM","EventName","getSafe","getQueryParam","getLocaleSafely","getOptions","CustomMetricNames","assertValidFunction","require_react","require_jsx_runtime","_objectWithoutPropertiesLoose","_extends","require_react_is","useProgramConfiguration","logger","LinkExternal","useMessage","Message","fetchOrganization","useFlag","setRef","require_prop_types","FormattedHTMLMessage","dashed","createPopperScope","ReactRemoveScroll","DismissableLayer","dispatchDiscreteCustomEvent","Presence","composeRefs","useComposedRefs","Root2$1","Content","useFocusGuards","hideOthers","createSlot","Arrow","useId","useCallbackRef","Anchor","composeEventHandlers","FocusScope","Primitive","useControllableState","createContextScope","LoadingSpinnerComponent","getSafe$1","cn","getFormFieldLabelHtmlId","FormFieldLayout","Input","MetricIds","useMetrics","isCountrySelectionNeeded","import_react","SearchOverlayContext","useSearchOverlay","SearchRankingContext","useSearchRanking","useGeoLocation","location","setLocation","error","setError","loading","setLoading","loc","position","resolve","geoError","err","reject","import_jsx_runtime","SearchRankingProvider","sortMode","setSortMode","userLocation","setUserLocation","locationDenied","setLocationDenied","geoLocation","requestLocation","value","FOCUSABLE_SELECTOR","FALLBACK_PAGE_TINT","pageTint","foreground","themed","SearchOverlay","isOpen","setIsOpen","containerRef","showOverlay","enabled","scrollTo","setShowOverlay","inFrame","state","modalMax","currentHeight","handleKeyDown","container","focusableElements","firstElement","lastElement","closeSectionLabel","children","SelectedOrg","inputRef","org","inputValue","labelId","clearSelectionLabel","onClear","EARTH_RADIUS_KM","calculateDistance","toRadians","degrees","dLat","lat2","lat1","dLon","lon2","lon1","a","MILES_LOCALES","getDistanceUnit","locale","formatDistance","suffix","unit","distance","distanceKm","rounded","createCollection","PROVIDER_NAME","name","createCollectionContext","createCollectionScope","CollectionProviderImpl","useCollectionContext","CollectionProvider","props","ref","itemMap","COLLECTION_SLOT_NAME","CollectionSlotImpl","CollectionSlot","context","scope","composedRefs","forwardedRef","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlotImpl","CollectionItemSlot","itemData","useCollection","collectionNode","orderedNodes","b","DirectionContext","useDirection","globalDir","localDir","ENTRY_FOCUS","EVENT_OPTIONS","GROUP_NAME$2","Collection$1","useCollection$1","createCollectionScope$1","createRovingFocusGroupContext","createRovingFocusGroupScope","RovingFocusProvider","useRovingFocusContext","RovingFocusGroup","RovingFocusGroupImpl","currentTabStopIdProp","groupProps","direction","dir","currentTabStopId","setCurrentTabStopId","defaultCurrentTabStopId","onCurrentTabStopIdChange","isTabbingBackOut","setIsTabbingBackOut","handleEntryFocus","onEntryFocus","getItems","__scopeRovingFocusGroup","isClickFocusRef","focusableItemsCount","setFocusableItemsCount","node","tabStopId","prevCount","orientation","isKeyboardFocus","event","entryFocusEvent","items","item","preventScrollOnEntryFocus","ITEM_NAME$2","RovingFocusGroupItem","itemProps","autoId","id","isCurrentTabStop","focusable","onFocusableItemAdd","onFocusableItemRemove","focusIntent","getFocusIntent","candidateNodes","currentIndex","wrapArray$1","focusFirst$1","MAP_KEY_TO_FOCUS_INTENT","getDirectionAwareKey","key","PREVIOUSLY_FOCUSED_ELEMENT","candidate","candidates","array","startIndex","index","Root","Item","SELECTION_KEYS","FIRST_KEYS","LAST_KEYS","FIRST_LAST_KEYS","SUB_OPEN_KEYS","SUB_CLOSE_KEYS","MENU_NAME","Collection","createMenuContext","createMenuScope","usePopperScope","useRovingFocusGroupScope","MenuProvider","useMenuContext","MenuRootProvider","useMenuRootContext","Menu","popperScope","__scopeMenu","content","setContent","isUsingKeyboardRef","handleOpenChange","onOpenChange","handlePointer","ANCHOR_NAME","MenuAnchor","anchorProps","PortalProvider","usePortalContext","CONTENT_NAME$1","MenuContentProvider","useMenuContentContext","MenuContent","portalContext","contentProps","rootContext","forceMount","MenuRootContentModal","MenuRootContentNonModal","MenuContentImpl","Slot","rovingFocusGroupScope","currentItemId","setCurrentItemId","contentRef","timerRef","searchRef","pointerGraceTimerRef","pointerGraceIntentRef","pointerDirRef","lastPointerXRef","ScrollLockWrapper","disableOutsideScroll","scrollLockWrapperProps","handleTypeaheadSearch","search","currentItem","currentMatch","nextMatch","getNextMatch","newItem","updateSearch","isPointerMovingToSubmenu","isPointerInGraceArea","intent","trapFocus","onOpenAutoFocus","onCloseAutoFocus","getOpenState","isKeyDownInside","isModifierKey","isCharacterKey","focusFirst","whenMouse","target","pointerXHasChanged","newDir","GROUP_NAME$1","MenuGroup","LABEL_NAME$1","MenuLabel","labelProps","ITEM_NAME$1","ITEM_SELECT","MenuItem","contentContext","isPointerDownRef","handleSelect","menuItem","disabled","itemSelectEvent","onSelect","MenuItemImpl","isTypingAhead","isFocused","setIsFocused","textContent","setTextContent","textValue","CHECKBOX_ITEM_NAME$1","MenuCheckboxItem","checkboxItemProps","ItemIndicatorProvider","isIndeterminate","checked","getCheckedState","onCheckedChange","RADIO_GROUP_NAME$1","RadioGroupProvider","useRadioGroupContext","MenuRadioGroup","handleValueChange","onValueChange","RADIO_ITEM_NAME$1","MenuRadioItem","radioItemProps","ITEM_INDICATOR_NAME","useItemIndicatorContext","MenuItemIndicator","itemIndicatorProps","indicatorContext","SEPARATOR_NAME$1","MenuSeparator","separatorProps","ARROW_NAME$1","MenuArrow","arrowProps","MenuSubProvider","useMenuSubContext","SUB_TRIGGER_NAME$1","MenuSubTrigger","subContext","openTimerRef","clearOpenTimer","pointerGraceTimer","onPointerGraceIntentChange","contentRect","side","rightSide","bleed","contentNearEdge","contentFarEdge","SUB_CONTENT_NAME$1","MenuSubContent","subContentProps","isCloseKey","open","wrapArray","normalizedSearch","char","currentMatchIndex","values","wrappedValues","v","isPointInPolygon","point","inside","i","j","polygon","ii","jj","xi","yi","xj","yj","y","x","area","handler","Root3","Anchor2","Content2$1","Group","Label","Item2$1","CheckboxItem","RadioGroup","RadioItem","ItemIndicator","Separator","Arrow2","SubTrigger","SubContent","DROPDOWN_MENU_NAME","createDropdownMenuContext","createDropdownMenuScope","useMenuScope","DropdownMenuProvider","useDropdownMenuContext","DropdownMenu","openProp","menuScope","__scopeDropdownMenu","triggerRef","setOpen","defaultOpen","prevOpen","TRIGGER_NAME","DropdownMenuTrigger","triggerProps","CONTENT_NAME","DropdownMenuContent","hasInteractedOutsideRef","originalEvent","ctrlLeftClick","isRightClick","GROUP_NAME","DropdownMenuGroup","LABEL_NAME","DropdownMenuLabel","ITEM_NAME","DropdownMenuItem","CHECKBOX_ITEM_NAME","DropdownMenuCheckboxItem","RADIO_GROUP_NAME","DropdownMenuRadioGroup","radioGroupProps","RADIO_ITEM_NAME","DropdownMenuRadioItem","INDICATOR_NAME","DropdownMenuItemIndicator","SEPARATOR_NAME","DropdownMenuSeparator","ARROW_NAME","DropdownMenuArrow","SUB_TRIGGER_NAME","DropdownMenuSubTrigger","subTriggerProps","SUB_CONTENT_NAME","DropdownMenuSubContent","Root2","Trigger","Content2","Item2","BarsArrowDownIcon","svgRef","titleId","title","ForwardRef","SortDropdown","searchRanking","on","accessibilityLabel","sortByRelevanceLabel","sortByDistanceLabel","import_prop_types","t","e","n","o","r","l","c","f","u","g","p","m","w","W","H","M","E","C","I","R","T","B","F","V","k","D","L","s","d","h","S","X","Y","idCounter","generateId","useLatestRef","val","handleRefs$1","refs","callAllEventHandlers$1","fns","args","fn","debounce$1","timeoutId","cancel","wrapper","time","cleanupStatus","document","getStatusDiv","statusDiv","setStatus","status","div","cleanupStatusDiv","noop","validatePropTypes$1","getState","newState","scrollIntoView","menuNode","el","_ref","top","left","isOrContainsNode","parent","child","environment","debounce$2","callAllEventHandlers","handleRefs","isControlledProp","normalizeArrowKey","keyCode","getHighlightedIndex","circular","count","itemsLastIndex","start","offset","current","highlightedIndex","getNonDisabledIndex","isItemDisabled","backwards","_index","targetWithinDownshift","checkActiveElement","downshiftElements","contextNode","capitalizeString","string","callOnChangeProps","type","action","changes","keys","_i","_keys","invokeOnChangeHandler","useEnhancedReducer","prevStateRef","actionRef","propsRef","enhancedReducer","reducer","_React$useReducer","createInitialState","dispatch","prevState","isStateEqual","useControlledReducer$1","_useEnhancedReducer","getItemAndIndex","itemProp","indexProp","errorMessage","useIsInitialMount","isInitialMountRef","stateReducer","propTypes$5","getDefaultValue$1","defaultValue","propKey","defaultStateValues","getInitialValue$1","initialValue","updateA11yStatus","useA11yMessageStatus","isInitialMount","getA11yStatusMessage","options","dependencyArray","propTypes$4","defaultProps$3","defaultStateValues$1","useIsomorphicLayoutEffect","isAcceptedCharacterKey","getInitialState$3","selectedItem","getInitialHighlightedIndex","getHighlightedIndexOnOpen","initialHighlightedIndex","defaultHighlightedIndex","itemToKey","useMouseAndTouchTracker","mouseAndTouchTrackersRef","getDownshiftElements","downshiftRefs","onMouseDown","onMouseUp","handleBlur","onTouchStart","onTouchMove","onTouchEnd","useGetterPropsCalledChecker","useScrollIntoView","itemRefs","getItemNodeFromIndex","menuElement","scrollIntoViewProp","shouldScrollRef","useControlPropsValidator","getChangesOnSelection","shouldSelect","isDropdownsStateEqual","getDefaultHighlightedIndex","downshiftCommonReducer","stateChangeTypes","propTypes$3","defaultProps$2","getItemIndexByCharacterKey","keysSoFar","itemToString","lowerCasedKeysSoFar","offsetIndex","_item","ToggleButtonClick$1","ToggleButtonKeyDownArrowDown","ToggleButtonKeyDownArrowUp","ToggleButtonKeyDownCharacter","ToggleButtonKeyDownEscape","ToggleButtonKeyDownHome","ToggleButtonKeyDownEnd","ToggleButtonKeyDownEnter","ToggleButtonKeyDownSpaceButton","ToggleButtonKeyDownPageUp","ToggleButtonKeyDownPageDown","ToggleButtonBlur","MenuMouseLeave$1","ItemMouseMove$1","ItemClick$1","FunctionToggleMenu$1","FunctionOpenMenu$1","FunctionCloseMenu$1","FunctionSetHighlightedIndex$1","FunctionSelectItem$1","FunctionSetInputValue$1","FunctionReset$2","stateChangeTypes$3","downshiftSelectReducer","altKey","lowercasedKey","reactUseId$1","useElementIds$1","useElementIdsR18$1","useElementIdsLegacy$1","menuId","getItemId","toggleButtonId","inputId","reactId","_ref2","baseId","_excluded$3","_excluded2$3","_excluded3$2","_excluded4$1","useSelect","userProps","_useControlledReducer","toggleButtonRef","menuRef","clearTimeoutRef","elementIds","latest","mouseAndTouchTrackers","setGetterPropCallInfo","toggleButtonKeyDownHandlers","currentState","toggleMenu","closeMenu","openMenu","setHighlightedIndex","newHighlightedIndex","selectItem","newSelectedItem","reset","setInputValue","newInputValue","getLabelProps","_temp","onClick","_toggleButtonRef$curr","getMenuProps","_extends2","_temp2","onMouseLeave","_ref2$refKey","refKey","rest","_ref3$suppressRefErro","_temp3","_extends3","_ref4","_temp4","onBlur","onKeyDown","_ref4$refKey","_ref5$suppressRefErro","_temp5","suppressRefError","latestState","toggleButtonHandleClick","toggleButtonHandleBlur","toggleButtonHandleKeyDown","toggleProps","toggleButtonNode","_extends4","_ref6","_temp6","onMouseMove","_ref6$refKey","disabledProp","_latest$current","latestProps","_getItemAndIndex","itemHandleMouseMove","itemHandleClick","itemHandleMouseDown","itemNode","InputKeyDownArrowDown","InputKeyDownArrowUp","InputKeyDownEscape","InputKeyDownHome","InputKeyDownEnd","InputKeyDownPageUp","InputKeyDownPageDown","InputKeyDownEnter","InputChange","InputBlur","InputClick","MenuMouseLeave","ItemMouseMove","ItemClick","ToggleButtonClick","FunctionToggleMenu","FunctionOpenMenu","FunctionCloseMenu","FunctionSetHighlightedIndex","FunctionSelectItem","FunctionSetInputValue","FunctionReset$1","ControlledPropUpdatedSelectedItem","stateChangeTypes$2","getInitialState$2","initialState","propTypes$2","useControlledReducer","previousSelectedItemRef","defaultProps$1","downshiftUseComboboxReducer","_excluded$2","_excluded2$2","_excluded3$1","_excluded4","useCombobox","previousResultCountRef","_inputRef$current","inputKeyDownHandlers","_ref$refKey","_ref2$suppressRefErro","getItemProps","_ref3","_ref3$refKey","onSelectKey","customClickHandler","getToggleButtonProps","_ref5","_ref5$refKey","getInputProps","_extends5","onChange","onInput","_ref7$suppressRefErro","inputHandleKeyDown","inputHandleChange","inputHandleBlur","inputHandleClick","onChangeKey","eventHandlers","_eventHandlers","inputNode","getInitialValue","getDefaultValue","getInitialState$1","isKeyDownOperationPermitted","element","isStateEqual$1","defaultProps","validatePropTypes","SelectedItemClick","SelectedItemKeyDownDelete","SelectedItemKeyDownBackspace","SelectedItemKeyDownNavigationNext","SelectedItemKeyDownNavigationPrevious","DropdownKeyDownNavigationPrevious","DropdownKeyDownBackspace","DropdownClick","FunctionAddSelectedItem","FunctionRemoveSelectedItem","FunctionSetSelectedItems","FunctionSetActiveIndex","FunctionReset","stateChangeTypes$1","downshiftMultipleSelectionReducer","activeIndex","selectedItems","newActiveIndex","_newActiveIndex","selectedItemIndex","_excluded$1","_excluded2$1","useMultipleSelection","keyNavigationNext","keyNavigationPrevious","dropdownRef","selectedItemRefs","selectedItemKeyDownHandlers","dropdownKeyDownHandlers","selectedItemProp","isFocusable","selectedItemNode","_ref4$preventKeyActio","preventKeyAction","dropdownNode","newSelectedItems","TagClick","TagGroupKeyDownArrowLeft","TagGroupKeyDownArrowRight","TagGroupKeyDownDelete","TagGroupKeyDownBackspace","TagRemoveClick","FunctionAddItem","useTagGroupReducer","newItems","_newItems","_newItems2","_newActiveIndex2","reactUseId","useElementIds","useElementIdsR18","useElementIdsLegacy","tagGroupId","getTagId","getInitialState","oldState","A11Y_DESCRIPTION_ELEMENT_ID","useAccessibleDescription","accessibleDescriptionElement","description","getMergedProps","useRovingTagFocus","previousActiveIndexRef","previousItemsLengthRef","itemsLength","_itemRefs$current$get","propTypes","_excluded","_excluded2","_excluded3","_useTagGroup","getTagGroupProps","getTagProps","_options$refKey","handleClick","tagId","getTagRemoveProps","tagRemoveId","import_debounce","debounce","timeout","timestamp","result","wait","later","last","immediate","func","debounced","callNow","ROW_HEIGHT","MAX_ITEMS","OrganizationListComponent","childrenCount","fullHeight","organizations","overlayEnabled","distanceUnit","getDistanceDisplay","organization","elem","distanceDisplay","maxItemsToDisplay","LightbulbIcon","AddSchoolRequestRow","shouldShowTips","setShouldShowTips","urlAddSchoolForm","programId","trackEvent","onTipsShown","getSearchValue","orgSearchUrl","getAttribution","updateSearchUrl","searchValue","newParams","params","origin","pathname","FetchOrganizationsComponent","setOrganizations","isErrored","setIsErrored","mountedRef","prevSearchTermRef","searchRankingRef","searchTerm","doFetch","url","sv","loaded","fetchParams","ranking","fetchedOrganizations","currentSearchTerm","debouncedFetchRef","prevSearchTerm","minimumSearchValueLength","userLatitude","userLongitude","orgSearchAttribution","openOrgSearchEnabled","onClickAddSchool","handleStateChange","opts","TypeaheadClearButtonComponent","handleOnBlur","TypeaheadComponent","loadedOrgs","setLoadedOrgs","numReworksRef","startTimeRef","tipsShownRef","searchAfterTipsTrackedRef","showClearButton","setShowClearButton","disabledClearButton","setDisabledClearButton","inputHtmlId","selectedRank","timeUntilSelection","recordNumericMetric","handleInputChange","handleOnFocus","handleOnInteraction","className","isWarned","isRequired","ariaDescribedBy","msg","loadedOrganizations","isOpenOrganization","shouldCollectPostalCode","programConfiguration","viewModel","FormFieldTypeahead","labelHtmlId","fieldId","errorHtmlId","warningHtmlId","verificationService","countryChoiceValue","needToPickCountry","verificationResponse","autoFocus","setAutoFocus","showSearchOverlay","showSelectedOrgBox","showOpenOrgWarningOrange","showOpenOrgWarningGray","showOpenOrgWarningFlag","showOpenOrgWarning","setShowOpenOrgWarning","handleChange","newValue","openOrgWarningMessage","warningMsg","warningMessage","helperMsg","helperMessage","explanation"],"sources":["../../../packages/org-search/src/SearchOverlay/context.ts","../../../packages/org-search/src/SearchRanking/context.ts","../../../packages/org-search/src/hooks/useGeoLocation.ts","../../../packages/org-search/src/SearchRanking/SearchRankingProvider.tsx","../../../packages/org-search/src/SearchOverlay/SearchOverlay.tsx","../../../packages/org-search/src/SelectedOrg/SelectedOrg.tsx","../../../packages/org-search/src/utils/distance.ts","../../../node_modules/@radix-ui/react-collection/dist/index.mjs","../../../node_modules/@radix-ui/react-direction/dist/index.mjs","../../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs","../../../node_modules/@radix-ui/react-menu/dist/index.mjs","../../../node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs","../../../node_modules/@heroicons/react/24/outline/esm/BarsArrowDownIcon.js","../../../packages/org-search/src/SortDropdown/SortDropdown.tsx","../../../node_modules/compute-scroll-into-view/dist/index.js","../../../node_modules/downshift/dist/downshift.esm.mjs","../../../node_modules/debounce/index.js","../../src/components/OrganizationList/OrganizationListComponent.tsx","../../src/components/FetchOrganizationsComponent.tsx","../../src/components/FormInputs/Typeahead/TypeaheadComponentHelper.ts","../../src/components/FormInputs/Typeahead/TypeaheadClearButton/TypeaheadClearButtonComponent.tsx","../../src/components/FormInputs/Typeahead/TypeaheadComponent.tsx","../../src/lib/organization/organization.ts","../../src/components/FormFields/FormFieldTypeahead/FormFieldTypeahead.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\ntype SearchOverlayContext = {\n showOverlay: boolean;\n setShowOverlay: (open: boolean) => void;\n};\n\nexport const SearchOverlayContext = createContext<SearchOverlayContext>({\n showOverlay: false,\n setShowOverlay: () => undefined,\n});\n\nexport const useSearchOverlay = () => useContext(SearchOverlayContext);\n","import { createContext, useContext } from \"react\";\n\nimport type { GeoLocation } from \"../hooks/useGeoLocation\";\n\nexport type SortMode = \"relevance\" | \"distance\";\n\nexport type SearchRankingContextType = {\n sortMode: SortMode;\n userLocation: GeoLocation | null;\n locationDenied: boolean;\n setSortMode: (mode: SortMode) => void;\n requestLocation: () => Promise<GeoLocation>;\n};\n\nexport const SearchRankingContext = createContext<SearchRankingContextType | null>(null);\n\n/*\n * Will return null if not inside a SearchRanking context\n */\nexport const useSearchRanking = (): SearchRankingContextType | null => {\n const context = useContext(SearchRankingContext);\n return context;\n};\n","import { useState, useCallback } from \"react\";\n\nexport type GeoLocation = {\n latitude: number;\n longitude: number;\n};\n\nexport type GeoLocationError = {\n code: number;\n message: string;\n};\n\nexport type UseGeoLocationResult = {\n location: GeoLocation | null;\n error: GeoLocationError | null;\n loading: boolean;\n requestLocation: () => Promise<GeoLocation>;\n};\n\nexport function useGeoLocation(): UseGeoLocationResult {\n const [location, setLocation] = useState<GeoLocation | null>(null);\n const [error, setError] = useState<GeoLocationError | null>(null);\n const [loading, setLoading] = useState(false);\n\n const requestLocation = useCallback((): Promise<GeoLocation> => {\n setLoading(true);\n setError(null);\n\n return new Promise((resolve, reject) => {\n navigator.geolocation.getCurrentPosition(\n (position) => {\n const loc = {\n latitude: position.coords.latitude,\n longitude: position.coords.longitude,\n };\n setLocation(loc);\n setLoading(false);\n resolve(loc);\n },\n (err) => {\n const geoError = { code: err.code, message: err.message };\n setError(geoError);\n setLoading(false);\n reject(geoError);\n },\n );\n });\n }, []);\n\n return {\n location,\n error,\n loading,\n requestLocation,\n };\n}\n","import type React from \"react\";\nimport { useState, useCallback, useMemo } from \"react\";\n\nimport { useGeoLocation, type GeoLocation } from \"../hooks/useGeoLocation\";\n\nimport { SearchRankingContext, type SortMode } from \"./context\";\n\ntype SearchRankingProviderProps = {\n children: React.ReactNode;\n};\n\nexport const SearchRankingProvider: React.FC<SearchRankingProviderProps> = ({ children }) => {\n const [sortMode, setSortMode] = useState<SortMode>(\"relevance\");\n const [userLocation, setUserLocation] = useState<GeoLocation | null>(null);\n const [locationDenied, setLocationDenied] = useState(false);\n const geoLocation = useGeoLocation();\n\n const requestLocation = useCallback(async (): Promise<GeoLocation> => {\n try {\n const location = await geoLocation.requestLocation();\n setUserLocation(location);\n setLocationDenied(false);\n return location;\n } catch {\n setLocationDenied(true);\n throw new Error(\"Location denied\");\n }\n }, [geoLocation]);\n\n const value = useMemo(\n () => ({\n sortMode,\n userLocation,\n locationDenied,\n setSortMode,\n requestLocation,\n }),\n [sortMode, userLocation, locationDenied, requestLocation],\n );\n\n return <SearchRankingContext.Provider value={value}>{children}</SearchRankingContext.Provider>;\n};\n","import type React from \"react\";\nimport { useEffect, useRef, useState, type PropsWithChildren, type ReactNode } from \"react\";\n\nimport { SearchRankingProvider } from \"../SearchRanking\";\n\nimport { SearchOverlayContext } from \"./context\";\n\ninterface Props {\n closeSectionLabel?: ReactNode;\n enabled: boolean;\n}\n\nconst FOCUSABLE_SELECTOR =\n 'button, a[href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n// The page behind the overlay gets the scrim's tint: the theme's text colour at 10%. The body sits\n// outside the themed element, where theme variables don't resolve, so the colour is read from\n// inside the overlay and written as a value.\nconst FALLBACK_PAGE_TINT = \"rgba(0,0,0,.1)\";\nconst pageTint = (themed: HTMLElement | null): string => {\n const foreground = themed && getComputedStyle(themed).getPropertyValue(\"--foreground\").trim();\n return foreground ? `color-mix(in oklab, ${foreground} 10%, transparent)` : FALLBACK_PAGE_TINT;\n};\n\nexport const SearchOverlay: React.FC<PropsWithChildren<Props>> = ({\n children,\n enabled,\n closeSectionLabel,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n const showOverlay = enabled && isOpen;\n const scrollTo = useRef(0);\n\n /**\n * we're creating a full-screen modal. Thats mostly handled in the CSS. but we\n * don't want it to mess with the the underlying scroll. So we track the\n * existing scroll location, turn off scrolling & move to the top. Then we\n * undo that when we close.\n */\n const setShowOverlay = (state: boolean) => {\n if (!enabled) return;\n const inFrame = window !== window.top;\n\n if (state && isOpen === false) {\n scrollTo.current = window.scrollY;\n document.body.style.overflow = \"hidden\";\n document.body.style.backgroundColor = pageTint(containerRef.current);\n window.scrollTo({ top: 0 });\n\n // We're in a frame, hard set the iframe body element to the modal max\n // height or the current document height. Whichever is smaller.\n // When turning off the overlay we unset this.\n if (inFrame) {\n // calc(100vh - 80px) is the modal css max height\n // It would be nice to be able to do this entirely in css\n // but css lengths fall down a bit inside frames.\n const modalMax = window.screen.availHeight - 80;\n const currentHeight = document.body.clientHeight;\n\n document.body.style.height = `${Math.min(currentHeight, modalMax)}px`;\n }\n\n if (containerRef.current) {\n setTimeout(() => {\n containerRef.current.scrollIntoView();\n }, 0);\n }\n }\n\n if (!state && isOpen) {\n document.body.style.overflow = \"\";\n document.body.style.backgroundColor = \"\";\n window.scrollTo({ top: scrollTo.current });\n if (inFrame) {\n document.body.style.height = \"\";\n }\n }\n\n setIsOpen(state);\n };\n\n // Focus trapping: keep Tab/Shift+Tab within overlay, close on Escape\n useEffect(() => {\n if (!showOverlay) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== \"Tab\") return;\n\n const container = containerRef.current;\n if (!container) return;\n\n const focusableElements = container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n\n if (e.shiftKey && document.activeElement === firstElement) {\n e.preventDefault();\n lastElement?.focus();\n } else if (!e.shiftKey && document.activeElement === lastElement) {\n e.preventDefault();\n firstElement?.focus();\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown, true);\n return () => document.removeEventListener(\"keydown\", handleKeyDown, true);\n }, [showOverlay]);\n\n if (!enabled) {\n return <>{children}</>;\n }\n\n return (\n <SearchOverlayContext.Provider value={{ showOverlay, setShowOverlay }}>\n <SearchRankingProvider>\n <div className={showOverlay ? \"sid-search-overlay__overlay\" : undefined}>\n <div\n className={showOverlay ? \"sid-search-overlay__container\" : undefined}\n ref={containerRef}\n >\n {showOverlay && (\n <button className=\"sid-search-overlay__close\" onClick={() => setShowOverlay(false)}>\n {closeSectionLabel}\n </button>\n )}\n {children}\n </div>\n </div>\n </SearchRankingProvider>\n </SearchOverlayContext.Provider>\n );\n};\n","import type React from \"react\";\nimport { useEffect, useRef } from \"react\";\n\ntype Organization = {\n id: number;\n name: string;\n state?: string;\n city?: string;\n};\n\ninterface Props {\n org: Organization;\n onClear: () => void;\n clearSelectionLabel: string;\n labelId: string;\n}\n\nexport const SelectedOrg: React.FC<Props> = ({ org, onClear, clearSelectionLabel, labelId }) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const location = [org.city, org.state].filter(Boolean).join(\", \");\n const inputValue = [org.name, location].filter(Boolean).join(\", \");\n\n useEffect(() => {\n inputRef.current?.focus();\n }, []);\n\n return (\n <div className=\"sid-selected-org__wrapper\">\n <input\n ref={inputRef}\n className=\"sid-h-screen-reader-only\"\n type=\"text\"\n readOnly\n aria-labelledby={labelId}\n aria-expanded={false}\n value={inputValue}\n />\n <div className=\"sid-selected-org__container\">\n <div className=\"sid-selected-org__name\" aria-hidden=\"true\">\n {org.name}\n {location && <span className=\"sid-selected-org__location\">{location}</span>}\n </div>\n <button\n className=\"sid-selected-org__clear\"\n aria-label={clearSelectionLabel}\n onClick={onClear}\n >\n ✕\n </button>\n </div>\n </div>\n );\n};\n","export type DistanceUnit = \"miles\" | \"kilometers\";\n\nconst EARTH_RADIUS_KM = 6371;\n\n/**\n * Calculate the distance between two points using the Haversine formula\n * @returns Distance in kilometers\n */\nexport function calculateDistance(lat1: number, lon1: number, lat2: number, lon2: number): number {\n const toRadians = (degrees: number) => (degrees * Math.PI) / 180;\n\n const dLat = toRadians(lat2 - lat1);\n const dLon = toRadians(lon2 - lon1);\n\n const a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);\n\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return EARTH_RADIUS_KM * c;\n}\n\nconst MILES_LOCALES = [\"en-us\", \"en-gb\"];\n\n/**\n * Determine the appropriate distance unit based on locale\n * US and GB use miles, others use kilometers\n */\nexport function getDistanceUnit(locale: string): DistanceUnit {\n return MILES_LOCALES.includes(locale.toLowerCase()) ? \"miles\" : \"kilometers\";\n}\n\n/**\n * Format a distance value with the appropriate unit suffix\n * Distances < 10 show one decimal, >= 10 show whole number\n *\n * @param distanceKm in km\n * @param unit DistanceUnit\n *\n * If unit is miles, convert internally.\n */\nexport function formatDistance(distanceKm: number, unit: DistanceUnit): string {\n const suffix = unit === \"miles\" ? \"mi\" : \"km\";\n const distance = unit === \"miles\" ? distanceKm * 0.621371 : distanceKm;\n\n // Round to one decimal first to determine display format\n const rounded = Math.round(distance * 10) / 10;\n\n if (rounded >= 10) {\n return `${Math.round(distance)} ${suffix}`;\n }\n\n return `${rounded} ${suffix}`;\n}\n","\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n insert(index, key, value) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i];\n if (keys[i] === key) {\n nextKey = keys[i + 1];\n }\n if (has) {\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1];\n const currentValue = nextValue;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n find(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return void 0;\n }\n findIndex(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n filter(predicate, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new _OrderedDict(entries);\n }\n map(callbackfn, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new _OrderedDict(entries);\n }\n reduce(...args) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0);\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1);\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index);\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index);\n const element = this.get(key);\n reversed.set(key, element);\n }\n return reversed;\n }\n toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\n }\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index);\n const element = this.get(key);\n result.set(key, element);\n }\n return result;\n }\n every(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n some(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n};\nfunction at(array, index) {\n if (\"at\" in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0\n }\n );\n const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\n });\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\n if (a === b) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\") return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === \"childList\") {\n callback();\n return;\n }\n }\n });\n return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/direction/src/direction.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DirectionContext = React.createContext(void 0);\nvar DirectionProvider = (props) => {\n const { dir, children } = props;\n return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });\n};\nfunction useDirection(localDir) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\nvar Provider = DirectionProvider;\nexport {\n DirectionProvider,\n Provider,\n useDirection\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/roving-focus-group.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { jsx } from \"react/jsx-runtime\";\nvar ENTRY_FOCUS = \"rovingFocusGroup.onEntryFocus\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar GROUP_NAME = \"RovingFocusGroup\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);\nvar [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(\n GROUP_NAME,\n [createCollectionScope]\n);\nvar [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);\nvar RovingFocusGroup = React.forwardRef(\n (props, forwardedRef) => {\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });\n }\n);\nRovingFocusGroup.displayName = GROUP_NAME;\nvar RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n orientation,\n loop = false,\n dir,\n currentTabStopId: currentTabStopIdProp,\n defaultCurrentTabStopId,\n onCurrentTabStopIdChange,\n onEntryFocus,\n preventScrollOnEntryFocus = false,\n ...groupProps\n } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const direction = useDirection(dir);\n const [currentTabStopId, setCurrentTabStopId] = useControllableState({\n prop: currentTabStopIdProp,\n defaultProp: defaultCurrentTabStopId ?? null,\n onChange: onCurrentTabStopIdChange,\n caller: GROUP_NAME\n });\n const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);\n const handleEntryFocus = useCallbackRef(onEntryFocus);\n const getItems = useCollection(__scopeRovingFocusGroup);\n const isClickFocusRef = React.useRef(false);\n const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n node.addEventListener(ENTRY_FOCUS, handleEntryFocus);\n return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);\n }\n }, [handleEntryFocus]);\n return /* @__PURE__ */ jsx(\n RovingFocusProvider,\n {\n scope: __scopeRovingFocusGroup,\n orientation,\n dir: direction,\n loop,\n currentTabStopId,\n onItemFocus: React.useCallback(\n (tabStopId) => setCurrentTabStopId(tabStopId),\n [setCurrentTabStopId]\n ),\n onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),\n onFocusableItemAdd: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount + 1),\n []\n ),\n onFocusableItemRemove: React.useCallback(\n () => setFocusableItemsCount((prevCount) => prevCount - 1),\n []\n ),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,\n \"data-orientation\": orientation,\n ...groupProps,\n ref: composedRefs,\n style: { outline: \"none\", ...props.style },\n onMouseDown: composeEventHandlers(props.onMouseDown, () => {\n isClickFocusRef.current = true;\n }),\n onFocus: composeEventHandlers(props.onFocus, (event) => {\n const isKeyboardFocus = !isClickFocusRef.current;\n if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {\n const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);\n event.currentTarget.dispatchEvent(entryFocusEvent);\n if (!entryFocusEvent.defaultPrevented) {\n const items = getItems().filter((item) => item.focusable);\n const activeItem = items.find((item) => item.active);\n const currentItem = items.find((item) => item.id === currentTabStopId);\n const candidateItems = [activeItem, currentItem, ...items].filter(\n Boolean\n );\n const candidateNodes = candidateItems.map((item) => item.ref.current);\n focusFirst(candidateNodes, preventScrollOnEntryFocus);\n }\n }\n isClickFocusRef.current = false;\n }),\n onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))\n }\n )\n }\n );\n});\nvar ITEM_NAME = \"RovingFocusGroupItem\";\nvar RovingFocusGroupItem = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeRovingFocusGroup,\n focusable = true,\n active = false,\n tabStopId,\n children,\n ...itemProps\n } = props;\n const autoId = useId();\n const id = tabStopId || autoId;\n const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);\n const isCurrentTabStop = context.currentTabStopId === id;\n const getItems = useCollection(__scopeRovingFocusGroup);\n const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;\n React.useEffect(() => {\n if (focusable) {\n onFocusableItemAdd();\n return () => onFocusableItemRemove();\n }\n }, [focusable, onFocusableItemAdd, onFocusableItemRemove]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeRovingFocusGroup,\n id,\n focusable,\n active,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n tabIndex: isCurrentTabStop ? 0 : -1,\n \"data-orientation\": context.orientation,\n ...itemProps,\n ref: forwardedRef,\n onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {\n if (!focusable) event.preventDefault();\n else context.onItemFocus(id);\n }),\n onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key === \"Tab\" && event.shiftKey) {\n context.onItemShiftTab();\n return;\n }\n if (event.target !== event.currentTarget) return;\n const focusIntent = getFocusIntent(event, context.orientation, context.dir);\n if (focusIntent !== void 0) {\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;\n event.preventDefault();\n const items = getItems().filter((item) => item.focusable);\n let candidateNodes = items.map((item) => item.ref.current);\n if (focusIntent === \"last\") candidateNodes.reverse();\n else if (focusIntent === \"prev\" || focusIntent === \"next\") {\n if (focusIntent === \"prev\") candidateNodes.reverse();\n const currentIndex = candidateNodes.indexOf(event.currentTarget);\n candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);\n }\n setTimeout(() => focusFirst(candidateNodes));\n }\n }),\n children: typeof children === \"function\" ? children({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children\n }\n )\n }\n );\n }\n);\nRovingFocusGroupItem.displayName = ITEM_NAME;\nvar MAP_KEY_TO_FOCUS_INTENT = {\n ArrowLeft: \"prev\",\n ArrowUp: \"prev\",\n ArrowRight: \"next\",\n ArrowDown: \"next\",\n PageUp: \"first\",\n Home: \"first\",\n PageDown: \"last\",\n End: \"last\"\n};\nfunction getDirectionAwareKey(key, dir) {\n if (dir !== \"rtl\") return key;\n return key === \"ArrowLeft\" ? \"ArrowRight\" : key === \"ArrowRight\" ? \"ArrowLeft\" : key;\n}\nfunction getFocusIntent(event, orientation, dir) {\n const key = getDirectionAwareKey(event.key, dir);\n if (orientation === \"vertical\" && [\"ArrowLeft\", \"ArrowRight\"].includes(key)) return void 0;\n if (orientation === \"horizontal\" && [\"ArrowUp\", \"ArrowDown\"].includes(key)) return void 0;\n return MAP_KEY_TO_FOCUS_INTENT[key];\n}\nfunction focusFirst(candidates, preventScroll = false) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus({ preventScroll });\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nvar Root = RovingFocusGroup;\nvar Item = RovingFocusGroupItem;\nexport {\n Item,\n Root,\n RovingFocusGroup,\n RovingFocusGroupItem,\n createRovingFocusGroupScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/menu.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createCollection } from \"@radix-ui/react-collection\";\nimport { useComposedRefs, composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\";\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useId } from \"@radix-ui/react-id\";\nimport * as PopperPrimitive from \"@radix-ui/react-popper\";\nimport { createPopperScope } from \"@radix-ui/react-popper\";\nimport { Portal as PortalPrimitive } from \"@radix-ui/react-portal\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport * as RovingFocusGroup from \"@radix-ui/react-roving-focus\";\nimport { createRovingFocusGroupScope } from \"@radix-ui/react-roving-focus\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { hideOthers } from \"aria-hidden\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { jsx } from \"react/jsx-runtime\";\nvar SELECTION_KEYS = [\"Enter\", \" \"];\nvar FIRST_KEYS = [\"ArrowDown\", \"PageUp\", \"Home\"];\nvar LAST_KEYS = [\"ArrowUp\", \"PageDown\", \"End\"];\nvar FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nvar SUB_OPEN_KEYS = {\n ltr: [...SELECTION_KEYS, \"ArrowRight\"],\n rtl: [...SELECTION_KEYS, \"ArrowLeft\"]\n};\nvar SUB_CLOSE_KEYS = {\n ltr: [\"ArrowLeft\"],\n rtl: [\"ArrowRight\"]\n};\nvar MENU_NAME = \"Menu\";\nvar [Collection, useCollection, createCollectionScope] = createCollection(MENU_NAME);\nvar [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, [\n createCollectionScope,\n createPopperScope,\n createRovingFocusGroupScope\n]);\nvar usePopperScope = createPopperScope();\nvar useRovingFocusGroupScope = createRovingFocusGroupScope();\nvar [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);\nvar [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);\nvar Menu = (props) => {\n const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;\n const popperScope = usePopperScope(__scopeMenu);\n const [content, setContent] = React.useState(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const direction = useDirection(dir);\n React.useEffect(() => {\n const handleKeyDown = () => {\n isUsingKeyboardRef.current = true;\n document.addEventListener(\"pointerdown\", handlePointer, { capture: true, once: true });\n document.addEventListener(\"pointermove\", handlePointer, { capture: true, once: true });\n };\n const handlePointer = () => isUsingKeyboardRef.current = false;\n document.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n document.removeEventListener(\"pointerdown\", handlePointer, { capture: true });\n document.removeEventListener(\"pointermove\", handlePointer, { capture: true });\n };\n }, []);\n return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx(\n MenuProvider,\n {\n scope: __scopeMenu,\n open,\n onOpenChange: handleOpenChange,\n content,\n onContentChange: setContent,\n children: /* @__PURE__ */ jsx(\n MenuRootProvider,\n {\n scope: __scopeMenu,\n onClose: React.useCallback(() => handleOpenChange(false), [handleOpenChange]),\n isUsingKeyboardRef,\n dir: direction,\n modal,\n children\n }\n )\n }\n ) });\n};\nMenu.displayName = MENU_NAME;\nvar ANCHOR_NAME = \"MenuAnchor\";\nvar MenuAnchor = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...anchorProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });\n }\n);\nMenuAnchor.displayName = ANCHOR_NAME;\nvar PORTAL_NAME = \"MenuPortal\";\nvar [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, {\n forceMount: void 0\n});\nvar MenuPortal = (props) => {\n const { __scopeMenu, forceMount, children, container } = props;\n const context = useMenuContext(PORTAL_NAME, __scopeMenu);\n return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children }) }) });\n};\nMenuPortal.displayName = PORTAL_NAME;\nvar CONTENT_NAME = \"MenuContent\";\nvar [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME);\nvar MenuContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });\n }\n);\nvar MenuRootContentModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n return /* @__PURE__ */ jsx(\n MenuContentImpl,\n {\n ...props,\n ref: composedRefs,\n trapFocus: context.open,\n disableOutsidePointerEvents: context.open,\n disableOutsideScroll: true,\n onFocusOutside: composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false }\n ),\n onDismiss: () => context.onOpenChange(false)\n }\n );\n }\n);\nvar MenuRootContentNonModal = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n return /* @__PURE__ */ jsx(\n MenuContentImpl,\n {\n ...props,\n ref: forwardedRef,\n trapFocus: false,\n disableOutsidePointerEvents: false,\n disableOutsideScroll: false,\n onDismiss: () => context.onOpenChange(false)\n }\n );\n});\nvar Slot = createSlot(\"MenuContent.ScrollLock\");\nvar MenuContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeMenu,\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEntryFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME, __scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const getItems = useCollection(__scopeMenu);\n const [currentItemId, setCurrentItemId] = React.useState(null);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);\n const timerRef = React.useRef(0);\n const searchRef = React.useRef(\"\");\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef(null);\n const pointerDirRef = React.useRef(\"right\");\n const lastPointerXRef = React.useRef(0);\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot, allowPinchZoom: true } : void 0;\n const handleTypeaheadSearch = (key) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n (function updateSearch(value) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== \"\") timerRef.current = window.setTimeout(() => updateSearch(\"\"), 1e3);\n })(search);\n if (newItem) {\n setTimeout(() => newItem.focus());\n }\n };\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n useFocusGuards();\n const isPointerMovingToSubmenu = React.useCallback((event) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n return /* @__PURE__ */ jsx(\n MenuContentProvider,\n {\n scope: __scopeMenu,\n searchRef,\n onItemEnter: React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n ),\n onItemLeave: React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu]\n ),\n onTriggerLeave: React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n ),\n pointerGraceTimerRef,\n onPointerGraceIntentChange: React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, []),\n children: /* @__PURE__ */ jsx(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx(\n FocusScope,\n {\n asChild: true,\n trapped: trapFocus,\n onMountAutoFocus: composeEventHandlers(onOpenAutoFocus, (event) => {\n event.preventDefault();\n contentRef.current?.focus({ preventScroll: true });\n }),\n onUnmountAutoFocus: onCloseAutoFocus,\n children: /* @__PURE__ */ jsx(\n DismissableLayer,\n {\n asChild: true,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n children: /* @__PURE__ */ jsx(\n RovingFocusGroup.Root,\n {\n asChild: true,\n ...rovingFocusGroupScope,\n dir: rootContext.dir,\n orientation: \"vertical\",\n loop,\n currentTabStopId: currentItemId,\n onCurrentTabStopIdChange: setCurrentItemId,\n onEntryFocus: composeEventHandlers(onEntryFocus, (event) => {\n if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();\n }),\n preventScrollOnEntryFocus: true,\n children: /* @__PURE__ */ jsx(\n PopperPrimitive.Content,\n {\n role: \"menu\",\n \"aria-orientation\": \"vertical\",\n \"data-state\": getOpenState(context.open),\n \"data-radix-menu-content\": \"\",\n dir: rootContext.dir,\n ...popperScope,\n ...contentProps,\n ref: composedRefs,\n style: { outline: \"none\", ...contentProps.style },\n onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {\n const target = event.target;\n const isKeyDownInside = target.closest(\"[data-radix-menu-content]\") === event.currentTarget;\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n const isCharacterKey = event.key.length === 1;\n if (isKeyDownInside) {\n if (event.key === \"Tab\") event.preventDefault();\n if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);\n }\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n }),\n onBlur: composeEventHandlers(props.onBlur, (event) => {\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = \"\";\n }\n }),\n onPointerMove: composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? \"right\" : \"left\";\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n })\n )\n }\n )\n }\n )\n }\n )\n }\n ) })\n }\n );\n }\n);\nMenuContent.displayName = CONTENT_NAME;\nvar GROUP_NAME = \"MenuGroup\";\nvar MenuGroup = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...groupProps } = props;\n return /* @__PURE__ */ jsx(Primitive.div, { role: \"group\", ...groupProps, ref: forwardedRef });\n }\n);\nMenuGroup.displayName = GROUP_NAME;\nvar LABEL_NAME = \"MenuLabel\";\nvar MenuLabel = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...labelProps } = props;\n return /* @__PURE__ */ jsx(Primitive.div, { ...labelProps, ref: forwardedRef });\n }\n);\nMenuLabel.displayName = LABEL_NAME;\nvar ITEM_NAME = \"MenuItem\";\nvar ITEM_SELECT = \"menu.itemSelect\";\nvar MenuItem = React.forwardRef(\n (props, forwardedRef) => {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef(null);\n const rootContext = useMenuRootContext(ITEM_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isPointerDownRef = React.useRef(false);\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n dispatchDiscreteCustomEvent(menuItem, itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) {\n isPointerDownRef.current = false;\n } else {\n rootContext.onClose();\n }\n }\n };\n return /* @__PURE__ */ jsx(\n MenuItemImpl,\n {\n ...itemProps,\n ref: composedRefs,\n disabled,\n onClick: composeEventHandlers(props.onClick, handleSelect),\n onPointerDown: (event) => {\n props.onPointerDown?.(event);\n isPointerDownRef.current = true;\n },\n onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {\n if (!isPointerDownRef.current) event.currentTarget?.click();\n }),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== \"\";\n if (disabled || isTypingAhead && event.key === \" \") return;\n if (SELECTION_KEYS.includes(event.key)) {\n event.currentTarget.click();\n event.preventDefault();\n }\n })\n }\n );\n }\n);\nMenuItem.displayName = ITEM_NAME;\nvar MenuItemImpl = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;\n const contentContext = useMenuContentContext(ITEM_NAME, __scopeMenu);\n const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const [isFocused, setIsFocused] = React.useState(false);\n const [textContent, setTextContent] = React.useState(\"\");\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? \"\").trim());\n }\n }, [itemProps.children]);\n return /* @__PURE__ */ jsx(\n Collection.ItemSlot,\n {\n scope: __scopeMenu,\n disabled,\n textValue: textValue ?? textContent,\n children: /* @__PURE__ */ jsx(RovingFocusGroup.Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n role: \"menuitem\",\n \"data-highlighted\": isFocused ? \"\" : void 0,\n \"aria-disabled\": disabled || void 0,\n \"data-disabled\": disabled ? \"\" : void 0,\n ...itemProps,\n ref: composedRefs,\n onPointerMove: composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus({ preventScroll: true });\n }\n }\n })\n ),\n onPointerLeave: composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event))\n ),\n onFocus: composeEventHandlers(props.onFocus, () => setIsFocused(true)),\n onBlur: composeEventHandlers(props.onBlur, () => setIsFocused(false))\n }\n ) })\n }\n );\n }\n);\nvar CHECKBOX_ITEM_NAME = \"MenuCheckboxItem\";\nvar MenuCheckboxItem = React.forwardRef(\n (props, forwardedRef) => {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return /* @__PURE__ */ jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx(\n MenuItem,\n {\n role: \"menuitemcheckbox\",\n \"aria-checked\": isIndeterminate(checked) ? \"mixed\" : checked,\n ...checkboxItemProps,\n ref: forwardedRef,\n \"data-state\": getCheckedState(checked),\n onSelect: composeEventHandlers(\n checkboxItemProps.onSelect,\n () => onCheckedChange?.(isIndeterminate(checked) ? true : !checked),\n { checkForDefaultPrevented: false }\n )\n }\n ) });\n }\n);\nMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\nvar RADIO_GROUP_NAME = \"MenuRadioGroup\";\nvar [RadioGroupProvider, useRadioGroupContext] = createMenuContext(\n RADIO_GROUP_NAME,\n { value: void 0, onValueChange: () => {\n } }\n);\nvar MenuRadioGroup = React.forwardRef(\n (props, forwardedRef) => {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n return /* @__PURE__ */ jsx(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsx(MenuGroup, { ...groupProps, ref: forwardedRef }) });\n }\n);\nMenuRadioGroup.displayName = RADIO_GROUP_NAME;\nvar RADIO_ITEM_NAME = \"MenuRadioItem\";\nvar MenuRadioItem = React.forwardRef(\n (props, forwardedRef) => {\n const { value, ...radioItemProps } = props;\n const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);\n const checked = value === context.value;\n return /* @__PURE__ */ jsx(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx(\n MenuItem,\n {\n role: \"menuitemradio\",\n \"aria-checked\": checked,\n ...radioItemProps,\n ref: forwardedRef,\n \"data-state\": getCheckedState(checked),\n onSelect: composeEventHandlers(\n radioItemProps.onSelect,\n () => context.onValueChange?.(value),\n { checkForDefaultPrevented: false }\n )\n }\n ) });\n }\n);\nMenuRadioItem.displayName = RADIO_ITEM_NAME;\nvar ITEM_INDICATOR_NAME = \"MenuItemIndicator\";\nvar [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(\n ITEM_INDICATOR_NAME,\n { checked: false }\n);\nvar MenuItemIndicator = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;\n const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);\n return /* @__PURE__ */ jsx(\n Presence,\n {\n present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,\n children: /* @__PURE__ */ jsx(\n Primitive.span,\n {\n ...itemIndicatorProps,\n ref: forwardedRef,\n \"data-state\": getCheckedState(indicatorContext.checked)\n }\n )\n }\n );\n }\n);\nMenuItemIndicator.displayName = ITEM_INDICATOR_NAME;\nvar SEPARATOR_NAME = \"MenuSeparator\";\nvar MenuSeparator = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...separatorProps } = props;\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n role: \"separator\",\n \"aria-orientation\": \"horizontal\",\n ...separatorProps,\n ref: forwardedRef\n }\n );\n }\n);\nMenuSeparator.displayName = SEPARATOR_NAME;\nvar ARROW_NAME = \"MenuArrow\";\nvar MenuArrow = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeMenu, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeMenu);\n return /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });\n }\n);\nMenuArrow.displayName = ARROW_NAME;\nvar SUB_NAME = \"MenuSub\";\nvar [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);\nvar MenuSub = (props) => {\n const { __scopeMenu, children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);\n const popperScope = usePopperScope(__scopeMenu);\n const [trigger, setTrigger] = React.useState(null);\n const [content, setContent] = React.useState(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx(\n MenuProvider,\n {\n scope: __scopeMenu,\n open,\n onOpenChange: handleOpenChange,\n content,\n onContentChange: setContent,\n children: /* @__PURE__ */ jsx(\n MenuSubProvider,\n {\n scope: __scopeMenu,\n contentId: useId(),\n triggerId: useId(),\n trigger,\n onTriggerChange: setTrigger,\n children\n }\n )\n }\n ) });\n};\nMenuSub.displayName = SUB_NAME;\nvar SUB_TRIGGER_NAME = \"MenuSubTrigger\";\nvar MenuSubTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu);\n const openTimerRef = React.useRef(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n const scope = { __scopeMenu: props.__scopeMenu };\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n return /* @__PURE__ */ jsx(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx(\n MenuItemImpl,\n {\n id: subContext.triggerId,\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": context.open,\n \"aria-controls\": subContext.contentId,\n \"data-state\": getOpenState(context.open),\n ...props,\n ref: composeRefs(forwardedRef, subContext.onTriggerChange),\n onClick: (event) => {\n props.onClick?.(event);\n if (props.disabled || event.defaultPrevented) return;\n event.currentTarget.focus();\n if (!context.open) context.onOpenChange(true);\n },\n onPointerMove: composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n })\n ),\n onPointerLeave: composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n const side = context.content?.dataset.side;\n const rightSide = side === \"right\";\n const bleed = rightSide ? -5 : 5;\n const contentNearEdge = contentRect[rightSide ? \"left\" : \"right\"];\n const contentFarEdge = contentRect[rightSide ? \"right\" : \"left\"];\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom }\n ],\n side\n });\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n contentContext.onPointerGraceIntentChange(null);\n }\n })\n ),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== \"\";\n if (props.disabled || isTypingAhead && event.key === \" \") return;\n if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {\n context.onOpenChange(true);\n context.content?.focus();\n event.preventDefault();\n }\n })\n }\n ) });\n }\n);\nMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\nvar SUB_CONTENT_NAME = \"MenuSubContent\";\nvar MenuSubContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);\n const { forceMount = portalContext.forceMount, ...subContentProps } = props;\n const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);\n const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);\n const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx(\n MenuContentImpl,\n {\n id: subContext.contentId,\n \"aria-labelledby\": subContext.triggerId,\n ...subContentProps,\n ref: composedRefs,\n align: \"start\",\n side: rootContext.dir === \"rtl\" ? \"left\" : \"right\",\n disableOutsidePointerEvents: false,\n disableOutsideScroll: false,\n trapFocus: false,\n onOpenAutoFocus: (event) => {\n if (rootContext.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n },\n onCloseAutoFocus: (event) => event.preventDefault(),\n onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {\n if (event.target !== subContext.trigger) context.onOpenChange(false);\n }),\n onEscapeKeyDown: composeEventHandlers(props.onEscapeKeyDown, (event) => {\n rootContext.onClose();\n event.preventDefault();\n }),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n const isKeyDownInside = event.currentTarget.contains(event.target);\n const isCloseKey = SUB_CLOSE_KEYS[rootContext.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n subContext.trigger?.focus();\n event.preventDefault();\n }\n })\n }\n ) }) }) });\n }\n);\nMenuSubContent.displayName = SUB_CONTENT_NAME;\nfunction getOpenState(open) {\n return open ? \"open\" : \"closed\";\n}\nfunction isIndeterminate(checked) {\n return checked === \"indeterminate\";\n}\nfunction getCheckedState(checked) {\n return isIndeterminate(checked) ? \"indeterminate\" : checked ? \"checked\" : \"unchecked\";\n}\nfunction focusFirst(candidates) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\nfunction wrapArray(array, startIndex) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\nfunction getNextMatch(values, search, currentMatch) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find(\n (value) => value.toLowerCase().startsWith(normalizedSearch.toLowerCase())\n );\n return nextMatch !== currentMatch ? nextMatch : void 0;\n}\nfunction isPointInPolygon(point, polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const ii = polygon[i];\n const jj = polygon[j];\n const xi = ii.x;\n const yi = ii.y;\n const xj = jj.x;\n const yj = jj.y;\n const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;\n if (intersect) inside = !inside;\n }\n return inside;\n}\nfunction isPointerInGraceArea(event, area) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\nfunction whenMouse(handler) {\n return (event) => event.pointerType === \"mouse\" ? handler(event) : void 0;\n}\nvar Root3 = Menu;\nvar Anchor2 = MenuAnchor;\nvar Portal = MenuPortal;\nvar Content2 = MenuContent;\nvar Group = MenuGroup;\nvar Label = MenuLabel;\nvar Item2 = MenuItem;\nvar CheckboxItem = MenuCheckboxItem;\nvar RadioGroup = MenuRadioGroup;\nvar RadioItem = MenuRadioItem;\nvar ItemIndicator = MenuItemIndicator;\nvar Separator = MenuSeparator;\nvar Arrow2 = MenuArrow;\nvar Sub = MenuSub;\nvar SubTrigger = MenuSubTrigger;\nvar SubContent = MenuSubContent;\nexport {\n Anchor2 as Anchor,\n Arrow2 as Arrow,\n CheckboxItem,\n Content2 as Content,\n Group,\n Item2 as Item,\n ItemIndicator,\n Label,\n Menu,\n MenuAnchor,\n MenuArrow,\n MenuCheckboxItem,\n MenuContent,\n MenuGroup,\n MenuItem,\n MenuItemIndicator,\n MenuLabel,\n MenuPortal,\n MenuRadioGroup,\n MenuRadioItem,\n MenuSeparator,\n MenuSub,\n MenuSubContent,\n MenuSubTrigger,\n Portal,\n RadioGroup,\n RadioItem,\n Root3 as Root,\n Separator,\n Sub,\n SubContent,\n SubTrigger,\n createMenuScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/dropdown-menu.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport * as MenuPrimitive from \"@radix-ui/react-menu\";\nimport { createMenuScope } from \"@radix-ui/react-menu\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DROPDOWN_MENU_NAME = \"DropdownMenu\";\nvar [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nvar useMenuScope = createMenuScope();\nvar [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);\nvar DropdownMenu = (props) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef(null);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: DROPDOWN_MENU_NAME\n });\n return /* @__PURE__ */ jsx(\n DropdownMenuProvider,\n {\n scope: __scopeDropdownMenu,\n triggerId: useId(),\n triggerRef,\n contentId: useId(),\n open,\n onOpenChange: setOpen,\n onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),\n modal,\n children: /* @__PURE__ */ jsx(MenuPrimitive.Root, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })\n }\n );\n};\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\nvar TRIGGER_NAME = \"DropdownMenuTrigger\";\nvar DropdownMenuTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n id: context.triggerId,\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": context.open,\n \"aria-controls\": context.open ? context.contentId : void 0,\n \"data-state\": context.open ? \"open\" : \"closed\",\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n ...triggerProps,\n ref: composeRefs(forwardedRef, context.triggerRef),\n onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n if (!context.open) event.preventDefault();\n }\n }),\n onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if ([\"Enter\", \" \"].includes(event.key)) context.onOpenToggle();\n if (event.key === \"ArrowDown\") context.onOpenChange(true);\n if ([\"Enter\", \" \", \"ArrowDown\"].includes(event.key)) event.preventDefault();\n })\n }\n ) });\n }\n);\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\nvar PORTAL_NAME = \"DropdownMenuPortal\";\nvar DropdownMenuPortal = (props) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Portal, { ...menuScope, ...portalProps });\n};\nDropdownMenuPortal.displayName = PORTAL_NAME;\nvar CONTENT_NAME = \"DropdownMenuContent\";\nvar DropdownMenuContent = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n return /* @__PURE__ */ jsx(\n MenuPrimitive.Content,\n {\n id: context.contentId,\n \"aria-labelledby\": context.triggerId,\n ...menuScope,\n ...contentProps,\n ref: forwardedRef,\n onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n event.preventDefault();\n }),\n onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n }),\n style: {\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n \"--radix-dropdown-menu-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"--radix-dropdown-menu-content-available-width\": \"var(--radix-popper-available-width)\",\n \"--radix-dropdown-menu-content-available-height\": \"var(--radix-popper-available-height)\",\n \"--radix-dropdown-menu-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"--radix-dropdown-menu-trigger-height\": \"var(--radix-popper-anchor-height)\"\n }\n }\n }\n );\n }\n);\nDropdownMenuContent.displayName = CONTENT_NAME;\nvar GROUP_NAME = \"DropdownMenuGroup\";\nvar DropdownMenuGroup = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef });\n }\n);\nDropdownMenuGroup.displayName = GROUP_NAME;\nvar LABEL_NAME = \"DropdownMenuLabel\";\nvar DropdownMenuLabel = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef });\n }\n);\nDropdownMenuLabel.displayName = LABEL_NAME;\nvar ITEM_NAME = \"DropdownMenuItem\";\nvar DropdownMenuItem = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });\n }\n);\nDropdownMenuItem.displayName = ITEM_NAME;\nvar CHECKBOX_ITEM_NAME = \"DropdownMenuCheckboxItem\";\nvar DropdownMenuCheckboxItem = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });\n});\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\nvar RADIO_GROUP_NAME = \"DropdownMenuRadioGroup\";\nvar DropdownMenuRadioGroup = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });\n});\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\nvar RADIO_ITEM_NAME = \"DropdownMenuRadioItem\";\nvar DropdownMenuRadioItem = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });\n});\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\nvar INDICATOR_NAME = \"DropdownMenuItemIndicator\";\nvar DropdownMenuItemIndicator = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });\n});\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\nvar SEPARATOR_NAME = \"DropdownMenuSeparator\";\nvar DropdownMenuSeparator = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });\n});\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\nvar ARROW_NAME = \"DropdownMenuArrow\";\nvar DropdownMenuArrow = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });\n }\n);\nDropdownMenuArrow.displayName = ARROW_NAME;\nvar DropdownMenuSub = (props) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: \"DropdownMenuSub\"\n });\n return /* @__PURE__ */ jsx(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children });\n};\nvar SUB_TRIGGER_NAME = \"DropdownMenuSubTrigger\";\nvar DropdownMenuSubTrigger = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(MenuPrimitive.SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });\n});\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\nvar SUB_CONTENT_NAME = \"DropdownMenuSubContent\";\nvar DropdownMenuSubContent = React.forwardRef((props, forwardedRef) => {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return /* @__PURE__ */ jsx(\n MenuPrimitive.SubContent,\n {\n ...menuScope,\n ...subContentProps,\n ref: forwardedRef,\n style: {\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n \"--radix-dropdown-menu-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"--radix-dropdown-menu-content-available-width\": \"var(--radix-popper-available-width)\",\n \"--radix-dropdown-menu-content-available-height\": \"var(--radix-popper-available-height)\",\n \"--radix-dropdown-menu-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"--radix-dropdown-menu-trigger-height\": \"var(--radix-popper-anchor-height)\"\n }\n }\n }\n );\n});\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\nvar Root2 = DropdownMenu;\nvar Trigger = DropdownMenuTrigger;\nvar Portal2 = DropdownMenuPortal;\nvar Content2 = DropdownMenuContent;\nvar Group2 = DropdownMenuGroup;\nvar Label2 = DropdownMenuLabel;\nvar Item2 = DropdownMenuItem;\nvar CheckboxItem2 = DropdownMenuCheckboxItem;\nvar RadioGroup2 = DropdownMenuRadioGroup;\nvar RadioItem2 = DropdownMenuRadioItem;\nvar ItemIndicator2 = DropdownMenuItemIndicator;\nvar Separator2 = DropdownMenuSeparator;\nvar Arrow2 = DropdownMenuArrow;\nvar Sub2 = DropdownMenuSub;\nvar SubTrigger2 = DropdownMenuSubTrigger;\nvar SubContent2 = DropdownMenuSubContent;\nexport {\n Arrow2 as Arrow,\n CheckboxItem2 as CheckboxItem,\n Content2 as Content,\n DropdownMenu,\n DropdownMenuArrow,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuItemIndicator,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n Group2 as Group,\n Item2 as Item,\n ItemIndicator2 as ItemIndicator,\n Label2 as Label,\n Portal2 as Portal,\n RadioGroup2 as RadioGroup,\n RadioItem2 as RadioItem,\n Root2 as Root,\n Separator2 as Separator,\n Sub2 as Sub,\n SubContent2 as SubContent,\n SubTrigger2 as SubTrigger,\n Trigger,\n createDropdownMenuScope\n};\n//# sourceMappingURL=index.mjs.map\n","import * as React from \"react\";\nfunction BarsArrowDownIcon({\n title,\n titleId,\n ...props\n}, svgRef) {\n return /*#__PURE__*/React.createElement(\"svg\", Object.assign({\n xmlns: \"http://www.w3.org/2000/svg\",\n fill: \"none\",\n viewBox: \"0 0 24 24\",\n strokeWidth: 1.5,\n stroke: \"currentColor\",\n \"aria-hidden\": \"true\",\n \"data-slot\": \"icon\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"path\", {\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n d: \"M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0-3.75-3.75M17.25 21 21 17.25\"\n }));\n}\nconst ForwardRef = /*#__PURE__*/ React.forwardRef(BarsArrowDownIcon);\nexport default ForwardRef;","import type React from \"react\";\nimport * as DropdownMenu from \"@radix-ui/react-dropdown-menu\";\nimport { BarsArrowDownIcon } from \"@heroicons/react/24/outline\";\n\nimport { useSearchRanking } from \"../SearchRanking/context\";\n\nexport type SortDropdownProps = {\n sortByRelevanceLabel: string;\n sortByDistanceLabel: string;\n accessibilityLabel: string;\n // metrics events\n on?: (event: \"openSortMenu\" | \"sortDistance\" | \"sortRelevance\") => void;\n};\n\nexport const SortDropdown: React.FC<SortDropdownProps> = ({\n sortByRelevanceLabel,\n sortByDistanceLabel,\n accessibilityLabel,\n on = () => {}, // default no-op\n}) => {\n const searchRanking = useSearchRanking();\n if (!searchRanking) {\n throw new Error(\"SortDropdown must be used within a SearchRankingProvider\");\n }\n const { sortMode, setSortMode, requestLocation, locationDenied } = searchRanking;\n\n const handleRelevanceClick = () => {\n setSortMode(\"relevance\");\n on(\"sortRelevance\");\n };\n\n const handleDistanceClick = async () => {\n if (locationDenied) return;\n\n try {\n await requestLocation();\n setSortMode(\"distance\");\n on(\"sortDistance\");\n } catch {\n // Location denied - state is updated by requestLocation\n }\n };\n\n return (\n <DropdownMenu.Root onOpenChange={(isOpen) => isOpen && on(\"openSortMenu\")}>\n <DropdownMenu.Trigger asChild>\n <button\n type=\"button\"\n className=\"sid-sort-dropdown__trigger\"\n aria-label={accessibilityLabel}\n >\n <BarsArrowDownIcon className=\"sid-sort-dropdown__icon\" />\n </button>\n </DropdownMenu.Trigger>\n\n <DropdownMenu.Content\n className=\"sid-sort-dropdown__content\"\n sideOffset={0}\n collisionPadding={10}\n align=\"end\"\n >\n <DropdownMenu.Item\n className=\"sid-sort-dropdown__item\"\n onSelect={handleRelevanceClick}\n data-active={sortMode === \"relevance\" ? \"\" : undefined}\n >\n {sortByRelevanceLabel}\n </DropdownMenu.Item>\n\n <DropdownMenu.Item\n className=\"sid-sort-dropdown__item\"\n onSelect={handleDistanceClick}\n disabled={locationDenied}\n data-active={sortMode === \"distance\" ? \"\" : undefined}\n >\n {sortByDistanceLabel}\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n );\n};\n","const t=t=>\"object\"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||\"hidden\"!==t)&&(\"visible\"!==t&&\"clip\"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return!1},o=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if(\"undefined\"==typeof document)return[];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p=\"function\"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError(\"Invalid target\");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W)}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return{top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k=\"start\"===f||\"nearest\"===f?x-T:\"end\"===f?I+F:x+v/2-T+F,D=\"center\"===u?R+E/2-V+B:\"end\"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:l,width:r,top:i,right:s,bottom:d,left:h}=e.getBoundingClientRect();if(\"if-needed\"===c&&x>=0&&R>=0&&I<=H&&C<=b&&(e===m&&!n(e)||x>=i&&I<=d&&R>=h&&C<=s))return L;const a=getComputedStyle(e),g=parseInt(a.borderLeftWidth,10),p=parseInt(a.borderTopWidth,10),W=parseInt(a.borderRightWidth,10),T=parseInt(a.borderBottomWidth,10);let B=0,F=0;const V=\"offsetWidth\"in e?e.offsetWidth-e.clientWidth-g-W:0,S=\"offsetHeight\"in e?e.offsetHeight-e.clientHeight-p-T:0,X=\"offsetWidth\"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,Y=\"offsetHeight\"in e?0===e.offsetHeight?0:l/e.offsetHeight:0;if(m===e)B=\"start\"===f?k:\"end\"===f?k-H:\"nearest\"===f?o(M,M+H,H,p,T,M+k,M+k+v,v):k-H/2,F=\"start\"===u?D:\"center\"===u?D-b/2:\"end\"===u?D-b:o(y,y+b,b,g,W,y+D,y+D+E,E),B=Math.max(0,B+M),F=Math.max(0,F+y);else{B=\"start\"===f?k-i-p:\"end\"===f?k-d+T+S:\"nearest\"===f?o(i,d,l,p,T+S,k,k+v,v):k-(i+l/2)+S/2,F=\"start\"===u?D-h-g:\"center\"===u?D-(h+r/2)+V/2:\"end\"===u?D-s+W+V:o(h,s,r,g,W+V,D,D+E,E);const{scrollLeft:t,scrollTop:n}=e;B=0===Y?0:Math.max(0,Math.min(n+B/Y,e.scrollHeight-l/Y+S)),F=0===X?0:Math.max(0,Math.min(t+F/X,e.scrollWidth-r/X+V)),k+=n-B,D+=t-F}L.push({el:e,top:B,left:F})}return L};export{r as compute};//# sourceMappingURL=index.js.map\n","import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _extends from '@babel/runtime/helpers/esm/extends';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport PropTypes from 'prop-types';\nimport * as React from 'react';\nimport { cloneElement, Component, useRef, useCallback, useEffect, useMemo } from 'react';\nimport { isForwardRef } from 'react-is';\nimport { compute } from 'compute-scroll-into-view';\n\nvar unknown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_unknown__' : 0;\nvar mouseUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_mouseup__' : 1;\nvar itemMouseEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_item_mouseenter__' : 2;\nvar keyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_up__' : 3;\nvar keyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_arrow_down__' : 4;\nvar keyDownEscape = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_escape__' : 5;\nvar keyDownEnter = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_enter__' : 6;\nvar keyDownHome = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_home__' : 7;\nvar keyDownEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_end__' : 8;\nvar clickItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_item__' : 9;\nvar blurInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_input__' : 10;\nvar changeInput = process.env.NODE_ENV !== \"production\" ? '__autocomplete_change_input__' : 11;\nvar keyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_keydown_space_button__' : 12;\nvar clickButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_click_button__' : 13;\nvar blurButton = process.env.NODE_ENV !== \"production\" ? '__autocomplete_blur_button__' : 14;\nvar controlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__autocomplete_controlled_prop_updated_selected_item__' : 15;\nvar touchEnd = process.env.NODE_ENV !== \"production\" ? '__autocomplete_touchend__' : 16;\n\nvar stateChangeTypes$4 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n blurButton: blurButton,\n blurInput: blurInput,\n changeInput: changeInput,\n clickButton: clickButton,\n clickItem: clickItem,\n controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,\n itemMouseEnter: itemMouseEnter,\n keyDownArrowDown: keyDownArrowDown,\n keyDownArrowUp: keyDownArrowUp,\n keyDownEnd: keyDownEnd,\n keyDownEnter: keyDownEnter,\n keyDownEscape: keyDownEscape,\n keyDownHome: keyDownHome,\n keyDownSpaceButton: keyDownSpaceButton,\n mouseUp: mouseUp,\n touchEnd: touchEnd,\n unknown: unknown\n});\n\nvar idCounter = 0;\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {string} the unique ID\n */\nfunction generateId() {\n return String(idCounter++);\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n // istanbul ignore next\n if ('useId' in React) {\n console.warn(\"It is not necessary to call resetIdCounter when using React 18+\");\n return;\n }\n idCounter = 0;\n}\n\nfunction useLatestRef(val) {\n var ref = React.useRef(val);\n // technically this is not \"concurrent mode safe\" because we're manipulating\n // the value during render (so it's not idempotent). However, the places this\n // hook is used is to support memoizing callbacks which will be called\n // *during* render, so we need the latest values *during* render.\n // If not for this, then we'd probably want to use useLayoutEffect instead.\n ref.current = val;\n return ref;\n}\n\nfunction handleRefs$1() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n return function (node) {\n refs.forEach(function (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n });\n };\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param fns the event handler functions\n * @return the event handler to add to an element\n */\nfunction callAllEventHandlers$1() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n return function (event) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n return fns.some(function (fn) {\n if (fn) {\n fn.apply(void 0, [event].concat(args));\n }\n return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;\n });\n };\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n */\nfunction debounce$1(fn, time) {\n var timeoutId;\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n function wrapper() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n cancel();\n timeoutId = setTimeout(function () {\n timeoutId = null;\n fn.apply(void 0, args);\n }, time);\n }\n wrapper.cancel = cancel;\n return wrapper;\n}\n\nvar cleanupStatus = debounce$1(function (document) {\n getStatusDiv(document).textContent = '';\n}, 500);\n\n/**\n * Get the status node or create it if it does not already exist.\n */\nfunction getStatusDiv(document) {\n var statusDiv = document.getElementById('a11y-status-message');\n if (statusDiv) {\n return statusDiv;\n }\n statusDiv = document.createElement('div');\n statusDiv.setAttribute('id', 'a11y-status-message');\n statusDiv.setAttribute('role', 'status');\n statusDiv.setAttribute('aria-live', 'polite');\n statusDiv.setAttribute('aria-relevant', 'additions text');\n Object.assign(statusDiv.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px'\n });\n document.body.appendChild(statusDiv);\n return statusDiv;\n}\n\n/**\n * Sets aria live status to a div element that's visually hidden.\n */\nfunction setStatus(status, document) {\n if (!status || !document) {\n return;\n }\n var div = getStatusDiv(document);\n div.textContent = status;\n cleanupStatus(document);\n}\n\n/**\n * Removes the status element from the DOM\n */\nfunction cleanupStatusDiv(document) {\n var statusDiv = document == null ? void 0 : document.getElementById('a11y-status-message');\n if (statusDiv) {\n statusDiv.remove();\n }\n}\n\nfunction noop() {}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes$1 = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes$1 = function validatePropTypes(options, caller, propTypes) {\n PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name);\n };\n}\n\n/**\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param state The state of the component/hook.\n * @param props The props that may contain controlled values.\n * @returns The merged controlled state.\n */\nfunction getState(state, props) {\n if (!props) {\n return state;\n }\n var keys = Object.keys(state);\n return keys.reduce(function (newState, key) {\n if (props[key] !== undefined) {\n newState[key] = props[key];\n }\n return newState;\n }, _extends({}, state));\n}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} menuNode the menu element of the component\n */\nfunction scrollIntoView(node, menuNode) {\n if (!node) {\n return;\n }\n var actions = compute(node, {\n boundary: menuNode,\n block: 'nearest',\n scrollMode: 'if-needed'\n });\n actions.forEach(function (_ref) {\n var el = _ref.el,\n top = _ref.top,\n left = _ref.left;\n el.scrollTop = top;\n el.scrollLeft = left;\n });\n}\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n return typeof cb === 'function' ? cb : noop;\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @param {Window} environment The window context where downshift renders.\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child, environment) {\n var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);\n return result;\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n var timeoutId;\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n function wrapper() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n cancel();\n timeoutId = setTimeout(function () {\n timeoutId = null;\n fn.apply(void 0, args);\n }, time);\n }\n wrapper.cancel = cancel;\n return wrapper;\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers() {\n for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n fns[_key2] = arguments[_key2];\n }\n return function (event) {\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n return fns.some(function (fn) {\n if (fn) {\n fn.apply(void 0, [event].concat(args));\n }\n return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;\n });\n };\n}\nfunction handleRefs() {\n for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n refs[_key4] = arguments[_key4];\n }\n return function (node) {\n refs.forEach(function (ref) {\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n });\n };\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specify if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage(_ref) {\n var isOpen = _ref.isOpen,\n resultCount = _ref.resultCount,\n previousResultCount = _ref.previousResultCount;\n if (!isOpen) {\n return '';\n }\n if (!resultCount) {\n return 'No results are available.';\n }\n if (resultCount !== previousResultCount) {\n return resultCount + \" result\" + (resultCount === 1 ? ' is' : 's are') + \" available, use up and down arrow keys to navigate. Press Enter key to select.\";\n }\n return '';\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */arg[0] : arg;\n if (!arg && defaultValue) {\n return defaultValue;\n } else {\n return arg;\n }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n\n // then we assume this is react\n return typeof element.type === 'string';\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n return element.props;\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n // eslint-disable-next-line no-console\n console.error(\"The property \\\"\" + propName + \"\\\" is required in \\\"\" + fnName + \"\\\"\");\n}\nvar stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state) {\n if (state === void 0) {\n state = {};\n }\n var result = {};\n stateKeys.forEach(function (k) {\n if (state.hasOwnProperty(k)) {\n result[k] = state[k];\n }\n });\n return result;\n}\n\n/**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n *\n * @param {Object} props The props that may contain controlled values.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\nfunction isControlledProp(props, key) {\n return props[key] !== undefined;\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n var key = event.key,\n keyCode = event.keyCode;\n /* istanbul ignore next (ie) */\n if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n return \"Arrow\" + key;\n }\n return key;\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\n/**\n * Returns the next non-disabled highlightedIndex value.\n *\n * @param {number} start The current highlightedIndex.\n * @param {number} offset The offset from the current highlightedIndex to start searching.\n * @param {unknown[]} items The items array.\n * @param {(item: unknown, index: number) => boolean} isItemDisabled Function that tells if an item is disabled or not.\n * @param {boolean?} circular If the search reaches the end, if it can search again starting from the other end.\n * @returns {number} The next highlightedIndex.\n */\nfunction getHighlightedIndex(start, offset, items, isItemDisabled, circular) {\n if (circular === void 0) {\n circular = false;\n }\n var count = items.length;\n if (count === 0) {\n return -1;\n }\n var itemsLastIndex = count - 1;\n if (typeof start !== 'number' || start < 0 || start > itemsLastIndex) {\n start = offset > 0 ? -1 : itemsLastIndex + 1;\n }\n var current = start + offset;\n if (current < 0) {\n current = circular ? itemsLastIndex : 0;\n } else if (current > itemsLastIndex) {\n current = circular ? 0 : itemsLastIndex;\n }\n var highlightedIndex = getNonDisabledIndex(current, offset < 0, items, isItemDisabled, circular);\n if (highlightedIndex === -1) {\n return start >= count ? -1 : start;\n }\n return highlightedIndex;\n}\n\n/**\n * Returns the next non-disabled highlightedIndex value.\n *\n * @param {number} start The current highlightedIndex.\n * @param {boolean} backwards If true, it will search backwards from the start.\n * @param {unknown[]} items The items array.\n * @param {(item: unknown, index: number) => boolean} isItemDisabled Function that tells if an item is disabled or not.\n * @param {boolean} circular If the search reaches the end, if it can search again starting from the other end.\n * @returns {number} The next non-disabled index.\n */\nfunction getNonDisabledIndex(start, backwards, items, isItemDisabled, circular) {\n if (circular === void 0) {\n circular = false;\n }\n var count = items.length;\n if (backwards) {\n for (var index = start; index >= 0; index--) {\n if (!isItemDisabled(items[index], index)) {\n return index;\n }\n }\n } else {\n for (var _index = start; _index < count; _index++) {\n if (!isItemDisabled(items[_index], _index)) {\n return _index;\n }\n }\n }\n if (circular) {\n return getNonDisabledIndex(backwards ? count - 1 : 0, backwards, items, isItemDisabled);\n }\n return -1;\n}\n\n/**\n * Checks if event target is within the downshift elements.\n *\n * @param {EventTarget} target Target to check.\n * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).\n * @param {Window} environment The window context where downshift renders.\n * @param {boolean} checkActiveElement Whether to also check activeElement.\n *\n * @returns {boolean} Whether or not the target is within downshift elements.\n */\nfunction targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {\n if (checkActiveElement === void 0) {\n checkActiveElement = true;\n }\n return environment && downshiftElements.some(function (contextNode) {\n return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));\n });\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validateControlledUnchanged = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged = function validateControlledUnchanged(state, prevProps, nextProps) {\n var warningDescription = \"This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props\";\n Object.keys(state).forEach(function (propKey) {\n if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: A component has changed the controlled prop \\\"\" + propKey + \"\\\" to be uncontrolled. \" + warningDescription);\n } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: A component has changed the uncontrolled prop \\\"\" + propKey + \"\\\" to be controlled. \" + warningDescription);\n }\n });\n };\n}\n\nvar _excluded$4 = [\"refKey\", \"ref\"],\n _excluded2$4 = [\"onClick\", \"onPress\", \"onKeyDown\", \"onKeyUp\", \"onBlur\"],\n _excluded3$3 = [\"onKeyDown\", \"onBlur\", \"onChange\", \"onInput\", \"onChangeText\"],\n _excluded4$2 = [\"refKey\", \"ref\"],\n _excluded5 = [\"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"index\", \"item\"];\nvar Downshift = /*#__PURE__*/function () {\n var Downshift = /*#__PURE__*/function (_Component) {\n function Downshift(_props) {\n var _this;\n _this = _Component.call(this, _props) || this;\n // fancy destructuring + defaults + aliases\n // this basically says each value of state should either be set to\n // the initial value or the default value if the initial value is not provided\n _this.id = _this.props.id || \"downshift-\" + generateId();\n _this.menuId = _this.props.menuId || _this.id + \"-menu\";\n _this.labelId = _this.props.labelId || _this.id + \"-label\";\n _this.inputId = _this.props.inputId || _this.id + \"-input\";\n _this.getItemId = _this.props.getItemId || function (index) {\n return _this.id + \"-item-\" + index;\n };\n _this.items = [];\n // itemCount can be changed asynchronously\n // from within downshift (so it can't come from a prop)\n // this is why we store it as an instance and use\n // getItemCount rather than just use items.length\n // (to support windowing + async)\n _this.itemCount = null;\n _this.previousResultCount = 0;\n _this.timeoutIds = [];\n /**\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n */\n _this.internalSetTimeout = function (fn, time) {\n var id = setTimeout(function () {\n _this.timeoutIds = _this.timeoutIds.filter(function (i) {\n return i !== id;\n });\n fn();\n }, time);\n _this.timeoutIds.push(id);\n };\n _this.setItemCount = function (count) {\n _this.itemCount = count;\n };\n _this.unsetItemCount = function () {\n _this.itemCount = null;\n };\n _this.isItemDisabled = function (_item, index) {\n var currentElementNode = _this.getItemNodeFromIndex(index);\n return currentElementNode && currentElementNode.hasAttribute('disabled');\n };\n _this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {\n if (highlightedIndex === void 0) {\n highlightedIndex = _this.props.defaultHighlightedIndex;\n }\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(_extends({\n highlightedIndex: highlightedIndex\n }, otherStateToSet));\n };\n _this.clearSelection = function (cb) {\n _this.internalSetState({\n selectedItem: null,\n inputValue: '',\n highlightedIndex: _this.props.defaultHighlightedIndex,\n isOpen: _this.props.defaultIsOpen\n }, cb);\n };\n _this.selectItem = function (item, otherStateToSet, cb) {\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(_extends({\n isOpen: _this.props.defaultIsOpen,\n highlightedIndex: _this.props.defaultHighlightedIndex,\n selectedItem: item,\n inputValue: _this.props.itemToString(item)\n }, otherStateToSet), cb);\n };\n _this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {\n var item = _this.items[itemIndex];\n if (item == null) {\n return;\n }\n _this.selectItem(item, otherStateToSet, cb);\n };\n _this.selectHighlightedItem = function (otherStateToSet, cb) {\n return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);\n };\n // any piece of our state can live in two places:\n // 1. Uncontrolled: it's internal (this.state)\n // We will call this.setState to update that state\n // 2. Controlled: it's external (this.props)\n // We will call this.props.onStateChange to update that state\n //\n // In addition, we'll call this.props.onChange if the\n // selectedItem is changed.\n _this.internalSetState = function (stateToSet, cb) {\n var isItemSelected, onChangeArg;\n var onStateChangeArg = {};\n var isStateToSetFunction = typeof stateToSet === 'function';\n\n // we want to call `onInputValueChange` before the `setState` call\n // so someone controlling the `inputValue` state gets notified of\n // the input change as soon as possible. This avoids issues with\n // preserving the cursor position.\n // See https://github.com/downshift-js/downshift/issues/217 for more info.\n if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));\n }\n return _this.setState(function (state) {\n var _newStateToSet;\n state = _this.getState(state);\n var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet;\n\n // Your own function that could modify the state that will be set.\n newStateToSet = _this.props.stateReducer(state, newStateToSet);\n\n // checks if an item is selected, regardless of if it's different from\n // what was selected before\n // used to determine if onSelect and onChange callbacks should be called\n isItemSelected = newStateToSet.hasOwnProperty('selectedItem');\n // this keeps track of the object we want to call with setState\n var nextState = {};\n // we need to call on change if the outside world is controlling any of our state\n // and we're trying to update that state. OR if the selection has changed and we're\n // trying to update the selection\n if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {\n onChangeArg = newStateToSet.selectedItem;\n }\n (_newStateToSet = newStateToSet).type || (_newStateToSet.type = unknown);\n Object.keys(newStateToSet).forEach(function (key) {\n // onStateChangeArg should only have the state that is\n // actually changing\n if (state[key] !== newStateToSet[key]) {\n onStateChangeArg[key] = newStateToSet[key];\n }\n // the type is useful for the onStateChangeArg\n // but we don't actually want to set it in internal state.\n // this is an undocumented feature for now... Not all internalSetState\n // calls support it and I'm not certain we want them to yet.\n // But it enables users controlling the isOpen state to know when\n // the isOpen state changes due to mouseup events which is quite handy.\n if (key === 'type') {\n return;\n }\n newStateToSet[key];\n // if it's coming from props, then we don't care to set it internally\n if (!isControlledProp(_this.props, key)) {\n nextState[key] = newStateToSet[key];\n }\n });\n\n // if stateToSet is a function, then we weren't able to call onInputValueChange\n // earlier, so we'll call it now that we know what the inputValue state will be.\n if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {\n _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));\n }\n return nextState;\n }, function () {\n // call the provided callback if it's a function\n cbToCb(cb)();\n\n // only call the onStateChange and onChange callbacks if\n // we have relevant information to pass them.\n var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;\n if (hasMoreStateThanType) {\n _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());\n }\n if (isItemSelected) {\n _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());\n }\n if (onChangeArg !== undefined) {\n _this.props.onChange(onChangeArg, _this.getStateAndHelpers());\n }\n // this is currently undocumented and therefore subject to change\n // We'll try to not break it, but just be warned.\n _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());\n });\n };\n //////////////////////////// ROOT\n _this.rootRef = function (node) {\n return _this._rootNode = node;\n };\n _this.getRootProps = function (_temp, _temp2) {\n var _extends2;\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$refKey = _ref.refKey,\n refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n ref = _ref.ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$suppressRefErro = _ref2.suppressRefError,\n suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n // this is used in the render to know whether the user has called getRootProps.\n // It uses that to know whether to apply the props automatically\n _this.getRootProps.called = true;\n _this.getRootProps.refKey = refKey;\n _this.getRootProps.suppressRefError = suppressRefError;\n var _this$getState = _this.getState(),\n isOpen = _this$getState.isOpen;\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : undefined, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n _this.keyDownHandlers = {\n ArrowDown: function ArrowDown(event) {\n var _this2 = this;\n event.preventDefault();\n if (this.getState().isOpen) {\n var amount = event.shiftKey ? 5 : 1;\n this.moveHighlightedIndex(amount, {\n type: keyDownArrowDown\n });\n } else {\n this.internalSetState({\n isOpen: true,\n type: keyDownArrowDown\n }, function () {\n var itemCount = _this2.getItemCount();\n if (itemCount > 0) {\n var _this2$getState = _this2.getState(),\n highlightedIndex = _this2$getState.highlightedIndex;\n var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, 1, {\n length: itemCount\n }, _this2.isItemDisabled, true);\n _this2.setHighlightedIndex(nextHighlightedIndex, {\n type: keyDownArrowDown\n });\n }\n });\n }\n },\n ArrowUp: function ArrowUp(event) {\n var _this3 = this;\n event.preventDefault();\n if (this.getState().isOpen) {\n var amount = event.shiftKey ? -5 : -1;\n this.moveHighlightedIndex(amount, {\n type: keyDownArrowUp\n });\n } else {\n this.internalSetState({\n isOpen: true,\n type: keyDownArrowUp\n }, function () {\n var itemCount = _this3.getItemCount();\n if (itemCount > 0) {\n var _this3$getState = _this3.getState(),\n highlightedIndex = _this3$getState.highlightedIndex;\n var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, -1, {\n length: itemCount\n }, _this3.isItemDisabled, true);\n _this3.setHighlightedIndex(nextHighlightedIndex, {\n type: keyDownArrowUp\n });\n }\n });\n }\n },\n Enter: function Enter(event) {\n if (event.which === 229) {\n return;\n }\n var _this$getState2 = this.getState(),\n isOpen = _this$getState2.isOpen,\n highlightedIndex = _this$getState2.highlightedIndex;\n if (isOpen && highlightedIndex != null) {\n event.preventDefault();\n var item = this.items[highlightedIndex];\n var itemNode = this.getItemNodeFromIndex(highlightedIndex);\n if (item == null || itemNode && itemNode.hasAttribute('disabled')) {\n return;\n }\n this.selectHighlightedItem({\n type: keyDownEnter\n });\n }\n },\n Escape: function Escape(event) {\n event.preventDefault();\n this.reset(_extends({\n type: keyDownEscape\n }, !this.state.isOpen && {\n selectedItem: null,\n inputValue: ''\n }));\n }\n };\n //////////////////////////// BUTTON\n _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n ' ': function _(event) {\n event.preventDefault();\n this.toggleMenu({\n type: keyDownSpaceButton\n });\n }\n });\n _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {\n Home: function Home(event) {\n var _this$getState3 = this.getState(),\n isOpen = _this$getState3.isOpen;\n if (!isOpen) {\n return;\n }\n event.preventDefault();\n var itemCount = this.getItemCount();\n if (itemCount <= 0 || !isOpen) {\n return;\n }\n\n // get next non-disabled starting downwards from 0 if that's disabled.\n var newHighlightedIndex = getNonDisabledIndex(0, false, {\n length: itemCount\n }, this.isItemDisabled);\n this.setHighlightedIndex(newHighlightedIndex, {\n type: keyDownHome\n });\n },\n End: function End(event) {\n var _this$getState4 = this.getState(),\n isOpen = _this$getState4.isOpen;\n if (!isOpen) {\n return;\n }\n event.preventDefault();\n var itemCount = this.getItemCount();\n if (itemCount <= 0 || !isOpen) {\n return;\n }\n\n // get next non-disabled starting upwards from last index if that's disabled.\n var newHighlightedIndex = getNonDisabledIndex(itemCount - 1, true, {\n length: itemCount\n }, this.isItemDisabled);\n this.setHighlightedIndex(newHighlightedIndex, {\n type: keyDownEnd\n });\n }\n });\n _this.getToggleButtonProps = function (_temp3) {\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n onClick = _ref3.onClick;\n _ref3.onPress;\n var onKeyDown = _ref3.onKeyDown,\n onKeyUp = _ref3.onKeyUp,\n onBlur = _ref3.onBlur,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$4);\n var _this$getState5 = _this.getState(),\n isOpen = _this$getState5.isOpen;\n var enabledEventHandlers = {\n onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),\n onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),\n onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)\n };\n var eventHandlers = rest.disabled ? {} : enabledEventHandlers;\n return _extends({\n type: 'button',\n role: 'button',\n 'aria-label': isOpen ? 'close menu' : 'open menu',\n 'aria-haspopup': true,\n 'data-toggle': true\n }, eventHandlers, rest);\n };\n _this.buttonHandleKeyUp = function (event) {\n // Prevent click event from emitting in Firefox\n event.preventDefault();\n };\n _this.buttonHandleKeyDown = function (event) {\n var key = normalizeArrowKey(event);\n if (_this.buttonKeyDownHandlers[key]) {\n _this.buttonKeyDownHandlers[key].call(_this, event);\n }\n };\n _this.buttonHandleClick = function (event) {\n event.preventDefault();\n // handle odd case for Safari and Firefox which\n // don't give the button the focus properly.\n /* istanbul ignore if (can't reasonably test this) */\n if (_this.props.environment) {\n var _this$props$environme = _this.props.environment.document,\n body = _this$props$environme.body,\n activeElement = _this$props$environme.activeElement;\n if (body && body === activeElement) {\n event.target.focus();\n }\n }\n // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n // when building for production and should therefore have no impact on production code.\n if (process.env.NODE_ENV === 'test') {\n _this.toggleMenu({\n type: clickButton\n });\n } else {\n // Ensure that toggle of menu occurs after the potential blur event in iOS\n _this.internalSetTimeout(function () {\n return _this.toggleMenu({\n type: clickButton\n });\n });\n }\n };\n _this.buttonHandleBlur = function (event) {\n var blurTarget = event.target; // Save blur target for comparison with activeElement later\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n _this.internalSetTimeout(function () {\n if (_this.isMouseDown || !_this.props.environment) {\n return;\n }\n var activeElement = _this.props.environment.document.activeElement;\n if ((activeElement == null || activeElement.id !== _this.inputId) && activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n ) {\n _this.reset({\n type: blurButton\n });\n }\n });\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n /////////////////////////////// LABEL\n _this.getLabelProps = function (props) {\n return _extends({\n htmlFor: _this.inputId,\n id: _this.labelId\n }, props);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n /////////////////////////////// INPUT\n _this.getInputProps = function (_temp4) {\n var _ref4 = _temp4 === void 0 ? {} : _temp4,\n onKeyDown = _ref4.onKeyDown,\n onBlur = _ref4.onBlur,\n onChange = _ref4.onChange,\n onInput = _ref4.onInput;\n _ref4.onChangeText;\n var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$3);\n var onChangeKey;\n var eventHandlers = {};\n\n /* istanbul ignore next (preact) */\n {\n onChangeKey = 'onChange';\n }\n var _this$getState6 = _this.getState(),\n inputValue = _this$getState6.inputValue,\n isOpen = _this$getState6.isOpen,\n highlightedIndex = _this$getState6.highlightedIndex;\n if (!rest.disabled) {\n var _eventHandlers;\n eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);\n }\n return _extends({\n 'aria-autocomplete': 'list',\n 'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : undefined,\n 'aria-controls': isOpen ? _this.menuId : undefined,\n 'aria-labelledby': rest && rest['aria-label'] ? undefined : _this.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: inputValue,\n id: _this.inputId\n }, eventHandlers, rest);\n };\n _this.inputHandleKeyDown = function (event) {\n var key = normalizeArrowKey(event);\n if (key && _this.inputKeyDownHandlers[key]) {\n _this.inputKeyDownHandlers[key].call(_this, event);\n }\n };\n _this.inputHandleChange = function (event) {\n _this.internalSetState({\n type: changeInput,\n isOpen: true,\n inputValue: event.target.value,\n highlightedIndex: _this.props.defaultHighlightedIndex\n });\n };\n _this.inputHandleBlur = function () {\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n _this.internalSetTimeout(function () {\n var _activeElement$datase;\n if (_this.isMouseDown || !_this.props.environment) {\n return;\n }\n var activeElement = _this.props.environment.document.activeElement;\n var downshiftButtonIsActive = (activeElement == null || (_activeElement$datase = activeElement.dataset) == null ? void 0 : _activeElement$datase.toggle) && _this._rootNode && _this._rootNode.contains(activeElement);\n if (!downshiftButtonIsActive) {\n _this.reset({\n type: blurInput\n });\n }\n });\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n /////////////////////////////// MENU\n _this.menuRef = function (node) {\n _this._menuNode = node;\n };\n _this.getMenuProps = function (_temp5, _temp6) {\n var _extends3;\n var _ref5 = _temp5 === void 0 ? {} : _temp5,\n _ref5$refKey = _ref5.refKey,\n refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n ref = _ref5.ref,\n props = _objectWithoutPropertiesLoose(_ref5, _excluded4$2);\n var _ref6 = _temp6 === void 0 ? {} : _temp6,\n _ref6$suppressRefErro = _ref6.suppressRefError,\n suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;\n _this.getMenuProps.called = true;\n _this.getMenuProps.refKey = refKey;\n _this.getMenuProps.suppressRefError = suppressRefError;\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? undefined : _this.labelId, _extends3.id = _this.menuId, _extends3), props);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n /////////////////////////////// ITEM\n _this.getItemProps = function (_temp7) {\n var _enabledEventHandlers;\n var _ref7 = _temp7 === void 0 ? {} : _temp7,\n onMouseMove = _ref7.onMouseMove,\n onMouseDown = _ref7.onMouseDown,\n onClick = _ref7.onClick;\n _ref7.onPress;\n var index = _ref7.index,\n _ref7$item = _ref7.item,\n item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ? /* istanbul ignore next */undefined : requiredProp('getItemProps', 'item') : _ref7$item,\n rest = _objectWithoutPropertiesLoose(_ref7, _excluded5);\n if (index === undefined) {\n _this.items.push(item);\n index = _this.items.indexOf(item);\n } else {\n _this.items[index] = item;\n }\n var onSelectKey = 'onClick';\n var customClickHandler = onClick;\n var enabledEventHandlers = (_enabledEventHandlers = {\n // onMouseMove is used over onMouseEnter here. onMouseMove\n // is only triggered on actual mouse movement while onMouseEnter\n // can fire on DOM changes, interrupting keyboard navigation\n onMouseMove: callAllEventHandlers(onMouseMove, function () {\n if (index === _this.getState().highlightedIndex) {\n return;\n }\n _this.setHighlightedIndex(index, {\n type: itemMouseEnter\n });\n\n // We never want to manually scroll when changing state based\n // on `onMouseMove` because we will be moving the element out\n // from under the user which is currently scrolling/moving the\n // cursor\n _this.avoidScrolling = true;\n _this.internalSetTimeout(function () {\n return _this.avoidScrolling = false;\n }, 250);\n }),\n onMouseDown: callAllEventHandlers(onMouseDown, function (event) {\n // This prevents the activeElement from being changed\n // to the item so it can remain with the current activeElement\n // which is a more common use case.\n event.preventDefault();\n })\n }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {\n _this.selectItemAtIndex(index, {\n type: clickItem\n });\n }), _enabledEventHandlers);\n\n // Passing down the onMouseDown handler to prevent redirect\n // of the activeElement if clicking on disabled items\n var eventHandlers = rest.disabled ? {\n onMouseDown: enabledEventHandlers.onMouseDown\n } : enabledEventHandlers;\n return _extends({\n id: _this.getItemId(index),\n role: 'option',\n 'aria-selected': _this.getState().highlightedIndex === index\n }, eventHandlers, rest);\n };\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n _this.clearItems = function () {\n _this.items = [];\n };\n _this.reset = function (otherStateToSet, cb) {\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(function (_ref8) {\n var selectedItem = _ref8.selectedItem;\n return _extends({\n isOpen: _this.props.defaultIsOpen,\n highlightedIndex: _this.props.defaultHighlightedIndex,\n inputValue: _this.props.itemToString(selectedItem)\n }, otherStateToSet);\n }, cb);\n };\n _this.toggleMenu = function (otherStateToSet, cb) {\n if (otherStateToSet === void 0) {\n otherStateToSet = {};\n }\n otherStateToSet = pickState(otherStateToSet);\n _this.internalSetState(function (_ref9) {\n var isOpen = _ref9.isOpen;\n return _extends({\n isOpen: !isOpen\n }, isOpen && {\n highlightedIndex: _this.props.defaultHighlightedIndex\n }, otherStateToSet);\n }, function () {\n var _this$getState7 = _this.getState(),\n isOpen = _this$getState7.isOpen,\n highlightedIndex = _this$getState7.highlightedIndex;\n if (isOpen) {\n if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {\n _this.setHighlightedIndex(highlightedIndex, otherStateToSet);\n }\n }\n cbToCb(cb)();\n });\n };\n _this.openMenu = function (cb) {\n _this.internalSetState({\n isOpen: true\n }, cb);\n };\n _this.closeMenu = function (cb) {\n _this.internalSetState({\n isOpen: false\n }, cb);\n };\n _this.updateStatus = debounce(function () {\n var _this$props;\n if (!((_this$props = _this.props) != null && (_this$props = _this$props.environment) != null && _this$props.document)) {\n return;\n }\n var state = _this.getState();\n var item = _this.items[state.highlightedIndex];\n var resultCount = _this.getItemCount();\n var status = _this.props.getA11yStatusMessage(_extends({\n itemToString: _this.props.itemToString,\n previousResultCount: _this.previousResultCount,\n resultCount: resultCount,\n highlightedItem: item\n }, state));\n _this.previousResultCount = resultCount;\n setStatus(status, _this.props.environment.document);\n }, 200);\n var _this$props2 = _this.props,\n defaultHighlightedIndex = _this$props2.defaultHighlightedIndex,\n _this$props2$initialH = _this$props2.initialHighlightedIndex,\n _highlightedIndex = _this$props2$initialH === void 0 ? defaultHighlightedIndex : _this$props2$initialH,\n defaultIsOpen = _this$props2.defaultIsOpen,\n _this$props2$initialI = _this$props2.initialIsOpen,\n _isOpen = _this$props2$initialI === void 0 ? defaultIsOpen : _this$props2$initialI,\n _this$props2$initialI2 = _this$props2.initialInputValue,\n _inputValue = _this$props2$initialI2 === void 0 ? '' : _this$props2$initialI2,\n _this$props2$initialS = _this$props2.initialSelectedItem,\n _selectedItem = _this$props2$initialS === void 0 ? null : _this$props2$initialS;\n var _state = _this.getState({\n highlightedIndex: _highlightedIndex,\n isOpen: _isOpen,\n inputValue: _inputValue,\n selectedItem: _selectedItem\n });\n if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {\n _state.inputValue = _this.props.itemToString(_state.selectedItem);\n }\n _this.state = _state;\n return _this;\n }\n _inheritsLoose(Downshift, _Component);\n var _proto = Downshift.prototype;\n /**\n * Clear all running timeouts\n */\n _proto.internalClearTimeouts = function internalClearTimeouts() {\n this.timeoutIds.forEach(function (id) {\n clearTimeout(id);\n });\n this.timeoutIds = [];\n }\n\n /**\n * Gets the state based on internal state or props\n * If a state value is passed via props, then that\n * is the value given, otherwise it's retrieved from\n * stateToMerge\n *\n * @param {Object} stateToMerge defaults to this.state\n * @return {Object} the state\n */;\n _proto.getState = function getState$1(stateToMerge) {\n if (stateToMerge === void 0) {\n stateToMerge = this.state;\n }\n return getState(stateToMerge, this.props);\n };\n _proto.getItemCount = function getItemCount() {\n // things read better this way. They're in priority order:\n // 1. `this.itemCount`\n // 2. `this.props.itemCount`\n // 3. `this.items.length`\n var itemCount = this.items.length;\n if (this.itemCount != null) {\n itemCount = this.itemCount;\n } else if (this.props.itemCount !== undefined) {\n itemCount = this.props.itemCount;\n }\n return itemCount;\n };\n _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {\n return this.props.environment ? this.props.environment.document.getElementById(this.getItemId(index)) : null;\n };\n _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {\n /* istanbul ignore else (react-native) */\n {\n var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);\n this.props.scrollIntoView(node, this._menuNode);\n }\n };\n _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {\n var itemCount = this.getItemCount();\n var _this$getState8 = this.getState(),\n highlightedIndex = _this$getState8.highlightedIndex;\n if (itemCount > 0) {\n var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, amount, {\n length: itemCount\n }, this.isItemDisabled, true);\n this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);\n }\n };\n _proto.getStateAndHelpers = function getStateAndHelpers() {\n var _this$getState9 = this.getState(),\n highlightedIndex = _this$getState9.highlightedIndex,\n inputValue = _this$getState9.inputValue,\n selectedItem = _this$getState9.selectedItem,\n isOpen = _this$getState9.isOpen;\n var itemToString = this.props.itemToString;\n var id = this.id;\n var getRootProps = this.getRootProps,\n getToggleButtonProps = this.getToggleButtonProps,\n getLabelProps = this.getLabelProps,\n getMenuProps = this.getMenuProps,\n getInputProps = this.getInputProps,\n getItemProps = this.getItemProps,\n openMenu = this.openMenu,\n closeMenu = this.closeMenu,\n toggleMenu = this.toggleMenu,\n selectItem = this.selectItem,\n selectItemAtIndex = this.selectItemAtIndex,\n selectHighlightedItem = this.selectHighlightedItem,\n setHighlightedIndex = this.setHighlightedIndex,\n clearSelection = this.clearSelection,\n clearItems = this.clearItems,\n reset = this.reset,\n setItemCount = this.setItemCount,\n unsetItemCount = this.unsetItemCount,\n setState = this.internalSetState;\n return {\n // prop getters\n getRootProps: getRootProps,\n getToggleButtonProps: getToggleButtonProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getInputProps: getInputProps,\n getItemProps: getItemProps,\n // actions\n reset: reset,\n openMenu: openMenu,\n closeMenu: closeMenu,\n toggleMenu: toggleMenu,\n selectItem: selectItem,\n selectItemAtIndex: selectItemAtIndex,\n selectHighlightedItem: selectHighlightedItem,\n setHighlightedIndex: setHighlightedIndex,\n clearSelection: clearSelection,\n clearItems: clearItems,\n setItemCount: setItemCount,\n unsetItemCount: unsetItemCount,\n setState: setState,\n // props\n itemToString: itemToString,\n // derived\n id: id,\n // state\n highlightedIndex: highlightedIndex,\n inputValue: inputValue,\n isOpen: isOpen,\n selectedItem: selectedItem\n };\n };\n _proto.componentDidMount = function componentDidMount() {\n var _this4 = this;\n /* istanbul ignore if (react-native) */\n if (process.env.NODE_ENV !== 'production' && true && this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n }\n\n /* istanbul ignore if (react-native or SSR) */\n if (!this.props.environment) {\n this.cleanup = function () {\n _this4.internalClearTimeouts();\n };\n } else {\n // this.isMouseDown helps us track whether the mouse is currently held down.\n // This is useful when the user clicks on an item in the list, but holds the mouse\n // down long enough for the list to disappear (because the blur event fires on the input)\n // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n // trigger hiding the menu.\n var onMouseDown = function onMouseDown() {\n _this4.isMouseDown = true;\n };\n var onMouseUp = function onMouseUp(event) {\n _this4.isMouseDown = false;\n // if the target element or the activeElement is within a downshift node\n // then we don't want to reset downshift\n var contextWithinDownshift = targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment);\n if (!contextWithinDownshift && _this4.getState().isOpen) {\n _this4.reset({\n type: mouseUp\n }, function () {\n return _this4.props.onOuterClick(_this4.getStateAndHelpers());\n });\n }\n };\n // Touching an element in iOS gives focus and hover states, but touching out of\n // the element will remove hover, and persist the focus state, resulting in the\n // blur event not being triggered.\n // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.\n // If the user taps outside of Downshift, the component should be reset,\n // but not if the user is swiping\n var onTouchStart = function onTouchStart() {\n _this4.isTouchMove = false;\n };\n var onTouchMove = function onTouchMove() {\n _this4.isTouchMove = true;\n };\n var onTouchEnd = function onTouchEnd(event) {\n var contextWithinDownshift = targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment, false);\n if (!_this4.isTouchMove && !contextWithinDownshift && _this4.getState().isOpen) {\n _this4.reset({\n type: touchEnd\n }, function () {\n return _this4.props.onOuterClick(_this4.getStateAndHelpers());\n });\n }\n };\n var environment = this.props.environment;\n environment.addEventListener('mousedown', onMouseDown);\n environment.addEventListener('mouseup', onMouseUp);\n environment.addEventListener('touchstart', onTouchStart);\n environment.addEventListener('touchmove', onTouchMove);\n environment.addEventListener('touchend', onTouchEnd);\n this.cleanup = function () {\n _this4.internalClearTimeouts();\n _this4.updateStatus.cancel();\n environment.removeEventListener('mousedown', onMouseDown);\n environment.removeEventListener('mouseup', onMouseUp);\n environment.removeEventListener('touchstart', onTouchStart);\n environment.removeEventListener('touchmove', onTouchMove);\n environment.removeEventListener('touchend', onTouchEnd);\n };\n }\n };\n _proto.shouldScroll = function shouldScroll(prevState, prevProps) {\n var _ref0 = this.props.highlightedIndex === undefined ? this.getState() : this.props,\n currentHighlightedIndex = _ref0.highlightedIndex;\n var _ref1 = prevProps.highlightedIndex === undefined ? prevState : prevProps,\n prevHighlightedIndex = _ref1.highlightedIndex;\n var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;\n var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;\n return scrollWhenOpen || scrollWhenNavigating;\n };\n _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged(this.state, prevProps, this.props);\n /* istanbul ignore if (react-native) */\n if (this.getMenuProps.called && !this.getMenuProps.suppressRefError) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);\n }\n }\n if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {\n this.internalSetState({\n type: controlledPropUpdatedSelectedItem,\n inputValue: this.props.itemToString(this.props.selectedItem)\n });\n }\n if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {\n this.scrollHighlightedItemIntoView();\n }\n\n /* istanbul ignore else (react-native) */\n {\n this.updateStatus();\n }\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.cleanup(); // avoids memory leak\n };\n _proto.render = function render() {\n var children = unwrapArray(this.props.children, noop);\n // because the items are rerendered every time we call the children\n // we clear this out each render and it will be populated again as\n // getItemProps is called.\n this.clearItems();\n // we reset this so we know whether the user calls getRootProps during\n // this render. If they do then we don't need to do anything,\n // if they don't then we need to clone the element they return and\n // apply the props for them.\n this.getRootProps.called = false;\n this.getRootProps.refKey = undefined;\n this.getRootProps.suppressRefError = undefined;\n // we do something similar for getMenuProps\n this.getMenuProps.called = false;\n this.getMenuProps.refKey = undefined;\n this.getMenuProps.suppressRefError = undefined;\n // we do something similar for getLabelProps\n this.getLabelProps.called = false;\n // and something similar for getInputProps\n this.getInputProps.called = false;\n var element = unwrapArray(children(this.getStateAndHelpers()));\n if (!element) {\n return null;\n }\n if (this.getRootProps.called || this.props.suppressRefError) {\n if (process.env.NODE_ENV !== 'production' && !this.getRootProps.suppressRefError && !this.props.suppressRefError) {\n validateGetRootPropsCalledCorrectly(element, this.getRootProps);\n }\n return element;\n } else if (isDOMElement(element)) {\n // they didn't apply the root props, but we can clone\n // this and apply the props ourselves\n return /*#__PURE__*/cloneElement(element, this.getRootProps(getElementProps(element)));\n }\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n // they didn't apply the root props, but they need to\n // otherwise we can't query around the autocomplete\n\n throw new Error('downshift: If you return a non-DOM element, you must apply the getRootProps function');\n }\n\n /* istanbul ignore next */\n return undefined;\n };\n return Downshift;\n }(Component);\n Downshift.defaultProps = {\n defaultHighlightedIndex: null,\n defaultIsOpen: false,\n getA11yStatusMessage: getA11yStatusMessage,\n itemToString: function itemToString(i) {\n if (i == null) {\n return '';\n }\n if (process.env.NODE_ENV !== 'production' && isPlainObject(i) && !i.hasOwnProperty('toString')) {\n // eslint-disable-next-line no-console\n console.warn('downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.', 'The object that was passed:', i);\n }\n return String(i);\n },\n onStateChange: noop,\n onInputValueChange: noop,\n onUserAction: noop,\n onChange: noop,\n onSelect: noop,\n onOuterClick: noop,\n selectedItemChanged: function selectedItemChanged(prevItem, item) {\n return prevItem !== item;\n },\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' || false ? undefined : window,\n stateReducer: function stateReducer(state, stateToSet) {\n return stateToSet;\n },\n suppressRefError: false,\n scrollIntoView: scrollIntoView\n };\n Downshift.stateChangeTypes = stateChangeTypes$4;\n return Downshift;\n}();\nprocess.env.NODE_ENV !== \"production\" ? Downshift.propTypes = {\n children: PropTypes.func,\n defaultHighlightedIndex: PropTypes.number,\n defaultIsOpen: PropTypes.bool,\n initialHighlightedIndex: PropTypes.number,\n initialSelectedItem: PropTypes.any,\n initialInputValue: PropTypes.string,\n initialIsOpen: PropTypes.bool,\n getA11yStatusMessage: PropTypes.func,\n itemToString: PropTypes.func,\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onStateChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n onUserAction: PropTypes.func,\n onOuterClick: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n stateReducer: PropTypes.func,\n itemCount: PropTypes.number,\n id: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func.isRequired,\n removeEventListener: PropTypes.func.isRequired,\n document: PropTypes.shape({\n createElement: PropTypes.func.isRequired,\n getElementById: PropTypes.func.isRequired,\n activeElement: PropTypes.any.isRequired,\n body: PropTypes.any.isRequired\n }).isRequired,\n Node: PropTypes.func.isRequired\n }),\n suppressRefError: PropTypes.bool,\n scrollIntoView: PropTypes.func,\n // things we keep in state for uncontrolled components\n // but can accept as props for controlled components\n /* eslint-disable react/no-unused-prop-types */\n selectedItem: PropTypes.any,\n isOpen: PropTypes.bool,\n inputValue: PropTypes.string,\n highlightedIndex: PropTypes.number,\n labelId: PropTypes.string,\n inputId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func\n /* eslint-enable react/no-unused-prop-types */\n} : void 0;\nfunction validateGetMenuPropsCalledCorrectly(node, _ref10) {\n var refKey = _ref10.refKey;\n if (!node) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from getMenuProps was not applied correctly on your menu element.\");\n }\n}\nfunction validateGetRootPropsCalledCorrectly(element, _ref11) {\n var refKey = _ref11.refKey;\n var refKeySpecified = refKey !== 'ref';\n var isComposite = !isDOMElement(element);\n if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n // eslint-disable-next-line no-console\n console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');\n } else if (!isComposite && refKeySpecified) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \\\"\" + refKey + \"\\\"\");\n }\n if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You must apply the ref prop \\\"\" + refKey + \"\\\" from getRootProps onto your root element.\");\n }\n}\n\nfunction capitalizeString(string) {\n return \"\" + string.slice(0, 1).toUpperCase() + string.slice(1);\n}\n\nfunction callOnChangeProps(action, props, state, newState) {\n var type = action.type;\n var changes = {};\n var keys = Object.keys(state);\n for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {\n var key = _keys[_i];\n invokeOnChangeHandler(key, action, props, state, newState);\n if (newState[key] !== state[key]) {\n changes[key] = newState[key];\n }\n }\n if (props.onStateChange && Object.keys(changes).length) {\n props.onStateChange(_extends({\n type: type\n }, changes));\n }\n}\nfunction invokeOnChangeHandler(key, action, props, state, newState) {\n if (newState[key] === state[key]) {\n return;\n }\n var handlerKey = \"on\" + capitalizeString(key) + \"Change\";\n var handler = props[handlerKey];\n if (typeof handler !== 'function') {\n return;\n }\n var type = action.type;\n handler(_extends({\n type: type\n }, newState));\n}\n\n/**\n * Computes the controlled state using a the previous state, props,\n * two reducers, one from downshift and an optional one from the user.\n * Also calls the onChange handlers for state values that have changed.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} props The hook props, also passed to createInitialState.\n * @param {Function} createInitialState Function that returns the initial state.\n * @param {Function} isStateEqual Function that checks if a previous state is equal to the next.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {\n var prevStateRef = React.useRef(null);\n var actionRef = React.useRef(undefined);\n var propsRef = useLatestRef(props);\n var enhancedReducer = React.useCallback(function (state, action) {\n actionRef.current = action;\n state = getState(state, propsRef.current);\n var changes = reducer(state, propsRef.current, action);\n var newState = propsRef.current.stateReducer(state, _extends({}, action, {\n changes: changes\n }));\n return _extends({}, state, newState);\n }, [propsRef, reducer]);\n var _React$useReducer = React.useReducer(enhancedReducer, props, createInitialState),\n state = _React$useReducer[0],\n dispatch = _React$useReducer[1];\n var action = actionRef.current;\n React.useEffect(function () {\n var _prevStateRef$current;\n var prevState = getState((_prevStateRef$current = prevStateRef.current) != null ? _prevStateRef$current : {}, propsRef.current);\n var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevState, state);\n if (shouldCallOnChangeProps) {\n callOnChangeProps(action, propsRef.current, prevState, state);\n }\n prevStateRef.current = state;\n }, [state, action, isStateEqual, propsRef]);\n return [state, dispatch];\n}\n\n/**\n * Wraps the useEnhancedReducer and applies the controlled prop values before\n * returning the new state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} props The hook props, also passed to createInitialState.\n * @param {Function} createInitialState Function that returns the initial state.\n * @param {Function} isStateEqual Function that checks if a previous state is equal to the next.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer$1(reducer, props, createInitialState, isStateEqual) {\n var _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual),\n state = _useEnhancedReducer[0],\n dispatch = _useEnhancedReducer[1];\n return [getState(state, props), dispatch];\n}\n\n/**\n * Returns both the item and index when both or either is passed.\n *\n * @param itemProp The item which could be undefined.\n * @param indexProp The index which could be undefined.\n * @param items The array of items to get the item based on index.\n * @param errorMessage The error to be thrown if index and item could not be returned for any reason.\n * @returns An array with item and index.\n */\nfunction getItemAndIndex(itemProp, indexProp, items, errorMessage) {\n if (itemProp !== undefined && indexProp !== undefined) {\n return [itemProp, indexProp];\n }\n if (itemProp !== undefined) {\n var index = items.indexOf(itemProp);\n if (index < 0) {\n throw new Error(errorMessage);\n }\n return [itemProp, items.indexOf(itemProp)];\n }\n if (indexProp !== undefined) {\n var item = items[indexProp];\n if (item === undefined) {\n throw new Error(errorMessage);\n }\n return [item, indexProp];\n }\n throw new Error(errorMessage);\n}\n\n/**\n * Tracks if it's the first render.\n */\nfunction useIsInitialMount() {\n var isInitialMountRef = React.useRef(true);\n React.useEffect(function () {\n isInitialMountRef.current = false;\n return function () {\n isInitialMountRef.current = true;\n };\n }, []);\n return isInitialMountRef.current;\n}\n\n/**\n * Default state reducer that returns the changes.\n *\n */\nfunction stateReducer(_s, a) {\n return a.changes;\n}\n\n// Shared between all exports.\nvar propTypes$5 = {\n environment: PropTypes.shape({\n addEventListener: PropTypes.func.isRequired,\n removeEventListener: PropTypes.func.isRequired,\n document: PropTypes.shape({\n createElement: PropTypes.func.isRequired,\n getElementById: PropTypes.func.isRequired,\n activeElement: PropTypes.any.isRequired,\n body: PropTypes.any.isRequired\n }).isRequired,\n Node: PropTypes.func.isRequired\n }),\n itemToKey: PropTypes.func,\n stateReducer: PropTypes.func\n};\n\nfunction getDefaultValue$1(props, propKey, defaultStateValues) {\n var defaultValue = props[\"default\" + capitalizeString(propKey)];\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n return defaultStateValues[propKey];\n}\n\nfunction getInitialValue$1(props, propKey, defaultStateValues) {\n var value = props[propKey];\n if (value !== undefined) {\n return value;\n }\n var initialValue = props[\"initial\" + capitalizeString(propKey)];\n if (initialValue !== undefined) {\n return initialValue;\n }\n return getDefaultValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Debounced call for updating the a11y message.\n */\nvar updateA11yStatus = debounce$1(function (status, document) {\n setStatus(status, document);\n}, 200);\n\n/**\n * Adds an a11y aria live status message if getA11yStatusMessage is passed.\n * @param getA11yStatusMessage The function that builds the status message.\n * @param options The options to be passed to getA11yStatusMessage if called.\n * @param dependencyArray The dependency array that triggers the status message setter via useEffect.\n * @param environment The environment object containing the document.\n */\nfunction useA11yMessageStatus(getA11yStatusMessage, options, dependencyArray, environment) {\n var document = environment == null ? void 0 : environment.document;\n var isInitialMount = useIsInitialMount();\n\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n React.useEffect(function () {\n if (!getA11yStatusMessage || isInitialMount || false || !document) {\n return;\n }\n var status = getA11yStatusMessage(options);\n updateA11yStatus(status, document);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencyArray);\n\n // Cleanup the status message container.\n React.useEffect(function () {\n return function () {\n updateA11yStatus.cancel();\n cleanupStatusDiv(document);\n };\n }, [document]);\n}\n\n// Shared between useSelect, useCombobox, Downshift.\nvar propTypes$4 = _extends({}, propTypes$5, {\n getA11yStatusMessage: PropTypes.func,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n toggleButtonId: PropTypes.string,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n scrollIntoView: PropTypes.func\n});\n\nvar defaultProps$3 = {\n itemToString: function itemToString(item) {\n return item ? String(item) : '';\n },\n itemToKey: function itemToKey(item) {\n return item;\n },\n stateReducer: stateReducer,\n scrollIntoView: scrollIntoView,\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' || false ? undefined : window\n};\n\nvar defaultStateValues$1 = {\n highlightedIndex: -1,\n isOpen: false,\n selectedItem: null,\n inputValue: ''\n};\n\n// istanbul ignore next\nvar useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;\nfunction isAcceptedCharacterKey(key) {\n return /^\\S{1}$/.test(key);\n}\nfunction getInitialState$3(props) {\n var selectedItem = getInitialValue$1(props, 'selectedItem', defaultStateValues$1);\n var isOpen = getInitialValue$1(props, 'isOpen', defaultStateValues$1);\n var highlightedIndex = getInitialHighlightedIndex(props);\n var inputValue = getInitialValue$1(props, 'inputValue', defaultStateValues$1);\n return {\n highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.findIndex(function (item) {\n return props.itemToKey(item) === props.itemToKey(selectedItem);\n }) : highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\nfunction getHighlightedIndexOnOpen(props, state, offset) {\n var items = props.items,\n initialHighlightedIndex = props.initialHighlightedIndex,\n defaultHighlightedIndex = props.defaultHighlightedIndex,\n isItemDisabled = props.isItemDisabled,\n itemToKey = props.itemToKey;\n var selectedItem = state.selectedItem,\n highlightedIndex = state.highlightedIndex;\n if (items.length === 0) {\n return -1;\n }\n\n // initialHighlightedIndex will give value to highlightedIndex on initial state only.\n if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex], initialHighlightedIndex)) {\n return initialHighlightedIndex;\n }\n if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex], defaultHighlightedIndex)) {\n return defaultHighlightedIndex;\n }\n if (selectedItem) {\n return items.findIndex(function (item) {\n return itemToKey(selectedItem) === itemToKey(item);\n });\n }\n if (offset < 0 && !isItemDisabled(items[items.length - 1], items.length - 1)) {\n return items.length - 1;\n }\n if (offset > 0 && !isItemDisabled(items[0], 0)) {\n return 0;\n }\n return -1;\n}\n/**\n * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.\n *\n * @param {Window} environment The environment to add the event listeners to, for instance window.\n * @param {() => void} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.\n * @param {Array<{current: HTMLElement}>} downshiftElementsRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.\n * @returns {{isMouseDown: boolean, isTouchMove: boolean, isTouchEnd: boolean}} The mouse and touch events information, if any of are happening.\n */\nfunction useMouseAndTouchTracker(environment, handleBlur, downshiftRefs) {\n var mouseAndTouchTrackersRef = React.useRef({\n isMouseDown: false,\n isTouchMove: false,\n isTouchEnd: false\n });\n var getDownshiftElements = React.useCallback(function () {\n return downshiftRefs.map(function (ref) {\n return ref.current;\n });\n }, [downshiftRefs]);\n React.useEffect(function () {\n if (!environment) {\n return noop;\n }\n function onMouseDown() {\n mouseAndTouchTrackersRef.current.isTouchEnd = false; // reset this one.\n mouseAndTouchTrackersRef.current.isMouseDown = true;\n }\n function onMouseUp(event) {\n mouseAndTouchTrackersRef.current.isMouseDown = false;\n if (!targetWithinDownshift(event.target, getDownshiftElements(), environment)) {\n handleBlur();\n }\n }\n function onTouchStart() {\n mouseAndTouchTrackersRef.current.isTouchEnd = false;\n mouseAndTouchTrackersRef.current.isTouchMove = false;\n }\n function onTouchMove() {\n mouseAndTouchTrackersRef.current.isTouchMove = true;\n }\n function onTouchEnd(event) {\n mouseAndTouchTrackersRef.current.isTouchEnd = true;\n if (!mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, getDownshiftElements(), environment, false)) {\n handleBlur();\n }\n }\n environment.addEventListener('mousedown', onMouseDown);\n environment.addEventListener('mouseup', onMouseUp);\n environment.addEventListener('touchstart', onTouchStart);\n environment.addEventListener('touchmove', onTouchMove);\n environment.addEventListener('touchend', onTouchEnd);\n return function cleanup() {\n environment.removeEventListener('mousedown', onMouseDown);\n environment.removeEventListener('mouseup', onMouseUp);\n environment.removeEventListener('touchstart', onTouchStart);\n environment.removeEventListener('touchmove', onTouchMove);\n environment.removeEventListener('touchend', onTouchEnd);\n };\n }, [environment, getDownshiftElements, handleBlur]);\n return mouseAndTouchTrackersRef.current;\n}\n\n/* istanbul ignore next */\n// eslint-disable-next-line import/no-mutable-exports\nvar useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n return noop;\n};\n/**\n * Custom hook that checks if getter props are called correctly.\n *\n * @param {...any} propKeys Getter prop names to be handled.\n * @returns {Function} Setter function called inside getter props to set call information.\n */\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {\n for (var _len = arguments.length, propKeys = new Array(_len), _key = 0; _key < _len; _key++) {\n propKeys[_key] = arguments[_key];\n }\n var getterPropsCalledRef = React.useRef(propKeys.reduce(function (acc, propKey) {\n acc[propKey] = {};\n return acc;\n }, {}));\n React.useEffect(function () {\n Object.keys(getterPropsCalledRef.current).forEach(function (propKey) {\n var propCallInfo = getterPropsCalledRef.current[propKey];\n if (!Object.keys(propCallInfo).length) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: You forgot to call the \" + propKey + \" getter function on your component / element.\");\n return;\n }\n var suppressRefError = propCallInfo.suppressRefError,\n refKey = propCallInfo.refKey,\n elementRef = propCallInfo.elementRef;\n if (suppressRefError) {\n return;\n }\n if (!(elementRef != null && elementRef.current)) {\n // eslint-disable-next-line no-console\n console.error(\"downshift: The ref prop \\\"\" + refKey + \"\\\" from \" + propKey + \" was not applied correctly on your element.\");\n }\n });\n }, []);\n var setGetterPropCallInfo = React.useCallback(function (propKey, suppressRefError, refKey, elementRef) {\n getterPropsCalledRef.current[propKey] = {\n suppressRefError: suppressRefError,\n refKey: refKey,\n elementRef: elementRef\n };\n }, []);\n return setGetterPropCallInfo;\n };\n}\nfunction useScrollIntoView(_ref) {\n var highlightedIndex = _ref.highlightedIndex,\n isOpen = _ref.isOpen,\n itemRefs = _ref.itemRefs,\n getItemNodeFromIndex = _ref.getItemNodeFromIndex,\n menuElement = _ref.menuElement,\n scrollIntoViewProp = _ref.scrollIntoView;\n // used not to scroll on highlight by mouse.\n var shouldScrollRef = React.useRef(true);\n // Scroll on highlighted item if change comes from keyboard.\n useIsomorphicLayoutEffect(function () {\n if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {\n return;\n }\n if (shouldScrollRef.current === false) {\n shouldScrollRef.current = true;\n } else {\n scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex]);\n return shouldScrollRef;\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nvar useControlPropsValidator = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useControlPropsValidator = function useControlPropsValidator(_ref2) {\n var props = _ref2.props,\n state = _ref2.state;\n // used for checking when props are moving from controlled to uncontrolled.\n var prevPropsRef = React.useRef(props);\n var isInitialMount = useIsInitialMount();\n React.useEffect(function () {\n if (isInitialMount) {\n return;\n }\n validateControlledUnchanged(state, prevPropsRef.current, props);\n prevPropsRef.current = props;\n }, [state, props, isInitialMount]);\n };\n}\n\n/**\n * Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted.\n * In that case, selects the item and resets to defaults for open state and highlighted idex.\n * @param {Object} props The useCombobox props.\n * @param {number} highlightedIndex The index from the state.\n * @param {boolean} inputValue Also return the input value for state.\n * @returns The changes for the state.\n */\nfunction getChangesOnSelection(props, highlightedIndex, inputValue) {\n var _props$items;\n if (inputValue === void 0) {\n inputValue = true;\n }\n var shouldSelect = ((_props$items = props.items) == null ? void 0 : _props$items.length) && highlightedIndex >= 0;\n return _extends({\n isOpen: false,\n highlightedIndex: -1\n }, shouldSelect && _extends({\n selectedItem: props.items[highlightedIndex],\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n highlightedIndex: getDefaultValue$1(props, 'highlightedIndex', defaultStateValues$1)\n }, inputValue && {\n inputValue: props.itemToString(props.items[highlightedIndex])\n }));\n}\n\n/**\n * Check if a state is equal for dropdowns, by comparing isOpen, inputValue, highlightedIndex and selected item.\n * Used by useSelect and useCombobox.\n *\n * @param {Object} prevState\n * @param {Object} newState\n * @returns {boolean} Wheather the states are deeply equal.\n */\nfunction isDropdownsStateEqual(prevState, newState) {\n return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;\n}\n\n/**\n * Returns the new highlightedIndex based on the defaultHighlightedIndex prop, if it's not disabled.\n *\n * @param {Object} props Props from useCombobox or useSelect.\n * @returns {number} The highlighted index.\n */\nfunction getDefaultHighlightedIndex(props) {\n var highlightedIndex = getDefaultValue$1(props, 'highlightedIndex', defaultStateValues$1);\n if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {\n return -1;\n }\n return highlightedIndex;\n}\n\n/**\n * Returns the new highlightedIndex based on the initialHighlightedIndex prop, if not disabled.\n *\n * @param {Object} props Props from useCombobox or useSelect.\n * @returns {number} The highlighted index.\n */\nfunction getInitialHighlightedIndex(props) {\n var highlightedIndex = getInitialValue$1(props, 'highlightedIndex', defaultStateValues$1);\n if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {\n return -1;\n }\n return highlightedIndex;\n}\n\nfunction downshiftCommonReducer(state, props, action, stateChangeTypes) {\n var type = action.type;\n var changes;\n switch (type) {\n case stateChangeTypes.ItemMouseMove:\n changes = {\n highlightedIndex: action.disabled ? -1 : action.index\n };\n break;\n case stateChangeTypes.MenuMouseLeave:\n changes = {\n highlightedIndex: -1\n };\n break;\n case stateChangeTypes.ToggleButtonClick:\n case stateChangeTypes.FunctionToggleMenu:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case stateChangeTypes.FunctionOpenMenu:\n changes = {\n isOpen: true,\n highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case stateChangeTypes.FunctionCloseMenu:\n changes = {\n isOpen: false\n };\n break;\n case stateChangeTypes.FunctionSetHighlightedIndex:\n changes = {\n highlightedIndex: props.isItemDisabled(props.items[action.highlightedIndex], action.highlightedIndex) ? -1 : action.highlightedIndex\n };\n break;\n case stateChangeTypes.FunctionSetInputValue:\n changes = {\n inputValue: action.inputValue\n };\n break;\n case stateChangeTypes.FunctionReset:\n changes = {\n highlightedIndex: getDefaultHighlightedIndex(props),\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n selectedItem: getDefaultValue$1(props, 'selectedItem', defaultStateValues$1),\n inputValue: getDefaultValue$1(props, 'inputValue', defaultStateValues$1)\n };\n break;\n default:\n throw new Error('Reducer called without proper action type.');\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar propTypes$3 = _extends({}, propTypes$4, {\n items: PropTypes.array.isRequired,\n isItemDisabled: PropTypes.func\n});\n\nvar defaultProps$2 = _extends({}, defaultProps$3, {\n isItemDisabled: function isItemDisabled() {\n return false;\n }\n});\n\nfunction getItemIndexByCharacterKey(_ref) {\n var keysSoFar = _ref.keysSoFar,\n highlightedIndex = _ref.highlightedIndex,\n items = _ref.items,\n itemToString = _ref.itemToString,\n isItemDisabled = _ref.isItemDisabled;\n var lowerCasedKeysSoFar = keysSoFar.toLowerCase();\n for (var _index = 0; _index < items.length; _index++) {\n // if we already have a search query in progress, we also consider the current highlighted item.\n var offsetIndex = (_index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;\n var _item = items[offsetIndex];\n if (_item !== undefined && itemToString(_item).toLowerCase().startsWith(lowerCasedKeysSoFar) && !isItemDisabled(_item, offsetIndex)) {\n return offsetIndex;\n }\n }\n return highlightedIndex;\n}\n\nvar ToggleButtonClick$1 = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 0;\nvar ToggleButtonKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_down__' : 1;\nvar ToggleButtonKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_arrow_up__' : 2;\nvar ToggleButtonKeyDownCharacter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_character__' : 3;\nvar ToggleButtonKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_escape__' : 4;\nvar ToggleButtonKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_home__' : 5;\nvar ToggleButtonKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_end__' : 6;\nvar ToggleButtonKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_enter__' : 7;\nvar ToggleButtonKeyDownSpaceButton = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_space_button__' : 8;\nvar ToggleButtonKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_up__' : 9;\nvar ToggleButtonKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__togglebutton_keydown_page_down__' : 10;\nvar ToggleButtonBlur = process.env.NODE_ENV !== \"production\" ? '__togglebutton_blur__' : 11;\nvar MenuMouseLeave$1 = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 12;\nvar ItemMouseMove$1 = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 13;\nvar ItemClick$1 = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 14;\nvar FunctionToggleMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu$1 = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem$1 = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue$1 = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$2 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\n\nvar stateChangeTypes$3 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n FunctionCloseMenu: FunctionCloseMenu$1,\n FunctionOpenMenu: FunctionOpenMenu$1,\n FunctionReset: FunctionReset$2,\n FunctionSelectItem: FunctionSelectItem$1,\n FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,\n FunctionSetInputValue: FunctionSetInputValue$1,\n FunctionToggleMenu: FunctionToggleMenu$1,\n ItemClick: ItemClick$1,\n ItemMouseMove: ItemMouseMove$1,\n MenuMouseLeave: MenuMouseLeave$1,\n ToggleButtonBlur: ToggleButtonBlur,\n ToggleButtonClick: ToggleButtonClick$1,\n ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,\n ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,\n ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,\n ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,\n ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,\n ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,\n ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,\n ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,\n ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,\n ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton\n});\n\n/* eslint-disable complexity */\nfunction downshiftSelectReducer(state, props, action) {\n var _props$items;\n var type = action.type,\n altKey = action.altKey;\n var changes;\n switch (type) {\n case ItemClick$1:\n changes = {\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n highlightedIndex: getDefaultHighlightedIndex(props),\n selectedItem: props.items[action.index]\n };\n break;\n case ToggleButtonKeyDownCharacter:\n {\n var lowercasedKey = action.key;\n var inputValue = \"\" + state.inputValue + lowercasedKey;\n var prevHighlightedIndex = !state.isOpen && state.selectedItem ? props.items.findIndex(function (item) {\n return props.itemToKey(item) === props.itemToKey(state.selectedItem);\n }) : state.highlightedIndex;\n var highlightedIndex = getItemIndexByCharacterKey({\n keysSoFar: inputValue,\n highlightedIndex: prevHighlightedIndex,\n items: props.items,\n itemToString: props.itemToString,\n isItemDisabled: props.isItemDisabled\n });\n changes = {\n inputValue: inputValue,\n highlightedIndex: highlightedIndex,\n isOpen: true\n };\n }\n break;\n case ToggleButtonKeyDownArrowDown:\n {\n var _highlightedIndex = state.isOpen ? getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled) : altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1);\n changes = {\n highlightedIndex: _highlightedIndex,\n isOpen: true\n };\n }\n break;\n case ToggleButtonKeyDownArrowUp:\n if (state.isOpen && altKey) {\n changes = getChangesOnSelection(props, state.highlightedIndex, false);\n } else {\n var _highlightedIndex2 = state.isOpen ? getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled) : getHighlightedIndexOnOpen(props, state, -1);\n changes = {\n highlightedIndex: _highlightedIndex2,\n isOpen: true\n };\n }\n break;\n // only triggered when menu is open.\n case ToggleButtonKeyDownEnter:\n case ToggleButtonKeyDownSpaceButton:\n changes = getChangesOnSelection(props, state.highlightedIndex, false);\n break;\n case ToggleButtonKeyDownHome:\n changes = {\n highlightedIndex: getNonDisabledIndex(0, false, props.items, props.isItemDisabled),\n isOpen: true\n };\n break;\n case ToggleButtonKeyDownEnd:\n changes = {\n highlightedIndex: getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled),\n isOpen: true\n };\n break;\n case ToggleButtonKeyDownPageUp:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled)\n };\n break;\n case ToggleButtonKeyDownPageDown:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled)\n };\n break;\n case ToggleButtonKeyDownEscape:\n changes = {\n isOpen: false,\n highlightedIndex: -1\n };\n break;\n case ToggleButtonBlur:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && {\n selectedItem: props.items[state.highlightedIndex]\n });\n break;\n case FunctionSelectItem$1:\n changes = {\n selectedItem: action.selectedItem\n };\n break;\n default:\n return downshiftCommonReducer(state, props, action, stateChangeTypes$3);\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\n// https://github.com/downshift-js/downshift/issues/1674#issuecomment-3924320872\nvar SafeReact$1 = _extends({}, React);\nvar reactUseId$1 = SafeReact$1.useId;\nvar useElementIds$1 = typeof reactUseId$1 === 'function' ? useElementIdsR18$1 : useElementIdsLegacy$1;\nfunction useElementIdsR18$1(_ref) {\n var id = _ref.id,\n labelId = _ref.labelId,\n menuId = _ref.menuId,\n getItemId = _ref.getItemId,\n toggleButtonId = _ref.toggleButtonId,\n inputId = _ref.inputId;\n var reactId = \"downshift-\" + reactUseId$1();\n if (!id) {\n id = reactId;\n }\n var elementIds = React.useMemo(function () {\n return {\n labelId: labelId != null ? labelId : id + \"-label\",\n menuId: menuId != null ? menuId : id + \"-menu\",\n getItemId: getItemId != null ? getItemId : function (index) {\n return id + \"-item-\" + index;\n },\n toggleButtonId: toggleButtonId != null ? toggleButtonId : id + \"-toggle-button\",\n inputId: inputId != null ? inputId : id + \"-input\"\n };\n }, [getItemId, id, inputId, labelId, menuId, toggleButtonId]);\n return elementIds;\n}\nfunction useElementIdsLegacy$1(_ref2) {\n var id = _ref2.id,\n labelId = _ref2.labelId,\n menuId = _ref2.menuId,\n getItemId = _ref2.getItemId,\n toggleButtonId = _ref2.toggleButtonId,\n inputId = _ref2.inputId;\n var baseIdRef = React.useRef(id != null ? id : \"downshift-\" + generateId());\n var baseId = baseIdRef.current;\n var elementIds = React.useMemo(function () {\n return {\n labelId: labelId != null ? labelId : baseId + \"-label\",\n menuId: menuId != null ? menuId : baseId + \"-menu\",\n getItemId: getItemId != null ? getItemId : function (index) {\n return baseId + \"-item-\" + index;\n },\n toggleButtonId: toggleButtonId != null ? toggleButtonId : baseId + \"-toggle-button\",\n inputId: inputId != null ? inputId : baseId + \"-input\"\n };\n }, [getItemId, inputId, labelId, menuId, toggleButtonId, baseId]);\n return elementIds;\n}\n\nvar _excluded$3 = [\"onClick\"],\n _excluded2$3 = [\"onMouseLeave\", \"refKey\", \"ref\"],\n _excluded3$2 = [\"onBlur\", \"onClick\", \"onPress\", \"onKeyDown\", \"refKey\", \"ref\"],\n _excluded4$1 = [\"item\", \"index\", \"onMouseMove\", \"onClick\", \"onMouseDown\", \"onPress\", \"refKey\", \"disabled\", \"ref\"];\nuseSelect.stateChangeTypes = stateChangeTypes$3;\nfunction useSelect(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes$1(userProps, useSelect, propTypes$3);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps$2, userProps);\n var scrollIntoView = props.scrollIntoView,\n environment = props.environment,\n getA11yStatusMessage = props.getA11yStatusMessage;\n // Initial state depending on controlled props.\n var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, props, getInitialState$3, isDropdownsStateEqual),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var isOpen = state.isOpen,\n highlightedIndex = state.highlightedIndex,\n selectedItem = state.selectedItem,\n inputValue = state.inputValue;\n // Element efs.\n var toggleButtonRef = useRef(null);\n var menuRef = useRef(null);\n var itemRefs = useRef({});\n\n // used to keep the inputValue clearTimeout object between renders.\n var clearTimeoutRef = useRef(null);\n // prevent id re-generation between renders.\n var elementIds = useElementIds$1(props);\n // utility callback to get item element.\n var latest = useLatestRef({\n state: state,\n props: props\n });\n\n // Some utils.\n var getItemNodeFromIndex = useCallback(function (index) {\n return itemRefs.current[elementIds.getItemId(index)];\n }, [elementIds]);\n\n // Effects.\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n useA11yMessageStatus(getA11yStatusMessage, state, [isOpen, highlightedIndex, selectedItem, inputValue], environment);\n // Scroll on highlighted item if change comes from keyboard.\n var shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n itemRefs: itemRefs,\n scrollIntoView: scrollIntoView,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n // Sets cleanup for the keysSoFar callback, debounded after 500ms.\n useEffect(function () {\n // init the clean function here as we need access to dispatch.\n clearTimeoutRef.current = debounce(function (outerDispatch) {\n outerDispatch({\n type: FunctionSetInputValue$1,\n inputValue: ''\n });\n }, 500);\n\n // Cancel any pending debounced calls on mount\n return function () {\n clearTimeoutRef.current.cancel();\n };\n }, []);\n // Invokes the keysSoFar callback set up above.\n useEffect(function () {\n if (!inputValue) {\n return;\n }\n clearTimeoutRef.current(dispatch);\n }, [dispatch, inputValue]);\n useControlPropsValidator({\n props: props,\n state: state\n });\n // Focus the toggle button on first render if required.\n useEffect(function () {\n var focusOnOpen = getInitialValue$1(props, 'isOpen', defaultStateValues$1);\n if (focusOnOpen && toggleButtonRef.current) {\n toggleButtonRef.current.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n var handleBlurInTracker = useCallback(function handleBlur() {\n if (latest.current.state.isOpen) {\n dispatch({\n type: ToggleButtonBlur\n });\n }\n }, [dispatch, latest]);\n var downshiftRefs = useMemo(function () {\n return [menuRef, toggleButtonRef];\n }, []);\n var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, handleBlurInTracker, downshiftRefs);\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');\n // Reset itemRefs on close.\n useEffect(function () {\n if (!isOpen) {\n itemRefs.current = {};\n }\n }, [isOpen]);\n\n // Event handler functions.\n var toggleButtonKeyDownHandlers = useMemo(function () {\n return {\n ArrowDown: function ArrowDown(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownArrowDown,\n altKey: event.altKey\n });\n },\n ArrowUp: function ArrowUp(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownArrowUp,\n altKey: event.altKey\n });\n },\n Home: function Home(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownHome\n });\n },\n End: function End(event) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownEnd\n });\n },\n Escape: function Escape() {\n if (latest.current.state.isOpen) {\n dispatch({\n type: ToggleButtonKeyDownEscape\n });\n }\n },\n Enter: function Enter(event) {\n event.preventDefault();\n dispatch({\n type: latest.current.state.isOpen ? ToggleButtonKeyDownEnter : ToggleButtonClick$1\n });\n },\n PageUp: function PageUp(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownPageUp\n });\n }\n },\n PageDown: function PageDown(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: ToggleButtonKeyDownPageDown\n });\n }\n },\n ' ': function _(event) {\n event.preventDefault();\n var currentState = latest.current.state;\n if (!currentState.isOpen) {\n dispatch({\n type: ToggleButtonClick$1\n });\n return;\n }\n if (currentState.inputValue) {\n dispatch({\n type: ToggleButtonKeyDownCharacter,\n key: ' '\n });\n } else {\n dispatch({\n type: ToggleButtonKeyDownSpaceButton\n });\n }\n }\n };\n }, [dispatch, latest]);\n\n // Action functions.\n var toggleMenu = useCallback(function () {\n dispatch({\n type: FunctionToggleMenu$1\n });\n }, [dispatch]);\n var closeMenu = useCallback(function () {\n dispatch({\n type: FunctionCloseMenu$1\n });\n }, [dispatch]);\n var openMenu = useCallback(function () {\n dispatch({\n type: FunctionOpenMenu$1\n });\n }, [dispatch]);\n var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n dispatch({\n type: FunctionSetHighlightedIndex$1,\n highlightedIndex: newHighlightedIndex\n });\n }, [dispatch]);\n var selectItem = useCallback(function (newSelectedItem) {\n dispatch({\n type: FunctionSelectItem$1,\n selectedItem: newSelectedItem\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset$2\n });\n }, [dispatch]);\n var setInputValue = useCallback(function (newInputValue) {\n dispatch({\n type: FunctionSetInputValue$1,\n inputValue: newInputValue\n });\n }, [dispatch]);\n // Getter functions.\n var getLabelProps = useCallback(function (_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n onClick = _ref.onClick,\n labelProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);\n var labelHandleClick = function labelHandleClick() {\n var _toggleButtonRef$curr;\n (_toggleButtonRef$curr = toggleButtonRef.current) == null || _toggleButtonRef$curr.focus();\n };\n return _extends({\n id: elementIds.labelId,\n htmlFor: elementIds.toggleButtonId,\n onClick: callAllEventHandlers(onClick, labelHandleClick)\n }, labelProps);\n }, [elementIds]);\n var getMenuProps = useCallback(function (_temp2, _temp3) {\n var _extends2;\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n onMouseLeave = _ref2.onMouseLeave,\n _ref2$refKey = _ref2.refKey,\n refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,\n ref = _ref2.ref,\n rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$3);\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n _ref3$suppressRefErro = _ref3.suppressRefError,\n suppressRefError = _ref3$suppressRefErro === void 0 ? false : _ref3$suppressRefErro;\n var menuHandleMouseLeave = function menuHandleMouseLeave() {\n dispatch({\n type: MenuMouseLeave$1\n });\n };\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n menuRef.current = menuNode;\n }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends2), rest);\n }, [dispatch, setGetterPropCallInfo, elementIds]);\n var getToggleButtonProps = useCallback(function (_temp4, _temp5) {\n var _extends3;\n var _ref4 = _temp4 === void 0 ? {} : _temp4,\n onBlur = _ref4.onBlur,\n onClick = _ref4.onClick;\n _ref4.onPress;\n var onKeyDown = _ref4.onKeyDown,\n _ref4$refKey = _ref4.refKey,\n refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,\n ref = _ref4.ref,\n rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);\n var _ref5 = _temp5 === void 0 ? {} : _temp5,\n _ref5$suppressRefErro = _ref5.suppressRefError,\n suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;\n var latestState = latest.current.state;\n var toggleButtonHandleClick = function toggleButtonHandleClick() {\n dispatch({\n type: ToggleButtonClick$1\n });\n };\n var toggleButtonHandleBlur = function toggleButtonHandleBlur() {\n if (latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {\n dispatch({\n type: ToggleButtonBlur\n });\n }\n };\n var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && toggleButtonKeyDownHandlers[key]) {\n toggleButtonKeyDownHandlers[key](event);\n } else if (isAcceptedCharacterKey(key)) {\n dispatch({\n type: ToggleButtonKeyDownCharacter,\n key: key\n });\n }\n };\n var toggleProps = _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {\n toggleButtonRef.current = toggleButtonNode;\n }), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);\n if (!rest.disabled) {\n /* istanbul ignore if (react-native) */\n {\n toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);\n toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);\n }\n }\n setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);\n return toggleProps;\n }, [dispatch, elementIds, latest, mouseAndTouchTrackers, setGetterPropCallInfo, toggleButtonKeyDownHandlers]);\n var getItemProps = useCallback(function (_temp6) {\n var _extends4;\n var _ref6 = _temp6 === void 0 ? {} : _temp6,\n itemProp = _ref6.item,\n indexProp = _ref6.index,\n onMouseMove = _ref6.onMouseMove,\n onClick = _ref6.onClick,\n onMouseDown = _ref6.onMouseDown;\n _ref6.onPress;\n var _ref6$refKey = _ref6.refKey,\n refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,\n disabledProp = _ref6.disabled,\n ref = _ref6.ref,\n rest = _objectWithoutPropertiesLoose(_ref6, _excluded4$1);\n if (disabledProp !== undefined) {\n console.warn('Passing \"disabled\" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.');\n }\n var _latest$current = latest.current,\n latestState = _latest$current.state,\n latestProps = _latest$current.props;\n var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n item = _getItemAndIndex[0],\n index = _getItemAndIndex[1];\n var disabled = latestProps.isItemDisabled(item, index);\n var itemHandleMouseMove = function itemHandleMouseMove() {\n if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {\n return;\n }\n shouldScrollRef.current = false;\n dispatch({\n type: ItemMouseMove$1,\n index: index,\n disabled: disabled\n });\n };\n var itemHandleClick = function itemHandleClick() {\n dispatch({\n type: ItemClick$1,\n index: index\n });\n };\n var itemHandleMouseDown = function itemHandleMouseDown(e) {\n return e.preventDefault();\n }; // keep focus on the toggle after item click select.\n\n var itemProps = _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(index)] = itemNode;\n }\n }), _extends4['aria-disabled'] = disabled, _extends4['aria-selected'] = item === latestState.selectedItem, _extends4.id = elementIds.getItemId(index), _extends4.role = 'option', _extends4), rest);\n if (!disabled) {\n /* istanbul ignore next (react-native) */\n {\n itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);\n }\n }\n itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);\n itemProps.onMouseDown = callAllEventHandlers(onMouseDown, itemHandleMouseDown);\n return itemProps;\n }, [latest, elementIds, mouseAndTouchTrackers, shouldScrollRef, dispatch]);\n return {\n // prop getters.\n getToggleButtonProps: getToggleButtonProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getItemProps: getItemProps,\n // actions.\n toggleMenu: toggleMenu,\n openMenu: openMenu,\n closeMenu: closeMenu,\n setHighlightedIndex: setHighlightedIndex,\n selectItem: selectItem,\n reset: reset,\n setInputValue: setInputValue,\n // state.\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\n\nvar InputKeyDownArrowDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_down__' : 0;\nvar InputKeyDownArrowUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_arrow_up__' : 1;\nvar InputKeyDownEscape = process.env.NODE_ENV !== \"production\" ? '__input_keydown_escape__' : 2;\nvar InputKeyDownHome = process.env.NODE_ENV !== \"production\" ? '__input_keydown_home__' : 3;\nvar InputKeyDownEnd = process.env.NODE_ENV !== \"production\" ? '__input_keydown_end__' : 4;\nvar InputKeyDownPageUp = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_up__' : 5;\nvar InputKeyDownPageDown = process.env.NODE_ENV !== \"production\" ? '__input_keydown_page_down__' : 6;\nvar InputKeyDownEnter = process.env.NODE_ENV !== \"production\" ? '__input_keydown_enter__' : 7;\nvar InputChange = process.env.NODE_ENV !== \"production\" ? '__input_change__' : 8;\nvar InputBlur = process.env.NODE_ENV !== \"production\" ? '__input_blur__' : 9;\nvar InputClick = process.env.NODE_ENV !== \"production\" ? '__input_click__' : 10;\nvar MenuMouseLeave = process.env.NODE_ENV !== \"production\" ? '__menu_mouse_leave__' : 11;\nvar ItemMouseMove = process.env.NODE_ENV !== \"production\" ? '__item_mouse_move__' : 12;\nvar ItemClick = process.env.NODE_ENV !== \"production\" ? '__item_click__' : 13;\nvar ToggleButtonClick = process.env.NODE_ENV !== \"production\" ? '__togglebutton_click__' : 14;\nvar FunctionToggleMenu = process.env.NODE_ENV !== \"production\" ? '__function_toggle_menu__' : 15;\nvar FunctionOpenMenu = process.env.NODE_ENV !== \"production\" ? '__function_open_menu__' : 16;\nvar FunctionCloseMenu = process.env.NODE_ENV !== \"production\" ? '__function_close_menu__' : 17;\nvar FunctionSetHighlightedIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_highlighted_index__' : 18;\nvar FunctionSelectItem = process.env.NODE_ENV !== \"production\" ? '__function_select_item__' : 19;\nvar FunctionSetInputValue = process.env.NODE_ENV !== \"production\" ? '__function_set_input_value__' : 20;\nvar FunctionReset$1 = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 21;\nvar ControlledPropUpdatedSelectedItem = process.env.NODE_ENV !== \"production\" ? '__controlled_prop_updated_selected_item__' : 22;\n\nvar stateChangeTypes$2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem,\n FunctionCloseMenu: FunctionCloseMenu,\n FunctionOpenMenu: FunctionOpenMenu,\n FunctionReset: FunctionReset$1,\n FunctionSelectItem: FunctionSelectItem,\n FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,\n FunctionSetInputValue: FunctionSetInputValue,\n FunctionToggleMenu: FunctionToggleMenu,\n InputBlur: InputBlur,\n InputChange: InputChange,\n InputClick: InputClick,\n InputKeyDownArrowDown: InputKeyDownArrowDown,\n InputKeyDownArrowUp: InputKeyDownArrowUp,\n InputKeyDownEnd: InputKeyDownEnd,\n InputKeyDownEnter: InputKeyDownEnter,\n InputKeyDownEscape: InputKeyDownEscape,\n InputKeyDownHome: InputKeyDownHome,\n InputKeyDownPageDown: InputKeyDownPageDown,\n InputKeyDownPageUp: InputKeyDownPageUp,\n ItemClick: ItemClick,\n ItemMouseMove: ItemMouseMove,\n MenuMouseLeave: MenuMouseLeave,\n ToggleButtonClick: ToggleButtonClick\n});\n\nfunction getInitialState$2(props) {\n var initialState = getInitialState$3(props);\n var selectedItem = initialState.selectedItem;\n var inputValue = initialState.inputValue;\n if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {\n inputValue = props.itemToString(selectedItem);\n }\n return _extends({}, initialState, {\n inputValue: inputValue\n });\n}\nvar propTypes$2 = _extends({}, propTypes$4, {\n items: PropTypes.array.isRequired,\n isItemDisabled: PropTypes.func,\n inputValue: PropTypes.string,\n defaultInputValue: PropTypes.string,\n initialInputValue: PropTypes.string,\n inputId: PropTypes.string,\n onInputValueChange: PropTypes.func\n});\n\n/**\n * The useCombobox version of useControlledReducer, which also\n * checks if the controlled prop selectedItem changed between\n * renders. If so, it will also update inputValue with its\n * string equivalent. It uses the common useEnhancedReducer to\n * compute the rest of the state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} props The hook props, also passed to createInitialState.\n * @param {Function} createInitialState Function that returns the initial state.\n * @param {Function} isStateEqual Function that checks if a previous state is equal to the next.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer(reducer, props, createInitialState, isStateEqual) {\n var previousSelectedItemRef = useRef();\n var _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual),\n state = _useEnhancedReducer[0],\n dispatch = _useEnhancedReducer[1];\n var isInitialMount = useIsInitialMount();\n useEffect(function () {\n if (!isControlledProp(props, 'selectedItem')) {\n return;\n }\n if (!isInitialMount // on first mount we already have the proper inputValue for a initial selected item.\n ) {\n var shouldCallDispatch = props.itemToKey(props.selectedItem) !== props.itemToKey(previousSelectedItemRef.current);\n if (shouldCallDispatch) {\n dispatch({\n type: ControlledPropUpdatedSelectedItem,\n inputValue: props.itemToString(props.selectedItem)\n });\n }\n }\n previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.selectedItem, props.selectedItem]);\n return [getState(state, props), dispatch];\n}\nvar defaultProps$1 = _extends({}, defaultProps$3, {\n isItemDisabled: function isItemDisabled() {\n return false;\n }\n});\n\n/* eslint-disable complexity */\nfunction downshiftUseComboboxReducer(state, props, action) {\n var _props$items;\n var type = action.type,\n altKey = action.altKey;\n var changes;\n switch (type) {\n case ItemClick:\n changes = {\n isOpen: getDefaultValue$1(props, 'isOpen', defaultStateValues$1),\n highlightedIndex: getDefaultHighlightedIndex(props),\n selectedItem: props.items[action.index],\n inputValue: props.itemToString(props.items[action.index])\n };\n break;\n case InputKeyDownArrowDown:\n if (state.isOpen) {\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled, true)\n };\n } else {\n changes = {\n highlightedIndex: altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props, state, 1),\n isOpen: props.items.length >= 0\n };\n }\n break;\n case InputKeyDownArrowUp:\n if (state.isOpen) {\n if (altKey) {\n changes = getChangesOnSelection(props, state.highlightedIndex);\n } else {\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled, true)\n };\n }\n } else {\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(props, state, -1),\n isOpen: props.items.length >= 0\n };\n }\n break;\n case InputKeyDownEnter:\n changes = getChangesOnSelection(props, state.highlightedIndex);\n break;\n case InputKeyDownEscape:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, !state.isOpen && {\n selectedItem: null,\n inputValue: ''\n });\n break;\n case InputKeyDownPageUp:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled, true)\n };\n break;\n case InputKeyDownPageDown:\n changes = {\n highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled, true)\n };\n break;\n case InputKeyDownHome:\n changes = {\n highlightedIndex: getNonDisabledIndex(0, false, props.items, props.isItemDisabled)\n };\n break;\n case InputKeyDownEnd:\n changes = {\n highlightedIndex: getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled)\n };\n break;\n case InputBlur:\n changes = _extends({\n isOpen: false,\n highlightedIndex: -1\n }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && action.selectItem && {\n selectedItem: props.items[state.highlightedIndex],\n inputValue: props.itemToString(props.items[state.highlightedIndex])\n });\n break;\n case InputChange:\n changes = {\n isOpen: true,\n highlightedIndex: getDefaultHighlightedIndex(props),\n inputValue: action.inputValue\n };\n break;\n case InputClick:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)\n };\n break;\n case FunctionSelectItem:\n changes = {\n selectedItem: action.selectedItem,\n inputValue: props.itemToString(action.selectedItem)\n };\n break;\n case ControlledPropUpdatedSelectedItem:\n changes = {\n inputValue: action.inputValue\n };\n break;\n default:\n return downshiftCommonReducer(state, props, action, stateChangeTypes$2);\n }\n return _extends({}, state, changes);\n}\n/* eslint-enable complexity */\n\nvar _excluded$2 = [\"onMouseLeave\", \"refKey\", \"ref\"],\n _excluded2$2 = [\"item\", \"index\", \"refKey\", \"ref\", \"onMouseMove\", \"onMouseDown\", \"onClick\", \"onPress\", \"disabled\"],\n _excluded3$1 = [\"onClick\", \"onPress\", \"refKey\", \"ref\"],\n _excluded4 = [\"onKeyDown\", \"onChange\", \"onInput\", \"onBlur\", \"onChangeText\", \"onClick\", \"refKey\", \"ref\"];\nuseCombobox.stateChangeTypes = stateChangeTypes$2;\nfunction useCombobox(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes$1(userProps, useCombobox, propTypes$2);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps$1, userProps);\n var items = props.items,\n scrollIntoView = props.scrollIntoView,\n environment = props.environment,\n getA11yStatusMessage = props.getA11yStatusMessage;\n // Initial state depending on controlled props.\n var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, props, getInitialState$2, isDropdownsStateEqual),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var isOpen = state.isOpen,\n highlightedIndex = state.highlightedIndex,\n selectedItem = state.selectedItem,\n inputValue = state.inputValue;\n\n // Element refs.\n var menuRef = useRef(null);\n var itemRefs = useRef({});\n var inputRef = useRef(null);\n var toggleButtonRef = useRef(null);\n var isInitialMount = useIsInitialMount();\n\n // prevent id re-generation between renders.\n var elementIds = useElementIds$1(props);\n // used to keep track of how many items we had on previous cycle.\n var previousResultCountRef = useRef();\n // utility callback to get item element.\n var latest = useLatestRef({\n state: state,\n props: props\n });\n var getItemNodeFromIndex = useCallback(function (index) {\n return itemRefs.current[elementIds.getItemId(index)];\n }, [elementIds]);\n\n // Effects.\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n useA11yMessageStatus(getA11yStatusMessage, state, [isOpen, highlightedIndex, selectedItem, inputValue], environment);\n // Scroll on highlighted item if change comes from keyboard.\n var shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n itemRefs: itemRefs,\n scrollIntoView: scrollIntoView,\n getItemNodeFromIndex: getItemNodeFromIndex\n });\n useControlPropsValidator({\n props: props,\n state: state\n });\n // Focus the input on first render if required.\n useEffect(function () {\n var focusOnOpen = getInitialValue$1(props, 'isOpen', defaultStateValues$1);\n if (focusOnOpen && inputRef.current) {\n inputRef.current.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n useEffect(function () {\n if (!isInitialMount) {\n previousResultCountRef.current = items.length;\n }\n });\n var handleBlurInTracker = useCallback(function handleBlur() {\n if (latest.current.state.isOpen) {\n dispatch({\n type: InputBlur\n });\n }\n }, [dispatch, latest]);\n var downshiftRefs = useMemo(function () {\n return [menuRef, toggleButtonRef, inputRef];\n }, []);\n var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, handleBlurInTracker, downshiftRefs);\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');\n // Reset itemRefs on close.\n useEffect(function () {\n if (!isOpen) {\n itemRefs.current = {};\n }\n }, [isOpen]);\n // Reset itemRefs on close.\n useEffect(function () {\n var _inputRef$current;\n if (!isOpen || !(environment != null && environment.document) || !(inputRef != null && (_inputRef$current = inputRef.current) != null && _inputRef$current.focus)) {\n return;\n }\n if (environment.document.activeElement !== inputRef.current) {\n inputRef.current.focus();\n }\n }, [isOpen, environment]);\n\n /* Event handler functions */\n var inputKeyDownHandlers = useMemo(function () {\n return {\n ArrowDown: function ArrowDown(event) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownArrowDown,\n altKey: event.altKey\n });\n },\n ArrowUp: function ArrowUp(event) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownArrowUp,\n altKey: event.altKey\n });\n },\n Home: function Home(event) {\n if (!latest.current.state.isOpen) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownHome\n });\n },\n End: function End(event) {\n if (!latest.current.state.isOpen) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownEnd\n });\n },\n Escape: function Escape(event) {\n var latestState = latest.current.state;\n if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownEscape\n });\n }\n },\n Enter: function Enter(event) {\n var latestState = latest.current.state;\n // if closed or no highlighted index, do nothing.\n if (!latestState.isOpen || event.which === 229 // if IME composing, wait for next Enter keydown event.\n ) {\n return;\n }\n event.preventDefault();\n dispatch({\n type: InputKeyDownEnter\n });\n },\n PageUp: function PageUp(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownPageUp\n });\n }\n },\n PageDown: function PageDown(event) {\n if (latest.current.state.isOpen) {\n event.preventDefault();\n dispatch({\n type: InputKeyDownPageDown\n });\n }\n }\n };\n }, [dispatch, latest]);\n\n // Getter props.\n var getLabelProps = useCallback(function (labelProps) {\n return _extends({\n id: elementIds.labelId,\n htmlFor: elementIds.inputId\n }, labelProps);\n }, [elementIds]);\n var getMenuProps = useCallback(function (_temp, _temp2) {\n var _extends2;\n var _ref = _temp === void 0 ? {} : _temp,\n onMouseLeave = _ref.onMouseLeave,\n _ref$refKey = _ref.refKey,\n refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,\n ref = _ref.ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$suppressRefErro = _ref2.suppressRefError,\n suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {\n menuRef.current = menuNode;\n }), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : \"\" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {\n dispatch({\n type: MenuMouseLeave\n });\n }), _extends2), rest);\n }, [dispatch, setGetterPropCallInfo, elementIds]);\n var getItemProps = useCallback(function (_temp3) {\n var _extends3, _ref4;\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n itemProp = _ref3.item,\n indexProp = _ref3.index,\n _ref3$refKey = _ref3.refKey,\n refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n ref = _ref3.ref,\n onMouseMove = _ref3.onMouseMove,\n onMouseDown = _ref3.onMouseDown,\n onClick = _ref3.onClick;\n _ref3.onPress;\n var disabledProp = _ref3.disabled,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$2);\n if (disabledProp !== undefined) {\n console.warn('Passing \"disabled\" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');\n }\n var _latest$current = latest.current,\n latestProps = _latest$current.props,\n latestState = _latest$current.state;\n var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, latestProps.items, 'Pass either item or index to getItemProps!'),\n item = _getItemAndIndex[0],\n index = _getItemAndIndex[1];\n var disabled = latestProps.isItemDisabled(item, index);\n var onSelectKey = 'onClick';\n var customClickHandler = onClick;\n var itemHandleMouseMove = function itemHandleMouseMove() {\n if (mouseAndTouchTrackers.isTouchEnd || index === latestState.highlightedIndex) {\n return;\n }\n shouldScrollRef.current = false;\n dispatch({\n type: ItemMouseMove,\n index: index,\n disabled: disabled\n });\n };\n var itemHandleClick = function itemHandleClick() {\n dispatch({\n type: ItemClick,\n index: index\n });\n };\n var itemHandleMouseDown = function itemHandleMouseDown(e) {\n return e.preventDefault();\n }; // keep focus on the input after item click select.\n\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(index)] = itemNode;\n }\n }), _extends3['aria-disabled'] = disabled, _extends3['aria-selected'] = index === latestState.highlightedIndex, _extends3.id = elementIds.getItemId(index), _extends3.role = 'option', _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), {\n onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),\n onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown)\n }, rest);\n }, [dispatch, elementIds, latest, mouseAndTouchTrackers, shouldScrollRef]);\n var getToggleButtonProps = useCallback(function (_temp4) {\n var _extends4;\n var _ref5 = _temp4 === void 0 ? {} : _temp4,\n onClick = _ref5.onClick;\n _ref5.onPress;\n var _ref5$refKey = _ref5.refKey,\n refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,\n ref = _ref5.ref,\n rest = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);\n var latestState = latest.current.state;\n var toggleButtonHandleClick = function toggleButtonHandleClick() {\n dispatch({\n type: ToggleButtonClick\n });\n };\n return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {\n toggleButtonRef.current = toggleButtonNode;\n }), _extends4['aria-controls'] = elementIds.menuId, _extends4['aria-expanded'] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({}, {\n onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)\n }), rest);\n }, [dispatch, latest, elementIds]);\n var getInputProps = useCallback(function (_temp5, _temp6) {\n var _extends5;\n var _ref6 = _temp5 === void 0 ? {} : _temp5,\n onKeyDown = _ref6.onKeyDown,\n onChange = _ref6.onChange,\n onInput = _ref6.onInput,\n onBlur = _ref6.onBlur;\n _ref6.onChangeText;\n var onClick = _ref6.onClick,\n _ref6$refKey = _ref6.refKey,\n refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,\n ref = _ref6.ref,\n rest = _objectWithoutPropertiesLoose(_ref6, _excluded4);\n var _ref7 = _temp6 === void 0 ? {} : _temp6,\n _ref7$suppressRefErro = _ref7.suppressRefError,\n suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;\n setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);\n var latestState = latest.current.state;\n var inputHandleKeyDown = function inputHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && inputKeyDownHandlers[key]) {\n inputKeyDownHandlers[key](event);\n }\n };\n var inputHandleChange = function inputHandleChange(event) {\n dispatch({\n type: InputChange,\n inputValue: event.target.value\n });\n };\n var inputHandleBlur = function inputHandleBlur(event) {\n /* istanbul ignore else */\n if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackers.isMouseDown) {\n var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body;\n dispatch({\n type: InputBlur,\n selectItem: !isBlurByTabChange\n });\n }\n };\n var inputHandleClick = function inputHandleClick() {\n dispatch({\n type: InputClick\n });\n };\n\n /* istanbul ignore next (preact) */\n var onChangeKey = 'onChange';\n var eventHandlers = {};\n if (!rest.disabled) {\n var _eventHandlers;\n eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onClick = callAllEventHandlers(onClick, inputHandleClick), _eventHandlers);\n }\n return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {\n inputRef.current = inputNode;\n }), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);\n }, [dispatch, elementIds, environment, inputKeyDownHandlers, latest, mouseAndTouchTrackers, setGetterPropCallInfo]);\n\n // returns\n var toggleMenu = useCallback(function () {\n dispatch({\n type: FunctionToggleMenu\n });\n }, [dispatch]);\n var closeMenu = useCallback(function () {\n dispatch({\n type: FunctionCloseMenu\n });\n }, [dispatch]);\n var openMenu = useCallback(function () {\n dispatch({\n type: FunctionOpenMenu\n });\n }, [dispatch]);\n var setHighlightedIndex = useCallback(function (newHighlightedIndex) {\n dispatch({\n type: FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex\n });\n }, [dispatch]);\n var selectItem = useCallback(function (newSelectedItem) {\n dispatch({\n type: FunctionSelectItem,\n selectedItem: newSelectedItem\n });\n }, [dispatch]);\n var setInputValue = useCallback(function (newInputValue) {\n dispatch({\n type: FunctionSetInputValue,\n inputValue: newInputValue\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset$1\n });\n }, [dispatch]);\n return {\n // prop getters.\n getItemProps: getItemProps,\n getLabelProps: getLabelProps,\n getMenuProps: getMenuProps,\n getInputProps: getInputProps,\n getToggleButtonProps: getToggleButtonProps,\n // actions.\n toggleMenu: toggleMenu,\n openMenu: openMenu,\n closeMenu: closeMenu,\n setHighlightedIndex: setHighlightedIndex,\n setInputValue: setInputValue,\n selectItem: selectItem,\n reset: reset,\n // state.\n highlightedIndex: highlightedIndex,\n isOpen: isOpen,\n selectedItem: selectedItem,\n inputValue: inputValue\n };\n}\n\nvar defaultStateValues = {\n activeIndex: -1,\n selectedItems: []\n};\n\n/**\n * Returns the initial value for a state key in the following order:\n * 1. controlled prop, 2. initial prop, 3. default prop, 4. default\n * value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getInitialValue(props, propKey) {\n return getInitialValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Returns the default value for a state key in the following order:\n * 1. controlled prop, 2. default prop, 3. default value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getDefaultValue(props, propKey) {\n return getDefaultValue$1(props, propKey, defaultStateValues);\n}\n\n/**\n * Gets the initial state based on the provided props. It uses initial, default\n * and controlled props related to state in order to compute the initial value.\n *\n * @param {Object} props Props passed to the hook.\n * @returns {Object} The initial state.\n */\nfunction getInitialState$1(props) {\n var activeIndex = getInitialValue(props, 'activeIndex');\n var selectedItems = getInitialValue(props, 'selectedItems');\n return {\n activeIndex: activeIndex,\n selectedItems: selectedItems\n };\n}\n\n/**\n * Returns true if dropdown keydown operation is permitted. Should not be\n * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on\n * input element with text content that is either highlighted or selection\n * cursor is not at the starting position.\n *\n * @param {KeyboardEvent} event The event from keydown.\n * @returns {boolean} Whether the operation is allowed.\n */\nfunction isKeyDownOperationPermitted(event) {\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false;\n }\n var element = event.target;\n if (element instanceof HTMLInputElement &&\n // if element is a text input\n element.value !== '' && (\n // and we have text in it\n // and cursor is either not at the start or is currently highlighting text.\n element.selectionStart !== 0 || element.selectionEnd !== 0)) {\n return false;\n }\n return true;\n}\n\n/**\n * Check if a state is equal for taglist, by comparing active index and selected items.\n * Used by useSelect and useCombobox.\n *\n * @param {Object} prevState\n * @param {Object} newState\n * @returns {boolean} Wheather the states are deeply equal.\n */\nfunction isStateEqual$1(prevState, newState) {\n return prevState.selectedItems === newState.selectedItems && prevState.activeIndex === newState.activeIndex;\n}\nvar propTypes$1 = {\n stateReducer: propTypes$4.stateReducer,\n itemToKey: propTypes$4.itemToKey,\n environment: propTypes$4.environment,\n selectedItems: PropTypes.array,\n initialSelectedItems: PropTypes.array,\n defaultSelectedItems: PropTypes.array,\n getA11yStatusMessage: PropTypes.func,\n activeIndex: PropTypes.number,\n initialActiveIndex: PropTypes.number,\n defaultActiveIndex: PropTypes.number,\n onActiveIndexChange: PropTypes.func,\n onSelectedItemsChange: PropTypes.func,\n keyNavigationNext: PropTypes.string,\n keyNavigationPrevious: PropTypes.string\n};\nvar defaultProps = {\n itemToKey: defaultProps$3.itemToKey,\n stateReducer: defaultProps$3.stateReducer,\n environment: defaultProps$3.environment,\n keyNavigationNext: 'ArrowRight',\n keyNavigationPrevious: 'ArrowLeft'\n};\n\n// eslint-disable-next-line import/no-mutable-exports\nvar validatePropTypes = noop;\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes = function validatePropTypes(options, caller) {\n PropTypes.checkPropTypes(propTypes$1, options, 'prop', caller.name);\n };\n}\n\nvar SelectedItemClick = process.env.NODE_ENV !== \"production\" ? '__selected_item_click__' : 0;\nvar SelectedItemKeyDownDelete = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_delete__' : 1;\nvar SelectedItemKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_backspace__' : 2;\nvar SelectedItemKeyDownNavigationNext = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_next__' : 3;\nvar SelectedItemKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__selected_item_keydown_navigation_previous__' : 4;\nvar DropdownKeyDownNavigationPrevious = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_navigation_previous__' : 5;\nvar DropdownKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__dropdown_keydown_backspace__' : 6;\nvar DropdownClick = process.env.NODE_ENV !== \"production\" ? '__dropdown_click__' : 7;\nvar FunctionAddSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_add_selected_item__' : 8;\nvar FunctionRemoveSelectedItem = process.env.NODE_ENV !== \"production\" ? '__function_remove_selected_item__' : 9;\nvar FunctionSetSelectedItems = process.env.NODE_ENV !== \"production\" ? '__function_set_selected_items__' : 10;\nvar FunctionSetActiveIndex = process.env.NODE_ENV !== \"production\" ? '__function_set_active_index__' : 11;\nvar FunctionReset = process.env.NODE_ENV !== \"production\" ? '__function_reset__' : 12;\n\nvar stateChangeTypes$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n DropdownClick: DropdownClick,\n DropdownKeyDownBackspace: DropdownKeyDownBackspace,\n DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,\n FunctionAddSelectedItem: FunctionAddSelectedItem,\n FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,\n FunctionReset: FunctionReset,\n FunctionSetActiveIndex: FunctionSetActiveIndex,\n FunctionSetSelectedItems: FunctionSetSelectedItems,\n SelectedItemClick: SelectedItemClick,\n SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,\n SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,\n SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,\n SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious\n});\n\n/* eslint-disable complexity */\nfunction downshiftMultipleSelectionReducer(state, props, action) {\n var type = action.type,\n index = action.index,\n selectedItem = action.selectedItem;\n var activeIndex = state.activeIndex,\n selectedItems = state.selectedItems;\n var changes;\n switch (type) {\n case SelectedItemClick:\n changes = {\n activeIndex: index\n };\n break;\n case SelectedItemKeyDownNavigationPrevious:\n changes = {\n activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1\n };\n break;\n case SelectedItemKeyDownNavigationNext:\n changes = {\n activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1\n };\n break;\n case SelectedItemKeyDownBackspace:\n case SelectedItemKeyDownDelete:\n {\n if (activeIndex < 0) {\n break;\n }\n var newActiveIndex = activeIndex;\n if (selectedItems.length === 1) {\n newActiveIndex = -1;\n } else if (activeIndex === selectedItems.length - 1) {\n newActiveIndex = selectedItems.length - 2;\n }\n changes = _extends({\n selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))\n }, {\n activeIndex: newActiveIndex\n });\n break;\n }\n case DropdownKeyDownNavigationPrevious:\n changes = {\n activeIndex: selectedItems.length - 1\n };\n break;\n case DropdownKeyDownBackspace:\n changes = {\n selectedItems: selectedItems.slice(0, selectedItems.length - 1)\n };\n break;\n case FunctionAddSelectedItem:\n changes = {\n selectedItems: [].concat(selectedItems, [selectedItem])\n };\n break;\n case DropdownClick:\n changes = {\n activeIndex: -1\n };\n break;\n case FunctionRemoveSelectedItem:\n {\n var _newActiveIndex = activeIndex;\n var selectedItemIndex = selectedItems.findIndex(function (item) {\n return props.itemToKey(item) === props.itemToKey(selectedItem);\n });\n if (selectedItemIndex < 0) {\n break;\n }\n if (selectedItems.length === 1) {\n _newActiveIndex = -1;\n } else if (selectedItemIndex === selectedItems.length - 1) {\n _newActiveIndex = selectedItems.length - 2;\n }\n changes = {\n selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)),\n activeIndex: _newActiveIndex\n };\n break;\n }\n case FunctionSetSelectedItems:\n {\n var newSelectedItems = action.selectedItems;\n changes = {\n selectedItems: newSelectedItems\n };\n break;\n }\n case FunctionSetActiveIndex:\n {\n var _newActiveIndex2 = action.activeIndex;\n changes = {\n activeIndex: _newActiveIndex2\n };\n break;\n }\n case FunctionReset:\n changes = {\n activeIndex: getDefaultValue(props, 'activeIndex'),\n selectedItems: getDefaultValue(props, 'selectedItems')\n };\n break;\n default:\n throw new Error('Reducer called without proper action type.');\n }\n return _extends({}, state, changes);\n}\n\nvar _excluded$1 = [\"refKey\", \"ref\", \"onClick\", \"onKeyDown\", \"selectedItem\", \"index\"],\n _excluded2$1 = [\"refKey\", \"ref\", \"onKeyDown\", \"onClick\", \"preventKeyAction\"];\nuseMultipleSelection.stateChangeTypes = stateChangeTypes$1;\nfunction useMultipleSelection(userProps) {\n if (userProps === void 0) {\n userProps = {};\n }\n validatePropTypes(userProps, useMultipleSelection);\n // Props defaults and destructuring.\n var props = _extends({}, defaultProps, userProps);\n var getA11yStatusMessage = props.getA11yStatusMessage,\n environment = props.environment,\n keyNavigationNext = props.keyNavigationNext,\n keyNavigationPrevious = props.keyNavigationPrevious;\n\n // Reducer init.\n var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, props, getInitialState$1, isStateEqual$1),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var activeIndex = state.activeIndex,\n selectedItems = state.selectedItems;\n\n // Refs.\n var isInitialMount = useIsInitialMount();\n var dropdownRef = useRef(null);\n var selectedItemRefs = useRef();\n selectedItemRefs.current = [];\n var latest = useLatestRef({\n state: state,\n props: props\n });\n\n // Effects.\n // Adds an a11y aria live status message if getA11yStatusMessage is passed.\n useA11yMessageStatus(getA11yStatusMessage, state, [activeIndex, selectedItems], environment);\n // Sets focus on active item.\n useEffect(function () {\n if (isInitialMount) {\n return;\n }\n if (activeIndex === -1 && dropdownRef.current) {\n dropdownRef.current.focus();\n } else if (selectedItemRefs.current[activeIndex]) {\n selectedItemRefs.current[activeIndex].focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [activeIndex]);\n useControlPropsValidator({\n props: props,\n state: state\n });\n var setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps');\n\n // Event handler functions.\n var selectedItemKeyDownHandlers = useMemo(function () {\n var _ref;\n return _ref = {}, _ref[keyNavigationPrevious] = function () {\n dispatch({\n type: SelectedItemKeyDownNavigationPrevious\n });\n }, _ref[keyNavigationNext] = function () {\n dispatch({\n type: SelectedItemKeyDownNavigationNext\n });\n }, _ref.Delete = function Delete() {\n dispatch({\n type: SelectedItemKeyDownDelete\n });\n }, _ref.Backspace = function Backspace() {\n dispatch({\n type: SelectedItemKeyDownBackspace\n });\n }, _ref;\n }, [dispatch, keyNavigationNext, keyNavigationPrevious]);\n var dropdownKeyDownHandlers = useMemo(function () {\n var _ref2;\n return _ref2 = {}, _ref2[keyNavigationPrevious] = function (event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: DropdownKeyDownNavigationPrevious\n });\n }\n }, _ref2.Backspace = function Backspace(event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: DropdownKeyDownBackspace\n });\n }\n }, _ref2;\n }, [dispatch, keyNavigationPrevious]);\n\n // Getter props.\n var getSelectedItemProps = useCallback(function (_temp) {\n var _extends2;\n var _ref3 = _temp === void 0 ? {} : _temp,\n _ref3$refKey = _ref3.refKey,\n refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,\n ref = _ref3.ref,\n onClick = _ref3.onClick,\n onKeyDown = _ref3.onKeyDown,\n selectedItemProp = _ref3.selectedItem,\n indexProp = _ref3.index,\n rest = _objectWithoutPropertiesLoose(_ref3, _excluded$1);\n var latestState = latest.current.state;\n var _getItemAndIndex = getItemAndIndex(selectedItemProp, indexProp, latestState.selectedItems, 'Pass either item or index to getSelectedItemProps!'),\n index = _getItemAndIndex[1];\n var isFocusable = index > -1 && index === latestState.activeIndex;\n var selectedItemHandleClick = function selectedItemHandleClick() {\n dispatch({\n type: SelectedItemClick,\n index: index\n });\n };\n var selectedItemHandleKeyDown = function selectedItemHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && selectedItemKeyDownHandlers[key]) {\n selectedItemKeyDownHandlers[key](event);\n }\n };\n return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (selectedItemNode) {\n if (selectedItemNode) {\n selectedItemRefs.current.push(selectedItemNode);\n }\n }), _extends2.tabIndex = isFocusable ? 0 : -1, _extends2.onClick = callAllEventHandlers(onClick, selectedItemHandleClick), _extends2.onKeyDown = callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends2), rest);\n }, [dispatch, latest, selectedItemKeyDownHandlers]);\n var getDropdownProps = useCallback(function (_temp2, _temp3) {\n var _extends3;\n var _ref4 = _temp2 === void 0 ? {} : _temp2,\n _ref4$refKey = _ref4.refKey,\n refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,\n ref = _ref4.ref,\n onKeyDown = _ref4.onKeyDown,\n onClick = _ref4.onClick,\n _ref4$preventKeyActio = _ref4.preventKeyAction,\n preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,\n rest = _objectWithoutPropertiesLoose(_ref4, _excluded2$1);\n var _ref5 = _temp3 === void 0 ? {} : _temp3,\n _ref5$suppressRefErro = _ref5.suppressRefError,\n suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;\n setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);\n var dropdownHandleKeyDown = function dropdownHandleKeyDown(event) {\n var key = normalizeArrowKey(event);\n if (key && dropdownKeyDownHandlers[key]) {\n dropdownKeyDownHandlers[key](event);\n }\n };\n var dropdownHandleClick = function dropdownHandleClick() {\n dispatch({\n type: DropdownClick\n });\n };\n return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (dropdownNode) {\n if (dropdownNode) {\n dropdownRef.current = dropdownNode;\n }\n }), _extends3), !preventKeyAction && {\n onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),\n onClick: callAllEventHandlers(onClick, dropdownHandleClick)\n }, rest);\n }, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]);\n\n // returns\n var addSelectedItem = useCallback(function (selectedItem) {\n dispatch({\n type: FunctionAddSelectedItem,\n selectedItem: selectedItem\n });\n }, [dispatch]);\n var removeSelectedItem = useCallback(function (selectedItem) {\n dispatch({\n type: FunctionRemoveSelectedItem,\n selectedItem: selectedItem\n });\n }, [dispatch]);\n var setSelectedItems = useCallback(function (newSelectedItems) {\n dispatch({\n type: FunctionSetSelectedItems,\n selectedItems: newSelectedItems\n });\n }, [dispatch]);\n var setActiveIndex = useCallback(function (newActiveIndex) {\n dispatch({\n type: FunctionSetActiveIndex,\n activeIndex: newActiveIndex\n });\n }, [dispatch]);\n var reset = useCallback(function () {\n dispatch({\n type: FunctionReset\n });\n }, [dispatch]);\n return {\n getSelectedItemProps: getSelectedItemProps,\n getDropdownProps: getDropdownProps,\n addSelectedItem: addSelectedItem,\n removeSelectedItem: removeSelectedItem,\n setSelectedItems: setSelectedItems,\n setActiveIndex: setActiveIndex,\n reset: reset,\n selectedItems: selectedItems,\n activeIndex: activeIndex\n };\n}\n\nvar TagClick = process.env.NODE_ENV !== \"production\" ? '__tag_click__' : 0;\nvar TagGroupKeyDownArrowLeft = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_arrowleft__' : 1;\nvar TagGroupKeyDownArrowRight = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_arrowright__' : 2;\nvar TagGroupKeyDownDelete = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_delete__' : 3;\nvar TagGroupKeyDownBackspace = process.env.NODE_ENV !== \"production\" ? '__taggroup_keydown_backspace__' : 4;\nvar TagRemoveClick = process.env.NODE_ENV !== \"production\" ? '__tagremove_click__' : 5;\nvar FunctionAddItem = process.env.NODE_ENV !== \"production\" ? '__function_add_item__' : 6;\n\nvar stateChangeTypes = /*#__PURE__*/Object.freeze({\n __proto__: null,\n FunctionAddItem: FunctionAddItem,\n TagClick: TagClick,\n TagGroupKeyDownArrowLeft: TagGroupKeyDownArrowLeft,\n TagGroupKeyDownArrowRight: TagGroupKeyDownArrowRight,\n TagGroupKeyDownBackspace: TagGroupKeyDownBackspace,\n TagGroupKeyDownDelete: TagGroupKeyDownDelete,\n TagRemoveClick: TagRemoveClick\n});\n\nfunction useTagGroupReducer(state, _props, action) {\n var type = action.type;\n var changes;\n switch (type) {\n case TagClick:\n changes = {\n activeIndex: action.index\n };\n break;\n case TagGroupKeyDownArrowLeft:\n changes = {\n activeIndex: state.activeIndex === 0 ? state.items.length - 1 : state.activeIndex - 1\n };\n break;\n case TagGroupKeyDownArrowRight:\n changes = {\n activeIndex: state.activeIndex === state.items.length - 1 ? 0 : state.activeIndex + 1\n };\n break;\n case TagGroupKeyDownBackspace:\n case TagGroupKeyDownDelete:\n {\n var newItems = [].concat(state.items.slice(0, state.activeIndex), state.items.slice(state.activeIndex + 1));\n var newActiveIndex = newItems.length === 0 ? -1 : newItems.length === state.activeIndex ? state.activeIndex - 1 : state.activeIndex;\n changes = {\n items: [].concat(state.items.slice(0, state.activeIndex), state.items.slice(state.activeIndex + 1)),\n activeIndex: newActiveIndex\n };\n break;\n }\n case TagRemoveClick:\n {\n var _newItems = [].concat(state.items.slice(0, action.index), state.items.slice(action.index + 1));\n var _newActiveIndex = _newItems.length === 0 ? -1 : _newItems.length === action.index ? action.index - 1 : action.index;\n changes = {\n items: _newItems,\n activeIndex: _newActiveIndex\n };\n }\n break;\n case FunctionAddItem:\n {\n var _newItems2 = [];\n if (action.index === undefined) {\n _newItems2 = [].concat(state.items, [action.item]);\n } else {\n _newItems2 = [].concat(state.items.slice(0, action.index), [action.item], state.items.slice(action.index));\n }\n var _newActiveIndex2 = state.activeIndex === -1 ? _newItems2.length - 1 : state.activeIndex;\n changes = {\n items: _newItems2,\n activeIndex: _newActiveIndex2\n };\n break;\n }\n default:\n throw new Error('Invalid useTagGroup reducer action.');\n }\n return _extends({}, state, changes);\n}\n\n// https://github.com/downshift-js/downshift/issues/1674#issuecomment-3924320872\nvar SafeReact = _extends({}, React);\nvar reactUseId = SafeReact.useId;\n\n// istanbul ignore next\nvar useElementIds = typeof reactUseId === 'function' ? useElementIdsR18 : useElementIdsLegacy;\nfunction useElementIdsR18(_ref) {\n var id = _ref.id,\n tagGroupId = _ref.tagGroupId,\n getTagId = _ref.getTagId;\n var reactId = \"downshift-\" + reactUseId();\n if (!id) {\n id = reactId;\n }\n var elementIds = React.useMemo(function () {\n return {\n tagGroupId: tagGroupId != null ? tagGroupId : id + \"-tag-group\",\n getTagId: getTagId != null ? getTagId : function (index) {\n return id + \"-tag-\" + index;\n }\n };\n }, [getTagId, id, tagGroupId]);\n return elementIds;\n}\nfunction useElementIdsLegacy(_ref2) {\n var id = _ref2.id,\n getTagId = _ref2.getTagId,\n tagGroupId = _ref2.tagGroupId;\n var baseIdRef = React.useRef(id != null ? id : \"downshift-\" + generateId());\n var baseId = baseIdRef.current;\n var elementIds = React.useMemo(function () {\n return {\n tagGroupId: tagGroupId != null ? tagGroupId : baseId + \"-tag-group\",\n getTagId: getTagId != null ? getTagId : function (index) {\n return baseId + \"-tag-\" + index;\n }\n };\n }, [getTagId, baseId, tagGroupId]);\n return elementIds;\n}\n\nfunction getInitialState(props) {\n var _ref, _props$items, _ref2, _props$activeIndex;\n var items = (_ref = (_props$items = props.items) != null ? _props$items : props.initialItems) != null ? _ref : [];\n var activeIndex = (_ref2 = (_props$activeIndex = props.activeIndex) != null ? _props$activeIndex : props.initialActiveIndex) != null ? _ref2 : items.length === 0 ? -1 : 0;\n return {\n activeIndex: activeIndex,\n items: items\n };\n}\n\nfunction isStateEqual(oldState, newState) {\n return oldState.activeIndex === newState.activeIndex && oldState.items === newState.items;\n}\n\nvar A11Y_DESCRIPTION_ELEMENT_ID = 'tag-group-a11y-description';\nfunction useAccessibleDescription(document, description) {\n React.useEffect(function () {\n if (!document) {\n return;\n }\n var accessibleDescriptionElement = document.createElement('div');\n accessibleDescriptionElement.setAttribute('id', A11Y_DESCRIPTION_ELEMENT_ID);\n accessibleDescriptionElement.style.display = 'none';\n accessibleDescriptionElement.textContent = description;\n document.body.appendChild(accessibleDescriptionElement);\n return function () {\n accessibleDescriptionElement.remove();\n };\n }, [description, document]);\n}\n\nfunction getMergedProps(userProps) {\n return _extends({\n stateReducer: function stateReducer(_s, _ref) {\n var changes = _ref.changes;\n return changes;\n },\n environment: /* istanbul ignore next (ssr) */\n typeof window === 'undefined' || false ? undefined : window,\n removeElementDescription: 'Press Delete or Backspace to remove tag.'\n }, userProps);\n}\n\n/**\n * Focuses the tag at activeIndex when it changes or when an item is removed.\n */\nfunction useRovingTagFocus(activeIndex, itemsLength, getTagId) {\n var itemRefs = React.useRef({});\n var previousActiveIndexRef = React.useRef(activeIndex);\n var previousItemsLengthRef = React.useRef(itemsLength);\n React.useEffect(function () {\n if (activeIndex !== -1 && previousActiveIndexRef.current !== -1 && activeIndex !== previousActiveIndexRef.current || previousItemsLengthRef.current === itemsLength + 1) {\n var _itemRefs$current$get;\n (_itemRefs$current$get = itemRefs.current[getTagId(activeIndex)]) == null || _itemRefs$current$get.focus();\n }\n previousActiveIndexRef.current = activeIndex;\n previousItemsLengthRef.current = itemsLength;\n }, [activeIndex, getTagId, itemsLength]);\n return itemRefs;\n}\n\nvar propTypes = {\n isItemDisabled: PropTypes.func\n};\n\nvar _excluded = [\"onKeyDown\"],\n _excluded2 = [\"index\", \"refKey\", \"ref\", \"onClick\"],\n _excluded3 = [\"index\", \"onClick\"];\nvar _useTagGroup = function useTagGroup(userProps) {\n var _props$environment;\n if (userProps === void 0) {\n userProps = {};\n }\n /* State and Props */\n\n validatePropTypes$1(userProps, _useTagGroup, propTypes);\n var props = getMergedProps(userProps);\n var _useControlledReducer = useControlledReducer$1(useTagGroupReducer, props, getInitialState, isStateEqual),\n state = _useControlledReducer[0],\n dispatch = _useControlledReducer[1];\n var activeIndex = state.activeIndex,\n items = state.items;\n\n /* Refs */\n\n var latest = useLatestRef({\n state: state,\n props: props\n });\n var elementIds = useElementIds({\n getTagId: props.getTagId,\n id: props.id,\n tagGroupId: props.tagGroupId\n });\n\n /* Effects */\n\n useAccessibleDescription((_props$environment = props.environment) == null ? void 0 : _props$environment.document, props.removeElementDescription);\n var itemRefs = useRovingTagFocus(activeIndex, items.length, elementIds.getTagId);\n\n /* Getter functions */\n\n var getTagGroupProps = useCallback(function (options) {\n var _ref = options != null ? options : {},\n onKeyDown = _ref.onKeyDown,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n var handleKeyDown = function handleKeyDown(e) {\n switch (e.key) {\n case 'ArrowLeft':\n dispatch({\n type: TagGroupKeyDownArrowLeft\n });\n break;\n case 'ArrowRight':\n dispatch({\n type: TagGroupKeyDownArrowRight\n });\n break;\n case 'Delete':\n dispatch({\n type: TagGroupKeyDownDelete\n });\n break;\n case 'Backspace':\n dispatch({\n type: TagGroupKeyDownBackspace\n });\n break;\n }\n };\n var tagGroupProps = _extends({\n id: elementIds.tagGroupId,\n 'aria-live': 'polite',\n 'aria-atomic': 'false',\n 'aria-relevant': 'additions',\n role: 'listbox',\n onKeyDown: callAllEventHandlers$1(onKeyDown, handleKeyDown)\n }, rest);\n return tagGroupProps;\n }, [dispatch, elementIds.tagGroupId]);\n var getTagProps = useCallback(function (options) {\n var _extends2;\n var index = options.index,\n _options$refKey = options.refKey,\n refKey = _options$refKey === void 0 ? 'ref' : _options$refKey,\n ref = options.ref,\n onClick = options.onClick,\n rest = _objectWithoutPropertiesLoose(options, _excluded2);\n if (!Number.isInteger(index) || index < 0) {\n throw new Error('Pass correct item index to getTagProps!');\n }\n var latestState = latest.current.state;\n var handleClick = function handleClick() {\n dispatch({\n type: TagClick,\n index: index\n });\n };\n var tagId = elementIds.getTagId(index);\n return _extends((_extends2 = {\n 'aria-describedby': A11Y_DESCRIPTION_ELEMENT_ID\n }, _extends2[refKey] = handleRefs$1(ref, function (itemNode) {\n if (itemNode) {\n itemRefs.current[tagId] = itemNode;\n }\n }), _extends2['aria-labelledby'] = tagId, _extends2.role = 'option', _extends2.id = tagId, _extends2.onClick = callAllEventHandlers$1(onClick, handleClick), _extends2.tabIndex = latestState.activeIndex === index ? 0 : -1, _extends2), rest);\n }, [dispatch, elementIds, latest, itemRefs]);\n var getTagRemoveProps = useCallback(function (options) {\n var index = options.index,\n onClick = options.onClick,\n rest = _objectWithoutPropertiesLoose(options, _excluded3);\n if (!Number.isInteger(index) || index < 0) {\n throw new Error('Pass correct item index to getTagRemoveProps!');\n }\n var handleClick = function handleClick(event) {\n event.stopPropagation();\n dispatch({\n type: TagRemoveClick,\n index: index\n });\n };\n var tagId = elementIds.getTagId(index);\n var tagRemoveId = tagId + \"-remove\";\n return _extends({\n id: tagRemoveId,\n tabIndex: -1,\n 'aria-labelledby': tagRemoveId + \" \" + tagId,\n onClick: callAllEventHandlers$1(onClick, handleClick)\n }, rest);\n }, [elementIds, dispatch]);\n\n /* Imperative Functions */\n\n var addItem = useCallback(function (item, index) {\n dispatch({\n type: FunctionAddItem,\n item: item,\n index: index\n });\n }, [dispatch]);\n return {\n activeIndex: activeIndex,\n addItem: addItem,\n getTagGroupProps: getTagGroupProps,\n getTagProps: getTagProps,\n getTagRemoveProps: getTagRemoveProps,\n items: items\n };\n};\n_useTagGroup.stateChangeTypes = stateChangeTypes;\n\nexport { Downshift as default, resetIdCounter, useCombobox, useMultipleSelection, useSelect, _useTagGroup as useTagGroup };\n","/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing. The function also has a property 'clear' \n * that is a function which will clear the timer to prevent previously scheduled executions. \n *\n * @source underscore.js\n * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n * @param {Function} function to wrap\n * @param {Number} timeout in ms (`100`)\n * @param {Boolean} whether to execute at the beginning (`false`)\n * @api public\n */\nfunction debounce(func, wait, immediate){\n var timeout, args, context, timestamp, result;\n if (null == wait) wait = 100;\n\n function later() {\n var last = Date.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n context = args = null;\n }\n }\n };\n\n var debounced = function(){\n context = this;\n args = arguments;\n timestamp = Date.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n\n debounced.clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n \n debounced.flush = function() {\n if (timeout) {\n result = func.apply(context, args);\n context = args = null;\n \n clearTimeout(timeout);\n timeout = null;\n }\n };\n\n return debounced;\n};\n\n// Adds compatibility for ES modules\ndebounce.debounce = debounce;\n\nmodule.exports = debounce;\n","import type React from \"react\";\nimport { Children, useEffect, useMemo } from \"react\";\n\nimport {\n useSearchRanking,\n calculateDistance,\n getDistanceUnit,\n formatDistance,\n} from \"@jslib/OrgSearch\";\n\nimport { getLocaleSafely } from \"@/lib/intl/intl\";\n\nimport { type Organization } from \"../../lib/types/types\";\nimport { useFlag } from \"../FeatureFlags/hooks\";\n\ninterface OrganizationListProps {\n getItemProps: any;\n highlightedIndex: number;\n itemToString: any;\n organizations: Organization[];\n children: React.ReactNode;\n maxItemsToDisplay?: number; // eslint-disable-line\n // Next line is deprecated. Menu is always mounted now, up in TypeaheadComponent.\n getMenuProps?: any; // eslint-disable-line\n}\n\nconst ROW_HEIGHT = 42;\nconst MAX_ITEMS = 26;\n\nconst OrganizationList = ({\n getItemProps,\n highlightedIndex,\n organizations,\n itemToString,\n children,\n maxItemsToDisplay = MAX_ITEMS,\n}: OrganizationListProps) => {\n const childrenCount = Children.count(children);\n const fullHeight = (organizations.length + childrenCount) * ROW_HEIGHT;\n const itemRefs = {};\n const overlayEnabled = useFlag(\"org-search-overlay\") === \"overlay\";\n const searchRanking = useSearchRanking();\n const locale = getLocaleSafely();\n\n // Get user's locale for distance unit preference\n const distanceUnit = useMemo(() => getDistanceUnit(locale), [locale]);\n\n const getDistanceDisplay = (organization: Organization): string | null => {\n if (!searchRanking?.userLocation) return null;\n if (organization.latitude == null || organization.longitude == null) return null;\n\n const distanceKm = calculateDistance(\n searchRanking.userLocation.latitude,\n searchRanking.userLocation.longitude,\n organization.latitude,\n organization.longitude,\n );\n\n return formatDistance(distanceKm, distanceUnit);\n };\n\n useEffect(() => {\n const elem = document\n .getElementsByClassName(\"sid-organization-list__item--highlighted\")\n .item(0);\n if (elem) {\n // elem.scrollIntoViewIfNeeded is nonstandard but has a better\n // experience, particularly on mobile browsers. So try it first.\n if (\"scrollIntoViewIfNeeded\" in elem && typeof elem.scrollIntoViewIfNeeded === \"function\") {\n elem.scrollIntoViewIfNeeded(true);\n } else {\n elem.scrollIntoView({ behavior: \"instant\", block: \"center\" });\n }\n }\n }, [highlightedIndex]);\n\n const item = (organization: Organization, index: number) => {\n const location = [organization.city, organization.state].filter(Boolean).join(\", \");\n const distanceDisplay = getDistanceDisplay(organization);\n\n return (\n <div\n className={`sid-organization-list__item ${\n highlightedIndex === index ? \"sid-organization-list__item--highlighted\" : \"\"\n }`}\n key={index}\n role=\"option\"\n aria-selected={highlightedIndex === index}\n {...getItemProps({\n index,\n item: organization,\n })}\n ref={itemRefs[highlightedIndex]}\n >\n <span className=\"sid-organization-list__name\">{itemToString(organization)}</span>\n {overlayEnabled && location && (\n <span className=\"sid-organization-list__location\">{location}</span>\n )}\n {distanceDisplay && (\n <span className=\"sid-organization-list__distance\" data-testid=\"org-distance\">\n {distanceDisplay}\n </span>\n )}\n </div>\n );\n };\n\n return (\n <div\n id=\"sid-org-list-menu\"\n className=\"sid-organization-list__menu\"\n tabIndex={-1}\n role=\"listbox\"\n >\n <div style={{ height: Math.min(fullHeight, 280) }}>\n {organizations\n .filter((_, index) => index <= maxItemsToDisplay - 1)\n .map((organization, index) => item(organization, index))}\n {children}\n </div>\n </div>\n );\n};\n\nexport const OrganizationListComponent = OrganizationList;\n","import React, { useState, useEffect, useRef, useCallback } from \"react\";\nimport { FormattedHTMLMessage } from \"react-intl\";\nimport { debounce } from \"debounce\";\n\nimport { logger } from \"@jslib/shared/utils/logger\";\nimport { useSearchRanking } from \"@jslib/OrgSearch\";\n\nimport { fetchOrganization } from \"../lib/ServerApi/OrganizationApiClient\";\nimport { type OrganizationSearchResp, type DatabaseId, type Locale } from \"../lib/types/types\";\nimport { DEBOUNCE_TIMEOUT, DEFAULT_LOCALE } from \"../constants\";\nimport { EventName, type OrgsDisplayedEvent, recordGaEvent } from \"../lib/GoogleAnalytics/ga\";\nimport { getQueryParam } from \"../lib/utils/routing/Url\";\n\nimport { LinkExternal } from \"./LinkExternal\";\nimport { LoadingSpinnerComponent } from \"./LoadingSpinner/LoadingSpinnerComponent\";\nimport { OrganizationListComponent } from \"./OrganizationList/OrganizationListComponent\";\nimport { MetricIds, useMetrics } from \"./FeatureFlags/useMetrics\";\n\ninterface FetchOrganizationsProps {\n getItemProps: any;\n highlightedIndex: any;\n itemToString: any;\n minimumSearchValueLength: number;\n onLoaded: any;\n programId: DatabaseId;\n orgSearchUrl?: string;\n locale?: Locale;\n urlAddSchoolForm?: string;\n openOrgSearchEnabled?: boolean;\n onClickAddSchool?: () => void;\n onTipsShown?: () => void;\n // optional search params that are set before the query is sent\n searchUrlParams?: Record<string, string>;\n /** @deprecated */\n // eslint-disable-next-line react/no-unused-prop-types\n countryCode?: string;\n /** @deprecated orgSearchTags has no affect, pass a full orgSearchUrl, instead */\n // eslint-disable-next-line react/no-unused-prop-types\n orgSearchTags?: string;\n /** @deprecated pass a complete orgSearchUrl instead, using the `name` parameter with a value of what you would have given `searchValue` */\n searchValue?: string;\n /** @deprecated. Menu is always mounted now, up in TypeaheadComponent. */\n getMenuProps?: any;\n}\n\ntype AddSchoolRequestRowProps = {\n programId: DatabaseId;\n locale: Locale;\n urlAddSchoolForm: string;\n onClick?: () => void;\n onTipsShown?: () => void;\n};\n\nconst LightbulbIcon: React.FC<{ className?: string }> = ({ className }) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className={className}\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18\"\n />\n </svg>\n);\n\nconst AddSchoolRequestRow: React.FC<AddSchoolRequestRowProps> = ({\n urlAddSchoolForm,\n programId,\n locale = DEFAULT_LOCALE,\n onClick = () => undefined,\n onTipsShown,\n}: AddSchoolRequestRowProps) => {\n const [shouldShowTips, setShouldShowTips] = React.useState(false);\n const { trackEvent } = useMetrics({ programId });\n\n const handleOnClick = () => {\n recordGaEvent({\n eventName: EventName.ASR_TIPS_SHOWN,\n params: { programId, locale },\n });\n trackEvent(MetricIds.AsrTipsShown);\n // Notify parent that tips are now shown\n onTipsShown?.();\n\n setShouldShowTips(true);\n };\n\n if (shouldShowTips) {\n return (\n <div className=\"sid-organization-list__add-school-tips\">\n <div className=\"sid-organization-list__tips\">\n <div>\n <LightbulbIcon className=\"sid-organization-list__tips-icon\" />\n </div>\n\n <div className=\"sid-organization-list__tips-text\">\n <FormattedHTMLMessage\n id=\"multipleLocationsTips\"\n defaultMessage=\"If your academic institution has multiple locations and you didn't see yours, enter the main location.\"\n />\n <FormattedHTMLMessage\n id=\"tryFullNameTips\"\n defaultMessage=\"Try typing the full name of the academic institution rather than using acronyms or abbreviations.\"\n />\n </div>\n </div>\n\n <LinkExternal\n onClick={onClick}\n className=\"sid-organization-list__item sid-organization-list__request-school sid-link\"\n href={`${urlAddSchoolForm}?pid=${programId}&locale=${locale}`}\n >\n <FormattedHTMLMessage\n id=\"requestSchool\"\n defaultMessage=\"Don't see your school? Request to have it added\"\n />\n </LinkExternal>\n </div>\n );\n }\n\n return (\n <LinkExternal\n onClick={handleOnClick}\n className=\"sid-organization-list__item sid-organization-list__request-school sid-link\"\n >\n <FormattedHTMLMessage\n id=\"cantFindYourSchool\"\n defaultMessage=\"Can't find your school? Click to show tips\"\n />\n </LinkExternal>\n );\n};\n\nconst getSearchValue = (orgSearchUrl: string): string => getQueryParam(\"name\", orgSearchUrl) || \"\";\n\nexport const getAttribution = (organizations: OrganizationSearchResp): React.ReactNode => {\n if (!organizations) {\n return null;\n }\n\n // When organization results are provided by Google Place, Google requires their logo be presented as attribution.\n // org.source denotes where the organization data is coming from, in case of Google Place, it is \"PLACE\".\n const requiresGooglePlaceAttribution = organizations.find((org) => org.source === \"PLACE\");\n if (requiresGooglePlaceAttribution) {\n return (\n <img\n className=\"sid-organization-list__attribution-logo\"\n src=\"https://developers.google.com/static/maps/documentation/images/google_on_white.png\"\n alt=\"Google\"\n />\n );\n }\n return null;\n};\n\n/**\n * Support deprecated prop \"searchValue\"\n * @TODO remove searchValue prop and this function in v2\n * @param orgSearchUrl\n */\nexport const updateSearchUrl = (\n orgSearchUrl: string,\n searchValue: string,\n newParams?: Record<string, string>,\n): string => {\n if (!searchValue && !newParams) {\n return orgSearchUrl;\n }\n if (!orgSearchUrl) {\n logger.error(\"Expected orgSearchUrl\");\n return orgSearchUrl;\n }\n\n try {\n const url = new URL(orgSearchUrl);\n const { origin, pathname, search } = url;\n const params = new URLSearchParams(search);\n if (searchValue) {\n params.set(\"name\", searchValue);\n }\n if (newParams) {\n Object.entries(newParams).forEach(([k, v]) => {\n params.set(k, v);\n });\n }\n params.sort();\n return `${origin}${pathname}?${params.toString()}`;\n } catch (e) {\n logger.error(e);\n }\n};\n\nconst FetchOrganizations: React.FC<FetchOrganizationsProps> = ({\n getItemProps,\n getMenuProps,\n highlightedIndex,\n itemToString,\n minimumSearchValueLength,\n onLoaded,\n programId,\n orgSearchUrl,\n locale,\n urlAddSchoolForm,\n openOrgSearchEnabled,\n onClickAddSchool,\n onTipsShown,\n searchUrlParams,\n searchValue,\n}) => {\n const [loading, setLoading] = useState(false);\n const [organizations, setOrganizations] = useState<OrganizationSearchResp>(null);\n const [isErrored, setIsErrored] = useState<string>(null);\n const mountedRef = useRef(false);\n const prevSearchTermRef = useRef<string>(null);\n\n const searchRanking = useSearchRanking();\n\n // Store props in refs so debounced fetch always uses latest values (like this.props in class)\n const propsRef = useRef({ orgSearchUrl, searchValue, searchUrlParams, onLoaded });\n propsRef.current = { orgSearchUrl, searchValue, searchUrlParams, onLoaded };\n\n // Store search ranking in ref for debounced fetch\n const searchRankingRef = useRef(searchRanking);\n searchRankingRef.current = searchRanking;\n\n const searchTerm = searchValue || getSearchValue(orgSearchUrl) || \"\";\n\n // Stable fetch function that reads from refs (like this.fetch in class component)\n const doFetch = useCallback(async () => {\n if (!mountedRef.current) {\n return;\n }\n\n const {\n orgSearchUrl: url,\n searchValue: sv,\n searchUrlParams: params,\n onLoaded: loaded,\n } = propsRef.current;\n\n // Build params including location if distance sorting is enabled\n let fetchParams = params;\n const ranking = searchRankingRef.current;\n if (ranking && ranking.sortMode === \"distance\" && ranking.userLocation) {\n fetchParams = {\n ...params,\n lat: String(ranking.userLocation.latitude),\n long: String(ranking.userLocation.longitude),\n };\n }\n\n const start = Date.now();\n const fetchedOrganizations: OrganizationSearchResp = await fetchOrganization(\n updateSearchUrl(url, sv, fetchParams),\n );\n\n if (!mountedRef.current) {\n return;\n }\n\n if (fetchedOrganizations) {\n loaded(fetchedOrganizations);\n setOrganizations(fetchedOrganizations);\n setLoading(false);\n }\n\n try {\n const currentSearchTerm = sv || getSearchValue(url) || \"\";\n const event: OrgsDisplayedEvent = {\n eventName: EventName.ORGS_DISPLAYED,\n params: {\n queryLength: currentSearchTerm.length,\n eventDuration: Date.now() - start,\n numberOfResults: fetchedOrganizations?.length,\n },\n };\n recordGaEvent(event);\n } catch (e) {\n logger.error(e);\n }\n }, []); // No dependencies - reads from refs\n\n // Create a stable debounced function once\n const debouncedFetchRef = useRef<ReturnType<typeof debounce>>(null);\n if (!debouncedFetchRef.current) {\n debouncedFetchRef.current = debounce(doFetch, DEBOUNCE_TIMEOUT);\n }\n\n // Handle mount/unmount\n useEffect(() => {\n mountedRef.current = true;\n\n return () => {\n mountedRef.current = false;\n if (debouncedFetchRef.current) {\n debouncedFetchRef.current.clear();\n }\n };\n }, []);\n\n // Handle search term changes (replaces componentDidMount and componentDidUpdate logic)\n useEffect(() => {\n const prevSearchTerm = prevSearchTermRef.current;\n\n // On mount or when search term changes\n if (prevSearchTerm !== searchTerm) {\n if (searchTerm.length >= minimumSearchValueLength) {\n // Reset state and trigger fetch\n setIsErrored(null);\n setLoading(true);\n setOrganizations(null);\n if (debouncedFetchRef.current) {\n debouncedFetchRef.current();\n }\n } else {\n // Reset state without fetching\n setIsErrored(null);\n setLoading(false);\n setOrganizations(null);\n if (prevSearchTerm !== null) {\n // Only log on updates, not initial mount with short search term\n logger.info(\n `No organizations fetched. Search searchTterm \"${searchTerm}\" is less than ${minimumSearchValueLength} characters.`,\n );\n } else if (searchTerm.length > 0) {\n // Log on initial mount if there's a search term that's too short\n logger.info(\n `No organizations fetched. Search searchTerm \"${searchTerm}\" is less than ${minimumSearchValueLength} characters.`,\n );\n }\n }\n }\n\n prevSearchTermRef.current = searchTerm;\n }, [searchTerm, minimumSearchValueLength]);\n\n // Re-fetch when sort mode or user location changes (but not on initial render)\n const sortMode = searchRanking?.sortMode;\n const userLatitude = searchRanking?.userLocation?.latitude;\n const userLongitude = searchRanking?.userLocation?.longitude;\n\n useEffect(() => {\n if (searchTerm.length >= minimumSearchValueLength) {\n setIsErrored(null);\n setLoading(true);\n setOrganizations(null);\n debouncedFetchRef.current?.();\n }\n }, [sortMode, userLatitude, userLongitude, searchTerm, minimumSearchValueLength]);\n\n const orgSearchAttribution = getAttribution(organizations);\n\n if (loading) {\n return (\n <div className=\"sid-organization-list__menu\">\n <div className=\"sid-organization-list__message sid-organization-list__spinner-container\">\n <div id=\"sid-spinner-container\">\n <LoadingSpinnerComponent />\n </div>\n </div>\n </div>\n );\n }\n if (isErrored) {\n return (\n <div className=\"sid-organization-list__menu\">\n <div className=\"sid-organization-list__message\">\n {/* TODO: Define correct message ID from backend (backend need to send this message?) */}\n <FormattedHTMLMessage\n id=\"errorId.unknownError\"\n defaultMessage=\"An unknown error occurred\"\n />\n </div>\n </div>\n );\n }\n\n if (organizations && organizations.length > 0) {\n return (\n <>\n {orgSearchAttribution && (\n <div className=\"sid-organization-list__attribution\">{orgSearchAttribution}</div>\n )}\n\n <OrganizationListComponent\n getItemProps={getItemProps}\n getMenuProps={getMenuProps}\n highlightedIndex={highlightedIndex}\n itemToString={itemToString}\n organizations={organizations}\n >\n {searchTerm &&\n !openOrgSearchEnabled &&\n urlAddSchoolForm &&\n (!organizations || organizations.length < 26) && (\n <AddSchoolRequestRow\n onClick={onClickAddSchool}\n onTipsShown={onTipsShown}\n urlAddSchoolForm={urlAddSchoolForm}\n programId={programId}\n locale={locale}\n />\n )}\n </OrganizationListComponent>\n </>\n );\n }\n\n if (\n searchTerm &&\n !openOrgSearchEnabled &&\n urlAddSchoolForm &&\n (!organizations || organizations.length === 0)\n ) {\n return (\n <div className=\"sid-organization-list__menu\">\n <AddSchoolRequestRow\n onClick={onClickAddSchool}\n onTipsShown={onTipsShown}\n urlAddSchoolForm={urlAddSchoolForm}\n programId={programId}\n locale={locale}\n />\n </div>\n );\n }\n\n return null;\n};\n\nexport const FetchOrganizationsComponent = FetchOrganizations;\n","import { useCombobox, type UseComboboxStateChange } from \"downshift\";\n\nimport { type Organization } from \"../../../lib/types/types\";\n\nexport const handleStateChange = (\n changes: UseComboboxStateChange<Organization>,\n onChange: Function,\n opts: {\n openOrgSearchEnabled: boolean;\n _searchOverlayEnabled?: boolean;\n },\n) => {\n if (changes.type === useCombobox.stateChangeTypes.FunctionSelectItem) {\n const { selectedItem } = changes;\n onChange(selectedItem);\n } else if (changes.type === useCombobox.stateChangeTypes.InputBlur) {\n if (!opts.openOrgSearchEnabled && !opts._searchOverlayEnabled) {\n onChange({\n id: undefined,\n name: \"\",\n });\n }\n }\n};\n","import type React from \"react\";\n\ninterface TypeaheadClearButtonProps {\n id: string;\n onMouseDown: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n handleOnBlur: (event: React.FocusEvent<HTMLButtonElement>) => void;\n disabled?: boolean;\n}\n\nconst TypeaheadClearButton = ({\n id,\n onMouseDown,\n disabled,\n onKeyDown,\n handleOnBlur,\n}: TypeaheadClearButtonProps) => (\n <button\n id={id}\n type=\"button\"\n onMouseDown={onMouseDown}\n onKeyDown={onKeyDown}\n onBlur={handleOnBlur}\n className={`sid-input-clear-button ${disabled ? \"sid-input-clear-button--disabled\" : \"\"}`}\n aria-label=\"clear text\"\n aria-disabled={disabled}\n tabIndex={0}\n >\n <svg\n viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"none\"\n width={28}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.1\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n </button>\n);\n\nexport const TypeaheadClearButtonComponent = TypeaheadClearButton;\n","import type React from \"react\";\nimport { useRef, useEffect, useState } from \"react\";\nimport { useCombobox } from \"downshift\";\n\nimport { useSearchOverlay, SortDropdown } from \"@jslib/OrgSearch\";\nimport { logger } from \"@jslib/shared/utils/logger\";\nimport { Input } from \"@jslib/ui/components/input\";\nimport { cn } from \"@jslib/ui/lib/utils\";\n\nimport { useFlag } from \"@/components/FeatureFlags/hooks\";\nimport { MetricIds, useMetrics } from \"@/components/FeatureFlags/useMetrics\";\nimport { useMessage } from \"@/components/Message\";\n\nimport { FetchOrganizationsComponent } from \"../../FetchOrganizationsComponent\";\nimport {\n type Organization,\n type DatabaseId,\n type Country,\n type Locale,\n} from \"../../../lib/types/types\";\nimport { setRef } from \"../../../lib/refs/refs\";\nimport { assertValidFunction } from \"../../../lib/types/assertions\";\nimport {\n type AsrEvent,\n CustomMetricNames,\n EventName,\n type OrgSelectedEvent,\n recordGaEvent,\n} from \"../../../lib/GoogleAnalytics/ga\";\n\nimport { handleStateChange } from \"./TypeaheadComponentHelper\";\nimport { TypeaheadClearButtonComponent } from \"./TypeaheadClearButton/TypeaheadClearButtonComponent\";\n\nexport interface TypeaheadProps {\n onChange: (org: Organization) => void;\n programId: DatabaseId;\n inputHtmlId: string;\n autoFocus?: boolean;\n className?: string;\n countryCode?: Country;\n disabled?: boolean;\n minimumSearchValueLength?: number;\n placeholder?: string;\n value?: Organization;\n openOrgSearchEnabled?: boolean;\n orgSearchUrl: string;\n isRequired?: boolean;\n locale?: Locale;\n urlAddSchoolForm?: string;\n isErrored?: boolean;\n /** Paints the warning border; FormFieldLayout shows the warning text. */\n isWarned?: boolean;\n ariaDescribedBy?: string;\n onBlur?: () => void;\n}\n\nexport const TypeaheadComponent = ({\n onChange,\n programId,\n className,\n countryCode,\n disabled,\n minimumSearchValueLength,\n placeholder,\n value,\n inputHtmlId,\n openOrgSearchEnabled,\n orgSearchUrl,\n isRequired,\n locale,\n urlAddSchoolForm,\n isErrored,\n isWarned = false,\n ariaDescribedBy,\n autoFocus = false,\n onBlur = () => {},\n}: TypeaheadProps) => {\n const { msg } = useMessage();\n const [inputValue, setInputValue] = useState(value ? value.name : \"\");\n const [loadedOrgs, setLoadedOrgs] = useState([]);\n\n const numReworksRef = useRef(0);\n const startTimeRef = useRef(0);\n const tipsShownRef = useRef(false);\n const searchAfterTipsTrackedRef = useRef(false);\n\n const [showClearButton, setShowClearButton] = useState(false);\n const [disabledClearButton, setDisabledClearButton] = useState(false);\n const { recordNumericMetric, trackEvent } = useMetrics({ programId });\n const overlayEnabled = useFlag(\"org-search-overlay\") === \"overlay\";\n const { showOverlay, setShowOverlay } = useSearchOverlay();\n\n assertValidFunction(onChange);\n\n const itemToString = (item: Organization) => (item ? item.name : \"\");\n\n const { isOpen, highlightedIndex, getMenuProps, getItemProps, getInputProps } = useCombobox({\n itemToString,\n id: inputHtmlId,\n items: loadedOrgs,\n inputValue,\n onStateChange: (changes) =>\n handleStateChange(changes, onChange, {\n openOrgSearchEnabled,\n _searchOverlayEnabled: showOverlay,\n }),\n selectedItem: value,\n onSelectedItemChange: ({ selectedItem }) => {\n if (!selectedItem) {\n setInputValue(\"\");\n setShowOverlay(false);\n onChange({\n id: 0,\n name: \"\",\n });\n return;\n }\n\n setInputValue(itemToString(selectedItem));\n\n const selectedRank = loadedOrgs.findIndex((o) => o.id === selectedItem.id) + 1;\n const timeUntilSelection = Date.now() - startTimeRef.current;\n try {\n const event: OrgSelectedEvent = {\n eventName: EventName.ORG_SELECTED,\n params: {\n [CustomMetricNames.QUERY_LENGTH]: inputValue.length,\n [CustomMetricNames.NUMBER_REWORKS]: numReworksRef.current,\n [CustomMetricNames.SELECTED_RESULT_RANK]: selectedRank,\n [CustomMetricNames.EVENT_DURATION]: timeUntilSelection,\n [CustomMetricNames.NUMBER_OF_RESULTS]: loadedOrgs.length,\n },\n };\n recordGaEvent(event);\n } catch (e) {\n logger.error(e);\n }\n\n try {\n recordNumericMetric(MetricIds.OrgSearchNumReworks, numReworksRef.current);\n recordNumericMetric(MetricIds.OrgSearchQueryLength, inputValue.length);\n recordNumericMetric(MetricIds.OrgSearchResultRank, selectedRank);\n recordNumericMetric(MetricIds.OrgSearchTimeUntilSelection, timeUntilSelection);\n } catch (e) {\n logger.error(e);\n }\n\n startTimeRef.current = 0;\n numReworksRef.current = 0;\n setShowOverlay(false);\n onChange(selectedItem);\n },\n });\n\n const onClickAddSchool = () => {\n try {\n const event: AsrEvent = {\n eventName: EventName.ASR_SELECTED,\n params: {\n [CustomMetricNames.QUERY_LENGTH]: inputValue.length,\n [CustomMetricNames.NUMBER_REWORKS]: numReworksRef.current,\n [CustomMetricNames.EVENT_DURATION]: Date.now() - startTimeRef.current,\n [CustomMetricNames.NUMBER_OF_RESULTS]: loadedOrgs.length,\n },\n };\n recordGaEvent(event);\n trackEvent(MetricIds.AsrClickThrough);\n } catch (e) {\n logger.error(e);\n }\n };\n\n const onTipsShown = () => {\n tipsShownRef.current = true;\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newInputValue = event.target.value;\n\n if (newInputValue) {\n setDisabledClearButton(false);\n } else {\n setDisabledClearButton(true);\n }\n\n try {\n if (startTimeRef.current === 0) {\n startTimeRef.current = Date.now();\n }\n if (newInputValue.length < inputValue.length) {\n numReworksRef.current += 1;\n }\n\n // Track when user searches again after seeing tips (only once)\n if (tipsShownRef.current && !searchAfterTipsTrackedRef.current && newInputValue) {\n searchAfterTipsTrackedRef.current = true;\n recordGaEvent({\n eventName: EventName.ASR_SEARCH_AFTER_TIPS,\n params: { programId },\n });\n trackEvent(MetricIds.AsrSearchAfterTips);\n }\n } catch (e) {\n logger.error(e);\n }\n\n setInputValue(newInputValue);\n onChange({\n id: 0,\n name: newInputValue,\n });\n };\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // NOTE: Dependency array omitted to account for use of resetRef(), as useEffect with dep arr\n // will only trigger on initial render leaving the refs empty, this replicates prior version\n // where ref callback would trigger with each re-render\n useEffect(() => {\n setRef(\"organization\", inputRef.current);\n });\n\n // Follow `value` when it changes from outside the input (`setViewModel`, or an unselected org cleared on blur). While the input has focus its text belongs to the user: a typed value echoed back through `onChange` must not overwrite it, or IME composition breaks (HC-1468).\n useEffect(() => {\n const root = inputRef.current?.getRootNode() as Document | ShadowRoot | undefined;\n if (root?.activeElement !== inputRef.current) {\n setInputValue(value?.name ?? \"\");\n }\n }, [value?.id, value?.name]);\n\n const handleOnFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setShowClearButton(true);\n if (!event.currentTarget.value) {\n setDisabledClearButton(true);\n } else {\n setDisabledClearButton(false);\n setShowOverlay(true);\n }\n };\n\n const handleOnBlur = (event: React.FocusEvent) => {\n if (event.relatedTarget?.id !== `${inputHtmlId}-clear-button`) {\n setShowClearButton(false);\n onBlur();\n }\n };\n\n const handleOnInteraction = (\n event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n if (event.type === \"mousedown\" || (\"key\" in event && event.key === \"Enter\")) {\n setInputValue(\"\");\n onChange({\n id: undefined,\n name: \"\",\n });\n inputRef.current.focus();\n }\n };\n\n return (\n <div className=\"sid-organization-list\">\n <div className=\"sid-text-input__wrapper\">\n <Input\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getInputProps({\n ref: inputRef,\n onChange: handleInputChange,\n onFocus: (event) => handleOnFocus(event),\n onBlur: (event) => handleOnBlur(event),\n onKeyDown: (event) => {\n // we want to start the overlay if someone starts\n // typing, not if they are tabbing past or pressing Escape.\n if (event.key !== \"Tab\" && event.key !== \"Escape\") {\n setShowOverlay(true);\n }\n },\n })}\n // The look comes from @jslib/ui's Input; the legacy class names stay for legacy SCSS and\n // tests. pe-7.5 keeps the text clear of the clear button.\n hidePlaceholder\n className={cn(\n \"sid-l-full-width sid-hidden-placeholder sid-text-input pe-7.5 data-warning:border-warning\",\n className,\n )}\n data-warning={isWarned || undefined}\n disabled={disabled}\n id={inputHtmlId}\n // Autofocus is situational here, it's only added when org is cleared.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n placeholder={placeholder}\n aria-required={isRequired}\n aria-controls=\"sid-org-list-menu\"\n aria-describedby={ariaDescribedBy}\n aria-invalid={isErrored}\n // Maintain same labelledby value as previous versions even though label has \"for\" attribute\n aria-labelledby={`${inputHtmlId}-label`}\n />\n {showOverlay && (\n <SortDropdown\n sortByRelevanceLabel={msg({ id: \"orgSearchSortByRelevance\" })}\n sortByDistanceLabel={msg({ id: \"orgSearchSortByDistance\" })}\n accessibilityLabel={msg({ id: \"orgSearchSortAccessibilityLabel\" })}\n on={(event) => {\n switch (event) {\n case \"openSortMenu\":\n trackEvent(MetricIds.OrgSearchOpenSortMenu);\n break;\n\n case \"sortDistance\":\n trackEvent(MetricIds.OrgSearchSortDistance);\n break;\n\n case \"sortRelevance\":\n trackEvent(MetricIds.OrgSearchSortRelevance);\n break;\n default:\n break;\n }\n }}\n />\n )}\n </div>\n\n {showClearButton && !showOverlay ? (\n <TypeaheadClearButtonComponent\n id={`${inputHtmlId}-clear-button`}\n disabled={disabledClearButton}\n onMouseDown={handleOnInteraction}\n onKeyDown={handleOnInteraction}\n handleOnBlur={handleOnBlur}\n />\n ) : null}\n\n <div {...getMenuProps()} className=\"sid-organization-list__menu-wrapper\">\n {/* when using the overlay we don't want to use downshift's isOpen */}\n {(inputValue && isOpen) || (showOverlay && inputValue) ? (\n <FetchOrganizationsComponent\n countryCode={countryCode}\n getItemProps={getItemProps}\n highlightedIndex={highlightedIndex}\n itemToString={itemToString}\n minimumSearchValueLength={minimumSearchValueLength}\n onLoaded={(loadedOrganizations) => setLoadedOrgs(loadedOrganizations)}\n programId={programId}\n orgSearchUrl={orgSearchUrl}\n locale={locale}\n urlAddSchoolForm={urlAddSchoolForm}\n onClickAddSchool={onClickAddSchool}\n onTipsShown={onTipsShown}\n openOrgSearchEnabled={openOrgSearchEnabled}\n searchUrlParams={overlayEnabled ? { format: \"detailed\" } : undefined}\n />\n ) : null}\n </div>\n </div>\n );\n};\n","import {\n type Organization,\n type ProgramConfiguration,\n type WithOrganization,\n} from \"../types/types\";\nimport { getSafe } from \"../utils/getSafe\";\n\nexport const isOpenOrganization = (organization?: Organization): boolean =>\n getSafe(() => organization.id) === 0 && getSafe(() => organization.name, \"\").length > 0;\n\nexport const shouldCollectPostalCode = (\n programConfiguration: ProgramConfiguration,\n viewModel: WithOrganization,\n) =>\n getSafe(() => programConfiguration.openOrgSearchEnabled) &&\n isOpenOrganization(viewModel.organization);\n","import type React from \"react\";\nimport { useState } from \"react\";\n\nimport { SelectedOrg, SearchOverlay } from \"@jslib/OrgSearch\";\nimport { getSafe } from \"@jslib/shared/utils/getSafe\";\n\nimport { Message, useMessage } from \"@/components/Message\";\nimport { useFlag } from \"@/components/FeatureFlags/hooks\";\n\nimport { useProgramConfiguration } from \"@/lib/state/contextHooks\";\n\nimport { dashed } from \"../../../lib/utils/strings\";\nimport { FormFieldLayout, getFormFieldLabelHtmlId } from \"../FormFieldLayout/FormFieldLayout\";\nimport {\n TypeaheadComponent,\n type TypeaheadProps,\n} from \"../../FormInputs/Typeahead/TypeaheadComponent\";\nimport { type Locale, type VerificationService } from \"../../../lib/types/types\";\nimport { getOptions } from \"../../../options/options\";\nimport { getLocaleSafely } from \"../../../lib/intl/intl\";\nimport { isCountrySelectionNeeded } from \"../Country/countryUtils\";\nimport { isOpenOrganization } from \"../../../lib/organization/organization\";\n\n// Extend TypeaheadProps to pass along things like required, onKeyUp, etc.\n// Omit errorId, isErrored, etc because those are handled within this component\nexport interface FormFieldTypeaheadComponentProps extends Omit<\n TypeaheadProps,\n | \"inputHtmlId\"\n | \"id\"\n | \"errorId\"\n | \"isErrored\"\n | \"locale\"\n | \"programId\"\n | \"country\"\n | \"orgSearchUrl\" // omit b/c this component (FormFieldTypeaheadComponent) has a fallback so orgSearchUrl is optional\n | \"onBlur\"\n> {\n fieldId: string; // should be camelCase\n verificationService: VerificationService;\n label: React.ReactNode; // Label is always required for screen readers\n showPlaceholderAndHideLabel?: boolean;\n errorMessage?: React.ReactNode;\n warningMessage?: React.ReactNode;\n helperMessage?: React.ReactNode;\n explanation?: string | JSX.Element;\n orgSearchUrl: string;\n}\n\n/**\n * Generic typeahead field component.\n * In the JSLIB, a field has a label, inline error message, and an input of some kind.\n */\nexport const FormFieldTypeahead = ({\n fieldId,\n value,\n verificationService,\n onChange,\n placeholder,\n label,\n errorMessage,\n warningMessage,\n helperMessage,\n showPlaceholderAndHideLabel = false,\n isRequired = true,\n explanation = \"\",\n orgSearchUrl,\n urlAddSchoolForm,\n disabled = false,\n}: FormFieldTypeaheadComponentProps) => {\n const { msg } = useMessage();\n const programConfiguration = useProgramConfiguration();\n\n const labelHtmlId = `sid-${dashed(fieldId)}`;\n const errorHtmlId = `sid-${dashed(fieldId)}-error`;\n const warningHtmlId = `sid-${dashed(fieldId)}-warning`;\n const { programId, verificationResponse, viewModel } = verificationService;\n const countryChoiceValue = getSafe(() => viewModel.countryChoice.value);\n const needToPickCountry = isCountrySelectionNeeded(programConfiguration, countryChoiceValue);\n const locale: Locale = getLocaleSafely(viewModel, verificationResponse);\n const [autoFocus, setAutoFocus] = useState(false);\n const showSearchOverlay = useFlag(\"org-search-overlay\") === \"overlay\";\n const showSelectedOrgBox = showSearchOverlay || useFlag(\"org-selected-display\") === \"box-display\";\n const showOpenOrgWarningOrange = useFlag(\"hc-open-org-warning\") === \"warning-orange\";\n const showOpenOrgWarningGray = useFlag(\"hc-open-org-warning\") === \"warning-gray\";\n const showOpenOrgWarningFlag = showOpenOrgWarningOrange || showOpenOrgWarningGray;\n\n const [showOpenOrgWarning, setShowOpenOrgWarning] = useState(false);\n const openOrgSearchEnabled = getSafe(() => programConfiguration.openOrgSearchEnabled);\n\n const handleBlur = () => {\n if (openOrgSearchEnabled && isOpenOrganization(value)) {\n setShowOpenOrgWarning(true);\n } else {\n setShowOpenOrgWarning(false);\n }\n };\n\n const handleChange = (newValue: typeof value) => {\n if (showOpenOrgWarning) {\n setShowOpenOrgWarning(false);\n }\n onChange(newValue);\n };\n\n // Combine prop warning with internal open org warning\n const openOrgWarningMessage = showOpenOrgWarning && showOpenOrgWarningFlag && (\n <Message id=\"warningId.openOrganization\" />\n );\n const warningMsg = warningMessage || (showOpenOrgWarningOrange && openOrgWarningMessage);\n const helperMsg = helperMessage || (showOpenOrgWarningGray && openOrgWarningMessage);\n\n const getAriaDescribedBy = () => {\n if (errorMessage) return errorHtmlId;\n if (warningMsg) return warningHtmlId;\n return undefined;\n };\n\n return (\n <SearchOverlay enabled={showSearchOverlay} closeSectionLabel={<Message id=\"closeSection\" />}>\n <FormFieldLayout\n fieldId={fieldId}\n label={label}\n errorMessage={errorMessage}\n warningMessage={warningMsg}\n helperMessage={helperMsg}\n showPlaceholderAndHideLabel={showPlaceholderAndHideLabel}\n isRequired={isRequired || needToPickCountry}\n explanation={needToPickCountry ? <Message id=\"chooseCountry\" /> : explanation}\n >\n {showSelectedOrgBox && value.id ? (\n <SelectedOrg\n org={value}\n onClear={() => {\n handleChange(undefined);\n setAutoFocus(true);\n }}\n clearSelectionLabel={msg({ id: \"clearSelection\" })}\n labelId={getFormFieldLabelHtmlId(fieldId)}\n />\n ) : (\n <TypeaheadComponent\n disabled={needToPickCountry || disabled}\n countryCode={countryChoiceValue}\n minimumSearchValueLength={getOptions().minimumOrganizationSearchLength}\n onChange={handleChange}\n placeholder={placeholder}\n programId={programId}\n value={value}\n inputHtmlId={labelHtmlId}\n openOrgSearchEnabled={programConfiguration.openOrgSearchEnabled}\n locale={locale}\n orgSearchUrl={orgSearchUrl || getSafe(() => programConfiguration.orgSearchUrl)}\n urlAddSchoolForm={urlAddSchoolForm}\n isRequired={isRequired}\n isErrored={!!errorMessage}\n isWarned={!errorMessage && !!warningMsg}\n ariaDescribedBy={getAriaDescribedBy()}\n autoFocus={autoFocus}\n onBlur={handleBlur}\n />\n )}\n </FormFieldLayout>\n </SearchOverlay>\n );\n};\n"],"ignoreList":[7,8,9,10,11,12,14,15,16],"mappings":";;;;;;;;;;;;;;;;;;A,mCAOa0I,MAAA,GAAuB1I,EAAAA,cAAAA,CAAoC;CACtE,aAAa;CACb,sBAAsB,KAAA;AACxB,CAAC,GAEY2I,YAAA,GAAyB1I,EAAAA,WAAAA,CAAWyI,EAAoB,GCExDE,MAAA,GAAuB1I,EAAAA,cAAAA,CAA+C,IAAI,GAK1E2I,YAEX,GADgB1I,EAAAA,WAAAA,CAAWyI,EACpB;;;ACFT,SAAgBE,KAAuC;CACrD,IAAM,CAACC,GAAUC,MAAA,GAAe5I,EAAAA,SAAAA,CAA6B,IAAI,GAC3D,CAAC6I,GAAOC,MAAA,GAAY9I,EAAAA,SAAAA,CAAkC,IAAI,GAC1D,CAAC+I,GAASC,MAAA,GAAchJ,EAAAA,SAAAA,CAAS,EAAK;CA2B5C,OAAO;EACL;EACA;EACA;EACA,kBAAA,GA7BsBC,EAAAA,YAAAA,QACtB+I,EAAW,EAAI,GACfF,EAAS,IAAI,GAEN,IAAI,SAAS,GAAS,MAAW;GACtC,UAAU,YAAY,oBACnB,MAAa;IACZ,IAAMG,IAAM;KACV,UAAUC,EAAS,OAAO;KAC1B,WAAWA,EAAS,OAAO;IAC7B;IAGA,AAFAN,EAAYK,CAAG,GACfD,EAAW,EAAK,GAChBG,EAAQF,CAAG;GACb,IACC,MAAQ;IACP,IAAMG,IAAW;KAAE,MAAMC,EAAI;KAAM,SAASA,EAAI;IAAQ;IAGxD,AAFAP,EAASM,CAAQ,GACjBJ,EAAW,EAAK,GAChBM,EAAOF,CAAQ;GACjB,CACF;EACF,CAAC,IACA,CAAC,CAMF;CACF;AACF;;;A,aC5CaI,MAA+D,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