tempest-react-sdk 0.53.0 → 0.55.0

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 (475) hide show
  1. package/README.md +27 -6
  2. package/dist/access/Can.cjs +1 -1
  3. package/dist/access/Can.cjs.map +1 -1
  4. package/dist/access/Can.js +3 -3
  5. package/dist/access/Can.js.map +1 -1
  6. package/dist/audio/level-meter.cjs +1 -1
  7. package/dist/audio/level-meter.cjs.map +1 -1
  8. package/dist/audio/level-meter.js +15 -15
  9. package/dist/audio/level-meter.js.map +1 -1
  10. package/dist/audio/noise-floor.cjs +2 -0
  11. package/dist/audio/noise-floor.cjs.map +1 -0
  12. package/dist/audio/noise-floor.js +27 -0
  13. package/dist/audio/noise-floor.js.map +1 -0
  14. package/dist/audio/voice-activity.cjs +2 -0
  15. package/dist/audio/voice-activity.cjs.map +1 -0
  16. package/dist/audio/voice-activity.js +26 -0
  17. package/dist/audio/voice-activity.js.map +1 -0
  18. package/dist/audio/voice-chain-stages.cjs +2 -0
  19. package/dist/audio/voice-chain-stages.cjs.map +1 -0
  20. package/dist/audio/voice-chain-stages.js +82 -0
  21. package/dist/audio/voice-chain-stages.js.map +1 -0
  22. package/dist/audio/voice-chain.cjs +2 -0
  23. package/dist/audio/voice-chain.cjs.map +1 -0
  24. package/dist/audio/voice-chain.js +74 -0
  25. package/dist/audio/voice-chain.js.map +1 -0
  26. package/dist/auth/lazy-with-retry.cjs.map +1 -1
  27. package/dist/auth/lazy-with-retry.js.map +1 -1
  28. package/dist/auth/passkey.cjs.map +1 -1
  29. package/dist/auth/passkey.js.map +1 -1
  30. package/dist/br/BrazilStateCitySelect.cjs +1 -1
  31. package/dist/br/BrazilStateCitySelect.cjs.map +1 -1
  32. package/dist/br/BrazilStateCitySelect.js +36 -28
  33. package/dist/br/BrazilStateCitySelect.js.map +1 -1
  34. package/dist/br/data/br-centroids.cjs +1 -1
  35. package/dist/br/data/br-centroids.cjs.map +1 -1
  36. package/dist/br/data/br-centroids.js +11105 -11045
  37. package/dist/br/data/br-centroids.js.map +1 -1
  38. package/dist/br/data/br-locations.cjs +1 -1
  39. package/dist/br/data/br-locations.cjs.map +1 -1
  40. package/dist/br/data/br-locations.js +5803 -137
  41. package/dist/br/data/br-locations.js.map +1 -1
  42. package/dist/br/data/br-uf-geo.cjs +1 -1
  43. package/dist/br/data/br-uf-geo.cjs.map +1 -1
  44. package/dist/br/data/br-uf-geo.js +5721 -6777
  45. package/dist/br/data/br-uf-geo.js.map +1 -1
  46. package/dist/br/data/mun/AC.cjs +1 -1
  47. package/dist/br/data/mun/AC.cjs.map +1 -1
  48. package/dist/br/data/mun/AC.js +681 -689
  49. package/dist/br/data/mun/AC.js.map +1 -1
  50. package/dist/br/data/mun/AL.cjs +1 -1
  51. package/dist/br/data/mun/AL.cjs.map +1 -1
  52. package/dist/br/data/mun/AL.js +949 -844
  53. package/dist/br/data/mun/AL.js.map +1 -1
  54. package/dist/br/data/mun/AM.cjs +1 -1
  55. package/dist/br/data/mun/AM.cjs.map +1 -1
  56. package/dist/br/data/mun/AM.js +4337 -4218
  57. package/dist/br/data/mun/AM.js.map +1 -1
  58. package/dist/br/data/mun/AP.cjs +1 -1
  59. package/dist/br/data/mun/AP.cjs.map +1 -1
  60. package/dist/br/data/mun/AP.js +786 -780
  61. package/dist/br/data/mun/AP.js.map +1 -1
  62. package/dist/br/data/mun/BA.cjs +1 -1
  63. package/dist/br/data/mun/BA.cjs.map +1 -1
  64. package/dist/br/data/mun/BA.js +6329 -5633
  65. package/dist/br/data/mun/BA.js.map +1 -1
  66. package/dist/br/data/mun/CE.cjs +1 -1
  67. package/dist/br/data/mun/CE.cjs.map +1 -1
  68. package/dist/br/data/mun/CE.js +2544 -2487
  69. package/dist/br/data/mun/CE.js.map +1 -1
  70. package/dist/br/data/mun/DF.cjs +1 -1
  71. package/dist/br/data/mun/DF.cjs.map +1 -1
  72. package/dist/br/data/mun/DF.js +17 -16
  73. package/dist/br/data/mun/DF.js.map +1 -1
  74. package/dist/br/data/mun/ES.cjs +1 -1
  75. package/dist/br/data/mun/ES.cjs.map +1 -1
  76. package/dist/br/data/mun/ES.js +1101 -1070
  77. package/dist/br/data/mun/ES.js.map +1 -1
  78. package/dist/br/data/mun/GO.cjs +1 -1
  79. package/dist/br/data/mun/GO.cjs.map +1 -1
  80. package/dist/br/data/mun/GO.js +4632 -4636
  81. package/dist/br/data/mun/GO.js.map +1 -1
  82. package/dist/br/data/mun/MA.cjs +1 -1
  83. package/dist/br/data/mun/MA.cjs.map +1 -1
  84. package/dist/br/data/mun/MA.js +3603 -3457
  85. package/dist/br/data/mun/MA.js.map +1 -1
  86. package/dist/br/data/mun/MG.cjs +1 -1
  87. package/dist/br/data/mun/MG.cjs.map +1 -1
  88. package/dist/br/data/mun/MG.js +12716 -11739
  89. package/dist/br/data/mun/MG.js.map +1 -1
  90. package/dist/br/data/mun/MS.cjs +1 -1
  91. package/dist/br/data/mun/MS.cjs.map +1 -1
  92. package/dist/br/data/mun/MS.js +2182 -2335
  93. package/dist/br/data/mun/MS.js.map +1 -1
  94. package/dist/br/data/mun/MT.cjs +1 -1
  95. package/dist/br/data/mun/MT.cjs.map +1 -1
  96. package/dist/br/data/mun/MT.js +4808 -4896
  97. package/dist/br/data/mun/MT.js.map +1 -1
  98. package/dist/br/data/mun/PA.cjs +1 -1
  99. package/dist/br/data/mun/PA.cjs.map +1 -1
  100. package/dist/br/data/mun/PA.js +4981 -4901
  101. package/dist/br/data/mun/PA.js.map +1 -1
  102. package/dist/br/data/mun/PB.cjs +1 -1
  103. package/dist/br/data/mun/PB.cjs.map +1 -1
  104. package/dist/br/data/mun/PB.js +2418 -1956
  105. package/dist/br/data/mun/PB.js.map +1 -1
  106. package/dist/br/data/mun/PE.cjs +1 -1
  107. package/dist/br/data/mun/PE.cjs.map +1 -1
  108. package/dist/br/data/mun/PE.js +2164 -1987
  109. package/dist/br/data/mun/PE.js.map +1 -1
  110. package/dist/br/data/mun/PI.cjs +1 -1
  111. package/dist/br/data/mun/PI.cjs.map +1 -1
  112. package/dist/br/data/mun/PI.js +2982 -2844
  113. package/dist/br/data/mun/PI.js.map +1 -1
  114. package/dist/br/data/mun/PR.cjs +1 -1
  115. package/dist/br/data/mun/PR.cjs.map +1 -1
  116. package/dist/br/data/mun/PR.js +5425 -5240
  117. package/dist/br/data/mun/PR.js.map +1 -1
  118. package/dist/br/data/mun/RJ.cjs +1 -1
  119. package/dist/br/data/mun/RJ.cjs.map +1 -1
  120. package/dist/br/data/mun/RJ.js +1395 -1178
  121. package/dist/br/data/mun/RJ.js.map +1 -1
  122. package/dist/br/data/mun/RN.cjs +1 -1
  123. package/dist/br/data/mun/RN.cjs.map +1 -1
  124. package/dist/br/data/mun/RN.js +1608 -1382
  125. package/dist/br/data/mun/RN.js.map +1 -1
  126. package/dist/br/data/mun/RO.cjs +1 -1
  127. package/dist/br/data/mun/RO.cjs.map +1 -1
  128. package/dist/br/data/mun/RO.js +1392 -1470
  129. package/dist/br/data/mun/RO.js.map +1 -1
  130. package/dist/br/data/mun/RR.cjs +1 -1
  131. package/dist/br/data/mun/RR.cjs.map +1 -1
  132. package/dist/br/data/mun/RR.js +795 -778
  133. package/dist/br/data/mun/RR.js.map +1 -1
  134. package/dist/br/data/mun/RS.cjs +1 -1
  135. package/dist/br/data/mun/RS.cjs.map +1 -1
  136. package/dist/br/data/mun/RS.js +7579 -6424
  137. package/dist/br/data/mun/RS.js.map +1 -1
  138. package/dist/br/data/mun/SC.cjs +1 -1
  139. package/dist/br/data/mun/SC.cjs.map +1 -1
  140. package/dist/br/data/mun/SC.js +3979 -3357
  141. package/dist/br/data/mun/SC.js.map +1 -1
  142. package/dist/br/data/mun/SE.cjs +1 -1
  143. package/dist/br/data/mun/SE.cjs.map +1 -1
  144. package/dist/br/data/mun/SE.js +812 -625
  145. package/dist/br/data/mun/SE.js.map +1 -1
  146. package/dist/br/data/mun/SP.cjs +1 -1
  147. package/dist/br/data/mun/SP.cjs.map +1 -1
  148. package/dist/br/data/mun/SP.js +7866 -6803
  149. package/dist/br/data/mun/SP.js.map +1 -1
  150. package/dist/br/data/mun/TO.cjs +1 -1
  151. package/dist/br/data/mun/TO.cjs.map +1 -1
  152. package/dist/br/data/mun/TO.js +2763 -2817
  153. package/dist/br/data/mun/TO.js.map +1 -1
  154. package/dist/br/locations.cjs +1 -1
  155. package/dist/br/locations.cjs.map +1 -1
  156. package/dist/br/locations.js +97 -24
  157. package/dist/br/locations.js.map +1 -1
  158. package/dist/br/scales.cjs +1 -1
  159. package/dist/br/scales.cjs.map +1 -1
  160. package/dist/br/scales.js +8 -4
  161. package/dist/br/scales.js.map +1 -1
  162. package/dist/br/whatsapp.cjs +2 -0
  163. package/dist/br/whatsapp.cjs.map +1 -0
  164. package/dist/br/whatsapp.js +21 -0
  165. package/dist/br/whatsapp.js.map +1 -0
  166. package/dist/br.cjs +1 -1
  167. package/dist/br.cjs.map +1 -1
  168. package/dist/br.d.ts +188 -10
  169. package/dist/br.js +18 -17
  170. package/dist/br.js.map +1 -1
  171. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  172. package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
  173. package/dist/components/BottomSheet/BottomSheet.js +30 -27
  174. package/dist/components/BottomSheet/BottomSheet.js.map +1 -1
  175. package/dist/components/Command/Command.cjs +1 -1
  176. package/dist/components/Command/Command.cjs.map +1 -1
  177. package/dist/components/Command/Command.js +78 -75
  178. package/dist/components/Command/Command.js.map +1 -1
  179. package/dist/components/Drawer/Drawer.cjs +1 -1
  180. package/dist/components/Drawer/Drawer.cjs.map +1 -1
  181. package/dist/components/Drawer/Drawer.js +42 -39
  182. package/dist/components/Drawer/Drawer.js.map +1 -1
  183. package/dist/components/DropdownMenu/DropdownMenu.cjs +1 -1
  184. package/dist/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
  185. package/dist/components/DropdownMenu/DropdownMenu.js +111 -67
  186. package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
  187. package/dist/components/Modal/Modal.cjs +1 -1
  188. package/dist/components/Modal/Modal.cjs.map +1 -1
  189. package/dist/components/Modal/Modal.js +45 -42
  190. package/dist/components/Modal/Modal.js.map +1 -1
  191. package/dist/components/Money/Money.cjs +1 -1
  192. package/dist/components/Money/Money.cjs.map +1 -1
  193. package/dist/components/Money/Money.js +10 -9
  194. package/dist/components/Money/Money.js.map +1 -1
  195. package/dist/components/Pagination/Pagination.cjs +1 -1
  196. package/dist/components/Pagination/Pagination.cjs.map +1 -1
  197. package/dist/components/Pagination/Pagination.js +38 -31
  198. package/dist/components/Pagination/Pagination.js.map +1 -1
  199. package/dist/components/Pagination/Pagination.module.cjs +1 -1
  200. package/dist/components/Pagination/Pagination.module.cjs.map +1 -1
  201. package/dist/components/Pagination/Pagination.module.js +4 -4
  202. package/dist/components/Pagination/Pagination.module.js.map +1 -1
  203. package/dist/components/Portal/Portal.cjs +1 -1
  204. package/dist/components/Portal/Portal.cjs.map +1 -1
  205. package/dist/components/Portal/Portal.js +9 -6
  206. package/dist/components/Portal/Portal.js.map +1 -1
  207. package/dist/components/Portal/portal-host.cjs +2 -0
  208. package/dist/components/Portal/portal-host.cjs.map +1 -0
  209. package/dist/components/Portal/portal-host.js +11 -0
  210. package/dist/components/Portal/portal-host.js.map +1 -0
  211. package/dist/components/Scheduler/Scheduler.cjs +1 -1
  212. package/dist/components/Scheduler/Scheduler.cjs.map +1 -1
  213. package/dist/components/Scheduler/Scheduler.js +83 -82
  214. package/dist/components/Scheduler/Scheduler.js.map +1 -1
  215. package/dist/components/Toast/ToastProvider.cjs +1 -1
  216. package/dist/components/Toast/ToastProvider.cjs.map +1 -1
  217. package/dist/components/Toast/ToastProvider.js +55 -53
  218. package/dist/components/Toast/ToastProvider.js.map +1 -1
  219. package/dist/components/VirtualList/VirtualList.cjs +1 -1
  220. package/dist/components/VirtualList/VirtualList.cjs.map +1 -1
  221. package/dist/components/VirtualList/VirtualList.js +41 -31
  222. package/dist/components/VirtualList/VirtualList.js.map +1 -1
  223. package/dist/components/VirtualTable/VirtualTable.cjs +1 -1
  224. package/dist/components/VirtualTable/VirtualTable.cjs.map +1 -1
  225. package/dist/components/VirtualTable/VirtualTable.js +78 -68
  226. package/dist/components/VirtualTable/VirtualTable.js.map +1 -1
  227. package/dist/forms/masked-inputs.cjs +1 -1
  228. package/dist/forms/masked-inputs.cjs.map +1 -1
  229. package/dist/forms/masked-inputs.js +20 -19
  230. package/dist/forms/masked-inputs.js.map +1 -1
  231. package/dist/hooks/use-fullscreen-element.cjs +2 -0
  232. package/dist/hooks/use-fullscreen-element.cjs.map +1 -0
  233. package/dist/hooks/use-fullscreen-element.js +20 -0
  234. package/dist/hooks/use-fullscreen-element.js.map +1 -0
  235. package/dist/hooks/use-fullscreen.cjs +2 -0
  236. package/dist/hooks/use-fullscreen.cjs.map +1 -0
  237. package/dist/hooks/use-fullscreen.js +66 -0
  238. package/dist/hooks/use-fullscreen.js.map +1 -0
  239. package/dist/hooks/use-push-to-talk.cjs +2 -0
  240. package/dist/hooks/use-push-to-talk.cjs.map +1 -0
  241. package/dist/hooks/use-push-to-talk.js +61 -0
  242. package/dist/hooks/use-push-to-talk.js.map +1 -0
  243. package/dist/http/describe-api-error.cjs.map +1 -1
  244. package/dist/http/describe-api-error.js.map +1 -1
  245. package/dist/http/errors.cjs +1 -1
  246. package/dist/http/errors.cjs.map +1 -1
  247. package/dist/http/errors.js +34 -16
  248. package/dist/http/errors.js.map +1 -1
  249. package/dist/http/parse-response.cjs +2 -2
  250. package/dist/http/parse-response.cjs.map +1 -1
  251. package/dist/http/parse-response.js +9 -8
  252. package/dist/http/parse-response.js.map +1 -1
  253. package/dist/i18n/create-i18n.cjs +1 -1
  254. package/dist/i18n/create-i18n.cjs.map +1 -1
  255. package/dist/i18n/create-i18n.js +28 -27
  256. package/dist/i18n/create-i18n.js.map +1 -1
  257. package/dist/router/AppRouter.cjs +1 -1
  258. package/dist/router/AppRouter.cjs.map +1 -1
  259. package/dist/router/AppRouter.js +28 -21
  260. package/dist/router/AppRouter.js.map +1 -1
  261. package/dist/router/RouteGuard.cjs +1 -1
  262. package/dist/router/RouteGuard.cjs.map +1 -1
  263. package/dist/router/RouteGuard.js +4 -4
  264. package/dist/router/RouteGuard.js.map +1 -1
  265. package/dist/sse/create-event-stream.cjs +1 -1
  266. package/dist/sse/create-event-stream.cjs.map +1 -1
  267. package/dist/sse/create-event-stream.js +34 -38
  268. package/dist/sse/create-event-stream.js.map +1 -1
  269. package/dist/styles/AIChat.css +79 -0
  270. package/dist/styles/Accordion.css +12 -0
  271. package/dist/styles/Alert.css +32 -0
  272. package/dist/styles/AppBar.css +17 -0
  273. package/dist/styles/AppShell.css +8 -0
  274. package/dist/styles/AspectRatio.css +3 -0
  275. package/dist/styles/AudioPlayer.css +13 -0
  276. package/dist/styles/AudioRecorder.css +20 -0
  277. package/dist/styles/Avatar.css +13 -0
  278. package/dist/styles/AvatarGroup.css +18 -0
  279. package/dist/styles/Badge.css +25 -0
  280. package/dist/styles/Banner.css +13 -0
  281. package/dist/styles/BarList.css +10 -0
  282. package/dist/styles/BarcodeScanner.css +21 -0
  283. package/dist/styles/BottomNavigation.css +10 -0
  284. package/dist/styles/BottomSheet.css +11 -0
  285. package/dist/styles/BrazilMap.css +20 -0
  286. package/dist/styles/Breadcrumbs.css +8 -0
  287. package/dist/styles/Button.css +42 -0
  288. package/dist/styles/Calendar.css +16 -0
  289. package/dist/styles/Card.css +15 -0
  290. package/dist/styles/Carousel.css +17 -0
  291. package/dist/styles/Center.css +5 -0
  292. package/dist/styles/Chat.css +35 -0
  293. package/dist/styles/Checkbox.css +11 -0
  294. package/dist/styles/ChipInput.css +13 -0
  295. package/dist/styles/CodeBlock.css +25 -0
  296. package/dist/styles/Collapsible.css +6 -0
  297. package/dist/styles/Combobox.css +18 -0
  298. package/dist/styles/Command.css +20 -0
  299. package/dist/styles/ContextMenu.css +11 -0
  300. package/dist/styles/CopyButton.css +4 -0
  301. package/dist/styles/DataList.css +3 -0
  302. package/dist/styles/DataTable.css +19 -0
  303. package/dist/styles/DateRangePicker.css +22 -0
  304. package/dist/styles/DescriptionList.css +4 -0
  305. package/dist/styles/Divider.css +11 -0
  306. package/dist/styles/Drawer.css +22 -0
  307. package/dist/styles/DropdownMenu.css +16 -0
  308. package/dist/styles/Dropzone.css +7 -0
  309. package/dist/styles/EmptyState.css +6 -0
  310. package/dist/styles/ErrorState.css +6 -0
  311. package/dist/styles/ErrorText.css +2 -0
  312. package/dist/styles/FileUpload.css +17 -0
  313. package/dist/styles/FilterBar.css +19 -0
  314. package/dist/styles/FloatingActionButton.css +23 -0
  315. package/dist/styles/Form.css +21 -0
  316. package/dist/styles/HoverCard.css +11 -0
  317. package/dist/styles/IconPicker.css +6 -0
  318. package/dist/styles/Image.css +2 -0
  319. package/dist/styles/ImageCropper.css +16 -0
  320. package/dist/styles/Input.css +24 -0
  321. package/dist/styles/InstallBanner.css +8 -0
  322. package/dist/styles/Kanban.css +15 -0
  323. package/dist/styles/Kbd.css +5 -0
  324. package/dist/styles/Label.css +3 -0
  325. package/dist/styles/Layout.css +22 -0
  326. package/dist/styles/Lightbox.css +21 -0
  327. package/dist/styles/ListTile.css +14 -0
  328. package/dist/styles/MapLegend.css +9 -0
  329. package/dist/styles/Markdown.css +24 -0
  330. package/dist/styles/Masonry.css +4 -0
  331. package/dist/styles/Menubar.css +17 -0
  332. package/dist/styles/Modal.css +21 -0
  333. package/dist/styles/ModalsManager.css +2 -0
  334. package/dist/styles/MultiSelect.css +21 -0
  335. package/dist/styles/MunicipalitySearch.css +6 -0
  336. package/dist/styles/NProgress.css +2 -0
  337. package/dist/styles/Navbar.css +10 -0
  338. package/dist/styles/NavigationMenu.css +12 -0
  339. package/dist/styles/NavigationRail.css +14 -0
  340. package/dist/styles/NotificationCenter.css +21 -0
  341. package/dist/styles/OfflineIndicator.css +7 -0
  342. package/dist/styles/Page.css +13 -0
  343. package/dist/styles/Pagination.css +12 -0
  344. package/dist/styles/PasswordInput.css +21 -0
  345. package/dist/styles/PinInput.css +13 -0
  346. package/dist/styles/PixQRCode.css +9 -0
  347. package/dist/styles/Popover.css +10 -0
  348. package/dist/styles/Progress.css +11 -0
  349. package/dist/styles/QRCode.css +3 -0
  350. package/dist/styles/Radio.css +14 -0
  351. package/dist/styles/RangeSlider.css +15 -0
  352. package/dist/styles/RatingStars.css +11 -0
  353. package/dist/styles/RefreshIndicator.css +5 -0
  354. package/dist/styles/Resizable.css +13 -0
  355. package/dist/styles/RichTextEditor.css +19 -0
  356. package/dist/styles/SafeArea.css +7 -0
  357. package/dist/styles/Scheduler.css +24 -0
  358. package/dist/styles/ScrollArea.css +7 -0
  359. package/dist/styles/SearchBar.css +11 -0
  360. package/dist/styles/SegmentedControl.css +12 -0
  361. package/dist/styles/Select.css +14 -0
  362. package/dist/styles/Sidebar.css +19 -0
  363. package/dist/styles/SignaturePad.css +6 -0
  364. package/dist/styles/Skeleton.css +7 -0
  365. package/dist/styles/Slider.css +15 -0
  366. package/dist/styles/Spacer.css +4 -0
  367. package/dist/styles/Sparkline.css +4 -0
  368. package/dist/styles/Spinner.css +12 -0
  369. package/dist/styles/Stat.css +12 -0
  370. package/dist/styles/Stepper.css +17 -0
  371. package/dist/styles/StepperInput.css +15 -0
  372. package/dist/styles/Switch.css +11 -0
  373. package/dist/styles/SyncStatusBadge.css +13 -0
  374. package/dist/styles/Table.css +16 -0
  375. package/dist/styles/Tabs.css +14 -0
  376. package/dist/styles/Tag.css +14 -0
  377. package/dist/styles/Textarea.css +13 -0
  378. package/dist/styles/TimePicker.css +14 -0
  379. package/dist/styles/Timeline.css +17 -0
  380. package/dist/styles/Toast.css +21 -0
  381. package/dist/styles/Toggle.css +12 -0
  382. package/dist/styles/ToggleGroup.css +9 -0
  383. package/dist/styles/Tooltip.css +10 -0
  384. package/dist/styles/Tour.css +20 -0
  385. package/dist/styles/TrajectoryMap.css +16 -0
  386. package/dist/styles/Transfer.css +21 -0
  387. package/dist/styles/TreeView.css +17 -0
  388. package/dist/styles/TruncateText.css +2 -0
  389. package/dist/styles/UpdatePrompt.css +10 -0
  390. package/dist/styles/VirtualList.css +5 -0
  391. package/dist/styles/VirtualTable.css +17 -0
  392. package/dist/styles/VisuallyHidden.css +2 -0
  393. package/dist/styles/Wizard.css +4 -0
  394. package/dist/styles/actions.css +104 -0
  395. package/dist/styles/advanced.css +66 -0
  396. package/dist/styles/br.css +41 -0
  397. package/dist/styles/chat.css +113 -0
  398. package/dist/styles/core.css +40 -0
  399. package/dist/styles/data.css +222 -0
  400. package/dist/styles/editor.css +19 -0
  401. package/dist/styles/feedback.css +201 -0
  402. package/dist/styles/forms.css +321 -0
  403. package/dist/styles/geo.css +16 -0
  404. package/dist/styles/icons.css +6 -0
  405. package/dist/styles/identity.css +48 -0
  406. package/dist/styles/layout.css +122 -0
  407. package/dist/styles/media.css +52 -0
  408. package/dist/styles/navigation.css +167 -0
  409. package/dist/styles/overlay.css +73 -0
  410. package/dist/styles/utility.css +39 -0
  411. package/dist/styles.css +1 -1
  412. package/dist/sw/register-service-worker.cjs +1 -1
  413. package/dist/sw/register-service-worker.cjs.map +1 -1
  414. package/dist/sw/register-service-worker.js +21 -17
  415. package/dist/sw/register-service-worker.js.map +1 -1
  416. package/dist/sw.d.ts +17 -1
  417. package/dist/tempest-react-sdk.cjs +1 -1
  418. package/dist/tempest-react-sdk.d.ts +1151 -41
  419. package/dist/tempest-react-sdk.js +295 -286
  420. package/dist/utils/dev-mode.cjs.map +1 -1
  421. package/dist/utils/dev-mode.js.map +1 -1
  422. package/dist/utils/format.cjs +1 -1
  423. package/dist/utils/format.cjs.map +1 -1
  424. package/dist/utils/format.js +22 -14
  425. package/dist/utils/format.js.map +1 -1
  426. package/dist/utils/intl-cache.cjs +2 -0
  427. package/dist/utils/intl-cache.cjs.map +1 -0
  428. package/dist/utils/intl-cache.js +23 -0
  429. package/dist/utils/intl-cache.js.map +1 -0
  430. package/dist/utils/json-frame.cjs +2 -0
  431. package/dist/utils/json-frame.cjs.map +1 -0
  432. package/dist/utils/json-frame.js +30 -0
  433. package/dist/utils/json-frame.js.map +1 -0
  434. package/dist/utils/numbers.cjs +1 -1
  435. package/dist/utils/numbers.cjs.map +1 -1
  436. package/dist/utils/numbers.js +8 -7
  437. package/dist/utils/numbers.js.map +1 -1
  438. package/dist/vision/results.cjs +1 -1
  439. package/dist/vision/results.cjs.map +1 -1
  440. package/dist/vision/results.js +26 -17
  441. package/dist/vision/results.js.map +1 -1
  442. package/dist/vision.d.ts +29 -0
  443. package/dist/vite/tempest-icons.cjs +1 -1
  444. package/dist/vite/tempest-icons.cjs.map +1 -1
  445. package/dist/vite/tempest-icons.js +1 -1
  446. package/dist/vite/tempest-icons.js.map +1 -1
  447. package/dist/webrtc/link-stats.cjs +2 -0
  448. package/dist/webrtc/link-stats.cjs.map +1 -0
  449. package/dist/webrtc/link-stats.js +74 -0
  450. package/dist/webrtc/link-stats.js.map +1 -0
  451. package/dist/webrtc/mesh-quality.cjs +2 -0
  452. package/dist/webrtc/mesh-quality.cjs.map +1 -0
  453. package/dist/webrtc/mesh-quality.js +51 -0
  454. package/dist/webrtc/mesh-quality.js.map +1 -0
  455. package/dist/webrtc/peer-link.cjs +2 -0
  456. package/dist/webrtc/peer-link.cjs.map +1 -0
  457. package/dist/webrtc/peer-link.js +45 -0
  458. package/dist/webrtc/peer-link.js.map +1 -0
  459. package/dist/webrtc/peer-mesh.cjs +2 -0
  460. package/dist/webrtc/peer-mesh.cjs.map +1 -0
  461. package/dist/webrtc/peer-mesh.js +155 -0
  462. package/dist/webrtc/peer-mesh.js.map +1 -0
  463. package/dist/webrtc/use-link-stats.cjs +2 -0
  464. package/dist/webrtc/use-link-stats.cjs.map +1 -0
  465. package/dist/webrtc/use-link-stats.js +22 -0
  466. package/dist/webrtc/use-link-stats.js.map +1 -0
  467. package/dist/ws/create-web-socket.cjs +1 -1
  468. package/dist/ws/create-web-socket.cjs.map +1 -1
  469. package/dist/ws/create-web-socket.js +81 -85
  470. package/dist/ws/create-web-socket.js.map +1 -1
  471. package/dist/ws/use-web-socket.cjs +1 -1
  472. package/dist/ws/use-web-socket.cjs.map +1 -1
  473. package/dist/ws/use-web-socket.js +42 -48
  474. package/dist/ws/use-web-socket.js.map +1 -1
  475. package/package.json +5 -2
