javascript-time-ago 2.5.10 → 2.5.12

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 (439) hide show
  1. package/bundle/javascript-time-ago.js +1 -1
  2. package/bundle/javascript-time-ago.js.map +1 -1
  3. package/bundle/javascript-time-ago.min.js +1 -1
  4. package/bundle/javascript-time-ago.min.js.map +1 -1
  5. package/commonjs/LocaleDataStore.js +2 -5
  6. package/commonjs/LocaleDataStore.js.map +1 -1
  7. package/commonjs/PropTypes.js +12 -12
  8. package/commonjs/PropTypes.js.map +1 -1
  9. package/commonjs/TimeAgo.js +135 -190
  10. package/commonjs/TimeAgo.js.map +1 -1
  11. package/commonjs/TimeAgo.test.js +124 -130
  12. package/commonjs/TimeAgo.test.js.map +1 -1
  13. package/commonjs/cache.js +7 -25
  14. package/commonjs/cache.js.map +1 -1
  15. package/commonjs/cache.test.js +1 -3
  16. package/commonjs/cache.test.js.map +1 -1
  17. package/commonjs/isStyleObject.js +9 -9
  18. package/commonjs/isStyleObject.js.map +1 -1
  19. package/commonjs/isStyleObject.test.js +1 -3
  20. package/commonjs/isStyleObject.test.js.map +1 -1
  21. package/commonjs/locale.js +6 -19
  22. package/commonjs/locale.js.map +1 -1
  23. package/commonjs/locale.test.js +2 -11
  24. package/commonjs/locale.test.js.map +1 -1
  25. package/commonjs/round.js +2 -5
  26. package/commonjs/round.js.map +1 -1
  27. package/commonjs/steps/approximate.js +1 -4
  28. package/commonjs/steps/approximate.js.map +1 -1
  29. package/commonjs/steps/approximate.test.js +1 -6
  30. package/commonjs/steps/approximate.test.js.map +1 -1
  31. package/commonjs/steps/getStep.js +36 -53
  32. package/commonjs/steps/getStep.js.map +1 -1
  33. package/commonjs/steps/getStep.test.js +7 -7
  34. package/commonjs/steps/getStep.test.js.map +1 -1
  35. package/commonjs/steps/getStepDenominator.js +2 -5
  36. package/commonjs/steps/getStepDenominator.js.map +1 -1
  37. package/commonjs/steps/getStepDenominator.test.js +1 -3
  38. package/commonjs/steps/getStepDenominator.test.js.map +1 -1
  39. package/commonjs/steps/getStepMinTime.js +17 -32
  40. package/commonjs/steps/getStepMinTime.js.map +1 -1
  41. package/commonjs/steps/getStepMinTime.test.js +1 -3
  42. package/commonjs/steps/getStepMinTime.test.js.map +1 -1
  43. package/commonjs/steps/getTimeToNextUpdate.js +19 -41
  44. package/commonjs/steps/getTimeToNextUpdate.js.map +1 -1
  45. package/commonjs/steps/getTimeToNextUpdate.test.js +29 -25
  46. package/commonjs/steps/getTimeToNextUpdate.test.js.map +1 -1
  47. package/commonjs/steps/getTimeToNextUpdateForUnit.js +3 -12
  48. package/commonjs/steps/getTimeToNextUpdateForUnit.js.map +1 -1
  49. package/commonjs/steps/getTimeToNextUpdateForUnit.test.js +1 -7
  50. package/commonjs/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
  51. package/commonjs/steps/helpers.js +1 -2
  52. package/commonjs/steps/helpers.js.map +1 -1
  53. package/commonjs/steps/helpers.test.js +0 -1
  54. package/commonjs/steps/helpers.test.js.map +1 -1
  55. package/commonjs/steps/index.js +1 -6
  56. package/commonjs/steps/index.js.map +1 -1
  57. package/commonjs/steps/renameLegacyProperties.js +6 -14
  58. package/commonjs/steps/renameLegacyProperties.js.map +1 -1
  59. package/commonjs/steps/renameLegacyProperties.test.js +1 -3
  60. package/commonjs/steps/renameLegacyProperties.test.js.map +1 -1
  61. package/commonjs/steps/round.js +1 -2
  62. package/commonjs/steps/round.js.map +1 -1
  63. package/commonjs/steps/round.test.js +1 -7
  64. package/commonjs/steps/round.test.js.map +1 -1
  65. package/commonjs/steps/units.js +10 -21
  66. package/commonjs/steps/units.js.map +1 -1
  67. package/commonjs/style/approximate.js +2 -6
  68. package/commonjs/style/approximate.js.map +1 -1
  69. package/commonjs/style/approximateTime.js +2 -6
  70. package/commonjs/style/approximateTime.js.map +1 -1
  71. package/commonjs/style/approximateTime.test.js +116 -75
  72. package/commonjs/style/approximateTime.test.js.map +1 -1
  73. package/commonjs/style/getStyleByName.js +3 -29
  74. package/commonjs/style/getStyleByName.js.map +1 -1
  75. package/commonjs/style/mini.js +9 -6
  76. package/commonjs/style/mini.js.map +1 -1
  77. package/commonjs/style/mini.test.js +15 -25
  78. package/commonjs/style/mini.test.js.map +1 -1
  79. package/commonjs/style/miniMinute.js +8 -13
  80. package/commonjs/style/miniMinute.js.map +1 -1
  81. package/commonjs/style/miniMinute.test.js +11 -17
  82. package/commonjs/style/miniMinute.test.js.map +1 -1
  83. package/commonjs/style/miniMinuteNow.js +8 -13
  84. package/commonjs/style/miniMinuteNow.js.map +1 -1
  85. package/commonjs/style/miniMinuteNow.test.js +11 -17
  86. package/commonjs/style/miniMinuteNow.test.js.map +1 -1
  87. package/commonjs/style/miniNow.js +8 -13
  88. package/commonjs/style/miniNow.js.map +1 -1
  89. package/commonjs/style/miniNow.test.js +11 -17
  90. package/commonjs/style/miniNow.test.js.map +1 -1
  91. package/commonjs/style/renameLegacyProperties.js +7 -13
  92. package/commonjs/style/renameLegacyProperties.js.map +1 -1
  93. package/commonjs/style/renameLegacyProperties.test.js +1 -4
  94. package/commonjs/style/renameLegacyProperties.test.js.map +1 -1
  95. package/commonjs/style/round.js +2 -6
  96. package/commonjs/style/round.js.map +1 -1
  97. package/commonjs/style/round.test.js +51 -67
  98. package/commonjs/style/round.test.js.map +1 -1
  99. package/commonjs/style/roundMinute.js +8 -13
  100. package/commonjs/style/roundMinute.js.map +1 -1
  101. package/commonjs/style/roundMinute.test.js +20 -27
  102. package/commonjs/style/roundMinute.test.js.map +1 -1
  103. package/commonjs/style/twitter.js +34 -38
  104. package/commonjs/style/twitter.js.map +1 -1
  105. package/commonjs/style/twitter.test.js +49 -55
  106. package/commonjs/style/twitter.test.js.map +1 -1
  107. package/commonjs/style/twitterFirstMinute.js +10 -15
  108. package/commonjs/style/twitterFirstMinute.js.map +1 -1
  109. package/commonjs/style/twitterFirstMinute.test.js +16 -23
  110. package/commonjs/style/twitterFirstMinute.test.js.map +1 -1
  111. package/commonjs/style/twitterMinute.js +8 -13
  112. package/commonjs/style/twitterMinute.js.map +1 -1
  113. package/commonjs/style/twitterMinute.test.js +20 -25
  114. package/commonjs/style/twitterMinute.test.js.map +1 -1
  115. package/commonjs/style/twitterMinuteNow.js +8 -13
  116. package/commonjs/style/twitterMinuteNow.js.map +1 -1
  117. package/commonjs/style/twitterMinuteNow.test.js +20 -25
  118. package/commonjs/style/twitterMinuteNow.test.js.map +1 -1
  119. package/commonjs/style/twitterNow.js +8 -13
  120. package/commonjs/style/twitterNow.js.map +1 -1
  121. package/commonjs/style/twitterNow.test.js +18 -24
  122. package/commonjs/style/twitterNow.test.js.map +1 -1
  123. package/load-all-locales/index.cjs +32 -0
  124. package/load-all-locales/index.cjs.js +32 -0
  125. package/load-all-locales/index.js +64 -0
  126. package/locale/ak/package.json +16 -0
  127. package/locale/ak.json +267 -0
  128. package/locale/ak.json.d.ts +4 -0
  129. package/locale/ak.json.js +267 -0
  130. package/locale/bal-Latn/package.json +16 -0
  131. package/locale/bal-Latn.json +240 -0
  132. package/locale/bal-Latn.json.d.ts +4 -0
  133. package/locale/bal-Latn.json.js +240 -0
  134. package/locale/be-tarask/package.json +16 -0
  135. package/locale/be-tarask.json +259 -0
  136. package/locale/be-tarask.json.d.ts +4 -0
  137. package/locale/be-tarask.json.js +259 -0
  138. package/locale/blo/package.json +16 -0
  139. package/locale/blo.json +159 -0
  140. package/locale/blo.json.d.ts +4 -0
  141. package/locale/blo.json.js +159 -0
  142. package/locale/bn.json +5 -2
  143. package/locale/bn.json.js +5 -2
  144. package/locale/bs.json +8 -2
  145. package/locale/bs.json.js +8 -2
  146. package/locale/ccp.json +2 -8
  147. package/locale/ccp.json.js +2 -8
  148. package/locale/csw/package.json +16 -0
  149. package/locale/csw.json +180 -0
  150. package/locale/csw.json.d.ts +4 -0
  151. package/locale/csw.json.js +180 -0
  152. package/locale/cy.json +6 -12
  153. package/locale/cy.json.js +6 -12
  154. package/locale/doi/package.json +16 -0
  155. package/locale/doi.json +159 -0
  156. package/locale/doi.json.d.ts +4 -0
  157. package/locale/doi.json.js +159 -0
  158. package/locale/en-AU.json +12 -12
  159. package/locale/en-AU.json.js +12 -12
  160. package/locale/en-CZ/package.json +16 -0
  161. package/locale/en-CZ.json +219 -0
  162. package/locale/en-CZ.json.d.ts +4 -0
  163. package/locale/en-CZ.json.js +219 -0
  164. package/locale/en-ES/package.json +16 -0
  165. package/locale/en-ES.json +219 -0
  166. package/locale/en-ES.json.d.ts +4 -0
  167. package/locale/en-ES.json.js +219 -0
  168. package/locale/en-FR/package.json +16 -0
  169. package/locale/en-FR.json +219 -0
  170. package/locale/en-FR.json.d.ts +4 -0
  171. package/locale/en-FR.json.js +219 -0
  172. package/locale/en-GS/package.json +16 -0
  173. package/locale/en-GS.json +219 -0
  174. package/locale/en-GS.json.d.ts +4 -0
  175. package/locale/en-GS.json.js +219 -0
  176. package/locale/en-HU/package.json +16 -0
  177. package/locale/en-HU.json +219 -0
  178. package/locale/en-HU.json.d.ts +4 -0
  179. package/locale/en-HU.json.js +219 -0
  180. package/locale/en-ID/package.json +16 -0
  181. package/locale/en-ID.json +219 -0
  182. package/locale/en-ID.json.d.ts +4 -0
  183. package/locale/en-ID.json.js +219 -0
  184. package/locale/en-IT/package.json +16 -0
  185. package/locale/en-IT.json +219 -0
  186. package/locale/en-IT.json.d.ts +4 -0
  187. package/locale/en-IT.json.js +219 -0
  188. package/locale/en-NO/package.json +16 -0
  189. package/locale/en-NO.json +219 -0
  190. package/locale/en-NO.json.d.ts +4 -0
  191. package/locale/en-NO.json.js +219 -0
  192. package/locale/en-PL/package.json +16 -0
  193. package/locale/en-PL.json +219 -0
  194. package/locale/en-PL.json.d.ts +4 -0
  195. package/locale/en-PL.json.js +219 -0
  196. package/locale/en-PT/package.json +16 -0
  197. package/locale/en-PT.json +219 -0
  198. package/locale/en-PT.json.d.ts +4 -0
  199. package/locale/en-PT.json.js +219 -0
  200. package/locale/en-RO/package.json +16 -0
  201. package/locale/en-RO.json +219 -0
  202. package/locale/en-RO.json.d.ts +4 -0
  203. package/locale/en-RO.json.js +219 -0
  204. package/locale/en-SK/package.json +16 -0
  205. package/locale/en-SK.json +219 -0
  206. package/locale/en-SK.json.d.ts +4 -0
  207. package/locale/en-SK.json.js +219 -0
  208. package/locale/es-MX.json +12 -9
  209. package/locale/es-MX.json.js +12 -9
  210. package/locale/es-SV.json +2 -2
  211. package/locale/es-SV.json.js +2 -2
  212. package/locale/eu.json +24 -24
  213. package/locale/eu.json.js +24 -24
  214. package/locale/ha.json +119 -65
  215. package/locale/ha.json.js +119 -65
  216. package/locale/he.json +0 -6
  217. package/locale/he.json.js +0 -6
  218. package/locale/hi-Latn.json +2 -2
  219. package/locale/hi-Latn.json.js +2 -2
  220. package/locale/ht/package.json +16 -0
  221. package/locale/ht.json +207 -0
  222. package/locale/ht.json.d.ts +4 -0
  223. package/locale/ht.json.js +207 -0
  224. package/locale/id.json +1 -1
  225. package/locale/id.json.js +1 -1
  226. package/locale/ie/package.json +16 -0
  227. package/locale/ie.json +159 -0
  228. package/locale/ie.json.d.ts +4 -0
  229. package/locale/ie.json.js +159 -0
  230. package/locale/ig.json +17 -17
  231. package/locale/ig.json.js +17 -17
  232. package/locale/ii/package.json +16 -0
  233. package/locale/ii.json +165 -0
  234. package/locale/ii.json.d.ts +4 -0
  235. package/locale/ii.json.js +165 -0
  236. package/locale/is.json +4 -1
  237. package/locale/is.json.js +4 -1
  238. package/locale/kaa/package.json +16 -0
  239. package/locale/kaa.json +159 -0
  240. package/locale/kaa.json.d.ts +4 -0
  241. package/locale/kaa.json.js +159 -0
  242. package/locale/kok-Latn/package.json +16 -0
  243. package/locale/kok-Latn.json +159 -0
  244. package/locale/kok-Latn.json.d.ts +4 -0
  245. package/locale/kok-Latn.json.js +159 -0
  246. package/locale/kok.json +8 -8
  247. package/locale/kok.json.js +8 -8
  248. package/locale/ks.json +9 -9
  249. package/locale/ks.json.js +9 -9
  250. package/locale/ku.json +55 -46
  251. package/locale/ku.json.js +55 -46
  252. package/locale/lld/package.json +16 -0
  253. package/locale/lld.json +291 -0
  254. package/locale/lld.json.d.ts +4 -0
  255. package/locale/lld.json.js +291 -0
  256. package/locale/mi.json +22 -22
  257. package/locale/mi.json.js +22 -22
  258. package/locale/ms-Arab/package.json +16 -0
  259. package/locale/ms-Arab.json +159 -0
  260. package/locale/ms-Arab.json.d.ts +4 -0
  261. package/locale/ms-Arab.json.js +159 -0
  262. package/locale/nb.json +2 -2
  263. package/locale/nb.json.js +2 -2
  264. package/locale/ne.json +1 -1
  265. package/locale/ne.json.js +1 -1
  266. package/locale/nn.json +4 -4
  267. package/locale/nn.json.js +4 -4
  268. package/locale/no.json +2 -2
  269. package/locale/no.json.js +2 -2
  270. package/locale/nqo/package.json +16 -0
  271. package/locale/nqo.json +159 -0
  272. package/locale/nqo.json.d.ts +4 -0
  273. package/locale/nqo.json.js +159 -0
  274. package/locale/om/package.json +16 -0
  275. package/locale/om.json +213 -0
  276. package/locale/om.json.d.ts +4 -0
  277. package/locale/om.json.js +213 -0
  278. package/locale/or.json +1 -1
  279. package/locale/or.json.js +1 -1
  280. package/locale/pl.json +59 -0
  281. package/locale/pl.json.js +59 -0
  282. package/locale/qu.json +46 -46
  283. package/locale/qu.json.js +46 -46
  284. package/locale/rhg/package.json +16 -0
  285. package/locale/rhg.json +159 -0
  286. package/locale/rhg.json.d.ts +4 -0
  287. package/locale/rhg.json.js +159 -0
  288. package/locale/sl.json +12 -12
  289. package/locale/sl.json.js +12 -12
  290. package/locale/sr-Cyrl-BA.json +2 -2
  291. package/locale/sr-Cyrl-BA.json.js +2 -2
  292. package/locale/sr-Latn-BA.json +2 -2
  293. package/locale/sr-Latn-BA.json.js +2 -2
  294. package/locale/sv.json +1 -1
  295. package/locale/sv.json.js +1 -1
  296. package/locale/syr/package.json +16 -0
  297. package/locale/syr.json +303 -0
  298. package/locale/syr.json.d.ts +4 -0
  299. package/locale/syr.json.js +303 -0
  300. package/locale/ti.json +6 -6
  301. package/locale/ti.json.js +6 -6
  302. package/locale/tn/package.json +16 -0
  303. package/locale/tn.json +159 -0
  304. package/locale/tn.json.d.ts +4 -0
  305. package/locale/tn.json.js +159 -0
  306. package/locale/to.json +26 -26
  307. package/locale/to.json.js +26 -26
  308. package/locale/uk.json +1 -1
  309. package/locale/uk.json.js +1 -1
  310. package/locale/ur-IN.json +9 -6
  311. package/locale/ur-IN.json.js +9 -6
  312. package/locale/vec/package.json +16 -0
  313. package/locale/vec.json +267 -0
  314. package/locale/vec.json.d.ts +4 -0
  315. package/locale/vec.json.js +267 -0
  316. package/locale/xnr/package.json +16 -0
  317. package/locale/xnr.json +159 -0
  318. package/locale/xnr.json.d.ts +4 -0
  319. package/locale/xnr.json.js +159 -0
  320. package/locale/yo-BJ.json +17 -17
  321. package/locale/yo-BJ.json.js +17 -17
  322. package/locale/yo.json +17 -17
  323. package/locale/yo.json.js +17 -17
  324. package/locale-more-styles/pl/long-time.json +30 -0
  325. package/locale-more-styles/pl/mini.json +9 -0
  326. package/locale-more-styles/pl/now.json +7 -0
  327. package/locale-more-styles/pl/short-time.json +12 -0
  328. package/modules/LocaleDataStore.js +2 -3
  329. package/modules/LocaleDataStore.js.map +1 -1
  330. package/modules/PropTypes.js +11 -7
  331. package/modules/PropTypes.js.map +1 -1
  332. package/modules/TimeAgo.js +135 -174
  333. package/modules/TimeAgo.js.map +1 -1
  334. package/modules/TimeAgo.test.js +126 -115
  335. package/modules/TimeAgo.test.js.map +1 -1
  336. package/modules/cache.js +6 -22
  337. package/modules/cache.js.map +1 -1
  338. package/modules/cache.test.js.map +1 -1
  339. package/modules/isStyleObject.js +9 -7
  340. package/modules/isStyleObject.js.map +1 -1
  341. package/modules/isStyleObject.test.js.map +1 -1
  342. package/modules/locale.js +6 -16
  343. package/modules/locale.js.map +1 -1
  344. package/modules/locale.test.js +0 -4
  345. package/modules/locale.test.js.map +1 -1
  346. package/modules/round.js +2 -3
  347. package/modules/round.js.map +1 -1
  348. package/modules/steps/approximate.js +6 -2
  349. package/modules/steps/approximate.js.map +1 -1
  350. package/modules/steps/approximate.test.js +0 -2
  351. package/modules/steps/approximate.test.js.map +1 -1
  352. package/modules/steps/getStep.js +36 -48
  353. package/modules/steps/getStep.js.map +1 -1
  354. package/modules/steps/getStep.test.js +6 -2
  355. package/modules/steps/getStep.test.js.map +1 -1
  356. package/modules/steps/getStepDenominator.js +2 -3
  357. package/modules/steps/getStepDenominator.js.map +1 -1
  358. package/modules/steps/getStepDenominator.test.js.map +1 -1
  359. package/modules/steps/getStepMinTime.js +17 -29
  360. package/modules/steps/getStepMinTime.js.map +1 -1
  361. package/modules/steps/getStepMinTime.test.js.map +1 -1
  362. package/modules/steps/getTimeToNextUpdate.js +19 -31
  363. package/modules/steps/getTimeToNextUpdate.js.map +1 -1
  364. package/modules/steps/getTimeToNextUpdate.test.js +27 -18
  365. package/modules/steps/getTimeToNextUpdate.test.js.map +1 -1
  366. package/modules/steps/getTimeToNextUpdateForUnit.js +4 -10
  367. package/modules/steps/getTimeToNextUpdateForUnit.js.map +1 -1
  368. package/modules/steps/getTimeToNextUpdateForUnit.test.js +0 -4
  369. package/modules/steps/getTimeToNextUpdateForUnit.test.js.map +1 -1
  370. package/modules/steps/helpers.js +1 -1
  371. package/modules/steps/helpers.js.map +1 -1
  372. package/modules/steps/helpers.test.js.map +1 -1
  373. package/modules/steps/index.js +2 -1
  374. package/modules/steps/index.js.map +1 -1
  375. package/modules/steps/renameLegacyProperties.js +6 -13
  376. package/modules/steps/renameLegacyProperties.js.map +1 -1
  377. package/modules/steps/renameLegacyProperties.test.js.map +1 -1
  378. package/modules/steps/round.js.map +1 -1
  379. package/modules/steps/round.test.js +0 -3
  380. package/modules/steps/round.test.js.map +1 -1
  381. package/modules/steps/units.js +5 -9
  382. package/modules/steps/units.js.map +1 -1
  383. package/modules/style/approximate.js +5 -1
  384. package/modules/style/approximate.js.map +1 -1
  385. package/modules/style/approximateTime.js +6 -2
  386. package/modules/style/approximateTime.js.map +1 -1
  387. package/modules/style/approximateTime.test.js +115 -70
  388. package/modules/style/approximateTime.test.js.map +1 -1
  389. package/modules/style/getStyleByName.js +4 -17
  390. package/modules/style/getStyleByName.js.map +1 -1
  391. package/modules/style/mini.js +8 -4
  392. package/modules/style/mini.js.map +1 -1
  393. package/modules/style/mini.test.js +14 -20
  394. package/modules/style/mini.test.js.map +1 -1
  395. package/modules/style/miniMinute.js +6 -6
  396. package/modules/style/miniMinute.js.map +1 -1
  397. package/modules/style/miniMinute.test.js +10 -12
  398. package/modules/style/miniMinute.test.js.map +1 -1
  399. package/modules/style/miniMinuteNow.js +6 -6
  400. package/modules/style/miniMinuteNow.js.map +1 -1
  401. package/modules/style/miniMinuteNow.test.js +10 -12
  402. package/modules/style/miniMinuteNow.test.js.map +1 -1
  403. package/modules/style/miniNow.js +6 -6
  404. package/modules/style/miniNow.js.map +1 -1
  405. package/modules/style/miniNow.test.js +10 -12
  406. package/modules/style/miniNow.test.js.map +1 -1
  407. package/modules/style/renameLegacyProperties.js +8 -10
  408. package/modules/style/renameLegacyProperties.js.map +1 -1
  409. package/modules/style/renameLegacyProperties.test.js +0 -1
  410. package/modules/style/renameLegacyProperties.test.js.map +1 -1
  411. package/modules/style/round.js +3 -2
  412. package/modules/style/round.js.map +1 -1
  413. package/modules/style/round.test.js +50 -62
  414. package/modules/style/round.test.js.map +1 -1
  415. package/modules/style/roundMinute.js +8 -7
  416. package/modules/style/roundMinute.js.map +1 -1
  417. package/modules/style/roundMinute.test.js +19 -22
  418. package/modules/style/roundMinute.test.js.map +1 -1
  419. package/modules/style/twitter.js +35 -32
  420. package/modules/style/twitter.js.map +1 -1
  421. package/modules/style/twitter.test.js +48 -50
  422. package/modules/style/twitter.test.js.map +1 -1
  423. package/modules/style/twitterFirstMinute.js +8 -7
  424. package/modules/style/twitterFirstMinute.js.map +1 -1
  425. package/modules/style/twitterFirstMinute.test.js +15 -18
  426. package/modules/style/twitterFirstMinute.test.js.map +1 -1
  427. package/modules/style/twitterMinute.js +6 -6
  428. package/modules/style/twitterMinute.js.map +1 -1
  429. package/modules/style/twitterMinute.test.js +19 -20
  430. package/modules/style/twitterMinute.test.js.map +1 -1
  431. package/modules/style/twitterMinuteNow.js +6 -6
  432. package/modules/style/twitterMinuteNow.js.map +1 -1
  433. package/modules/style/twitterMinuteNow.test.js +19 -20
  434. package/modules/style/twitterMinuteNow.test.js.map +1 -1
  435. package/modules/style/twitterNow.js +6 -6
  436. package/modules/style/twitterNow.js.map +1 -1
  437. package/modules/style/twitterNow.test.js +17 -19
  438. package/modules/style/twitterNow.test.js.map +1 -1
  439. package/package.json +261 -4
