@bigbinary/neetoui 6.6.0 → 6.7.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 (227) hide show
  1. package/README.md +2 -5
  2. package/dist/Accordion.js +2 -290
  3. package/dist/Accordion.js.map +1 -1
  4. package/dist/ActionDropdown.js +4 -3
  5. package/dist/ActionDropdown.js.map +1 -1
  6. package/dist/Alert.js +5 -4
  7. package/dist/Alert.js.map +1 -1
  8. package/dist/Avatar.js +9 -1128
  9. package/dist/Avatar.js.map +1 -1
  10. package/dist/Button.js +3 -2
  11. package/dist/Button.js.map +1 -1
  12. package/dist/Checkbox.js +3 -2
  13. package/dist/Checkbox.js.map +1 -1
  14. package/dist/ColorPicker.js +8 -8
  15. package/dist/ColorPicker.js.map +1 -1
  16. package/dist/DatePicker.js +3 -2
  17. package/dist/DatePicker.js.map +1 -1
  18. package/dist/DateTimePicker.js +7 -5
  19. package/dist/DateTimePicker.js.map +1 -1
  20. package/dist/Dropdown.js +4 -3
  21. package/dist/Dropdown.js.map +1 -1
  22. package/dist/Input.js +3 -2
  23. package/dist/Input.js.map +1 -1
  24. package/dist/Kbd.js +2 -1
  25. package/dist/Kbd.js.map +1 -1
  26. package/dist/Label.js +2 -1
  27. package/dist/Label.js.map +1 -1
  28. package/dist/Modal.js +5 -4
  29. package/dist/Modal.js.map +1 -1
  30. package/dist/MultiEmailInput.js +6 -4
  31. package/dist/MultiEmailInput.js.map +1 -1
  32. package/dist/NoData.js +3 -2
  33. package/dist/NoData.js.map +1 -1
  34. package/dist/Pagination.js +2 -2
  35. package/dist/Pane.js +5 -4
  36. package/dist/Pane.js.map +1 -1
  37. package/dist/Popover.js +2 -1
  38. package/dist/Popover.js.map +1 -1
  39. package/dist/ProgressBar.js +1 -1
  40. package/dist/Radio.js +3 -2
  41. package/dist/Radio.js.map +1 -1
  42. package/dist/Select.js +30 -182
  43. package/dist/Select.js.map +1 -1
  44. package/dist/Sidebar.js +4 -2
  45. package/dist/Sidebar.js.map +1 -1
  46. package/dist/Slider.js +3 -2
  47. package/dist/Slider.js.map +1 -1
  48. package/dist/Switch.js +3 -2
  49. package/dist/Switch.js.map +1 -1
  50. package/dist/Table.js +405 -4540
  51. package/dist/Table.js.map +1 -1
  52. package/dist/Textarea.js +3 -2
  53. package/dist/Textarea.js.map +1 -1
  54. package/dist/TimePicker.js +3 -2
  55. package/dist/TimePicker.js.map +1 -1
  56. package/dist/TimePickerInput.js +8 -6
  57. package/dist/TimePickerInput.js.map +1 -1
  58. package/dist/Toastr.js +3 -1653
  59. package/dist/Toastr.js.map +1 -1
  60. package/dist/Tooltip.js +2 -1
  61. package/dist/Tooltip.js.map +1 -1
  62. package/dist/Tree.js +1 -1
  63. package/dist/TreeSelect.js +3 -2
  64. package/dist/TreeSelect.js.map +1 -1
  65. package/dist/cjs/Accordion.js +3 -309
  66. package/dist/cjs/Accordion.js.map +1 -1
  67. package/dist/cjs/ActionDropdown.js +4 -3
  68. package/dist/cjs/ActionDropdown.js.map +1 -1
  69. package/dist/cjs/Alert.js +5 -4
  70. package/dist/cjs/Alert.js.map +1 -1
  71. package/dist/cjs/Avatar.js +10 -1128
  72. package/dist/cjs/Avatar.js.map +1 -1
  73. package/dist/cjs/Button.js +6 -5
  74. package/dist/cjs/Button.js.map +1 -1
  75. package/dist/cjs/Checkbox.js +3 -2
  76. package/dist/cjs/Checkbox.js.map +1 -1
  77. package/dist/cjs/ColorPicker.js +7 -7
  78. package/dist/cjs/ColorPicker.js.map +1 -1
  79. package/dist/cjs/DatePicker.js +3 -2
  80. package/dist/cjs/DatePicker.js.map +1 -1
  81. package/dist/cjs/DateTimePicker.js +7 -5
  82. package/dist/cjs/DateTimePicker.js.map +1 -1
  83. package/dist/cjs/Dropdown.js +4 -3
  84. package/dist/cjs/Dropdown.js.map +1 -1
  85. package/dist/cjs/Input.js +3 -2
  86. package/dist/cjs/Input.js.map +1 -1
  87. package/dist/cjs/Kbd.js +2 -1
  88. package/dist/cjs/Kbd.js.map +1 -1
  89. package/dist/cjs/Label.js +2 -1
  90. package/dist/cjs/Label.js.map +1 -1
  91. package/dist/cjs/Modal.js +5 -4
  92. package/dist/cjs/Modal.js.map +1 -1
  93. package/dist/cjs/MultiEmailInput.js +15 -12
  94. package/dist/cjs/MultiEmailInput.js.map +1 -1
  95. package/dist/cjs/NoData.js +3 -2
  96. package/dist/cjs/NoData.js.map +1 -1
  97. package/dist/cjs/Pagination.js +2 -2
  98. package/dist/cjs/Pane.js +5 -4
  99. package/dist/cjs/Pane.js.map +1 -1
  100. package/dist/cjs/Popover.js +2 -1
  101. package/dist/cjs/Popover.js.map +1 -1
  102. package/dist/cjs/ProgressBar.js +2 -2
  103. package/dist/cjs/ProgressBar.js.map +1 -1
  104. package/dist/cjs/Radio.js +3 -2
  105. package/dist/cjs/Radio.js.map +1 -1
  106. package/dist/cjs/Select.js +26 -192
  107. package/dist/cjs/Select.js.map +1 -1
  108. package/dist/cjs/Sidebar.js +4 -2
  109. package/dist/cjs/Sidebar.js.map +1 -1
  110. package/dist/cjs/Slider.js +3 -2
  111. package/dist/cjs/Slider.js.map +1 -1
  112. package/dist/cjs/Switch.js +3 -2
  113. package/dist/cjs/Switch.js.map +1 -1
  114. package/dist/cjs/Table.js +430 -4565
  115. package/dist/cjs/Table.js.map +1 -1
  116. package/dist/cjs/Textarea.js +3 -2
  117. package/dist/cjs/Textarea.js.map +1 -1
  118. package/dist/cjs/TimePicker.js +3 -2
  119. package/dist/cjs/TimePicker.js.map +1 -1
  120. package/dist/cjs/TimePickerInput.js +8 -6
  121. package/dist/cjs/TimePickerInput.js.map +1 -1
  122. package/dist/cjs/Toastr.js +6 -1656
  123. package/dist/cjs/Toastr.js.map +1 -1
  124. package/dist/cjs/Tooltip.js +2 -1
  125. package/dist/cjs/Tooltip.js.map +1 -1
  126. package/dist/cjs/Tree.js +1 -1
  127. package/dist/cjs/TreeSelect.js +3 -2
  128. package/dist/cjs/TreeSelect.js.map +1 -1
  129. package/dist/cjs/formik/ActionBlock.js +3 -2
  130. package/dist/cjs/formik/ActionBlock.js.map +1 -1
  131. package/dist/cjs/formik/BlockNavigation.js +5 -4
  132. package/dist/cjs/formik/BlockNavigation.js.map +1 -1
  133. package/dist/cjs/formik/Button.js +3 -2
  134. package/dist/cjs/formik/Button.js.map +1 -1
  135. package/dist/cjs/formik/Checkbox.js +3 -2
  136. package/dist/cjs/formik/Checkbox.js.map +1 -1
  137. package/dist/cjs/formik/Input.js +3 -2
  138. package/dist/cjs/formik/Input.js.map +1 -1
  139. package/dist/cjs/formik/MultiEmailInput.js +6 -4
  140. package/dist/cjs/formik/MultiEmailInput.js.map +1 -1
  141. package/dist/cjs/formik/Radio.js +3 -2
  142. package/dist/cjs/formik/Radio.js.map +1 -1
  143. package/dist/cjs/formik/Select.js +8 -4
  144. package/dist/cjs/formik/Select.js.map +1 -1
  145. package/dist/cjs/formik/Slider.js +3 -2
  146. package/dist/cjs/formik/Slider.js.map +1 -1
  147. package/dist/cjs/formik/Switch.js +3 -2
  148. package/dist/cjs/formik/Switch.js.map +1 -1
  149. package/dist/cjs/formik/Textarea.js +3 -2
  150. package/dist/cjs/formik/Textarea.js.map +1 -1
  151. package/dist/cjs/formik/TreeSelect.js +3 -2
  152. package/dist/cjs/formik/TreeSelect.js.map +1 -1
  153. package/dist/cjs/formik/index.js +9 -5
  154. package/dist/cjs/formik/index.js.map +1 -1
  155. package/dist/cjs/{index-16ef19ed.js → index-6e09c7bc.js} +1 -23
  156. package/dist/cjs/index-6e09c7bc.js.map +1 -0
  157. package/dist/cjs/index-773961dd.js +453 -0
  158. package/dist/cjs/index-773961dd.js.map +1 -0
  159. package/dist/cjs/index-becc6543.js +262 -0
  160. package/dist/cjs/index-becc6543.js.map +1 -0
  161. package/dist/cjs/index.js +18 -7
  162. package/dist/cjs/index.js.map +1 -1
  163. package/dist/cjs/layouts.js +4 -2
  164. package/dist/cjs/layouts.js.map +1 -1
  165. package/dist/cjs/{useOverlayManager-53380ba5.js → useOverlayManager-359ed795.js} +2 -2
  166. package/dist/cjs/{useOverlayManager-53380ba5.js.map → useOverlayManager-359ed795.js.map} +1 -1
  167. package/dist/cjs/{useQueryParams-3ddcf459.js → useQueryParams-14f054b3.js} +2 -2
  168. package/dist/cjs/{useQueryParams-3ddcf459.js.map → useQueryParams-14f054b3.js.map} +1 -1
  169. package/dist/formik/ActionBlock.js +3 -2
  170. package/dist/formik/ActionBlock.js.map +1 -1
  171. package/dist/formik/BlockNavigation.js +5 -4
  172. package/dist/formik/BlockNavigation.js.map +1 -1
  173. package/dist/formik/Button.js +3 -2
  174. package/dist/formik/Button.js.map +1 -1
  175. package/dist/formik/Checkbox.js +3 -2
  176. package/dist/formik/Checkbox.js.map +1 -1
  177. package/dist/formik/Input.js +3 -2
  178. package/dist/formik/Input.js.map +1 -1
  179. package/dist/formik/MultiEmailInput.js +6 -4
  180. package/dist/formik/MultiEmailInput.js.map +1 -1
  181. package/dist/formik/Radio.js +3 -2
  182. package/dist/formik/Radio.js.map +1 -1
  183. package/dist/formik/Select.js +8 -4
  184. package/dist/formik/Select.js.map +1 -1
  185. package/dist/formik/Slider.js +3 -2
  186. package/dist/formik/Slider.js.map +1 -1
  187. package/dist/formik/Switch.js +3 -2
  188. package/dist/formik/Switch.js.map +1 -1
  189. package/dist/formik/Textarea.js +3 -2
  190. package/dist/formik/Textarea.js.map +1 -1
  191. package/dist/formik/TreeSelect.js +3 -2
  192. package/dist/formik/TreeSelect.js.map +1 -1
  193. package/dist/formik/index.js +9 -5
  194. package/dist/formik/index.js.map +1 -1
  195. package/dist/index-661b9fd6.js +253 -0
  196. package/dist/index-661b9fd6.js.map +1 -0
  197. package/dist/index-c442518b.js +445 -0
  198. package/dist/index-c442518b.js.map +1 -0
  199. package/dist/{index-26f3deee.js → index-c8d9113c.js} +2 -23
  200. package/dist/index-c8d9113c.js.map +1 -0
  201. package/dist/index.js +18 -7
  202. package/dist/index.js.map +1 -1
  203. package/dist/layouts.js +4 -2
  204. package/dist/layouts.js.map +1 -1
  205. package/dist/{useOverlayManager-e76af01f.js → useOverlayManager-95a474d5.js} +2 -2
  206. package/dist/{useOverlayManager-e76af01f.js.map → useOverlayManager-95a474d5.js.map} +1 -1
  207. package/dist/{useQueryParams-4731dc94.js → useQueryParams-4e7ddcf8.js} +2 -2
  208. package/dist/{useQueryParams-4731dc94.js.map → useQueryParams-4e7ddcf8.js.map} +1 -1
  209. package/package.json +13 -2
  210. package/dist/cjs/index-0e68cfff.js +0 -3934
  211. package/dist/cjs/index-0e68cfff.js.map +0 -1
  212. package/dist/cjs/index-16ef19ed.js.map +0 -1
  213. package/dist/cjs/index-e722fedf.js +0 -3844
  214. package/dist/cjs/index-e722fedf.js.map +0 -1
  215. package/dist/cjs/motion-a1906aff.js +0 -8892
  216. package/dist/cjs/motion-a1906aff.js.map +0 -1
  217. package/dist/cjs/react-select-creatable.esm-b39742a3.js +0 -6675
  218. package/dist/cjs/react-select-creatable.esm-b39742a3.js.map +0 -1
  219. package/dist/index-2123b5e9.js +0 -3927
  220. package/dist/index-2123b5e9.js.map +0 -1
  221. package/dist/index-26f3deee.js.map +0 -1
  222. package/dist/index-8ff7d9a1.js +0 -3837
  223. package/dist/index-8ff7d9a1.js.map +0 -1
  224. package/dist/motion-087daf52.js +0 -8862
  225. package/dist/motion-087daf52.js.map +0 -1
  226. package/dist/react-select-creatable.esm-93affeca.js +0 -6644
  227. package/dist/react-select-creatable.esm-93affeca.js.map +0 -1
