react-intl 2.3.0 → 2.4.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 (263) hide show
  1. package/dist/react-intl.js +960 -948
  2. package/dist/react-intl.js.map +1 -1
  3. package/dist/react-intl.min.js +1 -2
  4. package/dist/react-intl.min.js.map +1 -1
  5. package/lib/index.es.js +971 -970
  6. package/lib/index.js +971 -970
  7. package/locale-data/af.js +1 -1
  8. package/locale-data/agq.js +1 -1
  9. package/locale-data/ak.js +1 -1
  10. package/locale-data/am.js +1 -1
  11. package/locale-data/ar.js +1 -1
  12. package/locale-data/ars.js +1 -0
  13. package/locale-data/as.js +1 -1
  14. package/locale-data/asa.js +1 -1
  15. package/locale-data/ast.js +1 -1
  16. package/locale-data/az.js +1 -1
  17. package/locale-data/bas.js +1 -1
  18. package/locale-data/be.js +1 -1
  19. package/locale-data/bem.js +1 -1
  20. package/locale-data/bez.js +1 -1
  21. package/locale-data/bg.js +1 -1
  22. package/locale-data/bh.js +1 -1
  23. package/locale-data/bm.js +1 -1
  24. package/locale-data/bn.js +1 -1
  25. package/locale-data/bo.js +1 -1
  26. package/locale-data/br.js +1 -1
  27. package/locale-data/brx.js +1 -1
  28. package/locale-data/bs.js +1 -1
  29. package/locale-data/ca.js +1 -1
  30. package/locale-data/ce.js +1 -1
  31. package/locale-data/cgg.js +1 -1
  32. package/locale-data/chr.js +1 -1
  33. package/locale-data/ckb.js +1 -1
  34. package/locale-data/cs.js +1 -1
  35. package/locale-data/cu.js +1 -1
  36. package/locale-data/cy.js +1 -1
  37. package/locale-data/da.js +1 -1
  38. package/locale-data/dav.js +1 -1
  39. package/locale-data/de.js +1 -1
  40. package/locale-data/dje.js +1 -1
  41. package/locale-data/dsb.js +1 -1
  42. package/locale-data/dua.js +1 -1
  43. package/locale-data/dv.js +1 -1
  44. package/locale-data/dyo.js +1 -1
  45. package/locale-data/dz.js +1 -1
  46. package/locale-data/ebu.js +1 -1
  47. package/locale-data/ee.js +1 -1
  48. package/locale-data/el.js +1 -1
  49. package/locale-data/en.js +1 -1
  50. package/locale-data/eo.js +1 -1
  51. package/locale-data/es.js +1 -1
  52. package/locale-data/et.js +1 -1
  53. package/locale-data/eu.js +1 -1
  54. package/locale-data/ewo.js +1 -1
  55. package/locale-data/fa.js +1 -1
  56. package/locale-data/ff.js +1 -1
  57. package/locale-data/fi.js +1 -1
  58. package/locale-data/fil.js +1 -1
  59. package/locale-data/fo.js +1 -1
  60. package/locale-data/fr.js +1 -1
  61. package/locale-data/fur.js +1 -1
  62. package/locale-data/fy.js +1 -1
  63. package/locale-data/ga.js +1 -1
  64. package/locale-data/gd.js +1 -1
  65. package/locale-data/gl.js +1 -1
  66. package/locale-data/gsw.js +1 -1
  67. package/locale-data/gu.js +1 -1
  68. package/locale-data/guw.js +1 -1
  69. package/locale-data/guz.js +1 -1
  70. package/locale-data/gv.js +1 -1
  71. package/locale-data/ha.js +1 -1
  72. package/locale-data/haw.js +1 -1
  73. package/locale-data/he.js +1 -1
  74. package/locale-data/hi.js +1 -1
  75. package/locale-data/hr.js +1 -1
  76. package/locale-data/hsb.js +1 -1
  77. package/locale-data/hu.js +1 -1
  78. package/locale-data/hy.js +1 -1
  79. package/locale-data/id.js +1 -1
  80. package/locale-data/ig.js +1 -1
  81. package/locale-data/ii.js +1 -1
  82. package/locale-data/in.js +1 -1
  83. package/locale-data/index.js +1 -10
  84. package/locale-data/is.js +1 -1
  85. package/locale-data/it.js +1 -1
  86. package/locale-data/iu.js +1 -1
  87. package/locale-data/iw.js +1 -1
  88. package/locale-data/ja.js +1 -1
  89. package/locale-data/jbo.js +1 -1
  90. package/locale-data/jgo.js +1 -1
  91. package/locale-data/ji.js +1 -1
  92. package/locale-data/jmc.js +1 -1
  93. package/locale-data/jv.js +1 -1
  94. package/locale-data/jw.js +1 -1
  95. package/locale-data/ka.js +1 -1
  96. package/locale-data/kab.js +1 -1
  97. package/locale-data/kaj.js +1 -1
  98. package/locale-data/kam.js +1 -1
  99. package/locale-data/kcg.js +1 -1
  100. package/locale-data/kde.js +1 -1
  101. package/locale-data/kea.js +1 -1
  102. package/locale-data/khq.js +1 -1
  103. package/locale-data/ki.js +1 -1
  104. package/locale-data/kk.js +1 -1
  105. package/locale-data/kkj.js +1 -1
  106. package/locale-data/kl.js +1 -1
  107. package/locale-data/kln.js +1 -1
  108. package/locale-data/km.js +1 -1
  109. package/locale-data/kn.js +1 -1
  110. package/locale-data/ko.js +1 -1
  111. package/locale-data/kok.js +1 -1
  112. package/locale-data/ks.js +1 -1
  113. package/locale-data/ksb.js +1 -1
  114. package/locale-data/ksf.js +1 -1
  115. package/locale-data/ksh.js +1 -1
  116. package/locale-data/ku.js +1 -1
  117. package/locale-data/kw.js +1 -1
  118. package/locale-data/ky.js +1 -1
  119. package/locale-data/lag.js +1 -1
  120. package/locale-data/lb.js +1 -1
  121. package/locale-data/lg.js +1 -1
  122. package/locale-data/lkt.js +1 -1
  123. package/locale-data/ln.js +1 -1
  124. package/locale-data/lo.js +1 -1
  125. package/locale-data/lrc.js +1 -1
  126. package/locale-data/lt.js +1 -1
  127. package/locale-data/lu.js +1 -1
  128. package/locale-data/luo.js +1 -1
  129. package/locale-data/luy.js +1 -1
  130. package/locale-data/lv.js +1 -1
  131. package/locale-data/mas.js +1 -1
  132. package/locale-data/mer.js +1 -1
  133. package/locale-data/mfe.js +1 -1
  134. package/locale-data/mg.js +1 -1
  135. package/locale-data/mgh.js +1 -1
  136. package/locale-data/mgo.js +1 -1
  137. package/locale-data/mk.js +1 -1
  138. package/locale-data/ml.js +1 -1
  139. package/locale-data/mn.js +1 -1
  140. package/locale-data/mo.js +1 -1
  141. package/locale-data/mr.js +1 -1
  142. package/locale-data/ms.js +1 -1
  143. package/locale-data/mt.js +1 -1
  144. package/locale-data/mua.js +1 -1
  145. package/locale-data/my.js +1 -1
  146. package/locale-data/mzn.js +1 -1
  147. package/locale-data/nah.js +1 -1
  148. package/locale-data/naq.js +1 -1
  149. package/locale-data/nb.js +1 -1
  150. package/locale-data/nd.js +1 -1
  151. package/locale-data/nds.js +1 -0
  152. package/locale-data/ne.js +1 -1
  153. package/locale-data/nl.js +1 -1
  154. package/locale-data/nmg.js +1 -1
  155. package/locale-data/nn.js +1 -1
  156. package/locale-data/nnh.js +1 -1
  157. package/locale-data/no.js +1 -1
  158. package/locale-data/nqo.js +1 -1
  159. package/locale-data/nr.js +1 -1
  160. package/locale-data/nso.js +1 -1
  161. package/locale-data/nus.js +1 -1
  162. package/locale-data/ny.js +1 -1
  163. package/locale-data/nyn.js +1 -1
  164. package/locale-data/om.js +1 -1
  165. package/locale-data/or.js +1 -1
  166. package/locale-data/os.js +1 -1
  167. package/locale-data/pa.js +1 -1
  168. package/locale-data/pap.js +1 -1
  169. package/locale-data/pl.js +1 -1
  170. package/locale-data/prg.js +1 -1
  171. package/locale-data/ps.js +1 -1
  172. package/locale-data/pt.js +1 -1
  173. package/locale-data/qu.js +1 -1
  174. package/locale-data/rm.js +1 -1
  175. package/locale-data/rn.js +1 -1
  176. package/locale-data/ro.js +1 -1
  177. package/locale-data/rof.js +1 -1
  178. package/locale-data/ru.js +1 -1
  179. package/locale-data/rw.js +1 -1
  180. package/locale-data/rwk.js +1 -1
  181. package/locale-data/sah.js +1 -1
  182. package/locale-data/saq.js +1 -1
  183. package/locale-data/sbp.js +1 -1
  184. package/locale-data/sdh.js +1 -1
  185. package/locale-data/se.js +1 -1
  186. package/locale-data/seh.js +1 -1
  187. package/locale-data/ses.js +1 -1
  188. package/locale-data/sg.js +1 -1
  189. package/locale-data/sh.js +1 -1
  190. package/locale-data/shi.js +1 -1
  191. package/locale-data/si.js +1 -1
  192. package/locale-data/sk.js +1 -1
  193. package/locale-data/sl.js +1 -1
  194. package/locale-data/sma.js +1 -1
  195. package/locale-data/smi.js +1 -1
  196. package/locale-data/smj.js +1 -1
  197. package/locale-data/smn.js +1 -1
  198. package/locale-data/sms.js +1 -1
  199. package/locale-data/sn.js +1 -1
  200. package/locale-data/so.js +1 -1
  201. package/locale-data/sq.js +1 -1
  202. package/locale-data/sr.js +1 -1
  203. package/locale-data/ss.js +1 -1
  204. package/locale-data/ssy.js +1 -1
  205. package/locale-data/st.js +1 -1
  206. package/locale-data/sv.js +1 -1
  207. package/locale-data/sw.js +1 -1
  208. package/locale-data/syr.js +1 -1
  209. package/locale-data/ta.js +1 -1
  210. package/locale-data/te.js +1 -1
  211. package/locale-data/teo.js +1 -1
  212. package/locale-data/th.js +1 -1
  213. package/locale-data/ti.js +1 -1
  214. package/locale-data/tig.js +1 -1
  215. package/locale-data/tk.js +1 -1
  216. package/locale-data/tl.js +1 -1
  217. package/locale-data/tn.js +1 -1
  218. package/locale-data/to.js +1 -1
  219. package/locale-data/tr.js +1 -1
  220. package/locale-data/ts.js +1 -1
  221. package/locale-data/twq.js +1 -1
  222. package/locale-data/tzm.js +1 -1
  223. package/locale-data/ug.js +1 -1
  224. package/locale-data/uk.js +1 -1
  225. package/locale-data/ur.js +1 -1
  226. package/locale-data/uz.js +1 -1
  227. package/locale-data/vai.js +1 -1
  228. package/locale-data/ve.js +1 -1
  229. package/locale-data/vi.js +1 -1
  230. package/locale-data/vo.js +1 -1
  231. package/locale-data/vun.js +1 -1
  232. package/locale-data/wa.js +1 -1
  233. package/locale-data/wae.js +1 -1
  234. package/locale-data/wo.js +1 -1
  235. package/locale-data/xh.js +1 -1
  236. package/locale-data/xog.js +1 -1
  237. package/locale-data/yav.js +1 -1
  238. package/locale-data/yi.js +1 -1
  239. package/locale-data/yo.js +1 -1
  240. package/locale-data/yue.js +1 -0
  241. package/locale-data/zgh.js +1 -1
  242. package/locale-data/zh.js +1 -1
  243. package/locale-data/zu.js +1 -1
  244. package/package.json +11 -9
  245. package/src/components/date.js +47 -0
  246. package/src/components/html-message.js +88 -0
  247. package/src/components/message.js +137 -0
  248. package/src/components/number.js +47 -0
  249. package/src/components/plural.js +59 -0
  250. package/src/components/provider.js +177 -0
  251. package/src/components/relative.js +171 -0
  252. package/src/components/time.js +47 -0
  253. package/src/define-messages.js +11 -0
  254. package/src/en.js +2 -0
  255. package/src/format.js +276 -0
  256. package/src/index.js +12 -0
  257. package/src/inject.js +59 -0
  258. package/src/locale-data-registry.js +42 -0
  259. package/src/plural.js +28 -0
  260. package/src/react-intl.js +24 -0
  261. package/src/types.js +98 -0
  262. package/src/utils.js +103 -0
  263. package/yarn.lock +87 -59