@@ -1,9 +1,9 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import roundMinute from './roundMinute.js';
8
8
  import TimeAgo from '../TimeAgo.js';
9
9
  import { day, month, year } from '../steps/index.js';
@@ -11,7 +11,6 @@ describe('style/round-minute', function () {
11
11
  it('should format relative time (English) (round: "floor")', function () {
12
12
  var timeAgo = new TimeAgo('en');
13
13
  var now = new Date(2016, 3, 10, 22, 59).getTime();
14
-
15
14
  var formatInterval = function formatInterval(secondsPassed) {
16
15
  return timeAgo.format(now - secondsPassed * 1000, _objectSpread(_objectSpread({
17
16
  now: now
@@ -19,7 +18,6 @@ describe('style/round-minute', function () {
19
18
  round: 'floor'
20
19
  }));
21
20
  };
22
-
23
21
  formatInterval(0).should.equal('just now');
24
22
  formatInterval(0.9).should.equal('just now');
25
23
  formatInterval(1).should.equal('just now');
@@ -28,52 +26,51 @@ describe('style/round-minute', function () {
28
26
  formatInterval(1.9 * 60).should.equal('1 minute ago');
29
27
  formatInterval(2 * 60).should.equal('2 minutes ago');
30
28
  formatInterval(2.9 * 60).should.equal('2 minutes ago');
31
- formatInterval(3 * 60).should.equal('3 minutes ago'); // …
32
-
29
+ formatInterval(3 * 60).should.equal('3 minutes ago');
30
+ // …
33
31
  formatInterval(59.9 * 60).should.equal('59 minutes ago');
34
32
  formatInterval(60 * 60).should.equal('1 hour ago');
35
33
  formatInterval(1.9 * 60 * 60).should.equal('1 hour ago');
36
34
  formatInterval(2 * 60 * 60).should.equal('2 hours ago');
37
35
  formatInterval(2.9 * 60 * 60).should.equal('2 hours ago');
38
- formatInterval(3 * 60 * 60).should.equal('3 hours ago'); // …
39
-
36
+ formatInterval(3 * 60 * 60).should.equal('3 hours ago');
37
+ // …
40
38
  formatInterval(23.9 * 60 * 60).should.equal('23 hours ago');
41
39
  formatInterval(24 * 60 * 60).should.equal('1 day ago');
42
40
  formatInterval(1.9 * day).should.equal('1 day ago');
43
41
  formatInterval(2 * day).should.equal('2 days ago');
44
42
  formatInterval(2.9 * day).should.equal('2 days ago');
45
- formatInterval(3 * day).should.equal('3 days ago'); // …
46
-
43
+ formatInterval(3 * day).should.equal('3 days ago');
44
+ // …
47
45
  formatInterval(6.9 * day).should.equal('6 days ago');
48
- formatInterval(7 * day).should.equal('1 week ago'); // …
49
-
46
+ formatInterval(7 * day).should.equal('1 week ago');
47
+ // …
50
48
  formatInterval(3.9 * 7 * day).should.equal('3 weeks ago');
51
49
  formatInterval(4 * 7 * day).should.equal('4 weeks ago');
52
50
  formatInterval(30.51 * day).should.equal('1 month ago');
53
51
  formatInterval(1.9 * month).should.equal('1 month ago');
54
52
  formatInterval(2 * month).should.equal('2 months ago');
55
53
  formatInterval(2.9 * month).should.equal('2 months ago');
56
- formatInterval(3 * month).should.equal('3 months ago'); // …
57
-
54
+ formatInterval(3 * month).should.equal('3 months ago');
55
+ // …
58
56
  formatInterval(11.9 * month).should.equal('11 months ago');
59
57
  formatInterval(12 * month).should.equal('1 year ago');
60
58
  formatInterval(1.99 * year).should.equal('1 year ago');
61
- formatInterval(2 * year).should.equal('2 years ago'); // …
62
- // Test future dates.
59
+ formatInterval(2 * year).should.equal('2 years ago');
60
+ //
63
61
 
62
+ // Test future dates.
64
63
  formatInterval(-1 * 3 * 60).should.equal('in 3 minutes');
65
64
  formatInterval(-1 * month * 8).should.equal('in 8 months');
66
65
  });
67
66
  it('should format relative time (English)', function () {
68
67
  var timeAgo = new TimeAgo('en');
69
68
  var now = new Date(2016, 3, 10, 22, 59).getTime();
70
-
71
69
  var formatInterval = function formatInterval(secondsPassed) {
72
70
  return timeAgo.format(now - secondsPassed * 1000, _objectSpread({
73
71
  now: now
74
72
  }, roundMinute));
75
73
  };
76
-
77
74
  formatInterval(0).should.equal('just now');
78
75
  formatInterval(0.49).should.equal('just now');
79
76
  formatInterval(0.5).should.equal('just now');
@@ -1 +1 @@
1
- {"version":3,"file":"roundMinute.test.js","names":["roundMinute","TimeAgo","day","month","year","describe","it","timeAgo","now","Date","getTime","formatInterval","secondsPassed","format","round","should","equal"],"sources":["../../source/style/roundMinute.test.js"],"sourcesContent":["import roundMinute from './roundMinute.js'\r\nimport TimeAgo from '../TimeAgo.js'\r\nimport { day, month, year } from '../steps/index.js'\r\n\r\ndescribe('style/round-minute', () => {\r\n\tit('should format relative time (English) (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatInterval = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...roundMinute, round: 'floor' })\r\n\r\n\t\tformatInterval(0).should.equal('just now')\r\n\t\tformatInterval(0.9).should.equal('just now')\r\n\t\tformatInterval(1).should.equal('just now')\r\n\t\tformatInterval(59.9).should.equal('just now')\r\n\t\tformatInterval(60).should.equal('1 minute ago')\r\n\t\tformatInterval(1.9 * 60).should.equal('1 minute ago')\r\n\t\tformatInterval(2 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(2.9 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(3 * 60).should.equal('3 minutes ago')\r\n\t\t// …\r\n\t\tformatInterval(59.9 * 60).should.equal('59 minutes ago')\r\n\t\tformatInterval(60 * 60).should.equal('1 hour ago')\r\n\t\tformatInterval(1.9 * 60 * 60).should.equal('1 hour ago')\r\n\t\tformatInterval(2 * 60 * 60).should.equal('2 hours ago')\r\n\t\tformatInterval(2.9 * 60 * 60).should.equal('2 hours ago')\r\n\t\tformatInterval(3 * 60 * 60).should.equal('3 hours ago')\r\n\t\t// …\r\n\t\tformatInterval(23.9 * 60 * 60).should.equal('23 hours ago')\r\n\t\tformatInterval(24 * 60 * 60).should.equal('1 day ago')\r\n\t\tformatInterval(1.9 * day).should.equal('1 day ago')\r\n\t\tformatInterval(2 * day).should.equal('2 days ago')\r\n\t\tformatInterval(2.9 * day).should.equal('2 days ago')\r\n\t\tformatInterval(3 * day).should.equal('3 days ago')\r\n\t\t// …\r\n\t\tformatInterval(6.9 * day).should.equal('6 days ago')\r\n\t\tformatInterval(7 * day).should.equal('1 week ago')\r\n\t\t// …\r\n\t\tformatInterval(3.9 * 7 * day).should.equal('3 weeks ago')\r\n\t\tformatInterval(4 * 7 * day).should.equal('4 weeks ago')\r\n\t\tformatInterval(30.51 * day).should.equal('1 month ago')\r\n\t\tformatInterval(1.9 * month).should.equal('1 month ago')\r\n\t\tformatInterval(2 * month).should.equal('2 months ago')\r\n\t\tformatInterval(2.9 * month).should.equal('2 months ago')\r\n\t\tformatInterval(3 * month).should.equal('3 months ago')\r\n\t\t// …\r\n\t\tformatInterval(11.9 * month).should.equal('11 months ago')\r\n\t\tformatInterval(12 * month).should.equal('1 year ago')\r\n\t\tformatInterval(1.99 * year).should.equal('1 year ago')\r\n\t\tformatInterval(2 * year).should.equal('2 years ago')\r\n\t\t// …\r\n\r\n\t\t// Test future dates.\r\n\t\tformatInterval(-1 * 3 * 60).should.equal('in 3 minutes')\r\n\t\tformatInterval(-1 * month * 8).should.equal('in 8 months')\r\n\t})\r\n\r\n\tit('should format relative time (English)', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatInterval = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...roundMinute })\r\n\r\n\t\tformatInterval(0).should.equal('just now')\r\n\t\tformatInterval(0.49).should.equal('just now')\r\n\t\tformatInterval(0.5).should.equal('just now')\r\n\t\tformatInterval(29.9).should.equal('just now')\r\n\t\tformatInterval(30).should.equal('1 minute ago')\r\n\t\tformatInterval(1.49 * 60).should.equal('1 minute ago')\r\n\t\tformatInterval(1.5 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(2.49 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(2.5 * 60).should.equal('3 minutes ago')\r\n\t})\r\n})"],"mappings":";;;;;;AAAA,OAAOA,WAAP,MAAwB,kBAAxB;AACA,OAAOC,OAAP,MAAoB,eAApB;AACA,SAASC,GAAT,EAAcC,KAAd,EAAqBC,IAArB,QAAiC,mBAAjC;AAEAC,QAAQ,CAAC,oBAAD,EAAuB,YAAM;EACpCC,EAAE,CAAC,wDAAD,EAA2D,YAAM;IAClE,IAAMC,OAAO,GAAG,IAAIN,OAAJ,CAAY,IAAZ,CAAhB;IAEA,IAAMO,GAAG,GAAG,IAAIC,IAAJ,CAAS,IAAT,EAAe,CAAf,EAAkB,EAAlB,EAAsB,EAAtB,EAA0B,EAA1B,EAA8BC,OAA9B,EAAZ;;IACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,aAAD;MAAA,OAAmBL,OAAO,CAACM,MAAR,CAAeL,GAAG,GAAGI,aAAa,GAAG,IAArC;QAA6CJ,GAAG,EAAHA;MAA7C,GAAqDR,WAArD;QAAkEc,KAAK,EAAE;MAAzE,GAAnB;IAAA,CAAvB;;IAEAH,cAAc,CAAC,CAAD,CAAd,CAAkBI,MAAlB,CAAyBC,KAAzB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KAA5B,CAAkC,UAAlC;IACAL,cAAc,CAAC,GAAD,CAAd,CAAoBI,MAApB,CAA2BC,KAA3B,CAAiC,UAAjC;IACAL,cAAc,CAAC,IAAD,CAAd,CAAqBI,MAArB,CAA4BC,KAA5B,CAAkC,UAAlC;IACAL,cAAc,CAAC,EAAD,CAAd,CAAmBI,MAAnB,CAA0BC,KAA1B,CAAgC,cAAhC;IACAL,cAAc,CAAC,OAAO,EAAR,CAAd,CAA0BI,MAA1B,CAAiCC,KAAjC,CAAuC,cAAvC;IACAL,cAAc,CAAC,MAAM,EAAP,CAAd,CAAyBI,MAAzB,CAAgCC,KAAhC,CAAsC,eAAtC;IACAL,cAAc,CAAC,OAAO,EAAR,CAAd,CAA0BI,MAA1B,CAAiCC,KAAjC,CAAuC,eAAvC;IACAL,cAAc,CAAC,MAAM,EAAP,CAAd,CAAyBI,MAAzB,CAAgCC,KAAhC,CAAsC,eAAtC;EACA,CAfC,CAAF;AAgBA,CArEO,CAAR"}
1
+ {"version":3,"file":"roundMinute.test.js","names":["roundMinute","TimeAgo","day","month","year","describe","it","timeAgo","now","Date","getTime","formatInterval","secondsPassed","format","_objectSpread","round","should","equal"],"sources":["../../source/style/roundMinute.test.js"],"sourcesContent":["import roundMinute from './roundMinute.js'\r\nimport TimeAgo from '../TimeAgo.js'\r\nimport { day, month, year } from '../steps/index.js'\r\n\r\ndescribe('style/round-minute', () => {\r\n\tit('should format relative time (English) (round: \"floor\")', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatInterval = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...roundMinute, round: 'floor' })\r\n\r\n\t\tformatInterval(0).should.equal('just now')\r\n\t\tformatInterval(0.9).should.equal('just now')\r\n\t\tformatInterval(1).should.equal('just now')\r\n\t\tformatInterval(59.9).should.equal('just now')\r\n\t\tformatInterval(60).should.equal('1 minute ago')\r\n\t\tformatInterval(1.9 * 60).should.equal('1 minute ago')\r\n\t\tformatInterval(2 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(2.9 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(3 * 60).should.equal('3 minutes ago')\r\n\t\t// …\r\n\t\tformatInterval(59.9 * 60).should.equal('59 minutes ago')\r\n\t\tformatInterval(60 * 60).should.equal('1 hour ago')\r\n\t\tformatInterval(1.9 * 60 * 60).should.equal('1 hour ago')\r\n\t\tformatInterval(2 * 60 * 60).should.equal('2 hours ago')\r\n\t\tformatInterval(2.9 * 60 * 60).should.equal('2 hours ago')\r\n\t\tformatInterval(3 * 60 * 60).should.equal('3 hours ago')\r\n\t\t// …\r\n\t\tformatInterval(23.9 * 60 * 60).should.equal('23 hours ago')\r\n\t\tformatInterval(24 * 60 * 60).should.equal('1 day ago')\r\n\t\tformatInterval(1.9 * day).should.equal('1 day ago')\r\n\t\tformatInterval(2 * day).should.equal('2 days ago')\r\n\t\tformatInterval(2.9 * day).should.equal('2 days ago')\r\n\t\tformatInterval(3 * day).should.equal('3 days ago')\r\n\t\t// …\r\n\t\tformatInterval(6.9 * day).should.equal('6 days ago')\r\n\t\tformatInterval(7 * day).should.equal('1 week ago')\r\n\t\t// …\r\n\t\tformatInterval(3.9 * 7 * day).should.equal('3 weeks ago')\r\n\t\tformatInterval(4 * 7 * day).should.equal('4 weeks ago')\r\n\t\tformatInterval(30.51 * day).should.equal('1 month ago')\r\n\t\tformatInterval(1.9 * month).should.equal('1 month ago')\r\n\t\tformatInterval(2 * month).should.equal('2 months ago')\r\n\t\tformatInterval(2.9 * month).should.equal('2 months ago')\r\n\t\tformatInterval(3 * month).should.equal('3 months ago')\r\n\t\t// …\r\n\t\tformatInterval(11.9 * month).should.equal('11 months ago')\r\n\t\tformatInterval(12 * month).should.equal('1 year ago')\r\n\t\tformatInterval(1.99 * year).should.equal('1 year ago')\r\n\t\tformatInterval(2 * year).should.equal('2 years ago')\r\n\t\t// …\r\n\r\n\t\t// Test future dates.\r\n\t\tformatInterval(-1 * 3 * 60).should.equal('in 3 minutes')\r\n\t\tformatInterval(-1 * month * 8).should.equal('in 8 months')\r\n\t})\r\n\r\n\tit('should format relative time (English)', () => {\r\n\t\tconst timeAgo = new TimeAgo('en')\r\n\r\n\t\tconst now = new Date(2016, 3, 10, 22, 59).getTime()\r\n\t\tconst formatInterval = (secondsPassed) => timeAgo.format(now - secondsPassed * 1000, { now, ...roundMinute })\r\n\r\n\t\tformatInterval(0).should.equal('just now')\r\n\t\tformatInterval(0.49).should.equal('just now')\r\n\t\tformatInterval(0.5).should.equal('just now')\r\n\t\tformatInterval(29.9).should.equal('just now')\r\n\t\tformatInterval(30).should.equal('1 minute ago')\r\n\t\tformatInterval(1.49 * 60).should.equal('1 minute ago')\r\n\t\tformatInterval(1.5 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(2.49 * 60).should.equal('2 minutes ago')\r\n\t\tformatInterval(2.5 * 60).should.equal('3 minutes ago')\r\n\t})\r\n})"],"mappings":";;;;;;AAAA,OAAOA,WAAW,MAAM,kBAAkB;AAC1C,OAAOC,OAAO,MAAM,eAAe;AACnC,SAASC,GAAG,EAAEC,KAAK,EAAEC,IAAI,QAAQ,mBAAmB;AAEpDC,QAAQ,CAAC,oBAAoB,EAAE,YAAM;EACpCC,EAAE,CAAC,wDAAwD,EAAE,YAAM;IAClE,IAAMC,OAAO,GAAG,IAAIN,OAAO,CAAC,IAAI,CAAC;IAEjC,IAAMO,GAAG,GAAG,IAAIC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAACC,OAAO,CAAC,CAAC;IACnD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,aAAa;MAAA,OAAKL,OAAO,CAACM,MAAM,CAACL,GAAG,GAAGI,aAAa,GAAG,IAAI,EAAAE,aAAA,CAAAA,aAAA;QAAIN,GAAG,EAAHA;MAAG,GAAKR,WAAW;QAAEe,KAA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W,cAAc,CAAC,CAAC,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,UAAU,CAAC;IAC1CN,cAAc,CAAC,IAAI,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,UAAU,CAAC;IAC7CN,cAAc,CAAC,GAAG,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,UAAU,CAAC;IAC5CN,cAAc,CAAC,IAAI,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,UAAU,CAAC;IAC7CN,cAAc,CAAC,EAAE,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,cAAc,CAAC;IAC/CN,cAAc,CAAC,IAAI,GAAG,EAAE,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,cAAc,CAAC;IACtDN,cAAc,CAAC,GAAG,GAAG,EAAE,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,eAAe,CAAC;IACtDN,cAAc,CAAC,IAAI,GAAG,EAAE,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,eAAe,CAAC;IACvDN,cAAc,CAAC,GAAG,GAAG,EAAE,CAAC,CAACK,MAAM,CAACC,KAAK,CAAC,eAAe,CAAC;EACvD,CAAC,CAAC;AACH,CAAC,CAAC","ignoreList":[]}
@@ -1,7 +1,10 @@
1
1
  import { day, getDate } from '../steps/index.js';
2
- import { intlDateTimeFormatSupported } from '../locale.js'; // For compatibility with the old versions of this library.
2
+ import { intlDateTimeFormatSupported } from '../locale.js';
3
3
 
4
- import renameLegacyProperties from './renameLegacyProperties.js'; // Twitter-style relative date/time formatting.
4
+ // For compatibility with the old versions of this library.
5
+ import renameLegacyProperties from './renameLegacyProperties.js';
6
+
7
+ // Twitter-style relative date/time formatting.
5
8
  // ("1m", "2h", "Mar 3", "Apr 4, 2012").
6
9
  //
7
10
  // Seconds, minutes or hours are shown for shorter intervals,
@@ -13,15 +16,17 @@ var steps = [{
13
16
  formatAs: 'minute'
14
17
  }, {
15
18
  formatAs: 'hour'
16
- }]; // A cache for `Intl.DateTimeFormat` formatters
17
- // for various locales (is a global variable).
19
+ }];
18
20
 
19
- var formatters = {}; // Starting from day intervals, output month and day.
21
+ // A cache for `Intl.DateTimeFormat` formatters
22
+ // for various locales (is a global variable).
23
+ var formatters = {};
20
24
 
25
+ // Starting from day intervals, output month and day.
21
26
  var monthAndDay = {
22
27
  minTime: function minTime(timestamp, _ref) {
23
28
  var future = _ref.future,
24
- getMinTimeForUnit = _ref.getMinTimeForUnit;
29
+ getMinTimeForUnit = _ref.getMinTimeForUnit;
25
30
  // Returns `23.5 * 60 * 60` when `round` is "round",
26
31
  // and `24 * 60 * 60` when `round` is "floor".
27
32
  return getMinTimeForUnit('day');
@@ -32,27 +37,24 @@ var monthAndDay = {
32
37
  formatters[locale] = {};
33
38
  }
34
39
  /* istanbul ignore else */
35
-
36
-
37
40
  if (!formatters[locale].dayMonth) {
38
41
  // "Apr 11" (MMMd)
39
42
  formatters[locale].dayMonth = new Intl.DateTimeFormat(locale, {
40
43
  month: 'short',
41
44
  day: 'numeric'
42
45
  });
43
- } // Output month and day.
44
-
45
-
46
+ }
47
+ // Output month and day.
46
48
  return formatters[locale].dayMonth.format(getDate(value));
47
49
  }
48
- }; // If the `date` happened/happens outside of current year,
50
+ };
51
+
52
+ // If the `date` happened/happens outside of current year,
49
53
  // then output day, month and year.
50
54
  // The interval should be such that the `date` lies outside of the current year.
51
-
52
55
  var yearMonthAndDay = {
53
56
  minTime: function minTime(timestamp, _ref2) {
54
57
  var future = _ref2.future;
55
-
56
58
  if (future) {
57
59
  // January 1, 00:00, of the `date`'s year is right after
58
60
  // the maximum `now` for formatting a future date:
@@ -61,8 +63,8 @@ var yearMonthAndDay = {
61
63
  // After that, it's hours, minutes, seconds, and after that it's no longer `future`.
62
64
  // The date is right after the maximum `now` for formatting a future date,
63
65
  // so subtract 1 millisecond from it.
64
- var maxFittingNow = new Date(new Date(timestamp).getFullYear(), 0).getTime() - 1; // Return `minTime` (in seconds).
65
-
66
+ var maxFittingNow = new Date(new Date(timestamp).getFullYear(), 0).getTime() - 1;
67
+ // Return `minTime` (in seconds).
66
68
  return (timestamp - maxFittingNow) / 1000;
67
69
  } else {
68
70
  // January 1, 00:00, of the year following the `date`'s year
@@ -70,8 +72,8 @@ var yearMonthAndDay = {
70
72
  // When `now` is before that date, the `date` is formatted as "day/month" (another step),
71
73
  // When `now` is equal to or after that date, the `date` is formatted as "day/month/year" (this step).
72
74
  // After that, it's hours, minutes, seconds, and after that it's no longer `future`.
73
- var minFittingNow = new Date(new Date(timestamp).getFullYear() + 1, 0).getTime(); // Return `minTime` (in seconds).
74
-
75
+ var minFittingNow = new Date(new Date(timestamp).getFullYear() + 1, 0).getTime();
76
+ // Return `minTime` (in seconds).
75
77
  return (minFittingNow - timestamp) / 1000;
76
78
  }
77
79
  },
@@ -81,8 +83,6 @@ var yearMonthAndDay = {
81
83
  formatters[locale] = {};
82
84
  }
83
85
  /* istanbul ignore else */
84
-
85
-
86
86
  if (!formatters[locale].dayMonthYear) {
87
87
  // "Apr 11, 2017" (yMMMd)
88
88
  formatters[locale].dayMonthYear = new Intl.DateTimeFormat(locale, {
@@ -90,19 +90,19 @@ var yearMonthAndDay = {
90
90
  month: 'short',
91
91
  day: 'numeric'
92
92
  });
93
- } // Output day, month and year.
94
-
95
-
93
+ }
94
+ // Output day, month and year.
96
95
  return formatters[locale].dayMonthYear.format(getDate(value));
97
96
  }
98
- }; // If `Intl.DateTimeFormat` is supported,
99
- // then longer time intervals will be formatted as dates.
97
+ };
100
98
 
99
+ // If `Intl.DateTimeFormat` is supported,
100
+ // then longer time intervals will be formatted as dates.
101
101
  /* istanbul ignore else */
102
-
103
102
  if (intlDateTimeFormatSupported()) {
104
103
  steps.push(monthAndDay, yearMonthAndDay);
105
- } // Otherwise, if `Intl.DateTimeFormat` is not supported,
104
+ }
105
+ // Otherwise, if `Intl.DateTimeFormat` is not supported,
106
106
  // which could be the case when using Internet Explorer,
107
107
  // then simply mimick "round" steps.
108
108
  else {
@@ -116,18 +116,21 @@ else {
116
116
  formatAs: 'year'
117
117
  });
118
118
  }
119
-
120
119
  export default {
121
120
  steps: steps,
122
- labels: [// "mini" labels are only defined for a few languages.
123
- 'mini', // "short-time" labels are only defined for a few languages.
124
- 'short-time', // "narrow" and "short" labels are defined for all languages.
121
+ labels: [
122
+ // "mini" labels are only defined for a few languages.
123
+ 'mini',
124
+ // "short-time" labels are only defined for a few languages.
125
+ 'short-time',
126
+ // "narrow" and "short" labels are defined for all languages.
125
127
  // "narrow" labels can sometimes be weird (like "+5d."),
126
128
  // but "short" labels have the " ago" part, so "narrow" seem
127
129
  // more appropriate.
128
130
  // "short" labels would have been more appropriate if they
129
131
  // didn't have the " ago" part, hence the "short-time" above.
130
- 'narrow', // Since "narrow" labels are always present, "short" element
132
+ 'narrow',
133
+ // Since "narrow" labels are always present, "short" element
131
134
  // of this array can be removed.
132
135
  'short']
133
136
  };
@@ -1 +1 @@
1
- {"version":3,"file":"twitter.js","names":["day","getDate","intlDateTimeFormatSupported","renameLegacyProperties","steps","formatAs","formatters","monthAndDay","minTime","timestamp","future","getMinTimeForUnit","format","value","locale","dayMonth","Intl","DateTimeFormat","month","yearMonthAndDay","maxFittingNow","Date","getFullYear","getTime","minFittingNow","dayMonthYear","year","push","labels"],"sources":["../../source/style/twitter.js"],"sourcesContent":["import { day, getDate } from '../steps/index.js'\r\nimport { intlDateTimeFormatSupported } from '../locale.js'\r\n\r\n// For compatibility with the old versions of this library.\r\nimport renameLegacyProperties from './renameLegacyProperties.js'\r\n\r\n// Twitter-style relative date/time formatting.\r\n// (\"1m\", \"2h\", \"Mar 3\", \"Apr 4, 2012\").\r\n//\r\n// Seconds, minutes or hours are shown for shorter intervals,\r\n// and longer intervals are formatted using full date format.\r\n\r\nconst steps = [\r\n\t{\r\n\t\tformatAs: 'second'\r\n\t},\r\n\t{\r\n\t\tformatAs: 'minute'\r\n\t},\r\n\t{\r\n\t\tformatAs: 'hour'\r\n\t}\r\n]\r\n\r\n// A cache for `Intl.DateTimeFormat` formatters\r\n// for various locales (is a global variable).\r\nconst formatters = {}\r\n\r\n// Starting from day intervals, output month and day.\r\nconst monthAndDay = {\r\n\tminTime(timestamp, { future, getMinTimeForUnit }) {\r\n\t\t// Returns `23.5 * 60 * 60` when `round` is \"round\",\r\n\t\t// and `24 * 60 * 60` when `round` is \"floor\".\r\n\t\treturn getMinTimeForUnit('day')\r\n\t},\r\n\tformat(value, locale) {\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale]) {\r\n\t\t\tformatters[locale] = {}\r\n\t\t}\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale].dayMonth) {\r\n\t\t\t// \"Apr 11\" (MMMd)\r\n\t\t\tformatters[locale].dayMonth = new Intl.DateTimeFormat(locale, {\r\n\t\t\t\tmonth: 'short',\r\n\t\t\t\tday: 'numeric'\r\n\t\t\t})\r\n\t\t}\r\n\t\t// Output month and day.\r\n\t\treturn formatters[locale].dayMonth.format(getDate(value))\r\n\t}\r\n}\r\n\r\n// If the `date` happened/happens outside of current year,\r\n// then output day, month and year.\r\n// The interval should be such that the `date` lies outside of the current year.\r\nconst yearMonthAndDay = {\r\n\tminTime(timestamp, { future }) {\r\n\t\tif (future) {\r\n\t\t\t// January 1, 00:00, of the `date`'s year is right after\r\n\t\t\t// the maximum `now` for formatting a future date:\r\n\t\t\t// When `now` is before that date, the `date` is formatted as \"day/month/year\" (this step),\r\n\t\t\t// When `now` is equal to or after that date, the `date` is formatted as \"day/month\" (another step).\r\n\t\t\t// After that, it's hours, minutes, seconds, and after that it's no longer `future`.\r\n\t\t\t// The date is right after the maximum `now` for formatting a future date,\r\n\t\t\t// so subtract 1 millisecond from it.\r\n\t\t\tconst maxFittingNow = new Date(new Date(timestamp).getFullYear(), 0).getTime() - 1\r\n\t\t\t// Return `minTime` (in seconds).\r\n\t\t\treturn (timestamp - maxFittingNow) / 1000\r\n\t\t} else {\r\n\t\t\t// January 1, 00:00, of the year following the `date`'s year\r\n\t\t\t// is the minimum `now` for formatting a past date:\r\n\t\t\t// When `now` is before that date, the `date` is formatted as \"day/month\" (another step),\r\n\t\t\t// When `now` is equal to or after that date, the `date` is formatted as \"day/month/year\" (this step).\r\n\t\t\t// After that, it's hours, minutes, seconds, and after that it's no longer `future`.\r\n\t\t\tconst minFittingNow = new Date(new Date(timestamp).getFullYear() + 1, 0).getTime()\r\n\t\t\t// Return `minTime` (in seconds).\r\n\t\t\treturn (minFittingNow - timestamp) / 1000\r\n\t\t}\r\n\t},\r\n\tformat(value, locale) {\r\n\t\t/* istanbul ignore if */\r\n\t\tif (!formatters[locale]) {\r\n\t\t\tformatters[locale] = {}\r\n\t\t}\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale].dayMonthYear) {\r\n\t\t\t// \"Apr 11, 2017\" (yMMMd)\r\n\t\t\tformatters[locale].dayMonthYear = new Intl.DateTimeFormat(locale, {\r\n\t\t\t\tyear: 'numeric',\r\n\t\t\t\tmonth: 'short',\r\n\t\t\t\tday: 'numeric'\r\n\t\t\t})\r\n\t\t}\r\n\t\t// Output day, month and year.\r\n\t\treturn formatters[locale].dayMonthYear.format(getDate(value))\r\n\t}\r\n}\r\n\r\n// If `Intl.DateTimeFormat` is supported,\r\n// then longer time intervals will be formatted as dates.\r\n/* istanbul ignore else */\r\nif (intlDateTimeFormatSupported()) {\r\n\tsteps.push(monthAndDay, yearMonthAndDay)\r\n}\r\n// Otherwise, if `Intl.DateTimeFormat` is not supported,\r\n// which could be the case when using Internet Explorer,\r\n// then simply mimick \"round\" steps.\r\nelse {\r\n\tsteps.push(\r\n\t\t{\r\n\t\t\tformatAs: 'day'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'week'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'month'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'year'\r\n\t\t}\r\n\t)\r\n}\r\n\r\nexport default {\r\n\tsteps,\r\n\tlabels: [\r\n\t\t// \"mini\" labels are only defined for a few languages.\r\n\t\t'mini',\r\n\t\t// \"short-time\" labels are only defined for a few languages.\r\n\t\t'short-time',\r\n\t\t// \"narrow\" and \"short\" labels are defined for all languages.\r\n\t\t// \"narrow\" labels can sometimes be weird (like \"+5d.\"),\r\n\t\t// but \"short\" labels have the \" ago\" part, so \"narrow\" seem\r\n\t\t// more appropriate.\r\n\t\t// \"short\" labels would have been more appropriate if they\r\n\t\t// didn't have the \" ago\" part, hence the \"short-time\" above.\r\n\t\t'narrow',\r\n\t\t// Since \"narrow\" labels are always present, \"short\" element\r\n\t\t// of this array can be removed.\r\n\t\t'short'\r\n\t]\r\n}"],"mappings":"AAAA,SAASA,GAAT,EAAcC,OAAd,QAA6B,mBAA7B;AACA,SAASC,2BAAT,QAA4C,cAA5C,C,CAEA;;AACA,OAAOC,sBAAP,MAAmC,6BAAnC,C,CAEA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,KAAK,GAAG,CACb;EACCC,QAAQ,EAAE;AADX,CADa,EAIb;EACCA,QAAQ,EAAE;AADX,CAJa,EAOb;EACCA,QAAQ,EAAE;AADX,CAPa,CAAd,C,CAYA;AACA;;AACA,IAAMC,UAAU,GAAG,EAAnB,C,CAEA;;AACA,IAAMC,WAAW,GAAG;EACnBC,OADmB,mBACXC,SADW,QAC+B;IAAA,IAA7BC,MAA6B,QAA7BA,MAA6B;IAAA,IAArBC,iBAAqB,QAArBA,iBAAqB;IACjD;IACA;IACA,OAAOA,iBAAiB,CAAC,KAAD,CAAxB;EACA,CALkB;EAMnBC,MANmB,kBAMZC,KANY,EAMLC,MANK,EAMG;IACrB;IACA,IAAI,CAACR,UAAU,CAACQ,MAAD,CAAf,EAAyB;MACxBR,UAAU,CAACQ,MAAD,CAAV,GAAqB,EAArB;IACA;IACD;;;IACA,IAAI,CAACR,UAAU,CAACQ,MAAD,CAAV,CAAmBC,QAAxB,EAAkC;MACjC;MACAT,UAAU,CAACQ,MAAD,CAAV,CAAmBC,QAAnB,GAA8B,IAAIC,IAAI,CAACC,c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,EAAE,SAD2D;QAEjER,KAAK,EAAE,OAF0D;QAGjElB,GAAG,EAAE;MAH4D,CAAhC,CAAlC;IAKA,CAboB,CAcrB;;;IACA,OAAOM,UAAU,CAACQ,MAAD,CAAV,CAAmBW,YAAnB,CAAgCb,MAAhC,CAAuCX,OAAO,CAACY,KAAD,CAA9C,CAAP;EACA;AAxCsB,CAAxB,C,CA2CA;AACA;;AACA;;AACA,IAAIX,2BAA2B,EAA/B,EAAmC;EAClCE,KAAK,CAACuB,IAAN,CAAWpB,WAAX,EAAwBY,eAAxB;AACA,CAFD,CAGA;AACA;AACA;AALA,KAMK;EACJf,KAAK,CAACuB,IAAN,CACC;IACCtB,QAAQ,EAAE;EADX,CADD,EAIC;IACCA,QAAQ,EAAE;EADX,CAJD,EAOC;IACCA,QAAQ,EAAE;EADX,CAPD,EAUC;IACCA,QAAQ,EAAE;EADX,CAVD;AAcA;;AAED,eAAe;EACdD,KAAK,EAALA,KADc;EAEdwB,MAAM,EAAE,CACP;EACA,MAFO,EAGP;EACA,YAJO,EAKP;EACA;EACA;EACA;EACA;EACA;EACA,QAXO,EAYP;EACA;EACA,OAdO;AAFM,CAAf"}
1
+ {"version":3,"file":"twitter.js","names":["day","getDate","intlDateTimeFormatSupported","renameLegacyProperties","steps","formatAs","formatters","monthAndDay","minTime","timestamp","_ref","future","getMinTimeForUnit","format","value","locale","dayMonth","Intl","DateTimeFormat","month","yearMonthAndDay","_ref2","maxFittingNow","Date","getFullYear","getTime","minFittingNow","dayMonthYear","year","push","labels"],"sources":["../../source/style/twitter.js"],"sourcesContent":["import { day, getDate } from '../steps/index.js'\r\nimport { intlDateTimeFormatSupported } from '../locale.js'\r\n\r\n// For compatibility with the old versions of this library.\r\nimport renameLegacyProperties from './renameLegacyProperties.js'\r\n\r\n// Twitter-style relative date/time formatting.\r\n// (\"1m\", \"2h\", \"Mar 3\", \"Apr 4, 2012\").\r\n//\r\n// Seconds, minutes or hours are shown for shorter intervals,\r\n// and longer intervals are formatted using full date format.\r\n\r\nconst steps = [\r\n\t{\r\n\t\tformatAs: 'second'\r\n\t},\r\n\t{\r\n\t\tformatAs: 'minute'\r\n\t},\r\n\t{\r\n\t\tformatAs: 'hour'\r\n\t}\r\n]\r\n\r\n// A cache for `Intl.DateTimeFormat` formatters\r\n// for various locales (is a global variable).\r\nconst formatters = {}\r\n\r\n// Starting from day intervals, output month and day.\r\nconst monthAndDay = {\r\n\tminTime(timestamp, { future, getMinTimeForUnit }) {\r\n\t\t// Returns `23.5 * 60 * 60` when `round` is \"round\",\r\n\t\t// and `24 * 60 * 60` when `round` is \"floor\".\r\n\t\treturn getMinTimeForUnit('day')\r\n\t},\r\n\tformat(value, locale) {\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale]) {\r\n\t\t\tformatters[locale] = {}\r\n\t\t}\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale].dayMonth) {\r\n\t\t\t// \"Apr 11\" (MMMd)\r\n\t\t\tformatters[locale].dayMonth = new Intl.DateTimeFormat(locale, {\r\n\t\t\t\tmonth: 'short',\r\n\t\t\t\tday: 'numeric'\r\n\t\t\t})\r\n\t\t}\r\n\t\t// Output month and day.\r\n\t\treturn formatters[locale].dayMonth.format(getDate(value))\r\n\t}\r\n}\r\n\r\n// If the `date` happened/happens outside of current year,\r\n// then output day, month and year.\r\n// The interval should be such that the `date` lies outside of the current year.\r\nconst yearMonthAndDay = {\r\n\tminTime(timestamp, { future }) {\r\n\t\tif (future) {\r\n\t\t\t// January 1, 00:00, of the `date`'s year is right after\r\n\t\t\t// the maximum `now` for formatting a future date:\r\n\t\t\t// When `now` is before that date, the `date` is formatted as \"day/month/year\" (this step),\r\n\t\t\t// When `now` is equal to or after that date, the `date` is formatted as \"day/month\" (another step).\r\n\t\t\t// After that, it's hours, minutes, seconds, and after that it's no longer `future`.\r\n\t\t\t// The date is right after the maximum `now` for formatting a future date,\r\n\t\t\t// so subtract 1 millisecond from it.\r\n\t\t\tconst maxFittingNow = new Date(new Date(timestamp).getFullYear(), 0).getTime() - 1\r\n\t\t\t// Return `minTime` (in seconds).\r\n\t\t\treturn (timestamp - maxFittingNow) / 1000\r\n\t\t} else {\r\n\t\t\t// January 1, 00:00, of the year following the `date`'s year\r\n\t\t\t// is the minimum `now` for formatting a past date:\r\n\t\t\t// When `now` is before that date, the `date` is formatted as \"day/month\" (another step),\r\n\t\t\t// When `now` is equal to or after that date, the `date` is formatted as \"day/month/year\" (this step).\r\n\t\t\t// After that, it's hours, minutes, seconds, and after that it's no longer `future`.\r\n\t\t\tconst minFittingNow = new Date(new Date(timestamp).getFullYear() + 1, 0).getTime()\r\n\t\t\t// Return `minTime` (in seconds).\r\n\t\t\treturn (minFittingNow - timestamp) / 1000\r\n\t\t}\r\n\t},\r\n\tformat(value, locale) {\r\n\t\t/* istanbul ignore if */\r\n\t\tif (!formatters[locale]) {\r\n\t\t\tformatters[locale] = {}\r\n\t\t}\r\n\t\t/* istanbul ignore else */\r\n\t\tif (!formatters[locale].dayMonthYear) {\r\n\t\t\t// \"Apr 11, 2017\" (yMMMd)\r\n\t\t\tformatters[locale].dayMonthYear = new Intl.DateTimeFormat(locale, {\r\n\t\t\t\tyear: 'numeric',\r\n\t\t\t\tmonth: 'short',\r\n\t\t\t\tday: 'numeric'\r\n\t\t\t})\r\n\t\t}\r\n\t\t// Output day, month and year.\r\n\t\treturn formatters[locale].dayMonthYear.format(getDate(value))\r\n\t}\r\n}\r\n\r\n// If `Intl.DateTimeFormat` is supported,\r\n// then longer time intervals will be formatted as dates.\r\n/* istanbul ignore else */\r\nif (intlDateTimeFormatSupported()) {\r\n\tsteps.push(monthAndDay, yearMonthAndDay)\r\n}\r\n// Otherwise, if `Intl.DateTimeFormat` is not supported,\r\n// which could be the case when using Internet Explorer,\r\n// then simply mimick \"round\" steps.\r\nelse {\r\n\tsteps.push(\r\n\t\t{\r\n\t\t\tformatAs: 'day'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'week'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'month'\r\n\t\t},\r\n\t\t{\r\n\t\t\tformatAs: 'year'\r\n\t\t}\r\n\t)\r\n}\r\n\r\nexport default {\r\n\tsteps,\r\n\tlabels: [\r\n\t\t// \"mini\" labels are only defined for a few languages.\r\n\t\t'mini',\r\n\t\t// \"short-time\" labels are only defined for a few languages.\r\n\t\t'short-time',\r\n\t\t// \"narrow\" and \"short\" labels are defined for all languages.\r\n\t\t// \"narrow\" labels can sometimes be weird (like \"+5d.\"),\r\n\t\t// but \"short\" labels have the \" ago\" part, so \"narrow\" seem\r\n\t\t// more appropriate.\r\n\t\t// \"short\" labels would have been more appropriate if they\r\n\t\t// didn't have the \" ago\" part, hence the \"short-time\" above.\r\n\t\t'narrow',\r\n\t\t// Since \"narrow\" labels are always present, \"short\" element\r\n\t\t// of this array can be removed.\r\n\t\t'short'\r\n\t]\r\n}"],"mappings":"AAAA,SAASA,GAAG,EAAEC,OAAO,QAAQ,mBAAmB;AAChD,SAASC,2BAA2B,QAAQ,cAAc;;AAE1D;AACA,OAAOC,sBAAsB,MAAM,6BAA6B;;AAEhE;AACA;AACA;AACA;AACA;;AAEA,IAAMC,KAAK,GAAG,CACb;EACCC,QAAQ,EAAE;AACX,CAAC,EACD;EACCA,QAAQ,EAAE;AACX,CAAC,EACD;EACCA,QAAQ,EAAE;AACX,CAAC,CACD;;AAED;AACA;AACA,IAAMC,UAAU,GAAG,CAAC,CAAC;;AAErB;AACA,IAAMC,WAAW,GAAG;EACnBC,OAAO,WAAAA,QAACC,SAAS,EAAAC,IAAA,EAAiC;IAAA,IAA7BC,MAAM,GAAAD,IAAA,CAANC,MAAM;MAAEC,iBAAiB,GAAAF,IAAA,CAAjBE,iBAAiB;IAC7C;IACA;IACA,OAAOA,iBAAiB,CAAC,KAAK,CAAC;EAChC,CAAC;EACDC,MAAM,WAAAA,OAACC,KAAK,EAAEC,MAAM,EAAE;IACrB;IACA,IAAI,CAACT,UAAU,CAACS,MAAM,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