react-intl 2.2.1 → 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 (262) hide show
  1. package/CONTRIBUTING.md +20 -0
  2. package/dist/react-intl.js +1017 -1475
  3. package/dist/react-intl.js.map +1 -1
  4. package/dist/react-intl.min.js +1 -2
  5. package/dist/react-intl.min.js.map +1 -1
  6. package/lib/index.es.js +983 -1428
  7. package/lib/index.js +990 -1435
  8. package/locale-data/af.js +1 -1
  9. package/locale-data/agq.js +1 -1
  10. package/locale-data/ak.js +1 -1
  11. package/locale-data/am.js +1 -1
  12. package/locale-data/ar.js +1 -1
  13. package/locale-data/ars.js +1 -0
  14. package/locale-data/as.js +1 -1
  15. package/locale-data/asa.js +1 -1
  16. package/locale-data/ast.js +1 -1
  17. package/locale-data/az.js +1 -1
  18. package/locale-data/bas.js +1 -1
  19. package/locale-data/be.js +1 -1
  20. package/locale-data/bem.js +1 -1
  21. package/locale-data/bez.js +1 -1
  22. package/locale-data/bg.js +1 -1
  23. package/locale-data/bh.js +1 -1
  24. package/locale-data/bm.js +1 -1
  25. package/locale-data/bn.js +1 -1
  26. package/locale-data/bo.js +1 -1
  27. package/locale-data/br.js +1 -1
  28. package/locale-data/brx.js +1 -1
  29. package/locale-data/bs.js +1 -1
  30. package/locale-data/ca.js +1 -1
  31. package/locale-data/ce.js +1 -1
  32. package/locale-data/cgg.js +1 -1
  33. package/locale-data/chr.js +1 -1
  34. package/locale-data/ckb.js +1 -1
  35. package/locale-data/cs.js +1 -1
  36. package/locale-data/cu.js +1 -1
  37. package/locale-data/cy.js +1 -1
  38. package/locale-data/da.js +1 -1
  39. package/locale-data/dav.js +1 -1
  40. package/locale-data/de.js +1 -1
  41. package/locale-data/dje.js +1 -1
  42. package/locale-data/dsb.js +1 -1
  43. package/locale-data/dua.js +1 -1
  44. package/locale-data/dv.js +1 -1
  45. package/locale-data/dyo.js +1 -1
  46. package/locale-data/dz.js +1 -1
  47. package/locale-data/ebu.js +1 -1
  48. package/locale-data/ee.js +1 -1
  49. package/locale-data/el.js +1 -1
  50. package/locale-data/en.js +1 -1
  51. package/locale-data/eo.js +1 -1
  52. package/locale-data/es.js +1 -1
  53. package/locale-data/et.js +1 -1
  54. package/locale-data/eu.js +1 -1
  55. package/locale-data/ewo.js +1 -1
  56. package/locale-data/fa.js +1 -1
  57. package/locale-data/ff.js +1 -1
  58. package/locale-data/fi.js +1 -1
  59. package/locale-data/fil.js +1 -1
  60. package/locale-data/fo.js +1 -1
  61. package/locale-data/fr.js +1 -1
  62. package/locale-data/fur.js +1 -1
  63. package/locale-data/fy.js +1 -1
  64. package/locale-data/ga.js +1 -1
  65. package/locale-data/gd.js +1 -1
  66. package/locale-data/gl.js +1 -1
  67. package/locale-data/gsw.js +1 -1
  68. package/locale-data/gu.js +1 -1
  69. package/locale-data/guw.js +1 -1
  70. package/locale-data/guz.js +1 -1
  71. package/locale-data/gv.js +1 -1
  72. package/locale-data/ha.js +1 -1
  73. package/locale-data/haw.js +1 -1
  74. package/locale-data/he.js +1 -1
  75. package/locale-data/hi.js +1 -1
  76. package/locale-data/hr.js +1 -1
  77. package/locale-data/hsb.js +1 -1
  78. package/locale-data/hu.js +1 -1
  79. package/locale-data/hy.js +1 -1
  80. package/locale-data/id.js +1 -1
  81. package/locale-data/ig.js +1 -1
  82. package/locale-data/ii.js +1 -1
  83. package/locale-data/in.js +1 -1
  84. package/locale-data/index.js +1 -10
  85. package/locale-data/is.js +1 -1
  86. package/locale-data/it.js +1 -1
  87. package/locale-data/iu.js +1 -1
  88. package/locale-data/iw.js +1 -1
  89. package/locale-data/ja.js +1 -1
  90. package/locale-data/jbo.js +1 -1
  91. package/locale-data/jgo.js +1 -1
  92. package/locale-data/ji.js +1 -1
  93. package/locale-data/jmc.js +1 -1
  94. package/locale-data/jv.js +1 -1
  95. package/locale-data/jw.js +1 -1
  96. package/locale-data/ka.js +1 -1
  97. package/locale-data/kab.js +1 -1
  98. package/locale-data/kaj.js +1 -1
  99. package/locale-data/kam.js +1 -1
  100. package/locale-data/kcg.js +1 -1
  101. package/locale-data/kde.js +1 -1
  102. package/locale-data/kea.js +1 -1
  103. package/locale-data/khq.js +1 -1
  104. package/locale-data/ki.js +1 -1
  105. package/locale-data/kk.js +1 -1
  106. package/locale-data/kkj.js +1 -1
  107. package/locale-data/kl.js +1 -1
  108. package/locale-data/kln.js +1 -1
  109. package/locale-data/km.js +1 -1
  110. package/locale-data/kn.js +1 -1
  111. package/locale-data/ko.js +1 -1
  112. package/locale-data/kok.js +1 -1
  113. package/locale-data/ks.js +1 -1
  114. package/locale-data/ksb.js +1 -1
  115. package/locale-data/ksf.js +1 -1
  116. package/locale-data/ksh.js +1 -1
  117. package/locale-data/ku.js +1 -1
  118. package/locale-data/kw.js +1 -1
  119. package/locale-data/ky.js +1 -1
  120. package/locale-data/lag.js +1 -1
  121. package/locale-data/lb.js +1 -1
  122. package/locale-data/lg.js +1 -1
  123. package/locale-data/lkt.js +1 -1
  124. package/locale-data/ln.js +1 -1
  125. package/locale-data/lo.js +1 -1
  126. package/locale-data/lrc.js +1 -1
  127. package/locale-data/lt.js +1 -1
  128. package/locale-data/lu.js +1 -1
  129. package/locale-data/luo.js +1 -1
  130. package/locale-data/luy.js +1 -1
  131. package/locale-data/lv.js +1 -1
  132. package/locale-data/mas.js +1 -1
  133. package/locale-data/mer.js +1 -1
  134. package/locale-data/mfe.js +1 -1
  135. package/locale-data/mg.js +1 -1
  136. package/locale-data/mgh.js +1 -1
  137. package/locale-data/mgo.js +1 -1
  138. package/locale-data/mk.js +1 -1
  139. package/locale-data/ml.js +1 -1
  140. package/locale-data/mn.js +1 -1
  141. package/locale-data/mo.js +1 -1
  142. package/locale-data/mr.js +1 -1
  143. package/locale-data/ms.js +1 -1
  144. package/locale-data/mt.js +1 -1
  145. package/locale-data/mua.js +1 -1
  146. package/locale-data/my.js +1 -1
  147. package/locale-data/mzn.js +1 -1
  148. package/locale-data/nah.js +1 -1
  149. package/locale-data/naq.js +1 -1
  150. package/locale-data/nb.js +1 -1
  151. package/locale-data/nd.js +1 -1
  152. package/locale-data/nds.js +1 -0
  153. package/locale-data/ne.js +1 -1
  154. package/locale-data/nl.js +1 -1
  155. package/locale-data/nmg.js +1 -1
  156. package/locale-data/nn.js +1 -1
  157. package/locale-data/nnh.js +1 -1
  158. package/locale-data/no.js +1 -1
  159. package/locale-data/nqo.js +1 -1
  160. package/locale-data/nr.js +1 -1
  161. package/locale-data/nso.js +1 -1
  162. package/locale-data/nus.js +1 -1
  163. package/locale-data/ny.js +1 -1
  164. package/locale-data/nyn.js +1 -1
  165. package/locale-data/om.js +1 -1
  166. package/locale-data/or.js +1 -1
  167. package/locale-data/os.js +1 -1
  168. package/locale-data/pa.js +1 -1
  169. package/locale-data/pap.js +1 -1
  170. package/locale-data/pl.js +1 -1
  171. package/locale-data/prg.js +1 -1
  172. package/locale-data/ps.js +1 -1
  173. package/locale-data/pt.js +1 -1
  174. package/locale-data/qu.js +1 -1
  175. package/locale-data/rm.js +1 -1
  176. package/locale-data/rn.js +1 -1
  177. package/locale-data/ro.js +1 -1
  178. package/locale-data/rof.js +1 -1
  179. package/locale-data/ru.js +1 -1
  180. package/locale-data/rw.js +1 -1
  181. package/locale-data/rwk.js +1 -1
  182. package/locale-data/sah.js +1 -1
  183. package/locale-data/saq.js +1 -1
  184. package/locale-data/sbp.js +1 -1
  185. package/locale-data/sdh.js +1 -1
  186. package/locale-data/se.js +1 -1
  187. package/locale-data/seh.js +1 -1
  188. package/locale-data/ses.js +1 -1
  189. package/locale-data/sg.js +1 -1
  190. package/locale-data/sh.js +1 -1
  191. package/locale-data/shi.js +1 -1
  192. package/locale-data/si.js +1 -1
  193. package/locale-data/sk.js +1 -1
  194. package/locale-data/sl.js +1 -1
  195. package/locale-data/sma.js +1 -1
  196. package/locale-data/smi.js +1 -1
  197. package/locale-data/smj.js +1 -1
  198. package/locale-data/smn.js +1 -1
  199. package/locale-data/sms.js +1 -1
  200. package/locale-data/sn.js +1 -1
  201. package/locale-data/so.js +1 -1
  202. package/locale-data/sq.js +1 -1
  203. package/locale-data/sr.js +1 -1
  204. package/locale-data/ss.js +1 -1
  205. package/locale-data/ssy.js +1 -1
  206. package/locale-data/st.js +1 -1
  207. package/locale-data/sv.js +1 -1
  208. package/locale-data/sw.js +1 -1
  209. package/locale-data/syr.js +1 -1
  210. package/locale-data/ta.js +1 -1
  211. package/locale-data/te.js +1 -1
  212. package/locale-data/teo.js +1 -1
  213. package/locale-data/th.js +1 -1
  214. package/locale-data/ti.js +1 -1
  215. package/locale-data/tig.js +1 -1
  216. package/locale-data/tk.js +1 -1
  217. package/locale-data/tl.js +1 -1
  218. package/locale-data/tn.js +1 -1
  219. package/locale-data/to.js +1 -1
  220. package/locale-data/tr.js +1 -1
  221. package/locale-data/ts.js +1 -1
  222. package/locale-data/twq.js +1 -1
  223. package/locale-data/tzm.js +1 -1
  224. package/locale-data/ug.js +1 -1
  225. package/locale-data/uk.js +1 -1
  226. package/locale-data/ur.js +1 -1
  227. package/locale-data/uz.js +1 -1
  228. package/locale-data/vai.js +1 -1
  229. package/locale-data/ve.js +1 -1
  230. package/locale-data/vi.js +1 -1
  231. package/locale-data/vo.js +1 -1
  232. package/locale-data/vun.js +1 -1
  233. package/locale-data/wa.js +1 -1
  234. package/locale-data/wae.js +1 -1
  235. package/locale-data/wo.js +1 -1
  236. package/locale-data/xh.js +1 -1
  237. package/locale-data/xog.js +1 -1
  238. package/locale-data/yav.js +1 -1
  239. package/locale-data/yi.js +1 -1
  240. package/locale-data/yo.js +1 -1
  241. package/locale-data/yue.js +1 -0
  242. package/locale-data/zgh.js +1 -1
  243. package/locale-data/zh.js +1 -1
  244. package/locale-data/zu.js +1 -1
  245. package/package.json +33 -27
  246. package/src/components/date.js +30 -29
  247. package/src/components/html-message.js +63 -62
  248. package/src/components/message.js +117 -114
  249. package/src/components/number.js +30 -29
  250. package/src/components/plural.js +37 -36
  251. package/src/components/provider.js +135 -134
  252. package/src/components/relative.js +128 -120
  253. package/src/components/time.js +30 -29
  254. package/src/define-messages.js +3 -3
  255. package/src/en.js +1 -1
  256. package/src/format.js +209 -208
  257. package/src/inject.js +38 -40
  258. package/src/locale-data-registry.js +21 -21
  259. package/src/plural.js +9 -9
  260. package/src/types.js +58 -48
  261. package/src/utils.js +65 -55
  262. package/yarn.lock +4832 -0
package/lib/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2016, Yahoo Inc.
2
+ * Copyright 2017, Yahoo Inc.
3
3
  * Copyrights licensed under the New BSD License.
4
4
  * See the accompanying LICENSE file for terms.
5
5
  */
@@ -7,7 +7,8 @@
7
7
  import allLocaleData from '../locale-data/index.js';
8
8
  import IntlMessageFormat from 'intl-messageformat';
9
9
  import IntlRelativeFormat from 'intl-relativeformat';
10
- import React, { Children, Component, PropTypes, isValidElement } from 'react';
10
+ import PropTypes from 'prop-types';
11
+ import React, { Children, Component, createElement, isValidElement } from 'react';
11
12
  import invariant from 'invariant';