package/lib/index.js CHANGED
@@ -26,7 +26,7 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
26
26
  t0 = Number(s[0]) == n,
27
27
  n10 = t0 && s[0].slice(-1),
28
28
  n100 = t0 && s[0].slice(-2);if (ord) return n10 == 1 && n100 != 11 ? "one" : n10 == 2 && n100 != 12 ? "two" : n10 == 3 && n100 != 13 ? "few" : "other";return n == 1 && v0 ? "one" : "other";
29
- }, "fields": { "year": { "displayName": "year", "relative": { "0": "this year", "1": "next year", "-1": "last year" }, "relativeTime": { "future": { "one": "in {0} year", "other": "in {0} years" }, "past": { "one": "{0} year ago", "other": "{0} years ago" } } }, "month": { "displayName": "month", "relative": { "0": "this month", "1": "next month", "-1": "last month" }, "relativeTime": { "future": { "one": "in {0} month", "other": "in {0} months" }, "past": { "one": "{0} month ago", "other": "{0} months ago" } } }, "day": { "displayName": "day", "relative": { "0": "today", "1": "tomorrow", "-1": "yesterday" }, "relativeTime": { "future": { "one": "in {0} day", "other": "in {0} days" }, "past": { "one": "{0} day ago", "other": "{0} days ago" } } }, "hour": { "displayName": "hour", "relativeTime": { "future": { "one": "in {0} hour", "other": "in {0} hours" }, "past": { "one": "{0} hour ago", "other": "{0} hours ago" } } }, "minute": { "displayName": "minute", "relativeTime": { "future": { "one": "in {0} minute", "other": "in {0} minutes" }, "past": { "one": "{0} minute ago", "other": "{0} minutes ago" } } }, "second": { "displayName": "second", "relative": { "0": "now" }, "relativeTime": { "future": { "one": "in {0} second", "other": "in {0} seconds" }, "past": { "one": "{0} second ago", "other": "{0} seconds ago" } } } } };
29
+ }, "fields": { "year": { "displayName": "year", "relative": { "0": "this year", "1": "next year", "-1": "last year" }, "relativeTime": { "future": { "one": "in {0} year", "other": "in {0} years" }, "past": { "one": "{0} year ago", "other": "{0} years ago" } } }, "month": { "displayName": "month", "relative": { "0": "this month", "1": "next month", "-1": "last month" }, "relativeTime": { "future": { "one": "in {0} month", "other": "in {0} months" }, "past": { "one": "{0} month ago", "other": "{0} months ago" } } }, "day": { "displayName": "day", "relative": { "0": "today", "1": "tomorrow", "-1": "yesterday" }, "relativeTime": { "future": { "one": "in {0} day", "other": "in {0} days" }, "past": { "one": "{0} day ago", "other": "{0} days ago" } } }, "hour": { "displayName": "hour", "relative": { "0": "this hour" }, "relativeTime": { "future": { "one": "in {0} hour", "other": "in {0} hours" }, "past": { "one": "{0} hour ago", "other": "{0} hours ago" } } }, "minute": { "displayName": "minute", "relative": { "0": "this minute" }, "relativeTime": { "future": { "one": "in {0} minute", "other": "in {0} minutes" }, "past": { "one": "{0} minute ago", "other": "{0} minutes ago" } } }, "second": { "displayName": "second", "relative": { "0": "now" }, "relativeTime": { "future": { "one": "in {0} second", "other": "in {0} seconds" }, "past": { "one": "{0} second ago", "other": "{0} seconds ago" } } } } };
30
30
 
31
31
  /*
32
32
  * Copyright 2015, Yahoo Inc.
@@ -35,36 +35,36 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
35
35
  */
36
36
 
37
37
  function addLocaleData() {
38
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
38
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
39
39
 
40
- var locales = Array.isArray(data) ? data : [data];
40
+ var locales = Array.isArray(data) ? data : [data];
41
41
 
42
- locales.forEach(function (localeData) {
43
- if (localeData && localeData.locale) {
44
- IntlMessageFormat.__addLocaleData(localeData);
45
- IntlRelativeFormat.__addLocaleData(localeData);
46
- }
47
- });
42
+ locales.forEach(function (localeData) {
43
+ if (localeData && localeData.locale) {
44
+ IntlMessageFormat.__addLocaleData(localeData);
45
+ IntlRelativeFormat.__addLocaleData(localeData);
46
+ }
47
+ });
48
48
  }
49
49
 
50
50
  function hasLocaleData(locale) {
51
- var localeParts = (locale || '').split('-');
51
+ var localeParts = (locale || '').split('-');
52
52
 
53
- while (localeParts.length > 0) {
54
- if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
55
- return true;
56
- }
57
-
58
- localeParts.pop();
53
+ while (localeParts.length > 0) {
54
+ if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
55
+ return true;
59
56
  }
60
57
 
61
- return false;
58
+ localeParts.pop();
59
+ }
60
+
61
+ return false;
62
62
  }
63
63
 
64
64
  function hasIMFAndIRFLocaleData(locale) {
65
- var normalizedLocale = locale && locale.toLowerCase();
65
+ var normalizedLocale = locale && locale.toLowerCase();
66
66
 
67
- return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
67
+ return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
68
68
  }
69
69
 
70
70
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
@@ -228,6 +228,7 @@ var object = PropTypes.object;
228
228
  var oneOf = PropTypes.oneOf;
229
229
  var shape = PropTypes.shape;
230
230
  var any = PropTypes.any;
231
+ var oneOfType = PropTypes.oneOfType;
231
232
 
232
233
  var localeMatcher = oneOf(['best fit', 'lookup']);
233
234
  var narrowShortLong = oneOf(['narrow', 'short', 'long']);
@@ -235,76 +236,76 @@ var numeric2digit = oneOf(['numeric', '2-digit']);
235
236
  var funcReq = func.isRequired;
236
237
 
237
238
  var intlConfigPropTypes = {
238
- locale: string,
239
- formats: object,
240
- messages: object,
241
- textComponent: any,
239
+ locale: string,
240
+ formats: object,
241
+ messages: object,
242
+ textComponent: any,
242
243
 
243
- defaultLocale: string,
244
- defaultFormats: object
244
+ defaultLocale: string,
245
+ defaultFormats: object
245
246
  };
246
247
 
247
248
  var intlFormatPropTypes = {
248
- formatDate: funcReq,
249
- formatTime: funcReq,
250
- formatRelative: funcReq,
251
- formatNumber: funcReq,
252
- formatPlural: funcReq,
253
- formatMessage: funcReq,
254
- formatHTMLMessage: funcReq
249
+ formatDate: funcReq,
250
+ formatTime: funcReq,
251
+ formatRelative: funcReq,
252
+ formatNumber: funcReq,
253
+ formatPlural: funcReq,
254
+ formatMessage: funcReq,
255
+ formatHTMLMessage: funcReq
255
256
  };
256
257
 
257
258
  var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, {
258
- formatters: object,
259
- now: funcReq
259
+ formatters: object,
260
+ now: funcReq
260
261
  }));
261
262
 
262
263
  var messageDescriptorPropTypes = {
263
- id: string.isRequired,
264
- description: string,
265
- defaultMessage: string
264
+ id: string.isRequired,
265
+ description: oneOfType([string, object]),
266
+ defaultMessage: string
266
267
  };
267
268
 
268
269
  var dateTimeFormatPropTypes = {
269
- localeMatcher: localeMatcher,
270
- formatMatcher: oneOf(['basic', 'best fit']),
271
-
272
- timeZone: string,
273
- hour12: bool,
274
-
275
- weekday: narrowShortLong,
276
- era: narrowShortLong,
277
- year: numeric2digit,
278
- month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
279
- day: numeric2digit,
280
- hour: numeric2digit,
281
- minute: numeric2digit,
282
- second: numeric2digit,
283
- timeZoneName: oneOf(['short', 'long'])
270
+ localeMatcher: localeMatcher,
271
+ formatMatcher: oneOf(['basic', 'best fit']),
272
+
273
+ timeZone: string,
274
+ hour12: bool,
275
+
276
+ weekday: narrowShortLong,
277
+ era: narrowShortLong,
278
+ year: numeric2digit,
279
+ month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
280
+ day: numeric2digit,
281
+ hour: numeric2digit,
282
+ minute: numeric2digit,
283
+ second: numeric2digit,
284
+ timeZoneName: oneOf(['short', 'long'])
284
285
  };
285
286
 
286
287
  var numberFormatPropTypes = {
287
- localeMatcher: localeMatcher,
288
-
289
- style: oneOf(['decimal', 'currency', 'percent']),
290
- currency: string,
291
- currencyDisplay: oneOf(['symbol', 'code', 'name']),
292
- useGrouping: bool,
293
-
294
- minimumIntegerDigits: number,
295
- minimumFractionDigits: number,
296
- maximumFractionDigits: number,
297
- minimumSignificantDigits: number,
298
- maximumSignificantDigits: number
288
+ localeMatcher: localeMatcher,
289
+
290
+ style: oneOf(['decimal', 'currency', 'percent']),
291
+ currency: string,
292
+ currencyDisplay: oneOf(['symbol', 'code', 'name']),
293
+ useGrouping: bool,
294
+
295
+ minimumIntegerDigits: number,
296
+ minimumFractionDigits: number,
297
+ maximumFractionDigits: number,
298
+ minimumSignificantDigits: number,
299
+ maximumSignificantDigits: number
299
300
  };
300
301
 
301
302
  var relativeFormatPropTypes = {
302
- style: oneOf(['best fit', 'numeric']),
303
- units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
303
+ style: oneOf(['best fit', 'numeric']),
304
+ units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
304
305
  };
305
306
 
306
307
  var pluralFormatPropTypes = {
307
- style: oneOf(['cardinal', 'ordinal'])
308
+ style: oneOf(['cardinal', 'ordinal'])
308
309
  };
309
310
 