@@ -28,52 +28,125 @@ var t = {
28
28
  PR: "Sul",
29
29
  RS: "Sul",
30
30
  SC: "Sul"
31
- }, n = e.dataLocals.map((e) => {
32
- let n = e.sigla;
31
+ }, n = e;
32
+ function r(e) {
33
+ return e.trim().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/['\u2019\u0060]/g, "").toLowerCase();
34
+ }
35
+ var i = {
36
+ 11: "RO",
37
+ 12: "AC",
38
+ 13: "AM",
39
+ 14: "RR",
40
+ 15: "PA",
41
+ 16: "AP",
42
+ 17: "TO",
43
+ 21: "MA",
44
+ 22: "PI",
45
+ 23: "CE",
46
+ 24: "RN",
47
+ 25: "PB",
48
+ 26: "PE",
49
+ 27: "AL",
50
+ 28: "SE",
51
+ 29: "BA",
52
+ 31: "MG",
53
+ 32: "ES",
54
+ 33: "RJ",
55
+ 35: "SP",
56
+ 41: "PR",
57
+ 42: "SC",
58
+ 43: "RS",
59
+ 50: "MS",
60
+ 51: "MT",
61
+ 52: "GO",
62
+ 53: "DF"
63
+ };
64
+ function a(e) {
65
+ return e.slice(0, 7);
66
+ }
67
+ function o(e) {
68
+ return (n.administrativeRegions[e] ?? []).map(([t, n]) => ({
69
+ id: t,
70
+ name: n,
71
+ municipalityId: e
72
+ }));
73
+ }
74
+ var s = n.states.map((e) => {
75
+ let n = e.uf, r = e.cities.map(([e, t]) => ({
76
+ id: e,
77
+ name: t
78
+ }));
33
79
  return {
34
80
  uf: n,
35
- name: e.estado,
81
+ name: e.name,
36
82
  region: t[n],
37
- cities: e.cidades
83
+ cities: r.map((e) => e.name),
84
+ municipalities: r,
85
+ administrativeRegions: r.flatMap((e) => o(e.id))
38
86
  };
39
- }).sort((e, t) => e.name.localeCompare(t.name, "pt-BR")), r = new Map(n.map((e) => [e.uf, e]));
40
- function i() {
41
- return n;
87
+ }).sort((e, t) => e.name.localeCompare(t.name, "pt-BR")), c = new Map(s.map((e) => [e.uf, e])), l = /* @__PURE__ */ new Map();
88
+ for (let [e, t] of n.aliases) {
89
+ let n = i[t.slice(0, 2)];
90
+ n !== void 0 && l.set(`${n}:${r(e)}`, a(t));
42
91
  }
43
- function a(e) {
44
- let t = l(e);
45
- return t ? r.get(t) ?? null : null;
92
+ for (let e of s) for (let t of e.administrativeRegions) l.set(`${e.uf}:${r(t.name)}`, t.municipalityId);
93
+ for (let e of s) for (let t of e.municipalities) l.set(`${e.uf}:${r(t.name)}`, t.id);
94
+ var u = new Map(s.flatMap((e) => e.municipalities).map((e) => [e.id, e]));
95
+ function d() {
96
+ return s;
46
97
  }
47
- function o(e) {
48
- return a(e)?.cities ?? [];
98
+ function f(e) {
99
+ let t = g(e);
100
+ return t ? c.get(t) ?? null : null;
101
+ }
102
+ function p(e) {
103
+ return f(e)?.cities ?? [];
49
104
  }
50
- function s(e) {
51
- return n.filter((t) => t.region === e);
105
+ function m(e) {
106
+ return s.filter((t) => t.region === e);
52
107
  }
53
- function c(e) {
54
- return l(e) !== null;
108
+ function h(e) {
109
+ return g(e) !== null;
55
110
  }
56
- function l(e) {
111
+ function g(e) {
57
112
  let n = e.trim().toUpperCase();
58
113
  return t[n] ? n : null;
59
114
  }
60
- function u(e, t) {
115
+ function _(e, t) {
61
116
  let n = t.trim().toLowerCase();
62
- return o(e).some((e) => e.toLowerCase() === n);
117
+ return p(e).some((e) => e.toLowerCase() === n);
63
118
  }
64
- function d() {
65
- return n.map((e) => ({
119
+ function v() {
120
+ return s.map((e) => ({
66
121
  value: e.uf,
67
122
  label: e.name
68
123
  }));
69
124
  }
70
- function f(e) {
71
- return o(e).map((e) => ({
125
+ function y(e) {
126
+ return p(e).map((e) => ({
72
127
  value: e,
73
128
  label: e
74
129
  }));
75
130
  }
131
+ function b(e) {
132
+ return f(e)?.municipalities ?? [];
133
+ }
134
+ function x(e) {
135
+ return f(e)?.administrativeRegions ?? [];
136
+ }
137
+ function S(e, t) {
138
+ let n = g(e);
139
+ if (n === null) return null;
140
+ let i = l.get(`${n}:${r(t)}`);
141
+ return i === void 0 ? null : u.get(i) ?? null;
142
+ }
143
+ function C() {
144
+ return n.vintage;
145
+ }
146
+ function w() {
147
+ return n.pendingGeometry;
148
+ }
76
149
  //#endregion
77
- export { o as citiesByUf, f as cityChoices, a as getState, u as isValidCity, c as isValidUf, i as listStates, l as normalizeUf, s as statesByRegion, d as ufChoices };
150
+ export { x as administrativeRegionsByUf, p as citiesByUf, y as cityChoices, C as datasetVintage, f as getState, _ as isValidCity, h as isValidUf, d as listStates, b as municipalitiesByUf, g as normalizeUf, w as pendingGeometryIds, S as resolveMunicipality, m as statesByRegion, v as ufChoices };
78
151
 
79
152
  //# sourceMappingURL=locations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"locations.js","names":[],"sources":["../../src/br/locations.ts"],"sourcesContent":["import rawLocations from \"./data/br-locations.json\";\n\n/** The 27 Brazilian federative units (26 states + Federal District). */\nexport type UF =\n | \"AC\"\n | \"AL\"\n | \"AP\"\n | \"AM\"\n | \"BA\"\n | \"CE\"\n | \"DF\"\n | \"ES\"\n | \"GO\"\n | \"MA\"\n | \"MT\"\n | \"MS\"\n | \"MG\"\n | \"PA\"\n | \"PB\"\n | \"PR\"\n | \"PE\"\n | \"PI\"\n | \"RJ\"\n | \"RN\"\n | \"RS\"\n | \"RO\"\n | \"RR\"\n | \"SC\"\n | \"SP\"\n | \"SE\"\n | \"TO\";\n\n/** The five Brazilian macro-regions (IBGE). */\nexport type BrRegion = \"Norte\" | \"Nordeste\" | \"Centro-Oeste\" | \"Sudeste\" | \"Sul\";\n\n/** A federative unit with its display name and city list. */\nexport interface BrazilState {\n /** Two-letter acronym, e.g. `\"SP\"`. */\n uf: UF;\n /** Full name, e.g. `\"São Paulo\"`. */\n name: string;\n /** Macro-region the state belongs to. */\n region: BrRegion;\n /** City names within the state, alphabetically. */\n cities: string[];\n}\n\n/** A `{ value, label }` option, handy for `<Select>` / `<Combobox>`. */\nexport interface Choice {\n value: string;\n label: string;\n}\n\n/** IBGE macro-region of each federative unit. */\nconst REGION_BY_UF: Record<UF, BrRegion> = {\n AC: \"Norte\",\n AP: \"Norte\",\n AM: \"Norte\",\n PA: \"Norte\",\n RO: \"Norte\",\n RR: \"Norte\",\n TO: \"Norte\",\n AL: \"Nordeste\",\n BA: \"Nordeste\",\n CE: \"Nordeste\",\n MA: \"Nordeste\",\n PB: \"Nordeste\",\n PE: \"Nordeste\",\n PI: \"Nordeste\",\n RN: \"Nordeste\",\n SE: \"Nordeste\",\n DF: \"Centro-Oeste\",\n GO: \"Centro-Oeste\",\n MT: \"Centro-Oeste\",\n MS: \"Centro-Oeste\",\n ES: \"Sudeste\",\n MG: \"Sudeste\",\n RJ: \"Sudeste\",\n SP: \"Sudeste\",\n PR: \"Sul\",\n RS: \"Sul\",\n SC: \"Sul\",\n};\n\ninterface RawState {\n sigla: string;\n estado: string;\n cidades: string[];\n}\n\nconst RAW = rawLocations as unknown as { dataLocals: RawState[] };\n\n/** Normalized, frozen list of all 27 states (built once at module load). */\nconst STATES: readonly BrazilState[] = RAW.dataLocals\n .map((entry) => {\n const uf = entry.sigla as UF;\n return {\n uf,\n name: entry.estado,\n region: REGION_BY_UF[uf],\n cities: entry.cidades,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name, \"pt-BR\"));\n\nconst STATE_BY_UF = new Map<UF, BrazilState>(STATES.map((s) => [s.uf, s]));\n\n/** All 27 federative units, sorted by name. */\nexport function listStates(): readonly BrazilState[] {\n return STATES;\n}\n\n/** Look up a single state by acronym (case-insensitive). Returns `null` if unknown. */\nexport function getState(uf: string): BrazilState | null {\n const normalized = normalizeUf(uf);\n return normalized ? (STATE_BY_UF.get(normalized) ?? null) : null;\n}\n\n/**\n * City names for a federative unit (case-insensitive acronym). Returns an empty\n * array for an unknown UF — \"no matches\" is a valid result, not an error.\n */\nexport function citiesByUf(uf: string): string[] {\n return getState(uf)?.cities ?? [];\n}\n\n/** States belonging to a macro-region. */\nexport function statesByRegion(region: BrRegion): readonly BrazilState[] {\n return STATES.filter((s) => s.region === region);\n}\n\n/** True when `value` is one of the 27 valid acronyms (case-insensitive). */\nexport function isValidUf(value: string): boolean {\n return normalizeUf(value) !== null;\n}\n\n/**\n * Normalize an acronym to canonical uppercase form, or `null` if it is not a\n * valid UF. `\"sp\"` → `\"SP\"`, `\"xx\"` → `null`.\n */\nexport function normalizeUf(value: string): UF | null {\n const upper = value.trim().toUpperCase();\n return (REGION_BY_UF as Record<string, BrRegion>)[upper] ? (upper as UF) : null;\n}\n\n/** True when `city` exists within `uf` (both case-insensitive). */\nexport function isValidCity(uf: string, city: string): boolean {\n const target = city.trim().toLowerCase();\n return citiesByUf(uf).some((c) => c.toLowerCase() === target);\n}\n\n/** `{ value: uf, label: name }` options for every state, for a `<Select>`. */\nexport function ufChoices(): Choice[] {\n return STATES.map((s) => ({ value: s.uf, label: s.name }));\n}\n\n/** `{ value, label }` options for every city in a UF (value === label). */\nexport function cityChoices(uf: string): Choice[] {\n return citiesByUf(uf).map((c) => ({ value: c, label: c }));\n}\n"],"mappings":";;AAsDA,IAAM,IAAqC;CACvC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACR,GAWM,IAAiC,EAAI,WACtC,KAAK,MAAU;CACZ,IAAM,IAAK,EAAM;CACjB,OAAO;EACH;EACA,MAAM,EAAM;EACZ,QAAQ,EAAa;EACrB,QAAQ,EAAM;CAClB;AACJ,CAAC,CAAC,CACD,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC,GAEnD,IAAc,IAAI,IAAqB,EAAO,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAGzE,SAAgB,IAAqC;CACjD,OAAO;AACX;AAGA,SAAgB,EAAS,GAAgC;CACrD,IAAM,IAAa,EAAY,CAAE;CACjC,OAAO,IAAc,EAAY,IAAI,CAAU,KAAK,OAAQ;AAChE;AAMA,SAAgB,EAAW,GAAsB;CAC7C,OAAO,EAAS,CAAE,CAAC,EAAE,UAAU,CAAC;AACpC;AAGA,SAAgB,EAAe,GAA0C;CACrE,OAAO,EAAO,QAAQ,MAAM,EAAE,WAAW,CAAM;AACnD;AAGA,SAAgB,EAAU,GAAwB;CAC9C,OAAO,EAAY,CAAK,MAAM;AAClC;AAMA,SAAgB,EAAY,GAA0B;CAClD,IAAM,IAAQ,EAAM,KAAK,CAAC,CAAC,YAAY;CACvC,OAAQ,EAA0C,KAAU,IAAe;AAC/E;AAGA,SAAgB,EAAY,GAAY,GAAuB;CAC3D,IAAM,IAAS,EAAK,KAAK,CAAC,CAAC,YAAY;CACvC,OAAO,EAAW,CAAE,CAAC,CAAC,MAAM,MAAM,EAAE,YAAY,MAAM,CAAM;AAChE;AAGA,SAAgB,IAAsB;CAClC,OAAO,EAAO,KAAK,OAAO;EAAE,OAAO,EAAE;EAAI,OAAO,EAAE;CAAK,EAAE;AAC7D;AAGA,SAAgB,EAAY,GAAsB;CAC9C,OAAO,EAAW,CAAE,CAAC,CAAC,KAAK,OAAO;EAAE,OAAO;EAAG,OAAO;CAAE,EAAE;AAC7D"}
1
+ {"version":3,"file":"locations.js","names":[],"sources":["../../src/br/locations.ts"],"sourcesContent":["import rawLocations from \"./data/br-locations.json\";\n\n/** The 27 Brazilian federative units (26 states + Federal District). */\nexport type UF =\n | \"AC\"\n | \"AL\"\n | \"AP\"\n | \"AM\"\n | \"BA\"\n | \"CE\"\n | \"DF\"\n | \"ES\"\n | \"GO\"\n | \"MA\"\n | \"MT\"\n | \"MS\"\n | \"MG\"\n | \"PA\"\n | \"PB\"\n | \"PR\"\n | \"PE\"\n | \"PI\"\n | \"RJ\"\n | \"RN\"\n | \"RS\"\n | \"RO\"\n | \"RR\"\n | \"SC\"\n | \"SP\"\n | \"SE\"\n | \"TO\";\n\n/** The five Brazilian macro-regions (IBGE). */\nexport type BrRegion = \"Norte\" | \"Nordeste\" | \"Centro-Oeste\" | \"Sudeste\" | \"Sul\";\n\n/** A municipality, identified by the code that survives its renames. */\nexport interface BrazilMunicipality {\n /** 7-digit IBGE code, e.g. `\"3550308\"`. Stable across a rename. */\n id: string;\n /** Current IBGE name, e.g. `\"São Paulo\"`. */\n name: string;\n}\n\n/**\n * An administrative region of the Federal District.\n *\n * The DF has exactly one municipality — Brasília — and 35 administrative\n * regions inside it. Nobody in the DF writes \"Brasília\" in an address field,\n * so the regions are listed and resolvable; they are not municipalities, and\n * `municipalityId` is what they geocode through.\n */\nexport interface BrazilAdministrativeRegion {\n /** IBGE subdistrict code, e.g. `\"53001080515\"` for Ceilândia. */\n id: string;\n /** IBGE name, e.g. `\"Sudoeste/Octogonal\"`. */\n name: string;\n /** The municipality it belongs to — Brasília (`\"5300108\"`) for all 35. */\n municipalityId: string;\n}\n\n/** A federative unit with its display name and city list. */\nexport interface BrazilState {\n /** Two-letter acronym, e.g. `\"SP\"`. */\n uf: UF;\n /** Full name, e.g. `\"São Paulo\"`. */\n name: string;\n /** Macro-region the state belongs to. */\n region: BrRegion;\n /** Municipality names within the state, alphabetically. */\n cities: string[];\n /** The same municipalities carrying their IBGE codes, same order. */\n municipalities: readonly BrazilMunicipality[];\n /** Administrative regions — 35 for `\"DF\"`, empty everywhere else. */\n administrativeRegions: readonly BrazilAdministrativeRegion[];\n}\n\n/** A `{ value, label }` option, handy for `<Select>` / `<Combobox>`. */\nexport interface Choice {\n value: string;\n label: string;\n}\n\n/** IBGE macro-region of each federative unit. */\nconst REGION_BY_UF: Record<UF, BrRegion> = {\n AC: \"Norte\",\n AP: \"Norte\",\n AM: \"Norte\",\n PA: \"Norte\",\n RO: \"Norte\",\n RR: \"Norte\",\n TO: \"Norte\",\n AL: \"Nordeste\",\n BA: \"Nordeste\",\n CE: \"Nordeste\",\n MA: \"Nordeste\",\n PB: \"Nordeste\",\n PE: \"Nordeste\",\n PI: \"Nordeste\",\n RN: \"Nordeste\",\n SE: \"Nordeste\",\n DF: \"Centro-Oeste\",\n GO: \"Centro-Oeste\",\n MT: \"Centro-Oeste\",\n MS: \"Centro-Oeste\",\n ES: \"Sudeste\",\n MG: \"Sudeste\",\n RJ: \"Sudeste\",\n SP: \"Sudeste\",\n PR: \"Sul\",\n RS: \"Sul\",\n SC: \"Sul\",\n};\n\n/** One `[IBGE code, name]` row as `br-locations.json` stores it. */\ntype RawEntry = [string, string];\n\ninterface RawState {\n uf: string;\n name: string;\n cities: RawEntry[];\n}\n\ninterface RawLocations {\n /**\n * The two IBGE vintages this file was built from: `roster` is the day the\n * municipality list was read, `mesh` the boundary release it was joined to.\n */\n vintage: { roster: string; mesh: string };\n states: RawState[];\n /** Administrative regions keyed by the municipality that contains them. */\n administrativeRegions: Record<string, RawEntry[]>;\n /** Every former name, mapped to the IBGE code that still answers to it. */\n aliases: RawEntry[];\n /** Municipalities the roster lists and the mesh has no geometry for. */\n pendingGeometry: string[];\n}\n\nconst RAW = rawLocations as unknown as RawLocations;\n\n/**\n * Strip a name down to what two spellings of the same place share.\n *\n * Accents, case and apostrophes are exactly what differs between the spelling a\n * user typed, the one an app saved five years ago and the one IBGE publishes\n * today — `\"Sant'Ana do Livramento\"` and `\"Santana do Livramento\"` are the same\n * municipality, and `\"acu\"` should find `\"Açu\"`.\n *\n * @param value - A municipality, region or alias name.\n * @returns The comparable form: lowercase, unaccented, apostrophes dropped.\n */\nfunction foldName(value: string): string {\n return value\n .trim()\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .replace(/['\\u2019\\u0060]/g, \"\")\n .toLowerCase();\n}\n\n/** The federative unit each IBGE code starts with. */\nconst UF_BY_CODE: Record<string, UF> = {\n \"11\": \"RO\",\n \"12\": \"AC\",\n \"13\": \"AM\",\n \"14\": \"RR\",\n \"15\": \"PA\",\n \"16\": \"AP\",\n \"17\": \"TO\",\n \"21\": \"MA\",\n \"22\": \"PI\",\n \"23\": \"CE\",\n \"24\": \"RN\",\n \"25\": \"PB\",\n \"26\": \"PE\",\n \"27\": \"AL\",\n \"28\": \"SE\",\n \"29\": \"BA\",\n \"31\": \"MG\",\n \"32\": \"ES\",\n \"33\": \"RJ\",\n \"35\": \"SP\",\n \"41\": \"PR\",\n \"42\": \"SC\",\n \"43\": \"RS\",\n \"50\": \"MS\",\n \"51\": \"MT\",\n \"52\": \"GO\",\n \"53\": \"DF\",\n};\n\n/**\n * The municipality an IBGE code belongs to.\n *\n * A municipality code is 7 digits and a subdistrict code extends it with 4 more\n * — `\"53001080515\"` (Ceilândia) is Brasília's `\"5300108\"` plus `\"0515\"` — so the\n * containing municipality is a prefix, not a lookup.\n *\n * @param id - A municipality or subdistrict IBGE code.\n * @returns The 7-digit municipality code.\n */\nfunction municipalityIdOf(id: string): string {\n return id.slice(0, 7);\n}\n\n/** Administrative regions of a municipality, or `[]` when it has none. */\nfunction regionsOf(municipalityId: string): readonly BrazilAdministrativeRegion[] {\n return (RAW.administrativeRegions[municipalityId] ?? []).map(([id, name]) => ({\n id,\n name,\n municipalityId,\n }));\n}\n\n/** Normalized, frozen list of all 27 states (built once at module load). */\nconst STATES: readonly BrazilState[] = RAW.states\n .map((entry) => {\n const uf = entry.uf as UF;\n const municipalities = entry.cities.map(([id, name]) => ({ id, name }));\n return {\n uf,\n name: entry.name,\n region: REGION_BY_UF[uf],\n cities: municipalities.map((m) => m.name),\n municipalities,\n administrativeRegions: municipalities.flatMap((m) => regionsOf(m.id)),\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name, \"pt-BR\"));\n\nconst STATE_BY_UF = new Map<UF, BrazilState>(STATES.map((s) => [s.uf, s]));\n\n/**\n * Every name that resolves to a municipality, folded, keyed by `<UF>:<name>`.\n *\n * Three kinds of name land here and the precedence matters: a current IBGE name\n * wins, then a former name from `aliases`, then an administrative region of the\n * DF. A rename never shadows a live municipality — `Campo Grande` is a live\n * municipality in both MS and RN, and in RN it is also the former name of\n * nothing, so the live entry has to be written last.\n */\nconst ID_BY_FOLDED_NAME = new Map<string, string>();\nfor (const [name, id] of RAW.aliases) {\n const uf = UF_BY_CODE[id.slice(0, 2)];\n if (uf !== undefined) ID_BY_FOLDED_NAME.set(`${uf}:${foldName(name)}`, municipalityIdOf(id));\n}\nfor (const state of STATES) {\n for (const region of state.administrativeRegions) {\n ID_BY_FOLDED_NAME.set(`${state.uf}:${foldName(region.name)}`, region.municipalityId);\n }\n}\nfor (const state of STATES) {\n for (const municipality of state.municipalities) {\n ID_BY_FOLDED_NAME.set(`${state.uf}:${foldName(municipality.name)}`, municipality.id);\n }\n}\n\nconst MUNICIPALITY_BY_ID = new Map<string, BrazilMunicipality>(\n STATES.flatMap((s) => s.municipalities).map((m) => [m.id, m]),\n);\n\n/** All 27 federative units, sorted by name. */\nexport function listStates(): readonly BrazilState[] {\n return STATES;\n}\n\n/** Look up a single state by acronym (case-insensitive). Returns `null` if unknown. */\nexport function getState(uf: string): BrazilState | null {\n const normalized = normalizeUf(uf);\n return normalized ? (STATE_BY_UF.get(normalized) ?? null) : null;\n}\n\n/**\n * City names for a federative unit (case-insensitive acronym). Returns an empty\n * array for an unknown UF — \"no matches\" is a valid result, not an error.\n */\nexport function citiesByUf(uf: string): string[] {\n return getState(uf)?.cities ?? [];\n}\n\n/** States belonging to a macro-region. */\nexport function statesByRegion(region: BrRegion): readonly BrazilState[] {\n return STATES.filter((s) => s.region === region);\n}\n\n/** True when `value` is one of the 27 valid acronyms (case-insensitive). */\nexport function isValidUf(value: string): boolean {\n return normalizeUf(value) !== null;\n}\n\n/**\n * Normalize an acronym to canonical uppercase form, or `null` if it is not a\n * valid UF. `\"sp\"` → `\"SP\"`, `\"xx\"` → `null`.\n */\nexport function normalizeUf(value: string): UF | null {\n const upper = value.trim().toUpperCase();\n return (REGION_BY_UF as Record<string, BrRegion>)[upper] ? (upper as UF) : null;\n}\n\n/** True when `city` exists within `uf` (both case-insensitive). */\nexport function isValidCity(uf: string, city: string): boolean {\n const target = city.trim().toLowerCase();\n return citiesByUf(uf).some((c) => c.toLowerCase() === target);\n}\n\n/** `{ value: uf, label: name }` options for every state, for a `<Select>`. */\nexport function ufChoices(): Choice[] {\n return STATES.map((s) => ({ value: s.uf, label: s.name }));\n}\n\n/** `{ value, label }` options for every city in a UF (value === label). */\nexport function cityChoices(uf: string): Choice[] {\n return citiesByUf(uf).map((c) => ({ value: c, label: c }));\n}\n\n/**\n * Municipalities of a federative unit, each carrying its IBGE code.\n *\n * The code is what a backend wants stored: it survives the renames that keep\n * happening (`Presidente Juscelino` became `Serra Caiada` in 2013) and it is the\n * key every other dataset in this module joins on.\n *\n * @param uf - Federative unit acronym, case-insensitive.\n * @returns The municipalities, alphabetically. Empty for an unknown UF.\n */\nexport function municipalitiesByUf(uf: string): readonly BrazilMunicipality[] {\n return getState(uf)?.municipalities ?? [];\n}\n\n/**\n * Administrative regions of a federative unit.\n *\n * Only the Federal District has any — 35 of them, inside its single\n * municipality. Every other UF answers `[]`, which is a valid result and not an\n * error.\n *\n * @param uf - Federative unit acronym, case-insensitive.\n * @returns The regions, alphabetically. Empty outside the DF.\n */\nexport function administrativeRegionsByUf(uf: string): readonly BrazilAdministrativeRegion[] {\n return getState(uf)?.administrativeRegions ?? [];\n}\n\n/**\n * Find the municipality a name refers to, however it was written down.\n *\n * Four kinds of name resolve, which is the point — an address saved years ago\n * has to keep pointing at the same place:\n *\n * 1. The current IBGE name (`\"Serra Caiada\"`).\n * 2. A former name (`\"Presidente Juscelino\"`), from the alias table the\n * generator builds by diffing vintages.\n * 3. A different spelling — accents, case and apostrophes are folded, so\n * `\"sant'ana do livramento\"` finds `\"Sant'Ana do Livramento\"`.\n * 4. An administrative region of the DF (`\"Ceilândia\"`), which resolves to\n * Brasília — the municipality it is part of.\n *\n * A live municipality always wins over a former name, so a name that is current\n * in one UF and historical in another resolves to the live one in each.\n *\n * @param uf - Federative unit acronym, case-insensitive.\n * @param name - The municipality, region or former name.\n * @returns The municipality, or `null` when nothing in that UF answers to it.\n */\nexport function resolveMunicipality(uf: string, name: string): BrazilMunicipality | null {\n const normalized = normalizeUf(uf);\n if (normalized === null) return null;\n const id = ID_BY_FOLDED_NAME.get(`${normalized}:${foldName(name)}`);\n return id === undefined ? null : (MUNICIPALITY_BY_ID.get(id) ?? null);\n}\n\n/**\n * The IBGE vintages the bundled datasets were built from.\n *\n * `roster` is the day the municipality list was read and `mesh` the boundary\n * release it was joined to. They differ on purpose: IBGE publishes new\n * municipalities before it publishes their boundaries, and the gap is what\n * {@link pendingGeometryIds} enumerates.\n *\n * @returns The two vintages, as they were written into the data file.\n */\nexport function datasetVintage(): { roster: string; mesh: string } {\n return RAW.vintage;\n}\n\n/**\n * Municipalities that exist in the roster and have no boundary yet.\n *\n * One today: Boa Esperança do Norte (MT), installed in 2023, for which IBGE\n * serves no mesh at any endpoint. It is listed and selectable, and it is the one\n * municipality `geocodeMunicipality` cannot place — so a caller that must plot\n * every selection can check this list up front instead of discovering it as an\n * empty result.\n *\n * @returns The IBGE codes, in the order the data file declares them.\n */\nexport function pendingGeometryIds(): readonly string[] {\n return RAW.pendingGeometry;\n}\n"],"mappings":";;AAmFA,IAAM,IAAqC;CACvC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACR,GA0BM,IAAM;AAaZ,SAAS,EAAS,GAAuB;CACrC,OAAO,EACF,KAAK,CAAC,CACN,UAAU,KAAK,CAAC,CAChB,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,YAAY;AACrB;AAGA,IAAM,IAAiC;CACnC,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;CACN,IAAM;AACV;AAYA,SAAS,EAAiB,GAAoB;CAC1C,OAAO,EAAG,MAAM,GAAG,CAAC;AACxB;AAGA,SAAS,EAAU,GAA+D;CAC9E,QAAQ,EAAI,sBAAsB,MAAmB,CAAC,EAAA,CAAG,KAAK,CAAC,GAAI,QAAW;EAC1E;EACA;EACA;CACJ,EAAE;AACN;AAGA,IAAM,IAAiC,EAAI,OACtC,KAAK,MAAU;CACZ,IAAM,IAAK,EAAM,IACX,IAAiB,EAAM,OAAO,KAAK,CAAC,GAAI,QAAW;EAAE;EAAI;CAAK,EAAE;CACtE,OAAO;EACH;EACA,MAAM,EAAM;EACZ,QAAQ,EAAa;EACrB,QAAQ,EAAe,KAAK,MAAM,EAAE,IAAI;EACxC;EACA,uBAAuB,EAAe,SAAS,MAAM,EAAU,EAAE,EAAE,CAAC;CACxE;AACJ,CAAC,CAAC,CACD,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC,GAEnD,IAAc,IAAI,IAAqB,EAAO,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAWnE,oBAAoB,IAAI,IAAoB;AAClD,KAAK,IAAM,CAAC,GAAM,MAAO,EAAI,SAAS;CAClC,IAAM,IAAK,EAAW,EAAG,MAAM,GAAG,CAAC;CACnC,AAAI,MAAO,KAAA,KAAW,EAAkB,IAAI,GAAG,EAAG,GAAG,EAAS,CAAI,KAAK,EAAiB,CAAE,CAAC;AAC/F;AACA,KAAK,IAAM,KAAS,GAChB,KAAK,IAAM,KAAU,EAAM,uBACvB,EAAkB,IAAI,GAAG,EAAM,GAAG,GAAG,EAAS,EAAO,IAAI,KAAK,EAAO,cAAc;AAG3F,KAAK,IAAM,KAAS,GAChB,KAAK,IAAM,KAAgB,EAAM,gBAC7B,EAAkB,IAAI,GAAG,EAAM,GAAG,GAAG,EAAS,EAAa,IAAI,KAAK,EAAa,EAAE;AAI3F,IAAM,IAAqB,IAAI,IAC3B,EAAO,SAAS,MAAM,EAAE,cAAc,CAAC,CAAC,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAChE;AAGA,SAAgB,IAAqC;CACjD,OAAO;AACX;AAGA,SAAgB,EAAS,GAAgC;CACrD,IAAM,IAAa,EAAY,CAAE;CACjC,OAAO,IAAc,EAAY,IAAI,CAAU,KAAK,OAAQ;AAChE;AAMA,SAAgB,EAAW,GAAsB;CAC7C,OAAO,EAAS,CAAE,CAAC,EAAE,UAAU,CAAC;AACpC;AAGA,SAAgB,EAAe,GAA0C;CACrE,OAAO,EAAO,QAAQ,MAAM,EAAE,WAAW,CAAM;AACnD;AAGA,SAAgB,EAAU,GAAwB;CAC9C,OAAO,EAAY,CAAK,MAAM;AAClC;AAMA,SAAgB,EAAY,GAA0B;CAClD,IAAM,IAAQ,EAAM,KAAK,CAAC,CAAC,YAAY;CACvC,OAAQ,EAA0C,KAAU,IAAe;AAC/E;AAGA,SAAgB,EAAY,GAAY,GAAuB;CAC3D,IAAM,IAAS,EAAK,KAAK,CAAC,CAAC,YAAY;CACvC,OAAO,EAAW,CAAE,CAAC,CAAC,MAAM,MAAM,EAAE,YAAY,MAAM,CAAM;AAChE;AAGA,SAAgB,IAAsB;CAClC,OAAO,EAAO,KAAK,OAAO;EAAE,OAAO,EAAE;EAAI,OAAO,EAAE;CAAK,EAAE;AAC7D;AAGA,SAAgB,EAAY,GAAsB;CAC9C,OAAO,EAAW,CAAE,CAAC,CAAC,KAAK,OAAO;EAAE,OAAO;EAAG,OAAO;CAAE,EAAE;AAC7D;AAYA,SAAgB,EAAmB,GAA2C;CAC1E,OAAO,EAAS,CAAE,CAAC,EAAE,kBAAkB,CAAC;AAC5C;AAYA,SAAgB,EAA0B,GAAmD;CACzF,OAAO,EAAS,CAAE,CAAC,EAAE,yBAAyB,CAAC;AACnD;AAuBA,SAAgB,EAAoB,GAAY,GAAyC;CACrF,IAAM,IAAa,EAAY,CAAE;CACjC,IAAI,MAAe,MAAM,OAAO;CAChC,IAAM,IAAK,EAAkB,IAAI,GAAG,EAAW,GAAG,EAAS,CAAI,GAAG;CAClE,OAAO,MAAO,KAAA,IAAY,OAAQ,EAAmB,IAAI,CAAE,KAAK;AACpE;AAYA,SAAgB,IAAmD;CAC/D,OAAO,EAAI;AACf;AAaA,SAAgB,IAAwC;CACpD,OAAO,EAAI;AACf"}
@@ -1,2 +1,2 @@
1
- const e=require("./svg-utils.cjs");var t=[`#eff3ff`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#3182bd`,`#08519c`],n=[`#edf8e9`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#31a354`,`#006d2c`],r=[`#440154`,`#414487`,`#2a788e`,`#22a884`,`#7ad151`,`#fde725`],i=[`#b2182b`,`#ef8a62`,`#fddbc7`,`#d1e5f0`,`#67a9cf`,`#2166ac`];function a(t,n){if(t.length===0)return`#000000`;if(t.length===1)return t[0];let r=Math.max(0,Math.min(1,n))*(t.length-1),i=Math.floor(r);return i>=t.length-1?t[t.length-1]:e.lerpColor(t[i],t[i+1],r-i)}function o(e,n,r=t){let i=n-e||1;return t=>a(r,(t-e)/i)}function s(e,n,r=t){let i=n-e||1,a=r.length;return t=>r[Math.min(a-1,Math.max(0,Math.floor((t-e)/i*a)))]}function c(e,t){return n=>{let r=0;for(;r<e.length&&n>=e[r];)r+=1;return t[Math.min(r,t.length-1)]}}exports.DIVERGING_RDBU=i,exports.SEQUENTIAL_BLUES=t,exports.SEQUENTIAL_GREENS=n,exports.SEQUENTIAL_VIRIDIS=r,exports.interpolatePalette=a,exports.quantizeScale=s,exports.sequentialScale=o,exports.thresholdScale=c;
1
+ const e=require("./svg-utils.cjs");var t=[`#eff3ff`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#3182bd`,`#08519c`],n=[`#edf8e9`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#31a354`,`#006d2c`],r=[`#440154`,`#414487`,`#2a788e`,`#22a884`,`#7ad151`,`#fde725`],i=[`#b2182b`,`#ef8a62`,`#fddbc7`,`#d1e5f0`,`#67a9cf`,`#2166ac`];function a(t,n){if(t.length===0)return`#000000`;if(t.length===1)return t[0];let r=Math.max(0,Math.min(1,n))*(t.length-1),i=Math.floor(r);return i>=t.length-1?t[t.length-1]:e.lerpColor(t[i],t[i+1],r-i)}function o(e,n,r=t){let i=n-e||1;return t=>a(r,(t-e)/i)}function s(e,t){if(e.length===0)throw Error(`${t}: palette must have at least one colour`)}function c(e,n,r=t){s(r,`quantizeScale`);let i=n-e||1,a=r.length;return t=>r[Math.min(a-1,Math.max(0,Math.floor((t-e)/i*a)))]}function l(e,t){return s(t,`thresholdScale`),n=>{let r=0;for(;r<e.length&&n>=e[r];)r+=1;return t[Math.min(r,t.length-1)]}}exports.DIVERGING_RDBU=i,exports.SEQUENTIAL_BLUES=t,exports.SEQUENTIAL_GREENS=n,exports.SEQUENTIAL_VIRIDIS=r,exports.interpolatePalette=a,exports.quantizeScale=c,exports.sequentialScale=o,exports.thresholdScale=l;
2
2
  //# sourceMappingURL=scales.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scales.cjs","names":[],"sources":["../../src/br/scales.ts"],"sourcesContent":["import { lerpColor } from \"./svg-utils\";\n\n/** Maps a numeric value to a CSS color string. */\nexport type ColorScale = (value: number) => string;\n\n/**\n * Sequential, colorblind-safe palettes (ColorBrewer / Viridis families, public\n * domain). Ordered light → dark. Swap for your brand ramp if needed — any\n * ordered list of hex colors works with the scale builders below.\n */\nexport const SEQUENTIAL_BLUES = [\n \"#eff3ff\",\n \"#c6dbef\",\n \"#9ecae1\",\n \"#6baed6\",\n \"#3182bd\",\n \"#08519c\",\n] as const;\n\nexport const SEQUENTIAL_GREENS = [\n \"#edf8e9\",\n \"#c7e9c0\",\n \"#a1d99b\",\n \"#74c476\",\n \"#31a354\",\n \"#006d2c\",\n] as const;\n\nexport const SEQUENTIAL_VIRIDIS = [\n \"#440154\",\n \"#414487\",\n \"#2a788e\",\n \"#22a884\",\n \"#7ad151\",\n \"#fde725\",\n] as const;\n\n/** Diverging palette (red ↔ neutral ↔ blue), for signed metrics. */\nexport const DIVERGING_RDBU = [\n \"#b2182b\",\n \"#ef8a62\",\n \"#fddbc7\",\n \"#d1e5f0\",\n \"#67a9cf\",\n \"#2166ac\",\n] as const;\n\n/**\n * Interpolate a palette at `t ∈ [0, 1]`, blending between the two nearest\n * stops. `t <= 0` → first color, `t >= 1` → last.\n */\nexport function interpolatePalette(palette: readonly string[], t: number): string {\n if (palette.length === 0) return \"#000000\";\n if (palette.length === 1) return palette[0];\n const clamped = Math.max(0, Math.min(1, t));\n const scaled = clamped * (palette.length - 1);\n const i = Math.floor(scaled);\n if (i >= palette.length - 1) return palette[palette.length - 1];\n return lerpColor(palette[i], palette[i + 1], scaled - i);\n}\n\n/**\n * Continuous scale: linearly interpolate `palette` across `[min, max]`.\n *\n * @example\n * const color = sequentialScale(0, 100, SEQUENTIAL_BLUES);\n * <BrazilMap values={data} colorScale={color} />;\n */\nexport function sequentialScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n const span = max - min || 1;\n return (value) => interpolatePalette(palette, (value - min) / span);\n}\n\n/**\n * Discrete scale: split `[min, max]` into `palette.length` equal buckets and\n * return the bucket's color (a classic choropleth \"quantize\" scale).\n */\nexport function quantizeScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n const span = max - min || 1;\n const n = palette.length;\n return (value) => {\n const idx = Math.min(n - 1, Math.max(0, Math.floor(((value - min) / span) * n)));\n return palette[idx];\n };\n}\n\n/**\n * Threshold scale: `palette[i]` applies to values in\n * `[thresholds[i-1], thresholds[i])`. `palette` must have\n * `thresholds.length + 1` entries.\n *\n * @example\n * const color = thresholdScale([10, 50, 100], SEQUENTIAL_GREENS.slice(0, 4));\n */\nexport function thresholdScale(\n thresholds: readonly number[],\n palette: readonly string[],\n): ColorScale {\n return (value) => {\n let i = 0;\n while (i < thresholds.length && value >= thresholds[i]) i += 1;\n return palette[Math.min(i, palette.length - 1)];\n };\n}\n"],"mappings":"mCAUA,IAAa,EAAmB,CAC5B,UACA,UACA,UACA,UACA,UACA,SACJ,EAEa,EAAoB,CAC7B,UACA,UACA,UACA,UACA,UACA,SACJ,EAEa,EAAqB,CAC9B,UACA,UACA,UACA,UACA,UACA,SACJ,EAGa,EAAiB,CAC1B,UACA,UACA,UACA,UACA,UACA,SACJ,EAMA,SAAgB,EAAmB,EAA4B,EAAmB,CAC9E,GAAI,EAAQ,SAAW,EAAG,MAAO,UACjC,GAAI,EAAQ,SAAW,EAAG,OAAO,EAAQ,GAEzC,IAAM,EADU,KAAK,IAAI,EAAG,KAAK,IAAI,EAAG,CAAC,CAC1B,GAAW,EAAQ,OAAS,GACrC,EAAI,KAAK,MAAM,CAAM,EAE3B,OADI,GAAK,EAAQ,OAAS,EAAU,EAAQ,EAAQ,OAAS,GACtD,EAAA,UAAU,EAAQ,GAAI,EAAQ,EAAI,GAAI,EAAS,CAAC,CAC3D,CASA,SAAgB,EACZ,EACA,EACA,EAA6B,EACnB,CACV,IAAM,EAAO,EAAM,GAAO,EAC1B,MAAQ,IAAU,EAAmB,GAAU,EAAQ,GAAO,CAAI,CACtE,CAMA,SAAgB,EACZ,EACA,EACA,EAA6B,EACnB,CACV,IAAM,EAAO,EAAM,GAAO,EACpB,EAAI,EAAQ,OAClB,MAAQ,IAEG,EADK,KAAK,IAAI,EAAI,EAAG,KAAK,IAAI,EAAG,KAAK,OAAQ,EAAQ,GAAO,EAAQ,CAAC,CAAC,CAC/D,EAEvB,CAUA,SAAgB,EACZ,EACA,EACU,CACV,MAAQ,IAAU,CACd,IAAI,EAAI,EACR,KAAO,EAAI,EAAW,QAAU,GAAS,EAAW,IAAI,GAAK,EAC7D,OAAO,EAAQ,KAAK,IAAI,EAAG,EAAQ,OAAS,CAAC,EACjD,CACJ"}
1
+ {"version":3,"file":"scales.cjs","names":[],"sources":["../../src/br/scales.ts"],"sourcesContent":["import { lerpColor } from \"./svg-utils\";\n\n/** Maps a numeric value to a CSS color string. */\nexport type ColorScale = (value: number) => string;\n\n/**\n * Sequential, colorblind-safe palettes (ColorBrewer / Viridis families, public\n * domain). Ordered light → dark. Swap for your brand ramp if needed — any\n * ordered list of hex colors works with the scale builders below.\n */\nexport const SEQUENTIAL_BLUES = [\n \"#eff3ff\",\n \"#c6dbef\",\n \"#9ecae1\",\n \"#6baed6\",\n \"#3182bd\",\n \"#08519c\",\n] as const;\n\nexport const SEQUENTIAL_GREENS = [\n \"#edf8e9\",\n \"#c7e9c0\",\n \"#a1d99b\",\n \"#74c476\",\n \"#31a354\",\n \"#006d2c\",\n] as const;\n\nexport const SEQUENTIAL_VIRIDIS = [\n \"#440154\",\n \"#414487\",\n \"#2a788e\",\n \"#22a884\",\n \"#7ad151\",\n \"#fde725\",\n] as const;\n\n/** Diverging palette (red ↔ neutral ↔ blue), for signed metrics. */\nexport const DIVERGING_RDBU = [\n \"#b2182b\",\n \"#ef8a62\",\n \"#fddbc7\",\n \"#d1e5f0\",\n \"#67a9cf\",\n \"#2166ac\",\n] as const;\n\n/**\n * Interpolate a palette at `t ∈ [0, 1]`, blending between the two nearest\n * stops. `t <= 0` → first color, `t >= 1` → last.\n */\nexport function interpolatePalette(palette: readonly string[], t: number): string {\n if (palette.length === 0) return \"#000000\";\n if (palette.length === 1) return palette[0];\n const clamped = Math.max(0, Math.min(1, t));\n const scaled = clamped * (palette.length - 1);\n const i = Math.floor(scaled);\n if (i >= palette.length - 1) return palette[palette.length - 1];\n return lerpColor(palette[i], palette[i + 1], scaled - i);\n}\n\n/**\n * Continuous scale: linearly interpolate `palette` across `[min, max]`.\n *\n * @example\n * const color = sequentialScale(0, 100, SEQUENTIAL_BLUES);\n * <BrazilMap values={data} colorScale={color} />;\n */\nexport function sequentialScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n const span = max - min || 1;\n return (value) => interpolatePalette(palette, (value - min) / span);\n}\n\n/**\n * Reject an empty palette where a colour has to come out.\n *\n * `interpolatePalette` already guarded this and the two factories did not, so an\n * empty array made them index at `-1` and return `undefined` announced as\n * `string` — which reaches the DOM as `fill=\"undefined\"` and paints nothing,\n * with no error anywhere. Throwing at construction puts the failure on the line\n * that built the scale instead of on every shape it colours.\n *\n * @param palette - The palette handed to a scale factory.\n * @param factory - Name of the caller, used in the message.\n * @throws {Error} When the palette has no entries.\n * @returns Nothing.\n */\nfunction assertPalette(palette: readonly string[], factory: string): void {\n if (palette.length === 0) {\n throw new Error(`${factory}: palette must have at least one colour`);\n }\n}\n\n/**\n * Discrete scale: split `[min, max]` into `palette.length` equal buckets and\n * return the bucket's color (a classic choropleth \"quantize\" scale).\n */\nexport function quantizeScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n assertPalette(palette, \"quantizeScale\");\n const span = max - min || 1;\n const n = palette.length;\n return (value) => {\n const idx = Math.min(n - 1, Math.max(0, Math.floor(((value - min) / span) * n)));\n return palette[idx] as string;\n };\n}\n\n/**\n * Threshold scale: `palette[i]` applies to values in\n * `[thresholds[i-1], thresholds[i])`. `palette` must have\n * `thresholds.length + 1` entries.\n *\n * @example\n * const color = thresholdScale([10, 50, 100], SEQUENTIAL_GREENS.slice(0, 4));\n */\nexport function thresholdScale(\n thresholds: readonly number[],\n palette: readonly string[],\n): ColorScale {\n assertPalette(palette, \"thresholdScale\");\n return (value) => {\n let i = 0;\n while (i < thresholds.length && value >= (thresholds[i] as number)) i += 1;\n return palette[Math.min(i, palette.length - 1)] as string;\n };\n}\n"],"mappings":"mCAUA,IAAa,EAAmB,CAC5B,UACA,UACA,UACA,UACA,UACA,SACJ,EAEa,EAAoB,CAC7B,UACA,UACA,UACA,UACA,UACA,SACJ,EAEa,EAAqB,CAC9B,UACA,UACA,UACA,UACA,UACA,SACJ,EAGa,EAAiB,CAC1B,UACA,UACA,UACA,UACA,UACA,SACJ,EAMA,SAAgB,EAAmB,EAA4B,EAAmB,CAC9E,GAAI,EAAQ,SAAW,EAAG,MAAO,UACjC,GAAI,EAAQ,SAAW,EAAG,OAAO,EAAQ,GAEzC,IAAM,EADU,KAAK,IAAI,EAAG,KAAK,IAAI,EAAG,CAAC,CAC1B,GAAW,EAAQ,OAAS,GACrC,EAAI,KAAK,MAAM,CAAM,EAE3B,OADI,GAAK,EAAQ,OAAS,EAAU,EAAQ,EAAQ,OAAS,GACtD,EAAA,UAAU,EAAQ,GAAI,EAAQ,EAAI,GAAI,EAAS,CAAC,CAC3D,CASA,SAAgB,EACZ,EACA,EACA,EAA6B,EACnB,CACV,IAAM,EAAO,EAAM,GAAO,EAC1B,MAAQ,IAAU,EAAmB,GAAU,EAAQ,GAAO,CAAI,CACtE,CAgBA,SAAS,EAAc,EAA4B,EAAuB,CACtE,GAAI,EAAQ,SAAW,EACnB,MAAU,MAAM,GAAG,EAAQ,wCAAwC,CAE3E,CAMA,SAAgB,EACZ,EACA,EACA,EAA6B,EACnB,CACV,EAAc,EAAS,eAAe,EACtC,IAAM,EAAO,EAAM,GAAO,EACpB,EAAI,EAAQ,OAClB,MAAQ,IAEG,EADK,KAAK,IAAI,EAAI,EAAG,KAAK,IAAI,EAAG,KAAK,OAAQ,EAAQ,GAAO,EAAQ,CAAC,CAAC,CAC/D,EAEvB,CAUA,SAAgB,EACZ,EACA,EACU,CAEV,OADA,EAAc,EAAS,gBAAgB,EAC/B,GAAU,CACd,IAAI,EAAI,EACR,KAAO,EAAI,EAAW,QAAU,GAAU,EAAW,IAAe,GAAK,EACzE,OAAO,EAAQ,KAAK,IAAI,EAAG,EAAQ,OAAS,CAAC,EACjD,CACJ"}
package/dist/br/scales.js CHANGED
@@ -39,18 +39,22 @@ function o(e, n, r = t) {
39
39
  let i = n - e || 1;
40
40
  return (t) => a(r, (t - e) / i);
41
41
  }
42
- function s(e, n, r = t) {
42
+ function s(e, t) {
43
+ if (e.length === 0) throw Error(`${t}: palette must have at least one colour`);
44
+ }
45
+ function c(e, n, r = t) {
46
+ s(r, "quantizeScale");
43
47
  let i = n - e || 1, a = r.length;
44
48
  return (t) => r[Math.min(a - 1, Math.max(0, Math.floor((t - e) / i * a)))];
45
49
  }
46
- function c(e, t) {
47
- return (n) => {
50
+ function l(e, t) {
51
+ return s(t, "thresholdScale"), (n) => {
48
52
  let r = 0;
49
53
  for (; r < e.length && n >= e[r];) r += 1;
50
54
  return t[Math.min(r, t.length - 1)];
51
55
  };
52
56
  }
53
57
  //#endregion
54
- export { i as DIVERGING_RDBU, t as SEQUENTIAL_BLUES, n as SEQUENTIAL_GREENS, r as SEQUENTIAL_VIRIDIS, a as interpolatePalette, s as quantizeScale, o as sequentialScale, c as thresholdScale };
58
+ export { i as DIVERGING_RDBU, t as SEQUENTIAL_BLUES, n as SEQUENTIAL_GREENS, r as SEQUENTIAL_VIRIDIS, a as interpolatePalette, c as quantizeScale, o as sequentialScale, l as thresholdScale };
55
59
 
56
60
  //# sourceMappingURL=scales.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scales.js","names":[],"sources":["../../src/br/scales.ts"],"sourcesContent":["import { lerpColor } from \"./svg-utils\";\n\n/** Maps a numeric value to a CSS color string. */\nexport type ColorScale = (value: number) => string;\n\n/**\n * Sequential, colorblind-safe palettes (ColorBrewer / Viridis families, public\n * domain). Ordered light → dark. Swap for your brand ramp if needed — any\n * ordered list of hex colors works with the scale builders below.\n */\nexport const SEQUENTIAL_BLUES = [\n \"#eff3ff\",\n \"#c6dbef\",\n \"#9ecae1\",\n \"#6baed6\",\n \"#3182bd\",\n \"#08519c\",\n] as const;\n\nexport const SEQUENTIAL_GREENS = [\n \"#edf8e9\",\n \"#c7e9c0\",\n \"#a1d99b\",\n \"#74c476\",\n \"#31a354\",\n \"#006d2c\",\n] as const;\n\nexport const SEQUENTIAL_VIRIDIS = [\n \"#440154\",\n \"#414487\",\n \"#2a788e\",\n \"#22a884\",\n \"#7ad151\",\n \"#fde725\",\n] as const;\n\n/** Diverging palette (red ↔ neutral ↔ blue), for signed metrics. */\nexport const DIVERGING_RDBU = [\n \"#b2182b\",\n \"#ef8a62\",\n \"#fddbc7\",\n \"#d1e5f0\",\n \"#67a9cf\",\n \"#2166ac\",\n] as const;\n\n/**\n * Interpolate a palette at `t ∈ [0, 1]`, blending between the two nearest\n * stops. `t <= 0` → first color, `t >= 1` → last.\n */\nexport function interpolatePalette(palette: readonly string[], t: number): string {\n if (palette.length === 0) return \"#000000\";\n if (palette.length === 1) return palette[0];\n const clamped = Math.max(0, Math.min(1, t));\n const scaled = clamped * (palette.length - 1);\n const i = Math.floor(scaled);\n if (i >= palette.length - 1) return palette[palette.length - 1];\n return lerpColor(palette[i], palette[i + 1], scaled - i);\n}\n\n/**\n * Continuous scale: linearly interpolate `palette` across `[min, max]`.\n *\n * @example\n * const color = sequentialScale(0, 100, SEQUENTIAL_BLUES);\n * <BrazilMap values={data} colorScale={color} />;\n */\nexport function sequentialScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n const span = max - min || 1;\n return (value) => interpolatePalette(palette, (value - min) / span);\n}\n\n/**\n * Discrete scale: split `[min, max]` into `palette.length` equal buckets and\n * return the bucket's color (a classic choropleth \"quantize\" scale).\n */\nexport function quantizeScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n const span = max - min || 1;\n const n = palette.length;\n return (value) => {\n const idx = Math.min(n - 1, Math.max(0, Math.floor(((value - min) / span) * n)));\n return palette[idx];\n };\n}\n\n/**\n * Threshold scale: `palette[i]` applies to values in\n * `[thresholds[i-1], thresholds[i])`. `palette` must have\n * `thresholds.length + 1` entries.\n *\n * @example\n * const color = thresholdScale([10, 50, 100], SEQUENTIAL_GREENS.slice(0, 4));\n */\nexport function thresholdScale(\n thresholds: readonly number[],\n palette: readonly string[],\n): ColorScale {\n return (value) => {\n let i = 0;\n while (i < thresholds.length && value >= thresholds[i]) i += 1;\n return palette[Math.min(i, palette.length - 1)];\n };\n}\n"],"mappings":";;AAUA,IAAa,IAAmB;CAC5B;CACA;CACA;CACA;CACA;CACA;AACJ,GAEa,IAAoB;CAC7B;CACA;CACA;CACA;CACA;CACA;AACJ,GAEa,IAAqB;CAC9B;CACA;CACA;CACA;CACA;CACA;AACJ,GAGa,IAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;AACJ;AAMA,SAAgB,EAAmB,GAA4B,GAAmB;CAC9E,IAAI,EAAQ,WAAW,GAAG,OAAO;CACjC,IAAI,EAAQ,WAAW,GAAG,OAAO,EAAQ;CAEzC,IAAM,IADU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAC,CAC1B,KAAW,EAAQ,SAAS,IACrC,IAAI,KAAK,MAAM,CAAM;CAE3B,OADI,KAAK,EAAQ,SAAS,IAAU,EAAQ,EAAQ,SAAS,KACtD,EAAU,EAAQ,IAAI,EAAQ,IAAI,IAAI,IAAS,CAAC;AAC3D;AASA,SAAgB,EACZ,GACA,GACA,IAA6B,GACnB;CACV,IAAM,IAAO,IAAM,KAAO;CAC1B,QAAQ,MAAU,EAAmB,IAAU,IAAQ,KAAO,CAAI;AACtE;AAMA,SAAgB,EACZ,GACA,GACA,IAA6B,GACnB;CACV,IAAM,IAAO,IAAM,KAAO,GACpB,IAAI,EAAQ;CAClB,QAAQ,MAEG,EADK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,OAAQ,IAAQ,KAAO,IAAQ,CAAC,CAAC,CAC/D;AAEvB;AAUA,SAAgB,EACZ,GACA,GACU;CACV,QAAQ,MAAU;EACd,IAAI,IAAI;EACR,OAAO,IAAI,EAAW,UAAU,KAAS,EAAW,KAAI,KAAK;EAC7D,OAAO,EAAQ,KAAK,IAAI,GAAG,EAAQ,SAAS,CAAC;CACjD;AACJ"}
1
+ {"version":3,"file":"scales.js","names":[],"sources":["../../src/br/scales.ts"],"sourcesContent":["import { lerpColor } from \"./svg-utils\";\n\n/** Maps a numeric value to a CSS color string. */\nexport type ColorScale = (value: number) => string;\n\n/**\n * Sequential, colorblind-safe palettes (ColorBrewer / Viridis families, public\n * domain). Ordered light → dark. Swap for your brand ramp if needed — any\n * ordered list of hex colors works with the scale builders below.\n */\nexport const SEQUENTIAL_BLUES = [\n \"#eff3ff\",\n \"#c6dbef\",\n \"#9ecae1\",\n \"#6baed6\",\n \"#3182bd\",\n \"#08519c\",\n] as const;\n\nexport const SEQUENTIAL_GREENS = [\n \"#edf8e9\",\n \"#c7e9c0\",\n \"#a1d99b\",\n \"#74c476\",\n \"#31a354\",\n \"#006d2c\",\n] as const;\n\nexport const SEQUENTIAL_VIRIDIS = [\n \"#440154\",\n \"#414487\",\n \"#2a788e\",\n \"#22a884\",\n \"#7ad151\",\n \"#fde725\",\n] as const;\n\n/** Diverging palette (red ↔ neutral ↔ blue), for signed metrics. */\nexport const DIVERGING_RDBU = [\n \"#b2182b\",\n \"#ef8a62\",\n \"#fddbc7\",\n \"#d1e5f0\",\n \"#67a9cf\",\n \"#2166ac\",\n] as const;\n\n/**\n * Interpolate a palette at `t ∈ [0, 1]`, blending between the two nearest\n * stops. `t <= 0` → first color, `t >= 1` → last.\n */\nexport function interpolatePalette(palette: readonly string[], t: number): string {\n if (palette.length === 0) return \"#000000\";\n if (palette.length === 1) return palette[0];\n const clamped = Math.max(0, Math.min(1, t));\n const scaled = clamped * (palette.length - 1);\n const i = Math.floor(scaled);\n if (i >= palette.length - 1) return palette[palette.length - 1];\n return lerpColor(palette[i], palette[i + 1], scaled - i);\n}\n\n/**\n * Continuous scale: linearly interpolate `palette` across `[min, max]`.\n *\n * @example\n * const color = sequentialScale(0, 100, SEQUENTIAL_BLUES);\n * <BrazilMap values={data} colorScale={color} />;\n */\nexport function sequentialScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n const span = max - min || 1;\n return (value) => interpolatePalette(palette, (value - min) / span);\n}\n\n/**\n * Reject an empty palette where a colour has to come out.\n *\n * `interpolatePalette` already guarded this and the two factories did not, so an\n * empty array made them index at `-1` and return `undefined` announced as\n * `string` — which reaches the DOM as `fill=\"undefined\"` and paints nothing,\n * with no error anywhere. Throwing at construction puts the failure on the line\n * that built the scale instead of on every shape it colours.\n *\n * @param palette - The palette handed to a scale factory.\n * @param factory - Name of the caller, used in the message.\n * @throws {Error} When the palette has no entries.\n * @returns Nothing.\n */\nfunction assertPalette(palette: readonly string[], factory: string): void {\n if (palette.length === 0) {\n throw new Error(`${factory}: palette must have at least one colour`);\n }\n}\n\n/**\n * Discrete scale: split `[min, max]` into `palette.length` equal buckets and\n * return the bucket's color (a classic choropleth \"quantize\" scale).\n */\nexport function quantizeScale(\n min: number,\n max: number,\n palette: readonly string[] = SEQUENTIAL_BLUES,\n): ColorScale {\n assertPalette(palette, \"quantizeScale\");\n const span = max - min || 1;\n const n = palette.length;\n return (value) => {\n const idx = Math.min(n - 1, Math.max(0, Math.floor(((value - min) / span) * n)));\n return palette[idx] as string;\n };\n}\n\n/**\n * Threshold scale: `palette[i]` applies to values in\n * `[thresholds[i-1], thresholds[i])`. `palette` must have\n * `thresholds.length + 1` entries.\n *\n * @example\n * const color = thresholdScale([10, 50, 100], SEQUENTIAL_GREENS.slice(0, 4));\n */\nexport function thresholdScale(\n thresholds: readonly number[],\n palette: readonly string[],\n): ColorScale {\n assertPalette(palette, \"thresholdScale\");\n return (value) => {\n let i = 0;\n while (i < thresholds.length && value >= (thresholds[i] as number)) i += 1;\n return palette[Math.min(i, palette.length - 1)] as string;\n };\n}\n"],"mappings":";;AAUA,IAAa,IAAmB;CAC5B;CACA;CACA;CACA;CACA;CACA;AACJ,GAEa,IAAoB;CAC7B;CACA;CACA;CACA;CACA;CACA;AACJ,GAEa,IAAqB;CAC9B;CACA;CACA;CACA;CACA;CACA;AACJ,GAGa,IAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;AACJ;AAMA,SAAgB,EAAmB,GAA4B,GAAmB;CAC9E,IAAI,EAAQ,WAAW,GAAG,OAAO;CACjC,IAAI,EAAQ,WAAW,GAAG,OAAO,EAAQ;CAEzC,IAAM,IADU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAC,CAC1B,KAAW,EAAQ,SAAS,IACrC,IAAI,KAAK,MAAM,CAAM;CAE3B,OADI,KAAK,EAAQ,SAAS,IAAU,EAAQ,EAAQ,SAAS,KACtD,EAAU,EAAQ,IAAI,EAAQ,IAAI,IAAI,IAAS,CAAC;AAC3D;AASA,SAAgB,EACZ,GACA,GACA,IAA6B,GACnB;CACV,IAAM,IAAO,IAAM,KAAO;CAC1B,QAAQ,MAAU,EAAmB,IAAU,IAAQ,KAAO,CAAI;AACtE;AAgBA,SAAS,EAAc,GAA4B,GAAuB;CACtE,IAAI,EAAQ,WAAW,GACnB,MAAU,MAAM,GAAG,EAAQ,wCAAwC;AAE3E;AAMA,SAAgB,EACZ,GACA,GACA,IAA6B,GACnB;CACV,EAAc,GAAS,eAAe;CACtC,IAAM,IAAO,IAAM,KAAO,GACpB,IAAI,EAAQ;CAClB,QAAQ,MAEG,EADK,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,OAAQ,IAAQ,KAAO,IAAQ,CAAC,CAAC,CAC/D;AAEvB;AAUA,SAAgB,EACZ,GACA,GACU;CAEV,OADA,EAAc,GAAS,gBAAgB,IAC/B,MAAU;EACd,IAAI,IAAI;EACR,OAAO,IAAI,EAAW,UAAU,KAAU,EAAW,KAAe,KAAK;EACzE,OAAO,EAAQ,KAAK,IAAI,GAAG,EAAQ,SAAS,CAAC;CACjD;AACJ"}
@@ -0,0 +1,2 @@
1
+ var e=new Set([10,11]),t=12,n=15;function r(r){let i=r.replace(/\D/g,``);return e.has(i.length)?`55${i}`:i.length>=t&&i.length<=n&&!i.startsWith(`0`)?i:``}function i(e,t){let n=r(e);if(!n)return``;let i=`https://wa.me/${n}`;return t?`${i}?text=${encodeURIComponent(t)}`:i}function a(e,t){if(typeof window>`u`)return!1;let n=i(e,t);return n?(window.open(n,`_blank`,`noopener,noreferrer`),!0):!1}exports.openWhatsApp=a,exports.toWhatsAppNumber=r,exports.whatsAppUrl=i;
2
+ //# sourceMappingURL=whatsapp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp.cjs","names":[],"sources":["../../src/br/whatsapp.ts"],"sourcesContent":["/** Country calling code for Brazil, the digits `wa.me` needs in front of a national number. */\nconst BR_COUNTRY_CODE = \"55\";\n\nconst NATIONAL_LENGTHS = new Set([10, 11]);\nconst E164_MIN_WITH_COUNTRY_CODE = 12;\nconst E164_MAX = 15;\n\n/**\n * Normalise a phone number to the digits-only form `wa.me` accepts.\n *\n * A Brazilian number is stored almost everywhere **without** the country code —\n * ten digits for a landline, eleven for a mobile — and `wa.me` refuses anything\n * that is not fully qualified. Those two shapes get `55` in front; a number that\n * already carries a country code (12 to 15 digits, the E.164 range that no\n * Brazilian national number can reach) is returned untouched, so a foreign\n * client's number still works.\n *\n * Everything else returns an empty string rather than a best guess. Handing back\n * the digits as typed is what the naive version does, and it builds a `wa.me`\n * URL that opens WhatsApp on a number nobody owns — a typo becomes a dead chat\n * window instead of a disabled button.\n *\n * Trunk and carrier-selection prefixes (`0`, `021`, …) are **not** stripped: a\n * leading zero is ambiguous between the two, so a number carrying one reads as\n * invalid instead of being silently reinterpreted. Pass the plain number. The\n * leading zero is what rules it out even at a plausible length — no E.164\n * country code starts with `0`, so `011999998888` is a national number wearing a\n * trunk prefix, never an international one.\n *\n * @example\n * toWhatsAppNumber(\"(11) 99999-8888\"); // \"5511999998888\"\n * toWhatsAppNumber(\"+55 11 99999-8888\"); // \"5511999998888\"\n * toWhatsAppNumber(\"99999-8888\"); // \"\" — no area code, nothing to dial\n *\n * @param phone - Phone number in any shape: masked, spaced, `+`-prefixed.\n * @returns Digits ready for a `wa.me` link, or an empty string when the input\n * cannot be resolved to a dialable number.\n */\nexport function toWhatsAppNumber(phone: string): string {\n const digits = phone.replace(/\\D/g, \"\");\n if (NATIONAL_LENGTHS.has(digits.length)) return `${BR_COUNTRY_CODE}${digits}`;\n const withinE164 = digits.length >= E164_MIN_WITH_COUNTRY_CODE && digits.length <= E164_MAX;\n if (withinE164 && !digits.startsWith(\"0\")) return digits;\n return \"\";\n}\n\n/**\n * Build the `wa.me` deep link that opens a chat with an optional message\n * already typed.\n *\n * This is a **deep link, never a send**: the chat opens with the text ready and\n * the person presses send. That is the feature, not a limitation — it needs no\n * official Cloud API, no approved template and no business verification, and it\n * cannot let the UI claim a message was delivered when it was not.\n *\n * `api.whatsapp.com/send?phone=…` is deliberately not offered as an alternative\n * host: both resolve to the same chooser, and `wa.me` is the short form of it.\n *\n * @example\n * whatsAppUrl(\"(11) 99999-8888\", \"Seu horário é amanhã às 14h.\");\n * // \"https://wa.me/5511999998888?text=Seu%20hor%C3%A1rio%20%C3%A9%20amanh%C3%A3%20%C3%A0s%2014h.\"\n *\n * @param phone - Phone number in any shape; normalised by {@link toWhatsAppNumber}.\n * @param text - Message to pre-fill. Omitted or empty leaves the composer blank.\n * @returns The `https://wa.me/…` URL, or an empty string when the number cannot\n * be normalised.\n */\nexport function whatsAppUrl(phone: string, text?: string): string {\n const number = toWhatsAppNumber(phone);\n if (!number) return \"\";\n const url = `https://wa.me/${number}`;\n return text ? `${url}?text=${encodeURIComponent(text)}` : url;\n}\n\n/**\n * Open the WhatsApp chat in a new tab.\n *\n * @example\n * <Button onClick={() => openWhatsApp(client.phone, greeting)}>\n * Falar no WhatsApp\n * </Button>\n *\n * @param phone - Phone number in any shape; normalised by {@link toWhatsAppNumber}.\n * @param text - Message to pre-fill. Omitted or empty leaves the composer blank.\n * @returns `true` when a URL was built and the open was requested, `false` when\n * the number is unusable or there is no `window` (test runner, service worker,\n * build plugin). It reports the **request**, not the tab: opening with\n * `noopener` makes `window.open` return `null` even on success, so its result\n * cannot distinguish a blocked popup from an opened one.\n */\nexport function openWhatsApp(phone: string, text?: string): boolean {\n if (typeof window === \"undefined\") return false;\n const url = whatsAppUrl(phone, text);\n if (!url) return false;\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n return true;\n}\n"],"mappings":"AACA,IAEM,EAAmB,IAAI,IAAI,CAAC,GAAI,EAAE,CAAC,EACnC,EAA6B,GAC7B,EAAW,GAiCjB,SAAgB,EAAiB,EAAuB,CACpD,IAAM,EAAS,EAAM,QAAQ,MAAO,EAAE,EAItC,OAHI,EAAiB,IAAI,EAAO,MAAM,EAAU,KAAqB,IAClD,EAAO,QAAU,GAA8B,EAAO,QAAU,GACjE,CAAC,EAAO,WAAW,GAAG,EAAU,EAC3C,EACX,CAuBA,SAAgB,EAAY,EAAe,EAAuB,CAC9D,IAAM,EAAS,EAAiB,CAAK,EACrC,GAAI,CAAC,EAAQ,MAAO,GACpB,IAAM,EAAM,iBAAiB,IAC7B,OAAO,EAAO,GAAG,EAAI,QAAQ,mBAAmB,CAAI,IAAM,CAC9D,CAkBA,SAAgB,EAAa,EAAe,EAAwB,CAChE,GAAI,OAAO,OAAW,IAAa,MAAO,GAC1C,IAAM,EAAM,EAAY,EAAO,CAAI,EAGnC,OAFK,GACL,OAAO,KAAK,EAAK,SAAU,qBAAqB,EACzC,IAFU,EAGrB"}
@@ -0,0 +1,21 @@
1
+ //#region src/br/whatsapp.ts
2
+ var e = /* @__PURE__ */ new Set([10, 11]), t = 12, n = 15;
3
+ function r(r) {
4
+ let i = r.replace(/\D/g, "");
5
+ return e.has(i.length) ? `55${i}` : i.length >= t && i.length <= n && !i.startsWith("0") ? i : "";
6
+ }
7
+ function i(e, t) {
8
+ let n = r(e);
9
+ if (!n) return "";
10
+ let i = `https://wa.me/${n}`;
11
+ return t ? `${i}?text=${encodeURIComponent(t)}` : i;
12
+ }
13
+ function a(e, t) {
14
+ if (typeof window > "u") return !1;
15
+ let n = i(e, t);
16
+ return n ? (window.open(n, "_blank", "noopener,noreferrer"), !0) : !1;
17
+ }
18
+ //#endregion
19
+ export { a as openWhatsApp, r as toWhatsAppNumber, i as whatsAppUrl };
20
+
21
+ //# sourceMappingURL=whatsapp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp.js","names":[],"sources":["../../src/br/whatsapp.ts"],"sourcesContent":["/** Country calling code for Brazil, the digits `wa.me` needs in front of a national number. */\nconst BR_COUNTRY_CODE = \"55\";\n\nconst NATIONAL_LENGTHS = new Set([10, 11]);\nconst E164_MIN_WITH_COUNTRY_CODE = 12;\nconst E164_MAX = 15;\n\n/**\n * Normalise a phone number to the digits-only form `wa.me` accepts.\n *\n * A Brazilian number is stored almost everywhere **without** the country code —\n * ten digits for a landline, eleven for a mobile — and `wa.me` refuses anything\n * that is not fully qualified. Those two shapes get `55` in front; a number that\n * already carries a country code (12 to 15 digits, the E.164 range that no\n * Brazilian national number can reach) is returned untouched, so a foreign\n * client's number still works.\n *\n * Everything else returns an empty string rather than a best guess. Handing back\n * the digits as typed is what the naive version does, and it builds a `wa.me`\n * URL that opens WhatsApp on a number nobody owns — a typo becomes a dead chat\n * window instead of a disabled button.\n *\n * Trunk and carrier-selection prefixes (`0`, `021`, …) are **not** stripped: a\n * leading zero is ambiguous between the two, so a number carrying one reads as\n * invalid instead of being silently reinterpreted. Pass the plain number. The\n * leading zero is what rules it out even at a plausible length — no E.164\n * country code starts with `0`, so `011999998888` is a national number wearing a\n * trunk prefix, never an international one.\n *\n * @example\n * toWhatsAppNumber(\"(11) 99999-8888\"); // \"5511999998888\"\n * toWhatsAppNumber(\"+55 11 99999-8888\"); // \"5511999998888\"\n * toWhatsAppNumber(\"99999-8888\"); // \"\" — no area code, nothing to dial\n *\n * @param phone - Phone number in any shape: masked, spaced, `+`-prefixed.\n * @returns Digits ready for a `wa.me` link, or an empty string when the input\n * cannot be resolved to a dialable number.\n */\nexport function toWhatsAppNumber(phone: string): string {\n const digits = phone.replace(/\\D/g, \"\");\n if (NATIONAL_LENGTHS.has(digits.length)) return `${BR_COUNTRY_CODE}${digits}`;\n const withinE164 = digits.length >= E164_MIN_WITH_COUNTRY_CODE && digits.length <= E164_MAX;\n if (withinE164 && !digits.startsWith(\"0\")) return digits;\n return \"\";\n}\n\n/**\n * Build the `wa.me` deep link that opens a chat with an optional message\n * already typed.\n *\n * This is a **deep link, never a send**: the chat opens with the text ready and\n * the person presses send. That is the feature, not a limitation — it needs no\n * official Cloud API, no approved template and no business verification, and it\n * cannot let the UI claim a message was delivered when it was not.\n *\n * `api.whatsapp.com/send?phone=…` is deliberately not offered as an alternative\n * host: both resolve to the same chooser, and `wa.me` is the short form of it.\n *\n * @example\n * whatsAppUrl(\"(11) 99999-8888\", \"Seu horário é amanhã às 14h.\");\n * // \"https://wa.me/5511999998888?text=Seu%20hor%C3%A1rio%20%C3%A9%20amanh%C3%A3%20%C3%A0s%2014h.\"\n *\n * @param phone - Phone number in any shape; normalised by {@link toWhatsAppNumber}.\n * @param text - Message to pre-fill. Omitted or empty leaves the composer blank.\n * @returns The `https://wa.me/…` URL, or an empty string when the number cannot\n * be normalised.\n */\nexport function whatsAppUrl(phone: string, text?: string): string {\n const number = toWhatsAppNumber(phone);\n if (!number) return \"\";\n const url = `https://wa.me/${number}`;\n return text ? `${url}?text=${encodeURIComponent(text)}` : url;\n}\n\n/**\n * Open the WhatsApp chat in a new tab.\n *\n * @example\n * <Button onClick={() => openWhatsApp(client.phone, greeting)}>\n * Falar no WhatsApp\n * </Button>\n *\n * @param phone - Phone number in any shape; normalised by {@link toWhatsAppNumber}.\n * @param text - Message to pre-fill. Omitted or empty leaves the composer blank.\n * @returns `true` when a URL was built and the open was requested, `false` when\n * the number is unusable or there is no `window` (test runner, service worker,\n * build plugin). It reports the **request**, not the tab: opening with\n * `noopener` makes `window.open` return `null` even on success, so its result\n * cannot distinguish a blocked popup from an opened one.\n */\nexport function openWhatsApp(phone: string, text?: string): boolean {\n if (typeof window === \"undefined\") return false;\n const url = whatsAppUrl(phone, text);\n if (!url) return false;\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n return true;\n}\n"],"mappings":";AACA,IAEM,oBAAmB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,GACnC,IAA6B,IAC7B,IAAW;AAiCjB,SAAgB,EAAiB,GAAuB;CACpD,IAAM,IAAS,EAAM,QAAQ,OAAO,EAAE;CAItC,OAHI,EAAiB,IAAI,EAAO,MAAM,IAAU,KAAqB,MAClD,EAAO,UAAU,KAA8B,EAAO,UAAU,KACjE,CAAC,EAAO,WAAW,GAAG,IAAU,IAC3C;AACX;AAuBA,SAAgB,EAAY,GAAe,GAAuB;CAC9D,IAAM,IAAS,EAAiB,CAAK;CACrC,IAAI,CAAC,GAAQ,OAAO;CACpB,IAAM,IAAM,iBAAiB;CAC7B,OAAO,IAAO,GAAG,EAAI,QAAQ,mBAAmB,CAAI,MAAM;AAC9D;AAkBA,SAAgB,EAAa,GAAe,GAAwB;CAChE,IAAI,OAAO,SAAW,KAAa,OAAO;CAC1C,IAAM,IAAM,EAAY,GAAO,CAAI;CAGnC,OAFK,KACL,OAAO,KAAK,GAAK,UAAU,qBAAqB,GACzC,MAFU;AAGrB"}
package/dist/br.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./br/locations.cjs"),t=require("./br/state-geo.cjs"),n=require("./br/geocode.cjs"),r=require("./br/regions.cjs"),i=require("./br/BrazilMap.cjs"),a=require("./br/BrazilStateMap.cjs"),o=require("./br/BrazilStateCitySelect.cjs"),s=require("./br/MunicipalitySearch.cjs"),c=require("./br/scales.cjs"),l=require("./br/MapLegend.cjs"),u=require("./br/pix.cjs"),d=require("./br/PixQRCode.cjs"),f=require("./br/boleto.cjs"),p=require("./br/nfe.cjs"),m=require("./br/holidays.cjs");async function h(){return(await Promise.resolve().then(()=>require("./br/br-geo.cjs"))).BR_UF_GEOJSON}exports.BoletoError=f.BoletoError,exports.BrazilMap=i.BrazilMap,exports.BrazilStateCitySelect=o.BrazilStateCitySelect,exports.BrazilStateMap=a.BrazilStateMap,exports.ChaveNFeError=p.ChaveNFeError,exports.DIVERGING_RDBU=c.DIVERGING_RDBU,exports.MapLegend=l.MapLegend,exports.MunicipalitySearch=s.MunicipalitySearch,exports.PixError=u.PixError,exports.PixQRCode=d.PixQRCode,exports.REGION_COLORS=r.REGION_COLORS,exports.SEQUENTIAL_BLUES=c.SEQUENTIAL_BLUES,exports.SEQUENTIAL_GREENS=c.SEQUENTIAL_GREENS,exports.SEQUENTIAL_VIRIDIS=c.SEQUENTIAL_VIRIDIS,exports.addBusinessDays=m.addBusinessDays,exports.boletoDueDate=f.boletoDueDate,exports.boletoKind=f.boletoKind,exports.chaveNFeCheckDigit=p.chaveNFeCheckDigit,exports.citiesByUf=e.citiesByUf,exports.cityChoices=e.cityChoices,exports.codigoBarrasToLinhaDigitavel=f.codigoBarrasToLinhaDigitavel,exports.easterSunday=m.easterSunday,exports.fatorVencimento=f.fatorVencimento,exports.formatChaveNFe=p.formatChaveNFe,exports.formatLinhaDigitavel=f.formatLinhaDigitavel,exports.geocodeMunicipality=n.geocodeMunicipality,exports.getState=e.getState,exports.holidaysFor=m.holidaysFor,exports.isBusinessDay=m.isBusinessDay,exports.isHoliday=m.isHoliday,exports.isValidCity=e.isValidCity,exports.isValidUf=e.isValidUf,exports.linhaDigitavelToCodigoBarras=f.linhaDigitavelToCodigoBarras,exports.listStates=e.listStates,exports.loadBrUfGeoJson=h,exports.loadStateMunicipalities=t.loadStateMunicipalities,exports.mod10Dac=f.mod10Dac,exports.mod11DacArrecadacao=f.mod11DacArrecadacao,exports.mod11DacCobranca=f.mod11DacCobranca,exports.municipalityCentroid=n.municipalityCentroid,exports.nearestMunicipality=n.nearestMunicipality,exports.nextBusinessDay=m.nextBusinessDay,exports.normalizePixKey=u.normalizePixKey,exports.normalizeUf=e.normalizeUf,exports.parseChaveNFe=p.parseChaveNFe,exports.parseCodigoBarras=f.parseCodigoBarras,exports.parseLinhaDigitavel=f.parseLinhaDigitavel,exports.parsePixPayload=u.parsePixPayload,exports.pixCrc16=u.pixCrc16,exports.pixKeyType=u.pixKeyType,exports.pixPayload=u.pixPayload,exports.quantizeScale=c.quantizeScale,exports.regionLegendItems=r.regionLegendItems,exports.reverseGeocode=n.reverseGeocode,exports.searchMunicipalities=n.searchMunicipalities,exports.sequentialScale=c.sequentialScale,exports.stateCentroid=n.stateCentroid,exports.statesByRegion=e.statesByRegion,exports.thresholdScale=c.thresholdScale,exports.ufChoices=e.ufChoices,exports.validateBoleto=f.validateBoleto,exports.validateChaveNFe=p.validateChaveNFe;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./br/locations.cjs"),t=require("./br/state-geo.cjs"),n=require("./br/geocode.cjs"),r=require("./br/regions.cjs"),i=require("./br/BrazilMap.cjs"),a=require("./br/BrazilStateMap.cjs"),o=require("./br/BrazilStateCitySelect.cjs"),s=require("./br/MunicipalitySearch.cjs"),c=require("./br/scales.cjs"),l=require("./br/MapLegend.cjs"),u=require("./br/pix.cjs"),d=require("./br/PixQRCode.cjs"),f=require("./br/boleto.cjs"),p=require("./br/nfe.cjs"),m=require("./br/whatsapp.cjs"),h=require("./br/holidays.cjs");async function g(){return(await Promise.resolve().then(()=>require("./br/br-geo.cjs"))).BR_UF_GEOJSON}exports.BoletoError=f.BoletoError,exports.BrazilMap=i.BrazilMap,exports.BrazilStateCitySelect=o.BrazilStateCitySelect,exports.BrazilStateMap=a.BrazilStateMap,exports.ChaveNFeError=p.ChaveNFeError,exports.DIVERGING_RDBU=c.DIVERGING_RDBU,exports.MapLegend=l.MapLegend,exports.MunicipalitySearch=s.MunicipalitySearch,exports.PixError=u.PixError,exports.PixQRCode=d.PixQRCode,exports.REGION_COLORS=r.REGION_COLORS,exports.SEQUENTIAL_BLUES=c.SEQUENTIAL_BLUES,exports.SEQUENTIAL_GREENS=c.SEQUENTIAL_GREENS,exports.SEQUENTIAL_VIRIDIS=c.SEQUENTIAL_VIRIDIS,exports.addBusinessDays=h.addBusinessDays,exports.administrativeRegionsByUf=e.administrativeRegionsByUf,exports.boletoDueDate=f.boletoDueDate,exports.boletoKind=f.boletoKind,exports.chaveNFeCheckDigit=p.chaveNFeCheckDigit,exports.citiesByUf=e.citiesByUf,exports.cityChoices=e.cityChoices,exports.codigoBarrasToLinhaDigitavel=f.codigoBarrasToLinhaDigitavel,exports.datasetVintage=e.datasetVintage,exports.easterSunday=h.easterSunday,exports.fatorVencimento=f.fatorVencimento,exports.formatChaveNFe=p.formatChaveNFe,exports.formatLinhaDigitavel=f.formatLinhaDigitavel,exports.geocodeMunicipality=n.geocodeMunicipality,exports.getState=e.getState,exports.holidaysFor=h.holidaysFor,exports.isBusinessDay=h.isBusinessDay,exports.isHoliday=h.isHoliday,exports.isValidCity=e.isValidCity,exports.isValidUf=e.isValidUf,exports.linhaDigitavelToCodigoBarras=f.linhaDigitavelToCodigoBarras,exports.listStates=e.listStates,exports.loadBrUfGeoJson=g,exports.loadStateMunicipalities=t.loadStateMunicipalities,exports.mod10Dac=f.mod10Dac,exports.mod11DacArrecadacao=f.mod11DacArrecadacao,exports.mod11DacCobranca=f.mod11DacCobranca,exports.municipalitiesByUf=e.municipalitiesByUf,exports.municipalityCentroid=n.municipalityCentroid,exports.nearestMunicipality=n.nearestMunicipality,exports.nextBusinessDay=h.nextBusinessDay,exports.normalizePixKey=u.normalizePixKey,exports.normalizeUf=e.normalizeUf,exports.openWhatsApp=m.openWhatsApp,exports.parseChaveNFe=p.parseChaveNFe,exports.parseCodigoBarras=f.parseCodigoBarras,exports.parseLinhaDigitavel=f.parseLinhaDigitavel,exports.parsePixPayload=u.parsePixPayload,exports.pendingGeometryIds=e.pendingGeometryIds,exports.pixCrc16=u.pixCrc16,exports.pixKeyType=u.pixKeyType,exports.pixPayload=u.pixPayload,exports.quantizeScale=c.quantizeScale,exports.regionLegendItems=r.regionLegendItems,exports.resolveMunicipality=e.resolveMunicipality,exports.reverseGeocode=n.reverseGeocode,exports.searchMunicipalities=n.searchMunicipalities,exports.sequentialScale=c.sequentialScale,exports.stateCentroid=n.stateCentroid,exports.statesByRegion=e.statesByRegion,exports.thresholdScale=c.thresholdScale,exports.toWhatsAppNumber=m.toWhatsAppNumber,exports.ufChoices=e.ufChoices,exports.validateBoleto=f.validateBoleto,exports.validateChaveNFe=p.validateChaveNFe,exports.whatsAppUrl=m.whatsAppUrl;
2
2
  //# sourceMappingURL=br.cjs.map
package/dist/br.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"br.cjs","names":[],"sources":["../src/br/index.ts"],"sourcesContent":["// Brazilian locations data (states + cities) — mirrors the `utils/locations`\n// module of tempest-fastapi-sdk.\nexport {\n listStates,\n getState,\n citiesByUf,\n statesByRegion,\n isValidUf,\n normalizeUf,\n isValidCity,\n ufChoices,\n cityChoices,\n} from \"./locations\";\nexport type { UF, BrRegion, BrazilState, Choice } from \"./locations\";\n\n// UF GeoJSON types (the geometry itself is lazy-loaded by BrazilMap).\nimport type { BrUfFeatureCollection } from \"./br-geo\";\nexport type { BrUfFeature, BrUfFeatureCollection, BrUfGeometry, Ring } from \"./br-geo\";\n\n/**\n * Lazily load the bundled simplified UF GeoJSON (~36 KB gzip). Kept out of the\n * synchronous barrel so a data-only import never pulls the geometry.\n */\nexport async function loadBrUfGeoJson(): Promise<BrUfFeatureCollection> {\n const mod = await import(\"./br-geo\");\n return mod.BR_UF_GEOJSON;\n}\n\n// Per-state municipality geometry (lazy, one chunk per UF).\nexport { loadStateMunicipalities } from \"./state-geo\";\nexport type { MunicipalityFeature, StateMunicipalities } from \"./state-geo\";\n\n// Offline geocoding (lazy centroid index).\nexport {\n nearestMunicipality,\n reverseGeocode,\n geocodeMunicipality,\n searchMunicipalities,\n municipalityCentroid,\n stateCentroid,\n} from \"./geocode\";\nexport type { MunicipalityCentroid, NearestMunicipality, ReverseGeocodeResult } from \"./geocode\";\n\n// Components\nexport { BrazilMap } from \"./BrazilMap\";\nexport type { BrazilMapProps, BrazilMapTooltipData } from \"./BrazilMap\";\nexport { BrazilStateMap } from \"./BrazilStateMap\";\nexport type {\n BrazilStateMapProps,\n BrazilStateMapTooltipData,\n Municipality,\n} from \"./BrazilStateMap\";\nexport { BrazilStateCitySelect } from \"./BrazilStateCitySelect\";\nexport type { BrazilStateCitySelectProps, BrazilStateCitySelection } from \"./BrazilStateCitySelect\";\nexport { MunicipalitySearch } from \"./MunicipalitySearch\";\nexport type { MunicipalitySearchProps } from \"./MunicipalitySearch\";\nexport type { GeoMarker } from \"@/geo/types\";\nexport type { MapMarkersProps } from \"./MapMarkers\";\nexport { MapLegend } from \"./MapLegend\";\nexport type { MapLegendProps, LegendItem } from \"./MapLegend\";\n\n// Pix — BR Code (EMV MPM) payload + the QR that carries it.\nexport {\n normalizePixKey,\n parsePixPayload,\n PixError,\n pixCrc16,\n pixKeyType,\n pixPayload,\n} from \"./pix\";\nexport type {\n NormalizedPixKey,\n ParsePixOptions,\n PixData,\n PixDynamicInput,\n PixField,\n PixInput,\n PixKeyType,\n PixStaticInput,\n} from \"./pix\";\nexport { PixQRCode } from \"./PixQRCode\";\nexport type { PixQRCodeLabels, PixQRCodeProps } from \"./PixQRCode\";\n\n// Boleto — 47/48-digit typed line, 44-digit barcode, FEBRABAN check digits.\nexport {\n boletoDueDate,\n BoletoError,\n boletoKind,\n codigoBarrasToLinhaDigitavel,\n fatorVencimento,\n formatLinhaDigitavel,\n linhaDigitavelToCodigoBarras,\n mod10Dac,\n mod11DacArrecadacao,\n mod11DacCobranca,\n parseCodigoBarras,\n parseLinhaDigitavel,\n validateBoleto,\n} from \"./boleto\";\nexport type {\n Boleto,\n BoletoArrecadacao,\n BoletoBanco,\n BoletoEpoch,\n BoletoKind,\n BoletoOptions,\n} from \"./boleto\";\n\n// NF-e / NFC-e / CT-e access key.\nexport {\n chaveNFeCheckDigit,\n ChaveNFeError,\n formatChaveNFe,\n parseChaveNFe,\n validateChaveNFe,\n} from \"./nfe\";\nexport type { ChaveNFe } from \"./nfe\";\n\n// National holidays + business-day arithmetic.\nexport {\n addBusinessDays,\n easterSunday,\n holidaysFor,\n isBusinessDay,\n isHoliday,\n nextBusinessDay,\n} from \"./holidays\";\nexport type { BusinessDayOptions, DateInput, Holiday, HolidayKind } from \"./holidays\";\n\n// Color scales + palettes for choropleths.\nexport {\n sequentialScale,\n quantizeScale,\n thresholdScale,\n SEQUENTIAL_BLUES,\n SEQUENTIAL_GREENS,\n SEQUENTIAL_VIRIDIS,\n DIVERGING_RDBU,\n} from \"./scales\";\nexport type { ColorScale } from \"./scales\";\nexport { REGION_COLORS, regionLegendItems } from \"./regions\";\n"],"mappings":"4iBAuBA,eAAsB,GAAkD,CAEpE,OAAO,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QADW,iBAAA,CAAA,EAAA,CACP,aACf"}
1
+ {"version":3,"file":"br.cjs","names":[],"sources":["../src/br/index.ts"],"sourcesContent":["// Brazilian locations data (states + cities) — mirrors the `utils/locations`\n// module of tempest-fastapi-sdk.\nexport {\n listStates,\n getState,\n citiesByUf,\n statesByRegion,\n isValidUf,\n normalizeUf,\n isValidCity,\n ufChoices,\n cityChoices,\n municipalitiesByUf,\n administrativeRegionsByUf,\n resolveMunicipality,\n datasetVintage,\n pendingGeometryIds,\n} from \"./locations\";\nexport type {\n UF,\n BrRegion,\n BrazilState,\n BrazilMunicipality,\n BrazilAdministrativeRegion,\n Choice,\n} from \"./locations\";\n\n// UF GeoJSON types (the geometry itself is lazy-loaded by BrazilMap).\nimport type { BrUfFeatureCollection } from \"./br-geo\";\nexport type { BrUfFeature, BrUfFeatureCollection, BrUfGeometry, Ring } from \"./br-geo\";\n\n/**\n * Lazily load the bundled simplified UF GeoJSON (~36 KB gzip). Kept out of the\n * synchronous barrel so a data-only import never pulls the geometry.\n */\nexport async function loadBrUfGeoJson(): Promise<BrUfFeatureCollection> {\n const mod = await import(\"./br-geo\");\n return mod.BR_UF_GEOJSON;\n}\n\n// Per-state municipality geometry (lazy, one chunk per UF).\nexport { loadStateMunicipalities } from \"./state-geo\";\nexport type { MunicipalityFeature, StateMunicipalities } from \"./state-geo\";\n\n// Offline geocoding (lazy centroid index).\nexport {\n nearestMunicipality,\n reverseGeocode,\n geocodeMunicipality,\n searchMunicipalities,\n municipalityCentroid,\n stateCentroid,\n} from \"./geocode\";\nexport type { MunicipalityCentroid, NearestMunicipality, ReverseGeocodeResult } from \"./geocode\";\n\n// Components\nexport { BrazilMap } from \"./BrazilMap\";\nexport type { BrazilMapProps, BrazilMapTooltipData } from \"./BrazilMap\";\nexport { BrazilStateMap } from \"./BrazilStateMap\";\nexport type {\n BrazilStateMapProps,\n BrazilStateMapTooltipData,\n Municipality,\n} from \"./BrazilStateMap\";\nexport { BrazilStateCitySelect } from \"./BrazilStateCitySelect\";\nexport type { BrazilStateCitySelectProps, BrazilStateCitySelection } from \"./BrazilStateCitySelect\";\nexport { MunicipalitySearch } from \"./MunicipalitySearch\";\nexport type { MunicipalitySearchProps } from \"./MunicipalitySearch\";\nexport type { GeoMarker } from \"@/geo/types\";\nexport type { MapMarkersProps } from \"./MapMarkers\";\nexport { MapLegend } from \"./MapLegend\";\nexport type { MapLegendProps, LegendItem } from \"./MapLegend\";\n\n// Pix — BR Code (EMV MPM) payload + the QR that carries it.\nexport {\n normalizePixKey,\n parsePixPayload,\n PixError,\n pixCrc16,\n pixKeyType,\n pixPayload,\n} from \"./pix\";\nexport type {\n NormalizedPixKey,\n ParsePixOptions,\n PixData,\n PixDynamicInput,\n PixField,\n PixInput,\n PixKeyType,\n PixStaticInput,\n} from \"./pix\";\nexport { PixQRCode } from \"./PixQRCode\";\nexport type { PixQRCodeLabels, PixQRCodeProps } from \"./PixQRCode\";\n\n// Boleto — 47/48-digit typed line, 44-digit barcode, FEBRABAN check digits.\nexport {\n boletoDueDate,\n BoletoError,\n boletoKind,\n codigoBarrasToLinhaDigitavel,\n fatorVencimento,\n formatLinhaDigitavel,\n linhaDigitavelToCodigoBarras,\n mod10Dac,\n mod11DacArrecadacao,\n mod11DacCobranca,\n parseCodigoBarras,\n parseLinhaDigitavel,\n validateBoleto,\n} from \"./boleto\";\nexport type {\n Boleto,\n BoletoArrecadacao,\n BoletoBanco,\n BoletoEpoch,\n BoletoKind,\n BoletoOptions,\n} from \"./boleto\";\n\n// NF-e / NFC-e / CT-e access key.\nexport {\n chaveNFeCheckDigit,\n ChaveNFeError,\n formatChaveNFe,\n parseChaveNFe,\n validateChaveNFe,\n} from \"./nfe\";\nexport type { ChaveNFe } from \"./nfe\";\n\n// WhatsApp deep link (chat opened with the message ready, never an API send).\nexport { openWhatsApp, toWhatsAppNumber, whatsAppUrl } from \"./whatsapp\";\n\n// National holidays + business-day arithmetic.\nexport {\n addBusinessDays,\n easterSunday,\n holidaysFor,\n isBusinessDay,\n isHoliday,\n nextBusinessDay,\n} from \"./holidays\";\nexport type { BusinessDayOptions, DateInput, Holiday, HolidayKind } from \"./holidays\";\n\n// Color scales + palettes for choropleths.\nexport {\n sequentialScale,\n quantizeScale,\n thresholdScale,\n SEQUENTIAL_BLUES,\n SEQUENTIAL_GREENS,\n SEQUENTIAL_VIRIDIS,\n DIVERGING_RDBU,\n} from \"./scales\";\nexport type { ColorScale } from \"./scales\";\nexport { REGION_COLORS, regionLegendItems } from \"./regions\";\n"],"mappings":"2kBAmCA,eAAsB,GAAkD,CAEpE,OAAO,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QADW,iBAAA,CAAA,EAAA,CACP,aACf"}