12
13
  import memoizeIntlConstructor from 'intl-format-cache';
13
14
 
@@ -18,7 +19,7 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
18
19
  t0 = Number(s[0]) == n,
19
20
  n10 = t0 && s[0].slice(-1),
20
21
  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";
21
- }, "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" } } } } };
22
+ }, "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" } } } } };
22
23
 
23
24
  /*
24
25
  * Copyright 2015, Yahoo Inc.
@@ -27,36 +28,36 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
27
28
  */
28
29
 
29
30
  function addLocaleData() {
30
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
31
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
31
32
 
32
- var locales = Array.isArray(data) ? data : [data];
33
+ var locales = Array.isArray(data) ? data : [data];
33
34
 
34
- locales.forEach(function (localeData) {
35
- if (localeData && localeData.locale) {
36
- IntlMessageFormat.__addLocaleData(localeData);
37
- IntlRelativeFormat.__addLocaleData(localeData);
38
- }
39
- });
35
+ locales.forEach(function (localeData) {
36
+ if (localeData && localeData.locale) {
37
+ IntlMessageFormat.__addLocaleData(localeData);
38
+ IntlRelativeFormat.__addLocaleData(localeData);
39
+ }
40
+ });
40
41
  }
41
42
 
42
43
  function hasLocaleData(locale) {
43
- var localeParts = (locale || '').split('-');
44
+ var localeParts = (locale || '').split('-');
44
45
 
45
- while (localeParts.length > 0) {
46
- if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
47
- return true;
48
- }
49
-
50
- localeParts.pop();
46
+ while (localeParts.length > 0) {
47
+ if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
48
+ return true;
51
49
  }
52
50
 
53
- return false;
51
+ localeParts.pop();
52
+ }
53
+
54
+ return false;
54
55
  }
55
56
 
56
57
  function hasIMFAndIRFLocaleData(locale) {
57
- var normalizedLocale = locale && locale.toLowerCase();
58
+ var normalizedLocale = locale && locale.toLowerCase();
58
59
 
59
- return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
60
+ return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
60
61
  }
61
62
 
62
63
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
@@ -65,257 +66,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
65
66
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
66
67
  };
67
68
 
68
- var jsx = function () {
69
- var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
70
- return function createRawReactElement(type, props, key, children) {
71
- var defaultProps = type && type.defaultProps;
72
- var childrenLength = arguments.length - 3;
73
-
74
- if (!props && childrenLength !== 0) {
75
- props = {};
76
- }
77
-
78
- if (props && defaultProps) {
79
- for (var propName in defaultProps) {
80
- if (props[propName] === void 0) {
81
- props[propName] = defaultProps[propName];
82
- }
83
- }
84
- } else if (!props) {
85
- props = defaultProps || {};
86
- }
87
-
88
- if (childrenLength === 1) {
89
- props.children = children;
90
- } else if (childrenLength > 1) {
91
- var childArray = Array(childrenLength);
92
-
93
- for (var i = 0; i < childrenLength; i++) {
94
- childArray[i] = arguments[i + 3];
95
- }
96
-
97
- props.children = childArray;
98
- }
99
-
100
- return {
101
- $$typeof: REACT_ELEMENT_TYPE,
102
- type: type,
103
- key: key === undefined ? null : '' + key,
104
- ref: null,
105
- props: props,
106
- _owner: null
107
- };
108
- };
109
- }();
110
-
111
- var asyncIterator = function (iterable) {
112
- if (typeof Symbol === "function") {
113
- if (Symbol.asyncIterator) {
114
- var method = iterable[Symbol.asyncIterator];
115
- if (method != null) return method.call(iterable);
116
- }
117
-
118
- if (Symbol.iterator) {
119
- return iterable[Symbol.iterator]();
120
- }
121
- }
122
-
123
- throw new TypeError("Object is not async iterable");
124
- };
125
-
126
- var asyncGenerator = function () {
127
- function AwaitValue(value) {
128
- this.value = value;
129
- }
130
-
131
- function AsyncGenerator(gen) {
132
- var front, back;
133
-
134
- function send(key, arg) {
135
- return new Promise(function (resolve, reject) {
136
- var request = {
137
- key: key,
138
- arg: arg,
139
- resolve: resolve,
140
- reject: reject,
141
- next: null
142
- };
143
-
144
- if (back) {
145
- back = back.next = request;
146
- } else {
147
- front = back = request;
148
- resume(key, arg);
149
- }
150
- });
151
- }
152
-
153
- function resume(key, arg) {
154
- try {
155
- var result = gen[key](arg);
156
- var value = result.value;
157
-
158
- if (value instanceof AwaitValue) {
159
- Promise.resolve(value.value).then(function (arg) {
160
- resume("next", arg);
161
- }, function (arg) {
162
- resume("throw", arg);
163
- });
164
- } else {
165
- settle(result.done ? "return" : "normal", result.value);
166
- }
167
- } catch (err) {
168
- settle("throw", err);
169
- }
170
- }
171
-
172
- function settle(type, value) {
173
- switch (type) {
174
- case "return":
175
- front.resolve({
176
- value: value,
177
- done: true
178
- });
179
- break;
180
-
181
- case "throw":
182
- front.reject(value);
183
- break;
184
-
185
- default:
186
- front.resolve({
187
- value: value,
188
- done: false
189
- });
190
- break;
191
- }
192
-
193
- front = front.next;
194
-
195
- if (front) {
196
- resume(front.key, front.arg);
197
- } else {
198
- back = null;
199
- }
200
- }
201
-
202
- this._invoke = send;
203
-
204
- if (typeof gen.return !== "function") {
205
- this.return = undefined;
206
- }
207
- }
208
-
209
- if (typeof Symbol === "function" && Symbol.asyncIterator) {
210
- AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
211
- return this;
212
- };
213
- }
214
-
215
- AsyncGenerator.prototype.next = function (arg) {
216
- return this._invoke("next", arg);
217
- };
218
-
219
- AsyncGenerator.prototype.throw = function (arg) {
220
- return this._invoke("throw", arg);
221
- };
222
-
223
- AsyncGenerator.prototype.return = function (arg) {
224
- return this._invoke("return", arg);
225
- };
226
-
227
- return {
228
- wrap: function (fn) {
229
- return function () {
230
- return new AsyncGenerator(fn.apply(this, arguments));
231
- };
232
- },
233
- await: function (value) {
234
- return new AwaitValue(value);
235
- }
236
- };
237
- }();
238
-
239
- var asyncGeneratorDelegate = function (inner, awaitWrap) {
240
- var iter = {},
241
- waiting = false;
242
69
 
243
- function pump(key, value) {
244
- waiting = true;
245
- value = new Promise(function (resolve) {
246
- resolve(inner[key](value));
247
- });
248
- return {
249
- done: false,
250
- value: awaitWrap(value)
251
- };
252
- }
253
70
 
254
-
255
71
 
256
- if (typeof Symbol === "function" && Symbol.iterator) {
257
- iter[Symbol.iterator] = function () {
258
- return this;
259
- };
260
- }
261
72
 
262
- iter.next = function (value) {
263
- if (waiting) {
264
- waiting = false;
265
- return value;
266
- }
267
73
 
268
- return pump("next", value);
269
- };
270
74
 
271
- if (typeof inner.throw === "function") {
272
- iter.throw = function (value) {
273
- if (waiting) {
274
- waiting = false;
275
- throw value;
276
- }
277
-
278
- return pump("throw", value);
279
- };
280
- }
281
-
282
- if (typeof inner.return === "function") {
283
- iter.return = function (value) {
284
- return pump("return", value);
285
- };
286
- }
287
-
288
- return iter;
289
- };
290
75
 
291
- var asyncToGenerator = function (fn) {
292
- return function () {
293
- var gen = fn.apply(this, arguments);
294
- return new Promise(function (resolve, reject) {
295
- function step(key, arg) {
296
- try {
297
- var info = gen[key](arg);
298
- var value = info.value;
299
- } catch (error) {
300
- reject(error);
301
- return;
302
- }
303
76
 
304
- if (info.done) {
305
- resolve(value);
306
- } else {
307
- return Promise.resolve(value).then(function (value) {
308
- step("next", value);
309
- }, function (err) {
310
- step("throw", err);
311
- });
312
- }
313
- }
314
77
 
315
- return step("next");
316
- });
317
- };
318
- };
319
78
 