310
311
  /*
@@ -321,82 +322,82 @@ file in the root directory of React's source tree.
321
322
  var intlConfigPropNames = Object.keys(intlConfigPropTypes);
322
323
 
323
324
  var ESCAPED_CHARS = {
324
- '&': '&',
325
- '>': '>',
326
- '<': '&lt;',
327
- '"': '&quot;',
328
- '\'': '&#x27;'
325
+ '&': '&amp;',
326
+ '>': '&gt;',
327
+ '<': '&lt;',
328
+ '"': '&quot;',
329
+ "'": '&#x27;'
329
330
  };
330
331
 
331
332
  var UNSAFE_CHARS_REGEX = /[&><"']/g;
332
333
 
333
334
  function escape(str) {
334
- return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
335
- return ESCAPED_CHARS[match];
336
- });
335
+ return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
336
+ return ESCAPED_CHARS[match];
337
+ });
337
338
  }
338
339
 
339
340
  function filterProps(props, whitelist) {
340
- var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
341
+ var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
341
342
 
342
- return whitelist.reduce(function (filtered, name) {
343
- if (props.hasOwnProperty(name)) {
344
- filtered[name] = props[name];
345
- } else if (defaults$$1.hasOwnProperty(name)) {
346
- filtered[name] = defaults$$1[name];
347
- }
343
+ return whitelist.reduce(function (filtered, name) {
344
+ if (props.hasOwnProperty(name)) {
345
+ filtered[name] = props[name];
346
+ } else if (defaults$$1.hasOwnProperty(name)) {
347
+ filtered[name] = defaults$$1[name];
348
+ }
348
349
 
349
- return filtered;
350
- }, {});
350
+ return filtered;
351
+ }, {});
351
352
  }
352
353
 
353
354
  function invariantIntlContext() {
354
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
355
- intl = _ref.intl;
355
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
356
+ intl = _ref.intl;
356
357
 
357
- invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
358
+ invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
358
359
  }
359
360
 
360
361
  function shallowEquals(objA, objB) {
361
- if (objA === objB) {
362
- return true;
363
- }
362
+ if (objA === objB) {
363
+ return true;
364
+ }
364
365
 
365
- if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
366
- return false;
367
- }
366
+ if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
367
+ return false;
368
+ }
368
369
 
369
- var keysA = Object.keys(objA);
370
- var keysB = Object.keys(objB);
370
+ var keysA = Object.keys(objA);
371
+ var keysB = Object.keys(objB);
371
372
 
372
- if (keysA.length !== keysB.length) {
373
- return false;
374
- }
373
+ if (keysA.length !== keysB.length) {
374
+ return false;
375
+ }
375
376
 
376
- // Test for A's keys different from B.
377
- var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
378
- for (var i = 0; i < keysA.length; i++) {
379
- if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
380
- return false;
381
- }
377
+ // Test for A's keys different from B.
378
+ var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
379
+ for (var i = 0; i < keysA.length; i++) {
380
+ if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
381
+ return false;
382
382
  }
383
+ }
383
384
 
384
- return true;
385
+ return true;
385
386
  }
386
387
 
387
388
  function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
388
- var props = _ref2.props,
389
- state = _ref2.state,
390
- _ref2$context = _ref2.context,
391
- context = _ref2$context === undefined ? {} : _ref2$context;
392
- var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
393
- var _context$intl = context.intl,
394
- intl = _context$intl === undefined ? {} : _context$intl;
395
- var _nextContext$intl = nextContext.intl,
396
- nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
397
-
398
-
399
- return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
389
+ var props = _ref2.props,
390
+ state = _ref2.state,
391
+ _ref2$context = _ref2.context,
392
+ context = _ref2$context === undefined ? {} : _ref2$context;
393
+ var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
394
+ var _context$intl = context.intl,
395
+ intl = _context$intl === undefined ? {} : _context$intl;
396
+ var _nextContext$intl = nextContext.intl,
397
+ nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
398
+
399
+
400
+ return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
400
401
  }
401
402
 
402
403
  /*
@@ -409,54 +410,54 @@ function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
409
410
  // https://github.com/rackt/react-redux
410
411
 
411
412
  function getDisplayName(Component$$1) {
412
- return Component$$1.displayName || Component$$1.name || 'Component';
413
+ return Component$$1.displayName || Component$$1.name || 'Component';
413
414
  }
414
415
 
415
416
  function injectIntl(WrappedComponent) {
416
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
417
- var _options$intlPropName = options.intlPropName,
418
- intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
419
- _options$withRef = options.withRef,
420
- withRef = _options$withRef === undefined ? false : _options$withRef;
417
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
418
+ var _options$intlPropName = options.intlPropName,
419
+ intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
420
+ _options$withRef = options.withRef,
421
+ withRef = _options$withRef === undefined ? false : _options$withRef;
421
422
 
422
- var InjectIntl = function (_Component) {
423
- inherits(InjectIntl, _Component);
423
+ var InjectIntl = function (_Component) {
424
+ inherits(InjectIntl, _Component);
424
425
 
425
- function InjectIntl(props, context) {
426
- classCallCheck(this, InjectIntl);
426
+ function InjectIntl(props, context) {
427
+ classCallCheck(this, InjectIntl);
427
428
 
428
- var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
429
+ var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
429
430
 
430
- invariantIntlContext(context);
431
- return _this;
432
- }
433
-
434
- createClass(InjectIntl, [{
435
- key: 'getWrappedInstance',
436
- value: function getWrappedInstance() {
437
- invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
438
-
439
- return this.refs.wrappedInstance;
440
- }
441
- }, {
442
- key: 'render',
443
- value: function render() {
444
- return React__default.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
445
- ref: withRef ? 'wrappedInstance' : null
446
- }));
447
- }
448
- }]);
449
- return InjectIntl;
450
- }(React.Component);
451
-
452
- InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
453
- InjectIntl.contextTypes = {
454
- intl: intlShape
455
- };
456
- InjectIntl.WrappedComponent = WrappedComponent;
431
+ invariantIntlContext(context);
432
+ return _this;
433
+ }
457
434
 
435
+ createClass(InjectIntl, [{
436
+ key: 'getWrappedInstance',
437
+ value: function getWrappedInstance() {
438
+ invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
458
439
 
440
+ return this.refs.wrappedInstance;
441
+ }
442
+ }, {
443
+ key: 'render',
444
+ value: function render() {
445
+ return React__default.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
446
+ ref: withRef ? 'wrappedInstance' : null
447
+ }));
448
+ }
449
+ }]);
459
450
  return InjectIntl;
451
+ }(React.Component);
452
+
453
+ InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
454
+ InjectIntl.contextTypes = {
455
+ intl: intlShape
456
+ };
457
+ InjectIntl.WrappedComponent = WrappedComponent;
458
+
459
+
460
+ return InjectIntl;
460
461
  }
461
462
 
462
463
  /*
@@ -480,25 +481,25 @@ function defineMessages(messageDescriptors) {
480
481
  // This is a "hack" until a proper `intl-pluralformat` package is created.
481
482
 
482
483
  function resolveLocale(locales) {
483
- // IntlMessageFormat#_resolveLocale() does not depend on `this`.
484
- return IntlMessageFormat.prototype._resolveLocale(locales);
484
+ // IntlMessageFormat#_resolveLocale() does not depend on `this`.
485
+ return IntlMessageFormat.prototype._resolveLocale(locales);
485
486
  }
486
487
 
487
488
  function findPluralFunction(locale) {
488
- // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
489
- return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
489
+ // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
490
+ return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
490
491
  }
491
492
 
492
493
  var IntlPluralFormat = function IntlPluralFormat(locales) {
493
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
494
- classCallCheck(this, IntlPluralFormat);
494
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
495
+ classCallCheck(this, IntlPluralFormat);
495
496
 
496
- var useOrdinal = options.style === 'ordinal';
497
- var pluralFn = findPluralFunction(resolveLocale(locales));
497
+ var useOrdinal = options.style === 'ordinal';
498
+ var pluralFn = findPluralFunction(resolveLocale(locales));
498
499
 
499
- this.format = function (value) {
500
- return pluralFn(value, useOrdinal);
501
- };
500
+ this.format = function (value) {
501
+ return pluralFn(value, useOrdinal);
502
+ };
502
503
  };
503
504
 
504
505
  /*
@@ -513,234 +514,234 @@ var RELATIVE_FORMAT_OPTIONS = Object.keys(relativeFormatPropTypes);
513
514
  var PLURAL_FORMAT_OPTIONS = Object.keys(pluralFormatPropTypes);
514
515
 
515
516
  var RELATIVE_FORMAT_THRESHOLDS = {
516
- second: 60, // seconds to minute
517
- minute: 60, // minutes to hour
518
- hour: 24, // hours to day
519
- day: 30, // days to month
520
- month: 12 };
517
+ second: 60, // seconds to minute
518
+ minute: 60, // minutes to hour
519
+ hour: 24, // hours to day
520
+ day: 30, // days to month
521
+ month: 12 // months to year
522
+ };
521
523
 
522
524
  function updateRelativeFormatThresholds(newThresholds) {
523
- var thresholds = IntlRelativeFormat.thresholds;
524
- thresholds.second = newThresholds.second;
525
- thresholds.minute = newThresholds.minute;
526
- thresholds.hour = newThresholds.hour;
527
- thresholds.day = newThresholds.day;
528
- thresholds.month = newThresholds.month;
525
+ var thresholds = IntlRelativeFormat.thresholds;
526
+ thresholds.second = newThresholds.second;
527
+ thresholds.minute = newThresholds.minute;
528
+ thresholds.hour = newThresholds.hour;
529
+ thresholds.day = newThresholds.day;
530
+ thresholds.month = newThresholds.month;
529
531
  }
530
532
 
531
533
  function getNamedFormat(formats, type, name) {
532
- var format = formats && formats[type] && formats[type][name];
533
- if (format) {
534
- return format;
535
- }
534
+ var format = formats && formats[type] && formats[type][name];
535
+ if (format) {
536
+ return format;
537
+ }
536
538
 
537
- if (process.env.NODE_ENV !== 'production') {
538
- console.error('[React Intl] No ' + type + ' format named: ' + name);
539
- }
539
+ if (process.env.NODE_ENV !== 'production') {
540
+ console.error('[React Intl] No ' + type + ' format named: ' + name);
541
+ }
540
542
  }
541
543
 
542
544
  function formatDate(config, state, value) {
543
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
544
- var locale = config.locale,
545
- formats = config.formats;
546
- var format = options.format;
545
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
546
+ var locale = config.locale,
547
+ formats = config.formats;
548
+ var format = options.format;
547
549
 
548
550
 
549
- var date = new Date(value);
550
- var defaults$$1 = format && getNamedFormat(formats, 'date', format);
551
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
551
+ var date = new Date(value);
552
+ var defaults$$1 = format && getNamedFormat(formats, 'date', format);
553
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
552
554
 
553
- try {
554
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
555
- } catch (e) {
556
- if (process.env.NODE_ENV !== 'production') {
557
- console.error('[React Intl] Error formatting date.\n' + e);
558
- }
555
+ try {
556
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
557
+ } catch (e) {
558
+ if (process.env.NODE_ENV !== 'production') {
559
+ console.error('[React Intl] Error formatting date.\n' + e);
559
560
  }
561
+ }
560
562
 
561
- return String(date);
563
+ return String(date);
562
564
  }
563
565
 
564
566
  function formatTime(config, state, value) {
565
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
566
- var locale = config.locale,
567
- formats = config.formats;
568
- var format = options.format;
567
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
568
+ var locale = config.locale,
569
+ formats = config.formats;
570
+ var format = options.format;
569
571
 
570
572
 
571
- var date = new Date(value);
572
- var defaults$$1 = format && getNamedFormat(formats, 'time', format);
573
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
573
+ var date = new Date(value);
574
+ var defaults$$1 = format && getNamedFormat(formats, 'time', format);
575
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
574
576
 
575
- if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
576
- // Add default formatting options if hour, minute, or second isn't defined.
577
- filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
578
- }
577
+ if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
578
+ // Add default formatting options if hour, minute, or second isn't defined.
579
+ filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
580
+ }
579
581
 
580
- try {
581
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
582
- } catch (e) {
583
- if (process.env.NODE_ENV !== 'production') {
584
- console.error('[React Intl] Error formatting time.\n' + e);
585
- }
582
+ try {
583
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
584
+ } catch (e) {
585
+ if (process.env.NODE_ENV !== 'production') {
586
+ console.error('[React Intl] Error formatting time.\n' + e);
586
587
  }
588
+ }
587
589
 
588
- return String(date);
590
+ return String(date);
589
591
  }
590
592
 
591
593
  function formatRelative(config, state, value) {
592
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
593
- var locale = config.locale,
594
- formats = config.formats;
595
- var format = options.format;
594
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
595
+ var locale = config.locale,
596
+ formats = config.formats;
597
+ var format = options.format;
596
598
 
597
599
 
598
- var date = new Date(value);
599
- var now = new Date(options.now);
600
- var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
601
- var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
600
+ var date = new Date(value);
601
+ var now = new Date(options.now);
602
+ var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
603
+ var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
602
604
 
603
- // Capture the current threshold values, then temporarily override them with
604
- // specific values just for this render.
605
- var oldThresholds = _extends({}, IntlRelativeFormat.thresholds);
606
- updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
605
+ // Capture the current threshold values, then temporarily override them with
606
+ // specific values just for this render.
607
+ var oldThresholds = _extends({}, IntlRelativeFormat.thresholds);
608
+ updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
607
609
 
608
- try {
609
- return state.getRelativeFormat(locale, filteredOptions).format(date, {
610
- now: isFinite(now) ? now : state.now()
611
- });
612
- } catch (e) {
613
- if (process.env.NODE_ENV !== 'production') {
614
- console.error('[React Intl] Error formatting relative time.\n' + e);
615
- }
616
- } finally {
617
- updateRelativeFormatThresholds(oldThresholds);
610
+ try {
611
+ return state.getRelativeFormat(locale, filteredOptions).format(date, {
612
+ now: isFinite(now) ? now : state.now()
613
+ });
614
+ } catch (e) {
615
+ if (process.env.NODE_ENV !== 'production') {
616
+ console.error('[React Intl] Error formatting relative time.\n' + e);
618
617
  }
618
+ } finally {
619
+ updateRelativeFormatThresholds(oldThresholds);
620
+ }
619
621
 
620
- return String(date);
622
+ return String(date);
621
623
  }
622
624
 
623
625
  function formatNumber(config, state, value) {
624
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
625
- var locale = config.locale,
626
- formats = config.formats;
627
- var format = options.format;
626
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
627
+ var locale = config.locale,
628
+ formats = config.formats;
629
+ var format = options.format;
628
630
 
629
631
 
630
- var defaults$$1 = format && getNamedFormat(formats, 'number', format);
631
- var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
632
+ var defaults$$1 = format && getNamedFormat(formats, 'number', format);
633
+ var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
632
634
 
633
- try {
634
- return state.getNumberFormat(locale, filteredOptions).format(value);
635
- } catch (e) {
636
- if (process.env.NODE_ENV !== 'production') {
637
- console.error('[React Intl] Error formatting number.\n' + e);
638
- }
635
+ try {
636
+ return state.getNumberFormat(locale, filteredOptions).format(value);
637
+ } catch (e) {
638
+ if (process.env.NODE_ENV !== 'production') {
639
+ console.error('[React Intl] Error formatting number.\n' + e);
639
640
  }
641
+ }
640
642
 
641
- return String(value);
643
+ return String(value);
642
644
  }
643
645
 
644
646
  function formatPlural(config, state, value) {
645
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
646
- var locale = config.locale;
647
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
648
+ var locale = config.locale;
647
649
 
648
650
 
649
- var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
651
+ var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
650
652
 
651
- try {
652
- return state.getPluralFormat(locale, filteredOptions).format(value);
653
- } catch (e) {
654
- if (process.env.NODE_ENV !== 'production') {
655
- console.error('[React Intl] Error formatting plural.\n' + e);
656
- }
653
+ try {
654
+ return state.getPluralFormat(locale, filteredOptions).format(value);
655
+ } catch (e) {
656
+ if (process.env.NODE_ENV !== 'production') {
657
+ console.error('[React Intl] Error formatting plural.\n' + e);
657
658
  }
659
+ }
658
660
 
659
- return 'other';
661
+ return 'other';
660
662
  }
661
663
 
662
664
  function formatMessage(config, state) {
663
- var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
664
- var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
665
- var locale = config.locale,
666
- formats = config.formats,
667
- messages = config.messages,
668
- defaultLocale = config.defaultLocale,
669
- defaultFormats = config.defaultFormats;
670
- var id = messageDescriptor.id,
671
- defaultMessage = messageDescriptor.defaultMessage;
672
-
673
- // `id` is a required field of a Message Descriptor.
674
-
675
- invariant(id, '[React Intl] An `id` must be provided to format a message.');
676
-
677
- var message = messages && messages[id];
678
- var hasValues = Object.keys(values).length > 0;
679
-
680
- // Avoid expensive message formatting for simple messages without values. In
681
- // development messages will always be formatted in case of missing values.
682
- if (!hasValues && process.env.NODE_ENV === 'production') {
683
- return message || defaultMessage || id;
684
- }
685
-
686
- var formattedMessage = void 0;
665
+ var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
666
+ var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
667
+ var locale = config.locale,
668
+ formats = config.formats,
669
+ messages = config.messages,
670
+ defaultLocale = config.defaultLocale,
671
+ defaultFormats = config.defaultFormats;
672
+ var id = messageDescriptor.id,
673
+ defaultMessage = messageDescriptor.defaultMessage;
674
+
675
+ // `id` is a required field of a Message Descriptor.
676
+
677
+ invariant(id, '[React Intl] An `id` must be provided to format a message.');
678
+
679
+ var message = messages && messages[id];
680
+ var hasValues = Object.keys(values).length > 0;
681
+
682
+ // Avoid expensive message formatting for simple messages without values. In
683
+ // development messages will always be formatted in case of missing values.
684
+ if (!hasValues && process.env.NODE_ENV === 'production') {
685
+ return message || defaultMessage || id;
686
+ }
687
687
 
688
- if (message) {
689
- try {
690
- var formatter = state.getMessageFormat(message, locale, formats);
688
+ var formattedMessage = void 0;
691
689
 
692
- formattedMessage = formatter.format(values);
693
- } catch (e) {
694
- if (process.env.NODE_ENV !== 'production') {
695
- console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
696
- }
697
- }
698
- } else {
699
- if (process.env.NODE_ENV !== 'production') {
700
- // This prevents warnings from littering the console in development
701
- // when no `messages` are passed into the <IntlProvider> for the
702
- // default locale, and a default message is in the source.
703
- if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
690
+ if (message) {
691
+ try {
692
+ var formatter = state.getMessageFormat(message, locale, formats);
704
693
 
705
- console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
706
- }
707
- }
694
+ formattedMessage = formatter.format(values);
695
+ } catch (e) {
696
+ if (process.env.NODE_ENV !== 'production') {
697
+ console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
698
+ }
708
699
  }
700
+ } else {
701
+ if (process.env.NODE_ENV !== 'production') {
702
+ // This prevents warnings from littering the console in development
703
+ // when no `messages` are passed into the <IntlProvider> for the
704
+ // default locale, and a default message is in the source.
705
+ if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
706
+ console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
707
+ }
708
+ }
709
+ }
709
710
 
710
- if (!formattedMessage && defaultMessage) {
711
- try {
712
- var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
711
+ if (!formattedMessage && defaultMessage) {
712
+ try {
713
+ var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
713
714
 
714
- formattedMessage = _formatter.format(values);
715
- } catch (e) {
716
- if (process.env.NODE_ENV !== 'production') {
717
- console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
718
- }
719
- }
715
+ formattedMessage = _formatter.format(values);
716
+ } catch (e) {
717
+ if (process.env.NODE_ENV !== 'production') {
718
+ console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
719
+ }
720
720
  }
721
+ }
721
722
 
722
- if (!formattedMessage) {
723
- if (process.env.NODE_ENV !== 'production') {
724
- console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
725
- }
723
+ if (!formattedMessage) {
724
+ if (process.env.NODE_ENV !== 'production') {
725
+ console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
726
726
  }
727
+ }
727
728
 
728
- return formattedMessage || message || defaultMessage || id;
729
+ return formattedMessage || message || defaultMessage || id;
729
730
  }
730
731
 
731
732
  function formatHTMLMessage(config, state, messageDescriptor) {
732
- var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
733
-
734
- // Process all the values before they are used when formatting the ICU
735
- // Message string. Since the formatted message might be injected via
736
- // `innerHTML`, all String-based values need to be HTML-escaped.
737
- var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
738
- var value = rawValues[name];
739
- escaped[name] = typeof value === 'string' ? escape(value) : value;
740
- return escaped;
741
- }, {});
742
-
743
- return formatMessage(config, state, messageDescriptor, escapedValues);
733
+ var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
734
+
735
+ // Process all the values before they are used when formatting the ICU
736
+ // Message string. Since the formatted message might be injected via
737
+ // `innerHTML`, all String-based values need to be HTML-escaped.
738
+ var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
739
+ var value = rawValues[name];
740
+ escaped[name] = typeof value === 'string' ? escape(value) : value;
741
+ return escaped;
742
+ }, {});
743
+
744
+ return formatMessage(config, state, messageDescriptor, escapedValues);
744
745
  }
745
746
 
746
747
 
@@ -767,170 +768,170 @@ var intlFormatPropNames = Object.keys(intlFormatPropTypes);
767
768
  // These are not a static property on the `IntlProvider` class so the intl
768
769
  // config values can be inherited from an <IntlProvider> ancestor.
769
770
  var defaultProps = {
770
- formats: {},
771
- messages: {},
772
- textComponent: 'span',
771
+ formats: {},
772
+ messages: {},
773
+ textComponent: 'span',
773
774
 
774
- defaultLocale: 'en',
775
- defaultFormats: {}
775
+ defaultLocale: 'en',
776
+ defaultFormats: {}
776
777
  };
777
778
 
778
779
  var IntlProvider = function (_Component) {
779
- inherits(IntlProvider, _Component);
780
-
781
- function IntlProvider(props) {
782
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
783
- classCallCheck(this, IntlProvider);
780
+ inherits(IntlProvider, _Component);
784
781
 
785
- var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
782
+ function IntlProvider(props) {
783
+ var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
784
+ classCallCheck(this, IntlProvider);
786
785
 
787
- invariant(typeof Intl !== 'undefined', '[React Intl] The `Intl` APIs must be available in the runtime, ' + 'and do not appear to be built-in. An `Intl` polyfill should be loaded.\n' + 'See: http://formatjs.io/guides/runtime-environments/');
786
+ var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
788
787
 
789
- var intlContext = context.intl;
788
+ invariant(typeof Intl !== 'undefined', '[React Intl] The `Intl` APIs must be available in the runtime, ' + 'and do not appear to be built-in. An `Intl` polyfill should be loaded.\n' + 'See: http://formatjs.io/guides/runtime-environments/');
790
789
 
791
- // Used to stabilize time when performing an initial rendering so that
792
- // all relative times use the same reference "now" time.
790
+ var intlContext = context.intl;
793
791
 
794
- var initialNow = void 0;
795
- if (isFinite(props.initialNow)) {
796
- initialNow = Number(props.initialNow);
797
- } else {
798
- // When an `initialNow` isn't provided via `props`, look to see an
799
- // <IntlProvider> exists in the ancestry and call its `now()`
800
- // function to propagate its value for "now".
801
- initialNow = intlContext ? intlContext.now() : Date.now();
802
- }
792
+ // Used to stabilize time when performing an initial rendering so that
793
+ // all relative times use the same reference "now" time.
803
794
 
804
- // Creating `Intl*` formatters is expensive. If there's a parent
805
- // `<IntlProvider>`, then its formatters will be used. Otherwise, this
806
- // memoize the `Intl*` constructors and cache them for the lifecycle of
807
- // this IntlProvider instance.
808
-
809
- var _ref = intlContext || {},
810
- _ref$formatters = _ref.formatters,
811
- formatters = _ref$formatters === undefined ? {
812
- getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
813
- getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
814
- getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
815
- getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
816
- getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
817
- } : _ref$formatters;
818
-
819
- _this.state = _extends({}, formatters, {
820
-
821
- // Wrapper to provide stable "now" time for initial render.
822
- now: function now() {
823
- return _this._didDisplay ? Date.now() : initialNow;
824
- }
825
- });
826
- return _this;
795
+ var initialNow = void 0;
796
+ if (isFinite(props.initialNow)) {
797
+ initialNow = Number(props.initialNow);
798
+ } else {
799
+ // When an `initialNow` isn't provided via `props`, look to see an
800
+ // <IntlProvider> exists in the ancestry and call its `now()`
801
+ // function to propagate its value for "now".
802
+ initialNow = intlContext ? intlContext.now() : Date.now();
827
803
  }
828
804
 
829
- createClass(IntlProvider, [{
830
- key: 'getConfig',
831
- value: function getConfig() {
832
- var intlContext = this.context.intl;
833
-
834
- // Build a whitelisted config object from `props`, defaults, and
835
- // `context.intl`, if an <IntlProvider> exists in the ancestry.
836
-
837
- var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
838
-
839
- // Apply default props. This must be applied last after the props have
840
- // been resolved and inherited from any <IntlProvider> in the ancestry.
841
- // This matches how React resolves `defaultProps`.
842
- for (var propName in defaultProps) {
843
- if (config[propName] === undefined) {
844
- config[propName] = defaultProps[propName];
845
- }
846
- }
847
-
848
- if (!hasLocaleData(config.locale)) {
849
- var _config = config,
850
- locale = _config.locale,
851
- defaultLocale = _config.defaultLocale,
852
- defaultFormats = _config.defaultFormats;
853
-
854
-
855
- if (process.env.NODE_ENV !== 'production') {
856
- console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
857
- }
858
-
859
- // Since there's no registered locale data for `locale`, this will
860
- // fallback to the `defaultLocale` to make sure things can render.
861
- // The `messages` are overridden to the `defaultProps` empty object
862
- // to maintain referential equality across re-renders. It's assumed
863
- // each <FormattedMessage> contains a `defaultMessage` prop.
864
- config = _extends({}, config, {
865
- locale: defaultLocale,
866
- formats: defaultFormats,
867
- messages: defaultProps.messages
868
- });
869
- }
870
-
871
- return config;
872
- }
873
- }, {
874
- key: 'getBoundFormatFns',
875
- value: function getBoundFormatFns(config, state) {
876
- return intlFormatPropNames.reduce(function (boundFormatFns, name) {
877
- boundFormatFns[name] = format[name].bind(null, config, state);
878
- return boundFormatFns;
879
- }, {});
880
- }
881
- }, {
882
- key: 'getChildContext',
883
- value: function getChildContext() {
884
- var config = this.getConfig();
805
+ // Creating `Intl*` formatters is expensive. If there's a parent
806
+ // `<IntlProvider>`, then its formatters will be used. Otherwise, this
807
+ // memoize the `Intl*` constructors and cache them for the lifecycle of
808
+ // this IntlProvider instance.
809
+
810
+ var _ref = intlContext || {},
811
+ _ref$formatters = _ref.formatters,
812
+ formatters = _ref$formatters === undefined ? {
813
+ getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
814
+ getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
815
+ getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
816
+ getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
817
+ getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
818
+ } : _ref$formatters;
819
+
820
+ _this.state = _extends({}, formatters, {
821
+
822
+ // Wrapper to provide stable "now" time for initial render.
823
+ now: function now() {
824
+ return _this._didDisplay ? Date.now() : initialNow;
825
+ }
826
+ });
827
+ return _this;
828
+ }
885
829
 
886
- // Bind intl factories and current config to the format functions.
887
- var boundFormatFns = this.getBoundFormatFns(config, this.state);
830
+ createClass(IntlProvider, [{
831
+ key: 'getConfig',
832
+ value: function getConfig() {
833
+ var intlContext = this.context.intl;
888
834
 
889
- var _state = this.state,
890
- now = _state.now,
891
- formatters = objectWithoutProperties(_state, ['now']);
835
+ // Build a whitelisted config object from `props`, defaults, and
836
+ // `context.intl`, if an <IntlProvider> exists in the ancestry.
892
837
 
838
+ var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
893
839
 
894
- return {
895
- intl: _extends({}, config, boundFormatFns, {
896
- formatters: formatters,
897
- now: now
898
- })
899
- };
840
+ // Apply default props. This must be applied last after the props have
841
+ // been resolved and inherited from any <IntlProvider> in the ancestry.
842
+ // This matches how React resolves `defaultProps`.
843
+ for (var propName in defaultProps) {
844
+ if (config[propName] === undefined) {
845
+ config[propName] = defaultProps[propName];
900
846
  }
901
- }, {
902
- key: 'shouldComponentUpdate',
903
- value: function shouldComponentUpdate() {
904
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
905
- next[_key] = arguments[_key];
906
- }
847
+ }
907
848
 
908
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
909
- }
910
- }, {
911
- key: 'componentDidMount',
912
- value: function componentDidMount() {
913
- this._didDisplay = true;
914
- }
915
- }, {
916
- key: 'render',
917
- value: function render() {
918
- return React.Children.only(this.props.children);
849
+ if (!hasLocaleData(config.locale)) {
850
+ var _config = config,
851
+ locale = _config.locale,
852
+ defaultLocale = _config.defaultLocale,
853
+ defaultFormats = _config.defaultFormats;
854
+
855
+
856
+ if (process.env.NODE_ENV !== 'production') {
857
+ console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
919
858
  }
920
- }]);
921
- return IntlProvider;
859
+
860
+ // Since there's no registered locale data for `locale`, this will
861
+ // fallback to the `defaultLocale` to make sure things can render.
862
+ // The `messages` are overridden to the `defaultProps` empty object
863
+ // to maintain referential equality across re-renders. It's assumed
864
+ // each <FormattedMessage> contains a `defaultMessage` prop.
865
+ config = _extends({}, config, {
866
+ locale: defaultLocale,
867
+ formats: defaultFormats,
868
+ messages: defaultProps.messages
869
+ });
870
+ }
871
+
872
+ return config;
873
+ }
874
+ }, {
875
+ key: 'getBoundFormatFns',
876
+ value: function getBoundFormatFns(config, state) {
877
+ return intlFormatPropNames.reduce(function (boundFormatFns, name) {
878
+ boundFormatFns[name] = format[name].bind(null, config, state);
879
+ return boundFormatFns;
880
+ }, {});
881
+ }
882
+ }, {
883
+ key: 'getChildContext',
884
+ value: function getChildContext() {
885
+ var config = this.getConfig();
886
+
887
+ // Bind intl factories and current config to the format functions.
888
+ var boundFormatFns = this.getBoundFormatFns(config, this.state);
889
+
890
+ var _state = this.state,
891
+ now = _state.now,
892
+ formatters = objectWithoutProperties(_state, ['now']);
893
+
894
+
895
+ return {
896
+ intl: _extends({}, config, boundFormatFns, {
897
+ formatters: formatters,
898
+ now: now
899
+ })
900
+ };
901
+ }
902
+ }, {
903
+ key: 'shouldComponentUpdate',
904
+ value: function shouldComponentUpdate() {
905
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
906
+ next[_key] = arguments[_key];
907
+ }
908
+
909
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
910
+ }
911
+ }, {
912
+ key: 'componentDidMount',
913
+ value: function componentDidMount() {
914
+ this._didDisplay = true;
915
+ }
916
+ }, {
917
+ key: 'render',
918
+ value: function render() {
919
+ return React.Children.only(this.props.children);
920
+ }
921
+ }]);
922
+ return IntlProvider;
922
923
  }(React.Component);
923
924
 
924
925
  IntlProvider.displayName = 'IntlProvider';
925
926
  IntlProvider.contextTypes = {
926
- intl: intlShape
927
+ intl: intlShape
927
928
  };
928
929
  IntlProvider.childContextTypes = {
929
- intl: intlShape.isRequired
930
+ intl: intlShape.isRequired
930
931
  };
931
932
  process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
932
- children: PropTypes.element.isRequired,
933
- initialNow: PropTypes.any
933
+ children: PropTypes.element.isRequired,
934
+ initialNow: PropTypes.any
934
935
  }) : void 0;
935
936
 
936
937
  /*
@@ -940,61 +941,61 @@ process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, in
940
941
  */
