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