320
79
  var classCallCheck = function (instance, Constructor) {
321
80
  if (!(instance instanceof Constructor)) {
@@ -341,31 +100,9 @@ var createClass = function () {
341
100
  };
342
101
  }();
343
102
 
344
- var defineEnumerableProperties = function (obj, descs) {
345
- for (var key in descs) {
346
- var desc = descs[key];
347
- desc.configurable = desc.enumerable = true;
348
- if ("value" in desc) desc.writable = true;
349
- Object.defineProperty(obj, key, desc);
350
- }
351
103
 
352
- return obj;
353
- };
354
-
355
- var defaults = function (obj, defaults) {
356
- var keys = Object.getOwnPropertyNames(defaults);
357
104
 
358
- for (var i = 0; i < keys.length; i++) {
359
- var key = keys[i];
360
- var value = Object.getOwnPropertyDescriptor(defaults, key);
361
-
362
- if (value && value.configurable && obj[key] === undefined) {
363
- Object.defineProperty(obj, key, value);
364
- }
365
- }
366
105
 
367
- return obj;
368
- };
369
106
 
370
107
  var defineProperty = function (obj, key, value) {
371
108
  if (key in obj) {
@@ -396,30 +133,7 @@ var _extends = Object.assign || function (target) {
396
133
  return target;
397
134
  };
398
135
 
399
- var get = function get(object, property, receiver) {
400
- if (object === null) object = Function.prototype;
401
- var desc = Object.getOwnPropertyDescriptor(object, property);
402
136
 
403
- if (desc === undefined) {
404
- var parent = Object.getPrototypeOf(object);
405
-
406
- if (parent === null) {
407
- return undefined;
408
- } else {
409
- return get(parent, property, receiver);
410
- }
411
- } else if ("value" in desc) {
412
- return desc.value;
413
- } else {
414
- var getter = desc.get;
415
-
416
- if (getter === undefined) {
417
- return undefined;
418
- }
419
-
420
- return getter.call(receiver);
421
- }
422
- };
423
137
 
424
138
  var inherits = function (subClass, superClass) {
425
139
  if (typeof superClass !== "function" && superClass !== null) {
@@ -437,46 +151,13 @@ var inherits = function (subClass, superClass) {
437
151
  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
438
152
  };
439
153
 
440
- var _instanceof = function (left, right) {
441
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
442
- return right[Symbol.hasInstance](left);
443
- } else {
444
- return left instanceof right;
445
- }
446
- };
447
154
 
448
- var interopRequireDefault = function (obj) {
449
- return obj && obj.__esModule ? obj : {
450
- default: obj
451
- };
452
- };
453
155
 
454
- var interopRequireWildcard = function (obj) {
455
- if (obj && obj.__esModule) {
456
- return obj;
457
- } else {
458
- var newObj = {};
459
156
 
460
- if (obj != null) {
461
- for (var key in obj) {
462
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
463
- }
464
- }
465
157
 
466
- newObj.default = obj;
467
- return newObj;
468
- }
469
- };
470
158
 
471
- var newArrowCheck = function (innerThis, boundThis) {
472
- if (innerThis !== boundThis) {
473
- throw new TypeError("Cannot instantiate an arrow function");
474
- }
475
- };
476
159
 
477
- var objectDestructuringEmpty = function (obj) {
478
- if (obj == null) throw new TypeError("Cannot destructure undefined");
479
- };
160
+
480
161
 
481
162
  var objectWithoutProperties = function (obj, keys) {
482
163
  var target = {};
@@ -498,112 +179,23 @@ var possibleConstructorReturn = function (self, call) {
498
179
  return call && (typeof call === "object" || typeof call === "function") ? call : self;
499
180
  };
500
181
 
501
- var selfGlobal = typeof global === "undefined" ? self : global;
502
-
503
- var set = function set(object, property, value, receiver) {
504
- var desc = Object.getOwnPropertyDescriptor(object, property);
505
182
 
506
- if (desc === undefined) {
507
- var parent = Object.getPrototypeOf(object);
508
183
 
509
- if (parent !== null) {
510
- set(parent, property, value, receiver);
511
- }
512
- } else if ("value" in desc && desc.writable) {
513
- desc.value = value;
514
- } else {
515
- var setter = desc.set;
516
184
 
517
- if (setter !== undefined) {
518
- setter.call(receiver, value);
519
- }
520
- }
521
185
 
522
- return value;
523
- };
524
186
 
525
- var slicedToArray = function () {
526
- function sliceIterator(arr, i) {
527
- var _arr = [];
528
- var _n = true;
529
- var _d = false;
530
- var _e = undefined;
531
187
 
532
- try {
533
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
534
- _arr.push(_s.value);
535
188
 
536
- if (i && _arr.length === i) break;
537
- }
538
- } catch (err) {
539
- _d = true;
540
- _e = err;
541
- } finally {
542
- try {
543
- if (!_n && _i["return"]) _i["return"]();
544
- } finally {
545
- if (_d) throw _e;
546
- }
547
- }
548
-
549
- return _arr;
550
- }
551
189
 
552
- return function (arr, i) {
553
- if (Array.isArray(arr)) {
554
- return arr;
555
- } else if (Symbol.iterator in Object(arr)) {
556
- return sliceIterator(arr, i);
557
- } else {
558
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
559
- }
560
- };
561
- }();
562
190
 
563
- var slicedToArrayLoose = function (arr, i) {
564
- if (Array.isArray(arr)) {
565
- return arr;
566
- } else if (Symbol.iterator in Object(arr)) {
567
- var _arr = [];
568
191
 
569
- for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
570
- _arr.push(_step.value);
571
192
 
572
- if (i && _arr.length === i) break;
573
- }
574
193
 
575
- return _arr;
576
- } else {
577
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
578
- }
579
- };
580
194
 
581
- var taggedTemplateLiteral = function (strings, raw) {
582
- return Object.freeze(Object.defineProperties(strings, {
583
- raw: {
584
- value: Object.freeze(raw)
585
- }
586
- }));
587
- };
588
195
 
589
- var taggedTemplateLiteralLoose = function (strings, raw) {
590
- strings.raw = raw;
591
- return strings;
592
- };
593
196
 
594
- var temporalRef = function (val, name, undef) {
595
- if (val === undef) {
596
- throw new ReferenceError(name + " is not defined - temporal dead zone");
597
- } else {
598
- return val;
599
- }
600
- };
601
197
 
602
- var temporalUndefined = {};
603
198
 
604
- var toArray = function (arr) {
605
- return Array.isArray(arr) ? arr : Array.from(arr);
606
- };
607
199
 
608
200
  var toConsumableArray = function (arr) {
609
201
  if (Array.isArray(arr)) {
@@ -615,42 +207,6 @@ var toConsumableArray = function (arr) {
615
207
  }
616
208
  };
617
209
 
618
-
619
-
620
- var babelHelpers$1 = Object.freeze({
621
- jsx: jsx,
622
- asyncIterator: asyncIterator,
623
- asyncGenerator: asyncGenerator,
624
- asyncGeneratorDelegate: asyncGeneratorDelegate,
625
- asyncToGenerator: asyncToGenerator,
626
- classCallCheck: classCallCheck,
627
- createClass: createClass,
628
- defineEnumerableProperties: defineEnumerableProperties,
629
- defaults: defaults,
630
- defineProperty: defineProperty,
631
- get: get,
632
- inherits: inherits,
633
- interopRequireDefault: interopRequireDefault,
634
- interopRequireWildcard: interopRequireWildcard,
635
- newArrowCheck: newArrowCheck,
636
- objectDestructuringEmpty: objectDestructuringEmpty,
637
- objectWithoutProperties: objectWithoutProperties,
638
- possibleConstructorReturn: possibleConstructorReturn,
639
- selfGlobal: selfGlobal,
640
- set: set,
641
- slicedToArray: slicedToArray,
642
- slicedToArrayLoose: slicedToArrayLoose,
643
- taggedTemplateLiteral: taggedTemplateLiteral,
644
- taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,
645
- temporalRef: temporalRef,
646
- temporalUndefined: temporalUndefined,
647
- toArray: toArray,
648
- toConsumableArray: toConsumableArray,
649
- typeof: _typeof,
650
- extends: _extends,
651
- instanceof: _instanceof
652
- });
653
-
654
210
  /*
655
211
  * Copyright 2015, Yahoo Inc.
656
212
  * Copyrights licensed under the New BSD License.
@@ -665,6 +221,7 @@ var object = PropTypes.object;
665
221
  var oneOf = PropTypes.oneOf;
666
222
  var shape = PropTypes.shape;
667
223
  var any = PropTypes.any;
224
+ var oneOfType = PropTypes.oneOfType;
668
225
 
669
226
  var localeMatcher = oneOf(['best fit', 'lookup']);
670
227
  var narrowShortLong = oneOf(['narrow', 'short', 'long']);
@@ -672,76 +229,76 @@ var numeric2digit = oneOf(['numeric', '2-digit']);
672
229
  var funcReq = func.isRequired;
673
230
 
674
231
  var intlConfigPropTypes = {
675
- locale: string,
676
- formats: object,
677
- messages: object,
678
- textComponent: any,
232
+ locale: string,
233
+ formats: object,
234
+ messages: object,
235
+ textComponent: any,
679
236
 
680
- defaultLocale: string,
681
- defaultFormats: object
237
+ defaultLocale: string,
238
+ defaultFormats: object
682
239
  };
683
240
 
684
241
  var intlFormatPropTypes = {
685
- formatDate: funcReq,
686
- formatTime: funcReq,
687
- formatRelative: funcReq,
688
- formatNumber: funcReq,
689
- formatPlural: funcReq,
690
- formatMessage: funcReq,
691
- formatHTMLMessage: funcReq
242
+ formatDate: funcReq,
243
+ formatTime: funcReq,
244
+ formatRelative: funcReq,
245
+ formatNumber: funcReq,
246
+ formatPlural: funcReq,
247
+ formatMessage: funcReq,
248
+ formatHTMLMessage: funcReq
692
249
  };
693
250
 
694
- var intlShape = shape(babelHelpers$1['extends']({}, intlConfigPropTypes, intlFormatPropTypes, {
695
- formatters: object,
696
- now: funcReq
251
+ var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, {
252
+ formatters: object,
253
+ now: funcReq
697
254
  }));
698
255
 
699
256
  var messageDescriptorPropTypes = {
700
- id: string.isRequired,
701
- description: string,
702
- defaultMessage: string
257
+ id: string.isRequired,
258
+ description: oneOfType([string, object]),
259
+ defaultMessage: string
703
260
  };
704
261
 
705
262
  var dateTimeFormatPropTypes = {
706
- localeMatcher: localeMatcher,
707
- formatMatcher: oneOf(['basic', 'best fit']),
708
-
709
- timeZone: string,
710
- hour12: bool,
711
-
712
- weekday: narrowShortLong,
713
- era: narrowShortLong,
714
- year: numeric2digit,
715
- month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
716
- day: numeric2digit,
717
- hour: numeric2digit,
718
- minute: numeric2digit,
719
- second: numeric2digit,
720
- timeZoneName: oneOf(['short', 'long'])
263
+ localeMatcher: localeMatcher,
264
+ formatMatcher: oneOf(['basic', 'best fit']),
265
+
266
+ timeZone: string,
267
+ hour12: bool,
268
+
269
+ weekday: narrowShortLong,
270
+ era: narrowShortLong,
271
+ year: numeric2digit,
272
+ month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
273
+ day: numeric2digit,
274
+ hour: numeric2digit,
275
+ minute: numeric2digit,
276
+ second: numeric2digit,
277
+ timeZoneName: oneOf(['short', 'long'])
721
278
  };
722
279
 
723
280
  var numberFormatPropTypes = {
724
- localeMatcher: localeMatcher,
725
-
726
- style: oneOf(['decimal', 'currency', 'percent']),
727
- currency: string,
728
- currencyDisplay: oneOf(['symbol', 'code', 'name']),
729
- useGrouping: bool,
730
-
731
- minimumIntegerDigits: number,
732
- minimumFractionDigits: number,
733
- maximumFractionDigits: number,
734
- minimumSignificantDigits: number,
735
- maximumSignificantDigits: number
281
+ localeMatcher: localeMatcher,
282
+
283
+ style: oneOf(['decimal', 'currency', 'percent']),
284
+ currency: string,
285
+ currencyDisplay: oneOf(['symbol', 'code', 'name']),
286
+ useGrouping: bool,
287
+
288
+ minimumIntegerDigits: number,
289
+ minimumFractionDigits: number,
290
+ maximumFractionDigits: number,
291
+ minimumSignificantDigits: number,
292
+ maximumSignificantDigits: number
736
293
  };
737
294
 
738
295
  var relativeFormatPropTypes = {
739
- style: oneOf(['best fit', 'numeric']),
740
- units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
296
+ style: oneOf(['best fit', 'numeric']),
297
+ units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
741
298
  };
742
299
 
743
300
  var pluralFormatPropTypes = {
744
- style: oneOf(['cardinal', 'ordinal'])
301
+ style: oneOf(['cardinal', 'ordinal'])
745
302
  };
746
303
 
747
304
  /*
@@ -758,82 +315,82 @@ file in the root directory of React's source tree.
758
315
  var intlConfigPropNames = Object.keys(intlConfigPropTypes);
759
316
 
760
317
  var ESCAPED_CHARS = {
761
- '&': '&amp;',
762
- '>': '&gt;',
763
- '<': '&lt;',
764
- '"': '&quot;',
765
- '\'': '&#x27;'
318
+ '&': '&amp;',
319
+ '>': '&gt;',
320
+ '<': '&lt;',
321
+ '"': '&quot;',
322
+ "'": '&#x27;'
766
323
  };
767
324
 
768
325
  var UNSAFE_CHARS_REGEX = /[&><"']/g;
769
326
 
770
327
  function escape(str) {
771
- return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
772
- return ESCAPED_CHARS[match];
773
- });
328
+ return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
329
+ return ESCAPED_CHARS[match];
330
+ });
774
331
  }
775
332
 
776
333
  function filterProps(props, whitelist) {
777
- var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
334
+ var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
778
335
 
779
- return whitelist.reduce(function (filtered, name) {
780
- if (props.hasOwnProperty(name)) {
781
- filtered[name] = props[name];
782
- } else if (defaults$$1.hasOwnProperty(name)) {
783
- filtered[name] = defaults$$1[name];
784
- }
336
+ return whitelist.reduce(function (filtered, name) {
337
+ if (props.hasOwnProperty(name)) {
338
+ filtered[name] = props[name];
339
+ } else if (defaults$$1.hasOwnProperty(name)) {
340
+ filtered[name] = defaults$$1[name];
341
+ }
785
342
 
786
- return filtered;
787
- }, {});
343
+ return filtered;
344
+ }, {});
788
345
  }
789
346
 
790
347
  function invariantIntlContext() {
791
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
792
- intl = _ref.intl;
348
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
349
+ intl = _ref.intl;
793
350
 
794
- invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
351
+ invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
795
352
  }
796
353
 
797
354
  function shallowEquals(objA, objB) {
798
- if (objA === objB) {
799
- return true;
800
- }
355
+ if (objA === objB) {
356
+ return true;
357
+ }
801
358
 
802
- if ((typeof objA === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](objB)) !== 'object' || objB === null) {
803
- return false;
804
- }
359
+ if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
360
+ return false;
361
+ }
805
362
 
806
- var keysA = Object.keys(objA);
807
- var keysB = Object.keys(objB);
363
+ var keysA = Object.keys(objA);
364
+ var keysB = Object.keys(objB);
808
365
 
809
- if (keysA.length !== keysB.length) {
810
- return false;
811
- }
366
+ if (keysA.length !== keysB.length) {
367
+ return false;
368
+ }
812
369
 
813
- // Test for A's keys different from B.
814
- var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
815
- for (var i = 0; i < keysA.length; i++) {
816
- if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
817
- return false;
818
- }
370
+ // Test for A's keys different from B.
371
+ var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
372
+ for (var i = 0; i < keysA.length; i++) {
373
+ if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
374
+ return false;
819
375
  }
376
+ }
820
377
 
821
- return true;
378
+ return true;
822
379
  }
823
380
 
824
381
  function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
825
- var props = _ref2.props,
826
- state = _ref2.state,
827
- _ref2$context = _ref2.context,
828
- context = _ref2$context === undefined ? {} : _ref2$context;
829
- var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
830
- var _context$intl = context.intl,
831
- intl = _context$intl === undefined ? {} : _context$intl;
832
- var _nextContext$intl = nextContext.intl,
833
- nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
834
-
835
-
836
- return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
382
+ var props = _ref2.props,
383
+ state = _ref2.state,
384
+ _ref2$context = _ref2.context,
385
+ context = _ref2$context === undefined ? {} : _ref2$context;
386
+ var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
387
+ var _context$intl = context.intl,
388
+ intl = _context$intl === undefined ? {} : _context$intl;
389
+ var _nextContext$intl = nextContext.intl,
390
+ nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
391
+
392
+
393
+ return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
837
394
  }
838
395
 
839
396
  /*
@@ -846,54 +403,54 @@ function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
846
403
  // https://github.com/rackt/react-redux
847
404
 
848
405
  function getDisplayName(Component$$1) {
849
- return Component$$1.displayName || Component$$1.name || 'Component';
406
+ return Component$$1.displayName || Component$$1.name || 'Component';
850
407
  }
851
408
 
852
409
  function injectIntl(WrappedComponent) {
853
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
854
- var _options$intlPropName = options.intlPropName,
855
- intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
856
- _options$withRef = options.withRef,
857
- withRef = _options$withRef === undefined ? false : _options$withRef;
858
-
859
- var InjectIntl = function (_Component) {
860
- inherits(InjectIntl, _Component);
410
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
411
+ var _options$intlPropName = options.intlPropName,
412
+ intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
413
+ _options$withRef = options.withRef,
414
+ withRef = _options$withRef === undefined ? false : _options$withRef;
861
415
 
862
- function InjectIntl(props, context) {
863
- classCallCheck(this, InjectIntl);
416
+ var InjectIntl = function (_Component) {
417
+ inherits(InjectIntl, _Component);
864
418
 
865
- var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
419
+ function InjectIntl(props, context) {
420
+ classCallCheck(this, InjectIntl);
866
421
 
867
- invariantIntlContext(context);
868
- return _this;
869
- }
422
+ var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
870
423
 
871
- createClass(InjectIntl, [{
872
- key: 'getWrappedInstance',
873
- value: function getWrappedInstance() {
874
- invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
875
-
876
- return this.refs.wrappedInstance;
877
- }
878
- }, {
879
- key: 'render',
880
- value: function render() {
881
- return React.createElement(WrappedComponent, babelHelpers$1['extends']({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
882
- ref: withRef ? 'wrappedInstance' : null
883
- }));
884
- }
885
- }]);
886
- return InjectIntl;
887
- }(Component);
888
-
889
- InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
890
- InjectIntl.contextTypes = {
891
- intl: intlShape
892
- };
893
- InjectIntl.WrappedComponent = WrappedComponent;
424
+ invariantIntlContext(context);
425
+ return _this;
426
+ }
894
427
 
428
+ createClass(InjectIntl, [{
429
+ key: 'getWrappedInstance',
430
+ value: function getWrappedInstance() {
431
+ invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
895
432
 
433
+ return this.refs.wrappedInstance;
434
+ }
435
+ }, {
436
+ key: 'render',
437
+ value: function render() {
438
+ return React.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
439
+ ref: withRef ? 'wrappedInstance' : null
440
+ }));
441
+ }
442
+ }]);
896
443
  return InjectIntl;
444
+ }(Component);
445
+
446
+ InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
447
+ InjectIntl.contextTypes = {
448
+ intl: intlShape
449
+ };
450
+ InjectIntl.WrappedComponent = WrappedComponent;
451
+
452
+
453
+ return InjectIntl;
897
454
  }
898
455
 
899
456
  /*
@@ -917,25 +474,25 @@ function defineMessages(messageDescriptors) {
917
474
  // This is a "hack" until a proper `intl-pluralformat` package is created.
918
475
 
919
476
  function resolveLocale(locales) {
920
- // IntlMessageFormat#_resolveLocale() does not depend on `this`.
921
- return IntlMessageFormat.prototype._resolveLocale(locales);
477
+ // IntlMessageFormat#_resolveLocale() does not depend on `this`.
478
+ return IntlMessageFormat.prototype._resolveLocale(locales);
922
479
  }
923
480
 
924
481
  function findPluralFunction(locale) {
925
- // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
926
- return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
482
+ // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
483
+ return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
927
484
  }
928
485
 
929
486
  var IntlPluralFormat = function IntlPluralFormat(locales) {
930
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
931
- classCallCheck(this, IntlPluralFormat);
487
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
488
+ classCallCheck(this, IntlPluralFormat);
932
489
 
933
- var useOrdinal = options.style === 'ordinal';
934
- var pluralFn = findPluralFunction(resolveLocale(locales));
490
+ var useOrdinal = options.style === 'ordinal';
491
+ var pluralFn = findPluralFunction(resolveLocale(locales));
935
492
 
936
- this.format = function (value) {
937
- return pluralFn(value, useOrdinal);
938
- };
493
+ this.format = function (value) {
494
+ return pluralFn(value, useOrdinal);
495
+ };
939
496
  };
940
497
 
941
498
  /*
@@ -950,234 +507,234 @@ var RELATIVE_FORMAT_OPTIONS = Object.keys(relativeFormatPropTypes);
950
507
  var PLURAL_FORMAT_OPTIONS = Object.keys(pluralFormatPropTypes);
951
508
 
952
509
  var RELATIVE_FORMAT_THRESHOLDS = {
953
- second: 60, // seconds to minute
954
- minute: 60, // minutes to hour
955
- hour: 24, // hours to day
956
- day: 30, // days to month
957
- month: 12 };
510
+ second: 60, // seconds to minute
511
+ minute: 60, // minutes to hour
512
+ hour: 24, // hours to day
513
+ day: 30, // days to month
514
+ month: 12 // months to year
515
+ };
958
516
 
959
517
  function updateRelativeFormatThresholds(newThresholds) {
960
- var thresholds = IntlRelativeFormat.thresholds;
961
- thresholds.second = newThresholds.second;
962
- thresholds.minute = newThresholds.minute;
963
- thresholds.hour = newThresholds.hour;
964
- thresholds.day = newThresholds.day;
965
- thresholds.month = newThresholds.month;
518
+ var thresholds = IntlRelativeFormat.thresholds;
519
+ thresholds.second = newThresholds.second;
520
+ thresholds.minute = newThresholds.minute;
521
+ thresholds.hour = newThresholds.hour;
522
+ thresholds.day = newThresholds.day;
523
+ thresholds.month = newThresholds.month;
966
524
  }
967
525
 
968
526
  function getNamedFormat(formats, type, name) {
969
- var format = formats && formats[type] && formats[type][name];
970
- if (format) {
971
- return format;
972
- }
527
+ var format = formats && formats[type] && formats[type][name];
528
+ if (format) {
529
+ return format;
530
+ }
973
531
 
974
- if (process.env.NODE_ENV !== 'production') {
975
- console.error('[React Intl] No ' + type + ' format named: ' + name);
976
- }
532
+ if (process.env.NODE_ENV !== 'production') {
533
+ console.error('[React Intl] No ' + type + ' format named: ' + name);
534
+ }
977
535
  }
978
536
 
979
537
  function formatDate(config, state, value) {
980
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
981
- var locale = config.locale,
982
- formats = config.formats;
983
- var format = options.format;
538
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
539
+ var locale = config.locale,
540
+ formats = config.formats;
541
+ var format = options.format;
984
542
 
985
543
 
986
- var date = new Date(value);
987
- var defaults$$1 = format && getNamedFormat(formats, 'date', format);
988
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
544
+ var date = new Date(value);
545
+ var defaults$$1 = format && getNamedFormat(formats, 'date', format);
546
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
989
547
 
990
- try {
991
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
992
- } catch (e) {
993
- if (process.env.NODE_ENV !== 'production') {
994
- console.error('[React Intl] Error formatting date.\n' + e);
995
- }
548
+ try {
549
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
550
+ } catch (e) {
551
+ if (process.env.NODE_ENV !== 'production') {
552
+ console.error('[React Intl] Error formatting date.\n' + e);
996
553
  }
554
+ }
997
555
 
998
- return String(date);
556
+ return String(date);
999
557
  }
1000
558
 
1001
559
  function formatTime(config, state, value) {
1002
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1003
- var locale = config.locale,
1004
- formats = config.formats;
1005
- var format = options.format;
560
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
561
+ var locale = config.locale,
562
+ formats = config.formats;
563
+ var format = options.format;
1006
564
 
1007
565
 
1008
- var date = new Date(value);
1009
- var defaults$$1 = format && getNamedFormat(formats, 'time', format);
1010
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
566
+ var date = new Date(value);
567
+ var defaults$$1 = format && getNamedFormat(formats, 'time', format);
568
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
1011
569
 
1012
- if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
1013
- // Add default formatting options if hour, minute, or second isn't defined.
1014
- filteredOptions = babelHelpers$1['extends']({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
1015
- }
570
+ if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
571
+ // Add default formatting options if hour, minute, or second isn't defined.
572
+ filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
573
+ }
1016
574
 
1017
- try {
1018
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
1019
- } catch (e) {
1020
- if (process.env.NODE_ENV !== 'production') {
1021
- console.error('[React Intl] Error formatting time.\n' + e);
1022
- }
575
+ try {
576
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
577
+ } catch (e) {
578
+ if (process.env.NODE_ENV !== 'production') {
579
+ console.error('[React Intl] Error formatting time.\n' + e);
1023
580
  }
581
+ }
1024
582
 
1025
- return String(date);
583
+ return String(date);
1026
584
  }
1027
585
 
1028
586
  function formatRelative(config, state, value) {
1029
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1030
- var locale = config.locale,
1031
- formats = config.formats;
1032
- var format = options.format;
587
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
588
+ var locale = config.locale,
589
+ formats = config.formats;
590
+ var format = options.format;
1033
591
 
1034
592
 
1035
- var date = new Date(value);
1036
- var now = new Date(options.now);
1037
- var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
1038
- var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
593
+ var date = new Date(value);
594
+ var now = new Date(options.now);
595
+ var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
596
+ var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
1039
597
 
1040
- // Capture the current threshold values, then temporarily override them with
1041
- // specific values just for this render.
1042
- var oldThresholds = babelHelpers$1['extends']({}, IntlRelativeFormat.thresholds);
1043
- updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
598
+ // Capture the current threshold values, then temporarily override them with
599
+ // specific values just for this render.
600
+ var oldThresholds = _extends({}, IntlRelativeFormat.thresholds);
601
+ updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
1044
602
 
1045
- try {
1046
- return state.getRelativeFormat(locale, filteredOptions).format(date, {
1047
- now: isFinite(now) ? now : state.now()
1048
- });
1049
- } catch (e) {
1050
- if (process.env.NODE_ENV !== 'production') {
1051
- console.error('[React Intl] Error formatting relative time.\n' + e);
1052
- }
1053
- } finally {
1054
- updateRelativeFormatThresholds(oldThresholds);
603
+ try {
604
+ return state.getRelativeFormat(locale, filteredOptions).format(date, {
605
+ now: isFinite(now) ? now : state.now()
606
+ });
607
+ } catch (e) {
608
+ if (process.env.NODE_ENV !== 'production') {
609
+ console.error('[React Intl] Error formatting relative time.\n' + e);
1055
610
  }
611
+ } finally {
612
+ updateRelativeFormatThresholds(oldThresholds);
613
+ }
1056
614
 
1057
- return String(date);
615
+ return String(date);
1058
616
  }
1059
617
 
1060
618
  function formatNumber(config, state, value) {
1061
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1062
- var locale = config.locale,
1063
- formats = config.formats;
1064
- var format = options.format;
619
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
620
+ var locale = config.locale,
621
+ formats = config.formats;
622
+ var format = options.format;
1065
623
 
1066
624
 
1067
- var defaults$$1 = format && getNamedFormat(formats, 'number', format);
1068
- var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
625
+ var defaults$$1 = format && getNamedFormat(formats, 'number', format);
626
+ var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
1069
627
 
1070
- try {
1071
- return state.getNumberFormat(locale, filteredOptions).format(value);
1072
- } catch (e) {
1073
- if (process.env.NODE_ENV !== 'production') {
1074
- console.error('[React Intl] Error formatting number.\n' + e);
1075
- }
628
+ try {
629
+ return state.getNumberFormat(locale, filteredOptions).format(value);
630
+ } catch (e) {
631
+ if (process.env.NODE_ENV !== 'production') {
632
+ console.error('[React Intl] Error formatting number.\n' + e);
1076
633
  }
634
+ }
1077
635
 
1078
- return String(value);
636
+ return String(value);
1079
637
  }
1080
638
 
1081
639
  function formatPlural(config, state, value) {
1082
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1083
- var locale = config.locale;
640
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
641
+ var locale = config.locale;
1084
642
 
1085
643
 
1086
- var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
644
+ var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
1087
645
 
1088
- try {
1089
- return state.getPluralFormat(locale, filteredOptions).format(value);
1090
- } catch (e) {
1091
- if (process.env.NODE_ENV !== 'production') {
1092
- console.error('[React Intl] Error formatting plural.\n' + e);
1093
- }
646
+ try {
647
+ return state.getPluralFormat(locale, filteredOptions).format(value);
648
+ } catch (e) {
649
+ if (process.env.NODE_ENV !== 'production') {
650
+ console.error('[React Intl] Error formatting plural.\n' + e);
1094
651
  }
652
+ }
1095
653
 
1096
- return 'other';
654
+ return 'other';
1097
655
  }
1098
656
 
1099
657
  function formatMessage(config, state) {
1100
- var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1101
- var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1102
- var locale = config.locale,
1103
- formats = config.formats,
1104
- messages = config.messages,
1105
- defaultLocale = config.defaultLocale,
1106
- defaultFormats = config.defaultFormats;
1107
- var id = messageDescriptor.id,
1108
- defaultMessage = messageDescriptor.defaultMessage;
1109
-
1110
- // `id` is a required field of a Message Descriptor.
1111
-
1112
- invariant(id, '[React Intl] An `id` must be provided to format a message.');
1113
-
1114
- var message = messages && messages[id];
1115
- var hasValues = Object.keys(values).length > 0;
1116
-
1117
- // Avoid expensive message formatting for simple messages without values. In
1118
- // development messages will always be formatted in case of missing values.
1119
- if (!hasValues && process.env.NODE_ENV === 'production') {
1120
- return message || defaultMessage || id;
1121
- }
1122
-
1123
- var formattedMessage = void 0;
658
+ var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
659
+ var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
660
+ var locale = config.locale,
661
+ formats = config.formats,
662
+ messages = config.messages,
663
+ defaultLocale = config.defaultLocale,
664
+ defaultFormats = config.defaultFormats;
665
+ var id = messageDescriptor.id,
666
+ defaultMessage = messageDescriptor.defaultMessage;
667
+
668
+ // `id` is a required field of a Message Descriptor.
669
+
670
+ invariant(id, '[React Intl] An `id` must be provided to format a message.');
671
+
672
+ var message = messages && messages[id];
673
+ var hasValues = Object.keys(values).length > 0;
674
+
675
+ // Avoid expensive message formatting for simple messages without values. In
676
+ // development messages will always be formatted in case of missing values.
677
+ if (!hasValues && process.env.NODE_ENV === 'production') {
678
+ return message || defaultMessage || id;
679
+ }
1124
680
 
1125
- if (message) {
1126
- try {
1127
- var formatter = state.getMessageFormat(message, locale, formats);
681
+ var formattedMessage = void 0;
1128
682
 
1129
- formattedMessage = formatter.format(values);
1130
- } catch (e) {
1131
- if (process.env.NODE_ENV !== 'production') {
1132
- console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
1133
- }
1134
- }
1135
- } else {
1136
- if (process.env.NODE_ENV !== 'production') {
1137
- // This prevents warnings from littering the console in development
1138
- // when no `messages` are passed into the <IntlProvider> for the
1139
- // default locale, and a default message is in the source.
1140
- if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
683
+ if (message) {
684
+ try {
685
+ var formatter = state.getMessageFormat(message, locale, formats);
1141
686
 
1142
- console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
1143
- }
1144
- }
687
+ formattedMessage = formatter.format(values);
688
+ } catch (e) {
689
+ if (process.env.NODE_ENV !== 'production') {
690
+ console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
691
+ }
692
+ }
693
+ } else {
694
+ if (process.env.NODE_ENV !== 'production') {
695
+ // This prevents warnings from littering the console in development
696
+ // when no `messages` are passed into the <IntlProvider> for the
697
+ // default locale, and a default message is in the source.
698
+ if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
699
+ console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
700
+ }
1145
701
  }
702
+ }
1146
703
 
1147
- if (!formattedMessage && defaultMessage) {
1148
- try {
1149
- var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
704
+ if (!formattedMessage && defaultMessage) {
705
+ try {
706
+ var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
1150
707
 
1151
- formattedMessage = _formatter.format(values);
1152
- } catch (e) {
1153
- if (process.env.NODE_ENV !== 'production') {
1154
- console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
1155
- }
1156
- }
708
+ formattedMessage = _formatter.format(values);
709
+ } catch (e) {
710
+ if (process.env.NODE_ENV !== 'production') {
711
+ console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
712
+ }
1157
713
  }
714
+ }
1158
715
 
1159
- if (!formattedMessage) {
1160
- if (process.env.NODE_ENV !== 'production') {
1161
- console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
1162
- }
716
+ if (!formattedMessage) {
717
+ if (process.env.NODE_ENV !== 'production') {
718
+ console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
1163
719
  }
720
+ }
1164
721
 
1165
- return formattedMessage || message || defaultMessage || id;
722
+ return formattedMessage || message || defaultMessage || id;
1166
723
  }
1167
724
 
1168
725
  function formatHTMLMessage(config, state, messageDescriptor) {
1169
- var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1170
-
1171
- // Process all the values before they are used when formatting the ICU
1172
- // Message string. Since the formatted message might be injected via
1173
- // `innerHTML`, all String-based values need to be HTML-escaped.
1174
- var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
1175
- var value = rawValues[name];
1176
- escaped[name] = typeof value === 'string' ? escape(value) : value;
1177
- return escaped;
1178
- }, {});
1179
-
1180
- return formatMessage(config, state, messageDescriptor, escapedValues);
726
+ var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
727
+
728
+ // Process all the values before they are used when formatting the ICU
729
+ // Message string. Since the formatted message might be injected via
730
+ // `innerHTML`, all String-based values need to be HTML-escaped.
731
+ var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
732
+ var value = rawValues[name];
733
+ escaped[name] = typeof value === 'string' ? escape(value) : value;
734
+ return escaped;
735
+ }, {});
736
+
737
+ return formatMessage(config, state, messageDescriptor, escapedValues);
1181
738
  }
1182
739
 
1183
740
 
@@ -1204,170 +761,170 @@ var intlFormatPropNames = Object.keys(intlFormatPropTypes);
1204
761
  // These are not a static property on the `IntlProvider` class so the intl
1205
762
  // config values can be inherited from an <IntlProvider> ancestor.
1206
763
  var defaultProps = {
1207
- formats: {},
1208
- messages: {},
1209
- textComponent: 'span',
764
+ formats: {},
765
+ messages: {},
766
+ textComponent: 'span',
1210
767
 
1211
- defaultLocale: 'en',
1212
- defaultFormats: {}
768
+ defaultLocale: 'en',
769
+ defaultFormats: {}
1213
770
  };
1214
771
 
1215
772
  var IntlProvider = function (_Component) {
1216
- inherits(IntlProvider, _Component);
1217
-
1218
- function IntlProvider(props) {
1219
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1220
- classCallCheck(this, IntlProvider);
773
+ inherits(IntlProvider, _Component);
1221
774
 
1222
- var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
775
+ function IntlProvider(props) {
776
+ var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
777
+ classCallCheck(this, IntlProvider);
1223
778
 
1224
- 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/');
779
+ var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
1225
780
 
1226
- var intlContext = context.intl;
781
+ 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/');
1227
782
 
1228
- // Used to stabilize time when performing an initial rendering so that
1229
- // all relative times use the same reference "now" time.
783
+ var intlContext = context.intl;
1230
784
 
1231
- var initialNow = void 0;
1232
- if (isFinite(props.initialNow)) {
1233
- initialNow = Number(props.initialNow);
1234
- } else {
1235
- // When an `initialNow` isn't provided via `props`, look to see an
1236
- // <IntlProvider> exists in the ancestry and call its `now()`
1237
- // function to propagate its value for "now".
1238
- initialNow = intlContext ? intlContext.now() : Date.now();
1239
- }
785
+ // Used to stabilize time when performing an initial rendering so that
786
+ // all relative times use the same reference "now" time.
1240
787
 
1241
- // Creating `Intl*` formatters is expensive. If there's a parent
1242
- // `<IntlProvider>`, then its formatters will be used. Otherwise, this
1243
- // memoize the `Intl*` constructors and cache them for the lifecycle of
1244
- // this IntlProvider instance.
1245
-
1246
- var _ref = intlContext || {},
1247
- _ref$formatters = _ref.formatters,
1248
- formatters = _ref$formatters === undefined ? {
1249
- getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
1250
- getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
1251
- getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
1252
- getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
1253
- getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
1254
- } : _ref$formatters;
1255
-
1256
- _this.state = babelHelpers$1['extends']({}, formatters, {
1257
-
1258
- // Wrapper to provide stable "now" time for initial render.
1259
- now: function now() {
1260
- return _this._didDisplay ? Date.now() : initialNow;
1261
- }
1262
- });
1263
- return _this;
788
+ var initialNow = void 0;
789
+ if (isFinite(props.initialNow)) {
790
+ initialNow = Number(props.initialNow);
791
+ } else {
792
+ // When an `initialNow` isn't provided via `props`, look to see an
793
+ // <IntlProvider> exists in the ancestry and call its `now()`
794
+ // function to propagate its value for "now".
795
+ initialNow = intlContext ? intlContext.now() : Date.now();
1264
796
  }
1265
797
 
1266
- createClass(IntlProvider, [{
1267
- key: 'getConfig',
1268
- value: function getConfig() {
1269
- var intlContext = this.context.intl;
1270
-
1271
- // Build a whitelisted config object from `props`, defaults, and
1272
- // `context.intl`, if an <IntlProvider> exists in the ancestry.
1273
-
1274
- var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
1275
-
1276
- // Apply default props. This must be applied last after the props have
1277
- // been resolved and inherited from any <IntlProvider> in the ancestry.
1278
- // This matches how React resolves `defaultProps`.
1279
- for (var propName in defaultProps) {
1280
- if (config[propName] === undefined) {
1281
- config[propName] = defaultProps[propName];
1282
- }
1283
- }
1284
-
1285
- if (!hasLocaleData(config.locale)) {
1286
- var _config = config,
1287
- locale = _config.locale,
1288
- defaultLocale = _config.defaultLocale,
1289
- defaultFormats = _config.defaultFormats;
1290
-
1291
-
1292
- if (process.env.NODE_ENV !== 'production') {
1293
- console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
1294
- }
1295
-
1296
- // Since there's no registered locale data for `locale`, this will
1297
- // fallback to the `defaultLocale` to make sure things can render.
1298
- // The `messages` are overridden to the `defaultProps` empty object
1299
- // to maintain referential equality across re-renders. It's assumed
1300
- // each <FormattedMessage> contains a `defaultMessage` prop.
1301
- config = babelHelpers$1['extends']({}, config, {
1302
- locale: defaultLocale,
1303
- formats: defaultFormats,
1304
- messages: defaultProps.messages
1305
- });
1306
- }
1307
-
1308
- return config;
1309
- }
1310
- }, {
1311
- key: 'getBoundFormatFns',
1312
- value: function getBoundFormatFns(config, state) {
1313
- return intlFormatPropNames.reduce(function (boundFormatFns, name) {
1314
- boundFormatFns[name] = format[name].bind(null, config, state);
1315
- return boundFormatFns;
1316
- }, {});
1317
- }
1318
- }, {
1319
- key: 'getChildContext',
1320
- value: function getChildContext() {
1321
- var config = this.getConfig();
798
+ // Creating `Intl*` formatters is expensive. If there's a parent
799
+ // `<IntlProvider>`, then its formatters will be used. Otherwise, this
800
+ // memoize the `Intl*` constructors and cache them for the lifecycle of
801
+ // this IntlProvider instance.
802
+
803
+ var _ref = intlContext || {},
804
+ _ref$formatters = _ref.formatters,
805
+ formatters = _ref$formatters === undefined ? {
806
+ getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
807
+ getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
808
+ getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
809
+ getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
810
+ getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
811
+ } : _ref$formatters;
812
+
813
+ _this.state = _extends({}, formatters, {
814
+
815
+ // Wrapper to provide stable "now" time for initial render.
816
+ now: function now() {
817
+ return _this._didDisplay ? Date.now() : initialNow;
818
+ }
819
+ });
820
+ return _this;
821
+ }
1322
822
 
1323
- // Bind intl factories and current config to the format functions.
1324
- var boundFormatFns = this.getBoundFormatFns(config, this.state);
823
+ createClass(IntlProvider, [{
824
+ key: 'getConfig',
825
+ value: function getConfig() {
826
+ var intlContext = this.context.intl;
1325
827
 
1326
- var _state = this.state,
1327
- now = _state.now,
1328
- formatters = objectWithoutProperties(_state, ['now']);
828
+ // Build a whitelisted config object from `props`, defaults, and
829
+ // `context.intl`, if an <IntlProvider> exists in the ancestry.
1329
830
 
831
+ var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
1330
832
 
1331
- return {
1332
- intl: babelHelpers$1['extends']({}, config, boundFormatFns, {
1333
- formatters: formatters,
1334
- now: now
1335
- })
1336
- };
833
+ // Apply default props. This must be applied last after the props have
834
+ // been resolved and inherited from any <IntlProvider> in the ancestry.
835
+ // This matches how React resolves `defaultProps`.
836
+ for (var propName in defaultProps) {
837
+ if (config[propName] === undefined) {
838
+ config[propName] = defaultProps[propName];
1337
839
  }
1338
- }, {
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
- }
840
+ }
1344
841
 
1345
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1346
- }
1347
- }, {
1348
- key: 'componentDidMount',
1349
- value: function componentDidMount() {
1350
- this._didDisplay = true;
1351
- }
1352
- }, {
1353
- key: 'render',
1354
- value: function render() {
1355
- return Children.only(this.props.children);
842
+ if (!hasLocaleData(config.locale)) {
843
+ var _config = config,
844
+ locale = _config.locale,
845
+ defaultLocale = _config.defaultLocale,
846
+ defaultFormats = _config.defaultFormats;
847
+
848
+
849
+ if (process.env.NODE_ENV !== 'production') {
850
+ console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
1356
851
  }
1357
- }]);
1358
- return IntlProvider;
852
+
853
+ // Since there's no registered locale data for `locale`, this will
854
+ // fallback to the `defaultLocale` to make sure things can render.
855
+ // The `messages` are overridden to the `defaultProps` empty object
856
+ // to maintain referential equality across re-renders. It's assumed
857
+ // each <FormattedMessage> contains a `defaultMessage` prop.
858
+ config = _extends({}, config, {
859
+ locale: defaultLocale,
860
+ formats: defaultFormats,
861
+ messages: defaultProps.messages
862
+ });
863
+ }
864
+
865
+ return config;
866
+ }
867
+ }, {
868
+ key: 'getBoundFormatFns',
869
+ value: function getBoundFormatFns(config, state) {
870
+ return intlFormatPropNames.reduce(function (boundFormatFns, name) {
871
+ boundFormatFns[name] = format[name].bind(null, config, state);
872
+ return boundFormatFns;
873
+ }, {});
874
+ }
875
+ }, {
876
+ key: 'getChildContext',
877
+ value: function getChildContext() {
878
+ var config = this.getConfig();
879
+
880
+ // Bind intl factories and current config to the format functions.
881
+ var boundFormatFns = this.getBoundFormatFns(config, this.state);
882
+
883
+ var _state = this.state,
884
+ now = _state.now,
885
+ formatters = objectWithoutProperties(_state, ['now']);
886
+
887
+
888
+ return {
889
+ intl: _extends({}, config, boundFormatFns, {
890
+ formatters: formatters,
891
+ now: now
892
+ })
893
+ };
894
+ }
895
+ }, {
896
+ key: 'shouldComponentUpdate',
897
+ value: function shouldComponentUpdate() {
898
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
899
+ next[_key] = arguments[_key];
900
+ }
901
+
902
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
903
+ }
904
+ }, {
905
+ key: 'componentDidMount',
906
+ value: function componentDidMount() {
907
+ this._didDisplay = true;
908
+ }
909
+ }, {
910
+ key: 'render',
911
+ value: function render() {
912
+ return Children.only(this.props.children);
913
+ }
914
+ }]);
915
+ return IntlProvider;
1359
916
  }(Component);
1360
917
 
1361
918
  IntlProvider.displayName = 'IntlProvider';
1362
919
  IntlProvider.contextTypes = {
1363
- intl: intlShape
920
+ intl: intlShape
1364
921
  };
1365
922
  IntlProvider.childContextTypes = {
1366
- intl: intlShape.isRequired
923
+ intl: intlShape.isRequired
1367
924
  };
1368
- process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = babelHelpers$1['extends']({}, intlConfigPropTypes, {
1369
- children: PropTypes.element.isRequired,
1370
- initialNow: PropTypes.any
925
+ process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
926
+ children: PropTypes.element.isRequired,
927
+ initialNow: PropTypes.any
1371
928
  }) : void 0;
1372
929
 
1373
930
  /*
@@ -1377,61 +934,61 @@ process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = babelHelpers$1[
1377
934
  */
1378
935
 
1379
936
  var FormattedDate = function (_Component) {
1380
- inherits(FormattedDate, _Component);
937
+ inherits(FormattedDate, _Component);
1381
938
 
1382
- function FormattedDate(props, context) {
1383
- classCallCheck(this, FormattedDate);
939
+ function FormattedDate(props, context) {
940
+ classCallCheck(this, FormattedDate);
1384
941
 
1385
- var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
942
+ var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
1386
943
 
1387
- invariantIntlContext(context);
1388
- return _this;
944
+ invariantIntlContext(context);
945
+ return _this;
946
+ }
947
+
948
+ createClass(FormattedDate, [{
949
+ key: 'shouldComponentUpdate',
950
+ value: function shouldComponentUpdate() {
951
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
952
+ next[_key] = arguments[_key];
953
+ }
954
+
955
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1389
956
  }
957
+ }, {
958
+ key: 'render',
959
+ value: function render() {
960
+ var _context$intl = this.context.intl,
961
+ formatDate = _context$intl.formatDate,
962
+ Text = _context$intl.textComponent;
963
+ var _props = this.props,
964
+ value = _props.value,
965
+ children = _props.children;
1390
966
 
1391
- createClass(FormattedDate, [{
1392
- key: 'shouldComponentUpdate',
1393
- value: function shouldComponentUpdate() {
1394
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1395
- next[_key] = arguments[_key];
1396
- }
1397
967
 
1398
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1399
- }
1400
- }, {
1401
- key: 'render',
1402
- value: function render() {
1403
- var _context$intl = this.context.intl,
1404
- formatDate = _context$intl.formatDate,
1405
- Text = _context$intl.textComponent;
1406
- var _props = this.props,
1407
- value = _props.value,
1408
- children = _props.children;
1409
-
1410
-
1411
- var formattedDate = formatDate(value, this.props);
1412
-
1413
- if (typeof children === 'function') {
1414
- return children(formattedDate);
1415
- }
1416
-
1417
- return React.createElement(
1418
- Text,
1419
- null,
1420
- formattedDate
1421
- );
1422
- }
1423
- }]);
1424
- return FormattedDate;
968
+ var formattedDate = formatDate(value, this.props);
969
+
970
+ if (typeof children === 'function') {
971
+ return children(formattedDate);
972
+ }
973
+
974
+ return React.createElement(
975
+ Text,
976
+ null,
977
+ formattedDate
978
+ );
979
+ }
980
+ }]);
981
+ return FormattedDate;
1425
982
  }(Component);
1426
983
 
1427
984
  FormattedDate.displayName = 'FormattedDate';
1428
985
  FormattedDate.contextTypes = {
1429
- intl: intlShape
986
+ intl: intlShape
1430
987
  };
1431
- process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = babelHelpers$1['extends']({}, dateTimeFormatPropTypes, {
1432
- value: PropTypes.any.isRequired,
1433
- format: PropTypes.string,
1434
- children: PropTypes.func
988
+ process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
989
+ value: PropTypes.any.isRequired,
990
+ format: PropTypes.string,
991
+ children: PropTypes.func
1435
992
  }) : void 0;
1436
993
 
1437
994
  /*
@@ -1441,61 +998,61 @@ process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = babelHelpers$1
1441
998
  */
1442
999
 
1443
1000
  var FormattedTime = function (_Component) {
1444
- inherits(FormattedTime, _Component);
1001
+ inherits(FormattedTime, _Component);
1445
1002
 
1446
- function FormattedTime(props, context) {
1447
- classCallCheck(this, FormattedTime);
1003
+ function FormattedTime(props, context) {
1004
+ classCallCheck(this, FormattedTime);
1448
1005
 
1449
- var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1006
+ var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1450
1007
 
1451
- invariantIntlContext(context);
1452
- return _this;
1008
+ invariantIntlContext(context);
1009
+ return _this;
1010
+ }
1011
+
1012
+ createClass(FormattedTime, [{
1013
+ key: 'shouldComponentUpdate',
1014
+ value: function shouldComponentUpdate() {
1015
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1016
+ next[_key] = arguments[_key];
1017
+ }
1018
+
1019
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1453
1020
  }
1021
+ }, {
1022
+ key: 'render',
1023
+ value: function render() {
1024
+ var _context$intl = this.context.intl,
1025
+ formatTime = _context$intl.formatTime,
1026
+ Text = _context$intl.textComponent;
1027
+ var _props = this.props,
1028
+ value = _props.value,
1029
+ children = _props.children;
1454
1030
 
1455
- createClass(FormattedTime, [{
1456
- key: 'shouldComponentUpdate',
1457
- value: function shouldComponentUpdate() {
1458
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1459
- next[_key] = arguments[_key];
1460
- }
1461
1031
 
1462
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1463
- }
1464
- }, {
1465
- key: 'render',
1466
- value: function render() {
1467
- var _context$intl = this.context.intl,
1468
- formatTime = _context$intl.formatTime,
1469
- Text = _context$intl.textComponent;
1470
- var _props = this.props,
1471
- value = _props.value,
1472
- children = _props.children;
1473
-
1474
-
1475
- var formattedTime = formatTime(value, this.props);
1476
-
1477
- if (typeof children === 'function') {
1478
- return children(formattedTime);
1479
- }
1480
-
1481
- return React.createElement(
1482
- Text,
1483
- null,
1484
- formattedTime
1485
- );
1486
- }
1487
- }]);
1488
- return FormattedTime;
1032
+ var formattedTime = formatTime(value, this.props);
1033
+
1034
+ if (typeof children === 'function') {
1035
+ return children(formattedTime);
1036
+ }
1037
+
1038
+ return React.createElement(
1039
+ Text,
1040
+ null,
1041
+ formattedTime
1042
+ );
1043
+ }
1044
+ }]);
1045
+ return FormattedTime;
1489
1046
  }(Component);
1490
1047
 
1491
1048
  FormattedTime.displayName = 'FormattedTime';
1492
1049
  FormattedTime.contextTypes = {
1493
- intl: intlShape
1050
+ intl: intlShape
1494
1051
  };
1495
- process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = babelHelpers$1['extends']({}, dateTimeFormatPropTypes, {
1496
- value: PropTypes.any.isRequired,
1497
- format: PropTypes.string,
1498
- children: PropTypes.func
1052
+ process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
1053
+ value: PropTypes.any.isRequired,
1054
+ format: PropTypes.string,
1055
+ children: PropTypes.func
1499
1056
  }) : void 0;
1500
1057
 
1501
1058
  /*
@@ -1514,177 +1071,179 @@ var DAY = 1000 * 60 * 60 * 24;
1514
1071
  var MAX_TIMER_DELAY = 2147483647;
1515
1072
 
1516
1073
  function selectUnits(delta) {
1517
- var absDelta = Math.abs(delta);
1074
+ var absDelta = Math.abs(delta);
1518
1075
 
1519
- if (absDelta < MINUTE) {
1520
- return 'second';
1521
- }
1076
+ if (absDelta < MINUTE) {
1077
+ return 'second';
1078
+ }
1522
1079
 
1523
- if (absDelta < HOUR) {
1524
- return 'minute';
1525
- }
1080
+ if (absDelta < HOUR) {
1081
+ return 'minute';
1082
+ }
1526
1083
 
1527
- if (absDelta < DAY) {
1528
- return 'hour';
1529
- }
1084
+ if (absDelta < DAY) {
1085
+ return 'hour';
1086
+ }
1530
1087
 
1531
- // The maximum scheduled delay will be measured in days since the maximum
1532
- // timer delay is less than the number of milliseconds in 25 days.
1533
- return 'day';
1088
+ // The maximum scheduled delay will be measured in days since the maximum
1089
+ // timer delay is less than the number of milliseconds in 25 days.
1090
+ return 'day';
1534
1091
  }
1535
1092
 
1536
1093
  function getUnitDelay(units) {
1537
- switch (units) {
1538
- case 'second':
1539
- return SECOND;
1540
- case 'minute':
1541
- return MINUTE;
1542
- case 'hour':
1543
- return HOUR;
1544
- case 'day':
1545
- return DAY;
1546
- default:
1547
- return MAX_TIMER_DELAY;
1548
- }
1094
+ switch (units) {
1095
+ case 'second':
1096
+ return SECOND;
1097
+ case 'minute':
1098
+ return MINUTE;
1099
+ case 'hour':
1100
+ return HOUR;
1101
+ case 'day':
1102
+ return DAY;
1103
+ default:
1104
+ return MAX_TIMER_DELAY;
1105
+ }
1549
1106
  }
1550
1107
 
1551
1108
  function isSameDate(a, b) {
1552
- if (a === b) {
1553
- return true;
1554
- }
1109
+ if (a === b) {
1110
+ return true;
1111
+ }
1555
1112
 
1556
- var aTime = new Date(a).getTime();
1557
- var bTime = new Date(b).getTime();
1113
+ var aTime = new Date(a).getTime();
1114
+ var bTime = new Date(b).getTime();
1558
1115
 
1559
- return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1116
+ return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1560
1117
  }
1561
1118
 
1562
1119
  var FormattedRelative = function (_Component) {
1563
- inherits(FormattedRelative, _Component);
1120
+ inherits(FormattedRelative, _Component);
1564
1121
 
1565
- function FormattedRelative(props, context) {
1566
- classCallCheck(this, FormattedRelative);
1122
+ function FormattedRelative(props, context) {
1123
+ classCallCheck(this, FormattedRelative);
1567
1124
 
1568
- var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1125
+ var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1569
1126
 
1570
- invariantIntlContext(context);
1127
+ invariantIntlContext(context);
1571
1128
 
1572
- var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1129
+ var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1573
1130
 
1574
- // `now` is stored as state so that `render()` remains a function of
1575
- // props + state, instead of accessing `Date.now()` inside `render()`.
1576
- _this.state = { now: now };
1577
- return _this;
1578
- }
1131
+ // `now` is stored as state so that `render()` remains a function of
1132
+ // props + state, instead of accessing `Date.now()` inside `render()`.
1133
+ _this.state = { now: now };
1134
+ return _this;
1135
+ }
1579
1136
 
1580
- createClass(FormattedRelative, [{
1581
- key: 'scheduleNextUpdate',
1582
- value: function scheduleNextUpdate(props, state) {
1583
- var _this2 = this;
1137
+ createClass(FormattedRelative, [{
1138
+ key: 'scheduleNextUpdate',
1139
+ value: function scheduleNextUpdate(props, state) {
1140
+ var _this2 = this;
1584
1141
 
1585
- var updateInterval = props.updateInterval;
1142
+ // Cancel and pending update because we're scheduling a new update.
1143
+ clearTimeout(this._timer);
1586
1144
 
1587
- // If the `updateInterval` is falsy, including `0`, then auto updates
1588
- // have been turned off, so we bail and skip scheduling an update.
1145
+ var value = props.value,
1146
+ units = props.units,
1147
+ updateInterval = props.updateInterval;
1589
1148
 
1590
- if (!updateInterval) {
1591
- return;
1592
- }
1149
+ var time = new Date(value).getTime();
1593
1150
 
1594
- var time = new Date(props.value).getTime();
1595
- var delta = time - state.now;
1596
- var units = props.units || selectUnits(delta);
1151
+ // If the `updateInterval` is falsy, including `0` or we don't have a
1152
+ // valid date, then auto updates have been turned off, so we bail and
1153
+ // skip scheduling an update.
1154
+ if (!updateInterval || !isFinite(time)) {
1155
+ return;
1156
+ }
1597
1157
 
1598
- var unitDelay = getUnitDelay(units);
1599
- var unitRemainder = Math.abs(delta % unitDelay);
1158
+ var delta = time - state.now;
1159
+ var unitDelay = getUnitDelay(units || selectUnits(delta));
1160
+ var unitRemainder = Math.abs(delta % unitDelay);
1600
1161
 
1601
- // We want the largest possible timer delay which will still display
1602
- // accurate information while reducing unnecessary re-renders. The delay
1603
- // should be until the next "interesting" moment, like a tick from
1604
- // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1605
- var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1162
+ // We want the largest possible timer delay which will still display
1163
+ // accurate information while reducing unnecessary re-renders. The delay
1164
+ // should be until the next "interesting" moment, like a tick from
1165
+ // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1166
+ var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1606
1167
 
1607
- clearTimeout(this._timer);
1168
+ this._timer = setTimeout(function () {
1169
+ _this2.setState({ now: _this2.context.intl.now() });
1170
+ }, delay);
1171
+ }
1172
+ }, {
1173
+ key: 'componentDidMount',
1174
+ value: function componentDidMount() {
1175
+ this.scheduleNextUpdate(this.props, this.state);
1176
+ }
1177
+ }, {
1178
+ key: 'componentWillReceiveProps',
1179
+ value: function componentWillReceiveProps(_ref) {
1180
+ var nextValue = _ref.value;
1181
+
1182
+ // When the `props.value` date changes, `state.now` needs to be updated,
1183
+ // and the next update can be rescheduled.
1184
+ if (!isSameDate(nextValue, this.props.value)) {
1185
+ this.setState({ now: this.context.intl.now() });
1186
+ }
1187
+ }
1188
+ }, {
1189
+ key: 'shouldComponentUpdate',
1190
+ value: function shouldComponentUpdate() {
1191
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1192
+ next[_key] = arguments[_key];
1193
+ }
1608
1194
 
1609
- this._timer = setTimeout(function () {
1610
- _this2.setState({ now: _this2.context.intl.now() });
1611
- }, delay);
1612
- }
1613
- }, {
1614
- key: 'componentDidMount',
1615
- value: function componentDidMount() {
1616
- this.scheduleNextUpdate(this.props, this.state);
1617
- }
1618
- }, {
1619
- key: 'componentWillReceiveProps',
1620
- value: function componentWillReceiveProps(_ref) {
1621
- var nextValue = _ref.value;
1622
-
1623
- // When the `props.value` date changes, `state.now` needs to be updated,
1624
- // and the next update can be rescheduled.
1625
- if (!isSameDate(nextValue, this.props.value)) {
1626
- this.setState({ now: this.context.intl.now() });
1627
- }
1628
- }
1629
- }, {
1630
- key: 'shouldComponentUpdate',
1631
- value: function shouldComponentUpdate() {
1632
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1633
- next[_key] = arguments[_key];
1634
- }
1195
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1196
+ }
1197
+ }, {
1198
+ key: 'componentWillUpdate',
1199
+ value: function componentWillUpdate(nextProps, nextState) {
1200
+ this.scheduleNextUpdate(nextProps, nextState);
1201
+ }
1202
+ }, {
1203
+ key: 'componentWillUnmount',
1204
+ value: function componentWillUnmount() {
1205
+ clearTimeout(this._timer);
1206
+ }
1207
+ }, {
1208
+ key: 'render',
1209
+ value: function render() {
1210
+ var _context$intl = this.context.intl,
1211
+ formatRelative = _context$intl.formatRelative,
1212
+ Text = _context$intl.textComponent;
1213
+ var _props = this.props,
1214
+ value = _props.value,
1215
+ children = _props.children;
1635
1216
 
1636
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1637
- }
1638
- }, {
1639
- key: 'componentWillUpdate',
1640
- value: function componentWillUpdate(nextProps, nextState) {
1641
- this.scheduleNextUpdate(nextProps, nextState);
1642
- }
1643
- }, {
1644
- key: 'componentWillUnmount',
1645
- value: function componentWillUnmount() {
1646
- clearTimeout(this._timer);
1647
- }
1648
- }, {
1649
- key: 'render',
1650
- value: function render() {
1651
- var _context$intl = this.context.intl,
1652
- formatRelative = _context$intl.formatRelative,
1653
- Text = _context$intl.textComponent;
1654
- var _props = this.props,
1655
- value = _props.value,
1656
- children = _props.children;
1657
-
1658
-
1659
- var formattedRelative = formatRelative(value, babelHelpers$1['extends']({}, this.props, this.state));
1660
-
1661
- if (typeof children === 'function') {
1662
- return children(formattedRelative);
1663
- }
1664
-
1665
- return React.createElement(
1666
- Text,
1667
- null,
1668
- formattedRelative
1669
- );
1670
- }
1671
- }]);
1672
- return FormattedRelative;
1217
+
1218
+ var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
1219
+
1220
+ if (typeof children === 'function') {
1221
+ return children(formattedRelative);
1222
+ }
1223
+
1224
+ return React.createElement(
1225
+ Text,
1226
+ null,
1227
+ formattedRelative
1228
+ );
1229
+ }
1230
+ }]);
1231
+ return FormattedRelative;
1673
1232
  }(Component);
1674
1233
 
1675
1234
  FormattedRelative.displayName = 'FormattedRelative';
1676
1235
  FormattedRelative.contextTypes = {
1677
- intl: intlShape
1236
+ intl: intlShape
1678
1237
  };
1679
1238
  FormattedRelative.defaultProps = {
1680
- updateInterval: 1000 * 10
1239
+ updateInterval: 1000 * 10
1681
1240
  };
1682
- process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = babelHelpers$1['extends']({}, relativeFormatPropTypes, {
1683
- value: PropTypes.any.isRequired,
1684
- format: PropTypes.string,
1685
- updateInterval: PropTypes.number,
1686
- initialNow: PropTypes.any,
1687
- children: PropTypes.func
1241
+ process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
1242
+ value: PropTypes.any.isRequired,
1243
+ format: PropTypes.string,
1244
+ updateInterval: PropTypes.number,
1245
+ initialNow: PropTypes.any,
1246
+ children: PropTypes.func
1688
1247
  }) : void 0;
1689
1248
 
1690
1249
  /*
@@ -1694,61 +1253,61 @@ process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = babelHelpe
1694
1253
  */
1695
1254
 
1696
1255
  var FormattedNumber = function (_Component) {
1697
- inherits(FormattedNumber, _Component);
1256
+ inherits(FormattedNumber, _Component);
1698
1257
 
1699
- function FormattedNumber(props, context) {
1700
- classCallCheck(this, FormattedNumber);
1258
+ function FormattedNumber(props, context) {
1259
+ classCallCheck(this, FormattedNumber);
1701
1260
 
1702
- var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1261
+ var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1262
+
1263
+ invariantIntlContext(context);
1264
+ return _this;
1265
+ }
1703
1266
 
1704
- invariantIntlContext(context);
1705
- return _this;
1267
+ createClass(FormattedNumber, [{
1268
+ key: 'shouldComponentUpdate',
1269
+ value: function shouldComponentUpdate() {
1270
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1271
+ next[_key] = arguments[_key];
1272
+ }
1273
+
1274
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1706
1275
  }
1276
+ }, {
1277
+ key: 'render',
1278
+ value: function render() {
1279
+ var _context$intl = this.context.intl,
1280
+ formatNumber = _context$intl.formatNumber,
1281
+ Text = _context$intl.textComponent;
1282
+ var _props = this.props,
1283
+ value = _props.value,
1284
+ children = _props.children;
1707
1285
 
1708
- createClass(FormattedNumber, [{
1709
- key: 'shouldComponentUpdate',
1710
- value: function shouldComponentUpdate() {
1711
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1712
- next[_key] = arguments[_key];
1713
- }
1714
1286
 
1715
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1716
- }
1717
- }, {
1718
- key: 'render',
1719
- value: function render() {
1720
- var _context$intl = this.context.intl,
1721
- formatNumber = _context$intl.formatNumber,
1722
- Text = _context$intl.textComponent;
1723
- var _props = this.props,
1724
- value = _props.value,
1725
- children = _props.children;
1726
-
1727
-
1728
- var formattedNumber = formatNumber(value, this.props);
1729
-
1730
- if (typeof children === 'function') {
1731
- return children(formattedNumber);
1732
- }
1733
-
1734
- return React.createElement(
1735
- Text,
1736
- null,
1737
- formattedNumber
1738
- );
1739
- }
1740
- }]);
1741
- return FormattedNumber;
1287
+ var formattedNumber = formatNumber(value, this.props);
1288
+
1289
+ if (typeof children === 'function') {
1290
+ return children(formattedNumber);
1291
+ }
1292
+
1293
+ return React.createElement(
1294
+ Text,
1295
+ null,
1296
+ formattedNumber
1297
+ );
1298
+ }
1299
+ }]);
1300
+ return FormattedNumber;
1742
1301
  }(Component);
1743
1302
 
1744
1303
  FormattedNumber.displayName = 'FormattedNumber';
1745
1304
  FormattedNumber.contextTypes = {
1746
- intl: intlShape
1305
+ intl: intlShape
1747
1306
  };
1748
- process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = babelHelpers$1['extends']({}, numberFormatPropTypes, {
1749
- value: PropTypes.any.isRequired,
1750
- format: PropTypes.string,
1751
- children: PropTypes.func
1307
+ process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
1308
+ value: PropTypes.any.isRequired,
1309
+ format: PropTypes.string,
1310
+ children: PropTypes.func
1752
1311
  }) : void 0;
1753
1312
 
1754
1313
  /*
@@ -1758,73 +1317,73 @@ process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = babelHelpers
1758
1317
  */
1759
1318
 
1760
1319
  var FormattedPlural = function (_Component) {
1761
- inherits(FormattedPlural, _Component);
1320
+ inherits(FormattedPlural, _Component);
1762
1321
 
1763
- function FormattedPlural(props, context) {
1764
- classCallCheck(this, FormattedPlural);
1322
+ function FormattedPlural(props, context) {
1323
+ classCallCheck(this, FormattedPlural);
1765
1324
 
1766
- var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1325
+ var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1767
1326
 
1768
- invariantIntlContext(context);
1769
- return _this;
1770
- }
1327
+ invariantIntlContext(context);
1328
+ return _this;
1329
+ }
1771
1330
 
1772
- createClass(FormattedPlural, [{
1773
- key: 'shouldComponentUpdate',
1774
- value: function shouldComponentUpdate() {
1775
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1776
- next[_key] = arguments[_key];
1777
- }
1331
+ createClass(FormattedPlural, [{
1332
+ key: 'shouldComponentUpdate',
1333
+ value: function shouldComponentUpdate() {
1334
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1335
+ next[_key] = arguments[_key];
1336
+ }
1778
1337
 
1779
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1780
- }
1781
- }, {
1782
- key: 'render',
1783
- value: function render() {
1784
- var _context$intl = this.context.intl,
1785
- formatPlural = _context$intl.formatPlural,
1786
- Text = _context$intl.textComponent;
1787
- var _props = this.props,
1788
- value = _props.value,
1789
- other = _props.other,
1790
- children = _props.children;
1791
-
1792
-
1793
- var pluralCategory = formatPlural(value, this.props);
1794
- var formattedPlural = this.props[pluralCategory] || other;
1795
-
1796
- if (typeof children === 'function') {
1797
- return children(formattedPlural);
1798
- }
1799
-
1800
- return React.createElement(
1801
- Text,
1802
- null,
1803
- formattedPlural
1804
- );
1805
- }
1806
- }]);
1807
- return FormattedPlural;
1338
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1339
+ }
1340
+ }, {
1341
+ key: 'render',
1342
+ value: function render() {
1343
+ var _context$intl = this.context.intl,
1344
+ formatPlural = _context$intl.formatPlural,
1345
+ Text = _context$intl.textComponent;
1346
+ var _props = this.props,
1347
+ value = _props.value,
1348
+ other = _props.other,
1349
+ children = _props.children;
1350
+
1351
+
1352
+ var pluralCategory = formatPlural(value, this.props);
1353
+ var formattedPlural = this.props[pluralCategory] || other;
1354
+
1355
+ if (typeof children === 'function') {
1356
+ return children(formattedPlural);
1357
+ }
1358
+
1359
+ return React.createElement(
1360
+ Text,
1361
+ null,
1362
+ formattedPlural
1363
+ );
1364
+ }
1365
+ }]);
1366
+ return FormattedPlural;
1808
1367
  }(Component);