941
942
 
942
943
  var FormattedDate = function (_Component) {
943
- inherits(FormattedDate, _Component);
944
+ inherits(FormattedDate, _Component);
945
+
946
+ function FormattedDate(props, context) {
947
+ classCallCheck(this, FormattedDate);
944
948
 
945
- function FormattedDate(props, context) {
946
- classCallCheck(this, FormattedDate);
949
+ var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
947
950
 
948
- var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
951
+ invariantIntlContext(context);
952
+ return _this;
953
+ }
949
954
 
950
- invariantIntlContext(context);
951
- return _this;
955
+ createClass(FormattedDate, [{
956
+ key: 'shouldComponentUpdate',
957
+ value: function shouldComponentUpdate() {
958
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
959
+ next[_key] = arguments[_key];
960
+ }
961
+
962
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
952
963
  }
964
+ }, {
965
+ key: 'render',
966
+ value: function render() {
967
+ var _context$intl = this.context.intl,
968
+ formatDate = _context$intl.formatDate,
969
+ Text = _context$intl.textComponent;
970
+ var _props = this.props,
971
+ value = _props.value,
972
+ children = _props.children;
953
973
 
954
- createClass(FormattedDate, [{
955
- key: 'shouldComponentUpdate',
956
- value: function shouldComponentUpdate() {
957
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
958
- next[_key] = arguments[_key];
959
- }
960
974
 
961
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
962
- }
963
- }, {
964
- key: 'render',
965
- value: function render() {
966
- var _context$intl = this.context.intl,
967
- formatDate = _context$intl.formatDate,
968
- Text = _context$intl.textComponent;
969
- var _props = this.props,
970
- value = _props.value,
971
- children = _props.children;
972
-
973
-
974
- var formattedDate = formatDate(value, this.props);
975
-
976
- if (typeof children === 'function') {
977
- return children(formattedDate);
978
- }
979
-
980
- return React__default.createElement(
981
- Text,
982
- null,
983
- formattedDate
984
- );
985
- }
986
- }]);
987
- return FormattedDate;
975
+ var formattedDate = formatDate(value, this.props);
976
+
977
+ if (typeof children === 'function') {
978
+ return children(formattedDate);
979
+ }
980
+
981
+ return React__default.createElement(
982
+ Text,
983
+ null,
984
+ formattedDate
985
+ );
986
+ }
987
+ }]);
988
+ return FormattedDate;
988
989
  }(React.Component);
