@rpcbase/ui 0.280.0 → 0.282.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 (519) hide show
  1. package/dist/components/AddressAutocompleteInput/index.d.ts +1 -1
  2. package/dist/components/AddressAutocompleteInput/index.d.ts.map +1 -1
  3. package/dist/components/ApplePayButton/index.d.ts +1 -1
  4. package/dist/components/ApplePayButton/index.d.ts.map +1 -1
  5. package/dist/components/Checkbox/index.d.ts +1 -1
  6. package/dist/components/Checkbox/index.d.ts.map +1 -1
  7. package/dist/components/DayPickerField/index.d.ts +2 -2
  8. package/dist/components/DayPickerField/index.d.ts.map +1 -1
  9. package/dist/components/Dialog/index.d.ts +9 -9
  10. package/dist/components/Dialog/index.d.ts.map +1 -1
  11. package/dist/components/FilesUploadField/index.d.ts +1 -1
  12. package/dist/components/FilesUploadField/index.d.ts.map +1 -1
  13. package/dist/components/HourPickerField/index.d.ts +2 -2
  14. package/dist/components/HourPickerField/index.d.ts.map +1 -1
  15. package/dist/components/I18nField/index.d.ts +1 -1
  16. package/dist/components/I18nField/index.d.ts.map +1 -1
  17. package/dist/components/Image/index.d.ts +1 -1
  18. package/dist/components/Image/index.d.ts.map +1 -1
  19. package/dist/components/ImagesField/index.d.ts +1 -1
  20. package/dist/components/ImagesField/index.d.ts.map +1 -1
  21. package/dist/components/Input/index.d.ts +1 -1
  22. package/dist/components/Input/index.d.ts.map +1 -1
  23. package/dist/components/Notifications/NotificationsButton.d.ts +1 -1
  24. package/dist/components/Notifications/NotificationsButton.d.ts.map +1 -1
  25. package/dist/components/Notifications/NotificationsDrawer.d.ts +1 -1
  26. package/dist/components/Notifications/NotificationsDrawer.d.ts.map +1 -1
  27. package/dist/components/Notifications/NotificationsSettings.d.ts +1 -1
  28. package/dist/components/Notifications/NotificationsSettings.d.ts.map +1 -1
  29. package/dist/components/PhoneNumberInput/suggestions.d.ts +3 -3
  30. package/dist/components/PhoneNumberInput/suggestions.d.ts.map +1 -1
  31. package/dist/components/Select/index.d.ts +2 -2
  32. package/dist/components/Select/index.d.ts.map +1 -1
  33. package/dist/components/header/MenuPopover/index.d.ts +1 -1
  34. package/dist/components/header/MenuPopover/index.d.ts.map +1 -1
  35. package/dist/index.js +12 -12
  36. package/dist/index10.js +6 -4
  37. package/dist/index10.js.map +1 -1
  38. package/dist/index12.js.map +1 -1
  39. package/dist/index13.js.map +1 -1
  40. package/dist/index14.js +88 -88
  41. package/dist/index14.js.map +1 -1
  42. package/dist/index15.js.map +1 -1
  43. package/dist/index154.js +19 -7
  44. package/dist/index154.js.map +1 -1
  45. package/dist/index16.js +36 -45
  46. package/dist/index16.js.map +1 -1
  47. package/dist/index160.js +3 -3
  48. package/dist/index160.js.map +1 -1
  49. package/dist/index166.js +5 -5
  50. package/dist/index166.js.map +1 -1
  51. package/dist/index172.js +27 -25
  52. package/dist/index172.js.map +1 -1
  53. package/dist/index181.js +1 -1
  54. package/dist/index181.js.map +1 -1
  55. package/dist/index182.js +145 -162
  56. package/dist/index182.js.map +1 -1
  57. package/dist/index184.js +6 -8
  58. package/dist/index184.js.map +1 -1
  59. package/dist/index186.js +2 -8
  60. package/dist/index186.js.map +1 -1
  61. package/dist/index19.js +1 -1
  62. package/dist/index19.js.map +1 -1
  63. package/dist/index195.js +1 -1
  64. package/dist/index195.js.map +1 -1
  65. package/dist/index196.js +2 -2
  66. package/dist/index196.js.map +1 -1
  67. package/dist/index197.js +1 -1
  68. package/dist/index197.js.map +1 -1
  69. package/dist/index198.js +16 -15
  70. package/dist/index198.js.map +1 -1
  71. package/dist/index199.js +13 -17
  72. package/dist/index199.js.map +1 -1
  73. package/dist/index200.js +3 -2
  74. package/dist/index200.js.map +1 -1
  75. package/dist/index207.js +5 -90
  76. package/dist/index207.js.map +1 -1
  77. package/dist/index208.js +15 -3
  78. package/dist/index208.js.map +1 -1
  79. package/dist/index209.js +102 -22
  80. package/dist/index209.js.map +1 -1
  81. package/dist/index210.js +3 -28
  82. package/dist/index210.js.map +1 -1
  83. package/dist/index211.js +23 -19
  84. package/dist/index211.js.map +1 -1
  85. package/dist/index212.js +27 -6
  86. package/dist/index212.js.map +1 -1
  87. package/dist/index213.js +19 -14
  88. package/dist/index213.js.map +1 -1
  89. package/dist/index214.js +5 -6
  90. package/dist/index214.js.map +1 -1
  91. package/dist/index215.js +14 -26
  92. package/dist/index215.js.map +1 -1
  93. package/dist/index216.js +7 -22
  94. package/dist/index216.js.map +1 -1
  95. package/dist/index217.js +27 -6
  96. package/dist/index217.js.map +1 -1
  97. package/dist/index218.js +23 -5
  98. package/dist/index218.js.map +1 -1
  99. package/dist/index219.js +6 -4
  100. package/dist/index219.js.map +1 -1
  101. package/dist/index220.js +5 -4
  102. package/dist/index220.js.map +1 -1
  103. package/dist/index221.js +4 -24
  104. package/dist/index221.js.map +1 -1
  105. package/dist/index222.js +4 -3
  106. package/dist/index222.js.map +1 -1
  107. package/dist/index223.js +21 -21
  108. package/dist/index223.js.map +1 -1
  109. package/dist/index224.js +3 -23
  110. package/dist/index224.js.map +1 -1
  111. package/dist/index225.js +23 -6
  112. package/dist/index225.js.map +1 -1
  113. package/dist/index226.js +22 -9
  114. package/dist/index226.js.map +1 -1
  115. package/dist/index227.js +5 -17
  116. package/dist/index227.js.map +1 -1
  117. package/dist/index228.js +8 -49
  118. package/dist/index228.js.map +1 -1
  119. package/dist/index229.js +18 -5
  120. package/dist/index229.js.map +1 -1
  121. package/dist/index230.js +50 -19
  122. package/dist/index230.js.map +1 -1
  123. package/dist/index231.js +20 -28
  124. package/dist/index231.js.map +1 -1
  125. package/dist/index232.js +27 -104
  126. package/dist/index232.js.map +1 -1
  127. package/dist/index233.js +98 -33
  128. package/dist/index233.js.map +1 -1
  129. package/dist/index234.js +28 -113
  130. package/dist/index234.js.map +1 -1
  131. package/dist/index235.js +117 -11
  132. package/dist/index235.js.map +1 -1
  133. package/dist/index236.js +12 -4
  134. package/dist/index236.js.map +1 -1
  135. package/dist/index237.js +4 -15
  136. package/dist/index237.js.map +1 -1
  137. package/dist/index238.js +13 -62
  138. package/dist/index238.js.map +1 -1
  139. package/dist/index239.js +64 -9
  140. package/dist/index239.js.map +1 -1
  141. package/dist/index240.js +10 -106
  142. package/dist/index240.js.map +1 -1
  143. package/dist/index241.js +107 -13
  144. package/dist/index241.js.map +1 -1
  145. package/dist/index242.js +16 -13
  146. package/dist/index242.js.map +1 -1
  147. package/dist/index243.js +13 -5
  148. package/dist/index243.js.map +1 -1
  149. package/dist/index244.js +4 -316
  150. package/dist/index244.js.map +1 -1
  151. package/dist/index245.js +315 -58
  152. package/dist/index245.js.map +1 -1
  153. package/dist/index246.js +58 -223
  154. package/dist/index246.js.map +1 -1
  155. package/dist/index247.js +215 -318
  156. package/dist/index247.js.map +1 -1
  157. package/dist/index248.js +250 -306
  158. package/dist/index248.js.map +1 -1
  159. package/dist/index249.js +308 -173
  160. package/dist/index249.js.map +1 -1
  161. package/dist/index250.js +178 -7
  162. package/dist/index250.js.map +1 -1
  163. package/dist/index251.js +8 -15
  164. package/dist/index251.js.map +1 -1
  165. package/dist/index252.js +41 -5
  166. package/dist/index252.js.map +1 -1
  167. package/dist/index253.js +46 -38
  168. package/dist/index253.js.map +1 -1
  169. package/dist/index254.js +7 -50
  170. package/dist/index254.js.map +1 -1
  171. package/dist/index255.js +49 -6
  172. package/dist/index255.js.map +1 -1
  173. package/dist/index256.js +48 -46
  174. package/dist/index256.js.map +1 -1
  175. package/dist/index257.js +6 -51
  176. package/dist/index257.js.map +1 -1
  177. package/dist/index258.js +10 -9
  178. package/dist/index258.js.map +1 -1
  179. package/dist/index259.js +60 -8
  180. package/dist/index259.js.map +1 -1
  181. package/dist/index26.js.map +1 -1
  182. package/dist/index260.js +41 -60
  183. package/dist/index260.js.map +1 -1
  184. package/dist/index261.js +88 -34
  185. package/dist/index261.js.map +1 -1
  186. package/dist/index262.js +47 -94
  187. package/dist/index262.js.map +1 -1
  188. package/dist/index263.js +36 -49
  189. package/dist/index263.js.map +1 -1
  190. package/dist/index264.js +45 -32
  191. package/dist/index264.js.map +1 -1
  192. package/dist/index265.js +47 -46
  193. package/dist/index265.js.map +1 -1
  194. package/dist/index266.js +18 -48
  195. package/dist/index266.js.map +1 -1
  196. package/dist/index267.js +174 -15
  197. package/dist/index267.js.map +1 -1
  198. package/dist/index268.js +47 -169
  199. package/dist/index268.js.map +1 -1
  200. package/dist/index269.js +17 -34
  201. package/dist/index269.js.map +1 -1
  202. package/dist/index270.js +59 -10
  203. package/dist/index270.js.map +1 -1
  204. package/dist/index271.js +10 -66
  205. package/dist/index271.js.map +1 -1
  206. package/dist/index272.js +4 -4
  207. package/dist/index273.js +71 -69
  208. package/dist/index273.js.map +1 -1
  209. package/dist/index274.js +158 -152
  210. package/dist/index274.js.map +1 -1
  211. package/dist/index275.js +7 -13
  212. package/dist/index275.js.map +1 -1
  213. package/dist/index276.js +12 -5
  214. package/dist/index276.js.map +1 -1
  215. package/dist/index277.js +12 -6
  216. package/dist/index277.js.map +1 -1
  217. package/dist/index278.js +11 -12
  218. package/dist/index278.js.map +1 -1
  219. package/dist/index279.js +65 -9
  220. package/dist/index279.js.map +1 -1
  221. package/dist/index280.js +6 -74
  222. package/dist/index280.js.map +1 -1
  223. package/dist/index281.js +25 -6
  224. package/dist/index281.js.map +1 -1
  225. package/dist/index282.js +24 -24
  226. package/dist/index282.js.map +1 -1
  227. package/dist/index283.js +125 -24
  228. package/dist/index283.js.map +1 -1
  229. package/dist/index284.js +52 -115
  230. package/dist/index284.js.map +1 -1
  231. package/dist/index285.js +59 -55
  232. package/dist/index285.js.map +1 -1
  233. package/dist/index286.js +48 -61
  234. package/dist/index286.js.map +1 -1
  235. package/dist/index287.js +5 -48
  236. package/dist/index287.js.map +1 -1
  237. package/dist/index288.js +14 -8
  238. package/dist/index288.js.map +1 -1
  239. package/dist/index289.js +18 -14
  240. package/dist/index289.js.map +1 -1
  241. package/dist/index290.js +10 -17
  242. package/dist/index290.js.map +1 -1
  243. package/dist/index291.js +23 -11
  244. package/dist/index291.js.map +1 -1
  245. package/dist/index292.js +52 -25
  246. package/dist/index292.js.map +1 -1
  247. package/dist/index293.js +6 -52
  248. package/dist/index293.js.map +1 -1
  249. package/dist/index294.js +137 -5
  250. package/dist/index294.js.map +1 -1
  251. package/dist/index295.js +59 -149
  252. package/dist/index295.js.map +1 -1
  253. package/dist/index296.js +90 -49
  254. package/dist/index296.js.map +1 -1
  255. package/dist/index297.js +11 -117
  256. package/dist/index297.js.map +1 -1
  257. package/dist/index298.js +863 -11
  258. package/dist/index298.js.map +1 -1
  259. package/dist/index299.js +21 -865
  260. package/dist/index299.js.map +1 -1
  261. package/dist/index3.js.map +1 -1
  262. package/dist/index300.js +417 -27
  263. package/dist/index300.js.map +1 -1
  264. package/dist/index301.js +774 -483
  265. package/dist/index301.js.map +1 -1
  266. package/dist/index302.js +7436 -803
  267. package/dist/index302.js.map +1 -1
  268. package/dist/index303.js +7 -7429
  269. package/dist/index303.js.map +1 -1
  270. package/dist/index304.js +12 -6
  271. package/dist/index304.js.map +1 -1
  272. package/dist/index305.js +5 -12
  273. package/dist/index305.js.map +1 -1
  274. package/dist/index306.js +3 -3
  275. package/dist/index306.js.map +1 -1
  276. package/dist/index307.js +469 -5
  277. package/dist/index307.js.map +1 -1
  278. package/dist/index308.js +32 -464
  279. package/dist/index308.js.map +1 -1
  280. package/dist/index309.js +18 -36
  281. package/dist/index309.js.map +1 -1
  282. package/dist/index310.js +28 -17
  283. package/dist/index310.js.map +1 -1
  284. package/dist/index311.js +4 -30
  285. package/dist/index311.js.map +1 -1
  286. package/dist/index312.js +59 -4
  287. package/dist/index312.js.map +1 -1
  288. package/dist/index313.js +11 -59
  289. package/dist/index313.js.map +1 -1
  290. package/dist/index314.js +5 -9
  291. package/dist/index314.js.map +1 -1
  292. package/dist/index315.js +9 -5
  293. package/dist/index315.js.map +1 -1
  294. package/dist/index316.js +12 -9
  295. package/dist/index316.js.map +1 -1
  296. package/dist/index317.js +3 -13
  297. package/dist/index317.js.map +1 -1
  298. package/dist/index318.js +17 -3
  299. package/dist/index318.js.map +1 -1
  300. package/dist/index319.js +23 -14
  301. package/dist/index319.js.map +1 -1
  302. package/dist/index320.js +39 -23
  303. package/dist/index320.js.map +1 -1
  304. package/dist/index321.js +5 -41
  305. package/dist/index321.js.map +1 -1
  306. package/dist/index322.js +25 -5
  307. package/dist/index322.js.map +1 -1
  308. package/dist/index323.js +18 -24
  309. package/dist/index323.js.map +1 -1
  310. package/dist/index324.js +32 -17
  311. package/dist/index324.js.map +1 -1
  312. package/dist/index325.js +5 -34
  313. package/dist/index325.js.map +1 -1
  314. package/dist/index326.js +9 -5
  315. package/dist/index326.js.map +1 -1
  316. package/dist/index327.js +7 -8
  317. package/dist/index327.js.map +1 -1
  318. package/dist/index328.js +9 -8
  319. package/dist/index328.js.map +1 -1
  320. package/dist/index329.js +10 -9
  321. package/dist/index329.js.map +1 -1
  322. package/dist/index330.js +7 -10
  323. package/dist/index330.js.map +1 -1
  324. package/dist/index331.js +75 -7
  325. package/dist/index331.js.map +1 -1
  326. package/dist/index332.js +153 -66
  327. package/dist/index332.js.map +1 -1
  328. package/dist/index333.js +99 -147
  329. package/dist/index333.js.map +1 -1
  330. package/dist/index334.js +13 -113
  331. package/dist/index334.js.map +1 -1
  332. package/dist/index335.js +78 -12
  333. package/dist/index335.js.map +1 -1
  334. package/dist/index336.js +23 -57
  335. package/dist/index336.js.map +1 -1
  336. package/dist/index337.js +12 -45
  337. package/dist/index337.js.map +1 -1
  338. package/dist/index338.js +16 -13
  339. package/dist/index338.js.map +1 -1
  340. package/dist/index339.js +100 -15
  341. package/dist/index339.js.map +1 -1
  342. package/dist/index340.js +50 -95
  343. package/dist/index340.js.map +1 -1
  344. package/dist/index341.js +57 -5
  345. package/dist/index341.js.map +1 -1
  346. package/dist/index342.js +41 -78
  347. package/dist/index342.js.map +1 -1
  348. package/dist/index343.js +100 -58
  349. package/dist/index343.js.map +1 -1
  350. package/dist/index344.js +46 -104
  351. package/dist/index344.js.map +1 -1
  352. package/dist/index345.js +39 -51
  353. package/dist/index345.js.map +1 -1
  354. package/dist/index346.js +143 -42
  355. package/dist/index346.js.map +1 -1
  356. package/dist/index347.js +122 -123
  357. package/dist/index347.js.map +1 -1
  358. package/dist/index348.js +224 -108
  359. package/dist/index348.js.map +1 -1
  360. package/dist/index349.js +158 -174
  361. package/dist/index349.js.map +1 -1
  362. package/dist/index350.js +213 -144
  363. package/dist/index350.js.map +1 -1
  364. package/dist/index351.js +5 -309
  365. package/dist/index351.js.map +1 -1
  366. package/dist/index352.js +6 -5
  367. package/dist/index352.js.map +1 -1
  368. package/dist/index353.js +7 -6
  369. package/dist/index353.js.map +1 -1
  370. package/dist/index354.js +4 -5
  371. package/dist/index354.js.map +1 -1
  372. package/dist/index355.js +4 -4
  373. package/dist/index355.js.map +1 -1
  374. package/dist/index356.js +21 -6
  375. package/dist/index356.js.map +1 -1
  376. package/dist/index357.js +10 -21
  377. package/dist/index357.js.map +1 -1
  378. package/dist/index358.js +128 -10
  379. package/dist/index358.js.map +1 -1
  380. package/dist/index359.js +36 -122
  381. package/dist/index359.js.map +1 -1
  382. package/dist/index360.js +64 -38
  383. package/dist/index360.js.map +1 -1
  384. package/dist/index361.js +115 -66
  385. package/dist/index361.js.map +1 -1
  386. package/dist/index362.js +485 -112
  387. package/dist/index362.js.map +1 -1
  388. package/dist/index363.js +7 -490
  389. package/dist/index363.js.map +1 -1
  390. package/dist/index364.js +1 -1
  391. package/dist/index364.js.map +1 -1
  392. package/dist/index367.js +2 -9
  393. package/dist/index367.js.map +1 -1
  394. package/dist/index368.js +26 -5
  395. package/dist/index368.js.map +1 -1
  396. package/dist/index369.js +43 -27
  397. package/dist/index369.js.map +1 -1
  398. package/dist/index370.js +35 -46
  399. package/dist/index370.js.map +1 -1
  400. package/dist/index371.js +16 -27
  401. package/dist/index371.js.map +1 -1
  402. package/dist/index372.js +41 -16
  403. package/dist/index372.js.map +1 -1
  404. package/dist/index373.js +11 -42
  405. package/dist/index373.js.map +1 -1
  406. package/dist/index374.js +10 -14
  407. package/dist/index374.js.map +1 -1
  408. package/dist/index375.js +51 -9
  409. package/dist/index375.js.map +1 -1
  410. package/dist/index376.js +40 -53
  411. package/dist/index376.js.map +1 -1
  412. package/dist/index377.js +17 -43
  413. package/dist/index377.js.map +1 -1
  414. package/dist/index378.js +4 -15
  415. package/dist/index378.js.map +1 -1
  416. package/dist/index379.js +4 -4
  417. package/dist/index379.js.map +1 -1
  418. package/dist/index380.js +9 -4
  419. package/dist/index380.js.map +1 -1
  420. package/dist/index381.js +304 -9
  421. package/dist/index381.js.map +1 -1
  422. package/dist/index382.js +4 -339
  423. package/dist/index382.js.map +1 -1
  424. package/dist/index383.js +21 -5
  425. package/dist/index383.js.map +1 -1
  426. package/dist/index384.js +106 -16
  427. package/dist/index384.js.map +1 -1
  428. package/dist/index385.js +19 -109
  429. package/dist/index385.js.map +1 -1
  430. package/dist/index386.js +18 -18
  431. package/dist/index386.js.map +1 -1
  432. package/dist/index387.js +14 -19
  433. package/dist/index387.js.map +1 -1
  434. package/dist/index388.js +12 -4
  435. package/dist/index388.js.map +1 -1
  436. package/dist/index389.js +113 -20
  437. package/dist/index389.js.map +1 -1
  438. package/dist/index390.js +5 -11
  439. package/dist/index390.js.map +1 -1
  440. package/dist/index391.js +28 -85
  441. package/dist/index391.js.map +1 -1
  442. package/dist/index392.js +9 -9
  443. package/dist/index392.js.map +1 -1
  444. package/dist/index393.js +6 -29
  445. package/dist/index393.js.map +1 -1
  446. package/dist/index394.js +254 -10
  447. package/dist/index394.js.map +1 -1
  448. package/dist/index395.js +12 -6
  449. package/dist/index395.js.map +1 -1
  450. package/dist/index396.js +11 -252
  451. package/dist/index396.js.map +1 -1
  452. package/dist/index397.js +6 -11
  453. package/dist/index397.js.map +1 -1
  454. package/dist/index398.js +22 -10
  455. package/dist/index398.js.map +1 -1
  456. package/dist/index399.js +22 -6
  457. package/dist/index399.js.map +1 -1
  458. package/dist/index4.js.map +1 -1
  459. package/dist/index400.js +103 -21
  460. package/dist/index400.js.map +1 -1
  461. package/dist/index401.js +15 -23
  462. package/dist/index401.js.map +1 -1
  463. package/dist/index402.js +11 -108
  464. package/dist/index402.js.map +1 -1
  465. package/dist/index403.js +10 -15
  466. package/dist/index403.js.map +1 -1
  467. package/dist/index404.js +237 -10
  468. package/dist/index404.js.map +1 -1
  469. package/dist/index405.js +27 -9
  470. package/dist/index405.js.map +1 -1
  471. package/dist/index406.js +33 -238
  472. package/dist/index406.js.map +1 -1
  473. package/dist/index407.js +11 -30
  474. package/dist/index407.js.map +1 -1
  475. package/dist/index408.js +118 -48
  476. package/dist/index408.js.map +1 -1
  477. package/dist/index409.js +39 -11
  478. package/dist/index409.js.map +1 -1
  479. package/dist/index410.js +18 -121
  480. package/dist/index410.js.map +1 -1
  481. package/dist/index411.js +11 -39
  482. package/dist/index411.js.map +1 -1
  483. package/dist/index412.js +21 -24
  484. package/dist/index412.js.map +1 -1
  485. package/dist/index413.js +17 -11
  486. package/dist/index413.js.map +1 -1
  487. package/dist/index414.js +10 -20
  488. package/dist/index414.js.map +1 -1
  489. package/dist/index415.js +4 -17
  490. package/dist/index415.js.map +1 -1
  491. package/dist/index416.js +300 -14
  492. package/dist/index416.js.map +1 -1
  493. package/dist/index417.js +61 -323
  494. package/dist/index417.js.map +1 -1
  495. package/dist/index418.js +4 -63
  496. package/dist/index418.js.map +1 -1
  497. package/dist/index419.js +28 -4
  498. package/dist/index419.js.map +1 -1
  499. package/dist/index420.js +468 -25
  500. package/dist/index420.js.map +1 -1
  501. package/dist/index421.js +250 -452
  502. package/dist/index421.js.map +1 -1
  503. package/dist/index6.js.map +1 -1
  504. package/dist/index7.js +91 -133
  505. package/dist/index7.js.map +1 -1
  506. package/dist/index70.js +2 -2
  507. package/dist/index70.js.map +1 -1
  508. package/dist/index71.js +11 -4
  509. package/dist/index71.js.map +1 -1
  510. package/dist/index72.js +1 -3
  511. package/dist/index72.js.map +1 -1
  512. package/dist/index8.js.map +1 -1
  513. package/dist/index9.js +16 -19
  514. package/dist/index9.js.map +1 -1
  515. package/dist/test-only/TestCoverageTestBadge/index.d.ts +1 -1
  516. package/dist/test-only/TestCoverageTestBadge/index.d.ts.map +1 -1
  517. package/package.json +15 -15
  518. package/dist/index422.js +0 -272
  519. package/dist/index422.js.map +0 -1
