twitter_cldr_js 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/Gemfile +5 -0
  2. data/History.txt +11 -1
  3. data/README.md +103 -13
  4. data/Rakefile +1 -1
  5. data/lib/assets/javascripts/twitter_cldr/af.js +1815 -0
  6. data/lib/assets/javascripts/twitter_cldr/ar.js +1815 -0
  7. data/lib/assets/javascripts/twitter_cldr/be.js +1815 -0
  8. data/lib/assets/javascripts/twitter_cldr/bg.js +1815 -0
  9. data/lib/assets/javascripts/twitter_cldr/bn.js +1815 -0
  10. data/lib/assets/javascripts/twitter_cldr/ca.js +1815 -0
  11. data/lib/assets/javascripts/twitter_cldr/cs.js +1815 -0
  12. data/lib/assets/javascripts/twitter_cldr/cy.js +1815 -0
  13. data/lib/assets/javascripts/twitter_cldr/da.js +1815 -0
  14. data/lib/assets/javascripts/twitter_cldr/de.js +1815 -0
  15. data/lib/assets/javascripts/twitter_cldr/el.js +1815 -0
  16. data/lib/assets/javascripts/twitter_cldr/en.js +1815 -0
  17. data/lib/assets/javascripts/twitter_cldr/es.js +1815 -0
  18. data/lib/assets/javascripts/twitter_cldr/eu.js +1815 -0
  19. data/lib/assets/javascripts/twitter_cldr/fa.js +1815 -0
  20. data/lib/assets/javascripts/twitter_cldr/fi.js +1815 -0
  21. data/lib/assets/javascripts/twitter_cldr/fil.js +1815 -0
  22. data/lib/assets/javascripts/twitter_cldr/fr.js +1815 -0
  23. data/lib/assets/javascripts/twitter_cldr/ga.js +1815 -0
  24. data/lib/assets/javascripts/twitter_cldr/gl.js +1815 -0
  25. data/lib/assets/javascripts/twitter_cldr/he.js +1815 -0
  26. data/lib/assets/javascripts/twitter_cldr/hi.js +1815 -0
  27. data/lib/assets/javascripts/twitter_cldr/hu.js +1815 -0
  28. data/lib/assets/javascripts/twitter_cldr/id.js +1815 -0
  29. data/lib/assets/javascripts/twitter_cldr/it.js +1815 -0
  30. data/lib/assets/javascripts/twitter_cldr/ja.js +1815 -0
  31. data/lib/assets/javascripts/twitter_cldr/ko.js +1815 -0
  32. data/lib/assets/javascripts/twitter_cldr/lv.js +1815 -0
  33. data/lib/assets/javascripts/twitter_cldr/msa.js +1815 -0
  34. data/lib/assets/javascripts/twitter_cldr/nl.js +1815 -0
  35. data/lib/assets/javascripts/twitter_cldr/no.js +1815 -0
  36. data/lib/assets/javascripts/twitter_cldr/pl.js +1815 -0
  37. data/lib/assets/javascripts/twitter_cldr/pt.js +1815 -0
  38. data/lib/assets/javascripts/twitter_cldr/ro.js +1815 -0
  39. data/lib/assets/javascripts/twitter_cldr/ru.js +1815 -0
  40. data/lib/assets/javascripts/twitter_cldr/sk.js +1815 -0
  41. data/lib/assets/javascripts/twitter_cldr/sq.js +1815 -0
  42. data/lib/assets/javascripts/twitter_cldr/sr.js +1815 -0
  43. data/lib/assets/javascripts/twitter_cldr/sv.js +1815 -0
  44. data/lib/assets/javascripts/twitter_cldr/ta.js +1815 -0
  45. data/lib/assets/javascripts/twitter_cldr/th.js +1815 -0
  46. data/lib/assets/javascripts/twitter_cldr/tr.js +1815 -0
  47. data/lib/assets/javascripts/twitter_cldr/uk.js +1815 -0
  48. data/lib/assets/javascripts/twitter_cldr/ur.js +1815 -0
  49. data/lib/assets/javascripts/twitter_cldr/zh-cn.js +1815 -0
  50. data/lib/assets/javascripts/twitter_cldr/zh-tw.js +1815 -0
  51. data/lib/twitter_cldr/js/compiler.rb +12 -3
  52. data/lib/twitter_cldr/js/mustache/bundle.coffee +19 -1
  53. data/lib/twitter_cldr/js/mustache/calendars/additional_date_format_selector.coffee +85 -0
  54. data/lib/twitter_cldr/js/mustache/calendars/datetime.coffee +248 -226
  55. data/lib/twitter_cldr/js/mustache/calendars/timespan.coffee +19 -18
  56. data/lib/twitter_cldr/js/mustache/numbers/numbers.coffee +62 -19
  57. data/lib/twitter_cldr/js/mustache/plurals/rules.coffee +1 -1
  58. data/lib/twitter_cldr/js/mustache/shared/bidi.coffee +433 -0
  59. data/lib/twitter_cldr/js/mustache/shared/calendar.coffee +25 -0
  60. data/lib/twitter_cldr/js/mustache/shared/currencies.coffee +5 -11
  61. data/lib/twitter_cldr/js/mustache/shared/lists.coffee +40 -0
  62. data/lib/twitter_cldr/js/mustache/shared/prerender/bidi_classes.json +1 -0
  63. data/lib/twitter_cldr/js/mustache/utilities.coffee +87 -0
  64. data/lib/twitter_cldr/js/renderers.rb +23 -19
  65. data/lib/twitter_cldr/js/renderers/bundle.rb +8 -2
  66. data/lib/twitter_cldr/js/renderers/calendars/additional_date_format_selector_renderer.rb +18 -0
  67. data/lib/twitter_cldr/js/renderers/calendars/datetime_renderer.rb +13 -9
  68. data/lib/twitter_cldr/js/renderers/numbers/numbers_renderer.rb +17 -3
  69. data/lib/twitter_cldr/js/renderers/shared/bidi_renderer.rb +77 -0
  70. data/lib/twitter_cldr/js/renderers/shared/calendar_renderer.rb +20 -0
  71. data/lib/twitter_cldr/js/renderers/shared/currencies_renderer.rb +2 -2
  72. data/lib/twitter_cldr/js/renderers/shared/list_renderer.rb +22 -0
  73. data/lib/twitter_cldr/js/tasks/tasks.rake +9 -5
  74. data/lib/twitter_cldr/js/tasks/tasks.rb +6 -5
  75. data/lib/twitter_cldr/js/version.rb +1 -1
  76. data/spec/js/calendars/additional_date_format_selector.spec.js +126 -0
  77. data/spec/js/calendars/datetime.spec.js +29 -2
  78. data/spec/js/calendars/timespan.spec.js +45 -1
  79. data/spec/js/numbers/abbreviated/abbreviated_number.spec.js +47 -0
  80. data/spec/js/numbers/abbreviated/long_decimal.spec.js +57 -0
  81. data/spec/js/numbers/abbreviated/short_decimal.spec.js +57 -0
  82. data/spec/js/numbers/currency.spec.js +2 -2
  83. data/spec/js/numbers/decimal.spec.js +1 -1
  84. data/spec/js/numbers/helpers/fraction.spec.js +1 -1
  85. data/spec/js/numbers/helpers/integer.spec.js +1 -1
  86. data/spec/js/numbers/number.spec.js +1 -1
  87. data/spec/js/numbers/percent.spec.js +1 -1
  88. data/spec/js/plurals/plural_rules.spec.js +1 -1
  89. data/spec/js/shared/bidi.spec.js +105 -0
  90. data/spec/js/shared/calendar.spec.js +51 -0
  91. data/spec/js/shared/classpath_bidi_test.txt +217202 -0
  92. data/spec/js/shared/lists.spec.js +100 -0
  93. data/spec/js/utilities.spec.js +120 -0
  94. data/twitter_cldr_js.gemspec +1 -1
  95. metadata +68 -37
  96. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_af.js +0 -887
  97. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ar.js +0 -887
  98. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ca.js +0 -887
  99. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_cs.js +0 -887
  100. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_da.js +0 -887
  101. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_de.js +0 -887
  102. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_el.js +0 -887
  103. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_en.js +0 -887
  104. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_es.js +0 -887
  105. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_eu.js +0 -887
  106. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fa.js +0 -887
  107. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fi.js +0 -887
  108. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fil.js +0 -887
  109. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_fr.js +0 -887
  110. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_he.js +0 -887
  111. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_hi.js +0 -887
  112. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_hu.js +0 -887
  113. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_id.js +0 -887
  114. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_it.js +0 -887
  115. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ja.js +0 -887
  116. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ko.js +0 -887
  117. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_msa.js +0 -887
  118. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_nl.js +0 -887
  119. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_no.js +0 -887
  120. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_pl.js +0 -887
  121. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_pt.js +0 -887
  122. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ru.js +0 -887
  123. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_sv.js +0 -887
  124. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_th.js +0 -887
  125. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_tr.js +0 -887
  126. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_uk.js +0 -887
  127. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_ur.js +0 -887
  128. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_zh-cn.js +0 -887
  129. data/lib/assets/javascripts/twitter_cldr/twitter_cldr_zh-tw.js +0 -887
data/Gemfile CHANGED
@@ -9,4 +9,9 @@ group :test do
9
9
  platform :mri_18 do
10
10
  gem 'rcov'
11
11
  end
12
+ end
13
+
14
+ group :development do
15
+ gem 'pry'
16
+ gem 'pry-nav'
12
17
  end
data/History.txt CHANGED
@@ -1,3 +1,13 @@
1
+ === 2.0.0
2
+
3
+ * Added module alias for twitter.com loadbuilder.
4
+ * Added bidi algorithm.
5
+ * Included support for approximate timespans.
6
+ * Included additional date formats.
7
+ * Added short/long decimal support (eg. 1K for 1,000).
8
+ * Re-added safety closure, updated to support browser and node.
9
+ * Upgraded to twitter-cldr-rb 2.0.0.
10
+
1
11
  === 1.0.0
2
12
 
3
- * Moved JavaScript compilation files out of twitter-cldr-rb and into their own gem here.
13
+ * Moved JavaScript compilation files out of twitter-cldr-rb and into their own gem here.
data/README.md CHANGED
@@ -8,9 +8,11 @@ Currently, twitter-cldr-js supports the following:
8
8
  1. Date and time formatting
9
9
  2. Relative date and time formatting (eg. 1 month ago)
10
10
  3. Number formatting (decimal, currency, and percentage)
11
- 4. Plural rules
11
+ 4. Long/short decimals
12
+ 5. Plural rules
13
+ 6. Bidirectional reordering
12
14
 
13
- ## Usage in the Rails Asset Pipeline
15
+ ## Usage with Rails
14
16
 
15
17
  twitter-cldr-js provides a single `.js` file per locale. You can include a locale-specific version (eg. Spanish) in your JavaScript manifest (`app/assets/javascripts/application.js`) like this:
16
18
 
@@ -27,7 +29,7 @@ This will make the Spanish version of twitter-cldr-js available to the JavaScrip
27
29
  ### Dates and Times
28
30
 
29
31
  ```javascript
30
- // include twitter_cldr_es.js for the Spanish DateTimeFormatter
32
+ // include twitter_cldr/es.js for the Spanish DateTimeFormatter
31
33
  var fmt = new TwitterCldr.DateTimeFormatter();
32
34
 
33
35
  fmt.format(new Date(), {"type": "full"}); // "lunes, 12 de diciembre de 2011 21:44:57 UTC -0800"
@@ -46,14 +48,68 @@ fmt.format(new Date(), {"format": "time", "type": "medium"}); // "21:46:09"
46
48
  fmt.format(new Date(), {"format": "time", "type": "short"}); // "21:47"
47
49
  ```
48
50
 
49
- The CLDR data set only includes 4 specific date formats, full, long, medium, and short, so you'll have to choose amongst them for the one that best fits your needs. Yes, it's limiting, but the 4 formats get the job done most of the time :)
51
+ The default CLDR data set only includes 4 date formats, full, long, medium, and short. See below for a list of additional formats.
52
+
53
+ #### Additional Date Formats
54
+
55
+ Besides the default date formats, CLDR supports a number of additional ones. The list of available formats varys for each locale. To get a full list, use the `additional_formats` method:
56
+
57
+ ```javascript
58
+ // ["EEEEd", "Ed", "GGGGyMd", "H", "Hm", "Hms", "M", "MEd", "MMM", "MMMEEEEd", "MMMEd", ... ]
59
+ TwitterCldr.DateTimeFormatter.additional_formats();
60
+ ```
61
+
62
+ You can use any of the returned formats as the `format` option when formatting dates:
63
+
64
+ ```javascript
65
+ // 30/11/2012 15:38:33
66
+ fmt.format(new Date(), {});
67
+ // 30 de noviembre
68
+ fmt.format(new Date(), {"format": "additional", "type": "EEEEd"});
69
+ ```
70
+
71
+ It's important to know that, even though a format may not be available across locales, TwitterCLDR will do it's best to approximate if no exact match can be found.
72
+
73
+ ##### List of additional date format examples for English:
74
+
75
+ | Format | Output |
76
+ |:-------|------------------|
77
+ | EHm | Wed 17:05 |
78
+ | EHms | Wed 17:05:33 |
79
+ | Ed | 28 Wed |
80
+ | Ehm | Wed 5:05 p.m. |
81
+ | Ehms | Wed 5:05:33 p.m. |
82
+ | Gy | 2012 AD |
83
+ | H | 17 |
84
+ | Hm | 17:05 |
85
+ | Hms | 17:05:33 |
86
+ | M | 11 |
87
+ | MEd | Wed 11/28 |
88
+ | MMM | Nov |
89
+ | MMMEd | Wed Nov 28 |
90
+ | MMMd | Nov 28 |
91
+ | Md | 11/28 |
92
+ | d | 28 |
93
+ | h | 5 p.m. |
94
+ | hm | 5:05 p.m. |
95
+ | hms | 5:05:33 p.m. |
96
+ | ms | 05:33 |
97
+ | y | 2012 |
98
+ | yM | 11/2012 |
99
+ | yMEd | Wed 11/28/2012 |
100
+ | yMMM | Nov 2012 |
101
+ | yMMMEd | Wed Nov 28 2012 |
102
+ | yMMMd | Nov 28 2012 |
103
+ | yMd | 11/28/2012 |
104
+ | yQQQ | Q4 2012 |
105
+ | yQQQQ | 4th quarter 2012 |
50
106
 
51
107
  ### Relative Dates and Times
52
108
 
53
109
  In addition to formatting full dates and times, TwitterCLDR supports relative time spans. It tries to guess the best time unit (eg. days, hours, minutes, etc) based on the length of time given. Indicate past or future by using negative or positive numbers respectively:
54
110
 
55
111
  ```javascript
56
- // include twitter_cldr_en.js for the English TimespanFormatter
112
+ // include twitter_cldr/en.js for the English TimespanFormatter
57
113
  var fmt = new TwitterCldr.TimespanFormatter();
58
114
  var then = Math.round(new Date(2012, 1, 1, 12, 0, 0).getTime() / 1000);
59
115
  var now = Math.round(Date.now() / 1000);
@@ -73,6 +129,14 @@ fmt.format(180, {direction: "none", type: "abbreviated"}); // "3m"
73
129
  fmt.format(180, {direction: "none", type: "short", unit: "second"}); // "180 secs"
74
130
  ```
75
131
 
132
+ By default, timespans are exact representations of a given unit of elapsed time. TwitterCLDR also supports approximate timespans which round up to the nearest larger unit. For example, "44 seconds" remains "44 seconds" while "45 seconds" becomes "1 minute". To approximate, pass the `approximate: true` option:
133
+
134
+ ```javascript
135
+ fmt.format(44, {approximate: true}); // Dentro de 44 segundos
136
+ fmt.format(45, {approximate: true}); // Dentro de 1 minuto
137
+ fmt.format(52, {approximate: true}); // Dentro de 1 minuto
138
+ ```
139
+
76
140
  ### Numbers
77
141
 
78
142
  twitter-cldr-js number formatting supports decimals, currencies, and percentages.
@@ -80,20 +144,32 @@ twitter-cldr-js number formatting supports decimals, currencies, and percentages
80
144
  #### Decimals
81
145
 
82
146
  ```javascript
83
- // include twitter_cldr_es.js for the Spanish NumberFormatter
147
+ // include twitter_cldr/es.js for the Spanish NumberFormatter
84
148
  var fmt = new TwitterCldr.DecimalFormatter();
85
149
  fmt.format(1337); // "1.337"
86
150
  fmt.format(-1337); // "-1.337"
87
151
  fmt.format(1337, {precision: 2}); // "1.337,00"
88
152
  ```
89
153
 
154
+ #### Short / Long Decimals
155
+
156
+ In addition to formatting regular decimals, TwitterCLDR supports short and long decimals. Short decimals abbreviate the notation for the appropriate power of ten, for example "1M" for 1,000,000 or "2K" for 2,000. Long decimals include the full notation, for example "1 million" or "2 thousand":
157
+
158
+ ```javascript
159
+ var fmt = new TwitterCldr.ShortDecimalFormatter();
160
+ fmt.format(2337); // 2K
161
+ fmt.format(1337123); // 1M
162
+
163
+ fmt = new TwitterCldr.LongDecimalFormatter();
164
+ fmt.format(2337); // 2 thousand
165
+ fmt.format(1337123); // 1 million
166
+ ```
167
+
90
168
  #### Currencies
