@aussieljk/forkbook 0.0.0-stage → 0.0.1-2

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 (598) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +77 -2
  3. package/assets/addon-vitest/templates/vitest.config.4.template.ts +36 -0
  4. package/assets/browser/favicon-wrapper.svg +46 -0
  5. package/assets/browser/favicon.svg +1 -0
  6. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  7. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  8. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  9. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  10. package/assets/builder-vite/iframe.html +99 -0
  11. package/assets/create/rendererAssets/.eslintrc.json +16 -0
  12. package/assets/create/rendererAssets/common/Configure.mdx +388 -0
  13. package/assets/create/rendererAssets/common/assets/accessibility.png +0 -0
  14. package/assets/create/rendererAssets/common/assets/accessibility.svg +1 -0
  15. package/assets/create/rendererAssets/common/assets/addon-library.png +0 -0
  16. package/assets/create/rendererAssets/common/assets/assets.png +0 -0
  17. package/assets/create/rendererAssets/common/assets/avif-test-image.avif +0 -0
  18. package/assets/create/rendererAssets/common/assets/context.png +0 -0
  19. package/assets/create/rendererAssets/common/assets/discord.svg +1 -0
  20. package/assets/create/rendererAssets/common/assets/docs.png +0 -0
  21. package/assets/create/rendererAssets/common/assets/figma-plugin.png +0 -0
  22. package/assets/create/rendererAssets/common/assets/github.svg +1 -0
  23. package/assets/create/rendererAssets/common/assets/share.png +0 -0
  24. package/assets/create/rendererAssets/common/assets/styling.png +0 -0
  25. package/assets/create/rendererAssets/common/assets/testing.png +0 -0
  26. package/assets/create/rendererAssets/common/assets/theming.png +0 -0
  27. package/assets/create/rendererAssets/common/assets/tutorials.svg +1 -0
  28. package/assets/create/rendererAssets/common/assets/youtube.svg +1 -0
  29. package/assets/create/rendererAssets/common/button.css +30 -0
  30. package/assets/create/rendererAssets/common/header.css +32 -0
  31. package/assets/create/rendererAssets/common/page.css +68 -0
  32. package/assets/create/templates/react-native/index.expo.js +20 -0
  33. package/assets/create/templates/react-native/index.js +25 -0
  34. package/assets/docs/addon-backgrounds.gif +0 -0
  35. package/assets/docs/addon-controls-args-annotated.png +0 -0
  36. package/assets/docs/addon-controls-args-background-color.png +0 -0
  37. package/assets/docs/addon-controls-args-background-string.png +0 -0
  38. package/assets/docs/addon-controls-args-docs.png +0 -0
  39. package/assets/docs/addon-controls-args-logging.png +0 -0
  40. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  41. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  42. package/assets/docs/addon-controls-args-reflow.png +0 -0
  43. package/assets/docs/addon-controls-args-template.png +0 -0
  44. package/assets/docs/addon-controls-expanded.png +0 -0
  45. package/assets/docs/addon-controls-hero.gif +0 -0
  46. package/assets/docs/addon-controls-install.png +0 -0
  47. package/assets/docs/hero.gif +0 -0
  48. package/assets/docs/highlight.png +0 -0
  49. package/assets/docs/message-reference.png +0 -0
  50. package/assets/docs/viewport.png +0 -0
  51. package/assets/react-native/metro-env.d.ts +69 -0
  52. package/assets/server/addon.tsconfig.json +6 -0
  53. package/assets/server/base-preview-body.html +116 -0
  54. package/assets/server/base-preview-head.html +494 -0
  55. package/assets/server/openBrowser.applescript +94 -0
  56. package/assets/server/template.ejs +87 -0
  57. package/dist/.build-stamp +0 -0
  58. package/dist/_browser-chunks/Color-PCLE2J36.js +1025 -0
  59. package/dist/_browser-chunks/DocsRenderer-JXND3PVQ.js +10 -0
  60. package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +1619 -0
  61. package/dist/_browser-chunks/chunk-2JDQ35OA.js +247 -0
  62. package/dist/_browser-chunks/chunk-2JT76G3E.js +104 -0
  63. package/dist/_browser-chunks/chunk-2MEPHP35.js +17 -0
  64. package/dist/_browser-chunks/chunk-2SCZVUKW.js +24 -0
  65. package/dist/_browser-chunks/chunk-46Z7NGAS.js +41 -0
  66. package/dist/_browser-chunks/chunk-4ATQOMJB.js +30 -0
  67. package/dist/_browser-chunks/chunk-52CW7FF7.js +49 -0
  68. package/dist/_browser-chunks/chunk-5I7E4GMO.js +62 -0
  69. package/dist/_browser-chunks/chunk-5P4QA6MY.js +20 -0
  70. package/dist/_browser-chunks/chunk-5WMXI5GW.js +816 -0
  71. package/dist/_browser-chunks/chunk-66OCZ54D.js +2604 -0
  72. package/dist/_browser-chunks/chunk-6SXYJQST.js +253 -0
  73. package/dist/_browser-chunks/chunk-AYRF6EJB.js +36 -0
  74. package/dist/_browser-chunks/chunk-B4AUNNU4.js +156 -0
  75. package/dist/_browser-chunks/chunk-BCP2FFXF.js +369 -0
  76. package/dist/_browser-chunks/chunk-C3D4HEFY.js +3396 -0
  77. package/dist/_browser-chunks/chunk-CFAOWGL7.js +43 -0
  78. package/dist/_browser-chunks/chunk-CFWWCCZV.js +223 -0
  79. package/dist/_browser-chunks/chunk-CNED6RYH.js +18 -0
  80. package/dist/_browser-chunks/chunk-DRQKCCAG.js +136 -0
  81. package/dist/_browser-chunks/chunk-ECQ75MKQ.js +0 -0
  82. package/dist/_browser-chunks/chunk-EIYAKDGP.js +302 -0
  83. package/dist/_browser-chunks/chunk-ENKK74N4.js +12 -0
  84. package/dist/_browser-chunks/chunk-FENFYI4X.js +698 -0
  85. package/dist/_browser-chunks/chunk-FJGWSWL5.js +155 -0
  86. package/dist/_browser-chunks/chunk-FVSEPWWX.js +2810 -0
  87. package/dist/_browser-chunks/chunk-GNZY6LOW.js +10116 -0
  88. package/dist/_browser-chunks/chunk-IE4ULIOQ.js +14 -0
  89. package/dist/_browser-chunks/chunk-IMSF75WX.js +42 -0
  90. package/dist/_browser-chunks/chunk-IWQGIXJS.js +14 -0
  91. package/dist/_browser-chunks/chunk-JMC7AIKT.js +108 -0
  92. package/dist/_browser-chunks/chunk-JPUOQJUI.js +8 -0
  93. package/dist/_browser-chunks/chunk-JSBKXXXF.js +218 -0
  94. package/dist/_browser-chunks/chunk-JWSKPMPC.js +73 -0
  95. package/dist/_browser-chunks/chunk-JYVGARBG.js +2943 -0
  96. package/dist/_browser-chunks/chunk-KBK7GKBN.js +35 -0
  97. package/dist/_browser-chunks/chunk-KQ7CRO2B.js +108 -0
  98. package/dist/_browser-chunks/chunk-LAWXTSXK.js +18 -0
  99. package/dist/_browser-chunks/chunk-LE2LTDW3.js +14 -0
  100. package/dist/_browser-chunks/chunk-LEVSOOLQ.js +48 -0
  101. package/dist/_browser-chunks/chunk-LV5PIKV4.js +93 -0
  102. package/dist/_browser-chunks/chunk-MDOL7KML.js +56 -0
  103. package/dist/_browser-chunks/chunk-MFMDGWP6.js +34 -0
  104. package/dist/_browser-chunks/chunk-MLBOOZL4.js +67 -0
  105. package/dist/_browser-chunks/chunk-NQUD4B7H.js +91 -0
  106. package/dist/_browser-chunks/chunk-NULBREPZ.js +43 -0
  107. package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
  108. package/dist/_browser-chunks/chunk-OD6IBQCC.js +117 -0
  109. package/dist/_browser-chunks/chunk-ODVJ3XZJ.js +157 -0
  110. package/dist/_browser-chunks/chunk-OQWFVDIN.js +386 -0
  111. package/dist/_browser-chunks/chunk-OVH3USFB.js +20 -0
  112. package/dist/_browser-chunks/chunk-OZZPSYQR.js +14 -0
  113. package/dist/_browser-chunks/chunk-P6PK47TQ.js +1970 -0
  114. package/dist/_browser-chunks/chunk-PFRNG3UC.js +22 -0
  115. package/dist/_browser-chunks/chunk-PJSMZ27A.js +13 -0
  116. package/dist/_browser-chunks/chunk-QC4HFS6K.js +41 -0
  117. package/dist/_browser-chunks/chunk-QDXFODK4.js +274 -0
  118. package/dist/_browser-chunks/chunk-RBCHTR7C.js +28 -0
  119. package/dist/_browser-chunks/chunk-RMYQ3QN3.js +294 -0
  120. package/dist/_browser-chunks/chunk-RNTIV5CE.js +411 -0
  121. package/dist/_browser-chunks/chunk-RSPAQWVJ.js +80 -0
  122. package/dist/_browser-chunks/chunk-S6TK43XQ.js +836 -0
  123. package/dist/_browser-chunks/chunk-SC67XZST.js +18 -0
  124. package/dist/_browser-chunks/chunk-SFVA4SBT.js +683 -0
  125. package/dist/_browser-chunks/chunk-SZYFOQMT.js +25 -0
  126. package/dist/_browser-chunks/chunk-TBJCJXK4.js +18 -0
  127. package/dist/_browser-chunks/chunk-UMDO3KB7.js +205 -0
  128. package/dist/_browser-chunks/chunk-V2G23FV7.js +11 -0
  129. package/dist/_browser-chunks/chunk-V5M7Q4HT.js +88 -0
  130. package/dist/_browser-chunks/chunk-W5M6NPS3.js +198 -0
  131. package/dist/_browser-chunks/chunk-W7NE2JXW.js +84 -0
  132. package/dist/_browser-chunks/chunk-WGVAAM43.js +1110 -0
  133. package/dist/_browser-chunks/chunk-WHQRNHXD.js +8 -0
  134. package/dist/_browser-chunks/chunk-WOSOWBCA.js +12 -0
  135. package/dist/_browser-chunks/chunk-WZ7KR7SH.js +85 -0
  136. package/dist/_browser-chunks/chunk-YEKO6BHJ.js +20 -0
  137. package/dist/_browser-chunks/chunk-YI2IBIQS.js +7 -0
  138. package/dist/_browser-chunks/chunk-YTIT5NA5.js +1966 -0
  139. package/dist/_browser-chunks/chunk-ZEHRUHTA.js +6 -0
  140. package/dist/_browser-chunks/chunk-ZTQ5MEJ5.js +203 -0
  141. package/dist/_browser-chunks/matchers-YLBYSYAF.js +1263 -0
  142. package/dist/_browser-chunks/react-dom-client-4OHE3QDV.js +9 -0
  143. package/dist/_node-chunks/attached-runtime-I2G4WLJI.js +282 -0
  144. package/dist/_node-chunks/builder-manager-VVHYQXCH.js +1661 -0
  145. package/dist/_node-chunks/chunk-2BUPBPFB.js +82 -0
  146. package/dist/_node-chunks/chunk-2DSIDINN.js +884 -0
  147. package/dist/_node-chunks/chunk-2RU7BKEW.js +23 -0
  148. package/dist/_node-chunks/chunk-34EO2PUT.js +26 -0
  149. package/dist/_node-chunks/chunk-3BKIBF5S.js +3008 -0
  150. package/dist/_node-chunks/chunk-3SDUYDXH.js +98 -0
  151. package/dist/_node-chunks/chunk-3T4ZSNPH.js +662 -0
  152. package/dist/_node-chunks/chunk-3W7F2B7P.js +79 -0
  153. package/dist/_node-chunks/chunk-3Y6AAY5H.js +80 -0
  154. package/dist/_node-chunks/chunk-42UWAGPW.js +1193 -0
  155. package/dist/_node-chunks/chunk-4FEANXWU.js +1986 -0
  156. package/dist/_node-chunks/chunk-5DQFEZEA.js +40 -0
  157. package/dist/_node-chunks/chunk-6KEHV53S.js +1218 -0
  158. package/dist/_node-chunks/chunk-6LMWA44H.js +3837 -0
  159. package/dist/_node-chunks/chunk-6YKBRP72.js +20 -0
  160. package/dist/_node-chunks/chunk-7GUDZVRQ.js +110 -0
  161. package/dist/_node-chunks/chunk-B5J7Q7J4.js +21 -0
  162. package/dist/_node-chunks/chunk-BS2WMZMR.js +90 -0
  163. package/dist/_node-chunks/chunk-BSKFCWQD.js +47 -0
  164. package/dist/_node-chunks/chunk-BXVYT7SB.js +36 -0
  165. package/dist/_node-chunks/chunk-CCOTJ4FC.js +688 -0
  166. package/dist/_node-chunks/chunk-CQKMLL5J.js +33 -0
  167. package/dist/_node-chunks/chunk-CXRU72ET.js +63 -0
  168. package/dist/_node-chunks/chunk-DC7DKR5K.js +20 -0
  169. package/dist/_node-chunks/chunk-DHJFTB4K.js +25 -0
  170. package/dist/_node-chunks/chunk-DUR55DJJ.js +1094 -0
  171. package/dist/_node-chunks/chunk-E6YESGLX.js +7032 -0
  172. package/dist/_node-chunks/chunk-EHUNOMDD.js +52345 -0
  173. package/dist/_node-chunks/chunk-ET7PWEO7.js +298 -0
  174. package/dist/_node-chunks/chunk-EWOX7HPJ.js +20 -0
  175. package/dist/_node-chunks/chunk-F3ZFKBHY.js +844 -0
  176. package/dist/_node-chunks/chunk-FK7KGTV7.js +26 -0
  177. package/dist/_node-chunks/chunk-FPZB5OI7.js +35 -0
  178. package/dist/_node-chunks/chunk-FW2HQUBQ.js +25 -0
  179. package/dist/_node-chunks/chunk-FY6UXW6G.js +11 -0
  180. package/dist/_node-chunks/chunk-GEFQN7K3.js +499 -0
  181. package/dist/_node-chunks/chunk-GRBLDJCR.js +989 -0
  182. package/dist/_node-chunks/chunk-H32DYT6P.js +87 -0
  183. package/dist/_node-chunks/chunk-H4PPVMP5.js +23 -0
  184. package/dist/_node-chunks/chunk-HMP2G23X.js +25 -0
  185. package/dist/_node-chunks/chunk-ICPBH3E7.js +59 -0
  186. package/dist/_node-chunks/chunk-IDEL2J23.js +23 -0
  187. package/dist/_node-chunks/chunk-IK4FGZLR.js +223 -0
  188. package/dist/_node-chunks/chunk-JDXXX6LB.js +68 -0
  189. package/dist/_node-chunks/chunk-JGGFYIG5.js +5468 -0
  190. package/dist/_node-chunks/chunk-JPAZLYJ3.js +29 -0
  191. package/dist/_node-chunks/chunk-JZOO7GGC.js +48 -0
  192. package/dist/_node-chunks/chunk-KISMCCP5.js +4744 -0
  193. package/dist/_node-chunks/chunk-LCK4ZQKG.js +115 -0
  194. package/dist/_node-chunks/chunk-LO56I6E2.js +132 -0
  195. package/dist/_node-chunks/chunk-LXBD4UL4.js +104 -0
  196. package/dist/_node-chunks/chunk-MA24JW6C.js +7162 -0
  197. package/dist/_node-chunks/chunk-MK2KYAI6.js +5414 -0
  198. package/dist/_node-chunks/chunk-NDWKJ4CL.js +2102 -0
  199. package/dist/_node-chunks/chunk-NIBT7XDZ.js +168 -0
  200. package/dist/_node-chunks/chunk-NPO45IMH.js +33 -0
  201. package/dist/_node-chunks/chunk-OISX4AGQ.js +414 -0
  202. package/dist/_node-chunks/chunk-OUW6R7C3.js +26 -0
  203. package/dist/_node-chunks/chunk-OWNFOGTA.js +194 -0
  204. package/dist/_node-chunks/chunk-Q7QNUM5H.js +49 -0
  205. package/dist/_node-chunks/chunk-QEQLR22M.js +1877 -0
  206. package/dist/_node-chunks/chunk-RRN2V55B.js +45 -0
  207. package/dist/_node-chunks/chunk-RWFIFGO5.js +144 -0
  208. package/dist/_node-chunks/chunk-RXNJDRGO.js +209 -0
  209. package/dist/_node-chunks/chunk-RZMQ7S3L.js +92 -0
  210. package/dist/_node-chunks/chunk-SIEXZVCR.js +51 -0
  211. package/dist/_node-chunks/chunk-SLWQNBGO.js +2034 -0
  212. package/dist/_node-chunks/chunk-SVTBJ7Q3.js +35 -0
  213. package/dist/_node-chunks/chunk-SWO5CDYU.js +32 -0
  214. package/dist/_node-chunks/chunk-TD5PLLQG.js +121 -0
  215. package/dist/_node-chunks/chunk-TEQGGSP7.js +33 -0
  216. package/dist/_node-chunks/chunk-TFCEV2XX.js +155 -0
  217. package/dist/_node-chunks/chunk-TFEWM4E3.js +1073 -0
  218. package/dist/_node-chunks/chunk-TINO74G5.js +21 -0
  219. package/dist/_node-chunks/chunk-TNJIXE37.js +40 -0
  220. package/dist/_node-chunks/chunk-TWI4GVH7.js +19 -0
  221. package/dist/_node-chunks/chunk-U5W53R2J.js +1011 -0
  222. package/dist/_node-chunks/chunk-UBOGWBEA.js +148 -0
  223. package/dist/_node-chunks/chunk-UMUBKI6E.js +3787 -0
  224. package/dist/_node-chunks/chunk-UVINFLGY.js +56 -0
  225. package/dist/_node-chunks/chunk-V2DY426G.js +1133 -0
  226. package/dist/_node-chunks/chunk-VLOXOXXE.js +45 -0
  227. package/dist/_node-chunks/chunk-W4OMYLSP.js +1297 -0
  228. package/dist/_node-chunks/chunk-WAXVSN3O.js +18 -0
  229. package/dist/_node-chunks/chunk-WCULS5TP.js +3767 -0
  230. package/dist/_node-chunks/chunk-WNZ2UMFM.js +153 -0
  231. package/dist/_node-chunks/chunk-WZJF2OUH.js +74 -0
  232. package/dist/_node-chunks/chunk-XGIUVY52.js +611 -0
  233. package/dist/_node-chunks/chunk-XHL2LVBM.js +415 -0
  234. package/dist/_node-chunks/chunk-XI6B6P47.js +59 -0
  235. package/dist/_node-chunks/chunk-XLP2ZKXV.js +60 -0
  236. package/dist/_node-chunks/chunk-YCMRA6RX.js +95 -0
  237. package/dist/_node-chunks/chunk-YZFWBA5L.js +2700 -0
  238. package/dist/_node-chunks/chunk-ZMAMXQKP.js +4731 -0
  239. package/dist/_node-chunks/chunk-ZWBCQ4MJ.js +110 -0
  240. package/dist/_node-chunks/dist-VTSTZKUB.js +16 -0
  241. package/dist/_node-chunks/globby-OEMHPBFY.js +2884 -0
  242. package/dist/_node-chunks/jiti-NFX6UU74.js +3848 -0
  243. package/dist/_node-chunks/lib-MDVARD7W.js +366 -0
  244. package/dist/_node-chunks/local-runtime-NTKIN2QT.js +78 -0
  245. package/dist/_node-chunks/mdx-plugin-MWISDWDQ.js +5680 -0
  246. package/dist/_node-chunks/monorepo-LIRFMQXE.js +121 -0
  247. package/dist/_node-chunks/monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js +121 -0
  248. package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +22 -0
  249. package/dist/_node-chunks/pattern-copy-play-EKHIUAU2.js +807 -0
  250. package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +20 -0
  251. package/dist/_node-chunks/rehype-external-links-BUN3HUCO.js +121 -0
  252. package/dist/_node-chunks/rehype-slug-PLADX223.js +52 -0
  253. package/dist/_node-chunks/relaxed-limits-GBHW6KIQ.js +117 -0
  254. package/dist/_node-chunks/run-KDTIZNSY.js +103 -0
  255. package/dist/_node-chunks/run-NL66VTNR.js +4532 -0
  256. package/dist/_node-chunks/session-id-KIIVOQLR.js +23 -0
  257. package/dist/_node-chunks/setup-MGC7BQO6.js +278 -0
  258. package/dist/_node-chunks/vitest.config.4.template-JH2THZFG.js +54 -0
  259. package/dist/actions/decorator.d.ts +7 -0
  260. package/dist/actions/decorator.js +43 -0
  261. package/dist/actions/index.d.ts +67 -0
  262. package/dist/actions/index.js +28 -0
  263. package/dist/addon-a11y/index.d.ts +52 -0
  264. package/dist/addon-a11y/index.js +16 -0
  265. package/dist/addon-a11y/manager.js +1429 -0
  266. package/dist/addon-a11y/preset.js +18 -0
  267. package/dist/addon-a11y/preview.d.ts +17 -0
  268. package/dist/addon-a11y/preview.js +15 -0
  269. package/dist/addon-docs/blocks.d.ts +1061 -0
  270. package/dist/addon-docs/blocks.js +2461 -0
  271. package/dist/addon-docs/index.d.ts +236 -0
  272. package/dist/addon-docs/index.js +16 -0
  273. package/dist/addon-docs/manager.js +90 -0
  274. package/dist/addon-docs/mdx-react-shim.d.ts +1 -0
  275. package/dist/addon-docs/mdx-react-shim.js +2 -0
  276. package/dist/addon-docs/preset.js +378 -0
  277. package/dist/addon-docs/preview.d.ts +4 -0
  278. package/dist/addon-docs/preview.js +7 -0
  279. package/dist/addon-links/index.d.ts +22 -0
  280. package/dist/addon-links/index.js +20 -0
  281. package/dist/addon-links/manager.js +14 -0
  282. package/dist/addon-links/preview.d.ts +6 -0
  283. package/dist/addon-links/preview.js +9 -0
  284. package/dist/addon-links/react/index.d.ts +25 -0
  285. package/dist/addon-links/react/index.js +52 -0
  286. package/dist/addon-mcp/preset.js +1345 -0
  287. package/dist/addon-mcp/preview.js +29 -0
  288. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +1153 -0
  289. package/dist/addon-ondevice-actions/index.d.ts +4 -0
  290. package/dist/addon-ondevice-actions/index.js +7 -0
  291. package/dist/addon-ondevice-actions/register.js +7 -0
  292. package/dist/addon-ondevice-controls/index.d.ts +6 -0
  293. package/dist/addon-ondevice-controls/index.js +14 -0
  294. package/dist/addon-ondevice-controls/register.js +10 -0
  295. package/dist/addon-pseudo-states/index.d.ts +35 -0
  296. package/dist/addon-pseudo-states/index.js +15 -0
  297. package/dist/addon-pseudo-states/manager.js +53 -0
  298. package/dist/addon-pseudo-states/preview.d.ts +9 -0
  299. package/dist/addon-pseudo-states/preview.js +10 -0
  300. package/dist/addon-themes/index.d.ts +80 -0
  301. package/dist/addon-themes/index.js +104 -0
  302. package/dist/addon-themes/manager.js +97 -0
  303. package/dist/addon-themes/postinstall.js +33 -0
  304. package/dist/addon-themes/preview.d.ts +6 -0
  305. package/dist/addon-themes/preview.js +8 -0
  306. package/dist/addon-vitest/constants.d.ts +132 -0
  307. package/dist/addon-vitest/constants.js +66 -0
  308. package/dist/addon-vitest/index.d.ts +4 -0
  309. package/dist/addon-vitest/index.js +8 -0
  310. package/dist/addon-vitest/manager.js +665 -0
  311. package/dist/addon-vitest/node/coverage-reporter.js +1284 -0
  312. package/dist/addon-vitest/node/vitest.js +674 -0
  313. package/dist/addon-vitest/postinstall.js +24 -0
  314. package/dist/addon-vitest/preset.js +943 -0
  315. package/dist/addon-vitest/vitest-plugin/global-setup.js +162 -0
  316. package/dist/addon-vitest/vitest-plugin/index.d.ts +56 -0
  317. package/dist/addon-vitest/vitest-plugin/index.js +463 -0
  318. package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +9 -0
  319. package/dist/addon-vitest/vitest-plugin/setup-file.browser.4.js +20 -0
  320. package/dist/addon-vitest/vitest-plugin/setup-file.js +50 -0
  321. package/dist/addon-vitest/vitest-plugin/test-utils.js +128 -0
  322. package/dist/babel/index.d.ts +2301 -0
  323. package/dist/babel/index.js +61 -0
  324. package/dist/backgrounds/index.d.ts +6 -0
  325. package/dist/backgrounds/index.js +15 -0
  326. package/dist/bin/core.js +1705 -0
  327. package/dist/bin/dispatcher.js +43 -0
  328. package/dist/bin/loader.js +115 -0
  329. package/dist/builder-vite/index.d.ts +50 -0
  330. package/dist/builder-vite/index.js +245 -0
  331. package/dist/builder-vite/preset.js +27 -0
  332. package/dist/channels/index.d.ts +2 -0
  333. package/dist/channels/index.js +352 -0
  334. package/dist/chunk-B2t1tGRh.d.ts +284 -0
  335. package/dist/chunk-BCoJQE-f.d.ts +602 -0
  336. package/dist/chunk-BGkgZp-H.d.ts +214 -0
  337. package/dist/chunk-BTVrWliM.d.ts +115 -0
  338. package/dist/chunk-BXLImeLy.d.ts +197 -0
  339. package/dist/chunk-BfBzpgct.d.ts +916 -0
  340. package/dist/chunk-Bpi2tz-6.d.ts +511 -0
  341. package/dist/chunk-BxWufQms.d.ts +142 -0
  342. package/dist/chunk-C-bavsOH.d.ts +34 -0
  343. package/dist/chunk-C2p5r3Vt.d.ts +13001 -0
  344. package/dist/chunk-C6PAgHLT.d.ts +12 -0
  345. package/dist/chunk-CMeX4WRe.d.ts +179 -0
  346. package/dist/chunk-Ct9xd6IM.d.ts +65 -0
  347. package/dist/chunk-CwQKNaYL.d.ts +15 -0
  348. package/dist/chunk-D7DwV41f.d.ts +3622 -0
  349. package/dist/chunk-DEVFdzxR.d.ts +253 -0
  350. package/dist/chunk-DaVb55-_.d.ts +124 -0
  351. package/dist/chunk-DgRNfmj_.d.ts +40 -0
  352. package/dist/chunk-DoIGKY33.d.ts +666 -0
  353. package/dist/chunk-Dr3R0DXk.d.ts +40 -0
  354. package/dist/chunk-DtHByo32.d.ts +55 -0
  355. package/dist/chunk-Dw1z1Pki.d.ts +933 -0
  356. package/dist/chunk-DzuY9DXg.d.ts +79 -0
  357. package/dist/chunk-FjDVzZTj.d.ts +62 -0
  358. package/dist/chunk-Kt1tW-D1.d.ts +59 -0
  359. package/dist/chunk-XP8oHzpE.d.ts +6 -0
  360. package/dist/chunk-gCX81nOr.d.ts +61 -0
  361. package/dist/chunk-pcFXCimE.d.ts +741 -0
  362. package/dist/cli/index.d.ts +1174 -0
  363. package/dist/cli/index.js +5613 -0
  364. package/dist/cli/skills/content/index.d.ts +72 -0
  365. package/dist/cli/skills/content/index.js +335 -0
  366. package/dist/cli/tools/sdk/child-host.d.ts +61 -0
  367. package/dist/cli/tools/sdk/child-host.js +131 -0
  368. package/dist/cli/tools/sdk/index.d.ts +137 -0
  369. package/dist/cli/tools/sdk/index.js +44 -0
  370. package/dist/cli-commands/bin/index.js +25 -0
  371. package/dist/client-logger/index.d.ts +31 -0
  372. package/dist/client-logger/index.js +63 -0
  373. package/dist/common/index.d.ts +1103 -0
  374. package/dist/common/index.js +364 -0
  375. package/dist/components/index.d.ts +1924 -0
  376. package/dist/components/index.js +13759 -0
  377. package/dist/core-events/index.d.ts +155 -0
  378. package/dist/core-events/index.js +136 -0
  379. package/dist/core-server/index.d.ts +2200 -0
  380. package/dist/core-server/index.js +4165 -0
  381. package/dist/core-server/presets/common-manager.css +170 -0
  382. package/dist/core-server/presets/common-manager.js +4168 -0
  383. package/dist/core-server/presets/common-override-preset.js +81 -0
  384. package/dist/core-server/presets/common-preset.js +2187 -0
  385. package/dist/create/bin/index.js +23 -0
  386. package/dist/create/index.js +25 -0
  387. package/dist/csf/csf-utils.d.ts +2 -0
  388. package/dist/csf/csf-utils.js +19 -0
  389. package/dist/csf/index.d.ts +7 -0
  390. package/dist/csf/index.js +2142 -0
  391. package/dist/csf-tools/index.d.ts +1157 -0
  392. package/dist/csf-tools/index.js +736 -0
  393. package/dist/docs-tools/index.d.ts +197 -0
  394. package/dist/docs-tools/index.js +61 -0
  395. package/dist/highlight/index.d.ts +10 -0
  396. package/dist/highlight/index.js +15 -0
  397. package/dist/instrumenter/index.d.ts +113 -0
  398. package/dist/instrumenter/index.js +2595 -0
  399. package/dist/manager/_manager-chunks/globals-runtime-8HkdnU2F.js +6144 -0
  400. package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +3389 -0
  401. package/dist/manager/_manager-chunks/globals-runtime-BdGkqNEt.js +45 -0
  402. package/dist/manager/_manager-chunks/globals-runtime-BmphMP6z.js +1190 -0
  403. package/dist/manager/_manager-chunks/globals-runtime-BvM-NY2g.js +13307 -0
  404. package/dist/manager/_manager-chunks/globals-runtime-C02fvgcd.js +9243 -0
  405. package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +9766 -0
  406. package/dist/manager/_manager-chunks/globals-runtime-DpNYC-qi.js +5564 -0
  407. package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +5357 -0
  408. package/dist/manager/_manager-chunks/globals-runtime-DwFqpqya.js +722 -0
  409. package/dist/manager/_manager-chunks/globals-runtime-FC201B7s.js +6837 -0
  410. package/dist/manager/_manager-chunks/globals-runtime-Rp_zjGnh.js +121 -0
  411. package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +10463 -0
  412. package/dist/manager/_manager-chunks/globals-runtime-eLPTIfX-.js +7759 -0
  413. package/dist/manager/_manager-chunks/globals-runtime-qKvCZHFY.js +4468 -0
  414. package/dist/manager/_manager-chunks/globals-runtime-sGpNlIJ1.js +5102 -0
  415. package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +452 -0
  416. package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +22 -0
  417. package/dist/manager/_manager-chunks/runtime-BhkT2CXl.js +1408 -0
  418. package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +998 -0
  419. package/dist/manager/_manager-chunks/runtime-D0UOWx0U.js +979 -0
  420. package/dist/manager/_manager-chunks/runtime-D94Vq3oR.js +4014 -0
  421. package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +77 -0
  422. package/dist/manager/_manager-chunks/runtime-EITvVbkG.js +46 -0
  423. package/dist/manager/_manager-chunks/runtime-cp5pazY2.js +8936 -0
  424. package/dist/manager/_manager-chunks/runtime-eDVAYF7N.js +6860 -0
  425. package/dist/manager/_manager-chunks/runtime-i-PDAHLR.js +2493 -0
  426. package/dist/manager/globals-runtime.js +2 -0
  427. package/dist/manager/globals.d.ts +23 -0
  428. package/dist/manager/globals.js +26 -0
  429. package/dist/manager/manager-stores.d.ts +2 -0
  430. package/dist/manager/manager-stores.js +19 -0
  431. package/dist/manager/runtime.js +2 -0
  432. package/dist/manager-api/index.d.ts +2 -0
  433. package/dist/manager-api/index.js +3257 -0
  434. package/dist/manager-errors.d.ts +89 -0
  435. package/dist/manager-errors.js +20 -0
  436. package/dist/mcp/index.d.ts +270 -0
  437. package/dist/mcp/index.js +305 -0
  438. package/dist/mocking-utils/index.d.ts +689 -0
  439. package/dist/mocking-utils/index.js +521 -0
  440. package/dist/mocking-utils/mocker-runtime.js +1254 -0
  441. package/dist/nextjs-vite/config/preview.js +3 -0
  442. package/dist/nextjs-vite/export-mocks/cache/index.d.ts +25 -0
  443. package/dist/nextjs-vite/export-mocks/cache/index.js +29 -0
  444. package/dist/nextjs-vite/export-mocks/headers/index.d.ts +37 -0
  445. package/dist/nextjs-vite/export-mocks/headers/index.js +54 -0
  446. package/dist/nextjs-vite/export-mocks/link/index.d.ts +9 -0
  447. package/dist/nextjs-vite/export-mocks/link/index.js +59 -0
  448. package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +28 -0
  449. package/dist/nextjs-vite/export-mocks/navigation/index.js +58 -0
  450. package/dist/nextjs-vite/export-mocks/router/index.d.ts +34 -0
  451. package/dist/nextjs-vite/export-mocks/router/index.js +63 -0
  452. package/dist/nextjs-vite/index.d.ts +92 -0
  453. package/dist/nextjs-vite/index.js +58 -0
  454. package/dist/nextjs-vite/node/index.d.ts +6 -0
  455. package/dist/nextjs-vite/node/index.js +20 -0
  456. package/dist/nextjs-vite/preset.js +648 -0
  457. package/dist/nextjs-vite/preview.d.ts +20 -0
  458. package/dist/nextjs-vite/preview.js +11 -0
  459. package/dist/nextjs-vite/vite-plugin/index.d.ts +6 -0
  460. package/dist/nextjs-vite/vite-plugin/index.js +19 -0
  461. package/dist/nextjs-vite-plugin/index.d.ts +28 -0
  462. package/dist/nextjs-vite-plugin/index.js +923 -0
  463. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +29 -0
  464. package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-context.js +8 -0
  465. package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-default-loader.js +23 -0
  466. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +28 -0
  467. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +17 -0
  468. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/cache/index.js +29 -0
  469. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/dynamic/index.js +40 -0
  470. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/headers/index.js +55 -0
  471. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/link/index.js +63 -0
  472. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/navigation/index.js +71 -0
  473. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +74 -0
  474. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/rsc/server-only.js +7 -0
  475. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/safe-stable-stringify/index.js +13 -0
  476. package/dist/nextjs-vite-plugin/plugins/next-mocks/compatibility/draft-mode.compat.js +7 -0
  477. package/dist/node-logger/index.d.ts +495 -0
  478. package/dist/node-logger/index.js +42 -0
  479. package/dist/oxc-parser/index.d.ts +99 -0
  480. package/dist/oxc-parser/index.js +275 -0
  481. package/dist/oxc-parser/worker.js +37 -0
  482. package/dist/preview/_chunks/runtime-BIzIdDbb.js +10263 -0
  483. package/dist/preview/_chunks/runtime-BTPtVY1p.js +1102 -0
  484. package/dist/preview/_chunks/runtime-BZSnICCg.js +8484 -0
  485. package/dist/preview/_chunks/runtime-BdGkqNEt.js +45 -0
  486. package/dist/preview/_chunks/runtime-BwSxqk3t.js +63 -0
  487. package/dist/preview/_chunks/runtime-CqHxptiK.js +6143 -0
  488. package/dist/preview/_chunks/runtime-CsV4HZPV.js +5064 -0
  489. package/dist/preview/_chunks/runtime-CxZK_Ln3.js +284 -0
  490. package/dist/preview/_chunks/runtime-DZToXfvO.js +9767 -0
  491. package/dist/preview/_chunks/runtime-DrTjJkPY.js +3872 -0
  492. package/dist/preview/_chunks/runtime-DuHdxMFA.js +387 -0
  493. package/dist/preview/_chunks/runtime-iXdo8CR8.js +3635 -0
  494. package/dist/preview/_chunks/runtime-q3wt0e_N.js +6838 -0
  495. package/dist/preview/globals.d.ts +16 -0
  496. package/dist/preview/globals.js +20 -0
  497. package/dist/preview/runtime.js +6 -0
  498. package/dist/preview-api/index.d.ts +4 -0
  499. package/dist/preview-api/index.js +147 -0
  500. package/dist/preview-errors.d.ts +186 -0
  501. package/dist/preview-errors.js +56 -0
  502. package/dist/react/docgen/docgen-worker.js +38 -0
  503. package/dist/react/entry-preview-argtypes.js +9 -0
  504. package/dist/react/entry-preview-docs.js +12 -0
  505. package/dist/react/entry-preview-rsc.js +11 -0
  506. package/dist/react/entry-preview.js +21 -0
  507. package/dist/react/index.d.ts +119 -0
  508. package/dist/react/index.js +26 -0
  509. package/dist/react/preset.js +301 -0
  510. package/dist/react/preview.d.ts +2 -0
  511. package/dist/react/preview.js +11 -0
  512. package/dist/react-native/bin/get-stories.js +34 -0
  513. package/dist/react-native/index.d.ts +160 -0
  514. package/dist/react-native/index.js +1547 -0
  515. package/dist/react-native/metro/node.d.ts +83 -0
  516. package/dist/react-native/metro/node.js +21 -0
  517. package/dist/react-native/metro/withStorybook.d.ts +2269 -0
  518. package/dist/react-native/metro/withStorybook.js +138 -0
  519. package/dist/react-native/preview.d.ts +6 -0
  520. package/dist/react-native/preview.js +20 -0
  521. package/dist/react-native/scripts/generate.d.ts +22 -0
  522. package/dist/react-native/scripts/generate.js +18 -0
  523. package/dist/react-native/stub.js +20 -0
  524. package/dist/react-native-theming/index.d.ts +175 -0
  525. package/dist/react-native-theming/index.js +2591 -0
  526. package/dist/react-native-ui/index.d.ts +130 -0
  527. package/dist/react-native-ui/index.js +1448 -0
  528. package/dist/react-native-ui-common/index.d.ts +230 -0
  529. package/dist/react-native-ui-common/index.js +514 -0
  530. package/dist/react-vite/index.d.ts +4 -0
  531. package/dist/react-vite/index.js +8 -0
  532. package/dist/react-vite/node/index.d.ts +6 -0
  533. package/dist/react-vite/node/index.js +20 -0
  534. package/dist/react-vite/preset.d.ts +6 -0
  535. package/dist/react-vite/preset.js +21 -0
  536. package/dist/router/index.d.ts +141 -0
  537. package/dist/router/index.js +1217 -0
  538. package/dist/server-errors.d.ts +2 -0
  539. package/dist/server-errors.js +149 -0
  540. package/dist/shared/open-service/index.d.ts +3 -0
  541. package/dist/shared/open-service/index.js +115 -0
  542. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +75 -0
  543. package/dist/shared/open-service/toolsets/docs/public.d.ts +1296 -0
  544. package/dist/shared/open-service/toolsets/docs/public.js +991 -0
  545. package/dist/telemetry/index.d.ts +314 -0
  546. package/dist/telemetry/index.js +103 -0
  547. package/dist/test/index.d.ts +158 -0
  548. package/dist/test/index.js +19421 -0
  549. package/dist/theming/create.d.ts +15 -0
  550. package/dist/theming/create.js +11 -0
  551. package/dist/theming/index.d.ts +54 -0
  552. package/dist/theming/index.js +511 -0
  553. package/dist/types/index.d.ts +2 -0
  554. package/dist/types/index.js +48 -0
  555. package/dist/viewport/index.d.ts +275 -0
  556. package/dist/viewport/index.js +21 -0
  557. package/package.json +1054 -4
  558. package/template/nextjs-vite/cli/.eslintrc.json +6 -0
  559. package/template/nextjs-vite/cli/js/Button.jsx +42 -0
  560. package/template/nextjs-vite/cli/js/Button.stories.js +49 -0
  561. package/template/nextjs-vite/cli/js/Configure.mdx +470 -0
  562. package/template/nextjs-vite/cli/js/Header.jsx +58 -0
  563. package/template/nextjs-vite/cli/js/Header.stories.js +30 -0
  564. package/template/nextjs-vite/cli/js/Page.jsx +68 -0
  565. package/template/nextjs-vite/cli/js/Page.stories.js +28 -0
  566. package/template/nextjs-vite/cli/ts/Button.stories.ts +54 -0
  567. package/template/nextjs-vite/cli/ts/Button.tsx +39 -0
  568. package/template/nextjs-vite/cli/ts/Configure.mdx +446 -0
  569. package/template/nextjs-vite/cli/ts/Header.stories.ts +34 -0
  570. package/template/nextjs-vite/cli/ts/Header.tsx +54 -0
  571. package/template/nextjs-vite/cli/ts/Page.stories.ts +33 -0
  572. package/template/nextjs-vite/cli/ts/Page.tsx +73 -0
  573. package/template/react/cli/.eslintrc.json +5 -0
  574. package/template/react/cli/js/Button.jsx +39 -0
  575. package/template/react/cli/js/Button.stories.js +49 -0
  576. package/template/react/cli/js/Header.jsx +56 -0
  577. package/template/react/cli/js/Header.stories.js +29 -0
  578. package/template/react/cli/js/Page.jsx +69 -0
  579. package/template/react/cli/js/Page.stories.js +28 -0
  580. package/template/react/cli/ts/Button.stories.ts +54 -0
  581. package/template/react/cli/ts/Button.tsx +37 -0
  582. package/template/react/cli/ts/Header.stories.ts +34 -0
  583. package/template/react/cli/ts/Header.tsx +56 -0
  584. package/template/react/cli/ts/Page.stories.ts +33 -0
  585. package/template/react/cli/ts/Page.tsx +73 -0
  586. package/template/react-vite/cli/.eslintrc.json +5 -0
  587. package/template/react-vite/cli/js/Button.jsx +39 -0
  588. package/template/react-vite/cli/js/Button.stories.js +49 -0
  589. package/template/react-vite/cli/js/Header.jsx +56 -0
  590. package/template/react-vite/cli/js/Header.stories.js +29 -0
  591. package/template/react-vite/cli/js/Page.jsx +69 -0
  592. package/template/react-vite/cli/js/Page.stories.js +28 -0
  593. package/template/react-vite/cli/ts/Button.stories.ts +54 -0
  594. package/template/react-vite/cli/ts/Button.tsx +37 -0
  595. package/template/react-vite/cli/ts/Header.stories.ts +34 -0
  596. package/template/react-vite/cli/ts/Header.tsx +56 -0
  597. package/template/react-vite/cli/ts/Page.stories.ts +33 -0
  598. package/template/react-vite/cli/ts/Page.tsx +73 -0