1809
1368
 
1810
1369
  FormattedPlural.displayName = 'FormattedPlural';
1811
1370
  FormattedPlural.contextTypes = {
1812
- intl: intlShape
1371
+ intl: intlShape
1813
1372
  };
1814
1373
  FormattedPlural.defaultProps = {
1815
- style: 'cardinal'
1374
+ style: 'cardinal'
1816
1375
  };
1817
- process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = babelHelpers$1['extends']({}, pluralFormatPropTypes, {
1818
- value: PropTypes.any.isRequired,
1376
+ process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
1377
+ value: PropTypes.any.isRequired,
1819
1378
 
1820
- other: PropTypes.node.isRequired,
1821
- zero: PropTypes.node,
1822
- one: PropTypes.node,
1823
- two: PropTypes.node,
1824
- few: PropTypes.node,
1825
- many: PropTypes.node,
1379
+ other: PropTypes.node.isRequired,
1380
+ zero: PropTypes.node,
1381
+ one: PropTypes.node,
1382
+ two: PropTypes.node,
1383
+ few: PropTypes.node,
1384
+ many: PropTypes.node,
1826
1385
 
1827
- children: PropTypes.func
1386
+ children: PropTypes.func
1828
1387
  }) : void 0;
1829
1388
 
1830
1389
  /*
@@ -1834,146 +1393,142 @@ process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = babelHelpers
1834
1393
  */