package/dist/Toastr.js CHANGED
@@ -8,1663 +8,13 @@ import React__default from 'react';
8
8
  import { t } from 'i18next';
9
9
  import { Close, CheckCircle, Warning, CloseCircle, Info } from '@bigbinary/neeto-icons';
10
10
  import { Slide, toast } from 'react-toastify';
11
- import { n as noop$1, U as UniqueArray } from './index-26f3deee.js';
11
+ import { n as noop, U as UniqueArray } from './index-c8d9113c.js';
12
+ import { Options, options, tokenize } from 'linkifyjs';
12
13
  import './createClass-601a36b2.js';
13
14
  import '@bigbinary/neeto-cist';
14
15
  import 'util';
15
16
  import 'ramda';
16
17
 
17
- // THIS FILE IS AUTOMATICALLY GENERATED DO NOT EDIT DIRECTLY
18
- // See update-tlds.js for encoding/decoding format
19
- // https://data.iana.org/TLD/tlds-alpha-by-domain.txt
20
- const encodedTlds = 'aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2';
21
- // Internationalized domain names containing non-ASCII
22
- const encodedUtlds = 'ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2';
23
-
24
- /**
25
- * @template A
26
- * @template B
27
- * @param {A} target
28
- * @param {B} properties
29
- * @return {A & B}
30
- */
31
- const assign = (target, properties) => {
32
- for (const key in properties) {
33
- target[key] = properties[key];
34
- }
35
- return target;
36
- };
37
-
38
- /**
39
- * Finite State Machine generation utilities
40
- */
41
-
42
- /**
43
- * @template T
44
- * @typedef {{ [group: string]: T[] }} Collections
45
- */
46
-
47
- /**
48
- * @typedef {{ [group: string]: true }} Flags
49
- */
50
-
51
- // Keys in scanner Collections instances
52
- const numeric = 'numeric';
53
- const ascii = 'ascii';
54
- const alpha = 'alpha';
55
- const asciinumeric = 'asciinumeric';
56
- const alphanumeric = 'alphanumeric';
57
- const domain = 'domain';
58
- const emoji = 'emoji';
59
- const scheme = 'scheme';
60
- const slashscheme = 'slashscheme';
61
- const whitespace = 'whitespace';
62
-
63
- /**
64
- * @template T
65
- * @param {string} name
66
- * @param {Collections<T>} groups to register in
67
- * @returns {T[]} Current list of tokens in the given collection
68
- */
69
- function registerGroup(name, groups) {
70
- if (!(name in groups)) {
71
- groups[name] = [];
72
- }
73
- return groups[name];
74
- }
75
-
76
- /**
77
- * @template T
78
- * @param {T} t token to add
79
- * @param {Collections<T>} groups
80
- * @param {Flags} flags
81
- */
82
- function addToGroups(t, flags, groups) {
83
- if (flags[numeric]) {
84
- flags[asciinumeric] = true;
85
- flags[alphanumeric] = true;
86
- }
87
- if (flags[ascii]) {
88
- flags[asciinumeric] = true;
89
- flags[alpha] = true;
90
- }
91
- if (flags[asciinumeric]) {
92
- flags[alphanumeric] = true;
93
- }
94
- if (flags[alpha]) {
95
- flags[alphanumeric] = true;
96
- }
97
- if (flags[alphanumeric]) {
98
- flags[domain] = true;
99
- }
100
- if (flags[emoji]) {
101
- flags[domain] = true;
102
- }
103
- for (const k in flags) {
104
- const group = registerGroup(k, groups);
105
- if (group.indexOf(t) < 0) {
106
- group.push(t);
107
- }
108
- }
109
- }
110
-
111
- /**
112
- * @template T
113
- * @param {T} t token to check
114
- * @param {Collections<T>} groups
115
- * @returns {Flags} group flags that contain this token
116
- */
117
- function flagsForToken(t, groups) {
118
- const result = {};
119
- for (const c in groups) {
120
- if (groups[c].indexOf(t) >= 0) {
121
- result[c] = true;
122
- }
123
- }
124
- return result;
125
- }
126
-
127
- /**
128
- * @template T
129
- * @typedef {null | T } Transition
130
- */
131
-
132
- /**
133
- * Define a basic state machine state. j is the list of character transitions,
134
- * jr is the list of regex-match transitions, jd is the default state to
135
- * transition to t is the accepting token type, if any. If this is the terminal
136
- * state, then it does not emit a token.
137
- *
138
- * The template type T represents the type of the token this state accepts. This
139
- * should be a string (such as of the token exports in `text.js`) or a
140
- * MultiToken subclass (from `multi.js`)
141
- *
142
- * @template T
143
- * @param {T} [token] Token that this state emits
144
- */
145
- function State(token) {
146
- if (token === void 0) {
147
- token = null;
148
- }
149
- // this.n = null; // DEBUG: State name
150
- /** @type {{ [input: string]: State<T> }} j */
151
- this.j = {}; // IMPLEMENTATION 1
152
- // this.j = []; // IMPLEMENTATION 2
153
- /** @type {[RegExp, State<T>][]} jr */
154
- this.jr = [];
155
- /** @type {?State<T>} jd */
156
- this.jd = null;
157
- /** @type {?T} t */
158
- this.t = token;
159
- }
160
-
161
- /**
162
- * Scanner token groups
163
- * @type Collections<string>
164
- */
165
- State.groups = {};
166
- State.prototype = {
167
- accepts() {
168
- return !!this.t;
169
- },
170
- /**
171
- * Follow an existing transition from the given input to the next state.
172
- * Does not mutate.
173
- * @param {string} input character or token type to transition on
174
- * @returns {?State<T>} the next state, if any
175
- */
176
- go(input) {
177
- const state = this;
178
- const nextState = state.j[input];
179
- if (nextState) {
180
- return nextState;
181
- }
182
- for (let i = 0; i < state.jr.length; i++) {
183
- const regex = state.jr[i][0];
184
- const nextState = state.jr[i][1]; // note: might be empty to prevent default jump
185
- if (nextState && regex.test(input)) {
186
- return nextState;
187
- }
188
- }
189
- // Nowhere left to jump! Return default, if any
190
- return state.jd;
191
- },
192
- /**
193
- * Whether the state has a transition for the given input. Set the second
194
- * argument to true to only look for an exact match (and not a default or
195
- * regular-expression-based transition)
196
- * @param {string} input
197
- * @param {boolean} exactOnly
198
- */
199
- has(input, exactOnly) {
200
- if (exactOnly === void 0) {
201
- exactOnly = false;
202
- }
203
- return exactOnly ? input in this.j : !!this.go(input);
204
- },
205
- /**
206
- * Short for "transition all"; create a transition from the array of items
207
- * in the given list to the same final resulting state.
208
- * @param {string | string[]} inputs Group of inputs to transition on
209
- * @param {Transition<T> | State<T>} [next] Transition options
210
- * @param {Flags} [flags] Collections flags to add token to
211
- * @param {Collections<T>} [groups] Master list of token groups
212
- */
213
- ta(inputs, next, flags, groups) {
214
- for (let i = 0; i < inputs.length; i++) {
215
- this.tt(inputs[i], next, flags, groups);
216
- }
217
- },
218
- /**
219
- * Short for "take regexp transition"; defines a transition for this state
220
- * when it encounters a token which matches the given regular expression
221
- * @param {RegExp} regexp Regular expression transition (populate first)
222
- * @param {T | State<T>} [next] Transition options
223
- * @param {Flags} [flags] Collections flags to add token to
224
- * @param {Collections<T>} [groups] Master list of token groups
225
- * @returns {State<T>} taken after the given input
226
- */
227
- tr(regexp, next, flags, groups) {
228
- groups = groups || State.groups;
229
- let nextState;
230
- if (next && next.j) {
231
- nextState = next;
232
- } else {
233
- // Token with maybe token groups
234
- nextState = new State(next);
235
- if (flags && groups) {
236
- addToGroups(next, flags, groups);
237
- }
238
- }
239
- this.jr.push([regexp, nextState]);
240
- return nextState;
241
- },
242
- /**
243
- * Short for "take transitions", will take as many sequential transitions as
244
- * the length of the given input and returns the
245
- * resulting final state.
246
- * @param {string | string[]} input
247
- * @param {T | State<T>} [next] Transition options
248
- * @param {Flags} [flags] Collections flags to add token to
249
- * @param {Collections<T>} [groups] Master list of token groups
250
- * @returns {State<T>} taken after the given input
251
- */
252
- ts(input, next, flags, groups) {
253
- let state = this;
254
- const len = input.length;
255
- if (!len) {
256
- return state;
257
- }
258
- for (let i = 0; i < len - 1; i++) {
259
- state = state.tt(input[i]);
260
- }
261
- return state.tt(input[len - 1], next, flags, groups);
262
- },
263
- /**
264
- * Short for "take transition", this is a method for building/working with
265
- * state machines.
266
- *
267
- * If a state already exists for the given input, returns it.
268
- *
269
- * If a token is specified, that state will emit that token when reached by
270
- * the linkify engine.
271
- *
272
- * If no state exists, it will be initialized with some default transitions
273
- * that resemble existing default transitions.
274
- *
275
- * If a state is given for the second argument, that state will be
276
- * transitioned to on the given input regardless of what that input
277
- * previously did.
278
- *
279
- * Specify a token group flags to define groups that this token belongs to.
280
- * The token will be added to corresponding entires in the given groups
281
- * object.
282
- *
283
- * @param {string} input character, token type to transition on
284
- * @param {T | State<T>} [next] Transition options
285
- * @param {Flags} [flags] Collections flags to add token to
286
- * @param {Collections<T>} [groups] Master list of groups
287
- * @returns {State<T>} taken after the given input
288
- */
289
- tt(input, next, flags, groups) {
290
- groups = groups || State.groups;
291
- const state = this;
292
-
293
- // Check if existing state given, just a basic transition
294
- if (next && next.j) {
295
- state.j[input] = next;
296
- return next;
297
- }
298
- const t = next;
299
-
300
- // Take the transition with the usual default mechanisms and use that as
301
- // a template for creating the next state
302
- let nextState,
303
- templateState = state.go(input);
304
- if (templateState) {
305
- nextState = new State();
306
- assign(nextState.j, templateState.j);
307
- nextState.jr.push.apply(nextState.jr, templateState.jr);
308
- nextState.jd = templateState.jd;
309
- nextState.t = templateState.t;
310
- } else {
311
- nextState = new State();
312
- }
313
- if (t) {
314
- // Ensure newly token is in the same groups as the old token
315
- if (groups) {
316
- if (nextState.t && typeof nextState.t === 'string') {
317
- const allFlags = assign(flagsForToken(nextState.t, groups), flags);
318
- addToGroups(t, allFlags, groups);
319
- } else if (flags) {
320
- addToGroups(t, flags, groups);
321
- }
322
- }
323
- nextState.t = t; // overwrite anything that was previously there
324
- }
325
-
326
- state.j[input] = nextState;
327
- return nextState;
328
- }
329
- };
330
-
331
- // Helper functions to improve minification (not exported outside linkifyjs module)
332
-
333
- /**
334
- * @template T
335
- * @param {State<T>} state
336
- * @param {string | string[]} input
337
- * @param {Flags} [flags]
338
- * @param {Collections<T>} [groups]
339
- */
340
- const ta = (state, input, next, flags, groups) => state.ta(input, next, flags, groups);
341
-
342
- /**
343
- * @template T
344
- * @param {State<T>} state
345
- * @param {RegExp} regexp
346
- * @param {T | State<T>} [next]
347
- * @param {Flags} [flags]
348
- * @param {Collections<T>} [groups]
349
- */
350
- const tr = (state, regexp, next, flags, groups) => state.tr(regexp, next, flags, groups);
351
-
352
- /**
353
- * @template T
354
- * @param {State<T>} state
355
- * @param {string | string[]} input
356
- * @param {T | State<T>} [next]
357
- * @param {Flags} [flags]
358
- * @param {Collections<T>} [groups]
359
- */
360
- const ts = (state, input, next, flags, groups) => state.ts(input, next, flags, groups);
361
-
362
- /**
363
- * @template T
364
- * @param {State<T>} state
365
- * @param {string} input
366
- * @param {T | State<T>} [next]
367
- * @param {Collections<T>} [groups]
368
- * @param {Flags} [flags]
369
- */
370
- const tt = (state, input, next, flags, groups) => state.tt(input, next, flags, groups);
371
-
372
- /******************************************************************************
373
- Text Tokens
374
- Identifiers for token outputs from the regexp scanner
375
- ******************************************************************************/
376
-
377
- // A valid web domain token
378
- const WORD = 'WORD'; // only contains a-z
379
- const UWORD = 'UWORD'; // contains letters other than a-z, used for IDN
380
-
381
- // Special case of word
382
- const LOCALHOST = 'LOCALHOST';
383
-
384
- // Valid top-level domain, special case of WORD (see tlds.js)
385
- const TLD = 'TLD';
386
-
387
- // Valid IDN TLD, special case of UWORD (see tlds.js)
388
- const UTLD = 'UTLD';
389
-
390
- // The scheme portion of a web URI protocol. Supported types include: `mailto`,
391
- // `file`, and user-defined custom protocols. Limited to schemes that contain
392
- // only letters
393
- const SCHEME = 'SCHEME';
394
-
395
- // Similar to SCHEME, except makes distinction for schemes that must always be
396
- // followed by `://`, not just `:`. Supported types include `http`, `https`,
397
- // `ftp`, `ftps`
398
- const SLASH_SCHEME = 'SLASH_SCHEME';
399
-
400
- // Any sequence of digits 0-9
401
- const NUM = 'NUM';
402
-
403
- // Any number of consecutive whitespace characters that are not newline
404
- const WS = 'WS';
405
-
406
- // New line (unix style)
407
- const NL$1 = 'NL'; // \n
408
-
409
- // Opening/closing bracket classes
410
- const OPENBRACE = 'OPENBRACE'; // {
411
- const OPENBRACKET = 'OPENBRACKET'; // [
412
- const OPENANGLEBRACKET = 'OPENANGLEBRACKET'; // <
413
- const OPENPAREN = 'OPENPAREN'; // (
414
- const CLOSEBRACE = 'CLOSEBRACE'; // }
415
- const CLOSEBRACKET = 'CLOSEBRACKET'; // ]
416
- const CLOSEANGLEBRACKET = 'CLOSEANGLEBRACKET'; // >
417
- const CLOSEPAREN = 'CLOSEPAREN'; // )
418
-
419
- // Various symbols
420
- const AMPERSAND = 'AMPERSAND'; // &
421
- const APOSTROPHE = 'APOSTROPHE'; // '
422
- const ASTERISK = 'ASTERISK'; // *
423
- const AT = 'AT'; // @
424
- const BACKSLASH = 'BACKSLASH'; // \
425
- const BACKTICK = 'BACKTICK'; // `
426
- const CARET = 'CARET'; // ^
427
- const COLON = 'COLON'; // :
428
- const COMMA = 'COMMA'; // ,
429
- const DOLLAR = 'DOLLAR'; // $
430
- const DOT = 'DOT'; // .
431
- const EQUALS = 'EQUALS'; // =
432
- const EXCLAMATION = 'EXCLAMATION'; // !
433
- const HYPHEN = 'HYPHEN'; // -
434
- const PERCENT = 'PERCENT'; // %
435
- const PIPE = 'PIPE'; // |
436
- const PLUS = 'PLUS'; // +
437
- const POUND = 'POUND'; // #
438
- const QUERY = 'QUERY'; // ?
439
- const QUOTE = 'QUOTE'; // "
440
-
441
- const SEMI = 'SEMI'; // ;
442
- const SLASH = 'SLASH'; // /
443
- const TILDE = 'TILDE'; // ~
444
- const UNDERSCORE = 'UNDERSCORE'; // _
445
-
446
- // Emoji symbol
447
- const EMOJI$1 = 'EMOJI';
448
-
449
- // Default token - anything that is not one of the above
450
- const SYM = 'SYM';
451
-
452
- var tk = /*#__PURE__*/Object.freeze({
453
- __proto__: null,
454
- WORD: WORD,
455
- UWORD: UWORD,
456
- LOCALHOST: LOCALHOST,
457
- TLD: TLD,
458
- UTLD: UTLD,
459
- SCHEME: SCHEME,
460
- SLASH_SCHEME: SLASH_SCHEME,
461
- NUM: NUM,
462
- WS: WS,
463
- NL: NL$1,
464
- OPENBRACE: OPENBRACE,
465
- OPENBRACKET: OPENBRACKET,
466
- OPENANGLEBRACKET: OPENANGLEBRACKET,
467
- OPENPAREN: OPENPAREN,
468
- CLOSEBRACE: CLOSEBRACE,
469
- CLOSEBRACKET: CLOSEBRACKET,
470
- CLOSEANGLEBRACKET: CLOSEANGLEBRACKET,
471
- CLOSEPAREN: CLOSEPAREN,
472
- AMPERSAND: AMPERSAND,
473
- APOSTROPHE: APOSTROPHE,
474
- ASTERISK: ASTERISK,
475
- AT: AT,
476
- BACKSLASH: BACKSLASH,
477
- BACKTICK: BACKTICK,
478
- CARET: CARET,
479
- COLON: COLON,
480
- COMMA: COMMA,
481
- DOLLAR: DOLLAR,
482
- DOT: DOT,
483
- EQUALS: EQUALS,
484
- EXCLAMATION: EXCLAMATION,
485
- HYPHEN: HYPHEN,
486
- PERCENT: PERCENT,
487
- PIPE: PIPE,
488
- PLUS: PLUS,
489
- POUND: POUND,
490
- QUERY: QUERY,
491
- QUOTE: QUOTE,
492
- SEMI: SEMI,
493
- SLASH: SLASH,
494
- TILDE: TILDE,
495
- UNDERSCORE: UNDERSCORE,
496
- EMOJI: EMOJI$1,
497
- SYM: SYM
498
- });
499
-
500
- // Note that these two Unicode ones expand into a really big one with Babel
501
- const ASCII_LETTER = /[a-z]/;
502
- const LETTER = /\p{L}/u; // Any Unicode character with letter data type
503
- const EMOJI = /\p{Emoji}/u; // Any Unicode emoji character
504
- const DIGIT = /\d/;
505
- const SPACE = /\s/;
506
-
507
- /**
508
- The scanner provides an interface that takes a string of text as input, and
509
- outputs an array of tokens instances that can be used for easy URL parsing.
510
- */
511
- const NL = '\n'; // New line character
512
- const EMOJI_VARIATION = '\ufe0f'; // Variation selector, follows heart and others
513
- const EMOJI_JOINER = '\u200d'; // zero-width joiner
514
-
515
- let tlds = null,
516
- utlds = null; // don't change so only have to be computed once
517
-
518
- /**
519
- * Scanner output token:
520
- * - `t` is the token name (e.g., 'NUM', 'EMOJI', 'TLD')
521
- * - `v` is the value of the token (e.g., '123', '❤️', 'com')
522
- * - `s` is the start index of the token in the original string
523
- * - `e` is the end index of the token in the original string
524
- * @typedef {{t: string, v: string, s: number, e: number}} Token
525
- */
526
-
527
- /**
528
- * @template T
529
- * @typedef {{ [collection: string]: T[] }} Collections
530
- */
531
-
532
- /**
533
- * Initialize the scanner character-based state machine for the given start
534
- * state
535
- * @param {[string, boolean][]} customSchemes List of custom schemes, where each
536
- * item is a length-2 tuple with the first element set to the string scheme, and
537
- * the second element set to `true` if the `://` after the scheme is optional
538
- */
539
- function init$2(customSchemes) {
540
- if (customSchemes === void 0) {
541
- customSchemes = [];
542
- }
543
- // Frequently used states (name argument removed during minification)
544
- /** @type Collections<string> */
545
- const groups = {}; // of tokens
546
- State.groups = groups;
547
- /** @type State<string> */
548
- const Start = new State();
549
- if (tlds == null) {
550
- tlds = decodeTlds(encodedTlds);
551
- }
552
- if (utlds == null) {
553
- utlds = decodeTlds(encodedUtlds);
554
- }
555
-
556
- // States for special URL symbols that accept immediately after start
557
- tt(Start, "'", APOSTROPHE);
558
- tt(Start, '{', OPENBRACE);
559
- tt(Start, '[', OPENBRACKET);
560
- tt(Start, '<', OPENANGLEBRACKET);
561
- tt(Start, '(', OPENPAREN);
562
- tt(Start, '}', CLOSEBRACE);
563
- tt(Start, ']', CLOSEBRACKET);
564
- tt(Start, '>', CLOSEANGLEBRACKET);
565
- tt(Start, ')', CLOSEPAREN);
566
- tt(Start, '&', AMPERSAND);
567
- tt(Start, '*', ASTERISK);
568
- tt(Start, '@', AT);
569
- tt(Start, '`', BACKTICK);
570
- tt(Start, '^', CARET);
571
- tt(Start, ':', COLON);
572
- tt(Start, ',', COMMA);
573
- tt(Start, '$', DOLLAR);
574
- tt(Start, '.', DOT);
575
- tt(Start, '=', EQUALS);
576
- tt(Start, '!', EXCLAMATION);
577
- tt(Start, '-', HYPHEN);
578
- tt(Start, '%', PERCENT);
579
- tt(Start, '|', PIPE);
580
- tt(Start, '+', PLUS);
581
- tt(Start, '#', POUND);
582
- tt(Start, '?', QUERY);
583
- tt(Start, '"', QUOTE);
584
- tt(Start, '/', SLASH);
585
- tt(Start, ';', SEMI);
586
- tt(Start, '~', TILDE);
587
- tt(Start, '_', UNDERSCORE);
588
- tt(Start, '\\', BACKSLASH);
589
- const Num = tr(Start, DIGIT, NUM, {
590
- [numeric]: true
591
- });
592
- tr(Num, DIGIT, Num);
593
-
594
- // State which emits a word token
595
- const Word = tr(Start, ASCII_LETTER, WORD, {
596
- [ascii]: true
597
- });
598
- tr(Word, ASCII_LETTER, Word);
599
-
600
- // Same as previous, but specific to non-fsm.ascii alphabet words
601
- const UWord = tr(Start, LETTER, UWORD, {
602
- [alpha]: true
603
- });
604
- tr(UWord, ASCII_LETTER); // Non-accepting
605
- tr(UWord, LETTER, UWord);
606
-
607
- // Whitespace jumps
608
- // Tokens of only non-newline whitespace are arbitrarily long
609
- // If any whitespace except newline, more whitespace!
610
- const Ws = tr(Start, SPACE, WS, {
611
- [whitespace]: true
612
- });
613
- tt(Start, NL, NL$1, {
614
- [whitespace]: true
615
- });
616
- tt(Ws, NL); // non-accepting state to avoid mixing whitespaces
617
- tr(Ws, SPACE, Ws);
618
-
619
- // Emoji tokens. They are not grouped by the scanner except in cases where a
620
- // zero-width joiner is present
621
- const Emoji = tr(Start, EMOJI, EMOJI$1, {
622
- [emoji]: true
623
- });
624
- tr(Emoji, EMOJI, Emoji);
625
- tt(Emoji, EMOJI_VARIATION, Emoji);
626
- // tt(Start, EMOJI_VARIATION, Emoji); // This one is sketchy
627
-
628
- const EmojiJoiner = tt(Emoji, EMOJI_JOINER);
629
- tr(EmojiJoiner, EMOJI, Emoji);
630
- // tt(EmojiJoiner, EMOJI_VARIATION, Emoji); // also sketchy
631
-
632
- // Generates states for top-level domains
633
- // Note that this is most accurate when tlds are in alphabetical order
634
- const wordjr = [[ASCII_LETTER, Word]];
635
- const uwordjr = [[ASCII_LETTER, null], [LETTER, UWord]];
636
- for (let i = 0; i < tlds.length; i++) {
637
- fastts(Start, tlds[i], TLD, WORD, wordjr);
638
- }
639
- for (let i = 0; i < utlds.length; i++) {
640
- fastts(Start, utlds[i], UTLD, UWORD, uwordjr);
641
- }
642
- addToGroups(TLD, {
643
- tld: true,
644
- ascii: true
645
- }, groups);
646
- addToGroups(UTLD, {
647
- utld: true,
648
- alpha: true
649
- }, groups);
650
-
651
- // Collect the states generated by different protocols. NOTE: If any new TLDs
652
- // get added that are also protocols, set the token to be the same as the
653
- // protocol to ensure parsing works as expected.
654
- fastts(Start, 'file', SCHEME, WORD, wordjr);
655
- fastts(Start, 'mailto', SCHEME, WORD, wordjr);
656
- fastts(Start, 'http', SLASH_SCHEME, WORD, wordjr);
657
- fastts(Start, 'https', SLASH_SCHEME, WORD, wordjr);
658
- fastts(Start, 'ftp', SLASH_SCHEME, WORD, wordjr);
659
- fastts(Start, 'ftps', SLASH_SCHEME, WORD, wordjr);
660
- addToGroups(SCHEME, {
661
- scheme: true,
662
- ascii: true
663
- }, groups);
664
- addToGroups(SLASH_SCHEME, {
665
- slashscheme: true,
666
- ascii: true
667
- }, groups);
668
-
669
- // Register custom schemes. Assumes each scheme is asciinumeric with hyphens
670
- customSchemes = customSchemes.sort((a, b) => a[0] > b[0] ? 1 : -1);
671
- for (let i = 0; i < customSchemes.length; i++) {
672
- const sch = customSchemes[i][0];
673
- const optionalSlashSlash = customSchemes[i][1];
674
- const flags = optionalSlashSlash ? {
675
- [scheme]: true
676
- } : {
677
- [slashscheme]: true
678
- };
679
- if (sch.indexOf('-') >= 0) {
680
- flags[domain] = true;
681
- } else if (!ASCII_LETTER.test(sch)) {
682
- flags[numeric] = true; // numbers only
683
- } else if (DIGIT.test(sch)) {
684
- flags[asciinumeric] = true;
685
- } else {
686
- flags[ascii] = true;
687
- }
688
- ts(Start, sch, sch, flags);
689
- }
690
-
691
- // Localhost token
692
- ts(Start, 'localhost', LOCALHOST, {
693
- ascii: true
694
- });
695
-
696
- // Set default transition for start state (some symbol)
697
- Start.jd = new State(SYM);
698
- return {
699
- start: Start,
700
- tokens: assign({
701
- groups
702
- }, tk)
703
- };
704
- }
705
-
706
- /**
707
- Given a string, returns an array of TOKEN instances representing the
708
- composition of that string.
709
-
710
- @method run
711
- @param {State<string>} start scanner starting state
712
- @param {string} str input string to scan
713
- @return {Token[]} list of tokens, each with a type and value
714
- */
715
- function run$1(start, str) {
716
- // State machine is not case sensitive, so input is tokenized in lowercased
717
- // form (still returns regular case). Uses selective `toLowerCase` because
718
- // lowercasing the entire string causes the length and character position to
719
- // vary in some non-English strings with V8-based runtimes.
720
- const iterable = stringToArray(str.replace(/[A-Z]/g, c => c.toLowerCase()));
721
- const charCount = iterable.length; // <= len if there are emojis, etc
722
- const tokens = []; // return value
723
-
724
- // cursor through the string itself, accounting for characters that have
725
- // width with length 2 such as emojis
726
- let cursor = 0;
727
-
728
- // Cursor through the array-representation of the string
729
- let charCursor = 0;
730
-
731
- // Tokenize the string
732
- while (charCursor < charCount) {
733
- let state = start;
734
- let nextState = null;
735
- let tokenLength = 0;
736
- let latestAccepting = null;
737
- let sinceAccepts = -1;
738
- let charsSinceAccepts = -1;
739
- while (charCursor < charCount && (nextState = state.go(iterable[charCursor]))) {
740
- state = nextState;
741
-
742
- // Keep track of the latest accepting state
743
- if (state.accepts()) {
744
- sinceAccepts = 0;
745
- charsSinceAccepts = 0;
746
- latestAccepting = state;
747
- } else if (sinceAccepts >= 0) {
748
- sinceAccepts += iterable[charCursor].length;
749
- charsSinceAccepts++;
750
- }
751
- tokenLength += iterable[charCursor].length;
752
- cursor += iterable[charCursor].length;
753
- charCursor++;
754
- }
755
-
756
- // Roll back to the latest accepting state
757
- cursor -= sinceAccepts;
758
- charCursor -= charsSinceAccepts;
759
- tokenLength -= sinceAccepts;
760
-
761
- // No more jumps, just make a new token from the last accepting one
762
- tokens.push({
763
- t: latestAccepting.t,
764
- // token type/name
765
- v: str.slice(cursor - tokenLength, cursor),
766
- // string value
767
- s: cursor - tokenLength,
768
- // start index
769
- e: cursor // end index (excluding)
770
- });
771
- }
772
-
773
- return tokens;
774
- }
775
-
776
- /**
777
- * Convert a String to an Array of characters, taking into account that some
778
- * characters like emojis take up two string indexes.
779
- *
780
- * Adapted from core-js (MIT license)
781
- * https://github.com/zloirock/core-js/blob/2d69cf5f99ab3ea3463c395df81e5a15b68f49d9/packages/core-js/internals/string-multibyte.js
782
- *
783
- * @function stringToArray
784
- * @param {string} str
785
- * @returns {string[]}
786
- */
787
- function stringToArray(str) {
788
- const result = [];
789
- const len = str.length;
790
- let index = 0;
791
- while (index < len) {
792
- let first = str.charCodeAt(index);
793
- let second;
794
- let char = first < 0xd800 || first > 0xdbff || index + 1 === len || (second = str.charCodeAt(index + 1)) < 0xdc00 || second > 0xdfff ? str[index] // single character
795
- : str.slice(index, index + 2); // two-index characters
796
- result.push(char);
797
- index += char.length;
798
- }
799
- return result;
800
- }
801
-
802
- /**
803
- * Fast version of ts function for when transition defaults are well known
804
- * @param {State<string>} state
805
- * @param {string} input
806
- * @param {string} t
807
- * @param {string} defaultt
808
- * @param {[RegExp, State<string>][]} jr
809
- * @returns {State<string>}
810
- */
811
- function fastts(state, input, t, defaultt, jr) {
812
- let next;
813
- const len = input.length;
814
- for (let i = 0; i < len - 1; i++) {
815
- const char = input[i];
816
- if (state.j[char]) {
817
- next = state.j[char];
818
- } else {
819
- next = new State(defaultt);
820
- next.jr = jr.slice();
821
- state.j[char] = next;
822
- }
823
- state = next;
824
- }
825
- next = new State(t);
826
- next.jr = jr.slice();
827
- state.j[input[len - 1]] = next;
828
- return next;
829
- }
830
-
831
- /**
832
- * Converts a string of Top-Level Domain names encoded in update-tlds.js back
833
- * into a list of strings.
834
- * @param {str} encoded encoded TLDs string
835
- * @returns {str[]} original TLDs list
836
- */
837
- function decodeTlds(encoded) {
838
- const words = [];
839
- const stack = [];
840
- let i = 0;
841
- let digits = '0123456789';
842
- while (i < encoded.length) {
843
- let popDigitCount = 0;
844
- while (digits.indexOf(encoded[i + popDigitCount]) >= 0) {
845
- popDigitCount++; // encountered some digits, have to pop to go one level up trie
846
- }
847
-
848
- if (popDigitCount > 0) {
849
- words.push(stack.join('')); // whatever preceded the pop digits must be a word
850
- for (let popCount = parseInt(encoded.substring(i, i + popDigitCount), 10); popCount > 0; popCount--) {
851
- stack.pop();
852
- }
853
- i += popDigitCount;
854
- } else {
855
- stack.push(encoded[i]); // drop down a level into the trie
856
- i++;
857
- }
858
- }
859
- return words;
860
- }
861
-
862
- /**
863
- * An object where each key is a valid DOM Event Name such as `click` or `focus`
864
- * and each value is an event handler function.
865
- *
866
- * https://developer.mozilla.org/en-US/docs/Web/API/Element#events
867
- * @typedef {?{ [event: string]: Function }} EventListeners
868
- */
869
-
870
- /**
871
- * All formatted properties required to render a link, including `tagName`,
872
- * `attributes`, `content` and `eventListeners`.
873
- * @typedef {{ tagName: any, attributes: {[attr: string]: any}, content: string,
874
- * eventListeners: EventListeners }} IntermediateRepresentation
875
- */
876
-
877
- /**
878
- * Specify either an object described by the template type `O` or a function.
879
- *
880
- * The function takes a string value (usually the link's href attribute), the
881
- * link type (`'url'`, `'hashtag`', etc.) and an internal token representation
882
- * of the link. It should return an object of the template type `O`
883
- * @template O
884
- * @typedef {O | ((value: string, type: string, token: MultiToken) => O)} OptObj
885
- */
886
-
887
- /**
888
- * Specify either a function described by template type `F` or an object.
889
- *
890
- * Each key in the object should be a link type (`'url'`, `'hashtag`', etc.). Each
891
- * value should be a function with template type `F` that is called when the
892
- * corresponding link type is encountered.
893
- * @template F
894
- * @typedef {F | { [type: string]: F}} OptFn
895
- */
896
-
897
- /**
898
- * Specify either a value with template type `V`, a function that returns `V` or
899
- * an object where each value resolves to `V`.
900
- *
901
- * The function takes a string value (usually the link's href attribute), the
902
- * link type (`'url'`, `'hashtag`', etc.) and an internal token representation
903
- * of the link. It should return an object of the template type `V`
904
- *
905
- * For the object, each key should be a link type (`'url'`, `'hashtag`', etc.).
906
- * Each value should either have type `V` or a function that returns V. This
907
- * function similarly takes a string value and a token.
908
- *
909
- * Example valid types for `Opt<string>`:
910
- *
911
- * ```js
912
- * 'hello'
913
- * (value, type, token) => 'world'
914
- * { url: 'hello', email: (value, token) => 'world'}
915
- * ```
916
- * @template V
917
- * @typedef {V | ((value: string, type: string, token: MultiToken) => V) | { [type: string]: V | ((value: string, token: MultiToken) => V) }} Opt
918
- */
919
-
920
- /**
921
- * See available options: https://linkify.js.org/docs/options.html
922
- * @typedef {{
923
- * defaultProtocol?: string,
924
- * events?: OptObj<EventListeners>,
925
- * format?: Opt<string>,
926
- * formatHref?: Opt<string>,
927
- * nl2br?: boolean,
928
- * tagName?: Opt<any>,
929
- * target?: Opt<string>,
930
- * rel?: Opt<string>,
931
- * validate?: Opt<boolean>,
932
- * truncate?: Opt<number>,
933
- * className?: Opt<string>,
934
- * attributes?: OptObj<({ [attr: string]: any })>,
935
- * ignoreTags?: string[],
936
- * render?: OptFn<((ir: IntermediateRepresentation) => any)>
937
- * }} Opts
938
- */
939
-
940
- /**
941
- * @type Required<Opts>
942
- */
943
- const defaults = {
944
- defaultProtocol: 'http',
945
- events: null,
946
- format: noop,
947
- formatHref: noop,
948
- nl2br: false,
949
- tagName: 'a',
950
- target: null,
951
- rel: null,
952
- validate: true,
953
- truncate: Infinity,
954
- className: null,
955
- attributes: null,
956
- ignoreTags: [],
957
- render: null
958
- };
959
-
960
- /**
961
- * Utility class for linkify interfaces to apply specified
962
- * {@link Opts formatting and rendering options}.
963
- *
964
- * @param {Opts | Options} [opts] Option value overrides.
965
- * @param {(ir: IntermediateRepresentation) => any} [defaultRender] (For
966
- * internal use) default render function that determines how to generate an
967
- * HTML element based on a link token's derived tagName, attributes and HTML.
968
- * Similar to render option
969
- */
970
- function Options(opts, defaultRender) {
971
- if (defaultRender === void 0) {
972
- defaultRender = null;
973
- }
974
- let o = assign({}, defaults);
975
- if (opts) {
976
- o = assign(o, opts instanceof Options ? opts.o : opts);
977
- }
978
-
979
- // Ensure all ignored tags are uppercase
980
- const ignoredTags = o.ignoreTags;
981
- const uppercaseIgnoredTags = [];
982
- for (let i = 0; i < ignoredTags.length; i++) {
983
- uppercaseIgnoredTags.push(ignoredTags[i].toUpperCase());
984
- }
985
- /** @protected */
986
- this.o = o;
987
- if (defaultRender) {
988
- this.defaultRender = defaultRender;
989
- }
990
- this.ignoreTags = uppercaseIgnoredTags;
991
- }
992
- Options.prototype = {
993
- o: defaults,
994
- /**
995
- * @type string[]
996
- */
997
- ignoreTags: [],
998
- /**
999
- * @param {IntermediateRepresentation} ir
1000
- * @returns {any}
1001
- */
1002
- defaultRender(ir) {
1003
- return ir;
1004
- },
1005
- /**
1006
- * Returns true or false based on whether a token should be displayed as a
1007
- * link based on the user options.
1008
- * @param {MultiToken} token
1009
- * @returns {boolean}
1010
- */
1011
- check(token) {
1012
- return this.get('validate', token.toString(), token);
1013
- },
1014
- // Private methods
1015
-
1016
- /**
1017
- * Resolve an option's value based on the value of the option and the given
1018
- * params. If operator and token are specified and the target option is
1019
- * callable, automatically calls the function with the given argument.
1020
- * @template {keyof Opts} K
1021
- * @param {K} key Name of option to use
1022
- * @param {string} [operator] will be passed to the target option if it's a
1023
- * function. If not specified, RAW function value gets returned
1024
- * @param {MultiToken} [token] The token from linkify.tokenize
1025
- * @returns {Opts[K] | any}
1026
- */
1027
- get(key, operator, token) {
1028
- const isCallable = operator != null;
1029
- let option = this.o[key];
1030
- if (!option) {
1031
- return option;
1032
- }
1033
- if (typeof option === 'object') {
1034
- option = token.t in option ? option[token.t] : defaults[key];
1035
- if (typeof option === 'function' && isCallable) {
1036
- option = option(operator, token);
1037
- }
1038
- } else if (typeof option === 'function' && isCallable) {
1039
- option = option(operator, token.t, token);
1040
- }
1041
- return option;
1042
- },
1043
- /**
1044
- * @template {keyof Opts} L
1045
- * @param {L} key Name of options object to use
1046
- * @param {string} [operator]
1047
- * @param {MultiToken} [token]
1048
- * @returns {Opts[L] | any}
1049
- */
1050
- getObj(key, operator, token) {
1051
- let obj = this.o[key];
1052
- if (typeof obj === 'function' && operator != null) {
1053
- obj = obj(operator, token.t, token);
1054
- }
1055
- return obj;
1056
- },
1057
- /**
1058
- * Convert the given token to a rendered element that may be added to the
1059
- * calling-interface's DOM
1060
- * @param {MultiToken} token Token to render to an HTML element
1061
- * @returns {any} Render result; e.g., HTML string, DOM element, React
1062
- * Component, etc.
1063
- */
1064
- render(token) {
1065
- const ir = token.render(this); // intermediate representation
1066
- const renderFn = this.get('render', null, token) || this.defaultRender;
1067
- return renderFn(ir, token.t, token);
1068
- }
1069
- };
1070
- function noop(val) {
1071
- return val;
1072
- }
1073
-
1074
- var options = /*#__PURE__*/Object.freeze({
1075
- __proto__: null,
1076
- defaults: defaults,
1077
- Options: Options,
1078
- assign: assign
1079
- });
1080
-
1081
- /******************************************************************************
1082
- Multi-Tokens
1083
- Tokens composed of arrays of TextTokens
1084
- ******************************************************************************/
1085
-
1086
- /**
1087
- * @param {string} value
1088
- * @param {Token[]} tokens
1089
- */
1090
- function MultiToken(value, tokens) {
1091
- this.t = 'token';
1092
- this.v = value;
1093
- this.tk = tokens;
1094
- }
1095
-
1096
- /**
1097
- * Abstract class used for manufacturing tokens of text tokens. That is rather
1098
- * than the value for a token being a small string of text, it's value an array
1099
- * of text tokens.
1100
- *
1101
- * Used for grouping together URLs, emails, hashtags, and other potential
1102
- * creations.
1103
- * @class MultiToken
1104
- * @property {string} t
1105
- * @property {string} v
1106
- * @property {Token[]} tk
1107
- * @abstract
1108
- */
1109
- MultiToken.prototype = {
1110
- isLink: false,
1111
- /**
1112
- * Return the string this token represents.
1113
- * @return {string}
1114
- */
1115
- toString() {
1116
- return this.v;
1117
- },
1118
- /**
1119
- * What should the value for this token be in the `href` HTML attribute?
1120
- * Returns the `.toString` value by default.
1121
- * @param {string} [scheme]
1122
- * @return {string}
1123
- */
1124
- toHref(scheme) {
1125
- return this.toString();
1126
- },
1127
- /**
1128
- * @param {Options} options Formatting options
1129
- * @returns {string}
1130
- */
1131
- toFormattedString(options) {
1132
- const val = this.toString();
1133
- const truncate = options.get('truncate', val, this);
1134
- const formatted = options.get('format', val, this);
1135
- return truncate && formatted.length > truncate ? formatted.substring(0, truncate) + '…' : formatted;
1136
- },
1137
- /**
1138
- *
1139
- * @param {Options} options
1140
- * @returns {string}
1141
- */
1142
- toFormattedHref(options) {
1143
- return options.get('formatHref', this.toHref(options.get('defaultProtocol')), this);
1144
- },
1145
- /**
1146
- * The start index of this token in the original input string
1147
- * @returns {number}
1148
- */
1149
- startIndex() {
1150
- return this.tk[0].s;
1151
- },
1152
- /**
1153
- * The end index of this token in the original input string (up to this
1154
- * index but not including it)
1155
- * @returns {number}
1156
- */
1157
- endIndex() {
1158
- return this.tk[this.tk.length - 1].e;
1159
- },
1160
- /**
1161
- Returns an object of relevant values for this token, which includes keys
1162
- * type - Kind of token ('url', 'email', etc.)
1163
- * value - Original text
1164
- * href - The value that should be added to the anchor tag's href
1165
- attribute
1166
- @method toObject
1167
- @param {string} [protocol] `'http'` by default
1168
- */
1169
- toObject(protocol) {
1170
- if (protocol === void 0) {
1171
- protocol = defaults.defaultProtocol;
1172
- }
1173
- return {
1174
- type: this.t,
1175
- value: this.toString(),
1176
- isLink: this.isLink,
1177
- href: this.toHref(protocol),
1178
- start: this.startIndex(),
1179
- end: this.endIndex()
1180
- };
1181
- },
1182
- /**
1183
- *
1184
- * @param {Options} options Formatting option
1185
- */
1186
- toFormattedObject(options) {
1187
- return {
1188
- type: this.t,
1189
- value: this.toFormattedString(options),
1190
- isLink: this.isLink,
1191
- href: this.toFormattedHref(options),
1192
- start: this.startIndex(),
1193
- end: this.endIndex()
1194
- };
1195
- },
1196
- /**
1197
- * Whether this token should be rendered as a link according to the given options
1198
- * @param {Options} options
1199
- * @returns {boolean}
1200
- */
1201
- validate(options) {
1202
- return options.get('validate', this.toString(), this);
1203
- },
1204
- /**
1205
- * Return an object that represents how this link should be rendered.
1206
- * @param {Options} options Formattinng options
1207
- */
1208
- render(options) {
1209
- const token = this;
1210
- const href = this.toHref(options.get('defaultProtocol'));
1211
- const formattedHref = options.get('formatHref', href, this);
1212
- const tagName = options.get('tagName', href, token);
1213
- const content = this.toFormattedString(options);
1214
- const attributes = {};
1215
- const className = options.get('className', href, token);
1216
- const target = options.get('target', href, token);
1217
- const rel = options.get('rel', href, token);
1218
- const attrs = options.getObj('attributes', href, token);
1219
- const eventListeners = options.getObj('events', href, token);
1220
- attributes.href = formattedHref;
1221
- if (className) {
1222
- attributes.class = className;
1223
- }
1224
- if (target) {
1225
- attributes.target = target;
1226
- }
1227
- if (rel) {
1228
- attributes.rel = rel;
1229
- }
1230
- if (attrs) {
1231
- assign(attributes, attrs);
1232
- }
1233
- return {
1234
- tagName,
1235
- attributes,
1236
- content,
1237
- eventListeners
1238
- };
1239
- }
1240
- };
1241
-
1242
- /**
1243
- * Create a new token that can be emitted by the parser state machine
1244
- * @param {string} type readable type of the token
1245
- * @param {object} props properties to assign or override, including isLink = true or false
1246
- * @returns {new (value: string, tokens: Token[]) => MultiToken} new token class
1247
- */
1248
- function createTokenClass(type, props) {
1249
- class Token extends MultiToken {
1250
- constructor(value, tokens) {
1251
- super(value, tokens);
1252
- this.t = type;
1253
- }
1254
- }
1255
- for (const p in props) {
1256
- Token.prototype[p] = props[p];
1257
- }
1258
- Token.t = type;
1259
- return Token;
1260
- }
1261
-
1262
- /**
1263
- Represents a list of tokens making up a valid email address
1264
- */
1265
- const Email = createTokenClass('email', {
1266
- isLink: true,
1267
- toHref() {
1268
- return 'mailto:' + this.toString();
1269
- }
1270
- });
1271
-
1272
- /**
1273
- Represents some plain text
1274
- */
1275
- const Text = createTokenClass('text');
1276
-
1277
- /**
1278
- Multi-linebreak token - represents a line break
1279
- @class Nl
1280
- */
1281
- const Nl = createTokenClass('nl');
1282
-
1283
- /**
1284
- Represents a list of text tokens making up a valid URL
1285
- @class Url
1286
- */
1287
- const Url = createTokenClass('url', {
1288
- isLink: true,
1289
- /**
1290
- Lowercases relevant parts of the domain and adds the protocol if
1291
- required. Note that this will not escape unsafe HTML characters in the
1292
- URL.
1293
- @param {string} [scheme] default scheme (e.g., 'https')
1294
- @return {string} the full href
1295
- */
1296
- toHref(scheme) {
1297
- if (scheme === void 0) {
1298
- scheme = defaults.defaultProtocol;
1299
- }
1300
- // Check if already has a prefix scheme
1301
- return this.hasProtocol() ? this.v : `${scheme}://${this.v}`;
1302
- },
1303
- /**
1304
- * Check whether this URL token has a protocol
1305
- * @return {boolean}
1306
- */
1307
- hasProtocol() {
1308
- const tokens = this.tk;
1309
- return tokens.length >= 2 && tokens[0].t !== LOCALHOST && tokens[1].t === COLON;
1310
- }
1311
- });
1312
-
1313
- /**
1314
- Not exactly parser, more like the second-stage scanner (although we can
1315
- theoretically hotswap the code here with a real parser in the future... but
1316
- for a little URL-finding utility abstract syntax trees may be a little
1317
- overkill).
1318
-
1319
- URL format: http://en.wikipedia.org/wiki/URI_scheme
1320
- Email format: http://en.wikipedia.org/wiki/EmailAddress (links to RFC in
1321
- reference)
1322
-
1323
- @module linkify
1324
- @submodule parser
1325
- @main run
1326
- */
1327
- const makeState = arg => new State(arg);
1328
-
1329
- /**
1330
- * Generate the parser multi token-based state machine
1331
- * @param {{ groups: Collections<string> }} tokens
1332
- */
1333
- function init$1(_ref) {
1334
- let {
1335
- groups
1336
- } = _ref;
1337
- // Types of characters the URL can definitely end in
1338
- const qsAccepting = groups.domain.concat([AMPERSAND, ASTERISK, AT, BACKSLASH, BACKTICK, CARET, DOLLAR, EQUALS, HYPHEN, NUM, PERCENT, PIPE, PLUS, POUND, SLASH, SYM, TILDE, UNDERSCORE]);
1339
-
1340
- // Types of tokens that can follow a URL and be part of the query string
1341
- // but cannot be the very last characters
1342
- // Characters that cannot appear in the URL at all should be excluded
1343
- const qsNonAccepting = [APOSTROPHE, CLOSEANGLEBRACKET, CLOSEBRACE, CLOSEBRACKET, CLOSEPAREN, COLON, COMMA, DOT, EXCLAMATION, OPENANGLEBRACKET, OPENBRACE, OPENBRACKET, OPENPAREN, QUERY, QUOTE, SEMI];
1344
-
1345
- // For addresses without the mailto prefix
1346
- // Tokens allowed in the localpart of the email
1347
- const localpartAccepting = [AMPERSAND, APOSTROPHE, ASTERISK, BACKSLASH, BACKTICK, CARET, CLOSEBRACE, DOLLAR, EQUALS, HYPHEN, OPENBRACE, PERCENT, PIPE, PLUS, POUND, QUERY, SLASH, SYM, TILDE, UNDERSCORE];
1348
-
1349
- // The universal starting state.
1350
- /**
1351
- * @type State<Token>
1352
- */
1353
- const Start = makeState();
1354
- const Localpart = tt(Start, TILDE); // Local part of the email address
1355
- ta(Localpart, localpartAccepting, Localpart);
1356
- ta(Localpart, groups.domain, Localpart);
1357
- const Domain = makeState(),
1358
- Scheme = makeState(),
1359
- SlashScheme = makeState();
1360
- ta(Start, groups.domain, Domain); // parsed string ends with a potential domain name (A)
1361
- ta(Start, groups.scheme, Scheme); // e.g., 'mailto'
1362
- ta(Start, groups.slashscheme, SlashScheme); // e.g., 'http'
1363
-
1364
- ta(Domain, localpartAccepting, Localpart);
1365
- ta(Domain, groups.domain, Domain);
1366
- const LocalpartAt = tt(Domain, AT); // Local part of the email address plus @
1367
-
1368
- tt(Localpart, AT, LocalpartAt); // close to an email address now
1369
-
1370
- // Local part of an email address can be e.g. 'http' or 'mailto'
1371
- tt(Scheme, AT, LocalpartAt);
1372
- tt(SlashScheme, AT, LocalpartAt);
1373
- const LocalpartDot = tt(Localpart, DOT); // Local part of the email address plus '.' (localpart cannot end in .)
1374
- ta(LocalpartDot, localpartAccepting, Localpart);
1375
- ta(LocalpartDot, groups.domain, Localpart);
1376
- const EmailDomain = makeState();
1377
- ta(LocalpartAt, groups.domain, EmailDomain); // parsed string starts with local email info + @ with a potential domain name
1378
- ta(EmailDomain, groups.domain, EmailDomain);
1379
- const EmailDomainDot = tt(EmailDomain, DOT); // domain followed by DOT
1380
- ta(EmailDomainDot, groups.domain, EmailDomain);
1381
- const Email$1 = makeState(Email); // Possible email address (could have more tlds)
1382
- ta(EmailDomainDot, groups.tld, Email$1);
1383
- ta(EmailDomainDot, groups.utld, Email$1);
1384
- tt(LocalpartAt, LOCALHOST, Email$1);
1385
-
1386
- // Hyphen can jump back to a domain name
1387
- const EmailDomainHyphen = tt(EmailDomain, HYPHEN); // parsed string starts with local email info + @ with a potential domain name
1388
- ta(EmailDomainHyphen, groups.domain, EmailDomain);
1389
- ta(Email$1, groups.domain, EmailDomain);
1390
- tt(Email$1, DOT, EmailDomainDot);
1391
- tt(Email$1, HYPHEN, EmailDomainHyphen);
1392
-
1393
- // Final possible email states
1394
- const EmailColon = tt(Email$1, COLON); // URL followed by colon (potential port number here)
1395
- /*const EmailColonPort = */
1396
- ta(EmailColon, groups.numeric, Email); // URL followed by colon and port numner
1397
-
1398
- // Account for dots and hyphens. Hyphens are usually parts of domain names
1399
- // (but not TLDs)
1400
- const DomainHyphen = tt(Domain, HYPHEN); // domain followed by hyphen
1401
- const DomainDot = tt(Domain, DOT); // domain followed by DOT
1402
- ta(DomainHyphen, groups.domain, Domain);
1403
- ta(DomainDot, localpartAccepting, Localpart);
1404
- ta(DomainDot, groups.domain, Domain);
1405
- const DomainDotTld = makeState(Url); // Simplest possible URL with no query string
1406
- ta(DomainDot, groups.tld, DomainDotTld);
1407
- ta(DomainDot, groups.utld, DomainDotTld);
1408
- ta(DomainDotTld, groups.domain, Domain);
1409
- ta(DomainDotTld, localpartAccepting, Localpart);
1410
- tt(DomainDotTld, DOT, DomainDot);
1411
- tt(DomainDotTld, HYPHEN, DomainHyphen);
1412
- tt(DomainDotTld, AT, LocalpartAt);
1413
- const DomainDotTldColon = tt(DomainDotTld, COLON); // URL followed by colon (potential port number here)
1414
- const DomainDotTldColonPort = makeState(Url); // TLD followed by a port number
1415
- ta(DomainDotTldColon, groups.numeric, DomainDotTldColonPort);
1416
-
1417
- // Long URL with optional port and maybe query string
1418
- const Url$1 = makeState(Url);
1419
-
1420
- // URL with extra symbols at the end, followed by an opening bracket
1421
- const UrlNonaccept = makeState(); // URL followed by some symbols (will not be part of the final URL)
1422
-
1423
- // Query strings
1424
- ta(Url$1, qsAccepting, Url$1);
1425
- ta(Url$1, qsNonAccepting, UrlNonaccept);
1426
- ta(UrlNonaccept, qsAccepting, Url$1);
1427
- ta(UrlNonaccept, qsNonAccepting, UrlNonaccept);
1428
-
1429
- // Become real URLs after `SLASH` or `COLON NUM SLASH`
1430
- // Here works with or without scheme:// prefix
1431
- tt(DomainDotTld, SLASH, Url$1);
1432
- tt(DomainDotTldColonPort, SLASH, Url$1);
1433
-
1434
- // Note that domains that begin with schemes are treated slighly differently
1435
- const SchemeColon = tt(Scheme, COLON); // e.g., 'mailto:'
1436
- const SlashSchemeColon = tt(SlashScheme, COLON); // e.g., 'http:'
1437
- const SlashSchemeColonSlash = tt(SlashSchemeColon, SLASH); // e.g., 'http:/'
1438
-
1439
- const UriPrefix = tt(SlashSchemeColonSlash, SLASH); // e.g., 'http://'
1440
-
1441
- // Scheme states can transition to domain states
1442
- ta(Scheme, groups.domain, Domain);
1443
- tt(Scheme, DOT, DomainDot);
1444
- tt(Scheme, HYPHEN, DomainHyphen);
1445
- ta(SlashScheme, groups.domain, Domain);
1446
- tt(SlashScheme, DOT, DomainDot);
1447
- tt(SlashScheme, HYPHEN, DomainHyphen);
1448
-
1449
- // Force URL with scheme prefix followed by anything sane
1450
- ta(SchemeColon, groups.domain, Url$1);
1451
- tt(SchemeColon, SLASH, Url$1);
1452
- ta(UriPrefix, groups.domain, Url$1);
1453
- ta(UriPrefix, qsAccepting, Url$1);
1454
- tt(UriPrefix, SLASH, Url$1);
1455
-
1456
- // URL, followed by an opening bracket
1457
- const UrlOpenbrace = tt(Url$1, OPENBRACE); // URL followed by {
1458
- const UrlOpenbracket = tt(Url$1, OPENBRACKET); // URL followed by [
1459
- const UrlOpenanglebracket = tt(Url$1, OPENANGLEBRACKET); // URL followed by <
1460
- const UrlOpenparen = tt(Url$1, OPENPAREN); // URL followed by (
1461
-
1462
- tt(UrlNonaccept, OPENBRACE, UrlOpenbrace);
1463
- tt(UrlNonaccept, OPENBRACKET, UrlOpenbracket);
1464
- tt(UrlNonaccept, OPENANGLEBRACKET, UrlOpenanglebracket);
1465
- tt(UrlNonaccept, OPENPAREN, UrlOpenparen);
1466
-
1467
- // Closing bracket component. This character WILL be included in the URL
1468
- tt(UrlOpenbrace, CLOSEBRACE, Url$1);
1469
- tt(UrlOpenbracket, CLOSEBRACKET, Url$1);
1470
- tt(UrlOpenanglebracket, CLOSEANGLEBRACKET, Url$1);
1471
- tt(UrlOpenparen, CLOSEPAREN, Url$1);
1472
- tt(UrlOpenbrace, CLOSEBRACE, Url$1);
1473
-
1474
- // URL that beings with an opening bracket, followed by a symbols.
1475
- // Note that the final state can still be `UrlOpenbrace` (if the URL only
1476
- // has a single opening bracket for some reason).
1477
- const UrlOpenbraceQ = makeState(Url); // URL followed by { and some symbols that the URL can end it
1478
- const UrlOpenbracketQ = makeState(Url); // URL followed by [ and some symbols that the URL can end it
1479
- const UrlOpenanglebracketQ = makeState(Url); // URL followed by < and some symbols that the URL can end it
1480
- const UrlOpenparenQ = makeState(Url); // URL followed by ( and some symbols that the URL can end it
1481
- ta(UrlOpenbrace, qsAccepting, UrlOpenbraceQ);
1482
- ta(UrlOpenbracket, qsAccepting, UrlOpenbracketQ);
1483
- ta(UrlOpenanglebracket, qsAccepting, UrlOpenanglebracketQ);
1484
- ta(UrlOpenparen, qsAccepting, UrlOpenparenQ);
1485
- const UrlOpenbraceSyms = makeState(); // UrlOpenbrace followed by some symbols it cannot end it
1486
- const UrlOpenbracketSyms = makeState(); // UrlOpenbracketQ followed by some symbols it cannot end it
1487
- const UrlOpenanglebracketSyms = makeState(); // UrlOpenanglebracketQ followed by some symbols it cannot end it
1488
- const UrlOpenparenSyms = makeState(); // UrlOpenparenQ followed by some symbols it cannot end it
1489
- ta(UrlOpenbrace, qsNonAccepting);
1490
- ta(UrlOpenbracket, qsNonAccepting);
1491
- ta(UrlOpenanglebracket, qsNonAccepting);
1492
- ta(UrlOpenparen, qsNonAccepting);
1493
-
1494
- // URL that begins with an opening bracket, followed by some symbols
1495
- ta(UrlOpenbraceQ, qsAccepting, UrlOpenbraceQ);
1496
- ta(UrlOpenbracketQ, qsAccepting, UrlOpenbracketQ);
1497
- ta(UrlOpenanglebracketQ, qsAccepting, UrlOpenanglebracketQ);
1498
- ta(UrlOpenparenQ, qsAccepting, UrlOpenparenQ);
1499
- ta(UrlOpenbraceQ, qsNonAccepting, UrlOpenbraceQ);
1500
- ta(UrlOpenbracketQ, qsNonAccepting, UrlOpenbracketQ);
1501
- ta(UrlOpenanglebracketQ, qsNonAccepting, UrlOpenanglebracketQ);
1502
- ta(UrlOpenparenQ, qsNonAccepting, UrlOpenparenQ);
1503
- ta(UrlOpenbraceSyms, qsAccepting, UrlOpenbraceSyms);
1504
- ta(UrlOpenbracketSyms, qsAccepting, UrlOpenbracketQ);
1505
- ta(UrlOpenanglebracketSyms, qsAccepting, UrlOpenanglebracketQ);
1506
- ta(UrlOpenparenSyms, qsAccepting, UrlOpenparenQ);
1507
- ta(UrlOpenbraceSyms, qsNonAccepting, UrlOpenbraceSyms);
1508
- ta(UrlOpenbracketSyms, qsNonAccepting, UrlOpenbracketSyms);
1509
- ta(UrlOpenanglebracketSyms, qsNonAccepting, UrlOpenanglebracketSyms);
1510
- ta(UrlOpenparenSyms, qsNonAccepting, UrlOpenparenSyms);
1511
-
1512
- // Close brace/bracket to become regular URL
1513
- tt(UrlOpenbracketQ, CLOSEBRACKET, Url$1);
1514
- tt(UrlOpenanglebracketQ, CLOSEANGLEBRACKET, Url$1);
1515
- tt(UrlOpenparenQ, CLOSEPAREN, Url$1);
1516
- tt(UrlOpenbraceQ, CLOSEBRACE, Url$1);
1517
- tt(UrlOpenbracketSyms, CLOSEBRACKET, Url$1);
1518
- tt(UrlOpenanglebracketSyms, CLOSEANGLEBRACKET, Url$1);
1519
- tt(UrlOpenparenSyms, CLOSEPAREN, Url$1);
1520
- tt(UrlOpenbraceSyms, CLOSEPAREN, Url$1);
1521
- tt(Start, LOCALHOST, DomainDotTld); // localhost is a valid URL state
1522
- tt(Start, NL$1, Nl); // single new line
1523
-
1524
- return {
1525
- start: Start,
1526
- tokens: tk
1527
- };
1528
- }
1529
-
1530
- /**
1531
- * Run the parser state machine on a list of scanned string-based tokens to
1532
- * create a list of multi tokens, each of which represents a URL, email address,
1533
- * plain text, etc.
1534
- *
1535
- * @param {State<MultiToken>} start parser start state
1536
- * @param {string} input the original input used to generate the given tokens
1537
- * @param {Token[]} tokens list of scanned tokens
1538
- * @returns {MultiToken[]}
1539
- */
1540
- function run(start, input, tokens) {
1541
- let len = tokens.length;
1542
- let cursor = 0;
1543
- let multis = [];
1544
- let textTokens = [];
1545
- while (cursor < len) {
1546
- let state = start;
1547
- let secondState = null;
1548
- let nextState = null;
1549
- let multiLength = 0;
1550
- let latestAccepting = null;
1551
- let sinceAccepts = -1;
1552
- while (cursor < len && !(secondState = state.go(tokens[cursor].t))) {
1553
- // Starting tokens with nowhere to jump to.
1554
- // Consider these to be just plain text
1555
- textTokens.push(tokens[cursor++]);
1556
- }
1557
- while (cursor < len && (nextState = secondState || state.go(tokens[cursor].t))) {
1558
- // Get the next state
1559
- secondState = null;
1560
- state = nextState;
1561
-
1562
- // Keep track of the latest accepting state
1563
- if (state.accepts()) {
1564
- sinceAccepts = 0;
1565
- latestAccepting = state;
1566
- } else if (sinceAccepts >= 0) {
1567
- sinceAccepts++;
1568
- }
1569
- cursor++;
1570
- multiLength++;
1571
- }
1572
- if (sinceAccepts < 0) {
1573
- // No accepting state was found, part of a regular text token add
1574
- // the first text token to the text tokens array and try again from
1575
- // the next
1576
- cursor -= multiLength;
1577
- if (cursor < len) {
1578
- textTokens.push(tokens[cursor]);
1579
- cursor++;
1580
- }
1581
- } else {
1582
- // Accepting state!
1583
- // First close off the textTokens (if available)
1584
- if (textTokens.length > 0) {
1585
- multis.push(initMultiToken(Text, input, textTokens));
1586
- textTokens = [];
1587
- }
1588
-
1589
- // Roll back to the latest accepting state
1590
- cursor -= sinceAccepts;
1591
- multiLength -= sinceAccepts;
1592
-
1593
- // Create a new multitoken
1594
- const Multi = latestAccepting.t;
1595
- const subtokens = tokens.slice(cursor - multiLength, cursor);
1596
- multis.push(initMultiToken(Multi, input, subtokens));
1597
- }
1598
- }
1599
-
1600
- // Finally close off the textTokens (if available)
1601
- if (textTokens.length > 0) {
1602
- multis.push(initMultiToken(Text, input, textTokens));
1603
- }
1604
- return multis;
1605
- }
1606
-
1607
- /**
1608
- * Utility function for instantiating a new multitoken with all the relevant
1609
- * fields during parsing.
1610
- * @param {new (value: string, tokens: Token[]) => MultiToken} Multi class to instantiate
1611
- * @param {string} input original input string
1612
- * @param {Token[]} tokens consecutive tokens scanned from input string
1613
- * @returns {MultiToken}
1614
- */
1615
- function initMultiToken(Multi, input, tokens) {
1616
- const startIdx = tokens[0].s;
1617
- const endIdx = tokens[tokens.length - 1].e;
1618
- const value = input.slice(startIdx, endIdx);
1619
- return new Multi(value, tokens);
1620
- }
1621
-
1622
- // Side-effect initialization state
1623
- const INIT = {
1624
- scanner: null,
1625
- parser: null,
1626
- tokenQueue: [],
1627
- pluginQueue: [],
1628
- customSchemes: [],
1629
- initialized: false
1630
- };
1631
-
1632
- /**
1633
- * Initialize the linkify state machine. Called automatically the first time
1634
- * linkify is called on a string, but may be called manually as well.
1635
- */
1636
- function init() {
1637
- // Initialize scanner state machine and plugins
1638
- INIT.scanner = init$2(INIT.customSchemes);
1639
- for (let i = 0; i < INIT.tokenQueue.length; i++) {
1640
- INIT.tokenQueue[i][1]({
1641
- scanner: INIT.scanner
1642
- });
1643
- }
1644
-
1645
- // Initialize parser state machine and plugins
1646
- INIT.parser = init$1(INIT.scanner.tokens);
1647
- for (let i = 0; i < INIT.pluginQueue.length; i++) {
1648
- INIT.pluginQueue[i][1]({
1649
- scanner: INIT.scanner,
1650
- parser: INIT.parser
1651
- });
1652
- }
1653
- INIT.initialized = true;
1654
- }
1655
-
1656
- /**
1657
- * Parse a string into tokens that represent linkable and non-linkable sub-components
1658
- * @param {string} str
1659
- * @return {MultiToken[]} tokens
1660
- */
1661
- function tokenize(str) {
1662
- if (!INIT.initialized) {
1663
- init();
1664
- }
1665
- return run(INIT.parser.start, str, run$1(INIT.scanner.start, str));
1666
- }
1667
-
1668
18
  /**
1669
19
  * Given a string, converts to an array of valid React components
1670
20
  * (which may include strings)
@@ -1787,7 +137,7 @@ var Toast = function Toast(_ref) {
1787
137
  _ref$buttonLabel = _ref.buttonLabel,
1788
138
  buttonLabel = _ref$buttonLabel === void 0 ? "" : _ref$buttonLabel,
1789
139
  _ref$onClick = _ref.onClick,
1790
- _onClick = _ref$onClick === void 0 ? noop$1 : _ref$onClick;
140
+ _onClick = _ref$onClick === void 0 ? noop : _ref$onClick;
1791
141
  return /*#__PURE__*/React__default.createElement("div", {
1792
142
  "data-cy": "toastr-message-container",
1793
143
  "data-test": "toastr-".concat(type, "-container")