package/dist/index358.js CHANGED
@@ -1,14 +1,132 @@
1
- import { getCountries as e } from "./index355.js";
2
- //#region src/components/PhoneNumberInput/countries.ts
3
- var t = /* @__PURE__ */ new Set([
4
- "IM",
5
- "GG",
6
- "JE"
7
- ]), n = e().filter((e) => !t.has(e));
8
- function r() {
9
- return n;
1
+ import { getCountryCallingCode as e } from "./index355.js";
2
+ import { getCountryList as t } from "./index357.js";
3
+ var n = t(), r = /* @__PURE__ */ new Map(), i = "__default_locale__", a = Array.from(new Set(n.map((t) => e(t)))).sort((e, t) => t.length - e.length);
4
+ a.reduce((e, t) => Math.max(e, t.length), 0);
5
+ var o = [
6
+ "0011",
7
+ "001",
8
+ "011",
9
+ "00",
10
+ "810"
11
+ ];
12
+ function s(e) {
13
+ return e && n.includes(e) ? e : "US";
14
+ }
15
+ function c(e) {
16
+ if (typeof Intl > "u" || Intl.DisplayNames === void 0) return null;
17
+ try {
18
+ let t = Array.isArray(e) ? e : e ? [e] : void 0;
19
+ return new Intl.DisplayNames(t, { type: "region" });
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ function l(t) {
25
+ let r = c(t), i = c("en");
26
+ return n.map((t) => {
27
+ let n = e(t), a = r?.of(t) ?? i?.of(t) ?? t, o = i?.of(t) ?? a, s = x(t), c = Array.from(new Set([
28
+ a,
29
+ o,
30
+ t.toUpperCase(),
31
+ t.toLowerCase(),
32
+ ...s
33
+ ].filter(Boolean)));
34
+ return {
35
+ value: t,
36
+ name: a,
37
+ dialCode: n,
38
+ label: `${a} (+${n})`,
39
+ flag: g(t),
40
+ searchableTokens: c,
41
+ normalizedSearchableTokens: c.map((e) => y(e))
42
+ };
43
+ }).sort((e, t) => {
44
+ let n = u(e.value), r = u(t.value);
45
+ return n === r ? e.name.localeCompare(t.name) : n - r;
46
+ });
47
+ }
48
+ function u(t) {
49
+ return t === "US" ? 0 : t === "CA" ? 1 : e(t) === "1" ? 2 : 3;
50
+ }
51
+ function d(e) {
52
+ return e ? Array.isArray(e) ? e.join("\0") : e : i;
53
+ }
54
+ function f(e) {
55
+ if (e !== i) {
56
+ if (e.includes("\0")) {
57
+ let t = e.split("\0").filter(Boolean);
58
+ return t.length === 0 ? void 0 : t.length === 1 ? t[0] ?? void 0 : t;
59
+ }
60
+ return e;
61
+ }
62
+ }
63
+ function p(e, t) {
64
+ let n = r.get(t);
65
+ if (n) return n;
66
+ let i = l(e);
67
+ return r.set(t, i), i;
68
+ }
69
+ function m(e) {
70
+ return {
71
+ code: e.value,
72
+ name: e.name,
73
+ dialCode: e.dialCode,
74
+ flag: e.flag
75
+ };
76
+ }
77
+ function h(t) {
78
+ return {
79
+ code: t,
80
+ name: t,
81
+ dialCode: e(t),
82
+ flag: g(t)
83
+ };
84
+ }
85
+ function g(e) {
86
+ let t = e?.toUpperCase();
87
+ if (!t || t.length !== 2 || /[^A-Z]/.test(t)) return "";
88
+ let n = 127397;
89
+ return String.fromCodePoint(t.charCodeAt(0) + n, t.charCodeAt(1) + n);
90
+ }
91
+ var _ = /[\u0300-\u036f]/g;
92
+ function v(e) {
93
+ return e.normalize("NFD").replace(_, "");
94
+ }
95
+ function y(e) {
96
+ return v(e).toLowerCase();
97
+ }
98
+ function b(e, t) {
99
+ let n = 2 ** 53 - 1;
100
+ for (let r of e) {
101
+ let e = r.indexOf(t);
102
+ e >= 0 && e < n && (n = e);
103
+ }
104
+ return n === 2 ** 53 - 1 ? 2 ** 53 - 1 : n;
105
+ }
106
+ function x(e) {
107
+ switch (e) {
108
+ case "US": return [
109
+ "USA",
110
+ "United States",
111
+ "America",
112
+ "United States of America"
113
+ ];
114
+ case "GB": return [
115
+ "UK",
116
+ "United Kingdom",
117
+ "Great Britain",
118
+ "England"
119
+ ];
120
+ case "AE": return ["UAE", "United Arab Emirates"];
121
+ case "KR": return ["South Korea", "Korea"];
122
+ case "CN": return ["China", "PRC"];
123
+ case "CD": return ["DRC", "Congo-Kinshasa"];
124
+ case "CG": return ["Congo-Brazzaville"];
125
+ case "BR": return ["Brazil"];
126
+ default: return [];
127
+ }
10
128
  }
11
129
  //#endregion
12
- export { r as getCountryList };
130
+ export { o as COMMON_IDD_PREFIXES, a as COUNTRY_DIAL_CODES, h as buildFallbackSelectedCountry, p as getCachedCountryOptions, d as getLocaleCacheKey, s as getValidCountry, y as normalizeSearchValue, b as optionMatchIndex, f as parseLocaleCacheKey, m as toSelectedCountry };
13
131
 
14
132
  //# sourceMappingURL=index358.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index358.js","names":["getCountries","CountryCode","EXCLUDED_COUNTRIES","EXCLUDED_SET","Set","FILTERED_COUNTRIES","filter","code","has","getCountryList"],"sources":["../src/components/PhoneNumberInput/countries.ts"],"sourcesContent":["import { getCountries } from \"libphonenumber-js\"\nimport type { CountryCode } from \"libphonenumber-js\"\n\n\nconst EXCLUDED_COUNTRIES: CountryCode[] = [\"IM\", \"GG\", \"JE\"]\nconst EXCLUDED_SET = new Set(EXCLUDED_COUNTRIES)\n\nconst FILTERED_COUNTRIES = getCountries().filter((code) => !EXCLUDED_SET.has(code))\n\nexport function getCountryList(): CountryCode[] {\n return FILTERED_COUNTRIES\n}\n"],"mappings":";;AAKA,IAAMG,oBAAe,IAAIC,IAAIF;CADc;CAAM;CAAM;AAC1BA,CAAkB,GAEzCG,IAAqBL,EAAa,CAAC,CAACM,QAAQC,MAAS,CAACJ,EAAaK,IAAID,CAAI,CAAC;AAElF,SAAgBE,IAAgC;CAC9C,OAAOJ;AACT"}
1
+ {"version":3,"file":"index358.js","names":[],"sources":["../src/components/PhoneNumberInput/country-options.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { getCountryCallingCode } from \"libphonenumber-js\"\n\nimport type { CountryOption, PhoneNumberSelectedCountry } from \"./types\"\nimport { getCountryList } from \"./countries\"\n\n\nexport const DEFAULT_COUNTRY: CountryCode = \"US\"\nconst COUNTRY_OPTIONS = getCountryList()\n\nconst COUNTRY_OPTIONS_CACHE = new Map<string, CountryOption[]>()\nconst DEFAULT_LOCALE_CACHE_KEY = \"__default_locale__\"\nexport const COUNTRY_DIAL_CODES = Array.from(\n new Set(COUNTRY_OPTIONS.map((code) => getCountryCallingCode(code)))\n).sort((a, b) => b.length - a.length)\nexport const MAX_DIAL_CODE_LENGTH = COUNTRY_DIAL_CODES.reduce(\n (max, dial) => Math.max(max, dial.length),\n 0\n)\nexport const COMMON_IDD_PREFIXES = [\"0011\", \"001\", \"011\", \"00\", \"810\"]\n\nexport function getValidCountry(input: CountryCode | undefined) {\n if (!input) {\n return DEFAULT_COUNTRY\n }\n\n return COUNTRY_OPTIONS.includes(input) ? input : DEFAULT_COUNTRY\n}\n\nfunction createDisplayNames(locale?: string | string[]) {\n if (typeof Intl === \"undefined\" || typeof Intl.DisplayNames === \"undefined\") {\n return null\n }\n\n try {\n const locales = Array.isArray(locale) ? locale : locale ? [locale] : undefined\n return new Intl.DisplayNames(locales, { type: \"region\" })\n } catch {\n return null\n }\n}\n\nfunction buildCountryOptions(locale?: string | string[]) {\n const displayNames = createDisplayNames(locale)\n const englishDisplayNames = createDisplayNames(\"en\")\n\n return COUNTRY_OPTIONS\n .map((country) => {\n const dialCode = getCountryCallingCode(country)\n const localizedName = displayNames?.of(country) ?? englishDisplayNames?.of(country) ?? country\n const englishName = englishDisplayNames?.of(country) ?? localizedName\n const aliasTokens = getCountryAliases(country)\n const searchableTokens = Array.from(\n new Set(\n [localizedName, englishName, country.toUpperCase(), country.toLowerCase(), ...aliasTokens].filter(\n Boolean\n )\n )\n ) as string[]\n return {\n value: country,\n name: localizedName,\n dialCode,\n label: `${localizedName} (+${dialCode})`,\n flag: countryCodeToFlagEmoji(country),\n searchableTokens,\n normalizedSearchableTokens: searchableTokens.map((token) => normalizeSearchValue(token)),\n }\n })\n .sort((a, b) => {\n const priorityA = getCountryPriority(a.value)\n const priorityB = getCountryPriority(b.value)\n if (priorityA !== priorityB) {\n return priorityA - priorityB\n }\n return a.name.localeCompare(b.name)\n })\n}\n\nfunction getCountryPriority(code: CountryCode) {\n if (code === \"US\") return 0\n if (code === \"CA\") return 1\n if (getCountryCallingCode(code) === \"1\") return 2\n return 3\n}\n\nexport function getLocaleCacheKey(locale?: string | string[]) {\n if (!locale) {\n return DEFAULT_LOCALE_CACHE_KEY\n }\n if (Array.isArray(locale)) {\n return locale.join(\"\\u0000\")\n }\n return locale\n}\n\nexport function parseLocaleCacheKey(cacheKey: string): string | string[] | undefined {\n if (cacheKey === DEFAULT_LOCALE_CACHE_KEY) {\n return undefined\n }\n\n if (cacheKey.includes(\"\\u0000\")) {\n const parts = cacheKey.split(\"\\u0000\").filter(Boolean)\n if (parts.length === 0) {\n return undefined\n }\n if (parts.length === 1) {\n return parts[0] ?? undefined\n }\n return parts\n }\n\n return cacheKey\n}\n\nexport function getCachedCountryOptions(locale: string | string[] | undefined, cacheKey: string) {\n const cached = COUNTRY_OPTIONS_CACHE.get(cacheKey)\n if (cached) {\n return cached\n }\n const built = buildCountryOptions(locale)\n COUNTRY_OPTIONS_CACHE.set(cacheKey, built)\n return built\n}\n\nexport function toSelectedCountry(option: CountryOption): PhoneNumberSelectedCountry {\n return {\n code: option.value,\n name: option.name,\n dialCode: option.dialCode,\n flag: option.flag,\n }\n}\n\nexport function buildFallbackSelectedCountry(country: CountryCode): PhoneNumberSelectedCountry {\n return {\n code: country,\n name: country,\n dialCode: getCountryCallingCode(country),\n flag: countryCodeToFlagEmoji(country),\n }\n}\n\nfunction countryCodeToFlagEmoji(country: CountryCode) {\n const upper = country?.toUpperCase()\n\n if (!upper || upper.length !== 2 || /[^A-Z]/.test(upper)) {\n return \"\"\n }\n\n const base = 127397\n return String.fromCodePoint(\n upper.charCodeAt(0) + base,\n upper.charCodeAt(1) + base\n )\n}\n\nconst DIACRITICS_REGEX = /[\\u0300-\\u036f]/g\n\nfunction stripDiacritics(value: string) {\n return value.normalize(\"NFD\").replace(DIACRITICS_REGEX, \"\")\n}\n\nexport function normalizeSearchValue(value: string) {\n return stripDiacritics(value).toLowerCase()\n}\n\nexport function optionMatchIndex(tokens: string[], query: string) {\n let best = Number.MAX_SAFE_INTEGER\n for (const token of tokens) {\n const index = token.indexOf(query)\n if (index >= 0 && index < best) {\n best = index\n }\n }\n return best === Number.MAX_SAFE_INTEGER ? Number.MAX_SAFE_INTEGER : best\n}\n\nfunction getCountryAliases(code: CountryCode): string[] {\n switch (code) {\n case \"US\":\n return [\"USA\", \"United States\", \"America\", \"United States of America\"]\n case \"GB\":\n return [\"UK\", \"United Kingdom\", \"Great Britain\", \"England\"]\n case \"AE\":\n return [\"UAE\", \"United Arab Emirates\"]\n case \"KR\":\n return [\"South Korea\", \"Korea\"]\n case \"CN\":\n return [\"China\", \"PRC\"]\n case \"CD\":\n return [\"DRC\", \"Congo-Kinshasa\"]\n case \"CG\":\n return [\"Congo-Brazzaville\"]\n case \"BR\":\n return [\"Brazil\"]\n default:\n return []\n }\n}\n\n"],"mappings":";;AAQA,IAAM,IAAkB,EAAe,GAEjC,oBAAwB,IAAI,IAA6B,GACzD,IAA2B,sBACpB,IAAqB,MAAM,KACtC,IAAI,IAAI,EAAgB,KAAK,MAAS,EAAsB,CAAI,CAAC,CAAC,CACpE,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM;AACA,EAAmB,QACpD,GAAK,MAAS,KAAK,IAAI,GAAK,EAAK,MAAM,GACxC,CACF;AACA,IAAa,IAAsB;CAAC;CAAQ;CAAO;CAAO;CAAM;AAAK;AAErE,SAAgB,EAAgB,GAAgC;CAK9D,OAJK,KAIE,EAAgB,SAAS,CAAK,IAAI,IAAA;AAC3C;AAEA,SAAS,EAAmB,GAA4B;CACtD,IAAI,OAAO,OAAS,OAAsB,KAAK,iBA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AA6D;AACtE;AAEA,SAAS,EAAkB,GAA6B;CACtD,QAAQ,GAAR;EACA,KAAK,MACH,OAAO;GAAC;GAAO;GAAiB;GAAW;EAA0B;EACvE,KAAK,MACH,OAAO;GAAC;GAAM;GAAkB;GAAiB;EAAS;EAC5D,KAAK,MACH,OAAO,CAAC,OAAO,sBAAsB;EACvC,KAAK,MACH,OAAO,CAAC,eAAe,OAAO;EAChC,KAAK,MACH,OAAO,CAAC,SAAS,KAAK;EACxB,KAAK,MACH,OAAO,CAAC,OAAO,gBAAgB;EACjC,KAAK,MACH,OAAO,CAAC,mBAAmB;EAC7B,KAAK,MACH,OAAO,CAAC,QAAQ;EAClB,SACE,OAAO,CAAA;CACT;AACF"}
package/dist/index359.js CHANGED
@@ -1,132 +1,46 @@
1
- import { getCountryCallingCode as e } from "./index356.js";
2
- import { getCountryList as t } from "./index358.js";
3
- var n = t(), r = /* @__PURE__ */ new Map(), i = "__default_locale__", a = Array.from(new Set(n.map((t) => e(t)))).sort((e, t) => t.length - e.length);
4
- a.reduce((e, t) => Math.max(e, t.length), 0);
5
- var o = [
6
- "0011",
7
- "001",
8
- "011",
9
- "00",
10
- "810"
11
- ];
12
- function s(e) {
13
- return e && n.includes(e) ? e : "US";
14
- }
15
- function c(e) {
16
- if (typeof Intl > "u" || Intl.DisplayNames === void 0) return null;
17
- try {
18
- let t = Array.isArray(e) ? e : e ? [e] : void 0;
19
- return new Intl.DisplayNames(t, { type: "region" });
20
- } catch {
21
- return null;
22
- }
23
- }
24
- function l(t) {
25
- let r = c(t), i = c("en");
26
- return n.map((t) => {
27
- let n = e(t), a = r?.of(t) ?? i?.of(t) ?? t, o = i?.of(t) ?? a, s = x(t), c = Array.from(new Set([
28
- a,
29
- o,
30
- t.toUpperCase(),
31
- t.toLowerCase(),
32
- ...s
33
- ].filter(Boolean)));
34
- return {
35
- value: t,
36
- name: a,
37
- dialCode: n,
38
- label: `${a} (+${n})`,
39
- flag: g(t),
40
- searchableTokens: c,
41
- normalizedSearchableTokens: c.map((e) => y(e))
42
- };
43
- }).sort((e, t) => {
44
- let n = u(e.value), r = u(t.value);
45
- return n === r ? e.name.localeCompare(t.name) : n - r;
46
- });
47
- }
48
- function u(t) {
49
- return t === "US" ? 0 : t === "CA" ? 1 : e(t) === "1" ? 2 : 3;
50
- }
51
- function d(e) {
52
- return e ? Array.isArray(e) ? e.join("\0") : e : i;
53
- }
54
- function f(e) {
55
- if (e !== i) {
56
- if (e.includes("\0")) {
57
- let t = e.split("\0").filter(Boolean);
58
- return t.length === 0 ? void 0 : t.length === 1 ? t[0] ?? void 0 : t;
59
- }
60
- return e;
61
- }
62
- }
63
- function p(e, t) {
64
- let n = r.get(t);
65
- if (n) return n;
66
- let i = l(e);
67
- return r.set(t, i), i;
68
- }
69
- function m(e) {
70
- return {
71
- code: e.value,
72
- name: e.name,
73
- dialCode: e.dialCode,
74
- flag: e.flag
1
+ import { validatePhoneNumberLength as e } from "./index352.js";
2
+ import { AsYouType as t } from "./index353.js";
3
+ //#region src/components/PhoneNumberInput/normalization.ts
4
+ function n(e) {
5
+ return e.replace(/\D/g, "");
6
+ }
7
+ var r = {
8
+ GG: "GB",
9
+ JE: "GB",
10
+ IM: "GB"
11
+ };
12
+ function i(e) {
13
+ if (e) return r[e] ?? e;
14
+ }
15
+ function a(e, r) {
16
+ if (e === "+") return {
17
+ international: "+",
18
+ national: "",
19
+ formatted: "+",
20
+ phoneNumber: null,
21
+ detectedCountry: void 0
75
22
  };
76
- }
77
- function h(t) {
23
+ let a = r ? new t(r) : new t(), o = a.input(e), s = a.getNumber(), c = i(s?.country ?? a.country ?? void 0), l = s?.formatInternational() ?? o;
78
24
  return {
79
- code: t,
80
- name: t,
81
- dialCode: e(t),
82
- flag: g(t)
25
+ international: l,
26
+ national: s?.formatNational() ?? n(l),
27
+ formatted: o,
28
+ phoneNumber: s,
29
+ detectedCountry: c
83
30
  };
84
31
  }
85
- function g(e) {
86
- let t = e?.toUpperCase();
87
- if (!t || t.length !== 2 || /[^A-Z]/.test(t)) return "";
88
- let n = 127397;
89
- return String.fromCodePoint(t.charCodeAt(0) + n, t.charCodeAt(1) + n);
90
- }
91
- var _ = /[\u0300-\u036f]/g;
92
- function v(e) {
93
- return e.normalize("NFD").replace(_, "");
94
- }
95
- function y(e) {
96
- return v(e).toLowerCase();
32
+ function o(e, t) {
33
+ return e.startsWith(t) ? e.slice(t.length) : e;
97
34
  }
98
- function b(e, t) {
99
- let n = 2 ** 53 - 1;
100
- for (let r of e) {
101
- let e = r.indexOf(t);
102
- e >= 0 && e < n && (n = e);
103
- }
104
- return n === 2 ** 53 - 1 ? 2 ** 53 - 1 : n;
105
- }
106
- function x(e) {
107
- switch (e) {
108
- case "US": return [
109
- "USA",
110
- "United States",
111
- "America",
112
- "United States of America"
113
- ];
114
- case "GB": return [
115
- "UK",
116
- "United Kingdom",
117
- "Great Britain",
118
- "England"
119
- ];
120
- case "AE": return ["UAE", "United Arab Emirates"];
121
- case "KR": return ["South Korea", "Korea"];
122
- case "CN": return ["China", "PRC"];
123
- case "CD": return ["DRC", "Congo-Kinshasa"];
124
- case "CG": return ["Congo-Brazzaville"];
125
- case "BR": return ["Brazil"];
126
- default: return [];
35
+ function s(t, n) {
36
+ if (!n || !t) return null;
37
+ try {
38
+ return e(t, n) === "TOO_LONG" ? "TOO_LONG" : null;
39
+ } catch {
40
+ return null;
127
41
  }
128
42
  }
129
43
  //#endregion
130
- export { o as COMMON_IDD_PREFIXES, a as COUNTRY_DIAL_CODES, h as buildFallbackSelectedCountry, p as getCachedCountryOptions, d as getLocaleCacheKey, s as getValidCountry, y as normalizeSearchValue, b as optionMatchIndex, f as parseLocaleCacheKey, m as toSelectedCountry };
44
+ export { a as formatWithAsYouType, s as getLengthIssue, n as sanitizeDigits, o as stripPrefix };
131
45
 
132
46
  //# sourceMappingURL=index359.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index359.js","names":["CountryCode","getCountryCallingCode","CountryOption","PhoneNumberSelectedCountry","getCountryList","DEFAULT_COUNTRY","COUNTRY_OPTIONS","COUNTRY_OPTIONS_CACHE","Map","DEFAULT_LOCALE_CACHE_KEY","COUNTRY_DIAL_CODES","Array","from","Set","map","code","sort","a","b","length","MAX_DIAL_CODE_LENGTH","reduce","max","dial","Math","COMMON_IDD_PREFIXES","getValidCountry","input","includes","createDisplayNames","locale","Intl","DisplayNames","locales","isArray","undefined","type","buildCountryOptions","displayNames","englishDisplayNames","country","dialCode","localizedName","of","englishName","aliasTokens","getCountryAliases","searchableTokens","toUpperCase","toLowerCase","filter","Boolean","value","name","label","flag","countryCodeToFlagEmoji","normalizedSearchableTokens","token","normalizeSearchValue","priorityA","getCountryPriority","priorityB","localeCompare","getLocaleCacheKey","join","parseLocaleCacheKey","cacheKey","parts","split","getCachedCountryOptions","cached","get","built","set","toSelectedCountry","option","buildFallbackSelectedCountry","upper","test","base","String","fromCodePoint","charCodeAt","DIACRITICS_REGEX","stripDiacritics","normalize","replace","optionMatchIndex","tokens","query","best","Number","MAX_SAFE_INTEGER","index","indexOf"],"sources":["../src/components/PhoneNumberInput/country-options.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { getCountryCallingCode } from \"libphonenumber-js\"\n\nimport type { CountryOption, PhoneNumberSelectedCountry } from \"./types\"\nimport { getCountryList } from \"./countries\"\n\n\nexport const DEFAULT_COUNTRY: CountryCode = \"US\"\nconst COUNTRY_OPTIONS = getCountryList()\n\nconst COUNTRY_OPTIONS_CACHE = new Map<string, CountryOption[]>()\nconst DEFAULT_LOCALE_CACHE_KEY = \"__default_locale__\"\nexport const COUNTRY_DIAL_CODES = Array.from(\n new Set(COUNTRY_OPTIONS.map((code) => getCountryCallingCode(code)))\n).sort((a, b) => b.length - a.length)\nexport const MAX_DIAL_CODE_LENGTH = COUNTRY_DIAL_CODES.reduce(\n (max, dial) => Math.max(max, dial.length),\n 0\n)\nexport const COMMON_IDD_PREFIXES = [\"0011\", \"001\", \"011\", \"00\", \"810\"]\n\nexport function getValidCountry(input: CountryCode | undefined) {\n if (!input) {\n return DEFAULT_COUNTRY\n }\n\n return COUNTRY_OPTIONS.includes(input) ? input : DEFAULT_COUNTRY\n}\n\nfunction createDisplayNames(locale?: string | string[]) {\n if (typeof Intl === \"undefined\" || typeof Intl.DisplayNames === \"undefined\") {\n return null\n }\n\n try {\n const locales = Array.isArray(locale) ? locale : locale ? [locale] : undefined\n return new Intl.DisplayNames(locales, { type: \"region\" })\n } catch {\n return null\n }\n}\n\nfunction buildCountryOptions(locale?: string | string[]) {\n const displayNames = createDisplayNames(locale)\n const englishDisplayNames = createDisplayNames(\"en\")\n\n return COUNTRY_OPTIONS\n .map((country) => {\n const dialCode = getCountryCallingCode(country)\n const localizedName = displayNames?.of(country) ?? englishDisplayNames?.of(country) ?? country\n const englishName = englishDisplayNames?.of(country) ?? localizedName\n const aliasTokens = getCountryAliases(country)\n const searchableTokens = Array.from(\n new Set(\n [localizedName, englishName, country.toUpperCase(), country.toLowerCase(), ...aliasTokens].filter(\n Boolean\n )\n )\n ) as string[]\n return {\n value: country,\n name: localizedName,\n dialCode,\n label: `${localizedName} (+${dialCode})`,\n flag: countryCodeToFlagEmoji(country),\n searchableTokens,\n normalizedSearchableTokens: searchableTokens.map((token) => normalizeSearchValue(token)),\n }\n })\n .sort((a, b) => {\n const priorityA = getCountryPriority(a.value)\n const priorityB = getCountryPriority(b.value)\n if (priorityA !== priorityB) {\n return priorityA - priorityB\n }\n return a.name.localeCompare(b.name)\n })\n}\n\nfunction getCountryPriority(code: CountryCode) {\n if (code === \"US\") return 0\n if (code === \"CA\") return 1\n if (getCountryCallingCode(code) === \"1\") return 2\n return 3\n}\n\nexport function getLocaleCacheKey(locale?: string | string[]) {\n if (!locale) {\n return DEFAULT_LOCALE_CACHE_KEY\n }\n if (Array.isArray(locale)) {\n return locale.join(\"\\u0000\")\n }\n return locale\n}\n\nexport function parseLocaleCacheKey(cacheKey: string): string | string[] | undefined {\n if (cacheKey === DEFAULT_LOCALE_CACHE_KEY) {\n return undefined\n }\n\n if (cacheKey.includes(\"\\u0000\")) {\n const parts = cacheKey.split(\"\\u0000\").filter(Boolean)\n if (parts.length === 0) {\n return undefined\n }\n if (parts.length === 1) {\n return parts[0] ?? undefined\n }\n return parts\n }\n\n return cacheKey\n}\n\nexport function getCachedCountryOptions(locale: string | string[] | undefined, cacheKey: string) {\n const cached = COUNTRY_OPTIONS_CACHE.get(cacheKey)\n if (cached) {\n return cached\n }\n const built = buildCountryOptions(locale)\n COUNTRY_OPTIONS_CACHE.set(cacheKey, built)\n return built\n}\n\nexport function toSelectedCountry(option: CountryOption): PhoneNumberSelectedCountry {\n return {\n code: option.value,\n name: option.name,\n dialCode: option.dialCode,\n flag: option.flag,\n }\n}\n\nexport function buildFallbackSelectedCountry(country: CountryCode): PhoneNumberSelectedCountry {\n return {\n code: country,\n name: country,\n dialCode: getCountryCallingCode(country),\n flag: countryCodeToFlagEmoji(country),\n }\n}\n\nfunction countryCodeToFlagEmoji(country: CountryCode) {\n const upper = country?.toUpperCase()\n\n if (!upper || upper.length !== 2 || /[^A-Z]/.test(upper)) {\n return \"\"\n }\n\n const base = 127397\n return String.fromCodePoint(\n upper.charCodeAt(0) + base,\n upper.charCodeAt(1) + base\n )\n}\n\nconst DIACRITICS_REGEX = /[\\u0300-\\u036f]/g\n\nfunction stripDiacritics(value: string) {\n return value.normalize(\"NFD\").replace(DIACRITICS_REGEX, \"\")\n}\n\nexport function normalizeSearchValue(value: string) {\n return stripDiacritics(value).toLowerCase()\n}\n\nexport function optionMatchIndex(tokens: string[], query: string) {\n let best = Number.MAX_SAFE_INTEGER\n for (const token of tokens) {\n const index = token.indexOf(query)\n if (index >= 0 && index < best) {\n best = index\n }\n }\n return best === Number.MAX_SAFE_INTEGER ? Number.MAX_SAFE_INTEGER : best\n}\n\nfunction getCountryAliases(code: CountryCode): string[] {\n switch (code) {\n case \"US\":\n return [\"USA\", \"United States\", \"America\", \"United States of America\"]\n case \"GB\":\n return [\"UK\", \"United Kingdom\", \"Great Britain\", \"England\"]\n case \"AE\":\n return [\"UAE\", \"United Arab Emirates\"]\n case \"KR\":\n return [\"South Korea\", \"Korea\"]\n case \"CN\":\n return [\"China\", \"PRC\"]\n case \"CD\":\n return [\"DRC\", \"Congo-Kinshasa\"]\n case \"CG\":\n return [\"Congo-Brazzaville\"]\n case \"BR\":\n return [\"Brazil\"]\n default:\n return []\n }\n}\n\n"],"mappings":";;AAQA,IAAMM,IAAkBF,EAAe,GAEjCG,oBAAwB,IAAIC,IAA6B,GACzDC,IAA2B,sBACpBC,IAAqBC,MAAMC,KACtC,IAAIC,IAAIP,EAAgBQ,KAAKC,MAASd,EAAsBc,CAAI,CAAC,CAAC,CACpE,CAAC,CAACC,MAAMC,GAAGC,MAAMA,EAAEC,SAASF,EAAEE,MAAM;AACAT,EAAmBW,QACpDC,GAAKC,MAASC,KAAKF,IAAIA,GAAKC,EAAKJ,MAAM,GACxC,CACF;AACA,IAAaM,IAAsB;CAAC;CAAQ;CAAO;CAAO;CAAM;AAAK;AAErE,SAAgBC,EAAgBC,GAAgC;CAK9D,OAJKA,KAIErB,EAAgBsB,SAASD,CAAK,IAAIA,IAAAA;AAC3C;AAEA,SAASE,EAAmBC,GAA4B;CACtD,IAAI,OAAOC,OAAS,OAAsBA,KAAKC,iBAAiB,QAC9D,OAAO;CAGT,IAAI;EACF,IAAMC,IAAUtB,MAAMuB,QAAQJ,CAAM,IAAIA,IAASA,IAAS,CAACA,CAAM,IAAIK,KAAAA;EACrE,OAAO,IAAIJ,KAAKC,aAAaC,GAAS,EAAEG,MAAM,SAAS,CAAC;CAC1D,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAASC,EAAoBP,GAA4B;CACvD,IAAMQ,IAAeT,EAAmBC,CAAM,GACxCS,IAAsBV,EAAmB,IAAI;CAEnD,OAAOvB,EACJQ,KAAK0B,MAAY;EAChB,IAAMC,IAAWxC,EAAsBuC,CAAO,GACxCE,IAAgBJ,GAAcK,GAAGH,CAAO,KAAKD,GA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GAAiB;GAAW;EAA0B;EACvE,KAAK,MACH,OAAO;GAAC;GAAM;GAAkB;GAAiB;EAAS;EAC5D,KAAK,MACH,OAAO,CAAC,OAAO,sBAAsB;EACvC,KAAK,MACH,OAAO,CAAC,eAAe,OAAO;EAChC,KAAK,MACH,OAAO,CAAC,SAAS,KAAK;EACxB,KAAK,MACH,OAAO,CAAC,OAAO,gBAAgB;EACjC,KAAK,MACH,OAAO,CAAC,mBAAmB;EAC7B,KAAK,MACH,OAAO,CAAC,QAAQ;EAClB,SACE,OAAO,CAAA;CACT;AACF"}
1
+ {"version":3,"file":"index359.js","names":[],"sources":["../src/components/PhoneNumberInput/normalization.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { AsYouType, validatePhoneNumberLength } from \"libphonenumber-js\"\n\n\nexport type LengthIssue = \"TOO_LONG\"\n\nexport function sanitizeDigits(value: string) {\n return value.replace(/\\D/g, \"\")\n}\n\nconst DETECTED_COUNTRY_OVERRIDES: Partial<Record<CountryCode, CountryCode>> = {\n GG: \"GB\",\n JE: \"GB\",\n IM: \"GB\",\n}\n\nfunction canonicalizeDetectedCountry(candidate: CountryCode | undefined): CountryCode | undefined {\n if (!candidate) {\n return undefined\n }\n return DETECTED_COUNTRY_OVERRIDES[candidate] ?? candidate\n}\n\nexport function formatWithAsYouType(value: string, baseCountry?: CountryCode) {\n if (value === \"+\") {\n return {\n international: \"+\",\n national: \"\",\n formatted: \"+\",\n phoneNumber: null,\n detectedCountry: undefined,\n }\n }\n\n const formatter = baseCountry ? new AsYouType(baseCountry) : new AsYouType()\n const formatted = formatter.input(value)\n const phoneNumber = formatter.getNumber()\n const detectedCountry = canonicalizeDetectedCountry(\n (phoneNumber?.country ?? formatter.country ?? undefined) as CountryCode | undefined\n )\n const international = phoneNumber?.formatInternational() ?? formatted\n const national = phoneNumber?.formatNational() ?? sanitizeDigits(international)\n\n return {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n }\n}\n\nexport function stripPrefix(value: string, prefix: string) {\n return value.startsWith(prefix) ? value.slice(prefix.length) : value\n}\n\nexport function getLengthIssue(value: string, country: CountryCode | undefined): LengthIssue | null {\n if (!country || !value) {\n return null\n }\n\n try {\n const result = validatePhoneNumberLength(value, country)\n return result === \"TOO_LONG\" ? \"TOO_LONG\" : null\n } catch {\n return null\n }\n}\n"],"mappings":";;;AAMA,SAAgB,EAAe,GAAe;CAC5C,OAAO,EAAM,QAAQ,OAAO,EAAE;AAChC;AAEA,IAAM,IAAwE;CAC5E,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAS,EAA4B,GAA6D;CAC3F,OAGL,OAAO,EAA2B,MAAc;AAClD;AAEA,SAAgB,EAAoB,GAAe,GAA2B;CAC5E,IAAI,MAAU,KACZ,OAAO;EACL,eAAe;EACf,UAAU;EACV,WAAW;EACX,aAAa;EACb,iBAAiB,KAAA;CACnB;CAGF,IAAM,IAAY,IAAc,IAAI,EAAU,CAAW,IAAI,IAAI,EAAU,GACrE,IAAY,EAAU,MAAM,CAAK,GACjC,IAAc,EAAU,UAAU,GAClC,IAAkB,EACrB,GAAa,WAAW,EAAU,WAAW,KAAA,CAChD,GACM,IAAgB,GAAa,oBAAoB,KAAK;CAG5D,OAAO;EACL;EACA,UAJe,GAAa,eAAe,KAAK,EAAe,CAAa;EAK5E;EACA;EACA;CACF;AACF;AAEA,SAAgB,EAAY,GAAe,GAAgB;CACzD,OAAO,EAAM,WAAW,CAAM,IAAI,EAAM,MAAM,EAAO,MAAM,IAAI;AACjE;AAEA,SAAgB,EAAe,GAAe,GAAsD;CAClG,IAAI,CAAC,KAAW,CAAC,GACf,OAAO;CAGT,IAAI;EAEF,OADe,EAA0B,GAAO,CACzC,MAAW,aAAa,aAAa;CAC9C,QAAQ;EACN,OAAO;CACT;AACF"}
package/dist/index360.js CHANGED
@@ -1,46 +1,72 @@
1
- import { validatePhoneNumberLength as e } from "./index353.js";
2
- import { AsYouType as t } from "./index354.js";
3
- //#region src/components/PhoneNumberInput/normalization.ts
4
- function n(e) {
5
- return e.replace(/\D/g, "");
6
- }
7
- var r = {
8
- GG: "GB",
9
- JE: "GB",
10
- IM: "GB"
11
- };
12
- function i(e) {
13
- if (e) return r[e] ?? e;
14
- }
15
- function a(e, r) {
16
- if (e === "+") return {
17
- international: "+",
18
- national: "",
19
- formatted: "+",
20
- phoneNumber: null,
21
- detectedCountry: void 0
22
- };
23
- let a = r ? new t(r) : new t(), o = a.input(e), s = a.getNumber(), c = i(s?.country ?? a.country ?? void 0), l = s?.formatInternational() ?? o;
1
+ //#region src/components/PhoneNumberInput/selection.ts
2
+ function e(e) {
3
+ if (!e) return !1;
4
+ let t = e.charCodeAt(0);
5
+ return t >= 48 && t <= 57;
6
+ }
7
+ function t(t, n) {
8
+ let r = 0, i = Math.min(n, t.length);
9
+ for (let n = 0; n < i; n += 1) e(t[n] ?? "") && (r += 1);
10
+ return r;
11
+ }
12
+ function n(t, n) {
13
+ if (n <= 0) return t.startsWith("+") ? Math.min(1, t.length) : 0;
14
+ let r = 0;
15
+ for (let i = 0; i < t.length; i += 1) if (e(t[i] ?? "") && (r += 1, r === n)) return i + 1;
16
+ return t.length;
17
+ }
18
+ function r(t) {
19
+ return !t || e(t) ? !1 : t !== "+";
20
+ }
21
+ function i(e, t) {
22
+ let n = t;
23
+ for (; n > 0 && r(e[n - 1] ?? "");) --n;
24
+ return n;
25
+ }
26
+ function a(e, t) {
27
+ let n = t;
28
+ for (; n < e.length && r(e[n] ?? "");) n += 1;
29
+ return n;
30
+ }
31
+ function o(e) {
32
+ let { value: n } = e, r = e.selectionStart ?? n.length, i = e.selectionEnd ?? r, a = r <= 1 && n.startsWith("+"), o = i <= 1 && n.startsWith("+");
24
33
  return {
25
- international: l,
26
- national: s?.formatNational() ?? n(l),
27
- formatted: o,
28
- phoneNumber: s,
29
- detectedCountry: c
34
+ selectionStart: r,
35
+ selectionEnd: i,
36
+ startDigits: t(n, r),
37
+ endDigits: t(n, i),
38
+ preserveStartIndex: a,
39
+ preserveEndIndex: o,
40
+ wasAtStart: r === 0,
41
+ wasAtEnd: i === n.length
30
42
  };
31
43
  }
32
- function o(e, t) {
33
- return e.startsWith(t) ? e.slice(t.length) : e;
34
- }
35
- function s(t, n) {
36
- if (!n || !t) return null;
37
- try {
38
- return e(t, n) === "TOO_LONG" ? "TOO_LONG" : null;
39
- } catch {
40
- return null;
44
+ function s(e, t) {
45
+ if (e.selectionStart === e.selectionEnd) {
46
+ if (e.wasAtEnd) {
47
+ let e = t.length;
48
+ return {
49
+ start: e,
50
+ end: e
51
+ };
52
+ }
53
+ if (e.wasAtStart) return {
54
+ start: 0,
55
+ end: 0
56
+ };
41
57
  }
58
+ let r = e.preserveStartIndex ? Math.min(e.selectionStart, t.length) : n(t, e.startDigits), i = e.preserveEndIndex ? Math.min(e.selectionEnd, t.length) : n(t, e.endDigits), a = r, o = i;
59
+ e.wasAtStart && (a = 0), e.wasAtEnd && (o = t.length), e.selectionStart === e.selectionEnd && (a = o);
60
+ let s = Math.min(Math.max(a, 0), t.length), c = Math.min(Math.max(o, 0), t.length);
61
+ return s > c ? {
62
+ start: c,
63
+ end: c
64
+ } : {
65
+ start: s,
66
+ end: c
67
+ };
42
68
  }
43
69
  //#endregion
44
- export { a as formatWithAsYouType, s as getLengthIssue, n as sanitizeDigits, o as stripPrefix };
70
+ export { o as captureSelectionSnapshot, s as resolveSelection, i as skipFormattingCharactersLeft, a as skipFormattingCharactersRight };
45
71
 
46
72
  //# sourceMappingURL=index360.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index360.js","names":["CountryCode","AsYouType","validatePhoneNumberLength","LengthIssue","sanitizeDigits","value","replace","DETECTED_COUNTRY_OVERRIDES","Partial","Record","GG","JE","IM","canonicalizeDetectedCountry","candidate","undefined","formatWithAsYouType","baseCountry","international","national","formatted","phoneNumber","detectedCountry","formatter","input","getNumber","country","formatInternational","formatNational","stripPrefix","prefix","startsWith","slice","length","getLengthIssue","result"],"sources":["../src/components/PhoneNumberInput/normalization.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { AsYouType, validatePhoneNumberLength } from \"libphonenumber-js\"\n\n\nexport type LengthIssue = \"TOO_LONG\"\n\nexport function sanitizeDigits(value: string) {\n return value.replace(/\\D/g, \"\")\n}\n\nconst DETECTED_COUNTRY_OVERRIDES: Partial<Record<CountryCode, CountryCode>> = {\n GG: \"GB\",\n JE: \"GB\",\n IM: \"GB\",\n}\n\nfunction canonicalizeDetectedCountry(candidate: CountryCode | undefined): CountryCode | undefined {\n if (!candidate) {\n return undefined\n }\n return DETECTED_COUNTRY_OVERRIDES[candidate] ?? candidate\n}\n\nexport function formatWithAsYouType(value: string, baseCountry?: CountryCode) {\n if (value === \"+\") {\n return {\n international: \"+\",\n national: \"\",\n formatted: \"+\",\n phoneNumber: null,\n detectedCountry: undefined,\n }\n }\n\n const formatter = baseCountry ? new AsYouType(baseCountry) : new AsYouType()\n const formatted = formatter.input(value)\n const phoneNumber = formatter.getNumber()\n const detectedCountry = canonicalizeDetectedCountry(\n (phoneNumber?.country ?? formatter.country ?? undefined) as CountryCode | undefined\n )\n const international = phoneNumber?.formatInternational() ?? formatted\n const national = phoneNumber?.formatNational() ?? sanitizeDigits(international)\n\n return {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n }\n}\n\nexport function stripPrefix(value: string, prefix: string) {\n return value.startsWith(prefix) ? value.slice(prefix.length) : value\n}\n\nexport function getLengthIssue(value: string, country: CountryCode | undefined): LengthIssue | null {\n if (!country || !value) {\n return null\n }\n\n try {\n const result = validatePhoneNumberLength(value, country)\n return result === \"TOO_LONG\" ? \"TOO_LONG\" : null\n } catch {\n return null\n }\n}\n"],"mappings":";;;AAMA,SAAgBI,EAAeC,GAAe;CAC5C,OAAOA,EAAMC,QAAQ,OAAO,EAAE;AAChC;AAEA,IAAMC,IAAwE;CAC5EG,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAEA,SAASC,EAA4BC,GAA6D;CAC3FA,OAGL,OAAOP,EAA2BO,MAAcA;AAClD;AAEA,SAAgBE,EAAoBX,GAAeY,GAA2B;CAC5E,IAAIZ,MAAU,KACZ,OAAO;EACLa,eAAe;EACfC,UAAU;EACVC,WAAW;EACXC,aAAa;EACbC,iBAAiBP,KAAAA;CACnB;CAGF,IAAMQ,IAAYN,IAAc,IAAIhB,EAAUgB,CAAW,IAAI,IAAIhB,EAAU,GACrEmB,IAAYG,EAAUC,MAAMnB,CAAK,GACjCgB,IAAcE,EAAUE,UAAU,GAClCH,IAAkBT,EACrBQ,GAAaK,WAAWH,EAAUG,WAAWX,KAAAA,CAChD,GACMG,IAAgBG,GAAaM,oBAAoB,KAAKP;CAG5D,OAAO;EACLF;EACAC,UAJeE,GAAaO,eAAe,KAAKxB,EAAec,CAAa;EAK5EE;EACAC;EACAC;CACF;AACF;AAEA,SAAgBO,EAAYxB,GAAeyB,GAAgB;CACzD,OAAOzB,EAAM0B,WAAWD,CAAM,IAAIzB,EAAM2B,MAAMF,EAAOG,MAAM,IAAI5B;AACjE;AAEA,SAAgB6B,EAAe7B,GAAeqB,GAAsD;CAClG,IAAI,CAACA,KAAW,CAACrB,GACf,OAAO;CAGT,IAAI;EAEF,OADeH,EAA0BG,GAAOqB,CACzCS,MAAW,aAAa,aAAa;CAC9C,QAAQ;EACN,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"index360.js","names":[],"sources":["../src/components/PhoneNumberInput/selection.ts"],"sourcesContent":["function isDigitCharacter(char: string) {\n if (!char) {\n return false\n }\n const code = char.charCodeAt(0)\n return code >= 48 && code <= 57\n}\n\nfunction countDigitsBefore(value: string, index: number) {\n let count = 0\n const limit = Math.min(index, value.length)\n for (let position = 0; position < limit; position += 1) {\n if (isDigitCharacter(value[position] ?? \"\")) {\n count += 1\n }\n }\n return count\n}\n\nfunction findIndexForDigitCount(value: string, digitCount: number) {\n if (digitCount <= 0) {\n return value.startsWith(\"+\") ? Math.min(1, value.length) : 0\n }\n\n let seen = 0\n for (let index = 0; index < value.length; index += 1) {\n if (isDigitCharacter(value[index] ?? \"\")) {\n seen += 1\n if (seen === digitCount) {\n return index + 1\n }\n }\n }\n\n return value.length\n}\n\nfunction isFormattingCharacter(char: string) {\n if (!char) {\n return false\n }\n if (isDigitCharacter(char)) {\n return false\n }\n return char !== \"+\"\n}\n\nexport function skipFormattingCharactersLeft(value: string, index: number) {\n let position = index\n while (position > 0) {\n const next = value[position - 1] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position -= 1\n }\n return position\n}\n\nexport function skipFormattingCharactersRight(value: string, index: number) {\n let position = index\n while (position < value.length) {\n const next = value[position] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position += 1\n }\n return position\n}\n\ntype SelectionSnapshot = {\n selectionStart: number\n selectionEnd: number\n startDigits: number\n endDigits: number\n preserveStartIndex: boolean\n preserveEndIndex: boolean\n wasAtStart: boolean\n wasAtEnd: boolean\n}\n\nexport function captureSelectionSnapshot(input: HTMLInputElement): SelectionSnapshot {\n const { value } = input\n const selectionStart = input.selectionStart ?? value.length\n const selectionEnd = input.selectionEnd ?? selectionStart\n const preserveStartIndex = selectionStart <= 1 && value.startsWith(\"+\")\n const preserveEndIndex = selectionEnd <= 1 && value.startsWith(\"+\")\n\n return {\n selectionStart,\n selectionEnd,\n startDigits: countDigitsBefore(value, selectionStart),\n endDigits: countDigitsBefore(value, selectionEnd),\n preserveStartIndex,\n preserveEndIndex,\n wasAtStart: selectionStart === 0,\n wasAtEnd: selectionEnd === value.length,\n }\n}\n\nexport function resolveSelection(snapshot: SelectionSnapshot, value: string) {\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n if (snapshot.wasAtEnd) {\n const end = value.length\n return { start: end, end }\n }\n if (snapshot.wasAtStart) {\n return { start: 0, end: 0 }\n }\n }\n\n const start = snapshot.preserveStartIndex\n ? Math.min(snapshot.selectionStart, value.length)\n : findIndexForDigitCount(value, snapshot.startDigits)\n const end = snapshot.preserveEndIndex\n ? Math.min(snapshot.selectionEnd, value.length)\n : findIndexForDigitCount(value, snapshot.endDigits)\n\n let resolvedStart = start\n let resolvedEnd = end\n\n if (snapshot.wasAtStart) {\n resolvedStart = 0\n }\n\n if (snapshot.wasAtEnd) {\n resolvedEnd = value.length\n }\n\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n resolvedStart = resolvedEnd\n }\n\n const clampedStart = Math.min(Math.max(resolvedStart, 0), value.length)\n const clampedEnd = Math.min(Math.max(resolvedEnd, 0), value.length)\n\n if (clampedStart > clampedEnd) {\n return { start: clampedEnd, end: clampedEnd }\n }\n\n return { start: clampedStart, end: clampedEnd }\n}\n\n"],"mappings":";AAAA,SAAS,EAAiB,GAAc;CACtC,IAAI,CAAC,GACH,OAAO;CAET,IAAM,IAAO,EAAK,WAAW,CAAC;CAC9B,OAAO,KAAQ,MAAM,KAAQ;AAC/B;AAEA,SAAS,EAAkB,GAAe,GAAe;CACvD,IAAI,IAAQ,GACN,IAAQ,KAAK,IAAI,GAAO,EAAM,MAAM;CAC1C,KAAK,IAAI,IAAW,GAAG,IAAW,GAAO,KAAY,GACnD,AAAI,EAAiB,EAAM,MAAa,EAAE,MACxC,KAAS;CAGb,OAAO;AACT;AAEA,SAAS,EAAuB,GAAe,GAAoB;CACjE,IAAI,KAAc,GAChB,OAAO,EAAM,WAAW,GAAG,IAAI,KAAK,IAAI,GAAG,EAAM,MAAM,IAAI;CAG7D,IAAI,IAAO;CACX,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAM,QAAQ,KAAS,GACjD,IAAI,EAAiB,EAAM,MAAU,EAAE,MACrC,KAAQ,GACJ,MAAS,IACX,OAAO,IAAQ;CAKrB,OAAO,EAAM;AACf;AAEA,SAAS,EAAsB,GAAc;CAO3C,OANI,CAAC,KAGD,EAAiB,CAAI,IAChB,KAEF,MAAS;AAClB;AAEA,SAAgB,EAA6B,GAAe,GAAe;CACzE,IAAI,IAAW;CACf,OAAO,IAAW,KAEX,EADQ,EAAM,IAAW,MAAM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