989
990
 
990
991
  FormattedDate.displayName = 'FormattedDate';
991
992
  FormattedDate.contextTypes = {
992
- intl: intlShape
993
+ intl: intlShape
993
994
  };
994
995
  process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
995
- value: PropTypes.any.isRequired,
996
- format: PropTypes.string,
997
- children: PropTypes.func
996
+ value: PropTypes.any.isRequired,
997
+ format: PropTypes.string,
998
+ children: PropTypes.func
998
999
  }) : void 0;
999
1000
 
1000
1001
  /*
@@ -1004,61 +1005,61 @@ process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, d
1004
1005
  */
1005
1006
 
1006
1007
  var FormattedTime = function (_Component) {
1007
- inherits(FormattedTime, _Component);
1008
+ inherits(FormattedTime, _Component);
1008
1009
 
1009
- function FormattedTime(props, context) {
1010
- classCallCheck(this, FormattedTime);
1010
+ function FormattedTime(props, context) {
1011
+ classCallCheck(this, FormattedTime);
1011
1012
 
1012
- var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1013
+ var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1013
1014
 
1014
- invariantIntlContext(context);
1015
- return _this;
1015
+ invariantIntlContext(context);
1016
+ return _this;
1017
+ }
1018
+
1019
+ createClass(FormattedTime, [{
1020
+ key: 'shouldComponentUpdate',
1021
+ value: function shouldComponentUpdate() {
1022
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1023
+ next[_key] = arguments[_key];
1024
+ }
1025
+
1026
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1016
1027
  }
1028
+ }, {
1029
+ key: 'render',
1030
+ value: function render() {
1031
+ var _context$intl = this.context.intl,
1032
+ formatTime = _context$intl.formatTime,
1033
+ Text = _context$intl.textComponent;
1034
+ var _props = this.props,
1035
+ value = _props.value,
1036
+ children = _props.children;
1017
1037
 
1018
- createClass(FormattedTime, [{
1019
- key: 'shouldComponentUpdate',
1020
- value: function shouldComponentUpdate() {
1021
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1022
- next[_key] = arguments[_key];
1023
- }
1024
1038
 
1025
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1026
- }
1027
- }, {
1028
- key: 'render',
1029
- value: function render() {
1030
- var _context$intl = this.context.intl,
1031
- formatTime = _context$intl.formatTime,
1032
- Text = _context$intl.textComponent;
1033
- var _props = this.props,
1034
- value = _props.value,
1035
- children = _props.children;
1036
-
1037
-
1038
- var formattedTime = formatTime(value, this.props);
1039
-
1040
- if (typeof children === 'function') {
1041
- return children(formattedTime);
1042
- }
1043
-
1044
- return React__default.createElement(
1045
- Text,
1046
- null,
1047
- formattedTime
1048
- );
1049
- }
1050
- }]);
1051
- return FormattedTime;
1039
+ var formattedTime = formatTime(value, this.props);
1040
+
1041
+ if (typeof children === 'function') {
1042
+ return children(formattedTime);
1043
+ }
1044
+
1045
+ return React__default.createElement(
1046
+ Text,
1047
+ null,
1048
+ formattedTime
1049
+ );
1050
+ }
1051
+ }]);
1052
+ return FormattedTime;
1052
1053
  }(React.Component);