91
169
 
92
170
  ```javascript
93
171
  var fmt = new TwitterCldr.CurrencyFormatter();
94
172
  fmt.format(1337, {currency: "EUR"}); // 1.337,00 €
95
- fmt.format(1337, {currency: "Peru"}); // 1.337,00 S/.
96
- fmt.format(1337, {currency: "Peru", precision: 3}); // 1.337,000 S/.
97
173
  ```
98
174
 
99
175
  #### Percentages
@@ -111,7 +187,7 @@ Some languages, like English, have "countable" nouns. You probably know this co
111
187
  TwitterCLDR makes it easy to find the plural rules for any numeric value:
112
188
 
113
189
  ```javascript
114
- // include twitter_cldr_ru.js for access to Russian Plural rules
190
+ // include twitter_cldr/ru.js for access to Russian Plural rules
115
191
  TwitterCldr.PluralRules.rule_for(1); // "one"
116
192
  TwitterCldr.PluralRules.rule_for(2); // "few"
117
193
  TwitterCldr.PluralRules.rule_for(8); // "many"
@@ -123,15 +199,29 @@ Get all the rules for your language:
123
199
  TwitterCldr.PluralRules.all(); // ["one", "few", "many", "other"]
124
200
  ```
125
201
 
202
+ ### Handling Bidirectional Text
203
+
204
+ When it comes to displaying text written in both right-to-left (RTL) and left-to-right (LTR) languages, most display systems run into problems. The trouble is that Arabic or Hebrew text and English text (for example) often get scrambled visually and are therefore difficult to read. It's not usually the basic ASCII characters like A-Z that get scrambled - it's most often punctuation marks and the like that are confusingly mixed up (they are considered "weak" types by Unicode).
205
+
206
+ To mitigate this problem, Unicode supports special invisible characters that force visual reordering so that mixed RTL and LTR (called "bidirectional") text renders naturally on the screen. The Unicode Consortium has developed an algorithm (The Unicode Bidirectional Algorithm, or UBA) that intelligently inserts these control characters where appropriate. You can make use of the UBA implementation in TwitterCLDR by creating a new instance of `TwitterCldr.Bidi` via the `from_string` method, and manipulating it like so:
207
+
208
+ ```javascript
209
+ var bidi_str = TwitterCldr.Bidi.from_string("hello نزوة world", {"direction": "RTL"});
210
+ bidi.reorder_visually();
211
+ bidi.toString();
212
+ ```
213
+
214
+ **Disclaimer**: Google Translate tells me the Arabic in the example above means "fancy", but my confidence is not very high, especially since all the letters are unattached. Apologies to any native speakers :)
215
+
126
216
  ### Generating the JavaScript
127
217
 
128
218
  The JavaScript files that make up twitter-cldr-js can be automatically generated for each language via a set of Rake tasks.
129
219
 
130
- * Build js files in the current directory: `bundle exec rake twitter_cldr:compile`
131
- * Build js files into a given directory: `bundle exec rake twitter_cldr:compile OUTPUT_DIR=/path/to/output/dir`
132
- * Build only the specified locales: `bundle exec rake twitter_cldr:compile OUTPUT_DIR=/path/to/output/dir LOCALES=ar,he,ko,ja`
220
+ * Build js files in the current directory: `bundle exec rake twitter_cldr:js:compile`
221
+ * Build js files into a given directory: `bundle exec rake twitter_cldr:js:compile OUTPUT_DIR=/path/to/output/dir`
222
+ * Build only the specified locales: `bundle exec rake twitter_cldr:js:compile OUTPUT_DIR=/path/to/output/dir LOCALES=ar,he,ko,ja`
133
223
 
134
- * Rebuild the js files internally in the gem: `bundle exec rake twitter_cldr:update`
224
+ * Rebuild the js files internally in the gem: `bundle exec rake twitter_cldr:js:update`
135
225
 
136
226
  ## Requirements
137
227
 
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ RSpec::Core::RakeTask.new("spec:ruby") do |t|
28
28
  end
29
29
 
30
30
  desc 'Run JavaScript specs'
31
- task "spec:js" => ["twitter_cldr:update"] do
31
+ task "spec:js" => ["twitter_cldr:js:update"] do
32
32
  puts "\nJasmine Specs"
33
33
  failures = 0
34
34
 