1835
1394
 
1836
1395
  var FormattedMessage = function (_Component) {
1837
- inherits(FormattedMessage, _Component);
1396
+ inherits(FormattedMessage, _Component);
1838
1397
 
1839
- function FormattedMessage(props, context) {
1840
- classCallCheck(this, FormattedMessage);
1398
+ function FormattedMessage(props, context) {
1399
+ classCallCheck(this, FormattedMessage);
1841
1400
 
1842
- var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1401
+ var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1843
1402
 
1844
- invariantIntlContext(context);
1845
- return _this;
1846
- }
1403
+ invariantIntlContext(context);
1404
+ return _this;
1405
+ }
1847
1406
 
1848
- createClass(FormattedMessage, [{
1849
- key: 'shouldComponentUpdate',
1850
- value: function shouldComponentUpdate(nextProps) {
1851
- var values = this.props.values;
1852
- var nextValues = nextProps.values;
1407
+ createClass(FormattedMessage, [{
1408
+ key: 'shouldComponentUpdate',
1409
+ value: function shouldComponentUpdate(nextProps) {
1410
+ var values = this.props.values;
1411
+ var nextValues = nextProps.values;
1853
1412
 
1854
1413
 
1855
- if (!shallowEquals(nextValues, values)) {
1856
- return true;
1857
- }
1414
+ if (!shallowEquals(nextValues, values)) {
1415
+ return true;
1416
+ }
1858
1417
 
1859
- // Since `values` has already been checked, we know they're not
1860
- // different, so the current `values` are carried over so the shallow
1861
- // equals comparison on the other props isn't affected by the `values`.
1862
- var nextPropsToCheck = babelHelpers$1['extends']({}, nextProps, {
1863
- values: values
1864
- });
1418
+ // Since `values` has already been checked, we know they're not
1419
+ // different, so the current `values` are carried over so the shallow
1420
+ // equals comparison on the other props isn't affected by the `values`.
1421
+ var nextPropsToCheck = _extends({}, nextProps, {
1422
+ values: values
1423
+ });
1865
1424
 
1866
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1867
- next[_key - 1] = arguments[_key];
1868
- }
1425
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1426
+ next[_key - 1] = arguments[_key];
1427
+ }
1869
1428
 
1870
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1871
- }
1872
- }, {
1873
- key: 'render',
1874
- value: function render() {
1875
- var _context$intl = this.context.intl,
1876
- formatMessage = _context$intl.formatMessage,
1877
- Text = _context$intl.textComponent;
1878
- var _props = this.props,
1879
- id = _props.id,
1880
- description = _props.description,
1881
- defaultMessage = _props.defaultMessage,
1882
- values = _props.values,
1883
- _props$tagName = _props.tagName,
1884
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1885
- children = _props.children;
1886
-
1887
-
1888
- var tokenDelimiter = void 0;
1889
- var tokenizedValues = void 0;
1890
- var elements = void 0;
1891
-
1892
- var hasValues = values && Object.keys(values).length > 0;
1893
- if (hasValues) {
1894
- (function () {
1895
- // Creates a token with a random UID that should not be guessable or
1896
- // conflict with other parts of the `message` string.
1897
- var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1898
-
1899
- var generateToken = function () {
1900
- var counter = 0;
1901
- return function () {
1902
- return 'ELEMENT-' + uid + '-' + (counter += 1);
1903
- };
1904
- }();
1905
-
1906
- // Splitting with a delimiter to support IE8. When using a regex
1907
- // with a capture group IE8 does not include the capture group in
1908
- // the resulting array.
1909
- tokenDelimiter = '@__' + uid + '__@';
1910
- tokenizedValues = {};
1911
- elements = {};
1912
-
1913
- // Iterates over the `props` to keep track of any React Element
1914
- // values so they can be represented by the `token` as a placeholder
1915
- // when the `message` is formatted. This allows the formatted
1916
- // message to then be broken-up into parts with references to the
1917
- // React Elements inserted back in.
1918
- Object.keys(values).forEach(function (name) {
1919
- var value = values[name];
1920
-
1921
- if (isValidElement(value)) {
1922
- var token = generateToken();
1923
- tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1924
- elements[token] = value;
1925
- } else {
1926
- tokenizedValues[name] = value;
1927
- }
1928
- });
1929
- })();
1930
- }
1931
-
1932
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1933
- var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1934
-
1935
- var nodes = void 0;
1936
-
1937
- var hasElements = elements && Object.keys(elements).length > 0;
1938
- if (hasElements) {
1939
- // Split the message into parts so the React Element values captured
1940
- // above can be inserted back into the rendered message. This
1941
- // approach allows messages to render with React Elements while
1942
- // keeping React's virtual diffing working properly.
1943
- nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1944
- return !!part;
1945
- }).map(function (part) {
1946
- return elements[part] || part;
1947
- });
1948
- } else {
1949
- nodes = [formattedMessage];
1950
- }
1951
-
1952
- if (typeof children === 'function') {
1953
- return children.apply(undefined, toConsumableArray(nodes));
1954
- }
1955
-
1956
- return React.createElement(
1957
- Component$$1,
1958
- null,
1959
- nodes
1960
- );
1961
- }
1962
- }]);
1963
- return FormattedMessage;
1429
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1430
+ }
1431
+ }, {
1432
+ key: 'render',
1433
+ value: function render() {
1434
+ var _context$intl = this.context.intl,
1435
+ formatMessage = _context$intl.formatMessage,
1436
+ Text = _context$intl.textComponent;
1437
+ var _props = this.props,
1438
+ id = _props.id,
1439
+ description = _props.description,
1440
+ defaultMessage = _props.defaultMessage,
1441
+ values = _props.values,
1442
+ _props$tagName = _props.tagName,
1443
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1444
+ children = _props.children;
1445
+
1446
+
1447
+ var tokenDelimiter = void 0;
1448
+ var tokenizedValues = void 0;
1449
+ var elements = void 0;
1450
+
1451
+ var hasValues = values && Object.keys(values).length > 0;
1452
+ if (hasValues) {
1453
+ // Creates a token with a random UID that should not be guessable or
1454
+ // conflict with other parts of the `message` string.
1455
+ var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1456
+
1457
+ var generateToken = function () {
1458
+ var counter = 0;
1459
+ return function () {
1460
+ return 'ELEMENT-' + uid + '-' + (counter += 1);
1461
+ };
1462
+ }();
1463
+
1464
+ // Splitting with a delimiter to support IE8. When using a regex
1465
+ // with a capture group IE8 does not include the capture group in
1466
+ // the resulting array.
1467
+ tokenDelimiter = '@__' + uid + '__@';
1468
+ tokenizedValues = {};
1469
+ elements = {};
1470
+
1471
+ // Iterates over the `props` to keep track of any React Element
1472
+ // values so they can be represented by the `token` as a placeholder
1473
+ // when the `message` is formatted. This allows the formatted
1474
+ // message to then be broken-up into parts with references to the
1475
+ // React Elements inserted back in.
1476
+ Object.keys(values).forEach(function (name) {
1477
+ var value = values[name];
1478
+
1479
+ if (isValidElement(value)) {
1480
+ var token = generateToken();
1481
+ tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1482
+ elements[token] = value;
1483
+ } else {
1484
+ tokenizedValues[name] = value;
1485
+ }
1486
+ });
1487
+ }
1488
+
1489
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1490
+ var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1491
+
1492
+ var nodes = void 0;
1493
+
1494
+ var hasElements = elements && Object.keys(elements).length > 0;
1495
+ if (hasElements) {
1496
+ // Split the message into parts so the React Element values captured
1497
+ // above can be inserted back into the rendered message. This
1498
+ // approach allows messages to render with React Elements while
1499
+ // keeping React's virtual diffing working properly.
1500
+ nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1501
+ return !!part;
1502
+ }).map(function (part) {
1503
+ return elements[part] || part;
1504
+ });
1505
+ } else {
1506
+ nodes = [formattedMessage];
1507
+ }
1508
+
1509
+ if (typeof children === 'function') {
1510
+ return children.apply(undefined, toConsumableArray(nodes));
1511
+ }
1512
+
1513
+ // Needs to use `createElement()` instead of JSX, otherwise React will
1514
+ // warn about a missing `key` prop with rich-text message formatting.
1515
+ return createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
1516
+ }
1517
+ }]);
1518
+ return FormattedMessage;
1964
1519
  }(Component);