1053
1054
 
1054
1055
  FormattedTime.displayName = 'FormattedTime';
1055
1056
  FormattedTime.contextTypes = {
1056
- intl: intlShape
1057
+ intl: intlShape
1057
1058
  };
1058
1059
  process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
1059
- value: PropTypes.any.isRequired,
1060
- format: PropTypes.string,
1061
- children: PropTypes.func
1060
+ value: PropTypes.any.isRequired,
1061
+ format: PropTypes.string,
1062
+ children: PropTypes.func
1062
1063
  }) : void 0;
1063
1064
 
1064
1065
  /*
@@ -1077,179 +1078,179 @@ var DAY = 1000 * 60 * 60 * 24;
1077
1078
  var MAX_TIMER_DELAY = 2147483647;
1078
1079
 
1079
1080
  function selectUnits(delta) {
1080
- var absDelta = Math.abs(delta);
1081
+ var absDelta = Math.abs(delta);
1081
1082
 
1082
- if (absDelta < MINUTE) {
1083
- return 'second';
1084
- }
1083
+ if (absDelta < MINUTE) {
1084
+ return 'second';
1085
+ }
1085
1086
 
1086
- if (absDelta < HOUR) {
1087
- return 'minute';
1088
- }
1087
+ if (absDelta < HOUR) {
1088
+ return 'minute';
1089
+ }
1089
1090
 
1090
- if (absDelta < DAY) {
1091
- return 'hour';
1092
- }
1091
+ if (absDelta < DAY) {
1092
+ return 'hour';
1093
+ }
1093
1094
 
1094
- // The maximum scheduled delay will be measured in days since the maximum
1095
- // timer delay is less than the number of milliseconds in 25 days.
1096
- return 'day';
1095
+ // The maximum scheduled delay will be measured in days since the maximum
1096
+ // timer delay is less than the number of milliseconds in 25 days.
1097
+ return 'day';
1097
1098
  }
1098
1099
 
1099
1100
  function getUnitDelay(units) {
1100
- switch (units) {
1101
- case 'second':
1102
- return SECOND;
1103
- case 'minute':
1104
- return MINUTE;
1105
- case 'hour':
1106
- return HOUR;
1107
- case 'day':
1108
- return DAY;
1109
- default:
1110
- return MAX_TIMER_DELAY;
1111
- }
1101
+ switch (units) {
1102
+ case 'second':
1103
+ return SECOND;
1104
+ case 'minute':
1105
+ return MINUTE;
1106
+ case 'hour':
1107
+ return HOUR;
1108
+ case 'day':
1109
+ return DAY;
1110
+ default:
1111
+ return MAX_TIMER_DELAY;
1112
+ }
1112
1113
  }
1113
1114
 
1114
1115
  function isSameDate(a, b) {
1115
- if (a === b) {
1116
- return true;
1117
- }
1116
+ if (a === b) {
1117
+ return true;
1118
+ }
1118
1119
 
1119
- var aTime = new Date(a).getTime();
1120
- var bTime = new Date(b).getTime();
1120
+ var aTime = new Date(a).getTime();
1121
+ var bTime = new Date(b).getTime();
1121
1122
 
1122
- return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1123
+ return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1123
1124
  }
1124
1125
 
1125
1126
  var FormattedRelative = function (_Component) {
1126
- inherits(FormattedRelative, _Component);
1127
+ inherits(FormattedRelative, _Component);
1127
1128
 
1128
- function FormattedRelative(props, context) {
1129
- classCallCheck(this, FormattedRelative);
1129
+ function FormattedRelative(props, context) {
1130
+ classCallCheck(this, FormattedRelative);
1130
1131
 
1131
- var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1132
+ var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1132
1133
 
1133
- invariantIntlContext(context);
1134
+ invariantIntlContext(context);
1134
1135
 
1135
- var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1136
+ var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1136
1137
 
1137
- // `now` is stored as state so that `render()` remains a function of
1138
- // props + state, instead of accessing `Date.now()` inside `render()`.
1139
- _this.state = { now: now };
1140
- return _this;
1141
- }
1138
+ // `now` is stored as state so that `render()` remains a function of
1139
+ // props + state, instead of accessing `Date.now()` inside `render()`.
1140
+ _this.state = { now: now };
1141
+ return _this;
1142
+ }
1142
1143
 
1143
- createClass(FormattedRelative, [{
1144
- key: 'scheduleNextUpdate',
1145
- value: function scheduleNextUpdate(props, state) {
1146
- var _this2 = this;
1144
+ createClass(FormattedRelative, [{
1145
+ key: 'scheduleNextUpdate',
1146
+ value: function scheduleNextUpdate(props, state) {
1147
+ var _this2 = this;
1147
1148
 
1148
- // Cancel and pending update because we're scheduling a new update.
1149
- clearTimeout(this._timer);
1149
+ // Cancel and pending update because we're scheduling a new update.
1150
+ clearTimeout(this._timer);
1150
1151
 
1151
- var value = props.value,
1152
- units = props.units,
1153
- updateInterval = props.updateInterval;
1152
+ var value = props.value,
1153
+ units = props.units,
1154
+ updateInterval = props.updateInterval;
1154
1155
 
1155
- var time = new Date(value).getTime();
1156
+ var time = new Date(value).getTime();
1156
1157
 
1157
- // If the `updateInterval` is falsy, including `0` or we don't have a
1158
- // valid date, then auto updates have been turned off, so we bail and
1159
- // skip scheduling an update.
1160
- if (!updateInterval || !isFinite(time)) {
1161
- return;
1162
- }
1158
+ // If the `updateInterval` is falsy, including `0` or we don't have a
1159
+ // valid date, then auto updates have been turned off, so we bail and
1160
+ // skip scheduling an update.
1161
+ if (!updateInterval || !isFinite(time)) {
1162
+ return;
1163
+ }
1163
1164
 
1164
- var delta = time - state.now;
1165
- var unitDelay = getUnitDelay(units || selectUnits(delta));
1166
- var unitRemainder = Math.abs(delta % unitDelay);
1165
+ var delta = time - state.now;
1166
+ var unitDelay = getUnitDelay(units || selectUnits(delta));
1167
+ var unitRemainder = Math.abs(delta % unitDelay);
1167
1168
 
1168
- // We want the largest possible timer delay which will still display
1169
- // accurate information while reducing unnecessary re-renders. The delay
1170
- // should be until the next "interesting" moment, like a tick from
1171
- // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1172
- var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1169
+ // We want the largest possible timer delay which will still display
1170
+ // accurate information while reducing unnecessary re-renders. The delay
1171
+ // should be until the next "interesting" moment, like a tick from
1172
+ // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1173
+ var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1173
1174
 
1174
- this._timer = setTimeout(function () {
1175
- _this2.setState({ now: _this2.context.intl.now() });
1176
- }, delay);
1177
- }
1178
- }, {
1179
- key: 'componentDidMount',
1180
- value: function componentDidMount() {
1181
- this.scheduleNextUpdate(this.props, this.state);
1182
- }
1183
- }, {
1184
- key: 'componentWillReceiveProps',
1185
- value: function componentWillReceiveProps(_ref) {
1186
- var nextValue = _ref.value;
1187
-
1188
- // When the `props.value` date changes, `state.now` needs to be updated,
1189
- // and the next update can be rescheduled.
1190
- if (!isSameDate(nextValue, this.props.value)) {
1191
- this.setState({ now: this.context.intl.now() });
1192
- }
1193
- }
1194
- }, {
1195
- key: 'shouldComponentUpdate',
1196
- value: function shouldComponentUpdate() {
1197
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1198
- next[_key] = arguments[_key];
1199
- }
1175
+ this._timer = setTimeout(function () {
1176
+ _this2.setState({ now: _this2.context.intl.now() });
1177
+ }, delay);
1178
+ }
1179
+ }, {
1180
+ key: 'componentDidMount',
1181
+ value: function componentDidMount() {
1182
+ this.scheduleNextUpdate(this.props, this.state);
1183
+ }
1184
+ }, {
1185
+ key: 'componentWillReceiveProps',
1186
+ value: function componentWillReceiveProps(_ref) {
1187
+ var nextValue = _ref.value;
1188
+
1189
+ // When the `props.value` date changes, `state.now` needs to be updated,
1190
+ // and the next update can be rescheduled.
1191
+ if (!isSameDate(nextValue, this.props.value)) {
1192
+ this.setState({ now: this.context.intl.now() });
1193
+ }
1194
+ }
1195
+ }, {
1196
+ key: 'shouldComponentUpdate',
1197
+ value: function shouldComponentUpdate() {
1198
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1199
+ next[_key] = arguments[_key];
1200
+ }
1200
1201
 
1201
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1202
- }
1203
- }, {
1204
- key: 'componentWillUpdate',
1205
- value: function componentWillUpdate(nextProps, nextState) {
1206
- this.scheduleNextUpdate(nextProps, nextState);
1207
- }
1208
- }, {
1209
- key: 'componentWillUnmount',
1210
- value: function componentWillUnmount() {
1211
- clearTimeout(this._timer);
1212
- }
1213
- }, {
1214
- key: 'render',
1215
- value: function render() {
1216
- var _context$intl = this.context.intl,
1217
- formatRelative = _context$intl.formatRelative,
1218
- Text = _context$intl.textComponent;
1219
- var _props = this.props,
1220
- value = _props.value,
1221
- children = _props.children;
1222
-
1223
-
1224
- var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
1225
-
1226
- if (typeof children === 'function') {
1227
- return children(formattedRelative);
1228
- }
1229
-
1230
- return React__default.createElement(
1231
- Text,
1232
- null,
1233
- formattedRelative
1234
- );
1235
- }
1236
- }]);
1237
- return FormattedRelative;
1202
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1203
+ }
1204
+ }, {
1205
+ key: 'componentWillUpdate',
1206
+ value: function componentWillUpdate(nextProps, nextState) {
1207
+ this.scheduleNextUpdate(nextProps, nextState);
1208
+ }
1209
+ }, {
1210
+ key: 'componentWillUnmount',
1211
+ value: function componentWillUnmount() {
1212
+ clearTimeout(this._timer);
1213
+ }
1214
+ }, {
1215
+ key: 'render',
1216
+ value: function render() {
1217
+ var _context$intl = this.context.intl,
1218
+ formatRelative = _context$intl.formatRelative,
1219
+ Text = _context$intl.textComponent;
1220
+ var _props = this.props,
1221
+ value = _props.value,
1222
+ children = _props.children;
1223
+
1224
+
1225
+ var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
1226
+
1227
+ if (typeof children === 'function') {
1228
+ return children(formattedRelative);
1229
+ }
1230
+
1231
+ return React__default.createElement(
1232
+ Text,
1233
+ null,
1234
+ formattedRelative
1235
+ );
1236
+ }
1237
+ }]);
1238
+ return FormattedRelative;
1238
1239
  }(React.Component);
1239
1240
 
1240
1241
  FormattedRelative.displayName = 'FormattedRelative';
1241
1242
  FormattedRelative.contextTypes = {
1242
- intl: intlShape
1243
+ intl: intlShape
1243
1244
  };
1244
1245
  FormattedRelative.defaultProps = {
1245
- updateInterval: 1000 * 10
1246
+ updateInterval: 1000 * 10
1246
1247
  };
1247
1248
  process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
1248
- value: PropTypes.any.isRequired,
1249
- format: PropTypes.string,
1250
- updateInterval: PropTypes.number,
1251
- initialNow: PropTypes.any,
1252
- children: PropTypes.func
1249
+ value: PropTypes.any.isRequired,
1250
+ format: PropTypes.string,
1251
+ updateInterval: PropTypes.number,
1252
+ initialNow: PropTypes.any,
1253
+ children: PropTypes.func
1253
1254
  }) : void 0;
1254
1255
 
1255
1256
  /*
@@ -1259,61 +1260,61 @@ process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({
1259
1260
  */