@@ -0,0 +1,1815 @@
1
+
2
+ /*
3
+ // Copyright 2012 Twitter, Inc
4
+ // http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ // TwitterCLDR (JavaScript) v2.0.0
7
+ // Authors: Cameron Dutro [@camertron]
8
+ Kirill Lashuk [@KL_7]
9
+ portions by Sven Fuchs [@svenfuchs]
10
+ // Homepage: https://twitter.com
11
+ // Description: Provides date, time, number, and list formatting functionality for various Twitter-supported locales in Javascript.
12
+ */
13
+
14
+
15
+ /*-module-*/
16
+ /*_lib/twitter_cldr_*/
17
+
18
+
19
+ (function() {
20
+ var TwitterCldr, key, obj, root,
21
+ __hasProp = {}.hasOwnProperty,
22
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
23
+
24
+ TwitterCldr = {};
25
+
26
+ TwitterCldr.is_rtl = false;
27
+
28
+ TwitterCldr.Utilities = (function() {
29
+
30
+ function Utilities() {}
31
+
32
+ Utilities.from_char_code = function(code_point) {
33
+ if (code_point > 0xFFFF) {
34
+ code_point -= 0x10000;
35
+ return String.fromCharCode(0xD800 + (code_point >> 10), 0xDC00 + (code_point & 0x3FF));
36
+ } else {
37
+ return String.fromCharCode(code_point);
38
+ }
39
+ };
40
+
41
+ Utilities.char_code_at = function(str, idx) {
42
+ var code, end, hi, li, low, surrogatePairs;
43
+ str += '';
44
+ end = str.length;
45
+ surrogatePairs = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
46
+ while (surrogatePairs.exec(str) !== null) {
47
+ li = surrogatePairs.lastIndex;
48
+ if (li - 2 < idx) {
49
+ idx += 1;
50
+ } else {
51
+ break;
52
+ }
53
+ }
54
+ if ((idx >= end) || (idx < 0)) {
55
+ return NaN;
56
+ }
57
+ code = str.charCodeAt(idx);
58
+ if ((0xD800 <= code) && (code <= 0xDBFF)) {
59
+ hi = code;
60
+ low = str.charCodeAt(idx + 1);
61
+ return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
62
+ }
63
+ return code;
64
+ };
65
+
66
+ Utilities.unpack_string = function(str) {
67
+ var code_point, idx, result, _i, _ref;
68
+ result = [];
69
+ for (idx = _i = 0, _ref = str.length; 0 <= _ref ? _i < _ref : _i > _ref; idx = 0 <= _ref ? ++_i : --_i) {
70
+ code_point = this.char_code_at(str, idx);
71
+ if (!code_point) {
72
+ break;
73
+ }
74
+ result.push(code_point);
75
+ }
76
+ return result;
77
+ };
78
+
79
+ Utilities.pack_array = function(char_arr) {
80
+ var cur_char;
81
+ return ((function() {
82
+ var _i, _len, _results;
83
+ _results = [];
84
+ for (_i = 0, _len = char_arr.length; _i < _len; _i++) {
85
+ cur_char = char_arr[_i];
86
+ _results.push(this.from_char_code(cur_char));
87
+ }
88
+ return _results;
89
+ }).call(this)).join("");
90
+ };
91
+
92
+ Utilities.arraycopy = function(orig, orig_index, dest, dest_index, length) {
93
+ var count, elem, _i, _len, _ref;
94
+ _ref = orig.slice(orig_index, orig_index + length);
95
+ for (count = _i = 0, _len = _ref.length; _i < _len; count = ++_i) {
96
+ elem = _ref[count];
97
+ dest[dest_index + count] = elem;
98
+ }
99
+ };
100
+
101
+ Utilities.max = function(arr) {
102
+ var elem, i, max, start_index, _i, _j, _len, _ref;
103
+ max = null;
104
+ for (start_index = _i = 0, _len = arr.length; _i < _len; start_index = ++_i) {
105
+ elem = arr[start_index];
106
+ if (elem != null) {
107
+ max = elem;
108
+ break;
109
+ }
110
+ }
111
+ for (i = _j = start_index, _ref = arr.length; start_index <= _ref ? _j <= _ref : _j >= _ref; i = start_index <= _ref ? ++_j : --_j) {
112
+ if (arr[i] > max) {
113
+ max = arr[i];
114
+ }
115
+ }
116
+ return max;
117
+ };
118
+
119
+ Utilities.min = function(arr) {
120
+ var elem, i, min, start_index, _i, _j, _len, _ref;
121
+ min = null;
122
+ for (start_index = _i = 0, _len = arr.length; _i < _len; start_index = ++_i) {
123
+ elem = arr[start_index];
124
+ if (elem != null) {
125
+ min = elem;
126
+ break;
127
+ }
128
+ }
129
+ for (i = _j = start_index, _ref = arr.length; start_index <= _ref ? _j <= _ref : _j >= _ref; i = start_index <= _ref ? ++_j : --_j) {
130
+ if (arr[i] < min) {
131
+ min = arr[i];
132
+ }
133
+ }
134
+ return min;
135
+ };
136
+
137
+ Utilities.is_even = function(num) {
138
+ return num % 2 === 0;
139
+ };
140
+
141
+ Utilities.is_odd = function(num) {
142
+ return num % 2 === 1;
143
+ };
144
+
145
+ return Utilities;
146
+
147
+ })();
148
+
149
+ TwitterCldr.PluralRules = (function() {
150
+
151
+ function PluralRules() {}
152
+
153
+ PluralRules.rules = {"keys": ["one","other"], "rule": function(n) { return (function() { if (n == 1) { return "one" } else { return "other" } })(); }};
154
+
155
+ PluralRules.all = function() {
156
+ return this.rules.keys;
157
+ };
158
+
159
+ PluralRules.rule_for = function(number) {
160
+ try {
161
+ return this.rules.rule(number);
162
+ } catch (error) {
163
+ return "other";
164
+ }
165
+ };
166
+
167
+ return PluralRules;
168
+
169
+ })();
170
+
171
+ TwitterCldr.TimespanFormatter = (function() {
172
+
173
+ function TimespanFormatter() {
174
+ this.approximate_multiplier = 0.75;
175
+ this.default_type = "default";
176
+ this.tokens = {"ago":{"second":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" sekonde gelede","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" sekondes gelede","type":"plaintext"}]}},"minute":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" minuut gelede","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" minute gelede","type":"plaintext"}]}},"hour":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" uur gelede","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" uur gelede","type":"plaintext"}]}},"day":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" dag gelede","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" dae gelede","type":"plaintext"}]}},"week":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" week gelede","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" weke gelede","type":"plaintext"}]}},"month":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" maand gelede","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" maande gelede","type":"plaintext"}]}},"year":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" jaar gelede","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" jaar gelede","type":"plaintext"}]}}},"until":{"second":{"default":{"one":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" sekond","type":"plaintext"}],"other":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" sekondes","type":"plaintext"}]}},"minute":{"default":{"one":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" minuut","type":"plaintext"}],"other":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" minute","type":"plaintext"}]}},"hour":{"default":{"one":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" uur","type":"plaintext"}],"other":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" uur","type":"plaintext"}]}},"day":{"default":{"one":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" dag","type":"plaintext"}],"other":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" dae","type":"plaintext"}]}},"week":{"default":{"one":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" week","type":"plaintext"}],"other":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" weke","type":"plaintext"}]}},"month":{"default":{"one":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" maand","type":"plaintext"}],"other":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" maande","type":"plaintext"}]}},"year":{"default":{"one":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" jaar","type":"plaintext"}],"other":[{"value":"In ","type":"plaintext"},{"value":"{0}","type":"placeholder"},{"value":" jaar","type":"plaintext"}]}}},"none":{"second":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" sekonde","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" sekondes","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" sek","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" sek","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":"s","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":"s","type":"plaintext"}]}},"minute":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" minuut","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" minute","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" min","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" min","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":"m","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":"m","type":"plaintext"}]}},"hour":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" uur","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" uur","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" uur","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" uur","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":"h","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":"h","type":"plaintext"}]}},"day":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" dag","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" dae","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" dag","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" dae","type":"plaintext"}]},"abbreviated":{"one":[{"value":"{0}","type":"placeholder"},{"value":"d","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":"d","type":"plaintext"}]}},"week":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" week","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" weke","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" week","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" weke","type":"plaintext"}]}},"month":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" maand","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" maande","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" mnd","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" mnde","type":"plaintext"}]}},"year":{"default":{"one":[{"value":"{0}","type":"placeholder"},{"value":" jaar","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" jaar","type":"plaintext"}]},"short":{"one":[{"value":"{0}","type":"placeholder"},{"value":" jr","type":"plaintext"}],"other":[{"value":"{0}","type":"placeholder"},{"value":" jr","type":"plaintext"}]}}}};
177
+ this.time_in_seconds = {
178
+ "second": 1,
179
+ "minute": 60,
180
+ "hour": 3600,
181
+ "day": 86400,
182
+ "week": 604800,
183
+ "month": 2629743.83,
184
+ "year": 31556926
185
+ };
186
+ }
187
+
188
+ TimespanFormatter.prototype.format = function(seconds, fmt_options) {
189
+ var key, number, obj, options, strings, token;
190
+ if (fmt_options == null) {
191
+ fmt_options = {};
192
+ }
193
+ options = {};
194
+ for (key in fmt_options) {
195
+ obj = fmt_options[key];
196
+ options[key] = obj;
197
+ }
198
+ options["direction"] || (options["direction"] = (seconds < 0 ? "ago" : "until"));
199
+ if (options["unit"] === null || options["unit"] === void 0) {
200
+ options["unit"] = this.calculate_unit(Math.abs(seconds), options);
201
+ }
202
+ options["type"] || (options["type"] = this.default_type);
203
+ options["number"] = this.calculate_time(Math.abs(seconds), options["unit"]);
204
+ number = this.calculate_time(Math.abs(seconds), options["unit"]);
205
+ options["rule"] = TwitterCldr.PluralRules.rule_for(number);
206
+ strings = (function() {
207
+ var _i, _len, _ref, _results;
208
+ _ref = this.tokens[options["direction"]][options["unit"]][options["type"]][options["rule"]];
209
+ _results = [];
210
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
211
+ token = _ref[_i];
212
+ _results.push(token.value);
213
+ }
214
+ return _results;
215
+ }).call(this);
216
+ return strings.join("").replace(/\{[0-9]\}/, number.toString());
217
+ };
218
+
219
+ TimespanFormatter.prototype.calculate_unit = function(seconds, unit_options) {
220
+ var key, multiplier, obj, options;
221
+ if (unit_options == null) {
222
+ unit_options = {};
223
+ }
224
+ options = {};
225
+ for (key in unit_options) {
226
+ obj = unit_options[key];
227
+ options[key] = obj;
228
+ }
229
+ if (options.approximate == null) {
230
+ options["approximate"] = false;
231
+ }
232
+ multiplier = options.approximate ? this.approximate_multiplier : 1;
233
+ if (seconds < (this.time_in_seconds.minute * multiplier)) {
234
+ return "second";
235
+ } else if (seconds < (this.time_in_seconds.hour * multiplier)) {
236
+ return "minute";
237
+ } else if (seconds < (this.time_in_seconds.day * multiplier)) {
238
+ return "hour";
239
+ } else if (seconds < (this.time_in_seconds.week * multiplier)) {
240
+ return "day";
241
+ } else if (seconds < (this.time_in_seconds.month * multiplier)) {
242
+ return "week";
243
+ } else if (seconds < (this.time_in_seconds.year * multiplier)) {
244
+ return "month";
245
+ } else {
246
+ return "year";
247
+ }
248
+ };
249
+
250
+ TimespanFormatter.prototype.calculate_time = function(seconds, unit) {
251
+ return Math.round(seconds / this.time_in_seconds[unit]);
252
+ };
253
+
254
+ return TimespanFormatter;
255
+
256
+ })();
257
+
258
+ TwitterCldr.DateTimeFormatter = (function() {
259
+
260
+ function DateTimeFormatter() {
261
+ this.tokens = {"date_time":{"default":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"full":[{"value":"EEEE","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"zzzz","type":"pattern"}],"long":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"z","type":"pattern"}],"medium":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"short":[{"value":"yyyy","type":"pattern"},{"value":"-","type":"plaintext"},{"value":"MM","type":"pattern"},{"value":"-","type":"plaintext"},{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"additional":{"Ed":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"H":[{"value":"HH","type":"pattern"}],"Hm":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"Hms":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"M":[{"value":"L","type":"pattern"}],"MEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"}],"MMM":[{"value":"LLL","type":"pattern"}],"MMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMd":[{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMdd":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"}],"MMMd":[{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"Md":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"}],"d":[{"value":"d","type":"pattern"}],"h":[{"value":"h","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hm":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hms":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"ms":[{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"y":[{"value":"y","type":"pattern"}],"yM":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMM":[{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMM":[{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMd":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMd":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQ":[{"value":"QQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQQ":[{"value":"QQQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}]}},"time":{"default":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"full":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"zzzz","type":"pattern"}],"long":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"z","type":"pattern"}],"medium":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"short":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"additional":{"Ed":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"H":[{"value":"HH","type":"pattern"}],"Hm":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"Hms":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"M":[{"value":"L","type":"pattern"}],"MEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"}],"MMM":[{"value":"LLL","type":"pattern"}],"MMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMd":[{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMdd":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"}],"MMMd":[{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"Md":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"}],"d":[{"value":"d","type":"pattern"}],"h":[{"value":"h","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hm":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hms":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"ms":[{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"y":[{"value":"y","type":"pattern"}],"yM":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMM":[{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMM":[{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMd":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMd":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQ":[{"value":"QQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQQ":[{"value":"QQQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}]}},"date":{"default":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"full":[{"value":"EEEE","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"long":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"medium":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"short":[{"value":"yyyy","type":"pattern"},{"value":"-","type":"plaintext"},{"value":"MM","type":"pattern"},{"value":"-","type":"plaintext"},{"value":"dd","type":"pattern"}],"additional":{"Ed":[{"value":"E","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"H":[{"value":"HH","type":"pattern"}],"Hm":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"}],"Hms":[{"value":"HH","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"M":[{"value":"L","type":"pattern"}],"MEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"}],"MMM":[{"value":"LLL","type":"pattern"}],"MMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMd":[{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"MMMMdd":[{"value":"dd","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMMM","type":"pattern"}],"MMMd":[{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"d","type":"pattern"}],"Md":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"}],"d":[{"value":"d","type":"pattern"}],"h":[{"value":"h","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hm":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"hms":[{"value":"h","type":"pattern"},{"value":":","type":"plaintext"},{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"a","type":"pattern"}],"ms":[{"value":"mm","type":"pattern"},{"value":":","type":"plaintext"},{"value":"ss","type":"pattern"}],"y":[{"value":"y","type":"pattern"}],"yM":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMM":[{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMEd":[{"value":"E","type":"pattern"},{"value":", ","type":"plaintext"},{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMM":[{"value":"MMMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMMMd":[{"value":"d","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"MMM","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yMd":[{"value":"M","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"d","type":"pattern"},{"value":"/","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQ":[{"value":"QQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}],"yQQQQ":[{"value":"QQQQ","type":"pattern"},{"value":" ","type":"plaintext"},{"value":"y","type":"pattern"}]}}};
262
+ this.weekday_keys = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
263
+ this.methods = {
264
+ 'G': 'era',
265
+ 'y': 'year',
266
+ 'Y': 'year_of_week_of_year',
267
+ 'Q': 'quarter',
268
+ 'q': 'quarter_stand_alone',
269
+ 'M': 'month',
270
+ 'L': 'month_stand_alone',
271
+ 'w': 'week_of_year',
272
+ 'W': 'week_of_month',
273
+ 'd': 'day',
274
+ 'D': 'day_of_month',
275
+ 'F': 'day_of_week_in_month',
276
+ 'E': 'weekday',
277
+ 'e': 'weekday_local',
278
+ 'c': 'weekday_local_stand_alone',
279
+ 'a': 'period',
280
+ 'h': 'hour',
281
+ 'H': 'hour',
282
+ 'K': 'hour',
283
+ 'k': 'hour',
284
+ 'm': 'minute',
285
+ 's': 'second',
286
+ 'S': 'second_fraction',
287
+ 'z': 'timezone',
288
+ 'Z': 'timezone',
289
+ 'v': 'timezone_generic_non_location',
290
+ 'V': 'timezone_metazone'
291
+ };
292
+ }
293
+
294
+ DateTimeFormatter.prototype.format = function(obj, options) {
295
+ var format_token, token, tokens,
296
+ _this = this;
297
+ format_token = function(token) {
298
+ var result;
299
+ result = "";
300
+ switch (token.type) {
301
+ case "pattern":
302
+ return _this.result_for_token(token, obj);
303
+ default:
304
+ if (token.value.length > 0 && token.value[0] === "'" && token.value[token.value.length - 1] === "'") {
305
+ return token.value.substring(1, token.value.length - 1);
306
+ } else {
307
+ return token.value;
308
+ }
309
+ }
310
+ };
311
+ tokens = this.get_tokens(obj, options);
312
+ return ((function() {
313
+ var _i, _len, _results;
314
+ _results = [];
315
+ for (_i = 0, _len = tokens.length; _i < _len; _i++) {
316
+ token = tokens[_i];
317
+ _results.push(format_token(token));
318
+ }
319
+ return _results;
320
+ })()).join("");
321
+ };
322
+
323
+ DateTimeFormatter.prototype.get_tokens = function(obj, options) {
324
+ var format, type;
325
+ format = options.format || "date_time";
326
+ type = options.type || "default";
327
+ if (format === "additional") {
328
+ return this.tokens["date_time"][format][this.additional_format_selector().find_closest(options.type)];
329
+ } else {
330
+ return this.tokens[format][type];
331
+ }
332
+ };
333
+
334
+ DateTimeFormatter.prototype.result_for_token = function(token, date) {
335
+ return this[this.methods[token.value[0]]](date, token.value, token.value.length);
336
+ };
337
+
338
+ DateTimeFormatter.prototype.additional_format_selector = function() {
339
+ return new TwitterCldr.AdditionalDateFormatSelector(this.tokens["date_time"]["additional"]);
340
+ };
341
+
342
+ DateTimeFormatter.additional_formats = function() {
343
+ return new TwitterCldr.DateTimeFormatter().additional_format_selector().patterns();
344
+ };
345
+
346
+ DateTimeFormatter.prototype.era = function(date, pattern, length) {
347
+ var choices, index, result;
348
+ switch (length) {
349
+ case 0:
350
+ choices = ["", ""];
351
+ break;
352
+ case 1:
353
+ case 2:
354
+ case 3:
355
+ choices = TwitterCldr.Calendar.calendar["eras"]["abbr"];
356
+ break;
357
+ default:
358
+ choices = TwitterCldr.Calendar.calendar["eras"]["name"];
359
+ }
360
+ index = date.getFullYear() < 0 ? 0 : 1;
361
+ result = choices[index];
362
+ if (result != null) {
363
+ return result;
364
+ } else {
365
+ return this.era(date, pattern.slice(0, -1), length - 1);
366
+ }
367
+ };
368
+
369
+ DateTimeFormatter.prototype.year = function(date, pattern, length) {
370
+ var year;
371
+ year = date.getFullYear().toString();
372
+ if (length === 2) {
373
+ if (year.length !== 1) {
374
+ year = year.slice(-2);
375
+ }
376
+ }
377
+ if (length > 1) {
378
+ year = ("0000" + year).slice(-length);
379
+ }
380
+ return year;
381
+ };
382
+
383
+ DateTimeFormatter.prototype.year_of_week_of_year = function(date, pattern, length) {
384
+ throw 'not implemented';
385
+ };
386
+
387
+ DateTimeFormatter.prototype.day_of_week_in_month = function(date, pattern, length) {
388
+ throw 'not implemented';
389
+ };
390
+
391
+ DateTimeFormatter.prototype.quarter = function(date, pattern, length) {
392
+ var quarter;
393
+ quarter = ((date.getMonth() / 3) | 0) + 1;
394
+ switch (length) {
395
+ case 1:
396
+ return quarter.toString();
397
+ case 2:
398
+ return ("0000" + quarter.toString()).slice(-length);
399
+ case 3:
400
+ return TwitterCldr.Calendar.calendar.quarters.format.abbreviated[quarter];
401
+ case 4:
402
+ return TwitterCldr.Calendar.calendar.quarters.format.wide[quarter];
403
+ }
404
+ };
405
+
406
+ DateTimeFormatter.prototype.quarter_stand_alone = function(date, pattern, length) {
407
+ var quarter;
408
+ quarter = (date.getMonth() - 1) / 3 + 1;
409
+ switch (length) {
410
+ case 1:
411
+ return quarter.toString();
412
+ case 2:
413
+ return ("0000" + quarter.toString()).slice(-length);
414
+ case 3:
415
+ throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
416
+ break;
417
+ case 4:
418
+ throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
419
+ break;
420
+ case 5:
421
+ return TwitterCldr.Calendar.calendar.quarters['stand-alone'].narrow[quarter];
422
+ }
423
+ };
424
+
425
+ DateTimeFormatter.prototype.month = function(date, pattern, length) {
426
+ var month_str;
427
+ month_str = (date.getMonth() + 1).toString();
428
+ switch (length) {
429
+ case 1:
430
+ return month_str;
431
+ case 2:
432
+ return ("0000" + month_str).slice(-length);
433
+ case 3:
434
+ return TwitterCldr.Calendar.calendar.months.format.abbreviated[month_str];
435
+ case 4:
436
+ return TwitterCldr.Calendar.calendar.months.format.wide[month_str];
437
+ case 5:
438
+ throw 'not yet implemented (requires cldr\'s "multiple inheritance")';
439
+ break;
440
+ default:
441
+ throw "Unknown date format";
442
+ }
443
+ };
444
+
445
+ DateTimeFormatter.prototype.month_stand_alone = function(date, pattern, length) {
446
+ var month_str;
447
+ month_str = (date.getMonth() + 1).toString();
448
+ switch (length) {
449
+ case 1:
450
+ return month_str;
451
+ case 2:
452
+ return ("0000" + month_str).slice(-length);
453
+ case 3:
454
+ return TwitterCldr.Calendar.calendar.months['stand-alone'].abbreviated[month_str];
455
+ case 4:
456
+ return TwitterCldr.Calendar.calendar.months['stand-alone'].wide[month_str];
457
+ case 5:
458
+ return TwitterCldr.Calendar.calendar.months['stand-alone'].narrow[month_str];
459
+ default:
460
+ throw "Unknown date format";
461
+ }
462
+ };
463
+
464
+ DateTimeFormatter.prototype.day = function(date, pattern, length) {
465
+ switch (length) {
466
+ case 1:
467
+ return date.getDate().toString();
468
+ case 2:
469
+ return ("0000" + date.getDate().toString()).slice(-length);
470
+ }
471
+ };
472
+
473
+ DateTimeFormatter.prototype.weekday = function(date, pattern, length) {
474
+ var key;
475
+ key = this.weekday_keys[date.getDay()];
476
+ switch (length) {
477
+ case 1:
478
+ case 2:
479
+ case 3:
480
+ return TwitterCldr.Calendar.calendar.days.format.abbreviated[key];
481
+ case 4:
482
+ return TwitterCldr.Calendar.calendar.days.format.wide[key];
483
+ case 5:
484
+ return TwitterCldr.Calendar.calendar.days['stand-alone'].narrow[key];
485
+ }
486
+ };
487
+
488
+ DateTimeFormatter.prototype.weekday_local = function(date, pattern, length) {
489
+ var day;
490
+ switch (length) {
491
+ case 1:
492
+ case 2:
493
+ day = date.getDay();
494
+ if (day === 0) {
495
+ return "7";
496
+ } else {
497
+ return day.toString();
498
+ }
499
+ break;
500
+ default:
501
+ return this.weekday(date, pattern, length);
502
+ }
503
+ };
504
+
505
+ DateTimeFormatter.prototype.weekday_local_stand_alone = function(date, pattern, length) {
506
+ switch (length) {
507
+ case 1:
508
+ return this.weekday_local(date, pattern, length);
509
+ default:
510
+ return this.weekday(date, pattern, length);
511
+ }
512
+ };
513
+
514
+ DateTimeFormatter.prototype.period = function(time, pattern, length) {
515
+ if (time.getHours() > 11) {
516
+ return TwitterCldr.Calendar.calendar.periods.format.wide["pm"];
517
+ } else {
518
+ return TwitterCldr.Calendar.calendar.periods.format.wide["am"];
519
+ }
520
+ };
521
+
522
+ DateTimeFormatter.prototype.hour = function(time, pattern, length) {
523
+ var hour;
524
+ hour = time.getHours();
525
+ switch (pattern[0]) {
526
+ case 'h':
527
+ if (hour > 12) {
528
+ hour = hour - 12;
529
+ } else if (hour === 0) {
530
+ hour = 12;
531
+ }
532
+ break;
533
+ case 'K':
534
+ if (hour > 11) {
535
+ hour = hour - 12;
536
+ }
537
+ break;
538
+ case 'k':
539
+ if (hour === 0) {
540
+ hour = 24;
541
+ }
542
+ }
543
+ if (length === 1) {
544
+ return hour.toString();
545
+ } else {
546
+ return ("000000" + hour.toString()).slice(-length);
547
+ }
548
+ };
549
+
550
+ DateTimeFormatter.prototype.minute = function(time, pattern, length) {
551
+ if (length === 1) {
552
+ return time.getMinutes().toString();
553
+ } else {
554
+ return ("000000" + time.getMinutes().toString()).slice(-length);
555
+ }
556
+ };
557
+
558
+ DateTimeFormatter.prototype.second = function(time, pattern, length) {
559
+ if (length === 1) {
560
+ return time.getSeconds().toString();
561
+ } else {
562
+ return ("000000" + time.getSeconds().toString()).slice(-length);
563
+ }
564
+ };
565
+
566
+ DateTimeFormatter.prototype.second_fraction = function(time, pattern, length) {
567
+ if (length > 6) {
568
+ throw 'can not use the S format with more than 6 digits';
569
+ }
570
+ return ("000000" + Math.round(Math.pow(time.getMilliseconds() * 100.0, 6 - length)).toString()).slice(-length);
571
+ };
572
+
573
+ DateTimeFormatter.prototype.timezone = function(time, pattern, length) {
574
+ var hours, minutes, offset, offsetString, sign;
575
+ offset = time.getTimezoneOffset();
576
+ hours = ("00" + (Math.abs(offset) / 60).toString()).slice(-2);
577
+ minutes = ("00" + (Math.abs(offset) % 60).toString()).slice(-2);
578
+ sign = offset > 0 ? "-" : "+";
579
+ offsetString = sign + hours + ":" + minutes;
580
+ switch (length) {
581
+ case 1:
582
+ case 2:
583
+ case 3:
584
+ return offsetString;
585
+ default:
586
+ return "UTC" + offsetString;
587
+ }
588
+ };
589
+
590
+ DateTimeFormatter.prototype.timezone_generic_non_location = function(time, pattern, length) {
591
+ throw 'not yet implemented (requires timezone translation data")';
592
+ };
593
+
594
+ return DateTimeFormatter;
595
+
596
+ })();
597
+
598
+ TwitterCldr.AdditionalDateFormatSelector = (function() {
599
+
600
+ function AdditionalDateFormatSelector(pattern_hash) {
601
+ this.pattern_hash = pattern_hash;
602
+ }
603
+
604
+ AdditionalDateFormatSelector.prototype.find_closest = function(goal_pattern) {
605
+ var key, min_key, min_rank, rank, ranks;
606
+ if (!(goal_pattern != null) || goal_pattern.trim().length === 0) {
607
+ return null;
608
+ } else {
609
+ ranks = this.rank(goal_pattern);
610
+ min_rank = 100;
611
+ min_key = null;
612
+ for (key in ranks) {
613
+ rank = ranks[key];
614
+ if (rank < min_rank) {
615
+ min_rank = rank;
616
+ min_key = key;
617
+ }
618
+ }
619
+ return min_key;
620
+ }
621
+ };
622
+
623
+ AdditionalDateFormatSelector.prototype.patterns = function() {
624
+ var key, _results;
625
+ _results = [];
626
+ for (key in this.pattern_hash) {
627
+ _results.push(key);
628
+ }
629
+ return _results;
630
+ };
631
+
632
+ AdditionalDateFormatSelector.prototype.separate = function(pattern_key) {
633
+ var cur_char, last_char, result, _i, _len;
634
+ last_char = "";
635
+ result = [];
636
+ for (_i = 0, _len = pattern_key.length; _i < _len; _i++) {
637
+ cur_char = pattern_key[_i];
638
+ if (cur_char === last_char) {
639
+ result[result.length - 1] += cur_char;
640
+ } else {
641
+ result.push(cur_char);
642
+ }
643
+ last_char = cur_char;
644
+ }
645
+ return result;
646
+ };
647
+
648
+ AdditionalDateFormatSelector.prototype.all_separated_patterns = function() {
649
+ var key, _results;
650
+ _results = [];
651
+ for (key in this.pattern_hash) {
652
+ _results.push(this.separate(key));
653
+ }
654
+ return _results;
655
+ };
656
+
657
+ AdditionalDateFormatSelector.prototype.score = function(entities, goal_entities) {
658
+ var score;
659
+ score = this.exist_score(entities, goal_entities) * 2;
660
+ score += this.position_score(entities, goal_entities);
661
+ return score + this.count_score(entities, goal_entities);
662
+ };
663
+
664
+ AdditionalDateFormatSelector.prototype.position_score = function(entities, goal_entities) {
665
+ var found, goal_entity, index, sum;
666
+ sum = 0;
667
+ for (index in goal_entities) {
668
+ goal_entity = goal_entities[index];
669
+ found = entities.indexOf(goal_entity);
670
+ if (found > -1) {
671
+ sum += Math.abs(found - index);
672
+ }
673
+ }
674
+ return sum;
675
+ };
676
+
677
+ AdditionalDateFormatSelector.prototype.exist_score = function(entities, goal_entities) {
678
+ var count, entity, goal_entity, _i, _len;
679
+ count = 0;
680
+ for (_i = 0, _len = goal_entities.length; _i < _len; _i++) {
681
+ goal_entity = goal_entities[_i];
682
+ if (!(((function() {
683
+ var _j, _len1, _results;
684
+ _results = [];
685
+ for (_j = 0, _len1 = entities.length; _j < _len1; _j++) {
686
+ entity = entities[_j];
687
+ if (entity[0] === goal_entity[0]) {
688
+ _results.push(entity);
689
+ }
690
+ }
691
+ return _results;
692
+ })()).length > 0)) {
693
+ count += 1;
694
+ }
695
+ }
696
+ return count;
697
+ };
698
+
699
+ AdditionalDateFormatSelector.prototype.count_score = function(entities, goal_entities) {
700
+ var entity, found_entity, goal_entity, sum, _i, _len;
701
+ sum = 0;
702
+ for (_i = 0, _len = goal_entities.length; _i < _len; _i++) {
703
+ goal_entity = goal_entities[_i];
704
+ found_entity = ((function() {
705
+ var _j, _len1, _results;
706
+ _results = [];
707
+ for (_j = 0, _len1 = entities.length; _j < _len1; _j++) {
708
+ entity = entities[_j];
709
+ if (entity[0] === goal_entity[0]) {
710
+ _results.push(entity);
711
+ }
712
+ }
713
+ return _results;
714
+ })())[0];
715
+ if (found_entity != null) {
716
+ sum += Math.abs(found_entity.length - goal_entity.length);
717
+ }
718
+ }
719
+ return sum;
720
+ };
721
+
722
+ AdditionalDateFormatSelector.prototype.rank = function(goal_pattern) {
723
+ var result, separated_goal_pattern, separated_pattern, _i, _len, _ref;
724
+ separated_goal_pattern = this.separate(goal_pattern);
725
+ result = {};
726
+ _ref = this.all_separated_patterns();
727
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
728
+ separated_pattern = _ref[_i];
729
+ result[separated_pattern.join("")] = this.score(separated_pattern, separated_goal_pattern);
730
+ }
731
+ return result;
732
+ };
733
+
734
+ return AdditionalDateFormatSelector;
735
+
736
+ })();
737
+
738
+ TwitterCldr.NumberFormatter = (function() {
739
+
740
+ function NumberFormatter() {
741
+ this.all_tokens = {"decimal":{"positive":["","#,##0.###"],"negative":["-","#,##0.###"]},"percent":{"positive":["","#,##0","%"],"negative":["-","#,##0","%"]},"currency":{"positive":["¤","#,##0.00"],"negative":["-(¤","#,##0.00",")"]},"short_decimal":{"positive":{"1000":["","0"],"10000":["","0"],"100000":["","0"],"1000000":["","0"," m"],"10000000":["","00"," m"],"100000000":["","000"," m"],"1000000000":["","0"," mjd"],"10000000000":["","00"," mjd"],"100000000000":["","000"," mjd"],"1000000000000":["","0"," bn"],"10000000000000":["","00"," bn"],"100000000000000":["","000"," bn"]},"negative":{"1000":["-","0"],"10000":["-","0"],"100000":["-","0"],"1000000":["-","0"," m"],"10000000":["-","00"," m"],"100000000":["-","000"," m"],"1000000000":["-","0"," mjd"],"10000000000":["-","00"," mjd"],"100000000000":["-","000"," mjd"],"1000000000000":["-","0"," bn"],"10000000000000":["-","00"," bn"],"100000000000000":["-","000"," bn"]}},"long_decimal":{"positive":{"1000":["","0"," duisend"],"10000":["","00"," duisend"],"100000":["","000"," duisend"],"1000000":["","0"," miljoen"],"10000000":["","00"," miljoen"],"100000000":["","000"," miljoen"],"1000000000":["","0"," miljard"],"10000000000":["","00"," miljard"],"100000000000":["","000"," miljard"],"1000000000000":["","0"," biljoen"],"10000000000000":["","00"," biljoen"],"100000000000000":["","000"," biljoen"]},"negative":{"1000":["-","0"," duisend"],"10000":["-","00"," duisend"],"100000":["-","000"," duisend"],"1000000":["-","0"," miljoen"],"10000000":["-","00"," miljoen"],"100000000":["-","000"," miljoen"],"1000000000":["-","0"," miljard"],"10000000000":["-","00"," miljard"],"100000000000":["-","000"," miljard"],"1000000000000":["-","0"," biljoen"],"10000000000000":["-","00"," biljoen"],"100000000000000":["-","000"," biljoen"]}}};
742
+ this.tokens = [];
743
+ this.symbols = {"alias":"","decimal":",","exponential":"E","group":" ","infinity":"∞","list":";","minus_sign":"-","nan":"NaN","per_mille":"‰","percent_sign":"%","plus_sign":"+"};
744
+ this.default_symbols = {
745
+ 'group': ',',
746
+ 'decimal': '.',
747
+ 'plus_sign': '+',
748
+ 'minus_sign': '-'
749
+ };
750
+ }
751
+
752
+ NumberFormatter.prototype.format = function(number, options) {
753
+ var fraction, fraction_format, integer_format, intg, key, opts, prefix, result, sign, suffix, val, _ref, _ref1;
754
+ if (options == null) {
755
+ options = {};
756
+ }
757
+ opts = this.default_format_options_for(number);
758
+ for (key in options) {
759
+ val = options[key];
760
+ opts[key] = options[key] != null ? options[key] : opts[key];
761
+ }
762
+ _ref = this.partition_tokens(this.get_tokens(number, opts)), prefix = _ref[0], suffix = _ref[1], integer_format = _ref[2], fraction_format = _ref[3];
763
+ number = this.transform_number(number);
764
+ _ref1 = this.parse_number(number, opts), intg = _ref1[0], fraction = _ref1[1];
765
+ result = integer_format.apply(parseFloat(intg), opts);
766
+ if (fraction) {
767
+ result += fraction_format.apply(fraction, opts);
768
+ }
769
+ sign = number < 0 && prefix !== "-" ? this.symbols.minus_sign || this.default_symbols.minus_sign : "";
770
+ return "" + prefix + result + suffix;
771
+ };
772
+
773
+ NumberFormatter.prototype.transform_number = function(number) {
774
+ return number;
775
+ };
776
+
777
+ NumberFormatter.prototype.partition_tokens = function(tokens) {
778
+ return [tokens[0] || "", tokens[2] || "", new TwitterCldr.NumberFormatter.IntegerHelper(tokens[1], this.symbols), new TwitterCldr.NumberFormatter.FractionHelper(tokens[1], this.symbols)];
779
+ };
780
+
781
+ NumberFormatter.prototype.parse_number = function(number, options) {
782
+ var precision;
783
+ if (options == null) {
784
+ options = {};
785
+ }
786
+ if (options.precision != null) {
787
+ precision = options.precision;
788
+ } else {
789
+ precision = this.precision_from(number);
790
+ }
791
+ number = this.round_to(number, precision);
792
+ return Math.abs(number).toFixed(precision).split(".");
793
+ };
794
+
795
+ NumberFormatter.prototype.precision_from = function(num) {
796
+ var parts;
797
+ parts = num.toString().split(".");
798
+ if (parts.length === 2) {
799
+ return parts[1].length;
800
+ } else {
801
+ return 0;
802
+ }
803
+ };
804
+
805
+ NumberFormatter.prototype.round_to = function(number, precision) {
806
+ var factor;
807
+ factor = Math.pow(10, precision);
808
+ return Math.round(number * factor) / factor;
809
+ };
810
+
811
+ NumberFormatter.prototype.get_tokens = function() {
812
+ throw "get_tokens() not implemented - use a derived class like PercentFormatter.";
813
+ };
814
+
815
+ return NumberFormatter;
816
+
817
+ })();
818
+
819
+ TwitterCldr.PercentFormatter = (function(_super) {
820
+
821
+ __extends(PercentFormatter, _super);
822
+
823
+ function PercentFormatter(options) {
824
+ if (options == null) {
825
+ options = {};
826
+ }
827
+ this.default_percent_sign = "%";
828
+ PercentFormatter.__super__.constructor.apply(this, arguments);
829
+ }
830
+
831
+ PercentFormatter.prototype.format = function(number, options) {
832
+ if (options == null) {
833
+ options = {};
834
+ }
835
+ return PercentFormatter.__super__.format.call(this, number, options).replace('¤', this.symbols.percent_sign || this.default_percent_sign);
836
+ };
837
+
838
+ PercentFormatter.prototype.default_format_options_for = function(number) {
839
+ return {
840
+ precision: 0
841
+ };
842
+ };
843
+
844
+ PercentFormatter.prototype.get_tokens = function(number, options) {
845
+ if (number < 0) {
846
+ return this.all_tokens.percent.negative;
847
+ } else {
848
+ return this.all_tokens.percent.positive;
849
+ }
850
+ };
851
+
852
+ return PercentFormatter;
853
+
854
+ })(TwitterCldr.NumberFormatter);
855
+
856
+ TwitterCldr.DecimalFormatter = (function(_super) {
857
+
858
+ __extends(DecimalFormatter, _super);
859
+
860
+ function DecimalFormatter() {
861
+ return DecimalFormatter.__super__.constructor.apply(this, arguments);
862
+ }
863
+
864
+ DecimalFormatter.prototype.format = function(number, options) {
865
+ if (options == null) {
866
+ options = {};
867
+ }
868
+ try {
869
+ return DecimalFormatter.__super__.format.call(this, number, options);
870
+ } catch (error) {
871
+ return number;
872
+ }
873
+ };
874
+
875
+ DecimalFormatter.prototype.default_format_options_for = function(number) {
876
+ return {
877
+ precision: this.precision_from(number)
878
+ };
879
+ };
880
+
881
+ DecimalFormatter.prototype.get_tokens = function(number, options) {
882
+ if (options == null) {
883
+ options = {};
884
+ }
885
+ if (number < 0) {
886
+ return this.all_tokens.decimal.negative;
887
+ } else {
888
+ return this.all_tokens.decimal.positive;
889
+ }
890
+ };
891
+
892
+ return DecimalFormatter;
893
+
894
+ })(TwitterCldr.NumberFormatter);
895
+
896
+ TwitterCldr.CurrencyFormatter = (function(_super) {
897
+
898
+ __extends(CurrencyFormatter, _super);
899
+
900
+ function CurrencyFormatter(options) {
901
+ if (options == null) {
902
+ options = {};
903
+ }
904
+ this.default_currency_symbol = "$";
905
+ this.default_precision = 2;
906
+ CurrencyFormatter.__super__.constructor.apply(this, arguments);
907
+ }
908
+
909
+ CurrencyFormatter.prototype.format = function(number, options) {
910
+ var currency;
911
+ if (options == null) {
912
+ options = {};
913
+ }
914
+ if (options.currency) {
915
+ if (TwitterCldr.Currencies != null) {
916
+ currency = TwitterCldr.Currencies.for_code(options.currency);
917
+ currency || (currency = {
918
+ symbol: options.currency
919
+ });
920
+ } else {
921
+ currency = {
922
+ symbol: options.currency
923
+ };
924
+ }
925
+ } else {
926
+ currency = {
927
+ symbol: this.default_currency_symbol
928
+ };
929
+ }
930
+ return CurrencyFormatter.__super__.format.call(this, number, options).replace('¤', currency.symbol);
931
+ };
932
+
933
+ CurrencyFormatter.prototype.default_format_options_for = function(number) {
934
+ var precision;
935
+ precision = this.precision_from(number);
936
+ if (precision === 0) {
937
+ precision = this.default_precision;
938
+ }
939
+ return {
940
+ precision: precision
941
+ };
942
+ };
943
+
944
+ CurrencyFormatter.prototype.get_tokens = function(number, options) {
945
+ if (options == null) {
946
+ options = {};
947
+ }
948
+ if (number < 0) {
949
+ return this.all_tokens.currency.negative;
950
+ } else {
951
+ return this.all_tokens.currency.positive;
952
+ }
953
+ };
954
+
955
+ return CurrencyFormatter;
956
+
957
+ })(TwitterCldr.NumberFormatter);
958
+
959
+ TwitterCldr.AbbreviatedNumberFormatter = (function(_super) {
960
+
961
+ __extends(AbbreviatedNumberFormatter, _super);
962
+
963
+ function AbbreviatedNumberFormatter() {
964
+ return AbbreviatedNumberFormatter.__super__.constructor.apply(this, arguments);
965
+ }
966
+
967
+ AbbreviatedNumberFormatter.prototype.NUMBER_MAX = Math.pow(10, 15);
968
+
969
+ AbbreviatedNumberFormatter.prototype.NUMBER_MIN = 1000;
970
+
971
+ AbbreviatedNumberFormatter.prototype.default_format_options_for = function(number) {
972
+ return {
973
+ precision: this.precision_from(number)
974
+ };
975
+ };
976
+
977
+ AbbreviatedNumberFormatter.prototype.get_type = function() {
978
+ return "decimal";
979
+ };
980
+
981
+ AbbreviatedNumberFormatter.prototype.get_key = function(number) {
982
+ var i, zeroes;
983
+ zeroes = ((function() {
984
+ var _i, _ref, _results;
985
+ _results = [];
986
+ for (i = _i = 0, _ref = Math.floor(number).toString().length - 1; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
987
+ _results.push("0");
988
+ }
989
+ return _results;
990
+ })()).join("");
991
+ return "1" + zeroes;
992
+ };
993
+
994
+ AbbreviatedNumberFormatter.prototype.get_tokens = function(number, options) {
995
+ var format, tokens, type;
996
+ if (options == null) {
997
+ options = {};
998
+ }
999
+ type = (number < this.NUMBER_MAX) && (number >= this.NUMBER_MIN) ? this.get_type() : "decimal";
1000
+ format = type === this.get_type() ? this.get_key(number) : null;
1001
+ tokens = this.all_tokens[type];
1002
+ tokens = number < 0 ? tokens.negative : tokens.positive;
1003
+ if (format != null) {
1004
+ tokens = tokens[format];
1005
+ }
1006
+ return tokens;
1007
+ };
1008
+
1009
+ AbbreviatedNumberFormatter.prototype.transform_number = function(number) {
1010
+ var sig_figs;
1011
+ if ((number < this.NUMBER_MAX) && (number >= this.NUMBER_MIN)) {
1012
+ sig_figs = (parseInt(number).toString().length - 1) % 3;
1013
+ return parseInt(number.toString().slice(0, +sig_figs + 1 || 9e9));
1014
+ } else {
1015
+ return number;
1016
+ }
1017
+ };
1018
+
1019
+ return AbbreviatedNumberFormatter;
1020
+
1021
+ })(TwitterCldr.NumberFormatter);
1022
+
1023
+ TwitterCldr.ShortDecimalFormatter = (function(_super) {
1024
+
1025
+ __extends(ShortDecimalFormatter, _super);
1026
+
1027
+ function ShortDecimalFormatter() {
1028
+ return ShortDecimalFormatter.__super__.constructor.apply(this, arguments);
1029
+ }
1030
+
1031
+ ShortDecimalFormatter.prototype.get_type = function() {
1032
+ return "short_decimal";
1033
+ };
1034
+
1035
+ return ShortDecimalFormatter;
1036
+
1037
+ })(TwitterCldr.AbbreviatedNumberFormatter);
1038
+
1039
+ TwitterCldr.LongDecimalFormatter = (function(_super) {
1040
+
1041
+ __extends(LongDecimalFormatter, _super);
1042
+
1043
+ function LongDecimalFormatter() {
1044
+ return LongDecimalFormatter.__super__.constructor.apply(this, arguments);
1045
+ }
1046
+
1047
+ LongDecimalFormatter.prototype.get_type = function() {
1048
+ return "long_decimal";
1049
+ };
1050
+
1051
+ return LongDecimalFormatter;
1052
+
1053
+ })(TwitterCldr.AbbreviatedNumberFormatter);
1054
+
1055
+ TwitterCldr.NumberFormatter.BaseHelper = (function() {
1056
+
1057
+ function BaseHelper() {}
1058
+
1059
+ BaseHelper.prototype.interpolate = function(string, value, orientation) {
1060
+ var i, length, start;
1061
+ if (orientation == null) {
1062
+ orientation = "right";
1063
+ }
1064
+ value = value.toString();
1065
+ length = value.length;
1066
+ start = orientation === "left" ? 0 : -length;
1067
+ if (string.length < length) {
1068
+ string = (((function() {
1069
+ var _i, _results;
1070
+ _results = [];
1071
+ for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) {
1072
+ _results.push("#");
1073
+ }
1074
+ return _results;
1075
+ })()).join("") + string).slice(-length);
1076
+ }
1077
+ if (start < 0) {
1078
+ string = string.slice(0, start + string.length) + value;
1079
+ } else {
1080
+ string = string.slice(0, start) + value + string.slice(length);
1081
+ }
1082
+ return string.replace(/#/g, "");
1083
+ };
1084
+
1085
+ return BaseHelper;
1086
+
1087
+ })();
1088
+
1089
+ TwitterCldr.NumberFormatter.IntegerHelper = (function(_super) {
1090
+
1091
+ __extends(IntegerHelper, _super);
1092
+
1093
+ function IntegerHelper(token, symbols) {
1094
+ var format;
1095
+ if (symbols == null) {
1096
+ symbols = {};
1097
+ }
1098
+ format = token.split('.')[0];
1099
+ this.format = this.prepare_format(format, symbols);
1100
+ this.groups = this.parse_groups(format);
1101
+ this.separator = symbols.group || ',';
1102
+ }
1103
+
1104
+ IntegerHelper.prototype.apply = function(number, options) {
1105
+ if (options == null) {
1106
+ options = {};
1107
+ }
1108
+ return this.format_groups(this.interpolate(this.format, parseInt(number)));
1109
+ };
1110
+
1111
+ IntegerHelper.prototype.format_groups = function(string) {
1112
+ var cur_token, token, tokens;
1113
+ if (this.groups.length === 0) {
1114
+ return string;
1115
+ }
1116
+ tokens = [];
1117
+ cur_token = this.chop_group(string, this.groups[0]);
1118
+ tokens.push(cur_token);
1119
+ if (cur_token) {
1120
+ string = string.slice(0, string.length - cur_token.length);
1121
+ }
1122
+ while (string.length > this.groups[this.groups.length - 1]) {
1123
+ cur_token = this.chop_group(string, this.groups[this.groups.length - 1]);
1124
+ tokens.push(cur_token);
1125
+ if (cur_token) {
1126
+ string = string.slice(0, string.length - cur_token.length);
1127
+ }
1128
+ }
1129
+ tokens.push(string);
1130
+ return ((function() {
1131
+ var _i, _len, _results;
1132
+ _results = [];
1133
+ for (_i = 0, _len = tokens.length; _i < _len; _i++) {
1134
+ token = tokens[_i];
1135
+ if (token !== null) {
1136
+ _results.push(token);
1137
+ }
1138
+ }
1139
+ return _results;
1140
+ })()).reverse().join(this.separator);
1141
+ };
1142
+
1143
+ IntegerHelper.prototype.parse_groups = function(format) {
1144
+ var index, rest, width, widths;
1145
+ index = format.lastIndexOf(',');
1146
+ if (!(index > 0)) {
1147
+ return [];
1148
+ }
1149
+ rest = format.slice(0, index);
1150
+ widths = [format.length - index - 1];
1151
+ if (rest.lastIndexOf(',') > -1) {
1152
+ widths.push(rest.length - rest.lastIndexOf(',') - 1);
1153
+ }
1154
+ widths = (function() {
1155
+ var _i, _len, _results;
1156
+ _results = [];
1157
+ for (_i = 0, _len = widths.length; _i < _len; _i++) {
1158
+ width = widths[_i];
1159
+ if (width !== null) {
1160
+ _results.push(width);
1161
+ }
1162
+ }
1163
+ return _results;
1164
+ })();
1165
+ widths.reverse();
1166
+ return ((function() {
1167
+ var _i, _ref, _results;
1168
+ _results = [];
1169
+ for (index = _i = 0, _ref = widths.length; 0 <= _ref ? _i < _ref : _i > _ref; index = 0 <= _ref ? ++_i : --_i) {
1170
+ if (widths.indexOf(widths[index], index + 1) === -1) {
1171
+ _results.push(widths[index]);
1172
+ }
1173
+ }
1174
+ return _results;
1175
+ })()).reverse();
1176
+ };
1177
+
1178
+ IntegerHelper.prototype.chop_group = function(string, size) {
1179
+ if (string.length > size) {
1180
+ return string.slice(-size);
1181
+ } else {
1182
+ return null;
1183
+ }
1184
+ };
1185
+
1186
+ IntegerHelper.prototype.prepare_format = function(format, symbols) {
1187
+ return format.replace(",", "").replace("+", symbols.plus_sign).replace("-", symbols.minus_sign);
1188
+ };
1189
+
1190
+ return IntegerHelper;
1191
+
1192
+ })(TwitterCldr.NumberFormatter.BaseHelper);
1193
+
1194
+ TwitterCldr.NumberFormatter.FractionHelper = (function(_super) {
1195
+
1196
+ __extends(FractionHelper, _super);
1197
+
1198
+ function FractionHelper(token, symbols) {
1199
+ if (symbols == null) {
1200
+ symbols = {};
1201
+ }
1202
+ this.format = token ? token.split('.').pop() : "";
1203
+ this.decimal = symbols.decimal || ".";
1204
+ this.precision = this.format.length;
1205
+ }
1206
+
1207
+ FractionHelper.prototype.apply = function(fraction, options) {
1208
+ var precision;
1209
+ if (options == null) {
1210
+ options = {};
1211
+ }
1212
+ precision = options.precision != null ? options.precision : this.precision;
1213
+ if (precision > 0) {
1214
+ return this.decimal + this.interpolate(this.format_for(options), fraction, "left");
1215
+ } else {
1216
+ return "";
1217
+ }
1218
+ };
1219
+
1220
+ FractionHelper.prototype.format_for = function(options) {
1221
+ var i, precision;
1222
+ precision = options.precision != null ? options.precision : this.precision;
1223
+ if (precision) {
1224
+ return ((function() {
1225
+ var _i, _results;
1226
+ _results = [];
1227
+ for (i = _i = 0; 0 <= precision ? _i < precision : _i > precision; i = 0 <= precision ? ++_i : --_i) {
1228
+ _results.push("0");
1229
+ }
1230
+ return _results;
1231
+ })()).join("");
1232
+ } else {
1233
+ return this.format;
1234
+ }
1235
+ };
1236
+
1237
+ return FractionHelper;
1238
+
1239
+ })(TwitterCldr.NumberFormatter.BaseHelper);
1240
+
1241
+ TwitterCldr.Currencies = (function() {
1242
+
1243
+ function Currencies() {}
1244
+
1245
+ Currencies.currencies = {"ADP":{"currency":"ADP","name":"Andorran peseta","symbol":null},"AED":{"currency":"AED","name":"UAE dirham","symbol":null},"AFA":{"currency":"AFA","name":"Afghan afghani (1927-2002)","symbol":null},"AFN":{"currency":"AFN","name":"Afghan Afghani","symbol":null},"ALK":{"currency":"ALK","name":"Albanian lek (1946-1965)","symbol":null},"ALL":{"currency":"ALL","name":"Albanian lek","symbol":null},"AMD":{"currency":"AMD","name":"Armenian dram","symbol":null},"ANG":{"currency":"ANG","name":"Netherlands Antillean guilder","symbol":null},"AOA":{"currency":"AOA","name":"Angolan kwanza","symbol":null},"AOK":{"currency":"AOK","name":"Angolan kwanza (1977-1991)","symbol":null},"AON":{"currency":"AON","name":"Angolan new kwanza (1990-2000)","symbol":null},"AOR":{"currency":"AOR","name":"Angolan readjusted kwanza (1995-1999)","symbol":null},"ARA":{"currency":"ARA","name":"Argentine austral","symbol":null},"ARL":{"currency":"ARL","name":"Argentine peso ley (1970-1983)","symbol":null},"ARM":{"currency":"ARM","name":"Argentine peso (1881-1970)","symbol":null},"ARP":{"currency":"ARP","name":"Argentine peso (1983-1985)","symbol":null},"ARS":{"currency":"ARS","name":"Argentine peso","symbol":null},"ATS":{"currency":"ATS","name":"Austrian schilling","symbol":null},"AUD":{"currency":"AUD","name":"Australian dollar","symbol":"A$"},"AWG":{"currency":"AWG","name":"Aruban florin","symbol":null},"AZM":{"currency":"AZM","name":"Azerbaijani manat (1993-2006)","symbol":null},"AZN":{"currency":"AZN","name":"Azerbaijani manat","symbol":null},"BAD":{"currency":"BAD","name":"Bosnia-Herzegovina dinar (1992-1994)","symbol":null},"BAM":{"currency":"BAM","name":"Bosnia-Herzegovina convertible mark","symbol":null},"BAN":{"currency":"BAN","name":"Bosnia-Herzegovina new dinar (1994-1997)","symbol":null},"BBD":{"currency":"BBD","name":"Barbadian dollar","symbol":null},"BDT":{"currency":"BDT","name":"Bangladeshi taka","symbol":null},"BEC":{"currency":"BEC","name":"Belgian franc (convertible)","symbol":null},"BEF":{"currency":"BEF","name":"Belgian franc","symbol":null},"BEL":{"currency":"BEL","name":"Belgian franc (financial)","symbol":null},"BGL":{"currency":"BGL","name":"Bulgarian hard lev","symbol":null},"BGM":{"currency":"BGM","name":"Bulgarian socialist lev","symbol":null},"BGN":{"currency":"BGN","name":"Bulgarian lev","symbol":null},"BGO":{"currency":"BGO","name":"Bulgarian lev (1879-1952)","symbol":null},"BHD":{"currency":"BHD","name":"Bahraini dinar","symbol":null},"BIF":{"currency":"BIF","name":"Burundian franc","symbol":null},"BMD":{"currency":"BMD","name":"Bermudan dollar","symbol":null},"BND":{"currency":"BND","name":"Brunei dollar","symbol":null},"BOB":{"currency":"BOB","name":"Bolivian boliviano","symbol":null},"BOL":{"currency":"BOL","name":"Bolivian boliviano (1863-1963)","symbol":null},"BOP":{"currency":"BOP","name":"Bolivian peso","symbol":null},"BOV":{"currency":"BOV","name":"Bolivian mvdol","symbol":null},"BRB":{"currency":"BRB","name":"Brazilian new cruzeiro (1967-1986)","symbol":null},"BRC":{"currency":"BRC","name":"Brazilian cruzado (1986-1989)","symbol":null},"BRE":{"currency":"BRE","name":"Brazilian cruzeiro (1990-1993)","symbol":null},"BRL":{"currency":"BRL","name":"Brazilian real","symbol":"R$"},"BRN":{"currency":"BRN","name":"Brazilian new cruzado (1989-1990)","symbol":null},"BRR":{"currency":"BRR","name":"Brazilian cruzeiro (1993-1994)","symbol":null},"BRZ":{"currency":"BRZ","name":"Brazilian cruzeiro (1942-1967)","symbol":null},"BSD":{"currency":"BSD","name":"Bahamian dollar","symbol":null},"BTN":{"currency":"BTN","name":"Bhutanese ngultrum","symbol":null},"BUK":{"currency":"BUK","name":"Burmese kyat","symbol":null},"BWP":{"currency":"BWP","name":"Botswanan pula","symbol":null},"BYB":{"currency":"BYB","name":"Belarusian new ruble (1994-1999)","symbol":null},"BYR":{"currency":"BYR","name":"Belarusian ruble","symbol":null},"BZD":{"currency":"BZD","name":"Belize dollar","symbol":null},"CAD":{"currency":"CAD","name":"Canadian dollar","symbol":"CA$"},"CDF":{"currency":"CDF","name":"Congolese franc","symbol":null},"CHE":{"currency":"CHE","name":"WIR euro","symbol":null},"CHF":{"currency":"CHF","name":"Swiss franc","symbol":null},"CHW":{"currency":"CHW","name":"WIR franc","symbol":null},"CLE":{"currency":"CLE","name":"Chilean escudo","symbol":null},"CLF":{"currency":"CLF","name":"Chilean unit of account (UF)","symbol":null},"CLP":{"currency":"CLP","name":"Chilean peso","symbol":null},"CNX":{"currency":"CNX","name":"Chinese People’s Bank dollar","symbol":null},"CNY":{"currency":"CNY","name":"Chinese yuan","symbol":"CN¥"},"COP":{"currency":"COP","name":"Colombian peso","symbol":null},"COU":{"currency":"COU","name":"Colombian real value unit","symbol":null},"CRC":{"currency":"CRC","name":"Costa Rican colón","symbol":null},"CSD":{"currency":"CSD","name":"Serbian dinar (2002-2006)","symbol":null},"CSK":{"currency":"CSK","name":"Czechoslovak hard koruna","symbol":null},"CUC":{"currency":"CUC","name":"Cuban convertible peso","symbol":null},"CUP":{"currency":"CUP","name":"Cuban peso","symbol":null},"CVE":{"currency":"CVE","name":"Cape Verdean escudo","symbol":null},"CYP":{"currency":"CYP","name":"Cypriot pound","symbol":null},"CZK":{"currency":"CZK","name":"Czech Republic koruna","symbol":null},"DDM":{"currency":"DDM","name":"East German mark","symbol":null},"DEM":{"currency":"DEM","name":"German mark","symbol":null},"DJF":{"currency":"DJF","name":"Djiboutian franc","symbol":null},"DKK":{"currency":"DKK","name":"Danish krone","symbol":null},"DOP":{"currency":"DOP","name":"Dominican peso","symbol":null},"DZD":{"currency":"DZD","name":"Algerian dinar","symbol":null},"ECS":{"currency":"ECS","name":"Ecuadorian sucre","symbol":null},"ECV":{"currency":"ECV","name":"Ecuadorian unit of constant value","symbol":null},"EEK":{"currency":"EEK","name":"Estonian kroon","symbol":null},"EGP":{"currency":"EGP","name":"Egyptian pound","symbol":null},"ERN":{"currency":"ERN","name":"Eritrean nakfa","symbol":null},"ESA":{"currency":"ESA","name":"Spanish peseta (A account)","symbol":null},"ESB":{"currency":"ESB","name":"Spanish peseta (convertible account)","symbol":null},"ESP":{"currency":"ESP","name":"Spanish peseta","symbol":null},"ETB":{"currency":"ETB","name":"Ethiopian birr","symbol":null},"EUR":{"currency":"EUR","name":"euro","symbol":"€"},"FIM":{"currency":"FIM","name":"Finnish markka","symbol":null},"FJD":{"currency":"FJD","name":"Fijian dollar","symbol":null},"FKP":{"currency":"FKP","name":"Falkland Islands pound","symbol":null},"FRF":{"currency":"FRF","name":"French franc","symbol":null},"GBP":{"currency":"GBP","name":"British pound sterling","symbol":"£"},"GEK":{"currency":"GEK","name":"Georgian kupon larit","symbol":null},"GEL":{"currency":"GEL","name":"Georgian lari","symbol":null},"GHC":{"currency":"GHC","name":"Ghanaian cedi (1979-2007)","symbol":null},"GHS":{"currency":"GHS","name":"Ghanaian cedi","symbol":null},"GIP":{"currency":"GIP","name":"Gibraltar pound","symbol":null},"GMD":{"currency":"GMD","name":"Gambian dalasi","symbol":null},"GNF":{"currency":"GNF","name":"Guinean franc","symbol":null},"GNS":{"currency":"GNS","name":"Guinean syli","symbol":null},"GQE":{"currency":"GQE","name":"Equatorial Guinean ekwele","symbol":null},"GRD":{"currency":"GRD","name":"Greek drachma","symbol":null},"GTQ":{"currency":"GTQ","name":"Guatemalan quetzal","symbol":null},"GWE":{"currency":"GWE","name":"Portuguese Guinea escudo","symbol":null},"GWP":{"currency":"GWP","name":"Guinea-Bissau peso","symbol":null},"GYD":{"currency":"GYD","name":"Guyanaese dollar","symbol":null},"HKD":{"currency":"HKD","name":"Hong Kong dollar","symbol":"HK$"},"HNL":{"currency":"HNL","name":"Honduran lempira","symbol":null},"HRD":{"currency":"HRD","name":"Croatian dinar","symbol":null},"HRK":{"currency":"HRK","name":"Croatian kuna","symbol":null},"HTG":{"currency":"HTG","name":"Haitian gourde","symbol":null},"HUF":{"currency":"HUF","name":"Hungarian forint","symbol":null},"IDR":{"currency":"IDR","name":"Indonesian rupiah","symbol":null},"IEP":{"currency":"IEP","name":"Irish pound","symbol":null},"ILP":{"currency":"ILP","name":"Israeli pound","symbol":null},"ILR":{"currency":"ILR","name":"Israeli sheqel (1980-1985)","symbol":null},"ILS":{"currency":"ILS","name":"Israeli new sheqel","symbol":"₪"},"INR":{"currency":"INR","name":"Indian rupee","symbol":"₹"},"IQD":{"currency":"IQD","name":"Iraqi dinar","symbol":null},"IRR":{"currency":"IRR","name":"Iranian rial","symbol":null},"ISJ":{"currency":"ISJ","name":"Icelandic króna (1918-1981)","symbol":null},"ISK":{"currency":"ISK","name":"Icelandic króna","symbol":null},"ITL":{"currency":"ITL","name":"Italian lira","symbol":null},"JMD":{"currency":"JMD","name":"Jamaican dollar","symbol":null},"JOD":{"currency":"JOD","name":"Jordanian dinar","symbol":null},"JPY":{"currency":"JPY","name":"Japanese yen","symbol":"¥"},"KES":{"currency":"KES","name":"Kenyan shilling","symbol":null},"KGS":{"currency":"KGS","name":"Kyrgystani som","symbol":null},"KHR":{"currency":"KHR","name":"Cambodian riel","symbol":null},"KMF":{"currency":"KMF","name":"Comorian franc","symbol":null},"KPW":{"currency":"KPW","name":"North Korean won","symbol":null},"KRH":{"currency":"KRH","name":"South Korean hwan (1953-1962)","symbol":null},"KRO":{"currency":"KRO","name":"South Korean won (1945-1953)","symbol":null},"KRW":{"currency":"KRW","name":"South Korean won","symbol":"₩"},"KWD":{"currency":"KWD","name":"Kuwaiti dinar","symbol":null},"KYD":{"currency":"KYD","name":"Cayman Islands dollar","symbol":null},"KZT":{"currency":"KZT","name":"Kazakhstani tenge","symbol":null},"LAK":{"currency":"LAK","name":"Laotian kip","symbol":null},"LBP":{"currency":"LBP","name":"Lebanese pound","symbol":null},"LKR":{"currency":"LKR","name":"Sri Lankan rupee","symbol":null},"LRD":{"currency":"LRD","name":"Liberian dollar","symbol":null},"LSL":{"currency":"LSL","name":"Lesotho loti","symbol":null},"LTL":{"currency":"LTL","name":"Lithuanian litas","symbol":null},"LTT":{"currency":"LTT","name":"Lithuanian talonas","symbol":null},"LUC":{"currency":"LUC","name":"Luxembourgian convertible franc","symbol":null},"LUF":{"currency":"LUF","name":"Luxembourgian franc","symbol":null},"LUL":{"currency":"LUL","name":"Luxembourg financial franc","symbol":null},"LVL":{"currency":"LVL","name":"Latvian lats","symbol":null},"LVR":{"currency":"LVR","name":"Latvian ruble","symbol":null},"LYD":{"currency":"LYD","name":"Libyan dinar","symbol":null},"MAD":{"currency":"MAD","name":"Moroccan dirham","symbol":null},"MAF":{"currency":"MAF","name":"Moroccan franc","symbol":null},"MCF":{"currency":"MCF","name":"Monegasque franc","symbol":null},"MDC":{"currency":"MDC","name":"Moldovan cupon","symbol":null},"MDL":{"currency":"MDL","name":"Moldovan leu","symbol":null},"MGA":{"currency":"MGA","name":"Malagasy Ariary","symbol":null},"MGF":{"currency":"MGF","name":"Malagasy franc","symbol":null},"MKD":{"currency":"MKD","name":"Macedonian denar","symbol":null},"MKN":{"currency":"MKN","name":"Macedonian denar (1992-1993)","symbol":null},"MLF":{"currency":"MLF","name":"Malian franc","symbol":null},"MMK":{"currency":"MMK","name":"Myanma kyat","symbol":null},"MNT":{"currency":"MNT","name":"Mongolian tugrik","symbol":null},"MOP":{"currency":"MOP","name":"Macanese pataca","symbol":null},"MRO":{"currency":"MRO","name":"Mauritanian ouguiya","symbol":null},"MTL":{"currency":"MTL","name":"Maltese lira","symbol":null},"MTP":{"currency":"MTP","name":"Maltese pound","symbol":null},"MUR":{"currency":"MUR","name":"Mauritian rupee","symbol":null},"MVP":{"currency":"MVP","name":"Maldivian rupee","symbol":null},"MVR":{"currency":"MVR","name":"Maldivian rufiyaa","symbol":null},"MWK":{"currency":"MWK","name":"Malawian Kwacha","symbol":null},"MXN":{"currency":"MXN","name":"Mexican peso","symbol":"MX$"},"MXP":{"currency":"MXP","name":"Mexican silver peso (1861-1992)","symbol":null},"MXV":{"currency":"MXV","name":"Mexican investment unit","symbol":null},"MYR":{"currency":"MYR","name":"Malaysian ringgit","symbol":null},"MZE":{"currency":"MZE","name":"Mozambican escudo","symbol":null},"MZM":{"currency":"MZM","name":"Mozambican metical (1980-2006)","symbol":null},"MZN":{"currency":"MZN","name":"Mozambican metical","symbol":null},"NAD":{"currency":"NAD","name":"Namibian dollar","symbol":null},"NGN":{"currency":"NGN","name":"Nigerian naira","symbol":null},"NIC":{"currency":"NIC","name":"Nicaraguan córdoba (1988-1991)","symbol":null},"NIO":{"currency":"NIO","name":"Nicaraguan córdoba","symbol":null},"NLG":{"currency":"NLG","name":"Dutch guilder","symbol":null},"NOK":{"currency":"NOK","name":"Norwegian krone","symbol":null},"NPR":{"currency":"NPR","name":"Nepalese rupee","symbol":null},"NZD":{"currency":"NZD","name":"New Zealand dollar","symbol":"NZ$"},"OMR":{"currency":"OMR","name":"Omani rial","symbol":null},"PAB":{"currency":"PAB","name":"Panamanian balboa","symbol":null},"PEI":{"currency":"PEI","name":"Peruvian inti","symbol":null},"PEN":{"currency":"PEN","name":"Peruvian nuevo sol","symbol":null},"PES":{"currency":"PES","name":"Peruvian sol (1863-1965)","symbol":null},"PGK":{"currency":"PGK","name":"Papua New Guinean kina","symbol":null},"PHP":{"currency":"PHP","name":"Philippine peso","symbol":null},"PKR":{"currency":"PKR","name":"Pakistani rupee","symbol":null},"PLN":{"currency":"PLN","name":"Polish zloty","symbol":null},"PLZ":{"currency":"PLZ","name":"Polish zloty (PLZ)","symbol":null},"PTE":{"currency":"PTE","name":"Portuguese escudo","symbol":null},"PYG":{"currency":"PYG","name":"Paraguayan guarani","symbol":null},"QAR":{"currency":"QAR","name":"Qatari rial","symbol":null},"RHD":{"currency":"RHD","name":"Rhodesian dollar","symbol":null},"ROL":{"currency":"ROL","name":"Romanian leu (1952-2006)","symbol":null},"RON":{"currency":"RON","name":"Romanian leu","symbol":null},"RSD":{"currency":"RSD","name":"Serbian dinar","symbol":null},"RUB":{"currency":"RUB","name":"Russian ruble","symbol":null},"RUR":{"currency":"RUR","name":"Russian ruble (1991-1998)","symbol":null},"RWF":{"currency":"RWF","name":"Rwandan franc","symbol":null},"SAR":{"currency":"SAR","name":"Saudi riyal","symbol":null},"SBD":{"currency":"SBD","name":"Solomon Islands dollar","symbol":null},"SCR":{"currency":"SCR","name":"Seychellois rupee","symbol":null},"SDD":{"currency":"SDD","name":"Sudanese dinar (1992-2007)","symbol":null},"SDG":{"currency":"SDG","name":"Sudanese pound","symbol":null},"SDP":{"currency":"SDP","name":"Sudanese pound (1957-1998)","symbol":null},"SEK":{"currency":"SEK","name":"Swedish krona","symbol":null},"SGD":{"currency":"SGD","name":"Singapore dollar","symbol":null},"SHP":{"currency":"SHP","name":"Saint Helena pound","symbol":null},"SIT":{"currency":"SIT","name":"Slovenian tolar","symbol":null},"SKK":{"currency":"SKK","name":"Slovak koruna","symbol":null},"SLL":{"currency":"SLL","name":"Sierra Leonean leone","symbol":null},"SOS":{"currency":"SOS","name":"Somali shilling","symbol":null},"SRD":{"currency":"SRD","name":"Surinamese dollar","symbol":null},"SRG":{"currency":"SRG","name":"Surinamese guilder","symbol":null},"SSP":{"currency":"SSP","name":"South Sudanese pound","symbol":null},"STD":{"currency":"STD","name":"São Tomé and Príncipe dobra","symbol":null},"SUR":{"currency":"SUR","name":"Soviet rouble","symbol":null},"SVC":{"currency":"SVC","name":"Salvadoran colón","symbol":null},"SYP":{"currency":"SYP","name":"Syrian pound","symbol":null},"SZL":{"currency":"SZL","name":"Swazi lilangeni","symbol":null},"THB":{"currency":"THB","name":"Thai baht","symbol":"฿"},"TJR":{"currency":"TJR","name":"Tajikistani ruble","symbol":null},"TJS":{"currency":"TJS","name":"Tajikistani somoni","symbol":null},"TMM":{"currency":"TMM","name":"Turkmenistani manat (1993-2009)","symbol":null},"TMT":{"currency":"TMT","name":"Turkmenistani manat","symbol":null},"TND":{"currency":"TND","name":"Tunisian dinar","symbol":null},"TOP":{"currency":"TOP","name":"Tongan paʻanga","symbol":null},"TPE":{"currency":"TPE","name":"Timorese escudo","symbol":null},"TRL":{"currency":"TRL","name":"Turkish lira (1922-2005)","symbol":null},"TRY":{"currency":"TRY","name":"Turkish lira","symbol":null},"TTD":{"currency":"TTD","name":"Trinidad and Tobago dollar","symbol":null},"TWD":{"currency":"TWD","name":"New Taiwan dollar","symbol":"NT$"},"TZS":{"currency":"TZS","name":"Tanzanian shilling","symbol":null},"UAH":{"currency":"UAH","name":"Ukrainian hryvnia","symbol":null},"UAK":{"currency":"UAK","name":"Ukrainian karbovanets","symbol":null},"UGS":{"currency":"UGS","name":"Ugandan shilling (1966-1987)","symbol":null},"UGX":{"currency":"UGX","name":"Ugandan shilling","symbol":null},"USD":{"currency":"USD","name":"US dollar","symbol":"$"},"USN":{"currency":"USN","name":"US dollar (next day)","symbol":null},"USS":{"currency":"USS","name":"US dollar (same day)","symbol":null},"UYI":{"currency":"UYI","name":"Uruguayan peso (indexed units)","symbol":null},"UYP":{"currency":"UYP","name":"Uruguayan peso (1975-1993)","symbol":null},"UYU":{"currency":"UYU","name":"Uruguayan peso","symbol":null},"UZS":{"currency":"UZS","name":"Uzbekistan som","symbol":null},"VEB":{"currency":"VEB","name":"Venezuelan bolívar (1871-2008)","symbol":null},"VEF":{"currency":"VEF","name":"Venezuelan bolívar","symbol":null},"VND":{"currency":"VND","name":"Vietnamese dong","symbol":"₫"},"VNN":{"currency":"VNN","name":"Vietnamese dong (1978-1985)","symbol":null},"VUV":{"currency":"VUV","name":"Vanuatu vatu","symbol":null},"WST":{"currency":"WST","name":"Samoan tala","symbol":null},"XAF":{"currency":"XAF","name":"CFA franc BEAC","symbol":"FCFA"},"XAG":{"currency":"XAG","name":"troy ounce of silver","symbol":null},"XAU":{"currency":"XAU","name":"troy ounce of gold","symbol":null},"XBA":{"currency":"XBA","name":"European composite unit","symbol":null},"XBB":{"currency":"XBB","name":"European monetary unit","symbol":null},"XBC":{"currency":"XBC","name":"European unit of account (XBC)","symbol":null},"XBD":{"currency":"XBD","name":"European unit of account (XBD)","symbol":null},"XCD":{"currency":"XCD","name":"East Caribbean dollar","symbol":"EC$"},"XDR":{"currency":"XDR","name":"special drawing rights","symbol":null},"XEU":{"currency":"XEU","name":"European currency unit","symbol":null},"XFO":{"currency":"XFO","name":"French gold franc","symbol":null},"XFU":{"currency":"XFU","name":"French UIC-franc","symbol":null},"XOF":{"currency":"XOF","name":"CFA franc BCEAO","symbol":"CFA"},"XPD":{"currency":"XPD","name":"troy ounce of palladium","symbol":null},"XPF":{"currency":"XPF","name":"CFP franc","symbol":"CFPF"},"XPT":{"currency":"XPT","name":"troy ounce of platinum","symbol":null},"XRE":{"currency":"XRE","name":"RINET Funds unit","symbol":null},"XSU":{"currency":"XSU","name":"Sucre","symbol":null},"XTS":{"currency":"XTS","name":"Testing Currency unit","symbol":null},"XUA":{"currency":"XUA","name":"ADB unit of account","symbol":null},"XXX":{"currency":"XXX","name":"(unknown unit of currency)","symbol":null},"YDD":{"currency":"YDD","name":"Yemeni dinar","symbol":null},"YER":{"currency":"YER","name":"Yemeni rial","symbol":null},"YUD":{"currency":"YUD","name":"Yugoslavian hard dinar (1966-1990)","symbol":null},"YUM":{"currency":"YUM","name":"Yugoslavian new dinar (1994-2002)","symbol":null},"YUN":{"currency":"YUN","name":"Yugoslavian convertible dinar (1990-1992)","symbol":null},"YUR":{"currency":"YUR","name":"Yugoslavian reformed dinar (1992-1993)","symbol":null},"ZAL":{"currency":"ZAL","name":"South African rand (financial)","symbol":null},"ZAR":{"currency":"ZAR","name":"South African rand","symbol":null},"ZMK":{"currency":"ZMK","name":"Zambian kwacha","symbol":null},"ZRN":{"currency":"ZRN","name":"Zairean new zaire (1993-1998)","symbol":null},"ZRZ":{"currency":"ZRZ","name":"Zairean zaire (1971-1993)","symbol":null},"ZWD":{"currency":"ZWD","name":"Zimbabwean dollar (1980-2008)","symbol":null},"ZWL":{"currency":"ZWL","name":"Zimbabwean dollar (2009)","symbol":null},"ZWR":{"currency":"ZWR","name":"Zimbabwean dollar (2008)","symbol":null}};
1246
+
1247
+ Currencies.currency_codes = function() {
1248
+ var data, _;
1249
+ return this.codes || (this.codes = (function() {
1250
+ var _ref, _results;
1251
+ _ref = this.currencies;
1252
+ _results = [];
1253
+ for (_ in _ref) {
1254
+ data = _ref[_];
1255
+ _results.push(data.code);
1256
+ }
1257
+ return _results;
1258
+ }).call(this));
1259
+ };
1260
+
1261
+ Currencies.for_code = function(currency_code) {
1262
+ var country_name, data, result, _ref;
1263
+ result = null;
1264
+ _ref = this.currencies;
1265
+ for (country_name in _ref) {
1266
+ data = _ref[country_name];
1267
+ if (data.code === currency_code) {
1268
+ result = {
1269
+ country: country_name,
1270
+ code: data.code,
1271
+ symbol: data.symbol,
1272
+ currency: data.currency
1273
+ };
1274
+ break;
1275
+ }
1276
+ }
1277
+ return result;
1278
+ };
1279
+
1280
+ return Currencies;
1281
+
1282
+ })();
1283
+
1284
+ TwitterCldr.ListFormatter = (function() {
1285
+
1286
+ function ListFormatter(options) {
1287
+ if (options == null) {
1288
+ options = {};
1289
+ }
1290
+ this.formats = {"2":"{0} en {1}","end":"{0} en {1}","middle":"{0}, {1}","start":"{0}, {1}"};
1291
+ }
1292
+
1293
+ ListFormatter.prototype.format = function(list) {
1294
+ if (this.formats[list.length.toString()] != null) {
1295
+ return this.compose(this.formats[list.length.toString()], list);
1296
+ } else {
1297
+ return this.compose_list(list);
1298
+ }
1299
+ };
1300
+
1301
+ ListFormatter.prototype.compose_list = function(list) {
1302
+ var format_key, i, result, _i, _ref;
1303
+ result = this.compose(this.formats.end || this.formats.middle || "", [list[list.length - 2], list[list.length - 1]]);
1304
+ if (list.length > 2) {
1305
+ for (i = _i = 3, _ref = list.length; 3 <= _ref ? _i <= _ref : _i >= _ref; i = 3 <= _ref ? ++_i : --_i) {
1306
+ format_key = i === list.length ? "start" : "middle";
1307
+ if (this.formats[format_key] == null) {
1308
+ format_key = "middle";
1309
+ }
1310
+ result = this.compose(this.formats[format_key] || "", [list[list.length - i], result]);
1311
+ }
1312
+ }
1313
+ return result;
1314
+ };
1315
+
1316
+ ListFormatter.prototype.compose = function(format, elements) {
1317
+ var element, result;
1318
+ elements = (function() {
1319
+ var _i, _len, _results;
1320
+ _results = [];
1321
+ for (_i = 0, _len = elements.length; _i < _len; _i++) {
1322
+ element = elements[_i];
1323
+ if (element !== null) {
1324
+ _results.push(element);
1325
+ }
1326
+ }
1327
+ return _results;
1328
+ })();
1329
+ if (elements.length > 1) {
1330
+ result = format.replace(/\{(\d+)\}/g, function() {
1331
+ return RegExp.$1;
1332
+ });
1333
+ if (TwitterCldr.is_rtl) {
1334
+ result = TwitterCldr.Bidi.from_string(result, {
1335
+ "direction": "RTL"
1336
+ }).reorder_visually().toString();
1337
+ }
1338
+ return result.replace(/(\d+)/g, function() {
1339
+ return elements[parseInt(RegExp.$1)];
1340
+ });
1341
+ } else {
1342
+ return elements[0] || "";
1343
+ }
1344
+ };
1345
+
1346
+ return ListFormatter;
1347
+
1348
+ })();
1349
+
1350
+ TwitterCldr.Bidi = (function() {
1351
+ var MAX_DEPTH;
1352
+
1353
+ MAX_DEPTH = 62;
1354
+
1355
+ function Bidi(options) {
1356
+ if (options == null) {
1357
+ options = {};
1358
+ }
1359
+ this.bidi_classes = {"BN":{"8":[0],"13":[14],"5":[127,8298],"25":[134],"0":[173,65279,917505],"2":[8203],"4":[8288],"7":[119155],"95":[917536]},"S":{"0":[9,11,31]},"B":{"0":[10,13,133,8233],"2":[28]},"WS":{"0":[12,32,5760,6158,8232,8287,12288],"10":[8192]},"ON":{"1":[33,171,174,697,884,900,1542,1550,5787,6468,8189,8448,8456,8506,12342,12443,12829,13278,42622,64830,65120,65281,126704,127338],"4":[38,187,8512,65286,65529,127942],"5":[59,91,3059,8478,11493,65307,65339,127792],"3":[123,166,2038,3898,8451,8522,12289,13004,13175,43048,43124,128249,128320],"0":[161,180,215,247,894,903,1014,1418,1758,1769,3066,5120,6464,8125,8468,8485,8487,8489,8585,12336,12448,12539,13311,42611,42888,65021,65105,65108,65128,65131,65793,67871,119365,120539,120597,120655,120713,120771,128064],"2":[182,8127,8141,8157,8173,8316,8332,8470,12349,12924,42509,65124,65506],"13":[706,722,127153],"8":[741,65110],"16":[751,127968],"6":[3192,11513,65512,68409],"9":[5008,6128,11088,65040],"10":[6144,9280,65371,128581],"33":[6622,42752],"23":[8208,128336],"14":[8245,12977,127136,127169,127185],"25":[8261,9083,11904],"15":[8528,12880],"129":[8592],"289":[8724],"93":[9110],"38":[9216],"39":[9312],"449":[9450],"82":[9901],"254":[9985],"588":[10496],"59":[11776],"88":[11931],"213":[12032],"11":[12272,65936],"24":[12296],"35":[12736],"63":[19904],"54":[42128],"31":[65072],"74":[65856],"19":[69714,127872],"65":[119296],"86":[119552],"43":[126976],"99":[127024],"32":[127744],"69":[127799,128507,128640],"36":[127904],"62":[128000],"181":[128066],"61":[128256],"115":[128768]},"ET":{"2":[35,65283],"3":[162],"1":[176,1545,2546,43064,65129,65504,65509],"0":[1423,1642,2555,2801,3065,3647,6107,8494,8723,65119],"4":[8240],"25":[8352]},"ES":{"0":[43,45,8722,64297,65291,65293],"1":[8314,8330,65122]},"CS":{"0":[44,58,160,1548,8239,8260,65104,65106,65109,65292,65306],"1":[46,65294]},"EN":{"9":[48,1776,8320,65296],"1":[178],"0":[185,8304],"5":[8308],"19":[9352],"49":[120782],"10":[127232]},"L":{"25":[65,97,5761,6576,65313,65345,65549],"0":[170,181,186,750,902,908,1417,2363,2482,2510,2519,2563,2654,2691,2761,2768,2880,2903,2947,2972,3024,3031,3133,3199,3294,3406,3415,3517,3716,3722,3725,3749,3751,3773,3782,3894,3896,3967,3973,4145,4152,4295,4301,4696,4800,6070,6108,6314,6743,6753,6965,6971,7082,7143,7150,7379,7393,8025,8027,8029,8126,8206,8305,8319,8450,8455,8469,8484,8486,8488,9109,9900,11559,11565,43047,43597,43697,43712,43714,65792,65794,69632,69932,71340,71350,119970,119995,120134],"22":[192,3090,3218,6656,11648],"30":[216,8031,13280,66304,127248],"448":[248],"6":[699,1369,2425,2474,2548,2602,2730,2858,3449,3520,3648,3737,4688,4792,6100,8118,8134,8182,11680,11688,11696,11704,11712,11720,11728,11736,43808,43816,64256,69703,69819,119997,120086,120138],"1":[720,886,2434,2447,2503,2507,2524,2575,2610,2613,2616,2738,2763,2784,2818,2831,2866,2877,2887,2891,2908,2969,2974,2979,3006,3009,3160,3168,3202,3274,3285,3296,3313,3330,3424,3458,3634,3713,3719,3754,3762,4155,4227,5941,6087,6448,6755,7078,7154,7220,7413,8526,11506,11631,12334,43346,43444,43450,43486,43567,43571,43701,44006,65596,69815,71342,110592,119171,119966,119973,127568],"4":[736,2741,2869,3125,3253,3776,3976,6512,6973,8473,8517,12337,12344,43705,64275,120128],"3":[880,890,2365,2377,2486,2493,2649,2749,2962,3137,3389,3732,3757,3804,4186,4682,4698,4746,4786,4802,4882,5902,6435,7401,8144,8490,8508,11499,12540,42896,43015,44009,66336,74864,119977,120071,120123],"2":[904,2382,2527,2622,2674,2703,2911,2958,2984,3014,3018,3073,3086,3214,3270,3342,3398,3402,3535,3570,3745,5998,6441,6681,7146,8130,8178,12293,12445,43011,43584,65498],"19":[910,2404],"82":[931],"139":[1015],"157":[1162,66560],"37":[1329,7968,11520,43264],"38":[1377,119040],"54":[2307],"9":[2392,2662,3114,3174,3242,3302,3792,3902,6112,6160,6784,6800,8458,43000,43250,43600,44016,66720,69734,69872,70079,70096,71360],"7":[2437,2821,3077,3205,3261,3333,3544,4030,6078,7360,8016,43056,43588,43758,120077,120772],"21":[2451,2579,2707,2835],"11":[2534,2990,12992,43214,65536,119982],"5":[2565,2949,4039,4231,6451,6765,7406,7960,8008,8150,42738,42889,43777,43785,43793,65474,65482,65490],"8":[2693,3507,6979,7028,12321,65847,119146,127552],"10":[2790,6608,8495,42912,43471],"17":[2918,3461,5920,5952,119648],"12":[3046,3663,4046,4213,5888,5984,8160,8336,94099],"40":[3346,4704,6272,8544,12549,43520],"15":[3430,4193,4992],"23":[3482,3840,42624],"47":[3585,6916,7164,12832,43395,43648,119214],"26":[3866,6992,66352],"35":[3913,69891],"44":[4096,12784,65799,66000],"24":[4159,43020,43310,69840],"14":[4238,4808,7227,65599],"39":[4254,6470],"376":[4304],"32":[4752],"56":[4824,120540,120598,120656,120714],"66":[4888],"28":[4960,6400,66176,127462],"84":[5024,119808],"638":[5121],"80":[5792],"51":[6016,43072,70018],"87":[6176],"69":[6320],"43":[6528],"55":[6686,11568],"13":[6816,65616,66504,69942],"31":[7042,43612],"57":[7084,127280],"50":[7245,120488],"191":[7424],"277":[7680],"52":[8064],"68":[9014,93952],"77":[9372],"255":[10240],"46":[11264,11312,13008,42560,94032],"132":[11360],"85":[12353],"89":[12449],"93":[12593],"42":[12688,71296,127344,127504],"27":[12896,42512,120094],"49":[12927],"118":[13056],"98":[13179,74752],"6591":[13312],"22156":[19968],"316":[42192],"79":[42656],"101":[42786],"67":[43136],"29":[43359,66432,119180],"16":[43453,43739],"36":[43968,66463],"11206":[44032],"48":[55243,66208,69762],"8813":[55296],"105":[64112],"88":[65382],"18":[65576],"122":[65664],"53":[69634],"878":[73728],"1070":[77824],"568":[92160],"245":[118784],"61":[119081],"70":[119894],"64":[120005],"339":[120146],"42719":[131072],"4383":[173824],"541":[194560],"131071":[983040]},"NSM":{"111":[768],"6":[1155,1750,2385,3636,6071,6744,7394,65056,119173],"44":[1425],"0":[1471,1479,1648,1809,2362,2364,2381,2433,2492,2509,2620,2641,2677,2748,2765,2817,2876,2879,2893,2902,2946,3008,3021,3260,3405,3530,3542,3633,3761,3893,3895,3897,4038,4226,4237,4253,6086,6109,6313,6450,6742,6752,6754,6783,6964,6972,6978,7083,7142,7149,7405,7412,11647,42655,43010,43014,43019,43204,43443,43452,43587,43596,43696,43713,43766,44005,44008,44013,64286,66045,68159,69633,71339,71341,71351],"1":[1473,1476,1767,2402,2530,2561,2625,2631,2672,2689,2759,2786,2914,3157,3170,3276,3298,3426,3771,3864,3974,4153,4157,4184,4229,5970,6002,6068,6439,6679,7040,7080,7144,7222,12441,42736,43045,43569,43573,43703,43710,43756,68101,69760,69817,70016],"10":[1552,1958,3981,6089,43335],"20":[1611],"5":[1759,3764,3784,4146,43561,71344],"3":[1770,2070,2497,2881,3146,3393,4141,4209,6912,7074,7676,12330,42607,43446,68108,69811,94095,119210],"26":[1840,2276],"8":[2027,2075,7019,70070],"2":[2085,2137,2304,2635,3134,3142,3538,4190,4957,5906,5938,6155,6432,6457,7151,7376,11503,43392,43698,68097,68152,69888,119143,119362],"4":[2089,2753,3968,6966,69927],"7":[2369,3655,6757,7212,43302,69933,119163],"13":[3953],"35":[3993],"9":[6771,42612],"12":[7380],"38":[7616],"32":[8400],"31":[11744],"17":[43232],"15":[65024],"14":[69688],"239":[917760]},"R":{"0":[1470,1472,1475,1478,2042,2074,2084,2088,2142,8207,64285,64318,67592,67644,67903,68096],"26":[1488,68121,68440],"4":[1520,64312],"42":[1984],"1":[2036,64320,64323,67639,68030],"21":[2048,68416],"14":[2096],"24":[2112],"9":[64287,64326],"12":[64298],"5":[67584],"43":[67594],"22":[67647],"8":[67671,68176],"27":[67840],"25":[67872],"55":[67968],"3":[68112],"2":[68117],"7":[68160,68472],"31":[68192],"53":[68352],"72":[68608]},"AN":{"4":[1536],"9":[1632],"1":[1643],"0":[1757],"30":[69216]},"AL":{"0":[1544,1547,1549,1563,1969,2208,126500,126503,126521,126523,126530,126535,126537,126539,126548,126551,126553,126555,126557,126559,126564,126590],"44":[1566],"2":[1645,126541,126625],"100":[1649],"1":[1765,1774,1807,126497,126545,126561],"19":[1786],"29":[1810],"88":[1869],"10":[2210],"113":[64336],"362":[64467],"63":[64848],"53":[64914],"12":[65008],"4":[65136,126629],"134":[65142],"3":[126464,126516,126567,126580,126585],"26":[126469],"9":[126505,126592],"6":[126572],"16":[126603,126635]},"LRE":{"0":[8234]},"RLE":{"0":[8235]},"PDF":{"0":[8236]},"LRO":{"0":[8237]},"RLO":{"0":[8238]}};
1360
+ this.string_arr = options.string_arr || options.types;
1361
+ this.types = options.types || [];
1362
+ this.levels = [];
1363
+ this.runs = [];
1364
+ this.direction = options.direction;
1365
+ this.default_direction = options.default_direction || "LTR";
1366
+ this.length = this.types.length;
1367
+ this.run_bidi();
1368
+ }
1369
+
1370
+ Bidi.bidi_class_for = function(code_point) {
1371
+ var bidi_class, end, range, range_list, range_offset, ranges, start, _i, _len, _ref;
1372
+ _ref = this.bidi_classes;
1373
+ for (bidi_class in _ref) {
1374
+ ranges = _ref[bidi_class];
1375
+ for (range_offset in ranges) {
1376
+ range_list = ranges[range_offset];
1377
+ for (_i = 0, _len = range_list.length; _i < _len; _i++) {
1378
+ range = range_list[_i];
1379
+ start = range;
1380
+ end = start + parseInt(range_offset);
1381
+ if ((code_point >= start) && (code_point <= end)) {
1382
+ return bidi_class;
1383
+ }
1384
+ }
1385
+ }
1386
+ }
1387
+ return null;
1388
+ };
1389
+
1390
+ Bidi.from_string = function(str, options) {
1391
+ var string_arr;
1392
+ if (options == null) {
1393
+ options = {};
1394
+ }
1395
+ string_arr = TwitterCldr.Utilities.unpack_string(str);
1396
+ options.types || (options.types = this.compute_types(string_arr));
1397
+ options.string_arr || (options.string_arr = string_arr);
1398
+ return new TwitterCldr.Bidi(options);
1399
+ };
1400
+
1401
+ Bidi.from_type_array = function(types, options) {
1402
+ if (options == null) {
1403
+ options = {};
1404
+ }
1405
+ options.types || (options.types = types);
1406
+ return new TwitterCldr.Bidi(options);
1407
+ };
1408
+
1409
+ Bidi.compute_types = function(arr) {
1410
+ var code_point, _i, _len, _results;
1411
+ _results = [];
1412
+ for (_i = 0, _len = arr.length; _i < _len; _i++) {
1413
+ code_point = arr[_i];
1414
+ _results.push(TwitterCldr.Bidi.bidi_class_for(code_point));
1415
+ }
1416
+ return _results;
1417
+ };
1418
+
1419
+ Bidi.prototype.toString = function() {
1420
+ return TwitterCldr.Utilities.pack_array(this.string_arr);
1421
+ };
1422
+
1423
+ Bidi.prototype.reorder_visually = function() {
1424
+ var depth, finish, i, level, lowest_odd, max, start, tmpb, tmpo, _i, _j, _k, _len, _ref, _ref1;
1425
+ if (!this.string_arr) {
1426
+ throw "No string given!";
1427
+ }
1428
+ max = 0;
1429
+ lowest_odd = MAX_DEPTH + 1;
1430
+ _ref = this.levels;
1431
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1432
+ level = _ref[_i];
1433
+ max = TwitterCldr.Utilities.max([level, max]);
1434
+ if (!TwitterCldr.Utilities.is_even(level)) {
1435
+ lowest_odd = TwitterCldr.Utilities.min([lowest_odd, level]);
1436
+ }
1437
+ }
1438
+ for (depth = _j = max; max <= 0 ? _j < 0 : _j > 0; depth = max <= 0 ? ++_j : --_j) {
1439
+ start = 0;
1440
+ while (start < this.levels.length) {
1441
+ while (start < this.levels.length && this.levels[start] < depth) {
1442
+ start += 1;
1443
+ }
1444
+ if (start === this.levels.length) {
1445
+ break;
1446
+ }
1447
+ finish = start + 1;
1448
+ while (finish < this.levels.length && this.levels[finish] >= depth) {
1449
+ finish += 1;
1450
+ }
1451
+ for (i = _k = 0, _ref1 = (finish - start) / 2; 0 <= _ref1 ? _k < _ref1 : _k > _ref1; i = 0 <= _ref1 ? ++_k : --_k) {
1452
+ tmpb = this.levels[finish - i - 1];
1453
+ this.levels[finish - i - 1] = this.levels[start + i];
1454
+ this.levels[start + i] = tmpb;
1455
+ tmpo = this.string_arr[finish - i - 1];
1456
+ this.string_arr[finish - i - 1] = this.string_arr[start + i];
1457
+ this.string_arr[start + i] = tmpo;
1458
+ }
1459
+ start = finish + 1;
1460
+ }
1461
+ }
1462
+ return this;
1463
+ };
1464
+
1465
+ Bidi.prototype.compute_paragraph_embedding_level = function() {
1466
+ var type, _i, _len, _ref;
1467
+ if (["LTR", "RTL"].indexOf(this.direction) > -1) {
1468
+ if (this.direction === "LTR") {
1469
+ return 0;
1470
+ } else {
1471
+ return 1;
1472
+ }
1473
+ } else {
1474
+ _ref = this.types;
1475
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1476
+ type = _ref[_i];
1477
+ if (type === "L") {
1478
+ return 0;
1479
+ }
1480
+ if (type === "R") {
1481
+ return 1;
1482
+ }
1483
+ }
1484
+ if (this.default_direction === "LTR") {
1485
+ return 0;
1486
+ } else {
1487
+ return 1;
1488
+ }
1489
+ }
1490
+ };
1491
+
1492
+ Bidi.prototype.compute_explicit_levels = function() {
1493
+ var current_embedding, directional_override, embedding_stack, i, input, is_ltr, is_special, len, new_embedding, next_fmt, output, size, sp, _i, _j, _ref, _ref1;
1494
+ current_embedding = this.base_embedding;
1495
+ directional_override = -1;
1496
+ embedding_stack = [];
1497
+ this.formatter_indices || (this.formatter_indices = []);
1498
+ sp = 0;
1499
+ for (i = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
1500
+ is_ltr = false;
1501
+ is_special = true;
1502
+ is_ltr = this.types[i] === "LRE" || this.types[i] === "LRO";
1503
+ switch (this.types[i]) {
1504
+ case "RLE":
1505
+ case "RLO":
1506
+ case "LRE":
1507
+ case "LRO":
1508
+ new_embedding = is_ltr ? (current_embedding & ~1) + 2 : (current_embedding + 1) | 1;
1509
+ if (new_embedding < MAX_DEPTH) {
1510
+ if (directional_override !== -1) {
1511
+ current_embedding |= -0x80;
1512
+ }
1513
+ embedding_stack[sp] = current_embedding;
1514
+ current_embedding = new_embedding;
1515
+ sp += 1;
1516
+ directional_override = this.types[i] === "LRO" ? "L" : this.types[i] === "RLO" ? "R" : -1;
1517
+ }
1518
+ break;
1519
+ case "PDF":
1520
+ if (sp > 0) {
1521
+ sp -= 1;
1522
+ new_embedding = embedding_stack[sp];
1523
+ current_embedding = new_embedding & 0x7f;
1524
+ directional_override = new_embedding < 0 ? (_ref1 = (new_embedding & 1) === 0) != null ? _ref1 : {
1525
+ "L": "R"
1526
+ } : -1;
1527
+ }
1528
+ break;
1529
+ default:
1530
+ is_special = false;
1531
+ }
1532
+ this.levels[i] = current_embedding;
1533
+ if (is_special) {
1534
+ this.formatter_indices.push(i);
1535
+ } else if (directional_override !== -1) {
1536
+ this.types[i] = directional_override;
1537
+ }
1538
+ }
1539
+ output = 0;
1540
+ input = 0;
1541
+ size = this.formatter_indices.length;
1542
+ for (i = _j = 0; 0 <= size ? _j <= size : _j >= size; i = 0 <= size ? ++_j : --_j) {
1543
+ next_fmt = i === size ? this.length : this.formatter_indices[i];
1544
+ len = next_fmt - input;
1545
+ TwitterCldr.Utilities.arraycopy(this.levels, input, this.levels, output, len);
1546
+ TwitterCldr.Utilities.arraycopy(this.types, input, this.types, output, len);
1547
+ output += len;
1548
+ input = next_fmt + 1;
1549
+ }
1550
+ return this.length -= this.formatter_indices.length;
1551
+ };
1552
+
1553
+ Bidi.prototype.compute_runs = function() {
1554
+ var current_embedding, i, last_run_start, run_count, where, _i, _j, _ref, _ref1;
1555
+ run_count = 0;
1556
+ current_embedding = this.base_embedding;
1557
+ for (i = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
1558
+ if (this.levels[i] !== current_embedding) {
1559
+ current_embedding = this.levels[i];
1560
+ run_count += 1;
1561
+ }
1562
+ }
1563
+ where = 0;
1564
+ last_run_start = 0;
1565
+ current_embedding = this.base_embedding;
1566
+ for (i = _j = 0, _ref1 = this.length; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
1567
+ if (this.levels[i] !== current_embedding) {
1568
+ this.runs[where] = last_run_start;
1569
+ where += 1;
1570
+ last_run_start = i;
1571
+ current_embedding = this.levels[i];
1572
+ }
1573
+ }
1574
+ return this.runs[where] = last_run_start;
1575
+ };
1576
+
1577
+ Bidi.prototype.resolve_weak_types = function() {
1578
+ var eor, finish, i, j, k, level, next_level, next_type, prev_strong_type, prev_type, previous_level, run_count, run_idx, sor, start, _i, _j, _k;
1579
+ run_count = this.runs.length;
1580
+ previous_level = this.base_embedding;
1581
+ for (run_idx = _i = 0; 0 <= run_count ? _i < run_count : _i > run_count; run_idx = 0 <= run_count ? ++_i : --_i) {
1582
+ start = this.get_run_start(run_idx);
1583
+ finish = this.get_run_limit(run_idx);
1584
+ level = this.get_run_level(run_idx) || 0;
1585
+ sor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([previous_level, level])) ? "L" : "R";
1586
+ next_level = run_idx === (run_count - 1) ? this.base_embedding : this.get_run_level(run_idx + 1) || 0;
1587
+ eor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([level, next_level])) ? "L" : "R";
1588
+ prev_type = sor;
1589
+ prev_strong_type = sor;
1590
+ for (i = _j = start; start <= finish ? _j < finish : _j > finish; i = start <= finish ? ++_j : --_j) {
1591
+ next_type = i === (finish - 1) ? eor : this.types[i + 1];
1592
+ if (this.types[i] === "NSM") {
1593
+ this.types[i] = prev_type;
1594
+ } else {
1595
+ prev_type = this.types[i];
1596
+ }
1597
+ if (this.types[i] === "EN") {
1598
+ if (prev_strong_type === "AL") {
1599
+ this.types[i] = "AN";
1600
+ }
1601
+ } else if (this.types[i] === "L" || this.types[i] === "R" || this.types[i] === "AL") {
1602
+ prev_strong_type = this.types[i];
1603
+ }
1604
+ if (this.types[i] === "AL") {
1605
+ this.types[i] = "R";
1606
+ }
1607
+ if (prev_type === "EN" && next_type === "EN") {
1608
+ if (this.types[i] === "ES" || this.types[i] === "CS") {
1609
+ this.types[i] = nextType;
1610
+ }
1611
+ } else if (prev_type === "AN" && next_type === "AN" && this.types[i] === "CS") {
1612
+ this.types[i] = next_type;
1613
+ }
1614
+ if (this.types[i] === "ET" || this.types[i] === "BN") {
1615
+ if (prev_type === "EN") {
1616
+ this.types[i] = prev_type;
1617
+ } else {
1618
+ j = i + 1;
1619
+ while (j < finish && this.types[j] === "ET" || this.types[j] === "BN") {
1620
+ j += 1;
1621
+ }
1622
+ if (j < finish && this.types[j] === "EN") {
1623
+ for (k = _k = i; i <= j ? _k < j : _k > j; k = i <= j ? ++_k : --_k) {
1624
+ this.types[k] = "EN";
1625
+ }
1626
+ }
1627
+ }
1628
+ }
1629
+ if (this.types[i] === "ET" || this.types[i] === "CS" || this.types[i] === "BN") {
1630
+ this.types[i] = "ON";
1631
+ }
1632
+ if (prev_strong_type === "L" && this.types[i] === "EN") {
1633
+ this.types[i] = prev_strong_type;
1634
+ }
1635
+ }
1636
+ previous_level = level;
1637
+ }
1638
+ };
1639
+
1640
+ Bidi.prototype.get_run_count = function() {
1641
+ return this.runs.length;
1642
+ };
1643
+
1644
+ Bidi.prototype.get_run_level = function(which) {
1645
+ return this.levels[this.runs[which]];
1646
+ };
1647
+
1648
+ Bidi.prototype.get_run_limit = function(which) {
1649
+ if (which === (this.runs.length - 1)) {
1650
+ return this.length;
1651
+ } else {
1652
+ return this.runs[which + 1];
1653
+ }
1654
+ };
1655
+
1656
+ Bidi.prototype.get_run_start = function(which) {
1657
+ return this.runs[which];
1658
+ };
1659
+
1660
+ Bidi.prototype.resolve_implicit_levels = function() {
1661
+ var i, _i, _ref;
1662
+ for (i = _i = 0, _ref = this.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
1663
+ if ((this.levels[i] & 1) === 0) {
1664
+ if (this.types[i] === "R") {
1665
+ this.levels[i] += 1;
1666
+ } else if (this.types[i] === "AN" || this.types[i] === "EN") {
1667
+ this.levels[i] += 2;
1668
+ }
1669
+ } else {
1670
+ if (this.types[i] === "L" || this.types[i] === "AN" || this.types[i] === "EN") {
1671
+ this.levels[i] += 1;
1672
+ }
1673
+ }
1674
+ }
1675
+ };
1676
+
1677
+ Bidi.prototype.resolve_neutral_types = function() {
1678
+ var embedding_direction, eor, finish, i, j, level, neutral_start, new_strong, next_level, override, prev_strong, previous_level, run, run_count, sor, start, this_type, _i, _j, _k;
1679
+ run_count = this.get_run_count();
1680
+ previous_level = this.base_embedding;
1681
+ for (run = _i = 0; 0 <= run_count ? _i < run_count : _i > run_count; run = 0 <= run_count ? ++_i : --_i) {
1682
+ start = this.get_run_start(run);
1683
+ finish = this.get_run_limit(run);
1684
+ level = this.get_run_level(run);
1685
+ if (level == null) {
1686
+ continue;
1687
+ }
1688
+ embedding_direction = TwitterCldr.Utilities.is_even(level) ? "L" : "R";
1689
+ sor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([previous_level, level])) ? "L" : "R";
1690
+ next_level = run === (run_count - 1) ? this.base_embedding : this.get_run_level(run + 1);
1691
+ eor = TwitterCldr.Utilities.is_even(TwitterCldr.Utilities.max([level, next_level])) ? "L" : "R";
1692
+ prev_strong = sor;
1693
+ neutral_start = -1;
1694
+ for (i = _j = start; start <= finish ? _j <= finish : _j >= finish; i = start <= finish ? ++_j : --_j) {
1695
+ new_strong = -1;
1696
+ this_type = i === finish ? eor : this.types[i];
1697
+ switch (this_type) {
1698
+ case "L":
1699
+ new_strong = "L";
1700
+ break;
1701
+ case "R":
1702
+ case "AN":
1703
+ case "EN":
1704
+ new_strong = "R";
1705
+ break;
1706
+ case "BN":
1707
+ case "ON":
1708
+ case "S":
1709
+ case "B":
1710
+ case "WS":
1711
+ if (neutral_start === -1) {
1712
+ neutral_start = i;
1713
+ }
1714
+ }
1715
+ if (new_strong !== -1) {
1716
+ if (neutral_start !== -1) {
1717
+ override = prev_strong === new_strong ? prev_strong : embedding_direction;
1718
+ for (j = _k = neutral_start; neutral_start <= i ? _k < i : _k > i; j = neutral_start <= i ? ++_k : --_k) {
1719
+ this.types[j] = override;
1720
+ }
1721
+ }
1722
+ prev_strong = new_strong;
1723
+ neutral_start = -1;
1724
+ }
1725
+ }
1726
+ previous_level = level;
1727
+ }
1728
+ };
1729
+
1730
+ Bidi.prototype.reinsert_formatting_codes = function() {
1731
+ var index, input, left_level, len, next_fmt, output, right_level, _i, _ref;
1732
+ if ((this.formatter_indices != null) && this.formatter_indices.length > 0) {
1733
+ input = this.length;
1734
+ output = this.levels.length;
1735
+ for (index = _i = _ref = this.formatter_indices.length - 1; _ref <= 0 ? _i <= 0 : _i >= 0; index = _ref <= 0 ? ++_i : --_i) {
1736
+ next_fmt = this.formatter_indices[index];
1737
+ len = output - next_fmt - 1;
1738
+ output = next_fmt;
1739
+ input -= len;
1740
+ if (next_fmt + 1 < this.levels.length) {
1741
+ TwitterCldr.Utilities.arraycopy(this.levels, input, this.levels, next_fmt + 1, len);
1742
+ }
1743
+ right_level = output === this.levels.length - 1 ? this.base_embedding : this.levels[output + 1] != null ? this.levels[output + 1] : 0;
1744
+ left_level = input === 0 ? this.base_embedding : this.levels[input] != null ? this.levels[input] : 0;
1745
+ this.levels[output] = TwitterCldr.Utilities.max([left_level, right_level]);
1746
+ }
1747
+ }
1748
+ return this.length = this.levels.length;
1749
+ };
1750
+
1751
+ Bidi.prototype.run_bidi = function() {
1752
+ this.base_embedding = this.compute_paragraph_embedding_level();
1753
+ this.compute_explicit_levels();
1754
+ this.compute_runs();
1755
+ this.resolve_weak_types();
1756
+ this.resolve_neutral_types();
1757
+ this.resolve_implicit_levels();
1758
+ this.reinsert_formatting_codes();
1759
+ this.compute_runs();
1760
+ };
1761
+
1762
+ return Bidi;
1763
+
1764
+ })();
1765
+
1766
+ TwitterCldr.Calendar = (function() {
1767
+
1768
+ function Calendar() {}
1769
+
1770
+ Calendar.calendar = {"additional_formats":{"Ed":"E d","H":"HH","Hm":"HH:mm","Hms":"HH:mm:ss","M":"L","MEd":"E, M/d","MMM":"LLL","MMMEd":"E, MMM d","MMMMEd":"E, MMMM d","MMMMd":"MMMM d","MMMMdd":"dd MMMM","MMMd":"MMM d","Md":"M/d","d":"d","h":"h a","hm":"h:mm a","hms":"h:mm:ss a","ms":"mm:ss","y":"y","yM":"M/y","yMEd":"E, d/M/y","yMMM":"MMM y","yMMMEd":"E, d MMM y","yMMMM":"MMMM y","yMMMd":"d MMM y","yMd":"M/d/y","yQQQ":"QQQ y","yQQQQ":"QQQQ y"},"days":{"format":{"abbreviated":{"fri":"Vr","mon":"Ma","sat":"Sa","sun":"So","thu":"Do","tue":"Di","wed":"Wo"},"narrow":{"fri":"V","mon":"M","sat":"S","sun":"S","thu":"D","tue":"D","wed":"W"},"short":{"fri":"Vr.","mon":"Ma.","sat":"Sa.","sun":"So.","thu":"Do.","tue":"Di.","wed":"Wo."},"wide":{"fri":"Vrydag","mon":"Maandag","sat":"Saterdag","sun":"Sondag","thu":"Donderdag","tue":"Dinsdag","wed":"Woensdag"}},"stand-alone":{"abbreviated":{"fri":"Vr","mon":"Ma","sat":"Sa","sun":"So","thu":"Do","tue":"Di","wed":"Wo"},"narrow":{"fri":"V","mon":"M","sat":"S","sun":"S","thu":"D","tue":"D","wed":"W"},"short":{"fri":"Vr.","mon":"Ma.","sat":"Sa.","sun":"So.","thu":"Do.","tue":"Di.","wed":"Wo."},"wide":{"fri":"Vrydag","mon":"Maandag","sat":"Saterdag","sun":"Sondag","thu":"Donderdag","tue":"Dinsdag","wed":"Woensdag"}}},"eras":{"abbr":{"0":"v.C.","1":"n.C."},"name":{"0":"voor Christus","1":"na Christus"},"narrow":{"0":""}},"fields":{"day":"Dag","dayperiod":"AM/PM","era":"Era","hour":"Uur","minute":"Minuut","month":"Maand","second":"Sekonde","week":"Week","weekday":"Weeksdag","year":"Jaar","zone":"Tydsone"},"formats":{"date":{"default":{"pattern":"dd MMM y"},"full":{"pattern":"EEEE dd MMMM y"},"long":{"pattern":"dd MMMM y"},"medium":{"pattern":"dd MMM y"},"short":{"pattern":"yyyy-MM-dd"}},"datetime":{"default":{"pattern":"{{date}} {{time}}"},"full":{"pattern":"{{date}} {{time}}"},"long":{"pattern":"{{date}} {{time}}"},"medium":{"pattern":"{{date}} {{time}}"},"short":{"pattern":"{{date}} {{time}}"}},"time":{"default":{"pattern":"h:mm:ss a"},"full":{"pattern":"h:mm:ss a zzzz"},"long":{"pattern":"h:mm:ss a z"},"medium":{"pattern":"h:mm:ss a"},"short":{"pattern":"h:mm a"}}},"months":{"format":{"abbreviated":{"1":"Jan","10":"Okt","11":"Nov","12":"Des","2":"Feb","3":"Mar","4":"Apr","5":"Mei","6":"Jun","7":"Jul","8":"Aug","9":"Sep"},"narrow":{"1":"J","10":"O","11":"N","12":"D","2":"F","3":"M","4":"A","5":"M","6":"J","7":"J","8":"A","9":"S"},"wide":{"1":"Januarie","10":"Oktober","11":"November","12":"Desember","2":"Februarie","3":"Maart","4":"April","5":"Mei","6":"Junie","7":"Julie","8":"Augustus","9":"September"}},"stand-alone":{"abbreviated":{"1":"Jan","10":"Okt","11":"Nov","12":"Des","2":"Feb","3":"Mar","4":"Apr","5":"Mei","6":"Jun","7":"Jul","8":"Aug","9":"Sep"},"narrow":{"1":"J","10":"O","11":"N","12":"D","2":"F","3":"M","4":"A","5":"M","6":"J","7":"J","8":"A","9":"S"},"wide":{"1":"Januarie","10":"Oktober","11":"November","12":"Desember","2":"Februarie","3":"Maart","4":"April","5":"Mei","6":"Junie","7":"Julie","8":"Augustus","9":"September"}}},"periods":{"format":{"abbreviated":null,"narrow":null,"wide":{"am":"vm.","pm":"nm."}},"stand-alone":{}},"quarters":{"format":{"abbreviated":{"1":"K1","2":"K2","3":"K3","4":"K4"},"narrow":{"1":1,"2":2,"3":3,"4":4},"wide":{"1":"1ste kwartaal","2":"2de kwartaal","3":"3de kwartaal","4":"4de kwartaal"}},"stand-alone":{"abbreviated":{"1":"K1","2":"K2","3":"K3","4":"K4"},"narrow":{"1":1,"2":2,"3":3,"4":4},"wide":{"1":"1ste kwartaal","2":"2de kwartaal","3":"3de kwartaal","4":"4de kwartaal"}}}};
1771
+
1772
+ Calendar.months = function(options) {
1773
+ var key, result, root, val;
1774
+ if (options == null) {
1775
+ options = {};
1776
+ }
1777
+ root = this.get_root("months", options);
1778
+ result = [];
1779
+ for (key in root) {
1780
+ val = root[key];
1781
+ result[parseInt(key) - 1] = val;
1782
+ }
1783
+ return result;
1784
+ };
1785
+
1786
+ Calendar.weekdays = function(options) {
1787
+ if (options == null) {
1788
+ options = {};
1789
+ }
1790
+ return this.get_root("days", options);
1791
+ };
1792
+
1793
+ Calendar.get_root = function(key, options) {
1794
+ var format, names_form, root, _ref;
1795
+ if (options == null) {
1796
+ options = {};
1797
+ }
1798
+ root = this.calendar[key];
1799
+ names_form = options["names_form"] || "wide";
1800
+ format = options.format || ((root != null ? (_ref = root["stand-alone"]) != null ? _ref[names_form] : void 0 : void 0) != null ? "stand-alone" : "format");
1801
+ return root[format][names_form];
1802
+ };
1803
+
1804
+ return Calendar;
1805
+
1806
+ })();
1807
+
1808
+ root = typeof exports !== "undefined" && exports !== null ? exports : (this.TwitterCldr = {}, this.TwitterCldr);
1809
+
1810
+ for (key in TwitterCldr) {
1811
+ obj = TwitterCldr[key];
1812
+ root[key] = obj;
1813
+ }
1814
+
1815
+ }).call(this);