@@ -0,0 +1,4014 @@
1
+ import { n as __esmMin, o as __toESM, t as __commonJSMin } from "./runtime-EITvVbkG.js";
2
+ import { Sr as useState, br as useReducer, er as Component, fr as useCallback, hr as useEffect, ir as cloneElement, lr as init__storybook_global_react, rr as _storybook_global_react_exports, vr as useLayoutEffect, xr as useRef, yr as useMemo } from "./runtime-Bly6WJLN.js";
3
+ import { a as _inheritsLoose, l as _extends, o as init_inheritsLoose, t as _objectWithoutPropertiesLoose } from "./runtime-eDVAYF7N.js";
4
+ import { h as require_prop_types, n as require_react_is } from "./runtime-i-PDAHLR.js";
5
+ //#region ../../node_modules/invariant/browser.js
6
+ /**
7
+ * Copyright (c) 2013-present, Facebook, Inc.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
13
+ /**
14
+ * Use invariant() to assert state which your program assumes to be true.
15
+ *
16
+ * Provide sprintf-style format (only %s is supported) and arguments
17
+ * to provide information about what broke and what you were
18
+ * expecting.
19
+ *
20
+ * The invariant message will be stripped in production, but the invariant
21
+ * will remain to ensure logic does not differ in production.
22
+ */
23
+ var invariant = function(condition, format, a, b, c, d, e, f) {
24
+ if (!condition) {
25
+ var error;
26
+ if (format === void 0) error = /* @__PURE__ */ new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");
27
+ else {
28
+ var args = [
29
+ a,
30
+ b,
31
+ c,
32
+ d,
33
+ e,
34
+ f
35
+ ];
36
+ var argIndex = 0;
37
+ error = new Error(format.replace(/%s/g, function() {
38
+ return args[argIndex++];
39
+ }));
40
+ error.name = "Invariant Violation";
41
+ }
42
+ error.framesToPop = 1;
43
+ throw error;
44
+ }
45
+ };
46
+ module.exports = invariant;
47
+ }));
48
+ //#endregion
49
+ //#region ../../node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
50
+ function getSymbols(object) {
51
+ return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
52
+ }
53
+ //#endregion
54
+ //#region ../../node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
55
+ /**
56
+ * Gets the `toStringTag` of `value`.
57
+ *
58
+ * @private
59
+ * @param {T} value The value to query.
60
+ * @returns {string} Returns the `Object.prototype.toString.call` result.
61
+ */
62
+ function getTag(value) {
63
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
64
+ return Object.prototype.toString.call(value);
65
+ }
66
+ //#endregion
67
+ //#region ../../node_modules/es-toolkit/dist/compat/_internal/tags.mjs
68
+ var regexpTag, stringTag, numberTag, booleanTag, symbolTag, dateTag, mapTag, setTag, arrayTag, functionTag, arrayBufferTag, objectTag, errorTag, dataViewTag, uint8ArrayTag, uint8ClampedArrayTag, uint16ArrayTag, uint32ArrayTag, bigUint64ArrayTag, int8ArrayTag, int16ArrayTag, int32ArrayTag, bigInt64ArrayTag, float32ArrayTag, float64ArrayTag;
69
+ function init_tags() {
70
+ return (init_tags = __esmMin((() => {
71
+ regexpTag = "[object RegExp]";
72
+ stringTag = "[object String]";
73
+ numberTag = "[object Number]";
74
+ booleanTag = "[object Boolean]";
75
+ symbolTag = "[object Symbol]";
76
+ dateTag = "[object Date]";
77
+ mapTag = "[object Map]";
78
+ setTag = "[object Set]";
79
+ arrayTag = "[object Array]";
80
+ functionTag = "[object Function]";
81
+ arrayBufferTag = "[object ArrayBuffer]";
82
+ objectTag = "[object Object]";
83
+ errorTag = "[object Error]";
84
+ dataViewTag = "[object DataView]";
85
+ uint8ArrayTag = "[object Uint8Array]";
86
+ uint8ClampedArrayTag = "[object Uint8ClampedArray]";
87
+ uint16ArrayTag = "[object Uint16Array]";
88
+ uint32ArrayTag = "[object Uint32Array]";
89
+ bigUint64ArrayTag = "[object BigUint64Array]";
90
+ int8ArrayTag = "[object Int8Array]";
91
+ int16ArrayTag = "[object Int16Array]";
92
+ int32ArrayTag = "[object Int32Array]";
93
+ bigInt64ArrayTag = "[object BigInt64Array]";
94
+ float32ArrayTag = "[object Float32Array]";
95
+ float64ArrayTag = "[object Float64Array]";
96
+ })))();
97
+ }
98
+ //#endregion
99
+ //#region ../../node_modules/es-toolkit/dist/_internal/globalThis.mjs
100
+ var globalThis_;
101
+ function init_globalThis() {
102
+ return (init_globalThis = __esmMin((() => {
103
+ globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() {
104
+ return this;
105
+ })();
106
+ })))();
107
+ }
108
+ //#endregion
109
+ //#region ../../node_modules/es-toolkit/dist/predicate/isBuffer.mjs
110
+ /**
111
+ * Checks if the given value is a Buffer instance.
112
+ *
113
+ * This function tests whether the provided value is an instance of Buffer.
114
+ * It returns `true` if the value is a Buffer, and `false` otherwise.
115
+ *
116
+ * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
117
+ *
118
+ * @param x - The value to check if it is a Buffer.
119
+ * @returns Returns `true` if `x` is a Buffer, else `false`.
120
+ *
121
+ * @example
122
+ * const buffer = Buffer.from("test");
123
+ * console.log(isBuffer(buffer)); // true
124
+ *
125
+ * const notBuffer = "not a buffer";
126
+ * console.log(isBuffer(notBuffer)); // false
127
+ */
128
+ function isBuffer(x) {
129
+ return typeof globalThis_.Buffer !== "undefined" && globalThis_.Buffer.isBuffer(x);
130
+ }
131
+ function init_isBuffer() {
132
+ return (init_isBuffer = __esmMin((() => {
133
+ init_globalThis();
134
+ })))();
135
+ }
136
+ //#endregion
137
+ //#region ../../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
138
+ /**
139
+ * Checks if a given value is a plain object.
140
+ *
141
+ * @param value - The value to check.
142
+ * @returns True if the value is a plain object, otherwise false.
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * // ✅👇 True
147
+ *
148
+ * isPlainObject({ }); // ✅
149
+ * isPlainObject({ key: 'value' }); // ✅
150
+ * isPlainObject({ key: new Date() }); // ✅
151
+ * isPlainObject(new Object()); // ✅
152
+ * isPlainObject(Object.create(null)); // ✅
153
+ * isPlainObject({ nested: { key: true} }); // ✅
154
+ * isPlainObject(new Proxy({}, {})); // ✅
155
+ * isPlainObject({ [Symbol('tag')]: 'A' }); // ✅
156
+ *
157
+ * // ✅👇 (cross-realms, node context, workers, ...)
158
+ * const runInNewContext = await import('node:vm').then(
159
+ * (mod) => mod.runInNewContext
160
+ * );
161
+ * isPlainObject(runInNewContext('({})')); // ✅
162
+ *
163
+ * // ❌👇 False
164
+ *
165
+ * class Test { };
166
+ * isPlainObject(new Test()) // ❌
167
+ * isPlainObject(10); // ❌
168
+ * isPlainObject(null); // ❌
169
+ * isPlainObject('hello'); // ❌
170
+ * isPlainObject([]); // ❌
171
+ * isPlainObject(new Date()); // ❌
172
+ * isPlainObject(new Uint8Array([1])); // ❌
173
+ * isPlainObject(Buffer.from('ABC')); // ❌
174
+ * isPlainObject(Promise.resolve({})); // ❌
175
+ * isPlainObject(Object.create({})); // ❌
176
+ * isPlainObject(new (class Cls {})); // ❌
177
+ * isPlainObject(globalThis); // ❌,
178
+ * ```
179
+ */
180
+ function isPlainObject(value) {
181
+ if (!value || typeof value !== "object") return false;
182
+ const proto = Object.getPrototypeOf(value);
183
+ if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
184
+ return Object.prototype.toString.call(value) === "[object Object]";
185
+ }
186
+ //#endregion
187
+ //#region ../../node_modules/es-toolkit/dist/compat/util/eq.mjs
188
+ /**
189
+ * Performs a `SameValueZero` comparison between two values to determine if they are equivalent.
190
+ *
191
+ * @param value The value to compare.
192
+ * @param other The other value to compare.
193
+ * @returns Returns `true` if the values are equivalent, else `false`.
194
+ *
195
+ * @example
196
+ * eq(1, 1); // true
197
+ * eq(0, -0); // true
198
+ * eq(NaN, NaN); // true
199
+ * eq('a', Object('a')); // false
200
+ */
201
+ function eq(value, other) {
202
+ return value === other || Number.isNaN(value) && Number.isNaN(other);
203
+ }
204
+ //#endregion
205
+ //#region ../../node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
206
+ /**
207
+ * Compares two values for equality using a custom comparison function.
208
+ *
209
+ * The custom function allows for fine-tuned control over the comparison process. If it returns a boolean, that result determines the equality. If it returns undefined, the function falls back to the default equality comparison.
210
+ *
211
+ * This function also uses the custom equality function to compare values inside objects,
212
+ * arrays, maps, sets, and other complex structures, ensuring a deep comparison.
213
+ *
214
+ * This approach provides flexibility in handling complex comparisons while maintaining efficient default behavior for simpler cases.
215
+ *
216
+ * The custom comparison function can take up to six parameters:
217
+ * - `x`: The value from the first object `a`.
218
+ * - `y`: The value from the second object `b`.
219
+ * - `property`: The property key used to get `x` and `y`.
220
+ * - `xParent`: The parent of the first value `x`.
221
+ * - `yParent`: The parent of the second value `y`.
222
+ * - `stack`: An internal stack (Map) to handle circular references.
223
+ *
224
+ * @param a - The first value to compare.
225
+ * @param b - The second value to compare.
226
+ * @param areValuesEqual - A function to customize the comparison.
227
+ * If it returns a boolean, that result will be used. If it returns undefined,
228
+ * the default equality comparison will be used.
229
+ * @returns `true` if the values are equal according to the customizer, otherwise `false`.
230
+ *
231
+ * @example
232
+ * const customizer = (a, b) => {
233
+ * if (typeof a === 'string' && typeof b === 'string') {
234
+ * return a.toLowerCase() === b.toLowerCase();
235
+ * }
236
+ * };
237
+ * isEqualWith('Hello', 'hello', customizer); // true
238
+ * isEqualWith({ a: 'Hello' }, { a: 'hello' }, customizer); // true
239
+ * isEqualWith([1, 2, 3], [1, 2, 3], customizer); // true
240
+ */
241
+ function isEqualWith(a, b, areValuesEqual) {
242
+ return isEqualWithImpl(a, b, void 0, void 0, void 0, void 0, areValuesEqual);
243
+ }
244
+ function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
245
+ const result = areValuesEqual(a, b, property, aParent, bParent, stack);
246
+ if (result !== void 0) return result;
247
+ if (typeof a === typeof b) switch (typeof a) {
248
+ case "bigint":
249
+ case "string":
250
+ case "boolean":
251
+ case "symbol":
252
+ case "undefined": return a === b;
253
+ case "number": return a === b || Object.is(a, b);
254
+ case "function": return a === b;
255
+ case "object": return areObjectsEqual(a, b, stack, areValuesEqual);
256
+ }
257
+ return areObjectsEqual(a, b, stack, areValuesEqual);
258
+ }
259
+ function areObjectsEqual(a, b, stack, areValuesEqual) {
260
+ if (Object.is(a, b)) return true;
261
+ let aTag = getTag(a);
262
+ let bTag = getTag(b);
263
+ if (aTag === "[object Arguments]") aTag = objectTag;
264
+ if (bTag === "[object Arguments]") bTag = objectTag;
265
+ if (aTag !== bTag) return false;
266
+ switch (aTag) {
267
+ case stringTag: return a.toString() === b.toString();
268
+ case numberTag: return eq(a.valueOf(), b.valueOf());
269
+ case booleanTag:
270
+ case dateTag:
271
+ case symbolTag: return Object.is(a.valueOf(), b.valueOf());
272
+ case regexpTag: return a.source === b.source && a.flags === b.flags;
273
+ case functionTag: return a === b;
274
+ }
275
+ stack = stack ?? /* @__PURE__ */ new Map();
276
+ const aStack = stack.get(a);
277
+ const bStack = stack.get(b);
278
+ if (aStack != null && bStack != null) return aStack === b;
279
+ stack.set(a, b);
280
+ stack.set(b, a);
281
+ try {
282
+ switch (aTag) {
283
+ case mapTag:
284
+ if (a.size !== b.size) return false;
285
+ for (const [key, value] of a.entries()) if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) return false;
286
+ return true;
287
+ case setTag: {
288
+ if (a.size !== b.size) return false;
289
+ const aValues = Array.from(a.values());
290
+ const bValues = Array.from(b.values());
291
+ for (let i = 0; i < aValues.length; i++) {
292
+ const aValue = aValues[i];
293
+ const index = bValues.findIndex((bValue) => {
294
+ return isEqualWithImpl(aValue, bValue, void 0, a, b, stack, areValuesEqual);
295
+ });
296
+ if (index === -1) return false;
297
+ bValues.splice(index, 1);
298
+ }
299
+ return true;
300
+ }
301
+ case arrayTag:
302
+ case uint8ArrayTag:
303
+ case uint8ClampedArrayTag:
304
+ case uint16ArrayTag:
305
+ case uint32ArrayTag:
306
+ case bigUint64ArrayTag:
307
+ case int8ArrayTag:
308
+ case int16ArrayTag:
309
+ case int32ArrayTag:
310
+ case bigInt64ArrayTag:
311
+ case float32ArrayTag:
312
+ case float64ArrayTag:
313
+ if (isBuffer(a) !== isBuffer(b)) return false;
314
+ if (a.length !== b.length) return false;
315
+ for (let i = 0; i < a.length; i++) if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) return false;
316
+ return true;
317
+ case arrayBufferTag:
318
+ if (a.byteLength !== b.byteLength) return false;
319
+ return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
320
+ case dataViewTag:
321
+ if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) return false;
322
+ return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
323
+ case errorTag: return a.name === b.name && a.message === b.message;
324
+ case objectTag: {
325
+ if (!(areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) || isPlainObject(a) && isPlainObject(b))) return false;
326
+ const aKeys = [...Object.keys(a), ...getSymbols(a)];
327
+ const bKeys = [...Object.keys(b), ...getSymbols(b)];
328
+ if (aKeys.length !== bKeys.length) return false;
329
+ for (let i = 0; i < aKeys.length; i++) {
330
+ const propKey = aKeys[i];
331
+ const aProp = a[propKey];
332
+ if (!Object.hasOwn(b, propKey)) return false;
333
+ const bProp = b[propKey];
334
+ if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) return false;
335
+ }
336
+ return true;
337
+ }
338
+ default: return false;
339
+ }
340
+ } finally {
341
+ stack.delete(a);
342
+ stack.delete(b);
343
+ }
344
+ }
345
+ function init_isEqualWith() {
346
+ return (init_isEqualWith = __esmMin((() => {
347
+ init_tags();
348
+ init_isBuffer();
349
+ })))();
350
+ }
351
+ //#endregion
352
+ //#region ../../node_modules/es-toolkit/dist/function/noop.mjs
353
+ /**
354
+ * A no-operation function that does nothing.
355
+ * This can be used as a placeholder or default function.
356
+ *
357
+ * @example
358
+ * noop(); // Does nothing
359
+ *
360
+ * @returns This function does not return anything.
361
+ */
362
+ function noop$1() {}
363
+ //#endregion
364
+ //#region ../../node_modules/es-toolkit/dist/predicate/isEqual.mjs
365
+ /**
366
+ * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.
367
+ *
368
+ * @param a - The first value to compare.
369
+ * @param b - The second value to compare.
370
+ * @returns `true` if the values are equal, otherwise `false`.
371
+ *
372
+ * @example
373
+ * isEqual(1, 1); // true
374
+ * isEqual({ a: 1 }, { a: 1 }); // true
375
+ * isEqual(/abc/g, /abc/g); // true
376
+ * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true
377
+ * isEqual([1, 2, 3], [1, 2, 3]); // true
378
+ */
379
+ function isEqual(a, b) {
380
+ return isEqualWith(a, b, noop$1);
381
+ }
382
+ function init_isEqual() {
383
+ return (init_isEqual = __esmMin((() => {
384
+ init_isEqualWith();
385
+ })))();
386
+ }
387
+ //#endregion
388
+ //#region ../../node_modules/clsx/dist/clsx.mjs
389
+ function r$1(e) {
390
+ var t, f, n = "";
391
+ if ("string" == typeof e || "number" == typeof e) n += e;
392
+ else if ("object" == typeof e) if (Array.isArray(e)) {
393
+ var o = e.length;
394
+ for (t = 0; t < o; t++) e[t] && (f = r$1(e[t])) && (n && (n += " "), n += f);
395
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
396
+ return n;
397
+ }
398
+ function clsx() {
399
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r$1(e)) && (n && (n += " "), n += t);
400
+ return n;
401
+ }
402
+ function init_clsx() {
403
+ return (init_clsx = __esmMin((() => {})))();
404
+ }
405
+ //#endregion
406
+ //#region ../../node_modules/es-toolkit/dist/function/debounce.mjs
407
+ /**
408
+ * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds
409
+ * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`
410
+ * method to cancel any pending execution.
411
+ *
412
+ * @template F - The type of function.
413
+ * @param func - The function to debounce.
414
+ * @param debounceMs - The number of milliseconds to delay.
415
+ * @param options - The options object
416
+ * @param options.signal - An optional AbortSignal to cancel the debounced function.
417
+ * @param options.edges - An optional array specifying whether the function should be invoked on the leading edge, trailing edge, or both.
418
+ * @returns A new debounced function with a `cancel` method.
419
+ *
420
+ * @example
421
+ * const debouncedFunction = debounce(() => {
422
+ * console.log('Function executed');
423
+ * }, 1000);
424
+ *
425
+ * // Will log 'Function executed' after 1 second if not called again in that time
426
+ * debouncedFunction();
427
+ *
428
+ * // Will not log anything as the previous call is canceled
429
+ * debouncedFunction.cancel();
430
+ *
431
+ * // With AbortSignal
432
+ * const controller = new AbortController();
433
+ * const signal = controller.signal;
434
+ * const debouncedWithSignal = debounce(() => {
435
+ * console.log('Function executed');
436
+ * }, 1000, { signal });
437
+ *
438
+ * debouncedWithSignal();
439
+ *
440
+ * // Will cancel the debounced function call
441
+ * controller.abort();
442
+ */
443
+ function debounce$1(func, debounceMs, { signal, edges } = {}) {
444
+ let pendingThis = void 0;
445
+ let pendingArgs = null;
446
+ const leading = edges != null && edges.includes("leading");
447
+ const trailing = edges == null || edges.includes("trailing");
448
+ const invoke = () => {
449
+ if (pendingArgs !== null) {
450
+ func.apply(pendingThis, pendingArgs);
451
+ pendingThis = void 0;
452
+ pendingArgs = null;
453
+ }
454
+ };
455
+ const onTimerEnd = () => {
456
+ if (trailing) invoke();
457
+ cancel();
458
+ };
459
+ let timeoutId = null;
460
+ const schedule = () => {
461
+ if (timeoutId != null) clearTimeout(timeoutId);
462
+ timeoutId = setTimeout(() => {
463
+ timeoutId = null;
464
+ onTimerEnd();
465
+ }, debounceMs);
466
+ };
467
+ const cancelTimer = () => {
468
+ if (timeoutId !== null) {
469
+ clearTimeout(timeoutId);
470
+ timeoutId = null;
471
+ }
472
+ };
473
+ const cancel = () => {
474
+ cancelTimer();
475
+ pendingThis = void 0;
476
+ pendingArgs = null;
477
+ };
478
+ const flush = () => {
479
+ invoke();
480
+ };
481
+ const debounced = function(...args) {
482
+ if (signal?.aborted) return;
483
+ pendingThis = this;
484
+ pendingArgs = args;
485
+ const isFirstCall = timeoutId == null;
486
+ schedule();
487
+ if (leading && isFirstCall) invoke();
488
+ };
489
+ debounced.schedule = schedule;
490
+ debounced.cancel = cancel;
491
+ debounced.flush = flush;
492
+ signal?.addEventListener("abort", cancel, { once: true });
493
+ return debounced;
494
+ }
495
+ function init_debounce() {
496
+ return (init_debounce = __esmMin((() => {})))();
497
+ }
498
+ //#endregion
499
+ //#region ../../node_modules/es-toolkit/dist/function/throttle.mjs
500
+ /**
501
+ * Creates a throttled function that only invokes the provided function at most once
502
+ * per every `throttleMs` milliseconds. Subsequent calls to the throttled function
503
+ * within the wait time will not trigger the execution of the original function.
504
+ *
505
+ * @template F - The type of function.
506
+ * @param func - The function to throttle.
507
+ * @param throttleMs - The number of milliseconds to throttle executions to.
508
+ * @returns A new throttled function that accepts the same parameters as the original function.
509
+ *
510
+ * @example
511
+ * const throttledFunction = throttle(() => {
512
+ * console.log('Function executed');
513
+ * }, 1000);
514
+ *
515
+ * // Will log 'Function executed' immediately
516
+ * throttledFunction();
517
+ *
518
+ * // Will not log anything as it is within the throttle time
519
+ * throttledFunction();
520
+ *
521
+ * // After 1 second
522
+ * setTimeout(() => {
523
+ * throttledFunction(); // Will log 'Function executed'
524
+ * }, 1000);
525
+ */
526
+ function throttle(func, throttleMs, { signal, edges = ["leading", "trailing"] } = {}) {
527
+ let pendingAt = null;
528
+ const debounced = debounce$1(function(...args) {
529
+ pendingAt = Date.now();
530
+ func.apply(this, args);
531
+ }, throttleMs, {
532
+ signal,
533
+ edges
534
+ });
535
+ const throttled = function(...args) {
536
+ if (pendingAt == null) pendingAt = Date.now();
537
+ if (Date.now() - pendingAt >= throttleMs) {
538
+ pendingAt = Date.now();
539
+ func.apply(this, args);
540
+ debounced.cancel();
541
+ debounced.schedule();
542
+ return;
543
+ }
544
+ debounced.apply(this, args);
545
+ };
546
+ throttled.cancel = debounced.cancel;
547
+ throttled.flush = debounced.flush;
548
+ return throttled;
549
+ }
550
+ function init_throttle() {
551
+ return (init_throttle = __esmMin((() => {})))();
552
+ }
553
+ //#endregion
554
+ //#region ../../node_modules/compute-scroll-into-view/dist/index.js
555
+ var t, e, n, o, l, r;
556
+ function init_dist() {
557
+ return (init_dist = __esmMin((() => {
558
+ t = (t) => "object" == typeof t && null != t && 1 === t.nodeType;
559
+ e = (t, e) => (!e || "hidden" !== t) && "visible" !== t && "clip" !== t;
560
+ n = (t, n) => {
561
+ if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) {
562
+ const o = getComputedStyle(t, null);
563
+ return e(o.overflowY, n) || e(o.overflowX, n) || ((t) => {
564
+ const e = ((t) => {
565
+ if (!t.ownerDocument || !t.ownerDocument.defaultView) return null;
566
+ try {
567
+ return t.ownerDocument.defaultView.frameElement;
568
+ } catch (t) {
569
+ return null;
570
+ }
571
+ })(t);
572
+ return !!e && (e.clientHeight < t.scrollHeight || e.clientWidth < t.scrollWidth);
573
+ })(t);
574
+ }
575
+ return !1;
576
+ };
577
+ 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;
578
+ l = (t) => {
579
+ const e = t.parentElement;
580
+ return null == e ? t.getRootNode().host || null : e;
581
+ };
582
+ r = (e, r) => {
583
+ var i, s, d, h;
584
+ if ("undefined" == typeof document) return [];
585
+ const { scrollMode: c, block: f, inline: u, boundary: a, skipOverflowHiddenElements: g } = r, p = "function" == typeof a ? a : (t) => t !== a;
586
+ if (!t(e)) throw new TypeError("Invalid target");
587
+ const m = document.scrollingElement || document.documentElement, w = [];
588
+ let W = e;
589
+ for (; t(W) && p(W);) {
590
+ if (W = l(W), W === m) {
591
+ w.push(W);
592
+ break;
593
+ }
594
+ null != W && W === document.body && n(W) && !n(document.documentElement) || null != W && n(W, g) && w.push(W);
595
+ }
596
+ 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) => {
597
+ const e = window.getComputedStyle(t);
598
+ return {
599
+ top: parseFloat(e.scrollMarginTop) || 0,
600
+ right: parseFloat(e.scrollMarginRight) || 0,
601
+ bottom: parseFloat(e.scrollMarginBottom) || 0,
602
+ left: parseFloat(e.scrollMarginLeft) || 0
603
+ };
604
+ })(e);
605
+ 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;
606
+ const L = [];
607
+ for (let t = 0; t < w.length; t++) {
608
+ const e = w[t], { height: l, width: r, top: i, right: s, bottom: d, left: h } = e.getBoundingClientRect();
609
+ 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;
610
+ const a = getComputedStyle(e), g = parseInt(a.borderLeftWidth, 10), p = parseInt(a.borderTopWidth, 10), W = parseInt(a.borderRightWidth, 10), T = parseInt(a.borderBottomWidth, 10);
611
+ let B = 0, F = 0;
612
+ 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;
613
+ 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);
614
+ else {
615
+ 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);
616
+ const { scrollLeft: t, scrollTop: n } = e;
617
+ 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;
618
+ }
619
+ L.push({
620
+ el: e,
621
+ top: B,
622
+ left: F
623
+ });
624
+ }
625
+ return L;
626
+ };
627
+ })))();
628
+ }
629
+ //#endregion
630
+ //#region ../../node_modules/downshift/dist/downshift.esm.mjs
631
+ /**
632
+ * This generates a unique ID for an instance of Downshift
633
+ * @return {string} the unique ID
634
+ */
635
+ function generateId() {
636
+ return String(idCounter++);
637
+ }
638
+ function useLatestRef(value) {
639
+ var ref = useRef(value);
640
+ useIsomorphicLayoutEffect(function() {
641
+ ref.current = value;
642
+ }, [value]);
643
+ return ref;
644
+ }
645
+ function handleRefs() {
646
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) refs[_key] = arguments[_key];
647
+ return function(node) {
648
+ refs.forEach(function(ref) {
649
+ if (typeof ref === "function") ref(node);
650
+ else if (ref) ref.current = node;
651
+ });
652
+ };
653
+ }
654
+ /**
655
+ * This is intended to be used to compose event handlers.
656
+ * They are executed in order until one of them sets
657
+ * `event.preventDownshiftDefault = true`.
658
+ * @param fns the event handler functions
659
+ * @return the event handler to add to an element
660
+ */
661
+ function callAllEventHandlers() {
662
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) fns[_key] = arguments[_key];
663
+ return function(event) {
664
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
665
+ return fns.some(function(fn) {
666
+ if (fn) fn.apply(void 0, [event].concat(args));
667
+ return event.preventDownshiftDefault || event.hasOwnProperty("nativeEvent") && event.nativeEvent.preventDownshiftDefault;
668
+ });
669
+ };
670
+ }
671
+ /**
672
+ * Simple debounce implementation. Will call the given
673
+ * function once after the time given has passed since
674
+ * it was last called.
675
+ */
676
+ function debounce(fn, time) {
677
+ var timeoutId;
678
+ function cancel() {
679
+ if (timeoutId) clearTimeout(timeoutId);
680
+ }
681
+ function wrapper() {
682
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
683
+ cancel();
684
+ timeoutId = setTimeout(function() {
685
+ timeoutId = null;
686
+ fn.apply(void 0, args);
687
+ }, time);
688
+ }
689
+ wrapper.cancel = cancel;
690
+ return wrapper;
691
+ }
692
+ /**
693
+ * Get the status node or create it if it does not already exist.
694
+ */
695
+ function getStatusDiv(document) {
696
+ var statusDiv = document.getElementById("a11y-status-message");
697
+ if (statusDiv) return statusDiv;
698
+ statusDiv = document.createElement("div");
699
+ statusDiv.setAttribute("id", "a11y-status-message");
700
+ statusDiv.setAttribute("role", "status");
701
+ statusDiv.setAttribute("aria-live", "polite");
702
+ statusDiv.setAttribute("aria-relevant", "additions text");
703
+ Object.assign(statusDiv.style, {
704
+ border: "0",
705
+ clip: "rect(0 0 0 0)",
706
+ height: "1px",
707
+ margin: "-1px",
708
+ overflow: "hidden",
709
+ padding: "0",
710
+ position: "absolute",
711
+ width: "1px"
712
+ });
713
+ document.body.appendChild(statusDiv);
714
+ return statusDiv;
715
+ }
716
+ /**
717
+ * Sets aria live status to a div element that's visually hidden.
718
+ */
719
+ function setStatus(status, document) {
720
+ if (!status || !document) return;
721
+ var div = getStatusDiv(document);
722
+ div.textContent = status;
723
+ cleanupStatus(document);
724
+ }
725
+ /**
726
+ * Removes the status element from the DOM
727
+ */
728
+ function cleanupStatusDiv(document) {
729
+ var statusDiv = document == null ? void 0 : document.getElementById("a11y-status-message");
730
+ if (statusDiv) statusDiv.remove();
731
+ }
732
+ function noop() {}
733
+ /**
734
+ * This will perform a shallow merge of the given state object
735
+ * with the state coming from props
736
+ * (for the controlled component scenario)
737
+ * This is used in state updater functions so they're referencing
738
+ * the right state regardless of where it comes from.
739
+ *
740
+ * @param state The state of the component/hook.
741
+ * @param props The props that may contain controlled values.
742
+ * @returns The merged controlled state.
743
+ */
744
+ function getState(state, props) {
745
+ if (!props) return state;
746
+ return Object.keys(state).reduce(function(newState, key) {
747
+ if (props[key] !== void 0) newState[key] = props[key];
748
+ return newState;
749
+ }, _extends({}, state));
750
+ }
751
+ /**
752
+ * Scroll node into view if necessary
753
+ * @param {HTMLElement} node the element that should scroll into view
754
+ * @param {HTMLElement} menuNode the menu element of the component
755
+ */
756
+ function scrollIntoView(node, menuNode) {
757
+ if (!node) return;
758
+ r(node, {
759
+ boundary: menuNode,
760
+ block: "nearest",
761
+ scrollMode: "if-needed"
762
+ }).forEach(function(_ref) {
763
+ var el = _ref.el, top = _ref.top, left = _ref.left;
764
+ el.scrollTop = top;
765
+ el.scrollLeft = left;
766
+ });
767
+ }
768
+ /**
769
+ * Normalizes the 'key' property of a KeyboardEvent in IE/Edge
770
+ * @param event a keyboardEvent object
771
+ * @return keyboard key
772
+ */
773
+ function normalizeArrowKey(event) {
774
+ var key = event.key, keyCode = event.keyCode;
775
+ /* istanbul ignore next (ie) */
776
+ if (keyCode >= 37 && keyCode <= 40 && !key.startsWith("Arrow")) return "Arrow" + key;
777
+ return key;
778
+ }
779
+ /**
780
+ * Returns the next non-disabled highlightedIndex value.
781
+ *
782
+ * @param start The current highlightedIndex.
783
+ * @param backwards If true, it will search backwards from the start.
784
+ * @param items The items array.
785
+ * @param isItemDisabled Function that tells if an item is disabled or not.
786
+ * @param circular If the search reaches the end, if it can search again starting from the other end.
787
+ * @returns The next non-disabled index.
788
+ */
789
+ function getNonDisabledIndex(start, backwards, items, isItemDisabled, circular) {
790
+ if (circular === void 0) circular = false;
791
+ var count = items.length;
792
+ if (backwards) {
793
+ for (var index = start; index >= 0; index--) if (!isItemDisabled(items[index], index)) return index;
794
+ } else for (var _index = start; _index < count; _index++) if (!isItemDisabled(items[_index], _index)) return _index;
795
+ if (circular) return getNonDisabledIndex(backwards ? count - 1 : 0, backwards, items, isItemDisabled);
796
+ return -1;
797
+ }
798
+ /**
799
+ * Returns the next non-disabled highlightedIndex value.
800
+ *
801
+ * @param start The current highlightedIndex.
802
+ * @param offset The offset from the current highlightedIndex to start searching.
803
+ * @param items The items array.
804
+ * @param isItemDisabled Function that tells if an item is disabled or not.
805
+ * @param circular If the search reaches the end, if it can search again starting from the other end.
806
+ * @returns The next highlightedIndex.
807
+ */
808
+ function getHighlightedIndex(start, offset, items, isItemDisabled, circular) {
809
+ if (circular === void 0) circular = false;
810
+ var count = items.length;
811
+ if (count === 0) return -1;
812
+ var itemsLastIndex = count - 1;
813
+ if (typeof start !== "number" || start < 0 || start > itemsLastIndex) start = offset > 0 ? -1 : itemsLastIndex + 1;
814
+ var current = start + offset;
815
+ if (current < 0) current = circular ? itemsLastIndex : 0;
816
+ else if (current > itemsLastIndex) current = circular ? 0 : itemsLastIndex;
817
+ var highlightedIndex = getNonDisabledIndex(current, offset < 0, items, isItemDisabled, circular);
818
+ if (highlightedIndex === -1) return start >= count ? -1 : start;
819
+ return highlightedIndex;
820
+ }
821
+ /**
822
+ * Checks if event target is within the downshift elements.
823
+ *
824
+ * @param target Target to check.
825
+ * @param downshiftElements The elements that form downshift (list, toggle button etc).
826
+ * @param environment The window context where downshift renders.
827
+ * @param checkActiveElement Whether to also check activeElement.
828
+ *
829
+ * @returns Whether or not the target is within downshift elements.
830
+ */
831
+ function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
832
+ if (checkActiveElement === void 0) checkActiveElement = true;
833
+ return !!environment && downshiftElements.some(function(contextNode) {
834
+ return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));
835
+ });
836
+ }
837
+ /**
838
+ * @param parent the parent node
839
+ * @param child the child node
840
+ * @param environment The window context where downshift renders.
841
+ * @return Whether the parent is the child or the child is in the parent
842
+ */
843
+ function isOrContainsNode(parent, child, environment) {
844
+ return parent === child || child instanceof environment.Node && parent.contains(child);
845
+ }
846
+ /**
847
+ * Accepts a parameter and returns it if it's a function
848
+ * or a noop function if it's not. This allows us to
849
+ * accept a callback, but not worry about it if it's not
850
+ * passed.
851
+ * @param {Function} cb the callback
852
+ * @return {Function} a function
853
+ */
854
+ function cbToCb(cb) {
855
+ return typeof cb === "function" ? cb : noop;
856
+ }
857
+ /**
858
+ * Default implementation for status message. Only added when menu is open.
859
+ * Will specify if there are results in the list, and if so, how many,
860
+ * and what keys are relevant.
861
+ *
862
+ * @param {Object} param the downshift state and other relevant properties
863
+ * @return {String} the a11y status message
864
+ */
865
+ function getA11yStatusMessage(_ref) {
866
+ var isOpen = _ref.isOpen, resultCount = _ref.resultCount, previousResultCount = _ref.previousResultCount;
867
+ if (!isOpen) return "";
868
+ if (!resultCount) return "No results are available.";
869
+ if (resultCount !== previousResultCount) return resultCount + " result" + (resultCount === 1 ? " is" : "s are") + " available, use up and down arrow keys to navigate. Press Enter key to select.";
870
+ return "";
871
+ }
872
+ /**
873
+ * Takes an argument and if it's an array, returns the first item in the array
874
+ * otherwise returns the argument
875
+ * @param {*} arg the maybe-array
876
+ * @param {*} defaultValue the value if arg is falsey not defined
877
+ * @return {*} the arg or it's first item
878
+ */
879
+ function unwrapArray(arg, defaultValue) {
880
+ arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */ arg[0] : arg;
881
+ if (!arg && defaultValue) return defaultValue;
882
+ else return arg;
883
+ }
884
+ /**
885
+ * @param {Object} element (P)react element
886
+ * @return {Boolean} whether it's a DOM element
887
+ */
888
+ function isDOMElement(element) {
889
+ return typeof element.type === "string";
890
+ }
891
+ /**
892
+ * @param {Object} element (P)react element
893
+ * @return {Object} the props
894
+ */
895
+ function getElementProps(element) {
896
+ return element.props;
897
+ }
898
+ /**
899
+ * @param {Object} state the state object
900
+ * @return {Object} state that is relevant to downshift
901
+ */
902
+ function pickState(state) {
903
+ if (state === void 0) state = {};
904
+ var result = {};
905
+ stateKeys.forEach(function(k) {
906
+ if (state.hasOwnProperty(k)) result[k] = state[k];
907
+ });
908
+ return result;
909
+ }
910
+ function capitalizeString(string) {
911
+ return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
912
+ }
913
+ function callOnChangeProps(action, props, state, newState) {
914
+ var type = action.type;
915
+ var changes = {};
916
+ var keys = Object.keys(state);
917
+ for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
918
+ var key = _keys[_i];
919
+ invokeOnChangeHandler(key, action, props, state, newState);
920
+ if (newState[key] !== state[key]) changes[key] = newState[key];
921
+ }
922
+ if (typeof props.onStateChange === "function" && Object.keys(changes).length) props.onStateChange(_extends({ type }, changes));
923
+ }
924
+ function invokeOnChangeHandler(key, action, props, state, newState) {
925
+ if (newState[key] === state[key]) return;
926
+ var handler = props["on" + capitalizeString(key) + "Change"];
927
+ if (typeof handler !== "function") return;
928
+ var type = action.type;
929
+ handler(_extends({ type }, newState));
930
+ }
931
+ /**
932
+ * Computes the controlled state using a the previous state, props,
933
+ * two reducers, one from downshift and an optional one from the user.
934
+ * Also calls the onChange handlers for state values that have changed.
935
+ *
936
+ * @param reducer Reducer function from downshift.
937
+ * @param props The hook props, also passed to createInitialState.
938
+ * @param createInitialState Function that returns the initial state.
939
+ * @param isStateEqual Function that checks if a previous state is equal to the next.
940
+ * @returns An array with the state and an action dispatcher.
941
+ */
942
+ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
943
+ var prevStateRef = useRef({});
944
+ var enhancedReducer = useCallback(function(_ref, action) {
945
+ var state = _ref.state;
946
+ state = getState(state, action.props);
947
+ var changes = reducer(state, action);
948
+ var newState = action.props.stateReducer(state, _extends({}, action, { changes }));
949
+ return {
950
+ state: _extends({}, state, newState),
951
+ lastAction: action
952
+ };
953
+ }, [reducer]);
954
+ var _React$useReducer = useReducer(enhancedReducer, props, function(p) {
955
+ return {
956
+ state: createInitialState(p),
957
+ lastAction: void 0
958
+ };
959
+ }), _React$useReducer$ = _React$useReducer[0], state = _React$useReducer$.state, lastAction = _React$useReducer$.lastAction, dispatch = _React$useReducer[1];
960
+ var propsRef = useLatestRef(props);
961
+ var dispatchWithProps = useCallback(function(action) {
962
+ return dispatch(_extends({}, action, { props: propsRef.current }));
963
+ }, [propsRef]);
964
+ useEffect(function() {
965
+ if (lastAction) {
966
+ var prevState = getState(prevStateRef.current, lastAction.props);
967
+ if (!isStateEqual(prevState, state)) callOnChangeProps(lastAction, lastAction.props, prevState, state);
968
+ }
969
+ prevStateRef.current = state;
970
+ }, [
971
+ state,
972
+ lastAction,
973
+ isStateEqual
974
+ ]);
975
+ return [state, dispatchWithProps];
976
+ }
977
+ /**
978
+ * Wraps the useEnhancedReducer and applies the controlled prop values before
979
+ * returning the new state.
980
+ * @param reducer Reducer function from downshift.
981
+ * @param props The hook props, also passed to createInitialState.
982
+ * @param createInitialState Function that returns the initial state.
983
+ * @param isStateEqual Function that checks if a previous state is equal to the next.
984
+ * @returns An array with the state and an action dispatcher.
985
+ */
986
+ function useControlledReducer$1(reducer, props, createInitialState, isStateEqual) {
987
+ var _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual), state = _useEnhancedReducer[0], dispatch = _useEnhancedReducer[1];
988
+ return [getState(state, props), dispatch];
989
+ }
990
+ /**
991
+ * Returns both the item and index when both or either is passed.
992
+ *
993
+ * @param itemProp The item which could be undefined.
994
+ * @param indexProp The index which could be undefined.
995
+ * @param items The array of items to get the item based on index.
996
+ * @param errorMessage The error to be thrown if index and item could not be returned for any reason.
997
+ * @returns An array with item and index.
998
+ */
999
+ function getItemAndIndex(itemProp, indexProp, items, errorMessage) {
1000
+ if (itemProp !== void 0 && indexProp !== void 0) return [itemProp, indexProp];
1001
+ if (itemProp !== void 0) {
1002
+ if (items.indexOf(itemProp) < 0) throw new Error(errorMessage);
1003
+ return [itemProp, items.indexOf(itemProp)];
1004
+ }
1005
+ if (indexProp !== void 0) {
1006
+ var item = items[indexProp];
1007
+ if (item === void 0) throw new Error(errorMessage);
1008
+ return [item, indexProp];
1009
+ }
1010
+ throw new Error(errorMessage);
1011
+ }
1012
+ /**
1013
+ * Tracks if it's the first render.
1014
+ */
1015
+ function useIsInitialMount() {
1016
+ var isInitialMountRef = useRef(true);
1017
+ useEffect(function() {
1018
+ isInitialMountRef.current = false;
1019
+ return function() {
1020
+ isInitialMountRef.current = true;
1021
+ };
1022
+ }, []);
1023
+ return isInitialMountRef.current;
1024
+ }
1025
+ /**
1026
+ * Returns the default value based on the defaultProp and defaultStateValue.
1027
+ *
1028
+ * @param defaultProp The default prop value.
1029
+ * @param defaultStateValue The default state value.
1030
+ * @returns The resolved default value.
1031
+ */
1032
+ function getDefaultValue(defaultProp, defaultStateValue) {
1033
+ return defaultProp === void 0 ? defaultStateValue : defaultProp;
1034
+ }
1035
+ /**
1036
+ * Returns the initial value for a state variable, based on the following precedence:
1037
+ * 1. The controlled value (if it's not undefined)
1038
+ * 2. The initialValue (if it's not undefined)
1039
+ * 3. The defaultValue (if it's not undefined)
1040
+ * 4. The defaultStateValue
1041
+ *
1042
+ * @param value The controlled value of the state variable.
1043
+ * @param initialValue The initial value of the state variable.
1044
+ * @param defaultValue The default value of the state variable.
1045
+ * @param defaultStateValue The default state value to use if all other values are undefined.
1046
+ * @returns The initial value for the state variable.
1047
+ */
1048
+ function getInitialValue(value, initialValue, defaultValue, defaultStateValue) {
1049
+ if (value !== void 0) return value;
1050
+ if (initialValue !== void 0) return initialValue;
1051
+ if (defaultValue !== void 0) return defaultValue;
1052
+ return defaultStateValue;
1053
+ }
1054
+ /**
1055
+ * Adds an a11y aria live status message if getA11yStatusMessage is passed.
1056
+ * @param getA11yStatusMessage The function that builds the status message.
1057
+ * @param options The options to be passed to getA11yStatusMessage if called.
1058
+ * @param dependencyArray The dependency array that triggers the status message setter via useEffect.
1059
+ * @param environment The environment object containing the document.
1060
+ */
1061
+ function useA11yMessageStatus(getA11yStatusMessage, options, dependencyArray, environment) {
1062
+ var document = environment == null ? void 0 : environment.document;
1063
+ var isInitialMount = useIsInitialMount();
1064
+ useEffect(function() {
1065
+ if (!getA11yStatusMessage || isInitialMount || !document) return;
1066
+ updateA11yStatus(getA11yStatusMessage(options), document);
1067
+ }, dependencyArray);
1068
+ useEffect(function() {
1069
+ return function() {
1070
+ updateA11yStatus.cancel();
1071
+ cleanupStatusDiv(document);
1072
+ };
1073
+ }, [document]);
1074
+ }
1075
+ function useElementIdsR18$1(_ref) {
1076
+ var id = _ref.id, labelId = _ref.labelId, menuId = _ref.menuId, getItemId = _ref.getItemId, toggleButtonId = _ref.toggleButtonId, inputId = _ref.inputId;
1077
+ var reactId = "downshift-" + reactUseId$1();
1078
+ if (!id) id = reactId;
1079
+ return useMemo(function() {
1080
+ return {
1081
+ labelId: labelId != null ? labelId : id + "-label",
1082
+ menuId: menuId != null ? menuId : id + "-menu",
1083
+ getItemId: getItemId != null ? getItemId : function(index) {
1084
+ return id + "-item-" + index;
1085
+ },
1086
+ toggleButtonId: toggleButtonId != null ? toggleButtonId : id + "-toggle-button",
1087
+ inputId: inputId != null ? inputId : id + "-input"
1088
+ };
1089
+ }, [
1090
+ getItemId,
1091
+ id,
1092
+ inputId,
1093
+ labelId,
1094
+ menuId,
1095
+ toggleButtonId
1096
+ ]);
1097
+ }
1098
+ function useElementIdsLegacy$1(_ref2) {
1099
+ var id = _ref2.id, labelId = _ref2.labelId, menuId = _ref2.menuId, getItemId = _ref2.getItemId, toggleButtonId = _ref2.toggleButtonId, inputId = _ref2.inputId;
1100
+ var baseId = useState(function() {
1101
+ return id != null ? id : "downshift-" + generateId();
1102
+ })[0];
1103
+ return useMemo(function() {
1104
+ return {
1105
+ labelId: labelId != null ? labelId : baseId + "-label",
1106
+ menuId: menuId != null ? menuId : baseId + "-menu",
1107
+ getItemId: getItemId != null ? getItemId : function(index) {
1108
+ return baseId + "-item-" + index;
1109
+ },
1110
+ toggleButtonId: toggleButtonId != null ? toggleButtonId : baseId + "-toggle-button",
1111
+ inputId: inputId != null ? inputId : baseId + "-input"
1112
+ };
1113
+ }, [
1114
+ getItemId,
1115
+ inputId,
1116
+ labelId,
1117
+ menuId,
1118
+ toggleButtonId,
1119
+ baseId
1120
+ ]);
1121
+ }
1122
+ /**
1123
+ * Returns the new highlightedIndex based on the defaultHighlightedIndex prop, if it's not disabled.
1124
+ *
1125
+ * @param props Props passed to the hook.
1126
+ * @returns The highlighted index.
1127
+ */
1128
+ function getDefaultHighlightedIndex(items, isItemDisabled, defaultHighlightedIndex) {
1129
+ var highlightedIndex = getDefaultValue(defaultHighlightedIndex, dropdownDefaultStateValues.highlightedIndex);
1130
+ if (items[highlightedIndex] && isItemDisabled(items[highlightedIndex], highlightedIndex)) return -1;
1131
+ return highlightedIndex;
1132
+ }
1133
+ /**
1134
+ * Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted.
1135
+ * In that case, selects the item and resets to defaults for open state and highlighted idex.
1136
+ *
1137
+ * @param props The Dropdown props.
1138
+ * @param highlightedIndex The index from the state.
1139
+ * @param inputValue Also return the input value for state.
1140
+ * @returns The changes for the state.
1141
+ */
1142
+ function getChangesOnSelection(items, itemToString, defaultIsOpen, defaultHighlightedIndex, highlightedIndex, inputValue) {
1143
+ var shouldSelect = items.length && highlightedIndex >= 0;
1144
+ return _extends({
1145
+ isOpen: false,
1146
+ highlightedIndex: -1
1147
+ }, shouldSelect && _extends({
1148
+ selectedItem: items[highlightedIndex],
1149
+ isOpen: getDefaultValue(defaultIsOpen, dropdownDefaultStateValues.isOpen),
1150
+ highlightedIndex: getDefaultValue(defaultHighlightedIndex, dropdownDefaultStateValues.highlightedIndex)
1151
+ }, inputValue && { inputValue: itemToString(items[highlightedIndex]) }));
1152
+ }
1153
+ /**
1154
+ * Returns the highlighted index when the menu is opened.
1155
+ * Takes into account the initialHighlightedIndex, defaultHighlightedIndex,
1156
+ * selectedItem, and the open direction offset.
1157
+ *
1158
+ * @param items The list of items.
1159
+ * @param initialHighlightedIndex The initial highlighted index prop.
1160
+ * @param defaultHighlightedIndex The default highlighted index prop.
1161
+ * @param isItemDisabled Callback to determine if an item is disabled.
1162
+ * @param itemToKey Callback to get a unique key from an item.
1163
+ * @param selectedItem The currently selected item.
1164
+ * @param highlightedIndex The current highlighted index from state.
1165
+ * @param offset The direction of navigation: positive opens downward, negative opens upward.
1166
+ * @returns The new highlighted index.
1167
+ */
1168
+ function getHighlightedIndexOnOpen(items, initialHighlightedIndex, defaultHighlightedIndex, isItemDisabled, itemToKey, selectedItem, highlightedIndex, offset) {
1169
+ if (items.length === 0) return -1;
1170
+ if (initialHighlightedIndex !== void 0 && highlightedIndex === initialHighlightedIndex && (initialHighlightedIndex === -1 || items[initialHighlightedIndex] !== void 0 && !isItemDisabled(items[initialHighlightedIndex], initialHighlightedIndex))) return initialHighlightedIndex;
1171
+ if (defaultHighlightedIndex !== void 0 && (defaultHighlightedIndex === -1 || items[defaultHighlightedIndex] !== void 0 && !isItemDisabled(items[defaultHighlightedIndex], defaultHighlightedIndex))) return defaultHighlightedIndex;
1172
+ if (selectedItem) return items.findIndex(function(item) {
1173
+ return itemToKey(selectedItem) === itemToKey(item);
1174
+ });
1175
+ if (offset < 0 && items[items.length - 1] && !isItemDisabled(items[items.length - 1], items.length - 1)) return items.length - 1;
1176
+ if (offset > 0 && items[0] && !isItemDisabled(items[0], 0)) return 0;
1177
+ return -1;
1178
+ }
1179
+ function getInitialState$3(props) {
1180
+ var selectedItem = getInitialValue(props.selectedItem, props.initialSelectedItem, props.defaultSelectedItem, dropdownDefaultStateValues.selectedItem);
1181
+ var isOpen = getInitialValue(props.isOpen, props.initialIsOpen, props.defaultIsOpen, dropdownDefaultStateValues.isOpen);
1182
+ var highlightedIndex = getInitialHighlightedIndex(props);
1183
+ var inputValue = getInitialValue(props.inputValue, props.initialInputValue, props.defaultInputValue, dropdownDefaultStateValues.inputValue);
1184
+ return {
1185
+ highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.findIndex(function(item) {
1186
+ return props.itemToKey(item) === props.itemToKey(selectedItem);
1187
+ }) : highlightedIndex,
1188
+ isOpen,
1189
+ selectedItem,
1190
+ inputValue
1191
+ };
1192
+ }
1193
+ /**
1194
+ * Returns the new highlightedIndex based on the initialHighlightedIndex prop, if not disabled.
1195
+ * @param props Props from useCombobox or useSelect.
1196
+ * @returns The highlighted index.
1197
+ */
1198
+ function getInitialHighlightedIndex(props) {
1199
+ var highlightedIndex = getInitialValue(props.highlightedIndex, props.initialHighlightedIndex, props.defaultHighlightedIndex, dropdownDefaultStateValues.highlightedIndex);
1200
+ if (highlightedIndex > -1 && props.items[highlightedIndex] && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) return -1;
1201
+ return highlightedIndex;
1202
+ }
1203
+ /**
1204
+ * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
1205
+ *
1206
+ * @param environment The environment to add the event listeners to, for instance window.
1207
+ * @param handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
1208
+ * @param downshiftRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.
1209
+ * @returns A ref holding the mouse and touch events information. Read `.current` only inside event handlers/effects.
1210
+ */
1211
+ function useMouseAndTouchTracker(environment, handleBlur, downshiftRefs) {
1212
+ var mouseAndTouchTrackersRef = useRef({
1213
+ isMouseDown: false,
1214
+ isTouchMove: false,
1215
+ isTouchEnd: false
1216
+ });
1217
+ var getDownshiftElements = useCallback(function() {
1218
+ return downshiftRefs.map(function(ref) {
1219
+ return ref.current;
1220
+ });
1221
+ }, [downshiftRefs]);
1222
+ useEffect(function() {
1223
+ if (!environment) return noop;
1224
+ function onMouseDown() {
1225
+ mouseAndTouchTrackersRef.current.isTouchEnd = false;
1226
+ mouseAndTouchTrackersRef.current.isMouseDown = true;
1227
+ }
1228
+ function onMouseUp(event) {
1229
+ mouseAndTouchTrackersRef.current.isMouseDown = false;
1230
+ if (!targetWithinDownshift(event.target, getDownshiftElements(), environment)) handleBlur();
1231
+ }
1232
+ function onTouchStart() {
1233
+ mouseAndTouchTrackersRef.current.isTouchEnd = false;
1234
+ mouseAndTouchTrackersRef.current.isTouchMove = false;
1235
+ }
1236
+ function onTouchMove() {
1237
+ mouseAndTouchTrackersRef.current.isTouchMove = true;
1238
+ }
1239
+ function onTouchEnd(event) {
1240
+ mouseAndTouchTrackersRef.current.isTouchEnd = true;
1241
+ if (!mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, getDownshiftElements(), environment, false)) handleBlur();
1242
+ }
1243
+ environment.addEventListener("mousedown", onMouseDown);
1244
+ environment.addEventListener("mouseup", onMouseUp);
1245
+ environment.addEventListener("touchstart", onTouchStart);
1246
+ environment.addEventListener("touchmove", onTouchMove);
1247
+ environment.addEventListener("touchend", onTouchEnd);
1248
+ return function cleanup() {
1249
+ environment.removeEventListener("mousedown", onMouseDown);
1250
+ environment.removeEventListener("mouseup", onMouseUp);
1251
+ environment.removeEventListener("touchstart", onTouchStart);
1252
+ environment.removeEventListener("touchmove", onTouchMove);
1253
+ environment.removeEventListener("touchend", onTouchEnd);
1254
+ };
1255
+ }, [
1256
+ environment,
1257
+ getDownshiftElements,
1258
+ handleBlur
1259
+ ]);
1260
+ return mouseAndTouchTrackersRef;
1261
+ }
1262
+ /**
1263
+ * Utility hook that scrolls an item from a menu into view.
1264
+ * @param scrollIntoView The function that does the scroll.
1265
+ * @param highlightedIndex The index of the item that should be scrolled.
1266
+ * @param isOpen If the menu is open or not.
1267
+ * @param menuRef The ref to the menu element.
1268
+ * @param itemsRef The ref to the object containing item elements.
1269
+ * @param getItemId The function to get the item id from index.
1270
+ * @returns Function that when called prevents the scroll.
1271
+ */
1272
+ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuRef, itemsRef, getItemId) {
1273
+ var shouldScrollRef = useRef(true);
1274
+ useIsomorphicLayoutEffect(function() {
1275
+ if (highlightedIndex < 0 || !isOpen || !Object.keys(itemsRef.current).length) return;
1276
+ if (shouldScrollRef.current) {
1277
+ var itemElement = itemsRef.current[getItemId(highlightedIndex)];
1278
+ if (itemElement && menuRef.current) scrollIntoView(itemElement, menuRef.current);
1279
+ } else shouldScrollRef.current = true;
1280
+ }, [highlightedIndex]);
1281
+ return useCallback(function preventScroll() {
1282
+ shouldScrollRef.current = false;
1283
+ }, []);
1284
+ }
1285
+ /**
1286
+ * Check if a state is equal for dropdowns, by comparing isOpen, inputValue, highlightedIndex and selected item.
1287
+ * Used by useSelect and useCombobox.
1288
+ *
1289
+ * @param prevState The previous dropdown state.
1290
+ * @param newState The new dropdown state.
1291
+ * @returns Whether the states are deeply equal.
1292
+ */
1293
+ function isDropdownStateEqual(prevState, newState) {
1294
+ return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;
1295
+ }
1296
+ function downshiftCommonReducer(state, props, action, stateChangeTypes) {
1297
+ var type = action.type;
1298
+ var changes;
1299
+ switch (type) {
1300
+ case stateChangeTypes.ItemMouseMove:
1301
+ changes = { highlightedIndex: action.disabled ? -1 : action.index };
1302
+ break;
1303
+ case stateChangeTypes.MenuMouseLeave:
1304
+ changes = { highlightedIndex: -1 };
1305
+ break;
1306
+ case stateChangeTypes.ToggleButtonClick:
1307
+ case stateChangeTypes.FunctionToggleMenu:
1308
+ changes = {
1309
+ isOpen: !state.isOpen,
1310
+ highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props.items, props.initialHighlightedIndex, props.defaultHighlightedIndex, props.isItemDisabled, props.itemToKey, state.selectedItem, state.highlightedIndex, 0)
1311
+ };
1312
+ break;
1313
+ case stateChangeTypes.FunctionOpenMenu:
1314
+ changes = {
1315
+ isOpen: true,
1316
+ highlightedIndex: getHighlightedIndexOnOpen(props.items, props.initialHighlightedIndex, props.defaultHighlightedIndex, props.isItemDisabled, props.itemToKey, state.selectedItem, state.highlightedIndex, 0)
1317
+ };
1318
+ break;
1319
+ case stateChangeTypes.FunctionCloseMenu:
1320
+ changes = { isOpen: false };
1321
+ break;
1322
+ case stateChangeTypes.FunctionSetHighlightedIndex:
1323
+ var highlightedIndex = action.highlightedIndex;
1324
+ changes = { highlightedIndex: props.isItemDisabled(props.items[highlightedIndex], highlightedIndex) ? -1 : highlightedIndex };
1325
+ break;
1326
+ case stateChangeTypes.FunctionSetInputValue:
1327
+ changes = { inputValue: action.inputValue };
1328
+ break;
1329
+ case stateChangeTypes.FunctionReset:
1330
+ changes = {
1331
+ highlightedIndex: getDefaultHighlightedIndex(props.items, props.isItemDisabled, props.defaultHighlightedIndex),
1332
+ isOpen: getDefaultValue(props.defaultIsOpen, dropdownDefaultStateValues.isOpen),
1333
+ selectedItem: getDefaultValue(props.defaultSelectedItem, dropdownDefaultStateValues.selectedItem),
1334
+ inputValue: getDefaultValue(props.defaultInputValue, dropdownDefaultStateValues.inputValue)
1335
+ };
1336
+ break;
1337
+ default: throw new Error("Reducer called without proper action type.");
1338
+ }
1339
+ return _extends({}, state, changes);
1340
+ }
1341
+ function getItemIndexByCharacterKey(_ref) {
1342
+ var keysSoFar = _ref.keysSoFar, highlightedIndex = _ref.highlightedIndex, items = _ref.items, itemToString = _ref.itemToString, isItemDisabled = _ref.isItemDisabled;
1343
+ var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
1344
+ for (var _index = 0; _index < items.length; _index++) {
1345
+ var offsetIndex = (_index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length;
1346
+ var _item = items[offsetIndex];
1347
+ if (_item !== void 0 && itemToString(_item).toLowerCase().startsWith(lowerCasedKeysSoFar) && !isItemDisabled(_item, offsetIndex)) return offsetIndex;
1348
+ }
1349
+ return highlightedIndex;
1350
+ }
1351
+ function downshiftSelectReducer(state, action) {
1352
+ var type = action.type, props = action.props;
1353
+ var changes;
1354
+ switch (type) {
1355
+ case ItemClick$1:
1356
+ changes = {
1357
+ isOpen: getDefaultValue(props.defaultIsOpen, dropdownDefaultStateValues.isOpen),
1358
+ highlightedIndex: getDefaultHighlightedIndex(props.items, props.isItemDisabled, props.defaultHighlightedIndex),
1359
+ selectedItem: props.items[action.index]
1360
+ };
1361
+ break;
1362
+ case ToggleButtonKeyDownCharacter:
1363
+ var lowercasedKey = action.key;
1364
+ var inputValue = "" + state.inputValue + lowercasedKey;
1365
+ changes = {
1366
+ inputValue,
1367
+ highlightedIndex: getItemIndexByCharacterKey({
1368
+ keysSoFar: inputValue,
1369
+ highlightedIndex: !state.isOpen && state.selectedItem ? props.items.findIndex(function(item) {
1370
+ return props.itemToKey(item) === props.itemToKey(state.selectedItem);
1371
+ }) : state.highlightedIndex,
1372
+ items: props.items,
1373
+ itemToString: props.itemToString,
1374
+ isItemDisabled: props.isItemDisabled
1375
+ }),
1376
+ isOpen: true
1377
+ };
1378
+ break;
1379
+ case ToggleButtonKeyDownArrowDown:
1380
+ var altKey = action.altKey;
1381
+ changes = {
1382
+ highlightedIndex: state.isOpen ? getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled) : altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props.items, props.initialHighlightedIndex, props.defaultHighlightedIndex, props.isItemDisabled, props.itemToKey, state.selectedItem, state.highlightedIndex, 1),
1383
+ isOpen: true
1384
+ };
1385
+ break;
1386
+ case ToggleButtonKeyDownArrowUp:
1387
+ var _altKey = action.altKey;
1388
+ if (state.isOpen && _altKey) changes = getChangesOnSelection(props.items, props.itemToString, props.defaultIsOpen, props.defaultHighlightedIndex, state.highlightedIndex, false);
1389
+ else changes = {
1390
+ highlightedIndex: state.isOpen ? getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled) : getHighlightedIndexOnOpen(props.items, props.initialHighlightedIndex, props.defaultHighlightedIndex, props.isItemDisabled, props.itemToKey, state.selectedItem, state.highlightedIndex, -1),
1391
+ isOpen: true
1392
+ };
1393
+ break;
1394
+ case ToggleButtonKeyDownEnter:
1395
+ case ToggleButtonKeyDownSpaceButton:
1396
+ changes = getChangesOnSelection(props.items, props.itemToString, props.defaultIsOpen, props.defaultHighlightedIndex, state.highlightedIndex, false);
1397
+ break;
1398
+ case ToggleButtonKeyDownHome:
1399
+ changes = {
1400
+ highlightedIndex: getNonDisabledIndex(0, false, props.items, props.isItemDisabled),
1401
+ isOpen: true
1402
+ };
1403
+ break;
1404
+ case ToggleButtonKeyDownEnd:
1405
+ changes = {
1406
+ highlightedIndex: getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled),
1407
+ isOpen: true
1408
+ };
1409
+ break;
1410
+ case ToggleButtonKeyDownPageUp:
1411
+ changes = { highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled) };
1412
+ break;
1413
+ case ToggleButtonKeyDownPageDown:
1414
+ changes = { highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled) };
1415
+ break;
1416
+ case ToggleButtonKeyDownEscape:
1417
+ changes = {
1418
+ isOpen: false,
1419
+ highlightedIndex: -1
1420
+ };
1421
+ break;
1422
+ case ToggleButtonBlur:
1423
+ changes = _extends({
1424
+ isOpen: false,
1425
+ highlightedIndex: -1
1426
+ }, state.highlightedIndex >= 0 && props.items.length && { selectedItem: props.items[state.highlightedIndex] });
1427
+ break;
1428
+ case FunctionSelectItem$1:
1429
+ changes = { selectedItem: action.selectedItem };
1430
+ break;
1431
+ default: return downshiftCommonReducer(state, props, action, stateChangeTypes$3);
1432
+ }
1433
+ return _extends({}, state, changes);
1434
+ }
1435
+ function useSelect(userProps) {
1436
+ if (userProps === void 0) userProps = {};
1437
+ validatePropTypes$1(userProps, useSelect, propTypes$3);
1438
+ var props = _extends({}, dropdownDefaultProps, userProps);
1439
+ var items = props.items, isItemDisabled = props.isItemDisabled, scrollIntoView = props.scrollIntoView, environment = props.environment, getA11yStatusMessage = props.getA11yStatusMessage;
1440
+ var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, props, getInitialState$3, isDropdownStateEqual), state = _useControlledReducer[0], dispatch = _useControlledReducer[1];
1441
+ var isOpen = state.isOpen, highlightedIndex = state.highlightedIndex, selectedItem = state.selectedItem, inputValue = state.inputValue;
1442
+ var toggleButtonRef = useRef(null);
1443
+ var menuRef = useRef(null);
1444
+ var itemsRef = useRef({});
1445
+ var clearTimeoutRef = useRef(null);
1446
+ var elementIds = useElementIds$1(props);
1447
+ /**
1448
+ * Ref to read `state` in handlers to preserve referential identity.
1449
+ * Only to be used in handlers and effects.
1450
+ * **never access this in getters**
1451
+ */
1452
+ var stateRef = useLatestRef(state);
1453
+ useA11yMessageStatus(getA11yStatusMessage, state, [
1454
+ isOpen,
1455
+ highlightedIndex,
1456
+ selectedItem,
1457
+ inputValue
1458
+ ], environment);
1459
+ var preventScroll = useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuRef, itemsRef, elementIds.getItemId);
1460
+ useEffect(function() {
1461
+ clearTimeoutRef.current = debounce(function(outerDispatch) {
1462
+ outerDispatch({
1463
+ type: FunctionSetInputValue$1,
1464
+ inputValue: ""
1465
+ });
1466
+ }, 500);
1467
+ return function() {
1468
+ var _clearTimeoutRef$curr;
1469
+ (_clearTimeoutRef$curr = clearTimeoutRef.current) == null || _clearTimeoutRef$curr.cancel();
1470
+ };
1471
+ }, []);
1472
+ useEffect(function() {
1473
+ if (!inputValue) return;
1474
+ clearTimeoutRef.current == null || clearTimeoutRef.current(dispatch);
1475
+ }, [dispatch, inputValue]);
1476
+ useControlPropsValidator({
1477
+ props,
1478
+ state
1479
+ });
1480
+ useEffect(function() {
1481
+ if (getInitialValue(props.isOpen, props.initialIsOpen, props.defaultIsOpen, dropdownDefaultStateValues.isOpen) && toggleButtonRef.current) toggleButtonRef.current.focus();
1482
+ }, []);
1483
+ var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, useCallback(function handleBlur() {
1484
+ if (stateRef.current.isOpen) dispatch({ type: ToggleButtonBlur });
1485
+ }, [dispatch, stateRef]), useMemo(function() {
1486
+ return [menuRef, toggleButtonRef];
1487
+ }, []));
1488
+ var setGetterPropCallInfo = useGetterPropsCalledChecker("getMenuProps", "getToggleButtonProps");
1489
+ useEffect(function() {
1490
+ if (!isOpen) itemsRef.current = {};
1491
+ }, [isOpen]);
1492
+ var toggleButtonKeyDownHandlers = useMemo(function() {
1493
+ return {
1494
+ ArrowDown: function ArrowDown(event) {
1495
+ event.preventDefault();
1496
+ dispatch({
1497
+ type: ToggleButtonKeyDownArrowDown,
1498
+ altKey: event.altKey
1499
+ });
1500
+ },
1501
+ ArrowUp: function ArrowUp(event) {
1502
+ event.preventDefault();
1503
+ dispatch({
1504
+ type: ToggleButtonKeyDownArrowUp,
1505
+ altKey: event.altKey
1506
+ });
1507
+ },
1508
+ Home: function Home(event) {
1509
+ event.preventDefault();
1510
+ dispatch({ type: ToggleButtonKeyDownHome });
1511
+ },
1512
+ End: function End(event) {
1513
+ event.preventDefault();
1514
+ dispatch({ type: ToggleButtonKeyDownEnd });
1515
+ },
1516
+ Escape: function Escape() {
1517
+ if (stateRef.current.isOpen) dispatch({ type: ToggleButtonKeyDownEscape });
1518
+ },
1519
+ Enter: function Enter(event) {
1520
+ event.preventDefault();
1521
+ dispatch({ type: stateRef.current.isOpen ? ToggleButtonKeyDownEnter : ToggleButtonClick$1 });
1522
+ },
1523
+ PageUp: function PageUp(event) {
1524
+ if (stateRef.current.isOpen) {
1525
+ event.preventDefault();
1526
+ dispatch({ type: ToggleButtonKeyDownPageUp });
1527
+ }
1528
+ },
1529
+ PageDown: function PageDown(event) {
1530
+ if (stateRef.current.isOpen) {
1531
+ event.preventDefault();
1532
+ dispatch({ type: ToggleButtonKeyDownPageDown });
1533
+ }
1534
+ },
1535
+ " ": function _(event) {
1536
+ event.preventDefault();
1537
+ var currentState = stateRef.current;
1538
+ if (!currentState.isOpen) {
1539
+ dispatch({ type: ToggleButtonClick$1 });
1540
+ return;
1541
+ }
1542
+ if (currentState.inputValue) dispatch({
1543
+ type: ToggleButtonKeyDownCharacter,
1544
+ key: " "
1545
+ });
1546
+ else dispatch({ type: ToggleButtonKeyDownSpaceButton });
1547
+ }
1548
+ };
1549
+ }, [dispatch, stateRef]);
1550
+ var getLabelProps = useCallback(function(labelProps) {
1551
+ var _ref = labelProps != null ? labelProps : {}, onClick = _ref.onClick, rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
1552
+ return _extends({
1553
+ id: elementIds.labelId,
1554
+ htmlFor: elementIds.toggleButtonId,
1555
+ onClick: callAllEventHandlers(onClick, function labelHandleClick() {
1556
+ var _toggleButtonRef$curr;
1557
+ (_toggleButtonRef$curr = toggleButtonRef.current) == null || _toggleButtonRef$curr.focus();
1558
+ })
1559
+ }, rest);
1560
+ }, [elementIds]);
1561
+ var getMenuProps = useCallback(function(menuProps, otherProps) {
1562
+ var _extends2;
1563
+ var _ref2 = menuProps != null ? menuProps : {}, onMouseLeave = _ref2.onMouseLeave, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, ref = _ref2.ref, ariaLabel = _ref2["aria-label"], rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$3);
1564
+ var _ref3$suppressRefErro = (otherProps != null ? otherProps : {}).suppressRefError, suppressRefError = _ref3$suppressRefErro === void 0 ? false : _ref3$suppressRefErro;
1565
+ var menuHandleMouseLeave = function menuHandleMouseLeave() {
1566
+ dispatch({ type: MenuMouseLeave$1 });
1567
+ };
1568
+ setGetterPropCallInfo("getMenuProps", suppressRefError, refKey, menuRef);
1569
+ return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function(menuNode) {
1570
+ menuRef.current = menuNode;
1571
+ }), _extends2.id = elementIds.menuId, _extends2.role = "listbox", _extends2["aria-label"] = ariaLabel, _extends2["aria-labelledby"] = ariaLabel ? void 0 : "" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends2), rest);
1572
+ }, [
1573
+ dispatch,
1574
+ setGetterPropCallInfo,
1575
+ elementIds
1576
+ ]);
1577
+ var getToggleButtonProps = useCallback(function(toggleButtonProps, otherProps) {
1578
+ var _extends3;
1579
+ var _ref4 = toggleButtonProps != null ? toggleButtonProps : {}, onBlur = _ref4.onBlur, onClick = _ref4.onClick;
1580
+ _ref4.onPress;
1581
+ var onKeyDown = _ref4.onKeyDown, _ref4$refKey = _ref4.refKey, refKey = _ref4$refKey === void 0 ? "ref" : _ref4$refKey, ref = _ref4.ref, rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);
1582
+ var _ref5$suppressRefErro = (otherProps != null ? otherProps : {}).suppressRefError, suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;
1583
+ var toggleButtonHandleClick = function toggleButtonHandleClick() {
1584
+ dispatch({ type: ToggleButtonClick$1 });
1585
+ };
1586
+ var toggleButtonHandleBlur = function toggleButtonHandleBlur() {
1587
+ if (stateRef.current.isOpen && !mouseAndTouchTrackers.current.isMouseDown) dispatch({ type: ToggleButtonBlur });
1588
+ };
1589
+ var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {
1590
+ var key = normalizeArrowKey(event);
1591
+ if (key && key in toggleButtonKeyDownHandlers) toggleButtonKeyDownHandlers[key](event);
1592
+ else if (/^\S{1}$/.test(key)) dispatch({
1593
+ type: ToggleButtonKeyDownCharacter,
1594
+ key
1595
+ });
1596
+ };
1597
+ var toggleProps = _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function(toggleButtonNode) {
1598
+ toggleButtonRef.current = toggleButtonNode;
1599
+ }), _extends3["aria-activedescendant"] = isOpen && highlightedIndex > -1 ? elementIds.getItemId(highlightedIndex) : "", _extends3["aria-controls"] = elementIds.menuId, _extends3["aria-expanded"] = isOpen, _extends3["aria-haspopup"] = "listbox", _extends3["aria-labelledby"] = rest["aria-label"] ? void 0 : "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = "combobox", _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);
1600
+ if (!rest.disabled) Object.assign(toggleProps, {
1601
+ onClick: callAllEventHandlers(onClick, toggleButtonHandleClick),
1602
+ onKeyDown: callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown)
1603
+ });
1604
+ setGetterPropCallInfo("getToggleButtonProps", suppressRefError, refKey, toggleButtonRef);
1605
+ return toggleProps;
1606
+ }, [
1607
+ dispatch,
1608
+ elementIds,
1609
+ isOpen,
1610
+ highlightedIndex,
1611
+ mouseAndTouchTrackers,
1612
+ setGetterPropCallInfo,
1613
+ toggleButtonKeyDownHandlers,
1614
+ stateRef
1615
+ ]);
1616
+ var getItemProps = useCallback(function(itemProps) {
1617
+ var _extends4;
1618
+ var _ref6 = itemProps != null ? itemProps : {}, itemProp = _ref6.item, indexProp = _ref6.index, onMouseMove = _ref6.onMouseMove, onClick = _ref6.onClick, onMouseDown = _ref6.onMouseDown;
1619
+ _ref6.onPress;
1620
+ var _ref6$refKey = _ref6.refKey, refKey = _ref6$refKey === void 0 ? "ref" : _ref6$refKey, disabledProp = _ref6.disabled, ref = _ref6.ref, rest = _objectWithoutPropertiesLoose(_ref6, _excluded4$1);
1621
+ if (disabledProp !== void 0) console.warn("Passing \"disabled\" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.");
1622
+ var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, items, "Pass either item or index to getItemProps!"), item = _getItemAndIndex[0], index = _getItemAndIndex[1];
1623
+ var disabled = isItemDisabled(item, index);
1624
+ var itemHandleMouseMove = function itemHandleMouseMove() {
1625
+ if (mouseAndTouchTrackers.current.isTouchEnd || index === stateRef.current.highlightedIndex) return;
1626
+ preventScroll();
1627
+ dispatch({
1628
+ type: ItemMouseMove$1,
1629
+ index,
1630
+ disabled
1631
+ });
1632
+ };
1633
+ var itemHandleClick = function itemHandleClick() {
1634
+ dispatch({
1635
+ type: ItemClick$1,
1636
+ index
1637
+ });
1638
+ };
1639
+ var resultItemProps = _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function(itemNode) {
1640
+ if (itemNode) itemsRef.current[elementIds.getItemId(index)] = itemNode;
1641
+ }), _extends4["aria-disabled"] = disabled, _extends4["aria-selected"] = item === selectedItem, _extends4.id = elementIds.getItemId(index), _extends4.role = "option", _extends4.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove), _extends4.onMouseDown = callAllEventHandlers(onMouseDown, function itemHandleMouseDown(e) {
1642
+ return e.preventDefault();
1643
+ }), _extends4), rest);
1644
+ if (!disabled) Object.assign(resultItemProps, { onClick: callAllEventHandlers(onClick, itemHandleClick) });
1645
+ return resultItemProps;
1646
+ }, [
1647
+ items,
1648
+ isItemDisabled,
1649
+ selectedItem,
1650
+ elementIds,
1651
+ mouseAndTouchTrackers,
1652
+ preventScroll,
1653
+ dispatch,
1654
+ stateRef
1655
+ ]);
1656
+ var toggleMenu = useCallback(function() {
1657
+ dispatch({ type: FunctionToggleMenu$1 });
1658
+ }, [dispatch]);
1659
+ var closeMenu = useCallback(function() {
1660
+ dispatch({ type: FunctionCloseMenu$1 });
1661
+ }, [dispatch]);
1662
+ return {
1663
+ getToggleButtonProps,
1664
+ getLabelProps,
1665
+ getMenuProps,
1666
+ getItemProps,
1667
+ toggleMenu,
1668
+ openMenu: useCallback(function() {
1669
+ dispatch({ type: FunctionOpenMenu$1 });
1670
+ }, [dispatch]),
1671
+ closeMenu,
1672
+ setHighlightedIndex: useCallback(function(newHighlightedIndex) {
1673
+ dispatch({
1674
+ type: FunctionSetHighlightedIndex$1,
1675
+ highlightedIndex: newHighlightedIndex
1676
+ });
1677
+ }, [dispatch]),
1678
+ selectItem: useCallback(function(newSelectedItem) {
1679
+ dispatch({
1680
+ type: FunctionSelectItem$1,
1681
+ selectedItem: newSelectedItem
1682
+ });
1683
+ }, [dispatch]),
1684
+ reset: useCallback(function() {
1685
+ dispatch({ type: FunctionReset$2 });
1686
+ }, [dispatch]),
1687
+ setInputValue: useCallback(function(newInputValue) {
1688
+ dispatch({
1689
+ type: FunctionSetInputValue$1,
1690
+ inputValue: newInputValue
1691
+ });
1692
+ }, [dispatch]),
1693
+ highlightedIndex,
1694
+ isOpen,
1695
+ selectedItem,
1696
+ inputValue
1697
+ };
1698
+ }
1699
+ function getInitialState$2(props) {
1700
+ var initialState = getInitialState$3(props);
1701
+ var selectedItem = initialState.selectedItem;
1702
+ var inputValue = initialState.inputValue;
1703
+ if (inputValue === "" && selectedItem && props.defaultInputValue === void 0 && props.initialInputValue === void 0 && props.inputValue === void 0) inputValue = props.itemToString(selectedItem);
1704
+ return _extends({}, initialState, { inputValue });
1705
+ }
1706
+ /**
1707
+ * The useCombobox version of useControlledReducer, which also
1708
+ * checks if the controlled prop selectedItem changed between
1709
+ * renders. If so, it will also update inputValue with its
1710
+ * string equivalent. It uses the common useEnhancedReducer to
1711
+ * compute the rest of the state.
1712
+ *
1713
+ * @param reducer Reducer function from downshift.
1714
+ * @param props The hook props, also passed to createInitialState.
1715
+ * @param createInitialState Function that returns the initial state.
1716
+ * @param isStateEqual Function that checks if a previous state is equal to the next.
1717
+ * @returns An array with the state and an action dispatcher.
1718
+ */
1719
+ function useControlledReducer(reducer, props, createInitialState, isStateEqual) {
1720
+ var previousSelectedItemRef = useRef(null);
1721
+ var _useEnhancedReducer = useEnhancedReducer(reducer, props, createInitialState, isStateEqual), state = _useEnhancedReducer[0], dispatch = _useEnhancedReducer[1];
1722
+ var isInitialMount = useIsInitialMount();
1723
+ useEffect(function() {
1724
+ if (props.selectedItem === void 0) return;
1725
+ if (!isInitialMount) {
1726
+ if (props.itemToKey(props.selectedItem) !== props.itemToKey(previousSelectedItemRef.current)) dispatch({
1727
+ type: ControlledPropUpdatedSelectedItem,
1728
+ inputValue: props.itemToString(props.selectedItem)
1729
+ });
1730
+ }
1731
+ previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;
1732
+ }, [state.selectedItem, props.selectedItem]);
1733
+ return [getState(state, props), dispatch];
1734
+ }
1735
+ function downshiftUseComboboxReducer(state, action) {
1736
+ var type = action.type, props = action.props;
1737
+ var changes;
1738
+ switch (type) {
1739
+ case ItemClick:
1740
+ changes = {
1741
+ isOpen: getDefaultValue(props.defaultIsOpen, dropdownDefaultStateValues.isOpen),
1742
+ highlightedIndex: getDefaultHighlightedIndex(props.items, props.isItemDisabled, props.defaultHighlightedIndex),
1743
+ selectedItem: props.items[action.index],
1744
+ inputValue: props.itemToString(props.items[action.index])
1745
+ };
1746
+ break;
1747
+ case InputKeyDownArrowDown:
1748
+ if (state.isOpen) changes = { highlightedIndex: getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled, true) };
1749
+ else changes = {
1750
+ highlightedIndex: action.altKey && state.selectedItem == null ? -1 : getHighlightedIndexOnOpen(props.items, props.initialHighlightedIndex, props.defaultHighlightedIndex, props.isItemDisabled, props.itemToKey, state.selectedItem, state.highlightedIndex, 1),
1751
+ isOpen: props.items.length >= 0
1752
+ };
1753
+ break;
1754
+ case InputKeyDownArrowUp:
1755
+ if (state.isOpen) {
1756
+ if (action.altKey) changes = getChangesOnSelection(props.items, props.itemToString, props.defaultIsOpen, props.defaultHighlightedIndex, state.highlightedIndex, true);
1757
+ else changes = { highlightedIndex: getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled, true) };
1758
+ } else changes = {
1759
+ highlightedIndex: getHighlightedIndexOnOpen(props.items, props.initialHighlightedIndex, props.defaultHighlightedIndex, props.isItemDisabled, props.itemToKey, state.selectedItem, state.highlightedIndex, -1),
1760
+ isOpen: props.items.length >= 0
1761
+ };
1762
+ break;
1763
+ case InputKeyDownEnter:
1764
+ changes = getChangesOnSelection(props.items, props.itemToString, props.defaultIsOpen, props.defaultHighlightedIndex, state.highlightedIndex, true);
1765
+ break;
1766
+ case InputKeyDownEscape:
1767
+ changes = _extends({
1768
+ isOpen: false,
1769
+ highlightedIndex: -1
1770
+ }, !state.isOpen && {
1771
+ selectedItem: null,
1772
+ inputValue: ""
1773
+ });
1774
+ break;
1775
+ case InputKeyDownPageUp:
1776
+ changes = { highlightedIndex: getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled, true) };
1777
+ break;
1778
+ case InputKeyDownPageDown:
1779
+ changes = { highlightedIndex: getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled, true) };
1780
+ break;
1781
+ case InputKeyDownHome:
1782
+ changes = { highlightedIndex: getNonDisabledIndex(0, false, props.items, props.isItemDisabled) };
1783
+ break;
1784
+ case InputKeyDownEnd:
1785
+ changes = { highlightedIndex: getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled) };
1786
+ break;
1787
+ case InputBlur:
1788
+ changes = _extends({
1789
+ isOpen: false,
1790
+ highlightedIndex: -1
1791
+ }, state.highlightedIndex >= 0 && props.items.length && action.selectItem && {
1792
+ selectedItem: props.items[state.highlightedIndex],
1793
+ inputValue: props.itemToString(props.items[state.highlightedIndex])
1794
+ });
1795
+ break;
1796
+ case InputChange:
1797
+ changes = {
1798
+ isOpen: true,
1799
+ highlightedIndex: getDefaultHighlightedIndex(props.items, props.isItemDisabled, props.defaultHighlightedIndex),
1800
+ inputValue: action.inputValue
1801
+ };
1802
+ break;
1803
+ case InputClick:
1804
+ changes = {
1805
+ isOpen: !state.isOpen,
1806
+ highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props.items, props.initialHighlightedIndex, props.defaultHighlightedIndex, props.isItemDisabled, props.itemToKey, state.selectedItem, state.highlightedIndex, 0)
1807
+ };
1808
+ break;
1809
+ case FunctionSelectItem:
1810
+ changes = {
1811
+ selectedItem: action.selectedItem,
1812
+ inputValue: props.itemToString(action.selectedItem)
1813
+ };
1814
+ break;
1815
+ case ControlledPropUpdatedSelectedItem:
1816
+ changes = { inputValue: action.inputValue };
1817
+ break;
1818
+ default: return downshiftCommonReducer(state, props, action, stateChangeTypes$2);
1819
+ }
1820
+ return _extends({}, state, changes);
1821
+ }
1822
+ function useCombobox(userProps) {
1823
+ if (userProps === void 0) userProps = {};
1824
+ validatePropTypes$1(userProps, useCombobox, propTypes$2);
1825
+ var props = _extends({}, dropdownDefaultProps, userProps);
1826
+ var items = props.items, isItemDisabled = props.isItemDisabled, scrollIntoView = props.scrollIntoView, environment = props.environment, getA11yStatusMessage = props.getA11yStatusMessage;
1827
+ var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, props, getInitialState$2, isDropdownStateEqual), state = _useControlledReducer[0], dispatch = _useControlledReducer[1];
1828
+ var isOpen = state.isOpen, highlightedIndex = state.highlightedIndex, selectedItem = state.selectedItem, inputValue = state.inputValue;
1829
+ var menuRef = useRef(null);
1830
+ var itemsRef = useRef({});
1831
+ var inputRef = useRef(null);
1832
+ var toggleButtonRef = useRef(null);
1833
+ var isInitialMount = useIsInitialMount();
1834
+ var elementIds = useElementIds$1(props);
1835
+ var previousResultCountRef = useRef();
1836
+ /**
1837
+ * Ref to read `state` in handlers to preserve referential identity.
1838
+ * Only to be used in handlers and effects.
1839
+ * **never access this in getters**
1840
+ */
1841
+ var stateRef = useLatestRef(state);
1842
+ useA11yMessageStatus(getA11yStatusMessage, state, [
1843
+ isOpen,
1844
+ highlightedIndex,
1845
+ selectedItem,
1846
+ inputValue
1847
+ ], environment);
1848
+ var preventScroll = useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuRef, itemsRef, elementIds.getItemId);
1849
+ useControlPropsValidator({
1850
+ state,
1851
+ props
1852
+ });
1853
+ useEffect(function() {
1854
+ if (getInitialValue(props.isOpen, props.initialIsOpen, props.defaultIsOpen, dropdownDefaultStateValues.isOpen) && inputRef.current) inputRef.current.focus();
1855
+ }, []);
1856
+ useEffect(function() {
1857
+ if (!isInitialMount) previousResultCountRef.current = items.length;
1858
+ });
1859
+ var mouseAndTouchTrackers = useMouseAndTouchTracker(environment, useCallback(function handleBlur() {
1860
+ if (stateRef.current.isOpen) dispatch({ type: InputBlur });
1861
+ }, [dispatch, stateRef]), useMemo(function() {
1862
+ return [
1863
+ menuRef,
1864
+ toggleButtonRef,
1865
+ inputRef
1866
+ ];
1867
+ }, []));
1868
+ var setGetterPropCallInfo = useGetterPropsCalledChecker("getInputProps", "getMenuProps");
1869
+ useEffect(function() {
1870
+ if (!isOpen) itemsRef.current = {};
1871
+ }, [isOpen]);
1872
+ useEffect(function() {
1873
+ var _inputRef$current;
1874
+ if (!isOpen || !(environment != null && environment.document) || !((_inputRef$current = inputRef.current) != null && _inputRef$current.focus)) return;
1875
+ if (environment.document.activeElement !== inputRef.current) inputRef.current.focus();
1876
+ }, [isOpen, environment]);
1877
+ var inputKeyDownHandlers = useMemo(function() {
1878
+ return {
1879
+ ArrowDown: function ArrowDown(event) {
1880
+ event.preventDefault();
1881
+ dispatch({
1882
+ type: InputKeyDownArrowDown,
1883
+ altKey: event.altKey
1884
+ });
1885
+ },
1886
+ ArrowUp: function ArrowUp(event) {
1887
+ event.preventDefault();
1888
+ dispatch({
1889
+ type: InputKeyDownArrowUp,
1890
+ altKey: event.altKey
1891
+ });
1892
+ },
1893
+ Home: function Home(event) {
1894
+ if (!stateRef.current.isOpen) return;
1895
+ event.preventDefault();
1896
+ dispatch({ type: InputKeyDownHome });
1897
+ },
1898
+ End: function End(event) {
1899
+ if (!stateRef.current.isOpen) return;
1900
+ event.preventDefault();
1901
+ dispatch({ type: InputKeyDownEnd });
1902
+ },
1903
+ Escape: function Escape(event) {
1904
+ var latestState = stateRef.current;
1905
+ if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
1906
+ event.preventDefault();
1907
+ dispatch({ type: InputKeyDownEscape });
1908
+ }
1909
+ },
1910
+ Enter: function Enter(event) {
1911
+ if (!stateRef.current.isOpen || event.which === 229) return;
1912
+ event.preventDefault();
1913
+ dispatch({ type: InputKeyDownEnter });
1914
+ },
1915
+ PageUp: function PageUp(event) {
1916
+ if (stateRef.current.isOpen) {
1917
+ event.preventDefault();
1918
+ dispatch({ type: InputKeyDownPageUp });
1919
+ }
1920
+ },
1921
+ PageDown: function PageDown(event) {
1922
+ if (stateRef.current.isOpen) {
1923
+ event.preventDefault();
1924
+ dispatch({ type: InputKeyDownPageDown });
1925
+ }
1926
+ }
1927
+ };
1928
+ }, [dispatch, stateRef]);
1929
+ var getLabelProps = useCallback(function(labelProps) {
1930
+ return _extends({
1931
+ id: elementIds.labelId,
1932
+ htmlFor: elementIds.inputId
1933
+ }, labelProps);
1934
+ }, [elementIds]);
1935
+ var getMenuProps = useCallback(function(menuProps, otherProps) {
1936
+ var _extends2;
1937
+ var _ref = menuProps != null ? menuProps : {}, onMouseLeave = _ref.onMouseLeave, _ref$refKey = _ref.refKey, refKey = _ref$refKey === void 0 ? "ref" : _ref$refKey, ref = _ref.ref, ariaLabel = _ref["aria-label"], rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1938
+ var _ref2$suppressRefErro = (otherProps != null ? otherProps : {}).suppressRefError;
1939
+ setGetterPropCallInfo("getMenuProps", _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro, refKey, menuRef);
1940
+ return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function(menuNode) {
1941
+ menuRef.current = menuNode;
1942
+ }), _extends2.id = elementIds.menuId, _extends2.role = "listbox", _extends2["aria-label"] = ariaLabel, _extends2["aria-labelledby"] = ariaLabel ? void 0 : "" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function() {
1943
+ dispatch({ type: MenuMouseLeave });
1944
+ }), _extends2), rest);
1945
+ }, [
1946
+ dispatch,
1947
+ setGetterPropCallInfo,
1948
+ elementIds
1949
+ ]);
1950
+ var getItemProps = useCallback(function(itemProps) {
1951
+ var _extends3, _ref4;
1952
+ var _ref3 = itemProps != null ? itemProps : {}, itemProp = _ref3.item, indexProp = _ref3.index, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, ref = _ref3.ref, onMouseMove = _ref3.onMouseMove, onMouseDown = _ref3.onMouseDown, onClick = _ref3.onClick;
1953
+ _ref3.onPress;
1954
+ var disabledProp = _ref3.disabled, rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$2);
1955
+ if (disabledProp !== void 0) console.warn("Passing \"disabled\" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.");
1956
+ var _getItemAndIndex = getItemAndIndex(itemProp, indexProp, items, "Pass either item or index to getItemProps!"), item = _getItemAndIndex[0], index = _getItemAndIndex[1];
1957
+ var disabled = isItemDisabled(item, index);
1958
+ var onSelectKey = "onClick";
1959
+ var customClickHandler = onClick;
1960
+ return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function(itemNode) {
1961
+ if (itemNode) itemsRef.current[elementIds.getItemId(index)] = itemNode;
1962
+ }), _extends3["aria-disabled"] = disabled, _extends3["aria-selected"] = index === highlightedIndex, _extends3.id = elementIds.getItemId(index), _extends3.role = "option", _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, function itemHandleClick() {
1963
+ dispatch({
1964
+ type: ItemClick,
1965
+ index
1966
+ });
1967
+ }), _ref4), {
1968
+ onMouseMove: callAllEventHandlers(onMouseMove, function itemHandleMouseMove() {
1969
+ if (mouseAndTouchTrackers.current.isTouchEnd || index === stateRef.current.highlightedIndex) return;
1970
+ preventScroll();
1971
+ dispatch({
1972
+ type: ItemMouseMove,
1973
+ index,
1974
+ disabled
1975
+ });
1976
+ }),
1977
+ onMouseDown: callAllEventHandlers(onMouseDown, function itemHandleMouseDown(e) {
1978
+ return e.preventDefault();
1979
+ })
1980
+ }, rest);
1981
+ }, [
1982
+ dispatch,
1983
+ elementIds,
1984
+ items,
1985
+ isItemDisabled,
1986
+ highlightedIndex,
1987
+ mouseAndTouchTrackers,
1988
+ preventScroll,
1989
+ stateRef
1990
+ ]);
1991
+ var getToggleButtonProps = useCallback(function(toggleButtonProps) {
1992
+ var _extends4;
1993
+ var _ref5 = toggleButtonProps != null ? toggleButtonProps : {}, onClick = _ref5.onClick;
1994
+ _ref5.onPress;
1995
+ var _ref5$refKey = _ref5.refKey, refKey = _ref5$refKey === void 0 ? "ref" : _ref5$refKey, ref = _ref5.ref, rest = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);
1996
+ return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function(toggleButtonNode) {
1997
+ toggleButtonRef.current = toggleButtonNode;
1998
+ }), _extends4["aria-controls"] = elementIds.menuId, _extends4["aria-expanded"] = isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({}, { onClick: callAllEventHandlers(onClick, function toggleButtonHandleClick() {
1999
+ dispatch({ type: ToggleButtonClick });
2000
+ }) }), rest);
2001
+ }, [
2002
+ dispatch,
2003
+ isOpen,
2004
+ elementIds
2005
+ ]);
2006
+ var getInputProps = useCallback(function(inputProps, otherProps) {
2007
+ var _extends5;
2008
+ var _ref6 = inputProps != null ? inputProps : {}, ariaLabel = _ref6["aria-label"], onKeyDown = _ref6.onKeyDown, onChange = _ref6.onChange, onInput = _ref6.onInput, onBlur = _ref6.onBlur;
2009
+ _ref6.onChangeText;
2010
+ var onClick = _ref6.onClick, _ref6$refKey = _ref6.refKey, refKey = _ref6$refKey === void 0 ? "ref" : _ref6$refKey, ref = _ref6.ref, rest = _objectWithoutPropertiesLoose(_ref6, _excluded4);
2011
+ var _ref7$suppressRefErro = (otherProps != null ? otherProps : {}).suppressRefError;
2012
+ setGetterPropCallInfo("getInputProps", _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro, refKey, inputRef);
2013
+ var inputHandleKeyDown = function inputHandleKeyDown(event) {
2014
+ var key = normalizeArrowKey(event);
2015
+ if (key && key in inputKeyDownHandlers) inputKeyDownHandlers[key](event);
2016
+ };
2017
+ var inputHandleChange = function inputHandleChange(event) {
2018
+ dispatch({
2019
+ type: InputChange,
2020
+ inputValue: event.target.value
2021
+ });
2022
+ };
2023
+ var inputHandleBlur = function inputHandleBlur(event) {
2024
+ /* istanbul ignore else */
2025
+ if (environment != null && environment.document && stateRef.current.isOpen && !mouseAndTouchTrackers.current.isMouseDown) dispatch({
2026
+ type: InputBlur,
2027
+ selectItem: !(event.relatedTarget === null && environment.document.activeElement !== environment.document.body)
2028
+ });
2029
+ };
2030
+ var inputHandleClick = function inputHandleClick() {
2031
+ dispatch({ type: InputClick });
2032
+ };
2033
+ /* istanbul ignore next (preact) */
2034
+ var onChangeKey = "onChange";
2035
+ var eventHandlers = {};
2036
+ if (!rest.disabled) {
2037
+ var _eventHandlers;
2038
+ eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onClick = callAllEventHandlers(onClick, inputHandleClick), _eventHandlers);
2039
+ }
2040
+ return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function(inputNode) {
2041
+ inputRef.current = inputNode;
2042
+ }), _extends5["aria-activedescendant"] = isOpen && highlightedIndex > -1 ? elementIds.getItemId(highlightedIndex) : "", _extends5["aria-autocomplete"] = "list", _extends5["aria-controls"] = elementIds.menuId, _extends5["aria-expanded"] = isOpen, _extends5["aria-labelledby"] = ariaLabel ? void 0 : elementIds.labelId, _extends5["aria-label"] = ariaLabel, _extends5.autoComplete = "off", _extends5.id = elementIds.inputId, _extends5.role = "combobox", _extends5.value = inputValue, _extends5), eventHandlers, rest);
2043
+ }, [
2044
+ dispatch,
2045
+ elementIds,
2046
+ environment,
2047
+ inputKeyDownHandlers,
2048
+ isOpen,
2049
+ highlightedIndex,
2050
+ inputValue,
2051
+ mouseAndTouchTrackers,
2052
+ setGetterPropCallInfo,
2053
+ stateRef
2054
+ ]);
2055
+ var toggleMenu = useCallback(function() {
2056
+ dispatch({ type: FunctionToggleMenu });
2057
+ }, [dispatch]);
2058
+ var closeMenu = useCallback(function() {
2059
+ dispatch({ type: FunctionCloseMenu });
2060
+ }, [dispatch]);
2061
+ var openMenu = useCallback(function() {
2062
+ dispatch({ type: FunctionOpenMenu });
2063
+ }, [dispatch]);
2064
+ var setHighlightedIndex = useCallback(function(newHighlightedIndex) {
2065
+ dispatch({
2066
+ type: FunctionSetHighlightedIndex,
2067
+ highlightedIndex: newHighlightedIndex
2068
+ });
2069
+ }, [dispatch]);
2070
+ var selectItem = useCallback(function(newSelectedItem) {
2071
+ dispatch({
2072
+ type: FunctionSelectItem,
2073
+ selectedItem: newSelectedItem
2074
+ });
2075
+ }, [dispatch]);
2076
+ return {
2077
+ getItemProps,
2078
+ getLabelProps,
2079
+ getMenuProps,
2080
+ getInputProps,
2081
+ getToggleButtonProps,
2082
+ toggleMenu,
2083
+ openMenu,
2084
+ closeMenu,
2085
+ setHighlightedIndex,
2086
+ setInputValue: useCallback(function(newInputValue) {
2087
+ dispatch({
2088
+ type: FunctionSetInputValue,
2089
+ inputValue: newInputValue
2090
+ });
2091
+ }, [dispatch]),
2092
+ selectItem,
2093
+ reset: useCallback(function() {
2094
+ dispatch({ type: FunctionReset$1 });
2095
+ }, [dispatch]),
2096
+ highlightedIndex,
2097
+ isOpen,
2098
+ selectedItem,
2099
+ inputValue
2100
+ };
2101
+ }
2102
+ /**
2103
+ * Gets the initial state based on the provided props. It uses initial, default
2104
+ * and controlled props related to state in order to compute the initial value.
2105
+ *
2106
+ * @param {Object} props Props passed to the hook.
2107
+ * @returns {Object} The initial state.
2108
+ */
2109
+ function getInitialState$1(props) {
2110
+ return {
2111
+ activeIndex: getInitialValue(props.activeIndex, props.initialActiveIndex, props.defaultActiveIndex, defaultStateValues.activeIndex),
2112
+ selectedItems: getInitialValue(props.selectedItems, props.initialSelectedItems, props.defaultSelectedItems, defaultStateValues.selectedItems)
2113
+ };
2114
+ }
2115
+ /**
2116
+ * Returns true if dropdown keydown operation is permitted. Should not be
2117
+ * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on
2118
+ * input element with text content that is either highlighted or selection
2119
+ * cursor is not at the starting position.
2120
+ *
2121
+ * @param {KeyboardEvent} event The event from keydown.
2122
+ * @returns {boolean} Whether the operation is allowed.
2123
+ */
2124
+ function isKeyDownOperationPermitted(event) {
2125
+ if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) return false;
2126
+ var element = event.target;
2127
+ if (element instanceof HTMLInputElement && element.value !== "" && (element.selectionStart !== 0 || element.selectionEnd !== 0)) return false;
2128
+ return true;
2129
+ }
2130
+ /**
2131
+ * Check if a state is equal for taglist, by comparing active index and selected items.
2132
+ * Used by useSelect and useCombobox.
2133
+ *
2134
+ * @param {Object} prevState
2135
+ * @param {Object} newState
2136
+ * @returns {boolean} Wheather the states are deeply equal.
2137
+ */
2138
+ function isStateEqual$1(prevState, newState) {
2139
+ return prevState.selectedItems === newState.selectedItems && prevState.activeIndex === newState.activeIndex;
2140
+ }
2141
+ function downshiftMultipleSelectionReducer(state, action) {
2142
+ var type = action.type, index = action.index, selectedItem = action.selectedItem, props = action.props;
2143
+ var activeIndex = state.activeIndex, selectedItems = state.selectedItems;
2144
+ var changes;
2145
+ switch (type) {
2146
+ case SelectedItemClick:
2147
+ changes = { activeIndex: index };
2148
+ break;
2149
+ case SelectedItemKeyDownNavigationPrevious:
2150
+ changes = { activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1 };
2151
+ break;
2152
+ case SelectedItemKeyDownNavigationNext:
2153
+ changes = { activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1 };
2154
+ break;
2155
+ case SelectedItemKeyDownBackspace:
2156
+ case SelectedItemKeyDownDelete:
2157
+ if (activeIndex < 0) break;
2158
+ var newActiveIndex = activeIndex;
2159
+ if (selectedItems.length === 1) newActiveIndex = -1;
2160
+ else if (activeIndex === selectedItems.length - 1) newActiveIndex = selectedItems.length - 2;
2161
+ changes = _extends({ selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1)) }, { activeIndex: newActiveIndex });
2162
+ break;
2163
+ case DropdownKeyDownNavigationPrevious:
2164
+ changes = { activeIndex: selectedItems.length - 1 };
2165
+ break;
2166
+ case DropdownKeyDownBackspace:
2167
+ changes = { selectedItems: selectedItems.slice(0, selectedItems.length - 1) };
2168
+ break;
2169
+ case FunctionAddSelectedItem:
2170
+ changes = { selectedItems: [].concat(selectedItems, [selectedItem]) };
2171
+ break;
2172
+ case DropdownClick:
2173
+ changes = { activeIndex: -1 };
2174
+ break;
2175
+ case FunctionRemoveSelectedItem:
2176
+ var _newActiveIndex = activeIndex;
2177
+ var selectedItemIndex = selectedItems.findIndex(function(item) {
2178
+ return props.itemToKey(item) === props.itemToKey(selectedItem);
2179
+ });
2180
+ if (selectedItemIndex < 0) break;
2181
+ if (selectedItems.length === 1) _newActiveIndex = -1;
2182
+ else if (selectedItemIndex === selectedItems.length - 1) _newActiveIndex = selectedItems.length - 2;
2183
+ changes = {
2184
+ selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)),
2185
+ activeIndex: _newActiveIndex
2186
+ };
2187
+ break;
2188
+ case FunctionSetSelectedItems:
2189
+ changes = { selectedItems: action.selectedItems };
2190
+ break;
2191
+ case FunctionSetActiveIndex:
2192
+ changes = { activeIndex: action.activeIndex };
2193
+ break;
2194
+ case FunctionReset:
2195
+ changes = {
2196
+ activeIndex: getDefaultValue(props.defaultActiveIndex, defaultStateValues.activeIndex),
2197
+ selectedItems: getDefaultValue(props.defaultSelectedItems, defaultStateValues.selectedItems)
2198
+ };
2199
+ break;
2200
+ default: throw new Error("Reducer called without proper action type.");
2201
+ }
2202
+ return _extends({}, state, changes);
2203
+ }
2204
+ function useMultipleSelection(userProps) {
2205
+ if (userProps === void 0) userProps = {};
2206
+ validatePropTypes(userProps, useMultipleSelection);
2207
+ var props = _extends({}, defaultProps, userProps);
2208
+ var getA11yStatusMessage = props.getA11yStatusMessage, environment = props.environment, keyNavigationNext = props.keyNavigationNext, keyNavigationPrevious = props.keyNavigationPrevious;
2209
+ var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, props, getInitialState$1, isStateEqual$1), state = _useControlledReducer[0], dispatch = _useControlledReducer[1];
2210
+ var activeIndex = state.activeIndex, selectedItems = state.selectedItems;
2211
+ var isInitialMount = useIsInitialMount();
2212
+ var dropdownRef = useRef(null);
2213
+ var selectedItemRefs = useRef(null);
2214
+ if (selectedItemRefs.current === null) selectedItemRefs.current = /* @__PURE__ */ new Map();
2215
+ useA11yMessageStatus(getA11yStatusMessage, state, [activeIndex, selectedItems], environment);
2216
+ useEffect(function() {
2217
+ if (isInitialMount) return;
2218
+ if (activeIndex === -1 && dropdownRef.current) dropdownRef.current.focus();
2219
+ else {
2220
+ var _selectedItemRefs$cur;
2221
+ (_selectedItemRefs$cur = selectedItemRefs.current.get(activeIndex)) == null || _selectedItemRefs$cur.focus();
2222
+ }
2223
+ }, [activeIndex]);
2224
+ useControlPropsValidator({
2225
+ props,
2226
+ state
2227
+ });
2228
+ var setGetterPropCallInfo = useGetterPropsCalledChecker("getDropdownProps");
2229
+ var selectedItemKeyDownHandlers = useMemo(function() {
2230
+ var _ref = {};
2231
+ return _ref[keyNavigationPrevious] = function() {
2232
+ dispatch({ type: SelectedItemKeyDownNavigationPrevious });
2233
+ }, _ref[keyNavigationNext] = function() {
2234
+ dispatch({ type: SelectedItemKeyDownNavigationNext });
2235
+ }, _ref.Delete = function Delete() {
2236
+ dispatch({ type: SelectedItemKeyDownDelete });
2237
+ }, _ref.Backspace = function Backspace() {
2238
+ dispatch({ type: SelectedItemKeyDownBackspace });
2239
+ }, _ref;
2240
+ }, [
2241
+ dispatch,
2242
+ keyNavigationNext,
2243
+ keyNavigationPrevious
2244
+ ]);
2245
+ var dropdownKeyDownHandlers = useMemo(function() {
2246
+ var _ref2 = {};
2247
+ return _ref2[keyNavigationPrevious] = function(event) {
2248
+ if (isKeyDownOperationPermitted(event)) dispatch({ type: DropdownKeyDownNavigationPrevious });
2249
+ }, _ref2.Backspace = function Backspace(event) {
2250
+ if (isKeyDownOperationPermitted(event)) dispatch({ type: DropdownKeyDownBackspace });
2251
+ }, _ref2;
2252
+ }, [dispatch, keyNavigationPrevious]);
2253
+ return {
2254
+ getSelectedItemProps: useCallback(function(_temp) {
2255
+ var _extends2;
2256
+ var _ref3 = _temp === void 0 ? {} : _temp, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, ref = _ref3.ref, onClick = _ref3.onClick, onKeyDown = _ref3.onKeyDown, selectedItemProp = _ref3.selectedItem, indexProp = _ref3.index, rest = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
2257
+ var index = getItemAndIndex(selectedItemProp, indexProp, selectedItems, "Pass either item or index to getSelectedItemProps!")[1];
2258
+ var isFocusable = index > -1 && index === activeIndex;
2259
+ return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function(selectedItemNode) {
2260
+ if (selectedItemNode) selectedItemRefs.current.set(index, selectedItemNode);
2261
+ else selectedItemRefs.current["delete"](index);
2262
+ }), _extends2.tabIndex = isFocusable ? 0 : -1, _extends2.onClick = callAllEventHandlers(onClick, function selectedItemHandleClick() {
2263
+ dispatch({
2264
+ type: SelectedItemClick,
2265
+ index
2266
+ });
2267
+ }), _extends2.onKeyDown = callAllEventHandlers(onKeyDown, function selectedItemHandleKeyDown(event) {
2268
+ var key = normalizeArrowKey(event);
2269
+ if (key && selectedItemKeyDownHandlers[key]) selectedItemKeyDownHandlers[key](event);
2270
+ }), _extends2), rest);
2271
+ }, [
2272
+ dispatch,
2273
+ selectedItems,
2274
+ activeIndex,
2275
+ selectedItemKeyDownHandlers
2276
+ ]),
2277
+ getDropdownProps: useCallback(function(_temp2, _temp3) {
2278
+ var _extends3;
2279
+ var _ref4 = _temp2 === void 0 ? {} : _temp2, _ref4$refKey = _ref4.refKey, refKey = _ref4$refKey === void 0 ? "ref" : _ref4$refKey, ref = _ref4.ref, onKeyDown = _ref4.onKeyDown, onClick = _ref4.onClick, _ref4$preventKeyActio = _ref4.preventKeyAction, preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio, rest = _objectWithoutPropertiesLoose(_ref4, _excluded2$1);
2280
+ var _ref5$suppressRefErro = (_temp3 === void 0 ? {} : _temp3).suppressRefError;
2281
+ setGetterPropCallInfo("getDropdownProps", _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro, refKey, dropdownRef);
2282
+ return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function(dropdownNode) {
2283
+ if (dropdownNode) dropdownRef.current = dropdownNode;
2284
+ }), _extends3), !preventKeyAction && {
2285
+ onKeyDown: callAllEventHandlers(onKeyDown, function dropdownHandleKeyDown(event) {
2286
+ var key = normalizeArrowKey(event);
2287
+ if (key && dropdownKeyDownHandlers[key]) dropdownKeyDownHandlers[key](event);
2288
+ }),
2289
+ onClick: callAllEventHandlers(onClick, function dropdownHandleClick() {
2290
+ dispatch({ type: DropdownClick });
2291
+ })
2292
+ }, rest);
2293
+ }, [
2294
+ dispatch,
2295
+ dropdownKeyDownHandlers,
2296
+ setGetterPropCallInfo
2297
+ ]),
2298
+ addSelectedItem: useCallback(function(selectedItem) {
2299
+ dispatch({
2300
+ type: FunctionAddSelectedItem,
2301
+ selectedItem
2302
+ });
2303
+ }, [dispatch]),
2304
+ removeSelectedItem: useCallback(function(selectedItem) {
2305
+ dispatch({
2306
+ type: FunctionRemoveSelectedItem,
2307
+ selectedItem
2308
+ });
2309
+ }, [dispatch]),
2310
+ setSelectedItems: useCallback(function(newSelectedItems) {
2311
+ dispatch({
2312
+ type: FunctionSetSelectedItems,
2313
+ selectedItems: newSelectedItems
2314
+ });
2315
+ }, [dispatch]),
2316
+ setActiveIndex: useCallback(function(newActiveIndex) {
2317
+ dispatch({
2318
+ type: FunctionSetActiveIndex,
2319
+ activeIndex: newActiveIndex
2320
+ });
2321
+ }, [dispatch]),
2322
+ reset: useCallback(function() {
2323
+ dispatch({ type: FunctionReset });
2324
+ }, [dispatch]),
2325
+ selectedItems,
2326
+ activeIndex
2327
+ };
2328
+ }
2329
+ function useTagGroupReducer(state, action) {
2330
+ var type = action.type;
2331
+ var changes;
2332
+ switch (type) {
2333
+ case TagClick:
2334
+ changes = { activeIndex: action.index };
2335
+ break;
2336
+ case TagGroupKeyDownArrowLeft:
2337
+ changes = { activeIndex: state.activeIndex === 0 ? state.items.length - 1 : state.activeIndex - 1 };
2338
+ break;
2339
+ case TagGroupKeyDownArrowRight:
2340
+ changes = { activeIndex: state.activeIndex === state.items.length - 1 ? 0 : state.activeIndex + 1 };
2341
+ break;
2342
+ case TagGroupKeyDownBackspace:
2343
+ case TagGroupKeyDownDelete:
2344
+ var newItems = [].concat(state.items.slice(0, state.activeIndex), state.items.slice(state.activeIndex + 1));
2345
+ var newActiveIndex = newItems.length === 0 ? -1 : newItems.length === state.activeIndex ? state.activeIndex - 1 : state.activeIndex;
2346
+ changes = {
2347
+ items: [].concat(state.items.slice(0, state.activeIndex), state.items.slice(state.activeIndex + 1)),
2348
+ activeIndex: newActiveIndex
2349
+ };
2350
+ break;
2351
+ case TagRemoveClick:
2352
+ var _newItems = [].concat(state.items.slice(0, action.index), state.items.slice(action.index + 1));
2353
+ changes = {
2354
+ items: _newItems,
2355
+ activeIndex: _newItems.length === 0 ? -1 : _newItems.length === action.index ? action.index - 1 : action.index
2356
+ };
2357
+ break;
2358
+ case FunctionAddItem:
2359
+ var _newItems2 = [];
2360
+ if (action.index === void 0) _newItems2 = [].concat(state.items, [action.item]);
2361
+ else _newItems2 = [].concat(state.items.slice(0, action.index), [action.item], state.items.slice(action.index));
2362
+ var _newActiveIndex2 = state.activeIndex === -1 ? _newItems2.length - 1 : state.activeIndex;
2363
+ changes = {
2364
+ items: _newItems2,
2365
+ activeIndex: _newActiveIndex2
2366
+ };
2367
+ break;
2368
+ default: throw new Error("Invalid useTagGroup reducer action.");
2369
+ }
2370
+ return _extends({}, state, changes);
2371
+ }
2372
+ function useElementIdsR18(_ref) {
2373
+ var id = _ref.id, tagGroupId = _ref.tagGroupId, getTagId = _ref.getTagId;
2374
+ var reactId = "downshift-" + reactUseId();
2375
+ if (!id) id = reactId;
2376
+ return useMemo(function() {
2377
+ return {
2378
+ tagGroupId: tagGroupId != null ? tagGroupId : id + "-tag-group",
2379
+ getTagId: getTagId != null ? getTagId : function(index) {
2380
+ return id + "-tag-" + index;
2381
+ }
2382
+ };
2383
+ }, [
2384
+ getTagId,
2385
+ id,
2386
+ tagGroupId
2387
+ ]);
2388
+ }
2389
+ function useElementIdsLegacy(_ref2) {
2390
+ var id = _ref2.id, getTagId = _ref2.getTagId, tagGroupId = _ref2.tagGroupId;
2391
+ var baseId = useState(function() {
2392
+ return id != null ? id : "downshift-" + generateId();
2393
+ })[0];
2394
+ return useMemo(function() {
2395
+ return {
2396
+ tagGroupId: tagGroupId != null ? tagGroupId : baseId + "-tag-group",
2397
+ getTagId: getTagId != null ? getTagId : function(index) {
2398
+ return baseId + "-tag-" + index;
2399
+ }
2400
+ };
2401
+ }, [
2402
+ getTagId,
2403
+ baseId,
2404
+ tagGroupId
2405
+ ]);
2406
+ }
2407
+ function getInitialState(props) {
2408
+ var _ref, _props$items, _ref2, _props$activeIndex;
2409
+ var items = (_ref = (_props$items = props.items) != null ? _props$items : props.initialItems) != null ? _ref : [];
2410
+ return {
2411
+ activeIndex: (_ref2 = (_props$activeIndex = props.activeIndex) != null ? _props$activeIndex : props.initialActiveIndex) != null ? _ref2 : items.length === 0 ? -1 : 0,
2412
+ items
2413
+ };
2414
+ }
2415
+ function isStateEqual(oldState, newState) {
2416
+ return oldState.activeIndex === newState.activeIndex && oldState.items === newState.items;
2417
+ }
2418
+ function useAccessibleDescription(document, description) {
2419
+ useEffect(function() {
2420
+ if (!document) return;
2421
+ var accessibleDescriptionElement = document.createElement("div");
2422
+ accessibleDescriptionElement.setAttribute("id", A11Y_DESCRIPTION_ELEMENT_ID);
2423
+ accessibleDescriptionElement.style.display = "none";
2424
+ accessibleDescriptionElement.textContent = description;
2425
+ document.body.appendChild(accessibleDescriptionElement);
2426
+ return function() {
2427
+ accessibleDescriptionElement.remove();
2428
+ };
2429
+ }, [description, document]);
2430
+ }
2431
+ function getMergedProps(userProps) {
2432
+ return _extends({
2433
+ stateReducer: function stateReducer(_s, _ref) {
2434
+ return _ref.changes;
2435
+ },
2436
+ environment: typeof window === "undefined" || false ? void 0 : window,
2437
+ removeElementDescription: "Press Delete or Backspace to remove tag."
2438
+ }, userProps);
2439
+ }
2440
+ /**
2441
+ * Focuses the tag at activeIndex when it changes or when an item is removed.
2442
+ */
2443
+ function useRovingTagFocus(activeIndex, itemsLength, getTagId) {
2444
+ var itemRefs = useRef({});
2445
+ var previousActiveIndexRef = useRef(activeIndex);
2446
+ var previousItemsLengthRef = useRef(itemsLength);
2447
+ useEffect(function() {
2448
+ if (activeIndex !== -1 && previousActiveIndexRef.current !== -1 && activeIndex !== previousActiveIndexRef.current || previousItemsLengthRef.current === itemsLength + 1) {
2449
+ var _itemRefs$current$get;
2450
+ (_itemRefs$current$get = itemRefs.current[getTagId(activeIndex)]) == null || _itemRefs$current$get.focus();
2451
+ }
2452
+ previousActiveIndexRef.current = activeIndex;
2453
+ previousItemsLengthRef.current = itemsLength;
2454
+ }, [
2455
+ activeIndex,
2456
+ getTagId,
2457
+ itemsLength
2458
+ ]);
2459
+ return itemRefs;
2460
+ }
2461
+ var import_prop_types, unknown, mouseUp, itemMouseEnter, keyDownArrowUp, keyDownArrowDown, keyDownEscape, keyDownEnter, keyDownHome, keyDownEnd, clickItem, blurInput, changeInput, keyDownSpaceButton, clickButton, blurButton, controlledPropUpdatedSelectedItem, touchEnd, stateChangeTypes$4, idCounter, useIsomorphicLayoutEffect, cleanupStatus, validatePropTypes$1, stateKeys, _excluded$4, _excluded2$4, _excluded3$3, _excluded4$2, _excluded5, Downshift, propTypes$4, updateA11yStatus, dropdownPropTypes, dropdownDefaultProps, dropdownDefaultStateValues, reactUseId$1, useElementIds$1, useControlPropsValidator, useGetterPropsCalledChecker, propTypes$3, 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, _excluded$3, _excluded2$3, _excluded3$2, _excluded4$1, 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, propTypes$2, _excluded$2, _excluded2$2, _excluded3$1, _excluded4, defaultStateValues, defaultProps, validatePropTypes, SelectedItemClick, SelectedItemKeyDownDelete, SelectedItemKeyDownBackspace, SelectedItemKeyDownNavigationNext, SelectedItemKeyDownNavigationPrevious, DropdownKeyDownNavigationPrevious, DropdownKeyDownBackspace, DropdownClick, FunctionAddSelectedItem, FunctionRemoveSelectedItem, FunctionSetSelectedItems, FunctionSetActiveIndex, FunctionReset, stateChangeTypes$1, _excluded$1, _excluded2$1, TagClick, TagGroupKeyDownArrowLeft, TagGroupKeyDownArrowRight, TagGroupKeyDownDelete, TagGroupKeyDownBackspace, TagRemoveClick, FunctionAddItem, stateChangeTypes, reactUseId, useElementIds, A11Y_DESCRIPTION_ELEMENT_ID, propTypes, _excluded, _excluded2, _excluded3, _useTagGroup;
2462
+ function init_downshift_esm() {
2463
+ return (init_downshift_esm = __esmMin((() => {
2464
+ init_inheritsLoose();
2465
+ import_prop_types = /* @__PURE__ */ __toESM(require_prop_types(), 1);
2466
+ init__storybook_global_react();
2467
+ require_react_is();
2468
+ init_dist();
2469
+ unknown = 0;
2470
+ mouseUp = 1;
2471
+ itemMouseEnter = 2;
2472
+ keyDownArrowUp = 3;
2473
+ keyDownArrowDown = 4;
2474
+ keyDownEscape = 5;
2475
+ keyDownEnter = 6;
2476
+ keyDownHome = 7;
2477
+ keyDownEnd = 8;
2478
+ clickItem = 9;
2479
+ blurInput = 10;
2480
+ changeInput = 11;
2481
+ keyDownSpaceButton = 12;
2482
+ clickButton = 13;
2483
+ blurButton = 14;
2484
+ controlledPropUpdatedSelectedItem = 15;
2485
+ touchEnd = 16;
2486
+ stateChangeTypes$4 = /*#__PURE__*/ Object.freeze({
2487
+ __proto__: null,
2488
+ blurButton,
2489
+ blurInput,
2490
+ changeInput,
2491
+ clickButton,
2492
+ clickItem,
2493
+ controlledPropUpdatedSelectedItem,
2494
+ itemMouseEnter,
2495
+ keyDownArrowDown,
2496
+ keyDownArrowUp,
2497
+ keyDownEnd,
2498
+ keyDownEnter,
2499
+ keyDownEscape,
2500
+ keyDownHome,
2501
+ keyDownSpaceButton,
2502
+ mouseUp,
2503
+ touchEnd,
2504
+ unknown
2505
+ });
2506
+ idCounter = 0;
2507
+ useIsomorphicLayoutEffect = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" || false ? useLayoutEffect : useEffect;
2508
+ cleanupStatus = debounce(function(document) {
2509
+ getStatusDiv(document).textContent = "";
2510
+ }, 500);
2511
+ validatePropTypes$1 = noop;
2512
+ stateKeys = [
2513
+ "highlightedIndex",
2514
+ "inputValue",
2515
+ "isOpen",
2516
+ "selectedItem",
2517
+ "type"
2518
+ ];
2519
+ _excluded$4 = ["refKey", "ref"];
2520
+ _excluded2$4 = [
2521
+ "onClick",
2522
+ "onPress",
2523
+ "onKeyDown",
2524
+ "onKeyUp",
2525
+ "onBlur"
2526
+ ];
2527
+ _excluded3$3 = [
2528
+ "onKeyDown",
2529
+ "onBlur",
2530
+ "onChange",
2531
+ "onInput",
2532
+ "onChangeText"
2533
+ ];
2534
+ _excluded4$2 = ["refKey", "ref"];
2535
+ _excluded5 = [
2536
+ "onMouseMove",
2537
+ "onMouseDown",
2538
+ "onClick",
2539
+ "onPress",
2540
+ "index",
2541
+ "item"
2542
+ ];
2543
+ Downshift = /*#__PURE__*/ function() {
2544
+ var Downshift = /*#__PURE__*/ function(_Component) {
2545
+ function Downshift(_props) {
2546
+ var _this = _Component.call(this, _props) || this;
2547
+ _this.id = _this.props.id || "downshift-" + generateId();
2548
+ _this.menuId = _this.props.menuId || _this.id + "-menu";
2549
+ _this.labelId = _this.props.labelId || _this.id + "-label";
2550
+ _this.inputId = _this.props.inputId || _this.id + "-input";
2551
+ _this.getItemId = _this.props.getItemId || function(index) {
2552
+ return _this.id + "-item-" + index;
2553
+ };
2554
+ _this.items = [];
2555
+ _this.itemCount = null;
2556
+ _this.previousResultCount = 0;
2557
+ _this.timeoutIds = [];
2558
+ /**
2559
+ * @param {Function} fn the function to call after the time
2560
+ * @param {Number} time the time to wait
2561
+ */
2562
+ _this.internalSetTimeout = function(fn, time) {
2563
+ var id = setTimeout(function() {
2564
+ _this.timeoutIds = _this.timeoutIds.filter(function(i) {
2565
+ return i !== id;
2566
+ });
2567
+ fn();
2568
+ }, time);
2569
+ _this.timeoutIds.push(id);
2570
+ };
2571
+ _this.setItemCount = function(count) {
2572
+ _this.itemCount = count;
2573
+ };
2574
+ _this.unsetItemCount = function() {
2575
+ _this.itemCount = null;
2576
+ };
2577
+ _this.isItemDisabled = function(_item, index) {
2578
+ var currentElementNode = _this.getItemNodeFromIndex(index);
2579
+ return currentElementNode && currentElementNode.hasAttribute("disabled");
2580
+ };
2581
+ _this.setHighlightedIndex = function(highlightedIndex, otherStateToSet) {
2582
+ if (highlightedIndex === void 0) highlightedIndex = _this.props.defaultHighlightedIndex;
2583
+ if (otherStateToSet === void 0) otherStateToSet = {};
2584
+ otherStateToSet = pickState(otherStateToSet);
2585
+ _this.internalSetState(_extends({ highlightedIndex }, otherStateToSet));
2586
+ };
2587
+ _this.clearSelection = function(cb) {
2588
+ _this.internalSetState({
2589
+ selectedItem: null,
2590
+ inputValue: "",
2591
+ highlightedIndex: _this.props.defaultHighlightedIndex,
2592
+ isOpen: _this.props.defaultIsOpen
2593
+ }, cb);
2594
+ };
2595
+ _this.selectItem = function(item, otherStateToSet, cb) {
2596
+ otherStateToSet = pickState(otherStateToSet);
2597
+ _this.internalSetState(_extends({
2598
+ isOpen: _this.props.defaultIsOpen,
2599
+ highlightedIndex: _this.props.defaultHighlightedIndex,
2600
+ selectedItem: item,
2601
+ inputValue: _this.props.itemToString(item)
2602
+ }, otherStateToSet), cb);
2603
+ };
2604
+ _this.selectItemAtIndex = function(itemIndex, otherStateToSet, cb) {
2605
+ var item = _this.items[itemIndex];
2606
+ if (item == null) return;
2607
+ _this.selectItem(item, otherStateToSet, cb);
2608
+ };
2609
+ _this.selectHighlightedItem = function(otherStateToSet, cb) {
2610
+ return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
2611
+ };
2612
+ _this.internalSetState = function(stateToSet, cb) {
2613
+ var isItemSelected, onChangeArg;
2614
+ var onStateChangeArg = {};
2615
+ var isStateToSetFunction = typeof stateToSet === "function";
2616
+ if (!isStateToSetFunction && stateToSet.hasOwnProperty("inputValue")) _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));
2617
+ return _this.setState(function(state) {
2618
+ var _newStateToSet;
2619
+ state = _this.getState(state);
2620
+ var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet;
2621
+ newStateToSet = _this.props.stateReducer(state, newStateToSet);
2622
+ isItemSelected = newStateToSet.hasOwnProperty("selectedItem");
2623
+ var nextState = {};
2624
+ if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) onChangeArg = newStateToSet.selectedItem;
2625
+ (_newStateToSet = newStateToSet).type || (_newStateToSet.type = unknown);
2626
+ Object.keys(newStateToSet).forEach(function(key) {
2627
+ if (state[key] !== newStateToSet[key]) onStateChangeArg[key] = newStateToSet[key];
2628
+ if (key === "type") return;
2629
+ newStateToSet[key];
2630
+ if (_this.props[key] === void 0) nextState[key] = newStateToSet[key];
2631
+ });
2632
+ if (isStateToSetFunction && newStateToSet.hasOwnProperty("inputValue")) _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));
2633
+ return nextState;
2634
+ }, function() {
2635
+ cbToCb(cb)();
2636
+ if (Object.keys(onStateChangeArg).length > 1) _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());
2637
+ if (isItemSelected) _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());
2638
+ if (onChangeArg !== void 0) _this.props.onChange(onChangeArg, _this.getStateAndHelpers());
2639
+ _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
2640
+ });
2641
+ };
2642
+ _this.rootRef = function(node) {
2643
+ return _this._rootNode = node;
2644
+ };
2645
+ _this.getRootProps = function(_temp, _temp2) {
2646
+ var _extends2;
2647
+ var _ref = _temp === void 0 ? {} : _temp, _ref$refKey = _ref.refKey, refKey = _ref$refKey === void 0 ? "ref" : _ref$refKey, ref = _ref.ref, rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2648
+ var _ref2$suppressRefErro = (_temp2 === void 0 ? {} : _temp2).suppressRefError, suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
2649
+ _this.getRootProps.called = true;
2650
+ _this.getRootProps.refKey = refKey;
2651
+ _this.getRootProps.suppressRefError = suppressRefError;
2652
+ var isOpen = _this.getState().isOpen;
2653
+ 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 : void 0, _extends2["aria-labelledby"] = _this.labelId, _extends2), rest);
2654
+ };
2655
+ _this.keyDownHandlers = {
2656
+ ArrowDown: function ArrowDown(event) {
2657
+ var _this2 = this;
2658
+ event.preventDefault();
2659
+ if (this.getState().isOpen) {
2660
+ var amount = event.shiftKey ? 5 : 1;
2661
+ this.moveHighlightedIndex(amount, { type: keyDownArrowDown });
2662
+ } else this.internalSetState({
2663
+ isOpen: true,
2664
+ type: keyDownArrowDown
2665
+ }, function() {
2666
+ var itemCount = _this2.getItemCount();
2667
+ if (itemCount > 0) {
2668
+ var highlightedIndex = _this2.getState().highlightedIndex;
2669
+ var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, 1, { length: itemCount }, _this2.isItemDisabled, true);
2670
+ _this2.setHighlightedIndex(nextHighlightedIndex, { type: keyDownArrowDown });
2671
+ }
2672
+ });
2673
+ },
2674
+ ArrowUp: function ArrowUp(event) {
2675
+ var _this3 = this;
2676
+ event.preventDefault();
2677
+ if (this.getState().isOpen) {
2678
+ var amount = event.shiftKey ? -5 : -1;
2679
+ this.moveHighlightedIndex(amount, { type: keyDownArrowUp });
2680
+ } else this.internalSetState({
2681
+ isOpen: true,
2682
+ type: keyDownArrowUp
2683
+ }, function() {
2684
+ var itemCount = _this3.getItemCount();
2685
+ if (itemCount > 0) {
2686
+ var highlightedIndex = _this3.getState().highlightedIndex;
2687
+ var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, -1, { length: itemCount }, _this3.isItemDisabled, true);
2688
+ _this3.setHighlightedIndex(nextHighlightedIndex, { type: keyDownArrowUp });
2689
+ }
2690
+ });
2691
+ },
2692
+ Enter: function Enter(event) {
2693
+ if (event.which === 229) return;
2694
+ var _this$getState2 = this.getState(), isOpen = _this$getState2.isOpen, highlightedIndex = _this$getState2.highlightedIndex;
2695
+ if (isOpen && highlightedIndex != null) {
2696
+ event.preventDefault();
2697
+ var item = this.items[highlightedIndex];
2698
+ var itemNode = this.getItemNodeFromIndex(highlightedIndex);
2699
+ if (item == null || itemNode && itemNode.hasAttribute("disabled")) return;
2700
+ this.selectHighlightedItem({ type: keyDownEnter });
2701
+ }
2702
+ },
2703
+ Escape: function Escape(event) {
2704
+ event.preventDefault();
2705
+ this.reset(_extends({ type: keyDownEscape }, !this.state.isOpen && {
2706
+ selectedItem: null,
2707
+ inputValue: ""
2708
+ }));
2709
+ }
2710
+ };
2711
+ _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, { " ": function _(event) {
2712
+ event.preventDefault();
2713
+ this.toggleMenu({ type: keyDownSpaceButton });
2714
+ } });
2715
+ _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
2716
+ Home: function Home(event) {
2717
+ var isOpen = this.getState().isOpen;
2718
+ if (!isOpen) return;
2719
+ event.preventDefault();
2720
+ var itemCount = this.getItemCount();
2721
+ if (itemCount <= 0 || !isOpen) return;
2722
+ var newHighlightedIndex = getNonDisabledIndex(0, false, { length: itemCount }, this.isItemDisabled);
2723
+ this.setHighlightedIndex(newHighlightedIndex, { type: keyDownHome });
2724
+ },
2725
+ End: function End(event) {
2726
+ var isOpen = this.getState().isOpen;
2727
+ if (!isOpen) return;
2728
+ event.preventDefault();
2729
+ var itemCount = this.getItemCount();
2730
+ if (itemCount <= 0 || !isOpen) return;
2731
+ var newHighlightedIndex = getNonDisabledIndex(itemCount - 1, true, { length: itemCount }, this.isItemDisabled);
2732
+ this.setHighlightedIndex(newHighlightedIndex, { type: keyDownEnd });
2733
+ }
2734
+ });
2735
+ _this.getToggleButtonProps = function(_temp3) {
2736
+ var _ref3 = _temp3 === void 0 ? {} : _temp3, onClick = _ref3.onClick;
2737
+ _ref3.onPress;
2738
+ var onKeyDown = _ref3.onKeyDown, onKeyUp = _ref3.onKeyUp, onBlur = _ref3.onBlur, rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$4);
2739
+ var isOpen = _this.getState().isOpen;
2740
+ var enabledEventHandlers = {
2741
+ onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
2742
+ onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
2743
+ onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
2744
+ onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
2745
+ };
2746
+ var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
2747
+ return _extends({
2748
+ type: "button",
2749
+ role: "button",
2750
+ "aria-label": isOpen ? "close menu" : "open menu",
2751
+ "aria-haspopup": true,
2752
+ "data-toggle": true
2753
+ }, eventHandlers, rest);
2754
+ };
2755
+ _this.buttonHandleKeyUp = function(event) {
2756
+ event.preventDefault();
2757
+ };
2758
+ _this.buttonHandleKeyDown = function(event) {
2759
+ var key = normalizeArrowKey(event);
2760
+ if (_this.buttonKeyDownHandlers[key]) _this.buttonKeyDownHandlers[key].call(_this, event);
2761
+ };
2762
+ _this.buttonHandleClick = function(event) {
2763
+ event.preventDefault();
2764
+ /* istanbul ignore if (can't reasonably test this) */
2765
+ if (_this.props.environment) {
2766
+ var _this$props$environme = _this.props.environment.document, body = _this$props$environme.body, activeElement = _this$props$environme.activeElement;
2767
+ if (body && body === activeElement) event.target.focus();
2768
+ }
2769
+ _this.internalSetTimeout(function() {
2770
+ return _this.toggleMenu({ type: clickButton });
2771
+ });
2772
+ };
2773
+ _this.buttonHandleBlur = function(event) {
2774
+ var blurTarget = event.target;
2775
+ _this.internalSetTimeout(function() {
2776
+ if (_this.isMouseDown || !_this.props.environment) return;
2777
+ var activeElement = _this.props.environment.document.activeElement;
2778
+ if ((activeElement == null || activeElement.id !== _this.inputId) && activeElement !== blurTarget) _this.reset({ type: blurButton });
2779
+ });
2780
+ };
2781
+ _this.getLabelProps = function(props) {
2782
+ return _extends({
2783
+ htmlFor: _this.inputId,
2784
+ id: _this.labelId
2785
+ }, props);
2786
+ };
2787
+ _this.getInputProps = function(_temp4) {
2788
+ var _ref4 = _temp4 === void 0 ? {} : _temp4, onKeyDown = _ref4.onKeyDown, onBlur = _ref4.onBlur, onChange = _ref4.onChange, onInput = _ref4.onInput;
2789
+ _ref4.onChangeText;
2790
+ var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$3);
2791
+ var onChangeKey;
2792
+ var eventHandlers = {};
2793
+ onChangeKey = "onChange";
2794
+ var _this$getState6 = _this.getState(), inputValue = _this$getState6.inputValue, isOpen = _this$getState6.isOpen, highlightedIndex = _this$getState6.highlightedIndex;
2795
+ if (!rest.disabled) {
2796
+ var _eventHandlers;
2797
+ eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);
2798
+ }
2799
+ return _extends({
2800
+ "aria-autocomplete": "list",
2801
+ "aria-activedescendant": isOpen && typeof highlightedIndex === "number" && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : void 0,
2802
+ "aria-controls": isOpen ? _this.menuId : void 0,
2803
+ "aria-labelledby": rest && rest["aria-label"] ? void 0 : _this.labelId,
2804
+ autoComplete: "off",
2805
+ value: inputValue,
2806
+ id: _this.inputId
2807
+ }, eventHandlers, rest);
2808
+ };
2809
+ _this.inputHandleKeyDown = function(event) {
2810
+ var key = normalizeArrowKey(event);
2811
+ if (key && _this.inputKeyDownHandlers[key]) _this.inputKeyDownHandlers[key].call(_this, event);
2812
+ };
2813
+ _this.inputHandleChange = function(event) {
2814
+ _this.internalSetState({
2815
+ type: changeInput,
2816
+ isOpen: true,
2817
+ inputValue: event.target.value,
2818
+ highlightedIndex: _this.props.defaultHighlightedIndex
2819
+ });
2820
+ };
2821
+ _this.inputHandleBlur = function() {
2822
+ _this.internalSetTimeout(function() {
2823
+ var _activeElement$datase;
2824
+ if (_this.isMouseDown || !_this.props.environment) return;
2825
+ var activeElement = _this.props.environment.document.activeElement;
2826
+ if (!((activeElement == null || (_activeElement$datase = activeElement.dataset) == null ? void 0 : _activeElement$datase.toggle) && _this._rootNode && _this._rootNode.contains(activeElement))) _this.reset({ type: blurInput });
2827
+ });
2828
+ };
2829
+ _this.menuRef = function(node) {
2830
+ _this._menuNode = node;
2831
+ };
2832
+ _this.getMenuProps = function(_temp5, _temp6) {
2833
+ var _extends3;
2834
+ var _ref5 = _temp5 === void 0 ? {} : _temp5, _ref5$refKey = _ref5.refKey, refKey = _ref5$refKey === void 0 ? "ref" : _ref5$refKey, ref = _ref5.ref, props = _objectWithoutPropertiesLoose(_ref5, _excluded4$2);
2835
+ var _ref6$suppressRefErro = (_temp6 === void 0 ? {} : _temp6).suppressRefError, suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;
2836
+ _this.getMenuProps.called = true;
2837
+ _this.getMenuProps.refKey = refKey;
2838
+ _this.getMenuProps.suppressRefError = suppressRefError;
2839
+ return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = "listbox", _extends3["aria-labelledby"] = props && props["aria-label"] ? void 0 : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
2840
+ };
2841
+ _this.getItemProps = function(_temp7) {
2842
+ var _enabledEventHandlers;
2843
+ var _ref7 = _temp7 === void 0 ? {} : _temp7, onMouseMove = _ref7.onMouseMove, onMouseDown = _ref7.onMouseDown, onClick = _ref7.onClick;
2844
+ _ref7.onPress;
2845
+ var index = _ref7.index, _ref7$item = _ref7.item, item = _ref7$item === void 0 ? /* istanbul ignore next */ void 0 : _ref7$item, rest = _objectWithoutPropertiesLoose(_ref7, _excluded5);
2846
+ if (index === void 0) {
2847
+ _this.items.push(item);
2848
+ index = _this.items.indexOf(item);
2849
+ } else _this.items[index] = item;
2850
+ var onSelectKey = "onClick";
2851
+ var customClickHandler = onClick;
2852
+ var enabledEventHandlers = (_enabledEventHandlers = {
2853
+ onMouseMove: callAllEventHandlers(onMouseMove, function() {
2854
+ if (index === _this.getState().highlightedIndex) return;
2855
+ _this.setHighlightedIndex(index, { type: itemMouseEnter });
2856
+ _this.avoidScrolling = true;
2857
+ _this.internalSetTimeout(function() {
2858
+ return _this.avoidScrolling = false;
2859
+ }, 250);
2860
+ }),
2861
+ onMouseDown: callAllEventHandlers(onMouseDown, function(event) {
2862
+ event.preventDefault();
2863
+ })
2864
+ }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function() {
2865
+ _this.selectItemAtIndex(index, { type: clickItem });
2866
+ }), _enabledEventHandlers);
2867
+ var eventHandlers = rest.disabled ? { onMouseDown: enabledEventHandlers.onMouseDown } : enabledEventHandlers;
2868
+ return _extends({
2869
+ id: _this.getItemId(index),
2870
+ role: "option",
2871
+ "aria-selected": _this.getState().highlightedIndex === index
2872
+ }, eventHandlers, rest);
2873
+ };
2874
+ _this.clearItems = function() {
2875
+ _this.items = [];
2876
+ };
2877
+ _this.reset = function(otherStateToSet, cb) {
2878
+ if (otherStateToSet === void 0) otherStateToSet = {};
2879
+ otherStateToSet = pickState(otherStateToSet);
2880
+ _this.internalSetState(function(_ref8) {
2881
+ var selectedItem = _ref8.selectedItem;
2882
+ return _extends({
2883
+ isOpen: _this.props.defaultIsOpen,
2884
+ highlightedIndex: _this.props.defaultHighlightedIndex,
2885
+ inputValue: _this.props.itemToString(selectedItem)
2886
+ }, otherStateToSet);
2887
+ }, cb);
2888
+ };
2889
+ _this.toggleMenu = function(otherStateToSet, cb) {
2890
+ if (otherStateToSet === void 0) otherStateToSet = {};
2891
+ otherStateToSet = pickState(otherStateToSet);
2892
+ _this.internalSetState(function(_ref9) {
2893
+ var isOpen = _ref9.isOpen;
2894
+ return _extends({ isOpen: !isOpen }, isOpen && { highlightedIndex: _this.props.defaultHighlightedIndex }, otherStateToSet);
2895
+ }, function() {
2896
+ var _this$getState7 = _this.getState(), isOpen = _this$getState7.isOpen, highlightedIndex = _this$getState7.highlightedIndex;
2897
+ if (isOpen) {
2898
+ if (_this.getItemCount() > 0 && typeof highlightedIndex === "number") _this.setHighlightedIndex(highlightedIndex, otherStateToSet);
2899
+ }
2900
+ cbToCb(cb)();
2901
+ });
2902
+ };
2903
+ _this.openMenu = function(cb) {
2904
+ _this.internalSetState({ isOpen: true }, cb);
2905
+ };
2906
+ _this.closeMenu = function(cb) {
2907
+ _this.internalSetState({ isOpen: false }, cb);
2908
+ };
2909
+ _this.updateStatus = debounce(function() {
2910
+ var _this$props;
2911
+ if (!((_this$props = _this.props) != null && (_this$props = _this$props.environment) != null && _this$props.document)) return;
2912
+ var state = _this.getState();
2913
+ var item = _this.items[state.highlightedIndex];
2914
+ var resultCount = _this.getItemCount();
2915
+ var status = _this.props.getA11yStatusMessage(_extends({
2916
+ itemToString: _this.props.itemToString,
2917
+ previousResultCount: _this.previousResultCount,
2918
+ resultCount,
2919
+ highlightedItem: item
2920
+ }, state));
2921
+ _this.previousResultCount = resultCount;
2922
+ setStatus(status, _this.props.environment.document);
2923
+ }, 200);
2924
+ var _this$props2 = _this.props, defaultHighlightedIndex = _this$props2.defaultHighlightedIndex, _this$props2$initialH = _this$props2.initialHighlightedIndex, _highlightedIndex = _this$props2$initialH === void 0 ? defaultHighlightedIndex : _this$props2$initialH, defaultIsOpen = _this$props2.defaultIsOpen, _this$props2$initialI = _this$props2.initialIsOpen, _isOpen = _this$props2$initialI === void 0 ? defaultIsOpen : _this$props2$initialI, _this$props2$initialI2 = _this$props2.initialInputValue, _inputValue = _this$props2$initialI2 === void 0 ? "" : _this$props2$initialI2, _this$props2$initialS = _this$props2.initialSelectedItem, _selectedItem = _this$props2$initialS === void 0 ? null : _this$props2$initialS;
2925
+ var _state = _this.getState({
2926
+ highlightedIndex: _highlightedIndex,
2927
+ isOpen: _isOpen,
2928
+ inputValue: _inputValue,
2929
+ selectedItem: _selectedItem
2930
+ });
2931
+ if (_state.selectedItem != null && _this.props.initialInputValue === void 0) _state.inputValue = _this.props.itemToString(_state.selectedItem);
2932
+ _this.state = _state;
2933
+ return _this;
2934
+ }
2935
+ _inheritsLoose(Downshift, _Component);
2936
+ var _proto = Downshift.prototype;
2937
+ /**
2938
+ * Clear all running timeouts
2939
+ */
2940
+ _proto.internalClearTimeouts = function internalClearTimeouts() {
2941
+ this.timeoutIds.forEach(function(id) {
2942
+ clearTimeout(id);
2943
+ });
2944
+ this.timeoutIds = [];
2945
+ };
2946
+ _proto.getState = function getState$1(stateToMerge) {
2947
+ if (stateToMerge === void 0) stateToMerge = this.state;
2948
+ return getState(stateToMerge, this.props);
2949
+ };
2950
+ _proto.getItemCount = function getItemCount() {
2951
+ var itemCount = this.items.length;
2952
+ if (this.itemCount != null) itemCount = this.itemCount;
2953
+ else if (this.props.itemCount !== void 0) itemCount = this.props.itemCount;
2954
+ return itemCount;
2955
+ };
2956
+ _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {
2957
+ return this.props.environment ? this.props.environment.document.getElementById(this.getItemId(index)) : null;
2958
+ };
2959
+ _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {
2960
+ var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
2961
+ this.props.scrollIntoView(node, this._menuNode);
2962
+ };
2963
+ _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {
2964
+ var itemCount = this.getItemCount();
2965
+ var highlightedIndex = this.getState().highlightedIndex;
2966
+ if (itemCount > 0) {
2967
+ var nextHighlightedIndex = getHighlightedIndex(highlightedIndex, amount, { length: itemCount }, this.isItemDisabled, true);
2968
+ this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);
2969
+ }
2970
+ };
2971
+ _proto.getStateAndHelpers = function getStateAndHelpers() {
2972
+ var _this$getState9 = this.getState(), highlightedIndex = _this$getState9.highlightedIndex, inputValue = _this$getState9.inputValue, selectedItem = _this$getState9.selectedItem, isOpen = _this$getState9.isOpen;
2973
+ var itemToString = this.props.itemToString;
2974
+ var id = this.id;
2975
+ var getRootProps = this.getRootProps, getToggleButtonProps = this.getToggleButtonProps, getLabelProps = this.getLabelProps, getMenuProps = this.getMenuProps, getInputProps = this.getInputProps, getItemProps = this.getItemProps, openMenu = this.openMenu, closeMenu = this.closeMenu, toggleMenu = this.toggleMenu, selectItem = this.selectItem, selectItemAtIndex = this.selectItemAtIndex, selectHighlightedItem = this.selectHighlightedItem, setHighlightedIndex = this.setHighlightedIndex, clearSelection = this.clearSelection, clearItems = this.clearItems;
2976
+ return {
2977
+ getRootProps,
2978
+ getToggleButtonProps,
2979
+ getLabelProps,
2980
+ getMenuProps,
2981
+ getInputProps,
2982
+ getItemProps,
2983
+ reset: this.reset,
2984
+ openMenu,
2985
+ closeMenu,
2986
+ toggleMenu,
2987
+ selectItem,
2988
+ selectItemAtIndex,
2989
+ selectHighlightedItem,
2990
+ setHighlightedIndex,
2991
+ clearSelection,
2992
+ clearItems,
2993
+ setItemCount: this.setItemCount,
2994
+ unsetItemCount: this.unsetItemCount,
2995
+ setState: this.internalSetState,
2996
+ itemToString,
2997
+ id,
2998
+ highlightedIndex,
2999
+ inputValue,
3000
+ isOpen,
3001
+ selectedItem
3002
+ };
3003
+ };
3004
+ _proto.componentDidMount = function componentDidMount() {
3005
+ var _this4 = this;
3006
+ /* istanbul ignore if (react-native or SSR) */
3007
+ if (!this.props.environment) this.cleanup = function() {
3008
+ _this4.internalClearTimeouts();
3009
+ };
3010
+ else {
3011
+ var onMouseDown = function onMouseDown() {
3012
+ _this4.isMouseDown = true;
3013
+ };
3014
+ var onMouseUp = function onMouseUp(event) {
3015
+ _this4.isMouseDown = false;
3016
+ if (!targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment) && _this4.getState().isOpen) _this4.reset({ type: mouseUp }, function() {
3017
+ return _this4.props.onOuterClick(_this4.getStateAndHelpers());
3018
+ });
3019
+ };
3020
+ var onTouchStart = function onTouchStart() {
3021
+ _this4.isTouchMove = false;
3022
+ };
3023
+ var onTouchMove = function onTouchMove() {
3024
+ _this4.isTouchMove = true;
3025
+ };
3026
+ var onTouchEnd = function onTouchEnd(event) {
3027
+ var contextWithinDownshift = targetWithinDownshift(event.target, [_this4._rootNode, _this4._menuNode], _this4.props.environment, false);
3028
+ if (!_this4.isTouchMove && !contextWithinDownshift && _this4.getState().isOpen) _this4.reset({ type: touchEnd }, function() {
3029
+ return _this4.props.onOuterClick(_this4.getStateAndHelpers());
3030
+ });
3031
+ };
3032
+ var environment = this.props.environment;
3033
+ environment.addEventListener("mousedown", onMouseDown);
3034
+ environment.addEventListener("mouseup", onMouseUp);
3035
+ environment.addEventListener("touchstart", onTouchStart);
3036
+ environment.addEventListener("touchmove", onTouchMove);
3037
+ environment.addEventListener("touchend", onTouchEnd);
3038
+ this.cleanup = function() {
3039
+ _this4.internalClearTimeouts();
3040
+ _this4.updateStatus.cancel();
3041
+ environment.removeEventListener("mousedown", onMouseDown);
3042
+ environment.removeEventListener("mouseup", onMouseUp);
3043
+ environment.removeEventListener("touchstart", onTouchStart);
3044
+ environment.removeEventListener("touchmove", onTouchMove);
3045
+ environment.removeEventListener("touchend", onTouchEnd);
3046
+ };
3047
+ }
3048
+ };
3049
+ _proto.shouldScroll = function shouldScroll(prevState, prevProps) {
3050
+ var currentHighlightedIndex = (this.props.highlightedIndex === void 0 ? this.getState() : this.props).highlightedIndex;
3051
+ var prevHighlightedIndex = (prevProps.highlightedIndex === void 0 ? prevState : prevProps).highlightedIndex;
3052
+ return currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen || currentHighlightedIndex !== prevHighlightedIndex;
3053
+ };
3054
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
3055
+ if (this.props.selectedItem !== void 0 && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) this.internalSetState({
3056
+ type: controlledPropUpdatedSelectedItem,
3057
+ inputValue: this.props.itemToString(this.props.selectedItem)
3058
+ });
3059
+ if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) this.scrollHighlightedItemIntoView();
3060
+ this.updateStatus();
3061
+ };
3062
+ _proto.componentWillUnmount = function componentWillUnmount() {
3063
+ this.cleanup();
3064
+ };
3065
+ _proto.render = function render() {
3066
+ var children = unwrapArray(this.props.children, noop);
3067
+ this.clearItems();
3068
+ this.getRootProps.called = false;
3069
+ this.getRootProps.refKey = void 0;
3070
+ this.getRootProps.suppressRefError = void 0;
3071
+ this.getMenuProps.called = false;
3072
+ this.getMenuProps.refKey = void 0;
3073
+ this.getMenuProps.suppressRefError = void 0;
3074
+ this.getLabelProps.called = false;
3075
+ this.getInputProps.called = false;
3076
+ var element = unwrapArray(children(this.getStateAndHelpers()));
3077
+ if (!element) return null;
3078
+ if (this.getRootProps.called || this.props.suppressRefError) return element;
3079
+ else if (isDOMElement(element)) return /*#__PURE__*/ cloneElement(element, this.getRootProps(getElementProps(element)));
3080
+ };
3081
+ return Downshift;
3082
+ }(Component);
3083
+ Downshift.defaultProps = {
3084
+ defaultHighlightedIndex: null,
3085
+ defaultIsOpen: false,
3086
+ getA11yStatusMessage,
3087
+ itemToString: function itemToString(i) {
3088
+ if (i == null) return "";
3089
+ return String(i);
3090
+ },
3091
+ onStateChange: noop,
3092
+ onInputValueChange: noop,
3093
+ onUserAction: noop,
3094
+ onChange: noop,
3095
+ onSelect: noop,
3096
+ onOuterClick: noop,
3097
+ selectedItemChanged: function selectedItemChanged(prevItem, item) {
3098
+ return prevItem !== item;
3099
+ },
3100
+ environment: typeof window === "undefined" || false ? void 0 : window,
3101
+ stateReducer: function stateReducer(state, stateToSet) {
3102
+ return stateToSet;
3103
+ },
3104
+ suppressRefError: false,
3105
+ scrollIntoView
3106
+ };
3107
+ Downshift.stateChangeTypes = stateChangeTypes$4;
3108
+ return Downshift;
3109
+ }();
3110
+ propTypes$4 = {
3111
+ environment: import_prop_types.default.shape({
3112
+ addEventListener: import_prop_types.default.func.isRequired,
3113
+ removeEventListener: import_prop_types.default.func.isRequired,
3114
+ document: import_prop_types.default.shape({
3115
+ createElement: import_prop_types.default.func.isRequired,
3116
+ getElementById: import_prop_types.default.func.isRequired,
3117
+ activeElement: import_prop_types.default.any.isRequired,
3118
+ body: import_prop_types.default.any.isRequired
3119
+ }).isRequired,
3120
+ Node: import_prop_types.default.func.isRequired
3121
+ }),
3122
+ itemToKey: import_prop_types.default.func,
3123
+ stateReducer: import_prop_types.default.func
3124
+ };
3125
+ updateA11yStatus = debounce(function(status, document) {
3126
+ setStatus(status, document);
3127
+ }, 200);
3128
+ dropdownPropTypes = _extends({}, propTypes$4, {
3129
+ getA11yStatusMessage: import_prop_types.default.func,
3130
+ highlightedIndex: import_prop_types.default.number,
3131
+ defaultHighlightedIndex: import_prop_types.default.number,
3132
+ initialHighlightedIndex: import_prop_types.default.number,
3133
+ isOpen: import_prop_types.default.bool,
3134
+ defaultIsOpen: import_prop_types.default.bool,
3135
+ initialIsOpen: import_prop_types.default.bool,
3136
+ selectedItem: import_prop_types.default.any,
3137
+ initialSelectedItem: import_prop_types.default.any,
3138
+ defaultSelectedItem: import_prop_types.default.any,
3139
+ id: import_prop_types.default.string,
3140
+ labelId: import_prop_types.default.string,
3141
+ menuId: import_prop_types.default.string,
3142
+ getItemId: import_prop_types.default.func,
3143
+ toggleButtonId: import_prop_types.default.string,
3144
+ onSelectedItemChange: import_prop_types.default.func,
3145
+ onHighlightedIndexChange: import_prop_types.default.func,
3146
+ onStateChange: import_prop_types.default.func,
3147
+ onIsOpenChange: import_prop_types.default.func,
3148
+ scrollIntoView: import_prop_types.default.func
3149
+ });
3150
+ dropdownDefaultProps = {
3151
+ itemToString: function itemToString(item) {
3152
+ return item ? String(item) : "";
3153
+ },
3154
+ itemToKey: function itemToKey(item) {
3155
+ return item;
3156
+ },
3157
+ isItemDisabled: function isItemDisabled(_item) {
3158
+ return false;
3159
+ },
3160
+ stateReducer: function stateReducer(_state, actionAndChanges) {
3161
+ return actionAndChanges.changes;
3162
+ },
3163
+ scrollIntoView,
3164
+ environment: typeof window === "undefined" || false ? void 0 : window
3165
+ };
3166
+ dropdownDefaultStateValues = {
3167
+ highlightedIndex: -1,
3168
+ isOpen: false,
3169
+ selectedItem: null,
3170
+ inputValue: ""
3171
+ };
3172
+ reactUseId$1 = _extends({}, _storybook_global_react_exports).useId;
3173
+ useElementIds$1 = typeof reactUseId$1 === "function" ? useElementIdsR18$1 : useElementIdsLegacy$1;
3174
+ useControlPropsValidator = noop;
3175
+ useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {
3176
+ return noop;
3177
+ };
3178
+ propTypes$3 = _extends({}, dropdownPropTypes, {
3179
+ items: import_prop_types.default.array.isRequired,
3180
+ isItemDisabled: import_prop_types.default.func
3181
+ });
3182
+ ToggleButtonClick$1 = 0;
3183
+ ToggleButtonKeyDownArrowDown = 1;
3184
+ ToggleButtonKeyDownArrowUp = 2;
3185
+ ToggleButtonKeyDownCharacter = 3;
3186
+ ToggleButtonKeyDownEscape = 4;
3187
+ ToggleButtonKeyDownHome = 5;
3188
+ ToggleButtonKeyDownEnd = 6;
3189
+ ToggleButtonKeyDownEnter = 7;
3190
+ ToggleButtonKeyDownSpaceButton = 8;
3191
+ ToggleButtonKeyDownPageUp = 9;
3192
+ ToggleButtonKeyDownPageDown = 10;
3193
+ ToggleButtonBlur = 11;
3194
+ MenuMouseLeave$1 = 12;
3195
+ ItemMouseMove$1 = 13;
3196
+ ItemClick$1 = 14;
3197
+ FunctionToggleMenu$1 = 15;
3198
+ FunctionOpenMenu$1 = 16;
3199
+ FunctionCloseMenu$1 = 17;
3200
+ FunctionSetHighlightedIndex$1 = 18;
3201
+ FunctionSelectItem$1 = 19;
3202
+ FunctionSetInputValue$1 = 20;
3203
+ FunctionReset$2 = 21;
3204
+ stateChangeTypes$3 = /*#__PURE__*/ Object.freeze({
3205
+ __proto__: null,
3206
+ FunctionCloseMenu: FunctionCloseMenu$1,
3207
+ FunctionOpenMenu: FunctionOpenMenu$1,
3208
+ FunctionReset: FunctionReset$2,
3209
+ FunctionSelectItem: FunctionSelectItem$1,
3210
+ FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
3211
+ FunctionSetInputValue: FunctionSetInputValue$1,
3212
+ FunctionToggleMenu: FunctionToggleMenu$1,
3213
+ ItemClick: ItemClick$1,
3214
+ ItemMouseMove: ItemMouseMove$1,
3215
+ MenuMouseLeave: MenuMouseLeave$1,
3216
+ ToggleButtonBlur,
3217
+ ToggleButtonClick: ToggleButtonClick$1,
3218
+ ToggleButtonKeyDownArrowDown,
3219
+ ToggleButtonKeyDownArrowUp,
3220
+ ToggleButtonKeyDownCharacter,
3221
+ ToggleButtonKeyDownEnd,
3222
+ ToggleButtonKeyDownEnter,
3223
+ ToggleButtonKeyDownEscape,
3224
+ ToggleButtonKeyDownHome,
3225
+ ToggleButtonKeyDownPageDown,
3226
+ ToggleButtonKeyDownPageUp,
3227
+ ToggleButtonKeyDownSpaceButton
3228
+ });
3229
+ _excluded$3 = ["onClick"];
3230
+ _excluded2$3 = [
3231
+ "onMouseLeave",
3232
+ "refKey",
3233
+ "ref",
3234
+ "aria-label"
3235
+ ];
3236
+ _excluded3$2 = [
3237
+ "onBlur",
3238
+ "onClick",
3239
+ "onPress",
3240
+ "onKeyDown",
3241
+ "refKey",
3242
+ "ref"
3243
+ ];
3244
+ _excluded4$1 = [
3245
+ "item",
3246
+ "index",
3247
+ "onMouseMove",
3248
+ "onClick",
3249
+ "onMouseDown",
3250
+ "onPress",
3251
+ "refKey",
3252
+ "disabled",
3253
+ "ref"
3254
+ ];
3255
+ useSelect.stateChangeTypes = stateChangeTypes$3;
3256
+ InputKeyDownArrowDown = 0;
3257
+ InputKeyDownArrowUp = 1;
3258
+ InputKeyDownEscape = 2;
3259
+ InputKeyDownHome = 3;
3260
+ InputKeyDownEnd = 4;
3261
+ InputKeyDownPageUp = 5;
3262
+ InputKeyDownPageDown = 6;
3263
+ InputKeyDownEnter = 7;
3264
+ InputChange = 8;
3265
+ InputBlur = 9;
3266
+ InputClick = 10;
3267
+ MenuMouseLeave = 11;
3268
+ ItemMouseMove = 12;
3269
+ ItemClick = 13;
3270
+ ToggleButtonClick = 14;
3271
+ FunctionToggleMenu = 15;
3272
+ FunctionOpenMenu = 16;
3273
+ FunctionCloseMenu = 17;
3274
+ FunctionSetHighlightedIndex = 18;
3275
+ FunctionSelectItem = 19;
3276
+ FunctionSetInputValue = 20;
3277
+ FunctionReset$1 = 21;
3278
+ ControlledPropUpdatedSelectedItem = 22;
3279
+ stateChangeTypes$2 = /*#__PURE__*/ Object.freeze({
3280
+ __proto__: null,
3281
+ ControlledPropUpdatedSelectedItem,
3282
+ FunctionCloseMenu,
3283
+ FunctionOpenMenu,
3284
+ FunctionReset: FunctionReset$1,
3285
+ FunctionSelectItem,
3286
+ FunctionSetHighlightedIndex,
3287
+ FunctionSetInputValue,
3288
+ FunctionToggleMenu,
3289
+ InputBlur,
3290
+ InputChange,
3291
+ InputClick,
3292
+ InputKeyDownArrowDown,
3293
+ InputKeyDownArrowUp,
3294
+ InputKeyDownEnd,
3295
+ InputKeyDownEnter,
3296
+ InputKeyDownEscape,
3297
+ InputKeyDownHome,
3298
+ InputKeyDownPageDown,
3299
+ InputKeyDownPageUp,
3300
+ ItemClick,
3301
+ ItemMouseMove,
3302
+ MenuMouseLeave,
3303
+ ToggleButtonClick
3304
+ });
3305
+ propTypes$2 = _extends({}, dropdownPropTypes, {
3306
+ items: import_prop_types.default.array.isRequired,
3307
+ isItemDisabled: import_prop_types.default.func,
3308
+ inputValue: import_prop_types.default.string,
3309
+ defaultInputValue: import_prop_types.default.string,
3310
+ initialInputValue: import_prop_types.default.string,
3311
+ inputId: import_prop_types.default.string,
3312
+ onInputValueChange: import_prop_types.default.func
3313
+ });
3314
+ _excluded$2 = [
3315
+ "onMouseLeave",
3316
+ "refKey",
3317
+ "ref",
3318
+ "aria-label"
3319
+ ];
3320
+ _excluded2$2 = [
3321
+ "item",
3322
+ "index",
3323
+ "refKey",
3324
+ "ref",
3325
+ "onMouseMove",
3326
+ "onMouseDown",
3327
+ "onClick",
3328
+ "onPress",
3329
+ "disabled"
3330
+ ];
3331
+ _excluded3$1 = [
3332
+ "onClick",
3333
+ "onPress",
3334
+ "refKey",
3335
+ "ref"
3336
+ ];
3337
+ _excluded4 = [
3338
+ "aria-label",
3339
+ "onKeyDown",
3340
+ "onChange",
3341
+ "onInput",
3342
+ "onBlur",
3343
+ "onChangeText",
3344
+ "onClick",
3345
+ "refKey",
3346
+ "ref"
3347
+ ];
3348
+ useCombobox.stateChangeTypes = stateChangeTypes$2;
3349
+ defaultStateValues = {
3350
+ activeIndex: -1,
3351
+ selectedItems: []
3352
+ };
3353
+ dropdownPropTypes.stateReducer, dropdownPropTypes.itemToKey, dropdownPropTypes.environment, import_prop_types.default.array, import_prop_types.default.array, import_prop_types.default.array, import_prop_types.default.func, import_prop_types.default.number, import_prop_types.default.number, import_prop_types.default.number, import_prop_types.default.func, import_prop_types.default.func, import_prop_types.default.string, import_prop_types.default.string;
3354
+ defaultProps = {
3355
+ itemToKey: dropdownDefaultProps.itemToKey,
3356
+ stateReducer: dropdownDefaultProps.stateReducer,
3357
+ environment: dropdownDefaultProps.environment,
3358
+ keyNavigationNext: "ArrowRight",
3359
+ keyNavigationPrevious: "ArrowLeft"
3360
+ };
3361
+ validatePropTypes = noop;
3362
+ SelectedItemClick = 0;
3363
+ SelectedItemKeyDownDelete = 1;
3364
+ SelectedItemKeyDownBackspace = 2;
3365
+ SelectedItemKeyDownNavigationNext = 3;
3366
+ SelectedItemKeyDownNavigationPrevious = 4;
3367
+ DropdownKeyDownNavigationPrevious = 5;
3368
+ DropdownKeyDownBackspace = 6;
3369
+ DropdownClick = 7;
3370
+ FunctionAddSelectedItem = 8;
3371
+ FunctionRemoveSelectedItem = 9;
3372
+ FunctionSetSelectedItems = 10;
3373
+ FunctionSetActiveIndex = 11;
3374
+ FunctionReset = 12;
3375
+ stateChangeTypes$1 = /*#__PURE__*/ Object.freeze({
3376
+ __proto__: null,
3377
+ DropdownClick,
3378
+ DropdownKeyDownBackspace,
3379
+ DropdownKeyDownNavigationPrevious,
3380
+ FunctionAddSelectedItem,
3381
+ FunctionRemoveSelectedItem,
3382
+ FunctionReset,
3383
+ FunctionSetActiveIndex,
3384
+ FunctionSetSelectedItems,
3385
+ SelectedItemClick,
3386
+ SelectedItemKeyDownBackspace,
3387
+ SelectedItemKeyDownDelete,
3388
+ SelectedItemKeyDownNavigationNext,
3389
+ SelectedItemKeyDownNavigationPrevious
3390
+ });
3391
+ _excluded$1 = [
3392
+ "refKey",
3393
+ "ref",
3394
+ "onClick",
3395
+ "onKeyDown",
3396
+ "selectedItem",
3397
+ "index"
3398
+ ];
3399
+ _excluded2$1 = [
3400
+ "refKey",
3401
+ "ref",
3402
+ "onKeyDown",
3403
+ "onClick",
3404
+ "preventKeyAction"
3405
+ ];
3406
+ useMultipleSelection.stateChangeTypes = stateChangeTypes$1;
3407
+ TagClick = 0;
3408
+ TagGroupKeyDownArrowLeft = 1;
3409
+ TagGroupKeyDownArrowRight = 2;
3410
+ TagGroupKeyDownDelete = 3;
3411
+ TagGroupKeyDownBackspace = 4;
3412
+ TagRemoveClick = 5;
3413
+ FunctionAddItem = 6;
3414
+ stateChangeTypes = /*#__PURE__*/ Object.freeze({
3415
+ __proto__: null,
3416
+ FunctionAddItem,
3417
+ TagClick,
3418
+ TagGroupKeyDownArrowLeft,
3419
+ TagGroupKeyDownArrowRight,
3420
+ TagGroupKeyDownBackspace,
3421
+ TagGroupKeyDownDelete,
3422
+ TagRemoveClick
3423
+ });
3424
+ reactUseId = _extends({}, _storybook_global_react_exports).useId;
3425
+ useElementIds = typeof reactUseId === "function" ? useElementIdsR18 : useElementIdsLegacy;
3426
+ A11Y_DESCRIPTION_ELEMENT_ID = "tag-group-a11y-description";
3427
+ propTypes = { isItemDisabled: import_prop_types.default.func };
3428
+ _excluded = ["onKeyDown"];
3429
+ _excluded2 = [
3430
+ "index",
3431
+ "refKey",
3432
+ "ref",
3433
+ "onClick"
3434
+ ];
3435
+ _excluded3 = ["index", "onClick"];
3436
+ _useTagGroup = function useTagGroup(userProps) {
3437
+ var _props$environment;
3438
+ if (userProps === void 0) userProps = {};
3439
+ validatePropTypes$1(userProps, _useTagGroup, propTypes);
3440
+ var props = getMergedProps(userProps);
3441
+ var _useControlledReducer = useControlledReducer$1(useTagGroupReducer, props, getInitialState, isStateEqual), state = _useControlledReducer[0], dispatch = _useControlledReducer[1];
3442
+ var activeIndex = state.activeIndex, items = state.items;
3443
+ var elementIds = useElementIds({
3444
+ getTagId: props.getTagId,
3445
+ id: props.id,
3446
+ tagGroupId: props.tagGroupId
3447
+ });
3448
+ useAccessibleDescription((_props$environment = props.environment) == null ? void 0 : _props$environment.document, props.removeElementDescription);
3449
+ var itemRefs = useRovingTagFocus(activeIndex, items.length, elementIds.getTagId);
3450
+ var getTagGroupProps = useCallback(function(options) {
3451
+ var _ref = options != null ? options : {}, onKeyDown = _ref.onKeyDown, rest = _objectWithoutPropertiesLoose(_ref, _excluded);
3452
+ return _extends({
3453
+ id: elementIds.tagGroupId,
3454
+ "aria-live": "polite",
3455
+ "aria-atomic": "false",
3456
+ "aria-relevant": "additions",
3457
+ role: "listbox",
3458
+ onKeyDown: callAllEventHandlers(onKeyDown, function handleKeyDown(e) {
3459
+ switch (e.key) {
3460
+ case "ArrowLeft":
3461
+ dispatch({ type: TagGroupKeyDownArrowLeft });
3462
+ break;
3463
+ case "ArrowRight":
3464
+ dispatch({ type: TagGroupKeyDownArrowRight });
3465
+ break;
3466
+ case "Delete":
3467
+ dispatch({ type: TagGroupKeyDownDelete });
3468
+ break;
3469
+ case "Backspace": dispatch({ type: TagGroupKeyDownBackspace });
3470
+ }
3471
+ })
3472
+ }, rest);
3473
+ }, [dispatch, elementIds.tagGroupId]);
3474
+ var getTagProps = useCallback(function(options) {
3475
+ var _extends2;
3476
+ var index = options.index, _options$refKey = options.refKey, refKey = _options$refKey === void 0 ? "ref" : _options$refKey, ref = options.ref, onClick = options.onClick, rest = _objectWithoutPropertiesLoose(options, _excluded2);
3477
+ if (!Number.isInteger(index) || index < 0) throw new Error("Pass correct item index to getTagProps!");
3478
+ var handleClick = function handleClick() {
3479
+ dispatch({
3480
+ type: TagClick,
3481
+ index
3482
+ });
3483
+ };
3484
+ var tagId = elementIds.getTagId(index);
3485
+ return _extends((_extends2 = { "aria-describedby": A11Y_DESCRIPTION_ELEMENT_ID }, _extends2[refKey] = handleRefs(ref, function(itemNode) {
3486
+ if (itemNode) itemRefs.current[tagId] = itemNode;
3487
+ }), _extends2["aria-labelledby"] = tagId, _extends2.role = "option", _extends2.id = tagId, _extends2.onClick = callAllEventHandlers(onClick, handleClick), _extends2.tabIndex = activeIndex === index ? 0 : -1, _extends2), rest);
3488
+ }, [
3489
+ dispatch,
3490
+ elementIds,
3491
+ activeIndex,
3492
+ itemRefs
3493
+ ]);
3494
+ var getTagRemoveProps = useCallback(function(options) {
3495
+ var index = options.index, onClick = options.onClick, rest = _objectWithoutPropertiesLoose(options, _excluded3);
3496
+ if (!Number.isInteger(index) || index < 0) throw new Error("Pass correct item index to getTagRemoveProps!");
3497
+ var handleClick = function handleClick(event) {
3498
+ event.stopPropagation();
3499
+ dispatch({
3500
+ type: TagRemoveClick,
3501
+ index
3502
+ });
3503
+ };
3504
+ var tagId = elementIds.getTagId(index);
3505
+ var tagRemoveId = tagId + "-remove";
3506
+ return _extends({
3507
+ id: tagRemoveId,
3508
+ tabIndex: -1,
3509
+ "aria-labelledby": tagRemoveId + " " + tagId,
3510
+ onClick: callAllEventHandlers(onClick, handleClick)
3511
+ }, rest);
3512
+ }, [elementIds, dispatch]);
3513
+ return {
3514
+ activeIndex,
3515
+ addItem: useCallback(function(item, index) {
3516
+ dispatch({
3517
+ type: FunctionAddItem,
3518
+ item,
3519
+ index
3520
+ });
3521
+ }, [dispatch]),
3522
+ getTagGroupProps,
3523
+ getTagProps,
3524
+ getTagRemoveProps,
3525
+ items
3526
+ };
3527
+ };
3528
+ _useTagGroup.stateChangeTypes = stateChangeTypes;
3529
+ })))();
3530
+ }
3531
+ //#endregion
3532
+ //#region ../../node_modules/fuse.js/dist/fuse.js
3533
+ var require_fuse = /* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
3534
+ /*!
3535
+ * Fuse.js v3.6.1 - Lightweight fuzzy-search (http://fusejs.io)
3536
+ *
3537
+ * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
3538
+ * All Rights Reserved. Apache Software License 2.0
3539
+ *
3540
+ * http://www.apache.org/licenses/LICENSE-2.0
3541
+ */
3542
+ (function(e, t) {
3543
+ "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define("Fuse", [], t) : "object" == typeof exports ? exports.Fuse = t() : e.Fuse = t();
3544
+ })(this$1, function() {
3545
+ return function(e) {
3546
+ var t = {};
3547
+ function r(n) {
3548
+ if (t[n]) return t[n].exports;
3549
+ var o = t[n] = {
3550
+ i: n,
3551
+ l: !1,
3552
+ exports: {}
3553
+ };
3554
+ return e[n].call(o.exports, o, o.exports, r), o.l = !0, o.exports;
3555
+ }
3556
+ return r.m = e, r.c = t, r.d = function(e, t, n) {
3557
+ r.o(e, t) || Object.defineProperty(e, t, {
3558
+ enumerable: !0,
3559
+ get: n
3560
+ });
3561
+ }, r.r = function(e) {
3562
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
3563
+ }, r.t = function(e, t) {
3564
+ if (1 & t && (e = r(e)), 8 & t) return e;
3565
+ if (4 & t && "object" == typeof e && e && e.__esModule) return e;
3566
+ var n = Object.create(null);
3567
+ if (r.r(n), Object.defineProperty(n, "default", {
3568
+ enumerable: !0,
3569
+ value: e
3570
+ }), 2 & t && "string" != typeof e) for (var o in e) r.d(n, o, function(t) {
3571
+ return e[t];
3572
+ }.bind(null, o));
3573
+ return n;
3574
+ }, r.n = function(e) {
3575
+ var t = e && e.__esModule ? function() {
3576
+ return e.default;
3577
+ } : function() {
3578
+ return e;
3579
+ };
3580
+ return r.d(t, "a", t), t;
3581
+ }, r.o = function(e, t) {
3582
+ return Object.prototype.hasOwnProperty.call(e, t);
3583
+ }, r.p = "", r(r.s = 0);
3584
+ }([
3585
+ function(e, t, r) {
3586
+ function n(e) {
3587
+ return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
3588
+ return typeof e;
3589
+ } : function(e) {
3590
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
3591
+ })(e);
3592
+ }
3593
+ function o(e, t) {
3594
+ for (var r = 0; r < t.length; r++) {
3595
+ var n = t[r];
3596
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
3597
+ }
3598
+ }
3599
+ var i = r(1), a = r(7), s = a.get, c = (a.deepValue, a.isArray);
3600
+ e.exports = function() {
3601
+ function e(t, r) {
3602
+ var n = r.location, o = void 0 === n ? 0 : n, i = r.distance, a = void 0 === i ? 100 : i, c = r.threshold, h = void 0 === c ? .6 : c, l = r.maxPatternLength, u = void 0 === l ? 32 : l, f = r.caseSensitive, v = void 0 !== f && f, p = r.tokenSeparator, d = void 0 === p ? / +/g : p, g = r.findAllMatches, y = void 0 !== g && g, m = r.minMatchCharLength, k = void 0 === m ? 1 : m, b = r.id, S = void 0 === b ? null : b, x = r.keys, M = void 0 === x ? [] : x, _ = r.shouldSort, w = void 0 === _ || _, L = r.getFn, A = void 0 === L ? s : L, O = r.sortFn, C = void 0 === O ? function(e, t) {
3603
+ return e.score - t.score;
3604
+ } : O, j = r.tokenize, P = void 0 !== j && j, I = r.matchAllTokens, F = void 0 !== I && I, T = r.includeMatches, N = void 0 !== T && T, z = r.includeScore, E = void 0 !== z && z, W = r.verbose, K = void 0 !== W && W;
3605
+ (function(e, t) {
3606
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
3607
+ })(this, e), this.options = {
3608
+ location: o,
3609
+ distance: a,
3610
+ threshold: h,
3611
+ maxPatternLength: u,
3612
+ isCaseSensitive: v,
3613
+ tokenSeparator: d,
3614
+ findAllMatches: y,
3615
+ minMatchCharLength: k,
3616
+ id: S,
3617
+ keys: M,
3618
+ includeMatches: N,
3619
+ includeScore: E,
3620
+ shouldSort: w,
3621
+ getFn: A,
3622
+ sortFn: C,
3623
+ verbose: K,
3624
+ tokenize: P,
3625
+ matchAllTokens: F
3626
+ }, this.setCollection(t), this._processKeys(M);
3627
+ }
3628
+ var t = e, r, a;
3629
+ return (r = [
3630
+ {
3631
+ key: "setCollection",
3632
+ value: function(e) {
3633
+ return this.list = e, e;
3634
+ }
3635
+ },
3636
+ {
3637
+ key: "_processKeys",
3638
+ value: function(e) {
3639
+ if (this._keyWeights = {}, this._keyNames = [], e.length && "string" == typeof e[0]) for (var t = 0, r = e.length; t < r; t += 1) {
3640
+ var n = e[t];
3641
+ this._keyWeights[n] = 1, this._keyNames.push(n);
3642
+ }
3643
+ else {
3644
+ for (var o = null, i = null, a = 0, s = 0, c = e.length; s < c; s += 1) {
3645
+ var h = e[s];
3646
+ if (!h.hasOwnProperty("name")) throw new Error("Missing \"name\" property in key object");
3647
+ var l = h.name;
3648
+ if (this._keyNames.push(l), !h.hasOwnProperty("weight")) throw new Error("Missing \"weight\" property in key object");
3649
+ var u = h.weight;
3650
+ if (u < 0 || u > 1) throw new Error("\"weight\" property in key must bein the range of [0, 1)");
3651
+ i = null == i ? u : Math.max(i, u), o = null == o ? u : Math.min(o, u), this._keyWeights[l] = u, a += u;
3652
+ }
3653
+ if (a > 1) throw new Error("Total of weights cannot exceed 1");
3654
+ }
3655
+ }
3656
+ },
3657
+ {
3658
+ key: "search",
3659
+ value: function(e) {
3660
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : { limit: !1 };
3661
+ this._log("---------\nSearch pattern: \"".concat(e, "\""));
3662
+ var r = this._prepareSearchers(e), n = r.tokenSearchers, o = r.fullSearcher, i = this._search(n, o);
3663
+ return this._computeScore(i), this.options.shouldSort && this._sort(i), t.limit && "number" == typeof t.limit && (i = i.slice(0, t.limit)), this._format(i);
3664
+ }
3665
+ },
3666
+ {
3667
+ key: "_prepareSearchers",
3668
+ value: function() {
3669
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", t = [];
3670
+ if (this.options.tokenize) for (var r = e.split(this.options.tokenSeparator), n = 0, o = r.length; n < o; n += 1) t.push(new i(r[n], this.options));
3671
+ return {
3672
+ tokenSearchers: t,
3673
+ fullSearcher: new i(e, this.options)
3674
+ };
3675
+ }
3676
+ },
3677
+ {
3678
+ key: "_search",
3679
+ value: function() {
3680
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], t = arguments.length > 1 ? arguments[1] : void 0, r = this.list, n = {}, o = [];
3681
+ if ("string" == typeof r[0]) {
3682
+ for (var i = 0, a = r.length; i < a; i += 1) this._analyze({
3683
+ key: "",
3684
+ value: r[i],
3685
+ record: i,
3686
+ index: i
3687
+ }, {
3688
+ resultMap: n,
3689
+ results: o,
3690
+ tokenSearchers: e,
3691
+ fullSearcher: t
3692
+ });
3693
+ return o;
3694
+ }
3695
+ for (var s = 0, c = r.length; s < c; s += 1) for (var h = r[s], l = 0, u = this._keyNames.length; l < u; l += 1) {
3696
+ var f = this._keyNames[l];
3697
+ this._analyze({
3698
+ key: f,
3699
+ value: this.options.getFn(h, f),
3700
+ record: h,
3701
+ index: s
3702
+ }, {
3703
+ resultMap: n,
3704
+ results: o,
3705
+ tokenSearchers: e,
3706
+ fullSearcher: t
3707
+ });
3708
+ }
3709
+ return o;
3710
+ }
3711
+ },
3712
+ {
3713
+ key: "_analyze",
3714
+ value: function(e, t) {
3715
+ var r = this, n = e.key, o = e.arrayIndex, i = void 0 === o ? -1 : o, a = e.value, s = e.record, h = e.index, l = t.tokenSearchers, u = void 0 === l ? [] : l, f = t.fullSearcher, v = t.resultMap, p = void 0 === v ? {} : v, d = t.results, g = void 0 === d ? [] : d;
3716
+ (function e(t, o, i, a) {
3717
+ if (null != o) {
3718
+ if ("string" == typeof o) {
3719
+ var s = !1, h = -1, l = 0;
3720
+ r._log("\nKey: ".concat("" === n ? "--" : n));
3721
+ var v = f.search(o);
3722
+ if (r._log("Full text: \"".concat(o, "\", score: ").concat(v.score)), r.options.tokenize) {
3723
+ for (var d = o.split(r.options.tokenSeparator), y = d.length, m = [], k = 0, b = u.length; k < b; k += 1) {
3724
+ var S = u[k];
3725
+ r._log("\nPattern: \"".concat(S.pattern, "\""));
3726
+ for (var x = !1, M = 0; M < y; M += 1) {
3727
+ var _ = d[M], w = S.search(_), L = {};
3728
+ w.isMatch ? (L[_] = w.score, s = !0, x = !0, m.push(w.score)) : (L[_] = 1, r.options.matchAllTokens || m.push(1)), r._log("Token: \"".concat(_, "\", score: ").concat(L[_]));
3729
+ }
3730
+ x && (l += 1);
3731
+ }
3732
+ h = m[0];
3733
+ for (var A = m.length, O = 1; O < A; O += 1) h += m[O];
3734
+ h /= A, r._log("Token score average:", h);
3735
+ }
3736
+ var C = v.score;
3737
+ h > -1 && (C = (C + h) / 2), r._log("Score average:", C);
3738
+ var j = !r.options.tokenize || !r.options.matchAllTokens || l >= u.length;
3739
+ if (r._log("\nCheck Matches: ".concat(j)), (s || v.isMatch) && j) {
3740
+ var P = {
3741
+ key: n,
3742
+ arrayIndex: t,
3743
+ value: o,
3744
+ score: C
3745
+ };
3746
+ r.options.includeMatches && (P.matchedIndices = v.matchedIndices);
3747
+ var I = p[a];
3748
+ I ? I.output.push(P) : (p[a] = {
3749
+ item: i,
3750
+ output: [P]
3751
+ }, g.push(p[a]));
3752
+ }
3753
+ } else if (c(o)) for (var F = 0, T = o.length; F < T; F += 1) e(F, o[F], i, a);
3754
+ }
3755
+ })(i, a, s, h);
3756
+ }
3757
+ },
3758
+ {
3759
+ key: "_computeScore",
3760
+ value: function(e) {
3761
+ this._log("\n\nComputing score:\n");
3762
+ for (var t = this._keyWeights, r = !!Object.keys(t).length, n = 0, o = e.length; n < o; n += 1) {
3763
+ for (var i = e[n], a = i.output, s = a.length, c = 1, h = 0; h < s; h += 1) {
3764
+ var l = a[h], u = l.key, f = r ? t[u] : 1, v = 0 === l.score && t && t[u] > 0 ? Number.EPSILON : l.score;
3765
+ c *= Math.pow(v, f);
3766
+ }
3767
+ i.score = c, this._log(i);
3768
+ }
3769
+ }
3770
+ },
3771
+ {
3772
+ key: "_sort",
3773
+ value: function(e) {
3774
+ this._log("\n\nSorting...."), e.sort(this.options.sortFn);
3775
+ }
3776
+ },
3777
+ {
3778
+ key: "_format",
3779
+ value: function(e) {
3780
+ var t = [];
3781
+ if (this.options.verbose) {
3782
+ var r = [];
3783
+ this._log("\n\nOutput:\n\n", JSON.stringify(e, function(e, t) {
3784
+ if ("object" === n(t) && null !== t) {
3785
+ if (-1 !== r.indexOf(t)) return;
3786
+ r.push(t);
3787
+ }
3788
+ return t;
3789
+ }, 2)), r = null;
3790
+ }
3791
+ var o = [];
3792
+ this.options.includeMatches && o.push(function(e, t) {
3793
+ var r = e.output;
3794
+ t.matches = [];
3795
+ for (var n = 0, o = r.length; n < o; n += 1) {
3796
+ var i = r[n];
3797
+ if (0 !== i.matchedIndices.length) {
3798
+ var a = {
3799
+ indices: i.matchedIndices,
3800
+ value: i.value
3801
+ };
3802
+ i.key && (a.key = i.key), i.hasOwnProperty("arrayIndex") && i.arrayIndex > -1 && (a.arrayIndex = i.arrayIndex), t.matches.push(a);
3803
+ }
3804
+ }
3805
+ }), this.options.includeScore && o.push(function(e, t) {
3806
+ t.score = e.score;
3807
+ });
3808
+ for (var i = 0, a = e.length; i < a; i += 1) {
3809
+ var s = e[i];
3810
+ if (this.options.id && (s.item = this.options.getFn(s.item, this.options.id)[0]), o.length) {
3811
+ for (var c = { item: s.item }, h = 0, l = o.length; h < l; h += 1) o[h](s, c);
3812
+ t.push(c);
3813
+ } else t.push(s.item);
3814
+ }
3815
+ return t;
3816
+ }
3817
+ },
3818
+ {
3819
+ key: "_log",
3820
+ value: function() {
3821
+ var e;
3822
+ this.options.verbose && (e = console).log.apply(e, arguments);
3823
+ }
3824
+ }
3825
+ ]) && o(t.prototype, r), a && o(t, a), e;
3826
+ }();
3827
+ },
3828
+ function(e, t, r) {
3829
+ function n(e, t) {
3830
+ for (var r = 0; r < t.length; r++) {
3831
+ var n = t[r];
3832
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
3833
+ }
3834
+ }
3835
+ var o = r(2), i = r(3), a = r(6);
3836
+ e.exports = function() {
3837
+ function e(t, r) {
3838
+ var n = r.location, o = void 0 === n ? 0 : n, i = r.distance, s = void 0 === i ? 100 : i, c = r.threshold, h = void 0 === c ? .6 : c, l = r.maxPatternLength, u = void 0 === l ? 32 : l, f = r.isCaseSensitive, v = void 0 !== f && f, p = r.tokenSeparator, d = void 0 === p ? / +/g : p, g = r.findAllMatches, y = void 0 !== g && g, m = r.minMatchCharLength, k = void 0 === m ? 1 : m, b = r.includeMatches, S = void 0 !== b && b;
3839
+ (function(e, t) {
3840
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
3841
+ })(this, e), this.options = {
3842
+ location: o,
3843
+ distance: s,
3844
+ threshold: h,
3845
+ maxPatternLength: u,
3846
+ isCaseSensitive: v,
3847
+ tokenSeparator: d,
3848
+ findAllMatches: y,
3849
+ includeMatches: S,
3850
+ minMatchCharLength: k
3851
+ }, this.pattern = v ? t : t.toLowerCase(), this.pattern.length <= u && (this.patternAlphabet = a(this.pattern));
3852
+ }
3853
+ var t = e, r, s;
3854
+ return (r = [{
3855
+ key: "search",
3856
+ value: function(e) {
3857
+ var t = this.options, r = t.isCaseSensitive, n = t.includeMatches;
3858
+ if (r || (e = e.toLowerCase()), this.pattern === e) {
3859
+ var a = {
3860
+ isMatch: !0,
3861
+ score: 0
3862
+ };
3863
+ return n && (a.matchedIndices = [[0, e.length - 1]]), a;
3864
+ }
3865
+ var s = this.options, c = s.maxPatternLength, h = s.tokenSeparator;
3866
+ if (this.pattern.length > c) return o(e, this.pattern, h);
3867
+ var l = this.options, u = l.location, f = l.distance, v = l.threshold, p = l.findAllMatches, d = l.minMatchCharLength;
3868
+ return i(e, this.pattern, this.patternAlphabet, {
3869
+ location: u,
3870
+ distance: f,
3871
+ threshold: v,
3872
+ findAllMatches: p,
3873
+ minMatchCharLength: d,
3874
+ includeMatches: n
3875
+ });
3876
+ }
3877
+ }]) && n(t.prototype, r), s && n(t, s), e;
3878
+ }();
3879
+ },
3880
+ function(e, t) {
3881
+ var r = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
3882
+ e.exports = function(e, t) {
3883
+ var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : / +/g, o = new RegExp(t.replace(r, "\\$&").replace(n, "|")), i = e.match(o), a = !!i, s = [];
3884
+ if (a) for (var c = 0, h = i.length; c < h; c += 1) {
3885
+ var l = i[c];
3886
+ s.push([e.indexOf(l), l.length - 1]);
3887
+ }
3888
+ return {
3889
+ score: a ? .5 : 1,
3890
+ isMatch: a,
3891
+ matchedIndices: s
3892
+ };
3893
+ };
3894
+ },
3895
+ function(e, t, r) {
3896
+ var n = r(4), o = r(5);
3897
+ e.exports = function(e, t, r, i) {
3898
+ for (var a = i.location, s = void 0 === a ? 0 : a, c = i.distance, h = void 0 === c ? 100 : c, l = i.threshold, u = void 0 === l ? .6 : l, f = i.findAllMatches, v = void 0 !== f && f, p = i.minMatchCharLength, d = void 0 === p ? 1 : p, g = i.includeMatches, y = void 0 !== g && g, m = s, k = e.length, b = u, S = e.indexOf(t, m), x = t.length, M = [], _ = 0; _ < k; _ += 1) M[_] = 0;
3899
+ if (-1 !== S) {
3900
+ var w = n(t, {
3901
+ errors: 0,
3902
+ currentLocation: S,
3903
+ expectedLocation: m,
3904
+ distance: h
3905
+ });
3906
+ if (b = Math.min(w, b), -1 !== (S = e.lastIndexOf(t, m + x))) {
3907
+ var L = n(t, {
3908
+ errors: 0,
3909
+ currentLocation: S,
3910
+ expectedLocation: m,
3911
+ distance: h
3912
+ });
3913
+ b = Math.min(L, b);
3914
+ }
3915
+ }
3916
+ S = -1;
3917
+ for (var A = [], O = 1, C = x + k, j = 1 << (x <= 31 ? x - 1 : 30), P = 0; P < x; P += 1) {
3918
+ for (var I = 0, F = C; I < F;) n(t, {
3919
+ errors: P,
3920
+ currentLocation: m + F,
3921
+ expectedLocation: m,
3922
+ distance: h
3923
+ }) <= b ? I = F : C = F, F = Math.floor((C - I) / 2 + I);
3924
+ C = F;
3925
+ var T = Math.max(1, m - F + 1), N = v ? k : Math.min(m + F, k) + x, z = Array(N + 2);
3926
+ z[N + 1] = (1 << P) - 1;
3927
+ for (var E = N; E >= T; E -= 1) {
3928
+ var W = E - 1, K = r[e.charAt(W)];
3929
+ if (K && (M[W] = 1), z[E] = (z[E + 1] << 1 | 1) & K, 0 !== P && (z[E] |= (A[E + 1] | A[E]) << 1 | 1 | A[E + 1]), z[E] & j && (O = n(t, {
3930
+ errors: P,
3931
+ currentLocation: W,
3932
+ expectedLocation: m,
3933
+ distance: h
3934
+ })) <= b) {
3935
+ if (b = O, (S = W) <= m) break;
3936
+ T = Math.max(1, 2 * m - S);
3937
+ }
3938
+ }
3939
+ if (n(t, {
3940
+ errors: P + 1,
3941
+ currentLocation: m,
3942
+ expectedLocation: m,
3943
+ distance: h
3944
+ }) > b) break;
3945
+ A = z;
3946
+ }
3947
+ var $ = {
3948
+ isMatch: S >= 0,
3949
+ score: 0 === O ? .001 : O
3950
+ };
3951
+ return y && ($.matchedIndices = o(M, d)), $;
3952
+ };
3953
+ },
3954
+ function(e, t) {
3955
+ e.exports = function(e, t) {
3956
+ var r = t.errors, n = void 0 === r ? 0 : r, o = t.currentLocation, i = void 0 === o ? 0 : o, a = t.expectedLocation, s = void 0 === a ? 0 : a, c = t.distance, h = void 0 === c ? 100 : c, l = n / e.length, u = Math.abs(s - i);
3957
+ return h ? l + u / h : u ? 1 : l;
3958
+ };
3959
+ },
3960
+ function(e, t) {
3961
+ e.exports = function() {
3962
+ for (var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, r = [], n = -1, o = -1, i = 0, a = e.length; i < a; i += 1) {
3963
+ var s = e[i];
3964
+ s && -1 === n ? n = i : s || -1 === n || ((o = i - 1) - n + 1 >= t && r.push([n, o]), n = -1);
3965
+ }
3966
+ return e[i - 1] && i - n >= t && r.push([n, i - 1]), r;
3967
+ };
3968
+ },
3969
+ function(e, t) {
3970
+ e.exports = function(e) {
3971
+ for (var t = {}, r = e.length, n = 0; n < r; n += 1) t[e.charAt(n)] = 0;
3972
+ for (var o = 0; o < r; o += 1) t[e.charAt(o)] |= 1 << r - o - 1;
3973
+ return t;
3974
+ };
3975
+ },
3976
+ function(e, t) {
3977
+ var r = function(e) {
3978
+ return Array.isArray ? Array.isArray(e) : "[object Array]" === Object.prototype.toString.call(e);
3979
+ }, n = function(e) {
3980
+ return null == e ? "" : function(e) {
3981
+ if ("string" == typeof e) return e;
3982
+ var t = e + "";
3983
+ return "0" == t && 1 / e == -1 / 0 ? "-0" : t;
3984
+ }(e);
3985
+ }, o = function(e) {
3986
+ return "string" == typeof e;
3987
+ }, i = function(e) {
3988
+ return "number" == typeof e;
3989
+ };
3990
+ e.exports = {
3991
+ get: function(e, t) {
3992
+ var a = [];
3993
+ return function e(t, s) {
3994
+ if (s) {
3995
+ var c = s.indexOf("."), h = s, l = null;
3996
+ -1 !== c && (h = s.slice(0, c), l = s.slice(c + 1));
3997
+ var u = t[h];
3998
+ if (null != u) if (l || !o(u) && !i(u)) if (r(u)) for (var f = 0, v = u.length; f < v; f += 1) e(u[f], l);
3999
+ else l && e(u, l);
4000
+ else a.push(n(u));
4001
+ } else a.push(t);
4002
+ }(e, t), a;
4003
+ },
4004
+ isArray: r,
4005
+ isString: o,
4006
+ isNum: i,
4007
+ toString: n
4008
+ };
4009
+ }
4010
+ ]);
4011
+ });
4012
+ }));
4013
+ //#endregion
4014
+ export { throttle as a, clsx as c, isEqual as d, require_browser as f, init_throttle as i, init_clsx as l, Downshift as n, debounce$1 as o, init_downshift_esm as r, init_debounce as s, require_fuse as t, init_isEqual as u };