1260
1261
 
1261
1262
  var FormattedNumber = function (_Component) {
1262
- inherits(FormattedNumber, _Component);
1263
+ inherits(FormattedNumber, _Component);
1263
1264
 
1264
- function FormattedNumber(props, context) {
1265
- classCallCheck(this, FormattedNumber);
1265
+ function FormattedNumber(props, context) {
1266
+ classCallCheck(this, FormattedNumber);
1266
1267
 
1267
- var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1268
+ var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1268
1269
 
1269
- invariantIntlContext(context);
1270
- return _this;
1270
+ invariantIntlContext(context);
1271
+ return _this;
1272
+ }
1273
+
1274
+ createClass(FormattedNumber, [{
1275
+ key: 'shouldComponentUpdate',
1276
+ value: function shouldComponentUpdate() {
1277
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1278
+ next[_key] = arguments[_key];
1279
+ }
1280
+
1281
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1271
1282
  }
1283
+ }, {
1284
+ key: 'render',
1285
+ value: function render() {
1286
+ var _context$intl = this.context.intl,
1287
+ formatNumber = _context$intl.formatNumber,
1288
+ Text = _context$intl.textComponent;
1289
+ var _props = this.props,
1290
+ value = _props.value,
1291
+ children = _props.children;
1272
1292
 
1273
- createClass(FormattedNumber, [{
1274
- key: 'shouldComponentUpdate',
1275
- value: function shouldComponentUpdate() {
1276
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1277
- next[_key] = arguments[_key];
1278
- }
1279
1293
 
1280
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1281
- }
1282
- }, {
1283
- key: 'render',
1284
- value: function render() {
1285
- var _context$intl = this.context.intl,
1286
- formatNumber = _context$intl.formatNumber,
1287
- Text = _context$intl.textComponent;
1288
- var _props = this.props,
1289
- value = _props.value,
1290
- children = _props.children;
1291
-
1292
-
1293
- var formattedNumber = formatNumber(value, this.props);
1294
-
1295
- if (typeof children === 'function') {
1296
- return children(formattedNumber);
1297
- }
1298
-
1299
- return React__default.createElement(
1300
- Text,
1301
- null,
1302
- formattedNumber
1303
- );
1304
- }
1305
- }]);
1306
- return FormattedNumber;
1294
+ var formattedNumber = formatNumber(value, this.props);
1295
+
1296
+ if (typeof children === 'function') {
1297
+ return children(formattedNumber);
1298
+ }
1299
+
1300
+ return React__default.createElement(
1301
+ Text,
1302
+ null,
1303
+ formattedNumber
1304
+ );
1305
+ }
1306
+ }]);
1307
+ return FormattedNumber;
1307
1308
  }(React.Component);
1308
1309
 
1309
1310
  FormattedNumber.displayName = 'FormattedNumber';
1310
1311
  FormattedNumber.contextTypes = {
1311
- intl: intlShape
1312
+ intl: intlShape
1312
1313
  };
1313
1314
  process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
1314
- value: PropTypes.any.isRequired,
1315
- format: PropTypes.string,
1316
- children: PropTypes.func
1315
+ value: PropTypes.any.isRequired,
1316
+ format: PropTypes.string,
1317
+ children: PropTypes.func
1317
1318
  }) : void 0;
1318
1319
 
1319
1320
  /*
@@ -1323,73 +1324,73 @@ process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({},
1323
1324
  */
1324
1325
 
1325
1326
  var FormattedPlural = function (_Component) {
1326
- inherits(FormattedPlural, _Component);
1327
+ inherits(FormattedPlural, _Component);
1327
1328
 
1328
- function FormattedPlural(props, context) {
1329
- classCallCheck(this, FormattedPlural);
1329
+ function FormattedPlural(props, context) {
1330
+ classCallCheck(this, FormattedPlural);
1330
1331
 
1331
- var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1332
+ var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1332
1333
 
1333
- invariantIntlContext(context);
1334
- return _this;
1335
- }
1334
+ invariantIntlContext(context);
1335
+ return _this;
1336
+ }
1336
1337
 
1337
- createClass(FormattedPlural, [{
1338
- key: 'shouldComponentUpdate',
1339
- value: function shouldComponentUpdate() {
1340
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1341
- next[_key] = arguments[_key];
1342
- }
1338
+ createClass(FormattedPlural, [{
1339
+ key: 'shouldComponentUpdate',
1340
+ value: function shouldComponentUpdate() {
1341
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1342
+ next[_key] = arguments[_key];
1343
+ }
1343
1344
 
1344
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1345
- }
1346
- }, {
1347
- key: 'render',
1348
- value: function render() {
1349
- var _context$intl = this.context.intl,
1350
- formatPlural = _context$intl.formatPlural,
1351
- Text = _context$intl.textComponent;
1352
- var _props = this.props,
1353
- value = _props.value,
1354
- other = _props.other,
1355
- children = _props.children;
1356
-
1357
-
1358
- var pluralCategory = formatPlural(value, this.props);
1359
- var formattedPlural = this.props[pluralCategory] || other;
1360
-
1361
- if (typeof children === 'function') {
1362
- return children(formattedPlural);
1363
- }
1364
-
1365
- return React__default.createElement(
1366
- Text,
1367
- null,
1368
- formattedPlural
1369
- );
1370
- }
1371
- }]);
1372
- return FormattedPlural;
1345
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1346
+ }
1347
+ }, {
1348
+ key: 'render',
1349
+ value: function render() {
1350
+ var _context$intl = this.context.intl,
1351
+ formatPlural = _context$intl.formatPlural,
1352
+ Text = _context$intl.textComponent;
1353
+ var _props = this.props,
1354
+ value = _props.value,
1355
+ other = _props.other,
1356
+ children = _props.children;
1357
+
1358
+
1359
+ var pluralCategory = formatPlural(value, this.props);
1360
+ var formattedPlural = this.props[pluralCategory] || other;
1361
+
1362
+ if (typeof children === 'function') {
1363
+ return children(formattedPlural);
1364
+ }
1365
+
1366
+ return React__default.createElement(
1367
+ Text,
1368
+ null,
1369
+ formattedPlural
1370
+ );
1371
+ }
1372
+ }]);
1373
+ return FormattedPlural;
1373
1374
  }(React.Component);
1374
1375
 
1375
1376
  FormattedPlural.displayName = 'FormattedPlural';
1376
1377
  FormattedPlural.contextTypes = {
1377
- intl: intlShape
1378
+ intl: intlShape
1378
1379
  };
1379
1380
  FormattedPlural.defaultProps = {
1380
- style: 'cardinal'
1381
+ style: 'cardinal'
1381
1382
  };
1382
1383
  process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
1383
- value: PropTypes.any.isRequired,
1384
+ value: PropTypes.any.isRequired,
1384
1385
 
1385
- other: PropTypes.node.isRequired,
1386
- zero: PropTypes.node,
1387
- one: PropTypes.node,
1388
- two: PropTypes.node,
1389
- few: PropTypes.node,
1390
- many: PropTypes.node,
1386
+ other: PropTypes.node.isRequired,
1387
+ zero: PropTypes.node,
1388
+ one: PropTypes.node,
1389
+ two: PropTypes.node,
1390
+ few: PropTypes.node,
1391
+ many: PropTypes.node,
1391
1392
 
1392
- children: PropTypes.func
1393
+ children: PropTypes.func
1393
1394
  }) : void 0;
1394
1395
 
1395
1396
  /*
@@ -1399,142 +1400,142 @@ process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({},
1399
1400
  */
1400
1401
 