1965
1520
 
1966
1521
  FormattedMessage.displayName = 'FormattedMessage';
1967
1522
  FormattedMessage.contextTypes = {
1968
- intl: intlShape
1523
+ intl: intlShape
1969
1524
  };
1970
1525
  FormattedMessage.defaultProps = {
1971
- values: {}
1526
+ values: {}
1972
1527
  };
1973
- process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = babelHelpers$1['extends']({}, messageDescriptorPropTypes, {
1974
- values: PropTypes.object,
1975
- tagName: PropTypes.string,
1976
- children: PropTypes.func
1528
+ process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1529
+ values: PropTypes.object,
1530
+ tagName: PropTypes.string,
1531
+ children: PropTypes.func
1977
1532
  }) : void 0;
1978
1533
 
1979
1534
  /*
@@ -1983,90 +1538,90 @@ process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = babelHelper
1983
1538
  */
1984
1539
 
1985
1540
  var FormattedHTMLMessage = function (_Component) {
1986
- inherits(FormattedHTMLMessage, _Component);
1541
+ inherits(FormattedHTMLMessage, _Component);
1987
1542
 
1988
- function FormattedHTMLMessage(props, context) {
1989
- classCallCheck(this, FormattedHTMLMessage);
1543
+ function FormattedHTMLMessage(props, context) {
1544
+ classCallCheck(this, FormattedHTMLMessage);
1990
1545
 
1991
- var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1546
+ var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1992
1547
 
1993
- invariantIntlContext(context);
1994
- return _this;
1995
- }
1548
+ invariantIntlContext(context);
1549
+ return _this;
1550
+ }
1996
1551
 
1997
- createClass(FormattedHTMLMessage, [{
1998
- key: 'shouldComponentUpdate',
1999
- value: function shouldComponentUpdate(nextProps) {
2000
- var values = this.props.values;
2001
- var nextValues = nextProps.values;
1552
+ createClass(FormattedHTMLMessage, [{
1553
+ key: 'shouldComponentUpdate',
1554
+ value: function shouldComponentUpdate(nextProps) {
1555
+ var values = this.props.values;
1556
+ var nextValues = nextProps.values;
2002
1557
 
2003
1558
 
2004
- if (!shallowEquals(nextValues, values)) {
2005
- return true;
2006
- }
1559
+ if (!shallowEquals(nextValues, values)) {
1560
+ return true;
1561
+ }
2007
1562
 
2008
- // Since `values` has already been checked, we know they're not
2009
- // different, so the current `values` are carried over so the shallow
2010
- // equals comparison on the other props isn't affected by the `values`.
2011
- var nextPropsToCheck = babelHelpers$1['extends']({}, nextProps, {
2012
- values: values
2013
- });
1563
+ // Since `values` has already been checked, we know they're not
1564
+ // different, so the current `values` are carried over so the shallow
1565
+ // equals comparison on the other props isn't affected by the `values`.
1566
+ var nextPropsToCheck = _extends({}, nextProps, {
1567
+ values: values
1568
+ });
2014
1569
 
2015
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2016
- next[_key - 1] = arguments[_key];
2017
- }
1570
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1571
+ next[_key - 1] = arguments[_key];
1572
+ }
2018
1573
 
2019
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
2020
- }
2021
- }, {
2022
- key: 'render',
2023
- value: function render() {
2024
- var _context$intl = this.context.intl,
2025
- formatHTMLMessage = _context$intl.formatHTMLMessage,
2026
- Text = _context$intl.textComponent;
2027
- var _props = this.props,
2028
- id = _props.id,
2029
- description = _props.description,
2030
- defaultMessage = _props.defaultMessage,
2031
- rawValues = _props.values,
2032
- _props$tagName = _props.tagName,
2033
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
2034
- children = _props.children;
2035
-
2036
-
2037
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
2038
- var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
2039
-
2040
- if (typeof children === 'function') {
2041
- return children(formattedHTMLMessage);
2042
- }
2043
-
2044
- // Since the message presumably has HTML in it, we need to set
2045
- // `innerHTML` in order for it to be rendered and not escaped by React.
2046
- // To be safe, all string prop values were escaped when formatting the
2047
- // message. It is assumed that the message is not UGC, and came from the
2048
- // developer making it more like a template.
2049
- //
2050
- // Note: There's a perf impact of using this component since there's no
2051
- // way for React to do its virtual DOM diffing.
2052
- var html = { __html: formattedHTMLMessage };
2053
- return React.createElement(Component$$1, { dangerouslySetInnerHTML: html });
2054
- }
2055
- }]);
2056
- return FormattedHTMLMessage;
1574
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1575
+ }
1576
+ }, {
1577
+ key: 'render',
1578
+ value: function render() {
1579
+ var _context$intl = this.context.intl,
1580
+ formatHTMLMessage = _context$intl.formatHTMLMessage,
1581
+ Text = _context$intl.textComponent;
1582
+ var _props = this.props,
1583
+ id = _props.id,
1584
+ description = _props.description,
1585
+ defaultMessage = _props.defaultMessage,
1586
+ rawValues = _props.values,
1587
+ _props$tagName = _props.tagName,
1588
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1589
+ children = _props.children;
1590
+
1591
+
1592
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1593
+ var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
1594
+
1595
+ if (typeof children === 'function') {
1596
+ return children(formattedHTMLMessage);
1597
+ }
1598
+
1599
+ // Since the message presumably has HTML in it, we need to set
1600
+ // `innerHTML` in order for it to be rendered and not escaped by React.
1601
+ // To be safe, all string prop values were escaped when formatting the
1602
+ // message. It is assumed that the message is not UGC, and came from the
1603
+ // developer making it more like a template.
1604
+ //
1605
+ // Note: There's a perf impact of using this component since there's no
1606
+ // way for React to do its virtual DOM diffing.
1607
+ var html = { __html: formattedHTMLMessage };
1608
+ return React.createElement(Component$$1, { dangerouslySetInnerHTML: html });
1609
+ }
1610
+ }]);
1611
+ return FormattedHTMLMessage;
2057
1612
  }(Component);
2058
1613
 
2059
1614
  FormattedHTMLMessage.displayName = 'FormattedHTMLMessage';
2060
1615
  FormattedHTMLMessage.contextTypes = {
2061
- intl: intlShape
1616
+ intl: intlShape
2062
1617
  };
2063
1618
  FormattedHTMLMessage.defaultProps = {
2064
- values: {}
1619
+ values: {}
2065
1620
  };
2066
- process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = babelHelpers$1['extends']({}, messageDescriptorPropTypes, {
2067
- values: PropTypes.object,
2068
- tagName: PropTypes.string,
2069
- children: PropTypes.func
1621
+ process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1622
+ values: PropTypes.object,
1623
+ tagName: PropTypes.string,
1624
+ children: PropTypes.func
2070
1625
  }) : void 0;
2071
1626
 
2072
1627
  /*