1401
1402
  var FormattedMessage = function (_Component) {
1402
- inherits(FormattedMessage, _Component);
1403
+ inherits(FormattedMessage, _Component);
1403
1404
 
1404
- function FormattedMessage(props, context) {
1405
- classCallCheck(this, FormattedMessage);
1405
+ function FormattedMessage(props, context) {
1406
+ classCallCheck(this, FormattedMessage);
1406
1407
 
1407
- var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1408
+ var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1408
1409
 
1409
- invariantIntlContext(context);
1410
- return _this;
1411
- }
1410
+ invariantIntlContext(context);
1411
+ return _this;
1412
+ }
1412
1413
 
1413
- createClass(FormattedMessage, [{
1414
- key: 'shouldComponentUpdate',
1415
- value: function shouldComponentUpdate(nextProps) {
1416
- var values = this.props.values;
1417
- var nextValues = nextProps.values;
1414
+ createClass(FormattedMessage, [{
1415
+ key: 'shouldComponentUpdate',
1416
+ value: function shouldComponentUpdate(nextProps) {
1417
+ var values = this.props.values;
1418
+ var nextValues = nextProps.values;
1418
1419
 
1419
1420
 
1420
- if (!shallowEquals(nextValues, values)) {
1421
- return true;
1422
- }
1421
+ if (!shallowEquals(nextValues, values)) {
1422
+ return true;
1423
+ }
1423
1424
 
1424
- // Since `values` has already been checked, we know they're not
1425
- // different, so the current `values` are carried over so the shallow
1426
- // equals comparison on the other props isn't affected by the `values`.
1427
- var nextPropsToCheck = _extends({}, nextProps, {
1428
- values: values
1429
- });
1425
+ // Since `values` has already been checked, we know they're not
1426
+ // different, so the current `values` are carried over so the shallow
1427
+ // equals comparison on the other props isn't affected by the `values`.
1428
+ var nextPropsToCheck = _extends({}, nextProps, {
1429
+ values: values
1430
+ });
1430
1431
 
1431
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1432
- next[_key - 1] = arguments[_key];
1433
- }
1432
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1433
+ next[_key - 1] = arguments[_key];
1434
+ }
1434
1435
 
1435
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1436
- }
1437
- }, {
1438
- key: 'render',
1439
- value: function render() {
1440
- var _context$intl = this.context.intl,
1441
- formatMessage = _context$intl.formatMessage,
1442
- Text = _context$intl.textComponent;
1443
- var _props = this.props,
1444
- id = _props.id,
1445
- description = _props.description,
1446
- defaultMessage = _props.defaultMessage,
1447
- values = _props.values,
1448
- _props$tagName = _props.tagName,
1449
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1450
- children = _props.children;
1451
-
1452
-
1453
- var tokenDelimiter = void 0;
1454
- var tokenizedValues = void 0;
1455
- var elements = void 0;
1456
-
1457
- var hasValues = values && Object.keys(values).length > 0;
1458
- if (hasValues) {
1459
- // Creates a token with a random UID that should not be guessable or
1460
- // conflict with other parts of the `message` string.
1461
- var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1462
-
1463
- var generateToken = function () {
1464
- var counter = 0;
1465
- return function () {
1466
- return 'ELEMENT-' + uid + '-' + (counter += 1);
1467
- };
1468
- }();
1469
-
1470
- // Splitting with a delimiter to support IE8. When using a regex
1471
- // with a capture group IE8 does not include the capture group in
1472
- // the resulting array.
1473
- tokenDelimiter = '@__' + uid + '__@';
1474
- tokenizedValues = {};
1475
- elements = {};
1476
-
1477
- // Iterates over the `props` to keep track of any React Element
1478
- // values so they can be represented by the `token` as a placeholder
1479
- // when the `message` is formatted. This allows the formatted
1480
- // message to then be broken-up into parts with references to the
1481
- // React Elements inserted back in.
1482
- Object.keys(values).forEach(function (name) {
1483
- var value = values[name];
1484
-
1485
- if (React.isValidElement(value)) {
1486
- var token = generateToken();
1487
- tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1488
- elements[token] = value;
1489
- } else {
1490
- tokenizedValues[name] = value;
1491
- }
1492
- });
1493
- }
1494
-
1495
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1496
- var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1497
-
1498
- var nodes = void 0;
1499
-
1500
- var hasElements = elements && Object.keys(elements).length > 0;
1501
- if (hasElements) {
1502
- // Split the message into parts so the React Element values captured
1503
- // above can be inserted back into the rendered message. This
1504
- // approach allows messages to render with React Elements while
1505
- // keeping React's virtual diffing working properly.
1506
- nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1507
- return !!part;
1508
- }).map(function (part) {
1509
- return elements[part] || part;
1510
- });
1511
- } else {
1512
- nodes = [formattedMessage];
1513
- }
1514
-
1515
- if (typeof children === 'function') {
1516
- return children.apply(undefined, toConsumableArray(nodes));
1517
- }
1518
-
1519
- // Needs to use `createElement()` instead of JSX, otherwise React will
1520
- // warn about a missing `key` prop with rich-text message formatting.
1521
- return React.createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
1522
- }
1523
- }]);
1524
- return FormattedMessage;
1436
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1437
+ }
1438
+ }, {
1439
+ key: 'render',
1440
+ value: function render() {
1441
+ var _context$intl = this.context.intl,
1442
+ formatMessage = _context$intl.formatMessage,
1443
+ Text = _context$intl.textComponent;
1444
+ var _props = this.props,
1445
+ id = _props.id,
1446
+ description = _props.description,
1447
+ defaultMessage = _props.defaultMessage,
1448
+ values = _props.values,
1449
+ _props$tagName = _props.tagName,
1450
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1451
+ children = _props.children;
1452
+
1453
+
1454
+ var tokenDelimiter = void 0;
1455
+ var tokenizedValues = void 0;
1456
+ var elements = void 0;
1457
+
1458
+ var hasValues = values && Object.keys(values).length > 0;
1459
+ if (hasValues) {
1460
+ // Creates a token with a random UID that should not be guessable or
1461
+ // conflict with other parts of the `message` string.
1462
+ var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1463
+
1464
+ var generateToken = function () {
1465
+ var counter = 0;
1466
+ return function () {
1467
+ return 'ELEMENT-' + uid + '-' + (counter += 1);
1468
+ };
1469
+ }();
1470
+
1471
+ // Splitting with a delimiter to support IE8. When using a regex
1472
+ // with a capture group IE8 does not include the capture group in
1473
+ // the resulting array.
1474
+ tokenDelimiter = '@__' + uid + '__@';
1475
+ tokenizedValues = {};
1476
+ elements = {};
1477
+
1478
+ // Iterates over the `props` to keep track of any React Element
1479
+ // values so they can be represented by the `token` as a placeholder
1480
+ // when the `message` is formatted. This allows the formatted
1481
+ // message to then be broken-up into parts with references to the
1482
+ // React Elements inserted back in.
1483
+ Object.keys(values).forEach(function (name) {
1484
+ var value = values[name];
1485
+
1486
+ if (React.isValidElement(value)) {
1487
+ var token = generateToken();
1488
+ tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1489
+ elements[token] = value;
1490
+ } else {
1491
+ tokenizedValues[name] = value;
1492
+ }
1493
+ });
1494
+ }
1495
+
1496
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1497
+ var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1498
+
1499
+ var nodes = void 0;
1500
+
1501
+ var hasElements = elements && Object.keys(elements).length > 0;
1502
+ if (hasElements) {
1503
+ // Split the message into parts so the React Element values captured
1504
+ // above can be inserted back into the rendered message. This
1505
+ // approach allows messages to render with React Elements while
1506
+ // keeping React's virtual diffing working properly.
1507
+ nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1508
+ return !!part;
1509
+ }).map(function (part) {
1510
+ return elements[part] || part;
1511
+ });
1512
+ } else {
1513
+ nodes = [formattedMessage];
1514
+ }
1515
+
1516
+ if (typeof children === 'function') {
1517
+ return children.apply(undefined, toConsumableArray(nodes));
1518
+ }
1519
+
1520
+ // Needs to use `createElement()` instead of JSX, otherwise React will
1521
+ // warn about a missing `key` prop with rich-text message formatting.
1522
+ return React.createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
1523
+ }
1524
+ }]);
1525
+ return FormattedMessage;
1525
1526
  }(React.Component);
1526
1527
 
1527
1528
  FormattedMessage.displayName = 'FormattedMessage';
1528
1529
  FormattedMessage.contextTypes = {
1529
- intl: intlShape
1530
+ intl: intlShape
1530
1531
  };
1531
1532
  FormattedMessage.defaultProps = {
1532
- values: {}
1533
+ values: {}
1533
1534
  };
1534
1535
  process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1535
- values: PropTypes.object,
1536
- tagName: PropTypes.string,
1537
- children: PropTypes.func
1536
+ values: PropTypes.object,
1537
+ tagName: PropTypes.string,
1538
+ children: PropTypes.func
1538
1539
  }) : void 0;
1539
1540
 
1540
1541
  /*
@@ -1544,90 +1545,90 @@ process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}
1544
1545
  */
1545
1546
 
1546
1547
  var FormattedHTMLMessage = function (_Component) {
1547
- inherits(FormattedHTMLMessage, _Component);
1548
+ inherits(FormattedHTMLMessage, _Component);
1548
1549
 
1549
- function FormattedHTMLMessage(props, context) {
1550
- classCallCheck(this, FormattedHTMLMessage);
1550
+ function FormattedHTMLMessage(props, context) {
1551
+ classCallCheck(this, FormattedHTMLMessage);
1551
1552
 
1552
- var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1553
+ var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1553
1554
 
1554
- invariantIntlContext(context);
1555
- return _this;
1556
- }
1555
+ invariantIntlContext(context);
1556
+ return _this;
1557
+ }
1557
1558
 
1558
- createClass(FormattedHTMLMessage, [{
1559
- key: 'shouldComponentUpdate',
1560
- value: function shouldComponentUpdate(nextProps) {
1561
- var values = this.props.values;
1562
- var nextValues = nextProps.values;
1559
+ createClass(FormattedHTMLMessage, [{
1560
+ key: 'shouldComponentUpdate',
1561
+ value: function shouldComponentUpdate(nextProps) {
1562
+ var values = this.props.values;
1563
+ var nextValues = nextProps.values;
1563
1564
 
1564
1565
 
1565
- if (!shallowEquals(nextValues, values)) {
1566
- return true;
1567
- }
1566
+ if (!shallowEquals(nextValues, values)) {
1567
+ return true;
1568
+ }
1568
1569
 
1569
- // Since `values` has already been checked, we know they're not
1570
- // different, so the current `values` are carried over so the shallow
1571
- // equals comparison on the other props isn't affected by the `values`.
1572
- var nextPropsToCheck = _extends({}, nextProps, {
1573
- values: values
1574
- });
1570
+ // Since `values` has already been checked, we know they're not
1571
+ // different, so the current `values` are carried over so the shallow
1572
+ // equals comparison on the other props isn't affected by the `values`.
1573
+ var nextPropsToCheck = _extends({}, nextProps, {
1574
+ values: values
1575
+ });
1575
1576
 
1576
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1577
- next[_key - 1] = arguments[_key];
1578
- }
1577
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1578
+ next[_key - 1] = arguments[_key];
1579
+ }
1579
1580
 
1580
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1581
- }
1582
- }, {
1583
- key: 'render',
1584
- value: function render() {
1585
- var _context$intl = this.context.intl,
1586
- formatHTMLMessage = _context$intl.formatHTMLMessage,
1587
- Text = _context$intl.textComponent;
1588
- var _props = this.props,
1589
- id = _props.id,
1590
- description = _props.description,
1591
- defaultMessage = _props.defaultMessage,
1592
- rawValues = _props.values,
1593
- _props$tagName = _props.tagName,
1594
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1595
- children = _props.children;
1596
-
1597
-
1598
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1599
- var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
1600
-
1601
- if (typeof children === 'function') {
1602
- return children(formattedHTMLMessage);
1603
- }
1604
-
1605
- // Since the message presumably has HTML in it, we need to set
1606
- // `innerHTML` in order for it to be rendered and not escaped by React.
1607
- // To be safe, all string prop values were escaped when formatting the
1608
- // message. It is assumed that the message is not UGC, and came from the
1609
- // developer making it more like a template.
1610
- //
1611
- // Note: There's a perf impact of using this component since there's no
1612
- // way for React to do its virtual DOM diffing.
1613
- var html = { __html: formattedHTMLMessage };
1614
- return React__default.createElement(Component$$1, { dangerouslySetInnerHTML: html });
1615
- }
1616
- }]);
1617
- return FormattedHTMLMessage;
1581
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1582
+ }
1583
+ }, {
1584
+ key: 'render',
1585
+ value: function render() {
1586
+ var _context$intl = this.context.intl,
1587
+ formatHTMLMessage = _context$intl.formatHTMLMessage,
1588
+ Text = _context$intl.textComponent;
1589
+ var _props = this.props,
1590
+ id = _props.id,
1591
+ description = _props.description,
1592
+ defaultMessage = _props.defaultMessage,
1593
+ rawValues = _props.values,
1594
+ _props$tagName = _props.tagName,
1595
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1596
+ children = _props.children;
1597
+
1598
+
1599
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1600
+ var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
1601
+
1602
+ if (typeof children === 'function') {
1603
+ return children(formattedHTMLMessage);
1604
+ }
1605
+
1606
+ // Since the message presumably has HTML in it, we need to set
1607
+ // `innerHTML` in order for it to be rendered and not escaped by React.
1608
+ // To be safe, all string prop values were escaped when formatting the
1609
+ // message. It is assumed that the message is not UGC, and came from the
1610
+ // developer making it more like a template.
1611
+ //
1612
+ // Note: There's a perf impact of using this component since there's no
1613
+ // way for React to do its virtual DOM diffing.
1614
+ var html = { __html: formattedHTMLMessage };
1615
+ return React__default.createElement(Component$$1, { dangerouslySetInnerHTML: html });
1616
+ }
1617
+ }]);
1618
+ return FormattedHTMLMessage;
1618
1619
  }(React.Component);
1619
1620
 
1620
1621
  FormattedHTMLMessage.displayName = 'FormattedHTMLMessage';
1621
1622
  FormattedHTMLMessage.contextTypes = {
1622
- intl: intlShape
1623
+ intl: intlShape
1623
1624
  };
1624
1625
  FormattedHTMLMessage.defaultProps = {
1625
- values: {}
1626
+ values: {}
1626
1627
  };
1627
1628
  process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1628
- values: PropTypes.object,
1629
- tagName: PropTypes.string,
1630
- children: PropTypes.func
1629
+ values: PropTypes.object,
1630
+ tagName: PropTypes.string,
1631
+ children: PropTypes.func
1631
1632
  }) : void 0;
1632
1633
 
1633
1634
  /*